NurseStationPersonApp/pages/Modifyinformation/Modifyinformation.vue

235 lines
5.1 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-09 10:57:02 +08:00
<image class="picture" :src="appPersonallist.avatar" mode=""></image>
2022-11-03 18:16:30 +08:00
<image class="pictureA" src="../../static/jiantou.png" mode=""></image>
</view>
<view class="content">
<view class="name">昵称
<input type="text" placeholder="请填写" v-model="appPersonallist.userName" />
</view>
<view class="name">姓名:
<input type="text" placeholder="请输入" v-model="appPersonallist.nickName" />
</view>
<view class="name">电话
<input type="text" placeholder="请输入" v-model="appPersonallist.phonenumber" />
</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-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-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
},
},
onLoad(options) {
2022-11-09 10:57:02 +08:00
this.info();
2022-11-03 18:16:30 +08:00
this.baseurl = baseurl;
const 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-03 18:16:30 +08:00
}
})
},
myInfo() {
nursePerson(this.phonenumber, this.password).then(res => {
2022-11-09 10:57:02 +08:00
res.data.avatar = 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
uni.uploadFile({
url: baseurl + '/nurseApp/personLogin/updateHeadAvatarHead',
filePath: that.appPersonallist.avatar, //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',
url: '/pages/personal/personal',
duration: '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,
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 {
margin-left: 5%;
height: 100rpx;
border-bottom: 1rpx solid #D8D4D4;
input {
font-size: 36rpx;
margin-top: -11%;
margin-left: 15%;
}
}
.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-03 18:16:30 +08:00
margin-left: 5%;
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>