196 lines
4.8 KiB
Vue
196 lines
4.8 KiB
Vue
<template>
|
|
<view class="app">
|
|
<view class="centercontent">
|
|
<view class="Commodity" @tap="uploadImag()">
|
|
头像
|
|
<image class="picture" :src="img" mode=""></image>
|
|
<image class="pictureA" src="../../static/jiantou.png" mode=""></image>
|
|
</view>
|
|
<view class="content">
|
|
<view class="name">
|
|
<span>姓名:</span>
|
|
<input type="text" maxlength="10" placeholder="请输入" v-model="appPersonallist.nickName" />
|
|
</view>
|
|
<view class="name">
|
|
<span class="">
|
|
账号:
|
|
</span>
|
|
<input type="text" disabled maxlength="10" placeholder="请填写" v-model="appPersonallist.userName" />
|
|
</view>
|
|
<view class="name">
|
|
<span>电话:</span>
|
|
<input disabled type="text" maxlength="11" placeholder="请输入"
|
|
v-model="appPersonallist.phonenumber" />
|
|
</view>
|
|
<view class="nursetype name" style="border: none;line-height: 50rpx;margin: 20rpx 20rpx;">
|
|
护理站:{{getNurseStationName(appPersonallist)}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="title">
|
|
注:只可修改姓名和头像
|
|
</view>
|
|
<view class="finish" @tap="gofinish()">完成
|
|
</view>
|
|
<u-select v-model="show" mode="single-column" :list="NurseStationList" @confirm="confirm"></u-select>
|
|
<u-toast ref="uToast" />
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
personNurseStationLists
|
|
} from '@/api/register/index.js'
|
|
import {
|
|
userPassWord,
|
|
nursePerson
|
|
} from '@/api/Modifyinformation/Modifyinformation.js';
|
|
import baseurl from '@/api/baseurl.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
show: false,
|
|
baseurl: '', //url
|
|
img: null,
|
|
image: null,
|
|
NurseStationList: [], //护理站list
|
|
appPersonallist: {
|
|
userId: '',
|
|
userName: '',
|
|
nickName: '',
|
|
phonenumber: '',
|
|
avatar: '',
|
|
File: '',
|
|
},
|
|
timer: null,
|
|
}
|
|
},
|
|
computed: {
|
|
getNurseStationName() {
|
|
return data => data?.nurseStationSysUserVOList?. [0]?.nurseStationName || ''
|
|
},
|
|
},
|
|
onShow() {
|
|
this.info();
|
|
this.baseurl = baseurl;
|
|
},
|
|
onLoad(options) {
|
|
let that = this
|
|
try {
|
|
const value = uni.getStorageSync('phonenumber');
|
|
const value2 = uni.getStorageSync('password');
|
|
if (value && value2) {
|
|
that.phonenumber = value
|
|
that.password = value2
|
|
that.myInfo()
|
|
}
|
|
} catch (e) {}
|
|
},
|
|
methods: {
|
|
//上传头像
|
|
uploadImag() {
|
|
var that = this;
|
|
uni.chooseImage({
|
|
count: 1,
|
|
sourceType: ['album'],
|
|
success(res) {
|
|
that.appPersonallist.avatar = res.tempFilePaths[0]
|
|
that.img = res.tempFilePaths[0]
|
|
that.image = true
|
|
}
|
|
})
|
|
},
|
|
myInfo() {
|
|
nursePerson(this.phonenumber, this.password).then(res => {
|
|
this.img = baseurl + res.data.avatar
|
|
this.appPersonallist = res.data
|
|
})
|
|
},
|
|
gofinish() {
|
|
var that = this
|
|
if (this.image) {
|
|
uni.uploadFile({
|
|
url: baseurl + '/nurseApp/personLogin/updateHeadAvatarHead',
|
|
filePath: that.img, //file: 二进制(filePath)
|
|
name: 'file',
|
|
formData: { //多余值
|
|
'userId': that.appPersonallist.userId,
|
|
},
|
|
header: {
|
|
'content-type': 'multipart/form-data'
|
|
},
|
|
timeout: 5000,
|
|
success(res) {
|
|
that.appPersonallist.avatar = JSON.parse(res.data).imgUrl
|
|
userPassWord(that.appPersonallist).then(res => {
|
|
if (res.code == 200) {
|
|
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'
|
|
})
|
|
}
|
|
})
|
|
}
|
|
})
|
|
} else {
|
|
userPassWord(that.appPersonallist).then(res => {
|
|
console.log(res)
|
|
if (res.code == 200) {
|
|
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']
|
|
},
|
|
//护理站
|
|
info() {
|
|
personNurseStationLists(this.pageNum, this.pageSize).then(res => {
|
|
this.NurseStationList = res.rows.map((e) => {
|
|
return {
|
|
value: e.id,
|
|
label: e.nurseStationName,
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
<style lang="scss">
|
|
@import './Modifyinformation.scss';
|
|
</style>
|