From 609b69744097d61b0f7e6e11997b99ec770fa772 Mon Sep 17 00:00:00 2001 From: aixianling Date: Tue, 3 Jan 2023 15:06:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=95=E7=A5=A8=E6=B5=81=E7=A8=8B=E5=A4=A7?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/http.js | 11 ++++ src/common/modules.js | 1 + src/project/fengdu/AppVote/AppVote.vue | 10 +++- src/project/fengdu/AppVote/voteDetail.vue | 25 +++----- src/project/fengdu/AppVote/weixinLogin.vue | 69 ++++++++++++++++++++++ 5 files changed, 99 insertions(+), 17 deletions(-) create mode 100644 src/project/fengdu/AppVote/weixinLogin.vue diff --git a/src/common/http.js b/src/common/http.js index d92d3cdb..80da7c1e 100644 --- a/src/common/http.js +++ b/src/common/http.js @@ -9,7 +9,18 @@ const getToken = () => { return !!vuex ? JSON.parse(vuex).user.token : null } const source = axios.CancelToken.source(); +let throttleMap = {} instance.interceptors.request.use(config => { + if (config.throttle) {// 节流处理 + let timer = throttleMap[config.url] + if (!!timer) { + config.cancelToken = source.token + source.cancel("节流控制,取消请求:" + config.url) + } + throttleMap[config.url] = setTimeout(() => { + throttleMap[config.url] = null + }, config.throttle) + } if (config.withoutToken) { return config } else if (getToken()) { diff --git a/src/common/modules.js b/src/common/modules.js index 8faa1ea3..4dab3be1 100644 --- a/src/common/modules.js +++ b/src/common/modules.js @@ -156,6 +156,7 @@ export const user = { let {module} = params, action = "/auth/wechat-mp/token" return http.post(action, params, { withoutToken: true, + throttle: 500, module, params: { ...params, grant_type: 'password', diff --git a/src/project/fengdu/AppVote/AppVote.vue b/src/project/fengdu/AppVote/AppVote.vue index ba329f87..da011647 100644 --- a/src/project/fengdu/AppVote/AppVote.vue +++ b/src/project/fengdu/AppVote/AppVote.vue @@ -16,12 +16,17 @@ + @@ -87,7 +79,8 @@ export default { ::v-deep video { width: 100%; } - ::v-deep.topLabel{ + + ::v-deep.topLabel { padding-right: 20px; } } diff --git a/src/project/fengdu/AppVote/weixinLogin.vue b/src/project/fengdu/AppVote/weixinLogin.vue new file mode 100644 index 00000000..95dfa3f7 --- /dev/null +++ b/src/project/fengdu/AppVote/weixinLogin.vue @@ -0,0 +1,69 @@ + + + + +