NurseStationPersonAppletUl/pages/Modifyinformation/Modifyinformation.vue

320 lines
9.7 KiB
Vue
Raw Permalink 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">
2023-04-11 10:38:25 +08:00
<image class="picture" :src="myimg" mode="" v-if="myimg"></image>
<image class="picture" :src="baseurl + appPersonallist.avatar" mode="" v-else></image>
2023-04-03 14:55:17 +08:00
<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>
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" style="">
<span>家庭住址</span>
<text v-if="appPersonallist.address"> {{appPersonallist.address}}
</text>
2023-03-28 10:02:47 +08:00
</view>
<view class="nursetype " style="">
护理站
2023-04-11 10:38:25 +08:00
<text v-for='(uitem,uindex) in appPersonallist.nurseStationSysUserVOList' :key="uindex">
{{uitem.nurseStationName}}
<text v-if="uindex!=appPersonallist.nurseStationSysUserVOList.length-1"></text>
2023-03-28 10:02:47 +08:00
</text>
<!-- {{getNurseStationName(appPersonallist)}} -->
</view>
2023-04-10 13:31:30 +08:00
<view class="nursetype" @tap='positionalTitleLevelshow=true'>
<span>职称级别</span>
<text v-if="appPersonallist.positionalTitleLevelvalue">
{{appPersonallist.positionalTitleLevelvalue}}
2023-04-03 14:55:17 +08:00
</text>
</view>
2023-04-10 13:31:30 +08:00
<view class="name" style="">
擅长项目
<input type="text" placeholder=" " v-model="appPersonallist.geniusItem" />
<!-- <input type="text" v-model="appPersonallist.geniusItem" /> -->
<!-- <text v-if="appPersonallist.geniusItem"> {{}}
</text> -->
</view>
2023-04-03 14:55:17 +08:00
<view class="nursetype " style="border: none;">
证书上传
2023-04-11 10:04:50 +08:00
<view class="upload" @tap='uploadcertificate' v-if="certificateimg.length==0">
2023-04-03 14:55:17 +08:00
<view class="">
<u-icon name="plus" color='#E6E6E6' label='拍摄上传' label-color='#E6E6E6'></u-icon>
</view>
</view>
<view class="rate" v-else>
2023-04-11 10:38:25 +08:00
<view class="itemimgs" v-for="(item,index) in certificateimg" :key="index">
2023-04-03 14:55:17 +08:00
<image class="delimg" src="../../static/gb2.png" mode="" @tap='delimg(item)'>
</image>
<image class="itemimg" :src="item" mode=""></image>
</view>
2023-04-11 10:04:50 +08:00
<view class="item" @tap='uploadcertificate'>
2023-04-03 14:55:17 +08:00
<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-13 15:18:23 +08:00
<view class="finish" @tap="uploadcertificateimgs">提交</view>
2023-04-10 13:31:30 +08:00
<!-- <u-select v-model="sexshow" :list="sexlist" mode="single-column" @confirm="sexconfirm"></u-select> -->
<u-select v-model="positionalTitleLevelshow" :list="positionalTitleLevellist" mode="single-column"
@confirm="positionalTitleLevelconfirm"></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-10 13:31:30 +08:00
baseurl: '', //url
2023-04-03 14:55:17 +08:00
timer: null, //timer
2023-04-06 13:46:00 +08:00
nursePersonId: null, //护理员id
2023-04-10 13:31:30 +08:00
// sexshow: false, //性别选择
// sexlist: [{
// value: 'MALE',
// label: '男'
// },
// {
// value: 'FEMALE',
// label: '女'
// }
// ],
positionalTitleLevelshow: false,
positionalTitleLevellist: [{
label: "初级",
value: "PRIMARY_LEVEL",
}, {
label: "中级",
value: "MIDDLE_LEVEL",
}, {
label: "高级",
value: "HIGH_LEVEL",
}],
2023-03-28 10:02:47 +08:00
appPersonallist: {
2023-04-03 14:55:17 +08:00
nurseStationPersonCheckList: []
}, //用户信息
2023-04-10 17:00:48 +08:00
image: false, //判断是否上传头像
2023-04-03 14:55:17 +08:00
certificateimg: [], //证书img
myimg: null, //头像img
2023-04-10 17:19:54 +08:00
uploadcertificateimg: [], //上传的证书img
2023-03-28 10:02:47 +08:00
}
},
computed: {
// getNurseStationName() {
// return data => data?.nurseStationSysUserVOList?. [0]?.nurseStationName || ''
// },
},
2023-04-11 10:44:37 +08:00
onShow() {},
onLoad(options) {
2023-04-10 17:00:48 +08:00
this.image = false
2023-03-28 10:02:47 +08:00
this.baseurl = baseurl;
let that = this
2023-04-06 13:46:00 +08:00
const value = uni.getStorageSync('nursePersonId');
if (value) {
that.nursePersonId = value
that.myInfo()
} else {}
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)
2023-04-12 14:17:40 +08:00
this.uploadcertificateimg = this.uploadcertificateimg.filter(e => e != item)
2023-04-12 16:21:24 +08:00
this.appPersonallist.nurseStationPersonCertificateList = this.appPersonallist
.nurseStationPersonCertificateList
.filter(e => (this.baseurl + e.certificateUrl) != item)
2023-04-03 14:55:17 +08:00
},
//上传证书
2023-04-11 10:04:50 +08:00
uploadcertificate() {
2023-04-03 14:55:17 +08:00
var that = this;
uni.chooseImage({
count: 9,
success(res) {
res.tempFilePaths.forEach(e => {
2023-04-10 17:19:54 +08:00
that.uploadcertificateimg.push(e)
2023-04-03 14:55:17 +08:00
that.certificateimg.push(e)
})
}
})
},
2023-03-28 10:02:47 +08:00
//上传头像
uploadImag() {
var that = this;
uni.chooseImage({
count: 1,
success(res) {
that.image = true
2023-04-11 10:38:25 +08:00
that.myimg = res.tempFilePaths[0]
that.appPersonallist.avatar = res.tempFilePaths[0]
2023-03-28 10:02:47 +08:00
}
})
},
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 = '女' : ''
2023-04-11 09:53:41 +08:00
res.data.positionalTitleLevel == 'PRIMARY_LEVEL' ? res.data.positionalTitleLevelvalue = '初级' :
2023-04-10 13:31:30 +08:00
''
2023-04-11 09:53:41 +08:00
res.data.positionalTitleLevel == 'MIDDLE_LEVEL' ? res.data.positionalTitleLevelvalue = '中级' :
2023-04-10 13:31:30 +08:00
''
2023-04-11 09:53:41 +08:00
res.data.positionalTitleLevel == 'HIGH_LEVEL' ? res.data.positionalTitleLevelvalue = '高级' : ''
2023-04-12 13:30:55 +08:00
res.data.id = this.nursePersonId
2023-04-03 14:55:17 +08:00
res.data.nurseStationPersonCertificateList.forEach(e => {
2023-04-07 15:34:32 +08:00
if (e.certificateUrl) {
2023-04-12 13:30:55 +08:00
this.certificateimg.push(baseurl + e.certificateUrl)
2023-04-07 15:34:32 +08:00
}
2023-04-03 14:55:17 +08:00
})
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
2023-04-13 16:07:39 +08:00
if (!that.timer) {
if (this.uploadcertificateimg && this.uploadcertificateimg.length > 0) {
this.uploadcertificateimg.forEach(e => {
uni.uploadFile({
url: baseurl +
'/nurseApplet/personCenter/uploadNurseStationPersonCertificateUrl',
filePath: e, //file: 二进制(filePath)
name: 'file',
formData: { //多余值
'nursePersonId': that.nursePersonId,
},
timeout: 10000,
success(res) {
var img = {
certificateUrl: JSON.parse(res.data).imgUrl
}
that.appPersonallist.nurseStationPersonCheckList.push(img)
if (that.appPersonallist.nurseStationPersonCheckList.length == that
.uploadcertificateimg.length) {
that.gofinish();
that.appPersonallist.nurseStationPersonCheckList = []
that.uploadcertificateimg = []
}
2023-04-03 14:55:17 +08:00
}
2023-04-13 16:07:39 +08:00
})
2023-04-03 14:55:17 +08:00
})
2023-04-13 16:07:39 +08:00
} else {
that.gofinish();
}
2023-04-03 14:55:17 +08:00
}
},
//修改
2023-03-28 10:02:47 +08:00
gofinish() {
var that = this
if (this.image) {
uni.uploadFile({
url: baseurl + '/nurseApp/personLogin/updateHeadAvatarHead',
2023-04-11 10:38:25 +08:00
filePath: that.appPersonallist.avatar, //file: 二进制(filePath)
2023-03-28 10:02:47 +08:00
name: 'file',
formData: { //多余值
'userId': that.appPersonallist.userId,
},
2023-04-12 16:24:50 +08:00
timeout: 10000,
2023-03-28 10:02:47 +08:00
success(res) {
that.appPersonallist.avatar = JSON.parse(res.data).imgUrl
2023-04-11 10:04:50 +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() {
2023-04-12 13:30:55 +08:00
this.appPersonallist.nurseStationPersonCertificateList.forEach(e => {
var img = {
certificateUrl: e.certificateUrl
}
this.appPersonallist.nurseStationPersonCheckList.push(img)
})
2023-04-03 14:55:17 +08:00
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.$refs.uToast.show({
2023-04-13 15:18:23 +08:00
title: '为了保证资料真实,平台需要对你的资料进行审核,请耐心等待',
2023-04-03 14:55:17 +08:00
type: 'success',
2023-04-13 15:25:29 +08:00
duration: '10000',
2023-04-03 14:55:17 +08:00
})
2023-04-13 16:08:52 +08:00
that.timer = setTimeout(e => {
2023-04-03 14:55:17 +08:00
uni.navigateBack({
delta: 1
})
2023-04-13 15:25:51 +08:00
}, 10000)
2023-04-03 14:55:17 +08:00
} 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
},
2023-04-10 13:31:30 +08:00
//职称级别
positionalTitleLevelconfirm(e) {
this.appPersonallist.positionalTitleLevelvalue = e[0].label
this.appPersonallist.positionalTitleLevel = e[0].value
},
2023-04-03 14:55:17 +08:00
//选择性别
sexconfirm(e) {
this.appPersonallist.sex = e[0].label
2023-03-28 10:02:47 +08:00
},
},
}
</script>
<style lang="scss">
@import './Modifyinformation.scss';
</style>