Commit 55707e2c by liimin

优化

1 parent d63e1be3
......@@ -17,15 +17,21 @@
.el-tabs__item:focus.is-active.is-focus:not(:active) {
box-shadow: none !important;
}
.el-tabs__nav-scroll{
padding-left: 20px;
}
.el-color-picker__trigger{
border-color:rgba(255,255,255,.1)
}
.el-table{
&--medium td{
padding: 5px 0 !important;
padding: 10px 0 !important;
.el-button--text{
padding: 0px 0px;
}
.cell{
.el-tag{
width: 80px;
font-size: 13px;
}
}
}
margin:4px 0 !important;
}
......@@ -39,7 +45,7 @@
}
&__footer {
.el-button {
width: 200px;
width: 150px;
}
}
}
......
......@@ -130,7 +130,7 @@
}
// 折叠侧边栏切换按钮
.toggle-aside-btn {
margin-left: 26px;
margin-left: 21px;
}
// [菜单] 顶栏
.el-menu {
......@@ -245,6 +245,16 @@
.el-tabs__header.is-top {
margin: 0px;
}
.el-tabs__nav-wrap{
.el-tabs__nav-scroll{
padding-left: 20px;
}
}
.el-tabs__nav-wrap.is-scrollable{
.el-tabs__nav-scroll{
padding-left: 0;
}
}
.el-tabs__nav {
overflow: hidden;
.el-tabs__item{
......@@ -257,20 +267,19 @@
}
.d2-multiple-page-control-btn {
position: relative;
bottom: -1px;
.el-dropdown {
// .el-dropdown {
.el-button-group {
.el-button{
padding: 9px 20px;
border-bottom: none ;
padding: 10px 20px;
&:first-child {
border-bottom-left-radius: 0px;
}
&:last-child {
border-bottom-right-radius: 0px;
padding: 9px 5px;
}
}
}
// }
}
}
}
......
......@@ -83,10 +83,10 @@
// 切换按钮
.toggle-aside-btn {
// i {
fill: $theme-header-hamberg-color;
color: $theme-header-hamberg-color;
background: $theme-header-item-background-color;
&:hover {
fill: $theme-header-hamberg-color-hover;
color: $theme-header-hamberg-color-hover;
}
// }
}
......
......@@ -4,7 +4,8 @@
class="d2-header-switch"
:class="{ 'd2-header-switch--active': isActive }"
@click="handleClick">
<li :class="$store.state.d2admin.tsearch.active?'fa fa-compress':'fa fa-expand'"></li>
<d2-el-icon :name="name"/>
<!-- <li :class="$store.state.d2admin.tsearch.active?'fa fa-compress':'fa fa-expand'"></li> -->
</div>
</template>
......@@ -20,6 +21,9 @@ export default {
computed: {
show() {
return true
},
name() {
return this.$store.state.d2admin.tsearch.active ? 'top-right' : 'bottom-left'
}
},
mounted() {
......
......@@ -8,7 +8,7 @@
:data-value="item.value"
class="d2-contentmenu-item"
flex="cross:center main:center">
<d2-icon
<d2-el-icon
v-if="item.icon"
:name="item.icon"/>
<div
......
......@@ -62,7 +62,7 @@ export default {
.d2-contextmenu {
position: absolute;
padding: 5px 0;
z-index: 2018;
z-index: 2019;
background: #FFF;
border: 1px solid #cfd7e5;
border-radius: 4px;
......
<template>
<svg t="1492500959545" @click="click" class="hamburger" :class="{'is-active':isActive}" viewBox="0 0 1024 1024"
<!-- <svg t="1492500959545" @click="click" class="hamburger" :class="{'is-active':isActive}" viewBox="0 0 1024 1024"
version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1691" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64">
<path d="M966.8023 568.849776 57.196677 568.849776c-31.397081 0-56.850799-25.452695-56.850799-56.850799l0 0c0-31.397081 25.452695-56.849776 56.850799-56.849776l909.605623 0c31.397081 0 56.849776 25.452695 56.849776 56.849776l0 0C1023.653099 543.397081 998.200404 568.849776 966.8023 568.849776z"
p-id="1692"></path>
......@@ -7,7 +7,10 @@
p-id="1693"></path>
<path d="M966.8023 256.17345 57.196677 256.17345c-31.397081 0-56.850799-25.452695-56.850799-56.849776l0 0c0-31.397081 25.452695-56.850799 56.850799-56.850799l909.605623 0c31.397081 0 56.849776 25.452695 56.849776 56.850799l0 0C1023.653099 230.720755 998.200404 256.17345 966.8023 256.17345z"
p-id="1694"></path>
</svg>
</svg> -->
<div @click="click" class="hamburger" :class="{'is-active':isActive}">
<d2-el-icon name="s-fold" />
</div>
</template>
<script>
......@@ -31,16 +34,18 @@ export default {
}
</script>
<style scoped>
<style scoped lang="scss">
.hamburger {
display: inline-block;
height: 58px;
cursor: pointer;
width: 22px;
height: 60px;
transition: .38s;
transform-origin: 50% 50%;
i{
line-height: 58px;
font-size: 28px;
}
}
.hamburger.is-active {
transform: rotate(90deg);
transform: rotate(180deg);
}
</style>
......@@ -4,7 +4,7 @@
: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-el-icon v-if="active" name="aim"/>
<d2-el-icon v-else name="full-screen" style="font-size: 16px"/>
</el-button>
</el-tooltip>
......
......@@ -11,7 +11,7 @@
</el-dropdown-menu>
</el-dropdown>-->
<div v-popover:popover-personal class="d2-mr personal-wrap">
<span class="btn-text">{{info && info.userName ? `${info.userName}` : '未登录'}}</span>
<span class="btn-text">{{info && info.userName ? `${info.userName}` : '未登录'}} <d2-el-icon name="caret-bottom"/></span>
<el-popover ref="popover-personal" placement="bottom-end" trigger="hover">
<personal-panel :user="info"></personal-panel>
</el-popover>
......@@ -40,8 +40,5 @@ export default {
<style lang="scss" scoped>
.personal-wrap{
transform: translateY(-3px);
.btn-text{
text-shadow: 0 1px 1px#666;
}
}
</style>
......@@ -13,7 +13,7 @@
</div>
<div class="registe-info">
<span class="registe-info">
<li class="fa fa-clock-o"></li>
<d2-el-icon name="time"/>
有效期:{{user.validTime || '未知' }}
</span>
</div>
......@@ -25,21 +25,21 @@
</div>-->
<div class="main-operation">
<span class="main-operation-item">
<el-button size="small" icon="fa fa-male" @click="openPersonalDialog"> 个人信息</el-button>
<el-button size="small" icon="el-icon-user" @click="openPersonalDialog"> 个人信息</el-button>
</span>
<span class="main-operation-item">
<el-button size="small" icon="fa fa-key" @click="openPasswordDialog"> 修改密码</el-button>
<el-button size="small" icon="el-icon-key" @click="openPasswordDialog"> 修改密码</el-button>
</span>
</div>
<div class="other-operation" @click="clear">
<div class="other-operation-item">
<i class="fa fa-eraser"></i>
<d2-el-icon name="delete"/>
清空本地缓存
</div>
</div>
<div class="personal-footer" @click="logOut">
<el-button type="text">
<i class="fa fa-sign-out"></i>退出
<d2-el-icon name="switch-button"/> 退出
</el-button>
</div>
</div>
......@@ -205,7 +205,7 @@ export default {
color: rgb(19, 138, 156);
}
.main-operation {
padding: 8px;
padding: 2px 0;
/* background: rgba(175, 182, 179, 0.3); */
border-color: rgba(201, 206, 206, 0.2);
border-top-width: 1px;
......
......@@ -30,37 +30,52 @@
<div
class="d2-multiple-page-control-btn"
flex-box="0">
<el-dropdown
<el-button-group>
<el-button icon="el-icon-error" @click="closeAll"></el-button>
<el-button icon="el-icon-refresh" @click="reload" :disabled="current==='/index'"></el-button>
</el-button-group>
<!-- <el-dropdown
size="default"
split-button
@click="closeAll"
@command="command => handleControlItemClick(command)">
<d2-icon name="times-circle"/>
<d2-el-icon name="error"/>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="left">
<d2-icon name="arrow-left" class="d2-mr-10"/>
<el-dropdown-item command="reload">
<d2-el-icon name="refresh"/>
刷新
</el-dropdown-item>
<el-dropdown-item command="left">
<d2-el-icon name="back" class="d2-mr-10"/>
关闭左侧
</el-dropdown-item>
<el-dropdown-item command="right">
<d2-icon name="arrow-right" class="d2-mr-10"/>
<d2-el-icon name="right" class="d2-mr-10"/>
关闭右侧
</el-dropdown-item>
<el-dropdown-item command="other">
<d2-icon name="times" class="d2-mr-10"/>
<d2-el-icon name="circle-close" class="d2-mr-10"/>
关闭其它
</el-dropdown-item>
<el-dropdown-item command="all">
<d2-icon name="times-circle" class="d2-mr-10"/>
<d2-el-icon name="error" class="d2-mr-10"/>
全部关闭
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown>-->
</div>
</div>
</template>
<script>
import { mapState, mapActions } from 'vuex'
import { mapState, mapActions, mapMutations } from 'vuex'
const CMD_MAP = {
'left': 'closeLeft',
'right': 'closeRight',
'other': 'closeOther',
'all': 'closeAll',
'reload': 'reload'
}
export default {
components: {
D2Contextmenu: () => import('../contextmenu'),
......@@ -72,13 +87,13 @@ export default {
contentmenuX: 0,
contentmenuY: 0,
contextmenuListIndex: [
{ icon: 'times-circle', title: '关闭全部', value: 'all' }
{ icon: 'error', 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' }
{ icon: 'back', title: '关闭左侧', value: 'left' },
{ icon: 'right', title: '关闭右侧', value: 'right' },
{ icon: 'circle-close', title: '关闭其它', value: 'other' },
{ icon: 'error', title: '关闭全部', value: 'all' }
],
tagName: '/index'
}
......@@ -97,6 +112,7 @@ export default {
'closeOther',
'closeAll'
]),
...mapMutations('d2admin/page', ['keepAliveRemove', 'keepAlivePush']),
/**
* @description 右键菜单功能点击
*/
......@@ -134,23 +150,7 @@ export default {
const params = {
pageSelect: tagName
}
switch (command) {
case 'left':
this.closeLeft(params)
break
case 'right':
this.closeRight(params)
break
case 'other':
this.closeOther(params)
break
case 'all':
this.closeAll()
break
default:
this.$message.error('无效的操作')
break
}
this[CMD_MAP[command]](params)
},
/**
* @description 接收点击 tab 标签的事件
......@@ -163,6 +163,17 @@ export default {
this.$router.push({ name, params, query })
}
},
async reload() {
const name = this.$router.currentRoute.name
await this.keepAliveRemove(name)
await this.$router.replace('/refresh')
var __timer = setInterval(() => {
if (this.$router.currentRoute.name === name) {
clearInterval(__timer)
this.keepAlivePush(name)
}
}, 10)
},
/**
* @description 点击 tab 上的删除按钮触发这里 首页的删除按钮已经隐藏 因此这里不用判断是 index
*/
......
......@@ -48,20 +48,20 @@ export const sys = [
// },
// component: _import('system/log')
// },
// // 刷新页面 必须保留
// {
// path: '/refresh',
// name: 'refresh',
// hidden: true,
// component: _import('system/function/refresh')
// },
// // 页面重定向 必须保留
// {
// path: 'redirect/:route*',
// name: 'redirect',
// hidden: true,
// component: _import('system/function/redirect')
// }
// 刷新页面 必须保留
{
path: '/refresh',
name: 'refresh',
hidden: true,
component: _import('system/function/refresh')
},
// 页面重定向 必须保留
{
path: 'redirect/:route*',
name: 'redirect',
hidden: true,
component: _import('system/function/redirect')
}
]
/**
......
......@@ -13,14 +13,7 @@ export default {
*/
listen({ commit }) {
return new Promise(resolve => {
if (screenfull.enabled) {
screenfull.on('change', () => {
console.log('1')
if (!screenfull.isFullscreen) {
commit('set', false)
}
})
}
screenfull.enabled && screenfull.on('change', () => !screenfull.isFullscreen && commit('set', false))
// end
resolve()
})
......
......@@ -42,36 +42,47 @@ export default {
openedLoad({ state, commit, dispatch }) {
return new Promise(async resolve => {
// store 赋值
const value = await dispatch('d2admin/db/get', {
dbName: 'sys',
path: 'page.opened',
defaultValue: [home],
user: true
}, { root: true })
const value = await dispatch(
'd2admin/db/get',
{
dbName: 'sys',
path: 'page.opened',
defaultValue: [home],
user: true
},
{ root: true }
)
// 在处理函数中进行数据优化 过滤掉现在已经失效的页签或者已经改变了信息的页签
// 以 fullPath 字段为准
// 如果页面过多的话可能需要优化算法
// valid 有效列表 1, 1, 0, 1 => 有效, 有效, 失效, 有效
const valid = []
const __oSource = await dispatch('d2admin/auth/load', null, { root: true })
const __oSource = await dispatch('d2admin/auth/load', null, {
root: true
})
// 处理数据
state.opened = value.map(opened => {
// 忽略首页
if (opened.fullPath === '/index') {
valid.push(1)
setIcon(opened.meta)
return opened
}
// 尝试在所有的支持多标签页的页面里找到 name 匹配的页面
const find = state.pool.find(item => {
return item.name === opened.name && __oSource.some(obj => obj.authId === item.meta.authId)
state.opened = value
.map(opened => {
// 忽略首页
if (opened.fullPath === '/index') {
valid.push(1)
setIcon(opened.meta)
return opened
}
// 尝试在所有的支持多标签页的页面里找到 name 匹配的页面
const find = state.pool.find(item => {
return (
item.name === opened.name &&
__oSource.some(obj => obj.authId === item.meta.authId)
)
})
// 记录有效或无效信息
valid.push(find ? 1 : 0)
// 返回合并后的数据 新的覆盖旧的
// 新的数据中一般不会携带 params 和 query, 所以旧的参数会留存
return Object.assign({}, opened, find)
})
// 记录有效或无效信息
valid.push(find ? 1 : 0)
// 返回合并后的数据 新的覆盖旧的
// 新的数据中一般不会携带 params 和 query, 所以旧的参数会留存
return Object.assign({}, opened, find)
}).filter((opened, index) => valid[index] === 1)
.filter((opened, index) => valid[index] === 1)
// 标记已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
state.openedLoaded = true
// 根据 opened 数据生成缓存设置
......@@ -87,12 +98,16 @@ export default {
opend2db({ state, dispatch }) {
return new Promise(async resolve => {
// 设置数据
dispatch('d2admin/db/set', {
dbName: 'sys',
path: 'page.opened',
value: state.opened,
user: true
}, { root: true })
dispatch(
'd2admin/db/set',
{
dbName: 'sys',
path: 'page.opened',
value: state.opened,
user: true
},
{ root: true }
)
// end
resolve()
})
......@@ -103,7 +118,10 @@ export default {
* @param {Object} context
* @param {Object} payload { index, params, query, fullPath } 路由信息
*/
openedUpdate({ state, commit, dispatch }, { index, params, query, fullPath }) {
openedUpdate(
{ state, commit, dispatch },
{ index, params, query, fullPath }
) {
return new Promise(async resolve => {
// 更新页面列表某一项
const page = state.opened[index]
......@@ -242,25 +260,20 @@ export default {
* @param {Object} context
* @param {Object} payload { pageSelect: 当前选中的tagName }
*/
closeLeft({ state, commit, dispatch }, { pageSelect } = {}) {
closeLeft({ dispatch }, { pageSelect } = {}) {
return new Promise(async resolve => {
const pageAim = pageSelect || state.current
let currentIndex = 0
state.opened.forEach((page, index) => {
if (page.fullPath === pageAim) {
currentIndex = index
await dispatch('do', {
pageSelect,
call: currentIndex => {
return new Promise(async resolve => {
if (currentIndex > 0) {
// 删除打开的页面 并在缓存设置中删除
await dispatch('splice', { index: 1, howmany: currentIndex - 1 })
}
resolve()
})
}
})
if (currentIndex > 0) {
// 删除打开的页面 并在缓存设置中删除
state.opened.splice(1, currentIndex - 1).forEach(({ name }) => commit('keepAliveRemove', name))
}
state.current = pageAim
if (router.app.$route.fullPath !== pageAim) {
router.push(pageAim)
}
// 持久化
await dispatch('opend2db')
// end
resolve()
})
......@@ -273,23 +286,16 @@ export default {
*/
closeRight({ state, commit, dispatch }, { pageSelect } = {}) {
return new Promise(async resolve => {
const pageAim = pageSelect || state.current
let currentIndex = 0
state.opened.forEach((page, index) => {
if (page.fullPath === pageAim) {
currentIndex = index
await dispatch('do', {
pageSelect,
call: currentIndex => {
return new Promise(async resolve => {
// 删除打开的页面 并在缓存设置中删除
await dispatch('splice', { index: currentIndex + 1 })
resolve()
})
}
})
// 删除打开的页面 并在缓存设置中删除
state.opened.splice(currentIndex + 1).forEach(({ name }) => commit('keepAliveRemove', name))
// 设置当前的页面
state.current = pageAim
if (router.app.$route.fullPath !== pageAim) {
router.push(pageAim)
}
// 持久化
await dispatch('opend2db')
// end
resolve()
})
},
......@@ -301,27 +307,21 @@ export default {
*/
closeOther({ state, commit, dispatch }, { pageSelect } = {}) {
return new Promise(async resolve => {
const pageAim = pageSelect || state.current
let currentIndex = 0
state.opened.forEach((page, index) => {
if (page.fullPath === pageAim) {
currentIndex = index
await dispatch('do', {
pageSelect,
call: currentIndex => {
return new Promise(async resolve => {
// 删除打开的页面数据 并更新缓存设置
if (currentIndex === 0) {
await dispatch('splice', { index: 1 })
} else {
await dispatch('splice', { index: currentIndex + 1 })
await dispatch('splice', { index: 1, howmany: currentIndex - 1 })
}
resolve()
})
}
})
// 删除打开的页面数据 并更新缓存设置
if (currentIndex === 0) {
state.opened.splice(1).forEach(({ name }) => commit('keepAliveRemove', name))
} else {
state.opened.splice(currentIndex + 1).forEach(({ name }) => commit('keepAliveRemove', name))
state.opened.splice(1, currentIndex - 1).forEach(({ name }) => commit('keepAliveRemove', name))
}
// 设置新的页面
state.current = pageAim
if (router.app.$route.fullPath !== pageAim) {
router.push(pageAim)
}
// 持久化
await dispatch('opend2db')
// end
resolve()
})
......@@ -334,7 +334,10 @@ export default {
closeAll({ state, commit, dispatch }) {
return new Promise(async resolve => {
// 删除打开的页面 并在缓存设置中删除
state.opened.splice(1).forEach(({ name }) => commit('keepAliveRemove', name))
await dispatch('splice', { index: 1 })
// state.opened
// .splice(1)
// .forEach(({ name }) => commit('keepAliveRemove', name))
// 持久化
await dispatch('opend2db')
// 关闭所有的标签页后需要判断一次现在是不是在首页
......@@ -346,7 +349,50 @@ export default {
// end
resolve()
})
},
/**
* @class opened
* @description 私有公共方法
* @param {Object} context
*/
async do({ state, commit, dispatch }, { pageSelect, call }) {
return new Promise(async resolve => {
const pageAim = pageSelect || state.current
let currentIndex = 0
state.opened.forEach((page, index) => {
if (page.fullPath === pageAim) {
currentIndex = index
}
})
await call(currentIndex)
// 设置当前的页面
state.current = pageAim
if (router.app.$route.fullPath !== pageAim) {
router.push(pageAim)
}
// 持久化
await dispatch('opend2db')
// end
resolve()
})
},
/**
* @class opened
* @description 私有公共方法
* @param {Object} context
*/
splice({ state, commit }, { index, howmany }) {
return new Promise(resolve => {
if (howmany !== undefined) {
state.opened.splice(index, howmany)
} else {
state.opened.splice(index)
}
state.opened.forEach(({ name }) => commit('keepAliveRemove', name))
resolve()
})
}
},
mutations: {
/**
......@@ -355,7 +401,9 @@ export default {
* @param {Object} state state
*/
keepAliveRefresh(state) {
state.keepAlive = state.opened.filter(item => isKeepAlive(item)).map(e => e.name)
state.keepAlive = state.opened
.filter(item => isKeepAlive(item))
.map(e => e.name)
},
/**
* @description 删除一个页面的缓存设置
......
......@@ -10,9 +10,6 @@ export default {
versionShow() {
util.log.capsule(process.env.VUE_APP_TITLE, `v${process.env.VUE_APP_VERSION}`)
console.log('广联赛讯 http://www.glsx.com.cn')
// console.log('D2 Crud https://github.com/d2-projects/d2-crud')
// console.log('Document https://doc.d2admin.fairyever.com/zh/')
// console.log('请不要吝啬您的 star,谢谢 ~')
}
}
}
......@@ -73,7 +73,6 @@
<template slot-scope="scope">
<template v-if="item.prop === 'status'">
<el-tag
style="width:80px; font-size: 14px;"
:type="tag.type[scope.row.status]"
>{{tag.label[scope.row.status]}}</el-tag>
</template>
......
......@@ -82,7 +82,6 @@
<template v-if="item.prop" slot-scope="scope">
<template v-if="item.prop == 'onlineStatus'">
<el-tag
style="width: 80px; font-size: 14px;"
:type="tag.type[scope.row.onlineStatus]"
>{{tag.label[scope.row.onlineStatus]}}</el-tag>
</template>
......
......@@ -72,7 +72,7 @@
<el-table-column label="有效期" prop="validTime" width="200" align="center" ></el-table-column>
<el-table-column label="状态" prop="status" width="100" align="center">
<template slot-scope="scope">
<el-tag style="width:80px; font-size: 14px;" :type="tag.type[scope.row.status]">{{tag.label[scope.row.status]}}</el-tag>
<el-tag :type="tag.type[scope.row.status]">{{tag.label[scope.row.status]}}</el-tag>
</template>
</el-table-column>
<el-table-column label="姓名" prop="userName" width="120" align="center" ></el-table-column>
......@@ -245,7 +245,7 @@ export default {
}
this.openDialog(row)
},
handleSearch() {
async handleSearch() {
this.loadUserList()
},
// 页码
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!