Files
hht-tongbo/pages/home/home.vue

233 lines
5.7 KiB
Vue
Raw Normal View History

2022-10-10 10:19:18 +08:00
<template>
2024-03-21 13:50:55 +08:00
<view class="home_wraper">
<view class="zd_content">
<view class="header">首页</view>
<view class="userInfo-wrap">
<view class="userInfo">
<text v-if="userName !== ''" class="p1">{{userName}}</text>
<text class="p2">欢迎进入铜箔手持系统</text>
</view>
<view class="exit" @tap="Quit">
<view class="icon-exit"></view>
<view class="exit-text">退出</view>
2022-11-28 11:20:38 +08:00
</view>
</view>
2024-03-21 13:50:55 +08:00
<view class="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.title}}</view>
2022-11-28 11:20:38 +08:00
</view>
</view>
</view>
2024-03-21 13:50:55 +08:00
</view>
<view class="sec_menu_wraper" :class="show ? 'popshow' : 'pophide'">
<!-- <view class="cancel">
2022-11-28 11:20:38 +08:00
<view class="iconfont cancel_icon" @tap="show = false"></view>
2024-03-21 13:50:55 +08:00
</view> -->
<view class="line"></view>
<view class="sec_menu_w">
<view class="sec_menu-item" :style="{'background-image': 'url(' + require('../../static/image/menu/' + icon + '.png') + ')'}" v-for="(e, i) in secM" :key="i" @click="toPage2(e)">
<view class="menu-name_inner" :class="'bgc_' + (i + 1)">{{e.title}}</view>
</view>
2022-10-11 17:03:44 +08:00
</view>
2022-10-10 10:19:18 +08:00
</view>
2024-03-21 13:50:55 +08:00
<view v-if="show" class="modal" @click.stop="show = false"></view>
2022-10-10 10:19:18 +08:00
</view>
</template>
<script>
2024-03-21 13:50:55 +08:00
// import {authority} from '@/utils/getData2.js'
import {authority} from '@/utils/mork2.js'
2022-10-10 10:19:18 +08:00
export default {
data() {
return {
2024-03-21 13:50:55 +08:00
userName: '',
2022-12-08 16:49:33 +08:00
menuList: [],
show: false,
2024-03-21 13:50:55 +08:00
secM: [],
icon: ''
2022-10-10 10:19:18 +08:00
};
},
2022-12-08 16:49:33 +08:00
created () {
2024-03-21 13:50:55 +08:00
if (this.$store.getters.userInfo) {
this.userName = JSON.parse(this.$store.getters.userInfo).username
}
2022-12-08 16:49:33 +08:00
this._authority()
2022-10-10 19:58:07 +08:00
},
2022-10-10 10:19:18 +08:00
methods: {
2022-11-28 11:20:38 +08:00
async _authority () {
2024-03-21 13:50:55 +08:00
let res = await authority()
this.menuList = [...res.result.sonTree]
2022-11-28 11:20:38 +08:00
},
toPage1 (e) {
2022-12-08 16:49:33 +08:00
if (e.sonTree.length > 0) {
this.show = true
this.secM = e.sonTree
2024-03-21 13:50:55 +08:00
this.icon = e.path
2022-11-28 11:20:38 +08:00
}
2022-10-10 19:58:07 +08:00
},
2022-11-28 11:20:38 +08:00
toPage2 (e) {
let url = e.path
2022-10-10 16:26:19 +08:00
uni.redirectTo({
url: url
2022-11-28 11:20:38 +08:00
})
2022-10-12 17:12:45 +08:00
},
Quit () {
2024-03-18 13:29:46 +08:00
this.$store.dispatch('delUserInfo', '')
2022-10-10 10:19:18 +08:00
uni.redirectTo({
url: '/pages/login/login'
2022-10-12 17:12:45 +08:00
})
2022-10-10 10:19:18 +08:00
}
}
}
</script>
<style lang="stylus">
@import '../../common/style/mixin.styl';
2024-03-21 13:50:55 +08:00
.home_wraper
_wh(100%, 100%)
overflow: hidden
2022-10-15 15:29:58 +08:00
.zd_content
2024-03-21 13:50:55 +08:00
padding 0 20rpx
height calc(100% - var(--status-bar-height) - 72rpx)
// background linear-gradient(to bottom, #f8e6db 0%, #f6f6f6 30%, #f6f6f6 100%)
margin-top calc(var(--status-bar-height) + 72rpx)
2022-10-10 10:19:18 +08:00
.header
2024-03-21 13:50:55 +08:00
position fixed
left 0
top 0
padding-top var(--status-bar-height)
z-index 100
_wh(100%, calc(var(--status-bar-height) + 72rpx))
// background-color #f8e6db
_font(36rpx,72rpx,#333,,center)
2022-10-10 10:19:18 +08:00
.userInfo-wrap
_fj()
_wh(100%,160rpx)
padding 0 30rpx
2022-10-12 17:12:45 +08:00
background-color $red
2022-10-10 10:19:18 +08:00
_bis('../../static/image/info_bg.png',auto,100%,right,bottom)
2022-10-11 17:03:44 +08:00
border-radius 12rpx
2024-03-21 13:50:55 +08:00
margin-bottom 24rpx
2022-10-10 10:19:18 +08:00
.userInfo
_fj(,flex-start,column)
.p1
2024-03-21 13:50:55 +08:00
_font(32rpx,1,#fff)
2022-10-10 10:19:18 +08:00
padding-bottom 18rpx
2022-10-12 17:12:45 +08:00
.p2
2024-03-21 13:50:55 +08:00
_font(28rpx,1,#fff)
2022-10-10 10:19:18 +08:00
.exit
_fj()
2024-03-21 13:50:55 +08:00
height 48rpx
padding 0 20rpx
2022-10-12 17:12:45 +08:00
border 1px solid #FF967C
2022-10-10 10:19:18 +08:00
border-radius 20rpx
.icon-exit
2022-10-12 17:12:45 +08:00
_wh(22rpx, 22rpx)
2022-10-10 10:19:18 +08:00
_bis('../../static/image/exit.png',22rpx)
2022-10-12 17:12:45 +08:00
.exit-text
2024-03-21 13:50:55 +08:00
_font(28rpx,48rpx,#fff,,right)
2022-10-10 10:19:18 +08:00
padding-left 10rpx
2024-03-21 13:50:55 +08:00
.zd_home_wrapper
_wh(100%, calc(100% - 208rpx))
background-color #fff
border-radius: 12rpx;
padding: 24rpx 14rpx;
margin-bottom: 24rpx;
overflow-y auto
box-shadow 0 4rpx 10rpx 2rpx rgba(0,0,0,.1)
2022-10-10 10:19:18 +08:00
.menu-wrap
2024-03-21 13:50:55 +08:00
_wh(100%, auto)
2022-10-10 10:19:18 +08:00
_fj(flex-start,flex-start,,wrap)
align-content: flex-start
.menu-item
2022-11-28 11:20:38 +08:00
_fj()
flex-direction column
_wh(30%, auto)
2022-10-10 10:19:18 +08:00
margin-bottom 40rpx
2024-03-21 13:50:55 +08:00
_font(26rpx, 28rpx,#e74f1a,,center)
2022-10-10 10:19:18 +08:00
&:nth-child(3n+2)
margin-left 5%
margin-right 5%
2022-11-29 18:36:32 +08:00
::v-deep .menu-img
_wh(100%, auto)
2024-03-21 13:50:55 +08:00
margin-bottom 16rpx
2022-11-28 11:20:38 +08:00
img
2022-11-29 18:36:32 +08:00
position relative
opacity 1
2022-11-28 11:20:38 +08:00
_wh(55%, auto)
2024-03-21 13:50:55 +08:00
background-color: #f3f5f8
box-shadow 8rpx 6rpx 10rpx 0px rgba(0,0,0,0.1)
padding 16rpx
border-radius 50%
2022-11-28 11:20:38 +08:00
margin 0 auto 0.2rpx
.menu-name
2024-03-21 13:50:55 +08:00
_font(28rpx, 30rpx, #444,,center)
2022-11-28 11:20:38 +08:00
.sec_menu_wraper
2022-12-08 16:49:33 +08:00
position fixed
2024-03-21 13:50:55 +08:00
bottom 0
2022-12-08 16:49:33 +08:00
left 0
2024-03-21 13:50:55 +08:00
width 100%
background-color #f4f5f5
box-shadow 0 -8px 16px 0 rgba(28,31,33,.1)
border-top-left-radius 20rpx
border-top-right-radius 20rpx
2022-12-08 16:49:33 +08:00
z-index 2017
2024-03-21 13:50:55 +08:00
transition all .3s
.modal
position fixed
bottom 0
left 0
_wh(100%, 100%)
background-color rgba(0,0,0,0.8)
z-index 2010
2022-11-28 11:20:38 +08:00
.sec_menu_w
2024-03-21 13:50:55 +08:00
width calc(100% - 76rpx)
margin 30rpx auto 60rpx auto
_fj(flex-start)
2022-12-08 16:49:33 +08:00
flex-wrap wrap
2024-03-21 13:50:55 +08:00
.sec_menu-item
_wh(30%, 120rpx)
margin-bottom 20rpx
border-radius 10rpx
background-size 40% auto
background-position right 90%
background-repeat no-repeat
&:nth-child(3n+2)
margin-left 5%
margin-right 5%
2022-11-28 11:20:38 +08:00
.menu-name_inner
2024-03-21 13:50:55 +08:00
_wh(100%, 100%)
_fj(center)
_font(28rpx, 30rpx, #fff,,center)
border-radius 10rpx
padding 10rpx
overflow hidden
.line
_wh(90rpx, 10rpx)
background-color #e0e0e1
border-radius 4rpx
margin 20rpx auto 40rpx
2022-11-28 11:20:38 +08:00
.cancel
2024-03-21 13:50:55 +08:00
_wh(calc(100% - 76rpx), 100rpx)
margin 0 auto
padding 20rpx 0
overflow hidden
border-bottom 1px solid #c5c6c7
.bgc_1
background linear-gradient(to right, rgba(73,102,255,0.8) 0%, rgba(117,142,255,0.8) 100%)
.bgc_2
background linear-gradient(to right, rgba(254, 168, 20,0.8) 0%, rgba(255, 177, 1,0.8) 100%)
.bgc_3
background linear-gradient(to right, rgba(0, 228, 153,0.8) 0%, rgba(0, 241, 197,0.8) 100%)
.bgc_4
background linear-gradient(to right, rgba(162, 86, 171,0.8) 0%, rgba(183,120,190,0.8) 100%)
.bgc_5
background linear-gradient(to right, rgba(146, 94, 52,0.8) 0%, rgba(162, 116, 79,0.8) 100%)
.bgc_6
background linear-gradient(to right, rgba(83, 191, 194,0.8) 0%, rgba(119, 198, 201,0.8) 100%)
.bgc_7
background linear-gradient(to right, rgba(244, 97, 61,0.8) 0%, rgba(245, 130, 102,0.8) 100%)
2022-10-10 10:19:18 +08:00
</style>