Merge branch 'master' into develop

Former-commit-id: e9b30f55f8fa5b17601a23ef4a17ba2ea58d6695 [formerly e9b30f55f8fa5b17601a23ef4a17ba2ea58d6695 [formerly e9b30f55f8fa5b17601a23ef4a17ba2ea58d6695 [formerly e9b30f55f8fa5b17601a23ef4a17ba2ea58d6695 [formerly cc7d1638dfd3ba091775eecb04e753b022276ace [formerly 1daa803a0454d6503fc0b58278987d6697ac0e6c]]]]]
Former-commit-id: e06537d133e3560d42a5a5bffe4732c197ec725d
Former-commit-id: 3539d459a8723b9e46615cb81de4bda03aa430c0
Former-commit-id: 5b5c0f9c747b76e84729ef00c8a51d38c830047c [formerly 1d2f6675e67d26f8243c51c2a1b7cc36488aa97c]
Former-commit-id: 3b2da5449eb061f8c0b55ccd1c3e1ff775420664
Former-commit-id: 7670095277f2f6570ad5228d8f4803e5f10624eb
Former-commit-id: 158e4d0a79199aac7d8570fc8a561ca5b0c2889a
Former-commit-id: c27e2b218e7497110f7fff960490809ceb77c092
Former-commit-id: d5e1646091903bb822c241427d321f5ff34a65b3
This commit is contained in:
liyang
2019-06-07 21:00:17 +08:00
27 changed files with 560 additions and 98 deletions

5
.env
View File

@@ -1,5 +1,6 @@
VUE_APP_TITLE=D2Admin
VUE_APP_API=/api/
VUE_APP_REPO=https://github.com/d2-projects/d2-admin
VUE_APP_I18N_LOCALE=en
VUE_APP_I18N_FALLBACK_LOCALE=zh-chs
VUE_APP_I18N_LOCALE=zh-chs
VUE_APP_I18N_FALLBACK_LOCALE=en
VUE_APP_ELEMENT_COLOR=#409EFF

View File

@@ -1,6 +1,9 @@
language: node_js
node_js: stable
notifications:
webhooks: https://oapi.dingtalk.com/robot/send?access_token=a0918ec1b0461056fb9953fe2b03ecc3074a629e88992f327cc94bae93349e9e
cache:
directories:
- "node_modules"

View File

@@ -1 +1 @@
681ffc71f82857c857c50891b8f73e04e345c7db
dc12e7a41dd2118aa502884a5a8799c47c5897e5

View File

@@ -25,7 +25,7 @@
"countup.js": "^2.0.4",
"dayjs": "^1.8.12",
"echarts": "^4.2.1",
"element-ui": "^2.7.2",
"element-ui": "^2.9.1",
"flex.css": "^1.1.7",
"fuse.js": "^3.4.4",
"github-markdown-css": "^3.0.1",
@@ -72,6 +72,7 @@
"text-loader": "0.0.1",
"uglifyjs-webpack-plugin": "^2.1.2",
"vue-cli-plugin-i18n": "^0.6.0",
"vue-template-compiler": "^2.5.21"
"vue-template-compiler": "^2.5.21",
"webpack-theme-color-replacer": "^1.2.1"
}
}

View File

@@ -3,7 +3,7 @@
<i v-if="menu.icon" :class="`fa fa-${menu.icon}`"></i>
<i v-if="menu.icon === undefined & !menu.iconSvg" class="fa fa-file-o"></i>
<d2-icon-svg v-if="menu.iconSvg" :name="menu.iconSvg"/>
<span slot="title">{{menu.title || '未命名菜单'}}</span>
<span slot="title">{{menu.title || $t('layout.header-aside.menu-item.label-default')}}</span>
</el-menu-item>
</template>

View File

@@ -0,0 +1,41 @@
<template>
<el-color-picker :value="value" size="small" @change="changeColor"></el-color-picker>
</template>
<script>
import { mapState, mapActions } from 'vuex'
import client from 'webpack-theme-color-replacer/client'
import forElementUI from 'webpack-theme-color-replacer/forElementUI'
export default {
name: 'd2-header-color',
computed: {
...mapState('d2admin/color', [
'value'
])
},
watch: {
value (val, old) {
this.changeThemeColor(old, val)
}
},
created () {
this.changeThemeColor(process.env.VUE_APP_ELEMENT_COLOR, this.value)
},
methods: {
...mapActions({
colorSet: 'd2admin/color/set'
}),
changeColor (newColor) {
this.colorSet(newColor)
},
changeThemeColor (curColor, newColor) {
var options = {
oldColors: [...forElementUI.getElementUISeries(curColor)],
newColors: [...forElementUI.getElementUISeries(newColor)]
}
client.changer.changeColor(options, Promise)
}
}
}
</script>

View File

@@ -1,7 +1,7 @@
<template>
<el-tooltip
effect="dark"
:content="active ? '退出全屏' : '全屏'"
:content="active ? $t('layout.header-aside.header-fullscreen.exit') : $t('layout.header-aside.header-fullscreen.active')"
placement="bottom">
<el-button class="d2-mr btn-text can-hover" type="text" @click="toggle">
<d2-icon v-if="active" name="compress"/>

View File

@@ -34,9 +34,9 @@ export default {
}),
tooltipContent () {
return this.logLength === 0
? '没有日志或异常'
: `${this.logLength} 条日志${this.logLengthError > 0
? ` | 包含 ${this.logLengthError} 个异常`
? this.$t('layout.header-aside.header-log.empty')
: `${this.$t('layout.header-aside.header-log.log-length', { length: this.logLength })}${this.logLengthError > 0
? ` | ${this.$t('layout.header-aside.header-log.error-length', { length: this.logLengthError })}`
: ''}`
}
},

View File

@@ -15,20 +15,18 @@
import { mapState, mapMutations, mapActions } from 'vuex'
export default {
name: 'd2-header-size',
data () {
return {
options: [
{ label: '默认', value: 'default' },
{ label: '中', value: 'medium' },
{ label: '小', value: 'small' },
{ label: '最小', value: 'mini' }
]
}
},
computed: {
...mapState('d2admin/size', [
'value'
])
]),
options () {
return [
{ label: this.$t('layout.header-aside.header-size.options.default'), value: 'default' },
{ label: this.$t('layout.header-aside.header-size.options.medium'), value: 'medium' },
{ label: this.$t('layout.header-aside.header-size.options.small'), value: 'small' },
{ label: this.$t('layout.header-aside.header-size.options.mini'), value: 'mini' }
]
}
},
watch: {
// 注意 这里是关键
@@ -61,9 +59,9 @@ export default {
handleChange (value) {
this.sizeSet(value)
this.$notify({
title: '提示',
title: this.$t('public.notify.special.component-size.changed.title'),
dangerouslyUseHTMLString: true,
message: '已更新页面内 <b>组件</b> 的 <b>默认尺寸</b><br/>例如按钮大小,<b>非字号</b>',
message: this.$t('public.notify.special.component-size.changed.message'),
type: 'success'
})
},

View File

@@ -7,8 +7,8 @@
align="center"
width="160"/>
<el-table-column
label="预览"
width="120">
width="120"
:label="$t('layout.header-aside.header-theme.list.column.label.preview')">
<div
slot-scope="scope"
class="theme-preview"
@@ -26,13 +26,13 @@
type="success"
icon="el-icon-check"
round>
已激活
{{ $t('layout.header-aside.header-theme.list.button.is-active') }}
</el-button>
<el-button
v-else
round
@click="handleSelectTheme(scope.row.name)">
使用
{{ $t('layout.header-aside.header-theme.list.button.select') }}
</el-button>
</template>
</el-table-column>

View File

@@ -2,8 +2,8 @@
<div>
<el-tooltip
effect="dark"
content="主题"
placement="bottom">
placement="bottom"
:content="$t('layout.header-aside.header-theme.tooltip.content')">
<el-button
class="d2-ml-0 d2-mr btn-text can-hover"
type="text"
@@ -14,8 +14,8 @@
</el-button>
</el-tooltip>
<el-dialog
title="主题"
width="600px"
:title="$t('layout.header-aside.header-theme.dialog.title')"
:visible.sync="dialogVisible"
:append-to-body="true">
<d2-theme-list style="margin-top: -25px;"/>

View File

@@ -1,10 +1,10 @@
<template>
<el-dropdown size="small" class="d2-mr">
<span class="btn-text">{{info.name ? `你好 ${info.name}` : '未登录'}}</span>
<span class="btn-text">{{info.name ? `${$t('layout.header-aside.header-user.hello')} ${info.name}` : '----'}}</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="logOff">
<d2-icon name="power-off" class="d2-mr-5"/>
注销
{{ $t('layout.header-aside.header-user.log-off') }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>

View File

@@ -13,7 +13,7 @@
</el-menu>
<div v-if="aside.length === 0 && !asideCollapse" class="d2-layout-header-aside-menu-empty" flex="dir:top main:center cross:center">
<d2-icon name="inbox"/>
<span>没有侧栏菜单</span>
<span>{{ $t('layout.header-aside.menu-side.empty') }}</span>
</div>
</div>
</template>

View File

@@ -4,7 +4,7 @@ export default {
methods: {
handleMenuSelect (index, indexPath) {
if (/^d2-menu-empty-\d+$/.test(index) || index === undefined) {
this.$message.warning('临时菜单')
this.$message.warning(this.$t('layout.header-aside.message.warning.temporary-menu'))
} else if (/^https:\/\/|http:\/\//.test(index)) {
util.open(index)
} else {

View File

@@ -15,7 +15,7 @@
ref="input"
v-model="searchText"
suffix-icon="el-icon-search"
placeholder="搜索页面"
:placeholder="$t('layout.header-aside.panel-search.autocomplete-placeholder')"
:fetch-suggestions="querySearch"
:trigger-on-focus="false"
:clearable="true"
@@ -26,11 +26,7 @@
:item="item"/>
</el-autocomplete>
<div class="panel-search__tip">
您可以使用快捷键
<span class="panel-search__key">{{hotkey.open}}</span>
唤醒搜索面板
<span class="panel-search__key">{{hotkey.close}}</span>
关闭
{{ $t('layout.header-aside.panel-search.tip', { open: hotkey.open, close: hotkey.close }) }}
</div>
</div>
<div
@@ -204,13 +200,6 @@ export default {
margin-bottom: 40px;
font-size: 12px;
color: $color-text-sub;
.panel-search__key {
padding: 1px 5px;
margin: 0px 2px;
border-radius: 2px;
background-color: $color-text-normal;
color: $color-bg;
}
}
}
.panel-search__results-group {

View File

@@ -21,7 +21,7 @@
<el-tab-pane
v-for="page in opened"
:key="page.fullPath"
:label="page.meta.title || '未命名'"
:label="page.meta.title || $t('layout.header-aside.tabs.label-default')"
:name="page.fullPath"/>
</el-tabs>
</div>
@@ -38,19 +38,19 @@
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="left">
<d2-icon name="arrow-left" class="d2-mr-10"/>
关闭左侧
{{ $t('layout.header-aside.tabs.close-left') }}
</el-dropdown-item>
<el-dropdown-item command="right">
<d2-icon name="arrow-right" class="d2-mr-10"/>
关闭右侧
{{ $t('layout.header-aside.tabs.close-right') }}
</el-dropdown-item>
<el-dropdown-item command="other">
<d2-icon name="times" class="d2-mr-10"/>
关闭其它
{{ $t('layout.header-aside.tabs.close-other') }}
</el-dropdown-item>
<el-dropdown-item command="all">
<d2-icon name="times-circle" class="d2-mr-10"/>
全部关闭
{{ $t('layout.header-aside.tabs.close-all') }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
@@ -70,15 +70,6 @@ export default {
contextmenuFlag: false,
contentmenuX: 0,
contentmenuY: 0,
contextmenuListIndex: [
{ icon: 'times-circle', title: '关闭全部', value: 'all' }
],
contextmenuList: [
{ icon: 'arrow-left', title: '关闭左侧', value: 'left' },
{ icon: 'arrow-right', title: '关闭右侧', value: 'right' },
{ icon: 'times', title: '关闭其它', value: 'other' },
{ icon: 'times-circle', title: '关闭全部', value: 'all' }
],
tagName: '/index'
}
},
@@ -86,7 +77,20 @@ export default {
...mapState('d2admin/page', [
'opened',
'current'
])
]),
contextmenuListIndex () {
return [
{ icon: 'times-circle', title: this.$t('layout.header-aside.tabs.close-all'), value: 'all' }
]
},
contextmenuList () {
return [
{ icon: 'arrow-left', title: this.$t('layout.header-aside.tabs.close-left'), value: 'left' },
{ icon: 'arrow-right', title: this.$t('layout.header-aside.tabs.close-right'), value: 'right' },
{ icon: 'times', title: this.$t('layout.header-aside.tabs.close-other'), value: 'other' },
{ icon: 'times-circle', title: this.$t('layout.header-aside.tabs.close-all'), value: 'all' }
]
}
},
methods: {
...mapActions('d2admin/page', [
@@ -147,7 +151,7 @@ export default {
this.closeAll()
break
default:
this.$message.error('无效的操作')
this.$message.error(this.$t('public.message.error.handle.invalid'))
break
}
},

View File

@@ -32,6 +32,7 @@
<d2-header-theme/>
<d2-header-size/>
<d2-header-locales/>
<d2-header-color></d2-header-color>
<d2-header-user/>
</div>
</div>
@@ -92,6 +93,7 @@ import d2HeaderSize from './components/header-size'
import d2HeaderTheme from './components/header-theme'
import d2HeaderUser from './components/header-user'
import d2HeaderLog from './components/header-log'
import d2HeaderColor from './components/header-color'
import { mapState, mapGetters, mapActions } from 'vuex'
import mixinSearch from './mixins/search'
export default {
@@ -109,7 +111,8 @@ export default {
d2HeaderSize,
d2HeaderTheme,
d2HeaderUser,
d2HeaderLog
d2HeaderLog,
d2HeaderColor
},
data () {
return {

View File

@@ -1,15 +1,111 @@
{
"_name": "English",
"layout": {
"header-aside": {
"header-fullscreen": {
"active": "full screen",
"exit": "Exit full screen"
},
"header-log": {
"empty": "No logs or exceptions",
"error-length": "Contains {length} exceptions",
"log-length": "{length} logs"
},
"header-size": {
"options": {
"default": "Default",
"medium": "in",
"mini": "Minimum",
"small": "Small"
}
},
"header-theme": {
"dialog": {
"title": "Theme"
},
"list": {
"button": {
"is-active": "Activated",
"select": "Select"
},
"column": {
"label": {
"preview": "Preview"
}
}
},
"tooltip": {
"content": "Theme"
}
},
"header-user": {
"hello": "Hello there",
"log-off": "Logout"
},
"menu-item": {
"label-default": "Unnamed menu"
},
"menu-side": {
"empty": "No sidebar menu"
},
"message": {
"warning": {
"temporary-menu": "Temporary menu"
}
},
"panel-search": {
"autocomplete-placeholder": "Search page",
"tip": "You can wake up the search panel with the shortcut {open} and press {close} to close"
},
"tabs": {
"close-all": "Close all",
"close-left": "Close left",
"close-other": "Close other",
"close-right": "Close right",
"label-default": "unnamed"
}
}
},
"public": {
"confirm": {
"special": {
"logout": {
"button": {
"cancel": "Give up",
"confirm": "Confirm logout"
},
"message": "Can I log out of my current account? The open tabs and user settings will be saved.",
"title": "Confirmation operation"
}
}
},
"message": {
"error": {
"form": {
"invalid": "Form verification failed, please check"
},
"handle": {
"invalid": "Invalid operation"
}
},
"special": {
"logout": {
"cancel": "Abandon logout user"
}
}
},
"notify": {
"special": {
"component-size": {
"changed": {
"message": "Global component size has changed",
"title": "prompt"
}
},
"show-log": {
"message": "The full log content has been printed to the console",
"title": "log details"
},
"upload": {
"error": {
"message": "Data upload failed",
@@ -93,12 +189,6 @@
}
},
"log": {
"notify": {
"more": {
"message": "The full log content has been printed to the console",
"title": "log details"
}
},
"table": {
"empty-text": "No log information yet",
"label": {

View File

@@ -1,15 +1,111 @@
{
"_name": "日本語",
"layout": {
"header-aside": {
"header-fullscreen": {
"active": "全画面",
"exit": "全画面を終了"
},
"header-log": {
"empty": "ログや例外はありません",
"error-length": " {length} 個の例外が含まれています",
"log-length": "{length} 個のログ"
},
"header-size": {
"options": {
"default": "デフォルト",
"medium": "普通",
"mini": "最小",
"small": "小さい"
}
},
"header-theme": {
"dialog": {
"title": "テーマ"
},
"list": {
"button": {
"is-active": "有効化",
"select": "選ぶ"
},
"column": {
"label": {
"preview": "プレビュー"
}
}
},
"tooltip": {
"content": "テーマ"
}
},
"header-user": {
"hello": "こんにちは",
"log-off": "ログアウト"
},
"menu-item": {
"label-default": "名前のないメニュー"
},
"menu-side": {
"empty": "サイドバーメニューなし"
},
"message": {
"warning": {
"temporary-menu": "一時メニュー"
}
},
"panel-search": {
"autocomplete-placeholder": "検索ページ",
"tip": "ショートカット {open} で検索パネルを起動し、 {close} を押して閉じることができます"
},
"tabs": {
"close-all": "すべて閉じる",
"close-left": "左に閉じる",
"close-other": "その他を閉じる",
"close-right": "右に閉じる",
"label-default": "無名:"
}
}
},
"public": {
"confirm": {
"special": {
"logout": {
"button": {
"cancel": "あきらめる",
"confirm": "ログアウトを確認"
},
"message": "現在のアカウントからログアウトできますか?開いているタブとユーザー設定が保存されます。",
"title": "確認操作"
}
}
},
"message": {
"error": {
"form": {
"invalid": "フォームの確認に失敗しました。確認してください"
},
"handle": {
"invalid": "無効な操作"
}
},
"special": {
"logout": {
"cancel": "ログアウトユーザーを放棄する"
}
}
},
"notify": {
"special": {
"component-size": {
"changed": {
"message": "グローバルコンポーネントサイズが変更されました",
"title": "プロンプト"
}
},
"show-log": {
"message": "ログ全体の内容がコンソールに出力されました",
"title": "ログ詳細"
},
"upload": {
"error": {
"message": "データのアップロードに失敗しました",
@@ -93,12 +189,6 @@
}
},
"log": {
"notify": {
"more": {
"message": "ログ全体の内容がコンソールに出力されました",
"title": "ログ詳細"
}
},
"table": {
"empty-text": "ログ情報はまだありません",
"label": {

View File

@@ -1,15 +1,111 @@
{
"_name": "简体中文",
"layout": {
"header-aside": {
"header-fullscreen": {
"active": "全屏",
"exit": "退出全屏"
},
"header-log": {
"empty": "没有日志或异常",
"error-length": "包含 {length} 个异常",
"log-length": "{length} 条日志"
},
"header-size": {
"options": {
"default": "默认",
"medium": "中",
"mini": "最小",
"small": "小"
}
},
"header-theme": {
"dialog": {
"title": "主题"
},
"list": {
"button": {
"is-active": "已激活",
"select": "选择"
},
"column": {
"label": {
"preview": "预览"
}
}
},
"tooltip": {
"content": "主题"
}
},
"header-user": {
"hello": "你好",
"log-off": "注销"
},
"menu-item": {
"label-default": "未命名菜单"
},
"menu-side": {
"empty": "没有侧栏菜单"
},
"message": {
"warning": {
"temporary-menu": "临时菜单"
}
},
"panel-search": {
"autocomplete-placeholder": "搜索页面",
"tip": "你可以使用快捷键 {open} 唤醒搜索面板,按 {close} 关闭"
},
"tabs": {
"close-all": "全部关闭",
"close-left": "关闭左侧",
"close-other": "关闭其它",
"close-right": "关闭右侧",
"label-default": "未命名"
}
}
},
"public": {
"confirm": {
"special": {
"logout": {
"button": {
"cancel": "放弃",
"confirm": "确定注销"
},
"message": "注销当前账户吗? 打开的标签页和用户设置将会被保存。",
"title": "确认操作"
}
}
},
"message": {
"error": {
"form": {
"invalid": "表单校验失败,请检查"
},
"handle": {
"invalid": "无效的操作"
}
},
"special": {
"logout": {
"cancel": "放弃注销用户"
}
}
},
"notify": {
"special": {
"component-size": {
"changed": {
"message": "全局组件尺寸已经变更",
"title": "提示"
}
},
"show-log": {
"message": "完整的日志内容已经打印到控制台",
"title": "日志详情"
},
"upload": {
"error": {
"message": "数据上传失败",
@@ -93,12 +189,6 @@
}
},
"log": {
"notify": {
"more": {
"message": "完整的日志内容已经打印到控制台",
"title": "日志详情"
}
},
"table": {
"empty-text": "暂无日志信息",
"label": {

View File

@@ -1,15 +1,111 @@
{
"_name": "繁體中文",
"layout": {
"header-aside": {
"header-fullscreen": {
"active": "全屏",
"exit": "退出全屏"
},
"header-log": {
"empty": "沒有日誌或異常",
"error-length": "包含 {length} 個異常",
"log-length": "{length} 條日誌"
},
"header-size": {
"options": {
"default": "默認",
"medium": "中",
"mini": "最小",
"small": "小"
}
},
"header-theme": {
"dialog": {
"title": "主題"
},
"list": {
"button": {
"is-active": "已激活",
"select": "選擇"
},
"column": {
"label": {
"preview": "預覽"
}
}
},
"tooltip": {
"content": "主題"
}
},
"header-user": {
"hello": "你好",
"log-off": "註銷"
},
"menu-item": {
"label-default": "未命名菜單"
},
"menu-side": {
"empty": "沒有側欄菜單"
},
"message": {
"warning": {
"temporary-menu": "臨時菜單"
}
},
"panel-search": {
"autocomplete-placeholder": "搜索頁面",
"tip": "你可以使用快捷鍵 {open} 喚醒搜索面板,按 {close} 關閉"
},
"tabs": {
"close-all": "全部關閉",
"close-left": "關閉左側",
"close-other": "關閉其它",
"close-right": "關閉右側",
"label-default": "未命名"
}
}
},
"public": {
"confirm": {
"special": {
"logout": {
"button": {
"cancel": "放棄",
"confirm": "確定註銷"
},
"message": "註銷當前賬戶嗎? 打開的標籤頁和用戶設置將會被保存。",
"title": "確認操作"
}
}
},
"message": {
"error": {
"form": {
"invalid": "表單校驗失敗,請檢查"
},
"handle": {
"invalid": "無效的操作"
}
},
"special": {
"logout": {
"cancel": "放棄註銷用戶"
}
}
},
"notify": {
"special": {
"component-size": {
"changed": {
"message": "全局組件尺寸已經變更",
"title": "提示"
}
},
"show-log": {
"message": "完整的日誌內容已經打印到控制台",
"title": "日誌詳情"
},
"upload": {
"error": {
"message": "數據上傳失敗",
@@ -93,12 +189,6 @@
}
},
"log": {
"notify": {
"more": {
"message": "完整的日誌內容已經打印到控制台",
"title": "日誌詳情"
}
},
"table": {
"empty-text": "暫無日誌信息",
"label": {

View File

@@ -2,6 +2,7 @@ import { Message, MessageBox } from 'element-ui'
import util from '@/libs/util.js'
import router from '@/router'
import { AccountLogin } from '@api/sys.login'
import i18n from '../../../../i18n'
export default {
namespaced: true,
@@ -69,9 +70,9 @@ export default {
// 判断是否需要确认
if (confirm) {
commit('d2admin/gray/set', true, { root: true })
MessageBox.confirm('注销当前账户吗? 打开的标签页和用户设置将会被保存。', '确认操作', {
confirmButtonText: '确定注销',
cancelButtonText: '放弃',
MessageBox.confirm(i18n.t('public.confirm.special.logout.message'), i18n.t('public.confirm.special.logout.title'), {
confirmButtonText: i18n.t('public.confirm.special.logout.button.confirm'),
cancelButtonText: i18n.t('public.confirm.special.logout.button.cancel'),
type: 'warning'
})
.then(() => {
@@ -81,7 +82,7 @@ export default {
.catch(() => {
commit('d2admin/gray/set', false, { root: true })
Message({
message: '放弃注销用户'
message: i18n.t('public.message.special.logout.cancel')
})
})
} else {
@@ -106,6 +107,7 @@ export default {
await dispatch('d2admin/menu/asideCollapseLoad', null, { root: true })
// DB -> store 持久化数据加载全局尺寸
await dispatch('d2admin/size/load', null, { root: true })
await dispatch('d2admin/color/load', null, { root: true })
// end
resolve()
})

View File

@@ -0,0 +1,46 @@
export default {
namespaced: true,
state: {
// 颜色
value: process.env.VUE_APP_ELEMENT_COLOR
},
actions: {
/**
* @description 设置颜色
* @param {Object} state vuex state
* @param {String} color 尺寸
*/
set ({ state, dispatch }, color) {
return new Promise(async resolve => {
// store 赋值
state.value = color
// 持久化
await dispatch('d2admin/db/set', {
dbName: 'sys',
path: 'color.value',
value: state.value,
user: true
}, { root: true })
// end
resolve()
})
},
/**
* @description 从持久化数据读取颜色设置
* @param {Object} state vuex state
*/
load ({ state, dispatch }) {
return new Promise(async resolve => {
// store 赋值
state.value = await dispatch('d2admin/db/get', {
dbName: 'sys',
path: 'color.value',
defaultValue: process.env.VUE_APP_ELEMENT_COLOR,
user: true
}, { root: true })
// end
resolve()
})
}
}
}

View File

@@ -89,8 +89,8 @@ export default {
// Print all information from a log to the console
this.$notify({
type: 'info',
title: this.$t('views.system.log.notify.more.title'),
message: this.$t('views.system.log.notify.more.message')
title: this.$t('public.notify.special.show-log.title'),
message: this.$t('public.notify.special.show-log.message')
})
this.$log.capsule('D2Admin', 'handleShowMore', 'primary')
console.group(log.message)

View File

@@ -1 +1 @@
79e5cb61969ad81e9de47b2dfc6ca33133c77a23
9c9dbaa47996b7dceac7c165fed90e73e4da0237

View File

@@ -1,6 +1,9 @@
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const VueFilenameInjector = require('./tools/vue-filename-injector')
const ThemeColorReplacer = require('webpack-theme-color-replacer')
const forElementUI = require('webpack-theme-color-replacer/forElementUI')
// 拼接路径
const resolve = dir => require('path').join(__dirname, dir)
@@ -26,6 +29,17 @@ module.exports = {
}
}
},
configureWebpack: {
plugins: [
new ThemeColorReplacer({
fileName: 'css/theme-colors.[contenthash:8].css',
matchColors: [
...forElementUI.getElementUISeries(process.env.VUE_APP_ELEMENT_COLOR) // Element-ui主色系列
],
changeSelector: forElementUI.changeSelector
})
]
},
// 默认设置: https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-service/lib/config/base.js
chainWebpack: config => {
/**
@@ -110,8 +124,8 @@ module.exports = {
// i18n
pluginOptions: {
i18n: {
locale: 'en',
fallbackLocale: 'zh-chs',
locale: 'zh-chs',
fallbackLocale: 'en',
localeDir: 'locales',
enableInSFC: true
}

View File

@@ -1 +1 @@
8a273c9068198d1dcc8d6b9738808332f76dabcb
12deef00e0a1116ba0392a3851989164ee601528