3 Коміти 219f272140 ... 0e211d1f61

Автор SHA1 Опис Дата
  menchuang 0e211d1f61 Merge branch 'zdsz3.0' of http://192.168.10.18:3000/wangtong/zd_wechatApp into zdsz3.0 1 рік тому
  menchuang 7e9ab3c1d3 sync 1 рік тому
  menchuang 5b4aed309f sync 1 рік тому
1 змінених файлів з 40 додано та 34 видалено
  1. 40 34
      pages/dangerous/dangerous.vue

+ 40 - 34
pages/dangerous/dangerous.vue

@@ -331,19 +331,18 @@
 							<view style="width: 100rpx; height: 100rpx; margin: 0 12rpx;">
 								<image
 									v-if="item.picUrl.substring(item.picUrl.length - 3) == 'png' || item.picUrl.substring(item.picUrl.length - 3) == 'jpg' || item.picUrl.substring(item.picUrl.length - 4) == 'jpeg' "
-									:src="item.picUrl" @click="this.showPhoto(imgList.indexOf(item.picUrl),imgList)"
+									:src="item.picUrl" @click="this.showPhoto(item.picUrl,fileArr)"
 									style="width: 100rpx; height: 100rpx; margin: 0 12rpx;">
 								</image>
 								<video v-else-if="item.picUrl.substring(item.picUrl.length - 3) == 'mp4'"
 									:src="item.picUrl" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;">
 								</video>
-								<text v-else 
-									@click="chooseModel(item.picUrl,item.fileName)">
+								<text v-else @click="chooseModel(item.picUrl,item.fileName)">
 									{{item.fileName}}
 								</text>
 							</view>
 							<view v-if="isShowRemoveFile(item)" @click="removeFile(index)"
-								style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
+								style="position: absolute; top: 0; right: 0rpx; border-radius: 50%;">
 								<image :src="loadImgSrc('icon_close.png')" style=" width: 15px; height: 15px;">
 								</image>
 							</view>
@@ -488,12 +487,20 @@
 					}
 				})
 			},
-			showPhoto(index, list) {
+			showPhoto(currentUrl, arr) {
+				let newArr = [];
+				for (let i = 0; i < arr.length; i++) {
+					if (arr[i].picUrl.substring(arr[i].picUrl.length - 3) == 'png' || arr[i].picUrl.substring(arr[i].picUrl.length - 3) == 'jpg' ||
+						arr[i].picUrl.substring(arr[i].picUrl.length - 4) ==
+						'jpeg') {
+						newArr.push(arr[i].picUrl);
+					}
+				}
+				let mIndex = newArr.indexOf(currentUrl);
 				uni.previewImage({
-					current: index,
-					urls: list,
+					current: mIndex,
+					urls: newArr,
 				})
-
 			},
 			pickerShow(e) {
 				if (e == 'name') {
@@ -540,14 +547,14 @@
 
 					this.fileArr = this.projectObj.pics;
 
-					for (let i = 0; i < this.fileArr.length; i++) {
-						if (this.fileArr[i].picUrl.substring(this.fileArr[i].picUrl.length - 3) == 'png' || this
-							.fileArr[i].picUrl.substring(this.fileArr[i].picUrl.length - 3) == 'jpg' ||
-							this.fileArr[i].picUrl.substring(this.fileArr[i].picUrl.length - 4) ==
-							'jpeg') {
-							this.imgList.push(this.fileArr[i].picUrl);
-						}
-					}
+					// for (let i = 0; i < this.fileArr.length; i++) {
+					// 	if (this.fileArr[i].picUrl.substring(this.fileArr[i].picUrl.length - 3) == 'png' || this
+					// 		.fileArr[i].picUrl.substring(this.fileArr[i].picUrl.length - 3) == 'jpg' ||
+					// 		this.fileArr[i].picUrl.substring(this.fileArr[i].picUrl.length - 4) ==
+					// 		'jpeg') {
+					// 		this.imgList.push(this.fileArr[i].picUrl);
+					// 	}
+					// }
 				})
 			},
 			switchChangePipe(e) {
@@ -596,7 +603,7 @@
 								name: 'file',
 								formData: {},
 								header: _this.headers,
-			
+
 								success: res => {
 									// 判断是否json字符串,将其转为json格式
 									let data = JSON.parse(res.data);
@@ -605,8 +612,8 @@
 									} else {
 										if (_this.progress === 100) {
 											_this.fileArr.push({
-												'fileName': item
-													.name,
+												'fileName': data.data
+													.fileName,
 												'picUrl': data
 													.data.url,
 											});
@@ -622,7 +629,7 @@
 								complete: res => {
 									uni.hideLoading();
 									_this.uploading = false;
-			
+
 								}
 							});
 							task.onProgressUpdate(res => {
@@ -636,13 +643,13 @@
 									_this.loading = true
 								}
 							});
-			
+
 						})
-			
+
 					},
 				})
 			},
-			
+
 			choosevideo() {
 				let _this = this;
 				uni.chooseVideo({
@@ -663,12 +670,12 @@
 								} else {
 									//上传成功
 									if (_this.progress === 100) {
-											_this.fileArr.push({
-												'fileName': item
-													.name,
-												'picUrl': data
-													.data.url,
-											})
+										_this.fileArr.push({
+											'fileName': data.data
+												.fileName,
+											'picUrl': data
+												.data.url,
+										})
 										_this.$modal.msg('上传成功!')
 										_this.photo = false;
 									}
@@ -694,13 +701,12 @@
 								_this.loading = true
 							}
 						});
-			
+
 					},
 				})
 			},
 			isShowRemoveFile(item) {
-				var isShow = item.createBy == this.$user.state.name;
-
+				var isShow = item.createBy==undefined||item.createBy == this.$user.state.name;
 				return isShow;
 			},
 			removeFile(index) {
@@ -837,9 +843,9 @@
 					return;
 				}
 				this.projectObj.enginTime = this.projectTime;
-				
-				this.projectObj.pics = this.fileArr;
 
+				this.projectObj.pics = this.fileArr;
+				// this.projectObj.files = this.fileArr;
 				uni.showLoading()
 				updateDangerousWorkProject(this.projectObj).then(res => {
 					uni.hideLoading()