no message

This commit is contained in:
小陌 2023-07-07 12:35:25 +08:00
parent 7db9708231
commit 8ae965de48
7 changed files with 32 additions and 51 deletions

View File

@ -1,8 +1,9 @@
import http from "@/utils/request"
export default {
upload: {
url: '/app/upload',
post: async function(data, config = {}) {
return await http.post('/app/upload', data, config);
return await http.post(this.url, data, config);
}
},
uploadFile: {

View File

@ -6,10 +6,10 @@ export default {
}
},
table: {
get: async function(name = '', config = {}) {
get: async function(name = '') {
return await http.get('/system/table/get', {
name
}, config);
}, {cache:true});
}
},
}

View File

@ -3,17 +3,15 @@ export default {
cacheList: {}
},
mutations: {
setCache(state, { name, value }) {
state.cacheList[name] = value;
setCache(state, payload) {
const {
key,
value
} = payload;
state.cacheList[key] = value;
},
getCache(state, name) {
if (!Object.prototype.hasOwnProperty.call(state.cacheList, name)) {
state.cacheList[name] = null;
}
return state.cacheList[name];
},
removeCache(state, name) {
delete state.cacheList[name];
removeCache(state, key) {
delete state.cacheList[key];
},
clearCache(state) {
state.cacheList = {};

View File

@ -1,17 +1,16 @@
import config from "@/config";
import tool from "@/utils/tool";
export default {
state: {
//移动端布局
ismobile: false,
//布局
layout: tool.data.get('layout') || config.LAYOUT,
layout: config.LAYOUT,
//菜单是否折叠 toggle
menuIsCollapse: tool.data.get('layoutmenuiscollapse') || config.MENU_IS_COLLAPSE || false,
menuIsCollapse: config.MENU_IS_COLLAPSE || false,
//多标签栏
layoutTags: tool.data.get('layouttags') || config.LAYOUT_TAGS,
layoutTags: config.LAYOUT_TAGS,
//显示页头
layoutHeader: tool.data.get('layoutheader') || true,
layoutHeader: true,
},
mutations: {
SET_ismobile(state, key) {

View File

@ -91,13 +91,9 @@ var http = {
return new Promise((resolve, reject) => {
// 缓存存在, 优先使用缓存
var cacheKey = '';
if (typeof config.cache !== 'undefined' && !isNaN(config.cache) && config.cache > 0) {
if (typeof config.cache !== 'undefined' && config.cache) {
cacheKey = tool.crypto.MD5(url + (new URLSearchParams(params)).toString());
const cachedData = tool.data.get(cacheKey);
const cachedData = tool.store.get(cacheKey);
if (cachedData) {
return resolve(cachedData);
}
@ -108,8 +104,8 @@ var http = {
params: params,
...config
}).then((response) => {
if (cacheKey && typeof config.cache !== 'undefined' && !isNaN(config.cache) && config.cache > 0) {
tool.data.set(cacheKey, response.data, config.cache);
if (cacheKey && typeof config.cache !== 'undefined' && config.cache) {
tool.store.set(cacheKey, response.data);
}
resolve(response.data);
}).catch((error) => {

View File

@ -1,8 +1,5 @@
/*
* @Descripttion: 工具集
* @version: 1.2
* @LastEditors: sakuya
* @LastEditTime: 2022年5月24日00:28:56
*/
import CryptoJS from 'crypto-js';
import sysConfig from "@/config";
@ -13,14 +10,13 @@ const tool = {}
/* store */
tool.store = {
set(key, data) {
return store.commit('setCache', key, data);
return store.commit('setCache', {key:key, value:data});
},
get(key) {
try {
return store.commit('getCache', key);
} catch (err) {
return null
if (!Object.prototype.hasOwnProperty.call(store.state.cache.cacheList, key)) {
store.state.cache.cacheList[key] = null;
}
return store.state.cache.cacheList[key];
},
remove(key) {
return store.commit('removeCache', key);

View File

@ -106,15 +106,6 @@
}
});
}
this.$tool.store.set('cacheKey', {uid:1});
console.log(this.$tool.store.get('cacheKey'))
},
computed: {
filterObj(){