直播间需要添加签到功能

This commit is contained in:
cbb
2026-01-13 17:56:19 +08:00
parent 06e026c8b8
commit c139fcf501
16 changed files with 313 additions and 171 deletions

View File

@@ -25,6 +25,7 @@ text-transform: none;`
const MAX_SCROLL = 446
const paging = ref(null)
const listLoading = ref(true)
const cbNavBar = ref({})
const dataList = ref([])
const topIcon = reactive({
@@ -54,24 +55,36 @@ text-transform: none;`
try {
const res = await getUserMomentsList({
pageNum,
pageSize
pageSize,
targetUserId: userInfo.value.userId
})
paging.value.complete(res.rows)
const list = res.rows.map(item => {
return {
...item,
commentList: item.comments
}
})
paging.value.complete(list)
listLoading.value = false
} catch (error) {
paging.value.complete(false)
}
}
const onLike = async item => {
await likeUserMoments(item.id)
// item.likeCount += 1
const res = await likeUserMoments(item.id)
if (res.data) {
item.likeCount += 1
} else {
item.likeCount -= 1
}
}
/** 点击查看大图 */
const onImage = current => {
const onImage = (urls, current = 0) => {
uni.previewImage({
urls: [current], // 图片路径数组(本地或网络)
current: current // 当前显示的图片(可选,默认为第一张)
urls, // 图片路径数组(本地或网络)
current // 当前显示的图片(可选,默认为第一张)
})
closeComment()
}
@@ -87,9 +100,11 @@ text-transform: none;`
console.log('发布评论')
const data = {
content: contentData.value,
id: item.id
id: item.id,
momentId: item.id
}
const res = await addUserMomentsComment(data)
item.commentList.push(res.data)
closeComment()
}
@@ -117,6 +132,7 @@ text-transform: none;`
safe-area-inset-bottom
use-safe-area-placeholder
:show-loading-more-no-more-view="false"
:auto="false"
@query="getData"
@scroll="onScroll"
>
@@ -146,39 +162,51 @@ text-transform: none;`
</template>
<view class="top-bg-img">
<image
:src="userInfo.avatar"
:src="userInfo?.avatar"
mode="aspectFill"
class="img"
@click="onImage(userInfo.avatar)"
@click="onImage([userInfo?.avatar])"
></image>
<!-- 用户信息 -->
<view class="user-info">
<text>{{ userInfo.userName }}</text>
<text>{{ userInfo?.userName }}</text>
<image
:src="userInfo.avatar"
:src="userInfo?.avatar"
mode="aspectFill"
class="avatar"
@click="onImage(userInfo.avatar)"
@click="onImage([userInfo?.avatar])"
></image>
</view>
</view>
<!-- 动态列表 -->
<view class="dynamic-list" @click="closeComment">
<view v-if="!listLoading" class="dynamic-list" @click="closeComment">
<view v-for="item in dataList" :key="item.id" class="list">
<image
src="https://img1.baidu.com/it/u=2645961124,1296922095&fm=253&app=138&f=JPEG?w=800&h=1530"
:src="item.avatar"
mode="aspectFill"
class="avatar"
></image>
<view class="content">
<text class="name">名字</text>
<text class="name">{{ item.userName }}</text>
<text class="text">{{ item.content }}</text>
<view class="img-list">
<view
v-if="item.images.length > 0"
:class="item.images.length === 1 ? 'one-img' : 'img-list'"
>
<image
src="https://p4.itc.cn/images01/20220619/46660ed163164c14be90e605a73ee5e8.jpeg"
v-for="(img, index) in item.images"
:key="index"
:src="img.imageUrl"
lazy-load
mode="aspectFill"
class="item-img"
@click="
onImage(
item.images.map(v => v.imageUrl),
index
)
"
></image>
</view>
<!-- 地址 -->
@@ -223,10 +251,14 @@ text-transform: none;`
<button @click.stop="onComment(item)">发布</button>
</view>
<!-- 评论内容 -->
<view class="comment">
<view v-for="item in 3" :key="item" class="comment-item">
<text>Admin:</text>
<text>确实的很好值得推荐的很好</text>
<view v-if="item.commentList.length > 0" class="comment">
<view
v-for="(c, i) in item.commentList"
:key="i"
class="comment-item"
>
<text>{{ c.userName }}:</text>
<text>{{ c.content }}</text>
</view>
</view>
</view>