From a8ec1d4136507d54580c2599fbfbc70a9a38ee62 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 05 二月 2021 00:35:17 +0800 Subject: [PATCH] 2021-02-05 --- src/api/index.js | 40 ++++++++++++++++++++++++++++++++++++++-- 1 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 587fafd..67a1ccb 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -15,7 +15,7 @@ 1589782279158ngr675kk3oksin35sul,1589788042787ffdt9hle4s45k9r1nvs,15900310928174dro07ihfckghpb5h13,1594095599055qicg2eb642v5qglhnuo,1599613340050c8nu6rbst9d4emnnbsq,1577972969199lei1g0qkvlh4tkc908m, 1578479100252lfbp29v1kafk4s4q4ig,1577971621421tg4v0i1ur8873k7e0ob,1577929944419lgc5h3hepum765e2k7u,1588493493409k9guqp067d31lu7blsv` -if (window.openDatabase) { +if (!window.openDatabase) { CacheUtils.openWebSql() } else if (window.indexedDB) { CacheUtils.openIndexDB() @@ -343,7 +343,17 @@ * @description 鍒犻櫎鏌愪釜鑿滃崟閰嶇疆淇℃伅 */ deleteMenuStorage (menuId) { - return CacheUtils.delMenuWebSqlConfig(menuId) + if (window.GLOB.IndexDB) { + let key = menuId + (sessionStorage.getItem('UserID') || '') + + if (sessionStorage.getItem('isEditState') === 'true' && options.cloudServiceApi) { + key = menuId + (sessionStorage.getItem('CloudUserID') || '') + } + + return CacheUtils.delMenuIndexDBConfig(key) + } else { + return CacheUtils.delMenuWebSqlConfig(menuId) + } } /** @@ -518,6 +528,32 @@ }) }) }) + } else if (window.GLOB.IndexDB) { + return new Promise(resolve => { + CacheUtils.getIndexDBMenuConfig(param.MenuID, param.userid).then(res => { + resolve(res) + }, () => { + param = this.encryptParam(param) + axios({ + url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, + method: 'post', + data: param + }).then(res => { + if (res.status && window.GLOB.IndexDB) { + let msg = { + ...res, + userid: param.userid, + menuid: param.MenuID, + id: param.MenuID + param.userid + } + CacheUtils.writeInIndexDB(msg) + } else if (res.status) { + window.GLOB.CacheMap.set(_param, res) + } + resolve(res) + }) + }) + }) } else if (window.GLOB.CacheMap.has(_param)) { return Promise.resolve(window.GLOB.CacheMap.get(_param)) } else { -- Gitblit v1.8.0