You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Sports/pages/login/register.vue

275 lines
5.7 KiB

<template>
<view class="add">
<view class="add-bd">
<view class="item">
<view class="l">用户名</view>
<view class="r">
<input type="text" v-model="info.username" />
</view>
</view>
<view class="item">
<view class="l">密码:</view>
<view class="r">
<input type="password" class="box" placeholder="数字加字母" v-model="info.password" />
</view>
</view>
<view class="item">
<view class="l">再次输入密码:</view>
<view class="r">
<input type="password" class="box" v-model="info.tpassword" />
</view>
</view>
<view class="item">
<view class="l">注册人员类型:</view>
<view class="r">
<picker mode="selector" :range="range" :value="rangeIndex" @change="bindDateChange">
{{rangeIndex>= 0?range[rangeIndex]:"请选择"}}
<image class="arrow" src="@/static/jiantouxia@2x.png"></image>
</picker>
</view>
</view>
<view class="item">
<view class="l">真实姓名:</view>
<view class="r">
<input type="text" v-model="info.realname" />
</view>
</view>
<view class="item">
<view class="l">院系:</view>
<view class="r">
<input type="text" v-model="info.faculties" />
</view>
</view>
<view class="item">
<view class="l">专业:</view>
<view class="r">
<input type="text" v-model="info.specialized" />
</view>
</view>
<view class="item">
<view class="l">课题组:</view>
<view class="r">
<input type="text" v-model="info.group" />
</view>
</view>
<view class="item">
<view class="l">导师:</view>
<view class="r">
<input type="text" v-model="info.teacher" />
</view>
</view>
</view>
<view class="add-fd">
<view class="btn" @click="toReg">注册</view>
</view>
<u-popup :show="show" mode="center" :round="10" :close-on-click-overlay="false" @close="close">
<view class="popup">
<view class="title">注册申请已完成,等待管理员确认!</view>
<view class="btn" @click="toPage()">确定</view>
</view>
</u-popup>
</view>
</template>
<script>
export default {
data() {
return {
show: false,
rangeIndex: -1,
range: ['课题组人员','课题组PI','动物中心管理员'],
info: {}
};
},
methods: {
close() {
this.show = false
},
bindDateChange(e){
this.rangeIndex = e.detail.value;
this.info.type = Number(e.detail.value)+1
},
async toReg() {
if(!this.info.username){
uni.showToast({
title: "用户名不能为空!",
icon: "none"
})
return ;
}
if(!this.info.password){
uni.showToast({
title: "密码不能为空!",
icon: "none"
})
return ;
}
if(!this.info.tpassword){
uni.showToast({
title: "再次密码不能为空!",
icon: "none"
})
return ;
}
if(this.info.password != this.info.tpassword){
uni.showToast({
title: "密码不一致!",
icon: "none"
})
return ;
}
if(this.rangeIndex == -1){
uni.showToast({
title: "请输入注册人员类型",
icon: "none"
})
return ;
}
if(!this.info.faculties){
uni.showToast({
title: "真实姓名不能为空!",
icon: "none"
})
return ;
}
if(!this.info.realname){
uni.showToast({
title: "院系不能为空!",
icon: "none"
})
return ;
}
if(!this.info.specialized){
uni.showToast({
title: "专业不能为空!",
icon: "none"
})
return ;
}
if(!this.info.group){
uni.showToast({
title: "课题组不能为空!",
icon: "none"
})
return ;
}
if(!this.info.teacher){
uni.showToast({
title: "导师不能为空!",
icon: "none"
})
return ;
}
const {errorcode, data, message} = await this.$api.api_login_register(this.info);
if( errorcode == 200 ){
this.show = true
}else{
uni.showToast({
title: message,
icon: "none",
})
}
},
toPage(){
uni.navigateBack({
delta: 1
})
},
}
}
</script>
<style lang="scss" scoped>
.add{
padding-bottom: calc(env(safe-area-inset-bottom)+140rpx);
overflow: hidden;
.popup{
width: 670rpx;
height: 380rpx;
text-align: center;
padding: 110rpx 0 30rpx 0;
box-sizing: border-box;
.title{
font-size: 32rpx;
color: #000;
text-align: center;
}
.btn{
width: 210rpx;
line-height: 90rpx;
font-size: 30rpx;
color: #000;
margin: 0 auto;
background-color: #f8b62d;
border-radius: 8rpx;
margin-top: 80rpx;
}
}
&-bd{
padding: 0 35rpx;
overflow: hidden;
.item{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
padding: 40rpx 0;
border-bottom: 1px solid #c0c2c2;
.l{
font-size: 28rpx;
color: #000;
}
.r{
flex: 1;
display: flex;
align-items: center;
justify-content: flex-end;
input,picker{
flex: 1;
font-size: 28rpx;
color: #000;
height: 50rpx;
line-height: 50rpx;
text-align: right;
}
.arrow{
width: 32rpx;
height: 19rpx;
margin-left: 20rpx;
vertical-align: middle;
}
.date{
width: 45rpx;
height: 45rpx;
margin-left: 20rpx;
vertical-align: middle;
}
}
}
}
&-fd{
width: 100%;
padding: 20rpx 35rpx;
box-sizing: border-box;
background-color: #f3f5f6;
position: fixed;
left: 0;
bottom: 0;
z-index: 22;
padding-bottom: calc(env(safe-area-inset-bottom));
.btn{
width: 100%;
line-height: 90rpx;
text-align: center;
background-color: #009944;
font-size: 32rpx;
color: #ffffff;
border-radius: 10rpx;
}
}
}
</style>