zhuli 5 giorni fa
parent
commit
97c6509996

+ 1 - 1
src/assets/json/authMenuList.json

@@ -664,7 +664,7 @@
       "name": "dynamicManagement",
       "redirect": "/dynamicManagement/index",
       "meta": {
-        "icon": "Operation",
+        "icon": "Operation", 
         "title": "动态",
         "isLink": "",
         "isHide": false,

+ 8 - 6
src/views/dynamicManagement/friendRelation.vue

@@ -32,13 +32,13 @@
 
         <el-form-item label="消费门槛金额(¥)" required>
           <div style="display: flex; gap: 10px; align-items: center; width: 100%">
-            <el-form-item prop="moneyLow" style=" flex: 1;margin-bottom: 0">
+            <el-form-item prop="moneyLow" style="flex: 1; margin-bottom: 0">
               <el-input v-model.number="formData.moneyLow" placeholder="0.00" clearable>
                 <template #prefix> ¥ </template>
               </el-input>
             </el-form-item>
             <span>~</span>
-            <el-form-item prop="moneyHigh" style=" flex: 1;margin-bottom: 0">
+            <el-form-item prop="moneyHigh" style="flex: 1; margin-bottom: 0">
               <el-input v-model.number="formData.moneyHigh" placeholder="0.00" clearable>
                 <template #prefix> ¥ </template>
               </el-input>
@@ -154,7 +154,8 @@ const formRules = reactive<FormRules>({
 const columns = reactive<ColumnProps<any>[]>([
   {
     prop: "acName",
-    label: "活动名称"
+    label: "活动名称",
+    search: { el: "input", props: { placeholder: "请输入活动名称" } }
   },
   {
     prop: "endDate",
@@ -171,12 +172,13 @@ const columns = reactive<ColumnProps<any>[]>([
     prop: "status",
     label: "状态",
     enum: [
-      { label: "启用", value: "0" },
-      { label: "已停用", value: "1" }
+      { label: "启用", value: 0 },
+      { label: "禁用", value: 1 }
     ],
+    search: { el: "select", props: { placeholder: "请选择状态" } },
     fieldNames: { label: "label", value: "value" },
     render: (scope: any) => {
-      return scope.row.status == "0" ? "启用中" : "已停用";
+      return scope.row.status == 0 ? "启用" : "禁用";
     }
   },
   { prop: "operation", label: "操作", fixed: "right", width: 250 }

+ 8 - 12
src/views/dynamicManagement/index.vue

@@ -323,9 +323,7 @@
                         @click="handleLikeComment(item)"
                         style="display: flex; align-items: center"
                       >
-                        <el-icon :size="16" :color="item.isLiked ? '#f56c6c' : '#999'">
-                          <Star /> </el-icon
-                        >&nbsp;
+                        <el-icon :size="16" :color="item.isLiked ? '#f56c6c' : '#999'"> <Star /> </el-icon>&nbsp;
                         <span>{{ item.likeCount || 0 }}</span>
                       </span>
                     </div>
@@ -851,7 +849,6 @@ const handleCardClick = async (item: DynamicItem) => {
     commentCount: 0,
     isFollowThis: item.isFollowThis // 使用item.isFollowThis而不是item.isFollowed
   };
-  console.log(currentDetail.value);
   detailDrawerVisible.value = true;
 
   // 打开抽屉时加载评论列表
@@ -870,9 +867,8 @@ const handleLike = async (item: DynamicItem) => {
       huifuId: item.id, // 动态ID
       type: 2 // 2表示点赞
     };
-
     // 根据当前点赞状态调用不同的接口
-    if (item.isLiked) {
+    if (item.isLike == "1") {
       // 已点赞,调用取消点赞接口
       await unlikeDynamicNew(params);
     } else {
@@ -881,7 +877,7 @@ const handleLike = async (item: DynamicItem) => {
     }
     await loadDynamicList();
 
-    ElMessage.success(item.isLiked ? "点赞成功" : "取消点赞");
+    ElMessage.success(item.isLike != "1" ? "点赞成功" : "取消点赞");
   } catch (error) {
     console.error("列表点赞操作失败:", error);
     ElMessage.error("操作失败");
@@ -920,7 +916,7 @@ const handleDetailLike = async () => {
     };
 
     // 根据当前点赞状态调用不同的接口
-    if (currentDetail.value.isLiked) {
+    if (currentDetail.value.isLike == "1") {
       // 已点赞,调用取消点赞接口
 
       await unlikeDynamicNew(params);
@@ -930,17 +926,17 @@ const handleDetailLike = async () => {
     }
 
     // 切换点赞状态
-    currentDetail.value.isLiked = !currentDetail.value.isLiked;
-    currentDetail.value.likeCount += currentDetail.value.isLiked ? 1 : -1;
+    currentDetail.value.isLike = !currentDetail.value.isLike;
+    currentDetail.value.likeCount += currentDetail.value.isLike ? 1 : -1;
 
     // 同步更新列表中的数据
     const listItem = dynamicList.value.find(item => item.id === currentDetail.value?.id);
     if (listItem) {
-      listItem.isLiked = currentDetail.value.isLiked;
+      listItem.isLike = currentDetail.value.isLike;
       listItem.likeCount = currentDetail.value.likeCount;
     }
 
-    ElMessage.success(currentDetail.value.isLiked ? "点赞成功" : "取消点赞");
+    ElMessage.success(currentDetail.value.isLike == "1" ? "点赞成功" : "取消点赞");
   } catch (error) {
     console.error("点赞操作失败:", error);
     ElMessage.error("操作失败");

+ 43 - 21
src/views/dynamicManagement/myDynamic.vue

@@ -52,7 +52,7 @@
         <div v-for="item in contentList" :key="item.id" class="content-card" @click="handleCardClick(item)">
           <!-- 封面图片/视频区域 -->
           <div class="content-cover-wrapper">
-            <img v-if="item.coverUrl" :src="item.coverUrl" :alt="item.title" class="content-cover" />
+            <img v-if="item.imagePath" :src="getCoverImage(item)" :alt="item.title" class="content-cover" />
             <div v-else class="cover-placeholder">
               <el-icon :size="48" color="#999">
                 <Picture />
@@ -60,7 +60,7 @@
             </div>
 
             <!-- 视频播放按钮 -->
-            <div v-if="item.type === 'video'" class="play-overlay">
+            <div v-if="isVideoItem(item)" class="play-overlay">
               <el-icon :size="40" color="#fff">
                 <VideoPlay />
               </el-icon>
@@ -91,7 +91,7 @@
         <div v-for="item in dianZanList" :key="item.id" class="content-card" @click="handleCardClick(item)">
           <!-- 封面图片/视频区域 -->
           <div class="content-cover-wrapper">
-            <img v-if="item.imagePath" :src="item.imagePath" :alt="item.title" class="content-cover" />
+            <img v-if="item.imagePath" :src="getCoverImage(item)" :alt="item.title" class="content-cover" />
             <div v-else class="cover-placeholder">
               <el-icon :size="48" color="#999">
                 <Picture />
@@ -99,7 +99,7 @@
             </div>
 
             <!-- 视频播放按钮 -->
-            <div v-if="item.type === 'video'" class="play-overlay">
+            <div v-if="isVideoItem(item)" class="play-overlay">
               <el-icon :size="40" color="#fff">
                 <VideoPlay />
               </el-icon>
@@ -368,9 +368,7 @@
                         @click="handleLikeComment(item)"
                         style="display: flex; align-items: center"
                       >
-                        <el-icon :size="16" :color="item.isLiked ? '#f56c6c' : '#999'">
-                          <Star /> </el-icon
-                        >&nbsp;
+                        <el-icon :size="16" :color="item.isLiked ? '#f56c6c' : '#999'"> <Star /> </el-icon>&nbsp;
                         <span>{{ item.likeCount || 0 }}</span>
                       </span>
                     </div>
@@ -666,6 +664,7 @@ interface ContentItem {
   id: number;
   title: string;
   coverUrl: string;
+  imagePath?: string;
   type: "image" | "video";
   viewCount: number;
   liulanCount?: number;
@@ -696,6 +695,7 @@ interface DetailItem extends ContentItem {
   phoneId?: string; // 发布者店铺ID
   storeUserId?: string | number; // 小店用户ID(用于举报和拉黑)
   userType?: number; // 发布者用户类型:1商家,2用户
+  imagePath?: string; // 图片路径
 }
 
 interface RelationUser {
@@ -924,7 +924,7 @@ const handleVideoPlay = (index: number) => {
 
 // 查看用户主页
 const handleViewUserProfile = () => {
-  ElMessage.info("查看用户主页功能开发中");
+  // ElMessage.info("查看用户主页功能开发中");
 };
 
 // 详情页点赞
@@ -1159,7 +1159,7 @@ const handleLikeComment = async (comment: any) => {
 // 回复评论
 const handleReplyComment = (comment: any) => {
   replyingComment.value = comment;
-  commentInput.value = `@${comment.userName} `;
+  commentInput.value = ``;
   // 聚焦到输入框
   setTimeout(() => {
     const textarea = document.querySelector(".comment-input-wrapper textarea") as HTMLTextAreaElement;
@@ -1468,6 +1468,40 @@ const loadUserInfo = async () => {
   }
 };
 
+// 判断是否是视频项
+const isVideoItem = (item: any) => {
+  if (!item.imagePath) return false;
+  const files = item.imagePath
+    .split(",")
+    .map((url: string) => url.trim())
+    .filter((url: string) => url);
+  const firstFile = files[0] || "";
+  return firstFile.toLowerCase().endsWith(".mp4") || firstFile.toLowerCase().includes(".mp4");
+};
+
+// 获取封面图片
+const getCoverImage = (item: any) => {
+  console.log(item.imagePath);
+  if (!item.imagePath) return "";
+
+  const files = item.imagePath
+    .split(",")
+    .map((url: string) => url.trim())
+    .filter((url: string) => url);
+
+  // 检查第一个文件是否是视频
+  const firstFile = files[0] || "";
+  const isVideo = firstFile.toLowerCase().endsWith(".mp4") || firstFile.toLowerCase().includes(".mp4");
+
+  // 如果第一个文件是视频,取第二个文件(jpg缩略图)
+  if (isVideo && files.length > 1) {
+    return files[1]; // 第二个是jpg缩略图
+  }
+
+  // 如果是图片或只有一个文件,取第一个
+  return files[0] || "";
+};
+
 // 加载草稿数量
 const loadDraftCount = async () => {
   try {
@@ -1492,15 +1526,6 @@ const loadDraftCount = async () => {
   }
 };
 
-// 加载内容列表
-const loadContentList = async () => {
-  // 根据当前 tab 调用不同的接口
-  if (activeTab.value === "dynamic") {
-    getDyanmicList();
-  } else if (activeTab.value === "liked") {
-    getDianZan();
-  }
-};
 const dianZanList = ref<any[]>([]);
 const getDianZan = async () => {
   const phone = userStore.userInfo?.phone || "";
@@ -2234,9 +2259,6 @@ onMounted(() => {
         padding: 8px;
         font-size: 24px;
         color: #ffffff;
-        &:hover {
-          background: rgb(255 255 255 / 10%);
-        }
       }
     }
     .detail-content {

+ 5 - 2
src/views/dynamicManagement/reviewAppeal.vue

@@ -109,7 +109,7 @@
               申诉删除
             </el-button>
 
-            <el-button type="primary" link @click="openReplayDialog(review)"> 回复 </el-button>
+            <el-button type="primary" link @click="openReplayDialog(review)" v-if="!hasStoreReply(review)"> 回复 </el-button>
           </div>
         </div>
       </div>
@@ -250,7 +250,10 @@ const appealFormData = reactive({
   files: [] as File[], // 保存原始的 File 对象
   fileList: [] as UploadUserFile[]
 });
-
+const hasStoreReply = (review: any) => {
+  console.log(review);
+  return review.storeComment && review.storeComment.length > 0;
+};
 const appealFormRules = reactive<FormRules>({
   reason: [{ required: true, message: "请输入申诉原因", trigger: "blur" }],
   images: [{ required: true, message: "请上传申诉凭证", trigger: "blur" }]

+ 42 - 13
src/views/dynamicManagement/userDynamic.vue

@@ -62,7 +62,6 @@
       <!-- 动态卡片网格 -->
       <div class="content-grid">
         <div v-for="item in paginatedList" :key="item.id" class="content-card" @click="handleCardClick(item)">
-          {{ item }}
           <!-- 封面图片区域 -->
           <div class="content-cover-wrapper">
             <img v-if="item.coverUrl" :src="item.coverUrl" :alt="item.title" class="content-cover" />
@@ -76,9 +75,9 @@
           <!-- 观看次数 -->
           <div class="content-footer">
             <el-icon :size="14" color="#666">
-              <View />
+              <Star />
             </el-icon>
-            <span class="view-count">{{ item.viewCount || 0 }}</span>
+            <span class="view-count">{{ item.dianzanCount }}</span>
           </div>
         </div>
       </div>
@@ -328,11 +327,11 @@
                     </div>
                     <div class="store-comment-text">
                       {{ item.commentContent }}
-                      <span class="comment-action-item" @click="handleLikeComment(comment)">
-                        <el-icon :size="16" :color="comment.isLiked ? '#f56c6c' : '#999'">
-                          <Star />
-                        </el-icon>
-                        <span>{{ comment.likeCount || 0 }}</span>
+                      <span class="comment-action-item" @click="handleLikeComment(item)" style="display: flex">
+                        <el-icon :size="16" :color="item.isLiked ? '#f56c6c' : '#999'">
+                          <Star /> </el-icon
+                        >&nbsp;
+                        <span>{{ item.likeCount || 0 }}</span>
                       </span>
                     </div>
                   </div>
@@ -521,7 +520,9 @@ import {
   cancelFollowed,
   reportUserViolation,
   blockUser,
-  getUserByPhone
+  getUserByPhone,
+  likeDynamicNew,
+  unlikeDynamicNew
 } from "@/api/modules/dynamicManagement";
 import { uploadImg } from "@/api/modules/upload";
 import { useUserStore } from "@/stores/modules/user";
@@ -554,6 +555,7 @@ interface ContentItem {
   createTime: string;
   commentCount?: number;
   mediaList?: MediaItem[];
+  dianzanCount: number;
 }
 
 interface ShareFriend {
@@ -711,6 +713,9 @@ const handleCardClick = async (item: any) => {
 
     // 重置轮播索引
     currentCarouselIndex.value = 0;
+
+    // 打开抽屉时立即加载评论列表
+    await loadCommentList();
   } catch (error) {
     console.error("加载详情失败:", error);
     ElMessage.error("加载详情失败");
@@ -812,11 +817,35 @@ const loadCommentList = async () => {
 
 // 点赞评论
 const handleLikeComment = async (comment: any) => {
+  console.log(comment);
   try {
+    // 获取当前用户的手机号,并在前面拼接 "store_"
+    const phone = userStore.userInfo?.phone || "";
+    const currentUserPhoneId = phone.startsWith("store_") ? phone : `store_${phone}`;
+
+    const params = {
+      userId: currentUserPhoneId, // 当前用户phoneId
+      huifuId: comment.id, // 评论ID
+      type: 1 // 1表示评论点赞
+    };
+
+    // 根据当前点赞状态调用不同的接口
+    if (comment.isLiked) {
+      // 已点赞,调用取消点赞接口
+      await unlikeDynamicNew(params);
+    } else {
+      // 未点赞,调用点赞接口
+      await likeDynamicNew(params);
+    }
+
+    // 切换点赞状态
     comment.isLiked = !comment.isLiked;
-    comment.likeCount = comment.isLiked ? (comment.likeCount || 0) + 1 : (comment.likeCount || 1) - 1;
+    comment.likeCount += comment.isLiked ? 1 : -1;
+
+    ElMessage.success(comment.isLiked ? "点赞成功" : "取消点赞");
   } catch (error) {
-    console.error("点赞评论失败:", error);
+    console.error("列表点赞操作失败:", error);
+    ElMessage.error("操作失败");
   }
 };
 
@@ -1303,10 +1332,10 @@ const loadContentList = async () => {
         id: item.id || item.dynamicId,
         title: item.title || item.content || item.dynamicContent || "",
         coverUrl: item.imagePath || item.coverUrl || "",
-        viewCount: item.viewCount || 0,
         likeCount: item.likeCount || item.praiseCount || 0,
         isLiked: item.isLiked || item.isPraise || false,
-        createTime: item.createTime || item.createDate || ""
+        createTime: item.createTime || item.createDate || "",
+        dianzanCount: item.dianzanCount || 0
       }));
 
       pagination.total = responseData.total || responseData.totalCount || list.length;