From f8b2923b57fd862060f94da8f3c26013e7507a57 Mon Sep 17 00:00:00 2001 From: sx <2427911852@qq.com> Date: Sun, 9 Feb 2025 21:32:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jiuyi2/api/video.js | 2 +- jiuyi2/common/js/config.js | 6 +- jiuyi2/common/js/util.js | 4 +- jiuyi2/pages/index/index.nvue | 85 ++++++++++++++-------------- jiuyi2/pages/index/myQrCode.vue | 4 +- jiuyi2/pages/index/wallet/wallet.vue | 5 +- jiuyi2/pages/mine/homepage.vue | 34 ++++++----- jiuyi2/pages/news/chat/chat.vue | 3 +- jiuyi2/pages/release/commodity.vue | 27 ++++++--- jiuyi2/pages/release/video.vue | 3 +- jiuyi2/vite.config.js | 6 +- 11 files changed, 103 insertions(+), 76 deletions(-) diff --git a/jiuyi2/api/video.js b/jiuyi2/api/video.js index 5a78ac20..d2718d85 100644 --- a/jiuyi2/api/video.js +++ b/jiuyi2/api/video.js @@ -85,7 +85,7 @@ const video = { return util.request({ url: `/video/tag/add`, // url: `/video/api/saveTags`, - data: param.data, + query: param.query, method: 'POST', load: true, }) diff --git a/jiuyi2/common/js/config.js b/jiuyi2/common/js/config.js index c3ea7466..a9af306b 100644 --- a/jiuyi2/common/js/config.js +++ b/jiuyi2/common/js/config.js @@ -6,9 +6,9 @@ const config = { // host: 'h5api', // #endif // #ifndef H5 - // host: 'http://91f.xyz:8080', - // host: 'http://bg8fnj.natappfree.cc', - host: 'http://79c97567.r24.cpolar.top', + host: 'http://91f.xyz:8080', + // host: 'http://ybfhhn.natappfree.cc', + // host: 'http://hnjcg2.natappfree.cc', // #endif // 支付方式配置 payType: { diff --git a/jiuyi2/common/js/util.js b/jiuyi2/common/js/util.js index 9e431736..6f8e03a1 100644 --- a/jiuyi2/common/js/util.js +++ b/jiuyi2/common/js/util.js @@ -213,7 +213,7 @@ const util = { responseType: params.responseType || 'text', // 请求成功返回 success: res => { - console.log('request success', url, res, params.data ? params.data : '') + // console.log('request success', url, res, params.data ? params.data : '') // 关闭加载效果 if (params.load) { uni.hideLoading() @@ -1426,7 +1426,7 @@ const util = { uni.$emit('login') setTimeout(() => { - uni.switchTab({ + uni.reLaunch({ url: '/pages/index/index' }) }, 500) diff --git a/jiuyi2/pages/index/index.nvue b/jiuyi2/pages/index/index.nvue index 2cc3fb28..d47c4eea 100644 --- a/jiuyi2/pages/index/index.nvue +++ b/jiuyi2/pages/index/index.nvue @@ -139,8 +139,12 @@ onLoad(() => { // 设备信息 const systemInfo = uni.getSystemInfoSync() + // 唱片高度 discOffsetTop.value = systemInfo.safeAreaInsets.top + 44 + 30 + // 特效完成高度 complete2Top.value = systemInfo.safeAreaInsets.top + 44 + 150 + // 获取列表 + tabCurrent.value.getList() // 判断是否提醒过闹铃 if (!uni.getStorageSync('alarmAlt')) { @@ -149,16 +153,17 @@ }, 1000) } - // 获取列表 - tabCurrent.value.getList() - // util.getMyTask() // 监听登录 uni.$on('login', () => { - // 获取列表 - tabCurrent.value.refreshList() + recList.data.length = 0 + attList.data.length = 0 + nextTick(() => { + // 获取列表 + tabCurrent.value.refreshList() + }) }) // 监听登录 @@ -247,13 +252,13 @@ pageNum: attList.pageNum, }, }).then(rs => { - // 设置数据列表 - setList(rs, attList) + handleListData(rs, attList) }) } // 重载推荐列表 function refreshRecList() { + console.log('refreshRecList') recList.pageNum = 1 recList.total = 0 getRecList() @@ -268,6 +273,7 @@ // 获取推荐视频 function getRecList() { + console.log('getRecList') // 获取首页分页视频 api.video.homeVideo({ query: { @@ -275,48 +281,43 @@ pageSize: recList.pageSize, } }).then(rs => { - console.log('getRecList then rs', rs) - // 设置列表 - setList(rs, recList) - }).catch(rs => { - console.log('getRecList', rs) + console.log('getRecList then') + handleListData(rs, recList) }) } /** - * 加载视频数据列表 - * @param {Object} rs 接口返回报文 - * @param {Object} obj 数据存放对象 + * 数据列表 + * @param {Object} rs 接口返回数据 + * @param {Object} obj 数据对象 */ - function setList(rs, obj) { + function handleListData(rs, obj) { if (rs.code == 200) { - // 总数 - obj.total = rs.total - // 重新排序 - // const list = rs.rows.sort(() => Math.random() - Math.random()) - const list = rs.rows - // 第一页清空数据 + // 如果第一页 if (obj.pageNum == 1) obj.data.length = 0 - // 合并 - obj.data.push(...list.map(item => { - // 初始播放时间 - item.readSecond = 0 - return item - })) - // console.log('result', obj.data, rs) - // 如果有多的视频 并且当前数据为一条 - // if (obj.total > 1 && obj.data.length <= 1) getMoreRecList() + nextTick(() => { + // 总数 + obj.total = rs.total + // 合并 + obj.data.push(...rs.rows.map(item => { + // 初始播放时间 + item.readSecond = 0 + return item + })) - // 延时监听播放 - setTimeout(() => { - const pages = getCurrentPages() - // 判断是否当前页 - if (pages[pages.length - 1].route != 'pages/index/index') { - proxy.$refs[`videoRef${tabIndex.value}`][current[tabIndex.value]].playState.value = false - proxy.$refs[`videoRef${tabIndex.value}`][current[tabIndex.value]].pause() - } - }, 500) + // 延时监听播放 + setTimeout(() => { + const pages = getCurrentPages() + // 判断是否当前页 + if (pages[pages.length - 1].route != 'pages/index/index') { + proxy.$refs[`videoRef${tabIndex.value}`][current[tabIndex.value]].playState.value = + false + proxy.$refs[`videoRef${tabIndex.value}`][current[tabIndex.value]].pause() + } + }, 500) + console.log('listdata final', rs, obj) + }) return } util.alert({ @@ -494,7 +495,7 @@ * @param {Number} index 点击的item */ function handle_tab(index) { - if (tabIndex.value === index) return + // if (tabIndex.value === index) return // 如果是关注 但是没有用户id if (tab[index].name == '关注' && !userinfo.value.id) { uni.navigateTo({ @@ -522,7 +523,7 @@ // 根据是否加载过判断 播放还是获取 if (tabCurrent.value.load && proxy.$refs[`videoRef${index}`]) proxy.$refs[`videoRef${index}`][current[index]] .play() - else tabCurrent.value.getList() + else tabCurrent.value.refreshList() // 已加载 tab[tabIndex.value].load = true } diff --git a/jiuyi2/pages/index/myQrCode.vue b/jiuyi2/pages/index/myQrCode.vue index 479b020a..a5e15c78 100644 --- a/jiuyi2/pages/index/myQrCode.vue +++ b/jiuyi2/pages/index/myQrCode.vue @@ -45,7 +45,7 @@ - 推荐码: {{userinfo.userRecommend}} + 推荐码: {{userinfo.invitationCode}} @@ -65,6 +65,6 @@ // 按钮 .button { - width: 310rpx; + min-width: 350rpx; } \ No newline at end of file diff --git a/jiuyi2/pages/index/wallet/wallet.vue b/jiuyi2/pages/index/wallet/wallet.vue index 13adbc83..983cc257 100644 --- a/jiuyi2/pages/index/wallet/wallet.vue +++ b/jiuyi2/pages/index/wallet/wallet.vue @@ -27,6 +27,8 @@ proxy } = getCurrentInstance() const store = useStore() + // 待入帐列表 + const releasedList = ref([]) // 积分变动记录 const scrollLog = reactive({ data: [], @@ -216,7 +218,8 @@ 积分 - + 暂无更多~ + 暂无内容~ diff --git a/jiuyi2/pages/mine/homepage.vue b/jiuyi2/pages/mine/homepage.vue index 8966292e..da2a42cb 100644 --- a/jiuyi2/pages/mine/homepage.vue +++ b/jiuyi2/pages/mine/homepage.vue @@ -171,7 +171,7 @@ } // 跳转 - function navigateToPage(path) { + function link(path) { uni.navigateTo({ url: path }); @@ -198,12 +198,20 @@ function isAuth(url) { util.isAuth({ success() { - uni.navigateTo({ - url, - }) + menuLink(url) } }) } + + /** + * 菜单跳转 + * @param {Object} url + */ + function menuLink(url) { + link(url) + // 关闭弹窗 + proxy.$refs.menuRef.close() + }