NurseStationPersonApp/pages/Modifyinformation/Modifyinformation.vue

292 lines
6.3 KiB
Vue
Raw Normal View History

2022-11-03 18:16:30 +08:00
<template>
<view class="app">
<view class="centercontent">
<view class="Commodity" @tap="uploadImag()">
头像
2022-11-11 17:37:41 +08:00
<image class="picture" :src="img" mode=""></image>
2022-11-03 18:16:30 +08:00
<image class="pictureA" src="../../static/jiantou.png" mode=""></image>
</view>
<view class="content">
2022-11-10 16:40:52 +08:00
<view class="name">
<span class="">
昵称
</span>
2022-11-11 17:37:41 +08:00
<input type="text" maxlength="10" placeholder="请填写" v-model="appPersonallist.userName" />
2022-11-03 18:16:30 +08:00
</view>
2022-11-10 16:40:52 +08:00
<view class="name">
<span>姓名:</span>
2022-11-11 17:37:41 +08:00
<input type="text" maxlength="10" placeholder="请输入" v-model="appPersonallist.nickName" />
2022-11-03 18:16:30 +08:00
</view>
2022-11-14 12:41:59 +08:00
<!-- <view class="name">
2022-11-10 16:40:52 +08:00
<span>电话</span>
2022-11-11 17:37:41 +08:00
<input type="text" maxlength="11" placeholder="请输入" v-model="appPersonallist.phonenumber" />
2022-11-14 12:41:59 +08:00
</view> -->
2022-11-09 10:57:02 +08:00
<!-- <view class="nursetype name" style="border: none;" @tap='show=true'>
2022-11-03 18:16:30 +08:00
护理站:{{getNurseStationName(appPersonallist)}}
2022-11-09 10:57:02 +08:00
</view> -->
2022-11-03 18:16:30 +08:00
</view>
</view>
2022-11-09 10:57:02 +08:00
<view class="finish" @tap="gofinish()">完成
</view>
<u-select v-model="show" mode="single-column" :list="NurseStationList" @confirm="confirm"></u-select>
<u-toast ref="uToast" />
2022-11-03 18:16:30 +08:00
</view>
</template>
<script>
2022-11-09 10:57:02 +08:00
import {
personNurseStationLists
} from '@/api/register/index.js'
2022-11-03 18:16:30 +08:00
import {
userPassWord,
nursePerson
} from '@/api/Modifyinformation/Modifyinformation.js';
import baseurl from '@/api/baseurl.js'
export default {
data() {
return {
2022-11-09 10:57:02 +08:00
show: false,
2022-11-03 18:16:30 +08:00
baseurl: '', //url
2022-11-11 17:37:41 +08:00
img: null,
image: null,
2022-11-09 10:57:02 +08:00
NurseStationList: [], //护理站list
2022-11-03 18:16:30 +08:00
appPersonallist: {
userId: '',
userName: '',
nickName: '',
phonenumber: '',
avatar: '',
File: '',
},
2022-11-11 17:37:41 +08:00
timer: null,
2022-11-03 18:16:30 +08:00
}
},
2022-11-09 10:57:02 +08:00
computed: {
2022-11-03 18:16:30 +08:00
getNurseStationName() {
2022-11-09 10:57:02 +08:00
return data => data?.nurseStationSysUserVOList?. [0]?.nurseStationName || ''
2022-11-03 18:16:30 +08:00
},
},
2022-11-10 10:51:44 +08:00
onShow() {
2022-11-11 17:37:41 +08:00
this.info();
this.baseurl = baseurl;
},
onLoad(options) {
2022-11-10 10:51:44 +08:00
let that = this
2022-11-09 10:57:02 +08:00
try {
const value = uni.getStorageSync('phonenumber');
if (value) {
that.phonenumber = value
2022-11-03 18:16:30 +08:00
}
2022-11-09 10:57:02 +08:00
} catch (e) {}
try {
const value = uni.getStorageSync('password');
if (value) {
that.password = value
2022-11-03 18:16:30 +08:00
}
2022-11-09 10:57:02 +08:00
} catch (e) {}
2022-11-03 18:16:30 +08:00
this.myInfo()
},
methods: {
//上传头像
uploadImag() {
var that = this;
uni.chooseImage({
count: 1,
sizeType: ['original'],
sourceType: ['album'],
success(res) {
2022-11-09 10:57:02 +08:00
that.appPersonallist.avatar = res.tempFilePaths[0]
2022-11-11 17:37:41 +08:00
that.img = res.tempFilePaths[0]
that.image = res.tempFilePaths[0]
2022-11-03 18:16:30 +08:00
}
})
},
myInfo() {
nursePerson(this.phonenumber, this.password).then(res => {
2022-11-11 17:37:41 +08:00
this.img = baseurl + res.data.avatar
2022-11-03 18:16:30 +08:00
this.appPersonallist = res.data
})
},
gofinish() {
2022-11-09 10:57:02 +08:00
var that = this
2022-11-11 17:37:41 +08:00
if (this.image) {
uni.uploadFile({
url: baseurl + '/nurseApp/personLogin/updateHeadAvatarHead',
filePath: that.image, //file: 二进制(filePath)
name: 'file',
formData: { //多余值
'userId': that.appPersonallist.userId,
},
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',
2022-11-10 10:51:44 +08:00
})
2022-11-11 17:37:41 +08:00
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)
2022-11-09 10:57:02 +08:00
}
2022-11-11 17:37:41 +08:00
that.timer = setTimeout(e => {
uni.navigateBack({
delta: 1
})
}, 1500)
} else {
that.$refs.uToast.show({
title: res.msg,
type: 'error'
})
}
})
}
2022-11-09 10:57:02 +08:00
},
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,
2022-11-03 18:16:30 +08:00
}
2022-11-09 10:57:02 +08:00
})
2022-11-03 18:16:30 +08:00
})
},
},
}
</script>
<style lang="scss">
.app {
background-color: #F4F5F7;
width: 100%;
height: 100vh;
color: #000000;
padding: 3%;
font-size: 36rpx;
2022-11-09 10:57:02 +08:00
.finish {
width: 217rpx;
font-size: 32rpx;
color: #FFFFFF;
height: 68rpx;
line-height: 68rpx;
text-align: center;
position: absolute;
top: 70%;
left: 70%;
background: #4C7BC9;
border-radius: 26rpx;
}
2022-11-03 18:16:30 +08:00
.centercontent {
width: 99%;
background: #FFFFFF;
box-shadow: 0rpx 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
border-radius: 20rpx;
margin: 0 auto;
.content {
line-height: 100rpx;
.name {
2022-11-10 16:40:52 +08:00
margin-left: 20rpx;
2022-11-03 18:16:30 +08:00
height: 100rpx;
2022-11-10 16:40:52 +08:00
line-height: 100rpx;
2022-11-03 18:16:30 +08:00
border-bottom: 1rpx solid #D8D4D4;
2022-11-10 16:40:52 +08:00
position: relative;
2022-11-11 17:37:41 +08:00
span {
2022-11-10 16:40:52 +08:00
display: inline-block;
width: 20%;
}
2022-11-11 17:37:41 +08:00
2022-11-03 18:16:30 +08:00
input {
2022-11-10 16:40:52 +08:00
position: absolute;
2022-11-11 17:37:41 +08:00
top: 50%;
2022-11-10 16:40:52 +08:00
transform: translateY(-50%);
line-height: 100rpx;
display: inline-block;
width: 80%;
2022-11-03 18:16:30 +08:00
font-size: 36rpx;
2022-11-10 16:40:52 +08:00
2022-11-03 18:16:30 +08:00
}
}
.nursetype {
2022-11-09 10:57:02 +08:00
height: 120rpx;
2022-11-03 18:16:30 +08:00
input {
margin-left: 25%;
}
}
}
.Commodity {
2022-11-09 10:57:02 +08:00
line-height: 130rpx;
2022-11-10 16:40:52 +08:00
margin-left: 20rpx;
2022-11-03 18:16:30 +08:00
border-bottom: 1rpx solid #D8D4D4;
2022-11-09 10:57:02 +08:00
position: relative;
2022-11-03 18:16:30 +08:00
.picture {
2022-11-09 10:57:02 +08:00
position: absolute;
right: 10%;
top: 50%;
transform: translateY(-50%);
width: 110rpx;
height: 110rpx;
2022-11-03 18:16:30 +08:00
border-radius: 50%;
}
.pictureA {
2022-11-09 10:57:02 +08:00
position: absolute;
right: 2%;
top: 50%;
transform: translateY(-50%);
2022-11-03 18:16:30 +08:00
width: 18rpx;
height: 27rpx;
}
.head {
line-height: 140rpx;
margin-left: 5%;
display: inline-block;
}
}
}
}
</style>