diff --git a/src/api/jnh/index.ts b/src/api/jnh/index.ts new file mode 100644 index 0000000..cd4312f --- /dev/null +++ b/src/api/jnh/index.ts @@ -0,0 +1,37 @@ +import request from '/@/utils/request'; + +// 获取账号列表 +export const getAccounts = (params: any) => { + return request({ + url: '/jnh/accounts/page', + method: 'post', + params, + }); +}; + +// 添加账号 +export const addOrUpdate = (params: any) => { + return request({ + url: '/jnh/accounts/addOrUpdate', + method: 'post', + params, + }); +}; + +// 删除账号 +export const deleteAccount = (params: any) => { + return request({ + url: '/jnh/accounts/remove', + method: 'post', + params, + }); +}; + +// 账号启用/禁用 +export const updateStatus = (params: any) => { + return request({ + url: '/jnh/accounts/status', + method: 'post', + params, + }); +}; diff --git a/src/router/route.ts b/src/router/route.ts index 6434cf7..899639c 100644 --- a/src/router/route.ts +++ b/src/router/route.ts @@ -62,6 +62,21 @@ export const dynamicRoutes: Array = [ icon: 'iconfont ele-Edit', }, }, + { + path: '/jindex', + name: 'jindex', + component: () => import('/@/views/pages/jnh/index.vue'), + meta: { + title: '账号管理', + isLink: '', + isHide: false, + isKeepAlive: true, + isAffix: true, + isIframe: false, + roles: ['jnh'], + icon: 'ele-Edit', + }, + }, { path: '/index', name: 'index', @@ -74,7 +89,7 @@ export const dynamicRoutes: Array = [ isAffix: true, isIframe: false, roles: ['admin', 'common', 'secondCommon'], - icon: 'iconfont ele-Edit', + icon: 'ele-Edit', }, }, { diff --git a/src/stores/userInfo.ts b/src/stores/userInfo.ts index 1b65df8..0027687 100644 --- a/src/stores/userInfo.ts +++ b/src/stores/userInfo.ts @@ -32,16 +32,19 @@ export const useUserInfo = defineStore('userInfo', { async getApiUserInfo() { return new Promise((resolve) => { setTimeout(() => { - let rolesLocal = '' + let rolesLocal = ''; if (Local.get('userInfoLocal').userType == '00') { - Cookies.set('userName', 'common') - rolesLocal = 'common' + Cookies.set('userName', 'common'); + rolesLocal = 'common'; } else if (Local.get('userInfoLocal').userType == '02') { - Cookies.set('userName', 'secondCommon') - rolesLocal = 'secondCommon' + Cookies.set('userName', 'secondCommon'); + rolesLocal = 'secondCommon'; + } else if (Local.get('userInfoLocal').userType == 'jnh') { + Cookies.set('userName', 'jnh'); + rolesLocal = 'jnh'; } else { - Cookies.set('userName', 'admin') - rolesLocal = 'admin' + Cookies.set('userName', 'admin'); + rolesLocal = 'admin'; } // 模拟数据,请求接口时,记得删除多余代码及对应依赖的引入 @@ -56,6 +59,7 @@ export const useUserInfo = defineStore('userInfo', { // test 页面权限标识,对应路由 meta.roles,用于控制路由的显示/隐藏 let testRoles: Array = ['common']; let secondCommonRoles: Array = ['secondCommon']; + let jnhRoles: Array = ['jnh']; // test 按钮权限标识 let testAuthBtnList: Array = ['btn.add', 'btn.link']; // 不同用户模拟不同的用户权限 @@ -65,12 +69,14 @@ export const useUserInfo = defineStore('userInfo', { } else if (rolesLocal == 'secondCommon') { defaultRoles = secondCommonRoles; defaultAuthBtnList = testAuthBtnList; + } else if (rolesLocal == 'jnh') { + defaultRoles = jnhRoles; + defaultAuthBtnList = testAuthBtnList; } else { defaultRoles = testRoles; defaultAuthBtnList = testAuthBtnList; } - console.log("🚀 ~ getApiUserInfo ~ rolesLocal:", rolesLocal) - + console.log('🚀 ~ getApiUserInfo ~ rolesLocal:', rolesLocal); // 用户信息模拟数据 const userInfos = { diff --git a/src/views/login/component/account.vue b/src/views/login/component/account.vue index 78260ad..63e09d6 100644 --- a/src/views/login/component/account.vue +++ b/src/views/login/component/account.vue @@ -9,7 +9,7 @@