question_uniapp/pages/promotion/invitesignup.vue

248 lines
8.7 KiB
Vue
Raw Normal View History

2025-06-15 22:12:30 +08:00
<template>
<view class="page">
<view style="padding-top: 100rpx;">
<image src="/static/images/logo.png" style="width: 140rpx; height: 60rpx; float: left; margin-left: 20rpx;"></image>
<view class="v1" style="line-height: 50rpx;" @click="download">
<span style="float: right; margin-left: 10rpx; font-size: 28rpx;">下载APP</span>
<uni-icons size="25" type="download" style="float: left;"></uni-icons>
</view>
<view class="v1" style="line-height: 50rpx; margin-right: 60rpx;" @click="selectlanguage">
<span style="float: right; margin-left: 10rpx; font-size: 28rpx;" v-if="$i18n.locale == 'en'">EN</span>
<span style="float: right; margin-left: 10rpx; font-size: 28rpx;" v-if="$i18n.locale == 'zh'">中文</span>
<image src="/static/images/earth.png" style="width: 40rpx; height: 40rpx; margin-top: 6rpx; float: right;"></image>
</view>
<view style="clear: both;"></view>
</view>
<view style="width:94%; margin: 40rpx auto; background: url('/static/images/s9.png'); background-size: 20%; background-repeat: no-repeat; background-position: right;">
<view style="font-weight: 600;font-size: 48rpx; line-height: 80rpx; color: #333333;">欢迎来到MT</view>
<view style="font-weight: 400;font-size: 28rpx; line-height: 50rpx; color: #333333;">注册并完成交易即可获得高额返佣奖励</view>
</view>
<view style="width: 94%; margin: 40rpx auto;">
<uni-forms label-position="left" label-width="80rpx" :modelValue="signupModel" :rules="rules" ref="signupModel">
<uni-forms-item label="Email" name="email" label-width="180rpx">
<uni-easyinput type="text" v-model="signupModel.email" :placeholder="$t('signup.text2')"></uni-easyinput>
</uni-forms-item>
<uni-forms-item :label="$t('forgot.text23')" name="code" label-width="180rpx">
<uni-easyinput type="number" v-model="signupModel.code" :placeholder="$t('signup.text3')">
<template #right>
<button type="primary"
:disabled="isSend"
@click="sendCode()"
style="font-size: 28rpx; padding: auto 20rpx; width: 220rpx;">{{sendText}}</button>
</template>
</uni-easyinput>
</uni-forms-item>
<uni-forms-item :label="$t('forgot.text11')" name="password" label-width="180rpx">
<uni-easyinput type="password" :passwordIcon="true" v-model="signupModel.password" :placeholder="$t('login.text5')" />
</uni-forms-item>
<uni-forms-item :label="$t('signup.text6')" name="trade_password" label-width="180rpx">
<uni-easyinput type="password" :passwordIcon="true" v-model="signupModel.trade_password" :placeholder="$t('signup.text7')" />
</uni-forms-item>
<uni-forms-item :label="$t('signup.text16')" name="invite_code" label-width="180rpx">
<uni-easyinput type="text" v-model="signupModel.invite_code" :placeholder="$t('signup.text9')"></uni-easyinput>
</uni-forms-item>
</uni-forms>
</view>
<view style="font-weight: 400;font-size: 26rpx;color: #333333; width: 94%; margin: 10rpx auto;">
<checkbox :checked="isAgree" style="width: 40rpx; height: 40rpx; transform: scale(0.8,0.8)" />
<span style="margin-left: 20rpx;">I have read and agree<span style="color: #1D61FF">MT User Agreement</span></span>
</view>
<view style="bottom: 0rpx; position: absolute; width:100vw; height: 60rpx; ">
<button type="primary" style="width: 94%; margin: auto;" @click="signup">{{this.$t('signup.text17')}}</button>
</view>
<uni-popup ref="popup" background-color="#fff">
<view style="width: 80vw; padding: 20rpx 30rpx; border-radius: 40rpx; line-height: 50rpx;">
<view style="font-size: 36rpx; font-weight: bold; text-align: center; margin-bottom: 30rpx;">{{$t('index.text25')}}</view>
<view style="padding-bottom: 20rpx; width: 100%;">
<view @click="switchlan('en')" style="height: 80rpx; line-height: 80rpx;" :style = "$i18n.locale == 'en' ? 'background-color:#1D61E7; color: #fff' : 'color: #333'">
<view style="font-weight: 600;font-size: 32rpx; margin-left: 20rpx;">English</view>
</view>
<view @click="switchlan('zh')" style="height: 80rpx; line-height: 80rpx;" :style = "$i18n.locale == 'zh' ? 'background-color:#1D61E7; color: #fff' : 'color: #333'">
<view style="font-weight: 600;font-size: 32rpx;margin-left: 20rpx;">简体中文</view>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import zNavigation from '@/components/module/navigation.vue';
import { getUserInfo } from '@/config/utils';
import {
mapState,
mapMutations
} from 'vuex';
export default {
components: {
zNavigation
},
data() {
return {
sendText: this.$t('setPasswork.text8'),
isSend: false,
isAgree:true,
signupModel:{
email:"",
code:"",
password:"",
invite_code:"",
trade_password:"",
},
rules: {
email: {rules:[{required: true,errorMessage: this.$t('forgot.text2')}]},
code:{rules:[{required: true,errorMessage: this.$t('setPasswork.text12')}]},
password: {rules:[{required: true,errorMessage: this.$t('login.text10')}]},
trade_password:{
rules:[{required: true,errorMessage: this.$t('putforward.text5')},
{minLength: 6, maxLength: 6, errorMessage: this.$t('putforward.text6') }],
},
invite_code: {rules:[{required: true,errorMessage: this.$t('putforward.text9')}]}
},
};
},
computed: {
...mapState(['userInfo']),
...mapState(['init'])
},
//第一次加载
onLoad(e) {
},
created() {
uni.hideTabBar()
},
//页面显示
onShow() {
},
//方法
methods: {
selectlanguage(){
this.$refs.popup.open('center');
},
download(){
window.location.href='https://www.dxmt.io/download'
},
switchlan(l){
this.$i18n.locale = l;
uni.setStorageSync('locale', l)
this.$refs.popup.close();
},
sendCode(){
this.isSend = true;
if (this.signupModel.email == '') {
uni.showToast({title: this.$t('forgot.text19'), icon:'error'});
this.isSend = false;
return;
}
if (!this.$base.mailRegular.test(this.signupModel.email)) {
uni.showToast({title: this.$t('forgot.text20'), icon:'error'});
this.isSend = false;
return;
}
let s = 120;
let data = {
type: "email",
event: "register",
email: this.signupModel.email,
lang: this.$i18n.locale
}
this.$http.post('/api/common/captcha', data).then(res => {
if(res.code == 0){
uni.showToast({title: 'Successfully sent'});
this.sendText = this.$t('forgot.text4',{par: s});
let intervalId = setInterval(() => {
s = s-1;
if (s == 0) {
clearInterval(intervalId);
this.isSend = false;
this.sendText = "Get code";
}
else{
this.sendText = this.$t('forgot.text4',{par: s});
}
}, 1000);
}
});
},
signup(){
this.$refs.signupModel.validate().then(res=>{
if (!this.$base.mailRegular.test(this.signupModel.email)) {
uni.showToast({title:this.$t('signup.text12'),icon:'error'});
return;
}
if(!this.$base.passwordRegular.test(this.signupModel.password)){
uni.showToast({title:this.$t('signup.text14'),icon:'error'});
return;
}
let data = {
email: this.signupModel.email,
code: this.signupModel.code,
password: this.signupModel.password,
invite_code: this.signupModel.invite_code,
trade_password: this.signupModel.trade_password,
}
this.$http.post('/api/common/register', data).then(res => {
if(res.code == 0){
this.setUserInfo(res.data.userinfo);
setTimeout(() => {
uni.switchTab({
url: '/pages/mine/index'
});
}, 1000);
}
});
}).catch(err =>{})
},
onTokenJump(url) {
if(this.userInfo.token === typeof(undefined) || this.userInfo.token === undefined){
uni.showModal({
title: this.$t('gotoLogin.title'),
content: this.$t('gotoLogin.content'),
confirmText: this.$t('gotoLogin.login'),
cancelText: this.$t('gotoLogin.cancel'),
success: (res) => {
if (res.confirm) {
uni.navigateTo({
url: "/pages/mine/login"
});
}
}
});
}else{
uni.navigateTo({
url: url
});
}
},
onPageJump(url) {
uni.navigateTo({
url: url
});
},
onPageJump1(url) {
uni.switchTab({
url: url
});
},
},
//页面隐藏
onHide() {},
//页面卸载
onUnload() {},
//页面下来刷新
onPullDownRefresh() {},
//页面上拉触底
onReachBottom() {},
//用户点击分享
onShareAppMessage(e) {
return this.wxShare();
}
};
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.page{min-height: 98vh;position: relative;}
.v1{ float: right; padding-right: 20upx;}
</style>