feat: 注册
This commit is contained in:
@@ -112,6 +112,34 @@ export default {
|
||||
butLoading: false,
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
const pages = getCurrentPages();
|
||||
const currentPage = pages[pages.length - 1];
|
||||
const id = currentPage.options?.key;
|
||||
this.form.referralCode = id;
|
||||
},
|
||||
computed: {
|
||||
/* 判断运行平台 */
|
||||
isIOS() {
|
||||
return /iPhone|iPad|iPod/i.test(navigator.userAgent);
|
||||
},
|
||||
|
||||
/* 下载地址:iOS 去 App Store,Android 去应用宝/直链 APK */
|
||||
storeUrl() {
|
||||
return 'https://app.tbmall.xin/';
|
||||
// return this.isIOS
|
||||
// ? 'https://apps.apple.com/cn/app/id123456789' // ← 换成你的 App Store 地址
|
||||
// : 'https://a.app.qq.com/o/simple.jsp?pkgname=com.xxx.app'; // ← 应用宝地址或 APK 直链
|
||||
},
|
||||
|
||||
/* 唤起协议:iOS 用 Universal Link,Android 用 URL Scheme */
|
||||
openUrl() {
|
||||
return this.isIOS
|
||||
? 'https://ulink.trustbridgeapp.com/open?scene=h5' // ← 你的 iOS Universal Link
|
||||
: 'trustbridgeapp://open?scene=h5'; // ← 你的 Android URL Scheme
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async registerFun() {
|
||||
const form = this.form;
|
||||
@@ -150,13 +178,13 @@ export default {
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!form.referralCode) {
|
||||
this.$refs.uToastRef.show({
|
||||
type: 'error',
|
||||
message: "请输入推荐码",
|
||||
});
|
||||
return;
|
||||
}
|
||||
// if (!form.referralCode) {
|
||||
// this.$refs.uToastRef.show({
|
||||
// type: 'error',
|
||||
// message: "请输入推荐码",
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
if (!this.isPolicy) {
|
||||
this.$refs.uToastRef.show({
|
||||
type: 'error',
|
||||
@@ -171,8 +199,10 @@ export default {
|
||||
password: CryptoJS.MD5(form.loginPassword).toString(),
|
||||
inviteCode: form.referralCode,
|
||||
}
|
||||
|
||||
const resp = await register(params);
|
||||
if (resp && resp.bizcode === 100) {
|
||||
// #ifdef APP-PLUS || MP-WEIXIN
|
||||
const data = resp.data;
|
||||
setStorageFun(TOKEN_NAME, data.token);
|
||||
// 用于无感登录
|
||||
@@ -197,10 +227,30 @@ export default {
|
||||
url: '/pages/home/home',
|
||||
})
|
||||
}, 2000);
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
this.openOrDownload();
|
||||
// #endif
|
||||
}
|
||||
this.butLoading = false;
|
||||
|
||||
},
|
||||
|
||||
openOrDownload() {
|
||||
|
||||
/* 1. 先尝试唤起 */
|
||||
window.location.href = this.openUrl;
|
||||
|
||||
/* 2. 2 秒后未成功则跳商店 */
|
||||
setTimeout(() => {
|
||||
// 简单兼容检测:如果页面仍然可见,就认为没唤起成功
|
||||
const hidden = document.hidden || document.webkitHidden || document.mozHidden || document.msHidden;
|
||||
if (hidden === undefined || !hidden) {
|
||||
window.location.href = this.storeUrl;
|
||||
}
|
||||
}, 2000);
|
||||
},
|
||||
/**
|
||||
* 获取手机验证码
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user