Quellcode durchsuchen

bug365

(cherry picked from commit 103fdad72a7f9f26f1aa56739aadc6307f3978c2)
lishanshan vor 2 Monaten
Ursprung
Commit
33aed44a8c
2 geänderte Dateien mit 45 neuen und 11 gelöschten Zeilen
  1. 1 1
      pages/coupon/coupon.vue
  2. 44 10
      pages/store/advertising.vue

+ 1 - 1
pages/coupon/coupon.vue

@@ -68,7 +68,7 @@
 							<text class="dot">•</text>
 							<text class="label">适用范围:</text>
 							<text class="value">{{
-                                item.couponRange == '1' ? '店可用' : item.couponRange == '2' ? '部分分类商品可用' : '部分分类商品不可用'
+                                item.couponRange == '1' ? '店可用' : item.couponRange == '2' ? '部分分类商品可用' : '部分分类商品不可用'
                                 }}</text>
 						</view>
 						<view class="info-item">

+ 44 - 10
pages/store/advertising.vue

@@ -225,16 +225,50 @@
 					current: e.currentTarget.dataset.url
 				});
 			},
-			chooseVideo() {
-				// 上传视频
-				console.log('上传视频')
-				uni.chooseVideo({
-					sourceType: ['camera', 'album'],
-					success: (res) => {
-						this.video = res.tempFilePath;
-					}
-				})
-			},
+      chooseVideo() {
+      	// 上传视频
+      	console.log('上传视频')
+      	uni.chooseVideo({
+      		sourceType: ['camera', 'album'],
+      		success: (res) => {
+      			uni.showLoading({
+      				title: '上传中...'
+      			})
+      			uni.uploadFile({
+      				url: configService.apiUrl + '/sys/common/upload',
+      				filePath: res.tempFilePath,
+      				name: "file",
+      				formData: {
+      					'biz': 'temp',
+      				},
+      				success: (files) => {
+      					uni.hideLoading()
+      					let data = JSON.parse(files.data);
+      					if (data.success) {
+      						this.video = configService.apiUrl + '/' + data.message
+      						uni.showToast({
+      							title: '上传成功',
+      							icon: 'success'
+      						})
+      					} else {
+      						uni.showToast({
+      							title: data.message || '上传失败',
+      							icon: 'none'
+      						})
+      					}
+      				},
+      				fail: (err) => {
+      					uni.hideLoading()
+      					uni.showToast({
+      						title: '上传失败',
+      						icon: 'none'
+      					})
+      					console.error('视频上传失败', err)
+      				}
+      			})
+      		}
+      	})
+      },
 			sumbit() {
 				let data = {
 					merchantId: uni.getStorageSync(USER_INFO).merchantId,