116 lines
2.2 KiB
Vue
116 lines
2.2 KiB
Vue
<script setup>
|
||
// 我的评论
|
||
import {
|
||
ref,
|
||
reactive,
|
||
computed,
|
||
getCurrentInstance,
|
||
} from 'vue';
|
||
import {
|
||
onLoad,
|
||
onReady,
|
||
onUnload,
|
||
onPageScroll,
|
||
onReachBottom,
|
||
} from '@dcloudio/uni-app'
|
||
import {
|
||
useStore,
|
||
} from 'vuex'
|
||
import api from '@/api/index.js'
|
||
// 工具库
|
||
import util from '@/common/js/util';
|
||
|
||
// 仓库
|
||
const store = useStore()
|
||
// 数据列表
|
||
const list = reactive({
|
||
data: [],
|
||
pageSize: 20,
|
||
pageNum: 1,
|
||
total: 0,
|
||
})
|
||
// 用户信息
|
||
const userinfo = computed(() => {
|
||
let result = store.state.userinfo
|
||
return result
|
||
})
|
||
|
||
onLoad(() => {
|
||
getLst()
|
||
})
|
||
|
||
// 重载视频列表
|
||
function refreshVideoList() {
|
||
list.pageNum = 1
|
||
list.total = 0
|
||
getLst()
|
||
}
|
||
|
||
// 获取更多视频列表
|
||
function getMoreVideoList() {
|
||
if (list.data.length >= list.total) return
|
||
list.pageNum++
|
||
getLst()
|
||
}
|
||
|
||
// 获取我的评论
|
||
function getLst() {
|
||
api.mine.myComment({
|
||
query: {
|
||
userId: userinfo.value.id,
|
||
pageNum: list.pageNum,
|
||
pageSize: list.pageSize,
|
||
}
|
||
}).then(rs => {
|
||
if (rs.code == 200) {
|
||
if (list.pageNum) list.data.length = 0
|
||
// 追加视频列表
|
||
list.data.push(...rs.rows.map(item => {
|
||
return item
|
||
}))
|
||
// 视频列表
|
||
list.total = rs.total
|
||
console.log('list', list.data)
|
||
return
|
||
}
|
||
util.alert({
|
||
content: rs.msg,
|
||
showCancel: false,
|
||
})
|
||
}).finally(() => {
|
||
uni.stopPullDownRefresh()
|
||
})
|
||
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<view class="appbw">
|
||
<view class="listBox plr30 ">
|
||
<view class="list ptb30 plr10" v-for="(item,index) in 10" :key="index">
|
||
<view class="rows">
|
||
<view class="message">
|
||
<view class="title f32 c333">评论了 视频</view>
|
||
<view class="content t2hd mtb15 c333 f32">你的视频我很喜欢,关注你了,赶快出续集</view>
|
||
<view class="time mt15 f28 c999">2024.12.08 18:00</view>
|
||
</view>
|
||
<view class="image ml20">
|
||
<image class="wh120 br10" src="/static/openPage.png" mode="aspectFill" />
|
||
</view>
|
||
</view>
|
||
<view class=""></view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<style scoped lang="scss">
|
||
//
|
||
.listBox {
|
||
|
||
// 列表
|
||
.list+.list {
|
||
border-top: 2rpx solid #eee;
|
||
}
|
||
}
|
||
</style> |