From 612dcb4fd8806b0153560ff67124c37a082a7bf5 Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期四, 13 十月 2022 17:43:35 +0800 Subject: [PATCH] 系统配置,环境资源监控接口对接 --- src/store/index.js | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 83c210d..047c4f4 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,8 +1,8 @@ import Vue from 'vue'; import Vuex from 'vuex'; -import { getToken, setToken, removeToken } from "@/utils/auth"; -import { Loading, Message } from "element-ui"; -import { login, getPublicKey } from "@/api/api"; +import { getToken, setToken, removeToken } from '@/utils/auth'; +import { Loading, Message } from 'element-ui'; +import { login, getPublicKey } from '@/api/api'; var encrypt = new JSEncrypt(); Vue.use(Vuex); @@ -23,7 +23,9 @@ apiCount: 0, //loading瀹炰緥 loadingInstance: null, - key: null + key: null, + //绯荤粺鐩戞帶WebSocket + ws: null, }, mutations: { // 鑾峰彇瀹屾暣闈㈠寘灞戣矾寰� @@ -43,7 +45,6 @@ changeName(state, msg) { state.menuNode = msg; // console.log(msg); - }, verChangeNode(state, msg) { state.verCateNode = msg; @@ -62,8 +63,8 @@ START_LOADING(state, msg) { state.loadingInstance = Loading.service({ lock: true, - text: msg ? msg : "鍔犺浇涓�...", - background: "rgba(0, 0, 0, 0.7)", + text: msg ? msg : '鍔犺浇涓�...', + background: 'rgba(0, 0, 0, 0.7)', }); }, /* 鍏抽棴loading */ @@ -73,13 +74,13 @@ }, /* 鏇存柊璇锋眰绾跨▼姹� */ UPDATE_API_COUNT(state, handle) { - if (handle == "add") { + if (handle == 'add') { state.apiCount++; - this.commit("START_LOADING"); + this.commit('START_LOADING'); } else { state.apiCount--; if (state.apiCount <= 0) { - this.commit("CLOSE_LOADING"); + this.commit('CLOSE_LOADING'); } } }, @@ -97,7 +98,7 @@ return new Promise((resolve, reject) => { var data = { uid: encrypt.encrypt(userInfo.uid), - pwd: encrypt.encrypt(userInfo.pwd) + pwd: encrypt.encrypt(userInfo.pwd), }; login(data) .then((response) => { @@ -105,11 +106,11 @@ if (data.code !== 200) { return Message({ message: data.msg, - type: "error", + type: 'error', duration: 5 * 1000, }); } - commit("SET_TOKEN", data.result.token); + commit('SET_TOKEN', data.result.token); setToken(data.result.token); resolve(data); }) @@ -119,12 +120,11 @@ }); }, getpublickey({ commit, state }, userInfo) { - return new Promise((resolve, reject) => { getPublicKey(userInfo) .then((response) => { const data = response; - commit("SET_KEY", data.result); + commit('SET_KEY', data.result); encrypt.setPublicKey(data.result); // 璁剧疆鍏挜 resolve(); @@ -133,7 +133,7 @@ reject(error); }); }); - } + }, }, modules: {}, }); -- Gitblit v1.9.3