合并代码

This commit is contained in:
sx 2025-02-09 21:32:55 +08:00
parent 35d0dde6c4
commit f8b2923b57
11 changed files with 103 additions and 76 deletions

View File

@ -85,7 +85,7 @@ const video = {
return util.request({ return util.request({
url: `/video/tag/add`, url: `/video/tag/add`,
// url: `/video/api/saveTags`, // url: `/video/api/saveTags`,
data: param.data, query: param.query,
method: 'POST', method: 'POST',
load: true, load: true,
}) })

View File

@ -6,9 +6,9 @@ const config = {
// host: 'h5api', // host: 'h5api',
// #endif // #endif
// #ifndef H5 // #ifndef H5
// host: 'http://91f.xyz:8080', host: 'http://91f.xyz:8080',
// host: 'http://bg8fnj.natappfree.cc', // host: 'http://ybfhhn.natappfree.cc',
host: 'http://79c97567.r24.cpolar.top', // host: 'http://hnjcg2.natappfree.cc',
// #endif // #endif
// 支付方式配置 // 支付方式配置
payType: { payType: {

View File

@ -213,7 +213,7 @@ const util = {
responseType: params.responseType || 'text', responseType: params.responseType || 'text',
// 请求成功返回 // 请求成功返回
success: res => { 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) { if (params.load) {
uni.hideLoading() uni.hideLoading()
@ -1426,7 +1426,7 @@ const util = {
uni.$emit('login') uni.$emit('login')
setTimeout(() => { setTimeout(() => {
uni.switchTab({ uni.reLaunch({
url: '/pages/index/index' url: '/pages/index/index'
}) })
}, 500) }, 500)

View File

@ -139,8 +139,12 @@
onLoad(() => { onLoad(() => {
// 设备信息 // 设备信息
const systemInfo = uni.getSystemInfoSync() const systemInfo = uni.getSystemInfoSync()
// 唱片高度
discOffsetTop.value = systemInfo.safeAreaInsets.top + 44 + 30 discOffsetTop.value = systemInfo.safeAreaInsets.top + 44 + 30
// 特效完成高度
complete2Top.value = systemInfo.safeAreaInsets.top + 44 + 150 complete2Top.value = systemInfo.safeAreaInsets.top + 44 + 150
// 获取列表
tabCurrent.value.getList()
// 判断是否提醒过闹铃 // 判断是否提醒过闹铃
if (!uni.getStorageSync('alarmAlt')) { if (!uni.getStorageSync('alarmAlt')) {
@ -149,16 +153,17 @@
}, 1000) }, 1000)
} }
// 获取列表
tabCurrent.value.getList()
// //
util.getMyTask() util.getMyTask()
// 监听登录 // 监听登录
uni.$on('login', () => { uni.$on('login', () => {
// 获取列表 recList.data.length = 0
tabCurrent.value.refreshList() attList.data.length = 0
nextTick(() => {
// 获取列表
tabCurrent.value.refreshList()
})
}) })
// 监听登录 // 监听登录
@ -247,13 +252,13 @@
pageNum: attList.pageNum, pageNum: attList.pageNum,
}, },
}).then(rs => { }).then(rs => {
// 设置数据列表 handleListData(rs, attList)
setList(rs, attList)
}) })
} }
// 重载推荐列表 // 重载推荐列表
function refreshRecList() { function refreshRecList() {
console.log('refreshRecList')
recList.pageNum = 1 recList.pageNum = 1
recList.total = 0 recList.total = 0
getRecList() getRecList()
@ -268,6 +273,7 @@
// 获取推荐视频 // 获取推荐视频
function getRecList() { function getRecList() {
console.log('getRecList')
// 获取首页分页视频 // 获取首页分页视频
api.video.homeVideo({ api.video.homeVideo({
query: { query: {
@ -275,48 +281,43 @@
pageSize: recList.pageSize, pageSize: recList.pageSize,
} }
}).then(rs => { }).then(rs => {
console.log('getRecList then rs', rs) console.log('getRecList then')
// 设置列表 handleListData(rs, recList)
setList(rs, recList)
}).catch(rs => {
console.log('getRecList', rs)
}) })
} }
/** /**
* 加载视频数据列表 * 数据列表
* @param {Object} rs 接口返回报文 * @param {Object} rs 接口返回数据
* @param {Object} obj 数据存放对象 * @param {Object} obj 数据对象
*/ */
function setList(rs, obj) { function handleListData(rs, obj) {
if (rs.code == 200) { 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 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)
// 如果有多的视频 并且当前数据为一条 nextTick(() => {
// if (obj.total > 1 && obj.data.length <= 1) getMoreRecList() // 总数
obj.total = rs.total
// 合并
obj.data.push(...rs.rows.map(item => {
// 初始播放时间
item.readSecond = 0
return item
}))
// 延时监听播放 // 延时监听播放
setTimeout(() => { setTimeout(() => {
const pages = getCurrentPages() const pages = getCurrentPages()
// 判断是否当前页 // 判断是否当前页
if (pages[pages.length - 1].route != 'pages/index/index') { 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]].playState.value =
proxy.$refs[`videoRef${tabIndex.value}`][current[tabIndex.value]].pause() false
} proxy.$refs[`videoRef${tabIndex.value}`][current[tabIndex.value]].pause()
}, 500) }
}, 500)
console.log('listdata final', rs, obj)
})
return return
} }
util.alert({ util.alert({
@ -494,7 +495,7 @@
* @param {Number} index 点击的item * @param {Number} index 点击的item
*/ */
function handle_tab(index) { function handle_tab(index) {
if (tabIndex.value === index) return // if (tabIndex.value === index) return
// 如果是关注 但是没有用户id // 如果是关注 但是没有用户id
if (tab[index].name == '关注' && !userinfo.value.id) { if (tab[index].name == '关注' && !userinfo.value.id) {
uni.navigateTo({ uni.navigateTo({
@ -522,7 +523,7 @@
// 根据是否加载过判断 播放还是获取 // 根据是否加载过判断 播放还是获取
if (tabCurrent.value.load && proxy.$refs[`videoRef${index}`]) proxy.$refs[`videoRef${index}`][current[index]] if (tabCurrent.value.load && proxy.$refs[`videoRef${index}`]) proxy.$refs[`videoRef${index}`][current[index]]
.play() .play()
else tabCurrent.value.getList() else tabCurrent.value.refreshList()
// 已加载 // 已加载
tab[tabIndex.value].load = true tab[tabIndex.value].load = true
} }

View File

@ -45,7 +45,7 @@
<image class="qr pmid" :src="qrData" mode="aspectFill" /> <image class="qr pmid" :src="qrData" mode="aspectFill" />
</view> </view>
<view class="button btn lg colourful mt60">推荐码 {{userinfo.userRecommend}}</view> <view class="button btn lg colourful mt60 plr30">推荐码 {{userinfo.invitationCode}}</view>
</view> </view>
</template> </template>
@ -65,6 +65,6 @@
// //
.button { .button {
width: 310rpx; min-width: 350rpx;
} }
</style> </style>

View File

@ -27,6 +27,8 @@
proxy proxy
} = getCurrentInstance() } = getCurrentInstance()
const store = useStore() const store = useStore()
//
const releasedList = ref([])
// //
const scrollLog = reactive({ const scrollLog = reactive({
data: [], data: [],
@ -216,7 +218,8 @@
<text v-else-if="item.type === 2">积分</text> <text v-else-if="item.type === 2">积分</text>
</view> </view>
</view> </view>
<view class="nomore" v-if="releasedList[0]"></view> <view class="nomore" v-if="releasedList[0]">暂无更多~</view>
<view class="nomore" v-if="!releasedList[0]">暂无内容~</view>
</scroll-view> </scroll-view>
</view> </view>
</view> </view>

View File

@ -171,7 +171,7 @@
} }
// //
function navigateToPage(path) { function link(path) {
uni.navigateTo({ uni.navigateTo({
url: path url: path
}); });
@ -198,12 +198,20 @@
function isAuth(url) { function isAuth(url) {
util.isAuth({ util.isAuth({
success() { success() {
uni.navigateTo({ menuLink(url)
url,
})
} }
}) })
} }
/**
* 菜单跳转
* @param {Object} url
*/
function menuLink(url) {
link(url)
//
proxy.$refs.menuRef.close()
}
</script> </script>
<template> <template>
@ -273,12 +281,12 @@
<view class="key ml10 c666 f24">隐私赞</view> <view class="key ml10 c666 f24">隐私赞</view>
</view> </view>
<view class="option" @click="navigateToPage('/pages/news/newAttention')"> <view class="option" @click="link('/pages/news/newAttention')">
<view class="value fmid f36 br10">{{userinfo.userAttention}}</view> <view class="value fmid f36 br10">{{userinfo.userAttention}}</view>
<view class="key ml10 c666 f24">关注</view> <view class="key ml10 c666 f24">关注</view>
</view> </view>
<view class="option" @click="navigateToPage('/pages/news/newFans')"> <view class="option" @click="link('/pages/news/newFans')">
<view class="value fmid f36 br10">{{userinfo.userFans}}</view> <view class="value fmid f36 br10">{{userinfo.userFans}}</view>
<view class="key ml10 c666 f24">粉丝</view> <view class="key ml10 c666 f24">粉丝</view>
</view> </view>
@ -288,7 +296,7 @@
<view class="rows mt30"> <view class="rows mt30">
<view class="desc f1 c333 f28">{{userinfo.personalSignature || '暂无个签~'}}</view> <view class="desc f1 c333 f28">{{userinfo.personalSignature || '暂无个签~'}}</view>
<view class="option" @click="navigateToPage('/pages/mine/myComment')"> <view class="option" @click="link('/pages/mine/myComment')">
<view class="value fmid f36 br10"> <view class="value fmid f36 br10">
<uni-icons type="chat" size="40rpx" /> <uni-icons type="chat" size="40rpx" />
</view> </view>
@ -355,18 +363,18 @@
<!-- 菜单列表 --> <!-- 菜单列表 -->
<view class="list mt30 c000 f32"> <view class="list mt30 c000 f32">
<navigator url="/pages/mine/setting/setting"> <view @click="menuLink('/pages/mine/setting/setting')">
<view class="item rows ptb20"> <view class="item rows ptb20">
<image class="wh50" src="/static/userMenu.png" mode="aspectFit" /> <image class="wh50" src="/static/userMenu.png" mode="aspectFit" />
<view class="txt ml20 f1">账户与安全</view> <view class="txt ml20 f1">账户与安全</view>
</view> </view>
</navigator> </view>
<navigator url="/pages/index/wallet"> <view @click="menuLink('/pages/index/wallet/wallet')">
<view class="item rows ptb20"> <view class="item rows ptb20">
<image class="wh50" src="/static/userMenu.png" mode="aspectFit" /> <image class="wh50" src="/static/userMenu.png" mode="aspectFit" />
<view class="txt ml20 f1">我的钱包</view> <view class="txt ml20 f1">我的钱包</view>
</view> </view>
</navigator> </view>
<!-- <view class="item rows ptb20"> <!-- <view class="item rows ptb20">
<image class="wh50" src="/static/userMenu.png" mode="aspectFit" /> <image class="wh50" src="/static/userMenu.png" mode="aspectFit" />
<view class="txt ml20 f1">我的客服</view> <view class="txt ml20 f1">我的客服</view>
@ -377,12 +385,12 @@
<view class="txt ml20 f1">我的分享</view> <view class="txt ml20 f1">我的分享</view>
</view> </view>
</view> </view>
<navigator url="/pages/mine/userinfo"> <view @click="menuLink('/pages/mine/userinfo')">
<view class="item rows ptb20"> <view class="item rows ptb20">
<image class="wh50" src="/static/userMenu.png" mode="aspectFit" /> <image class="wh50" src="/static/userMenu.png" mode="aspectFit" />
<view class="txt ml20 f1">个人资料</view> <view class="txt ml20 f1">个人资料</view>
</view> </view>
</navigator> </view>
</view> </view>
</view> </view>
<view class="btn cancel" @click="handleLogout">退出登录</view> <view class="btn cancel" @click="handleLogout">退出登录</view>

View File

@ -459,8 +459,9 @@
:class="[(item.From_Account || item.fromId) == userinfo.id ? 'self' : 'friend']"> :class="[(item.From_Account || item.fromId) == userinfo.id ? 'self' : 'friend']">
<!-- 如果是我自己 --> <!-- 如果是我自己 -->
<view> <view>
<image :src="item.callbackData.from_url" class="avatar" mode="widthFix" /> <image :src="item.callbackData.from_url" class="avatar wh80" mode="aspectFill" />
</view> </view>
<view class="df fdc mlr20"> <view class="df fdc mlr20">
<!-- 昵称 --> <!-- 昵称 -->
<view class="df fdc" v-if="item.from != userinfo.userId"> <view class="df fdc" v-if="item.from != userinfo.userId">

View File

@ -117,6 +117,16 @@
}) })
} }
//
function uploadSpecImage(item) {
util.upload_image({
type: 1,
success: rs => {
item.image = rs.value
}
})
}
/** /**
* 删除规格 * 删除规格
* @param {Object} index 下标 * @param {Object} index 下标
@ -135,13 +145,16 @@
}) })
} }
// /**
function uploadSpecImage(item) { * 移除图片
util.upload_image({ * @param {Object} index
type: 1, */
success: rs => { function removeImage(index) {
item.image = rs.value util.alert({
} content: '确认删除图片?',
}).then(rs => {
if (!rs.confirm) return
form.sliderImage.splice(index, 1)
}) })
} }

View File

@ -237,8 +237,9 @@
// //
function addLabel() { function addLabel() {
api.video.setLabel({ api.video.setLabel({
data: { query: {
tagName: labelKeyword.value, tagName: labelKeyword.value,
status: '1',
} }
}).then(rs => { }).then(rs => {
if (rs.code == 200) { if (rs.code == 200) {

View File

@ -3,9 +3,9 @@ import {
} from 'vite'; } from 'vite';
import uni from '@dcloudio/vite-plugin-uni'; import uni from '@dcloudio/vite-plugin-uni';
// let target = 'http://91f.xyz:8080' let target = 'http://91f.xyz:8080'
// let target = 'http://bg8fnj.natappfree.cc' // let target = 'http://ybfhhn.natappfree.cc'
let target = 'http://79c97567.r24.cpolar.top' // let target = 'http://hnjcg2.natappfree.cc'
export default defineConfig({ export default defineConfig({
plugins: [uni()], plugins: [uni()],