Kaynağa Gözat

图片上传加载优化

xhj 2 yıl önce
ebeveyn
işleme
cefaafd009

+ 1 - 1
card/create/create.css

@@ -4,7 +4,7 @@ page{background: #f9f9f9;padding-bottom: 130rpx;}
 .form .li{padding: 30rpx 0;position: relative;}
 .label{font-size: 30rpx;color: #999;width: 160rpx;}
 .photo{justify-content: space-between;}
-.userimg{width: 90rpx;height: 90rpx;border-radius: 50%;}
+.userimg{width: 90rpx;height: 90rpx;border-radius: 6rpx;}
 .rico{width: 15rpx;height: 22rpx;}
 .ipt{font-size: 30rpx;color: #333;}
 .textarea{font-size: 30rpx;color: #333;height: 100rpx;}

+ 26 - 2
card/create/create.vue

@@ -2,7 +2,7 @@
 	<view v-if="!loading">
 		<view class="form">
 			<view class="li ddflex">
-				<view class="label">头像</view>
+				<view class="label">名片页背景</view>
 				<view class="photo ddflex flex" @tap="uploadImgs()">
 					<image :src="avatar ? avatar : '../../static/images/userimg.png'" mode="aspectFill" class="userimg"></image>
 					<image src="../../static/images/rico.png" class="rico"></image>
@@ -203,7 +203,7 @@ export default {
 		getUserInfo(){
 			return new Promise((resolve,reject)=>{
 				req.getRequest('/api/user/info',{},res=>{
-					this.avatar = res.avatar;
+					// this.avatar = res.avatar;
 					this.phone = res.mobile;
 					this.saleNo = res.saleNo
 					req.setStorage('saleNo',this.saleNo)
@@ -298,20 +298,26 @@ export default {
 				sizeType: ['original', 'compressed'],
 				sourceType: ['album', 'camera'],
 				success: function({ tempFilePaths }) {
+					uni.showLoading({
+						title:'上传中'
+					})
 					var promise = Promise.all(
 						tempFilePaths.map(tempFilePath => {
 							return new Promise(function(resolve, reject) {
 								req.uploadFile('/api/nocheck/upload', tempFilePath, res => {
 									that.avatar = res.src;
+									resolve()
 								});
 							});
 						})
 					);
 					promise
 						.then(function(results) {
+							uni.hideLoading()
 							console.log(results);
 						})
 						.catch(function(err) {
+							uni.hideLoading()
 							console.log(err);
 						});
 				}
@@ -324,20 +330,26 @@ export default {
 				sizeType: ['original', 'compressed'],
 				sourceType: ['album', 'camera'],
 				success: function({ tempFilePaths }) {
+					uni.showLoading({
+						title:'上传中'
+					})
 					var promise = Promise.all(
 						tempFilePaths.map(tempFilePath => {
 							return new Promise(function(resolve, reject) {
 								req.uploadFile('/api/nocheck/upload', tempFilePath, res => {
 									that.wechatCode = res.src;
+									resolve()
 								});
 							});
 						})
 					);
 					promise
 						.then(function(results) {
+							uni.hideLoading()
 							console.log(results);
 						})
 						.catch(function(err) {
+							uni.hideLoading()
 							console.log(err);
 						});
 				}
@@ -351,6 +363,9 @@ export default {
 				sizeType: ['original', 'compressed'],
 				sourceType: ['album', 'camera'],
 				success: function({ tempFilePaths }) {
+					uni.showLoading({
+						title:'上传中'
+					})
 					var promise = Promise.all(
 						tempFilePaths.map(tempFilePath => {
 							return new Promise(function(resolve, reject) {
@@ -361,15 +376,18 @@ export default {
 									}else{
 										that.honorImgUrls = that.honorImgUrls.concat(res.src)
 									}
+									resolve()
 								});
 							});
 						})
 					);
 					promise
 						.then(function(results) {
+							uni.hideLoading()
 							console.log(results);
 						})
 						.catch(function(err) {
+							uni.hideLoading()
 							console.log(err);
 						});
 				}
@@ -387,6 +405,9 @@ export default {
 				sizeType: ['original', 'compressed'],
 				sourceType: ['album', 'camera'],
 				success: function({ tempFilePaths }) {
+					uni.showLoading({
+						title:'上传中'
+					})
 					var promise = Promise.all(
 						tempFilePaths.map(tempFilePath => {
 							return new Promise(function(resolve, reject) {
@@ -397,15 +418,18 @@ export default {
 									}else{
 										that.styleImgUrls = that.styleImgUrls.concat(res.src)
 									}
+									resolve()
 								});
 							});
 						})
 					);
 					promise
 						.then(function(results) {
+							uni.hideLoading()
 							console.log(results);
 						})
 						.catch(function(err) {
+							uni.hideLoading()
 							console.log(err);
 						});
 				}

+ 6 - 0
library/longPosterService/longPosterService.vue

@@ -202,20 +202,26 @@
 					sizeType: ['original', 'compressed'],
 					sourceType: ['album', 'camera'],
 					success: function({ tempFilePaths }) {
+						uni.showLoading({
+							title:'上传中'
+						})
 						var promise = Promise.all(
 							tempFilePaths.map(tempFilePath => {
 								return new Promise(function(resolve, reject) {
 									req.uploadFile('/api/nocheck/upload', tempFilePath, res => {
 										that.posterBg = res.src
+										resolve()
 									});
 								});
 							})
 						);
 						promise
 							.then(function(results) {
+								uni.hideLoading()
 								console.log(results);
 							})
 							.catch(function(err) {
+								uni.hideLoading()
 								console.log(err);
 							});
 					}

+ 6 - 0
library/longPosterService/longPosterService2.vue

@@ -221,20 +221,26 @@
 					sizeType: ['original', 'compressed'],
 					sourceType: ['album', 'camera'],
 					success: function({ tempFilePaths }) {
+						uni.showLoading({
+							title:'上传中'
+						})
 						var promise = Promise.all(
 							tempFilePaths.map(tempFilePath => {
 								return new Promise(function(resolve, reject) {
 									req.uploadFile('/api/nocheck/upload', tempFilePath, res => {
 										that.posterBg = res.src
+										resolve()
 									});
 								});
 							})
 						);
 						promise
 							.then(function(results) {
+								uni.hideLoading()
 								console.log(results);
 							})
 							.catch(function(err) {
+								uni.hideLoading()
 								console.log(err);
 							});
 					}

+ 6 - 0
match/activityEdit/activityEdit.vue

@@ -370,6 +370,9 @@
 					success: function({
 						tempFilePaths
 					}) {
+						uni.showLoading({
+							title:'上传中'
+						})
 						var promise = Promise.all(
 							tempFilePaths.map(tempFilePath => {
 								return new Promise(function(resolve, reject) {
@@ -388,15 +391,18 @@
 													res.src)
 											}
 										}
+										resolve()
 									});
 								});
 							})
 						);
 						promise
 							.then(function(results) {
+								uni.hideLoading()
 								console.log(results);
 							})
 							.catch(function(err) {
+								uni.hideLoading()
 								console.log(err);
 							});
 					}