增加绑定微信功能界面,增加每日解锁支付超过最大获取抽奖次数时弹窗提醒,增加视频解锁创建订单提示未绑定微信407状态时跳转绑定微信界面
This commit is contained in:
45
utils/wx.js
Normal file
45
utils/wx.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import {
|
||||
$bindWx,
|
||||
$bindStatus
|
||||
} from '@/api/login/login.js'
|
||||
|
||||
// 绑定状态
|
||||
export async function bindStatus() {
|
||||
const res = await $bindStatus()
|
||||
return res.wxBind ? true : false;
|
||||
}
|
||||
export function toBindWx() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/bindWx'
|
||||
})
|
||||
|
||||
}
|
||||
//绑定微信
|
||||
export async function bindWx() {
|
||||
console.log('bindWx');
|
||||
const isBind = await bindStatus()
|
||||
if (isBind) {
|
||||
uni.showToast({
|
||||
title: '已绑定微信,请勿重复绑定',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
return new Promise((reslove, reject) => {
|
||||
uni.login({
|
||||
"provider": "weixin",
|
||||
"onlyAuthorize": true, // 微信登录仅请求授权认证
|
||||
success: function(loginRes) {
|
||||
console.log(loginRes);
|
||||
reslove(loginRes.code)
|
||||
},
|
||||
fail: function(err) {
|
||||
// 登录授权失败
|
||||
// err.code是错误码
|
||||
console.log(err);
|
||||
reject()
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user