Commit 68155df3 by xinla

--no commit message

1 parent ddc1e70c
......@@ -59,14 +59,14 @@ export function getQueryValue(name) {
export async function getWxCode() {
let userinfo = localStorage.getItem('userinfo')
//取缓存中的用户信息
// if (userinfo) {
// try {
// userinfo = JSON.parse(userinfo)
// } catch (error) {
// alert(error)
// }
// return userinfo.openId
// }
if (userinfo) {
try {
userinfo = JSON.parse(userinfo)
} catch (error) {
alert(error)
}
return userinfo.openId
}
//缓存中没有用户信息,进入授权流程
let appid = window.CONFIG.appId // 公众号appid
......
......@@ -45,14 +45,18 @@ export default {
duration: 0,
forbidClick: true,
})
getWxCode().then((openId) => {
if (openId) {
this.openId = openId
this.getRedPacketInfo()
} else {
getWxCode()
.then((openId) => {
if (openId) {
this.openId = openId
this.getRedPacketInfo()
} else {
this.$toast.clear()
}
})
.catch(() => {
this.$toast('授权异常,请刷新重试')
}
})
})
},
getRedPacketInfo() {
getRedPacketInfo().then(({ data }) => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!