diff --git a/src/components/common/Header.vue b/src/components/common/Header.vue index 25c6c1a..a2ccf6a 100644 --- a/src/components/common/Header.vue +++ b/src/components/common/Header.vue @@ -50,6 +50,7 @@ export default { break; case "loginout": //退出登录 this.$message({ + duration: 1500, showClose: true, message: "退出成功", type: "success", diff --git a/src/components/message.js b/src/components/message.js deleted file mode 100644 index 5da2f07..0000000 --- a/src/components/message.js +++ /dev/null @@ -1,28 +0,0 @@ -//resetMessage.js -/**重置message,防止重复点击重复弹出message消息提示 */ -import { Message } from "element-ui"; - -let messageInstance = null; - -const resetMessage = (options) => { - if (messageInstance) { - messageInstance.close(); - } - Message.closeAll(); //手动关闭所有消息提示实例 - messageInstance = Message(options); - // console.log(Message(options)); -}; - -["error", "success", "info", "warning"].forEach((type) => { - resetMessage[type] = (options) => { - if (typeof options === "string") { - options = { - message: options, - }; - } - options.type = type; - return resetMessage(options); - }; -}); - -export const message = resetMessage; diff --git a/src/main.js b/src/main.js index d0b018c..d56bb3d 100644 --- a/src/main.js +++ b/src/main.js @@ -4,19 +4,16 @@ import router from "./router"; import store from "./store"; //引入element-ui -import "../src/assets/css/theme/index.css"; +import "../src/assets/css/theme/index.css"; //l绿色主题 import ElementUI from "element-ui"; // import "element-ui/lib/theme-chalk/index.css"; - -import { message } from "./components/message.js"; - -Vue.prototype.$message = message; Vue.use(ElementUI, { size: "small", }); + // 引入Echarts -import * as echarts from "echarts"; -Vue.prototype.$echarts = echarts; +// import * as echarts from "echarts"; +// Vue.prototype.$echarts = echarts; // // 引入 vue-awesome-swiper // import VueAwesomeSwiper from "vue-awesome-swiper"; diff --git a/src/utils/request.js b/src/utils/request.js index 4720443..32b77b6 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -40,23 +40,16 @@ service.interceptors.response.use( // duration: 5 * 1000, // }); if (res.code === 401) { - Message({ message: res.msg, type: "error", duration: 5 * 1000 }); + Message({ message: res.msg, type: "error", duration: 1500 }); router.push("/login"); } - if (res.code === 100) { - Message({ - showClose: true, - message: res.msg, - type: "error", - duration: 5 * 1000, - }); - } + if (res.code === 500) { Message({ showClose: true, message: 服务器错误(500), type: "error", - duration: 5 * 1000, + duration: 1500, }); } return Promise.reject(new Error(res.msg || "Error")); @@ -69,7 +62,7 @@ service.interceptors.response.use( message: error.message, showClose: true, type: "error", - duration: 5 * 1000, + duration: 1500, }); return Promise.reject(error); } diff --git a/src/views/Login.vue b/src/views/Login.vue index c68d2f6..5593bed 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -111,6 +111,7 @@ export default { this.$router.push("/realTimeMonitor"); this.$message({ + duration: 1500, showClose: true, message: "登录成功", type: "success", diff --git a/src/views/alarmHandling/index.vue b/src/views/alarmHandling/index.vue index 53a7ee7..ffb3853 100644 --- a/src/views/alarmHandling/index.vue +++ b/src/views/alarmHandling/index.vue @@ -371,6 +371,7 @@ export default { onSubmit() { if (this.formdata.starttime > this.formdata.endtime) { return this.$message({ + duration: 1500, showClose: true, message: "开始日期不能大于结束日期", type: "warning", @@ -459,6 +460,7 @@ export default { preset: 255, }).then((res) => { this.$message({ + duration: 1500, showClose: true, message: "手动拍照请求成功!", type: "success", diff --git a/src/views/cameraChannel/components/adddeviceDialog.vue b/src/views/cameraChannel/components/adddeviceDialog.vue index 0bc4e70..2fb03dc 100644 --- a/src/views/cameraChannel/components/adddeviceDialog.vue +++ b/src/views/cameraChannel/components/adddeviceDialog.vue @@ -90,6 +90,7 @@ export default { //this.errorMsg = ""; if (res.code == 200) { this.$message({ + duration: 1500, showClose: true, message: "添加成功", type: "success", @@ -103,6 +104,7 @@ export default { }) .catch((err) => { this.$message({ + duration: 1500, showClose: true, message: "添加失败", type: "error", diff --git a/src/views/cameraChannel/components/setdevice.vue b/src/views/cameraChannel/components/setdevice.vue index a0c4092..cc98ff1 100644 --- a/src/views/cameraChannel/components/setdevice.vue +++ b/src/views/cameraChannel/components/setdevice.vue @@ -136,6 +136,7 @@ export default { .then((res) => { this.isShow = false; this.$message({ + duration: 1500, showClose: true, message: "添加成功", type: "success", @@ -144,6 +145,7 @@ export default { }) .catch((err) => { this.$message({ + duration: 1500, showClose: true, message: "添加失败", type: "error", diff --git a/src/views/cameraChannel/index.vue b/src/views/cameraChannel/index.vue index 2f39958..954c4d7 100644 --- a/src/views/cameraChannel/index.vue +++ b/src/views/cameraChannel/index.vue @@ -157,6 +157,7 @@ export default { this.deviceList(); //刷新 }); this.$message({ + duration: 1500, showClose: true, type: "success", message: "删除成功!", @@ -164,6 +165,7 @@ export default { }) .catch(() => { this.$message({ + duration: 1500, showClose: true, type: "info", message: "已取消删除", diff --git a/src/views/devicePhotoSchedule/components/adddeviceDialog.vue b/src/views/devicePhotoSchedule/components/adddeviceDialog.vue index fee7596..557d253 100644 --- a/src/views/devicePhotoSchedule/components/adddeviceDialog.vue +++ b/src/views/devicePhotoSchedule/components/adddeviceDialog.vue @@ -142,6 +142,7 @@ export default { .then((res) => { this.isShow = false; this.$message({ + duration: 1500, showClose: true, message: "添加成功", type: "success", @@ -150,6 +151,7 @@ export default { }) .catch((err) => { this.$message({ + duration: 1500, showClose: true, message: "添加失败", type: "error", diff --git a/src/views/devicePhotoSchedule/components/setdevice.vue b/src/views/devicePhotoSchedule/components/setdevice.vue index 3cdd019..3e6a8b4 100644 --- a/src/views/devicePhotoSchedule/components/setdevice.vue +++ b/src/views/devicePhotoSchedule/components/setdevice.vue @@ -253,6 +253,7 @@ export default { }) .catch((err) => { this.$message({ + duration: 1500, showClose: true, message: "添加失败", type: "error", diff --git a/src/views/devicePhotoSchedule/index.vue b/src/views/devicePhotoSchedule/index.vue index a3b1d60..8f803d7 100644 --- a/src/views/devicePhotoSchedule/index.vue +++ b/src/views/devicePhotoSchedule/index.vue @@ -194,6 +194,7 @@ export default { this.deviceList(); //刷新 }); this.$message({ + duration: 1500, showClose: true, type: "success", message: "删除成功!", @@ -201,6 +202,7 @@ export default { }) .catch(() => { this.$message({ + duration: 1500, showClose: true, type: "info", message: "已取消删除", diff --git a/src/views/management/monitoringEquipment/photographicDevice/components/addPhotoDialog.vue b/src/views/management/monitoringEquipment/photographicDevice/components/addPhotoDialog.vue index 0135384..3e03f5b 100644 --- a/src/views/management/monitoringEquipment/photographicDevice/components/addPhotoDialog.vue +++ b/src/views/management/monitoringEquipment/photographicDevice/components/addPhotoDialog.vue @@ -245,6 +245,7 @@ export default { .then((res) => { this.isShow = false; this.$message({ + duration: 1500, showClose: true, message: "添加成功", type: "success", @@ -253,6 +254,7 @@ export default { }) .catch((err) => { this.$message({ + duration: 1500, showClose: true, message: "添加失败", type: "error", diff --git a/src/views/management/monitoringEquipment/photographicDevice/components/gpsPosition.vue b/src/views/management/monitoringEquipment/photographicDevice/components/gpsPosition.vue index ee1c843..cb507ce 100644 --- a/src/views/management/monitoringEquipment/photographicDevice/components/gpsPosition.vue +++ b/src/views/management/monitoringEquipment/photographicDevice/components/gpsPosition.vue @@ -74,6 +74,7 @@ export default { this.loading = false; this.i = 0; this.$message({ + duration: 1500, showClose: true, message: "gps信息已更新", type: "success", @@ -83,6 +84,7 @@ export default { this.loading = false; this.i = 0; this.$message({ + duration: 1500, showClose: true, message: "暂未获取到GPS信息,请稍后再试!!", type: "warning", diff --git a/src/views/management/monitoringEquipment/photographicDevice/components/pictureTags.vue b/src/views/management/monitoringEquipment/photographicDevice/components/pictureTags.vue index 7ac4f4e..231dca3 100644 --- a/src/views/management/monitoringEquipment/photographicDevice/components/pictureTags.vue +++ b/src/views/management/monitoringEquipment/photographicDevice/components/pictureTags.vue @@ -322,6 +322,7 @@ export default { console.log("qing"); console.log(res); this.$message({ + duration: 1500, type: "success", message: "绘制保存成功", showClose: true, diff --git a/src/views/management/monitoringEquipment/photographicDevice/components/videoCapture.vue b/src/views/management/monitoringEquipment/photographicDevice/components/videoCapture.vue index a529c97..7853b11 100644 --- a/src/views/management/monitoringEquipment/photographicDevice/components/videoCapture.vue +++ b/src/views/management/monitoringEquipment/photographicDevice/components/videoCapture.vue @@ -222,6 +222,7 @@ export default { this.i = 0; this.$message({ + duration: 1500, showClose: true, message: "查询已更新", type: "success", @@ -233,6 +234,7 @@ export default { this.i = 0; this.$message({ + duration: 1500, showClose: true, message: "暂无响应,请稍后再试!", type: "warning", diff --git a/src/views/management/monitoringEquipment/photographicDevice/index.vue b/src/views/management/monitoringEquipment/photographicDevice/index.vue index 3f291bf..8aead54 100644 --- a/src/views/management/monitoringEquipment/photographicDevice/index.vue +++ b/src/views/management/monitoringEquipment/photographicDevice/index.vue @@ -3,7 +3,9 @@