Browse Source

完善帖子详情页 评论组件

崔帅 2 months ago
parent
commit
eda27b192f

+ 44 - 6
components/CommentSection/CommentSection.vue

@@ -13,8 +13,8 @@
 			<text class="fa fa-pencil"></text>
 			<text>发表新评论</text>
 		</view>
-		<view class="bottomFixed"  @tap="openComment">
-			<view class="inbutBox">
+		<view class="bottomFixed"  >
+			<view class="inbutBox" @tap="openComment">
 				<view class="left-box">
 					<image src="@/static/icon/cz_icon_xiugaifengmian.png"></image>
 					<text>发表你的想法...</text>
@@ -23,11 +23,11 @@
 					<text class="fa fa-smile-o"></text>
 				</view>
 			</view>
-			<view class="giveTheThumbsUpBox">
-				<image v-if="true" src="@/static/icon/icon-19.png"></image>
+			<view class="giveTheThumbsUpBox" @click="giveTheThumbsUp()">
+				<image v-if="!isLikeFalg" src="@/static/icon/icon-19.png"></image>
 				<image v-else src="@/static/icon/icon-18.png"></image>
 				<!-- {{}} -->
-				0
+				{{articleInfo.is_like-(-(isLikeFalg?1:0) ) }}
 			</view>
 		</view>
 	</view>
@@ -50,6 +50,10 @@ export default {
 			type: Object,
 			required: true
 		},
+		articleInfo: {
+			type: Object, 
+			default: () => ({is_like:0})
+		},
 		articleId: {
 			type: [Number, String],
 			required: true
@@ -63,13 +67,47 @@ export default {
 		return {
 			deleteMode: "all",
 			tableTotal: 0,
-			tableData: []
+			tableData: [],
+			isLikeFalg:this.articleInfo.is_like
 		}
 	},
 	created() {
 		this.loadCommentData();
 	},
 	methods: {
+		giveTheThumbsUp(){
+			console.log('文章点赞的逻辑');
+			uni.request({
+				url: this.$apiHost + '/Article/like',
+				data: {
+					uuid: getApp().globalData.uuid,
+					id: this.articleId
+				},
+				header: {
+					"content-type": "application/json",
+					'sign': getApp().globalData.headerSign
+				},
+				success: (res) => {
+					console.log("点赞结果:", res.data);
+					if (res.data.str == "取消点赞") {
+						 // 请求失败时重置点赞效果
+						 this.isLikeFalg=false
+					}
+					if (res.data.str == "点赞成功") {
+						 // 请求失败时重置点赞效果
+						 this.isLikeFalg=true
+					}
+					uni.showToast({
+						title: res.data.str,
+						icon: 'none'
+					});
+				},
+				fail: (e) => {
+					console.log("点赞失败:", e);
+					 
+				}
+			});
+		},
 		loadCommentData() {
 			uni.request({
 				url: this.$apiHost + '/Article/getcomments',

+ 1 - 1
components/cc-comment/componets/common.vue

@@ -90,7 +90,7 @@ export default {
     // 回复
     replyClick(item) {
       // 自己不能回复自己
-      if (item.owner) return;
+      // if (item.owner) return;
       this.$emit("replyClick", item);
     },
     // 删除

+ 1 - 1
components/lh-select-city/index.vue

@@ -165,7 +165,7 @@
 </script>
 
 <style scoped>
-	/deep/.select-city-wrap {
+	::v-deep.select-city-wrap {
 		height: 100vh;
 		overflow: hidden;
 		z-index: 9999;

+ 1 - 1
components/page-navbar/page-navbar.vue

@@ -38,7 +38,7 @@
 			height: calc(400rpx + var(--status-bar-height));
 		}
 
-		/deep/.uv-navbar__content {
+		::v-deep.uv-navbar__content {
 			height: 310rpx !important;
 			box-sizing: border-box;
 			padding-left: 24rpx;

+ 116 - 89
pages/index/articleDetail.scss

@@ -111,13 +111,24 @@ page {
 }
 // 轮播图样式
 ::v-deep.swiper-box {
+  padding-bottom: 32rpx;
   .uv-swiper__wrapper__item__wrapper__image {
     width: 100%;
-    height: 300rpx;
+
+    background-color: transparent !important;
   }
   .uv-swiper__indicator {
     position: absolute;
     bottom: 0;
+    .uv-swiper-indicator__wrapper__dot {
+      width: 10rpx;
+      height: 10rpx;
+      border-radius: 50%;
+      background: #e1e1e1 !important;
+      &.uv-swiper-indicator__wrapper__dot--active {
+        background: #acf934 !important;
+      }
+    }
   }
 }
 // 评论区域样式
@@ -212,87 +223,15 @@ page {
     }
   }
 }
-.thread {
-  height: 20rpx;
-}
-.thread2 {
-  height: 60rpx;
-}
-.topUser {
-  width: 750rpx;
-  height: 750rpx;
-  position: relative;
-  overflow: hidden;
-  .home_image {
-    width: 100%;
-    height: 100%;
-    transition: transform 0.3s ease;
-
-    &:active {
-      transform: scale(1.05);
-    }
-  }
-  .image-indicator {
-    position: absolute;
-    top: 30rpx;
-    right: 30rpx;
-    background-color: rgba(0, 0, 0, 0.5);
-    color: #fff;
-    padding: 8rpx 16rpx;
-    border-radius: 20rpx;
-    font-size: 24rpx;
-  }
-  .list {
-    position: absolute;
-    bottom: 20rpx;
-    width: 100%;
-    display: flex;
-    flex-direction: row;
-    justify-content: center;
-    align-items: flex-end;
-    padding: 0 20rpx;
-    overflow-x: auto;
 
-    &::-webkit-scrollbar {
-      display: none;
-    }
-
-    .img {
-      width: 84rpx;
-      height: 84rpx;
-      margin: 0 10rpx;
-      transition: all 0.3s ease;
-      image {
-        width: 84rpx;
-        height: 84rpx;
-        border-radius: 16rpx;
-        border: solid 4rpx #fff;
-        box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2);
-      }
-    }
-    .active {
-      width: 136rpx;
-      height: 136rpx;
-      image {
-        width: 136rpx;
-        height: 136rpx;
-        border-radius: 24rpx;
-        border: solid 4rpx #fff;
-        box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.3);
-      }
-    }
-  }
-}
 .body {
   width: 750rpx;
-  margin-top: -60rpx;
   border-radius: 40rpx 40rpx 0 0;
   padding-top: 30rpx;
   display: flex;
   flex-direction: column;
   justify-content: flex-start;
   align-items: flex-start;
-  box-shadow: 0 -10rpx 20rpx rgba(0, 0, 0, 0.05);
   position: relative;
   z-index: 10;
   .article-header {
@@ -305,13 +244,60 @@ page {
     box-sizing: border-box;
 
     .title {
-      font-size: 40rpx;
-      font-weight: bold;
-      color: #222;
-      margin-bottom: 20rpx;
-      line-height: 1.4;
+      font-family: "PingFang SC-Bold";
+      font-size: 400;
+      color: #1f1f1f;
+      font-size: 36rpx;
     }
 
+    .article-content {
+      width: 100%;
+      padding-top: 40rpx;
+      padding-bottom: 28rpx;
+      .content {
+        font-family: "PingFang SCMedium";
+        font-size: 32rpx;
+        font-weight: 400;
+      }
+    }
+    .cardLink {
+      min-width: 340rpx;
+      max-width: 500rpx;
+      height: 120rpx;
+      border-radius: 12rpx;
+      border: 2rpx solid #f2f6f2;
+      padding: 10rpx;
+      box-sizing: border-box;
+      display: flex;
+      flex-direction: flex-start;
+      image {
+        width: auto;
+        height: 100rpx;
+        background: #f4f4f4;
+        flex-grow: 0;
+        border-radius: 12rpx;
+        margin-right: 12rpx;
+      }
+      .content {
+        height: 100%;
+        display: flex;
+        flex-direction: column;
+        justify-content: space-between;
+        .tit {
+          font-family: "PingFang SC-Bold";
+          font-family: PingFang SC, PingFang SC;
+          font-weight: 400;
+          font-size: 24rpx;
+        }
+        .tex {
+          font-family: "PingFang SC-Medium";
+          font-family: PingFang SC, PingFang SC;
+          font-size: 20rpx;
+          color: #999999;
+          line-height: 28rpx;
+        }
+      }
+    }
     .meta-info {
       display: flex;
       flex-direction: row;
@@ -337,18 +323,7 @@ page {
     width: 650rpx;
     margin: 10rpx auto 30rpx;
   }
-  .article-content {
-    padding: 0 50rpx 40rpx;
-    width: 100%;
-    box-sizing: border-box;
 
-    .content {
-      font-size: 32rpx;
-      color: #333;
-      line-height: 1.8;
-      text-align: justify;
-    }
-  }
   .article-footer {
     width: 100%;
     padding: 20rpx 0;
@@ -782,3 +757,55 @@ page {
   opacity: 0.9;
   transform: scale(0.98);
 }
+.failureReason {
+  padding: 40rpx;
+  padding-top: 52tpx;
+  background: #fff;
+  width: 600rpx;
+  min-height: 346rpx;
+  border-radius: 28rpx;
+  box-sizing: border-box;
+  .title {
+    font-family: PingFang SC, PingFang SC;
+    font-weight: 400;
+    font-size: 36rpx;
+    color: #1f1f1f;
+    text-align: center;
+    margin-bottom: 24rpx;
+  }
+  .reviewContent {
+    font-family: PingFang SC, PingFang SC;
+    font-weight: 400;
+    font-size: 28rpx;
+    color: #1f1f1f;
+  }
+  .btn-box {
+    background: #1f1f1f;
+    color: #fff;
+    margin: 0 auto;
+    width: 244rpx;
+    height: 72rpx;
+    font-size: 32rpx;
+    font-family: "PingFang SC-Bold";
+    background: #1f1f1f;
+    border-radius: 12rpx;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    margin-top: 54rpx;
+  }
+}
+.topStatusBar {
+  width: 100%;
+  height: 48rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  &.inProgress {
+    background: #acf934;
+  }
+  &.fail {
+    background: #fd3a3a;
+    color: #fff;
+  }
+}

+ 635 - 574
pages/index/articleDetail.vue

@@ -1,590 +1,651 @@
 <template>
-	<view class="page">
-		<!-- 引入FontAwesome -->
-		<view>
-			<link rel="stylesheet"
-				href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
-		</view>
-
-
-		<!-- 顶部导航栏 -->
-		<view class="custom-navbar">
-			<view class="navbar-left" @click="goBack">
-				<text class="fa fa-angle-left"></text>
-			</view>
-			<view class="navbar-center">
-				<view class="navbar-title">
-					<image class="navbar-avatar" :src="author.avator" mode="aspectFill"></image>
-					<text class="navbar-text">{{ author.nickname }}</text>
-					<!-- <text class="navbar-badge" v-if="author.is_vip > 0">VIP</text> -->
-				</view>
-			</view>
-			<view class="navbar-right">
-				<text class="followTheAuthor followTheAuthor1" v-if="author.is_attention == 0"
-					@click="followTheAuthor(1)">+关注</text>
-				<text class="followTheAuthor followTheAuthor0" v-if="author.is_attention == 1"
-					@click="followTheAuthor(0)">已关注</text>
-				<image v-if="false" @click="showActionSheet(0)" src="@/static/icon/sy_icon_fenxiang.png"
-					mode="widthFix"></image>
-				<view v-else class="navbar-right" @click="showActionSheet(1)">
-					<text class="fa fa-ellipsis-h"></text>
-				</view>
-			</view>
-		</view>
-
-		<!-- 轮播图 -->
-
-
-		<!-- 新增轮播图部分 -->
-		<uv-swiper class="swiper-box" height="1000rpx" :list="swperImages" indicator indicatorMode="line" circular>			</uv-swiper>
-
-
-
-
-
-
-
-		<!-- 文章头图区域 -->
-		<view class="topUser" v-if="articleInfo.type == 'user'">
-			<image :src="home_image" class="home_image" mode="aspectFill"></image>
-			<!-- 图片指示器 -->
-			<view class="image-indicator" v-if="image_list.length > 1">
-				<text>{{ selImg + 1 }}/{{ image_list.length }}</text>
-			</view>
-			<!-- 缩略图列表 -->
-			<view class="list">
-				<view class="img" :class="selImg == index ? 'active' : ''" v-for="(item, index) in image_list"
-					:key="index" @click="selPhoto(item, index)">
-					<image :src="item" mode="aspectFill"></image>
-				</view>
-			</view>
-		</view>
-
-		<!-- 文章内容区域 -->
-		<view class="body">
-			<!-- 文章标题与元信息 -->
-			<view class="article-header">
-				<view class="title">
-					{{ articleInfo.title || '暂无标题' }}
-				</view>
-				<view class="meta-info">
-					<view class="meta-item">
-						<text class="fa fa-calendar"></text>
-						<text class="meta-text">{{ articleInfo.create_time || '暂无时间' }}</text>
-					</view>
-					<view class="meta-item">
-						<text class="fa fa-eye"></text>
-						<text class="meta-text">{{ articleInfo.num_view || 0 }}次阅读</text>
-					</view>
-					<view class="meta-item" v-if="articleInfo.author">
-						<text class="fa fa-user"></text>
-						<text class="meta-text">{{ articleInfo.author }}</text>
-					</view>
-				</view>
-			</view>
-
-			<!-- 内容分隔线 -->
-			<view class="divider"></view>
-
-			<!-- 文章内容 -->
-			<!-- <view class="article-content" v-if="articleInfo.type == 'user'">
-				<view class="content">{{ articleInfo.content || '暂无内容' }}</view>
-			</view> -->
-			<view class="article-content">
-				<view class="content">
-					<rich-text :nodes="content" style="font-size: 14px;"></rich-text>
-				</view>
-			</view>
-
-			<!-- 文章底部区域 -->
-			<view class="article-footer">
-				<view class="action-bar">
-					<view class="action-item" @tap="likeArticle">
-						<text class="fa" :class="articleInfo.is_like ? 'fa-thumbs-up liked' : 'fa-thumbs-o-up'"></text>
-						<text class="action-text">{{ articleInfo.like_count || 0 }}</text>
-					</view>
-					<view class="action-item" @tap="openComment">
-						<text class="fa fa-comment-o"></text>
-						<text class="action-text">{{ tableTotal || 0 }}</text>
-					</view>
-					<view class="action-item" @tap="shareArticle">
-						<text class="fa fa-share-alt"></text>
-						<text class="action-text">分享</text>
-					</view>
-				</view>
-			</view>
-
-			<!-- 空白占位 -->
-			<view class="list_info">
-				<view class="blankHeight"></view>
-			</view>
-
-		</view>
-
-		<!-- <view class="btn_submit" @click="chatTA()">
+  <view class="page">
+    <!-- 引入FontAwesome -->
+    <view>
+      <link
+        rel="stylesheet"
+        href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
+      />
+    </view>
+
+    <!-- 顶部导航栏 -->
+    <view class="custom-navbar">
+      <view class="navbar-left" @click="goBack">
+        <text class="fa fa-angle-left"></text>
+      </view>
+      <view class="navbar-center">
+        <view class="navbar-title">
+          <image
+            class="navbar-avatar"
+            :src="author.avator"
+            mode="aspectFill"
+          ></image>
+          <text class="navbar-text">{{ author.nickname }}</text>
+          <!-- <text class="navbar-badge" v-if="author.is_vip > 0">VIP</text> -->
+        </view>
+      </view>
+      <view class="navbar-right">
+        <text
+          class="followTheAuthor followTheAuthor1"
+          v-if="author.is_attention == 0"
+          @click="followTheAuthor(1)"
+          >+关注</text
+        >
+        <text
+          class="followTheAuthor followTheAuthor0"
+          v-if="author.is_attention == 1"
+          @click="followTheAuthor(0)"
+          >已关注</text
+        >
+        <image
+          v-if="false"
+          @click="showActionSheet(0)"
+          src="@/static/icon/sy_icon_fenxiang.png"
+          mode="widthFix"
+        ></image>
+        <view v-else class="navbar-right" @click="showActionSheet(1)">
+          <text class="fa fa-ellipsis-h"></text>
+        </view>
+      </view>
+    </view>
+    <view class="topStatusBar inProgress" v-if="0"> 审核中</view>
+    <view class="topStatusBar fail" v-if="0" @click="openConfirmationBox">
+      审核未通过,点击查看原因</view
+    >
+
+    <!--  轮播图部分 -->
+    <uv-swiper
+      v-if="articleInfo.type == 'user'"
+      class="swiper-box"
+      height="1032rpx"
+      :list="swperImages"
+      indicator
+      indicatorMode="dot"
+      bgColor="#fff"
+      :autoplay="false"
+    >
+    </uv-swiper>
+
+    <!-- 文章内容区域 -->
+    <view class="body">
+      <!-- 文章标题与元信息 -->
+      <view class="article-header">
+        <view class="title">
+          {{ articleInfo.title || "暂无标题" }}
+        </view>
+        <view class="article-content">
+          <view class="content">
+            <rich-text :nodes="content" style="font-size: 14px"></rich-text>
+          </view>
+        </view>
+        <view class="cardLink" @click="goToDetails(workInfo.id)">
+          <image :src="workInfo.images" mode="heightFix"></image>
+          <view class="content">
+            <view class="tit">作品一号</view>
+            <view class="tex">{{
+              cutTime(workInfo.create_time) || "暂无时间"
+            }}</view>
+          </view>
+        </view>
+        <view v-if="false" class="meta-info">
+          <view class="meta-item">
+            <text class="fa fa-calendar"></text>
+            <text class="meta-text">{{
+              articleInfo.create_time || "暂无时间"
+            }}</text>
+          </view>
+          <view class="meta-item">
+            <text class="fa fa-eye"></text>
+            <text class="meta-text">{{ articleInfo.num_view || 0 }}次阅读</text>
+          </view>
+          <view class="meta-item" v-if="articleInfo.author">
+            <text class="fa fa-user"></text>
+            <text class="meta-text">{{ articleInfo.author }}</text>
+          </view>
+        </view>
+      </view>
+
+      <!-- 文章底部区域 -->
+      <view class="article-footer" v-if="false">
+        <view class="action-bar">
+          <view class="action-item" @tap="likeArticle">
+            <text
+              class="fa"
+              :class="
+                articleInfo.is_like ? 'fa-thumbs-up liked' : 'fa-thumbs-o-up'
+              "
+            ></text>
+            <text class="action-text">{{ articleInfo.like_count || 0 }}</text>
+          </view>
+          <view class="action-item" @tap="openComment">
+            <text class="fa fa-comment-o"></text>
+            <text class="action-text">{{ tableTotal || 0 }}</text>
+          </view>
+          <view class="action-item" @tap="shareArticle">
+            <text class="fa fa-share-alt"></text>
+            <text class="action-text">分享</text>
+          </view>
+        </view>
+      </view>
+    </view>
+
+    <!-- <view class="btn_submit" @click="chatTA()">
 			<image class="icon" src="../../static/icon/icon_chat_white.png" mode="widthFix"></image>
 			私聊
 		</view> -->
-		<view class="thread2"></view>
-		<view class="thread2"></view>
 
-		<previewImage ref="previewImage" :opacity="0.8" :circular="true" :imgs="imgs" :descs="descs"></previewImage>
-
-		<!-- 评论区域 -->
-		<CommentSection ref="commentSection" @totalNumberOfComments="totalNumberOfComments" :myInfo="myInfo"
-			:userInfo="userInfo" :articleId="arcID" :type="'article'">
-		</CommentSection>
-
-		<view class="thread2"></view>
-		<!-- 自定义 ActionSheet -->
-		<ActionSheet ref="actionSheet" :items="items" @select="handleActionSelect" @cancel="handleActionCancel" />
-	</view>
+    <previewImage
+      ref="previewImage"
+      :opacity="0.8"
+      :circular="true"
+      :imgs="imgs"
+      :descs="descs"
+    ></previewImage>
+
+    <!-- 评论区域 -->
+    <CommentSection
+      v-if="userInfo.id != 0"
+      ref="commentSection"
+      @totalNumberOfComments="totalNumberOfComments"
+      :articleInfo="articleInfo"
+      :myInfo="myInfo"
+      :userInfo="userInfo"
+      :articleId="arcID"
+      :type="'article'"
+    >
+    </CommentSection>
+
+    <view class="thread2"></view>
+    <!-- 自定义 ActionSheet -->
+    <ActionSheet
+      ref="actionSheet"
+      :items="items"
+      @select="handleActionSelect"
+      @cancel="handleActionCancel"
+    />
+    <CustomPopup ref="confirmationBox">
+      <view class="failureReason">
+        <view class="title"> 审核未通关</view>
+        <view class="reviewContent">
+          <!-- {{ fileInformation.reason }} -->
+          不通过原因
+        </view>
+        <view class="btn-box" @click="closeConfirmationBox">知道了</view>
+      </view>
+    </CustomPopup>
+  </view>
 </template>
 
 <script>
-import htmlParser from '../../common/html-parser'
+import htmlParser from "../../common/html-parser";
 import CommentSection from "@/components/CommentSection/CommentSection.vue";
-import previewImage from '@/components/kxj-previewImage/kxj-previewImage.vue'; //引用插件
+import previewImage from "@/components/kxj-previewImage/kxj-previewImage.vue"; //引用插件
+import CustomPopup from "@/components/CustomPopup/CustomPopup.vue";
 function parseImgs(nodes) {
-	nodes.forEach(node => {
-		if (
-			node.name === 'img' &&
-			node.attrs &&
-			node.attrs['data-img-size-val']
-		) {
-			const sizes = node.attrs['data-img-size-val'].split(',')
-			const width = uni.upx2px(720 * 0.9)
-			const height = parseInt(width * (sizes[1] / sizes[0]))
-			node.attrs.style = `width:${width};height:${height};`
-		}
-		if (Array.isArray(node.children)) {
-			parseImgs(node.children)
-		}
-	})
-	return nodes
+  nodes.forEach((node) => {
+    if (node.name === "img" && node.attrs && node.attrs["data-img-size-val"]) {
+      const sizes = node.attrs["data-img-size-val"].split(",");
+      const width = uni.upx2px(720 * 0.9);
+      const height = parseInt(width * (sizes[1] / sizes[0]));
+      node.attrs.style = `width:${width};height:${height};`;
+    }
+    if (Array.isArray(node.children)) {
+      parseImgs(node.children);
+    }
+  });
+  return nodes;
 }
 export default {
-	components: {
-		previewImage,
-		CommentSection
-	},
-	data() {
-		return {
-			swperImages: [],
-			items: [],
-			title: '',
-			arcID: 0,
-			selImg: 0,
-			home_image: '',
-			myinfo: {},
-			tag_list: [],
-			image_list: [],
-			imgs: [],
-			descs: [],
-			list_wish: [],
-			content: '',
-			tableTotal: 0,
-			author: {},
-			// 添加文章信息字段
-			articleInfo: {
-				title: '',
-				content: '',
-				create_time: '',
-				images: '',
-				view_count: 0,
-				author: '',
-				like_count: 0,
-				is_like: false
-			},
-			workInfo: {},
-			myInfo: {
-				user_id: 1, // 用户id
-				user_name: "", // 用户名
-				user_avatar: "", // 用户头像地址
-			},
-			// 文章作者信息(提示: 一般来自localstorage, 如果是实时获取的话, 那么获取到数据后再v-if显示评论组件)
-			userInfo: {
-				user_id: 2, // 用户id
-				user_name: "", // 用户名
-				user_avatar: "", // 用户头像地址
-			},
-		}
-	},
-	onLoad(parms) {
-		let self = this;
-		this.arcID = parms.id || 133;
-	},
-	onShow() {
-		uni.$emit('check_update');
-		this.$nextTick(() => {
-			if (this.$refs.commentSection) {
-				this.$refs.commentSection.loadCommentData();
-			}
-		});
-		this.loadData();
-	},
-	methods: {
-		// 返回上一页
-		goBack() {
-			uni.navigateBack({
-				delta: 1
-			});
-		},
-
-		// 文章点赞
-		likeArticle() {
-			uni.request({
-				url: this.$apiHost + '/Work/zanTA',
-				data: {
-					uuid: getApp().globalData.uuid,
-					id: this.arcID
-				},
-				header: {
-					"content-type": "application/json",
-					'sign': getApp().globalData.headerSign
-				},
-				success: (res) => {
-					console.log("点赞结果:", res.data);
-					if (res.data.success === "yes") {
-						// 更新点赞状态
-						if (!this.articleInfo.is_like) {
-							this.articleInfo.like_count = (this.articleInfo.like_count || 0) + 1;
-							this.articleInfo.is_like = true;
-							uni.showToast({
-								title: '点赞成功',
-								icon: 'none'
-							});
-						} else {
-							this.articleInfo.like_count = (this.articleInfo.like_count || 0) - 1;
-							this.articleInfo.is_like = false;
-							uni.showToast({
-								title: res.data.str,
-								icon: 'none'
-							});
-						}
-					} else {
-						uni.showToast({
-							title: res.data.str,
-							icon: 'none'
-						});
-					}
-				},
-				fail: (e) => {
-					console.log("点赞失败:", e);
-					uni.showToast({
-						title: '网络请求失败',
-						icon: 'none'
-					});
-				}
-			});
-		},
-		// 关注作者
-		followTheAuthor(n) {
-			uni.request({
-				url: this.$apiHost + '/Member/attention',
-				data: {
-					uuid: getApp().globalData.uuid,
-					id: this.author.id
-				},
-				header: {
-					"content-type": "application/json",
-					'sign': getApp().globalData.headerSign
-				},
-				success: (res) => {
-					console.log("点赞结果:", res.data);
-					uni.showToast({
-						title: res.data.str,
-						icon: 'none'
-					});
-					if (res.data.success === "yes") {
-						console.log("关注结果:", res.data, n);
-
-						this.author.is_attention = n
-					}
-				},
-				fail: (e) => {
-					console.log("关注失败:", e);
-					uni.showToast({
-						title: '网络请求失败',
-						icon: 'none'
-					});
-				}
-			});
-		},
-		totalNumberOfComments(tableTotal) {
-			this.tableTotal = tableTotal;
-		},
-		onLinqu(item) {
-			uni.navigateTo({
-				url: '/pages/my/wishHelp?id=' + item.myid,
-			})
-		},
-		selPhoto(item, sel) {
-			this.selImg = sel;
-			this.home_image = this.image_list[sel];
-		},
-		toArr(imgs) {
-			let arr = imgs.split("|");
-			return arr;
-		},
-		previewOpen(imgs1, index) {
-			this.imgs = imgs1.split("|");
-			setTimeout(() => this.$refs.previewImage.open(index), 0)
-			return; //如需测试和uni原生预览差别可注释这两行
-		},
-		loadData() {
-			uni.request({
-				url: this.$apiHost + '/Article/getinfo',
-				data: {
-					uuid: getApp().globalData.uuid,
-					id: this.arcID
-				},
-				header: {
-					"content-type": "application/json",
-					'sign': getApp().globalData.headerSign
-				},
-				success: (res) => {
-					console.log("文章信息:", res.data);
-					if (res.data.success === "yes") {
-						// 更新文章信息
-						this.articleInfo = res.data.article;
-						this.swperImages = this.imageString(res.data.article.images);
-						console.log("swperImages", this.swperImages);
-
-						this.author = res.data.author;
-						this.workInfo = res.data.work_info;
-						const nodes = htmlParser(res.data.article.content);
-						// #ifdef APP-PLUS-NVUE
-						parseImgs(nodes)
-						// #endif
-						this.content = nodes
-
-						// 更新图片列表
-						if (res.data.article.images && res.data.article.images !== "") {
-							this.image_list = res.data.article.images.split(",");
-							this.home_image = this.image_list[0];
-						} else {
-							this.home_image = "../../static/home/avator.png";
-						}
-						console.log("img", this.home_image);
-
-						// 更新标签列表
-						// if (res.data.data.tags && res.data.data.tags !== "") {
-						// 	this.tag_list = res.data.data.tags.split(",");
-						// }
-					} else {
-						uni.showToast({
-							title: '获取文章信息失败',
-							icon: 'none'
-						});
-					}
-				},
-				complete: (com) => {
-					// uni.hideLoading();
-				},
-				fail: (e) => {
-					console.log("请求失败:", e);
-					uni.showToast({
-						title: '网络请求失败',
-						icon: 'none'
-					});
-				}
-			});
-		},
-		// 评论相关方法已移至CommentSection组件
-
-		// 唤起新评论弹框
-		openComment() {
-			if (this.$refs.commentSection) {
-				this.$refs.commentSection.openComment();
-			}
-		},
-		// 文章点赞 
-		// 分享文章
-		shareArticle() {
-			// 如果在微信小程序环境
-			if (uni.getSystemInfoSync().platform === 'mp-weixin') {
-				uni.showShareMenu({
-					withShareTicket: true,
-					menus: ['shareAppMessage', 'shareTimeline']
-				});
-			} else {
-				// 其他环境,如APP
-				uni.share({
-					provider: "weixin",
-					scene: "WXSceneSession",
-					type: 0,
-					title: this.articleInfo.title,
-					summary: this.articleInfo.content.substring(0, 40) + "...",
-					imageUrl: this.home_image,
-					success: function (res) {
-						console.log("分享成功:" + JSON.stringify(res));
-					},
-					fail: function (err) {
-						console.log("分享失败:" + JSON.stringify(err));
-					}
-				});
-			}
-		},
-		// 评论回调事件
-		replyFun({
-			params
-		}, callback) {
-			// params = {
-			// 	...params,
-			// 	user_id: this.myInfo.user_id, // 用户id
-			// 	user_name: this.myInfo.user_name, // 用户名
-			// 	user_avatar: this.myInfo.user_avatar, // 用户头像地址
-			// 	user_content: this.commentValue, // 用户评论内容
-			// 	is_like: false, // 是否点赞
-			// 	like_count: 0, // 点赞数统计
-			// 	create_time: "刚刚", // 创建时间
-			// 	owner: true, // 是否为所有者 所有者可以进行删除 管理员默认true
-			// };
-			console.log("replyFun", {
-				uuid: getApp().globalData.uuid,
-				article_id: this.arcID, // 文章ID
-				content: params.user_content, // 评论内容
-				parent_id: params.parent_id || 0, // 父评论ID
-				reply_id: params.reply_id || 0, // 回复的评论ID
-				reply_name: params.reply_name || '' // 被回复人名称
-			});
-			uni.request({
-				url: this.$apiHost + '/Article/newComment',
-				data: {
-					uuid: getApp().globalData.uuid,
-					type: 'article',
-					article_id: this.arcID, // 文章ID
-					content: params.user_content, // 评论内容
-					parent_id: params.parent_id || 0, // 父评论ID
-					reply_id: params.reply_id || 0, // 回复的评论ID
-					reply_name: params.reply_name || '' // 被回复人名称
-				},
-				header: {
-					"content-type": "application/json",
-					'sign': getApp().globalData.headerSign
-				},
-				success: (res) => {
-					console.log("评论结果:", res.data);
-					if (res.data.success === "yes") {
-						callback(res.data); // 评论成功,传入后端返回的数据
-					}
-				},
-				fail: (e) => {
-					console.log("评论失败:", e);
-					uni.showToast({
-						title: '评论失败,请重试',
-						icon: 'none'
-					});
-				}
-			});
-		},
-		/** 删除回调事件
-		 * mode 删除模式
-		 * -- bind: 当被删除的一级评论存在回复评论, 那么该评论内容变更显示为[当前评论内容已被移除]
-		 * -- only: 仅删除当前评论(后端删除相关联的回复评论, 否则总数显示不对)
-		 * -- all : 删除所有评论包括回复评论 前端遍历子评论上报
-		 */
-
-		deleteFun({
-			params,
-			mode
-		}, callback) {
-			console.log("deleteFun", {
-				params,
-				mode
-			});
-			// 将params转换为逗号分隔的字符串
-			const idsString = Array.isArray(params) ? params.join(',') : params.toString();
-
-			console.log("删除评论", idsString, mode)
-			uni.request({
-				url: this.$apiHost + '/Article/delComment',
-				data: {
-					uuid: getApp().globalData.uuid,
-					ids: idsString, // 将params转换为逗号分隔的字符串传递给ids
-					mode: mode
-				},
-				header: {
-					"content-type": "application/json",
-					'sign': getApp().globalData.headerSign
-				},
-				success: (res) => {
-					console.log("删除结果:", res.data);
-					if (res.data.success === "yes") {
-						callback(res);
-					}
-				},
-				fail: (e) => { }
-			});
-			// switch (mode) {
-			// 	case "bind":
-			// 		// 逻辑: 调用接口进行评论内容修改 update
-			// 		setTimeout(() => callback(), 500); // 目前为了展示效果, 直接执行callback
-			// 		break;
-			// 	case "only":
-			// 		// 逻辑: 调用接口删除一个评论 delete
-			// 		setTimeout(() => callback(), 500); // 目前为了展示效果, 直接执行callback
-			// 		break;
-			// 	default:
-			// 		// all
-			// 		// 逻辑: 调用接口删除多个评论 [delete]
-			// 		setTimeout(() => callback(), 500); // 目前为了展示效果, 直接执行callback
-			// 		break;
-			// }
-		},
-
-
-		showActionSheet(n) {
-			if (n == 0) {
-				this.items = [
-					{ text: '分享作品', icon: '../../static/icon/cz_icon_fenxiangzuopin.png' },
-				]
-			}
-			if (n == 1) {
-				this.items = [
-					{ text: '分享作品', icon: '../../static/icon/cz_icon_fenxiangzuopin.png' },
-					{ text: '修改帖子', icon: '../../static/icon/cz_icon_xiugaifengmian.png' },
-					{ text: '删除作品', icon: '../../static/icon/sy_icon_shanchu.png', danger: true }
-				]
-
-			}
-			this.$refs.actionSheet.show();
-		},
-		handleActionCancel() {
-			console.log('ActionSheet cancelled');
-		},
-		handleActionSelect(index, item) {
-			console.log('ActionSheet selected index:', item.text,);
-			switch (item.text) {
-				case '分享作品':
-					console.log('分享作品');
-
-					break;
-				case '修改帖子':
-					console.log('修改帖子');
-					uni.navigateTo({
-						url: '/pages/make/fabuArticle?id=' + this.fileInformation.id
-					});
-					break;
-				case '删除作品':
-					console.log('删除作品');
-
-					break;
-
-			}
-		},
-		imageString(str) {
-			if (!str) {
-				return []
-			}
-			return str.split('|')
-		}
-
-	}
-}
+  components: {
+    previewImage,
+    CommentSection,
+    CustomPopup,
+  },
+  data() {
+    return {
+      swperImages: [],
+      items: [],
+      title: "",
+      arcID: 0,
+      selImg: 0,
+      home_image: "",
+      myinfo: {},
+      tag_list: [],
+      image_list: [],
+      imgs: [],
+      descs: [],
+      list_wish: [],
+      content: "",
+      tableTotal: 0,
+      author: {},
+      // 添加文章信息字段
+      articleInfo: {
+        title: "",
+        content: "",
+        create_time: "",
+        images: "",
+        view_count: 0,
+        author: "",
+        like_count: 0,
+        is_like: false,
+      },
+      workInfo: {},
+      myInfo: {
+        user_id: getApp().globalData.mobile, // 用户id
+        user_name: getApp().globalData.nickname, // 用户名
+        user_avatar: getApp().globalData.avator, // 用户头像地址
+      },
+      // 文章作者信息(提示: 一般来自localstorage, 如果是实时获取的话, 那么获取到数据后再v-if显示评论组件)
+      userInfo: {
+        user_id: 0, // 用户id
+        user_name: "", // 用户名
+        user_avatar: "", // 用户头像地址
+      },
+    };
+  },
+  onLoad(parms) {
+    let self = this;
+    this.arcID = parms.id || 396;
+  },
+  onShow() {
+    uni.$emit("check_update");
+    this.$nextTick(() => {
+      if (this.$refs.commentSection) {
+        this.$refs.commentSection.loadCommentData();
+      }
+    });
+    this.loadData();
+  },
+  methods: {
+    openConfirmationBox() {
+      this.$refs.confirmationBox.open();
+    },
+    closeConfirmationBox() {
+      this.$refs.confirmationBox.close();
+    },
+    // 返回上一页
+    goBack() {
+      uni.navigateBack({
+        delta: 1,
+      });
+    },
+
+    // 文章点赞
+    likeArticle() {
+      uni.request({
+        url: this.$apiHost + "/Work/zanTA",
+        data: {
+          uuid: getApp().globalData.uuid,
+          id: this.arcID,
+        },
+        header: {
+          "content-type": "application/json",
+          sign: getApp().globalData.headerSign,
+        },
+        success: (res) => {
+          console.log("点赞结果:", res.data);
+          if (res.data.success === "yes") {
+            // 更新点赞状态
+            if (!this.articleInfo.is_like) {
+              this.articleInfo.like_count =
+                (this.articleInfo.like_count || 0) + 1;
+              this.articleInfo.is_like = true;
+              uni.showToast({
+                title: "点赞成功",
+                icon: "none",
+              });
+            } else {
+              this.articleInfo.like_count =
+                (this.articleInfo.like_count || 0) - 1;
+              this.articleInfo.is_like = false;
+              uni.showToast({
+                title: res.data.str,
+                icon: "none",
+              });
+            }
+          } else {
+            uni.showToast({
+              title: res.data.str,
+              icon: "none",
+            });
+          }
+        },
+        fail: (e) => {
+          console.log("点赞失败:", e);
+          uni.showToast({
+            title: "网络请求失败",
+            icon: "none",
+          });
+        },
+      });
+    },
+    // 关注作者
+    followTheAuthor(n) {
+      uni.request({
+        url: this.$apiHost + "/Member/attention",
+        data: {
+          uuid: getApp().globalData.uuid,
+          id: this.author.id,
+        },
+        header: {
+          "content-type": "application/json",
+          sign: getApp().globalData.headerSign,
+        },
+        success: (res) => {
+          console.log("点赞结果:", res.data);
+          uni.showToast({
+            title: res.data.str,
+            icon: "none",
+          });
+          if (res.data.success === "yes") {
+            console.log("关注结果:", res.data, n);
+
+            this.author.is_attention = n;
+          }
+        },
+        fail: (e) => {
+          console.log("关注失败:", e);
+          uni.showToast({
+            title: "网络请求失败",
+            icon: "none",
+          });
+        },
+      });
+    },
+    totalNumberOfComments(tableTotal) {
+      this.tableTotal = tableTotal;
+    },
+    onLinqu(item) {
+      uni.navigateTo({
+        url: "/pages/my/wishHelp?id=" + item.myid,
+      });
+    },
+    selPhoto(item, sel) {
+      this.selImg = sel;
+      this.home_image = this.image_list[sel];
+    },
+    goToDetails(id) {
+      console.log("goToDetails", id);
+      uni.navigateTo({
+        url: "/pages/index/workDetail?id=" + id,
+      });
+      console.log("goToDetails", id);
+    },
+    toArr(imgs) {
+      let arr = imgs.split("|");
+      return arr;
+    },
+    previewOpen(imgs1, index) {
+      this.imgs = imgs1.split("|");
+      setTimeout(() => this.$refs.previewImage.open(index), 0);
+      return; //如需测试和uni原生预览差别可注释这两行
+    },
+    loadData() {
+      uni.request({
+        url: this.$apiHost + "/Article/getinfo",
+        data: {
+          uuid: getApp().globalData.uuid,
+          id: this.arcID,
+        },
+        header: {
+          "content-type": "application/json",
+          sign: getApp().globalData.headerSign,
+        },
+        success: (res) => {
+          console.log("文章信息:", res.data);
+          if (res.data.success === "yes") {
+            // 更新文章信息
+            this.articleInfo = res.data.article;
+            this.swperImages = this.imageString(res.data.article.images);
+            console.log("swperImages", this.swperImages);
+            this.userInfo.user_id = res.data.id; // 用户id
+            this.userInfo.user_name = res.data.nickname; // 用户名
+            this.userInfo.user_avatar = res.data.avator; // 用户头像地址
+            this.author = res.data.author;
+            this.workInfo = res.data.work_info;
+            const nodes = htmlParser(res.data.article.content);
+            // #ifdef APP-PLUS-NVUE
+            parseImgs(nodes);
+            // #endif
+            this.content = nodes;
+
+            // 更新图片列表
+            if (res.data.article.images && res.data.article.images !== "") {
+              this.image_list = res.data.article.images.split(",");
+              this.home_image = this.image_list[0];
+            } else {
+              this.home_image = "../../static/home/avator.png";
+            }
+            console.log("img", this.home_image);
+
+            // 更新标签列表
+            // if (res.data.data.tags && res.data.data.tags !== "") {
+            // 	this.tag_list = res.data.data.tags.split(",");
+            // }
+          } else {
+            uni.showToast({
+              title: "获取文章信息失败",
+              icon: "none",
+            });
+          }
+        },
+        complete: (com) => {
+          // uni.hideLoading();
+        },
+        fail: (e) => {
+          console.log("请求失败:", e);
+          uni.showToast({
+            title: "网络请求失败",
+            icon: "none",
+          });
+        },
+      });
+    },
+    // 评论相关方法已移至CommentSection组件
+
+    // 唤起新评论弹框
+    openComment() {
+      if (this.$refs.commentSection) {
+        this.$refs.commentSection.openComment();
+      }
+    },
+    // 文章点赞
+    // 分享文章
+    shareArticle() {
+      // 如果在微信小程序环境
+      if (uni.getSystemInfoSync().platform === "mp-weixin") {
+        uni.showShareMenu({
+          withShareTicket: true,
+          menus: ["shareAppMessage", "shareTimeline"],
+        });
+      } else {
+        // 其他环境,如APP
+        uni.share({
+          provider: "weixin",
+          scene: "WXSceneSession",
+          type: 0,
+          title: this.articleInfo.title,
+          summary: this.articleInfo.content.substring(0, 40) + "...",
+          imageUrl: this.home_image,
+          success: function (res) {
+            console.log("分享成功:" + JSON.stringify(res));
+          },
+          fail: function (err) {
+            console.log("分享失败:" + JSON.stringify(err));
+          },
+        });
+      }
+    },
+    // 评论回调事件
+    replyFun({ params }, callback) {
+      // params = {
+      // 	...params,
+      // 	user_id: this.myInfo.user_id, // 用户id
+      // 	user_name: this.myInfo.user_name, // 用户名
+      // 	user_avatar: this.myInfo.user_avatar, // 用户头像地址
+      // 	user_content: this.commentValue, // 用户评论内容
+      // 	is_like: false, // 是否点赞
+      // 	like_count: 0, // 点赞数统计
+      // 	create_time: "刚刚", // 创建时间
+      // 	owner: true, // 是否为所有者 所有者可以进行删除 管理员默认true
+      // };
+      console.log("replyFun", {
+        uuid: getApp().globalData.uuid,
+        article_id: this.arcID, // 文章ID
+        content: params.user_content, // 评论内容
+        parent_id: params.parent_id || 0, // 父评论ID
+        reply_id: params.reply_id || 0, // 回复的评论ID
+        reply_name: params.reply_name || "", // 被回复人名称
+      });
+      uni.request({
+        url: this.$apiHost + "/Article/newComment",
+        data: {
+          uuid: getApp().globalData.uuid,
+          type: "article",
+          article_id: this.arcID, // 文章ID
+          content: params.user_content, // 评论内容
+          parent_id: params.parent_id || 0, // 父评论ID
+          reply_id: params.reply_id || 0, // 回复的评论ID
+          reply_name: params.reply_name || "", // 被回复人名称
+        },
+        header: {
+          "content-type": "application/json",
+          sign: getApp().globalData.headerSign,
+        },
+        success: (res) => {
+          console.log("评论结果:", res.data);
+          if (res.data.success === "yes") {
+            callback(res.data); // 评论成功,传入后端返回的数据
+          }
+        },
+        fail: (e) => {
+          console.log("评论失败:", e);
+          uni.showToast({
+            title: "评论失败,请重试",
+            icon: "none",
+          });
+        },
+      });
+    },
+    /** 删除回调事件
+     * mode 删除模式
+     * -- bind: 当被删除的一级评论存在回复评论, 那么该评论内容变更显示为[当前评论内容已被移除]
+     * -- only: 仅删除当前评论(后端删除相关联的回复评论, 否则总数显示不对)
+     * -- all : 删除所有评论包括回复评论 前端遍历子评论上报
+     */
+
+    deleteFun({ params, mode }, callback) {
+      console.log("deleteFun", {
+        params,
+        mode,
+      });
+      // 将params转换为逗号分隔的字符串
+      const idsString = Array.isArray(params)
+        ? params.join(",")
+        : params.toString();
+
+      console.log("删除评论", idsString, mode);
+      uni.request({
+        url: this.$apiHost + "/Article/delComment",
+        data: {
+          uuid: getApp().globalData.uuid,
+          ids: idsString, // 将params转换为逗号分隔的字符串传递给ids
+          mode: mode,
+        },
+        header: {
+          "content-type": "application/json",
+          sign: getApp().globalData.headerSign,
+        },
+        success: (res) => {
+          console.log("删除结果:", res.data);
+          if (res.data.success === "yes") {
+            callback(res);
+          }
+        },
+        fail: (e) => {},
+      });
+      // switch (mode) {
+      // 	case "bind":
+      // 		// 逻辑: 调用接口进行评论内容修改 update
+      // 		setTimeout(() => callback(), 500); // 目前为了展示效果, 直接执行callback
+      // 		break;
+      // 	case "only":
+      // 		// 逻辑: 调用接口删除一个评论 delete
+      // 		setTimeout(() => callback(), 500); // 目前为了展示效果, 直接执行callback
+      // 		break;
+      // 	default:
+      // 		// all
+      // 		// 逻辑: 调用接口删除多个评论 [delete]
+      // 		setTimeout(() => callback(), 500); // 目前为了展示效果, 直接执行callback
+      // 		break;
+      // }
+    },
+
+    showActionSheet(n) {
+      if (n == 0) {
+        this.items = [
+          {
+            text: "分享作品",
+            icon: "../../static/icon/cz_icon_fenxiangzuopin.png",
+          },
+        ];
+      }
+      if (n == 1) {
+        this.items = [
+          {
+            text: "分享作品",
+            icon: "../../static/icon/cz_icon_fenxiangzuopin.png",
+          },
+          {
+            text: "修改帖子",
+            icon: "../../static/icon/cz_icon_xiugaifengmian.png",
+          },
+          {
+            text: "删除作品",
+            icon: "../../static/icon/sy_icon_shanchu.png",
+            danger: true,
+          },
+        ];
+      }
+      this.$refs.actionSheet.show();
+    },
+    handleActionCancel() {
+      console.log("ActionSheet cancelled");
+    },
+    handleActionSelect(index, item) {
+      console.log("ActionSheet selected index:", item.text);
+      switch (item.text) {
+        case "分享作品":
+          console.log("分享作品"); 
+          break;
+        case "修改帖子":
+          console.log("修改帖子");
+          uni.navigateTo({
+            url: "/pages/make/fabuArticle?id=" + this.fileInformation.id,
+          });
+          break;
+        case "删除作品":
+          console.log("删除作品");
+
+          break;
+      }
+    },
+    imageString(str) {
+      if (!str) {
+        return [];
+      }
+      return str.split("|");
+    },
+    cutTime(time) {
+      if (!time) {
+        return "";
+      }
+      return time.split(" ")[0];
+    },
+  },
+};
 </script>
 
 <style scoped lang="scss">
-@import 'articleDetail.scss';
+@import "articleDetail.scss";
 </style>

+ 1 - 1
pages/index/index.scss

@@ -293,7 +293,7 @@
 		background: #fff;	
 		border-top-left-radius: 20rpx;
 		border-top-right-radius: 20rpx;
-		/deep/.uv-swiper{
+		::v-deep.uv-swiper{
 			border-radius: 10rpx !important;
 			overflow: hidden;
 		}

+ 627 - 555
pages/index/workDetail.vue

@@ -1,571 +1,643 @@
 <template>
-	<view class="page">
-		<!-- 引入FontAwesome -->
-		<view>
-			<link rel="stylesheet"
-				href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
-		</view>
-
-
-
-		<!-- 顶部导航栏 -->
-		<view class="custom-navbar">
-			<view class="navbar-left" @click="goBack">
-				<text class="fa fa-angle-left"></text>
-			</view>
-			<view class="navbar-center">
-				<view class="navbar-title">
-					<image class="navbar-avatar" :src="author.avator" mode="aspectFill"></image>
-					<text class="navbar-text">{{ author.nickname }}</text>
-					<!-- <text class="navbar-badge" v-if="author.is_vip > 0">VIP</text> -->
-				</view>
-			</view>
-			<view class="navbar-right">
-				<text class="followTheAuthor followTheAuthor1" v-if="author.is_attention == 0"
-					@click="followTheAuthor(1)">+关注</text>
-				<text class="followTheAuthor followTheAuthor0" v-if="author.is_attention == 1"
-					@click="followTheAuthor(0)">已关注</text>
-				<image v-if="true" @click="showActionSheet(0)" src="../../static/icon/sy_icon_fenxiang.png"
-					mode="widthFix"></image>
-				<view v-else class="navbar-right" @click="showActionSheet(1)">
-					<text class="fa fa-ellipsis-h"></text>
-				</view>
-			</view>
-		</view>
-
-
-		<!-- 灵感 -->
-		<template v-if="articleInfo.task_type == 1">
-			<view class="inspiration-content" v-if="home_image">
-				<image v-if="home_image" src="../../static/makedetail/cz_img_zhanshi.png" mode="widthFix"></image>
-				<image :src="home_image" class="inspirationPictures" mode="widthFix"></image>
-			</view>
-		</template>
-		<!-- 音乐 -->
-		<template v-else-if="articleInfo.task_type == 2">
-			<view class="musicContentBox">
-				<view class="headCard">
-					<image :src="home_image" class="songCover"></image>
-					<view class="songInfo">
-						<view class="songTitle">{{ addBrackets(articleInfo.title) }}</view>
-						<view class="songTag">
-							<view class="tag" v-for="(item, index) in commaToArray(articleInfo.style)"
-								:key="index + item">{{ item }}</view>
-						</view>
-					</view>
-					<template v-if="articleInfo.task_type == 2">
-
-						<image @click="toggleAudio" v-if="isPlaying" src="@/static/makedetail/cz_icon_zanting.png"
-							class="playerButton"></image>
-						<image @click="toggleAudio" v-else src="@/static/makedetail/cz_icon_bofang.png"
-							class="playerButton"></image>
-					</template>
-				</view>
-				<view class="contentHeader">
-					<view class="musicContent">
-						<text> {{ articleInfo.lyrics }}</text>
-						<image class="roll" src="@/static/icon/roll.png"></image>
-					</view>
-					<view class="maskLayer"></view>
-				</view>
-
-			</view>
-
-		</template>
-
-		<!-- 作品描述 -->
-		<view class="workDescription">
-			<view class="workDescription-title">
-				<view>创作说明 </view>
-				<!-- <image class="pen" src="@/static/icon/wd_icon_bianji.png"></image> -->
-			</view>
-			<view class="workDescription-content">
-				{{ content || '暂无内容' }}
-			</view>
-		</view>
-
-		<view class="goCreate" @click="goCreate()">去创作</view>
-		<DialogBox ref="customConfirm"></DialogBox>
-
-
-
-
-
-
-
-
-
-
-		<!-- 文章头图区域 -->
-		<view class="topUser" v-if="false">
-			<image :src="home_image" class="home_image" mode="aspectFill"></image>
-			<!-- 图片指示器 -->
-			<view class="image-indicator" v-if="image_list.length > 1">
-				<text>{{ selImg + 1 }}/{{ image_list.length }}</text>
-			</view>
-			<!-- 音乐类型时显示歌词 -->
-			<view class="lyrics-overlay" v-if="articleInfo.task_type == 2">
-				<text class="lyrics-text">{{ articleInfo.lyrics }}</text>
-			</view>
-			<!-- 音乐类型时显示播放按钮 -->
-			<view class="play-button" v-if="articleInfo.task_type == 2 && articleInfo.result_audio"
-				@click="toggleAudio">
-				<text class="fa" :class="isPlaying ? 'fa-pause' : 'fa-play'"></text>
-			</view>
-			<!-- 缩略图列表 -->
-			<view class="list">
-				<view class="img" :class="selImg == index ? 'active' : ''" v-for="(item, index) in image_list"
-					:key="index" @click="selPhoto(item, index)">
-					<image :src="item" mode="aspectFill"></image>
-				</view>
-			</view>
-		</view>
-
-		<!-- 音频元素 -->
-		<audio id="audioPlayer" :src="articleInfo.result_audio" style="display:none;" v-if="false"></audio>
-
-		<!-- 文章内容区域 -->
-		<view class="body" v-if="false">
-			<!-- 文章标题与元信息 -->
-			<view class="article-header">
-				<view class="title">
-					{{ articleInfo.title || '暂无标题' }}
-				</view>
-				<view class="meta-info">
-					<view class="meta-item">
-						<text class="fa fa-calendar"></text>
-						<text class="meta-text">{{ articleInfo.create_time || '暂无时间' }}</text>
-					</view>
-					<view class="meta-item">
-						<text class="fa fa-eye"></text>
-						<text class="meta-text">{{ articleInfo.num_view || 0 }}次阅读</text>
-					</view>
-					<view class="meta-item" v-if="articleInfo.author">
-						<text class="fa fa-user"></text>
-						<text class="meta-text">{{ articleInfo.author }}</text>
-					</view>
-				</view>
-			</view>
-
-			<!-- 内容分隔线 -->
-			<view class="divider"></view>
-
-			<!-- 文章内容 -->
-			<!-- <view class="article-content" v-if="articleInfo.type == 'user'">
+  <view class="page">
+    <!-- 引入FontAwesome -->
+    <view>
+      <link
+        rel="stylesheet"
+        href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
+      />
+    </view>
+
+    <!-- 顶部导航栏 -->
+    <view class="custom-navbar">
+      <view class="navbar-left" @click="goBack">
+        <text class="fa fa-angle-left"></text>
+      </view>
+      <view class="navbar-center">
+        <view class="navbar-title">
+          <image
+            class="navbar-avatar"
+            :src="author.avator"
+            mode="aspectFill"
+          ></image>
+          <text class="navbar-text">{{ author.nickname }}</text>
+          <!-- <text class="navbar-badge" v-if="author.is_vip > 0">VIP</text> -->
+        </view>
+      </view>
+      <view class="navbar-right">
+        <text
+          class="followTheAuthor followTheAuthor1"
+          v-if="author.is_attention == 0"
+          @click="followTheAuthor(1)"
+          >+关注</text
+        >
+        <text
+          class="followTheAuthor followTheAuthor0"
+          v-if="author.is_attention == 1"
+          @click="followTheAuthor(0)"
+          >已关注</text
+        >
+        <image
+          v-if="true"
+          @click="showActionSheet(0)"
+          src="../../static/icon/sy_icon_fenxiang.png"
+          mode="widthFix"
+        ></image>
+        <view v-else class="navbar-right" @click="showActionSheet(1)">
+          <text class="fa fa-ellipsis-h"></text>
+        </view>
+      </view>
+    </view>
+
+    <!-- 灵感 -->
+    <template v-if="articleInfo.task_type == 1">
+      <view class="inspiration-content" v-if="home_image">
+        <image
+          v-if="home_image"
+          src="../../static/makedetail/cz_img_zhanshi.png"
+          mode="widthFix"
+        ></image>
+        <image
+          :src="home_image"
+          class="inspirationPictures"
+          mode="widthFix"
+        ></image>
+      </view>
+    </template>
+    <!-- 音乐 -->
+    <template v-else-if="articleInfo.task_type == 2">
+      <view class="musicContentBox">
+        <view class="headCard">
+          <image :src="home_image" class="songCover"></image>
+          <view class="songInfo">
+            <view class="songTitle">{{ addBrackets(articleInfo.title) }}</view>
+            <view class="songTag">
+              <view
+                class="tag"
+                v-for="(item, index) in commaToArray(articleInfo.style)"
+                :key="index + item"
+                >{{ item }}</view
+              >
+            </view>
+          </view>
+          <template v-if="articleInfo.task_type == 2">
+            <image
+              @click="toggleAudio"
+              v-if="isPlaying"
+              src="@/static/makedetail/cz_icon_zanting.png"
+              class="playerButton"
+            ></image>
+            <image
+              @click="toggleAudio"
+              v-else
+              src="@/static/makedetail/cz_icon_bofang.png"
+              class="playerButton"
+            ></image>
+          </template>
+        </view>
+        <view class="contentHeader">
+          <view class="musicContent">
+            <text> {{ articleInfo.lyrics }}</text>
+            <image class="roll" src="@/static/icon/roll.png"></image>
+          </view>
+          <view class="maskLayer"></view>
+        </view>
+      </view>
+    </template>
+
+    <!-- 作品描述 -->
+    <view class="workDescription">
+      <view class="workDescription-title">
+        <view>创作说明 </view>
+        <!-- <image class="pen" src="@/static/icon/wd_icon_bianji.png"></image> -->
+      </view>
+      <view class="workDescription-content">
+        {{ content || "暂无内容" }}
+      </view>
+    </view>
+
+    <view class="goCreate" @click="goCreate()">去创作</view>
+    <DialogBox ref="customConfirm"></DialogBox>
+
+    <!-- 文章头图区域 -->
+    <view class="topUser" v-if="false">
+      <image :src="home_image" class="home_image" mode="aspectFill"></image>
+      <!-- 图片指示器 -->
+      <view class="image-indicator" v-if="image_list.length > 1">
+        <text>{{ selImg + 1 }}/{{ image_list.length }}</text>
+      </view>
+      <!-- 音乐类型时显示歌词 -->
+      <view class="lyrics-overlay" v-if="articleInfo.task_type == 2">
+        <text class="lyrics-text">{{ articleInfo.lyrics }}</text>
+      </view>
+      <!-- 音乐类型时显示播放按钮 -->
+      <view
+        class="play-button"
+        v-if="articleInfo.task_type == 2 && articleInfo.result_audio"
+        @click="toggleAudio"
+      >
+        <text class="fa" :class="isPlaying ? 'fa-pause' : 'fa-play'"></text>
+      </view>
+      <!-- 缩略图列表 -->
+      <view class="list">
+        <view
+          class="img"
+          :class="selImg == index ? 'active' : ''"
+          v-for="(item, index) in image_list"
+          :key="index"
+          @click="selPhoto(item, index)"
+        >
+          <image :src="item" mode="aspectFill"></image>
+        </view>
+      </view>
+    </view>
+
+    <!-- 音频元素 -->
+    <audio
+      id="audioPlayer"
+      :src="articleInfo.result_audio"
+      style="display: none"
+      v-if="false"
+    ></audio>
+
+    <!-- 文章内容区域 -->
+    <view class="body" v-if="false">
+      <!-- 文章标题与元信息 -->
+      <view class="article-header">
+        <view class="title">
+          {{ articleInfo.title || "暂无标题" }}
+        </view>
+        <view class="meta-info">
+          <view class="meta-item">
+            <text class="fa fa-calendar"></text>
+            <text class="meta-text">{{
+              articleInfo.create_time || "暂无时间"
+            }}</text>
+          </view>
+          <view class="meta-item">
+            <text class="fa fa-eye"></text>
+            <text class="meta-text">{{ articleInfo.num_view || 0 }}次阅读</text>
+          </view>
+          <view class="meta-item" v-if="articleInfo.author">
+            <text class="fa fa-user"></text>
+            <text class="meta-text">{{ articleInfo.author }}</text>
+          </view>
+        </view>
+      </view>
+
+      <!-- 内容分隔线 -->
+      <view class="divider"></view>
+
+      <!-- 文章内容 -->
+      <!-- <view class="article-content" v-if="articleInfo.type == 'user'">
 				<view class="content">{{ articleInfo.content || '暂无内容' }}</view>
 			</view> -->
-			<view class="article-content">
-				<view class="content">
-					<rich-text :nodes="content" style="font-size: 14px;"></rich-text>
-				</view>
-			</view>
-
-			<!-- 文章底部区域 -->
-			<view class="article-footer">
-				<view class="action-bar">
-					<view class="action-item" @tap="likeArticle">
-						<text class="fa" :class="articleInfo.is_like ? 'fa-thumbs-up liked' : 'fa-thumbs-o-up'"></text>
-						<text class="action-text">{{ articleInfo.like_count || 0 }}</text>
-					</view>
-					<view class="action-item" @tap="openComment">
-						<text class="fa fa-comment-o"></text>
-						<text class="action-text">{{ tableTotal || 0 }}</text>
-					</view>
-					<view class="action-item" @tap="shareArticle">
-						<text class="fa fa-share-alt"></text>
-						<text class="action-text">分享</text>
-					</view>
-				</view>
-			</view>
-
-			<!-- 空白占位 -->
-			<view class="list_info">
-				<view class="blankHeight"></view>
-			</view>
-
-		</view>
-
-		<!-- <view class="btn_submit" @click="chatTA()">
+      <view class="article-content">
+        <view class="content">
+          <rich-text :nodes="content" style="font-size: 14px"></rich-text>
+        </view>
+      </view>
+
+      <!-- 文章底部区域 -->
+      <view class="article-footer">
+        <view class="action-bar">
+          <view class="action-item" @tap="likeArticle">
+            <text
+              class="fa"
+              :class="
+                articleInfo.is_like ? 'fa-thumbs-up liked' : 'fa-thumbs-o-up'
+              "
+            ></text>
+            <text class="action-text">{{ articleInfo.like_count || 0 }}</text>
+          </view>
+          <view class="action-item" @tap="openComment">
+            <text class="fa fa-comment-o"></text>
+            <text class="action-text">{{ tableTotal || 0 }}</text>
+          </view>
+          <view class="action-item" @tap="shareArticle">
+            <text class="fa fa-share-alt"></text>
+            <text class="action-text">分享</text>
+          </view>
+        </view>
+      </view>
+
+      <!-- 空白占位 -->
+      <view class="list_info">
+        <view class="blankHeight"></view>
+      </view>
+    </view>
+
+    <!-- <view class="btn_submit" @click="chatTA()">
 			<image class="icon" src="../../static/icon/icon_chat_white.png" mode="widthFix"></image>
 			私聊
 		</view> -->
-		<view class="thread2"></view>
-		<view class="thread2"></view>
-
-		<previewImage ref="previewImage" :opacity="0.8" :circular="true" :imgs="imgs" :descs="descs"></previewImage>
-
-		<!-- 评论区域 -->
-		<CommentSection ref="commentSection" :myInfo="myInfo" :userInfo="userInfo" :articleId="arcID"
-			@totalNumberOfComments="totalNumberOfComments"></CommentSection>
-
-		<!-- 自定义 ActionSheet -->
-		<ActionSheet ref="actionSheet" :items="items" @select="handleActionSelect" @cancel="handleActionCancel" />
-		<view class="thread2"></view>
-
-	</view>
+    <view class="thread2"></view>
+    <view class="thread2"></view>
+
+    <previewImage
+      ref="previewImage"
+      :opacity="0.8"
+      :circular="true"
+      :imgs="imgs"
+      :descs="descs"
+    ></previewImage>
+
+    <!-- 评论区域 -->
+    <CommentSection
+      v-if="userInfo.id != 0&& articleInfo.title" 
+      ref="commentSection"
+      :myInfo="myInfo"
+      :userInfo="userInfo"
+      :articleId="arcID"
+      @totalNumberOfComments="totalNumberOfComments"
+      articleInfo="articleInfo"
+    ></CommentSection>
+
+    <!-- 自定义 ActionSheet -->
+    <ActionSheet
+      ref="actionSheet"
+      :items="items"
+      @select="handleActionSelect"
+      @cancel="handleActionCancel"
+    />
+    <view class="thread2"></view>
+  </view>
 </template>
 
 <script>
-import htmlParser from '../../common/html-parser'
-import previewImage from '@/components/kxj-previewImage/kxj-previewImage.vue'; //引用插件
-import CommentSection from '@/components/CommentSection/CommentSection.vue';
-import ActionSheet from '@/components/ActionSheet/ActionSheet.vue';
+import htmlParser from "../../common/html-parser";
+import previewImage from "@/components/kxj-previewImage/kxj-previewImage.vue"; //引用插件
+import CommentSection from "@/components/CommentSection/CommentSection.vue";
+import ActionSheet from "@/components/ActionSheet/ActionSheet.vue";
 function parseImgs(nodes) {
-	nodes.forEach(node => {
-		if (
-			node.name === 'img' &&
-			node.attrs &&
-			node.attrs['data-img-size-val']
-		) {
-			const sizes = node.attrs['data-img-size-val'].split(',')
-			const width = uni.upx2px(720 * 0.9)
-			const height = parseInt(width * (sizes[1] / sizes[0]))
-			node.attrs.style = `width:${width};height:${height};`
-		}
-		if (Array.isArray(node.children)) {
-			parseImgs(node.children)
-		}
-	})
-	return nodes
+  nodes.forEach((node) => {
+    if (node.name === "img" && node.attrs && node.attrs["data-img-size-val"]) {
+      const sizes = node.attrs["data-img-size-val"].split(",");
+      const width = uni.upx2px(720 * 0.9);
+      const height = parseInt(width * (sizes[1] / sizes[0]));
+      node.attrs.style = `width:${width};height:${height};`;
+    }
+    if (Array.isArray(node.children)) {
+      parseImgs(node.children);
+    }
+  });
+  return nodes;
 }
 export default {
-	components: {
-		previewImage,
-		CommentSection,
-		ActionSheet
-	},
-	data() {
-		return {
-			title: '',
-			arcID: 0,
-			selImg: 0,
-			home_image: '',
-			articleInfo: {},
-			tag_list: [],
-			image_list: [],
-			imgs: [],
-			descs: [],
-			list_wish: [],
-			content: '',
-			author: {},
-			// 添加文章信息字段
-			articleInfo: {
-				title: '',
-				content: '',
-				create_time: '',
-				images: '',
-				view_count: 0,
-				author: '',
-				like_count: 0,
-				is_like: false
-			},
-			items: [],
-			myInfo: {
-				user_id: 1, // 用户id
-				user_name: "cc", // 用户名
-				user_avatar: "https://img0.baidu.com/it/u=2836960144,3650263035&fm=253&fmt=auto&app=138&f=JPEG?w=474&h=474", // 用户头像地址
-			},
-			// 文章作者信息(提示: 一般来自localstorage, 如果是实时获取的话, 那么获取到数据后再v-if显示评论组件)
-			userInfo: {
-				user_id: 2, // 用户id
-				user_name: "ikun", // 用户名
-				user_avatar: "https://pic1.zhimg.com/80/v2-a79071a705f55c5d88f6c74e6111fe84_720w.webp", // 用户头像地址
-			},
-			deleteMode: "all", //删除模式
-			// 评论总数
-			tableTotal: 4,
-			// 评论表
-			tableData: [],
-			isPlaying: false, // 添加播放状态
-			audioPlayer: null, // 添加音频播放器实例
-		}
-	},
-	onLoad(parms) {
-		let self = this;
-		this.arcID = parms.id || 393;
-	},
-	onShow() {
-		uni.$emit('check_update');
-		this.loadData();
-		this.$nextTick(() => {
-			if (this.$refs.commentSection) {
-				this.$refs.commentSection.loadCommentData();
-			}
-		});
-	},
-	onReady() {
-		// 初始化音频播放器
-		this.audioPlayer = uni.createInnerAudioContext();
-		this.audioPlayer.onEnded(() => {
-			this.isPlaying = false;
-		});
-	},
-	onUnload() {
-		// 页面卸载时停止音频播放
-		if (this.audioPlayer) {
-			this.audioPlayer.stop();
-			this.audioPlayer.destroy();
-		}
-	},
-	methods: {
-		// 返回上一页
-		goBack() {
-			uni.navigateBack({
-				delta: 1
-			});
-		},
-		totalNumberOfComments(tableTotal) {
-			this.tableTotal = tableTotal;
-		},
-		onLinqu(item) {
-			uni.navigateTo({
-				url: '/pages/my/wishHelp?id=' + item.myid,
-			})
-		},
-		selPhoto(item, sel) {
-			this.selImg = sel;
-			this.home_image = this.image_list[sel];
-		},
-		toArr(imgs) {
-			let arr = imgs.split("|");
-			return arr;
-		},
-		previewOpen(imgs1, index) {
-			this.imgs = imgs1.split("|");
-			setTimeout(() => this.$refs.previewImage.open(index), 0)
-			// 传入当前选中的图片地址或序号
-			return; //如需测试和uni原生预览差别可注释这两行
-		},
-		loadData() {
-			uni.request({
-				url: this.$apiHost + '/Work/getinfo',
-				data: {
-					uuid: getApp().globalData.uuid,
-					id: this.arcID
-				},
-				header: {
-					"content-type": "application/json",
-					'sign': getApp().globalData.headerSign
-				},
-				success: (res) => {
-					console.log("文章信息:", res.data);
-					if (res.data.success === "yes") {
-						console.log("文章信息:", res.data.data);
-
-						// 更新文章信息
-						this.articleInfo = res.data.data;
-						this.content = res.data.data.content;
-						this.home_image = res.data.data.images;
-						this.author = res.data.author;
-					} else {
-						uni.showToast({
-							title: '获取信息失败',
-							icon: 'none'
-						});
-					}
-				},
-				complete: (com) => {
-					// uni.hideLoading();
-				},
-				fail: (e) => {
-					console.log("请求失败:", e);
-					uni.showToast({
-						title: '网络请求失败',
-						icon: 'none'
-					});
-				}
-			});
-		},
-		// 唤起新评论弹框
-		openComment() {
-			if (this.$refs.commentSection) {
-				this.$refs.commentSection.openComment();
-			}
-		},
-		// 文章点赞
-		likeArticle() {
-			uni.request({
-				url: this.$apiHost + '/Work/zanTA',
-				data: {
-					uuid: getApp().globalData.uuid,
-					id: this.arcID
-				},
-				header: {
-					"content-type": "application/json",
-					'sign': getApp().globalData.headerSign
-				},
-				success: (res) => {
-					console.log("点赞结果:", res.data);
-					if (res.data.success === "yes") {
-						// 更新点赞状态
-						if (!this.articleInfo.is_like) {
-							this.articleInfo.like_count = (this.articleInfo.like_count || 0) + 1;
-							this.articleInfo.is_like = true;
-							uni.showToast({
-								title: '点赞成功',
-								icon: 'none'
-							});
-						} else {
-							this.articleInfo.like_count = (this.articleInfo.like_count || 0) - 1;
-							this.articleInfo.is_like = false;
-							uni.showToast({
-								title: res.data.str,
-								icon: 'none'
-							});
-						}
-					} else {
-						uni.showToast({
-							title: res.data.str,
-							icon: 'none'
-						});
-					}
-				},
-				fail: (e) => {
-					console.log("点赞失败:", e);
-					uni.showToast({
-						title: '网络请求失败',
-						icon: 'none'
-					});
-				}
-			});
-		},
-		// 关注作者
-		followTheAuthor(n) {
-			uni.request({
-				url: this.$apiHost + '/Member/attention',
-				data: {
-					uuid: getApp().globalData.uuid,
-					id: this.author.id
-				},
-				header: {
-					"content-type": "application/json",
-					'sign': getApp().globalData.headerSign
-				},
-				success: (res) => {
-					console.log("点赞结果:", res.data);
-					uni.showToast({
-						title: res.data.str,
-						icon: 'none'
-					});
-					if (res.data.success === "yes") {
-						console.log("关注结果:", res.data, n);
-
-						this.author.is_attention = n
-					}
-				},
-				fail: (e) => {
-					console.log("关注失败:", e);
-					uni.showToast({
-						title: '网络请求失败',
-						icon: 'none'
-					});
-				}
-			});
-		},
-		// 分享文章
-		shareArticle() {
-			// 如果在微信小程序环境
-			if (uni.getSystemInfoSync().platform === 'mp-weixin') {
-				uni.showShareMenu({
-					withShareTicket: true,
-					menus: ['shareAppMessage', 'shareTimeline']
-				});
-			} else {
-				// 其他环境,如APP
-				uni.share({
-					provider: "weixin",
-					scene: "WXSceneSession",
-					type: 0,
-					title: this.articleInfo.title,
-					summary: this.articleInfo.content.substring(0, 40) + "...",
-					imageUrl: this.home_image,
-					success: function (res) {
-						console.log("分享成功:" + JSON.stringify(res));
-					},
-					fail: function (err) {
-						console.log("分享失败:" + JSON.stringify(err));
-					}
-				});
-			}
-		},
-		// 切换音频播放状态
-		toggleAudio() {
-			if (!this.articleInfo.result_audio) return;
-
-			if (this.isPlaying) {
-				this.audioPlayer.pause();
-				this.isPlaying = false;
-			} else {
-				this.audioPlayer.src = this.articleInfo.result_audio;
-				this.audioPlayer.play();
-				this.isPlaying = true;
-			}
-		},
-		// 新增过滤器方法
-		commaToArray(str) {
-			if (!str) return '';
-			return str.split(',');
-		},
-
-		// 新增过滤器方法
-		addBrackets(str) {
-			if (!str) return '';
-			if (!str.startsWith('《')) {
-				str = '《' + str;
-			}
-			if (!str.endsWith('》')) {
-				str = str + '》';
-			}
-			return str;
-		},
-		getInfoData() {
-			uni.request({
-				url: this.$apiHost + '/Member/getinfoData',
-				data: {
-					uuid: getApp().globalData.uuid
-				},
-				header: {
-					'content-type': 'application/json'
-				},
-				success: (res) => {
-					console.log('用户信息', res.data);
-
-				}
-			});
-		},
-		showActionSheet(n) {
-			if (n == 0) {
-				this.items = [
-					{ text: '分享作品', icon: '../../static/icon/cz_icon_fenxiangzuopin.png' }, 
-				]
-			}
-			if (n == 1) {
-				this.items = [
-					{ text: '分享作品', icon: '../../static/icon/cz_icon_fenxiangzuopin.png' },
-					{ text: '修改封面', icon: '../../static/icon/cz_icon_xiugaifengmian.png' },
-					{ text: '删除作品', icon: '../../static/icon/sy_icon_shanchu.png', danger: true }
-				]
-
-			}
-			this.$refs.actionSheet.show();
-		},
-		handleActionCancel() {
-			console.log('ActionSheet cancelled');
-		},
-		handleActionSelect(index, item) {
-			console.log('ActionSheet selected index:', item.text,); 
-		},
-		goCreate() {
-			// 切换到标签页
-			uni.switchTab({
-				// 指定要切换到的页面路径
-				url: '/pages/make/index'
-			});
-		},
-	}
-}
+  components: {
+    previewImage,
+    CommentSection,
+    ActionSheet,
+  },
+  data() {
+    return {
+      title: "",
+      arcID: 0,
+      selImg: 0,
+      home_image: "",
+      articleInfo: {},
+      tag_list: [],
+      image_list: [],
+      imgs: [],
+      descs: [],
+      list_wish: [],
+      content: "",
+      author: {},
+      // 添加文章信息字段
+      articleInfo: {
+        title: "",
+        content: "",
+        create_time: "",
+        images: "",
+        view_count: 0,
+        author: "",
+        like_count: 0,
+        is_like: false,
+      },
+      items: [],
+      myInfo: {
+        user_id: getApp().globalData.mobile, // 用户id
+        user_name: getApp().globalData.nickname, // 用户名
+        user_avatar: getApp().globalData.avator , // 用户头像地址
+      },
+      // 文章作者信息(提示: 一般来自localstorage, 如果是实时获取的话, 那么获取到数据后再v-if显示评论组件)
+      userInfo: {
+        user_id: 0, // 用户id
+        user_name: "", // 用户名
+        user_avatar: "", // 用户头像地址
+      },
+      deleteMode: "all", //删除模式
+      // 评论总数
+      tableTotal: 4,
+      // 评论表
+      tableData: [],
+      isPlaying: false, // 添加播放状态
+      audioPlayer: null, // 添加音频播放器实例
+    };
+  },
+  onLoad(parms) {
+    let self = this;
+    this.arcID = parms.id || 393;
+  },
+  onShow() {
+    uni.$emit("check_update");
+    this.loadData();
+    this.$nextTick(() => {
+      if (this.$refs.commentSection) {
+        this.$refs.commentSection.loadCommentData();
+      }
+    });
+  },
+  onReady() {
+    // 初始化音频播放器
+    this.audioPlayer = uni.createInnerAudioContext();
+    this.audioPlayer.onEnded(() => {
+      this.isPlaying = false;
+    });
+  },
+  onUnload() {
+    // 页面卸载时停止音频播放
+    if (this.audioPlayer) {
+      this.audioPlayer.stop();
+      this.audioPlayer.destroy();
+    }
+  },
+  methods: {
+    // 返回上一页
+    goBack() {
+      uni.navigateBack({
+        delta: 1,
+      });
+    },
+    totalNumberOfComments(tableTotal) {
+      this.tableTotal = tableTotal;
+    },
+    onLinqu(item) {
+      uni.navigateTo({
+        url: "/pages/my/wishHelp?id=" + item.myid,
+      });
+    },
+    selPhoto(item, sel) {
+      this.selImg = sel;
+      this.home_image = this.image_list[sel];
+    },
+    toArr(imgs) {
+      let arr = imgs.split("|");
+      return arr;
+    },
+    previewOpen(imgs1, index) {
+      this.imgs = imgs1.split("|");
+      setTimeout(() => this.$refs.previewImage.open(index), 0);
+      // 传入当前选中的图片地址或序号
+      return; //如需测试和uni原生预览差别可注释这两行
+    },
+    loadData() {
+      uni.request({
+        url: this.$apiHost + "/Work/getinfo",
+        data: {
+          uuid: getApp().globalData.uuid,
+          id: this.arcID,
+        },
+        header: {
+          "content-type": "application/json",
+          sign: getApp().globalData.headerSign,
+        },
+        success: (res) => {
+          console.log("文章信息:", res.data);
+          if (res.data.success === "yes") {
+            console.log("文章信息:", res.data.data);
+
+            // 更新文章信息
+            this.articleInfo = res.data.data;
+            this.content = res.data.data.content;
+            this.home_image = res.data.data.images;
+            this.author = res.data.author;
+
+            this.userInfo.user_id = res.data.id; // 用户id
+            this.userInfo.user_name = res.data.nickname; // 用户名
+            this.userInfo.user_avatar = res.data.avator; // 用户头像地址
+          } else {
+            uni.showToast({
+              title: "获取信息失败",
+              icon: "none",
+            });
+          }
+        },
+        complete: (com) => {
+          // uni.hideLoading();
+        },
+        fail: (e) => {
+          console.log("请求失败:", e);
+          uni.showToast({
+            title: "网络请求失败",
+            icon: "none",
+          });
+        },
+      });
+    },
+    // 唤起新评论弹框
+    openComment() {
+      if (this.$refs.commentSection) {
+        this.$refs.commentSection.openComment();
+      }
+    },
+    // 文章点赞
+    likeArticle() {
+      uni.request({
+        url: this.$apiHost + "/Work/zanTA",
+        data: {
+          uuid: getApp().globalData.uuid,
+          id: this.arcID,
+        },
+        header: {
+          "content-type": "application/json",
+          sign: getApp().globalData.headerSign,
+        },
+        success: (res) => {
+          console.log("点赞结果:", res.data);
+          if (res.data.success === "yes") {
+            // 更新点赞状态
+            if (!this.articleInfo.is_like) {
+              this.articleInfo.like_count =
+                (this.articleInfo.like_count || 0) + 1;
+              this.articleInfo.is_like = true;
+              uni.showToast({
+                title: "点赞成功",
+                icon: "none",
+              });
+            } else {
+              this.articleInfo.like_count =
+                (this.articleInfo.like_count || 0) - 1;
+              this.articleInfo.is_like = false;
+              uni.showToast({
+                title: res.data.str,
+                icon: "none",
+              });
+            }
+          } else {
+            uni.showToast({
+              title: res.data.str,
+              icon: "none",
+            });
+          }
+        },
+        fail: (e) => {
+          console.log("点赞失败:", e);
+          uni.showToast({
+            title: "网络请求失败",
+            icon: "none",
+          });
+        },
+      });
+    },
+    // 关注作者
+    followTheAuthor(n) {
+      uni.request({
+        url: this.$apiHost + "/Member/attention",
+        data: {
+          uuid: getApp().globalData.uuid,
+          id: this.author.id,
+        },
+        header: {
+          "content-type": "application/json",
+          sign: getApp().globalData.headerSign,
+        },
+        success: (res) => {
+          console.log("点赞结果:", res.data);
+          uni.showToast({
+            title: res.data.str,
+            icon: "none",
+          });
+          if (res.data.success === "yes") {
+            console.log("关注结果:", res.data, n);
+
+            this.author.is_attention = n;
+          }
+        },
+        fail: (e) => {
+          console.log("关注失败:", e);
+          uni.showToast({
+            title: "网络请求失败",
+            icon: "none",
+          });
+        },
+      });
+    },
+    // 分享文章
+    shareArticle() {
+      // 如果在微信小程序环境
+      if (uni.getSystemInfoSync().platform === "mp-weixin") {
+        uni.showShareMenu({
+          withShareTicket: true,
+          menus: ["shareAppMessage", "shareTimeline"],
+        });
+      } else {
+        // 其他环境,如APP
+        uni.share({
+          provider: "weixin",
+          scene: "WXSceneSession",
+          type: 0,
+          title: this.articleInfo.title,
+          summary: this.articleInfo.content.substring(0, 40) + "...",
+          imageUrl: this.home_image,
+          success: function (res) {
+            console.log("分享成功:" + JSON.stringify(res));
+          },
+          fail: function (err) {
+            console.log("分享失败:" + JSON.stringify(err));
+          },
+        });
+      }
+    },
+    // 切换音频播放状态
+    toggleAudio() {
+      if (!this.articleInfo.result_audio) return;
+
+      if (this.isPlaying) {
+        this.audioPlayer.pause();
+        this.isPlaying = false;
+      } else {
+        this.audioPlayer.src = this.articleInfo.result_audio;
+        this.audioPlayer.play();
+        this.isPlaying = true;
+      }
+    },
+    // 新增过滤器方法
+    commaToArray(str) {
+      if (!str) return "";
+      return str.split(",");
+    },
+
+    // 新增过滤器方法
+    addBrackets(str) {
+      if (!str) return "";
+      if (!str.startsWith("《")) {
+        str = "《" + str;
+      }
+      if (!str.endsWith("》")) {
+        str = str + "》";
+      }
+      return str;
+    },
+    getInfoData() {
+      uni.request({
+        url: this.$apiHost + "/Member/getinfoData",
+        data: {
+          uuid: getApp().globalData.uuid,
+        },
+        header: {
+          "content-type": "application/json",
+        },
+        success: (res) => {
+          console.log("用户信息", res.data);
+        },
+      });
+    },
+    showActionSheet(n) {
+      if (n == 0) {
+        this.items = [
+          {
+            text: "分享作品",
+            icon: "../../static/icon/cz_icon_fenxiangzuopin.png",
+          },
+        ];
+      }
+      if (n == 1) {
+        this.items = [
+          {
+            text: "分享作品",
+            icon: "../../static/icon/cz_icon_fenxiangzuopin.png",
+          },
+          {
+            text: "修改封面",
+            icon: "../../static/icon/cz_icon_xiugaifengmian.png",
+          },
+          {
+            text: "删除作品",
+            icon: "../../static/icon/sy_icon_shanchu.png",
+            danger: true,
+          },
+        ];
+      }
+      this.$refs.actionSheet.show();
+    },
+    handleActionCancel() {
+      console.log("ActionSheet cancelled");
+    },
+    handleActionSelect(index, item) {
+      console.log("ActionSheet selected index:", item.text);
+    },
+    goCreate() {
+      // 切换到标签页
+      uni.switchTab({
+        // 指定要切换到的页面路径
+        url: "/pages/make/index",
+      });
+    },
+  },
+};
 </script>
 
 <style scoped lang="scss">
-@import 'workDetail.scss';
+@import "workDetail.scss";
 </style>

+ 31 - 0
pages/login/login.vue

@@ -293,6 +293,37 @@
 								});
 								return;
 							}
+							// 获取用户信息储存全局
+							uni.request({
+					url: this.$apiHost + '/User/getinfo',
+					data: {
+						uuid: getApp().globalData.uuid,
+						skey: getApp().globalData.skey
+					},
+					header: {
+						"content-type": "application/json",
+						'sign': getApp().globalData.headerSign
+					},
+					success: (res) => {
+						console.log("--获取用户信息--:", res.data);
+						if (res.data.need_login == "yes") {
+							
+						}
+						if (res.data.aihao) {
+							this.aihao_tags = res.data.aihao.split(",");
+						}
+						getApp().globalData.nickname=res.data.nickname
+							getApp().globalData.avator=res.data.avator
+							getApp().globalData.mobile=res.data.mobile
+						 
+					},
+					complete: (com) => {
+						// uni.hideLoading();
+					},
+					fail: (e) => {
+						console.log("----e:", e);
+					}
+				});
 							uni.switchTab({
 								url: "/pages/index/index",
 							});