Skip to content

Commit

Permalink
fix: #367
Browse files Browse the repository at this point in the history
  • Loading branch information
kailong321200875 committed Nov 30, 2023
1 parent 893459d commit c8400ab
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 72 deletions.
11 changes: 4 additions & 7 deletions mock/analysis/index.mock.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import config from '@/config/axios/config'
import { defineMock } from 'vite-plugin-mock-dev-server'

const { code } = config

const delay = 1000

export default defineMock([
Expand All @@ -13,7 +10,7 @@ export default defineMock([
delay,
body: () => {
return {
code: code,
code: 0,
data: {
users: 102400,
messages: 81212,
Expand All @@ -30,7 +27,7 @@ export default defineMock([
delay,
body: () => {
return {
code: code,
code: 0,
data: [
{ value: 1000, name: 'analysis.directAccess' },
{ value: 310, name: 'analysis.mailMarketing' },
Expand All @@ -48,7 +45,7 @@ export default defineMock([
delay,
body: () => {
return {
code: code,
code: 0,
data: [
{ value: 13253, name: 'analysis.monday' },
{ value: 34235, name: 'analysis.tuesday' },
Expand All @@ -68,7 +65,7 @@ export default defineMock([
delay,
body: () => {
return {
code: code,
code: 0,
data: [
{ estimate: 100, actual: 120, name: 'analysis.january' },
{ estimate: 120, actual: 82, name: 'analysis.february' },
Expand Down
18 changes: 7 additions & 11 deletions mock/department/index.mock.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import config from '@/config/axios/config'

import { toAnyString } from '@/utils'
import { faker } from '@faker-js/faker'

const { code } = config

const departmentList: any = []

const citys = ['厦门总公司', '北京分公司', '上海分公司', '福州分公司', '深圳分公司', '杭州分公司']
Expand Down Expand Up @@ -84,7 +80,7 @@ export default [
method: 'GET',
body: () => {
return {
code: code,
code: 0,
data: {
list: departmentList
}
Expand All @@ -96,7 +92,7 @@ export default [
method: 'GET',
body: () => {
return {
code: code,
code: 0,
data: {
list: departmentList,
total: 5
Expand Down Expand Up @@ -127,7 +123,7 @@ export default [
})
}
return {
code: code,
code: 0,
data: {
total: 100,
list: mockList
Expand All @@ -142,7 +138,7 @@ export default [
delay: 1000,
body: () => {
return {
code: code,
code: 0,
data: 'success'
}
}
Expand All @@ -160,7 +156,7 @@ export default [
}
} else {
return {
code: code,
code: 0,
data: 'success'
}
}
Expand All @@ -173,7 +169,7 @@ export default [
delay: 1000,
body: () => {
return {
code: code,
code: 0,
data: 'success'
}
}
Expand All @@ -191,7 +187,7 @@ export default [
}
} else {
return {
code: code,
code: 0,
data: 'success'
}
}
Expand Down
8 changes: 2 additions & 6 deletions mock/dict/index.mock.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import config from '@/config/axios/config'

const { code } = config

const delay = 1000

const dictObj: Recordable = {
Expand Down Expand Up @@ -29,7 +25,7 @@ export default [
delay,
body: () => {
return {
code: code,
code: 0,
data: dictObj
}
}
Expand All @@ -41,7 +37,7 @@ export default [
delay,
body: () => {
return {
code: code,
code: 0,
data: [
{
label: 'test1',
Expand Down
5 changes: 1 addition & 4 deletions mock/menu/index.mock.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import config from '@/config/axios/config'
import { faker } from '@faker-js/faker'

const { code } = config

const delay = 1000

export default [
Expand All @@ -13,7 +10,7 @@ export default [
delay,
body: () => {
return {
code: code,
code: 0,
data: {
list: [
{
Expand Down
14 changes: 5 additions & 9 deletions mock/request/index.mock.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import config from '@/config/axios/config'

const delay = 600000

const { code } = config

export default [
{
url: '/mock/request/1',
method: 'GET',
delay,
body: () => {
return {
code: code,
code: 0,
data: 'request-1'
}
}
Expand All @@ -22,7 +18,7 @@ export default [
delay,
body: () => {
return {
code: code,
code: 0,
data: 'request-2'
}
}
Expand All @@ -33,7 +29,7 @@ export default [
delay,
body: () => {
return {
code: code,
code: 0,
data: 'request-3'
}
}
Expand All @@ -44,7 +40,7 @@ export default [
delay,
body: () => {
return {
code: code,
code: 0,
data: 'request-4'
}
}
Expand All @@ -55,7 +51,7 @@ export default [
delay,
body: () => {
return {
code: code,
code: 0,
data: 'request-5'
}
}
Expand Down
11 changes: 4 additions & 7 deletions mock/role/index.mock.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import config from '@/config/axios/config'
import { faker } from '@faker-js/faker'

import { toAnyString } from '@/utils'

const { code } = config

const delay = 1000

const adminList = [
Expand Down Expand Up @@ -1144,7 +1141,7 @@ export default [
delay,
body: () => {
return {
code: code,
code: 0,
data: adminList
}
}
Expand All @@ -1155,7 +1152,7 @@ export default [
delay,
body: () => {
return {
code: code,
code: 0,
data: {
list: List,
total: 4
Expand All @@ -1170,7 +1167,7 @@ export default [
delay,
body: () => {
return {
code: code,
code: 0,
data: testList
}
}
Expand All @@ -1181,7 +1178,7 @@ export default [
delay,
body: () => {
return {
code: code,
code: 0,
data: {
list: List,
total: 4
Expand Down
15 changes: 6 additions & 9 deletions mock/table/index.mock.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import config from '@/config/axios/config'
import { faker } from '@faker-js/faker'

import { toAnyString } from '@/utils'

const { code } = config

const delay = 1000

const count = 100
Expand Down Expand Up @@ -196,7 +193,7 @@ export default [
(_, index) => index < pageSize * pageIndex && index >= pageSize * (pageIndex - 1)
)
return {
code: code,
code: 0,
data: {
total: mockList.length,
list: pageList
Expand All @@ -219,7 +216,7 @@ export default [
(_, index) => index < pageSize * pageIndex && index >= pageSize * (pageIndex - 1)
)
return {
code: code,
code: 0,
data: {
total: mockList.length,
list: pageList
Expand All @@ -240,7 +237,7 @@ export default [
})
].concat(List)
return {
code: code,
code: 0,
data: 'success'
}
} else {
Expand All @@ -252,7 +249,7 @@ export default [
}
})
return {
code: code,
code: 0,
data: 'success'
}
}
Expand All @@ -267,7 +264,7 @@ export default [
for (const example of List) {
if (example.id === id) {
return {
code: code,
code: 0,
data: example
}
}
Expand All @@ -293,7 +290,7 @@ export default [
}
}
return {
code: code,
code: 0,
data: 'success'
}
}
Expand Down
10 changes: 3 additions & 7 deletions mock/user/index.mock.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import config from '@/config/axios/config'

const { code } = config

const delay = 1000

const List: {
Expand Down Expand Up @@ -44,7 +40,7 @@ export default [
)

return {
code: code,
code: 0,
data: {
total: mockList.length,
list: pageList
Expand All @@ -64,7 +60,7 @@ export default [
if (user.username === data.username && user.password === data.password) {
hasUser = true
return {
code: code,
code: 0,
data: user
}
}
Expand All @@ -84,7 +80,7 @@ export default [
delay,
body: () => {
return {
code: code,
code: 0,
data: null
}
}
Expand Down
Loading

0 comments on commit c8400ab

Please sign in to comment.