This commit is contained in:
@@ -47,8 +47,8 @@ const menuItems = computed(() => {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
// 企业端显示授权卡和授权设备
|
// 企业端显示授权卡和授权设备 (仅 user_type === 4)
|
||||||
if (userInfo.value?.user_type !== 3) {
|
if (userInfo.value?.user_type === 4) {
|
||||||
menus.push(
|
menus.push(
|
||||||
{
|
{
|
||||||
title: '授权卡列表',
|
title: '授权卡列表',
|
||||||
@@ -201,7 +201,7 @@ onMounted(() => {
|
|||||||
<text class="text-11px text-white font-600">代理</text>
|
<text class="text-11px text-white font-600">代理</text>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
v-else
|
v-else-if="userInfo?.user_type === 4"
|
||||||
class="px-2 py-0.5 bg-white/20 rounded-6px"
|
class="px-2 py-0.5 bg-white/20 rounded-6px"
|
||||||
>
|
>
|
||||||
<text class="text-11px text-white font-600">企业</text>
|
<text class="text-11px text-white font-600">企业</text>
|
||||||
|
|||||||
@@ -119,6 +119,26 @@ async function submit() {
|
|||||||
// 调试日志:查看用户信息
|
// 调试日志:查看用户信息
|
||||||
console.log('登录成功,用户信息:', res.user);
|
console.log('登录成功,用户信息:', res.user);
|
||||||
|
|
||||||
|
// 验证用户类型 (只允许 3=代理 和 4=企业 登录)
|
||||||
|
if (res.user.user_type !== 3 && res.user.user_type !== 4) {
|
||||||
|
const typeNames: Record<number, string> = {
|
||||||
|
1: '超级管理员',
|
||||||
|
2: '平台用户',
|
||||||
|
};
|
||||||
|
const typeName = typeNames[res.user.user_type] || '未知';
|
||||||
|
|
||||||
|
uni.showToast({
|
||||||
|
title: `${typeName}账号无法登录此系统`,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2500,
|
||||||
|
});
|
||||||
|
// 清除已保存的 token
|
||||||
|
setToken('');
|
||||||
|
uni.removeStorageSync('refresh_token');
|
||||||
|
uni.removeStorageSync('user_info');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '登录成功',
|
title: '登录成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
@@ -126,21 +146,11 @@ async function submit() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// 根据用户类型跳转到不同页面
|
// 代理商和企业用户都跳转到首页(首页会根据用户类型显示不同功能)
|
||||||
// user_type: 1=超级管理员 2=平台 3=代理 4=企业
|
uni.$u.route({
|
||||||
if (res.user.user_type === 3 || res.user.user_type === 4) {
|
type: 'redirectTo',
|
||||||
// 代理商和企业用户都跳转到首页(首页会根据用户类型显示不同功能)
|
url: '/pages/agent-system/home/index',
|
||||||
uni.$u.route({
|
});
|
||||||
type: 'redirectTo',
|
|
||||||
url: '/pages/agent-system/home/index',
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// 其他用户(超级管理员、平台)跳转到默认页面
|
|
||||||
uni.$u.route({
|
|
||||||
type: 'redirectTo',
|
|
||||||
url: redirect,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, 1500);
|
}, 1500);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error('登录失败:', error);
|
console.error('登录失败:', error);
|
||||||
|
|||||||
Reference in New Issue
Block a user