wangfukang 2 weeks ago
parent
commit
498b52b59a
  1. 61
      package2/login/login.vue

61
package2/login/login.vue

@ -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,11 +263,6 @@
const that = this const that = this
this.loginLoading = true this.loginLoading = true
this.ensureInviteRegionMatched().then((matched) => {
if (!matched) {
that.loginLoading = false
return
}
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success(loginRes) { success(loginRes) {
@ -286,7 +298,6 @@
that.tui.toast('微信登录失败,请稍后再试') that.tui.toast('微信登录失败,请稍后再试')
} }
}) })
})
}, },
getWechatProfile() { getWechatProfile() {
return new Promise((resolve) => { return new Promise((resolve) => {
@ -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>

Loading…
Cancel
Save