vue2-client 1.7.7 → 1.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { manageApi, post } from '@vue2-client/services/api'
|
|
2
2
|
import { handleTree } from '@vue2-client/utils/util'
|
|
3
|
+
import { indexedDB } from '@vue2-client/utils/indexedDB'
|
|
3
4
|
|
|
4
5
|
const GetAppDataService = {
|
|
5
6
|
install (Vue) {
|
|
@@ -34,20 +35,18 @@ const GetAppDataService = {
|
|
|
34
35
|
},
|
|
35
36
|
// 返回树形省市区
|
|
36
37
|
async getDivisionsOhChinaForTree () {
|
|
37
|
-
let list = this.getDivisionsOhChinaForList()
|
|
38
38
|
// 获取省市区数据
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return JSON.parse(str)
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
try {
|
|
41
|
+
indexedDB.getByWeb('divisionsOhChina', manageApi.getDivisionsOhChina, {}, res => {
|
|
42
|
+
resolve(res)
|
|
43
|
+
}, processRes => {
|
|
44
|
+
return handleTree(processRes, 'code', 'parentcode')
|
|
45
|
+
})
|
|
46
|
+
} catch (e) {
|
|
47
|
+
reject(e)
|
|
48
|
+
}
|
|
49
|
+
})
|
|
51
50
|
},
|
|
52
51
|
getDictionaryList (key) {
|
|
53
52
|
const str = localStorage.getItem(process.env.VUE_APP_DICTIONARY_KEY)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="common-layout">
|
|
3
|
+
<div class="top"><a class="clearCacheBtn" @click="clearCache">清除缓存</a></div>
|
|
3
4
|
<div class="content"><slot></slot></div>
|
|
4
5
|
<page-footer :link-list="footerLinks" :copyright="copyright" :copyrightStyle="copyrightStyle"></page-footer>
|
|
5
6
|
</div>
|
|
@@ -8,12 +9,18 @@
|
|
|
8
9
|
<script>
|
|
9
10
|
import PageFooter from '@vue2-client/layouts/footer/PageFooter'
|
|
10
11
|
import { mapState } from 'vuex'
|
|
12
|
+
import { indexedDB } from '@vue2-client/utils/indexedDB'
|
|
11
13
|
|
|
12
14
|
export default {
|
|
13
15
|
name: 'CommonLayout',
|
|
14
16
|
components: { PageFooter },
|
|
15
17
|
computed: {
|
|
16
18
|
...mapState('setting', ['footerLinks', 'copyright', 'copyrightStyle'])
|
|
19
|
+
},
|
|
20
|
+
methods: {
|
|
21
|
+
clearCache () {
|
|
22
|
+
indexedDB.clearCache()
|
|
23
|
+
}
|
|
17
24
|
}
|
|
18
25
|
}
|
|
19
26
|
</script>
|
|
@@ -30,6 +37,13 @@ export default {
|
|
|
30
37
|
background-position-x: center;
|
|
31
38
|
background-position-y: 110px;
|
|
32
39
|
background-size: 100%;
|
|
40
|
+
.top {
|
|
41
|
+
padding: 5px 10px;
|
|
42
|
+
text-align: right;
|
|
43
|
+
.clearCacheBtn {
|
|
44
|
+
color: #fff !important;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
33
47
|
.content{
|
|
34
48
|
padding: 32px 0;
|
|
35
49
|
flex: 1;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
</div>
|
|
13
13
|
<div :class="['admin-header-right', headerTheme]">
|
|
14
14
|
<component class="header-item" :is="dynamicComponents['HeaderSearch']" @active="val => searchActive = val"/>
|
|
15
|
-
<a-tooltip class="header-item" placement="bottom" title="
|
|
15
|
+
<a-tooltip class="header-item" placement="bottom" title="清理缓存" >
|
|
16
16
|
<a @click="handleToClearCache">
|
|
17
17
|
<a-icon type="reload" />
|
|
18
18
|
</a>
|
|
@@ -115,11 +115,9 @@ export default {
|
|
|
115
115
|
handleToClearCache () {
|
|
116
116
|
Modal.confirm({
|
|
117
117
|
title: '信息',
|
|
118
|
-
content: '
|
|
118
|
+
content: '您确定要清除缓存吗?',
|
|
119
119
|
onOk: () => {
|
|
120
|
-
indexedDB.
|
|
121
|
-
location.reload()
|
|
122
|
-
})
|
|
120
|
+
indexedDB.clearCache()
|
|
123
121
|
},
|
|
124
122
|
onCancel () {}
|
|
125
123
|
})
|
package/src/utils/indexedDB.js
CHANGED
|
@@ -92,7 +92,7 @@ export const indexedDB = {
|
|
|
92
92
|
}
|
|
93
93
|
})
|
|
94
94
|
},
|
|
95
|
-
getByWeb: function (key, url, params, callback) {
|
|
95
|
+
getByWeb: function (key, url, params, callback, process) {
|
|
96
96
|
const self = this
|
|
97
97
|
self.openDB((res) => {
|
|
98
98
|
// 根据存储空间的键找到对应数据
|
|
@@ -105,6 +105,9 @@ export const indexedDB = {
|
|
|
105
105
|
const result = e.target.result
|
|
106
106
|
if (!result && url) {
|
|
107
107
|
post(url, params).then((res) => {
|
|
108
|
+
if (process) {
|
|
109
|
+
res = process(res)
|
|
110
|
+
}
|
|
108
111
|
self.add(key, res)
|
|
109
112
|
callback(res)
|
|
110
113
|
})
|
|
@@ -144,5 +147,10 @@ export const indexedDB = {
|
|
|
144
147
|
}
|
|
145
148
|
}
|
|
146
149
|
})
|
|
150
|
+
},
|
|
151
|
+
clearCache () {
|
|
152
|
+
indexedDB.clear(() => {
|
|
153
|
+
location.reload()
|
|
154
|
+
})
|
|
147
155
|
}
|
|
148
156
|
}
|