YNUtdPlatform/pages/HealthExaminationApp/index/index.vue

328 lines
9.6 KiB
Vue
Raw Normal View History

2024-09-02 15:08:09 +08:00
<template>
<view>
<div v-if="isShow">
<div class="top-swiper">
<div class="swiper">
<u-swiper :list="swiperList" indicator indicatorMode="dot" height="170" />
</div>
</div>
<div class="title">体检服务</div>
<div class="opt-list">
2024-09-06 14:53:49 +08:00
<div class="opt-item" v-if="personnelType != 0" @click="handlePage(optList[0].url)">
2024-09-02 15:08:09 +08:00
<div class="item">
2024-09-06 14:53:49 +08:00
<u--image :showLoading="true" :src="optList[0].src" width="70px" height="60px" />
<div class="name">{{ optList[0].name }}</div>
</div>
</div>
<div class="opt-item" v-if="status != 0" @click="handlePage(optList[1].url)">
<div class="item">
<u--image :showLoading="true" :src="optList[1].src" width="70px" height="60px" />
<div class="name">{{ optList[1].name }}</div>
</div>
</div>
<div class="opt-item" @click="handlePage(optList[2].url)">
<div class="item">
<u--image :showLoading="true" :src="optList[2].src" width="70px" height="60px" />
<div class="name">{{ optList[2].name }}</div>
</div>
</div>
<div class="opt-item" @click="handlePage(optList[3].url)">
<div class="item">
<u--image :showLoading="true" :src="optList[3].src" width="70px" height="60px" />
<div class="name">{{ optList[3].name }}</div>
2024-09-02 15:08:09 +08:00
</div>
</div>
</div>
</div>
<div v-else>
2024-09-06 14:53:49 +08:00
<div class="top-swiper avatar">
<u--image :showLoading="true" :src="avatar" shape="circle" width="120px" height="120px" />
<div style="margin-top: 20px; font-size: 18px">{{ userInfo.phyName }}</div>
</div>
<div class="user">
<div class="item" @click="handleUserInfo">
<u-icon name="/static/images-tijian/userInfo.png" size="16"></u-icon>
<div>个人信息</div>
</div>
<u-line color="#F2F2F2"></u-line>
<div class="item" @click="handleMsg">
<u-icon name="/static/images-tijian/message.png" size="16"></u-icon>
<div>消息通知</div>
</div>
<u-line color="#F2F2F2"></u-line>
<div class="item" @click="handleLogout">
<u-icon name="/static/images-tijian/logout.png" size="16"></u-icon>
<div>退出登录</div>
</div>
</div>
2024-09-02 15:08:09 +08:00
</div>
<!-- 底部导航 -->
<u-tabbar :value="selectValue" @change="changeTab" fixed placeholder safeAreaInsetBottom activeColor="#1989fa">
<u-tabbar-item text="首页" :icon="homeIcon"></u-tabbar-item>
<u-tabbar-item text="我的" :icon="myIcon"></u-tabbar-item>
</u-tabbar>
</view>
</template>
<script>
2024-09-04 15:18:01 +08:00
import config from '@/config'
2024-09-06 17:35:31 +08:00
import { decryptCBC } from '@/utils/aescbc'
2024-09-04 15:18:01 +08:00
2024-09-02 15:08:09 +08:00
export default {
data() {
return {
2024-09-04 15:18:01 +08:00
token: uni.getStorageSync('tjToken'),
2024-09-02 15:08:09 +08:00
isShow: true,
2024-09-04 15:18:01 +08:00
userInfo: {},
2024-09-02 15:08:09 +08:00
selectValue: 0,
homeIcon: '/static/images-tijian/home-selected.png',
myIcon: '/static/images-tijian/my-unselected.png',
swiperList: [
'/static/images-tijian/swiper-1.png',
'/static/images-tijian/swiper-2.png',
'/static/images-tijian/swiper-3.png'
],
2024-09-06 14:53:49 +08:00
personnelType: '',
status: '',
2024-09-02 15:08:09 +08:00
optList: [
{ name: '体检预约', src: '/static/images-tijian/preOrder.png', url: 'appointment' },
2024-09-06 14:53:49 +08:00
{ name: '职业预约', src: '/static/images-tijian/careerExam.png', url: 'jobAppointment' },
2024-09-02 15:08:09 +08:00
{ name: '我的预约', src: '/static/images-tijian/myPreOrder.png', url: 'myAppointment' },
2024-09-06 14:53:49 +08:00
{ name: '体检报告', src: '/static/images-tijian/report.png', url: 'report' }
],
// 头像
avatar:
2024-09-19 14:58:55 +08:00
'https://img.zcool.cn/community/0104c958b69c23a801219c77ba5da2.png?x-oss-process=image/auto-orient,1/resize,m_lfit,w_1280,limit_1/sharpen,100'
2024-09-02 15:08:09 +08:00
}
},
2024-09-04 15:18:01 +08:00
mounted() {
console.log('🚀 ~ mounted ~ mounted:', this.token)
this.getStatus()
this.getAppLoginInfo()
},
2024-09-02 15:08:09 +08:00
methods: {
changeTab(e) {
console.log('🚀 ~ changeTab ~ e:', e)
this.selectValue = e
this.homeIcon = e === 0 ? '/static/images-tijian/home-selected.png' : '/static/images-tijian/home-unselected.png'
this.myIcon = e === 1 ? '/static/images-tijian/my-selected.png' : '/static/images-tijian/my-unselected.png'
this.isShow = !this.isShow
},
// 跳转页面
handlePage(url) {
2024-09-19 11:32:22 +08:00
if (url == 'appointment' || url == 'jobAppointment') {
const params = {
appoint: url == 'appointment' ? '2' : '3',
token: this.token
}
console.log('🚀 ~ getStatus ~ params:', params)
uni.request({
url: config.tjBaseUrl + '/app/getphyappoint',
method: 'post',
data: params,
header: {
'content-type': 'application/x-www-form-urlencoded',
token: this.token
},
success: res => {
console.log('🚀 ~ getStatus ~ res:', res)
res = res.data
if (res.res == 1 && res.obj == 1) {
2024-09-19 14:58:55 +08:00
uni.navigateTo({
url: `/pages/HealthExaminationApp/${url}/${url}?params=${JSON.stringify(this.userInfo)}`
})
} else {
uni.showToast({
title: '您已经预约过,无法再次预约!',
icon: 'none'
})
2024-09-19 11:32:22 +08:00
}
},
fail: err => {
console.log('🚀 ~ getStatus ~ err:', err)
uni.showToast({
title: '系统异常,请联系管理员',
icon: 'none'
})
}
})
} else {
uni.navigateTo({
url: `/pages/HealthExaminationApp/${url}/${url}?params=${JSON.stringify(this.userInfo)}`
2024-09-05 15:05:17 +08:00
})
}
2024-09-04 15:18:01 +08:00
},
2024-09-06 14:53:49 +08:00
// 获取状态
2024-09-04 15:18:01 +08:00
getStatus() {
const params = {
token: this.token,
telephone: uni.getStorageSync('tjPhone')
}
console.log('🚀 ~ getStatus ~ params:', params)
uni.request({
url: config.tjBaseUrl + '/app/getStatus',
method: 'post',
data: params,
header: {
'content-type': 'application/x-www-form-urlencoded',
token: this.token
},
success: res => {
console.log('🚀 ~ getStatus ~ res:', res)
2024-09-06 14:53:49 +08:00
res = res.data
if (res.res === 1) {
this.personnelType = res.obj.personnelType || 0
this.status = res.obj.status
console.log('🚀 ~ getStatus ~ this.personnelType:', this.personnelType)
console.log('🚀 ~ getStatus ~ this.status:', this.status)
}
2024-09-04 15:18:01 +08:00
},
fail: err => {
console.log('🚀 ~ getStatus ~ err:', err)
}
})
},
// 获取app登录信息
getAppLoginInfo() {
const params = {
token: this.token
}
console.log('🚀 ~ getapplogininfo ~ params:', params)
uni.request({
url: config.tjBaseUrl + '/app/getapplogininfo',
method: 'post',
data: params,
header: {
'content-type': 'application/x-www-form-urlencoded',
token: this.token
},
success: res => {
res = res.data
2024-09-06 17:35:31 +08:00
console.log('🚀 ~ getAppLoginInfo ~ res:', res)
2024-09-04 15:18:01 +08:00
if (res.res === 1) {
this.userInfo = res.obj[0]
2024-09-06 17:35:31 +08:00
this.userInfo.phyName = decryptCBC(this.userInfo.phyName)
this.userInfo.idcard = decryptCBC(this.userInfo.idcard)
this.userInfo.telepNumber = decryptCBC(this.userInfo.telepNumber)
console.log('🚀 ~ getAppLoginInfo ~ this.userInfo:', this.userInfo)
2024-09-04 15:18:01 +08:00
}
},
fail: err => {
console.log('🚀 ~ getapplogininfo ~ err:', err)
}
2024-09-02 15:08:09 +08:00
})
2024-09-06 14:53:49 +08:00
},
// 个人信息
handleUserInfo() {
const params = {
name: this.userInfo.phyName,
idcard: this.userInfo.idcard,
age: this.userInfo.age,
sex: this.userInfo.sex == '0' ? '男' : '女',
phone: this.userInfo.telepNumber,
departName: this.userInfo.departName
}
console.log('🚀 ~ handleUserInfo ~ params:', params)
uni.navigateTo({
url: '/pages/HealthExaminationApp/index/userInfo?params=' + JSON.stringify(params)
})
},
// 消息通知
handleMsg() {
uni.navigateTo({
url: '/pages/HealthExaminationApp/index/message'
})
},
// 退出登录
handleLogout() {
uni.showModal({
title: '提示',
content: '确定退出登录吗?',
success: res => {
if (res.confirm) {
uni.removeStorageSync('tjToken')
uni.reLaunch({
url: '/pages/login'
})
}
}
})
2024-09-02 15:08:09 +08:00
}
}
}
</script>
<style lang="scss" scoped>
.top-swiper {
height: 300px;
padding: 10px;
background: url('/static/images-tijian/home-bg.png') no-repeat;
background-size: 100% 100%;
.swiper {
margin-top: 130px;
}
}
2024-09-06 14:53:49 +08:00
.avatar {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
2024-09-02 15:08:09 +08:00
.title {
margin: 20px 10px;
font-size: 20px;
font-weight: bold;
color: #333;
}
.opt-list {
margin: 0 10px;
padding: 10px;
background: #fff;
border-radius: 5px;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.opt-item {
width: 30%;
margin: 10px 0;
.item {
display: flex;
flex-direction: column;
align-items: center;
.name {
margin-top: 5px;
font-size: 14px;
color: #333;
}
}
}
}
2024-09-06 14:53:49 +08:00
.user {
margin: 10px;
padding: 10px;
background: #fff;
border-radius: 5px;
.item {
display: flex;
align-items: center;
margin: 10px 0;
div {
margin-left: 10px;
font-size: 16px;
color: #333;
}
}
}
2024-09-02 15:08:09 +08:00
</style>