Explorar el Código

feat:专员注册时头像选择改为压缩图,出错时弹出错误提示

zhanghui hace 1 año
padre
commit
dd5f029cbe
Se han modificado 1 ficheros con 19 adiciones y 3 borrados
  1. 19 3
      pages/register/register.vue

+ 19 - 3
pages/register/register.vue

@@ -251,7 +251,7 @@
                 let that = this
                 uni.chooseImage({
                     count: 1, //默认9
-                    sizeType: ['original'], //可以指定是原图还是压缩图,默认二者都有
+                    sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
                     sourceType: ['album'], //从相册选择
                     success: function (res) {
                         let tempUrl = res.tempFiles[0].path
@@ -269,10 +269,26 @@
                                 console.log('+++++++++++++++++chooseavatar+++++++++++++++++++++++', uploadFileRes.data)
                                 that.form.imgUrl = res.data.url.replace(/^http:/, "https:")
                                 that.form.img = res.data.ossId
-                            }
+                            },
+                          fail: (err) => {
+                              console.log(err)
+                            uni.showToast({
+                              icon: 'error',
+                              duration: 2000,
+                              title: err.errMsg
+                            });
+                          }
                         });
 
-                    }
+                    },
+                  fail: function(err) {
+                    console.log(err)
+                    uni.showToast({
+                      icon: 'error',
+                      duration: 2000,
+                      title: err.errMsg
+                    });
+                  }
                 })
 
             },