zhangxiaoxu123456
2021-12-20 301289e539c417995f95f5cb91fd1f6043bb7cfd
components/oss-upload/oss-upload.vue
@@ -32,35 +32,22 @@
         return {
            avatar: require('../../static/img/touxiang.jpg'),
            formData:{},
            action:'http://39.96.92.240:8099/user/updateImg',
            action:'http://Shuinigonghui.cn:8099/user/updateImg',
            userId:'',
            autoUpload:true,
            userInfo:'',
         };
      },
      created() {
         console.log("--------created")
         _this = this
         // uni.$on('uAvatarCropper', path => {
         //    _this.avatar = path;
            // 可以在此上传到服务端
            // uni.uploadFile({
            //    url: 'http://192.168.100.17/index.php/index/index/upload',
            //    filePath: path,
            //    name: 'file',
            //    complete: (res) => {
            //       console.log(res);
            //    }
            // });
         // })
      },
      mounted() {
         let userInfo = this.getStore('userInfo')
         this.avatar = userInfo.img
         this.userInfo = this.getStore('userInfo')
         this.avatar = this.userInfo.img
         if(this.avatar == '') {
            this.avatar = '../../static/img/touxiang.jpg'
         }
         _this.userId = userInfo.id
         _this.formData.userId=userInfo.id
         this.userId = this.userInfo.id
         this.formData.userId=this.userInfo.id
      },
      
      methods: {
@@ -70,9 +57,9 @@
            
         },
         onSuccess(data, index, lists, name) {
            // this.$refs.upload.remove(0)
            this.$refs.upload.remove(0)
            this.avatar = data.obj.img
            userInfo.img = data.obj.img;
            this.userInfo.img = data.obj.img;
            // this.setStore("userInfo",data.obj)
            this.$u.toast('修改成功')