NurseStationApp/pages/modify/modify.vue

242 lines
6.8 KiB
Vue
Raw Normal View History

2022-10-28 13:31:36 +08:00
<template>
<view class="app">
2022-11-03 17:26:15 +08:00
<view class="userinfo">
<view class="item" style="height: 200rpx; " @tap='uploadImag'>
<span style='height:200rpx;line-height: 200rpx;'>头像:</span>
2022-11-11 14:19:07 +08:00
<image class="picture" :src="img" mode=""></image>
2022-10-28 13:31:36 +08:00
<image class="pictureA" src="../../static/jiantou.png" mode=""></image>
</view>
2022-11-03 17:26:15 +08:00
<view class="item">
<span>姓名:</span>
2022-11-11 17:23:23 +08:00
<u-input :clearable='false' v-model="appPersonallist.patientName" placeholder="请输入" type="text" maxlength='5' />
2022-11-03 17:26:15 +08:00
</view>
<view class="item">
<span>电话:</span>
2022-11-11 17:23:23 +08:00
<u-input :clearable='false' v-model="appPersonallist.phone" placeholder="请输入" maxlength='11' type="text" />
2022-11-03 17:26:15 +08:00
</view>
<view class="item">
<span>身份证号:</span>
2022-11-11 17:23:23 +08:00
<u-input :clearable='false' v-model="appPersonallist.cardNo" placeholder="请输入" type="text" maxlength='18' />
2022-11-03 17:26:15 +08:00
</view>
<view class="item" @tap='areashow=true'>
<span>所属区域:</span>
2022-11-14 11:24:55 +08:00
<view class="address">{{address}}</view>
2022-10-28 13:31:36 +08:00
</view>
2022-11-03 17:26:15 +08:00
<view class="item">
<span>详细地址:</span>
2022-11-11 17:23:23 +08:00
<u-input :clearable='false' v-model="appPersonallist.address" type="text" placeholder='小区、单元、门牌号' />
2022-11-03 17:26:15 +08:00
</view>
2022-11-11 14:19:07 +08:00
<view class="item" @tap='getAddress()'>
2022-11-03 17:26:15 +08:00
<span>所在位置:</span>
2022-11-14 11:24:55 +08:00
<view class="address" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{chooseLocation}}</view>
2022-11-03 17:26:15 +08:00
</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>
2022-10-28 13:31:36 +08:00
</view>
</view>
2022-11-03 17:26:15 +08:00
<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" />
2022-10-28 13:31:36 +08:00
</view>
</template>
<script>
2022-11-01 14:54:09 +08:00
import {
2022-11-03 17:26:15 +08:00
getRegionAndStreetInfo
} from '@/api/information/index.js'
import {
information
} from '@/api/information/index.js'
2022-11-01 14:54:09 +08:00
import baseurl from '@/api/baseurl.js'
2022-10-28 13:31:36 +08:00
export default {
data() {
return {
2022-11-11 17:23:23 +08:00
timer:null,
2022-11-03 17:26:15 +08:00
baseurl: '',
address: '',
arealist: [],
areashow: false,
chooseLocation: '',
2022-11-09 16:38:05 +08:00
img: null,
2022-11-11 14:19:07 +08:00
image: null,
2022-11-01 14:54:09 +08:00
appPersonallist: {
2022-11-03 17:26:15 +08:00
patientName: "",
cardNo: "",
phone: "",
address: "",
areaCode: "",
homeLongitude: "",
homeLatitude: "",
nurseTypeIdList: [],
diseaseInfoList: [],
2022-11-01 14:54:09 +08:00
headPictureUrl: '',
2022-11-14 11:24:55 +08:00
locationName: '',
2022-11-01 14:54:09 +08:00
},
patientDiseaseInfoList: [], //获取个人信息
2022-10-28 13:31:36 +08:00
}
},
2022-11-01 14:54:09 +08:00
onLoad(options) {
2022-11-03 17:26:15 +08:00
this.areaInfo();
this.baseurl = baseurl
2022-11-01 14:54:09 +08:00
this.appPersonallist = JSON.parse(options.appPersonallist)
2022-11-11 14:19:07 +08:00
this.img = baseurl + this.appPersonallist.headPictureUrl
if (this.appPersonallist.regionName && this.appPersonallist.streetName) {
this.address = this.appPersonallist.regionName + '-' + this.appPersonallist.streetName
}
2022-11-01 14:54:09 +08:00
this.patientDiseaseInfoList = this.appPersonallist.patientDiseaseInfoList
this.patientDiseaseInfoList.forEach(e => {
e.id = e.diseaseId
})
2022-11-14 11:24:55 +08:00
if (this.appPersonallist.locationName) {
this.chooseLocation = this.appPersonallist.locationName
2022-11-11 14:19:07 +08:00
}
2022-11-01 14:54:09 +08:00
},
2022-10-28 13:31:36 +08:00
methods: {
2022-11-03 17:26:15 +08:00
//上传图片+提交信息
informationinfo() {
//上传图片
var that = this
2022-11-11 14:19:07 +08:00
if (this.image) {
2022-11-09 16:38:05 +08:00
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'
})
2022-11-11 17:23:23 +08:00
if (that.timer) {
clearTimeout(that.timer)
}
that.timer = setTimeout(e => {
2022-11-11 14:19:07 +08:00
uni.navigateBack({
delta: 1
})
}, 1500)
2022-11-09 16:38:05 +08:00
} 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'
})
2022-11-11 17:23:23 +08:00
if (that.timer) {
clearTimeout(that.timer)
}
that.timer = setTimeout(e => {
2022-11-11 14:19:07 +08:00
uni.navigateBack({
delta: 1
})
}, 1500)
2022-11-09 16:38:05 +08:00
} else if (res.code == 500) {
that.$refs.uToast.show({
title: res.msg,
type: 'error',
url: ''
})
}
})
}
2022-11-03 17:26:15 +08:00
},
//上传头像
uploadImag() {
var that = this;
uni.chooseImage({
count: 1,
sizeType: ['original'],
sourceType: ['album'],
success(res) {
that.appPersonallist.headPictureUrl = res.tempFilePaths[0]
2022-11-09 16:38:05 +08:00
that.img = res.tempFilePaths[0]
2022-11-11 14:19:07 +08:00
that.image = res.tempFilePaths[0]
2022-11-03 17:26:15 +08:00
}
})
},
//获取所在位置
getAddress() {
var that = this;
uni.chooseLocation({
success: function(res) {
2022-11-14 11:24:55 +08:00
that.appPersonallist.locationName = res.address
2022-11-11 14:19:07 +08:00
that.chooseLocation = res.name
that.appPersonallist.homeLongitude = res.longitude;
that.appPersonallist.homeLatitude = res.latitude;
2022-11-03 17:26:15 +08:00
}
});
},
//区街道选择
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;
})
},
//跳转疾病选择
2022-11-01 14:54:09 +08:00
godisease() {
uni.navigateTo({
url: `/pages/disease/disease?diseaseInfoList=${JSON.stringify(this.patientDiseaseInfoList)}`,
})
},
},
2022-11-11 14:19:07 +08:00
onUnload() {
// 页面卸载时设置插件选点数据为null防止再次进入页面geLocation返回的是上次选点结果
chooseLocation.setLocation(null);
},
2022-11-01 14:54:09 +08:00
//带参返回
onShow() {
let that = this
uni.$on('disease', function(data) {
that.patientDiseaseInfoList = JSON.parse(data.disease)
2022-11-11 17:23:23 +08:00
console.log(that.patientDiseaseInfoList)
2022-11-01 14:54:09 +08:00
})
2022-10-28 13:31:36 +08:00
}
}
</script>
<style lang="scss">
2022-11-03 17:26:15 +08:00
@import "./modify.scss"
2022-10-28 13:31:36 +08:00
</style>