200 lines
5.7 KiB
Vue
200 lines
5.7 KiB
Vue
<template>
|
||
<view class="home_content">
|
||
<view class="zd-row header">
|
||
<view class="zd-col-8 home_title">首页</view>
|
||
<view class="zd-col-8 zd-row jcflexend home_userinfo">
|
||
<view class="user_icon"></view>
|
||
<view class="user_name">{{userName}}</view>
|
||
<view class="exit_text" @tap="Quit">退出</view>
|
||
</view>
|
||
</view>
|
||
<view class="welcome_text_wraper">
|
||
<view class="welcome_text">{{userName}}, 欢迎进入诺力三期平板系统!</view>
|
||
</view>
|
||
<view class="zd_wrapper">
|
||
<view class="zd-row menu-wrap">
|
||
<view class="menu-item" v-for="(e, i) in menuList" :key="i" @tap="toPage(e)">
|
||
<view class="menu_name_bg" :class="'bg_texture_' + i">
|
||
<view class="menu-name">{{e.name}}</view>
|
||
<view v-show="Number(e.counts) > 0" class="bill_count">{{e.counts}}</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="left_bg"></view>
|
||
<view class="left_bg right_bg"></view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import { sendWebsocket, closeWebsocket } from '@/utils/websocket.js'
|
||
export default {
|
||
data() {
|
||
return {
|
||
intervalId: null,
|
||
userName: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).username : '',
|
||
menuList: []
|
||
};
|
||
},
|
||
onLoad() {
|
||
// setTimeout(() => {
|
||
// uni.showLoading({
|
||
// title: '加载中...'
|
||
// })
|
||
// }, 200)
|
||
this._getBillsCount()
|
||
},
|
||
beforeDestroy () {
|
||
closeWebsocket(true)
|
||
clearTimeout(this.intervalId)
|
||
this.intervalId = null
|
||
},
|
||
destroyed () {
|
||
closeWebsocket(true)
|
||
clearTimeout(this.intervalId)
|
||
this.intervalId = null
|
||
},
|
||
methods: {
|
||
_getBillsCount () {
|
||
let getTimestamp = new Date().getTime()
|
||
let url = this.$store.getters.baseUrl
|
||
url = url.substring(7)
|
||
sendWebsocket('ws://' + url + '/webSocket/SendHomeInfo/' + getTimestamp, {}, this.wsMessage, this.wsErr)
|
||
},
|
||
wsMessage (res) {
|
||
console.log(res)
|
||
clearTimeout(this.intervalId)
|
||
// uni.hideLoading()
|
||
this.menuList = [...res]
|
||
},
|
||
wsErr () {
|
||
this.intervalId = setTimeout(() => {
|
||
this._getBillsCount()
|
||
}, 10000)
|
||
},
|
||
toPage (e) {
|
||
let url = ''
|
||
url = '/pages/management/in-storage?id=' + e.djlx + '&name=' + e.name + '&type=' + e.ywlx
|
||
uni.navigateTo({
|
||
url: url
|
||
})
|
||
},
|
||
Quit () {
|
||
this.$store.dispatch('delUserInfo', '')
|
||
uni.redirectTo({
|
||
url: '/pages/login/login'
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="stylus">
|
||
@import '../../common/style/mixin.styl';
|
||
.home_content
|
||
position relative
|
||
_wh(100%, 100%)
|
||
_bis(,'../../static/images/home_bg.jpg', 100%, 100%,bottom)
|
||
.header
|
||
height 60px
|
||
padding 0 15px
|
||
align-items flex-start
|
||
justify-content flex-end
|
||
_bis(,'../../static/images/header_bg.png', 100%, 100%,bottom)
|
||
.home_title
|
||
_font(25px,35px,#F6F9FE,,center)
|
||
font-family: YouSheBiaoTiHei;
|
||
.home_userinfo
|
||
height 35px
|
||
.user_icon
|
||
_wh(25px, 25px)
|
||
margin-right 5px
|
||
_bis(,'../../static/images/user_icon.png', 100%, 100%,center)
|
||
.user_name
|
||
_font(17px,17px,#fff,,center)
|
||
padding-right 5px
|
||
margin 9px 10px 9px 0
|
||
border-right 1px solid #AECAF5
|
||
.exit_text
|
||
height 30px
|
||
_font(14px,30px,#fff,,center)
|
||
padding 0 10px
|
||
margin 2.5px 0
|
||
_bis(,'../../static/images/state-item_bg.png', 100%, 100%,center)
|
||
.welcome_text_wraper
|
||
height 70px
|
||
margin 0 50px
|
||
.welcome_text
|
||
_font(26px, 70px, #F6F9FE,,)
|
||
padding-left 20px
|
||
font-family: YouSheBiaoTiHei
|
||
background: linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(49,190,255,0.9) 0%, rgba(239,252,254,1) 40%);
|
||
-webkit-background-clip: text;
|
||
-webkit-text-fill-color: transparent;
|
||
.zd_wrapper
|
||
_wh(calc(100% - 100px),calc(100% - 180px)) /** 120rpx + 200rpx + 130rpx */
|
||
margin 20px 50px 0 50px
|
||
_bis(,'../../static/images/bg-task-r2.png', 100%, 100%,center)
|
||
.menu-wrap
|
||
flex-wrap wrap
|
||
justify-content flex-start
|
||
align-content center
|
||
height 100%
|
||
.menu-item
|
||
width 20%
|
||
margin 20px 0
|
||
.menu_name_bg
|
||
position relative
|
||
_wh(100px, 100px)
|
||
margin 0 auto
|
||
border-radius 20px
|
||
background-image: radial-gradient( ellipse farthest-corner at 11px 11px , #afafb9, #afafb9 50%, #ffffff 50%);
|
||
background-size: 11px 11px;
|
||
.bg_texture_1, .bg_texture_7
|
||
background: repeating-linear-gradient( -45deg, #afafb9, #afafb9 5px, #ffffff 5px, #ffffff 8px );
|
||
.menu-name
|
||
background-color rgba(49, 95, 255, 0.8)
|
||
.bg_texture_3, .bg_texture_6
|
||
background-image: repeating-linear-gradient(45deg, #afafb9 25%, transparent 25%, transparent 75%, #afafb9 75%, #afafb9), repeating-linear-gradient(45deg, #afafb9 25%, #ffffff 25%, #ffffff 75%, #afafb9 75%, #afafb9);
|
||
background-position: 0 0, 11px 11px;
|
||
background-size: 22px 22px;
|
||
.menu-name
|
||
background-color rgba(0, 239, 48, 0.8)
|
||
.bg_texture_2, .bg_texture_5
|
||
background: radial-gradient(circle, transparent 20%, #ffffff 20%, #ffffff 80%, transparent 80%, transparent), radial-gradient(circle, transparent 20%, #ffffff 20%, #ffffff 80%, transparent 80%, transparent) 13.5px 13.5px, linear-gradient(#afafb9 2px, transparent 2px) 0 -2px, linear-gradient(90deg, #afafb9 2px, #ffffff 2px) -2px 0;
|
||
background-size: 27.5px 27.5px, 27.5px 27.5px, 13.75px 13.75px, 13.75px 13.75px;
|
||
.menu-name
|
||
background-color rgba(255, 189, 45, 0.8)
|
||
.bg_texture_4
|
||
.menu-name
|
||
background-color rgba(255, 139, 69, 0.8)
|
||
.menu-name
|
||
display flex
|
||
justify-content center
|
||
align-items center
|
||
_wh(100px, 100px)
|
||
padding 10px
|
||
border-radius 20px
|
||
_font(20px, 25px, #fff,bold,center)
|
||
background-color rgba(0,166,255,0.8)
|
||
.bill_count
|
||
position absolute
|
||
top -10px
|
||
right -10px
|
||
_wh(30px, 30px)
|
||
background-color $red
|
||
border-radius 50%
|
||
_font(20px, 30px, #fff,bold,center)
|
||
box-shadow 3px 3px 1px 1px rgba(0,0,0,.3)
|
||
.left_bg
|
||
position absolute
|
||
left 0
|
||
top 0
|
||
_wh(25px, 100%)
|
||
_bis(,'../../static/images/hud_left.png', 100%, ,center)
|
||
.right_bg
|
||
left auto
|
||
right 0
|
||
background-image url('../../static/images/hud_right.png')
|
||
</style>
|