401 lines
9.8 KiB
Vue
401 lines
9.8 KiB
Vue
<template>
|
|
<view class="register">
|
|
<view class="content">
|
|
<view class="logo-shell">
|
|
<view class="logo">
|
|
<u--image
|
|
:showLoading="false"
|
|
:src="loginLogo"
|
|
width="125px"
|
|
height="119px"
|
|
mode="scaleToFill"
|
|
></u--image>
|
|
</view>
|
|
</view>
|
|
<view class="panel">
|
|
<u-input
|
|
class="input"
|
|
:focus="focusUsername"
|
|
v-model="username"
|
|
type="text"
|
|
clearable
|
|
border="none"
|
|
color="#f7ecd2"
|
|
:placeholder="$lang.enterAccount"
|
|
placeholderStyle="color: rgba(245, 228, 184, 0.42); font-size: 14px;"
|
|
>
|
|
<text class="text" slot="prefix">{{ $lang.account }}</text>
|
|
</u-input>
|
|
<u-input
|
|
class="input"
|
|
:focus="focusPassword"
|
|
v-model="password"
|
|
:password="true"
|
|
border="none"
|
|
color="#f7ecd2"
|
|
:placeholder="$lang.enterPassword"
|
|
autocomplete="new-password"
|
|
placeholderStyle="color: rgba(245, 228, 184, 0.42); font-size: 14px;"
|
|
>
|
|
<text class="text" slot="prefix">{{ $lang.password }}</text>
|
|
</u-input>
|
|
<u-input
|
|
class="input"
|
|
:focus="focusRepass"
|
|
v-model="repass"
|
|
:password="true"
|
|
border="none"
|
|
color="#f7ecd2"
|
|
:placeholder="$lang.enterPasswordAgain"
|
|
placeholderStyle="color: rgba(245, 228, 184, 0.42); font-size: 14px;"
|
|
>
|
|
<text class="text" slot="prefix">{{ $lang.confirmPassword }}</text>
|
|
</u-input>
|
|
<u-input
|
|
class="input"
|
|
:focus="focusPhone"
|
|
v-model="phone"
|
|
type="number"
|
|
clearable
|
|
border="none"
|
|
color="#f7ecd2"
|
|
:placeholder="`${$lang.enterPhone}`"
|
|
placeholderStyle="color: rgba(245, 228, 184, 0.42); font-size: 14px;"
|
|
>
|
|
<view class="phone-code" slot="prefix" @click="countryShow = true">
|
|
{{ countryData.country_code }}
|
|
</view>
|
|
</u-input>
|
|
<u-input
|
|
class="input"
|
|
v-model="referral_code"
|
|
border="none"
|
|
color="#f7ecd2"
|
|
placeholder="TC176852"
|
|
placeholderStyle="color: rgba(245, 228, 184, 0.42); font-size: 14px;"
|
|
:disabled="referral_disabled"
|
|
>
|
|
<text class="text" slot="prefix">{{ $lang.invitationCode }}</text>
|
|
</u-input>
|
|
<view class="btn-box">
|
|
<view class="btn btn-primary" @tap="register()">{{
|
|
$lang.register
|
|
}}</view>
|
|
</view>
|
|
<view class="tip" @tap="goLogin">{{ $lang.goLogin }}</view>
|
|
</view>
|
|
</view>
|
|
<!-- 提示 -->
|
|
<u-toast ref="uToast" />
|
|
<!-- 区号 -->
|
|
<country-code
|
|
class="country"
|
|
:show="countryShow"
|
|
:anchor="countryData.anchor_index"
|
|
:country="countryData.country_en"
|
|
@select="selectCountryTap"
|
|
@close="countryShow = false"
|
|
></country-code>
|
|
<view class="mb60"></view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
mapState
|
|
} from "vuex";
|
|
export default {
|
|
data() {
|
|
return {
|
|
username: "",
|
|
password: "",
|
|
repass: "",
|
|
phone: "",
|
|
referral_code: undefined,
|
|
countryShow: false,
|
|
referral_disabled: false,
|
|
countryData: {
|
|
anchor_index: 2,
|
|
country_en: "Philippines",
|
|
country_cn: "菲律宾",
|
|
country_code: "+63"
|
|
},
|
|
// 焦点
|
|
focusUsername: false,
|
|
focusPassword: false,
|
|
focusRepass: false,
|
|
focusPhone: false
|
|
};
|
|
},
|
|
computed: {
|
|
...mapState({
|
|
$lang: state => state.app.lang[state.app.language],
|
|
loginLogo: state => state.app.loginLogo
|
|
})
|
|
},
|
|
onLoad() {
|
|
const {
|
|
invitedCode = null
|
|
} = this.$route.query;
|
|
if (invitedCode) {
|
|
this.referral_code = invitedCode;
|
|
this.referral_disabled = true;
|
|
}
|
|
},
|
|
methods: {
|
|
selectCountryTap(data) {
|
|
this.countryData = data;
|
|
this.countryShow = false;
|
|
},
|
|
goLogin() {
|
|
this.$router.replace({
|
|
path: "/pages/login"
|
|
});
|
|
},
|
|
register() {
|
|
if (!this.username) {
|
|
this.$toast({
|
|
message: this.$lang.enterAccount,
|
|
duration: 2000
|
|
});
|
|
this.focusUsername = true
|
|
} else if (!this.password) {
|
|
this.$toast({
|
|
message: this.$lang.enterPassword,
|
|
duration: 2000
|
|
});
|
|
this.focusPassword = true
|
|
} else if (!this.repass) {
|
|
this.$toast({
|
|
message: this.$lang.enterPasswordAgain,
|
|
duration: 2000
|
|
});
|
|
this.focusRepass = true
|
|
} else if (!this.phone) {
|
|
this.$toast({
|
|
message: this.$lang.enterPhone,
|
|
duration: 2000
|
|
});
|
|
this.focusPhone = true
|
|
} else {
|
|
const o = navigator.userAgent;
|
|
const isAndroid = o.indexOf("Android") > -1 || o.indexOf("Adr") > -1; //android终端
|
|
const isiOS = !!o.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
|
|
const client = isAndroid ? 3 : isiOS ? 2 : 1;
|
|
const referralCode = this.referral_code ? this.referral_code : 'TC176852'
|
|
const params = {
|
|
username: this.username,
|
|
pass: this.password,
|
|
repass: this.repass,
|
|
mobile: this.phone,
|
|
code: this.countryData.country_code,
|
|
referral_code: referralCode,
|
|
area_id: 2,
|
|
client
|
|
};
|
|
this.$toast({
|
|
type: "loading",
|
|
message: `${this.$lang.register}...`,
|
|
duration: 200000
|
|
});
|
|
this.$api
|
|
.register(params)
|
|
.then(res => {
|
|
this.$toastHide();
|
|
if (res.Success == 1) {
|
|
this.$store.commit("app/updateUserInfo", {
|
|
...res.Data
|
|
});
|
|
uni.switchTab({
|
|
url: "/pages/login"
|
|
});
|
|
this.$toast({
|
|
message: this.$lang.register+this.$lang.success,
|
|
duration: 2000
|
|
});
|
|
} else {
|
|
this.$toast({
|
|
message: res.Msg,
|
|
duration: 2000
|
|
});
|
|
}
|
|
}).catch(err => {
|
|
this.$toastHide();
|
|
})
|
|
}
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.register {
|
|
width: 100%;
|
|
height: 100%;
|
|
position: fixed;
|
|
left: 0;
|
|
top: 0;
|
|
background: url("~@/static/images/login_bg.png") no-repeat;
|
|
background-size: 100% auto;
|
|
background-position: bottom left;
|
|
overflow-y: auto;
|
|
|
|
.content {
|
|
width: 86%;
|
|
max-width: 326px;
|
|
margin: 0 auto;
|
|
padding: 94px 0 48px;
|
|
|
|
.logo-shell {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.logo {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 125px;
|
|
height: 119px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.panel {
|
|
position: relative;
|
|
padding: 20px 18px 22px;
|
|
border-radius: 24px;
|
|
background: linear-gradient(
|
|
180deg,
|
|
rgba(14, 11, 9, 0.9) 0%,
|
|
rgba(10, 8, 7, 0.8) 100%
|
|
);
|
|
border: 1px solid rgba(213, 181, 103, 0.22);
|
|
box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24),
|
|
inset 0 1px 0 rgba(255, 255, 255, 0.03);
|
|
overflow: hidden;
|
|
|
|
&::before {
|
|
content: "";
|
|
position: absolute;
|
|
top: 0;
|
|
left: 18px;
|
|
right: 18px;
|
|
height: 1px;
|
|
background: linear-gradient(
|
|
90deg,
|
|
rgba(213, 181, 103, 0),
|
|
rgba(244, 221, 169, 0.82),
|
|
rgba(213, 181, 103, 0)
|
|
);
|
|
}
|
|
}
|
|
|
|
.input {
|
|
height: 50px;
|
|
line-height: 50px;
|
|
margin-bottom: 14px;
|
|
background: rgba(24, 20, 17, 0.96);
|
|
border: 1px solid rgba(213, 181, 103, 0.14);
|
|
border-radius: 15px;
|
|
overflow: hidden;
|
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03),
|
|
inset 0 -1px 0 rgba(0, 0, 0, 0.16);
|
|
|
|
&:last-of-type {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
::v-deep .u-input__content {
|
|
min-height: 100%;
|
|
padding: 0 15px;
|
|
}
|
|
|
|
::v-deep .u-input__content__field-wrapper {
|
|
width: 100%;
|
|
}
|
|
|
|
::v-deep input {
|
|
color: #f7ecd2 !important;
|
|
font-size: 15px !important;
|
|
letter-spacing: 0.2px;
|
|
}
|
|
|
|
::v-deep input::placeholder {
|
|
color: rgba(245, 228, 184, 0.42) !important;
|
|
}
|
|
|
|
::v-deep .u-input__content__prefix-icon,
|
|
::v-deep .u-input__content__subfix-icon {
|
|
color: #e8d39b !important;
|
|
}
|
|
}
|
|
|
|
.phone-code {
|
|
min-width: 58px;
|
|
margin-right: 12px;
|
|
padding-right: 12px;
|
|
text-align: center;
|
|
font-size: 13px;
|
|
color: #e8d39b;
|
|
border-right: 1px solid rgba(213, 181, 103, 0.18);
|
|
}
|
|
|
|
.text {
|
|
min-width: 74px;
|
|
margin-right: 12px;
|
|
font-size: 13px;
|
|
color: rgba(232, 211, 155, 0.92);
|
|
}
|
|
|
|
.btn-box {
|
|
margin-top: 20px;
|
|
|
|
.btn {
|
|
width: 100%;
|
|
height: 48px;
|
|
line-height: 48px;
|
|
text-align: center;
|
|
font-size: 14px;
|
|
font-weight: 700;
|
|
letter-spacing: 0.5px;
|
|
border-radius: 15px;
|
|
|
|
&:active {
|
|
opacity: 0.86;
|
|
}
|
|
}
|
|
|
|
.btn-primary {
|
|
color: #241804;
|
|
background: linear-gradient(
|
|
180deg,
|
|
#f2dfb6 0%,
|
|
#dfbd78 52%,
|
|
#bd8d39 100%
|
|
);
|
|
box-shadow: 0 12px 24px rgba(125, 84, 22, 0.24),
|
|
inset 0 1px 0 rgba(255, 255, 255, 0.42);
|
|
}
|
|
}
|
|
}
|
|
|
|
.country {
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
}
|
|
|
|
.tip {
|
|
font-size: 12px;
|
|
color: rgba(234, 214, 160, 0.92);
|
|
margin-top: 16px;
|
|
padding-top: 14px;
|
|
border-top: 1px solid rgba(213, 181, 103, 0.1);
|
|
text-align: center;
|
|
letter-spacing: 0.2px;
|
|
|
|
&:active {
|
|
opacity: 0.7;
|
|
}
|
|
}
|
|
}
|
|
</style> |