From 5f3c64ed8862a2be46159e168cf5b152c018eebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 19 Sep 2022 11:10:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20#10000=20=E8=A1=A8=E6=A0=BC=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=8A=A0=E8=BD=BD=E6=98=BE=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/frontend/src/util/http.js | 75 ++++++++++--------- resources/frontend/src/views/goods/goods.vue | 6 +- .../src/views/goodsType/goodsType.vue | 4 +- resources/frontend/src/views/logs/logs.vue | 5 +- resources/frontend/src/views/logs/record.vue | 4 +- .../frontend/src/views/plat/goodsList.vue | 4 +- resources/frontend/src/views/store/store.vue | 4 +- resources/frontend/src/views/system/role.vue | 5 +- resources/frontend/src/views/users/users.vue | 4 +- 9 files changed, 64 insertions(+), 47 deletions(-) diff --git a/resources/frontend/src/util/http.js b/resources/frontend/src/util/http.js index 2aaadae..d88e4cb 100644 --- a/resources/frontend/src/util/http.js +++ b/resources/frontend/src/util/http.js @@ -4,54 +4,55 @@ import NProgress from "nprogress"; import "nprogress/nprogress.css"; import { Message } from "element-ui"; var instance = axios.create({ - timeout: 10000, + timeout: 10000, }); instance.interceptors.request.use( - (config) => { - // config.headers['content-type'] = 'application/json' + (config) => { + // config.headers['content-type'] = 'application/json' - // config.headers['Shop-Id'] = localStorage.getItem('shopId') || 1 + // config.headers['Shop-Id'] = localStorage.getItem('shopId') || 1 - // 在发送请求之前做些什么 - // config.headers['content-type'] = 'application/json' - config.headers.Authorization = "Bearer " + getToken(); // 请求头 - NProgress.start(); - return config; - }, - (error) => { - // 对请求错误做些什么 - return Promise.reject(error); - } + // 在发送请求之前做些什么 + // config.headers['content-type'] = 'application/json' + config.headers.Authorization = "Bearer " + getToken(); // 请求头 + NProgress.start(); + return config; + }, + (error) => { + // 对请求错误做些什么 + return Promise.reject(error); + } ); // 添加响应拦截器 instance.interceptors.response.use( - (response) => { - NProgress.done(); - const res = response.status; - // 对响应数据做点什么 - if (res === 200 || res === 201) { - return response; - } - }, - (error) => { - // 对响应错误做点什么 - if (error.response.status === 400) { - Message({ - message: error.response.data.errorMessage, - type: "error", - }); - } + (response) => { + NProgress.done(); + const res = response.status; + // 对响应数据做点什么 + if (res === 200 || res === 201) { + return response; + } + }, + (error) => { + NProgress.done(); + // 对响应错误做点什么 + if (error.response.status === 400) { + Message({ + message: error.response.data.errorMessage, + type: "error", + }); + } - if (error.response.status === 500) { - Message({ - message: error.response.data.message, - type: "error", - }); + if (error.response.status === 500) { + Message({ + message: error.response.data.message, + type: "error", + }); + } + return Promise.reject(error); } - return Promise.reject(error); - } ); export default instance; diff --git a/resources/frontend/src/views/goods/goods.vue b/resources/frontend/src/views/goods/goods.vue index 2bc7e6f..9685931 100644 --- a/resources/frontend/src/views/goods/goods.vue +++ b/resources/frontend/src/views/goods/goods.vue @@ -75,8 +75,8 @@ - + @@ -385,6 +385,7 @@ export default { radio: "", // 损耗选择的原因 brand: [], // 品牌列表 cate: [], // 种类列表 + loading: true, tableData: [], // 商品列表 shopsData: [], //店铺传参数组 sku_code: {}, //店铺传参对象 @@ -524,6 +525,7 @@ export default { this.sku_code = { sku_code: this.shopsData, }; + this.loading = false; }); }, diff --git a/resources/frontend/src/views/goodsType/goodsType.vue b/resources/frontend/src/views/goodsType/goodsType.vue index f4b6219..0361ed4 100644 --- a/resources/frontend/src/views/goodsType/goodsType.vue +++ b/resources/frontend/src/views/goodsType/goodsType.vue @@ -5,7 +5,7 @@
- @@ -64,6 +64,7 @@ export default { data() { return { id: "", //每一项的id + loading: true, tableData: [], multipleSelection: [], dialogFormVisible: false, @@ -174,6 +175,7 @@ export default { this.tableData = res.data.data; this.Paginationdata = res.data.meta; }); + this.loading = false; }, }, }; diff --git a/resources/frontend/src/views/logs/logs.vue b/resources/frontend/src/views/logs/logs.vue index d43ba8d..afb6a86 100644 --- a/resources/frontend/src/views/logs/logs.vue +++ b/resources/frontend/src/views/logs/logs.vue @@ -50,7 +50,7 @@ - + @@ -292,7 +292,7 @@ export default { userId: "",//操作人id(用户列表) }, value1: "", //筛选时间变量 - + loading: true, tableData: [], //列表数据 Paginationdata: {}, //分页相关数据 current_page: 1, //当前页 @@ -310,6 +310,7 @@ export default { this.tableData = res.data.data; this.Paginationdata = res.data.meta; }); + this.loading = false; }, // 获取用户列表 diff --git a/resources/frontend/src/views/logs/record.vue b/resources/frontend/src/views/logs/record.vue index ca19254..a4290ff 100644 --- a/resources/frontend/src/views/logs/record.vue +++ b/resources/frontend/src/views/logs/record.vue @@ -44,7 +44,7 @@ - + @@ -109,6 +109,7 @@ export default { userId: "", }, value1: "", //筛选时间变量 + loading: true, tableData: [], //列表数据 Paginationdata: {}, //分页相关数据 current_page: 1, //当前页 @@ -133,6 +134,7 @@ export default { this.tableData = res.data.data; this.Paginationdata = res.data.meta; }); + this.loading = false; }, //分页功能 diff --git a/resources/frontend/src/views/plat/goodsList.vue b/resources/frontend/src/views/plat/goodsList.vue index f3f328c..bb5e41c 100644 --- a/resources/frontend/src/views/plat/goodsList.vue +++ b/resources/frontend/src/views/plat/goodsList.vue @@ -27,7 +27,7 @@ - +