| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- import Mock from 'mockjs'
- import { MockMethod } from 'vite-plugin-mock'
- let saveinfo: {
- employee: string
- name: string
- sex: string
- area: string
- section: string
- birthday: string
- profession: string
- educational: string
- universities: string
- aptityde: string
- beGoodAt: string
- introduction: string
- } | null = null
- const mockMethodFour: MockMethod[] = [
- {
- url: '/mock/api/four/userinfo',
- method: 'get',
- timeout: 1000,
- response: () => ({
- code: '0',
- ...Mock.mock({
- data: saveinfo ?? {
- employee: '@integer(0)',
- name: '@cname',
- sex: '@sex',
- area: '@integer(1, 3)',
- section: '@integer(1, 3)',
- birthday: '@datetime',
- profession: '@profession',
- educational: '@educational',
- universities: '@universities',
- aptityde: '@jobQualifications',
- beGoodAt: '@expertise',
- introduction: '唱跳两年半练习生'
- }
- })
- })
- },
- {
- url: '/mock/api/four/query',
- method: 'get',
- timeout: 1000,
- response: () => ({
- code: '0',
- ...Mock.mock({
- 'data|5-10': [
- {
- id: '@id',
- type: '类型@integer(1, 10)',
- product: '@goods',
- profession: '@profession',
- name: '@ctitle',
- // intro: '@csentence(5, 10)',
- createName: '@cname',
- createTime: '@datetime("2024-MM-dd hh:mm:ss")',
- modification: '@cname',
- modifiTime: '@datetime("2024-MM-dd hh:mm:ss")'
- }
- ]
- })
- })
- },
- {
- url: '/mock/api/four/tags',
- method: 'get',
- timeout: 1000,
- response: () => ({
- code: '0',
- ...Mock.mock({
- data: {
- 'product|2-3': [{ name: '@product', type: '@colorTypes' }],
- 'profession|2-3': [{ name: '@profession', type: '@colorTypes' }],
- 'expert|2-3': [{ name: '@expertTags', type: '@colorTypes' }]
- }
- })
- })
- },
- {
- url: '/mock/api/four/save',
- method: 'post',
- timeout: 1000,
- response: ({ body }: { body: any }) => {
- console.log(body)
- saveinfo = body
- return { code: '0' }
- }
- }
- ]
- export default mockMethodFour
|