292 lines
6.3 KiB
Vue
292 lines
6.3 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 class="">
|
||
昵称:
|
||
</span>
|
||
<input type="text" maxlength="10" placeholder="请填写" v-model="appPersonallist.userName" />
|
||
</view>
|
||
<view class="name">
|
||
<span>姓名:</span>
|
||
<input type="text" maxlength="10" placeholder="请输入" v-model="appPersonallist.nickName" />
|
||
</view>
|
||
<!-- <view class="name">
|
||
<span>电话:</span>
|
||
<input type="text" maxlength="11" placeholder="请输入" v-model="appPersonallist.phonenumber" />
|
||
</view> -->
|
||
<!-- <view class="nursetype name" style="border: none;" @tap='show=true'>
|
||
护理站:{{getNurseStationName(appPersonallist)}}
|
||
</view> -->
|
||
</view>
|
||
</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');
|
||
if (value) {
|
||
that.phonenumber = value
|
||
}
|
||
} catch (e) {}
|
||
try {
|
||
const value = uni.getStorageSync('password');
|
||
if (value) {
|
||
that.password = value
|
||
}
|
||
} catch (e) {}
|
||
this.myInfo()
|
||
},
|
||
methods: {
|
||
//上传头像
|
||
uploadImag() {
|
||
var that = this;
|
||
uni.chooseImage({
|
||
count: 1,
|
||
sizeType: ['original'],
|
||
sourceType: ['album'],
|
||
success(res) {
|
||
that.appPersonallist.avatar = res.tempFilePaths[0]
|
||
that.img = res.tempFilePaths[0]
|
||
that.image = res.tempFilePaths[0]
|
||
}
|
||
})
|
||
},
|
||
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.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',
|
||
})
|
||
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">
|
||
.app {
|
||
background-color: #F4F5F7;
|
||
width: 100%;
|
||
height: 100vh;
|
||
color: #000000;
|
||
padding: 3%;
|
||
font-size: 36rpx;
|
||
|
||
.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;
|
||
}
|
||
|
||
.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: 20rpx;
|
||
height: 100rpx;
|
||
line-height: 100rpx;
|
||
border-bottom: 1rpx solid #D8D4D4;
|
||
position: relative;
|
||
|
||
span {
|
||
display: inline-block;
|
||
width: 20%;
|
||
}
|
||
|
||
input {
|
||
position: absolute;
|
||
top: 50%;
|
||
transform: translateY(-50%);
|
||
line-height: 100rpx;
|
||
display: inline-block;
|
||
width: 80%;
|
||
font-size: 36rpx;
|
||
|
||
}
|
||
}
|
||
|
||
.nursetype {
|
||
height: 120rpx;
|
||
|
||
input {
|
||
margin-left: 25%;
|
||
}
|
||
}
|
||
}
|
||
|
||
.Commodity {
|
||
line-height: 130rpx;
|
||
margin-left: 20rpx;
|
||
border-bottom: 1rpx solid #D8D4D4;
|
||
position: relative;
|
||
|
||
.picture {
|
||
position: absolute;
|
||
right: 10%;
|
||
top: 50%;
|
||
transform: translateY(-50%);
|
||
width: 110rpx;
|
||
height: 110rpx;
|
||
border-radius: 50%;
|
||
}
|
||
|
||
.pictureA {
|
||
position: absolute;
|
||
right: 2%;
|
||
top: 50%;
|
||
transform: translateY(-50%);
|
||
width: 18rpx;
|
||
height: 27rpx;
|
||
}
|
||
|
||
.head {
|
||
line-height: 140rpx;
|
||
margin-left: 5%;
|
||
display: inline-block;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</style>
|