NurseStationPersonApp/pages/register/register.vue
2022-11-09 10:57:02 +08:00

146 lines
3.7 KiB
Vue

<template>
<view class="app">
<view class="item">
<view class="lefttext">
姓名
</view>
<input class="righttext" type="text" placeholder="请输入" v-model="appPersonallist.nickName" maxlength="30" />
</view>
<view class="item">
<view class="lefttext">
输入密码
</view>
<u-input class='righttext' style='left:30%' placeholder="请输入密码" maxlength="10"
v-model="appPersonallist.password" type="password" :border="false" :password-icon="true" />
</view>
<view class="item">
<view class="lefttext">
重复密码
</view>
<u-input class='righttext' style='left:30%' placeholder="请再次输入密码" maxlength="10"
v-model="appPersonallist.newpassword" type="password" :border="false" :password-icon="true" />
</view>
<view class="item">
<view class="lefttext">
手机号
</view>
<input class="righttext" style='left:23%' type="text" placeholder="请输入" maxlength="11"
v-model="appPersonallist.phonenumber" />
</view>
<view class="item" @tap='show=true'>
<span>护理站</span>
<text class='addition'>{{nurseStationName}}</text>
</view>
<view class="radio-content" @tap="changeRadio">
<view class="radio-right">
<view class="radio" :class="radio == 2 ? 'radio-default':''">
<view :class="radio == 2 ? 'radio-active':''"></view>
</view>
</view>
<text class="agreement">我已阅读并同意</text>
<text @tap='maskshow=true;showRegectAgreeButton=false'>《用户协议》</text>
</view>
<view class="loginbtn" @tap='getInfo'>
注册
</view>
<view class="switch" style="right:5%" @tap='gologin'>
已有账号,去登录
</view>
<u-select v-model="show" mode="single-column" :list="listinfo" @confirm="confirm"></u-select>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
nurseAppLoginSysUser,
personNurseStationLists
} from '@/api/register/index.js'
export default {
data() {
return {
listinfo: [],
show: false,
radio: 1, //用户协议
nurseStationName: '',
pageSize: 999,
pageNum: 1,
appPersonallist: {
nickName: '',
newpassword: '',
phonenumber: '',
password: '',
nurseStationIds: '',
}
};
},
onLoad() {
this.info()
},
methods: {
//护理站
info() {
personNurseStationLists(this.pageNum, this.pageSize).then(res => {
this.listinfo = res.rows.map((e) => {
return {
value: e.id,
label: e.nurseStationName,
}
})
})
},
confirm(e) {
this.appPersonallist.nurseStationIds = e[0].value
this.nurseStationName = e[0]['label']
},
//注册功能
getInfo() {
nurseAppLoginSysUser(this.appPersonallist).then(res => {
console.log(res)
if (this.password !== this.newpassword) {
this.$refs.uToast.show({
title: '密码输入不一致,请重新输入',
type: 'error',
duration: '1500'
})
} else if (res.code == 200) {
this.$refs.uToast.show({
title: '注册成功,前往登录',
type: 'success',
url: '/pages/login/login',
duration: '1500'
})
} else if (this.radio == 1) {
this.$refs.uToast.show({
title: '请审核并同意用户协议',
type: 'error'
})
} else {
this.$refs.uToast.show({
title: res.msg,
type: 'error'
})
}
})
},
//跳转登录页
gologin() {
uni.navigateTo({
url: `/pages/login/login?phonenumber=${this.phonenumber}&password=${this.password}`
})
},
changeRadio() {
if (this.radio == 1) {
this.radio = 2;
} else {
this.radio = 1;
}
},
},
}
</script>
<style lang="scss">
@import './register.scss';
</style>