From 28167c45044ddb9ceff22b44e48a7ab496b8839a Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期三, 25 六月 2025 10:47:25 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 pages/video/home-page.vue |  130 ++++++++++++++++++++++++++++++++-----------
 1 files changed, 96 insertions(+), 34 deletions(-)

diff --git a/pages/video/home-page.vue b/pages/video/home-page.vue
index 76ca651..4aebb07 100644
--- a/pages/video/home-page.vue
+++ b/pages/video/home-page.vue
@@ -24,47 +24,47 @@
           <text class="stat-label">鑾疯禐</text>
         </view>
       </view>
-      
+
       <!-- 鍏虫敞鎸夐挳 -->
       <view class="follow-btn-container" v-if="!userInfo.self">
-        <button 
-          class="follow-btn" 
-          :class="{followed: userInfo.hasSub}" 
+        <button
+          class="follow-btn"
+          :class="{followed: userInfo.hasSub}"
           @click="toggleFollow"
         >
           {{userInfo.hasSub ? '鍙栨秷鍏虫敞' : '鍏虫敞'}}
         </button>
       </view>
-	  
+
 	  <view class="edit-icon" @click="editInfo" v-if="userInfo.self">
 	    <uni-icons type="compose" size="20" color="#666"></uni-icons>缂栬緫涓婚〉淇℃伅
 	  </view>
     </view>
-    
+
         <!-- 浣滃搧/鍠滄鍒囨崲 -->
         <view class="tab-bar">
-          <view 
-            class="tab-item" 
-            :class="{active: currentTab === 'works'}" 
+          <view
+            class="tab-item"
+            :class="{active: currentTab === 'works'}"
             @click="switchTab('works')"
           >
             浣滃搧{{`(${videoTotal})`}}
           </view>
-          <view 
-            class="tab-item" 
-            :class="{active: currentTab === 'likes'}" 
+          <view
+            class="tab-item"
+            :class="{active: currentTab === 'likes'}"
             @click="switchTab('likes')"
           >
             鍠滄
           </view>
         </view>
-        
+
         <!-- 瑙嗛鍒楄〃 -->
 		<scroll-view class="video-list" scroll-y :show-scrollbar="false" @scrolltolower="getPage" v-show="currentTab === 'works' && videoList.length > 0">
 			<view class="video-container">
 				<view
-				  class="video-item" 
-				  v-for="(item, index) in videoList" 
+				  class="video-item"
+				  v-for="(item, index) in videoList"
 				  :key="item.id"
 				>
 				  <image class="video-cover" @click="playAuthorVideo(index)" :src="item.videoContentType === 'video' ? item.coverUrl : item.imgs[0]" mode="aspectFill"></image>
@@ -73,9 +73,10 @@
 				      <view class="stat">
 				        <uni-icons type="heart" size="16" color="#fff"></uni-icons>
 				        <text>{{item.collectNum}}</text>
-						<view class="more-op">
+						<view class="more-op" v-if="userInfo.self">
 							<dropdown-menu
 							:options="item.options"
+							:data="{id: item.id, title: item.title}"
 							placement="top"
 							theme-color="#07C160"
 							@change="handleChange"
@@ -90,8 +91,8 @@
 		<scroll-view class="video-list" scroll-y :show-scrollbar="false" @scrolltolower="getPage" v-show="currentTab === 'likes' && collectVideoList.length > 0">
 			<view class="video-container">
 				<view
-				  class="video-item" 
-				  v-for="(item, index) in collectVideoList" 
+				  class="video-item"
+				  v-for="(item, index) in collectVideoList"
 				  :key="item.id"
 				  @click="playCollectVideo(index)"
 				>
@@ -104,10 +105,10 @@
 				      </view>
 				    </view>
 				  </view>
-				</view> 
+				</view>
 			</view>
 		</scroll-view>
-        
+
         <!-- 绌虹姸鎬� -->
         <view class="empty-state" v-if="videoList.length === 0 && currentTab === 'works'">
           <!-- <image src="/static/images/empty.png" mode="aspectFit" class="empty-image"></image> -->
@@ -118,6 +119,18 @@
 		  <!-- <image src="/static/images/empty.png" mode="aspectFit" class="empty-image"></image> -->
 		  <text class="empty-text">杩樻病鏈夌偣璧炰綔鍝佸摝~</text>
 		</view>
+
+		<!-- 鍒犻櫎瑙嗛鎻愰啋妗� -->
+		<uni-popup ref="delDialog" type="dialog">
+			<uni-popup-dialog type="error" cancelText="鍙栨秷" confirmText="鍒犻櫎" title="鎻愰啋" :content="`鎮ㄦ鍦ㄥ垹闄わ細${opVideo.title}`" @confirm="deleteVideo"
+				@close="dialogClose"></uni-popup-dialog>
+		</uni-popup>
+
+		<!-- 涓嬫灦瑙嗛鎻愰啋妗� -->
+		<uni-popup ref="downDialog" type="dialog">
+			<uni-popup-dialog type="error" cancelText="鍙栨秷" confirmText="涓嬫灦" title="鎻愰啋" :content="`鎮ㄦ鍦ㄤ笅鏋讹細${opVideo.title}`" @confirm="downVideo"
+				@close="dialogClose"></uni-popup-dialog>
+		</uni-popup>
   </view>
 </template>
 
@@ -125,16 +138,20 @@
 import DropdownMenu from '@/components/dropdown-menu.vue'
 
 import {getAuthorInfo, getAuthorVideoPage, getAuthorCollectVideoPage} from '@/api/user.js'
-import {subscribe, unSubscribe} from '@/api/video.js'
+import {subscribe, unSubscribe, delVideo, updateVideo, userDownVideo} from '@/api/video.js'
 export default {
   components: {DropdownMenu},
   data() {
     return {
-		options: [
-		        { command: 1, label: '鍖椾含' },
-		        { command: 2, label: '涓婃捣' },
-		        { command: 3, label: '骞垮窞' }
-		      ],
+	  options: [
+			{ command: 1, label: '鍖椾含' },
+			{ command: 2, label: '涓婃捣' },
+			{ command: 3, label: '骞垮窞' }
+		  ],
+	  opVideo: { // 姝e湪鎿嶄綔鐨勮棰�
+		  id: '',
+		  title: ''
+	  },
       currentTab: 'works', // works: 浣滃搧, likes: 鍠滄
       authorId: '',
       userInfo: {
@@ -174,9 +191,54 @@
 	this.getAuthorVideoPage();
   },
   methods: {
-	  handleChange(value) {
-	        console.log('閫変腑鍊�:', value)
-	      },
+	dialogClose() {
+		this.opVideo = {
+			id: '',
+			title: ''
+		}
+	},
+	// 涓嬫灦瑙嗛
+	downVideo() {
+		userDownVideo(this.opVideo.id).then(res => {
+			uni.showToast({
+				title: '涓嬫灦鎴愬姛',
+				duration: 2000
+			});
+			// 鍒锋柊鏁版嵁
+			this.videoList = [];
+			this.videoQuery.pageNumber = 1;
+			this.getAuthorVideoPage();
+		})
+	},
+	// 鍒犻櫎瑙嗛
+	deleteVideo() {
+		delVideo(this.opVideo.id).then(res => {
+			uni.showToast({
+				title: '鍒犻櫎鎴愬姛',
+				duration: 2000
+			});
+			// 鍒锋柊鏁版嵁
+			this.videoList = [];
+			this.videoQuery.pageNumber = 1;
+			this.getAuthorVideoPage();
+		})
+	},
+	// 瑙﹀彂瑙嗛鎿嶄綔
+	handleChange(value, data) {
+	    console.log('閫変腑鍊�:', value)
+		this.opVideo.id = data.id;
+		this.opVideo.title = data.title;
+		if (value === 'DELETE') {
+			this.$refs.delDialog.open()
+		} else if (value === 'DOWN') {
+			this.$refs.downDialog.open()
+		} else if (value === 'EDIT') {
+			// 璺宠浆缂栬緫瑙嗛椤甸潰
+			uni.navigateTo({
+			  url: `/pages/video/video-edit?id=${this.opVideo.id}`
+			});
+		}
+	},
 	getPage() {
 		if(this.currentTab === 'works') {
 			if(this.nomoreVideo) {
@@ -321,14 +383,14 @@
         url: `/pages/video/home-page-edit?authorId=${this.authorId}&avatar=${this.userInfo.avatar}&motto=${this.userInfo.motto || ''}&nickName=${this.userInfo.nickName}`
       });
     },
-    
+
     // 璺宠浆鍒扮矇涓�/鍏虫敞鍒楄〃
     navigateToFollow(type) {
       uni.navigateTo({
         url: `/pages/user/follow?type=${type}`
       });
     },
-    
+
     // 璺宠浆鍒扮偣璧炲垪琛�
     navigateToLike() {
       uni.navigateTo({
@@ -562,15 +624,15 @@
   height: 70rpx;
   line-height: 70rpx;
   padding: 0 40rpx;
-  
+
   &::after {
     border: none;
   }
-  
+
   &.followed {
     background-color: #f5f5f5;
     color: #666;
   }
 }
 
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.8.0