zs 2 年之前
父節點
當前提交
9dcc59b431
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      pagesMy/home/index.js

+ 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 arr = await app.$api(`user/${that.data.user._id}`, 'POST', { icon: icon });
             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' });
                 that.search()
             } else {