vue2-client 1.6.49 → 1.7.0
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/.env +15 -15
- package/CHANGELOG.md +628 -625
- package/index.js +30 -30
- package/package.json +81 -81
- package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
- package/src/base-client/components/common/CitySelect/CitySelect.vue +247 -247
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +667 -667
- package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +733 -733
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +468 -462
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +508 -508
- package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +146 -140
- package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
- package/src/base-client/components/common/Upload/Upload.vue +168 -168
- package/src/base-client/components/common/XAddForm/XAddForm.vue +325 -325
- package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +279 -279
- package/src/base-client/components/common/XCard/XCard.vue +64 -64
- package/src/base-client/components/common/XForm/XForm.vue +180 -180
- package/src/base-client/components/common/XForm/XFormItem.vue +513 -513
- package/src/base-client/components/common/XForm/XTreeSelect.vue +184 -184
- package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
- package/src/base-client/components/common/XFormTable/XFormTable.vue +344 -336
- package/src/base-client/components/common/XFormTable/index.md +97 -97
- package/src/base-client/components/common/XImportExcel/XImportExcel.vue +132 -132
- package/src/base-client/components/common/XTable/XTable.vue +506 -506
- package/src/base-client/components/common/XTreeOne/XTreeOne.vue +111 -111
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +231 -231
- package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
- package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
- package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
- package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
- package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
- package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
- package/src/base-client/plugins/AppData.js +76 -76
- package/src/base-client/plugins/GetLoginInfoService.js +179 -179
- package/src/base-client/plugins/PagedList.js +177 -177
- package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
- package/src/base-client/plugins/i18n-extend.js +32 -32
- package/src/components/Ellipsis/Ellipsis.vue +65 -65
- package/src/components/Ellipsis/index.md +38 -38
- package/src/components/NumberInfo/index.md +43 -43
- package/src/components/STable/README.md +341 -341
- package/src/components/STable/index.js +318 -318
- package/src/components/Trend/index.md +45 -45
- package/src/components/checkbox/ColorCheckbox.vue +157 -157
- package/src/components/checkbox/ImgCheckbox.vue +163 -163
- package/src/components/exception/ExceptionPage.vue +70 -70
- package/src/components/form/FormRow.vue +52 -52
- package/src/components/index.js +36 -36
- package/src/components/menu/SideMenu.vue +62 -62
- package/src/components/menu/menu.js +273 -273
- package/src/components/page/header/index.less +40 -40
- package/src/components/setting/Setting.vue +235 -235
- package/src/components/table/StandardTable.vue +141 -141
- package/src/components/table/advance/ActionColumns.vue +158 -158
- package/src/components/table/advance/SearchArea.vue +355 -355
- package/src/components/tool/AStepItem.vue +60 -60
- package/src/components/tool/AvatarList.vue +68 -68
- package/src/components/tool/Drawer.vue +142 -142
- package/src/components/tool/TagSelect.vue +83 -83
- package/src/components/transition/PageToggleTransition.vue +97 -97
- package/src/config/CreateQueryConfig.js +307 -307
- package/src/config/default/admin.config.js +18 -18
- package/src/config/replacer/resolve.config.js +67 -67
- package/src/layouts/CommonLayout.vue +42 -42
- package/src/layouts/ComponentLayoutOne.vue +47 -47
- package/src/layouts/PageLayout.vue +151 -151
- package/src/layouts/SinglePageView.vue +116 -116
- package/src/layouts/footer/PageFooter.vue +49 -49
- package/src/layouts/header/AdminHeader.vue +134 -134
- package/src/layouts/header/HeaderAvatar.vue +64 -64
- package/src/layouts/header/HeaderNotice.vue +176 -176
- package/src/layouts/header/HeaderSearch.vue +67 -67
- package/src/layouts/header/InstitutionDetail.vue +181 -181
- package/src/layouts/header/index.less +92 -92
- package/src/layouts/tabs/TabsHead.vue +190 -190
- package/src/layouts/tabs/TabsView.vue +379 -379
- package/src/mock/goods/index.js +108 -108
- package/src/pages/CreateQueryPage.vue +84 -84
- package/src/pages/login/Login.vue +369 -369
- package/src/pages/report/ReportTable.js +124 -124
- package/src/pages/report/ReportTableHome.vue +28 -28
- package/src/pages/resourceManage/orgListManage.vue +98 -98
- package/src/pages/system/dictionary/index.vue +43 -43
- package/src/pages/system/file/index.vue +317 -317
- package/src/pages/system/monitor/loginInfor/index.vue +36 -36
- package/src/pages/system/monitor/operLog/index.vue +36 -36
- package/src/pages/system/settings/index.vue +126 -126
- package/src/pages/system/settings/modifyPassword.vue +109 -109
- package/src/router/async/config.async.js +28 -28
- package/src/router/async/router.map.js +66 -68
- package/src/router/index.js +27 -27
- package/src/services/api/DictionaryDetailsViewApi.js +6 -6
- package/src/services/api/LogDetailsViewApi.js +10 -10
- package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
- package/src/services/api/TicketDetailsViewApi.js +34 -34
- package/src/services/api/cas.js +79 -79
- package/src/services/api/common.js +137 -132
- package/src/services/api/commonTempTable.js +10 -10
- package/src/services/api/index.js +17 -17
- package/src/services/api/logininfor/index.js +6 -6
- package/src/services/api/manage.js +8 -8
- package/src/services/apiService.js +14 -14
- package/src/services/user.js +67 -67
- package/src/store/modules/index.js +4 -4
- package/src/theme/default/nprogress.less +76 -76
- package/src/theme/default/style.less +58 -58
- package/src/utils/EncryptUtil.js +53 -53
- package/src/utils/colors.js +107 -107
- package/src/utils/excel/Blob.js +180 -180
- package/src/utils/excel/Export2Excel.js +141 -141
- package/src/utils/formatter.js +68 -68
- package/src/utils/i18n.js +80 -80
- package/src/utils/map-utils.js +37 -37
- package/src/utils/theme-color-replacer-extend.js +91 -91
- package/src/utils/themeUtil.js +100 -100
- package/src/utils/util.js +230 -230
- package/vue.config.js +106 -106
- package/src/pages/system/queryParams/index.vue +0 -43
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
.page-header{
|
|
2
|
-
background: @base-bg-color;
|
|
3
|
-
padding: 16px 24px;
|
|
4
|
-
&.head.fixed{
|
|
5
|
-
margin: auto;
|
|
6
|
-
max-width: 100%;
|
|
7
|
-
}
|
|
8
|
-
.page-header-wide{
|
|
9
|
-
.breadcrumb{
|
|
10
|
-
margin-bottom: 20px;
|
|
11
|
-
}
|
|
12
|
-
.detail{
|
|
13
|
-
display: flex;
|
|
14
|
-
.row {
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-wrap: wrap;
|
|
17
|
-
justify-content: space-between;
|
|
18
|
-
}
|
|
19
|
-
.avatar {
|
|
20
|
-
margin:0 24px 0 0;
|
|
21
|
-
}
|
|
22
|
-
.main{
|
|
23
|
-
width: 100%;
|
|
24
|
-
.title{
|
|
25
|
-
font-size: 20px;
|
|
26
|
-
color: @title-color;
|
|
27
|
-
margin-bottom: 16px;
|
|
28
|
-
}
|
|
29
|
-
.content{
|
|
30
|
-
display: flex;
|
|
31
|
-
flex-wrap: wrap;
|
|
32
|
-
color: @text-color-second;
|
|
33
|
-
}
|
|
34
|
-
.extra{
|
|
35
|
-
display: flex;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
.page-header{
|
|
2
|
+
background: @base-bg-color;
|
|
3
|
+
padding: 16px 24px;
|
|
4
|
+
&.head.fixed{
|
|
5
|
+
margin: auto;
|
|
6
|
+
max-width: 100%;
|
|
7
|
+
}
|
|
8
|
+
.page-header-wide{
|
|
9
|
+
.breadcrumb{
|
|
10
|
+
margin-bottom: 20px;
|
|
11
|
+
}
|
|
12
|
+
.detail{
|
|
13
|
+
display: flex;
|
|
14
|
+
.row {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-wrap: wrap;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
}
|
|
19
|
+
.avatar {
|
|
20
|
+
margin:0 24px 0 0;
|
|
21
|
+
}
|
|
22
|
+
.main{
|
|
23
|
+
width: 100%;
|
|
24
|
+
.title{
|
|
25
|
+
font-size: 20px;
|
|
26
|
+
color: @title-color;
|
|
27
|
+
margin-bottom: 16px;
|
|
28
|
+
}
|
|
29
|
+
.content{
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-wrap: wrap;
|
|
32
|
+
color: @text-color-second;
|
|
33
|
+
}
|
|
34
|
+
.extra{
|
|
35
|
+
display: flex;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,235 +1,235 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="side-setting">
|
|
3
|
-
<setting-item>
|
|
4
|
-
<a-button @click="saveSetting" type="primary" icon="save">{{ $t('save') }}</a-button>
|
|
5
|
-
<a-button @click="resetSetting" type="dashed" icon="redo" style="float: right">{{ $t('reset') }}</a-button>
|
|
6
|
-
</setting-item>
|
|
7
|
-
<setting-item :title="$t('theme.title')">
|
|
8
|
-
<img-checkbox-group
|
|
9
|
-
@change="values => setTheme({...theme, mode: values[0]})"
|
|
10
|
-
:default-values="[theme.mode]"
|
|
11
|
-
>
|
|
12
|
-
<img-checkbox :title="$t('theme.dark')" img="https://gw.alipayobjects.com/zos/rmsportal/LCkqqYNmvBEbokSDscrm.svg" value="dark"/>
|
|
13
|
-
<img-checkbox :title="$t('theme.light')" img="https://gw.alipayobjects.com/zos/rmsportal/jpRkZQMyYRryryPNtyIC.svg" value="light"/>
|
|
14
|
-
<img-checkbox :title="$t('theme.night')" img="https://gw.alipayobjects.com/zos/antfincdn/hmKaLQvmY2/LCkqqYNmvBEbokSDscrm.svg" value="night"/>
|
|
15
|
-
</img-checkbox-group>
|
|
16
|
-
</setting-item>
|
|
17
|
-
<setting-item :title="$t('theme.color')">
|
|
18
|
-
<color-checkbox-group
|
|
19
|
-
@change="(values, colors) => setTheme({...theme, color: colors[0]})"
|
|
20
|
-
:defaultValues="[palettes.indexOf(theme.color)]"
|
|
21
|
-
:multiple="false"
|
|
22
|
-
>
|
|
23
|
-
<color-checkbox v-for="(color, index) in palettes" :key="index" :color="color" :value="index" />
|
|
24
|
-
</color-checkbox-group>
|
|
25
|
-
</setting-item>
|
|
26
|
-
<a-divider/>
|
|
27
|
-
<setting-item :title="$t('navigate.title')">
|
|
28
|
-
<img-checkbox-group
|
|
29
|
-
@change="values => setLayout(values[0])"
|
|
30
|
-
:default-values="[layout]"
|
|
31
|
-
>
|
|
32
|
-
<img-checkbox :title="$t('navigate.side')" img="https://gw.alipayobjects.com/zos/rmsportal/JopDzEhOqwOjeNTXkoje.svg" value="side"/>
|
|
33
|
-
<img-checkbox :title="$t('navigate.head')" img="https://gw.alipayobjects.com/zos/rmsportal/KDNDBbriJhLwuqMoxcAr.svg" value="head"/>
|
|
34
|
-
<img-checkbox :title="$t('navigate.mix')" img="https://gw.alipayobjects.com/zos/antfincdn/x8Ob%26B8cy8/LCkqqYNmvBEbokSDscrm.svg" value="mix"/>
|
|
35
|
-
</img-checkbox-group>
|
|
36
|
-
</setting-item>
|
|
37
|
-
<setting-item>
|
|
38
|
-
<a-list :split="false">
|
|
39
|
-
<a-list-item>
|
|
40
|
-
{{ $t('navigate.content.title') }}
|
|
41
|
-
<a-select
|
|
42
|
-
:getPopupContainer="getPopupContainer"
|
|
43
|
-
:value="pageWidth"
|
|
44
|
-
@change="setPageWidth"
|
|
45
|
-
class="select-item"
|
|
46
|
-
size="small"
|
|
47
|
-
slot="actions"
|
|
48
|
-
>
|
|
49
|
-
<a-select-option value="fluid">{{ $t('navigate.content.fluid') }}</a-select-option>
|
|
50
|
-
<a-select-option value="fixed">{{ $t('navigate.content.fixed') }}</a-select-option>
|
|
51
|
-
</a-select>
|
|
52
|
-
</a-list-item>
|
|
53
|
-
<a-list-item>
|
|
54
|
-
{{ $t('navigate.fixedHeader') }}
|
|
55
|
-
<a-switch :checked="fixedHeader" slot="actions" size="small" @change="setFixedHeader" />
|
|
56
|
-
</a-list-item>
|
|
57
|
-
<a-list-item>
|
|
58
|
-
{{ $t('navigate.fixedSideBar') }}
|
|
59
|
-
<a-switch :checked="fixedSideBar" slot="actions" size="small" @change="setFixedSideBar" />
|
|
60
|
-
</a-list-item>
|
|
61
|
-
</a-list>
|
|
62
|
-
</setting-item>
|
|
63
|
-
<a-divider />
|
|
64
|
-
<setting-item :title="$t('other.title')">
|
|
65
|
-
<a-list :split="false">
|
|
66
|
-
<a-list-item>
|
|
67
|
-
{{ $t('other.weekMode') }}
|
|
68
|
-
<a-switch :checked="weekMode" slot="actions" size="small" @change="setWeekMode" />
|
|
69
|
-
</a-list-item>
|
|
70
|
-
<a-list-item>
|
|
71
|
-
{{ $t('other.multiPages') }}
|
|
72
|
-
<a-switch :checked="multiPage" slot="actions" size="small" @change="setMultiPage" />
|
|
73
|
-
</a-list-item>
|
|
74
|
-
<a-list-item>
|
|
75
|
-
{{ $t('other.hideSetting') }}
|
|
76
|
-
<a-switch :checked="hideSetting" slot="actions" size="small" @change="setHideSetting" />
|
|
77
|
-
</a-list-item>
|
|
78
|
-
</a-list>
|
|
79
|
-
</setting-item>
|
|
80
|
-
<a-divider />
|
|
81
|
-
<setting-item :title="$t('animate.title')">
|
|
82
|
-
<a-list :split="false">
|
|
83
|
-
<a-list-item>
|
|
84
|
-
{{ $t('animate.disable') }}
|
|
85
|
-
<a-switch :checked="animate.disabled" slot="actions" size="small" @change="val => setAnimate({...animate, disabled: val})" />
|
|
86
|
-
</a-list-item>
|
|
87
|
-
<a-list-item>
|
|
88
|
-
{{ $t('animate.effect') }}
|
|
89
|
-
<a-select
|
|
90
|
-
:value="animate.name"
|
|
91
|
-
:getPopupContainer="getPopupContainer"
|
|
92
|
-
@change="val => setAnimate({...animate, name: val})"
|
|
93
|
-
class="select-item"
|
|
94
|
-
size="small"
|
|
95
|
-
slot="actions"
|
|
96
|
-
>
|
|
97
|
-
<a-select-option :key="index" :value="item.name" v-for="(item, index) in animates">{{ item.alias }}</a-select-option>
|
|
98
|
-
</a-select>
|
|
99
|
-
</a-list-item>
|
|
100
|
-
<a-list-item>
|
|
101
|
-
{{ $t('animate.direction') }}
|
|
102
|
-
<a-select
|
|
103
|
-
:value="animate.direction"
|
|
104
|
-
:getPopupContainer="getPopupContainer"
|
|
105
|
-
@change="val => setAnimate({...animate, direction: val})"
|
|
106
|
-
class="select-item"
|
|
107
|
-
size="small"
|
|
108
|
-
slot="actions"
|
|
109
|
-
>
|
|
110
|
-
<a-select-option :key="index" :value="item" v-for="(item, index) in directions">{{ item }}</a-select-option>
|
|
111
|
-
</a-select>
|
|
112
|
-
</a-list-item>
|
|
113
|
-
</a-list>
|
|
114
|
-
</setting-item>
|
|
115
|
-
<a-alert
|
|
116
|
-
v-if="isDev"
|
|
117
|
-
style="max-width: 240px; margin: -16px 0 8px; word-break: break-all"
|
|
118
|
-
type="warning"
|
|
119
|
-
:message="$t('alert')"
|
|
120
|
-
>
|
|
121
|
-
</a-alert>
|
|
122
|
-
<a-button
|
|
123
|
-
v-if="isDev"
|
|
124
|
-
id="copyBtn"
|
|
125
|
-
:data-clipboard-text="copyConfig"
|
|
126
|
-
@click="copyCode"
|
|
127
|
-
style="width: 100%"
|
|
128
|
-
icon="copy" >{{ $t('copy') }}</a-button>
|
|
129
|
-
</div>
|
|
130
|
-
</template>
|
|
131
|
-
|
|
132
|
-
<script>
|
|
133
|
-
import SettingItem from './SettingItem'
|
|
134
|
-
import { ColorCheckbox, ImgCheckbox } from '@vue2-client/components/checkbox'
|
|
135
|
-
import Clipboard from 'clipboard'
|
|
136
|
-
import { mapState, mapMutations } from 'vuex'
|
|
137
|
-
import { formatConfig } from '@vue2-client/utils/formatter'
|
|
138
|
-
import { setting } from '@vue2-client/config/default'
|
|
139
|
-
import fastEqual from 'fast-deep-equal'
|
|
140
|
-
|
|
141
|
-
const ColorCheckboxGroup = ColorCheckbox.Group
|
|
142
|
-
const ImgCheckboxGroup = ImgCheckbox.Group
|
|
143
|
-
export default {
|
|
144
|
-
name: 'Setting',
|
|
145
|
-
i18n: require('./i18n'),
|
|
146
|
-
components: { ImgCheckboxGroup, ImgCheckbox, ColorCheckboxGroup, ColorCheckbox, SettingItem },
|
|
147
|
-
data () {
|
|
148
|
-
return {
|
|
149
|
-
copyConfig: 'Sorry, you have copied nothing O(∩_∩)O~',
|
|
150
|
-
isDev: process.env.NODE_ENV === 'development'
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
computed: {
|
|
154
|
-
directions () {
|
|
155
|
-
return this.animates.find(item => item.name === this.animate.name).directions
|
|
156
|
-
},
|
|
157
|
-
...mapState('setting', ['theme', 'layout', 'animate', 'animates', 'palettes', 'multiPage', 'weekMode', 'fixedHeader', 'fixedSideBar', 'hideSetting', 'pageWidth'])
|
|
158
|
-
},
|
|
159
|
-
watch: {
|
|
160
|
-
'animate.name': function (val) {
|
|
161
|
-
this.setAnimate({ name: val, direction: this.directions[0] })
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
methods: {
|
|
165
|
-
getPopupContainer () {
|
|
166
|
-
return this.$el.parentNode
|
|
167
|
-
},
|
|
168
|
-
copyCode () {
|
|
169
|
-
const config = this.extractConfig()
|
|
170
|
-
this.copyConfig = `// 自定义配置,参考 ./default/setting.config.js,需要自定义的属性在这里配置即可
|
|
171
|
-
module.exports = ${formatConfig(config)}
|
|
172
|
-
`
|
|
173
|
-
const clipboard = new Clipboard('#copyBtn')
|
|
174
|
-
clipboard.on('success', () => {
|
|
175
|
-
this.$message.success(`复制成功,覆盖文件 src/config/config.js 然后重启项目即可生效`).then(() => {
|
|
176
|
-
const localConfig = localStorage.getItem(process.env.VUE_APP_SETTING_KEY)
|
|
177
|
-
if (localConfig) {
|
|
178
|
-
console.warn('检测到本地有历史保存的主题配置,想要要拷贝的配置代码生效,您可能需要先重置配置')
|
|
179
|
-
this.$message.warn('检测到本地有历史保存的主题配置,想要要拷贝的配置代码生效,您可能需要先重置配置', 5)
|
|
180
|
-
}
|
|
181
|
-
})
|
|
182
|
-
clipboard.destroy()
|
|
183
|
-
})
|
|
184
|
-
},
|
|
185
|
-
saveSetting () {
|
|
186
|
-
const closeMessage = this.$message.loading('正在保存到本地,请稍后...', 0)
|
|
187
|
-
const config = this.extractConfig()
|
|
188
|
-
localStorage.setItem(process.env.VUE_APP_SETTING_KEY, JSON.stringify(config))
|
|
189
|
-
setTimeout(closeMessage, 800)
|
|
190
|
-
},
|
|
191
|
-
resetSetting () {
|
|
192
|
-
this.$confirm({
|
|
193
|
-
title: '重置主题会刷新页面,当前页面内容不会保留,确认重置?',
|
|
194
|
-
onOk () {
|
|
195
|
-
localStorage.removeItem(process.env.VUE_APP_SETTING_KEY)
|
|
196
|
-
window.location.reload()
|
|
197
|
-
}
|
|
198
|
-
})
|
|
199
|
-
},
|
|
200
|
-
// 提取配置
|
|
201
|
-
extractConfig () {
|
|
202
|
-
const config = {}
|
|
203
|
-
const mySetting = this.$store.state.setting
|
|
204
|
-
const dftSetting = setting
|
|
205
|
-
Object.keys(mySetting).forEach(key => {
|
|
206
|
-
const dftValue = dftSetting[key]; const myValue = mySetting[key]
|
|
207
|
-
if (dftValue !== undefined && !fastEqual(dftValue, myValue)) {
|
|
208
|
-
config[key] = myValue
|
|
209
|
-
}
|
|
210
|
-
})
|
|
211
|
-
return config
|
|
212
|
-
},
|
|
213
|
-
...mapMutations('setting', ['setTheme', 'setLayout', 'setMultiPage', 'setWeekMode',
|
|
214
|
-
'setFixedSideBar', 'setFixedHeader', 'setAnimate', 'setHideSetting', 'setPageWidth'])
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
</script>
|
|
218
|
-
|
|
219
|
-
<style lang="less" scoped>
|
|
220
|
-
.side-setting{
|
|
221
|
-
min-height: 100%;
|
|
222
|
-
background-color: @base-bg-color;
|
|
223
|
-
padding: 24px;
|
|
224
|
-
font-size: 14px;
|
|
225
|
-
line-height: 1.5;
|
|
226
|
-
word-wrap: break-word;
|
|
227
|
-
position: relative;
|
|
228
|
-
.flex{
|
|
229
|
-
display: flex;
|
|
230
|
-
}
|
|
231
|
-
.select-item{
|
|
232
|
-
width: 80px;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="side-setting">
|
|
3
|
+
<setting-item>
|
|
4
|
+
<a-button @click="saveSetting" type="primary" icon="save">{{ $t('save') }}</a-button>
|
|
5
|
+
<a-button @click="resetSetting" type="dashed" icon="redo" style="float: right">{{ $t('reset') }}</a-button>
|
|
6
|
+
</setting-item>
|
|
7
|
+
<setting-item :title="$t('theme.title')">
|
|
8
|
+
<img-checkbox-group
|
|
9
|
+
@change="values => setTheme({...theme, mode: values[0]})"
|
|
10
|
+
:default-values="[theme.mode]"
|
|
11
|
+
>
|
|
12
|
+
<img-checkbox :title="$t('theme.dark')" img="https://gw.alipayobjects.com/zos/rmsportal/LCkqqYNmvBEbokSDscrm.svg" value="dark"/>
|
|
13
|
+
<img-checkbox :title="$t('theme.light')" img="https://gw.alipayobjects.com/zos/rmsportal/jpRkZQMyYRryryPNtyIC.svg" value="light"/>
|
|
14
|
+
<img-checkbox :title="$t('theme.night')" img="https://gw.alipayobjects.com/zos/antfincdn/hmKaLQvmY2/LCkqqYNmvBEbokSDscrm.svg" value="night"/>
|
|
15
|
+
</img-checkbox-group>
|
|
16
|
+
</setting-item>
|
|
17
|
+
<setting-item :title="$t('theme.color')">
|
|
18
|
+
<color-checkbox-group
|
|
19
|
+
@change="(values, colors) => setTheme({...theme, color: colors[0]})"
|
|
20
|
+
:defaultValues="[palettes.indexOf(theme.color)]"
|
|
21
|
+
:multiple="false"
|
|
22
|
+
>
|
|
23
|
+
<color-checkbox v-for="(color, index) in palettes" :key="index" :color="color" :value="index" />
|
|
24
|
+
</color-checkbox-group>
|
|
25
|
+
</setting-item>
|
|
26
|
+
<a-divider/>
|
|
27
|
+
<setting-item :title="$t('navigate.title')">
|
|
28
|
+
<img-checkbox-group
|
|
29
|
+
@change="values => setLayout(values[0])"
|
|
30
|
+
:default-values="[layout]"
|
|
31
|
+
>
|
|
32
|
+
<img-checkbox :title="$t('navigate.side')" img="https://gw.alipayobjects.com/zos/rmsportal/JopDzEhOqwOjeNTXkoje.svg" value="side"/>
|
|
33
|
+
<img-checkbox :title="$t('navigate.head')" img="https://gw.alipayobjects.com/zos/rmsportal/KDNDBbriJhLwuqMoxcAr.svg" value="head"/>
|
|
34
|
+
<img-checkbox :title="$t('navigate.mix')" img="https://gw.alipayobjects.com/zos/antfincdn/x8Ob%26B8cy8/LCkqqYNmvBEbokSDscrm.svg" value="mix"/>
|
|
35
|
+
</img-checkbox-group>
|
|
36
|
+
</setting-item>
|
|
37
|
+
<setting-item>
|
|
38
|
+
<a-list :split="false">
|
|
39
|
+
<a-list-item>
|
|
40
|
+
{{ $t('navigate.content.title') }}
|
|
41
|
+
<a-select
|
|
42
|
+
:getPopupContainer="getPopupContainer"
|
|
43
|
+
:value="pageWidth"
|
|
44
|
+
@change="setPageWidth"
|
|
45
|
+
class="select-item"
|
|
46
|
+
size="small"
|
|
47
|
+
slot="actions"
|
|
48
|
+
>
|
|
49
|
+
<a-select-option value="fluid">{{ $t('navigate.content.fluid') }}</a-select-option>
|
|
50
|
+
<a-select-option value="fixed">{{ $t('navigate.content.fixed') }}</a-select-option>
|
|
51
|
+
</a-select>
|
|
52
|
+
</a-list-item>
|
|
53
|
+
<a-list-item>
|
|
54
|
+
{{ $t('navigate.fixedHeader') }}
|
|
55
|
+
<a-switch :checked="fixedHeader" slot="actions" size="small" @change="setFixedHeader" />
|
|
56
|
+
</a-list-item>
|
|
57
|
+
<a-list-item>
|
|
58
|
+
{{ $t('navigate.fixedSideBar') }}
|
|
59
|
+
<a-switch :checked="fixedSideBar" slot="actions" size="small" @change="setFixedSideBar" />
|
|
60
|
+
</a-list-item>
|
|
61
|
+
</a-list>
|
|
62
|
+
</setting-item>
|
|
63
|
+
<a-divider />
|
|
64
|
+
<setting-item :title="$t('other.title')">
|
|
65
|
+
<a-list :split="false">
|
|
66
|
+
<a-list-item>
|
|
67
|
+
{{ $t('other.weekMode') }}
|
|
68
|
+
<a-switch :checked="weekMode" slot="actions" size="small" @change="setWeekMode" />
|
|
69
|
+
</a-list-item>
|
|
70
|
+
<a-list-item>
|
|
71
|
+
{{ $t('other.multiPages') }}
|
|
72
|
+
<a-switch :checked="multiPage" slot="actions" size="small" @change="setMultiPage" />
|
|
73
|
+
</a-list-item>
|
|
74
|
+
<a-list-item>
|
|
75
|
+
{{ $t('other.hideSetting') }}
|
|
76
|
+
<a-switch :checked="hideSetting" slot="actions" size="small" @change="setHideSetting" />
|
|
77
|
+
</a-list-item>
|
|
78
|
+
</a-list>
|
|
79
|
+
</setting-item>
|
|
80
|
+
<a-divider />
|
|
81
|
+
<setting-item :title="$t('animate.title')">
|
|
82
|
+
<a-list :split="false">
|
|
83
|
+
<a-list-item>
|
|
84
|
+
{{ $t('animate.disable') }}
|
|
85
|
+
<a-switch :checked="animate.disabled" slot="actions" size="small" @change="val => setAnimate({...animate, disabled: val})" />
|
|
86
|
+
</a-list-item>
|
|
87
|
+
<a-list-item>
|
|
88
|
+
{{ $t('animate.effect') }}
|
|
89
|
+
<a-select
|
|
90
|
+
:value="animate.name"
|
|
91
|
+
:getPopupContainer="getPopupContainer"
|
|
92
|
+
@change="val => setAnimate({...animate, name: val})"
|
|
93
|
+
class="select-item"
|
|
94
|
+
size="small"
|
|
95
|
+
slot="actions"
|
|
96
|
+
>
|
|
97
|
+
<a-select-option :key="index" :value="item.name" v-for="(item, index) in animates">{{ item.alias }}</a-select-option>
|
|
98
|
+
</a-select>
|
|
99
|
+
</a-list-item>
|
|
100
|
+
<a-list-item>
|
|
101
|
+
{{ $t('animate.direction') }}
|
|
102
|
+
<a-select
|
|
103
|
+
:value="animate.direction"
|
|
104
|
+
:getPopupContainer="getPopupContainer"
|
|
105
|
+
@change="val => setAnimate({...animate, direction: val})"
|
|
106
|
+
class="select-item"
|
|
107
|
+
size="small"
|
|
108
|
+
slot="actions"
|
|
109
|
+
>
|
|
110
|
+
<a-select-option :key="index" :value="item" v-for="(item, index) in directions">{{ item }}</a-select-option>
|
|
111
|
+
</a-select>
|
|
112
|
+
</a-list-item>
|
|
113
|
+
</a-list>
|
|
114
|
+
</setting-item>
|
|
115
|
+
<a-alert
|
|
116
|
+
v-if="isDev"
|
|
117
|
+
style="max-width: 240px; margin: -16px 0 8px; word-break: break-all"
|
|
118
|
+
type="warning"
|
|
119
|
+
:message="$t('alert')"
|
|
120
|
+
>
|
|
121
|
+
</a-alert>
|
|
122
|
+
<a-button
|
|
123
|
+
v-if="isDev"
|
|
124
|
+
id="copyBtn"
|
|
125
|
+
:data-clipboard-text="copyConfig"
|
|
126
|
+
@click="copyCode"
|
|
127
|
+
style="width: 100%"
|
|
128
|
+
icon="copy" >{{ $t('copy') }}</a-button>
|
|
129
|
+
</div>
|
|
130
|
+
</template>
|
|
131
|
+
|
|
132
|
+
<script>
|
|
133
|
+
import SettingItem from './SettingItem'
|
|
134
|
+
import { ColorCheckbox, ImgCheckbox } from '@vue2-client/components/checkbox'
|
|
135
|
+
import Clipboard from 'clipboard'
|
|
136
|
+
import { mapState, mapMutations } from 'vuex'
|
|
137
|
+
import { formatConfig } from '@vue2-client/utils/formatter'
|
|
138
|
+
import { setting } from '@vue2-client/config/default'
|
|
139
|
+
import fastEqual from 'fast-deep-equal'
|
|
140
|
+
|
|
141
|
+
const ColorCheckboxGroup = ColorCheckbox.Group
|
|
142
|
+
const ImgCheckboxGroup = ImgCheckbox.Group
|
|
143
|
+
export default {
|
|
144
|
+
name: 'Setting',
|
|
145
|
+
i18n: require('./i18n'),
|
|
146
|
+
components: { ImgCheckboxGroup, ImgCheckbox, ColorCheckboxGroup, ColorCheckbox, SettingItem },
|
|
147
|
+
data () {
|
|
148
|
+
return {
|
|
149
|
+
copyConfig: 'Sorry, you have copied nothing O(∩_∩)O~',
|
|
150
|
+
isDev: process.env.NODE_ENV === 'development'
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
computed: {
|
|
154
|
+
directions () {
|
|
155
|
+
return this.animates.find(item => item.name === this.animate.name).directions
|
|
156
|
+
},
|
|
157
|
+
...mapState('setting', ['theme', 'layout', 'animate', 'animates', 'palettes', 'multiPage', 'weekMode', 'fixedHeader', 'fixedSideBar', 'hideSetting', 'pageWidth'])
|
|
158
|
+
},
|
|
159
|
+
watch: {
|
|
160
|
+
'animate.name': function (val) {
|
|
161
|
+
this.setAnimate({ name: val, direction: this.directions[0] })
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
methods: {
|
|
165
|
+
getPopupContainer () {
|
|
166
|
+
return this.$el.parentNode
|
|
167
|
+
},
|
|
168
|
+
copyCode () {
|
|
169
|
+
const config = this.extractConfig()
|
|
170
|
+
this.copyConfig = `// 自定义配置,参考 ./default/setting.config.js,需要自定义的属性在这里配置即可
|
|
171
|
+
module.exports = ${formatConfig(config)}
|
|
172
|
+
`
|
|
173
|
+
const clipboard = new Clipboard('#copyBtn')
|
|
174
|
+
clipboard.on('success', () => {
|
|
175
|
+
this.$message.success(`复制成功,覆盖文件 src/config/config.js 然后重启项目即可生效`).then(() => {
|
|
176
|
+
const localConfig = localStorage.getItem(process.env.VUE_APP_SETTING_KEY)
|
|
177
|
+
if (localConfig) {
|
|
178
|
+
console.warn('检测到本地有历史保存的主题配置,想要要拷贝的配置代码生效,您可能需要先重置配置')
|
|
179
|
+
this.$message.warn('检测到本地有历史保存的主题配置,想要要拷贝的配置代码生效,您可能需要先重置配置', 5)
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
clipboard.destroy()
|
|
183
|
+
})
|
|
184
|
+
},
|
|
185
|
+
saveSetting () {
|
|
186
|
+
const closeMessage = this.$message.loading('正在保存到本地,请稍后...', 0)
|
|
187
|
+
const config = this.extractConfig()
|
|
188
|
+
localStorage.setItem(process.env.VUE_APP_SETTING_KEY, JSON.stringify(config))
|
|
189
|
+
setTimeout(closeMessage, 800)
|
|
190
|
+
},
|
|
191
|
+
resetSetting () {
|
|
192
|
+
this.$confirm({
|
|
193
|
+
title: '重置主题会刷新页面,当前页面内容不会保留,确认重置?',
|
|
194
|
+
onOk () {
|
|
195
|
+
localStorage.removeItem(process.env.VUE_APP_SETTING_KEY)
|
|
196
|
+
window.location.reload()
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
},
|
|
200
|
+
// 提取配置
|
|
201
|
+
extractConfig () {
|
|
202
|
+
const config = {}
|
|
203
|
+
const mySetting = this.$store.state.setting
|
|
204
|
+
const dftSetting = setting
|
|
205
|
+
Object.keys(mySetting).forEach(key => {
|
|
206
|
+
const dftValue = dftSetting[key]; const myValue = mySetting[key]
|
|
207
|
+
if (dftValue !== undefined && !fastEqual(dftValue, myValue)) {
|
|
208
|
+
config[key] = myValue
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
return config
|
|
212
|
+
},
|
|
213
|
+
...mapMutations('setting', ['setTheme', 'setLayout', 'setMultiPage', 'setWeekMode',
|
|
214
|
+
'setFixedSideBar', 'setFixedHeader', 'setAnimate', 'setHideSetting', 'setPageWidth'])
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
</script>
|
|
218
|
+
|
|
219
|
+
<style lang="less" scoped>
|
|
220
|
+
.side-setting{
|
|
221
|
+
min-height: 100%;
|
|
222
|
+
background-color: @base-bg-color;
|
|
223
|
+
padding: 24px;
|
|
224
|
+
font-size: 14px;
|
|
225
|
+
line-height: 1.5;
|
|
226
|
+
word-wrap: break-word;
|
|
227
|
+
position: relative;
|
|
228
|
+
.flex{
|
|
229
|
+
display: flex;
|
|
230
|
+
}
|
|
231
|
+
.select-item{
|
|
232
|
+
width: 80px;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
</style>
|