xinelu-applet-ui/pages/homepage/homepage.vue
2023-10-12 09:47:40 +08:00

244 lines
5.7 KiB
Vue

<template>
<view class="app">
<view class="content">
<image src="/static/pageC/homepage.png" mode=""></image>
<view class="loginmount">
<image src="/static/pageC/TAB.png" mode=""></image>
<text v-if="patientName">{{patientName}}</text>
<text @tap="login" v-else>你好,请登录</text>
</view>
</view>
<view class="contentcenter">
<view class="home" @tap="goonline">
<image src="/static/pageC/qianyue.png" mode=""></image>
<view class="name">
家医签约
</view>
</view>
<view class="home" @tap="goHealthrecords">
<image src="/static/pageC/health.png" mode=""></image>
<view class="name">
健康档案
</view>
</view>
<view class="home" @tap="goappoint">
<image src="/static/pageC/serveappoint.png" mode=""></image>
<view class="name">
服务预约
</view>
</view>
<view class="home" @tap="count">
<image src="/static/pageC/exchange.png" mode=""></image>
<view class="name">
积分兑换
</view>
</view>
<view class="home" @tap="myappointment">
<image src="/static/pageC/appointmen.png" mode=""></image>
<view class="name">
我的预约
</view>
</view>
<view class="home" @tap="servicerecord">
<image src="/static/pageC/SERVERECOD.png" mode=""></image>
<view class="name">
服务记录
</view>
</view>
</view>
<view class="contentbottom">
<view class="health">
健康管理
</view>
<view class="item">
<view class="signmyself" @tap="sign">
<image src="/static/pageC/tizheng.png" mode=""></image>
</view>
<view class="sign">
<image @tap="healthtest" src="/static/pageC/healthmyself.png" mode=""></image>
<image @tap="gorecords" src="/static/pageC/records.png" mode=""></image>
</view>
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
getOpenId,
getCurrentUser,
detail
} from '@/api/pages/homepage/homepage.js'
export default {
data() {
return {
patientName: '',
userinfo: {},
identity: '',
region: '',
openid: '',
}
},
onLoad() {
// this.login()
},
onShow() {
this.userinfo = uni.getStorageSync('userinfo');
this.region = this.userinfo.cityCode;
this.openid = this.userinfo.openid;
this.identity = this.userinfo.cardNo;
if (!this.openid && !this.region) {
// that.appPersonallist = null
this.$refs.uToast.show({
title: '您未登录,请先登录',
type: 'error',
duration: '1000',
})
} else {
getCurrentUser(this.openid, this.region).then(res => {
this.patientName = res.data.patientName
uni.setStorageSync('patientId', res.data.id);
// if (!res.data) {
// // 注册
// }
})
}
},
methods: {
// 登录
login() {
this.gologin();
},
gologin() {
this.$refs.uToast.show({
title: '您未登录,请先登录',
type: 'error',
duration: '1000',
url: '/pages/login/login'
})
},
// 签约信息
detailinfo(url1, url2) {
detail(this.identity, this.region).then(res => {
// detail('372424194703207523', '1').then(res => {
if (res.code == 200) {
uni.navigateTo({
url: url2 + `?item=${JSON.stringify(res.data)}`
})
} else {
this.$refs.uToast.show({
title: '未签约,请先签约',
type: 'error',
duration: '1000',
url: url1
})
}
})
},
// 家医签约
goonline() {
uni.navigateTo({
url:"/pagesC/Onlinesigning/Onlinesigning"
})
// this.detailinfo('/pagesC/Onlinesigning/Onlinesigning', '/pagesB/mysigning/mysigning')
if (!this.userinfo && !this.identity) {
// this.gologin();
} else {
// this.detailinfo('/pagesC/Onlinesigning/Onlinesigning', '/pagesB/mysigning/mysigning')
}
},
// 积分兑换
count() {
if (!this.userinfo && !this.identity) {
this.gologin();
} else {
this.detailinfo('', '')
}
},
// 健康档案
goHealthrecords() {
if (!this.userinfo && !this.identity) {
this.gologin();
} else {
// this.detailinfo('', '')
uni.navigateTo({
url: '/pagesC/Healthrecords/Healthrecords'
})
}
},
// 筛查记录
gorecords() {
if (!this.userinfo && !this.identity) {
this.gologin();
} else {
// this.detailinfo('', '')
uni.navigateTo({
url: '/pagesC/Screeningrecords/Screeningrecords'
})
}
},
// 健康自评
healthtest() {
if (!this.userinfo && !this.identity) {
this.gologin();
} else {
// this.detailinfo('', '')
uni.navigateTo({
url: '/pagesC/healthtest/healthtest'
})
}
},
// 体征检测
sign() {
if (!this.userinfo && !this.identity) {
this.gologin();
} else {
// this.detailinfo('', '')
uni.navigateTo({
url: '/pagesC/Physicalexamination/Physicalexamination'
})
}
},
// 服务预约
goappoint() {
uni.navigateTo({
url: '/pagesC/ServiceAppointment/ServiceAppointment'
})
// if (!this.userinfo && !this.identity) {
// this.gologin();
// } else {
// this.detailinfo('', '/pagesC/ServiceAppointment/ServiceAppointment')
// }
},
// 服务记录
servicerecord() {
if (!this.userinfo && !this.identity) {
this.gologin();
} else {
// this.detailinfo('', '')
uni.navigateTo({
url: '/pagesC/servicerecord/servicerecord'
})
}
},
// 我的预约
myappointment() {
if (!this.userinfo && !this.identity) {
this.gologin();
} else {
// this.detailinfo('', '')
uni.navigateTo({
url: '/pagesC/Myappointment/Myappointment'
})
}
},
}
}
</script>
<style lang="scss">
@import "./homepage.scss";
</style>