Commit 9c46aca9 authored by 郭志伟's avatar 郭志伟

fix: 问题修复

parent fc9174ab
...@@ -5,7 +5,6 @@ import axios from "axios"; ...@@ -5,7 +5,6 @@ import axios from "axios";
import cherry from "@qg/cherry-ui"; import cherry from "@qg/cherry-ui";
import config from "../config"; import config from "../config";
import localStorage from "./localStorage"; import localStorage from "./localStorage";
import { debounce } from "lodash-es";
const ERR_MESSAGE_MAP = { const ERR_MESSAGE_MAP = {
status: { status: {
...@@ -32,9 +31,6 @@ axios.defaults.timeout = 30000; ...@@ -32,9 +31,6 @@ axios.defaults.timeout = 30000;
const wait = async seconds => new Promise(resolve => setTimeout(resolve, seconds)); const wait = async seconds => new Promise(resolve => setTimeout(resolve, seconds));
let showLoading = debounce(function() {
beforeRequest();
}, 3000);
function beforeRequest() { function beforeRequest() {
reqNum++; reqNum++;
store.dispatch("setIsLoading", true); store.dispatch("setIsLoading", true);
...@@ -54,7 +50,7 @@ function clearRequest() { ...@@ -54,7 +50,7 @@ function clearRequest() {
// 请求拦截器 // 请求拦截器
axios.interceptors.request.use( axios.interceptors.request.use(
config => { config => {
showLoading(); beforeRequest();
// 发起请求时,取消掉当前正在进行的相同请求 // 发起请求时,取消掉当前正在进行的相同请求
if (pending[config.url]) { if (pending[config.url]) {
...@@ -78,7 +74,7 @@ axios.interceptors.request.use( ...@@ -78,7 +74,7 @@ axios.interceptors.request.use(
axios.interceptors.response.use( axios.interceptors.response.use(
response => { response => {
afterRequest(); afterRequest();
showLoading.cancel();
delete pending[response.config.url]; delete pending[response.config.url];
if (response.data.code === "0") return response.data.data; if (response.data.code === "0") return response.data.data;
// 特殊处理,下单已存在时,跳转到保单列表 // 特殊处理,下单已存在时,跳转到保单列表
...@@ -91,6 +87,7 @@ axios.interceptors.response.use( ...@@ -91,6 +87,7 @@ axios.interceptors.response.use(
return Promise.reject(response.data); return Promise.reject(response.data);
}, },
async err => { async err => {
console.dir(err.response);
afterRequest(); afterRequest();
// 判断是否取消请求 // 判断是否取消请求
if (err?.message === "取消重复请求") { if (err?.message === "取消重复请求") {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Description: weixin-js-sdk * @Description: weixin-js-sdk
* @LastEditors: gzw * @LastEditors: gzw
* @Date: 20120-08-30 18:40:11 * @Date: 20120-08-30 18:40:11
* @LastEditTime: 2020-09-01 18:51:52 * @LastEditTime: 2020-09-01 19:06:07
*/ */
import cfg from "@/config/index"; import cfg from "@/config/index";
import { getwxAuth } from "@/api/user"; import { getwxAuth } from "@/api/user";
...@@ -70,7 +70,7 @@ export async function setShare({ ...@@ -70,7 +70,7 @@ export async function setShare({
export function checkOpenId() { export function checkOpenId() {
const openId = localStorage.get("openId"); const openId = localStorage.get("openId");
const local = window.location.href; const local = window.location.href;
console.log(openId, isWeixinBrower); console.log(!openId, isWeixinBrower);
if (!openId && isWeixinBrower) { if (!openId && isWeixinBrower) {
alert("无openid"); alert("无openid");
var nextPage = document.createElement("a"); var nextPage = document.createElement("a");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment