Skip to content

Commit

Permalink
chore: mock参数修改
Browse files Browse the repository at this point in the history
  • Loading branch information
sdmu-gaoqi committed Jan 18, 2024
1 parent 57656df commit b108da0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mock/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const testMock: MockMethod = [
},
{
url: '/api/perm',
method: 'post',
method: 'get',
timeout: 1000,
response: ({ data }: any) => {
console.log('登录请求数据 =>', data)
Expand Down
8 changes: 4 additions & 4 deletions src/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ const route = createRouter({
const initPerms = async () => {
const store = useStore()
const { dispatch, state } = store
const perms = await getPerms().data
const menus = transformMenuByPerms(menu, perms)
dispatch('userInfo/setPerms', { data: perms }) // 存在全局状态
const perms = await getPerms()
const menus = transformMenuByPerms(menu, perms.data)
dispatch('userInfo/setPerms', { data: perms.data }) // 存在全局状态
dispatch('common/changeMenus', { data: menus }) // 修改全局菜单
transformRoute(perms) // vue-route 根据权限操作route
transformRoute(perms.data) // vue-route 根据权限操作route
return {
perms
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Request {
request = async <T>(data: AxiosRequestConfig<any>) => {
try {
const res = await _request.request(data)
return res as T
return res.data as T
} catch (err: any) {
message.error(err?.msg || err.message || '网络错误, 请稍后再试~')
return Promise.reject(err)
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default defineConfig(
// @ts-ignore
({ command, mode }: ConfigEnv): UserConfigExport => {
const envData = loadEnv(mode, path.resolve(process.cwd(), 'env'))
console.log(envData, 'envData')
console.log('envData环境变量', envData)
return {
plugins: [
vue(),
Expand Down

0 comments on commit b108da0

Please sign in to comment.