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.
 
 
 
 

170 lines
4.2 KiB

<template>
<view class="page">
<view class="title">Annie 邀请你加入</view>
<view class="form">
<view class="icon">
<image src="../../static/image/house.png" mode=""></image>
</view>
<view class="des">或然科技城市合伙人计划</view>
<view class="des">加入并自动为你创建一个团队群组</view>
<view class="input">
<uni-easyinput v-model="form.userName" placeholder="请填写姓名" :clearable="false" />
</view>
<view class="input">
<uni-easyinput v-model="form.account" placeholder="请填写账号" :clearable="false" />
</view>
<view class="input">
<uni-easyinput v-model="form.phone" placeholder="请填写你的手机号" :clearable="false" />
</view>
<view class="input code-wrap">
<uni-easyinput class="code" v-model="form.code" placeholder="验证码" :clearable="false" />
<view class="send-code" @click="sendCode" :disabled="codeDisabled">{{ btnText }}</view>
</view>
<view class="input">
<uni-easyinput v-model="form.email" placeholder="请填写邮箱" :clearable="false" />
</view>
<button class="submit" type="primary" size="10" @click="submit">立即加入</button>
</view>
</view>
</template>
<script>
import { savePartnerAccount } from '@/apis/modules/parner.js'
export default {
data() {
return {
form: {
isTeam: 1, // 0为团队,1为成员
partnerClassificationId: 167,
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyIiwiaWF0IjoxNjUzMjcyMjMyLCJleHAiOjE2NTMzMTU0MzIsImFjY291bnRJZCI6IjEifQ.gf5myNnrLmVjUcIWfqfohWyvdPXXwr9butZo75CXk64',
userName: '',
account: '',
phone: '',
code: '',
email: ''
},
codeDisabled: false,
phoneTimer: null,
phoneOpener: '',
btnText: '发送验证码',
}
},
onLoad() {
},
methods: {
// 提交
submit() {
const { form } = this
const { userName, phone } = form
if (!userName) return this.$util.errMsg('请输入姓名!')
if (!phone) return this.$util.errMsg('请输入手机号!')
form.uniqueIdentification = Date.now()
savePartnerAccount(this.form).then(res => {
this.$util.sucMsg('加入成功')
setTimeout(() => {
// uni.navigateBack()
}, 1500)
}).catch(res => {})
},
// 验证码倒计时
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)
}
},
// 发送验证码
sendCode() {
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 {
line-height: 38px;
font-size: 14px;
border-radius: 40px;
}
}
</style>