From d3d0b4dbb4f1f8c4784c834e0a39feba8aa5afa5 Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期三, 02 七月 2025 10:41:08 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev
---
pages/kitchen/KitchenVideo.vue | 85 +++++++--
api/user.js | 14 +
api/video.js | 14 +
pages/health/healthVideo.vue | 73 ++++++--
pages/video/video-play.vue | 87 +++++++---
pages/tabbar/index/home.vue | 47 +++++
pages/video/home-page.vue | 126 ++++++++++++++-
7 files changed, 362 insertions(+), 84 deletions(-)
diff --git a/api/user.js b/api/user.js
index 627e334..133f094 100644
--- a/api/user.js
+++ b/api/user.js
@@ -50,6 +50,20 @@
}
/**
+ * 鑾峰彇瑙嗛涓婚〉-浣滆�呯偣璧炵殑瑙嗛鍒嗛〉
+ *
+ * @param params
+ */
+ export function getAuthorLikeVideoPage(params) {
+ return http.request({
+ url: "/lmk/video/author-like-video-page",
+ method: Method.GET,
+ needToken: true,
+ params: params
+ });
+}
+
+/**
* 淇濆瓨瑙嗛涓婚〉淇℃伅缂栬緫
*
* @param params
diff --git a/api/video.js b/api/video.js
index d3dddd1..926527f 100644
--- a/api/video.js
+++ b/api/video.js
@@ -236,3 +236,17 @@
needToken: true
});
}
+
+/**
+ * 鐐硅禐瑙嗛/鍙栨秷鐐硅禐
+ *
+ * @param params
+ */
+ export function changeThumbsUp(data) {
+ return http.request({
+ url: "/lmk/video/change/thumbs-up",
+ method: Method.POST,
+ data: data,
+ needToken: true
+ });
+}
diff --git a/pages/health/healthVideo.vue b/pages/health/healthVideo.vue
index f10e1e8..369fea2 100644
--- a/pages/health/healthVideo.vue
+++ b/pages/health/healthVideo.vue
@@ -129,30 +129,34 @@
</view>
</view>
- <!-- 鍙充晶浜掑姩鎸夐挳 -->
+ <!-- 鍙充晶浜掑姩鎸夐挳 -->
<view class="action-buttons" v-if="false">
- <view class="avatar-container">
- <image class="avatar" @click="jumpToHomePage(item.authorId)" :src="item.authorAvatar" mode="aspectFill"></image>
- <!-- 鍏虫敞鍥炬爣 - 浣跨敤缁濆瀹氫綅 -->
- <view v-if="!item.subscribeThisAuthor" class="follow-icon" @click="subscribeAuth(index, item.authorId)">
- <text class="iconfont"></text>
- </view>
- </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 class="avatar-container">
+ <image class="avatar" @click="jumpToHomePage(item.authorId)" :src="item.authorAvatar" mode="aspectFill"></image>
+ <!-- 鍏虫敞鍥炬爣 - 浣跨敤缁濆瀹氫綅 -->
+ <view v-if="!item.subscribeThisAuthor" class="follow-icon" @click="subscribeAuth(index, item.authorId)">
+ <text class="iconfont"></text>
+ </view>
+ </view>
+ <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.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">
- <button open-type="share" class="custom-share-btn" :data-obj="item">
- <text class="iconfont"></text>
- </button>
-
- </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>
</swiper-item>
@@ -244,7 +248,16 @@
<script>
import TopBar from "@/components/TopBar.vue";
-import { getHealthRecommendVideos, savePlayRecord, subscribe, getVideoComments, addVideoComment, thubmsUpComment, cancelThubmsUpComment } from "@/api/video.js";
+import {
+ getHealthRecommendVideos,
+ 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";
@@ -805,6 +818,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);
diff --git a/pages/kitchen/KitchenVideo.vue b/pages/kitchen/KitchenVideo.vue
index 43b3432..8bafd83 100644
--- a/pages/kitchen/KitchenVideo.vue
+++ b/pages/kitchen/KitchenVideo.vue
@@ -134,29 +134,33 @@
<!-- 鍙充晶浜掑姩鎸夐挳 -->
<view class="action-buttons" v-if="false">
- <view class="avatar-container">
- <image class="avatar" @click="jumpToHomePage(item.authorId)" :src="item.authorAvatar" mode="aspectFill"></image>
- <!-- 鍏虫敞鍥炬爣 - 浣跨敤缁濆瀹氫綅 -->
- <view v-if="!item.subscribeThisAuthor" class="follow-icon" @click="subscribeAuth(index, item.authorId)">
- <text class="iconfont"></text>
- </view>
- </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="avatar-container">
+ <image class="avatar" @click="jumpToHomePage(item.authorId)" :src="item.authorAvatar" mode="aspectFill"></image>
+ <!-- 鍏虫敞鍥炬爣 - 浣跨敤缁濆瀹氫綅 -->
+ <view v-if="!item.subscribeThisAuthor" class="follow-icon" @click="subscribeAuth(index, item.authorId)">
+ <text class="iconfont"></text>
+ </view>
+ </view>
+ <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.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">
- <button open-type="share" class="custom-share-btn" :data-obj="item">
- <text class="iconfont"></text>
- </button>
-
- </view>
- </view>
+ <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>
</swiper-item>
</swiper>
@@ -262,7 +266,8 @@
getVideoComments,
addVideoComment,
thubmsUpComment,
- cancelThubmsUpComment
+ cancelThubmsUpComment,
+ changeThumbsUp
} from "@/api/video.js";
import {
changeCollect
@@ -776,6 +781,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);
@@ -1423,4 +1450,16 @@
background-color: lightpink !important;
}
+
+.custom-share-btn {
+ font-size: unset;
+ background: none;
+ padding: 0;
+ margin: 0;
+ line-height: normal;
+ border: none;
+}
+.custom-share-btn::after {
+ border: none;
+}
</style>
diff --git a/pages/tabbar/index/home.vue b/pages/tabbar/index/home.vue
index 3f1ecb8..87916dc 100644
--- a/pages/tabbar/index/home.vue
+++ b/pages/tabbar/index/home.vue
@@ -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";
@@ -806,6 +819,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);
diff --git a/pages/video/home-page.vue b/pages/video/home-page.vue
index 4aebb07..b9a7b49 100644
--- a/pages/video/home-page.vue
+++ b/pages/video/home-page.vue
@@ -52,11 +52,18 @@
</view>
<view
class="tab-item"
- :class="{active: currentTab === 'likes'}"
- @click="switchTab('likes')"
+ :class="{active: currentTab === 'collect'}"
+ @click="switchTab('collect')"
>
- 鍠滄
+ 鏀惰棌
</view>
+ <view
+ class="tab-item"
+ :class="{active: currentTab === 'likes'}"
+ @click="switchTab('likes')"
+ >
+ 鍠滄
+ </view>
</view>
<!-- 瑙嗛鍒楄〃 -->
@@ -88,13 +95,33 @@
</view>
</view>
</scroll-view>
- <scroll-view class="video-list" scroll-y :show-scrollbar="false" @scrolltolower="getPage" v-show="currentTab === 'likes' && collectVideoList.length > 0">
+ <scroll-view class="video-list" scroll-y :show-scrollbar="false" @scrolltolower="getPage" v-show="currentTab === 'collect' && collectVideoList.length > 0">
<view class="video-container">
<view
class="video-item"
v-for="(item, index) in collectVideoList"
:key="item.id"
@click="playCollectVideo(index)"
+ >
+ <image class="video-cover" :src="item.videoContentType === 'video' ? item.coverUrl : item.imgs[0]" mode="aspectFill"></image>
+ <view class="video-info">
+ <view class="video-stats">
+ <view class="stat">
+ <uni-icons type="heart" size="16" color="#fff"></uni-icons>
+ <text>{{item.collectNum}}</text>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </scroll-view>
+ <scroll-view class="video-list" scroll-y :show-scrollbar="false" @scrolltolower="getPage" v-show="currentTab === 'likes' && likeVideoList.length > 0">
+ <view class="video-container">
+ <view
+ class="video-item"
+ v-for="(item, index) in likeVideoList"
+ :key="item.id"
+ @click="playLikeVideo(index)"
>
<image class="video-cover" :src="item.videoContentType === 'video' ? item.coverUrl : item.imgs[0]" mode="aspectFill"></image>
<view class="video-info">
@@ -115,7 +142,12 @@
<text class="empty-text">杩樻湭鍙戝竷浣滃搧鍝</text>
</view>
<!-- 绌虹姸鎬� -->
- <view class="empty-state" v-if="collectVideoList.length === 0 && currentTab === 'likes'">
+ <view class="empty-state" v-if="collectVideoList.length === 0 && currentTab === 'collect'">
+ <!-- <image src="/static/images/empty.png" mode="aspectFit" class="empty-image"></image> -->
+ <text class="empty-text">杩樻病鏈夋敹钘忎綔鍝佸摝~</text>
+ </view>
+ <!-- 绌虹姸鎬� -->
+ <view class="empty-state" v-if="likeVideoList.length === 0 && currentTab === 'likes'">
<!-- <image src="/static/images/empty.png" mode="aspectFit" class="empty-image"></image> -->
<text class="empty-text">杩樻病鏈夌偣璧炰綔鍝佸摝~</text>
</view>
@@ -137,7 +169,7 @@
<script>
import DropdownMenu from '@/components/dropdown-menu.vue'
-import {getAuthorInfo, getAuthorVideoPage, getAuthorCollectVideoPage} from '@/api/user.js'
+import {getAuthorInfo, getAuthorVideoPage, getAuthorCollectVideoPage, getAuthorLikeVideoPage} from '@/api/user.js'
import {subscribe, unSubscribe, delVideo, updateVideo, userDownVideo} from '@/api/video.js'
export default {
components: {DropdownMenu},
@@ -175,15 +207,35 @@
pageNumber: 1,
pageSize: 10
},
+ likeVideoQuery: {
+ authorId: '',
+ pageNumber: 1,
+ pageSize: 10
+ },
videoTotal: 0,
videoList: [], // 浣滃搧
collectVideoList: [], // 鏀惰棌
+ likeVideoList: [], // 鐐硅禐
nomoreVideo: false,
- nomoreCollectVideo: false
+ nomoreCollectVideo: false,
+ nomoreLikeVideo: false,
}
},
onShow() {
this.getAuthorInfo();
+ if (this.currentTab === 'works') {
+ this.videoQuery.pageNumber = 1
+ this.nomoreVideo = false
+ this.getAuthorVideoPage();
+ } else if (this.currentTab === 'collect') {
+ this.collectVideoQuery.pageNumber = 1
+ this.nomoreCollectVideo = false
+ this.getAuthorCollectVideoPage()
+ } else if (this.currentTab === 'likes') {
+ this.likeVideoQuery.pageNumber = 1
+ this.nomoreLikeVideo = false
+ this.getAuthorLikeVideoPage()
+ }
},
onLoad(option) {
this.authorId = option.authorId;
@@ -261,7 +313,7 @@
this.videoQuery.pageNumber += 1;
}
})
- } else if(this.currentTab === 'likes') {
+ } else if(this.currentTab === 'collect') {
if(this.nomoreCollectVideo) {
return;
}
@@ -280,6 +332,27 @@
this.nomoreCollectVideo = true;
} else {
this.collectVideoQuery.pageNumber += 1;
+ }
+ })
+ } else if(this.currentTab === 'likes') {
+ if(this.nomoreLikeVideo) {
+ return;
+ }
+ getAuthorLikeVideoPage(this.likeVideoQuery).then(res => {
+ if(this.likeVideoQuery.pageNumber === 1) {
+ this.likeVideoList = res.data.data
+ } else {
+ this.likeVideoList = [
+ ...this.likeVideoList,
+ ...res.data.data.filter(
+ (newItem) => !this.likeVideoList.some((oldItem) => oldItem.id === newItem.id)
+ ),
+ ];
+ }
+ if(res.data.data.length < this.likeVideoQuery.pageSize) {
+ this.nomoreLikeVideo = true;
+ } else {
+ this.likeVideoQuery.pageNumber += 1;
}
})
}
@@ -333,14 +406,34 @@
this.currentTab = tab;
if(tab === 'works') {
this.collectVideoList = []
+ this.likeVideoList = []
this.videoQuery.pageNumber = 1
+ this.nomoreVideo = false
this.getAuthorVideoPage()
+ } else if(tab === 'collect') {
+ this.videoList = []
+ this.likeVideoList = []
+ this.collectVideoQuery.pageNumber = 1
+ this.nomoreCollectVideo = false
+ this.getAuthorCollectVideoPage()
} else if(tab === 'likes') {
this.videoList = []
- this.collectVideoQuery.pageNumber = 1
- this.getAuthorCollectVideoPage()
+ this.collectVideoList = []
+ this.likeVideoQuery.pageNumber = 1
+ this.nomoreLikeVideo = false
+ this.getAuthorLikeVideoPage()
}
},
+ // 鑾峰彇浣滆�呭枩娆㈢殑瑙嗛
+ async getAuthorLikeVideoPage() {
+ this.likeVideoQuery.authorId = this.authorId
+ getAuthorLikeVideoPage(this.likeVideoQuery).then(res => {
+ this.likeVideoList = res.data.data
+ if(res.data.data.length < this.likeVideoQuery.pageSize) {
+ this.nomoreLikeVideo = true;
+ }
+ })
+ },
// 鑾峰彇浣滆�呯殑鏀惰棌瑙嗛
async getAuthorCollectVideoPage() {
this.collectVideoQuery.authorId = this.authorId
@@ -377,6 +470,19 @@
url: `/pages/video/video-play?authorId=${this.authorId}&videoFrom=collect`
});
},
+ // 鎾斁鐐硅禐瑙嗛
+ playLikeVideo(index) {
+ const playInfo = {
+ videoList: this.likeVideoList,
+ nomore: this.nomoreLikeVideo,
+ pageNumber: this.likeVideoQuery.pageNumber,
+ playIndex: index
+ }
+ uni.setStorageSync("playInfo", playInfo)
+ uni.navigateTo({
+ url: `/pages/video/video-play?authorId=${this.authorId}&videoFrom=like`
+ });
+ },
// 缂栬緫涓汉璧勬枡
editInfo() {
uni.navigateTo({
diff --git a/pages/video/video-play.vue b/pages/video/video-play.vue
index 6601c76..c11b7d2 100644
--- a/pages/video/video-play.vue
+++ b/pages/video/video-play.vue
@@ -127,31 +127,35 @@
</view>
</view>
- <!-- 鍙充晶浜掑姩鎸夐挳 -->
- <view class="action-buttons">
- <view class="avatar-container">
- <image class="avatar" @click="jumpToHomePage(item.authorId)" :src="item.authorAvatar" mode="aspectFill"></image>
- <!-- 鍏虫敞鍥炬爣 - 浣跨敤缁濆瀹氫綅 -->
- <view v-if="!item.subscribeThisAuthor" class="follow-icon" @click="subscribeAuth(index, item.authorId)">
- <text class="iconfont"></text>
- </view>
- </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" @click="showComments(item)">
- <text class="iconfont"></text>
- <text style="font-size: 10px;font-weight: lighter;">{{item.commentNum}}</text>
- </view>
- <view class="action-item">
- <button open-type="share" class="custom-share-btn" :data-obj="item">
- <text class="iconfont"></text>
- </button>
-
- </view>
- </view>
+ <!-- 鍙充晶浜掑姩鎸夐挳 -->
+ <view class="action-buttons">
+ <view class="avatar-container">
+ <image class="avatar" @click="jumpToHomePage(item.authorId)" :src="item.authorAvatar" mode="aspectFill"></image>
+ <!-- 鍏虫敞鍥炬爣 - 浣跨敤缁濆瀹氫綅 -->
+ <view v-if="!item.subscribeThisAuthor" class="follow-icon" @click="subscribeAuth(index, item.authorId)">
+ <text class="iconfont"></text>
+ </view>
+ </view>
+ <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.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>
</swiper-item>
</swiper>
@@ -239,7 +243,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 } from "@/api/share.js";
import storage from "@/utils/storage.js";
@@ -827,6 +840,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);
--
Gitblit v1.8.0