From dd07c1da1030710529296c7a20f119acd0e7b471 Mon Sep 17 00:00:00 2001 From: Dawn_Ocean <1785590531@qq.com> Date: Fri, 8 Mar 2024 14:56:48 +0800 Subject: [PATCH] add mock apis --- mock/api.ts | 113 ++++++++++++++++++++++++++++++++++++++++++- mock/lang.json | 4 ++ mock/newComment.json | 4 ++ mock/report.json | 4 ++ mock/ticket.json | 10 ++++ mock/userinfo.json | 4 ++ 6 files changed, 137 insertions(+), 2 deletions(-) create mode 100644 mock/lang.json create mode 100644 mock/newComment.json create mode 100644 mock/report.json create mode 100644 mock/ticket.json create mode 100644 mock/userinfo.json diff --git a/mock/api.ts b/mock/api.ts index ad83669..4e0b294 100644 --- a/mock/api.ts +++ b/mock/api.ts @@ -1,8 +1,117 @@ +import userinfo from './userinfo.json'; +import lang from './lang.json'; +import report from './report.json'; +import newComment from './newComment.json'; +import ticket from './ticket.json'; + export default { - 'GET /testdata': { + 'GET /dutyinfo': { success: true, data: { - test: 'test', + token: 'token_test', + isInDuty: true, + inDutyCnt: 3, + currentDuty: '2', }, }, + 'GET /user/info': { + success: true, + data: { + token: 'token_test', + name: '马保国', + phone: 13333333333, + }, + }, + 'POST /user/update': { + file: userinfo, + }, + 'GET /user/locale/get': { + success: true, + data: { + token: 'token_test', + lang: 'zn_CN', + }, + }, + 'POST /user/locale/update': { + file: lang, + }, + 'POST /report': { + file: report, + }, + 'GET /user/mytickets': { + success: true, + data: { + list: [ + { + id: 6830, + type: 1, + status: 5, + device: '主机', + deviceModel: '技嘉', + owner: '武技栏', + phone: '18888888888', + createdTime: '2024-03-06T19:49:27.043865', + isConfirmed: false, + }, + ], + }, + }, + 'GET /tickets/info/': { + success: true, + data: { + id: 6847, + type: 1, + device: '华硕', + deviceModel: '灵耀X14', + owner: '唐姐姐', + phone: '15555555555', + description: '清灰', + workers: [], + createdTime: '2024-03-07T19:52:48.523303', + status: 5, + isConfirmed: false, + notes: [ + { + avatar: 'https://....jpg', + id: 21368, + op: '宇航员', + type: 0, + content: '', + createdTime: '2024-03-07T19:52:48.523305', + }, + { + avatar: 'https://....jpg', + id: 21370, + op: '宇航员', + type: 2, + content: '1', + createdTime: '2024-03-07T19:58:27.838816', + }, + { + avatar: 'https://....jpg', + id: 21373, + op: '宇航员', + type: 2, + content: '4', + createdTime: '2024-03-07T20:28:12.070707', + }, + { + avatar: 'https://....jpg', + id: 21374, + op: '宇航员', + type: 2, + content: '5', + createdTime: '2024-03-07T20:30:15.770486', + }, + ], + accessories: [2], + picked: false, + }, + }, + 'POST /tickets/newcomment': { + file: newComment, + }, + 'POST /tickets/create': { + file: ticket, + }, }; diff --git a/mock/lang.json b/mock/lang.json new file mode 100644 index 0000000..5b296da --- /dev/null +++ b/mock/lang.json @@ -0,0 +1,4 @@ +{ + "token": "token_test", + "lang": "en_US" +} \ No newline at end of file diff --git a/mock/newComment.json b/mock/newComment.json new file mode 100644 index 0000000..7805016 --- /dev/null +++ b/mock/newComment.json @@ -0,0 +1,4 @@ +{ + "token": "token_test", + "content": "这是一条评论" +} \ No newline at end of file diff --git a/mock/report.json b/mock/report.json new file mode 100644 index 0000000..d578808 --- /dev/null +++ b/mock/report.json @@ -0,0 +1,4 @@ +{ + "token": "token_test", + "content": "aaa bbbb cccc" +} \ No newline at end of file diff --git a/mock/ticket.json b/mock/ticket.json new file mode 100644 index 0000000..30c7dc3 --- /dev/null +++ b/mock/ticket.json @@ -0,0 +1,10 @@ +{ + "token": "token_test", + "type": 1, + "device": "华硕", + "deviceModel": "天选3", + "owner": "西西弗", + "phone": "12333333333", + "description": "没法用pd充电", + "accessories": [0] + } \ No newline at end of file diff --git a/mock/userinfo.json b/mock/userinfo.json new file mode 100644 index 0000000..c1a9f3b --- /dev/null +++ b/mock/userinfo.json @@ -0,0 +1,4 @@ +{ + "name": "宇航员", + "phone": "12333332103" +} \ No newline at end of file