nurseWeChatAppletUI/pages/Personal/Personal.vue
2023-02-23 14:06:35 +08:00

165 lines
3.3 KiB
Vue

<template>
<view class="app">
<view class="item" @tap='gouser'>
<image src="../../static/user.png" mode=""></image>
<view class="title">
个人信息
</view>
</view>
<view class=" item" @tap='goorder'>
<image src="../../static/dingdan.png" mode=""></image>
<view class="title">
我的订单
</view>
</view>
</view>
</template>
<script>
import {
existPatientInfo
} from '@/api/startup/index.js'
export default {
data() {
return {};
},
onLoad() {
var that = this
try {
const value = uni.getStorageSync('openid');
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');
const value3 = uni.getStorageSync('token');
var that = this
if (value && value3) {
existPatientInfo(value).then(res => {
if (res.code == 200 && res.msg == 'LOGIN') {
const value2 = uni.getStorageSync('patientId');
if (value2) {
uni.navigateTo({
url: '/pages/order/order'
})
} else {
that.remove()
}
} else {
that.remove()
}
})
} else {
that.remove()
}
} catch {
that.remove()
}
},
//跳转个人信息页面
gouser() {
try {
const value = uni.getStorageSync('openid');
const value3 = uni.getStorageSync('token');
var that = this
if (value && value3) {
existPatientInfo(value).then(res => {
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');
uni.removeStorageSync('token');
uni.navigateTo({
url: '/pages/login/login'
})
},
},
//1.分享给朋友
onShareAppMessage(res) {
let pages = getCurrentPages();
let url = pages[pages.length - 1].$page.fullPath
return {
title: '泉医到家',
path: url,
}
},
//2.分享到朋友圈
onShareTimeline(res) {
let pages = getCurrentPages();
let url = pages[pages.length - 1].$page.fullPath
return {
title: '泉医到家',
path: url,
}
},
}
</script>
<style lang="scss">
.app {
padding: 0;
.item {
width: 94%;
margin: 20rpx auto 0;
background-color: #fff;
position: relative;
height: 100rpx;
border-radius: 5rpx;
.title {
position: absolute;
left: 150rpx;
top: 50%;
transform: translateY(-50%);
font-size: 44rpx;
}
image {
position: absolute;
left: 40rpx;
top: 50%;
transform: translateY(-50%);
width: 55rpx;
height: 55rpx;
}
}
}
</style>