Files
hht-tongbo-yinni/pages/home/home.vue
2023-12-25 17:58:31 +08:00

188 lines
3.9 KiB
Vue

<template>
<view class="zd_content">
<view class="header">{{$t('home.title')}}</view>
<view class="userInfo-wrap">
<view class="userInfo">
<text class="p1">{{$store.getters.userName}}</text>
<text class="p2">{{$t('home.message')}}</text>
</view>
<view class="exit" @tap="Quit">
<view class="icon-exit"></view>
<view class="exit-text">{{$t('home.exit')}}</view>
</view>
</view>
<view class="zd_wrapper zd_home_wrapper">
<view class="menu-wrap">
<view class="menu-item" v-for="(e, i) in menuList" :key="i" @tap="toPage1(e)">
<image class="menu-img" :src="require('../../static/image/menu/' + e.path + '.png')" alt="">
<view class="menu-name">{{e.name}}</view>
</view>
</view>
</view>
<view class="sec_menu_wraper" :class="show ? 'show' : 'hidden'">
<view class="cancel">
<view class="iconfont cancel_icon" @tap="show = false"></view>
</view>
<view class="sec_menu_w">
<view class="sec_menu-item" v-for="(e, i) in secM" :key="i" @click="toPage2(e)">
<view class="menu-name_inner">{{e.name}}</view>
</view>
</view>
</view>
<view v-if="show" class="modal" @click.stop="show = false"></view>
</view>
</template>
<script>
import {authority} from '@/utils/getData2.js'
export default {
data() {
return {
menuList: [],
show: false,
secM: []
};
},
created () {
this._authority()
},
methods: {
async _authority () {
let res = await authority()
this.menuList = [...res.sonTree]
},
toPage1 (e) {
if (e.sonTree.length > 0) {
this.show = true
this.secM = e.sonTree
}
},
toPage2 (e) {
let url = e.path
uni.redirectTo({
url: url
})
},
Quit () {
this.$store.dispatch('delUserInfo')
uni.redirectTo({
url: '/pages/login/login'
})
}
}
}
</script>
<style lang="stylus">
@import '../../common/style/mixin.styl';
.zd_content
padding-top 0
padding-bottom 0
height 100%
.header
height 86rpx
_font(36rpx,86rpx,#333,,center)
.userInfo-wrap
_fj()
_wh(100%,160rpx)
padding 0 30rpx
background-color $red
_bis('../../static/image/info_bg.png',auto,100%,right,bottom)
border-radius 12rpx
margin-bottom 20rpx
.userInfo
_fj(,flex-start,column)
.p1
_font(34rpx,1,#fff)
padding-bottom 18rpx
.p2
_font(26rpx,1,#fff)
.exit
_fj()
height 47rpx
padding 0 15rpx
border 1px solid #FF967C
border-radius 20rpx
.icon-exit
_wh(22rpx, 22rpx)
_bis('../../static/image/exit.png',22rpx)
.exit-text
_font(24rpx,47rpx,#fff,,right)
padding-left 10rpx
.zd_home_wrapper
height calc(100% - 286rpx)
overflow hidden
overflow-y auto
.menu-wrap
_wh(100%, auto)
_fj(flex-start,flex-start,,wrap)
align-content: flex-start
.menu-item
_fj()
flex-direction column
_wh(30%, auto)
margin-bottom 40rpx
_font(26rpx, 60rpx,#e74f1a,,center)
&:nth-child(3n+2)
margin-left 5%
margin-right 5%
::v-deep .menu-img
_wh(100%, auto)
img
position relative
opacity 1
_wh(55%, auto)
margin 0 auto 0.2rpx
.menu-name
_font(28rpx, 38rpx, #444,,center)
.sec_menu_wraper
position fixed
bottom 0
left 0
width 100%
height 70%
background-color #f4f5f5
box-shadow 0 -8px 16px 0 rgba(28,31,33,.1)
border-top-left-radius 20rpx
border-top-right-radius 20rpx
z-index 2017
transition all .3s
.modal
position fixed
bottom 0
left 0
_wh(100%, 100%)
background-color rgba(0,0,0,0.8)
z-index 2010
.sec_menu_w
width calc(100% - 76rpx)
margin 30rpx auto 0 auto
_fj(flex-start)
flex-wrap wrap
.sec_menu-item
_wh(32%, 150rpx)
margin-bottom 20rpx
background-color #fff
border 2px solid #dfe2e6
border-radius 20rpx
&:nth-child(3n+2)
margin-left 2%
margin-right 2%
.menu-name_inner
_wh(100%, 100%)
_fj(center)
_font(28rpx, 34rpx, #444,,center)
padding 10rpx
overflow hidden
.cancel
_wh(calc(100% - 76rpx), 100rpx)
margin 0 auto
padding 20rpx 0
overflow hidden
border-bottom 1px solid #c5c6c7
.show
transform: translateY(0)
.hidden
transform: translateY(100%)
</style>