238 lines
6.7 KiB
Vue
238 lines
6.7 KiB
Vue
<template>
|
||
<view class="app">
|
||
<view class="userinfo">
|
||
<view class="item" style="height: 200rpx; " @tap='uploadImag'>
|
||
<span style='height:200rpx;line-height: 200rpx;'>头像:</span>
|
||
<image class="picture" :src="img" mode=""></image>
|
||
<image class="pictureA" src="../../static/jiantou.png" mode=""></image>
|
||
</view>
|
||
<view class="item">
|
||
<span>姓名:</span>
|
||
<u-input v-model="appPersonallist.patientName" placeholder="请输入" type="text" maxlength='5' />
|
||
</view>
|
||
<view class="item">
|
||
<span>电话:</span>
|
||
<u-input v-model="appPersonallist.phone" placeholder="请输入" maxlength='11' type="text" />
|
||
</view>
|
||
<view class="item">
|
||
<span>身份证号:</span>
|
||
<u-input v-model="appPersonallist.cardNo" placeholder="请输入" type="text" maxlength='18' />
|
||
</view>
|
||
<view class="item" @tap='areashow=true'>
|
||
<span>所属区域:</span>
|
||
<view>{{address}}</view>
|
||
</view>
|
||
<view class="item">
|
||
<span>详细地址:</span>
|
||
<u-input v-model="appPersonallist.address" type="text" placeholder='小区、单元、门牌号' />
|
||
</view>
|
||
<view class="item" @tap='getAddress()'>
|
||
<span>所在位置:</span>
|
||
<view style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{chooseLocation}}</view>
|
||
</view>
|
||
<view class="disease" style="border: none;" @tap="godisease">
|
||
<view style="display: block;line-height: 120rpx;">疾病类型:</view>
|
||
<image class="pictureA" src="../../static/jiantou.png" mode=""></image>
|
||
<view class="" style="padding-right: 10rpx" v-for="(item,index) in patientDiseaseInfoList">
|
||
{{item.diseaseName}}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<u-select v-model="areashow" mode="mutil-column-auto" label-name='areaName' value-name='areaCode'
|
||
:list="arealist" @confirm="areaconfirm"></u-select>
|
||
<view class="finish" @tap="informationinfo()">完成
|
||
</view>
|
||
<u-toast ref="uToast" />
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
getRegionAndStreetInfo
|
||
} from '@/api/information/index.js'
|
||
import {
|
||
information
|
||
} from '@/api/information/index.js'
|
||
import baseurl from '@/api/baseurl.js'
|
||
export default {
|
||
data() {
|
||
return {
|
||
baseurl: '',
|
||
address: '',
|
||
arealist: [],
|
||
areashow: false,
|
||
chooseLocation: '',
|
||
img: null,
|
||
image: null,
|
||
appPersonallist: {
|
||
patientName: "",
|
||
cardNo: "",
|
||
phone: "",
|
||
address: "",
|
||
areaCode: "",
|
||
homeLongitude: "",
|
||
homeLatitude: "",
|
||
nurseTypeIdList: [],
|
||
diseaseInfoList: [],
|
||
headPictureUrl: '',
|
||
},
|
||
patientDiseaseInfoList: [], //获取个人信息
|
||
}
|
||
},
|
||
onLoad(options) {
|
||
this.areaInfo();
|
||
this.baseurl = baseurl
|
||
this.appPersonallist = JSON.parse(options.appPersonallist)
|
||
this.img = baseurl + this.appPersonallist.headPictureUrl
|
||
if (this.appPersonallist.regionName && this.appPersonallist.streetName) {
|
||
this.address = this.appPersonallist.regionName + '-' + this.appPersonallist.streetName
|
||
}
|
||
this.patientDiseaseInfoList = this.appPersonallist.patientDiseaseInfoList
|
||
this.patientDiseaseInfoList.forEach(e => {
|
||
e.id = e.diseaseId
|
||
})
|
||
if (this.appPersonallist.homeLongitude && this.appPersonallist.homeLatitude) {
|
||
this.chooseLocation = '东经:' + this.appPersonallist.homeLongitude + ' 北纬:' + this.appPersonallist
|
||
.homeLatitude
|
||
}
|
||
},
|
||
methods: {
|
||
//上传图片+提交信息
|
||
informationinfo() {
|
||
//上传图片
|
||
var that = this
|
||
if (this.image) {
|
||
uni.uploadFile({
|
||
url: baseurl + '/nurseApplet/uploadFile/uploadHeadPictureUrl',
|
||
filePath: that.appPersonallist.headPictureUrl,
|
||
name: 'file',
|
||
formData: {
|
||
'patientId': that.appPersonallist.patientId
|
||
},
|
||
timeout: 5000,
|
||
success(res) {
|
||
that.appPersonallist.headPictureUrl = JSON.parse(res.data).imgUrl
|
||
that.appPersonallist.diseaseInfoList = that.patientDiseaseInfoList
|
||
information(that.appPersonallist).then(res => {
|
||
if (res.code == 200) {
|
||
that.$refs.uToast.show({
|
||
title: '修改信息成功',
|
||
type: 'success',
|
||
duration: '1500'
|
||
})
|
||
setTimeout(e => {
|
||
uni.navigateBack({
|
||
delta: 1
|
||
})
|
||
}, 1500)
|
||
} else if (res.code == 500) {
|
||
that.$refs.uToast.show({
|
||
title: res.msg,
|
||
type: 'error',
|
||
url: ''
|
||
})
|
||
}
|
||
})
|
||
}
|
||
})
|
||
} else {
|
||
that.appPersonallist.diseaseInfoList = that.patientDiseaseInfoList
|
||
information(that.appPersonallist).then(res => {
|
||
if (res.code == 200) {
|
||
that.$refs.uToast.show({
|
||
title: '修改信息成功',
|
||
type: 'success',
|
||
duration: '1500'
|
||
})
|
||
setTimeout(e => {
|
||
uni.navigateBack({
|
||
delta: 1
|
||
})
|
||
}, 1500)
|
||
} else if (res.code == 500) {
|
||
that.$refs.uToast.show({
|
||
title: res.msg,
|
||
type: 'error',
|
||
url: ''
|
||
})
|
||
}
|
||
})
|
||
}
|
||
},
|
||
//上传头像
|
||
uploadImag() {
|
||
var that = this;
|
||
uni.chooseImage({
|
||
count: 1,
|
||
sizeType: ['original'],
|
||
sourceType: ['album'],
|
||
success(res) {
|
||
that.appPersonallist.headPictureUrl = res.tempFilePaths[0]
|
||
that.img = res.tempFilePaths[0]
|
||
that.image = res.tempFilePaths[0]
|
||
}
|
||
})
|
||
},
|
||
//获取所在位置
|
||
getAddress() {
|
||
var that = this;
|
||
uni.chooseLocation({
|
||
success: function(res) {
|
||
that.chooseLocation = res.name
|
||
that.appPersonallist.homeLongitude = res.longitude;
|
||
that.appPersonallist.homeLatitude = res.latitude;
|
||
}
|
||
});
|
||
},
|
||
//区街道选择
|
||
areaconfirm(e) {
|
||
this.appPersonallist.areaCode = e[e.length - 1].value
|
||
this.address = e[0].label + '-' + e[1].label
|
||
},
|
||
//区街道
|
||
areaInfo() {
|
||
getRegionAndStreetInfo().then(res => {
|
||
//区下无街道添加一个空街道
|
||
res.data.forEach(e => {
|
||
if (e.children.length == 0) {
|
||
e.children.push({
|
||
areaCode: "",
|
||
areaName: "暂无街道",
|
||
children: null,
|
||
id: '',
|
||
})
|
||
}
|
||
})
|
||
this.arealist = res.data;
|
||
})
|
||
},
|
||
//跳转疾病选择
|
||
godisease() {
|
||
uni.navigateTo({
|
||
url: `/pages/disease/disease?diseaseInfoList=${JSON.stringify(this.patientDiseaseInfoList)}`,
|
||
})
|
||
},
|
||
},
|
||
onUnload() {
|
||
// 页面卸载时设置插件选点数据为null,防止再次进入页面,geLocation返回的是上次选点结果
|
||
chooseLocation.setLocation(null);
|
||
},
|
||
//带参返回
|
||
onShow() {
|
||
let that = this
|
||
uni.$on('disease', function(data) {
|
||
console.log(data)
|
||
that.patientDiseaseInfoList = JSON.parse(data.disease)
|
||
that.patientDiseaseInfoList.forEach(e => {
|
||
e.diseaseId = e.id
|
||
})
|
||
// console.log(that.patientDiseaseInfoList)
|
||
})
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
@import "./modify.scss"
|
||
</style>
|