v3.8.2 修复数据库用户表 头像列为 null 时不显示默认头像问题

This commit is contained in:
YunaiV 2022-07-06 09:12:43 +08:00
parent d1053d55ad
commit 2ad73cd69a
1 changed files with 1 additions and 1 deletions

View File

@ -107,7 +107,7 @@ const user = {
res = res.data; // 读取 data 数据 res = res.data; // 读取 data 数据
const user = res.user const user = res.user
const avatar = user.avatar === "" ? require("@/assets/images/profile.jpg") : user.avatar; const avatar = ( user.avatar === "" || user.avatar == null ) ? require("@/assets/images/profile.jpg") : user.avatar;
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组 if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.roles) commit('SET_ROLES', res.roles)
commit('SET_PERMISSIONS', res.permissions) commit('SET_PERMISSIONS', res.permissions)