master
toesbieya 6 years ago
parent 403992625c
commit 9e41c496db
  1. 5
      vue/src/assets/styles/sidebar.scss
  2. 3
      vue/src/assets/styles/variables.scss
  3. 12
      vue/src/layout/components/Sidebar/components/SidebarItem.vue
  4. 8
      vue/src/store/modules/resource.js
  5. 47
      vue/src/views/index/components/PanelGroup/PanelGroupItem.vue
  6. 13
      vue/src/views/index/components/PanelGroup/index.vue
  7. 4
      vue/src/views/userCenter/components/UserCard.vue

@ -116,10 +116,11 @@ $iconSize: 17px;
.popover-menu__title {
cursor: auto;
text-align: center;
color: $menuText;
border-bottom: 1px solid $subMenuBg;
&.is-disabled {
opacity: 1;
&.el-menu-item:hover {
background-color: $menuBg;
}
}
}

@ -31,7 +31,8 @@ $--color-info: $--color-teal;
}
// sidebar
$menuText: #bfcbd9;
//$menuText: #bfcbd9;
$menuText: #D6E2F0;
$menuBg: #304156;
$menuHover: #263445;
$subMenuBg: #1f2d3d;

@ -9,11 +9,11 @@
}
function getOnlyChild(item) {
const showingChildren = item.children || []
const children = item.children || []
if (showingChildren.length === 1) return showingChildren[0]
if (children.length === 1) return children[0]
if (showingChildren.length <= 0) return {...item, path: undefined, children: undefined}
if (children.length < 1) return {...item, path: undefined, children: undefined}
return null
}
@ -31,7 +31,7 @@
function renderNode({item, isNest, showParent, collapse, basePath}) {
let onlyOneChild = getOnlyChild(item)
const showSingle = onlyOneChild && !onlyOneChild.children && !item.alwaysShow
const showSingle = onlyOneChild && !onlyOneChild.children
if (showSingle) {
const index = resolvePath(basePath, onlyOneChild.path)
@ -64,9 +64,9 @@
//
if (showParent) {
children.unshift(
<el-menu-item class="popover-menu__title" disabled>
<div class="popover-menu__title el-menu-item">
<SidebarItemContent icon={icon} title={title}/>
</el-menu-item>
</div>
)
}
}

@ -68,7 +68,7 @@ const actions = {
}
}
//原始路由数组基础上添加全路径
//原始路由数组基础上添加全路径
function transformOriginRoutes(routes) {
let res = JSON.parse(JSON.stringify(routes))
@ -90,7 +90,7 @@ function clean(routes, cleanHidden = true) {
}
if (routes[i].children) {
clean(routes[i].children, cleanHidden)
if (routes[i].children.length < 1) {
if (routes[i].children.length < 1 && routes[i].alwaysShow !== true) {
routes.splice(i, 1)
}
}
@ -111,14 +111,14 @@ function getAuthorizedRoutes({resources, admin}) {
if (admin === 1) return finalAuthorityRoutes
if (!resources) return []
let arr = JSON.parse(JSON.stringify(finalAuthorityRoutes))
filter(arr, i => i.fullPath in resources)
filter(arr, i => !needAuth(i) || i.fullPath in resources)
return arr
}
//若没有children且未通过,则删除,若有,当children长度为0时删除
function filter(arr, fun) {
for (let i = 0; i < arr.length; i++) {
if (!arr[i].children && needAuth(arr[i]) && !fun(arr[i])) {
if (!arr[i].children && !fun(arr[i])) {
arr.splice(i, 1)
i--
continue

@ -1,45 +1,28 @@
<template>
<el-row
class="card-panel"
type="flex"
justify="space-between"
@mouseout.native="mouseout"
@mouseover.native="mouseover"
>
<div class="card-panel-icon-wrapper" :style="style">
<svg-icon :icon="icon" class-name="card-panel-icon"/>
</div>
<div class="card-panel-description">
<div class="card-panel-text">{{text}}</div>
<count-to class="card-panel-num" :duration="2000" :end-val="value" :start-val="0"/>
</div>
</el-row>
</template>
<script>
<script type="text/jsx">
import CountTo from 'vue-count-to'
export default {
name: "PanelGroupItem",
components: {CountTo},
functional: true,
props: {
icon: String,
color: String,
text: String,
value: Number
},
data() {
return {
style: 'color:' + this.color
}
},
methods: {
mouseout() {
this.style = 'color:' + this.color
},
mouseover() {
this.style = 'background:' + this.color
}
render(h, context) {
const {icon, color, text, value} = context.props
return (
<el-row class="card-panel" type="flex" justify="space-between">
<div class="card-panel-icon-wrapper" style={'color:' + color}>
<svg-icon icon={icon} class-name="card-panel-icon"/>
</div>
<div class="card-panel-description">
<div class="card-panel-text">{text}</div>
<CountTo class="card-panel-num" end-val={value} start-val={0}/>
</div>
</el-row>
)
}
}
</script>

@ -1,7 +1,7 @@
<template>
<el-row :gutter="40" class="panel-group">
<el-col v-for="i in list" :key="i.id" :xs="12" :sm="12" :lg="6">
<panel-group-item :ref="i.id" v-bind="i" @click.native="jump(i)"/>
<panel-group-item v-bind="i" @click.native="jump(i)"/>
</el-col>
</el-row>
</template>
@ -29,8 +29,8 @@
value: 0,
text: '今日采购额'
},
{id: 'sell', path: '/sell/order', icon: 'sell', color: variables.danger, value: 0, text: '今日销售额'},
{id: 'profit', icon: 'money', color: variables.info, value: 0, text: '今日毛利润'},
{id: 'sell', path: '/sell/order', icon: 'sell', color: variables.warning, value: 0, text: '今日销售额'},
{id: 'profit', icon: 'money', color: variables.success, value: 0, text: '今日毛利润'},
]
}
},
@ -46,11 +46,8 @@
})
.finally(() => this.loading = false)
},
jump({id, path}) {
if (!isEmpty(path) && auth(path)) {
this.$router.push(path)
this.$refs[id][0].mouseout()
}
jump({path}) {
if (!isEmpty(path) && auth(path)) this.$router.push(path)
}
},
mounted() {

@ -8,14 +8,14 @@
</div>
</div>
<div class="user-bio">
<!--<div class="user-bio">
<div class="user-bio-section">
<div class="user-bio-section-header">
<i class="el-icon-lock"/>
<span>修改锁屏密码</span>
</div>
</div>
</div>
</div>-->
</el-card>
</template>

Loading…
Cancel
Save