|
|
@ -89,6 +89,10 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<view v-if="inviteSkipTipVisible" class="invite-skip-tip"> |
|
|
|
|
|
{{inviteSkipTipText}} |
|
|
|
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
@ -108,7 +112,9 @@ |
|
|
areaKind: 1, |
|
|
areaKind: 1, |
|
|
inviteContext: { inviterId: '', regionId: '' }, |
|
|
inviteContext: { inviterId: '', regionId: '' }, |
|
|
inviteLat: '', |
|
|
inviteLat: '', |
|
|
inviteLng: '' |
|
|
inviteLng: '', |
|
|
|
|
|
inviteSkipTipVisible: false, |
|
|
|
|
|
inviteSkipTipText: '' |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
|
@ -150,6 +156,9 @@ |
|
|
this.goAfterLogin(false) |
|
|
this.goAfterLogin(false) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
onUnload() { |
|
|
|
|
|
clearTimeout(this._inviteSkipTipTimer) |
|
|
|
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
syncInviteContext(option) { |
|
|
syncInviteContext(option) { |
|
|
rememberInviteParams(option || {}) |
|
|
rememberInviteParams(option || {}) |
|
|
@ -193,6 +202,17 @@ |
|
|
} |
|
|
} |
|
|
return payload |
|
|
return payload |
|
|
}, |
|
|
}, |
|
|
|
|
|
showInviteSkipToast(message) { |
|
|
|
|
|
clearTimeout(this._inviteSkipTipTimer) |
|
|
|
|
|
this.inviteSkipTipText = message |
|
|
|
|
|
this.inviteSkipTipVisible = true |
|
|
|
|
|
return new Promise((resolve) => { |
|
|
|
|
|
this._inviteSkipTipTimer = setTimeout(() => { |
|
|
|
|
|
this.inviteSkipTipVisible = false |
|
|
|
|
|
resolve(true) |
|
|
|
|
|
}, 1500) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
ensureInviteRegionMatched() { |
|
|
ensureInviteRegionMatched() { |
|
|
if (!this.hasInviteContext()) return Promise.resolve(true) |
|
|
if (!this.hasInviteContext()) return Promise.resolve(true) |
|
|
return new Promise((resolve) => { |
|
|
return new Promise((resolve) => { |
|
|
@ -210,16 +230,13 @@ |
|
|
resolve(true) |
|
|
resolve(true) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
this.tui.toast('当前定位不在邀请区域内,无法领取拉新奖励') |
|
|
this.showInviteSkipToast('定位不在邀请区域内,邀请人无法获得奖励').then(resolve) |
|
|
resolve(false) |
|
|
|
|
|
}).catch(() => { |
|
|
}).catch(() => { |
|
|
this.tui.toast('区域校验失败,请稍后再试') |
|
|
this.showInviteSkipToast('区域校验失败,邀请人无法获得奖励').then(resolve) |
|
|
resolve(false) |
|
|
|
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
fail: () => { |
|
|
fail: () => { |
|
|
this.tui.toast('需要授权定位后领取拉新奖励') |
|
|
this.showInviteSkipToast('未授权定位,邀请人无法获得奖励').then(resolve) |
|
|
resolve(false) |
|
|
|
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
@ -246,46 +263,40 @@ |
|
|
|
|
|
|
|
|
const that = this |
|
|
const that = this |
|
|
this.loginLoading = true |
|
|
this.loginLoading = true |
|
|
this.ensureInviteRegionMatched().then((matched) => { |
|
|
uni.login({ |
|
|
if (!matched) { |
|
|
provider: 'weixin', |
|
|
that.loginLoading = false |
|
|
success(loginRes) { |
|
|
return |
|
|
that.getWechatProfile().then((profile) => { |
|
|
} |
|
|
that.cacheWechatProfile(profile) |
|
|
uni.login({ |
|
|
const loginPayload = Object.assign({ |
|
|
provider: 'weixin', |
|
|
jsCode: loginRes.code, |
|
|
success(loginRes) { |
|
|
customId: that.customId, |
|
|
that.getWechatProfile().then((profile) => { |
|
|
wechatName: profile.nickName || uni.getStorageSync('nickname') || that.defaultWechatName, |
|
|
that.cacheWechatProfile(profile) |
|
|
userType: '2' |
|
|
const loginPayload = Object.assign({ |
|
|
}, that.getInvitePayload()) |
|
|
jsCode: loginRes.code, |
|
|
that.tui.request('/user/login', 'post', loginPayload, false, false).then((res) => { |
|
|
customId: that.customId, |
|
|
that.loginLoading = false |
|
|
wechatName: profile.nickName || uni.getStorageSync('nickname') || that.defaultWechatName, |
|
|
if (res.code == 200) { |
|
|
userType: '2' |
|
|
that.saveLoginResult(res.result) |
|
|
}, that.getInvitePayload()) |
|
|
if (!res.result || !res.result.user || res.result.user.mobile == null || res.result.user.mobile === '') { |
|
|
that.tui.request('/user/login', 'post', loginPayload, false, false).then((res) => { |
|
|
that.needPhoneAuth = true |
|
|
that.loginLoading = false |
|
|
that.tui.toast('绑定手机号,解锁完整半径') |
|
|
if (res.code == 200) { |
|
|
|
|
|
that.saveLoginResult(res.result) |
|
|
|
|
|
if (!res.result || !res.result.user || res.result.user.mobile == null || res.result.user.mobile === '') { |
|
|
|
|
|
that.needPhoneAuth = true |
|
|
|
|
|
that.tui.toast('绑定手机号,解锁完整半径') |
|
|
|
|
|
} else { |
|
|
|
|
|
that.enterHome() |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
that.tui.toast(res.message) |
|
|
that.enterHome() |
|
|
} |
|
|
} |
|
|
}).catch(() => { |
|
|
} else { |
|
|
that.loginLoading = false |
|
|
that.tui.toast(res.message) |
|
|
that.tui.toast('登录失败,请稍后再试') |
|
|
} |
|
|
}) |
|
|
}).catch(() => { |
|
|
|
|
|
that.loginLoading = false |
|
|
|
|
|
that.tui.toast('登录失败,请稍后再试') |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}) |
|
|
fail() { |
|
|
}, |
|
|
that.loginLoading = false |
|
|
fail() { |
|
|
that.tui.toast('微信登录失败,请稍后再试') |
|
|
that.loginLoading = false |
|
|
} |
|
|
that.tui.toast('微信登录失败,请稍后再试') |
|
|
}) |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
getWechatProfile() { |
|
|
getWechatProfile() { |
|
|
@ -335,10 +346,6 @@ |
|
|
|
|
|
|
|
|
this.phoneLoading = true |
|
|
this.phoneLoading = true |
|
|
this.ensureInviteRegionMatched().then((matched) => { |
|
|
this.ensureInviteRegionMatched().then((matched) => { |
|
|
if (!matched) { |
|
|
|
|
|
this.phoneLoading = false |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const phonePayload = Object.assign({ |
|
|
const phonePayload = Object.assign({ |
|
|
code: e.detail.code |
|
|
code: e.detail.code |
|
|
}, this.getInvitePayload()) |
|
|
}, this.getInvitePayload()) |
|
|
@ -1142,4 +1149,24 @@ |
|
|
transform: translateY(-8rpx); |
|
|
transform: translateY(-8rpx); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.invite-skip-tip { |
|
|
|
|
|
position: fixed; |
|
|
|
|
|
left: 50%; |
|
|
|
|
|
top: 50%; |
|
|
|
|
|
z-index: 9999; |
|
|
|
|
|
width: 560rpx; |
|
|
|
|
|
max-width: calc(100vw - 96rpx); |
|
|
|
|
|
padding: 26rpx 30rpx; |
|
|
|
|
|
box-sizing: border-box; |
|
|
|
|
|
border-radius: 28rpx; |
|
|
|
|
|
background: rgba(18, 59, 49, 0.94); |
|
|
|
|
|
color: #ffffff; |
|
|
|
|
|
font-size: 27rpx; |
|
|
|
|
|
font-weight: 700; |
|
|
|
|
|
line-height: 1.55; |
|
|
|
|
|
text-align: center; |
|
|
|
|
|
box-shadow: 0 24rpx 70rpx rgba(18, 59, 49, 0.24); |
|
|
|
|
|
transform: translate(-50%, -50%); |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |
|
|
|