Commit 35905816 authored by 郭志伟's avatar 郭志伟

fix: 分享测试

parent 5c4fd3bc
...@@ -5,6 +5,7 @@ import axios from "axios"; ...@@ -5,6 +5,7 @@ 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: {
...@@ -31,6 +32,9 @@ axios.defaults.timeout = 30000; ...@@ -31,6 +32,9 @@ 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);
...@@ -50,7 +54,7 @@ function clearRequest() { ...@@ -50,7 +54,7 @@ function clearRequest() {
// 请求拦截器 // 请求拦截器
axios.interceptors.request.use( axios.interceptors.request.use(
config => { config => {
beforeRequest(); showLoading();
// 发起请求时,取消掉当前正在进行的相同请求 // 发起请求时,取消掉当前正在进行的相同请求
if (pending[config.url]) { if (pending[config.url]) {
...@@ -74,7 +78,7 @@ axios.interceptors.request.use( ...@@ -74,7 +78,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;
// 特殊处理,下单已存在时,跳转到保单列表 // 特殊处理,下单已存在时,跳转到保单列表
......
...@@ -2,13 +2,14 @@ ...@@ -2,13 +2,14 @@
* @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:12:00 * @LastEditTime: 2020-09-01 18:36:05
*/ */
import cfg from "@/config/index"; import cfg from "@/config/index";
import { getwxAuth } from "@/api/user"; import { getwxAuth } from "@/api/user";
import wx from "weixin-js-sdk"; import wx from "weixin-js-sdk";
import { isWeixinBrower } from "@/service/validation"; import { isWeixinBrower } from "@/service/validation";
import localStorage from "@/service/localStorage"; import localStorage from "@/service/localStorage";
/** /**
* @description: 微信分享 * @description: 微信分享
*/ */
...@@ -69,7 +70,9 @@ export async function setShare({ ...@@ -69,7 +70,9 @@ 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;
alert(!openId && isWeixinBrower);
if (!openId && isWeixinBrower) { if (!openId && isWeixinBrower) {
alert("无openid");
var nextPage = document.createElement("a"); var nextPage = document.createElement("a");
nextPage.setAttribute( nextPage.setAttribute(
"href", "href",
......
...@@ -87,9 +87,11 @@ export default { ...@@ -87,9 +87,11 @@ export default {
.catch(() => { .catch(() => {
console.log("h5支付"); console.log("h5支付");
// tradeType === "JSAPI" && this.$notify({ type: "warning", message: "支付异常" }); // tradeType === "JSAPI" && this.$notify({ type: "warning", message: "支付异常" });
this.$router.replace({ setTimeout(() => {
path: "/policy" this.$router.replace({
}); path: "/policy"
});
}, 3000);
return; return;
}); });
} else { } else {
......
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
} else { } else {
this.isAgeIndexChange = false; this.isAgeIndexChange = false;
} }
return _index; return _index === -1 ? 0 : _index;
}, },
amountOptions() { amountOptions() {
const { ageIndex, countOptions } = this; const { ageIndex, countOptions } = this;
......
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