caiyuqin 4 месяцев назад
Родитель
Сommit
a2ca0d01b1
4 измененных файлов с 63 добавлено и 37 удалено
  1. 27 6
      pages/store/adVideo.vue
  2. 14 5
      pages/store/advertising.vue
  3. 21 25
      pages/store/headPhoto.vue
  4. 1 1
      pages/store/shopRenovation.vue

+ 27 - 6
pages/store/adVideo.vue

@@ -64,9 +64,9 @@ export default {
   async onLoad(data) {
     if (data.params) {
       let obj = JSON.parse(decodeURIComponent(data.params));
-      this.video = obj.video ? obj.video : ''
       this.form = obj
       this.form.renovationStatus=obj.renovationStatus.filter(item => item.type === 3)[0] //1入口图 2经营相册 3视频
+      this.video  = this.form.renovationStatus ? this.form.renovationStatus.context:""
     }
 
   },
@@ -121,16 +121,30 @@ export default {
     },
     chooseVideo() {
       // 上传视频
-      console.log('上传视频')
       uni.chooseVideo({
         sourceType: ['camera', 'album'],
         success: (res) => {
           this.video = res.tempFilePath;
+          uni.uploadFile({
+								url: configService.apiUrl + '/sys/common/upload',
+								filePath: res.tempFilePath,
+								name: "file",
+								formData: {
+									'biz': 'temp',
+								},
+								success: (files) => {
+									let data = JSON.parse(files.data);
+									if (data.success) {
+										this.video = configService.apiUrl + '/' + data.message
+									}
+								}
+							})
         }
       })
     },
     sumbit() {
-      let data = {
+      if(this.video){
+         let data = {
         	merchantId: uni.getStorageSync(USER_INFO).merchantId,
 					context: this.video,
 					status:1,
@@ -143,9 +157,9 @@ export default {
               title: res.data.result || '成功'
             })
 
-            uni.navigateBack({
-              delta: 1 // 返回的页面数,默认为1
-            })
+           uni.navigateTo({
+									url: '/pages/store/newSettings'
+						});
           } else {
             uni.showToast({
               icon: 'none',
@@ -153,6 +167,13 @@ export default {
             })
           }
         })
+      }else{
+         uni.showToast({
+              icon: 'none',
+              title: '请上传视频'
+          })
+      }
+     
 
     },
     delClick(val) {

+ 14 - 5
pages/store/advertising.vue

@@ -76,10 +76,10 @@
 		async onLoad(data) {
 			if (data.params) {
 				let obj = JSON.parse(decodeURIComponent(data.params));
-				this.video = obj.video ? obj.video : ''
-				obj.photo = obj.photo ? obj.photo.split(',').filter(id => id !== '') : []
 				this.form = obj
 				this.form.renovationStatus=obj.renovationStatus.filter(item => item.type === 2)[0] //1入口图 2经营相册 3视频
+				const photoArr= this.form.renovationStatus ? this.form.renovationStatus.context.split(',') : []
+				 this.$set(this.form, 'photo', photoArr);
 			}
 
 		},
@@ -173,6 +173,8 @@
 											// this.photoList =res.tempFilePaths
 											this.form.photo = [configService.apiUrl + '/' + data.message]
 										}
+										console.log(	this.form.photo )
+										this.$forceUpdate();
 									}
 								}
 							})
@@ -198,6 +200,13 @@
 				})
 			},
 			sumbit() {
+				if(!this.form.photo.length){
+					uni.showToast({
+								icon:'none',
+								title: '请上传图片'
+						})
+						return
+				}
 				let data = {
 					merchantId: uni.getStorageSync(USER_INFO).merchantId,
 					context: this.form.photo.join(","),
@@ -212,9 +221,9 @@
 								title:res.data.result || '成功'
 							})
 							
-							uni.navigateBack({
-								delta: 1 // 返回的页面数,默认为1
-							})
+						uni.navigateTo({
+									url: '/pages/store/newSettings'
+						});
 						} else {
 							uni.showToast({
 								icon:'none',

+ 21 - 25
pages/store/headPhoto.vue

@@ -14,10 +14,10 @@
 						</view>
 					</view>
 					<view class="grid col-4 grid-square flex-sub booder-top">
-						<view class="bg-img" v-for="(item, index) in form.photo" :key="index" @tap="ViewImage"
+						<view class="bg-img" v-for="(item, index) in form.headPhoto" :key="index" @tap="ViewImage"
 							:data-url="form.headPhoto[index]">
 							<image :src="item" mode="aspectFill"></image>
-							<view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
+							<view class="cu-tag bg-red" @tap.stop="DelImg(index)" :data-index="index">
 								<text class='cuIcon-close'></text>
 							</view>
 						</view>
@@ -40,7 +40,7 @@
 			<button class="cu-btn round line-gray shadow" @click="$Router.push({ name: 'newSettings' })"
 				style="width: 205rpx;">取消</button>
 			<button style="width:443rpx;background: linear-gradient( 90deg, #77B6FF 0%, #449AFF 100%);border-radius:53rpx ;"
-				class="cu-btn bg-blue round " @click="sumbit" v-if='form.renovationStatus.status || form.renovationStatus.status==null'>提交审核</button>
+				class="cu-btn bg-blue round " @click="sumbit" >提交审核</button>
 		</view>
 	</view>
 </template>
@@ -76,11 +76,9 @@
 		async onLoad(data) {
 			if (data.params) {
 				let obj = JSON.parse(decodeURIComponent(data.params));
-				// this.video = obj.video ? obj.video : ''
-				obj.photo = obj.photo ? obj.headPhoto.split(',').filter(id => id !== '') : []
 				this.form = obj
         this.form.renovationStatus=obj.renovationStatus.filter(item => item.type === 1)[0] //1入口图 2经营相册 3视频
-				console.log( this.form)
+				this.form.headPhoto = this.form.renovationStatus ? this.form.renovationStatus.context.split(',') : []
 			}
 
 		},
@@ -107,8 +105,7 @@
 				})
 
 			},
-			DelImg(e) {
-				
+			DelImg(index) {
 				uni.showModal({
 					title: '提示',
 					content: '确定要删除?',
@@ -116,10 +113,8 @@
 					confirmText: '确定',
 					success: res => {
 						if (res.confirm) {
-							console.log(this.form)
-							// this.photoList.splice(e.currentTarget.dataset.index, 1)
-							this.form.photo.splice(e.currentTarget.dataset.index, 1)
-
+							this.form.headPhoto.splice(index, 1);
+							this.$forceUpdate();
 						}
 					}
 				})
@@ -142,19 +137,13 @@
 								success: (files) => {
 									let data = JSON.parse(files.data);
 									if (data.success) {
-										let temp = this.form.headPhoto && this.form.headPhoto.split(',') || []
-										if (this.form.headPhoto.split(',').length > 0) {
-											// this.photoList = this.photoList.concat(res.tempFilePaths)
-											this.form.photo.push(configService.apiUrl + '/' + data.message)
-											this.form.headPhoto+(configService.apiUrl + '/' + data.message)
-											temp.push(configService.apiUrl + '/' + data.message)
-											 this.form.headPhoto = temp.join(',')
-											console.log(this.form.headPhoto)
+										if (this.form.headPhoto.length !=0) {
+											this.form.headPhoto.push(configService.apiUrl + '/' + data.message)
 										} else {
 												console.log('22222')
-											// this.photoList =res.tempFilePaths
 											this.form.headPhoto = [configService.apiUrl + '/' + data.message]
 										}
+											this.$forceUpdate();
 									}
 								}
 							})
@@ -170,9 +159,16 @@
 				});
 			},
 			sumbit() {
+				if(!this.form.headPhoto.length){
+					uni.showToast({
+								icon:'none',
+								title: '请上传图片'
+						})
+						return
+				}
 				let data = {
 					merchantId: uni.getStorageSync(USER_INFO).merchantId,
-					context: this.form.headPhoto,
+					context: this.form.headPhoto.join(","),
 					status:0,
 					type:1,
 				}
@@ -182,9 +178,9 @@
 								icon:'none',
 								title:'提交成功'
 							})
-							uni.navigateBack({
-								delta: 1 // 返回的页面数,默认为1
-							})
+							uni.navigateTo({
+									url: '/pages/store/newSettings'
+							});
 						} else {
 							uni.showToast({
 								icon:'none',

+ 1 - 1
pages/store/shopRenovation.vue

@@ -17,7 +17,7 @@
     <swiper class="image-swiper" :current="currentIndex" @change="onSwiperChange" :circular="false">
       <swiper-item v-for="(item, index) in tabList" :key="index">
         <view class="custom-slide">
-          <image :src="item.image" mode="widthFix" class="slide-image" @click="onImageClick(index)"></image>
+          <image :src="item.image" mode="widthFix" class="slide-image"></image>
           <view class="image-caption" :class='["image-caption"+(index+1)]'>
             <image :src="item.bar" mode="widthFix" class="slide-bar"></image>
             <view class='info'>