main #35
@ -62,8 +62,8 @@ function addUserRoutes(routes, userType, orgType, userRoles = []) {
|
||||
|
||||
const userRoutes = [];
|
||||
|
||||
// 如果是普通用户(org_type为2或userType为user),添加订单管理和资源管理路由
|
||||
if (userType === 'user' || orgType == 2) {
|
||||
// 修复:包含 orgType 为 2 和 3 的情况(公司客户和个人客户)
|
||||
if (userType === 'user' || orgType == 2 || orgType == 3) {
|
||||
const orderManagementRoute = routes.find(route => route.path === "/orderManagement");
|
||||
const resourceManagementRoute = routes.find(route => route.path === "/resourceManagement");
|
||||
|
||||
@ -160,7 +160,8 @@ const actions = {
|
||||
|
||||
console.log("用户类型:", userType, "orgType:", orgType);
|
||||
|
||||
if (params.user && params.user.includes("admin") && orgType != 2) {
|
||||
// 修复:包含 orgType 为 2 和 3 的情况
|
||||
if (params.user && params.user.includes("admin") && orgType != 2 && orgType != 3) {
|
||||
// 管理员:只显示超级管理员菜单
|
||||
accessedRoutes = asyncRoutes.filter(item => item.path === '/superAdministrator');
|
||||
} else {
|
||||
|
||||
@ -128,11 +128,10 @@ const actions = {
|
||||
const {data, org_type} = response;
|
||||
commit("SET_USER", username);
|
||||
|
||||
// 新增:根据 org_type 设置用户类型和角色
|
||||
// org_type 为 2 表示客户,其他为管理员
|
||||
const userType = org_type == 2 ? 'user' : 'admin';
|
||||
// 修复:org_type 为 2 或 3 都表示客户
|
||||
const userType = (org_type == 2 || org_type == 3) ? 'user' : 'admin';
|
||||
// 设置用户角色 - 如果是客户,则添加'客户'角色
|
||||
const userRoles = org_type == 2 ? ['客户'] : ['管理员'];
|
||||
const userRoles = (org_type == 2 || org_type == 3) ? ['客户'] : ['管理员'];
|
||||
|
||||
commit("SET_USER_TYPE", userType);
|
||||
// 确保 org_type 不为 undefined
|
||||
@ -284,4 +283,3 @@ export default {
|
||||
mutations,
|
||||
actions,
|
||||
};
|
||||
|
||||
@ -129,7 +129,8 @@ export default Vue.extend({
|
||||
},
|
||||
viewList: [],
|
||||
navList: [],
|
||||
mybalance: 0,
|
||||
// 移除 data 中的 mybalance 定义
|
||||
// mybalance: 0, // ❌ 删除这一行
|
||||
todoList: [
|
||||
{ name: '待支付', count: 0 },
|
||||
{ name: '待续费', count: 0 },
|
||||
@ -142,7 +143,8 @@ export default Vue.extend({
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initMybalance();
|
||||
// 移除 initMybalance 调用,因为现在使用 computed 的 mybalance
|
||||
// this.initMybalance(); // ❌ 删除这一行
|
||||
this.getUnreadMsgCount();
|
||||
this.fetchTodoCount();
|
||||
},
|
||||
@ -185,12 +187,13 @@ export default Vue.extend({
|
||||
const iconIndex = index % this.navIcons.length;
|
||||
return this.navIcons[iconIndex];
|
||||
},
|
||||
async initMybalance() {
|
||||
const res = await editReachargelogAPI()
|
||||
if (res.status) {
|
||||
this.mybalance = res.data
|
||||
}
|
||||
},
|
||||
// 移除 initMybalance 方法,因为现在使用 computed 的 mybalance
|
||||
// async initMybalance() { // ❌ 删除这个方法
|
||||
// const res = await editReachargelogAPI()
|
||||
// if (res.status) {
|
||||
// this.mybalance = res.data
|
||||
// }
|
||||
// },
|
||||
async getUnreadMsgCount() {
|
||||
try {
|
||||
const res = await getUnreadmsgAPI();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user