NurseStationApp/pages/Personal/Personal.vue
2023-02-23 10:45:26 +08:00

145 lines
2.9 KiB
Vue

<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">
</view>
<view class="item">
</view>
<view class="item">
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
getExistPatientByPatientId
} from '@/api/startup/index.js'
export default {
data() {
return {
timer: null,
};
},
methods: {
goorder() {
const value = uni.getStorageSync('patientId');
var that = this
if (value) {
getExistPatientByPatientId(value).then(res => {
if (res.code == 200) {
if (res.msg == 'LOGIN') {
uni.navigateTo({
url: '/pages/order/order'
})
} else {
that.$refs.uToast.show({
title: '当前用户信息不存在,请重新登录',
type: 'error',
duration: '1500'
})
that.remove();
}
} else {
that.$refs.uToast.show({
title: '登录异常,请重新登录',
type: 'error',
duration: '1500'
})
that.remove();
}
})
} else {
that.remove();
that.$refs.uToast.show({
title: '请重新登录',
type: 'error',
duration: '1500'
})
}
},
remove() {
var that = this
uni.removeStorageSync('patientId');
uni.removeStorageSync('phone');
uni.removeStorageSync('password');
if (that.timer) {
clearTimeout(that.timer)
}
that.timer = setTimeout(e => {
uni.reLaunch({
url: '/pages/login/login'
})
}, 1500)
},
//跳转个人信息页面
gouser() {
const value = uni.getStorageSync('patientId');
var that = this
if (value) {
getExistPatientByPatientId(value).then(res => {
if (res.code == 200) {
if (res.msg == 'LOGIN') {
uni.navigateTo({
url: '/pages/user/user'
})
} else {
that.$refs.uToast.show({
title: '当前用户信息不存在,请重新登录',
type: 'error',
duration: '1500'
})
that.remove();
}
} else {
that.$refs.uToast.show({
title: '登录异常,请重新登录',
type: 'error',
duration: '1500'
})
that.remove();
}
})
} else {
that.$refs.uToast.show({
title: '请重新登录',
type: 'error',
duration: '1500'
})
that.remove();
}
},
},
}
</script>
<style lang="scss">
.app {
.cards {
padding: 22px 0 20px 0;
.item {
.title {
width: 80%;
top: 60%;
}
}
}
}
</style>