Dining_Hall/pages/system.vue

272 lines
7.8 KiB
Vue

<template>
<page-meta :page-font-size="fontValue+'px'" :root-font-size="fontValue+'px'"></page-meta>
<view class="index_main" :style="{ minHeight: screenH + 'px' }">
<!-- <Navbar title="皖送e餐" :showRightText="false" :isBack="false" :showBack="false"/> -->
<Navbar title="皖送e餐" :showRightText="false" :isBack="false" :showBack="false" :leftIconSize="0"/>
<!-- <view style="height: 50px;width: 100%;text-align: center;line-height: 50px;background: #FFF;font-weight: 600;font-size: 32rpx;margin-bottom: 20rpx;">皖送e餐</view> -->
<view class="back-top"></view>
<!-- 轮播图 -->
<view class="swiper_nav">
<swiper autoplay :duration="1000">
<swiper-item v-for="(item, index) in swiperImg" :key="index">
<image :src="item" style="width: 100%; height: 100%" @click="jumpPage(index)"></image>
</swiper-item>
</swiper>
</view>
<!-- 皖送e餐 志愿者服务 -->
<view class="main_menu">
<view class="main_menu_item" v-for="(item, index) in firstMenus" :key="index" @click="handleItem(index)">
<image :src="item.icon" style="width: 120rpx;height: 120rpx;margin-bottom: 20rpx;"></image>
<view class="main_menu_name">{{ item.name }}</view>
</view>
</view>
<!-- <view style="width: 92%;margin: 40rpx auto;">
<image src="../static/images/system/banner2.png" style="width: 100%;height: 300rpx;"></image>
</view>
<view style="width: 92%;margin: 00rpx auto;">
<image src="../static/images/system/banner1.png" style="width: 100%;height: 300rpx;"></image>
</view> -->
</view>
</template>
<script>
import { getInfoNewAPI } from '@/api/login'
import { decryptWithSM4 } from '@/utils/sm'
export default {
data() {
return {
fontValue:uni.getStorageSync('fontSize') || 8,
screenH: '',
swiperImg: [require('../static/images/system/top.png'),require('../static/images/system/top1.png'),require('../static/images/system/top2.png')],
firstMenus: [
{
name: '就餐服务',
icon: require('../static/images/system/canteen.png')
},
{
name: '共享驿站',
icon: require('../static/images/system/station.png')
},
{
name: '志愿者服务',
icon: require('../static/images/system/server.png')
}
],
userInfo:{}
}
},
onShow() {
this.getUserInfo()
},
mounted() {
uni.getSystemInfo({
success: res => {
this.screenH = res.windowHeight
}
})
},
methods: {
//获取用户信息
getUserInfo(){
getInfoNewAPI({'custId':uni.getStorageSync('custId'),"sourceType":7}).then(result => {
this.userInfo = result.data;
this.$set(this.userInfo,'mobile',decryptWithSM4(this.userInfo.mobile))
this.$set(this.userInfo,'idCard',decryptWithSM4(this.userInfo.idCard))
this.$set(this.userInfo,'email',decryptWithSM4(this.userInfo.email))
//sm4加密
// let jsonStr = decryptWithSM4(result.data.data)
// this.userInfo = JSON.parse(jsonStr)
})
},
handleItem(index) {
if (index === 0) {
//运检食堂的人或在sbd食堂但可以到运检食堂吃饭的人
if(this.userInfo.orgFullName.indexOf("运检分公司食堂")>-1&&this.userInfo.orgFullName.indexOf("运检后勤食堂")==-1){
uni.navigateTo({ url: '/pages/yjCanteen' });
}else if(this.userInfo.custId=="456367498472722432"||this.userInfo.custId=="456367759735918592"||this.userInfo.custId=="456367758817366016"||this.userInfo.custId=="456367392017092608"){
uni.navigateTo({ url: '/pages/yjCanteen' });
}else if(this.userInfo.custNum&&this.userInfo.custNum.indexOf("!yjst_yj2")>-1){
uni.navigateTo({ url: '/pages/yjCanteen' });
}else{
this.$router.push({ path: '/pages/index' })
}
} else if (index === 1) {
this.$router.push({ path: '/pages/post/index' })
} else if (index === 2) {
}
},
jumpPage(index) {
if (index === 0) {
//运检食堂的人或在sbd食堂但可以到运检食堂吃饭的人
if(this.userInfo.orgFullName.indexOf("运检分公司食堂")>-1&&this.userInfo.orgFullName.indexOf("运检后勤食堂")==-1){
uni.navigateTo({ url: '/pages/yjCanteen' });
}else if(this.userInfo.custId=="456367498472722432"||this.userInfo.custId=="456367759735918592"||this.userInfo.custId=="456367758817366016"||this.userInfo.custId=="456367392017092608"){
uni.navigateTo({ url: '/pages/yjCanteen' });
}else if(this.userInfo.custNum&&this.userInfo.custNum.indexOf("!yjst_yj2")>-1){
uni.navigateTo({ url: '/pages/yjCanteen' });
}else{
this.$router.push({ path: '/pages/index' })
}
} else if (index === 1) {
this.$router.push({ path: '/pages/post/index' })
} else if (index === 2) {
this.$router.push({ path: '/pages/index' })
}
}
},
onUnload() {
// uni.showModal({
// title: "提示",
// content: "是否确认退出,您可以继续留在该页面,或者重新登录?",
// success: function (res) {
// if (res.confirm) {
// uni.redirectTo({ url: `/pages/login` });
// }
// }
// })
},
// onBackPress(e) {
// console.log(e)
// //e.from === 'backbutton' 说明如果点击的是物理返回键或导航栏的返回键就进行以下操作
// if (e.from === 'backbutton') {
// //返回值为true 时,表示不执行默认的返回(默认返回上一页),执行自定义的返回
// uni.showModal({
// title: "提示",
// content: "是否确认退出,您可以继续留在该页面,或者重新登录?",
// success: function (res) {
// if (res.confirm) {
// uni.redirectTo({ url: `/pages/login` });
// }
// }
// })
// //如果要限制必须写成true
// return true;
// }
// },
}
</script>
<style lang="scss">
page {
height: 100vh;
overflow-y: auto;
background-image: url('../static/images/system/bg.png');
}
.index_main {
/* background: #f2f6fa; */
overflow: auto;
padding: 0;
box-sizing: border-box;
}
.back-top {
position: fixed;
width: 100%;
height: 578rpx;
/* background: linear-gradient(180deg, #d2eaff 0%, rgba(208, 233, 254, 0) 100%); */
top: 0;
left: 0;
}
.swiper_nav {
width: 100%;
height: 300rpx;
/* background: #ffffff; */
border-radius: 20rpx;
padding: 0 24rpx;
box-sizing: border-box;
margin-top: 28rpx;
}
.main_menu {
display: flex;
justify-content: space-between;
margin-top: 24px;
padding: 0 12rpx;
box-sizing: border-box;
}
.main_menu_item {
z-index: 99;
margin: 0 12rpx;
padding: 28rpx 0;
flex: 1;
height: auto;
background: #ffffff;
border-radius: 20rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
.main_menu_name {
font-family: PingFang SC, PingFang SC;
font-weight: bold;
font-size: 30rpx;
color: #0e1a24;
font-style: normal;
text-transform: none;
}
image {
display: flex;
width: 88rpx;
height: 88rpx;
border-radius: 34rpx;
}
}
.yiz_menu {
width: calc(100% - 48rpx);
min-height: 480rpx;
background: #ffffff;
border-radius: 20rpx;
margin-top: 24rpx;
margin-left: 24rpx;
}
.yiz_menu_tle {
font-family: PingFang SC, PingFang SC;
font-weight: bold;
font-size: 32rpx;
color: #0e1a24;
font-style: normal;
text-transform: none;
padding: 28rpx 28rpx 0 28rpx;
}
.yiz_menu_nav {
display: flex;
align-items: center;
flex-wrap: wrap;
.yiz_menu_nav_item {
width: calc(100% / 4);
margin-top: 48rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
image {
display: block;
width: 88rpx;
height: 88rpx;
border-radius: 34rpx;
}
.yiz_menu_name {
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 28rpx;
color: #0e1a24;
font-style: normal;
text-transform: none;
margin-top: 20rpx;
}
}
}
</style>