306132416@qq.com 3 年 前
コミット
4bd3766ace
共有3 個のファイルを変更した59 個の追加68 個の削除を含む
  1. 8 63
      pages/index/activity/comment.vue
  2. 1 1
      pages/index/activity/files.vue
  3. 50 4
      pages/index/activity/list.vue

+ 8 - 63
pages/index/activity/comment.vue

@@ -33,7 +33,7 @@
 		
 		<view class="footer-box">
 			<!-- <button type="primary" class="submit-bth" style="background-color: #aaaaaa;" @click="goStep()">清空</button> -->
-			<button type="primary" class="submit-bth" style="background-color: #169bd5;" @click="goStep()">提交</button>
+			<button type="primary" class="submit-bth" style="background-color: #169bd5;" @click="goComment()">提交</button>
 		</view>
 <!-- 		<view class="mask-share-box" v-if="isShowShare">
 			<image src="/static/share-arrow.png" mode="aspectFit"></image>
@@ -85,8 +85,8 @@
 			}
 		},
 		methods: {
-			goStep(){
-				 this.addOrEditActiveRecord();
+			goComment(){
+				 this.addOrEditActiveComment();
 			},
 			closeShare(e){
 				this.isShowShareModal = false;
@@ -118,7 +118,7 @@
 					  if (res.data.code === 200) {
 						  let obj = res.data.data;
 						  // this.recordId = obj.id;
-						  // this.contentDesc = obj.content;
+						  this.contentDesc = obj.content;
 						  // this.contentLink = obj.web_url;
 						  // this.uploadList = obj.pic_list.map((item)=>{return this.globalUrl + item.pic_url});
 						  // this.imgIdList = obj.pic_list.map((item)=>{return item.pic_id})
@@ -129,24 +129,23 @@
 					},
 				});
 			}, 
-			addOrEditActiveFiles(){
+			addOrEditActiveComment(){
 			    let url,data;
 				let md5Sign = md5(
 				  "method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
 				    "&secret=" + getApp().globalData.secret
 				);
 				if(this.type === 'add'){
-					  url = getApp().globalData.shareUrl +"api/api.php" +"?method=activity&action=files_add&timestamp=" +
+					  url = getApp().globalData.shareUrl +"api/api.php" +"?method=activity&action=comment_add&timestamp=" +
 					  getApp().globalData.globalTimestamp + "&sign=" + md5Sign;
 					  data = {
 						openid:getApp().globalData.open_id,
 						branch_id:this.branchId,
 						activity_id:this.activeId, 
 						content:this.contentDesc,  
-						attach_ids:this.imgIdList.join()
 					   }
 				}else {
-					  url = getApp().globalData.shareUrl +"api/api.php" +"?method=activity&action=files_update&timestamp=" +
+					  url = getApp().globalData.shareUrl +"api/api.php" +"?method=activity&action=comment_update&timestamp=" +
 					  getApp().globalData.globalTimestamp + "&sign=" + md5Sign;
 					  data = {
 						openid:getApp().globalData.open_id,
@@ -154,7 +153,6 @@
 						branch_id:this.branchId,
 						activity_id:this.activeId, 
 						content:this.contentDesc,  
-						attach_ids:this.imgIdList.join()
 					   }
 				}
 				uni.request({
@@ -178,7 +176,7 @@
 							let pages = getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
 							let nowPage = pages[pages.length - 1]; //当前页页面实例
 							let prevPage = pages[pages.length - 2]; //上一页页面实例
-							prevPage.$vm.pageShowShare(types)
+							prevPage.$vm.pageShowShare(types,'comment')
 							uni.showToast({
 							  title: "上传成功",
 							  icon: "none", 
@@ -194,59 +192,6 @@
 				  },
 				});
 			}, 
-		  chooseFile(){
-		  	//chooseMessageFile
-		  	let that = this;
-		  	uni.chooseMessageFile({
-		  	  count: 3,
-		  	  type: 'file',
-		  	  success (res) {
-		  	    for(let i=0;i<res.tempFiles.length;i++){
-		  		   res.tempFiles[i].size  = (res.tempFiles[i].size/1024) ;
-		  		   res.tempFiles[i].size = Math.trunc(res.tempFiles[i].size);
-				   let msg = {name:res.tempFiles[i].name,textValue:res.tempFiles[i].path,size:res.tempFiles[i].size};
-				   that.uploadFileRequest(msg)
-		  	   }
-		  	  }
-		  	})
-		  	console.log('文件上传')
-		  },
-		  uploadFileRequest(fileVal){
-		  	let that = this;
-			let md5Sign = md5(
-			  "method=" +"activity_file_upload" +"&timestamp=" +
-				getApp().globalData.globalTimestamp +"&secret=" +getApp().globalData.secret
-			);
-			let url = getApp().globalData.shareUrl + "api/api.php" +"?method=activity_file_upload&timestamp=" +
-			  getApp().globalData.globalTimestamp +"&sign=" + md5Sign;
-			  uni.uploadFile({
-		  		url:url, //需要设置为全局
-		  		filePath:fileVal.textValue,
-		  		name:'file',
-		  		formData: {
-					openid: getApp().globalData.open_id,
-		  			file:fileVal.textValue,
-					branch_id:this.branchId,
-					file_name:fileVal.name
-		  		},
-		  		success: res => {
-					 this.fileObj = JSON.parse(res.data);
-					 console.log(this.fileObj.data)
-					 this.fileObj.data.url = getApp().globalData.shareUrl + this.fileObj.data.url;
-		  			// let url = 'https://gdoctor.tcmlives.com'
-		  			 //let msg = msgType === 4 ? {textValue:url+ tmpres.msg.file_path} : {name:fileVal.name,size:fileVal.size,textValue: url+tmpres.msg.file_path};
-		  			// that.sendMsg(msg,msgType);	
-		  		},
-		  		fail:res=>{
-		  			console.log("上传请求失败");
-		  			console.log(res);
-		  		}
-		  	});
-		  },
-			delPhoto(idx) {
-			  this.uploadList.splice(idx, 1);
-			  this.imgIdList.splice(idx, 1);
-			},
 		}
 	}
 </script>

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

@@ -178,7 +178,7 @@
 							let pages = getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
 							let nowPage = pages[pages.length - 1]; //当前页页面实例
 							let prevPage = pages[pages.length - 2]; //上一页页面实例
-							prevPage.$vm.pageShowShare(types)
+							prevPage.$vm.pageShowShare(types,'file')
 							uni.showToast({
 							  title: "上传成功",
 							  icon: "none", 

+ 50 - 4
pages/index/activity/list.vue

@@ -103,7 +103,7 @@ export default {
   },
   onShow() {
 	 this.readActive(this.recordId);
-	 this.getFileList(this.recordId)
+	 //this.getFileList(this.recordId);
   },
   onShareAppMessage() {
     return {
@@ -117,15 +117,33 @@ export default {
 			 	url:'./record?id='+ id + '&bId=' + this.branchId + '&aId=' + this.activeId + '&types=edit'
 			 }) 
 		  },
-		  pageShowShare(obj){
-			  console.log(obj)
+		  pageShowShare(obj,tabs){
+			  switch (tabs){
+			  	case 'files':
+				   this.getFileList(this.recordId)
+			  		break;
+				case 'comment':
+				   this.getCommentList(this.recordId)
+					break;
+			  	default:
+			  		break;
+			  }
 			  this.isShowShareModal = true;
 		  },
 		  closeShare(e){
 		  	this.isShowShareModal = false;
 		  },
 		  onClickItem(e){
-		  	 this.current = e.currentIndex
+		  	 this.current = e.currentIndex;
+			 if(e.currentIndex == '0'){
+			 	 this.readActive(this.recordId)
+			 }
+			 if(e.currentIndex == '1'){
+				 this.getFileList(this.recordId)
+			 }
+			 if(e.currentIndex == '2'){
+				 this.getCommentList(this.recordId)
+			 }
 		  },
 		  //打开文件
 		  openFile(files){
@@ -250,6 +268,34 @@ 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("连接失败");
+		  				},
+		  			  });
+		  },
 		  getFileList(id){
 			  let md5Sign = md5(
 				"method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +