381 lines
11 KiB
Vue
381 lines
11 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 class="codeBtn" v-if="!isShowBtn" @click="openCode">
|
|
<view style="font-size: 36rpx;font-weight: 600;">出示二维码支付</view>
|
|
</view>
|
|
<view class="card-box" v-if="isShowBtn">
|
|
<!-- 标题 -->
|
|
<view class="title">
|
|
<view style="font-size: 44rpx;color: #333;font-weight: 600;">出示二维码支付</view>
|
|
<!-- <view @click="isShowBtn=false" style="position: absolute;right: 30rpx;">X</view> -->
|
|
<view @click="isShowBtn=false" style="position: absolute;right: 40rpx;top: 6rpx;">
|
|
<image src="../static/images/arrow2.png" style="width: 60rpx;height: 60rpx;"></image>
|
|
</view>
|
|
</view>
|
|
<!-- 副标题 -->
|
|
<view class="subtitle">{{custName}}</view>
|
|
<view style="border: 1px dashed #e9a765;width: 90%;margin: 0 auto;"></view>
|
|
<!-- 二维码 -->
|
|
<ikun-qrcode
|
|
class="qr-code"
|
|
width="500"
|
|
height="500"
|
|
unit="rpx"
|
|
color="#000000"
|
|
:data="qrCodeUrl"
|
|
></ikun-qrcode>
|
|
<!-- 有效期 -->
|
|
<!-- <view class="valid-time">有效时间15分钟</view> -->
|
|
<view class="refresh-button">
|
|
<button @click="refreshQrCode" class="login-btn cu-btn block bg-blue lg round" style="width: 70%;">刷新二维码</button>
|
|
</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'
|
|
import { getOrderQRCodeAPI } from '@/api/index/index'
|
|
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:{},
|
|
custName:uni.getStorageSync('custName'),
|
|
isShowBtn:false,
|
|
qrCodeUrl:`xnzn{\"s\":1,\"y\":3,\"p\":\"${uni.getStorageSync('custId')}\",\"t\":\"${uni.getStorageSync('codeTime')}\"}`// 替换为实际的二维码URL
|
|
}
|
|
},
|
|
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;
|
|
uni.setStorageSync('mobilePhone',this.userInfo.mobile)
|
|
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' })
|
|
}
|
|
},
|
|
openCode(){
|
|
this.refreshQrCode()
|
|
this.isShowBtn=true
|
|
},
|
|
// 获取二维码
|
|
async getOrderQRCodeData() {
|
|
const res = await getOrderQRCodeAPI({ "custId":uni.getStorageSync('custId') })
|
|
uni.setStorageSync("codeTime",res);
|
|
this.qrCodeUrl = `xnzn{\"s\":1,\"y\":3,\"p\":\"${uni.getStorageSync('custId')}\",\"t\":\"${uni.getStorageSync('codeTime')}\"}`
|
|
// console.log(res, '二维码信息--')
|
|
},
|
|
refreshQrCode() {
|
|
// 模拟刷新二维码
|
|
this.getOrderQRCodeData()
|
|
}
|
|
},
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
|
|
.codeBtn{
|
|
width: 94%;margin: 40rpx auto;background: #FFF;height: 80rpx;border-radius: 10rpx;display: flex;align-items: center;justify-content: center;
|
|
}
|
|
.card-box{
|
|
margin: 40rpx;
|
|
/* border: 1px solid #000; */
|
|
border-radius: 10rpx;
|
|
background: #FFF;
|
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
|
|
padding-top: 20rpx;
|
|
padding-bottom: 40rpx;
|
|
}
|
|
|
|
.title {
|
|
width: 100%;
|
|
margin-bottom: 10px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
position: relative;
|
|
}
|
|
|
|
.subtitle {
|
|
font-size: 32rpx;
|
|
color: #999;
|
|
margin-bottom: 20px;
|
|
width: 100%;
|
|
text-align: center;
|
|
/* font-weight: 600; */
|
|
}
|
|
|
|
.qr-code {
|
|
margin: 0 auto;
|
|
margin-bottom: 10px;
|
|
padding-top: 20rpx;
|
|
}
|
|
|
|
.valid-time {
|
|
font-size: 32rpx;
|
|
color: #666;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.refresh-button {
|
|
width: 100%;
|
|
height: auto;
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
|
|
.login-btn {
|
|
width: 100%;
|
|
height: 35px;
|
|
margin: 0 auto;
|
|
margin-left: 30rpx;
|
|
margin-right: 30rpx;
|
|
background-color: #e97c3d;
|
|
}
|
|
</style>
|