306132416@qq.com лет назад: 4
Родитель
Сommit
64c3d5c05d
3 измененных файлов с 219 добавлено и 58 удалено
  1. 10 1
      App.vue
  2. 1 1
      pages/index/activity/comment.vue
  3. 208 56
      pages/index/activity/list.vue

+ 10 - 1
App.vue

@@ -134,7 +134,7 @@ page {
 .items-center {
   align-items: center;
 }
-.margin-top-3{
+.margin-top-10{
   margin-top: 10%;
 }
 .shareParent {
@@ -142,4 +142,13 @@ page {
 	height: 100%;
 	position: fixed;
 }
+.margin-right-10 {
+	margin-right: 10rpx;
+}
+.margin-top-1 {
+	margin-top: 1%;
+}
+.margin-right-0 {
+	margin-right: 0!important;
+}
 </style>

+ 1 - 1
pages/index/activity/comment.vue

@@ -102,7 +102,7 @@
 					"method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
 					  "&secret=" + getApp().globalData.secret
 				);
-				let url = getApp().globalData.shareUrl +"api/api.php" +"?method=activity&action=files_info_by_id&timestamp=" +
+				let url = getApp().globalData.shareUrl +"api/api.php" +"?method=activity&action=comment_info_by_id&timestamp=" +
 								getApp().globalData.globalTimestamp + "&sign=" + md5Sign;
 				uni.request({
 					url: url,

+ 208 - 56
pages/index/activity/list.vue

@@ -6,7 +6,7 @@
     <view v-show="current == 0">
 		<view class="active-title-box">
 			<view class="header-title">{{activeDesc.name}}</view>
-			<view style="color: gray;">{{activeDesc.start_time}}</view>
+			<view style="color: gray;margin-left: 3%;">{{activeDesc.start_time}}</view>
 		</view>
 		<view class="active-box" v-for="(item,index) in activiList" :key="index" style="flex-direction: column;" :class="index===activiList.length-1?'marginB40':''">
 			<view class="active-header">
@@ -34,7 +34,7 @@
 				</view>
 			</view>
 			
-		    <view class="margin-top-3" style="color: #007AFF;" @click="tonewurl(item.web_url)" v-if="item.web_url">
+		    <view class="margin-top-3" style="color: #007AFF;word-break: break-all;" @click="tonewurl(item.web_url)" v-if="item.web_url">
 		    	{{item.web_url}}
 		    </view>
 			<view v-if="item.web_url" style="font-size: 24rpx;color: #ccc;">
@@ -42,30 +42,51 @@
 			</view>
 			
 			<view class="edit-icon-box">
-				  <image src="/static/edit-icon.png" mode="aspectFit" v-if="item.edit_auth" @click="goEditPage(item.id)"></image>
-				  <image src="/static/del-icon.png" mode="aspectFit" v-if="item.del_auth" @click="delProcess(item.id)"></image>
+				  <image src="/static/edit-icon.png" mode="aspectFit" v-if="item.edit_auth" @click="goEditPage(item.id,'record')"></image>
+				  <image src="/static/del-icon.png" mode="aspectFit" v-if="item.del_auth" @click="delProcess(item.id,'record')"></image>
 			</view>
 		</view>
 		
 		<button class="footer-box-record" @click="goRecord()">上传记录</button>
 	</view>
 	<view v-if="current == 1">
-<!-- 		 <view class="active-box" v-for="(item,index) in activiList" :key="index" style="flex-direction: column;" :class="index===activiList.length-1?'marginB40':''">
-		 	<view class="active-content-box-img margin-top-3">
-		 		<view v-for="(img,indexImg) in item.pic_list" :key="indexImg" class="marginR5">
-		 			<image :src="img.pic_url_resize" mode="aspectFill" @click="showLarge(item.pic_list,indexImg)"></image>
-		 		</view>
-		 	</view>
-		 	<view class="edit-icon-box">
-		 		  <image src="/static/edit-icon.png" mode="aspectFit" v-if="item.edit_auth" @click="goEditPage(item.id)"></image>
-		 		  <image src="/static/del-icon.png" mode="aspectFit" v-if="item.del_auth" @click="delProcess(item.id)"></image>
-		 	</view>
-		 </view> -->
-		 
+		 <view class="active-box active-box-comment" v-for="(item,index) in fileList" :key="index" style="flex-direction: column;" :class="index===fileList.length-1?'marginB40':''">
+		 				<view class="active-header-comment">
+		 					<view class="active-content">
+		 						<view class="active-type-comment">
+		 							<image :src="item.avatar_url || '/static/auth-icon.png'" mode="aspectFit"></image>
+		 						</view>
+		 						<view class="active-name">{{item.author}}</view>
+		 					</view>
+		 					<view class="active-date-comment">{{item.addtime}}</view>
+		 				</view>	
+		 				<view class="active-content-files margin-top-1">
+						     	
+						</view>
+		 				<view class="edit-icon-box-comment">
+		 					  <image src="/static/edit-icon.png" mode="aspectFit" v-if="item.edit_auth" @click="goEditPage(item.id,'comment')"></image>
+		 					  <image class="margin-right-0" src="/static/del-icon.png" mode="aspectFit" v-if="item.del_auth" @click="delProcess(item.id,'files')"></image>
+		 				</view>
+		 </view>
 		 <button class="footer-box-record" @click="goFiles()">上传文件</button>
-		
 	</view>
 	<view v-if="current == 2">
+		 <view class="active-box active-box-comment" v-for="(item,index) in commentList" :key="index" style="flex-direction: column;" :class="index===commentList.length-1?'marginB40':''">
+				<view class="active-header-comment">
+					<view class="active-content">
+						<view class="active-type-comment">
+							<image :src="item.avatar_url" mode="aspectFit"></image>
+						</view>
+						<view class="active-name">{{item.author}}</view>
+					</view>
+					<view class="active-date-comment">{{item.addtime}}</view>
+				</view>	
+				<view class="active-content-comment margin-top-1">{{item.content}}</view>
+				<view class="edit-icon-box-comment">
+					 <!-- <image src="/static/edit-icon.png" mode="aspectFit" v-if="item.edit_auth" @click="goEditPage(item.id,'comment')"></image> -->
+					  <image class="margin-right-0" src="/static/del-icon.png" mode="aspectFit" v-if="item.del_auth" @click="delProcess(item.id,'comment')"></image>
+				</view>
+		 </view>
 		<button class="footer-box-record" @click="goComment()">上传评论</button>
 	</view>
     <share-modal  @closeShare="closeShare" :isShowShare="isShowShareModal" :class="{ shareParent: isShowShareModal}"></share-modal>
@@ -91,6 +112,8 @@ export default {
 	  recordId:'',
 	  activeDesc:{},
 	  activiList:[],
+	  commentList:[],
+	  fileList:[],
 	  fileObj:{},
 	  isShowShareModal:false,
 	  items:['记录','文件','评论'],
@@ -113,10 +136,24 @@ export default {
   	}
   },
   methods: {
-	      goEditPage(id){
-			 uni.navigateTo({
-			 	url:'./record?id='+ id + '&bId=' + this.branchId + '&aId=' + this.activeId + '&types=edit'
-			 }) 
+	      goEditPage(id,type){
+			switch (type){
+				case 'record':
+					uni.navigateTo({
+						url:'./record?id='+ id + '&bId=' + this.branchId + '&aId=' + this.activeId + '&types=edit'
+					}) 
+					break;
+				case 'files':
+				   uni.navigateTo({
+				   		url:'./files?id='+ id + '&bId=' + this.branchId + '&aId=' + this.activeId + '&types=edit'
+				   }) 
+				   break;
+				case 'comment':
+				   uni.navigateTo({
+						url:'./comment?id='+ id + '&bId=' + this.branchId + '&aId=' + this.activeId + '&types=edit'
+				   }) 
+				   break;
+			}  
 		  },
 		  pageShowShare(obj,tabs){
 			  switch (tabs){
@@ -227,13 +264,65 @@ export default {
 			    },
 			  });
 		  },
-		  delProcess(id){
+		  delCommentRequeset(delId){
+			  let md5Sign = md5(
+				"method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
+				  "&secret=" + getApp().globalData.secret
+			  );
+			  let url = getApp().globalData.shareUrl +"api/api.php" +
+				"?method=activity&action=comment_del&timestamp=" +
+				getApp().globalData.globalTimestamp + "&sign=" + md5Sign;
+			  uni.request({
+				url: url,
+				method: "POST",
+				header: {
+				  "content-type": "application/x-www-form-urlencoded",
+				},
+				data: {
+				  openid: getApp().globalData.open_id,
+				  id:delId
+				},
+				success: (res) => {
+				  if (res.data.code === 200) {
+					uni.showToast({
+					  title: "删除成功",
+					  icon: "none", 
+					  duration: 2500,
+					  success:()=>{
+						 this.getCommentList(this.activeId)
+					  }
+					});
+				  }
+				},
+				fail: () => {
+				  console.log("连接失败");
+				},
+			  });
+		  },
+		  delProcess(id,type){
 		  		 let that = this;
+				 let typeTitle;
+				 switch (type){
+				 	case 'record':
+					 typeTitle = '确定删除此记录吗'
+				 		break;
+					case 'comment':
+					 typeTitle = '确定删除此评论吗'
+						break;	
+					case 'comment':
+					 typeTitle = '确定删除此文件吗'
+						break;	
+				 }
 		  		 uni.showModal({
-		  		   title: "确定删除此记录吗?",
+		  		   title: typeTitle,
 		  		   success(res) {
 		  		 	if (res.confirm) {
-		  		 	  that.delProcessRequeset(id);
+						if(type === 'record') {
+							that.delProcessRequeset(id);
+						}
+		  		 	    else if (type === 'comment') {
+							that.delCommentRequeset(id);
+						}
 		  		 	} else if (res.cancel) {
 		  		 	  console.log("用户点击取消");
 		  		 	}
@@ -271,32 +360,33 @@ export default {
 			  });
 		  },
 		  getCommentList(id){
-		  			  let md5Sign = md5(
-		  				"method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
-		  				  "&secret=" + getApp().globalData.secret
-		  			  );
-		  			  let url = getApp().globalData.shareUrl +"api/api.php" +
-		  				"?method=activity&action=comment_list&timestamp=" +
-		  				getApp().globalData.globalTimestamp + "&sign=" + md5Sign;
-		  			  uni.request({
-		  				url: url,
-		  				method: "POST",
-		  				header: {
-		  				  "content-type": "application/x-www-form-urlencoded",
-		  				},
-		  				data: {
-		  				  openid:getApp().globalData.open_id,
-		  				  activity_id : id
-		  				},
-		  				success: (res) => {
-		  				  if (res.data.code === 200) {
-		  					  console.log(res.data.data)
-		  				  }
-		  				},
-		  				fail: () => {
-		  				  console.log("连接失败");
-		  				},
-		  			  });
+			  let md5Sign = md5(
+				"method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
+				  "&secret=" + getApp().globalData.secret
+			  );
+			  let url = getApp().globalData.shareUrl +"api/api.php" +
+				"?method=activity&action=comment_list&timestamp=" +
+				getApp().globalData.globalTimestamp + "&sign=" + md5Sign;
+			  uni.request({
+				url: url,
+				method: "POST",
+				header: {
+				  "content-type": "application/x-www-form-urlencoded",
+				},
+				data: {
+				  openid:getApp().globalData.open_id,
+				  activity_id : id
+				},
+				success: (res) => {
+				  if (res.data.code === 200) {
+					  console.log(res.data.data)
+					  this.commentList = res.data.data.list;
+				  }
+				},
+				fail: () => {
+				  console.log("连接失败");
+				},
+			  });
 		  },
 		  getFileList(id){
 			  let md5Sign = md5(
@@ -319,6 +409,7 @@ export default {
 				success: (res) => {
 				  if (res.data.code === 200) {
 					  console.log(res.data.data)
+					  this.fileList = res.data.data.list;
 				  }
 				},
 				fail: () => {
@@ -449,13 +540,11 @@ export default {
 	background: #d4d4d4;
 } 
 .header-title {
-	margin-top: 3%;
-	margin-bottom: 1%;
 	font-size: 32rpx;
-	font-weight: bold
+	font-weight: bold;
+	margin: 3% 0 1% 3%;
 }
 .active-title-box {
-	padding-left: 3%;
     font-size: 26rpx;
     height: 100rpx;
     border-bottom: 4px solid #eeeeee;
@@ -487,8 +576,6 @@ export default {
 			color: #fff;
 			margin-left: 25rpx;
 		}
-	
-	
 }
 .margin-top-3 {
 	margin-top: 3%;
@@ -506,6 +593,12 @@ export default {
 		display: flex;
 		width: 100%;
 	}
+	.active-header-comment {
+		display: flex;
+		justify-content: space-between;
+		width: 100%;
+		align-items: center;
+	}
 	.active-type {
 		width: 100rpx;
 		height: 100rpx;
@@ -517,6 +610,19 @@ export default {
 		font-size: 26rpx;
 		color: #fff;
 	}
+	.active-type-comment {
+		width: 60rpx;
+		height: 60rpx;
+		border-radius: 10rpx;
+		display: flex;
+		align-items: center;
+		margin-right: 15rpx;
+			image {
+				width: 100%;
+			    height: 100%;
+			    border-radius: 10rpx;
+			}
+	}
 	.active-content-box{
 		display: flex;
 		flex-direction: column;
@@ -540,6 +646,7 @@ export default {
 			font-size: 28rpx;
 			margin-right: 10rpx;
 			font-weight: bold;
+			word-break: break-all;
 		}
 		.active-name {
 			font-size: 26rpx;
@@ -549,6 +656,10 @@ export default {
 			color: #ccc;
 		}
 	}
+	.active-date-comment {
+		font-size: 26rpx;
+		color: #8590a6;
+	}
 	.edit-icon-box {
 		position: absolute;
 		right: 10px;
@@ -639,4 +750,45 @@ export default {
 			}
 		}
 	}
+	.active-box-comment {
+		border-bottom: 1px solid #d7d7d7;
+		box-shadow: none;
+	}
+    .active-content-comment {
+		font-size: 28rpx;
+		margin-right: 10rpx;
+		// font-weight: bold;
+		word-break: break-all;
+		margin-left: 70rpx;
+		width: 85%;
+	}
+	.edit-icon-box-comment {
+		position: absolute;
+		right: 10px;
+		bottom: 5px;
+		image {
+			width: 30rpx;
+			height: 30rpx;
+			margin-right: 10rpx;	
+		} 
+	}
+	.active-content-files {
+		font-size: 28rpx;
+		margin-right: 10rpx;
+		// font-weight: bold;
+		word-break: break-all;
+		margin-left: 70rpx;
+		width: 85%;
+		height: 150rpx;
+	}
+	.edit-icon-box-file {
+		position: absolute;
+		right: 10px;
+		bottom: 5px;
+		image {
+			width: 35rpx;
+			height: 35rpx;
+			margin-right: 10rpx;	
+		} 
+	}
 </style>