|
@@ -8,7 +8,7 @@
|
|
|
</div>
|
|
|
<!-- 被邀请人提示 -->
|
|
|
<div v-else class="invitee-tips">
|
|
|
- <div class="invitee-tips-user">用户01</div>
|
|
|
+ <div class="invitee-tips-user">用户</div>
|
|
|
<div class="invitee-tips-text">
|
|
|
亲,我在用双子星云手机,可以<span>24小时运行游戏/聊天/看视频</span>,双子星云手机已经帮我节省<span>10086小时</span>,我得任务全做完了,游戏升级哇哇快,现在官方活动领云机,麻烦帮我助力!
|
|
|
</div>
|
|
@@ -16,7 +16,7 @@
|
|
|
<!-- 砍价进度 -->
|
|
|
<div class="bargaining-assistance-main">
|
|
|
<!-- 被邀请人助力、邀请人砍价 -->
|
|
|
- <template v-if="true">
|
|
|
+ <template v-if="!assistanceBool">
|
|
|
<div class="package-name">
|
|
|
<span> {{ info.phoneType }}{{ info.validityPeriod }}天</span>
|
|
|
</div>
|
|
@@ -52,7 +52,9 @@
|
|
|
<!-- 被邀请人点击助力之后领取手机的页面 -->
|
|
|
<template v-else>
|
|
|
<div class="invitee-to-claim">
|
|
|
- <div class="invitee-to-claim_btn">免费领取</div>
|
|
|
+ <div class="invitee-to-claim_btn" @click="loginVisible = true">
|
|
|
+ 免费领取
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</div>
|
|
@@ -204,17 +206,53 @@
|
|
|
<van-dialog v-model="loginVisible" :showConfirmButton="false">
|
|
|
<div class="login">
|
|
|
<div class="login-title">双子星快捷登录</div>
|
|
|
- <van-field placeholder="手机号" />
|
|
|
- <van-field placeholder="验证码">
|
|
|
+ <van-field
|
|
|
+ placeholder="手机号"
|
|
|
+ v-model="laoginData.phone"
|
|
|
+ maxLength="11"
|
|
|
+ @input="laoginData.phone = laoginData.phone.replace(/\D/g, '')"
|
|
|
+ />
|
|
|
+ <van-field
|
|
|
+ placeholder="验证码"
|
|
|
+ v-model="laoginData.code"
|
|
|
+ @input="
|
|
|
+ laoginData.code = laoginData.code.replace(/[\u4e00-\u9fa5]/g, '')
|
|
|
+ "
|
|
|
+ >
|
|
|
<template #button>
|
|
|
- <div class="login-code">获取验证码</div>
|
|
|
+ <div
|
|
|
+ :class="[
|
|
|
+ 'login-code',
|
|
|
+ {
|
|
|
+ disabled:
|
|
|
+ !agreementBool ||
|
|
|
+ codeNumber !== '获取验证码' ||
|
|
|
+ laoginData.phone.length < 11,
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ @click="getCode"
|
|
|
+ >
|
|
|
+ {{ codeNumber }}
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</van-field>
|
|
|
- <van-button color="#3666F2">登录</van-button>
|
|
|
+ <van-button
|
|
|
+ color="#3666F2"
|
|
|
+ :disabled="
|
|
|
+ !agreementBool ||
|
|
|
+ !laoginData.code ||
|
|
|
+ laoginData.phone.length < 11 ||
|
|
|
+ loginLoading
|
|
|
+ "
|
|
|
+ @click="login"
|
|
|
+ >
|
|
|
+ <template v-if="loginLoading"> 正在登录中... </template>
|
|
|
+ <template v-else> 登录 </template>
|
|
|
+ </van-button>
|
|
|
<div class="login-agreement">
|
|
|
<van-checkbox icon-size="16px" v-model="agreementBool">
|
|
|
通过登录即可完成注册,成为我们的新用户登录后表示同意
|
|
|
- <span>用户协议</span>
|
|
|
+ <span @click.stop="toAgreement">用户协议</span>
|
|
|
</van-checkbox>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -223,6 +261,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { sha256 } from 'js-sha256';
|
|
|
import customProgress from './customProgress.vue';
|
|
|
import loadList from '@/components/loadList';
|
|
|
import { fileKeyToUrl } from '@/plugins/file-center.js';
|
|
@@ -254,6 +293,12 @@ export default {
|
|
|
return () => {};
|
|
|
},
|
|
|
},
|
|
|
+ inviteeData: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {};
|
|
|
+ },
|
|
|
+ },
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -271,6 +316,14 @@ export default {
|
|
|
info: {}, // 砍价相关信息
|
|
|
bargainingAmount: '', // 砍价金额
|
|
|
systemTime: '', // 系统时间
|
|
|
+ assistanceBool: false, // 是否触发助力
|
|
|
+ laoginData: {
|
|
|
+ // 被邀请人登录信息
|
|
|
+ phone: '',
|
|
|
+ code: '',
|
|
|
+ },
|
|
|
+ codeNumber: '获取验证码',
|
|
|
+ loginLoading: false,
|
|
|
};
|
|
|
},
|
|
|
components: {
|
|
@@ -278,21 +331,31 @@ export default {
|
|
|
loadList,
|
|
|
},
|
|
|
mounted() {
|
|
|
- console.log(process.env.API_URL);
|
|
|
+ if (sessionStorage.getItem('isAgreementBool')) {
|
|
|
+ this.assistanceBool = true;
|
|
|
+ this.loginVisible = true;
|
|
|
+ this.laoginData.phone = sessionStorage.getItem('invitedPhone');
|
|
|
+ this.laoginData.code = sessionStorage.getItem('invitedCode');
|
|
|
+ sessionStorage.removeItem('isAgreementBool');
|
|
|
+ sessionStorage.removeItem('invitedPhone');
|
|
|
+ sessionStorage.removeItem('invitedCode');
|
|
|
+ }
|
|
|
if (+this.type === 1 || +this.type === 2) {
|
|
|
this.getRule();
|
|
|
this.getAssistAwardRecode();
|
|
|
}
|
|
|
|
|
|
- this.bargainingStatus(true);
|
|
|
- switch (+this.type) {
|
|
|
- case 3: // 成功,领取下一台云机界面
|
|
|
- this.successfulBargainingVisible = true;
|
|
|
- break;
|
|
|
- case 4: // 失败,领取下一台云机界面
|
|
|
- this.expireVisible = true;
|
|
|
- break;
|
|
|
- }
|
|
|
+ setTimeout(() => {
|
|
|
+ this.bargainingStatus(true);
|
|
|
+ switch (+this.type) {
|
|
|
+ case 3: // 成功,领取下一台云机界面
|
|
|
+ this.successfulBargainingVisible = true;
|
|
|
+ break;
|
|
|
+ case 4: // 失败,领取下一台云机界面
|
|
|
+ this.expireVisible = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
computed: {
|
|
|
time() {
|
|
@@ -337,7 +400,6 @@ export default {
|
|
|
div.style = 'opacity: 0';
|
|
|
div.innerHTML = `<div>
|
|
|
<div>${phoneNumber}</div>
|
|
|
- <span> 领取了6次 </span>
|
|
|
</div>
|
|
|
<div>${phoneType}${duration}天,价值<span>${price}元</span></div>`;
|
|
|
return div;
|
|
@@ -410,15 +472,31 @@ export default {
|
|
|
duration: 0,
|
|
|
});
|
|
|
}
|
|
|
+ const params = {};
|
|
|
+ console.log(this.inviteeData);
|
|
|
+ if (Object.keys(this.inviteeData).length) {
|
|
|
+ params.userLaunchId = this.inviteeData.userLaunchId;
|
|
|
+ }
|
|
|
+
|
|
|
this.$axios
|
|
|
- .$get('activity/v5/assist/bargaining/current/bargainingStatus')
|
|
|
+ .$get('activity/v5/assist/bargaining/current/bargainingStatus', {
|
|
|
+ params,
|
|
|
+ })
|
|
|
.then(async (res) => {
|
|
|
if (res.success) {
|
|
|
this.info = res.data;
|
|
|
+ localStorage.setItem(
|
|
|
+ 'bargainingStatusInfo',
|
|
|
+ JSON.stringify(this.info),
|
|
|
+ );
|
|
|
+ if (Object.keys(this.inviteeData).length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
const data = await this.getSystemTime();
|
|
|
this.systemTime = data.data;
|
|
|
if (this.info.bargainingStatus === 0) {
|
|
|
this.bargainingVisible = true;
|
|
|
+ return
|
|
|
}
|
|
|
// 如果是安卓客户端登录的情况且bargainingStatus为 1 2 ,
|
|
|
if (
|
|
@@ -541,6 +619,7 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
btnFun() {
|
|
|
+ if (!+this.type) this.assistanceBool = true;
|
|
|
if (+this.type) {
|
|
|
switch (this.info.bargainingStatus) {
|
|
|
case 1:
|
|
@@ -587,6 +666,144 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ // 获取验证码
|
|
|
+ getCode() {
|
|
|
+ if (
|
|
|
+ this.laoginData.phone.length < 11 ||
|
|
|
+ this.codeNumber !== '获取验证码' ||
|
|
|
+ !this.agreementBool
|
|
|
+ ) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!/^1[3456789]\d{9}$/.test(this.laoginData.phone)) {
|
|
|
+ this.$toast('手机号码有误,请重填');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$toast.loading({
|
|
|
+ message: '加载中...',
|
|
|
+ forbidClick: true,
|
|
|
+ duration: 0,
|
|
|
+ });
|
|
|
+ const params = {
|
|
|
+ type: 'common',
|
|
|
+ authorizationType: 4,
|
|
|
+ phone: this.laoginData.phone,
|
|
|
+ };
|
|
|
+ this.$axios
|
|
|
+ .$post('message/v5/phone/send', params)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ this.codeNumber = 60;
|
|
|
+ const timer = setInterval(() => {
|
|
|
+ this.codeNumber--;
|
|
|
+ if (this.codeNumber === 0) {
|
|
|
+ this.codeNumber = '获取验证码';
|
|
|
+ clearInterval(timer);
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$toast('获取成功');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$toast(error.message);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.$toast.clear();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 登录
|
|
|
+ async login() {
|
|
|
+ this.loginLoading = true;
|
|
|
+
|
|
|
+ let uuid = localStorage.getItem('uuid');
|
|
|
+ if (!uuid) {
|
|
|
+ const url = URL.createObjectURL(new Blob());
|
|
|
+ uuid = url.toString();
|
|
|
+ URL.revokeObjectURL(url);
|
|
|
+ uuid = uuid.substring(uuid.lastIndexOf('/') + 1);
|
|
|
+ // 去除 UUID 字符串中的连字符
|
|
|
+ const uuidHex = uuid.replace(/-/g, '');
|
|
|
+ // 将十六进制字符串解析为大整数
|
|
|
+ const uuidNumber = BigInt('0x' + uuidHex);
|
|
|
+ uuid = uuidNumber.toString().substring(0, 20); // 将大整数转换为字符串格式
|
|
|
+ localStorage.setItem('uuid', uuid);
|
|
|
+ }
|
|
|
+ const data = await this.getSystemTime();
|
|
|
+ const registerTime = this.timestampToTime(data.data);
|
|
|
+ const params = {
|
|
|
+ invitationType: 6,
|
|
|
+ registerSource: 102,
|
|
|
+ uuid,
|
|
|
+ registerTime,
|
|
|
+ };
|
|
|
+
|
|
|
+ const headers = {
|
|
|
+ devicesId: uuid,
|
|
|
+ registerSign: this.jm(registerTime),
|
|
|
+ };
|
|
|
+ Object.assign(params, this.laoginData);
|
|
|
+ Object.assign(params, this.inviteeData);
|
|
|
+ params.activityId = params.operateActivityId;
|
|
|
+ delete params.operateActivityId;
|
|
|
+
|
|
|
+ this.$axios
|
|
|
+ .$post('user/v5/client/register/forH5', params, { headers })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ localStorage.setItem('phone', params.phone);
|
|
|
+ localStorage.setItem('auth._token.password', res.data.token)
|
|
|
+ localStorage.setItem('token', res.data.token)
|
|
|
+ localStorage.setItem('dataInfo', `{type: Object, data: ${JSON.stringify(res.data)}}`)
|
|
|
+ this.$toast('登录成功');
|
|
|
+ const url = !res.data.jumpToPage
|
|
|
+ ? '/claimCloudPhone?bool=1'
|
|
|
+ : '/claimCloudPhone/firstReward';
|
|
|
+ this.$router[res.data.jumpToPage ? 'replace' : 'push'](url);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$toast(error.message);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.loginLoading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ timestampToTime(timestamp) {
|
|
|
+ var date = new Date(timestamp * 1000);
|
|
|
+ var Y = date.getFullYear() + '-';
|
|
|
+ var M =
|
|
|
+ (date.getMonth() + 1 < 10
|
|
|
+ ? '0' + (date.getMonth() + 1)
|
|
|
+ : date.getMonth() + 1) + '-';
|
|
|
+ var D =
|
|
|
+ (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
|
|
|
+ var h =
|
|
|
+ (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
|
|
|
+ var m =
|
|
|
+ (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) +
|
|
|
+ ':';
|
|
|
+ var s =
|
|
|
+ date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
|
|
|
+ return Y + M + D + h + m + s;
|
|
|
+ },
|
|
|
+ jm(systemTime) {
|
|
|
+ const registerSign = sha256('Register_SZX_2023:' + systemTime);
|
|
|
+ return registerSign;
|
|
|
+ },
|
|
|
+ // 跳转对应协议
|
|
|
+ toAgreement() {
|
|
|
+ sessionStorage.setItem('invitedPhone', this.laoginData.phone);
|
|
|
+ sessionStorage.setItem('invitedCode', this.laoginData.code);
|
|
|
+ this.$router.push(
|
|
|
+ '/claimCloudPhone/agreement?agreementCoding=XYPZYHXY2002',
|
|
|
+ );
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -921,7 +1138,7 @@ export default {
|
|
|
rgba(255, 255, 255, 0.35)
|
|
|
)
|
|
|
1 1;
|
|
|
- padding: 0 10px;
|
|
|
+ padding-left: 20px;
|
|
|
font-size: 10px;
|
|
|
font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
|
|
|
font-weight: 400;
|
|
@@ -935,17 +1152,10 @@ export default {
|
|
|
&:first-of-type {
|
|
|
display: flex;
|
|
|
& > div {
|
|
|
- width: 50px;
|
|
|
overflow: hidden;
|
|
|
text-overflow: ellipsis;
|
|
|
white-space: nowrap;
|
|
|
}
|
|
|
- & > span {
|
|
|
- display: inline-block;
|
|
|
- background: linear-gradient(to bottom, #fec37a 0%, #ff1500 100%);
|
|
|
- border-radius: 21px;
|
|
|
- padding: 0 10px;
|
|
|
- }
|
|
|
}
|
|
|
&:last-of-type span {
|
|
|
color: #fddb2b;
|
|
@@ -1206,6 +1416,9 @@ export default {
|
|
|
line-height: 16px;
|
|
|
text-align: left;
|
|
|
font-style: normal;
|
|
|
+ &.disabled {
|
|
|
+ color: #999;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.login-agreement {
|