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.
 
 
 
 

152 lines
3.4 KiB

<template>
<view class="page">
<view class="title">Annie 邀请你加入</view>
<view class="form">
<view class="icon">
<image src="../../static/house.png" mode=""></image>
</view>
<view class="des">或然科技城市合伙人计划</view>
<view class="des">加入并自动为你创建一个团队群组</view>
<view class="input">
<uni-easyinput v-model="form.contact" placeholder="请填写你的真实姓名" :clearable="false" />
</view>
<view class="input">
<uni-easyinput v-model="form.contact" placeholder="请填写你的手机号" :clearable="false" />
</view>
<view class="input code-wrap">
<uni-easyinput class="code" v-model="form.contact" placeholder="验证码" :clearable="false" />
<view class="send-code" @click="sendCode" :disabled="codeDisabled">{{ btnText }}</view>
</view>
<button class="submit" type="primary" @click="submit('valiForm')">立即加入</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
form: {
name: '',
provience: '',
city: '',
},
codeDisabled: false,
phoneTimer: null,
phoneOpener: '',
btnText: '发送验证码',
}
},
onLoad() {
},
methods: {
submit(ref) {
this.$refs[ref].validate().then(res => {
console.log('success', res);
uni.showToast({
title: `校验通过`
})
}).catch(err => {
console.log('err', err);
})
},
// 验证码倒计时
phoneCountdown() {
let count = 60
if (!this.phoneTimer) {
this.codeDisabled = true
this.phoneTimer = setInterval(() => {
if (count > 0) {
count--
this.btnText = `${count}秒后重试`
} else {
this.codeDisabled = false
clearInterval(this.phoneTimer)
this.phoneTimer = null
this.btnText = `发送验证码`
}
}, 1000)
}
},
// 发送验证码
sendPhoneCode(bind) {
const { phone } = this.form
if (!phone) return this.$util.errMsg('请填写手机号!')
if (!/^1[3456789]\d{9}$/.test(phone) && !/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(phone)) return this.$util.errMsg('请填写正确的手机号!')
// this.$post(this.api.sendPhoneOrEmailCode, {
// platform: Setting.platformId,
// phone,
// types: 2
// }).then(({ message }) => {
// if (message.opener) {
// this.phoneCountdown()
// this.phoneOpener = message.opener
// } else {
// util.errorMsg(message)
// }
// }).catch(res => {})
}
}
}
</script>
<style scoped lang="scss">
.page {
margin: 20px;
border-radius: 6px;
overflow: hidden;
.title {
padding: 0 15px;
line-height: 2.4;
font-size: 16px;
color: #fff;
background-color: #319bf7;
}
}
.form {
padding: 20px 20px 30px;
background-color: #fff;
.icon {
display: flex;
justify-content: center;
align-items: center;
width: 70px;
height: 70px;
margin: 20px auto;
border-radius: 4px;
background-color: $uni-primary;
image {
width: 40px;
height: 40px;
}
}
.des {
margin-bottom: 10px;
text-align: center;
font-size: 14px;
}
.input {
margin-bottom: 20px;
}
.code-wrap {
display: flex;
}
.code {
flex: 1;
}
.send-code {
width: 100px;
margin-left: 20px;
text-align: center;
color: #4386ff;
font-size: 12px;
line-height: 36px;
border: 1px solid #4386ff;
border-radius: 5px;
}
.submit {
border-radius: 40px;
}
}
</style>