From be80b22a4a0fcd33e1b17ebdb86eba91cc7de4d2 Mon Sep 17 00:00:00 2001 From: peng <peng.com> Date: 星期三, 02 七月 2025 18:59:06 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- pages/tabbar/index/home.vue | 57 +++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 49 insertions(+), 8 deletions(-) diff --git a/pages/tabbar/index/home.vue b/pages/tabbar/index/home.vue index 078a1bb..4589ccd 100644 --- a/pages/tabbar/index/home.vue +++ b/pages/tabbar/index/home.vue @@ -121,7 +121,7 @@ <!-- 瑙嗛淇℃伅灞� --> <view class="video-info" :style="{bottom: marginBottom + 20 + 'px'}"> <view> - <text class="video-author">@{{item.authorName}}</text> + <text class="video-author" @click="jumpToSearch">@{{item.authorName}}</text> </view> <view style="width: 100%;word-wrap: break-word;white-space: normal;overflow-wrap: break-word;"> <text class="video-title">{{item.title}}</text> @@ -129,7 +129,7 @@ </view> </view> - <!-- 鍙充晶浜掑姩鎸夐挳 --> + <!-- 鍙充晶浜掑姩鎸夐挳 --> <view class="action-buttons"> <view class="avatar-container"> <image class="avatar" @click="jumpToHomePage(item.authorId)" :src="item.authorAvatar" mode="aspectFill"></image> @@ -138,20 +138,24 @@ <text class="iconfont"></text> </view> </view> - <view class="action-item" @click="toggleCollect(item, index)"> - <text class="iconfont" v-if="item.collected"></text> + <view class="action-item" @click="toggleThumbsUp(item, index)"> + <text class="iconfont" v-if="item.thumbsUp"></text> <text class="iconfont" v-else></text> - <text style="font-size: 10px;font-weight: lighter;">{{item.collectNum}}</text> + <text style="font-size: 10px;font-weight: lighter;">{{item.thumbsUpNum}}</text> </view> <view class="action-item" @click="showComments(item)"> <text class="iconfont"></text> <text style="font-size: 10px;font-weight: lighter;">{{item.commentNum}}</text> </view> + <view class="action-item" @click="toggleCollect(item, index)"> + <text class="iconfont" v-if="item.collected"></text> + <text class="iconfont" v-else></text> + <text style="font-size: 10px;font-weight: lighter;">{{item.collectNum}}</text> + </view> <view class="action-item"> <button open-type="share" class="custom-share-btn" :data-obj="item"> <text class="iconfont"></text> </button> - </view> </view> @@ -243,7 +247,16 @@ </template> <script> -import { getRecommendVideos, savePlayRecord, subscribe, getVideoComments, addVideoComment, thubmsUpComment, cancelThubmsUpComment } from "@/api/video.js"; +import { + getRecommendVideos, + savePlayRecord, + subscribe, + getVideoComments, + addVideoComment, + thubmsUpComment, + cancelThubmsUpComment, + changeThumbsUp, +} from "@/api/video.js"; import { changeCollect } from "@/api/collect.js"; import { saveShare, saveShareClickRecord } from "@/api/share.js"; import { silentLogin } from "@/api/connect.js"; @@ -386,6 +399,12 @@ } }, methods: { + jumpToSearch() { + uni.navigateTo({ + url: '/pages/video/video-search' + }); + }, + // 鍒囨崲椤堕儴瀵艰埅鏍� topBarChange(titleObj) { if (titleObj.index === 'home') { uni.switchTab({ @@ -806,6 +825,28 @@ } }) }, + // 鐐硅禐/鍙栨秷鐐硅禐 + toggleThumbsUp(item, index) { + let data = { + refId: item.id, + thumbsUpType: 'video' + } + const beforeThumbsUp = item.thumbsUp + const beforeThumbsUpNum = item.thumbsUpNum + if(item.thumbsUp) { + this.videoList[index].thumbsUp = false + this.videoList[index].thumbsUpNum -= 1 + } else { + this.videoList[index].thumbsUp = true + this.videoList[index].thumbsUpNum += 1 + } + changeThumbsUp(data).then(res => { + if(res.data.code !== 200) { + this.videoList[index].thumbsUp = beforeThumbsUp + this.videoList[index].thumbsUpNum = beforeThumbsUpNum + } + }) + }, // 鍗曞嚮灞忓箷锛氭殏鍋滄垨缁х画鎾斁 togglePlay(index) { console.log("鍗曞嚮瑙嗛", index); @@ -1355,7 +1396,7 @@ .progress-text { margin-top: 10px; font-size: 14px; - color: #666; + color: #fff; } .swiper-box { width: 100%; -- Gitblit v1.8.0