jiuyiUniapp/jiuyi2/pages/index/index.nvue

934 lines
22 KiB
Plaintext
Raw Normal View History

2024-12-18 15:46:27 +08:00
<script setup>
/**
* 首页 视频页
*/
import {
ref,
reactive,
getCurrentInstance,
computed,
nextTick,
} from 'vue';
import {
onLoad,
onReady,
onHide,
onShow,
onUnload,
} from '@dcloudio/uni-app'
// 工具库
import util from '@/common/js/util';
// api
import api from '@/api/index.js'
// 顶部状态栏
import statusBar from '@/components/header/statusBar.vue'
// 引入视频
import indexVideo from '@/components/index/indexVideo.vue'
// 底部菜单
import footerMneu from '@/components/footerMenu/footerMenu.vue'
// 计时闹钟弹窗
import timeAlt from '@/components/index/time.vue'
// 评论弹窗
import commentAlt from '@/components/index/commentArea.vue'
// 收藏弹窗
import collectAlt from '@/components/index/collect.vue'
// 分享到好友弹窗
import shareFirendAlt from '@/components/index/shareFirend.vue'
// 左侧菜单弹窗
import leftMenuAlt from "@/components/index/leftMenu.vue"
// 有效读秒唱片
import disc from '@/components/index/disc.vue'
// 长按更多菜单
import moreMenu from '@/components/index/moreMenu.vue'
2025-01-02 01:01:23 +08:00
// 快捷收藏
import fastCollect from '@/components/index/fastCollect.vue';
// 青少年模式
import teen from '@/components/index/teen.vue'
2025-02-15 08:59:41 +08:00
// 产品详情弹窗
import productAlt from '@/components/index/proDetailAlt.vue'
2025-02-15 16:10:05 +08:00
// 产品规格弹窗
import productSpecAlt from '@/components/shop/detail/makeOrder.vue'
2024-12-18 15:46:27 +08:00
const {
proxy
} = getCurrentInstance()
const dom = uni.requireNativePlugin('dom')
// 钟表提示弹窗
const oclockWindow = ref(false)
2025-01-03 18:11:02 +08:00
// 有效读秒
2024-12-18 15:46:27 +08:00
const readSecond = reactive({
// 定时器
timer: null,
})
// tab选项
const tab = reactive([
// {
// name: '同城',
// },
{
name: '关注',
load: false,
listData: () => attList.data,
getList: () => getAttList(),
getMoreList: () => getMoreAttList(),
refreshList: () => refreshAttList(),
},
{
name: '推荐',
load: false,
listData: () => recList.data,
getList: () => getRecList(),
getMoreList: () => getMoreRecList(),
refreshList: () => refreshRecList(),
},
])
// tab下标
2025-02-15 16:09:39 +08:00
const tabIndex = ref(1)
2024-12-18 15:46:27 +08:00
// 起始值
const startY = ref(0)
// 上一个播放索引
const currentLast = reactive([0, 0])
// 当前播放索引
const current = reactive([0, 0])
// 列表
const recList = reactive({
data: [],
pageNum: 1,
total: 0,
2025-02-28 13:09:49 +08:00
pageSize: 20,
2024-12-18 15:46:27 +08:00
})
// 关注的视频列表
const attList = reactive({
data: [],
2025-02-28 13:09:49 +08:00
pageSize: 20,
2024-12-18 15:46:27 +08:00
pageNum: 1,
total: 0,
timer: null,
})
// 容器高度 用来控制视频、遮罩等高度 用来解决nvue模式下没有100%高度的问题
2025-01-02 01:01:23 +08:00
const viewSize = reactive({
height: 0,
width: 0,
})
2024-12-18 15:46:27 +08:00
// 唱片顶部位置
const discOffsetTop = ref(0)
2025-01-04 01:44:11 +08:00
// 有效读秒顶部位置
const complete2Top = ref(0)
// 结束特效配置
const completeConfig = {
'complete1': {
time: 2,
},
'complete2': {
time: 1.5,
},
}
// 结束特效键 complete1优先任务特效 complete2有效读秒特效
const completeKey = ref('')
2024-12-18 15:46:27 +08:00
// 底部菜单高度
const footerMenuHeight = ref(0)
2025-02-15 16:10:05 +08:00
// 当前产品详情
const productDetail = reactive({})
2025-01-03 18:11:02 +08:00
// 当前任务
2025-01-16 20:18:22 +08:00
const task = computed(() => uni.$store.state.task)
2024-12-18 15:46:27 +08:00
// 用户信息
2025-01-13 21:59:03 +08:00
const userinfo = computed(() => uni.$store.state.userinfo || {})
2024-12-18 15:46:27 +08:00
// 当前tab选中
2025-01-16 20:18:22 +08:00
const tabCurrent = computed(() => tab[tabIndex.value])
2025-01-03 18:11:02 +08:00
// 当前视频元素对象
2025-01-16 20:18:22 +08:00
const currentVideoRef = computed(() => proxy.$refs[`videoRef${tabIndex.value}`][current[tabIndex.value]])
2025-01-05 15:43:14 +08:00
// 系统配置
2025-01-16 20:18:22 +08:00
const config = computed(() => uni.$store.state.config)
2024-12-18 15:46:27 +08:00
// 加载完成之后
onLoad(() => {
// 设备信息
const systemInfo = uni.getSystemInfoSync()
2025-02-09 21:32:55 +08:00
// 唱片高度
2025-01-02 01:01:23 +08:00
discOffsetTop.value = systemInfo.safeAreaInsets.top + 44 + 30
2025-02-09 21:32:55 +08:00
// 特效完成高度
2025-01-04 01:44:11 +08:00
complete2Top.value = systemInfo.safeAreaInsets.top + 44 + 150
2025-02-15 16:09:39 +08:00
// 获取列表
tabCurrent.value.getList()
2024-12-18 15:46:27 +08:00
// 判断是否提醒过闹铃
if (!uni.getStorageSync('alarmAlt')) {
setTimeout(() => {
oclockWindow.value = true
}, 1000)
}
2025-01-03 18:11:02 +08:00
//
util.getMyTask()
2024-12-18 15:46:27 +08:00
// 监听登录
2025-02-27 14:53:04 +08:00
// uni.$on('login', () => {
// // 获取列表
// tabCurrent.value.refreshList()
// })
2024-12-18 15:46:27 +08:00
// 监听登录
2025-02-27 14:53:04 +08:00
// uni.$on('logout', () => {
// // 获取列表
// tabCurrent.value.refreshList()
// })
2024-12-18 15:46:27 +08:00
// 视频数据被修改
uni.$on('updateVideo', (item) => {
// 校验
if (!item && !item.videoId) return
const list = tabCurrent.value.listData()
2025-01-13 00:25:06 +08:00
const findIndex = list.findIndex(node => node.id == item.id)
2024-12-18 15:46:27 +08:00
if (findIndex >= 0) list.splice(findIndex, 1, {
...tabCurrent.value.listData()[findIndex],
...item,
})
})
// 视频用户关注
uni.$on('focusUser', (param) => {
if (!param.userId) return
// 重载关注列表
2025-02-17 19:26:33 +08:00
if (tab[0].load) refreshAttList()
console.log(param)
2024-12-18 15:46:27 +08:00
// 切换推荐列表的关注状态
for (var index = 0; index < recList.data.length; i++) {
const item = recList.data[index]
if (item.userId == param.userId) {
item.isAttention = param.result
recList.data.splice(index, 1, item)
}
}
})
})
onReady(() => {
2025-01-04 01:44:11 +08:00
setTimeout(() => {
// 获取视频容器节点信息
dom.getComponentRect(proxy.$refs.containerRef[0], (option) => {
viewSize.height = option.size.height
viewSize.width = option.size.width
})
}, 50)
2025-02-15 08:59:41 +08:00
//
2025-02-15 16:10:05 +08:00
// proxy.$refs.productAltRef.init()
// handleProBuy({
// productId: 42,
// })
2024-12-18 15:46:27 +08:00
})
onShow(() => {
// 触发自定义tabbar函数
uni.$emit('changeMine', 'default')
})
onHide(() => {
2025-02-28 13:09:49 +08:00
// console.log('onHide', tabIndex.value, current, proxy.$refs)
const videoRefList = proxy.$refs[`videoRef${tabIndex.value}`]
2024-12-18 15:46:27 +08:00
// 暂停视频
2025-02-28 13:09:49 +08:00
if (videoRefList) {
2025-02-28 19:19:35 +08:00
videoRefList[videoRefList.length - 2].pause()
// videoRefList[current[tabIndex.value]].pause()
2025-01-05 19:13:08 +08:00
}
2024-12-18 15:46:27 +08:00
})
onUnload(() => {
uni.$off('login')
uni.$off('logout')
uni.$off('updateVideo')
uni.$off('focusUser')
})
// 重载关注列表
function refreshAttList() {
attList.pageNum = 1
attList.total = 0
getAttList()
}
// 获取更多关注列表
function getMoreAttList() {
if (attList.total <= attList.data.length) return
attList.pageNum++
getAttList()
}
// 获取关注列表
function getAttList() {
//
api.video.followVideo({
query: {
pageSize: attList.pageSize,
pageNum: attList.pageNum,
},
}).then(rs => {
2025-02-09 21:32:55 +08:00
handleListData(rs, attList)
2024-12-18 15:46:27 +08:00
})
}
// 重载推荐列表
function refreshRecList() {
2025-02-15 16:09:39 +08:00
console.log('refreshRecList')
2024-12-18 15:46:27 +08:00
recList.pageNum = 1
recList.total = 0
getRecList()
}
// 获取更多推荐视频
function getMoreRecList() {
if (recList.total <= recList.data.length) return
recList.pageNum++
getRecList()
}
// 获取推荐视频
function getRecList() {
2025-02-09 21:32:55 +08:00
console.log('getRecList')
2025-01-02 01:01:23 +08:00
// 获取首页分页视频
api.video.homeVideo({
query: {
2025-02-12 09:05:14 +08:00
userId: userinfo.value.id || 0,
2025-01-02 01:01:23 +08:00
pageNum: recList.pageNum,
pageSize: recList.pageSize,
}
}).then(rs => {
2025-02-15 16:09:39 +08:00
console.log('getRecList then')
2025-02-09 21:32:55 +08:00
handleListData(rs, recList)
2024-12-18 15:46:27 +08:00
})
}
2025-01-03 18:11:02 +08:00
/**
2025-02-09 21:32:55 +08:00
* 数据列表
* @param {Object} rs 接口返回数据
* @param {Object} obj 数据对象
2025-01-03 18:11:02 +08:00
*/
2025-02-09 21:32:55 +08:00
function handleListData(rs, obj) {
2025-01-03 18:11:02 +08:00
if (rs.code == 200) {
2025-02-09 21:32:55 +08:00
// 如果第一页
2025-01-03 18:11:02 +08:00
if (obj.pageNum == 1) obj.data.length = 0
2025-02-09 21:32:55 +08:00
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') {
2025-02-17 19:26:33 +08:00
proxy.$refs[`videoRef${tabIndex.value}`][current[tabIndex.value]].playState
.value =
2025-02-09 21:32:55 +08:00
false
proxy.$refs[`videoRef${tabIndex.value}`][current[tabIndex.value]].pause()
}
}, 500)
console.log('listdata final', rs, obj)
})
2025-01-03 18:11:02 +08:00
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
}
2025-01-04 01:44:11 +08:00
/**
* 观看视频记录
* @param {Object} element 记录的视频元素对象
*/
function browseLog(element) {
util.isLogin().then(rs => {
// if (readSecond.count == 0) return
const data = {
// 视频id
videoId: element.item.id,
// 有效读秒时间统计
viewingDuration: Math.floor(element.item.readSecond),
// 视频秒数
videoDescription: Math.floor(element.videoTime.currentTime),
//
task: 0,
}
2025-02-28 13:09:49 +08:00
// console.log('browseLog data', data)
2025-01-04 01:44:11 +08:00
//
api.video.browseLog({
data,
}).then(rs => {
if (rs.code == 200) {
// 计数
const result = rs.data
// 现在的有效读秒
const taskValue = task.value
2025-02-28 13:09:49 +08:00
// console.log('browseLog result', rs, taskValue)
2025-01-04 01:44:11 +08:00
2025-01-13 21:59:03 +08:00
// 如果不是第一次统计
if (taskValue.viewingDuration != 0) {
// 如果原来任务是优先任务 当前任务是有效读秒
if (taskValue.taskType == 0 && result.taskType == 1) {
// 优先任务完成 播放烟花动画
console.log('优先任务完成 播放烟花动画')
handleCompleteMode('complete1')
}
// 如果原来任务任务是有效读秒 并且新返回的数据小于当前的任务进度
else if (result.taskType == 1 && (result.viewingDuration < taskValue
.viewingDuration)) {
console.log('有效读秒完成 播放任务完成动画')
handleCompleteMode('complete2')
}
2025-01-04 01:44:11 +08:00
}
//
uni.$store.commit('setState', {
key: 'task',
value: result,
})
return
} else {
console.log('browseLog err', rs)
}
})
})
}
/**
* 触发完成特效
2025-01-05 19:13:08 +08:00
* @param {Object} mode ['complete1'|'complete2'] 需要触发的动画键
2025-01-04 01:44:11 +08:00
*/
function handleCompleteMode(mode) {
// 开启对应的特效
completeKey.value = mode
setTimeout(() => {
// 关闭特效
completeKey.value = ''
}, completeConfig[mode].time * 1000)
}
2025-01-03 18:11:02 +08:00
// 有效读秒增加
function readSecondAdd() {
clearInterval(readSecond.timer)
// 当前视频对象
const item = tab[tabIndex.value].listData()[current[tabIndex.value]]
// 开启计时器
readSecond.timer = setInterval(() => {
2025-01-04 01:44:11 +08:00
// 当前视频有效读秒 小于等于 最大有效读秒限制(视频最大时长-2s,设置的有效读秒上限)
2025-01-05 19:13:08 +08:00
if (item.readSecond < Math.min(Math.floor(item.videoDuration) - 2, config.value
.EFFECTIVE_VIDEO_TIME)) {
2025-01-03 18:11:02 +08:00
// 增加这条视频的有效读秒
item.readSecond++
} else {
2025-01-04 01:44:11 +08:00
// 暂停有效读秒的统计
readSecondPause()
2025-01-03 18:11:02 +08:00
}
}, 1000)
}
2025-01-04 01:44:11 +08:00
// 暂停有效读秒的统计
2025-01-03 18:11:02 +08:00
function readSecondPause() {
2025-01-04 01:44:11 +08:00
// 暂停唱片
2025-01-14 20:37:57 +08:00
proxy.$refs.discRef && proxy.$refs.discRef.pause()
2025-01-03 18:11:02 +08:00
clearInterval(readSecond.timer)
}
2024-12-18 15:46:27 +08:00
/**
* 触摸事件完成 滚动到当前位置
* @param {Number} target 滚动到下标的元素
*/
function scrollTo(target) {
// tab下标
const tab_index = tabIndex.value
// 当前cell对象
const element = proxy.$refs[`cellRef${tab_index}`][target]
// 上一个视频组件
const lastVideoRef = proxy.$refs[`videoRef${tab_index}`][currentLast[tab_index]]
// 滚动到对应位置
dom.scrollToElement(element, {
animated: true
})
2025-02-28 13:09:49 +08:00
console.log('current', current[tab_index])
2024-12-18 15:46:27 +08:00
// 如果视频切换
if (current[tab_index] != currentLast[tab_index]) {
// 停止当前有效读秒统计
readSecondPause()
// 浏览记录
browseLog(lastVideoRef)
2025-01-03 18:11:02 +08:00
// 开始记录
readSecondAdd()
2024-12-18 15:46:27 +08:00
}
}
/**
* 触摸开始
* @param {Object} ev 默认事件
* @param {Number} index 所在swiper滑块
*/
function onTouchstart(ev, index) {
Object.assign(currentLast, current)
startY.value = ev.changedTouches[0].screenY
}
/**
* 触摸结束
* @param {Object} ev 默认事件
* @param {Number} index 所在swiper滑块
*/
function onTouchend(ev, index) {
// 结束
const endY = ev.changedTouches[0].screenY
// 列表
const list = tabCurrent.value.listData()
if (!list[0]) return
// 根据滑动距离
if (endY - startY.value < -50) {
if (current[index] < list.length - 1) current[index]++
scrollTo(current[index])
} else if (endY - startY.value > 50) {
if (current[index] > 0) current[index]--
scrollTo(current[index])
} else if (endY - startY.value == 0) {
//
} else {
scrollTo(current[index])
}
}
/**
* 切换tab下标
* @param {Number} index 点击的item
*/
function handle_tab(index) {
2025-02-09 21:32:55 +08:00
// if (tabIndex.value === index) return
2024-12-18 15:46:27 +08:00
// 如果是关注 但是没有用户id
2025-02-08 18:25:43 +08:00
if (tab[index].name == '关注' && !userinfo.value.id) {
2024-12-18 15:46:27 +08:00
uni.navigateTo({
url: '/pages/login/loginPhone'
})
return
}
// 如果有
if (proxy.$refs[`videoRef${tabIndex.value}`]) {
// 上一个视频对象
const lastVideoRef = proxy.$refs[`videoRef${tabIndex.value}`][current[tabIndex.value]]
// 暂停当前播放的视频
lastVideoRef.pause()
// 停止当前有效读秒统计
readSecondPause()
// 浏览记录
browseLog(lastVideoRef)
// 清空累计继续计时
readSecond.total += readSecond.count
2025-01-03 18:11:02 +08:00
// 开始记录有效读秒
readSecondAdd()
2024-12-18 15:46:27 +08:00
}
tabIndex.value = index
// 根据是否加载过判断 播放还是获取
2025-01-02 01:01:23 +08:00
if (tabCurrent.value.load && proxy.$refs[`videoRef${index}`]) proxy.$refs[`videoRef${index}`][current[index]]
.play()
2025-02-09 21:32:55 +08:00
else tabCurrent.value.refreshList()
2024-12-18 15:46:27 +08:00
// 已加载
tab[tabIndex.value].load = true
}
// 打开计时闹钟弹窗
function handleShowTime() {
proxy.$refs.timeRef.open()
}
/**
* 打开评论弹窗
* @param {Object} item 当前列表项
*/
function handleShowCommentAlt(item) {
proxy.$refs.commentRef.open(item)
// 暂停当前视频
currentVideoRef.value.pause()
}
/**
* 打开收藏弹窗
* @param {Object} item 视频项下标
*/
function handleShowCollectAlt(item) {
proxy.$refs.collectRef.open(item)
}
2025-01-13 21:59:03 +08:00
/**
* 打开快速收藏弹窗
* @param {Object} ev 视频对象和节点位置信息
*/
function handleShowFastCollect(ev) {
proxy.$refs.fastCollectRef.open(ev)
}
2024-12-18 15:46:27 +08:00
/**
* 打开分享给好友弹窗
* @param {Object} item 当前列表项
*/
function handleShowShareFirend(item) {
proxy.$refs.shareFirendRef.open(item)
}
// 视频播放
function handleVideoOnPlay() {
if (proxy.$refs.discRef) proxy.$refs.discRef.play()
2025-01-03 18:11:02 +08:00
// 开始计时有效读秒
readSecondAdd()
2024-12-18 15:46:27 +08:00
}
// 视频暂停
function handleVideoOnPause() {
if (proxy.$refs.discRef) proxy.$refs.discRef.pause()
2025-02-12 17:03:02 +08:00
readSecondPause()
2024-12-18 15:46:27 +08:00
}
/**
* 视频点赞
* @param {Object} param 见下
* @param {Number} param.index 操作的视频下标
2025-01-25 21:43:01 +08:00
* @param {Number|String} param.isLike 0.点赞 1.取消点赞
2025-01-13 00:25:06 +08:00
* @param {Number|String} param.likeType 点赞类型 0.公开赞 1.隐私赞
2024-12-18 15:46:27 +08:00
*/
function videoLike(param) {
2025-01-07 23:13:56 +08:00
// 当前项
2025-01-13 00:25:06 +08:00
const item = tabCurrent.value.listData()[param.index]
const data = {
2025-01-25 21:43:01 +08:00
// 视频id
videoId: item.id,
// 点赞用户id
likeUserId: userinfo.value.id,
// 被点赞用户id
targetUserId: item.userId,
// 点赞类型 0.公开赞 1.隐私赞
likeType: param.likeType,
// //点赞 0.点赞 1.取消点赞
isLike: param.isLike,
}
2025-02-17 19:26:33 +08:00
2024-12-18 15:46:27 +08:00
//
2025-01-13 00:25:06 +08:00
api.video.videoLike({
data,
2024-12-18 15:46:27 +08:00
}).then(rs => {
if (rs.code == 200) {
2025-01-13 00:25:06 +08:00
uni.$emit('updateVideo', {
...item,
...rs.data,
})
2024-12-18 15:46:27 +08:00
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
// 设置闹铃
function setAlarm() {
oclockWindow.value = false
// 设置闹铃弹窗不再弹出
uni.setStorageSync('alarmAlt', true)
}
// 打开左侧菜单
function showLeftMenu() {
util.isLogin().then(rs => {
proxy.$refs.leftMenuRef.open()
}).catch(() => {
uni.navigateTo({
url: '/pages/login/loginPhone'
})
})
}
/**
* 修改当前视频播放速度
* @param {Object} item
*/
function handleSpeed(item) {
// 速度
const speed = item.value
//
const tab_index = tabIndex.value
// 修改视频倍速
proxy.$refs[`videoRef${tab_index}`][current[tab_index]].videoCtx().playbackRate(speed)
// 修改视频数据对象
tabCurrent.value.listData()[current[tab_index]].speed = speed
}
2025-01-02 01:01:23 +08:00
// 唤起闹铃
function showAlarm() {
proxy.$refs.timeRef.open()
2024-12-18 15:46:27 +08:00
}
2025-02-15 08:59:41 +08:00
/**
* 打开产品弹窗
* @param {Object} item 视频列表项
*/
function handleShowProduct(item) {
// 打开产品详情弹窗
proxy.$refs.productAltRef.init(item.productId)
}
2025-02-15 16:10:05 +08:00
/**
* 商品弹窗购买
* @param {Object} product
*/
function handleProductBuy(product) {
Object.assign(productDetail, {}, product)
//
proxy.$refs.productSpecAltRef.open()
}
/**
* 商品购买
* @param {Object} video 视频列表
*/
function handleProBuy(video) {
// 获取商品详情
api.shop.productDetail({
query: {
// 产品id
productionId: video.productId,
},
}).then(rs => {
if (rs.code == 200) {
//
handleProductBuy(rs.data)
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
/**
* 立即下单
*/
function handlePay(event) {
// 产生待付款订单
api.shop.addOrder({
data: [{
// 地址id
addressId: event.address.id,
// 产品id
productId: productDetail.id,
// 规格id
attrValueId: event.spec.id,
// 数量
payNum: event.payNum,
// 0-普通订单1-视频号订单
orderType: 1,
// 分享人id
// shareId: userinfo.id,
}],
}).then(rs => {
if (rs.code === 200) {
// 跳转
if (rs.data && rs.data[0]) uni.navigateTo({
url: util.setUrl('/pages/shop/commodity/payment', {
orderId: rs.data[0].orderId,
})
})
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
2024-12-18 15:46:27 +08:00
</script>
<template>
<!-- 页面内容 -->
<view class="page pr f1">
<!-- 顶部内容 -->
<view class="top pf t0 l0 r0">
<statusBar />
<view class="menu head fdr jcsa aic plr40">
<view class="sider" @click="showLeftMenu">
<image class="wh40" src="@/static/indexList.png" mode="aspectFit" />
</view>
<view class="f1">
<view class="tab fdr jcc" :key="tabIndex">
2025-01-02 01:01:23 +08:00
<view class="list" v-for="(item,index) in tab" :key="index"
:class="[{'active': index === tabIndex}]" @click.stop="handle_tab(index)">
2024-12-18 15:46:27 +08:00
<view class="txt">
<text class="text">{{item.name}}</text>
</view>
<view class="line"></view>
</view>
</view>
</view>
<navigator url="/pages/index/search" class="search">
<image class="wh65" src="@/static/indexSearch.png" mode="aspectFit" />
</navigator>
</view>
</view>
2025-01-04 01:44:11 +08:00
<!-- 优先任务结算 -->
<template v-if="completeKey == 'complete1'">
<image class="complete1" src="/static/complete1.gif" mode="aspectFit" />
</template>
<!-- 有效读秒结算 -->
<view class="complete2" :style="{top: complete2Top + 'px'}" v-if="completeKey == 'complete2'">
<image class="image" src="/static/complete2.gif" mode="aspectFit" />
</view>
2024-12-18 15:46:27 +08:00
<!-- 有效读秒唱片 -->
2025-01-02 01:01:23 +08:00
<view class="disc pf r0" :style="{top: discOffsetTop+'px'}" v-if="userinfo.id">
2024-12-18 15:46:27 +08:00
<disc ref="discRef" />
</view>
<template v-for="(item, index) in tab" :key="index">
2025-01-04 01:44:11 +08:00
<view class="container f1" v-if="tabIndex == index" ref="containerRef">
2024-12-18 15:46:27 +08:00
<!-- 主要内容区域 -->
2025-01-04 01:44:11 +08:00
<list class="listBox f1" :show-scrollbar="false" @touchstart="onTouchstart($event,index)"
2025-01-02 01:01:23 +08:00
@touchend="onTouchend($event,index)" @loadmore="item.getMoreList">
<cell class="cell" :style="[{height: viewSize.height + 'px'}]" :ref="`cellRef` + index"
2025-01-05 23:04:47 +08:00
v-for="(secItem,secIndex) in item.listData()" :key="secItem.id" @click.stop>
2025-02-28 19:19:35 +08:00
<template v-if="current[tabIndex] < secIndex + 2 && current[tabIndex] > secIndex - 2">
<!-- 视频 -->
<indexVideo :ref="'videoRef' + index" :tabIndex="index" :current="current[tabIndex]"
:width="viewSize.width" :height="viewSize.height" :item="secItem" :index="secIndex"
@showTime="handleShowTime" @showComment="handleShowCommentAlt"
@showCollect="handleShowCollectAlt" @showShareFirend="handleShowShareFirend"
@onPlay="handleVideoOnPlay" @onPause="handleVideoOnPause" @like="videoLike"
@longtap="$refs.moreMenuRef.open(secItem)" @showFastCollect="handleShowFastCollect"
@showProduct="handleShowProduct" @proBuy="handleProBuy" />
</template>
2024-12-18 15:46:27 +08:00
</cell>
</list>
</view>
</template>
<!-- 计时提示 -->
<view class="oclockHint pa pfull fmid" @touchstart.stop="" @click.stop="setAlarm" v-if="oclockWindow">
<image class="image" src="/static/indexOclock.png" mode="widthFix" />
</view>
<!-- 底部导航 -->
<footerMenu ref="footerMenuRef" page="index" subject="dark" />
</view>
2025-01-02 01:01:23 +08:00
<!-- 快捷收藏 -->
<fastCollect ref="fastCollectRef" />
<!-- 青少年模式 -->
2025-02-12 17:03:02 +08:00
<teen ref="teenRef" />
2024-12-18 15:46:27 +08:00
<!-- 长按菜单 -->
<moreMenu ref="moreMenuRef" @changeSpeed="handleSpeed" />
<!-- 闹钟弹窗 -->
<timeAlt ref="timeRef" />
<!-- 评论弹窗 -->
<commentAlt ref="commentRef" />
<!-- 收藏弹窗 -->
<collectAlt ref="collectRef" />
<!-- 分享到好友弹窗 -->
<shareFirendAlt ref="shareFirendRef" />
<!-- 左侧菜单弹窗 -->
<leftMenuAlt ref="leftMenuRef" />
2025-02-15 08:59:41 +08:00
<!-- 产品详情弹窗 -->
<productAlt ref="productAltRef" @buy="handleProductBuy" />
2025-02-15 16:10:05 +08:00
<!-- 产品立即下单弹窗 -->
<productSpecAlt ref="productSpecAltRef" :detail="productDetail" @confirm="handlePay" />
2024-12-18 15:46:27 +08:00
</template>
<style lang="scss" scoped>
//
.page {
background-color: #161616;
}
2025-01-04 01:44:11 +08:00
// 优先任务完成
.complete1 {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 10;
transform: translateY(100rpx);
}
// 有效读秒完成
.complete2 {
position: fixed;
justify-content: flex-end;
right: 30rpx;
z-index: 10;
//
.image {
width: 80rpx;
height: 80rpx;
}
}
2024-12-18 15:46:27 +08:00
// 顶部导航
.top {
z-index: 10;
}
// 分栏
.tab {
.list {
margin: 0 20rpx;
&.active {
.text {
color: #fff;
}
.line {
opacity: 1;
}
}
.text {
color: rgba(255, 255, 255, .7);
}
.line {
margin: 0 10rpx;
height: 5rpx;
background-color: #fff;
opacity: 0;
}
}
}
// 钟表提示
.oclockHint {
background-color: rgba(0, 0, 0, .3);
.image {
margin-top: 300rpx;
width: 750rpx;
}
}
// 唱片盒子
.disc {
margin-right: 20rpx;
}
</style>