天河备件pda
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

274 lines
6.6 KiB

<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="getAccessToken()">
<view class="info">
<image :src="store.avatar" class="cu-avatar" mode="" v-if="store.avatar"></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">{{store.name}}
<!-- <span v-if="store.post">{{store.post.name}}</span> -->
</view>
<!-- <view class="tips">{{store.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="" v-for="(item,index) in meaus" :key='index'>
<view class="title">{{item.name}}</view>
<u-row gutter="16" style="padding:0px 20rpx ;">
<u-col span="3" v-for="(cur,key) in item.children" :key='key'>
<view class="icon-item" @click="open(cur.path)">
<!-- 扫码图标 -->
<image src="../static/images/icon8.png" mode="" v-if="cur.componentName == 'scanCodeMeau'"></image>
<!-- 采购入库图标 -->
<image src="../static/images/icon1.png" mode="" v-else-if="cur.componentName == 'inLocation'"></image>
<!-- 备件归还图标 -->
<image src="../static/images/icon3.png" mode="" v-else-if="cur.componentName == 'sparePartsReturn'"></image>
<!-- 采购出库图标 -->
<image src="../static/images/icon2.png" mode="" v-else-if="cur.componentName == 'outLocation'"></image>
<view>{{cur.name}}</view>
</view>
</u-col>
</u-row>
</view>
<!-- <view class="">
<view class="title">扫码</view>
<u-row gutter="16" style="padding:0px 20rpx ;">
<u-col span="3">
<view class="icon-item" @click="open('/pages/scanCode/scanCode')">
<image src="../static/images/icon8.png" mode=""></image>
<view>扫码</view>
</view>
</u-col>
</u-row>
</view> -->
<!-- <view class="" v-if="menus1&&menus1.length>0">
<view class="title">采购入库</view>
<u-row gutter="16" style="padding:0px 20rpx ;">
<block v-for="(item,index) in menus1" :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="" v-if="menus2&&menus2.length>0">
<view class="title">出库</view>
<u-row gutter="16">
<block v-for="(item,index) in menus2" :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="getAccessToken()">退出登录</view>
</view>
</template>
<script setup lang="ts">
import {
onPageScroll,
onLoad
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import {
getAccessToken
} from '@/utils/auth'
import { useCountStore } from '@/store'
const { proxy } = getCurrentInstance()
// 获取自定义的store
const store = useCountStore()
const bgOpacity = ref(0)
const meaus = ref([])
// const menus2 = ref([])
function open(url) {
if (!getAccessToken()) {
proxy.$tab.navigateTo('/pages/login')
return
}
proxy.$tab.navigateTo("/" + url)
}
function handleLogout() {
proxy.$modal.confirm('确定注销并退出系统吗?').then(() => {
store.LogOut().then(() => {
proxy.$tab.reLaunch('/pages/login')
}).catch(() => { })
}).catch(() => { })
}
function handleLogin() {
proxy.$tab.navigateTo('/pages/login')
}
onLoad(async () => {
await proxy.$onLaunched;
// menus1.value = store.menus1
// menus2.value = store.menus2
meaus.value = store.meaus
console.log(meaus.value )
})
onPageScroll((e) => {
if (e.scrollTop > 0) {
bgOpacity.value = e.scrollTop / 200;
} else {
bgOpacity.value = 0
}
})
</script>
<style scoped lang="scss">
.index-content {
background-color: white;
min-height: 100vh;
padding-bottom: 20rpx;
}
.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%;
display: flex;
align-items: center;
justify-content: center;
background: white;
.icon {
font-size: 80rpx;
color: #f5f5f5;
}
}
.user-info {
margin-left: 30rpx;
flex: 1;
.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>