Commit 6d7c01e5 by zhangxw

登录修改

1 parent f2e7a35c
...@@ -57,9 +57,6 @@ Page({ ...@@ -57,9 +57,6 @@ Page({
}) })
}) })
let params = { let params = {
accountName: userInfo?.nickName,
customerOpenId: userInfo?.openId,
customerImgUrl: userInfo?.headImgUrl,
buyerMsg: goodsInfo?.buyerMsg, buyerMsg: goodsInfo?.buyerMsg,
addressId: contactInfo?.id, addressId: contactInfo?.id,
orderGoodsList, orderGoodsList,
......
...@@ -86,12 +86,12 @@ Page({ ...@@ -86,12 +86,12 @@ Page({
onLoad(options) { onLoad(options) {
const userInfo = wx.p.storage.get('userInfo') const userInfo = wx.p.storage.get('userInfo')
this.setData({userInfo}) this.setData({userInfo})
this.getHomeData()
wx.p.router.getRouterParams(options).then(params => { wx.p.router.getRouterParams(options).then(params => {
this.setData({loginPageFlag: params?.loginPageFlag}, () => { this.setData({loginPageFlag: params?.loginPageFlag}, () => {
this.getPointsWallet() this.getPointsWallet()
this.getGoodsList() this.getGoodsList()
this.getCategory() this.getCategory()
this.getHomeData()
}) })
}).catch(err => { }).catch(err => {
console.error('参数获取失败:', err) console.error('参数获取失败:', err)
...@@ -131,7 +131,8 @@ Page({ ...@@ -131,7 +131,8 @@ Page({
let { code, data, message } = res let { code, data, message } = res
if (code == 0) { if (code == 0) {
if (data && Object.keys(data)?.length) { // 有数据返回说明已开通钱包 if (data && Object.keys(data)?.length) { // 有数据返回说明已开通钱包
wx.p.storage.set('userInfo', {...userInfo, nickName: data?.name}) // 更新storage中的nickName // 替换昵称
this.replaceNickName(data)
} else { } else {
if (!loginPageFlag) return // 只有通过登录页面进入首页弹出一次 if (!loginPageFlag) return // 只有通过登录页面进入首页弹出一次
// 未开通弹出开通钱包弹窗 // 未开通弹出开通钱包弹窗
...@@ -151,6 +152,22 @@ Page({ ...@@ -151,6 +152,22 @@ Page({
}) })
}, },
replaceNickName(data) {
let { userInfo } = this.data
commonApi.replaceWalletName({
nickName: data?.name,
phone: data?.phone,
scoreSource: data?.scoreSource
}).then(res => {
let { code, message } = res
if (code == 0) {
wx.p.storage.set('userInfo', {...userInfo, nickName: data?.name}) // 更新storage中的nickName
} else {
wx.p.wxApi.showToast(message)
}
})
},
// 获取前端分类 // 获取前端分类
getCategory() { getCategory() {
homeApi.getHomeCategoryList({}).then(res => { homeApi.getHomeCategoryList({}).then(res => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!