From e3196bc81327e82748c7683c5cad9849b4b228b6 Mon Sep 17 00:00:00 2001 From: lxl <lixuliang_hd@126.com> Date: 星期三, 26 十月 2022 14:36:58 +0800 Subject: [PATCH] 菜单 --- src/store/index.js | 54 +++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 39 insertions(+), 15 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 088eb10..c12a22d 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); @@ -11,18 +11,33 @@ state: { catalogueName: '', cataNode: {}, + lang: 'zh', + menuNode: {}, verCateNode: {}, verCateNodes: {}, styleDirCateNodes: {}, styleDepCateNodes: {}, + iframeMsg: '', token: getToken(), //璇锋眰璁℃暟 apiCount: 0, //loading瀹炰緥 loadingInstance: null, - key: null + key: null, + //绯荤粺鐩戞帶WebSocket + ws: null, + //鏉冮檺鍚堥泦 + permsEntity: [], + currentPerms: "", }, mutations: { + //鑾峰彇鏉冮檺鍚堥泦 + getPermsEntity(state, msg) { + state.permsEntity = msg + }, + currentPerms(state, msg) { + state.currentPerms = msg + }, // 鑾峰彇瀹屾暣闈㈠寘灞戣矾寰� changeCata(state, msg) { state.catalogueName = msg; @@ -30,6 +45,16 @@ // 鑾峰彇鐐瑰嚮鐨勭洰褰曠偣瀵硅薄 changeNode(state, msg) { state.cataNode = msg; + }, + changeLang(state, msg) { + state.lang = msg; + }, + getIframe(state, msg) { + state.iframeMsg = msg; + }, + changeName(state, msg) { + state.menuNode = msg; + // console.log(msg); }, verChangeNode(state, msg) { state.verCateNode = msg; @@ -48,8 +73,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 */ @@ -59,13 +84,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'); } } }, @@ -83,7 +108,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) => { @@ -91,11 +116,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); }) @@ -105,12 +130,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(); @@ -119,7 +143,7 @@ reject(error); }); }); - } + }, }, modules: {}, }); -- Gitblit v1.9.3