Commit 837c088a by 白宇

reset_applcation

parent 9893c088
...@@ -90,6 +90,9 @@ const $get = (url)=>{ ...@@ -90,6 +90,9 @@ const $get = (url)=>{
if(res.data.code===0){ if(res.data.code===0){
resolve(res.data) resolve(res.data)
}else{ }else{
if(res.data.code == '100100' || res.data.code == '100101'){
reset_applcation()
}
reject(Error(res.data.msg)) reject(Error(res.data.msg))
} }
}).catch(err => { }).catch(err => {
...@@ -106,6 +109,9 @@ const $post = (url,data)=>{ ...@@ -106,6 +109,9 @@ const $post = (url,data)=>{
if(res.data.code===0){ if(res.data.code===0){
resolve(res.data) resolve(res.data)
}else{ }else{
if(res.data.code == '100100' || res.data.code == '100101'){
reset_applcation()
}
reject(Error(res.data.msg)) reject(Error(res.data.msg))
} }
...@@ -114,7 +120,46 @@ const $post = (url,data)=>{ ...@@ -114,7 +120,46 @@ const $post = (url,data)=>{
}) })
}) })
} }
function _init_wx_jssdk(){
if(wx){
wx.updateAppMessageShareData({
title: FRONT_TITLE, // 分享标题
desc: FRONT_DESC, // 分享描述
link: FRONT_URL+'?'+new Date().getTime(), // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: shareImg(), // 分享图标
success: function () {
// 设置成功
}
})
var title = FRONT_TITLE
try {
title = `${getUserInfoByLocalStorage()}的2020幸运打卡地:丹寨`
} catch (error) {
}
// alert(title)
var img = shareImg()
// alert(img)
// wx.onMenuShareTimeline({
wx.updateTimelineShareData({
title: title, // 分享标题
link: FRONT_URL+'?'+new Date().getTime(), // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: img, // 分享图标
success: function () {
// 设置成功
}
})
}
}
async function reset_applcation() {
localStorage.clear()
const {url,appid} = await $get('/weixin/info').then(res=>res.data).catch(err=>{throw err})
location.href = url
}
/** /**
* 获取信息 * 获取信息
* @returns {Promise<unknown>} * @returns {Promise<unknown>}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment