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.
108 lines
3.9 KiB
108 lines
3.9 KiB
10 months ago
|
<template>
|
||
|
<BaseContainer class="my-promoter">
|
||
|
<NavBar title="开启学习旅程" fixed />
|
||
|
<view class="become-promoter" id="app">
|
||
|
<view style="text-align: center">
|
||
|
<image mode="aspectFit" :src="homeLogo" class="image" />
|
||
|
</view>
|
||
|
<view class="phone">
|
||
|
<view class="list">
|
||
|
<view class="item"><input type="text" placeholder="输入手机号" v-model="phone"></view>
|
||
|
<view class="item itemCode acea-row row-between-wrapper">
|
||
|
<input type="number" placeholder="输入验证码" v-model="code_num">
|
||
|
<view class="code acea-row row-center-wrapper" :disabled="active"
|
||
|
:class="active == true ? 'on' : ''" @click="code">{{ timetext }}</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
<view class="bnt acea-row row-center-wrapper" @click="save_promoter">加入学习</view>
|
||
|
</view>
|
||
|
<quick-menu></quick-menu>
|
||
|
</view>
|
||
|
</BaseContainer>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import { getLogoConfig } from "@/api/special";
|
||
|
import { getAuthCode } from "@/api/user"
|
||
|
import { getsave_promoter} from "@/api/spread"
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
active: false,
|
||
|
timetext: '获取验证码',
|
||
|
phone: '',
|
||
|
code_num: '',
|
||
|
homeLogo: '',
|
||
|
spread_uid: 0,
|
||
|
}
|
||
|
},
|
||
|
onLoad(options) {
|
||
|
const parmData = this.$util.mergeLaunchParams(options)
|
||
|
this.spread_uid = parmData.spread_uid;
|
||
|
this.getLogoConfig();
|
||
|
},
|
||
|
methods: {
|
||
|
async getLogoConfig() {
|
||
|
try {
|
||
|
const { data } = await getLogoConfig();
|
||
|
this.homeLogo = data.homeLogo;
|
||
|
} catch (err) {
|
||
|
console.log(err);
|
||
|
}
|
||
|
},
|
||
|
save_promoter() {
|
||
|
var that = this;
|
||
|
if (!that.phone) return this.$util.showMsg('请输入手机号码');
|
||
|
if (!that.$operation.tel(Number(that.phone))) return that.$util.showMsg('请输入正确的手机号码');
|
||
|
if (!that.code_num) return this.$util.showMsg('请输入验证码');
|
||
|
getsave_promoter({ spread_uid: that.spread_uid ,phone:that.phone , code:that.code_num }).then(res=>{
|
||
|
setTimeout(() => {
|
||
|
that.$util.showMsg(res.msg)
|
||
|
}, 1500);
|
||
|
uni.switchTab({
|
||
|
url: '/pages/index/index'
|
||
|
});
|
||
|
}).catch(err=>{
|
||
|
that.$util.showMsg(err.msg)
|
||
|
})
|
||
|
},
|
||
|
code: function () {
|
||
|
var that = this;
|
||
|
if (!that.phone) return this.$util.showMsg('请输入手机号码');
|
||
|
if (!this.$operation.tel(Number(that.phone))) return this.$util.showMsg('请输入正确的手机号码');
|
||
|
that.active = true;
|
||
|
var n = 60;
|
||
|
getAuthCode(that.phone).then(res=>{
|
||
|
console.log(res)
|
||
|
var data = res.data;
|
||
|
if (data.Message == 'OK' || data.Code == 'OK') {
|
||
|
var run = setInterval(function () {
|
||
|
n--;
|
||
|
if (n < 0) {
|
||
|
clearInterval(run);
|
||
|
}
|
||
|
that.timetext = "剩余 " + n + "s";
|
||
|
if (that.timetext < "剩余 " + 0 + "s") {
|
||
|
that.active = false;
|
||
|
that.timetext = "重发";
|
||
|
}
|
||
|
}, 1000);
|
||
|
} else {
|
||
|
$h.pushMsgOnce(data.Message);
|
||
|
that.active = false;
|
||
|
}
|
||
|
}).catch(err=>{
|
||
|
that.active = false;
|
||
|
console.log(err)
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
|
.image {
|
||
|
width: 60%;
|
||
|
height: 200rpx;
|
||
|
}
|
||
|
</style>
|