From e7c729b71343b9f79e32d5e584f0f5eeb2f8033a Mon Sep 17 00:00:00 2001 From: lipenggao Date: Mon, 11 Mar 2024 15:53:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 3 +- pages/discover/discover.acss | 152 +++++++++++++++++++++++++-- pages/discover/discover.axml | 53 +++++++++- pages/discover/discover.js | 139 ++++++++++++++++++------ pages/discover/discover.json | 2 +- pages/recharge/recharge.acss | 126 ---------------------- pages/recharge/recharge.axml | 54 ---------- pages/recharge/recharge.js | 17 --- pages/recharge/recharge.json | 1 - pages/video/video.axml | 5 +- pages/video/video.js | 9 +- pages/videoAndroid/videoAndroid.axml | 17 +-- pages/videoAndroid/videoAndroid.js | 49 +++++---- utils/httpRequest.js | 4 +- 14 files changed, 346 insertions(+), 285 deletions(-) delete mode 100644 pages/recharge/recharge.acss delete mode 100644 pages/recharge/recharge.axml delete mode 100644 pages/recharge/recharge.js delete mode 100644 pages/recharge/recharge.json diff --git a/app.json b/app.json index cf3f036..7422584 100644 --- a/app.json +++ b/app.json @@ -10,7 +10,6 @@ "pages/give/give", "pages/purchaseNotes/purchaseNotes", "pages/video/video", - "pages/recharge/recharge", "pages/videoAndroid/videoAndroid" ], "plugins": { @@ -41,7 +40,7 @@ "activeIcon": "/static/tabbar/playlet_on.png" }, { - "name": "壁纸", + "name": "发现", "pagePath": "pages/discover/discover", "icon": "/static/tabbar/discover_off.png", "activeIcon": "/static/tabbar/discover_on.png" diff --git a/pages/discover/discover.acss b/pages/discover/discover.acss index 492ff24..abaaedb 100644 --- a/pages/discover/discover.acss +++ b/pages/discover/discover.acss @@ -1,16 +1,148 @@ + + +page { + background-color: #f5f5f5; +} + ._discover_list { - width: 100%; - padding: 30rpx; + padding: 30rpx 30rpx; + background-color: #f5f5f5; } -._discover_li_item { - width: 100%; - height: 800rpx; - margin-bottom: 30rpx; +._discover_list_item { + position: relative; + width: 100%; + height: 958rpx; + margin-bottom: 40rpx; + border-radius: 10rpx; + background: #fff; } -._discover_li_item ._it_img{ - display: block; - width: 100%; - height: 100%; +._discover_list_item:last-child { + margin-bottom: 0; +} + +._discover_li_it_cover { + position: absolute; + top:0; + left: 0; + width: 100%; + height: 720rpx; +} + +._discover_li_it_cover ._li_it_cover_img { + display: block; + width: 100%; + height: 100%; + border-radius: 10rpx 10rpx 0 0; +} + +._discover_li_it_play { + position: absolute; + top: 50%; + left: 50%; + display: flex; + justify-content: center; + align-items: center; + width: 100rpx; + height: 100rpx; + background-color: rgba(0, 0, 0, 0.45); + border-radius: 50%; + transform: translate(-50%,-50%); + border: 1rpx solid #fff; +} + +._li_it_play_icon { + width: 40rpx; + height: 40rpx; + margin-left: 4rpx; +} + +._li_it_play_icon .v_s_img { + display: block; + width: 100%; + height: 100%; +} + +._discover_li_it_info { + position: absolute; + bottom: 0; + left: 0; + width: 100%; + /* height: 258rpx; */ + height: 332rpx; + padding: 120rpx 20rpx 40rpx; + /* background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, #ffffff 22%); */ + background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #ffffff 30%); + /* box-shadow: 0 -80rpx 20rpx 0 rgba(255, 255, 255, 0.3); */ + /* margin-top: 60rpx; */ + border-radius: 0 0 10rpx 10rpx; +} + +._li_it_info_header { + display: flex; + justify-content: space-between; + align-items: center; + overflow: hidden; +} + +._info_header_title { + width: 60%; + line-height: 1; + font-size: 44rpx; + font-weight: 700; + color: #1a1a1a; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +._info_header_num { + display: flex; + align-items: center; +} + +._info_header_num_icon { + width: 36rpx; + height: 36rpx; +} + +.__num_icon_img { + display: block; + width: 100%; + height: 100%; +} + +._info__num_text { + margin-left: 8rpx; + font-size: 26rpx; + color: #666; +} + +._li_it_info_description { + font-size: 26rpx; + font-weight: 400; + color: #999999; + line-height: 56rpx; + margin-top: 16rpx; + text-overflow: ellipsis; + overflow: hidden; + word-break: break-all; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} + +._discover_footer { + display: flex; + justify-content: center; + align-items: center; + width: 100%; +} + +._discover_footer_loading { + margin-left: 16rpx; + font-size: 26rpx; + color: #999; + margin-top: -4rpx; } \ No newline at end of file diff --git a/pages/discover/discover.axml b/pages/discover/discover.axml index 58962eb..c61fcda 100644 --- a/pages/discover/discover.axml +++ b/pages/discover/discover.axml @@ -1,11 +1,54 @@ - - + + - - - + + + + + + + + + + + + + + {{item.name}} + + + + + + + + + + {{item.num}} + + + + + {{ item.description || '' }} + + + + + + + + + 加载中... + + + + + 我是有底线的哦~ + + + \ No newline at end of file diff --git a/pages/discover/discover.js b/pages/discover/discover.js index 1a8014b..f7b156b 100644 --- a/pages/discover/discover.js +++ b/pages/discover/discover.js @@ -1,45 +1,124 @@ + const { httpRequest } = getApp(); +import { imageBasUrl } from '../../utils/config' Page({ data: { - disvoverList: [], - page: 1 + discoverList: [], + noDataFlag: false, + page: 1, + imageBasUrl, }, - onShow() { - const page = this.data.page; - this.isWallpaper(page); - }, - isWallpaper(page) { - const disvoverList = this.data.disvoverList; + + getFindIndex(page, show, refresh) { + + const discoverList = this.data.discoverList; + + if (!show) { + my.showLoading({ + content: '加载中...', + }); + } + const paramenter = { - path: '/wallpaper', - method: 'GET', - params: { - page: page + path: '/findindex', + method: 'POST', + body: { + page } } + httpRequest(paramenter).then(res => { - console.log(res, "wallpaper") - if (res.status == 1) { - if (page == 1) { - this.setData({ - disvoverList: res.list, - }) - } else { - this.setData({ - disvoverList: [...disvoverList, ...res.list], - }) + my.hideLoading(); + if (refresh) { + my.stopPullDownRefresh(); + } + + if (res.status == 1 && Array.isArray(res.data.module1)) { + const module1 = res.data.module1; + let ls = []; + let noDataFlag = false; + if (module1.length == 0) { + noDataFlag = true; } + if (page == 1) { + ls = module1; + } else { + ls = [...discoverList, ...module1]; + } + this.setData({ + discoverList: ls, + page, + noDataFlag, + }) } }) }, - onReachBottom() { - // 页面被拉到底部 - console.log("========") - const page = this.data.page; - this.isWallpaper(page); - this.setData({ - page: page + 1 - }) + + onShow() { + this.getFindIndex(1) }, + + onReachBottom() { + const page = this.data.page; + const noDataFlag = this.data.noDataFlag; + if (!noDataFlag) { + this.getFindIndex(page + 1) + } + }, + + onPullDownRefresh() { + this.getFindIndex(1, false, true) + }, + + chaseCollection(ev) { + let params = {}; + const item = ev.currentTarget.dataset.item; + const idx = ev.currentTarget.dataset.idx; + const discoverList = this.data.discoverList; + if (item.collection === 0) { + params = { + path: '/addkeep', + method: 'POST', + body: { + sid: item.id + } + } + } else { + params = { + path: '/chasingdramadel', + method: 'POST', + body: { + ids: item.id, + sid: item.id + } + } + } + + discoverList[idx].collection = item.collection === 0 ? 1 : 0; + discoverList[idx].num = item.collection === 0 ? item.num + 1 : item.num - 1; + + httpRequest(params).then((res) => { + this.setData({ + discoverList + }) + }); + }, + + + toPathVideo(event) { + const data = event.target.dataset.item; + const systemInfo = getApp().globalData.systemInfo; + if (systemInfo.platform == 'android' || systemInfo.platform == 'Android') { + my.navigateTo({ + url: `/pages/videoAndroid/videoAndroid?sid=${data.id}`, + }); + } else { + my.navigateTo({ + url: `/pages/video/video?sid=${data.id}` + }); + } + }, + + }) \ No newline at end of file diff --git a/pages/discover/discover.json b/pages/discover/discover.json index 1137138..ed3a57d 100644 --- a/pages/discover/discover.json +++ b/pages/discover/discover.json @@ -1,3 +1,3 @@ { - "defaultTitle": "壁纸" + "pullRefresh": true } \ No newline at end of file diff --git a/pages/recharge/recharge.acss b/pages/recharge/recharge.acss deleted file mode 100644 index dce384c..0000000 --- a/pages/recharge/recharge.acss +++ /dev/null @@ -1,126 +0,0 @@ -._recharge_html { - flex: 1; - padding: 40rpx; - /* background-color: #fff; */ - padding-bottom: calc(140rpx + constant(safe-area-inset-bottom)); - padding-bottom: calc(140rpx + env(safe-area-inset-bottom)); -} - -._recharge_step_one { - padding: 20rpx; - background-color: #fff; - border-radius: 16rpx; -} - -._recharge_describe { - font-size: 28rpx; - color: #333; -} - -._recharge_balance { - display: flex; - margin-top: 20rpx; -} - -._recharge_balance_name { - font-size: 28rpx; - color: #333; -} - -._recharge_balance_num { - font-size: 28rpx; - font-weight: 500; - color: #333; -} - -._recharge_step_two { - padding: 20rpx 0 20rpx 20rpx; - background-color: #fff; - border-radius: 16rpx; - margin-top: 20rpx; -} - -._recharge_template_header { - padding-right: 20rpx; -} - -._recharge_te_he_name { - font-size: 32rpx; - color: #333; -} - -._recharge_template_list { - display: flex; - flex-wrap: wrap; -} - -._recharge_te_li_item { - width: 50%; - padding-right: 20rpx; - margin-top: 30rpx; -} - -._recharge_te_li_it_warp { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 200rpx; - background-color: #f9f9f9; - border-radius: 16rpx; - border: 2rpx solid transparent; -} - -._recharge_te_li_it_warp.active { - border-color: #EA6A4E; - background-color:rgba(245, 107, 95, 0.2) ; -} - -._re_amount_text { - font-size: 36rpx; - line-height: 1; - font-weight: 700; -} - -._re_amount_coin { - margin-top: 16rpx; - font-size: 26rpx; - color: #999; - line-height: 1; -} - -._re_amount_give { - margin-top: 16rpx; - font-size: 26rpx; - color: #999; - line-height: 1; -} - -._recharge_notice_text { - font-size: 26rpx; - color: #333; - line-height: 1.6; - margin-top: 16rpx; -} - -._recharge_btn_warp { - position: fixed; - left: 0; - bottom: 0; - width: 100%; - padding-bottom: constant(safe-area-inset-bottom); - padding-bottom: env(safe-area-inset-bottom); - background-color:#E94E41 ; -} - -._recharge_btn { - display: flex; - justify-content: center; - align-items: center; - width: 100%; - height: 100rpx; - background-color:#E94E41 ; - font-size: 28rpx; - color: #fff; -} \ No newline at end of file diff --git a/pages/recharge/recharge.axml b/pages/recharge/recharge.axml deleted file mode 100644 index 297da90..0000000 --- a/pages/recharge/recharge.axml +++ /dev/null @@ -1,54 +0,0 @@ - - - - 创作不易,支持作者 - - - - 我的K币: - - {{coinNum}} K币 - - - - - - - - 请选择充值金额 - - - - - - - - 199元 - 37621K币 - 多增送20元K币 - - - - - - - - - - - 购买须知 - - - 1、k币和会员属于虚拟产品,一经购买不可退换 - 2、未满18岁的未成年人需要在监护人主导、同意下进行相关付费操作。 - 3、{{userInfo.giftTime}} - 4、充值K币一般在10分钟内到账,如未到账请在“我的”页面联系客服 - - - - - 立即充值 - - - - \ No newline at end of file diff --git a/pages/recharge/recharge.js b/pages/recharge/recharge.js deleted file mode 100644 index 1b24734..0000000 --- a/pages/recharge/recharge.js +++ /dev/null @@ -1,17 +0,0 @@ -Page({ - data: { - coinNum: 0, - tempIndex: 0, - userInfo: {} - }, - onLoad(query) { - console.log('page onLoad', query) - }, - onShow() { }, - selectPayTem(ev) { - const idx = ev.target.dataset.idx; - this.setData({ - tempIndex: idx - }) - } -}) \ No newline at end of file diff --git a/pages/recharge/recharge.json b/pages/recharge/recharge.json deleted file mode 100644 index 9e26dfe..0000000 --- a/pages/recharge/recharge.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/pages/video/video.axml b/pages/video/video.axml index b82121a..96f4736 100644 --- a/pages/video/video.axml +++ b/pages/video/video.axml @@ -32,8 +32,9 @@ - 第 {{videoInfoObj.order}} 集 - 此剧为付费内容,您的K币不足 + 第 {{videoInfoObj.order}} 集,为付费内容 + + 解锁需要{{item.price}}K币,您的K币不足 支持创作作者,解锁后继续观看 立即充值 diff --git a/pages/video/video.js b/pages/video/video.js index 8b38456..83b4d1c 100644 --- a/pages/video/video.js +++ b/pages/video/video.js @@ -175,11 +175,7 @@ Page({ id: videoInfoObj.id, allprice: videoInfoObj.allprice }, - errObj: { - 2: { - showToastFlag: true - } - } + errShowT: true } httpRequest(paramVideo).then(res => { @@ -371,9 +367,6 @@ Page({ }, toPathPlayPage() { - // my.navigateTo({ - // url: '/pages/recharge/recharge' - // }); this.setData({ popupShow: true, }) diff --git a/pages/videoAndroid/videoAndroid.axml b/pages/videoAndroid/videoAndroid.axml index 7b370eb..278e31d 100644 --- a/pages/videoAndroid/videoAndroid.axml +++ b/pages/videoAndroid/videoAndroid.axml @@ -6,15 +6,16 @@ - + - - - + + {{currentTime}} - + {{videoDuration}} diff --git a/pages/videoAndroid/videoAndroid.js b/pages/videoAndroid/videoAndroid.js index 40ed9f4..c0a1f86 100644 --- a/pages/videoAndroid/videoAndroid.js +++ b/pages/videoAndroid/videoAndroid.js @@ -180,11 +180,7 @@ Page({ id: videoInfoObj.id, allprice: videoInfoObj.allprice }, - errObj: { - 2: { - showToastFlag: true - } - } + errShowT: true } httpRequest(paramVideo).then(res => { @@ -299,7 +295,32 @@ Page({ }) }, - onTouchEndControls() { + // onTouchEndControls() { + // const videoControlTimer = setTimeout(() => { + // const videoStatus = this.data.videoStatus; + // if (videoStatus == 2) { + // this.setData({ + // videoStatus: 1 + // }) + // } + // }, 3000); + + // this.setData({ + // videoControlTimer + // }) + // }, + + // onTouchStartControls() { + // const videoControlTimer = this.data.videoControlTimer; + // clearTimeout(videoControlTimer); + // }, + + videoSliderChange(ev) { + const sliderValue = ev.detail.value; + const item = ev.currentTarget.dataset.item; + const videoContext = my.createVideoContext(`myVideo_${item.order}`); + videoContext.seek(sliderValue); + const videoControlTimer = setTimeout(() => { const videoStatus = this.data.videoStatus; if (videoStatus == 2) { @@ -310,25 +331,16 @@ Page({ }, 3000); this.setData({ + sliderValue, videoControlTimer }) }, - onTouchStartControls() { + videoSliderChanging() { const videoControlTimer = this.data.videoControlTimer; clearTimeout(videoControlTimer); }, - videoSliderChange(ev) { - const sliderValue = ev.detail.value; - const item = ev.currentTarget.dataset.item; - const videoContext = my.createVideoContext(`myVideo_${item.order}`); - videoContext.seek(sliderValue); - this.setData({ - sliderValue - }) - }, - videoPlayPause(ev) { const item = ev.currentTarget.dataset.item; const videoControlTimer = this.data.videoControlTimer; @@ -492,9 +504,6 @@ Page({ }, toPathPlayPage() { - // my.navigateTo({ - // url: '/pages/recharge/recharge' - // }); this.setData({ popupShow: true, }) diff --git a/utils/httpRequest.js b/utils/httpRequest.js index 6508d09..9e129a5 100644 --- a/utils/httpRequest.js +++ b/utils/httpRequest.js @@ -6,7 +6,7 @@ cloud.init({ env: 'test' }); -const httpRequest = async ({ path, method = 'GET', params = {}, body = {}, exts = {}, errObj = {} }) => { +const httpRequest = async ({ path, method = 'GET', params = {}, body = {}, exts = {}, errShowT = false }) => { const dataUid = my.getStorageSync({ key: 'uid' }).data; let isBody = {}; @@ -58,7 +58,7 @@ const httpRequest = async ({ path, method = 'GET', params = {}, body = {}, exts return isResult; } if (isResult.status == 2) { - if (!errObj[isResult.status].showToastFlag) { + if (!errShowT) { my.showToast({ content: isResult.msg, duration: 3000,