-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a28bc4e
commit e35fa8b
Showing
20 changed files
with
210 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { success, fail } from '../helper'; | ||
|
||
export default [ | ||
{ | ||
url: '/api/list', // | ||
method: 'get', | ||
response: (req: { body: { username: any }; query: { page?: number; size?: number } }) => { | ||
const query = req.query; | ||
if (!query.page || !query.size) { | ||
return fail('page和size必填'); | ||
} | ||
if (query.page < 1) { | ||
return fail('page必须大于0'); | ||
} | ||
if (query.size < 1) { | ||
return fail('size必须大于0'); | ||
} | ||
const list = [] as string[]; | ||
for (let i = 0; i < query.size; i++) { | ||
list.push(`item-${query.page}-${i}`); | ||
} | ||
return success( | ||
{ | ||
total: 30, | ||
list, | ||
}, | ||
'登录成功', | ||
); | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import request from '@/utils/request'; | ||
|
||
const enum Api { | ||
LIST = '/api/list', | ||
INFO = '/api/list/info/', | ||
} | ||
|
||
//列表接口 | ||
export interface ListParams { | ||
page: number; | ||
size: number; | ||
} | ||
export interface ListResult { | ||
total: number; | ||
list: string[]; | ||
} | ||
export function listApi() { | ||
return request<ListResult, [ListParams]>((params) => ({ | ||
url: Api.LIST, | ||
method: 'get', | ||
params, | ||
})); | ||
} | ||
|
||
export function infoApi() { | ||
return request<string, [number]>((id) => ({ | ||
url: Api.INFO + id, | ||
method: 'get', | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { RouteRecordRaw } from 'vue-router'; | ||
export const routes: RouteRecordRaw[] = [ | ||
{ | ||
path: 'request', | ||
component: async () => await import('@/views/example/request.vue'), | ||
meta: { title: '请求示例' }, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { RouteRecordRaw } from 'vue-router'; | ||
export const routes: RouteRecordRaw[] = [ | ||
{ | ||
path: 'https://github.com/meadmin-cn/meadmin-template', | ||
component: async () => await import('@/views/404.vue'), | ||
meta: { title: '外链', isLink: true }, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { RouteRecordRaw, RouterView } from 'vue-router'; | ||
import LayoutPage from '@/layout/components/page.vue'; | ||
import { concatObjectValue } from '@/utils/helper'; | ||
export const routes: RouteRecordRaw[] = [ | ||
{ | ||
path: 'multilevel', | ||
component: LayoutPage, | ||
meta: { title: '多级菜单' }, | ||
children: concatObjectValue<RouteRecordRaw>( | ||
import.meta.glob('./multilevel/*.ts', { eager: true, import: 'routes' }), | ||
), | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { RouteRecordRaw, RouterView } from 'vue-router'; | ||
import LayoutPage from '@/layout/components/page.vue'; | ||
export const routes: RouteRecordRaw[] = [ | ||
{ | ||
path: '1', | ||
component: LayoutPage, | ||
meta: { title: '多级菜单1' }, | ||
children: [ | ||
{ | ||
path: '1-1', | ||
component: LayoutPage, | ||
meta: { title: '多级菜单1-1', alwaysShow: true }, | ||
children: [ | ||
{ | ||
path: '1-1-1', | ||
component: () => import('@/views/dashboard/index.vue'), | ||
meta: { title: '多级菜单1-1-1' }, | ||
}, | ||
{ | ||
path: '/test/componentLang', | ||
component: async () => await import('@/views/example/componentLang/index.vue'), | ||
meta: { title: '组件语言包' }, | ||
}, | ||
], | ||
}, | ||
{ | ||
path: '1-2', | ||
component: () => import('@/views/dashboard/index.vue'), | ||
meta: { title: '多级菜单1-2' }, | ||
}, | ||
], | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import nProgress from 'nprogress'; | ||
let number = 0; | ||
export const done = (n = 1) => { | ||
number -= n; | ||
if (number <= 0) { | ||
nProgress.done(); | ||
number = 0; | ||
} else { | ||
nProgress.set(number / (number + n)); | ||
} | ||
}; | ||
|
||
export const start = (n = 1) => { | ||
if (number <= 0) { | ||
nProgress.start(); | ||
number = n; | ||
} else { | ||
number += n; | ||
} | ||
}; | ||
|
||
export const set = (n: number) => { | ||
if (number > 0) { | ||
nProgress.set(n); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.