Browse Source

Merge branch 'master' of http://git.cc-lotus.info/ball-competition-zs/applet

guhongwei 2 years ago
parent
commit
33fa1215eb
3 changed files with 5 additions and 2 deletions
  1. 1 1
      pagesCommon/login/index.js
  2. 2 1
      pagesMy/basic/index.js
  3. 2 0
      pagesMy/home/index.js

+ 1 - 1
pagesCommon/login/index.js

@@ -55,7 +55,7 @@ Page({
                 const res = await app.$api('user', 'POST', params);
                 const res = await app.$api('user', 'POST', params);
                 if (res.errcode === 0) {
                 if (res.errcode === 0) {
                     wx.showToast({ title: `账号注册成功`, icon: 'success', duration: 2000 }) //登录成功提示
                     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 })
                 } 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);
             else res = await app.$api('user', 'POST', parmas);
             if (res.errcode == '0') {
             if (res.errcode == '0') {
                 wx.showToast({ title: `信息提交成功`, icon: 'success' });
                 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 });
                 wx.navigateBack({ delta: 1 });
             } else {
             } else {
                 wx.showToast({ title: `${res.errmsg}`, icon: 'none' });
                 wx.showToast({ title: `${res.errmsg}`, icon: 'none' });

+ 2 - 0
pagesMy/home/index.js

@@ -59,6 +59,8 @@ Page({
             let icon = [{ id: res.id, name: res.name, uri: res.uri, url: `${app.globalData.fileserverUrl}` + res.uri }]
             let icon = [{ id: res.id, name: res.name, uri: res.uri, url: `${app.globalData.fileserverUrl}` + res.uri }]
             let arr = await app.$api(`user/${that.data.user._id}`, 'POST', { icon: icon });
             let arr = await app.$api(`user/${that.data.user._id}`, 'POST', { icon: icon });
             if (arr.errcode == '0') {
             if (arr.errcode == '0') {
+                const user = await app.$api(`user/${that.data.user._id}`, 'get', {});
+                if (user.errcode == '0') wx.setStorage({ key: "user", data: user.data })// 存用户信息到storage,以便之后判断用户是否登录
                 wx.showToast({ title: `头像上传成功`, icon: 'success' });
                 wx.showToast({ title: `头像上传成功`, icon: 'success' });
                 that.search()
                 that.search()
             } else {
             } else {