2025.02.28 工作代码提交

This commit is contained in:
sx 2025-02-28 19:19:35 +08:00
parent ff3913769c
commit 1fb340263b
6 changed files with 365 additions and 353 deletions

View File

@ -1,245 +1,245 @@
<script setup> <script setup>
/** /**
* 底部导航的规则 * 底部导航的规则
* 视频端显示 * 视频端显示
* 视频 商城 消息 我的(视频我的) * 视频 商城 消息 我的(视频我的)
* 商城端显示 * 商城端显示
* 视频 商城 消息 个人中心(商城我的) * 视频 商城 消息 个人中心(商城我的)
*/ */
import { import {
ref, ref,
computed, computed,
onMounted, onMounted,
onUnmounted, onUnmounted,
getCurrentInstance, getCurrentInstance,
reactive, reactive,
watch, watch,
} from 'vue' } from 'vue'
import { import {
onLoad, onLoad,
} from "@dcloudio/uni-app" } from "@dcloudio/uni-app"
// //
import util from '@/common/js/util'; import util from '@/common/js/util';
const { const {
proxy proxy
} = getCurrentInstance() } = getCurrentInstance()
// //
const props = defineProps({ const props = defineProps({
page: { page: {
type: String, type: String,
}, },
// dark light // dark light
subject: { subject: {
type: String, type: String,
default: 'light', default: 'light',
}, },
}) })
// //
const userinfo = computed(() => { const userinfo = computed(() => {
let resuilt = uni.$store.state.userinfo let resuilt = uni.$store.state.userinfo
return resuilt return resuilt
}) })
// shop default // shop default
const mode = computed(() => uni.$store.state.tabbarMode) const mode = computed(() => uni.$store.state.tabbarMode)
// //
const menu = computed(() => { const menu = computed(() => {
let arr = [{ let arr = [{
page: 'index', page: 'index',
type: 'option',
name: '视频',
labelType: 'default',
pagePath: 'pages/index/index',
},
// {
// page: '',
// type: 'option',
// name: '',
// pagePath: 'pages/index/durian',
// },
{
page: 'shop',
type: 'option',
name: '商城',
labelType: 'shop',
pagePath: 'pages/shop/shop'
},
{
type: 'middle',
name: '',
},
{
page: 'news',
type: 'option',
name: '消息',
pagePath: 'pages/news/news',
}
]
switch (mode.value) {
case 'default':
arr.push({
page: 'homepage',
type: 'option', type: 'option',
name: '我的', name: '视频',
labelType: 'default', labelType: 'default',
pagePath: 'pages/mine/homepage', pagePath: 'pages/index/index',
}) },
break; // {
case 'shop': // page: '',
arr.push({ // type: 'option',
page: 'mine', // name: '',
// pagePath: 'pages/index/durian',
// },
{
page: 'shop',
type: 'option', type: 'option',
name: '个人中心', name: '商城',
labelType: 'shop', labelType: 'shop',
pagePath: 'pages/mine/mine', pagePath: 'pages/shop/shop'
}) },
break; {
} type: 'middle',
return arr name: '',
}) },
// {
let safeHeight = ref(0) page: 'news',
type: 'option',
name: '消息',
pagePath: 'pages/news/news',
}
]
// switch (mode.value) {
const showMenu = computed(() => { case 'default':
let result = [] arr.push({
page: 'homepage',
// type: 'option',
if (userinfo.value.id) { name: '我的',
result.push({ labelType: 'default',
name: '发布视频', pagePath: 'pages/mine/homepage',
img: '/static/footerMenu1.png',
url: '/pages/release/video',
})
}
// 1
// if(userinfo.value.isShop == 1) {
// result.push({
// name: '',
// img: '/static/footerMenu1.png',
// url: '/pages/release/commodity',
// })
// }
//
// result.push({
// name: '',
// }, {
// name: '',
// }, {
// name: '',
// }, {
// name: '',
// }, {
// name: '',
// })
return result
})
//
const noReadNum = ref(0)
const getReadNum = () => {
getNoReadNum()
}
defineExpose({ getReadNum })
//
onMounted(() => {
//
addListener()
// tabbar
uni.hideTabBar()
//
uni.getSystemInfo().then(rs => {
safeHeight.value = rs.safeArea + 'px'
})
//
// proxy.$refs.alert.open()
})
onLoad(() => {
//
getNoReadNum()
})
//
onUnmounted(() => {
uni.$off('changeMine')
})
//
function addListener() {
//
uni.$on('changeMine', (value) => {
uni.$store.commit('setState', {
key: 'tabbarMode',
value,
})
})
}
/**
* 点击菜单
* @param {Object} item 当前点击的菜单项
*/
function handleMenu(item) {
if (item.type != 'middle') {
//
if (item.page) uni.switchTab({
url: `/${item.pagePath}`,
})
else uni.navigateTo({
url: `/${item.pagePath}`,
})
getNoReadNum()
return
}
//
proxy.$refs.alert.open()
}
/**
* 内容
* @param {Object} ev
*/
function handleAlert(ev) {
const index = ev.detail.index
const item = showMenu.value[index]
//
util.isAuth({
success: rs => {
//
if (item.url) {
uni.navigateTo({
url: item.url,
}) })
} else util.alert('敬请期待') break;
case 'shop':
arr.push({
page: 'mine',
type: 'option',
name: '个人中心',
labelType: 'shop',
pagePath: 'pages/mine/mine',
})
break;
} }
return arr
}) })
// //
proxy.$refs.alert.close() let safeHeight = ref(0)
}
// //
function getNoReadNum() { const showMenu = computed(() => {
if (userinfo.value.isRealName) { let result = []
// sdk
let isReady = uni.$chat.isReady(); //
if (!isReady) { if (userinfo.value.id) {
setTimeout(function () { result.push({
getNoReadNum(); name: '发布视频',
}, 800); img: '/static/footerMenu1.png',
url: '/pages/release/video',
})
}
// 1
// if(userinfo.value.isShop == 1) {
// result.push({
// name: '',
// img: '/static/footerMenu1.png',
// url: '/pages/release/commodity',
// })
// }
//
// result.push({
// name: '',
// }, {
// name: '',
// }, {
// name: '',
// }, {
// name: '',
// }, {
// name: '',
// })
return result
})
//
const noReadNum = ref(0)
const getReadNum = () => {
getNoReadNum()
}
//
onMounted(() => {
//
addListener()
// tabbar
uni.hideTabBar()
//
uni.getSystemInfo().then(rs => {
safeHeight.value = rs.safeArea + 'px'
})
//
getNoReadNum()
//
// proxy.$refs.alert.open()
})
//
onUnmounted(() => {
uni.$off('changeMine')
})
//
function addListener() {
//
uni.$on('changeMine', (value) => {
uni.$store.commit('setState', {
key: 'tabbarMode',
value,
})
})
}
/**
* 点击菜单
* @param {Object} item 当前点击的菜单项
*/
function handleMenu(item) {
if (item.type != 'middle') {
//
if (item.page) uni.switchTab({
url: `/${item.pagePath}`,
})
else uni.navigateTo({
url: `/${item.pagePath}`,
})
getNoReadNum()
return return
} }
//
// #ifdef APP proxy.$refs.alert.open()
const unreadCount = uni.$chat.getTotalUnreadMessageCount();
noReadNum.value = +unreadCount > 99 ? '99+' : unreadCount;
// #endif
} }
}
/**
* 内容
* @param {Object} ev
*/
function handleAlert(ev) {
const index = ev.detail.index
const item = showMenu.value[index]
//
util.isAuth({
success: rs => {
//
if (item.url) {
uni.navigateTo({
url: item.url,
})
} else util.alert('敬请期待')
}
})
//
proxy.$refs.alert.close()
}
//
function getNoReadNum() {
if (userinfo.value.isRealName) {
// sdk
let isReady = uni.$chat.isReady();
if (!isReady) {
setTimeout(function() {
getNoReadNum();
}, 800);
return
}
// #ifdef APP
const unreadCount = uni.$chat.getTotalUnreadMessageCount();
noReadNum.value = +unreadCount > 99 ? '99+' : unreadCount;
// #endif
}
}
defineExpose({
getReadNum
})
</script> </script>
<template> <template>
@ -252,9 +252,10 @@ function getNoReadNum() {
<view class="option" :class="{ active: item.page === page }" v-if="item.type == 'option'"> <view class="option" :class="{ active: item.page === page }" v-if="item.type == 'option'">
<text class="text">{{ item.name }}</text> <text class="text">{{ item.name }}</text>
<view class="pot" v-if="item.page == 'news' && noReadNum != 0">{{ noReadNum }}</view>
</view> </view>
<text class="pot" v-if="item.page == 'news' && noReadNum != 0">{{ noReadNum }}</text>
<view class="middle" v-else-if="item.type === 'middle'"> <view class="middle" v-else-if="item.type === 'middle'">
<image class="img" src="/static/footerMenuPlus.png" mode="aspectFit" v-if="subject == 'dark'" /> <image class="img" src="/static/footerMenuPlus.png" mode="aspectFit" v-if="subject == 'dark'" />
<image class="img" src="/static/footerMenuPlus1.png" mode="aspectFit" <image class="img" src="/static/footerMenuPlus1.png" mode="aspectFit"
@ -290,121 +291,129 @@ function getNoReadNum() {
</template> </template>
<style lang="scss"> <style lang="scss">
$boderSize: 2rpx; $boderSize: 2rpx;
// //
.ghost { .ghost {
height: 120rpx; height: 120rpx;
} }
// //
.menuBox { .menuBox {
position: fixed; position: fixed;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
/* #ifndef APP-NVUE */
box-sizing: border-box;
/* #endif */
.menu {
justify-content: space-between;
padding: 20rpx 0;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; box-sizing: border-box;
/* #endif */ /* #endif */
/* #ifdef APP-NVUE */
flex-direction: row;
/* #endif */
}
.item { .menu {
/* #ifndef APP-NVUE */ justify-content: space-between;
display: flex; padding: 20rpx 0;
/* #endif */
align-items: center;
justify-content: center;
flex: 1;
}
//
&.dark {
border-top: 1rpx solid #999;
background-color: #161616;
.active {
.text {
color: #fff;
}
}
.text {
color: #999;
}
}
//
&.light {
box-shadow: 0px 8px 20px rgba(0, 0, 0, .3);
background-color: #fff;
.active {
.text {
color: #333;
}
}
.text {
color: #999;
}
}
.option {
position: relative;
z-index: 1;
.pot {
position: absolute;
top: -16rpx;
right: -30rpx;
height: 24rpx;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
min-width: 24rpx; display: flex;
/* #endif */ /* #endif */
line-height: 24rpx; /* #ifdef APP-NVUE */
border-radius: 24rpx; flex-direction: row;
/* #endif */
}
.item {
/* #ifndef APP-NVUE */
position: relative;
display: flex;
/* #endif */
align-items: center;
justify-content: center;
flex: 1;
}
//
&.dark {
border-top: 1rpx solid #999;
background-color: #161616;
.active {
.text {
color: #fff;
}
}
.text {
color: #999;
}
}
//
&.light {
box-shadow: 0px 8px 20px rgba(0, 0, 0, .3);
background-color: #fff;
.active {
.text {
color: #333;
}
}
.text {
color: #999;
}
}
.option {
position: relative;
z-index: 1;
}
//
.pot {
/* #ifndef APP-NVUE */
display: flex;
flex-direction: column;
box-sizing: border-box;
/* #endif */
/* #ifdef APP-NVUE */
line-height: 28rpx;
/* #endif */
justify-content: center;
align-items: center;
position: absolute;
top: 5rpx;
right: 5rpx;
width: 28rpx;
height: 28rpx;
border-radius: 100rpx;
background: #FF6B17; background: #FF6B17;
color: #fff; color: #fff;
font-size: 20rpx; font-size: 20rpx;
padding: 4rpx;
text-align: center; text-align: center;
z-index: 11; z-index: 11;
} }
}
.middle { .middle {
.img { .img {
width: 80rpx; width: 80rpx;
height: 80rpx; height: 80rpx;
}
} }
} }
}
// //
.alert { .alert {
margin-bottom: 120rpx; margin-bottom: 120rpx;
background-color: #f8f8f8; background-color: #f8f8f8;
border-radius: 30rpx; border-radius: 30rpx;
// //
.scroll { .scroll {
height: 350rpx; height: 350rpx;
}
//
.itemBox {
// padding: 30rpx;
}
} }
//
.itemBox {
// padding: 30rpx;
}
}
</style> </style>

View File

@ -130,13 +130,11 @@
userId: userinfo.value.id, userId: userinfo.value.id,
// id // id
childrenParentId: reply.id || 0, childrenParentId: reply.id || 0,
} }
}).then(rs => { }).then(rs => {
console.log('saveComment', rs) console.log('saveComment', rs)
if (rs.code == 200) { if (rs.code == 200) {
proxy.$refs.comment.close() proxy.$refs.comment.close()
detail.comment++
// //
refreshList() refreshList()
setTimeout(() => { setTimeout(() => {
@ -144,7 +142,10 @@
content.value = '' content.value = ''
}, 500) }, 500)
// //
uni.$emit('updateVideo', detail) uni.$emit('updateVideo', {
...detail,
...rs.data,
})
return return
} }
util.alert({ util.alert({

View File

@ -386,11 +386,11 @@
*/ */
function handleLike(index, likeType, isLike) { function handleLike(index, likeType, isLike) {
util.isLogin().then(rs => { util.isLogin().then(rs => {
emit('like', { emit('like', {
index, index,
likeType, likeType,
isLike, isLike,
}) })
}).catch(() => { }).catch(() => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/login/loginPhone' url: '/pages/login/loginPhone'
@ -474,7 +474,7 @@
if (isLong.value) return if (isLong.value) return
play() play()
isLong.value = true isLong.value = true
videoCtx.value.playbackRate(2) videoCtx.value.playbackRate(1.5)
} }
// //
@ -509,6 +509,7 @@
<view class="main f1"> <view class="main f1">
<view class="videoBox f1" @touchmove.stop="" @touchstart="onTouchStart" @touchend="onTouchEnd" <view class="videoBox f1" @touchmove.stop="" @touchstart="onTouchStart" @touchend="onTouchEnd"
@touchcancel="onTouchCancel" @longpress="longtap"> @touchcancel="onTouchCancel" @longpress="longtap">
<statusBar /> <statusBar />
<!-- 视频 增加判断防止重复加载 --> <!-- 视频 增加判断防止重复加载 -->
@ -530,7 +531,7 @@
<!-- 倍速播放提示 --> <!-- 倍速播放提示 -->
<view class="speedBox" v-if="isLong"> <view class="speedBox" v-if="isLong">
<view class="speed ptb5 plr10"> <view class="speed ptb5 plr10">
<text class="f22 cfff">2倍速播放中...</text> <text class="f22 cfff">1.5倍速播放中...</text>
</view> </view>
</view> </view>
@ -587,7 +588,8 @@
<!-- 只有公开赞显示点赞数 --> <!-- 只有公开赞显示点赞数 -->
<view class="txt mt10"> <view class="txt mt10">
<text class="text" v-if="item.isLike == 0 && item.likeType == 0">{{ item.likeCount }}</text> <text class="text"
v-if="item.isLike == 0 && item.likeType == 0">{{ item.likeCount }}</text>
<text class="text" v-else-if="item.isLike == 0 && item.likeType == 1">隐私赞</text> <text class="text" v-else-if="item.isLike == 0 && item.likeType == 1">隐私赞</text>
<text class="text" v-else>点赞</text> <text class="text" v-else>点赞</text>
</view> </view>

View File

@ -53,7 +53,7 @@
function getDetail() { function getDetail() {
api.shop.productDetail({ api.shop.productDetail({
query: { query: {
userId: userinfo.value.id, userId: userinfo.value.id || '',
// id // id
productionId: proId.value productionId: proId.value
} }

View File

@ -360,7 +360,7 @@ function handleDate(timestamp) {
<view class="mark pa t0 r0 cfff f22 cir" v-if="item.unreadCount">{{ item.unreadCount }} <view class="mark pa t0 r0 cfff f22 cir" v-if="item.unreadCount">{{ item.unreadCount }}
</view> </view>
</view> </view>
<view class="col f1 ml20"> <view class="col oh f1 ml20">
<view class="rows"> <view class="rows">
<view class="name f1 thd c333 f32">{{ item.name }}</view> <view class="name f1 thd c333 f32">{{ item.name }}</view>
<view class="datetime c999 f22"> <view class="datetime c999 f22">

View File

@ -228,8 +228,8 @@
const videoRefList = proxy.$refs[`videoRef${tabIndex.value}`] const videoRefList = proxy.$refs[`videoRef${tabIndex.value}`]
// 暂停视频 // 暂停视频
if (videoRefList) { if (videoRefList) {
// videoRefList[videoRefList.length - 2].pause() videoRefList[videoRefList.length - 2].pause()
videoRefList[current[tabIndex.value]].pause() // videoRefList[current[tabIndex.value]].pause()
} }
}) })
@ -806,16 +806,16 @@
@touchend="onTouchend($event,index)" @loadmore="item.getMoreList"> @touchend="onTouchend($event,index)" @loadmore="item.getMoreList">
<cell class="cell" :style="[{height: viewSize.height + 'px'}]" :ref="`cellRef` + index" <cell class="cell" :style="[{height: viewSize.height + 'px'}]" :ref="`cellRef` + index"
v-for="(secItem,secIndex) in item.listData()" :key="secItem.id" @click.stop> v-for="(secItem,secIndex) in item.listData()" :key="secItem.id" @click.stop>
<!-- <template v-if="current[tabIndex] < secIndex + 2 && current[tabIndex] > secIndex - 2"> --> <template v-if="current[tabIndex] < secIndex + 2 && current[tabIndex] > secIndex - 2">
<!-- 视频 --> <!-- 视频 -->
<indexVideo :ref="'videoRef' + index" :tabIndex="index" :current="current[tabIndex]" <indexVideo :ref="'videoRef' + index" :tabIndex="index" :current="current[tabIndex]"
:width="viewSize.width" :height="viewSize.height" :item="secItem" :index="secIndex" :width="viewSize.width" :height="viewSize.height" :item="secItem" :index="secIndex"
@showTime="handleShowTime" @showComment="handleShowCommentAlt" @showTime="handleShowTime" @showComment="handleShowCommentAlt"
@showCollect="handleShowCollectAlt" @showShareFirend="handleShowShareFirend" @showCollect="handleShowCollectAlt" @showShareFirend="handleShowShareFirend"
@onPlay="handleVideoOnPlay" @onPause="handleVideoOnPause" @like="videoLike" @onPlay="handleVideoOnPlay" @onPause="handleVideoOnPause" @like="videoLike"
@longtap="$refs.moreMenuRef.open(secItem)" @showFastCollect="handleShowFastCollect" @longtap="$refs.moreMenuRef.open(secItem)" @showFastCollect="handleShowFastCollect"
@showProduct="handleShowProduct" @proBuy="handleProBuy" /> @showProduct="handleShowProduct" @proBuy="handleProBuy" />
<!-- </template> --> </template>
</cell> </cell>
</list> </list>
</view> </view>