Explorar o código

语音发布增加loading 提示

jwyu %!s(int64=2) %!d(string=hai) anos
pai
achega
7a4e76da87
Modificáronse 2 ficheiros con 13 adicións e 2 borrados
  1. 4 1
      App.vue
  2. 9 1
      pages-voice/addVoice.vue

+ 4 - 1
App.vue

@@ -32,7 +32,10 @@
 			})
 			//设置在小程序内屏幕常亮(防止录音等操作自动息屏会停止录音)
 			wx.setKeepScreenOn({
-				keepScreenOn: true
+				keepScreenOn: true,
+				fail(res){
+					console.log('设置屏幕常亮失败:',res);
+				}
 			})
 		},
 		onShow: function(options) {

+ 9 - 1
pages-voice/addVoice.vue

@@ -426,6 +426,13 @@ export default {
                 author_id:Number(this.$store.state.user.userInfo.user_id),
                 author:this.$store.state.user.userInfo.real_name
             }
+            wx.showLoading({
+                title: '发布中...',
+                mask: true,
+                success: (result) => {},
+                fail: () => {},
+                complete: () => {}
+            });
             uni.uploadFile({
                 url: baseApiUrl + "/voice/broadcast/add",
                 filePath: this.temAudio.url,
@@ -438,6 +445,7 @@ export default {
                     const { envVersion } = uni.getAccountInfoSync().miniProgram
                     const res =  envVersion === 'release' ? JSON.parse(CryptoJS.Des3Decrypt(result.data)) :  JSON.parse(result.data);
                     console.log(res);
+                    wx.hideLoading();
                     if(res.code===200){
                         if(onlyPublished){
                             uni.showToast({
@@ -467,7 +475,7 @@ export default {
                     })
                 },
                 complete: () => {
-
+                    wx.hideLoading();
                 }
             });
         },