NurseStationPersonAppletUl/pages/Modifyinformation/Modifyinformation.vue
2023-04-10 17:19:54 +08:00

314 lines
9.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="app">
<view class="Commodity" @tap="uploadImag">
<image class="picture" :src="myimg" mode=""></image>
<view class="">
点击编辑头像
</view>
</view>
<view class="centercontent" v-if="appPersonallist">
<view class="content">
<view class="name">
<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>
</view>
<view class="name">
<span>年龄:</span>
<input type="text" maxlength="4" placeholder=" " v-model="appPersonallist.age" disabled />
</view>
<!-- <view class="name">
<span class="">
账号:
</span>
</view> -->
<view class="name">
<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>
</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>
<view class="nursetype" @tap='positionalTitleLevelshow=true'>
<span>职称级别:</span>
<text v-if="appPersonallist.positionalTitleLevelvalue">
{{appPersonallist.positionalTitleLevelvalue}}
</text>
</view>
<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>
<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>
</view>
</view>
<view class="finish" @tap="uploadcertificateimgs">保存</view>
<!-- <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>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
updateNursePersonCheck,
personNurseStationLists
} from '@/api/Modifyinformation/Modifyinformation.js';
import {
nurseAppletPersonCenter,
} from '@/api/personnal/personal.js';
import baseurl from '@/api/baseurl.js'
export default {
data() {
return {
baseurl: '', //url
timer: null, //timer
nursePersonId: null, //护理员id
// sexshow: false, //性别选择
// sexlist: [{
// value: 'MALE',
// label: '男'
// },
// {
// value: 'FEMALE',
// label: '女'
// }
// ],
positionalTitleLevelshow: false,
positionalTitleLevellist: [{
label: "初级",
value: "PRIMARY_LEVEL",
}, {
label: "中级",
value: "MIDDLE_LEVEL",
}, {
label: "高级",
value: "HIGH_LEVEL",
}],
appPersonallist: {
nurseStationPersonCheckList: []
}, //用户信息
image: false, //判断是否上传头像
certificateimg: [], //证书img
myimg: null, //头像img
uploadcertificateimg: [], //上传的证书img
}
},
computed: {
// getNurseStationName() {
// return data => data?.nurseStationSysUserVOList?. [0]?.nurseStationName || ''
// },
},
onShow() {
this.image = false
this.baseurl = baseurl;
let that = this
const value = uni.getStorageSync('nursePersonId');
if (value) {
that.nursePersonId = value
that.myInfo()
} else {}
},
onLoad(options) {},
methods: {
//删除证书图片
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.uploadcertificateimg.push(e)
that.certificateimg.push(e)
})
}
})
},
//上传头像
uploadImag() {
var that = this;
uni.chooseImage({
count: 1,
sourceType: ['album'],
success(res) {
that.appPersonallist.avatar = res.tempFilePaths[0]
that.myimg = res.tempFilePaths[0]
that.image = true
}
})
},
//个人信息
myInfo() {
this.certificateimg = []
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.positionalTitleLevelvalue == 'PRIMARY_LEVEL' ? res.data.positionalTitleLevel = '初级' :
''
res.data.positionalTitleLevelvalue == 'MIDDLE_LEVEL' ? res.data.positionalTitleLevel = '中级' :
''
res.data.positionalTitleLevelvalue == 'HIGH_LEVEL' ? res.data.positionalTitleLevel = '高级' : ''
res.data.nurseStationPersonCertificateList.forEach(e => {
if (e.certificateUrl) {
e.certificateUrl = baseurl + e.certificateUrl
this.certificateimg.push(e.certificateUrl)
}
})
res.data.id = this.nursePersonId
res.data.nurseStationPersonCheckList = []
this.appPersonallist = res.data
})
},
//上传证书
uploadcertificateimgs() {
let that = this
if (this.uploadcertificateimg && this.uploadcertificateimg.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();
}
},
//修改
gofinish() {
var that = this
if (this.image) {
console.log(3)
uni.uploadFile({
url: baseurl + '/nurseApp/personLogin/updateHeadAvatarHead',
filePath: that.myimg, //file: 二进制(filePath)
name: 'file',
formData: { //多余值
'userId': that.appPersonallist.userId,
},
timeout: 5000,
success(res) {
that.appPersonallist.avatar = JSON.parse(res.data).imgUrl
// that.updateNursePerson();
}
})
} else {
console.log(2)
that.updateNursePerson();
}
},
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'
})
}
})
},
confirm(e) {
this.appPersonallist.nurseStationSysUserVOList[0].nurseStationId = e[0].value
this.appPersonallist.nurseStationSysUserVOList[0].nurseStationName = e[0]['label']
},
//开启选择性别
sexshowtrue() {
this.sexshow = true
},
//职称级别
positionalTitleLevelconfirm(e) {
this.appPersonallist.positionalTitleLevelvalue = e[0].label
this.appPersonallist.positionalTitleLevel = e[0].value
},
//选择性别
sexconfirm(e) {
this.appPersonallist.sex = e[0].label
},
},
}
</script>
<style lang="scss">
@import './Modifyinformation.scss';
</style>