zs hai 1 ano
pai
achega
7ec1d4adc9
Modificáronse 2 ficheiros con 3 adicións e 2 borrados
  1. 1 1
      pagesCommon/login/index.js
  2. 2 1
      pagesMy/basic/index.js

+ 1 - 1
pagesCommon/login/index.js

@@ -55,7 +55,7 @@ Page({
                 const res = await app.$api('user', 'POST', params);
                 if (res.errcode === 0) {
                     wx.showToast({ title: `账号注册成功`, icon: 'success', duration: 2000 }) //登录成功提示
-                    that.setData({ current: 1, form: {} })
+                    that.setData({ current: 1, form: { openid: that.data.form.openid } })
                 } else wx.showToast({ title: res.errmsg, icon: 'none', duration: 2000 })
             }
         }

+ 2 - 1
pagesMy/basic/index.js

@@ -58,7 +58,8 @@ Page({
             else res = await app.$api('user', 'POST', parmas);
             if (res.errcode == '0') {
                 wx.showToast({ title: `信息提交成功`, icon: 'success' });
-                wx.setStorage({ key: "user", data: res.data })// 存用户信息到storage,以便之后判断用户是否登录
+                const user = await app.$api(`user/${form._id}`, 'get', {});
+                if (user.errcode == '0') wx.setStorage({ key: "user", data: user.data })// 存用户信息到storage,以便之后判断用户是否登录
                 wx.navigateBack({ delta: 1 });
             } else {
                 wx.showToast({ title: `${res.errmsg}`, icon: 'none' });