Ver código fonte

修改问题

hejie 3 anos atrás
pai
commit
46f98a5c39
1 arquivos alterados com 19 adições e 7 exclusões
  1. 19 7
      src/pages/my/userinfo.vue

+ 19 - 7
src/pages/my/userinfo.vue

@@ -4,7 +4,13 @@
       <view class="list_title flex_r flex_ac flex_jb"
         ><text>头</text><text>像:</text></view
       >
-      <img @click="upheadimg" :src="formDa.head_pic" alt="" srcset="" class="head_pic" />
+      <img
+        @click="upheadimg"
+        :src="formDa.head_pic"
+        alt=""
+        srcset=""
+        class="head_pic"
+      />
     </view>
     <view class="list flex_r flex_ac">
       <view class="list_title flex_r flex_ac flex_jb"
@@ -28,17 +34,20 @@ import { get, post } from "@/request/api.js";
 export default {
   data() {
     return {
-      formDa: {},
+      formDa: {
+        nickname:undefined,
+        head_pic:undefined
+      },
     };
   },
   onLoad() {
     this.loadData();
   },
   methods: {
-    loadData(){
-        let da = uni.getStorageSync("userinfo");
-        this.formDa.nickname = da.nickname;
-        this.formDa.head_pic = da.head_pic;
+    loadData() {
+      let da = uni.getStorageSync("userinfo");
+      this.formDa.nickname = da.nickname;
+      this.formDa.head_pic = da.head_pic;
     },
     upheadimg() {
       // 上传图片uploadImg
@@ -49,7 +58,7 @@ export default {
         sourceType: ["album", "camera"], // album 从相册选图,camera 使用相机,默认二者都有
         success: function (res) {
           var arr = res.tempFiles;
-          that.$up(arr[0].path).then(res => {
+          that.$up(arr[0].path).then((res) => {
             that.$set(that.formDa, "head_pic", res);
             // that.formDa.head_pic = res;
           });
@@ -61,6 +70,9 @@ export default {
         if (res.code === 0) {
           appEv.errTips(res.msg);
           this.getuserInfo();
+          uni.navigateBack({
+            delta: 1, //返回层数,2则上上页
+          });
         }
       });
     },