|
|
|
<template>
|
|
|
|
<view class="index-content">
|
|
|
|
<u-navbar back-icon-color='#fff' back-icon-name=''
|
|
|
|
:background="{ background: 'rgba(64, 158,255,'+bgOpacity+')'}" back-text="" title-color='#fff'
|
|
|
|
:immersive='true' :border-bottom='false' title="首页">
|
|
|
|
</u-navbar>
|
|
|
|
<view class="top">
|
|
|
|
<image src="../static/images/mobile_bg.png" class="bg" mode=""></image>
|
|
|
|
<view class="top-box" v-if="token">
|
|
|
|
<view class="info">
|
|
|
|
<image :src="$store.state.user.avatar" class="cu-avatar" mode="" v-if="$store.state.user"></image>
|
|
|
|
<view class="cu-avatar" v-else>
|
|
|
|
<u-icon name="account-fill" color="#ababab" size="100"></u-icon>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="user-info">
|
|
|
|
<view class="name" v-if="$store.state.user.name">{{$store.state.user.name}} <span v-if="$store.state.user.post">{{$store.state.user.post.name}}</span></view>
|
|
|
|
<view class="tips" v-if="$store.state.user.dept">{{$store.state.user.dept.name}}</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="top-box" v-else>
|
|
|
|
<view class="info">
|
|
|
|
<view class="cu-avatar">
|
|
|
|
<u-icon name="account-fill" color="#ababab" size="100"></u-icon>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="user-info" @click="handleLogin">
|
|
|
|
<view class="name">点击登录</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="box">
|
|
|
|
<view class="">
|
|
|
|
<view class="title">采购入库</view>
|
|
|
|
<u-row gutter="16" style="padding:0px 20rpx ;">
|
|
|
|
<block v-for="(item,index) in menus" :key="index" >
|
|
|
|
<u-col span="3" v-if="item.path == 'purchaseIn'">
|
|
|
|
<view class="icon-item" @click="open('/pages/inLocation/index')">
|
|
|
|
<image src="../static/images/icon1.png" mode=""></image>
|
|
|
|
<view>{{item.name}}</view>
|
|
|
|
</view>
|
|
|
|
</u-col>
|
|
|
|
<u-col span="3" v-else-if="item.path == 'itemIn'">
|
|
|
|
<view class="icon-item" @click="open('/pages/sparePartsReturn/addForm')">
|
|
|
|
<image src="../static/images/icon3.png" mode=""></image>
|
|
|
|
<view>{{item.name}}</view>
|
|
|
|
</view>
|
|
|
|
</u-col>
|
|
|
|
</block>
|
|
|
|
</u-row>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="">
|
|
|
|
<view class="title">出库</view>
|
|
|
|
<u-row gutter="16">
|
|
|
|
<block v-for="(item,index) in menus" :key="index" >
|
|
|
|
<u-col span="3" v-if="item.path == 'itemOut'">
|
|
|
|
<view class="icon-item" @click="open('/pages/outLocation/index')">
|
|
|
|
<image src="../static/images/icon2.png" mode=""></image>
|
|
|
|
<view>{{item.name}}</view>
|
|
|
|
</view>
|
|
|
|
</u-col>
|
|
|
|
</block>
|
|
|
|
</u-row>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="btn" @click="handleLogout" v-if="token">退出登录</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import {
|
|
|
|
getInfo
|
|
|
|
} from '@/api/login'
|
|
|
|
import {
|
|
|
|
getCounts,
|
|
|
|
getToDoCountsByUser
|
|
|
|
} from '@/api/index'
|
|
|
|
import {
|
|
|
|
getAccessToken
|
|
|
|
} from '@/utils/auth'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
bgOpacity: 0,
|
|
|
|
token: '',
|
|
|
|
menus:[]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
open(url) {
|
|
|
|
if(!this.token){
|
|
|
|
this.$tab.navigateTo('/pages/login')
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.$tab.navigateTo(url)
|
|
|
|
},
|
|
|
|
handleLogout() {
|
|
|
|
this.$modal.confirm('确定注销并退出系统吗?').then(() => {
|
|
|
|
this.$store.dispatch('LogOut').then(() => {
|
|
|
|
this.$tab.reLaunch('/pages/login')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handleLogin() {
|
|
|
|
console.log(11)
|
|
|
|
this.$tab.navigateTo('/pages/login')
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onLoad: async function() {
|
|
|
|
// if (getAccessToken()) {
|
|
|
|
// }
|
|
|
|
this.token = getAccessToken() ? getAccessToken() :''
|
|
|
|
console.log( this.$store.state)
|
|
|
|
if (getAccessToken()) {
|
|
|
|
this.$store.dispatch('GetPermissionInfo').then(res => {
|
|
|
|
this.menus = res.menus.filter(item=>item.path == '/pda')[0].children
|
|
|
|
console.log(this.menus)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
onPageScroll(e) {
|
|
|
|
if (e.scrollTop > 0) {
|
|
|
|
this.bgOpacity = e.scrollTop / 200;
|
|
|
|
} else {
|
|
|
|
this.bgOpacity = 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.index-content {
|
|
|
|
background-color: white;
|
|
|
|
min-height: 100vh;
|
|
|
|
}
|
|
|
|
|
|
|
|
.bg {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.top {
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
image {
|
|
|
|
height: calc(var(--status-bar-height) + 310rpx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.info {
|
|
|
|
position: absolute;
|
|
|
|
top: calc(var(--status-bar-height) + 110rpx);
|
|
|
|
left: 80rpx;
|
|
|
|
right: 80rpx;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
.cu-avatar {
|
|
|
|
border: 4rpx solid #eaeaea;
|
|
|
|
width: 140rpx;
|
|
|
|
height: 140rpx;
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
font-size: 80rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.user-info {
|
|
|
|
margin-left: 30rpx;
|
|
|
|
|
|
|
|
.name {
|
|
|
|
line-height: 60rpx;
|
|
|
|
font-size: 36rpx;
|
|
|
|
font-weight: bold;
|
|
|
|
line-height: 60rpx;
|
|
|
|
margin-right: 20rpx;
|
|
|
|
color: white;
|
|
|
|
|
|
|
|
span {
|
|
|
|
font-weight: normal;
|
|
|
|
font-size: 28rpx;
|
|
|
|
padding-left: 20rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.tips {
|
|
|
|
padding: 10rpx 20rpx;
|
|
|
|
background: #3952ae;
|
|
|
|
color: white;
|
|
|
|
border-radius: 50rpx;
|
|
|
|
font-size: 24rpx;
|
|
|
|
display: inline-block;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.box {
|
|
|
|
.title {
|
|
|
|
font-size: 32rpx;
|
|
|
|
font-weight: bold;
|
|
|
|
padding: 50rpx 50rpx 30rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.icon-item {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
flex-direction: column;
|
|
|
|
margin: 20rpx 0px;
|
|
|
|
|
|
|
|
image {
|
|
|
|
width: 80rpx;
|
|
|
|
height: 80rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
view {
|
|
|
|
margin-top: 20rpx;
|
|
|
|
color: #999999;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.btn {
|
|
|
|
width: calc(100vw - 60rpx);
|
|
|
|
margin: 30rpx auto;
|
|
|
|
background-color: rgb(64, 158, 255);
|
|
|
|
color: #FFFFFF;
|
|
|
|
height: 90rpx;
|
|
|
|
line-height: 90rpx;
|
|
|
|
text-align: center;
|
|
|
|
border-radius: 10rpx;
|
|
|
|
font-size: 32rpx;
|
|
|
|
}
|
|
|
|
</style>
|