提交 acb544f3 authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 6a4cd50b
VITE_LOGIN_URL=https://login.ezijing.com/auth/login/index
VITE_SECRET_ID=ezijing_964c8383203c73b1a15b9f78d029be47
VITE_SECRET_KEY=9ca37c562fa85402a201a54ee105a59c
\ No newline at end of file
VITE_LOGIN_URL=https://login.ezijing.com/auth/login/index
VITE_SECRET_ID=ezijing_964c8383203c73b1a15b9f78d029be47
VITE_SECRET_KEY=9ca37c562fa85402a201a54ee105a59c
\ No newline at end of file
VITE_LOGIN_URL=https://login2.ezijing.com/auth/login/index
VITE_SECRET_ID=ezijing_964c8383203c73b1a15b9f78d029be47
VITE_SECRET_KEY=9ca37c562fa85402a201a54ee105a59c
\ No newline at end of file
......@@ -2,7 +2,7 @@ import httpRequest from '@/utils/axios'
// 获取用户信息
export function getUser() {
return httpRequest.get('/api/resource/v1/util/info')
return httpRequest.get('/api/passport/account/get-user-info')
}
// 退出登录
......@@ -33,3 +33,10 @@ export async function uploadFile(data: Record<string, any>) {
export function searchUser(params: { q: string }) {
return httpRequest.get('/api/zws/v1/backend/common/search-user', { params })
}
/**
* 获取权限列表
*/
export function getPermissions(params?: { type: number }) {
return httpRequest.get('/api/permissions/api/v1/user/permissions', { params })
}
......@@ -8,27 +8,34 @@ export const menus: IMenuItem[] = [
{
icon: Box,
name: '渠道管理',
path: '/base/channel'
path: '/base/channel',
tag: 'channel'
},
{
icon: Files,
name: '项目管理',
path: '/base/project'
path: '/base/project',
tag: 'project'
}
]
},
{
name: '权限管理',
path: '/system',
tag: 'management',
children: [
{
icon: User,
name: '用户管理',
path: '/base/users'
path: '/system/users',
tag: 'management-member'
},
{
icon: Star,
name: '角色管理',
path: '/base/roles'
path: '/system/roles',
tag: 'management-role'
}
]
},
{
name: '权限管理',
path: 'https://app.ezijing.com/settings/users?appid=131614279236792320'
}
]
......@@ -2,6 +2,10 @@ import type { RouteRecordRaw } from 'vue-router'
import AppLayout from '@/components/layout/Index.vue'
export const routes: Array<RouteRecordRaw> = [
{
path: '/base',
redirect: '/base/channel'
},
{
path: '/base/channel',
component: AppLayout,
......
......@@ -3,7 +3,7 @@ import AppLayout from '@/components/layout/Index.vue'
export const routes: Array<RouteRecordRaw> = [
{
path: '/base/roles',
path: '/system/roles',
component: AppLayout,
children: [
{ path: '', component: () => import('./views/Index.vue') },
......
......@@ -31,7 +31,7 @@ const listOptions = $computed(() => {
// 查看
function handleView(row: any) {
router.push({ path: `/base/roles/detail/${row.id}` })
router.push({ path: `/system/roles/detail/${row.id}` })
}
</script>
......
......@@ -3,7 +3,11 @@ import AppLayout from '@/components/layout/Index.vue'
export const routes: Array<RouteRecordRaw> = [
{
path: '/base/users',
path: '/system',
redirect: '/system/users'
},
{
path: '/system/users',
component: AppLayout,
children: [{ path: '', component: () => import('./views/Index.vue') }]
}
......
......@@ -3,7 +3,7 @@ import { useUserStore } from '@/stores/user'
const router = createRouter({
history: createWebHistory(),
routes: [{ path: '/:pathMatch(.*)*', redirect: '/base/channel' }]
routes: [{ path: '/:pathMatch(.*)*', redirect: '/base' }]
})
router.beforeEach(async (to, from, next) => {
......
import { defineStore } from 'pinia'
import { getUser, logout } from '@/api/base'
import { getUser, logout, getPermissions } from '@/api/base'
import type { UserType, ProjectType, OrganizationType, RoleType, PermissionType } from '@/types'
interface State {
......@@ -25,13 +25,9 @@ export const useUserStore = defineStore({
actions: {
async getUser() {
const res = await getUser()
const { info } = res.data
const { organization, project, roles, permissions } = res.data.permissions
this.user = info
this.organization = organization
this.project = project
this.roles = roles
this.permissions = permissions
const resp = await getPermissions()
this.user = res.data
this.permissions = resp.data.items
},
async logout() {
await logout()
......
......@@ -13,6 +13,19 @@ const httpRequest = axios.create({
// 请求拦截
httpRequest.interceptors.request.use(
function (config) {
// 权限接口单独签名
// https://gitlab.ezijing.com/root/api-documents/-/blob/master/ezijing_permissions/%E7%AD%BE%E5%90%8D%E9%AA%8C%E8%AF%81.md
if (/^\/api\/permissions/.test(config.url)) {
// 默认参数
const defaultHeaders = {
timestamp: Date.now(),
nonce: Math.random().toString(36).slice(-8),
'secret-id': import.meta.env.VITE_SECRET_ID,
'secret-key': import.meta.env.VITE_SECRET_KEY,
signature: 'UG7wBenexQhiuD2wpCwuxkU0jqcj006d'
}
config.headers = Object.assign(config.headers, defaultHeaders)
}
if (config.headers?.['Content-Type'] === 'application/x-www-form-urlencoded') {
config.data = qs.stringify(config.data, { skipNulls: true })
}
......
......@@ -29,7 +29,7 @@ export default defineConfig(({ mode }) => ({
changeOrigin: true,
rewrite: path => path.replace(/^\/api\/zws/, '')
},
'/api': 'https://saas-lab.ezijing.com'
'/api': 'https://project-center.ezijing.com'
}
},
resolve: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论