From f6739d7542be48f7f8139c3d5fc7b2326e5cfc8d Mon Sep 17 00:00:00 2001 From: songshankun <songshankun@foxmail.com> Date: 星期三, 22 十一月 2023 11:06:35 +0800 Subject: [PATCH] feat: 轮询plc时间调整; 接口报错时也轮询plc --- src/utils/request.js | 38 ++++++++++++++++++++++++++++++-------- 1 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/utils/request.js b/src/utils/request.js index 23a0a72..2a73124 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,8 +1,11 @@ import axios from "axios"; import util from "@/libs/util.js"; -import { Message } from "element-ui"; +import { Message,MessageBox } from "element-ui"; +import {FilterMessage} from "@/utils/filterMessage"; // import router from '@/router' + +const m= new FilterMessage(3000) let Axios = axios.create({ responseType: "json", @@ -38,12 +41,24 @@ return res.data ? res.data : {}; } else { if(!res.config.loadingFlag){ - Message({ - // message: res.data.msg==res.data.data?res.data.data:res.data.msg+','+res.data.data, - message: res.data.msg, - type: 'error', - duration: 5 * 1000 - }) + if (!m.has(res.data.msg)){ + m.add(res.data.msg) + Message({ + // message: res.data.msg==res.data.data?res.data.data:res.data.msg+','+res.data.data, + message: res.data.msg, + type: 'error', + duration: 3 * 1000 + }) + } + + // MessageBox.confirm( res.data.msg+"?", "鎻愮ず", { + // confirmButtonText: "纭畾", + // cancelButtonText: "鍙栨秷", + // type: "warning", + // }) + // .then(() => { + // }) + // .catch(() => {}); } return res.data ? res.data : {}; } @@ -60,8 +75,15 @@ Message({ message: message, type: 'error', - duration: 5 * 1000 + duration: 3 * 1000 }) + // MessageBox.confirm( message+"?", "鎻愮ず", { + // confirmButtonText: "纭畾", + // cancelButtonText: "鍙栨秷", + // type: "warning", + // }) + // .then(() => {}) + // .catch(() => {}); return Promise.reject(error) } ) -- Gitblit v1.8.0