NurseStationApp/pages/user/user.vue

242 lines
6.1 KiB
Vue
Raw Normal View History

2022-10-24 16:30:14 +08:00
<template>
<view class="app">
<view class="user">
2022-11-09 16:38:05 +08:00
<view v-if="appPersonallist.headPictureUrl">
<image class="img" :src="baseurl+appPersonallist.headPictureUrl" mode=""></image>
2022-11-03 17:26:15 +08:00
</view>
<view class="img" v-else>
2022-10-24 16:30:14 +08:00
<image src="../../static/users.png" mode=""></image>
</view>
2023-01-13 13:55:31 +08:00
<view class="phone" v-if="appPersonallist.patientName">
2022-11-03 17:26:15 +08:00
{{appPersonallist.patientName}}
2022-10-24 16:30:14 +08:00
</view>
<view class="nickname">
2022-11-03 17:26:15 +08:00
<!-- {{appPersonallist.phone}} -->
2022-10-24 16:30:14 +08:00
</view>
2022-11-01 14:54:09 +08:00
<view class="modify" @tap='updatainfo()'>
2022-10-24 16:30:14 +08:00
修改信息
<u-icon name="arrow-right" color="#ffffff" size="32"></u-icon>
</view>
</view>
<view class="information">
2023-01-13 13:55:31 +08:00
<view class="item" v-if="appPersonallist.patientName">
2022-11-01 14:54:09 +08:00
姓名{{appPersonallist.patientName}}
2022-10-24 16:30:14 +08:00
</view>
2022-11-03 17:26:15 +08:00
<view class="item" v-else>
姓名
</view>
2023-01-13 13:55:31 +08:00
<view class="item" v-if="appPersonallist.phone">
2022-11-01 14:54:09 +08:00
电话{{appPersonallist.phone}}
2022-10-24 16:30:14 +08:00
</view>
2022-11-03 17:26:15 +08:00
<view class="item" v-else>
电话
</view>
2023-01-13 13:55:31 +08:00
<view class="item" v-if="appPersonallist.cardNo">
2022-11-03 17:26:15 +08:00
身份证{{appPersonallist.cardNo}}
</view>
<view class="item" v-else>
身份证
</view>
2023-01-13 13:55:31 +08:00
<view class="addressitem" v-if="appPersonallist.areaName">
2023-01-10 10:35:17 +08:00
<view class="" style="padding-left: 5%;">
区域
</view>
<view class="address" style="">
2023-01-13 13:55:31 +08:00
{{appPersonallist.areaName}}
2023-01-10 10:35:17 +08:00
</view>
2022-11-03 17:26:15 +08:00
</view>
2023-01-10 15:26:26 +08:00
<view class="addressitem" v-else>
2023-01-10 10:35:17 +08:00
<view class="" style="padding-left: 5%;">
区域
</view>
<view class="address" style="">
</view>
2022-11-03 17:26:15 +08:00
</view>
2023-01-10 10:35:17 +08:00
<view class="addressitem" style="height:100%" v-if="appPersonallist.address">
<view class="" style="padding-left: 5%;">
地址
</view>
<view class="address" style="">
{{appPersonallist.address}}
</view>
2022-10-24 16:30:14 +08:00
</view>
2022-11-14 11:24:55 +08:00
<view class="item" style="height:100%" v-else>
2023-01-10 10:35:17 +08:00
<view class="" style="padding-left: 5%;">
地址
</view>
2022-11-14 11:24:55 +08:00
</view>
2022-11-11 14:19:07 +08:00
<!-- <view class="item" style="height:100%">
2022-11-03 17:26:15 +08:00
<view class="" style="display: inline-block;">
位置:
</view>
<view class="address" v-if="appPersonallist.homeLatitude&&appPersonallist.homeLongitude">
2022-11-09 16:38:05 +08:00
东经:{{appPersonallist.homeLongitude}}--北纬:{{ appPersonallist.homeLatitude}}
2022-11-03 17:26:15 +08:00
</view>
2022-11-11 14:19:07 +08:00
</view> -->
2022-11-03 17:26:15 +08:00
<view class="disease" style="border:none;">
<view class="" style="line-height: 110rpx;">
疾病类型:
</view>
<span style="padding-right: 15rpx;font-size: 32rpx;"
2022-11-01 14:54:09 +08:00
v-for="(item,index) in appPersonallist.patientDiseaseInfoList"
:key="index">{{item.diseaseName}}</span>
2022-10-24 16:30:14 +08:00
</view>
2023-02-13 15:24:21 +08:00
<view class="signout" @tap='removeshow=true'>
账号管理
</view>
<u-mask :show="removeshow" @tap="removeshow = false" class='masks'>
<view class="mask">
<view class="out" @tap='remove'>
退出账号
</view>
<view class="cancellation" @tap="remove('cancellation')">
注销账号
</view>
</view>
</u-mask>
2022-10-24 16:30:14 +08:00
</view>
2022-11-11 17:23:23 +08:00
<u-toast ref="uToast" />
2022-10-24 16:30:14 +08:00
</view>
</template>
<script>
2022-11-01 14:54:09 +08:00
import {
appPersonal,
2023-02-13 15:24:21 +08:00
accountCancellation
2022-11-01 14:54:09 +08:00
} from '@/api/user/user.js';
import baseurl from '@/api/baseurl.js'
2022-11-23 16:41:09 +08:00
import {
getExistPatientByPatientId
} from '@/api/startup/index.js'
2022-10-24 16:30:14 +08:00
export default {
data() {
return {
2023-02-13 15:24:21 +08:00
removeshow: false,
2022-11-03 17:26:15 +08:00
baseurl: '',
2022-11-01 14:54:09 +08:00
appPersonallist: [], //获取个人信息
2022-11-23 16:41:09 +08:00
timer: null,
2023-02-13 15:24:21 +08:00
patientId: null,
2022-10-24 16:30:14 +08:00
}
2022-11-01 14:54:09 +08:00
},
2022-11-11 14:19:07 +08:00
onShow() {
2022-11-03 17:26:15 +08:00
this.baseurl = baseurl
2022-11-01 14:54:09 +08:00
this.myInfo()
},
2022-11-11 17:23:23 +08:00
onLoad(options) {}, //获取传值
2022-11-01 14:54:09 +08:00
methods: {
2022-11-11 14:19:07 +08:00
//退出
2023-02-13 15:24:21 +08:00
remove(row) {
2022-11-11 17:23:23 +08:00
let that = this
2023-02-13 15:24:21 +08:00
if (row == 'cancellation') {
uni.showModal({
title: '提示',
content: '确认要注销此账号吗',
success: function(res) {
if (res.confirm) {
accountCancellation(that.patientId).then(res => {
if (res.code == 200) {
uni.removeStorageSync('patientId');
uni.removeStorageSync('phone');
uni.removeStorageSync('password');
uni.removeStorageSync('token');
2023-02-13 15:24:21 +08:00
uni.reLaunch({
url: "/pages/login/login"
})
}
})
} else if (res.cancel) {
that.$refs.uToast.show({
title: '取消注销账号',
type: 'error',
duration: '1000'
})
}
2022-11-14 11:24:55 +08:00
}
2023-02-13 15:24:21 +08:00
});
} else {
uni.showModal({
title: '提示',
content: '确认要退出此账号吗',
success: function(res) {
if (res.confirm) {
that.removeS();
} else if (res.cancel) {
that.$refs.uToast.show({
title: '取消退出账号',
type: 'error',
duration: '1000'
})
}
}
});
}
2022-11-11 14:19:07 +08:00
},
2022-11-01 14:54:09 +08:00
//获取个人信息
myInfo() {
2022-11-03 17:26:15 +08:00
var that = this
2022-11-09 16:38:05 +08:00
try {
const value = uni.getStorageSync('patientId');
if (value) {
2023-02-13 15:24:21 +08:00
that.patientId = value
2022-11-23 16:41:09 +08:00
getExistPatientByPatientId(value).then(res => {
2022-12-27 09:21:01 +08:00
if (res.code == 200 && res.msg == 'LOGIN') {
appPersonal(value).then(response => {
if (response.code == 200) {
that.appPersonallist = response.data
} else {
that.$refs.uToast.show({
title: '账号异常,请重新登录',
type: 'error',
duration: '1500'
})
that.removeS()
}
})
2022-11-23 16:41:09 +08:00
} else {
that.$refs.uToast.show({
title: '登录异常,请重新登录',
type: 'error',
duration: '1500'
})
2022-12-27 09:21:01 +08:00
that.removeS()
2022-11-23 16:41:09 +08:00
}
2022-11-03 17:26:15 +08:00
})
}
2023-02-13 15:24:21 +08:00
} catch (e) {}
2022-11-09 16:38:05 +08:00
// uni.getStorage({
// key: 'patientId',
// success: function(res) {
// appPersonal(res.data).then(res => {
// that.appPersonallist = res.data
// })
// }
// });
2022-11-01 14:54:09 +08:00
},
2022-11-23 16:41:09 +08:00
removeS() {
var that = this
uni.removeStorageSync('patientId');
uni.removeStorageSync('phone');
uni.removeStorageSync('password');
2022-12-27 09:21:01 +08:00
uni.removeStorageSync('token');
2022-11-23 16:41:09 +08:00
if (that.timer) {
clearTimeout(that.timer)
}
that.timer = setTimeout(e => {
2022-12-27 09:21:01 +08:00
uni.reLaunch({
url: "/pages/login/login"
2022-11-23 16:41:09 +08:00
})
2023-01-10 10:35:17 +08:00
}, 1500)
2022-11-23 16:41:09 +08:00
},
2022-11-01 14:54:09 +08:00
updatainfo() {
2022-11-03 17:26:15 +08:00
uni.navigateTo({
url: `/pages/modify/modify?appPersonallist=${JSON.stringify(this.appPersonallist)}`
})
2022-10-24 16:30:14 +08:00
}
2022-11-09 16:38:05 +08:00
},
2023-02-13 15:24:21 +08:00
onBackPress(options) {},
2022-10-24 16:30:14 +08:00
}
2022-11-01 14:54:09 +08:00
</script>
<style lang="scss">
@import "./user.scss";
2022-10-24 16:30:14 +08:00
</style>