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 { .popover-menu__title {
cursor: auto; cursor: auto;
text-align: center; text-align: center;
color: $menuText;
border-bottom: 1px solid $subMenuBg; border-bottom: 1px solid $subMenuBg;
&.is-disabled { &.el-menu-item:hover {
opacity: 1; background-color: $menuBg;
} }
} }
} }

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

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

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

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

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

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

Loading…
Cancel
Save