<template>
|
<view class="user-register">
|
<template>
|
<view class="form-wrap p30 f30" style="text-align: center;" v-if="is_success">
|
您已注册成功!
|
</view>
|
<view class="form-wrap p30 f30" v-else>
|
<form @submit="formSubmit" @reset="formReset">
|
<view class="form-item border-b">
|
<view class="field-name">姓名</view>
|
<input class="flex-1 ml20" name="real_name" type="text" value="" placeholder-class="grary" placeholder="请输入姓名" />
|
</view>
|
<view class="form-item border-b">
|
<view class="field-name">手机号</view>
|
<input class="flex-1 ml20" name="mobile" type="number" value="" placeholder-class="grary" placeholder="请输入手机" />
|
</view>
|
<view class="d-c-c mt50">
|
<button class="btn-green" form-type="submit">提交注册</button>
|
</view>
|
<view class="d-c-c mt30">
|
<button class="btn-gray" @click="gotoShop()">暂不注册</button>
|
</view>
|
</form>
|
</view>
|
</template>
|
</view>
|
</template>
|
|
<script>
|
import Popup from '@/components/uni-popup.vue'
|
export default {
|
components: {
|
Popup
|
},
|
data() {
|
return {
|
userInfo: {},
|
is_success: false
|
}
|
},
|
mounted() {
|
/*数据*/
|
this.getData();
|
},
|
methods: {
|
/*获取数据*/
|
getData() {
|
let self = this;
|
uni.showLoading({
|
title: '加载中'
|
})
|
self._get('user.register/register', {
|
platform: self.getPlatform(),
|
}, function(res) {
|
uni.hideLoading();
|
self.userInfo = res.data.userInfo;
|
if(res.data.is_register){
|
self.is_success = true;
|
}
|
});
|
},
|
|
/*申请*/
|
formSubmit: function(e) {
|
let formdata = e.detail.value;
|
let self = this;
|
|
if(formdata.name==''){
|
uni.showToast({
|
title: '请输入姓名!',
|
icon:'none'
|
});
|
return;
|
}
|
if(formdata.mobile.length==''){
|
uni.showToast({
|
title: '请输入手机号!',
|
icon: 'none'
|
});
|
return;
|
}
|
if (!/^1(3|4|5|6|7|8|9)\d{9}$/.test(formdata.mobile)) {
|
uni.showToast({
|
title: '手机有误,请重填!',
|
icon: 'none'
|
});
|
return;
|
}
|
|
uni.showLoading({
|
title: '正在提交',
|
mask: true
|
})
|
self._post('user.register/register', formdata, function(res) {
|
uni.hideLoading();
|
uni.showToast({
|
title: '注册成功'
|
});
|
self.is_success = true;
|
/* setTimeout(function() {
|
self.getData();
|
}, 1500); */
|
});
|
},
|
|
/*去商城看看*/
|
gotoShop(){
|
uni.switchTab({
|
url:'/pages/index/index'
|
})
|
},
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
.form-wrap {
|
background: #FFFFFF;
|
//margin-top: 80rpx;
|
position: relative;
|
border-radius: 30rpx 30rpx 0 0;
|
}
|
|
.form-item {
|
padding: 20rpx 0;
|
margin-bottom: 20rpx;
|
display: flex;
|
justify-content: flex-start;
|
align-items: center;
|
font-size: 28rpx;
|
}
|
|
.form-item .field-name {
|
width: 180rpx;
|
}
|
|
.form-item input {
|
font-size: 28rpx;
|
}
|
|
.agreement-content {
|
max-height: 60vh;
|
overflow-y: auto;
|
}
|
.user-register .btn-green, .user-register .btn-gray {
|
width: 600rpx;
|
height: 88rpx;
|
line-height: 88rpx;
|
border-radius: 44rpx;
|
}
|
|
.head_top {
|
position: absolute;
|
width: 100%;
|
height: 30px;
|
line-height: 30px;
|
font-size: 32rpx;
|
z-index: 2;
|
}
|
|
.agreement {
|
border-radius: 50%;
|
width: 28rpx;
|
height: 28rpx;
|
border: 2rpx solid #EE1413;
|
background: #fff;
|
position: relative;
|
margin-right: 10rpx;
|
box-sizing: border-box;
|
}
|
|
.agreement.active::after {
|
content: '';
|
width: 14rpx;
|
height: 14rpx;
|
background-color: #EE1413;
|
border-radius: 50%;
|
position: absolute;
|
left: 0;
|
top: 0;
|
right: 0;
|
bottom: 0;
|
margin: auto;
|
}
|
</style>
|