合并代码

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({
url: `/video/tag/add`,
// url: `/video/api/saveTags`,
data: param.data,
query: param.query,
method: 'POST',
load: true,
})

View File

@ -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: {

View File

@ -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)

View File

@ -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
}

View File

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

View File

@ -27,6 +27,8 @@
proxy
} = getCurrentInstance()
const store = useStore()
//
const releasedList = ref([])
//
const scrollLog = reactive({
data: [],
@ -216,7 +218,8 @@
<text v-else-if="item.type === 2">积分</text>
</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>
</view>
</view>

View File

@ -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()
}
</script>
<template>
@ -273,12 +281,12 @@
<view class="key ml10 c666 f24">隐私赞</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="key ml10 c666 f24">关注</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="key ml10 c666 f24">粉丝</view>
</view>
@ -288,7 +296,7 @@
<view class="rows mt30">
<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">
<uni-icons type="chat" size="40rpx" />
</view>
@ -355,18 +363,18 @@
<!-- 菜单列表 -->
<view class="list mt30 c000 f32">
<navigator url="/pages/mine/setting/setting">
<view @click="menuLink('/pages/mine/setting/setting')">
<view class="item rows ptb20">
<image class="wh50" src="/static/userMenu.png" mode="aspectFit" />
<view class="txt ml20 f1">账户与安全</view>
</view>
</navigator>
<navigator url="/pages/index/wallet">
</view>
<view @click="menuLink('/pages/index/wallet/wallet')">
<view class="item rows ptb20">
<image class="wh50" src="/static/userMenu.png" mode="aspectFit" />
<view class="txt ml20 f1">我的钱包</view>
</view>
</navigator>
</view>
<!-- <view class="item rows ptb20">
<image class="wh50" src="/static/userMenu.png" mode="aspectFit" />
<view class="txt ml20 f1">我的客服</view>
@ -377,12 +385,12 @@
<view class="txt ml20 f1">我的分享</view>
</view>
</view>
<navigator url="/pages/mine/userinfo">
<view @click="menuLink('/pages/mine/userinfo')">
<view class="item rows ptb20">
<image class="wh50" src="/static/userMenu.png" mode="aspectFit" />
<view class="txt ml20 f1">个人资料</view>
</view>
</navigator>
</view>
</view>
</view>
<view class="btn cancel" @click="handleLogout">退出登录</view>

View File

@ -459,8 +459,9 @@
:class="[(item.From_Account || item.fromId) == userinfo.id ? 'self' : 'friend']">
<!-- 如果是我自己 -->
<view>
<image :src="item.callbackData.from_url" class="avatar" mode="widthFix" />
<image :src="item.callbackData.from_url" class="avatar wh80" mode="aspectFill" />
</view>
<view class="df fdc mlr20">
<!-- 昵称 -->
<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 下标
@ -135,13 +145,16 @@
})
}
//
function uploadSpecImage(item) {
util.upload_image({
type: 1,
success: rs => {
item.image = rs.value
}
/**
* 移除图片
* @param {Object} index
*/
function removeImage(index) {
util.alert({
content: '确认删除图片?',
}).then(rs => {
if (!rs.confirm) return
form.sliderImage.splice(index, 1)
})
}

View File

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

View File

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