update to 1.8.4
This commit is contained in:
-13
@@ -1,13 +0,0 @@
|
||||
# 构建预览页面
|
||||
|
||||
# 指定构建模式
|
||||
NODE_ENV=production
|
||||
|
||||
# 标记当前构建方式
|
||||
VUE_APP_BUILD_MODE=PREVIEW
|
||||
|
||||
# 显示源码按钮
|
||||
VUE_APP_SCOURCE_LINK=TRUE
|
||||
|
||||
# 部署路径
|
||||
VUE_APP_PUBLIC_PATH=/d2-admin-start-kit/
|
||||
@@ -1,13 +0,0 @@
|
||||
# 构建预览页面
|
||||
|
||||
# 指定构建模式
|
||||
NODE_ENV=production
|
||||
|
||||
# 标记当前构建方式
|
||||
VUE_APP_BUILD_MODE=PREVIEW
|
||||
|
||||
# 显示源码按钮
|
||||
VUE_APP_SCOURCE_LINK=TRUE
|
||||
|
||||
# 部署路径
|
||||
VUE_APP_PUBLIC_PATH=/
|
||||
+1
-1
@@ -10,4 +10,4 @@ VUE_APP_BUILD_MODE=PREVIEW
|
||||
VUE_APP_SCOURCE_LINK=TRUE
|
||||
|
||||
# 部署路径
|
||||
VUE_APP_PUBLIC_PATH=/d2-admin-start-kit/preview/
|
||||
VUE_APP_PUBLIC_PATH=/
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
name: Deploy https://cdn.d2.pub
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
SITE: https://cdn.d2.pub/
|
||||
QINIU_BUCKET: d2-cdn
|
||||
DIST_FOLDER: /dist
|
||||
PATH_SUFFIX: /preview
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '10.x'
|
||||
- name: Download qshell
|
||||
run: |
|
||||
wget http://devtools.qiniu.com/qshell-linux-x86-v2.4.0.zip
|
||||
unzip qshell-linux-x86-v2.4.0.zip
|
||||
mv qshell-linux-x86-v2.4.0 qshell
|
||||
- name: Install packages
|
||||
run: npm i
|
||||
- name: Build
|
||||
run: npm run build:preview
|
||||
- name: CDN login
|
||||
run: ./qshell account ${{ secrets.AK }} ${{ secrets.SK }} GITHUB_ACTION
|
||||
- name: CDN upload
|
||||
run: |
|
||||
REPO=${GITHUB_REPOSITORY//*\//}
|
||||
echo $SITE > cdnrefresh.txt
|
||||
./qshell qupload2 \
|
||||
--src-dir=$GITHUB_WORKSPACE$DIST_FOLDER \
|
||||
--bucket=$QINIU_BUCKET \
|
||||
--key-prefix=$REPO$PATH_SUFFIX/ \
|
||||
--overwrite=true \
|
||||
--check-exists=true \
|
||||
--check-hash=true \
|
||||
--check-size=true \
|
||||
--rescan-local=true \
|
||||
--thread-count=32
|
||||
- name: CDN refresh
|
||||
run: ./qshell cdnrefresh --dirs -i ./cdnrefresh.txt
|
||||
@@ -1,30 +0,0 @@
|
||||
name: Deploy https://d2.pub
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '10.x'
|
||||
- name: Build
|
||||
run: |
|
||||
npm install
|
||||
npm run build:preview
|
||||
- name: Deploy
|
||||
uses: SamKirkland/FTP-Deploy-Action@2.0.0
|
||||
env:
|
||||
FTP_SERVER: ${{ secrets.FTP_SERVER }}
|
||||
FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
|
||||
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
|
||||
METHOD: sftp
|
||||
PORT: ${{ secrets.FTP_PORT }}
|
||||
LOCAL_DIR: dist
|
||||
REMOTE_DIR: /www/d2-admin-start-kit/preview
|
||||
ARGS: --delete --verbose --parallel=100
|
||||
@@ -1,21 +0,0 @@
|
||||
name: Deploy Github
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Build and Deploy
|
||||
uses: JamesIves/github-pages-deploy-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
BRANCH: gh-pages
|
||||
FOLDER: dist
|
||||
BUILD_SCRIPT: npm install && npm run build:github
|
||||
CLEAN: true
|
||||
@@ -0,0 +1,107 @@
|
||||
name: Deploy preview
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
|
||||
cdn:
|
||||
name: CDN
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: bahmutov/npm-install@v1
|
||||
- name: Set vue cli env
|
||||
shell: bash
|
||||
run: |
|
||||
echo -e "\
|
||||
VUE_APP_PUBLIC_PATH=/d2-admin-start-kit/preview/\
|
||||
" > .env.preview.local
|
||||
cat .env.preview.local | while read line
|
||||
do
|
||||
echo $line
|
||||
done
|
||||
- name: Build
|
||||
run: yarn build:preview --report
|
||||
- name: CDN download qshell
|
||||
run: |
|
||||
wget http://devtools.qiniu.com/qshell-linux-x86-v2.4.0.zip
|
||||
unzip qshell-linux-x86-v2.4.0.zip
|
||||
mv qshell-linux-x86-v2.4.0 qshell
|
||||
- name: CDN login
|
||||
run: ./qshell account ${{ secrets.AK }} ${{ secrets.SK }} GITHUB_ACTION
|
||||
- name: CDN upload
|
||||
run: |
|
||||
./qshell qupload2 \
|
||||
--src-dir=$GITHUB_WORKSPACE/dist \
|
||||
--bucket=d2-cdn \
|
||||
--key-prefix=${GITHUB_REPOSITORY//*\//}/preview/ \
|
||||
--overwrite=true \
|
||||
--check-exists=true \
|
||||
--check-hash=true \
|
||||
--check-size=true \
|
||||
--rescan-local=true \
|
||||
--thread-count=32
|
||||
- name: CDN refresh
|
||||
run: |
|
||||
echo "https://cdn.d2.pub/${GITHUB_REPOSITORY//*\//}/preview/" > cdnrefresh.txt
|
||||
./qshell cdnrefresh --dirs -i ./cdnrefresh.txt
|
||||
|
||||
ftp:
|
||||
name: FTP
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: bahmutov/npm-install@v1
|
||||
- name: Set vue cli env
|
||||
shell: bash
|
||||
run: |
|
||||
echo -e "\
|
||||
VUE_APP_PUBLIC_PATH=/d2-admin-start-kit/preview/\
|
||||
" > .env.preview.local
|
||||
cat .env.preview.local | while read line
|
||||
do
|
||||
echo $line
|
||||
done
|
||||
- name: Build
|
||||
run: yarn build:preview --report
|
||||
- name: Deploy
|
||||
uses: SamKirkland/FTP-Deploy-Action@2.0.0
|
||||
env:
|
||||
FTP_SERVER: ${{ secrets.FTP_SERVER }}
|
||||
FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
|
||||
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
|
||||
METHOD: sftp
|
||||
PORT: ${{ secrets.FTP_PORT }}
|
||||
LOCAL_DIR: dist
|
||||
REMOTE_DIR: /www/d2-admin-start-kit/preview
|
||||
ARGS: --delete --verbose --parallel=100
|
||||
|
||||
gh-pages:
|
||||
name: Github Pages
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: bahmutov/npm-install@v1
|
||||
- name: Set vue cli env
|
||||
shell: bash
|
||||
run: |
|
||||
echo -e "\
|
||||
VUE_APP_PUBLIC_PATH=/d2-admin-start-kit/\
|
||||
" > .env.preview.local
|
||||
cat .env.preview.local | while read line
|
||||
do
|
||||
echo $line
|
||||
done
|
||||
- name: Build
|
||||
run: yarn build:preview --report
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v2
|
||||
env:
|
||||
PERSONAL_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
PUBLISH_BRANCH: gh-pages
|
||||
PUBLISH_DIR: ./dist
|
||||
with:
|
||||
forceOrphan: true
|
||||
@@ -0,0 +1,22 @@
|
||||
module.exports = {
|
||||
branch: 'master',
|
||||
plugins: [
|
||||
'@semantic-release/commit-analyzer',
|
||||
'@semantic-release/release-notes-generator',
|
||||
[
|
||||
'@semantic-release/npm',
|
||||
{
|
||||
npmPublish: false
|
||||
}
|
||||
],
|
||||
'@semantic-release/github',
|
||||
[
|
||||
'@semantic-release/git',
|
||||
{
|
||||
assets: [
|
||||
'package.json'
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
Generated
-15036
File diff suppressed because it is too large
Load Diff
+5
-6
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "d2-admin",
|
||||
"version": "1.8.0",
|
||||
"name": "d2-admin-start-kit",
|
||||
"version": "1.8.4",
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve --open",
|
||||
"start": "npm run serve",
|
||||
@@ -8,12 +8,11 @@
|
||||
"build": "vue-cli-service build",
|
||||
"build:nomock": "vue-cli-service build --mode nomock",
|
||||
"build:preview": "NODE_OPTIONS=--max_old_space_size=4096 vue-cli-service build --mode preview",
|
||||
"build:github": "NODE_OPTIONS=--max_old_space_size=4096 vue-cli-service build --mode github",
|
||||
"build:netlify": "NODE_OPTIONS=--max_old_space_size=4096 vue-cli-service build --mode netlify",
|
||||
"lint": "vue-cli-service lint --fix",
|
||||
"test:unit": "vue-cli-service test:unit",
|
||||
"i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'",
|
||||
"analyz": "npm_config_report=true npm run build"
|
||||
"analyz": "npm_config_report=true npm run build",
|
||||
"commit": "git-cz"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.19.0",
|
||||
@@ -30,7 +29,7 @@
|
||||
"mockjs": "^1.1.0",
|
||||
"nprogress": "^0.2.0",
|
||||
"qs": "^6.9.1",
|
||||
"screenfull": "^5.0.0",
|
||||
"screenfull": "^5.0.2",
|
||||
"sortablejs": "^1.10.1",
|
||||
"ua-parser-js": "^0.7.20",
|
||||
"vue": "^2.6.11",
|
||||
|
||||
+4
-15
@@ -1,19 +1,8 @@
|
||||
<template>
|
||||
<div
|
||||
class="d2-contentmenu-list"
|
||||
@click="rowClick">
|
||||
<div
|
||||
v-for="item in menulist"
|
||||
:key="item.value"
|
||||
:data-value="item.value"
|
||||
class="d2-contentmenu-item"
|
||||
flex="cross:center main:center">
|
||||
<d2-icon
|
||||
v-if="item.icon"
|
||||
:name="item.icon"/>
|
||||
<div
|
||||
class="d2-contentmenu-item-title"
|
||||
flex-box="1">
|
||||
<div class="d2-contentmenu-list" @click="rowClick">
|
||||
<div v-for="item in menulist" :key="item.value" :data-value="item.value" class="d2-contentmenu-item" flex="cross:center main:center">
|
||||
<d2-icon v-if="item.icon" :name="item.icon"/>
|
||||
<div class="d2-contentmenu-item-title" flex-box="1">
|
||||
{{item.title}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<template>
|
||||
<div
|
||||
class="d2-contextmenu"
|
||||
v-show="flag"
|
||||
:style="style">
|
||||
<div class="d2-contextmenu" v-show="flag" :style="style">
|
||||
<slot/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<template>
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="active ? '退出全屏' : '全屏'"
|
||||
placement="bottom">
|
||||
<el-tooltip effect="dark" :content="active ? '退出全屏' : '全屏'" placement="bottom">
|
||||
<el-button class="d2-mr btn-text can-hover" type="text" @click="toggle">
|
||||
<d2-icon v-if="active" name="compress"/>
|
||||
<d2-icon v-else name="arrows-alt" style="font-size: 16px"/>
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<template>
|
||||
<el-dropdown
|
||||
placement="bottom"
|
||||
size="small"
|
||||
@command="onChangeLocale">
|
||||
<el-dropdown placement="bottom" size="small" @command="onChangeLocale">
|
||||
<el-button class="d2-mr btn-text can-hover" type="text">
|
||||
<d2-icon name="language" style="font-size: 16px;"/>
|
||||
</el-button>
|
||||
|
||||
@@ -1,25 +1,10 @@
|
||||
<template>
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="tooltipContent"
|
||||
placement="bottom">
|
||||
<el-button
|
||||
class="d2-ml-0 d2-mr btn-text can-hover"
|
||||
type="text"
|
||||
@click="handleClick">
|
||||
<el-badge
|
||||
v-if="logLength > 0"
|
||||
:max="99"
|
||||
:value="logLengthError"
|
||||
:is-dot="logLengthError === 0">
|
||||
<d2-icon
|
||||
:name="logLengthError === 0 ? 'dot-circle-o' : 'bug'"
|
||||
style="font-size: 20px"/>
|
||||
<el-tooltip effect="dark" :content="tooltipContent" placement="bottom">
|
||||
<el-button class="d2-ml-0 d2-mr btn-text can-hover" type="text" @click="handleClick">
|
||||
<el-badge v-if="logLength > 0" :max="99" :value="logLengthError" :is-dot="logLengthError === 0">
|
||||
<d2-icon :name="logLengthError === 0 ? 'dot-circle-o' : 'bug'" style="font-size: 20px"/>
|
||||
</el-badge>
|
||||
<d2-icon
|
||||
v-else
|
||||
name="dot-circle-o"
|
||||
style="font-size: 20px"/>
|
||||
<d2-icon v-else name="dot-circle-o" style="font-size: 20px"/>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
@@ -1,39 +1,13 @@
|
||||
<template>
|
||||
<el-table
|
||||
:data="list"
|
||||
v-bind="table">
|
||||
<el-table-column
|
||||
prop="title"
|
||||
align="center"
|
||||
width="160"/>
|
||||
<el-table-column
|
||||
label="预览"
|
||||
width="120">
|
||||
<div
|
||||
slot-scope="scope"
|
||||
class="theme-preview"
|
||||
:style="{
|
||||
backgroundImage: `url(${$baseUrl}${scope.row.preview})`
|
||||
}">
|
||||
</div>
|
||||
<el-table :data="list" v-bind="table">
|
||||
<el-table-column prop="title" align="center" width="160"/>
|
||||
<el-table-column label="预览" width="120">
|
||||
<div slot-scope="scope" class="theme-preview" :style="{ backgroundImage: `url(${$baseUrl}${scope.row.preview})` }"/>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="address"
|
||||
align="center">
|
||||
<el-table-column prop="address" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-if="activeName === scope.row.name"
|
||||
type="success"
|
||||
icon="el-icon-check"
|
||||
round>
|
||||
已激活
|
||||
</el-button>
|
||||
<el-button
|
||||
v-else
|
||||
round
|
||||
@click="handleSelectTheme(scope.row.name)">
|
||||
使用
|
||||
</el-button>
|
||||
<el-button v-if="activeName === scope.row.name" type="success" icon="el-icon-check" round>已激活</el-button>
|
||||
<el-button v-else round @click="handleSelectTheme(scope.row.name)">使用</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 创建 el-menu-item
|
||||
export function elMenuItem (createElement, menu) {
|
||||
return createElement('el-menu-item', { props: { index: menu.path } }, [
|
||||
return createElement('el-menu-item', { key: menu.path, props: { index: menu.path } }, [
|
||||
...menu.icon ? [
|
||||
createElement('i', { attrs: { class: `fa fa-${menu.icon}` } })
|
||||
] : [],
|
||||
@@ -16,7 +16,7 @@ export function elMenuItem (createElement, menu) {
|
||||
|
||||
// 创建 el-submenu
|
||||
export function elSubmenu (createElement, menu) {
|
||||
return createElement('el-submenu', { props: { index: menu.path } }, [
|
||||
return createElement('el-submenu', { key: menu.path, props: { index: menu.path } }, [
|
||||
...menu.icon ? [
|
||||
createElement('i', { slot: 'title', attrs: { class: `fa fa-${menu.icon}` } })
|
||||
] : [],
|
||||
|
||||
@@ -11,7 +11,7 @@ export default {
|
||||
render (createElement) {
|
||||
return createElement('div', { attrs: { class: 'd2-layout-header-aside-menu-side' } }, [
|
||||
createElement('el-menu', {
|
||||
props: { collapse: this.asideCollapse, uniqueOpened: true, defaultActive: this.active },
|
||||
props: { collapse: this.asideCollapse, uniqueOpened: true, defaultActive: this.$route.fullPath },
|
||||
ref: 'menu',
|
||||
on: { select: this.handleMenuSelect }
|
||||
}, this.aside.map(menu => (menu.children === undefined ? elMenuItem : elSubmenu).call(this, createElement, menu))),
|
||||
@@ -25,7 +25,6 @@ export default {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
active: '',
|
||||
asideHeight: 300,
|
||||
BS: null
|
||||
}
|
||||
@@ -43,13 +42,6 @@ export default {
|
||||
setTimeout(() => {
|
||||
this.scrollInit()
|
||||
}, 500)
|
||||
},
|
||||
// 监听路由 控制侧边栏激活状态
|
||||
'$route.fullPath': {
|
||||
handler (value) {
|
||||
this.active = value
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
<template>
|
||||
<div
|
||||
class="panel-search"
|
||||
flex="dir:top">
|
||||
<div
|
||||
class="panel-search__input-group"
|
||||
flex-box="0"
|
||||
flex="dir:top main:center cross:center"
|
||||
@click.self="handlePanelClick">
|
||||
<d2-icon-svg
|
||||
class="panel-search__logo"
|
||||
name="d2-admin-text"/>
|
||||
<div class="panel-search" flex="dir:top">
|
||||
<div class="panel-search__input-group" flex-box="0" flex="dir:top main:center cross:center" @click.self="handlePanelClick">
|
||||
<d2-icon-svg class="panel-search__logo" name="d2-admin-text"/>
|
||||
<el-autocomplete
|
||||
class="panel-search__input"
|
||||
ref="input"
|
||||
@@ -21,9 +13,7 @@
|
||||
:clearable="true"
|
||||
@keydown.esc.native="handleEsc"
|
||||
@select="handleSelect">
|
||||
<d2-panel-search-item
|
||||
slot-scope="{ item }"
|
||||
:item="item"/>
|
||||
<d2-panel-search-item slot-scope="{ item }" :item="item"/>
|
||||
</el-autocomplete>
|
||||
<div class="panel-search__tip">
|
||||
您可以使用快捷键
|
||||
@@ -33,10 +23,7 @@
|
||||
关闭
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="resultsList.length > 0"
|
||||
class="panel-search__results-group"
|
||||
flex-box="1">
|
||||
<div v-if="resultsList.length > 0" class="panel-search__results-group" flex-box="1">
|
||||
<el-card>
|
||||
<div class="panel-search__results-group-inner">
|
||||
<d2-panel-search-item
|
||||
|
||||
@@ -2,13 +2,8 @@
|
||||
<div class="d2-multiple-page-control-group" flex>
|
||||
<div class="d2-multiple-page-control-content" flex-box="1">
|
||||
<div class="d2-multiple-page-control-content-inner">
|
||||
<d2-contextmenu
|
||||
:visible.sync="contextmenuFlag"
|
||||
:x="contentmenuX"
|
||||
:y="contentmenuY">
|
||||
<d2-contextmenu-list
|
||||
:menulist="tagName === '/index' ? contextmenuListIndex : contextmenuList"
|
||||
@rowClick="contextmenuClick"/>
|
||||
<d2-contextmenu :visible.sync="contextmenuFlag" :x="contentmenuX" :y="contentmenuY">
|
||||
<d2-contextmenu-list :menulist="tagName === '/index' ? contextmenuListIndex : contextmenuList" @rowClick="contextmenuClick"/>
|
||||
</d2-contextmenu>
|
||||
<el-tabs
|
||||
class="d2-multiple-page-control d2-multiple-page-sort"
|
||||
@@ -18,22 +13,12 @@
|
||||
@tab-click="handleClick"
|
||||
@edit="handleTabsEdit"
|
||||
@contextmenu.native="handleContextmenu">
|
||||
<el-tab-pane
|
||||
v-for="page in opened"
|
||||
:key="page.fullPath"
|
||||
:label="page.meta.title || '未命名'"
|
||||
:name="page.fullPath"/>
|
||||
<el-tab-pane v-for="page in opened" :key="page.fullPath" :label="page.meta.title || '未命名'" :name="page.fullPath"/>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="d2-multiple-page-control-btn"
|
||||
flex-box="0">
|
||||
<el-dropdown
|
||||
size="default"
|
||||
split-button
|
||||
@click="closeAll"
|
||||
@command="command => handleControlItemClick(command)">
|
||||
<div class="d2-multiple-page-control-btn" flex-box="0">
|
||||
<el-dropdown size="default" split-button @click="closeAll" @command="command => handleControlItemClick(command)">
|
||||
<d2-icon name="times-circle"/>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="left">
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
<template>
|
||||
<div
|
||||
class="d2-layout-header-aside-group"
|
||||
:style="styleLayoutMainGroup"
|
||||
:class="{grayMode: grayActive}">
|
||||
<div class="d2-layout-header-aside-group" :style="styleLayoutMainGroup" :class="{grayMode: grayActive}">
|
||||
<!-- 半透明遮罩 -->
|
||||
<div class="d2-layout-header-aside-mask"></div>
|
||||
<!-- 主体内容 -->
|
||||
<div class="d2-layout-header-aside-content" flex="dir:top">
|
||||
<!-- 顶栏 -->
|
||||
<div
|
||||
class="d2-theme-header"
|
||||
:style="{
|
||||
opacity: this.searchActive ? 0.5 : 1
|
||||
}"
|
||||
flex-box="0"
|
||||
flex>
|
||||
<div class="d2-theme-header" :style="{ opacity: this.searchActive ? 0.5 : 1 }" flex-box="0" flex>
|
||||
<router-link to="/index" class="logo-group" :style="{width: asideCollapse ? asideWidthCollapse : asideWidth}" flex-box="0">
|
||||
<img v-if="asideCollapse" :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/icon-only.png`">
|
||||
<img v-else :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/all.png`">
|
||||
@@ -39,14 +30,7 @@
|
||||
<!-- 下面 主体 -->
|
||||
<div class="d2-theme-container" flex-box="1" flex>
|
||||
<!-- 主体 侧边栏 -->
|
||||
<div
|
||||
flex-box="0"
|
||||
ref="aside"
|
||||
class="d2-theme-container-aside"
|
||||
:style="{
|
||||
width: asideCollapse ? asideWidthCollapse : asideWidth,
|
||||
opacity: this.searchActive ? 0.5 : 1
|
||||
}">
|
||||
<div flex-box="0" ref="aside" class="d2-theme-container-aside" :style="{ width: asideCollapse ? asideWidthCollapse : asideWidth, opacity: this.searchActive ? 0.5 : 1 }">
|
||||
<d2-menu-side/>
|
||||
</div>
|
||||
<!-- 主体 -->
|
||||
@@ -54,9 +38,7 @@
|
||||
<!-- 搜索 -->
|
||||
<transition name="fade-scale">
|
||||
<div v-if="searchActive" class="d2-theme-container-main-layer" flex>
|
||||
<d2-panel-search
|
||||
ref="panelSearch"
|
||||
@close="searchPanelClose"/>
|
||||
<d2-panel-search ref="panelSearch" @close="searchPanelClose"/>
|
||||
</div>
|
||||
</transition>
|
||||
<!-- 内容 -->
|
||||
@@ -136,11 +118,9 @@ export default {
|
||||
* @description 最外层容器的背景图片样式
|
||||
*/
|
||||
styleLayoutMainGroup () {
|
||||
return {
|
||||
...this.themeActiveSetting.backgroundImage ? {
|
||||
backgroundImage: `url('${this.$baseUrl}${this.themeActiveSetting.backgroundImage}')`
|
||||
} : {}
|
||||
}
|
||||
return this.themeActiveSetting.backgroundImage
|
||||
? { backgroundImage: `url('${this.$baseUrl}${this.themeActiveSetting.backgroundImage}')` }
|
||||
: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
+1
-2
@@ -9,8 +9,7 @@ import store from '@/store/index'
|
||||
|
||||
// 菜单和路由设置
|
||||
import router from './router'
|
||||
import menuHeader from '@/menu/header'
|
||||
import menuAside from '@/menu/aside'
|
||||
import { menuHeader, menuAside } from '@/menu'
|
||||
import { frameInRoutes } from '@/router/routes'
|
||||
|
||||
// 核心插件
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
// 菜单 侧边栏
|
||||
export default [
|
||||
{ path: '/index', title: '首页', icon: 'home' },
|
||||
{
|
||||
title: '页面',
|
||||
icon: 'folder-o',
|
||||
children: [
|
||||
{ path: '/page1', title: '页面 1' },
|
||||
{ path: '/page2', title: '页面 2' },
|
||||
{ path: '/page3', title: '页面 3' }
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -1,13 +0,0 @@
|
||||
// 菜单 顶栏
|
||||
export default [
|
||||
{ path: '/index', title: '首页', icon: 'home' },
|
||||
{
|
||||
title: '页面',
|
||||
icon: 'folder-o',
|
||||
children: [
|
||||
{ path: '/page1', title: '页面 1' },
|
||||
{ path: '/page2', title: '页面 2' },
|
||||
{ path: '/page3', title: '页面 3' }
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,42 @@
|
||||
import { uniqueId } from 'lodash'
|
||||
|
||||
/**
|
||||
* @description 给菜单数据补充上 path 字段
|
||||
* @description https://github.com/d2-projects/d2-admin/issues/209
|
||||
* @param {Array} menu 原始的菜单数据
|
||||
*/
|
||||
function supplementPath (menu) {
|
||||
return menu.map(e => ({
|
||||
...e,
|
||||
path: e.path || uniqueId('d2-menu-empty-'),
|
||||
...e.children ? {
|
||||
children: supplementPath(e.children)
|
||||
} : {}
|
||||
}))
|
||||
}
|
||||
|
||||
export const menuHeader = supplementPath([
|
||||
{ path: '/index', title: '首页', icon: 'home' },
|
||||
{
|
||||
title: '页面',
|
||||
icon: 'folder-o',
|
||||
children: [
|
||||
{ path: '/page1', title: '页面 1' },
|
||||
{ path: '/page2', title: '页面 2' },
|
||||
{ path: '/page3', title: '页面 3' }
|
||||
]
|
||||
}
|
||||
])
|
||||
|
||||
export const menuAside = supplementPath([
|
||||
{ path: '/index', title: '首页', icon: 'home' },
|
||||
{
|
||||
title: '页面',
|
||||
icon: 'folder-o',
|
||||
children: [
|
||||
{ path: '/page1', title: '页面 1' },
|
||||
{ path: '/page2', title: '页面 2' },
|
||||
{ path: '/page3', title: '页面 3' }
|
||||
]
|
||||
}
|
||||
])
|
||||
@@ -4,7 +4,10 @@ export default function (Mock) {
|
||||
Mock.XHR.prototype.send = function () {
|
||||
if (this.custom.xhr) {
|
||||
this.custom.xhr.withCredentials = this.withCredentials || false
|
||||
this.custom.xhr.responseType = this.responseType
|
||||
// https://github.com/d2-projects/d2-admin/issues/254
|
||||
if (!this.custom.async) {
|
||||
this.custom.xhr.responseType = this.responseType
|
||||
}
|
||||
}
|
||||
this.__send.apply(this, arguments)
|
||||
}
|
||||
|
||||
@@ -12,18 +12,11 @@ export default {
|
||||
* @param {Object} context
|
||||
*/
|
||||
listen ({ commit }) {
|
||||
return new Promise(resolve => {
|
||||
if (screenfull.enabled) {
|
||||
screenfull.on('change', () => {
|
||||
console.log('1')
|
||||
if (!screenfull.isFullscreen) {
|
||||
commit('set', false)
|
||||
}
|
||||
})
|
||||
}
|
||||
// end
|
||||
resolve()
|
||||
})
|
||||
if (screenfull.isEnabled) {
|
||||
screenfull.on('change', () => {
|
||||
if (!screenfull.isFullscreen) commit('set', false)
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @description 切换全屏
|
||||
|
||||
+27
-19
@@ -3,6 +3,7 @@ const VueFilenameInjector = require('@d2-projects/vue-filename-injector')
|
||||
const ThemeColorReplacer = require('webpack-theme-color-replacer')
|
||||
const forElementUI = require('webpack-theme-color-replacer/forElementUI')
|
||||
const cdnDependencies = require('./dependencies-cdn')
|
||||
const { chain, set, each, keys } = require('lodash')
|
||||
|
||||
// 拼接路径
|
||||
const resolve = dir => require('path').join(__dirname, dir)
|
||||
@@ -16,7 +17,7 @@ let publicPath = process.env.VUE_APP_PUBLIC_PATH || '/'
|
||||
|
||||
// 设置不参与构建的库
|
||||
let externals = {}
|
||||
cdnDependencies.forEach(package => { externals[package.name] = package.library })
|
||||
cdnDependencies.forEach(pkg => { externals[pkg.name] = pkg.library })
|
||||
|
||||
// 引入文件的 cdn 链接
|
||||
const cdn = {
|
||||
@@ -24,12 +25,20 @@ const cdn = {
|
||||
js: cdnDependencies.map(e => e.js).filter(e => e)
|
||||
}
|
||||
|
||||
// 多页配置,默认未开启,如需要请参考 https://cli.vuejs.org/zh/config/#pages
|
||||
const pages = undefined
|
||||
// const pages = {
|
||||
// index: './src/main.js',
|
||||
// subpage: './src/subpage.js'
|
||||
// }
|
||||
|
||||
module.exports = {
|
||||
// 根据你的实际情况更改这里
|
||||
publicPath,
|
||||
lintOnSave: true,
|
||||
devServer: {
|
||||
publicPath // 和 publicPath 保持一致
|
||||
publicPath, // 和 publicPath 保持一致
|
||||
disableHostCheck: process.env.NODE_ENV === 'development' // 关闭 host check,方便使用 ngrok 之类的内网转发工具
|
||||
},
|
||||
css: {
|
||||
loaderOptions: {
|
||||
@@ -39,6 +48,7 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
},
|
||||
pages,
|
||||
configureWebpack: config => {
|
||||
const configNew = {}
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
@@ -54,27 +64,23 @@ module.exports = {
|
||||
})
|
||||
]
|
||||
}
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// 关闭 host check,方便使用 ngrok 之类的内网转发工具
|
||||
configNew.devServer = {
|
||||
disableHostCheck: true
|
||||
}
|
||||
}
|
||||
return configNew
|
||||
},
|
||||
// 默认设置: https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-service/lib/config/base.js
|
||||
chainWebpack: config => {
|
||||
/**
|
||||
* 添加 CDN 参数到 htmlWebpackPlugin 配置中
|
||||
* 已适配多页
|
||||
*/
|
||||
config.plugin('html').tap(args => {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
args[0].cdn = cdn
|
||||
} else {
|
||||
args[0].cdn = []
|
||||
}
|
||||
return args
|
||||
const htmlPluginNames = chain(pages).keys().map(page => 'html-' + page).value()
|
||||
const targetHtmlPluginNames = htmlPluginNames.length ? htmlPluginNames : ['html']
|
||||
each(targetHtmlPluginNames, name => {
|
||||
config.plugin(name).tap(options => {
|
||||
set(options, '[0].cdn', process.env.NODE_ENV === 'production' ? cdn : [])
|
||||
return options
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
* 删除懒加载模块的 prefetch preload,降低带宽压力
|
||||
* https://cli.vuejs.org/zh/guide/html-and-static-assets.html#prefetch
|
||||
@@ -140,11 +146,13 @@ module.exports = {
|
||||
config.resolve.alias
|
||||
.set('@api', resolve('src/api'))
|
||||
// 判断环境加入模拟数据
|
||||
const entry = config.entry('app')
|
||||
// 已适配多页
|
||||
if (process.env.VUE_APP_BUILD_MODE !== 'NOMOCK') {
|
||||
entry
|
||||
.add('@/mock')
|
||||
.end()
|
||||
const multiEntry = keys(pages || {})
|
||||
const entrys = multiEntry.length ? multiEntry : ['app']
|
||||
each(entrys, entry => {
|
||||
config.entry(entry).add('@/mock').end()
|
||||
})
|
||||
}
|
||||
// 分析工具
|
||||
if (process.env.npm_config_report) {
|
||||
|
||||
Reference in New Issue
Block a user