jhbigscreen/src/api/gzaiBox/dict.js

25 lines
658 B
JavaScript

import request from '@/utils/requestOthers'
const getDict = (dictName) => {
let key = 'dict_' + dictName;
let obj = window.jhcaches[key];
if (obj && obj.length > 0) {
return new Promise((resolve) => {
resolve(obj);
})
} else {
return new Promise(async (resolve) => {
let data = await request({
url: `/publics/aiBox/dicts`,
method: 'get'
});
let obj = data.data || [];
if (obj && obj.length > 0) {
window.jhcaches[key] = obj;
}
resolve(obj);
});
}
}
export default getDict;