From 532f8c73a83267d552f13f607d6b54dce5c5fa59 Mon Sep 17 00:00:00 2001 From: ycy <2861518472@qq.com> Date: Sat, 6 Apr 2024 15:29:30 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20mock=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mock/modules/ycy.js | 21 ++++++-- src/api/login.js | 2 +- src/api/stockList.js | 7 +++ src/pages/finance-bill-manage/billStock.vue | 7 ++- src/utils/requestMock.js | 54 +++++++++++++++++++++ vite.config.js | 9 ---- 6 files changed, 85 insertions(+), 15 deletions(-) create mode 100644 src/api/stockList.js create mode 100644 src/utils/requestMock.js diff --git a/mock/modules/ycy.js b/mock/modules/ycy.js index aba129e..318fac0 100644 --- a/mock/modules/ycy.js +++ b/mock/modules/ycy.js @@ -5,14 +5,27 @@ const StockList = Mock.mock({ "id|+1": "0", billserial: "@integer(10000000000,19999999999)", billType: "@integer(0,5)", - stockNum: "前端", - unit: "前端", + stockNum: "@integer(1,2)", + unit: "@cword(张本,1)", stockDate: "@date", operator: "@cname", remark: " @integer(10000000000,19999999999)", }, ], }); -export default [ -] +export default [ + { + url: "/stockList", + method: "get", + response: () => { + const obj = { + list: StockList, + }; + return { + code: 200, + data: obj, + }; + }, + }, +]; diff --git a/src/api/login.js b/src/api/login.js index 34c4da1..3d7cbb8 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -5,4 +5,4 @@ const API = { udaiu: "/user", }; export const reqUser = () => request.get(API.LOGIN_URL); -export const reqUser = (data) => request.post(API.LOGIN_URL, data); +export const reqUserone = (data) => request.post(API.LOGIN_URL, data); diff --git a/src/api/stockList.js b/src/api/stockList.js new file mode 100644 index 0000000..47b311a --- /dev/null +++ b/src/api/stockList.js @@ -0,0 +1,7 @@ +import request from "@/utils/requestMock"; + +const API = { + STOCK_LIST: "/stockList", +}; + +export const reqStockList = () => request.get(API.STOCK_LIST); diff --git a/src/pages/finance-bill-manage/billStock.vue b/src/pages/finance-bill-manage/billStock.vue index dc6a5a8..ed57b49 100644 --- a/src/pages/finance-bill-manage/billStock.vue +++ b/src/pages/finance-bill-manage/billStock.vue @@ -35,8 +35,9 @@