nurseWeChatAppletUI/pages/Personal/Personal.vue

148 lines
3.0 KiB
Vue
Raw Normal View History

<template>
<view class="app">
<view class="cards">
<view class="item" style="background-color: #9E4DD0;" @tap='gouser'>
<image src="../../static/user.png" mode=""></image>
<view class="title">
个人信息
</view>
</view>
<view class=" item" style="background-color: #E1AE3C ;" @tap='goorder'>
<image src="../../static/dingdan.png" mode=""></image>
<view class="title">
我的订单
</view>
</view>
<!-- <view class="item" style="background-color: #00C176 ;">
<image src="../../static/home.png" mode=""></image>
<view class="title" style="font-size: 42rpx;">
我的家庭
</view>
</view> -->
<view class="item">
</view>
<view class="item">
</view>
<view class="item">
</view>
<view class="item">
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
existPatientInfo
} from '@/api/startup/index.js'
export default {
data() {
return {};
},
onLoad() {
var that = this
try {
const value = uni.getStorageSync('openid');
2022-12-27 09:22:42 +08:00
const value3 = uni.getStorageSync('token');
if (value && value3) {
const value2 = uni.getStorageSync('patientId');
if (value2) {} else {
uni.navigateTo({
url: '/pages/login/login'
})
}
} else {
uni.navigateTo({
url: '/pages/login/login'
})
}
} catch (e) {
uni.navigateTo({
url: '/pages/login/login'
})
}
},
methods: {
goorder() {
var that = this
try {
const value = uni.getStorageSync('openid');
if (value) {
const value2 = uni.getStorageSync('patientId');
if (value2) {
uni.navigateTo({
url: '/pages/order/order'
})
} else {
uni.navigateTo({
url: '/pages/login/login'
})
}
} else {
uni.navigateTo({
url: '/pages/login/login'
})
}
} catch (e) {
uni.navigateTo({
url: '/pages/login/login'
})
}
},
//跳转个人信息页面
gouser() {
try {
const value = uni.getStorageSync('openid');
2022-12-27 09:22:42 +08:00
const value3 = uni.getStorageSync('token');
var that = this
2022-12-27 09:22:42 +08:00
if (value && value3) {
existPatientInfo(value).then(res => {
2022-12-27 09:22:42 +08:00
if (res.code == 200 && res.msg == 'LOGIN') {
const value2 = uni.getStorageSync('patientId');
if (value2) {
uni.navigateTo({
url: '/pages/user/user'
})
} else {
that.remove()
}
} else {
that.remove()
}
})
} else {
that.remove()
}
} catch {
that.remove()
}
},
remove() {
uni.removeStorageSync('patientId');
uni.removeStorageSync('openid');
uni.removeStorageSync('phone');
2022-12-27 09:22:42 +08:00
uni.removeStorageSync('token');
uni.navigateTo({
url: '/pages/login/login'
})
},
},
}
</script>
<style lang="scss">
.app {
.cards {
padding: 22px 0 20px 0;
.item {
.title {
width: 80%;
top: 60%;
}
}
}
}
</style>