Commit 6d7c01e5 by zhangxw

登录修改

1 parent f2e7a35c
......@@ -57,9 +57,6 @@ Page({
})
})
let params = {
accountName: userInfo?.nickName,
customerOpenId: userInfo?.openId,
customerImgUrl: userInfo?.headImgUrl,
buyerMsg: goodsInfo?.buyerMsg,
addressId: contactInfo?.id,
orderGoodsList,
......
......@@ -86,12 +86,12 @@ Page({
onLoad(options) {
const userInfo = wx.p.storage.get('userInfo')
this.setData({userInfo})
this.getHomeData()
wx.p.router.getRouterParams(options).then(params => {
this.setData({loginPageFlag: params?.loginPageFlag}, () => {
this.getPointsWallet()
this.getGoodsList()
this.getCategory()
this.getHomeData()
})
}).catch(err => {
console.error('参数获取失败:', err)
......@@ -131,7 +131,8 @@ Page({
let { code, data, message } = res
if (code == 0) {
if (data && Object.keys(data)?.length) { // 有数据返回说明已开通钱包
wx.p.storage.set('userInfo', {...userInfo, nickName: data?.name}) // 更新storage中的nickName
// 替换昵称
this.replaceNickName(data)
} else {
if (!loginPageFlag) return // 只有通过登录页面进入首页弹出一次
// 未开通弹出开通钱包弹窗
......@@ -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() {
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!