```feat(user): 查询并显示当前用户余额
在用户页面展示当前用户的余额信息,通过调用用户余额接口获取数据。优化界面布局,确保余额信息 清晰呈现给用户。同时,修复了潜在的token解析问题,保证用户数据准确无误。 修复了用户余额展示的bug,优化了用户界面体验。 ```master
parent
9ab5c50980
commit
1ed86b7362
|
@ -69,6 +69,7 @@ const user = {
|
||||||
commit('SET_ROLES', ['ROLE_DEFAULT'])
|
commit('SET_ROLES', ['ROLE_DEFAULT'])
|
||||||
}
|
}
|
||||||
commit('SET_ID', user.userId)
|
commit('SET_ID', user.userId)
|
||||||
|
localStorage.setItem('userId', user.userId)
|
||||||
commit('SET_NAME', user.userName)
|
commit('SET_NAME', user.userName)
|
||||||
commit('SET_AVATAR', avatar)
|
commit('SET_AVATAR', avatar)
|
||||||
resolve(res)
|
resolve(res)
|
||||||
|
|
|
@ -23,7 +23,7 @@ export default {
|
||||||
async fetchUserBalance() {
|
async fetchUserBalance() {
|
||||||
try {
|
try {
|
||||||
const userId = localStorage.getItem('userId');
|
const userId = localStorage.getItem('userId');
|
||||||
console.log(userId)// 假设你登录后把userId存到了localStorage
|
console.log(userId)// 登录后把userId存到了localStorage
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
this.userBalanceData = {userBalance: '未登录'};
|
this.userBalanceData = {userBalance: '未登录'};
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue