NurseStationApp/pages/register/register.vue
2022-10-13 17:39:43 +08:00

149 lines
2.7 KiB
Vue

<template>
<view class="app">
<view class="title">
注册账号
</view>
<view class="loginphone">
<input class="phone" type="text" placeholder="手机号码" maxlength="11" v-model="phone" />
</view>
<view class="logincode loginphone" style="top: 40%;">
<u-input class='code phone' placeholder="密码" maxlength="10" v-model="password" type="password"
:border="true" :password-icon="true" />
</view>
<view class="loginbtn" @tap='register'>
立即注册
</view>
<view class="switch" style="left:55%" @tap='gologin'>
已有账号,去登录
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
appRegister
} from '../../api/register/index.js'
export default {
data() {
return {
phone: '13234353453',
password: '123456'
};
},
methods: {
//注册功能
register() {
appRegister(this.phone, this.password).then(res => {
console.log(res)
if (res.code == 200) {
this.$refs.uToast.show({
title: '注册成功,前往登录',
type: 'success',
url: '/pages/login/login',
duration: '1500'
})
} else {
this.$refs.uToast.show({
title: res.msg,
type: 'error'
})
}
})
},
//跳转登录页
gologin() {
uni.navigateTo({
url: `/pages/login/login?switchs=${true}`
})
},
},
}
</script>
<style lang="scss">
.app {
background-color: #F4F5F7;
position: relative;
height: 100vh;
width: 100%;
font-family: DengXian;
color: #C3C1C1;
font-weight: 400;
.switch {
text-align: center;
line-height: 60rpx;
color: #46ABD7;
position: absolute;
top: 66%;
left: 10%;
}
.loginbtn {
width: 80%;
height: 100rpx;
text-align: center;
line-height: 100rpx;
background: #4C7BC9;
border-radius: 51rpx;
font-size: 41rpx;
color: #FFFFFF;
position: absolute;
top: 57%;
left: 10%;
}
.loginphone {
background-color: #fff;
width: 80%;
height: 162rpx;
position: absolute;
left: 10%;
top: 23%;
input {
font-size: 40rpx;
color: #000000;
}
::v-deep .uni-input-placeholder {
padding-left: 40rpx;
font-size: 41rpx;
font-weight: 400;
color: #C3C1C1;
}
.phone {
padding-left: 40rpx;
height: 100%;
box-shadow: 0px 9px 31px 9px rgba(0, 0, 0, 0.03);
}
}
.logincode {
position: absolute;
left: 10%;
::v-deep .u-input__input {
padding-left: 20rpx;
color: #000000;
font-size: 41rpx;
font-weight: 400;
height: 100%;
}
}
.title {
height: 50rpx;
font-size: 52rpx;
font-weight: bold;
color: #000000;
line-height: 44rpx;
position: absolute;
top: 13%;
left: 13%;
}
}
</style>