NurseStationPersonAppletUl/pages/Modifyinformation/Modifyinformation.vue

287 lines
8.1 KiB
Vue
Raw Normal View History

2023-03-28 10:02:47 +08:00
<template>
<view class="app">
2023-04-03 14:55:17 +08:00
<view class="Commodity" @tap="uploadImag">
<image class="picture" :src="myimg" mode=""></image>
<view class="">
点击编辑头像
2023-03-28 10:02:47 +08:00
</view>
2023-04-03 14:55:17 +08:00
</view>
<view class="centercontent" v-if="appPersonallist">
2023-03-28 10:02:47 +08:00
<view class="content">
<view class="name">
2023-04-03 14:55:17 +08:00
<span>姓名</span>
<input type="text" maxlength="10" placeholder="请输入" v-model="appPersonallist.nickName" disabled />
</view>
<view class="name">
<span>性别</span>
<text v-if='appPersonallist.sex'> {{appPersonallist.sex}}
</text>
2023-03-28 10:02:47 +08:00
</view>
<view class="name">
2023-04-03 14:55:17 +08:00
<span>年龄</span>
<input type="text" maxlength="4" placeholder=" " v-model="appPersonallist.age" disabled />
</view>
<!-- <view class="name">
2023-03-28 10:02:47 +08:00
<span class="">
账号
</span>
<input type="text" disabled maxlength="10" placeholder="请填写" v-model="appPersonallist.userName" />
2023-04-03 14:55:17 +08:00
</view> -->
2023-03-28 10:02:47 +08:00
<view class="name">
2023-04-03 14:55:17 +08:00
<span>手机号</span>
<input disabled type="text" maxlength="11" placeholder="请输入" v-model="appPersonallist.phonenumber"
disabled />
</view>
<view class="nursetype">
<span>职称级别</span>
<text v-if="appPersonallist.positionalTitleLevel">
{{appPersonallist.positionalTitleLevel}}
</text>
</view>
<view class="nursetype" style="">
<span>家庭住址</span>
<text v-if="appPersonallist.address"> {{appPersonallist.address}}
</text>
2023-03-28 10:02:47 +08:00
</view>
<view class="nursetype " style="">
护理站
<text v-for='(uitem,index) in appPersonallist.nurseStationSysUserVOList'> {{uitem.nurseStationName}}
<text v-if="index!=appPersonallist.nurseStationSysUserVOList.length-1"></text>
</text>
<!-- {{getNurseStationName(appPersonallist)}} -->
</view>
2023-04-03 14:55:17 +08:00
<view class="nursetype " style="">
擅长项目
<text v-if="appPersonallist.geniusItem"> {{appPersonallist.geniusItem}}
</text>
</view>
<view class="nursetype " style="border: none;">
证书上传
<view class="upload" @tap='uploadcertificateimg' v-if="certificateimg.length==0">
<view class="">
<u-icon name="plus" color='#E6E6E6' label='拍摄上传' label-color='#E6E6E6'></u-icon>
</view>
</view>
<view class="rate" v-else>
<view class="itemimgs" v-for="(item,index) in certificateimg">
<image class="delimg" src="../../static/gb2.png" mode="" @tap='delimg(item)'>
</image>
<image class="itemimg" :src="item" mode=""></image>
</view>
<view class="item" @tap='uploadcertificateimg'>
<image src="../../static/paishe.png" mode=""></image>
<view class="title">
拍摄上传
</view>
</view>
</view>
</view>
2023-03-28 10:02:47 +08:00
</view>
</view>
2023-04-03 14:55:17 +08:00
<view class="finish" @tap="uploadcertificateimgs">保存</view>
<u-select v-model="sexshow" :list="sexlist" mode="single-column" @confirm="sexconfirm"></u-select>
2023-03-28 10:02:47 +08:00
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
2023-04-03 14:55:17 +08:00
updateNursePersonCheck,
2023-03-28 10:02:47 +08:00
personNurseStationLists
} from '@/api/Modifyinformation/Modifyinformation.js';
2023-04-03 14:55:17 +08:00
import {
nurseAppletPersonCenter,
} from '@/api/personnal/personal.js';
2023-03-28 10:02:47 +08:00
import baseurl from '@/api/baseurl.js'
export default {
data() {
return {
2023-04-03 14:55:17 +08:00
timer: null, //timer
nursePersonId: 34, //护理员id
sexshow: false, //性别选择
2023-03-28 10:02:47 +08:00
baseurl: '', //url
2023-04-03 14:55:17 +08:00
sexlist: [{
value: 'MALE',
label: '男'
},
{
value: 'FEMALE',
label: '女'
}
],
2023-03-28 10:02:47 +08:00
appPersonallist: {
2023-04-03 14:55:17 +08:00
nurseStationPersonCheckList: []
}, //用户信息
image: null, //判断是否上传头像
certificateimg: [], //证书img
myimg: null, //头像img
2023-03-28 10:02:47 +08:00
}
},
computed: {
// getNurseStationName() {
// return data => data?.nurseStationSysUserVOList?. [0]?.nurseStationName || ''
// },
},
onShow() {
this.baseurl = baseurl;
},
onLoad(options) {
let that = this
2023-04-03 14:55:17 +08:00
// const value = uni.getStorageSync('nursePersonId');
// if (value) {
// that.nursePersonId= value
that.myInfo()
// }
2023-03-28 10:02:47 +08:00
},
methods: {
2023-04-03 14:55:17 +08:00
//删除证书图片
delimg(item) {
this.certificateimg = this.certificateimg.filter(e => e != item)
},
//上传证书
uploadcertificateimg() {
var that = this;
uni.chooseImage({
count: 9,
success(res) {
res.tempFilePaths.forEach(e => {
that.certificateimg.push(e)
})
}
})
},
2023-03-28 10:02:47 +08:00
//上传头像
uploadImag() {
var that = this;
uni.chooseImage({
count: 1,
sourceType: ['album'],
success(res) {
that.appPersonallist.avatar = res.tempFilePaths[0]
2023-04-03 14:55:17 +08:00
that.myimg = res.tempFilePaths[0]
2023-03-28 10:02:47 +08:00
that.image = true
}
})
},
2023-04-03 14:55:17 +08:00
//个人信息
2023-03-28 10:02:47 +08:00
myInfo() {
2023-04-03 14:55:17 +08:00
nurseAppletPersonCenter(this.nursePersonId).then(res => {
res.data.sex == 'MALE' ? res.data.sex = '男' : ''
res.data.sex == 'FEMALE' ? res.data.sex = '女' : ''
this.myimg = baseurl + res.data.avatar
res.data.positionalTitleLevel == 'PRIMARY_LEVEL' ? res.data.positionalTitleLevel = '初级' : ''
res.data.positionalTitleLevel == 'MIDDLE_LEVEL' ? res.data.positionalTitleLevel = '中级' : ''
res.data.positionalTitleLevel == 'HIGH_LEVEL' ? res.data.positionalTitleLevel = '高级' : ''
res.data.nurseStationPersonCertificateList.forEach(e => {
e.certificateUrl = baseurl + e.certificateUrl
this.certificateimg.push(e.certificateUrl)
})
res.data.id = this.nursePersonId
res.data.nurseStationPersonCheckList = []
2023-03-28 10:02:47 +08:00
this.appPersonallist = res.data
})
},
2023-04-03 14:55:17 +08:00
//上传证书
uploadcertificateimgs() {
let that = this
if (this.certificateimg.length > 0) {
this.certificateimg.forEach(e => {
uni.uploadFile({
url: baseurl +
'/nurseApplet/personCenter/uploadNurseStationPersonCertificateUrl',
filePath: e, //file: 二进制(filePath)
name: 'file',
formData: { //多余值
'nursePersonId': that.nursePersonId,
},
timeout: 5000,
success(res) {
var img = {
certificateUrl: JSON.parse(res.data).imgUrl
}
that.appPersonallist.nurseStationPersonCheckList.push(img)
if (that.appPersonallist.nurseStationPersonCheckList.length == that
.certificateimg.length) {
that.gofinish();
}
}
})
})
} else {
that.gofinish();
}
},
//修改
2023-03-28 10:02:47 +08:00
gofinish() {
var that = this
if (this.image) {
uni.uploadFile({
url: baseurl + '/nurseApp/personLogin/updateHeadAvatarHead',
2023-04-03 14:55:17 +08:00
filePath: that.myimg, //file: 二进制(filePath)
2023-03-28 10:02:47 +08:00
name: 'file',
formData: { //多余值
'userId': that.appPersonallist.userId,
},
timeout: 5000,
success(res) {
that.appPersonallist.avatar = JSON.parse(res.data).imgUrl
2023-04-03 14:55:17 +08:00
that.updateNursePerson();
2023-03-28 10:02:47 +08:00
}
})
} else {
2023-04-03 14:55:17 +08:00
that.updateNursePerson();
2023-03-28 10:02:47 +08:00
}
},
2023-04-03 14:55:17 +08:00
updateNursePerson() {
var that = this
var obj = {
avatar: that.appPersonallist.avatar,
userId: that.appPersonallist.userId,
id: that.nursePersonId,
positionalTitleLevelCheck: that.appPersonallist.positionalTitleLevel,
geniusItemCheck: that.appPersonallist.geniusItem,
nurseStationPersonCheckList: that.appPersonallist.nurseStationPersonCheckList
}
updateNursePersonCheck(obj).then(res => {
if (res.code == 200) {
that.myInfo();
that.$refs.uToast.show({
title: '修改成功',
type: 'success',
duration: '1500',
})
if (that.timer) {
clearTimeout(that.timer)
}
that.timer = setTimeout(e => {
uni.navigateBack({
delta: 1
})
}, 1500)
} else {
that.$refs.uToast.show({
title: res.msg,
type: 'error'
})
}
})
},
2023-03-28 10:02:47 +08:00
confirm(e) {
this.appPersonallist.nurseStationSysUserVOList[0].nurseStationId = e[0].value
this.appPersonallist.nurseStationSysUserVOList[0].nurseStationName = e[0]['label']
},
2023-04-03 14:55:17 +08:00
//开启选择性别
sexshowtrue() {
this.sexshow = true
},
//选择性别
sexconfirm(e) {
this.appPersonallist.sex = e[0].label
2023-03-28 10:02:47 +08:00
},
},
}
</script>
<style lang="scss">
@import './Modifyinformation.scss';
</style>