NurseStationApp/pages/modify/modify.vue
2022-11-03 17:26:15 +08:00

201 lines
5.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="appPersonallist.headPictureUrl" 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()'
v-if="appPersonallist.homeLongitude&&this.appPersonallist.homeLatitude">
<span>所在位置:</span>
<view>{{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: '',
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.appPersonallist.headPictureUrl = baseurl + this.appPersonallist.headPictureUrl
this.patientDiseaseInfoList = this.appPersonallist.patientDiseaseInfoList
this.patientDiseaseInfoList.forEach(e => {
e.id = e.diseaseId
})
this.chooseLocation = '东经:' + this.appPersonallist.homeLongitude + '度' + ' 北纬:' + this.appPersonallist
.homeLatitude + '度';
},
methods: {
//上传图片+提交信息
informationinfo() {
//上传图片
var that = this
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.homeLongitude = '1'
// that.appPersonallist.homeLatitude = '1'
that.appPersonallist.diseaseInfoList = that.patientDiseaseInfoList
console.log(that.appPersonallist)
information(that.appPersonallist).then(res => {
if (res.code == 200) {
that.$refs.uToast.show({
title: '修改信息成功',
type: 'success',
url: '/pages/user/user',
duration: '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]
console.log(that.appPersonallist.headPictureUrl)
}
})
},
//获取所在位置
getAddress() {
var that = this;
uni.chooseLocation({
success: function(res) {
that.chooseLocation = '东经:' + res.longitude + ' 北纬:' + res.latitude;
console.log(that.chooseLocation)
}
});
},
//区街道选择
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)}`,
})
},
},
//带参返回
onShow() {
let that = this
uni.$on('disease', function(data) {
that.patientDiseaseInfoList = JSON.parse(data.disease)
that.patientDiseaseInfoList.forEach(e => {
e.disbaseId = e.id
})
// console.log(that.patientDiseaseInfoList)
})
}
}
</script>
<style lang="scss">
@import "./modify.scss"
</style>