xs-common-plugins 1.1.2 → 1.1.6
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/README.md +37 -0
- package/package.json +1 -1
- package/src/App.vue +11 -11
- package/src/common/common.js +143 -14
- package/src/common/createMenuId.js +7 -7
- package/src/common/uploadImgToBase64.js +12 -12
- package/src/common/utils.js +95 -95
- package/src/components/Breadcrumb/index.vue +81 -81
- package/src/components/Col_TableCell/data.js +4 -4
- package/src/components/Col_TableCell/index.scss +77 -77
- package/src/components/Col_TableCell/index.vue +43 -43
- package/src/components/Col_TableCell/methods.js +19 -19
- package/src/components/Hamburger/index.vue +44 -44
- package/src/components/ReportCmp/data.js +3 -3
- package/src/components/ReportCmp/index.scss +29 -29
- package/src/components/ReportCmp/index.vue +2 -2
- package/src/components/ReportCmp/methods.js +30 -30
- package/src/components/Search/cascader/data.js +3 -3
- package/src/components/Search/cascader/index.scss +17 -17
- package/src/components/Search/cascader/index.vue +96 -96
- package/src/components/Search/cascader/methods.js +41 -41
- package/src/components/Search/data.js +5 -5
- package/src/components/Search/hk_cascader/index.vue +104 -104
- package/src/components/Search/hk_cascader_qudao/index.vue +94 -94
- package/src/components/Search/methods.js +86 -86
- package/src/components/Search/product_option/data.js +3 -3
- package/src/components/Search/product_option/index.scss +68 -68
- package/src/components/Search/product_option/index.vue +419 -419
- package/src/components/Search/product_option/methods.js +46 -46
- package/src/components/Search/select/data.js +3 -3
- package/src/components/Search/select/index.scss +2 -2
- package/src/components/Search/select/index.vue +114 -114
- package/src/components/Search/select/methods.js +51 -51
- package/src/components/Search_filter/data.js +5 -5
- package/src/components/Search_filter/index.vue +88 -88
- package/src/components/Search_filter/methods.js +43 -43
- package/src/components/TableCmp/data.js +3 -3
- package/src/components/TableCmp/index.scss +22 -22
- package/src/components/TableCmp/index.vue +98 -98
- package/src/components/TableCmp/methods.js +35 -35
- package/src/components/home/BarChart.vue +118 -118
- package/src/components/home/LineChart.vue +146 -146
- package/src/components/home/Panel.vue +135 -135
- package/src/components/home/PanelGroup.vue +146 -146
- package/src/components/home/PieChart.vue +81 -81
- package/src/components/home/RaddarChart.vue +119 -119
- package/src/components/home/TabLayout.vue +88 -88
- package/src/components/home/TableList.vue +158 -158
- package/src/components/home/Teng.vue +248 -248
- package/src/components/home/TransactionTable.vue +49 -49
- package/src/components/home/mixins/resize.js +55 -55
- package/src/components/im/methods.js +25 -25
- package/src/components/image-singleUpload/data.js +3 -3
- package/src/components/image-singleUpload/index.scss +26 -26
- package/src/components/image-singleUpload/index.vue +56 -56
- package/src/components/image-singleUpload/methods.js +30 -30
- package/src/components/image-upload/data.js +7 -7
- package/src/components/image-upload/index.vue +41 -41
- package/src/components/image-upload/methods.js +80 -80
- package/src/components/multiple-image-upload/data.js +11 -11
- package/src/components/multiple-image-upload/index.scss +8 -8
- package/src/components/multiple-image-upload/index.vue +63 -63
- package/src/components/multiple-image-upload/methods.js +45 -45
- package/src/components/pro-upload/data.js +3 -3
- package/src/components/pro-upload/index.scss +4 -4
- package/src/components/pro-upload/index.vue +89 -89
- package/src/components/pro-upload/methods.js +86 -86
- package/src/components/report_set/index.scss +44 -44
- package/src/components/report_set/index.vue +153 -153
- package/src/components/search-page/src/index.scss +5 -5
- package/src/components/search-page/src/index.vue +76 -76
- package/src/components/search-page/src/methods.js +36 -36
- package/src/mixin/dialog.js +31 -31
- package/src/mixin/dlg.js +46 -46
- package/src/mixin/newDialog.js +19 -19
- package/src/mixin/report.js +82 -82
- package/src/mixin/table.js +93 -93
- package/src/mixin/tableCell/colTableCell_analysis.js +103 -103
- package/src/mixin/upload.js +22 -22
- package/src/mixin/vmodel.js +26 -26
- package/src/plugins/im/components/conversation-list/index.css +91 -91
- package/src/plugins/im/components/conversation-list/index.json +3 -3
- package/src/plugins/im/components/conversation-list/index.vue +89 -89
- package/src/plugins/im/components/loading/loading.css +69 -69
- package/src/plugins/im/components/loading/loading.json +3 -3
- package/src/plugins/im/components/loading/loading.vue +14 -14
- package/src/plugins/im/components/msg-image/index.json +3 -3
- package/src/plugins/im/components/msg-text/index.json +3 -3
- package/src/plugins/im/components/msg-text/index.vue +24 -24
- package/src/plugins/im/im-plug-in/Protobuf-2.3.7.min.js +1 -1
- package/src/plugins/im/im-plug-in/RongCallLib-3.1.5.min.js +74 -74
- package/src/plugins/im/im-plug-in/RongIMLib-4.1.0.js +17420 -17420
- package/src/plugins/im/im-plug-in/init.js +216 -216
- package/src/plugins/im/im-plug-in/qiniu.js +266 -266
- package/src/plugins/im/im-plug-in/send-data.js +431 -431
- package/src/plugins/im/im-plug-in/upload.js +232 -232
- package/src/plugins/im/lib/RongIMEmoji-2.2.6.js +332 -332
- package/src/plugins/im/lib/RongIMLib-3.0.7.2-dev.js +11635 -11635
- package/src/plugins/im/lib/RongIMLib-3.0.7.2-dev.min.js +6 -6
- package/src/plugins/im/utils/underscore-1.8.3.js +1531 -1531
- package/src/plugins/im/utils/utils.js +149 -149
- package/src/plugins/row-col-cmp/colCmp/data.js +3 -3
- package/src/plugins/row-col-cmp/colCmp/index.scss +50 -50
- package/src/plugins/row-col-cmp/colCmp/index.vue +53 -53
- package/src/plugins/row-col-cmp/colCmp/methods.js +25 -25
- package/src/plugins/row-col-cmp/rowCmp/data.js +3 -3
- package/src/plugins/row-col-cmp/rowCmp/index.scss +3 -3
- package/src/plugins/row-col-cmp/rowCmp/index.vue +43 -43
- package/src/plugins/row-col-cmp/rowCmp/methods.js +29 -29
- package/src/router/index.js +47 -43
- package/src/store/getters.js +13 -13
- package/src/store/index.js +58 -58
- package/src/store/modules/app.js +55 -55
- package/src/store/modules/dic.js +1 -1
- package/src/store/modules/settings.js +28 -28
- package/src/store/modules/user.js +94 -94
- package/src/store/modules/widgetdata.js +42 -42
- package/src/styles/element-ui.scss +49 -49
- package/src/styles/mixin.scss +28 -28
- package/src/styles/sidebar.scss +210 -210
- package/src/styles/transition.scss +48 -48
- package/src/styles/variables.scss +25 -25
- package/src/utils/get-page-title.js +10 -10
- package/src/utils/getMenu.js +2 -1
- package/src/utils/global-config.js +15 -15
- package/src/utils/index.js +332 -332
- package/src/utils/localStorage.js +21 -21
- package/src/utils/validate.js +20 -20
- package/src/views/layout/components/AllSearch/index.vue +44 -44
- package/src/views/layout/components/AppMain.vue +50 -50
- package/src/views/layout/components/Navbar.vue +43 -2
- package/src/views/layout/components/Sidebar/FixiOSBug.js +26 -26
- package/src/views/layout/components/Sidebar/Item.vue +28 -28
- package/src/views/layout/components/Sidebar/Link.vue +34 -34
- package/src/views/layout/components/Sidebar/Logo.vue +79 -79
- package/src/views/layout/components/Sidebar/SidebarItem.vue +67 -67
- package/src/views/layout/components/Sidebar/index.vue +114 -114
- package/src/views/layout/components/index.js +3 -3
- package/src/views/layout/index.vue +105 -105
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
// ------------------------------------------------------------------
|
|
3
|
-
// pragma mark - inti(初始化行为)
|
|
4
|
-
// ------------------------------------------------------------------
|
|
5
|
-
createdInit() {
|
|
6
|
-
|
|
7
|
-
},
|
|
8
|
-
mountedInit() {
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
getdata() {
|
|
12
|
-
return 11
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
// ------------------------------------------------------------------
|
|
16
|
-
// pragma mark - Event Response(响应事件)
|
|
17
|
-
// 命名规范: Name + EventHandler
|
|
18
|
-
// ------------------------------------------------------------------
|
|
19
|
-
Demo_handler() {
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
// ------------------------------------------------------------------
|
|
24
|
-
// pragma mark - Private Methods(私有方法: )
|
|
25
|
-
// 命名规范: 前缀 __ + name
|
|
26
|
-
// ------------------------------------------------------------------
|
|
27
|
-
__demoFunction() {
|
|
28
|
-
|
|
29
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
// ------------------------------------------------------------------
|
|
3
|
+
// pragma mark - inti(初始化行为)
|
|
4
|
+
// ------------------------------------------------------------------
|
|
5
|
+
createdInit() {
|
|
6
|
+
|
|
7
|
+
},
|
|
8
|
+
mountedInit() {
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
getdata() {
|
|
12
|
+
return 11
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
// ------------------------------------------------------------------
|
|
16
|
+
// pragma mark - Event Response(响应事件)
|
|
17
|
+
// 命名规范: Name + EventHandler
|
|
18
|
+
// ------------------------------------------------------------------
|
|
19
|
+
Demo_handler() {
|
|
20
|
+
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
// ------------------------------------------------------------------
|
|
24
|
+
// pragma mark - Private Methods(私有方法: )
|
|
25
|
+
// 命名规范: 前缀 __ + name
|
|
26
|
+
// ------------------------------------------------------------------
|
|
27
|
+
__demoFunction() {
|
|
28
|
+
|
|
29
|
+
}
|
|
30
30
|
}
|
package/src/router/index.js
CHANGED
|
@@ -1,43 +1,47 @@
|
|
|
1
|
-
import Vue from 'vue'
|
|
2
|
-
import VueRouter from 'vue-router'
|
|
3
|
-
import autoRouter from '../automatically/router'
|
|
4
|
-
Vue.use(VueRouter)
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import VueRouter from 'vue-router'
|
|
3
|
+
import autoRouter from '../automatically/router'
|
|
4
|
+
Vue.use(VueRouter)
|
|
5
|
+
|
|
6
|
+
const originalPush = VueRouter.prototype.push;
|
|
7
|
+
VueRouter.prototype.push = function push(location) {
|
|
8
|
+
return originalPush.call(this, location).catch(err => err)
|
|
9
|
+
}
|
|
10
|
+
const routes = [
|
|
11
|
+
{
|
|
12
|
+
path: '/',
|
|
13
|
+
name: 'layout',
|
|
14
|
+
component: () => import('../views/layout/index'),
|
|
15
|
+
redirect: '/home', // 默认展示页面
|
|
16
|
+
meta: { title: '首页', icon: 'example' },
|
|
17
|
+
children: [autoRouter[0]]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
path: '/home',
|
|
21
|
+
name: 'home',
|
|
22
|
+
component: () => import('../views/layout/index'),
|
|
23
|
+
meta: { title: '首页', icon: 'example' },
|
|
24
|
+
children: [{
|
|
25
|
+
path:'/',
|
|
26
|
+
component: () => import('../views/home/index'),
|
|
27
|
+
}],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
path: '/callback',
|
|
31
|
+
name: 'callback',
|
|
32
|
+
meta: { title: '认证' },
|
|
33
|
+
component: ()=> import('../views/callback/index')
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
path: '/slienceAuth',
|
|
37
|
+
name: 'slienceAuth',
|
|
38
|
+
meta: {title: '静默授权'},
|
|
39
|
+
component: () => import("../views/slienceAuth/index")
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
const router = new VueRouter({
|
|
44
|
+
routes
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
export default router
|
package/src/store/getters.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const getters = {
|
|
2
|
-
sidebar: state => state.app.sidebar,
|
|
3
|
-
device: state => state.app.device,
|
|
4
|
-
token: state => state.user.token,
|
|
5
|
-
avatar: state => state.user.avatar,
|
|
6
|
-
name: state => state.user.name,
|
|
7
|
-
widgetObj: state => state.widgetdata.widgetObj,
|
|
8
|
-
widgetMeta: state => state.widgetdata.meta,
|
|
9
|
-
menuList: state => state.app.menuList,
|
|
10
|
-
ossCfg: state => state.oss.ossCfg,
|
|
11
|
-
dic: state => state.dic.ask,
|
|
12
|
-
}
|
|
13
|
-
export default getters
|
|
1
|
+
const getters = {
|
|
2
|
+
sidebar: state => state.app.sidebar,
|
|
3
|
+
device: state => state.app.device,
|
|
4
|
+
token: state => state.user.token,
|
|
5
|
+
avatar: state => state.user.avatar,
|
|
6
|
+
name: state => state.user.name,
|
|
7
|
+
widgetObj: state => state.widgetdata.widgetObj,
|
|
8
|
+
widgetMeta: state => state.widgetdata.meta,
|
|
9
|
+
menuList: state => state.app.menuList,
|
|
10
|
+
ossCfg: state => state.oss.ossCfg,
|
|
11
|
+
dic: state => state.dic.ask,
|
|
12
|
+
}
|
|
13
|
+
export default getters
|
package/src/store/index.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import Vue from 'vue'
|
|
2
|
-
import Vuex from 'vuex'
|
|
3
|
-
import getters from './getters'
|
|
4
|
-
import app from './modules/app'
|
|
5
|
-
import user from './modules/user'
|
|
6
|
-
import widgetdata from './modules/widgetdata'
|
|
7
|
-
import dic from './modules/dic'
|
|
8
|
-
import oss from './modules/oss'
|
|
9
|
-
|
|
10
|
-
const globalCfg = require("../modules/module.config");
|
|
11
|
-
const importModules = globalCfg.IMPORT_MODULES;
|
|
12
|
-
|
|
13
|
-
import storeConfig from '../modules/storeCfg.js'
|
|
14
|
-
|
|
15
|
-
Vue.use(Vuex)
|
|
16
|
-
|
|
17
|
-
const modulesDB = storeConfig;
|
|
18
|
-
|
|
19
|
-
let mod = {};
|
|
20
|
-
if (importModules) {
|
|
21
|
-
importModules.forEach(element => {
|
|
22
|
-
if (modulesDB[`module_${element}`]) {
|
|
23
|
-
mod[`module_${element}`] = Object.assign({}, {
|
|
24
|
-
namespaced: true,
|
|
25
|
-
}, modulesDB[`module_${element}`])
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
let storeCfg = {
|
|
31
|
-
state: {
|
|
32
|
-
search: null, // 全局搜索
|
|
33
|
-
glo_loading: false
|
|
34
|
-
},
|
|
35
|
-
mutations: {
|
|
36
|
-
setSearch(state, val) {
|
|
37
|
-
state.search = val
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
setLoading(state, val) {
|
|
41
|
-
state.glo_loading = val
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
modules: {
|
|
46
|
-
app,
|
|
47
|
-
user,
|
|
48
|
-
widgetdata,
|
|
49
|
-
dic,
|
|
50
|
-
oss,
|
|
51
|
-
...mod
|
|
52
|
-
},
|
|
53
|
-
getters
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const store = new Vuex.Store(storeCfg)
|
|
57
|
-
|
|
58
|
-
export default store
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import Vuex from 'vuex'
|
|
3
|
+
import getters from './getters'
|
|
4
|
+
import app from './modules/app'
|
|
5
|
+
import user from './modules/user'
|
|
6
|
+
import widgetdata from './modules/widgetdata'
|
|
7
|
+
import dic from './modules/dic'
|
|
8
|
+
import oss from './modules/oss'
|
|
9
|
+
|
|
10
|
+
const globalCfg = require("../modules/module.config");
|
|
11
|
+
const importModules = globalCfg.IMPORT_MODULES;
|
|
12
|
+
|
|
13
|
+
import storeConfig from '../modules/storeCfg.js'
|
|
14
|
+
|
|
15
|
+
Vue.use(Vuex)
|
|
16
|
+
|
|
17
|
+
const modulesDB = storeConfig;
|
|
18
|
+
|
|
19
|
+
let mod = {};
|
|
20
|
+
if (importModules) {
|
|
21
|
+
importModules.forEach(element => {
|
|
22
|
+
if (modulesDB[`module_${element}`]) {
|
|
23
|
+
mod[`module_${element}`] = Object.assign({}, {
|
|
24
|
+
namespaced: true,
|
|
25
|
+
}, modulesDB[`module_${element}`])
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let storeCfg = {
|
|
31
|
+
state: {
|
|
32
|
+
search: null, // 全局搜索
|
|
33
|
+
glo_loading: false
|
|
34
|
+
},
|
|
35
|
+
mutations: {
|
|
36
|
+
setSearch(state, val) {
|
|
37
|
+
state.search = val
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
setLoading(state, val) {
|
|
41
|
+
state.glo_loading = val
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
modules: {
|
|
46
|
+
app,
|
|
47
|
+
user,
|
|
48
|
+
widgetdata,
|
|
49
|
+
dic,
|
|
50
|
+
oss,
|
|
51
|
+
...mod
|
|
52
|
+
},
|
|
53
|
+
getters
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const store = new Vuex.Store(storeCfg)
|
|
57
|
+
|
|
58
|
+
export default store
|
package/src/store/modules/app.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import Cookies from 'js-cookie'
|
|
2
|
-
|
|
3
|
-
const state = {
|
|
4
|
-
sidebar: {
|
|
5
|
-
opened: true, //侧边栏默认关闭
|
|
6
|
-
withoutAnimation: false
|
|
7
|
-
},
|
|
8
|
-
menuList: [], // 侧边菜单
|
|
9
|
-
device: 'desktop'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const mutations = {
|
|
13
|
-
TOGGLE_SIDEBAR: state => {
|
|
14
|
-
state.sidebar.opened = !state.sidebar.opened
|
|
15
|
-
state.sidebar.withoutAnimation = false
|
|
16
|
-
if (state.sidebar.opened) {
|
|
17
|
-
Cookies.set('sidebarStatus', 1)
|
|
18
|
-
} else {
|
|
19
|
-
Cookies.set('sidebarStatus', 0)
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
CLOSE_SIDEBAR: (state, withoutAnimation) => {
|
|
23
|
-
Cookies.set('sidebarStatus', 0)
|
|
24
|
-
state.sidebar.opened = false
|
|
25
|
-
state.sidebar.withoutAnimation = withoutAnimation
|
|
26
|
-
},
|
|
27
|
-
TOGGLE_DEVICE: (state, device) => {
|
|
28
|
-
state.device = device
|
|
29
|
-
},
|
|
30
|
-
SET_MENULIST: (state, list) => {
|
|
31
|
-
state.menuList = list
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const actions = {
|
|
36
|
-
toggleSideBar({ commit }) {
|
|
37
|
-
commit('TOGGLE_SIDEBAR')
|
|
38
|
-
},
|
|
39
|
-
closeSideBar({ commit }, { withoutAnimation }) {
|
|
40
|
-
commit('CLOSE_SIDEBAR', withoutAnimation)
|
|
41
|
-
},
|
|
42
|
-
toggleDevice({ commit }, device) {
|
|
43
|
-
commit('TOGGLE_DEVICE', device)
|
|
44
|
-
},
|
|
45
|
-
getMenuList({ commit }, list) {
|
|
46
|
-
commit('SET_MENULIST', list)
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export default {
|
|
51
|
-
namespaced: true,
|
|
52
|
-
state,
|
|
53
|
-
mutations,
|
|
54
|
-
actions
|
|
55
|
-
}
|
|
1
|
+
import Cookies from 'js-cookie'
|
|
2
|
+
|
|
3
|
+
const state = {
|
|
4
|
+
sidebar: {
|
|
5
|
+
opened: true, //侧边栏默认关闭
|
|
6
|
+
withoutAnimation: false
|
|
7
|
+
},
|
|
8
|
+
menuList: [], // 侧边菜单
|
|
9
|
+
device: 'desktop'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const mutations = {
|
|
13
|
+
TOGGLE_SIDEBAR: state => {
|
|
14
|
+
state.sidebar.opened = !state.sidebar.opened
|
|
15
|
+
state.sidebar.withoutAnimation = false
|
|
16
|
+
if (state.sidebar.opened) {
|
|
17
|
+
Cookies.set('sidebarStatus', 1)
|
|
18
|
+
} else {
|
|
19
|
+
Cookies.set('sidebarStatus', 0)
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
CLOSE_SIDEBAR: (state, withoutAnimation) => {
|
|
23
|
+
Cookies.set('sidebarStatus', 0)
|
|
24
|
+
state.sidebar.opened = false
|
|
25
|
+
state.sidebar.withoutAnimation = withoutAnimation
|
|
26
|
+
},
|
|
27
|
+
TOGGLE_DEVICE: (state, device) => {
|
|
28
|
+
state.device = device
|
|
29
|
+
},
|
|
30
|
+
SET_MENULIST: (state, list) => {
|
|
31
|
+
state.menuList = list
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const actions = {
|
|
36
|
+
toggleSideBar({ commit }) {
|
|
37
|
+
commit('TOGGLE_SIDEBAR')
|
|
38
|
+
},
|
|
39
|
+
closeSideBar({ commit }, { withoutAnimation }) {
|
|
40
|
+
commit('CLOSE_SIDEBAR', withoutAnimation)
|
|
41
|
+
},
|
|
42
|
+
toggleDevice({ commit }, device) {
|
|
43
|
+
commit('TOGGLE_DEVICE', device)
|
|
44
|
+
},
|
|
45
|
+
getMenuList({ commit }, list) {
|
|
46
|
+
commit('SET_MENULIST', list)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default {
|
|
51
|
+
namespaced: true,
|
|
52
|
+
state,
|
|
53
|
+
mutations,
|
|
54
|
+
actions
|
|
55
|
+
}
|
package/src/store/modules/dic.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
const state = {
|
|
3
|
-
showSettings: false,
|
|
4
|
-
fixedHeader: true,
|
|
5
|
-
sidebarLogo: true
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const mutations = {
|
|
9
|
-
CHANGE_SETTING: (state, { key, value }) => {
|
|
10
|
-
if (state.hasOwnProperty(key)) {
|
|
11
|
-
state[key] = value
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const actions = {
|
|
17
|
-
changeSetting({ commit }, data) {
|
|
18
|
-
commit('CHANGE_SETTING', data)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export default {
|
|
23
|
-
namespaced: true,
|
|
24
|
-
state,
|
|
25
|
-
mutations,
|
|
26
|
-
actions
|
|
27
|
-
}
|
|
28
|
-
|
|
1
|
+
|
|
2
|
+
const state = {
|
|
3
|
+
showSettings: false,
|
|
4
|
+
fixedHeader: true,
|
|
5
|
+
sidebarLogo: true
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const mutations = {
|
|
9
|
+
CHANGE_SETTING: (state, { key, value }) => {
|
|
10
|
+
if (state.hasOwnProperty(key)) {
|
|
11
|
+
state[key] = value
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const actions = {
|
|
17
|
+
changeSetting({ commit }, data) {
|
|
18
|
+
commit('CHANGE_SETTING', data)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
namespaced: true,
|
|
24
|
+
state,
|
|
25
|
+
mutations,
|
|
26
|
+
actions
|
|
27
|
+
}
|
|
28
|
+
|
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
import { getToken, setToken, removeToken } from '@/utils/auth'
|
|
2
|
-
|
|
3
|
-
const getDefaultState = () => {
|
|
4
|
-
return {
|
|
5
|
-
token: getToken(),
|
|
6
|
-
name: '',
|
|
7
|
-
avatar: ''
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const state = getDefaultState()
|
|
12
|
-
|
|
13
|
-
const mutations = {
|
|
14
|
-
RESET_STATE: (state) => {
|
|
15
|
-
Object.assign(state, getDefaultState())
|
|
16
|
-
},
|
|
17
|
-
SET_TOKEN: (state, token) => {
|
|
18
|
-
state.token = token
|
|
19
|
-
},
|
|
20
|
-
SET_NAME: (state, name) => {
|
|
21
|
-
state.name = name
|
|
22
|
-
},
|
|
23
|
-
SET_AVATAR: (state, avatar) => {
|
|
24
|
-
state.avatar = avatar
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const actions = {
|
|
29
|
-
// user login
|
|
30
|
-
login({ commit }, userInfo) {
|
|
31
|
-
const { username, password } = userInfo
|
|
32
|
-
return new Promise((resolve, reject) => {
|
|
33
|
-
login({ username: username.trim(), password: password }).then(response => {
|
|
34
|
-
const { data } = response
|
|
35
|
-
commit('SET_TOKEN', data.token)
|
|
36
|
-
setToken(data.token)
|
|
37
|
-
resolve()
|
|
38
|
-
}).catch(error => {
|
|
39
|
-
reject(error)
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
// get user info
|
|
45
|
-
getInfo({ commit, state }) {
|
|
46
|
-
return new Promise((resolve, reject) => {
|
|
47
|
-
getInfo(state.token).then(response => {
|
|
48
|
-
const { data } = response
|
|
49
|
-
|
|
50
|
-
if (!data) {
|
|
51
|
-
reject('Verification failed, please Login again.')
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const { name, avatar } = data
|
|
55
|
-
|
|
56
|
-
commit('SET_NAME', name)
|
|
57
|
-
commit('SET_AVATAR', avatar)
|
|
58
|
-
resolve(data)
|
|
59
|
-
}).catch(error => {
|
|
60
|
-
reject(error)
|
|
61
|
-
})
|
|
62
|
-
})
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
// user logout
|
|
66
|
-
logout({ commit, state }) {
|
|
67
|
-
return new Promise((resolve, reject) => {
|
|
68
|
-
logout(state.token).then(() => {
|
|
69
|
-
removeToken() // must remove token first
|
|
70
|
-
commit('RESET_STATE')
|
|
71
|
-
resolve();
|
|
72
|
-
}).catch(error => {
|
|
73
|
-
reject(error)
|
|
74
|
-
})
|
|
75
|
-
})
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
// remove token
|
|
79
|
-
resetToken({ commit }) {
|
|
80
|
-
return new Promise(resolve => {
|
|
81
|
-
removeToken() // must remove token first
|
|
82
|
-
commit('RESET_STATE')
|
|
83
|
-
resolve()
|
|
84
|
-
})
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export default {
|
|
89
|
-
namespaced: true,
|
|
90
|
-
state,
|
|
91
|
-
mutations,
|
|
92
|
-
actions
|
|
93
|
-
}
|
|
94
|
-
|
|
1
|
+
import { getToken, setToken, removeToken } from '@/utils/auth'
|
|
2
|
+
|
|
3
|
+
const getDefaultState = () => {
|
|
4
|
+
return {
|
|
5
|
+
token: getToken(),
|
|
6
|
+
name: '',
|
|
7
|
+
avatar: ''
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const state = getDefaultState()
|
|
12
|
+
|
|
13
|
+
const mutations = {
|
|
14
|
+
RESET_STATE: (state) => {
|
|
15
|
+
Object.assign(state, getDefaultState())
|
|
16
|
+
},
|
|
17
|
+
SET_TOKEN: (state, token) => {
|
|
18
|
+
state.token = token
|
|
19
|
+
},
|
|
20
|
+
SET_NAME: (state, name) => {
|
|
21
|
+
state.name = name
|
|
22
|
+
},
|
|
23
|
+
SET_AVATAR: (state, avatar) => {
|
|
24
|
+
state.avatar = avatar
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const actions = {
|
|
29
|
+
// user login
|
|
30
|
+
login({ commit }, userInfo) {
|
|
31
|
+
const { username, password } = userInfo
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
login({ username: username.trim(), password: password }).then(response => {
|
|
34
|
+
const { data } = response
|
|
35
|
+
commit('SET_TOKEN', data.token)
|
|
36
|
+
setToken(data.token)
|
|
37
|
+
resolve()
|
|
38
|
+
}).catch(error => {
|
|
39
|
+
reject(error)
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
// get user info
|
|
45
|
+
getInfo({ commit, state }) {
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
getInfo(state.token).then(response => {
|
|
48
|
+
const { data } = response
|
|
49
|
+
|
|
50
|
+
if (!data) {
|
|
51
|
+
reject('Verification failed, please Login again.')
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { name, avatar } = data
|
|
55
|
+
|
|
56
|
+
commit('SET_NAME', name)
|
|
57
|
+
commit('SET_AVATAR', avatar)
|
|
58
|
+
resolve(data)
|
|
59
|
+
}).catch(error => {
|
|
60
|
+
reject(error)
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
// user logout
|
|
66
|
+
logout({ commit, state }) {
|
|
67
|
+
return new Promise((resolve, reject) => {
|
|
68
|
+
logout(state.token).then(() => {
|
|
69
|
+
removeToken() // must remove token first
|
|
70
|
+
commit('RESET_STATE')
|
|
71
|
+
resolve();
|
|
72
|
+
}).catch(error => {
|
|
73
|
+
reject(error)
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
// remove token
|
|
79
|
+
resetToken({ commit }) {
|
|
80
|
+
return new Promise(resolve => {
|
|
81
|
+
removeToken() // must remove token first
|
|
82
|
+
commit('RESET_STATE')
|
|
83
|
+
resolve()
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export default {
|
|
89
|
+
namespaced: true,
|
|
90
|
+
state,
|
|
91
|
+
mutations,
|
|
92
|
+
actions
|
|
93
|
+
}
|
|
94
|
+
|