NurseStationApp/pages/user/user.vue
2023-02-13 15:24:21 +08:00

238 lines
6.0 KiB
Vue

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