注册页面修改
This commit is contained in:
parent
005536128c
commit
b1d95b4d26
17
api/pages/api.js
Normal file
17
api/pages/api.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import request from "../request.js"
|
||||||
|
|
||||||
|
// 获取OpenId
|
||||||
|
export function getOpenId(code) {
|
||||||
|
return request({
|
||||||
|
url: `/applet/register/getOpenId/${code}`,
|
||||||
|
method: 'GET'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前注册居民
|
||||||
|
export function getCurrentUser(data) {
|
||||||
|
return request({
|
||||||
|
url: `/applet/register/getCurrentResident/${data.openid}/${data.cityCode}`,
|
||||||
|
method: 'GET'
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -7,6 +7,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getOpenId, getCurrentUser } from '@/api/pages/api.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -14,10 +15,29 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
this.login()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
login() {
|
||||||
|
const _this = this
|
||||||
|
uni.login({
|
||||||
|
success(res) {
|
||||||
|
getOpenId(res.code).then(Res => {
|
||||||
|
if(Res.code == 200) {
|
||||||
|
_this.isWxBing(Res.msg, '1')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
isWxBing(openid, cityCode) {
|
||||||
|
getCurrentUser(openid, cityCode).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if(!res.data) {
|
||||||
|
// 注册
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -5,76 +5,145 @@
|
|||||||
<span>人脸采集</span>
|
<span>人脸采集</span>
|
||||||
</view>
|
</view>
|
||||||
<view class="form">
|
<view class="form">
|
||||||
<span>姓名</span>
|
<u-form :model="form" ref="uForm">
|
||||||
<input type="text" placeholder="请输入姓名">
|
<span>姓名</span>
|
||||||
<span>手机号</span>
|
<u-form-item prop="name">
|
||||||
<input type="text" placeholder="请输入手机号">
|
<u-input v-model="form.name" border='true' placeholder="请输入姓名" />
|
||||||
<span>身份证号</span>
|
</u-form-item>
|
||||||
<input type="text" placeholder="请输入身份证号">
|
<span>手机号</span>
|
||||||
|
<u-form-item prop="phone">
|
||||||
|
<u-input v-model="form.phone" border='true' placeholder="请输入手机号" />
|
||||||
|
</u-form-item>
|
||||||
|
<span>身份证号</span>
|
||||||
|
<u-form-item prop="indent">
|
||||||
|
<u-input v-model="form.indent" border='true' placeholder="请输入身份证号" />
|
||||||
|
</u-form-item>
|
||||||
|
</u-form>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn">提交</view>
|
<view class="btn" @click="submit">提交</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
|
onReady() {
|
||||||
|
this.$refs.uForm.setRules(this.rules);
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
tipsText: '',
|
||||||
|
form: {
|
||||||
|
name: '',
|
||||||
|
phone: '',
|
||||||
|
indent: ''
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
name: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入姓名',
|
||||||
|
trigger: ['change', 'blur'],
|
||||||
|
}],
|
||||||
|
phone: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入手机号',
|
||||||
|
trigger: ['change', 'blur'],
|
||||||
|
}, {
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
return uni.$u.test.mobile(value);
|
||||||
|
},
|
||||||
|
message: '手机号码不正确',
|
||||||
|
trigger: ['blur'],
|
||||||
|
}],
|
||||||
|
indent: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入身份证号',
|
||||||
|
trigger: ['change', 'blur'],
|
||||||
|
}, {
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
return uni.$u.test.idCard(value);
|
||||||
|
},
|
||||||
|
message: '请输入正确的身份证号',
|
||||||
|
trigger: ['blur'],
|
||||||
|
}]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onLoad() {
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
submit() {
|
||||||
|
this.$refs.uForm.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
console.log('验证通过');
|
||||||
|
} else {
|
||||||
|
console.log('验证失败');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.register {
|
.register {
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
.head {
|
|
||||||
margin-top: 60rpx;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
span {
|
|
||||||
margin-top: 48rpx;
|
.head {
|
||||||
|
margin-top: 60rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
span {
|
||||||
|
margin-top: 48rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.form {
|
.form {
|
||||||
margin-top: 106rpx;
|
margin-top: 106rpx;
|
||||||
input {
|
|
||||||
margin: 21rpx 0 42rpx 0;
|
/deep/ .u-input--border {
|
||||||
width: 600rpx;
|
margin: 0 0 12rpx 0;
|
||||||
height: 63rpx;
|
width: 600rpx;
|
||||||
background: #F6F6F6;
|
background: #F6F6F6;
|
||||||
|
border-radius: 5rpx !important;
|
||||||
|
border: 0;
|
||||||
|
|
||||||
|
input {
|
||||||
|
color: #8E8E8E !important;
|
||||||
|
font-size: 22rpx !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
color: #333333;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
width: 496rpx;
|
||||||
|
height: 61rpx;
|
||||||
|
background: #26A888;
|
||||||
border-radius: 5rpx;
|
border-radius: 5rpx;
|
||||||
color: #8E8E8E;
|
font-size: 31rpx;
|
||||||
font-size: 20rpx;
|
color: #FFFFFF;
|
||||||
padding-left: 26rpx;
|
line-height: 61rpx;
|
||||||
}
|
text-align: center;
|
||||||
span {
|
position: absolute;
|
||||||
color: #333333;
|
bottom: 72rpx;
|
||||||
font-size: 30rpx;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.btn {
|
|
||||||
width: 496rpx;
|
.Facecollection {
|
||||||
height: 61rpx;
|
width: 266rpx;
|
||||||
background: #26A888;
|
height: 266rpx;
|
||||||
border-radius: 5rpx;
|
}
|
||||||
font-size: 31rpx;
|
|
||||||
color: #FFFFFF;
|
/deep/ .u-form-item__message {
|
||||||
line-height: 61rpx;
|
padding-left: 0 !important;
|
||||||
text-align: center;
|
|
||||||
margin-top: 300rpx;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.Facecollection {
|
|
||||||
width: 266rpx;
|
|
||||||
height: 266rpx;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user