Commit f2a0ac00 by 程默

第三方跳转 sso

parent 5babe6db
......@@ -15,6 +15,10 @@ console.log(process.env,'-----------------config------')
//check unionid
checkUnionid(options){
return requestGET(`${process.env.OLSHOP_URL}/wx/mini_check_union_id`,options)
},
// sso登录
getSsoBcakUrl(options) {
return requestPOST(`${process.env.OLSHOP_URL}/common/getSsoCallbackUrl`,options)
}
}
\ No newline at end of file
......@@ -26,38 +26,42 @@ export default {
};
},
async onLoad(options) {
console.log('wxarticle',options)
// options.scene="64a77cd6aeac4c1db46e3f7d53596fe6"
if (options.link) {
this.link = decodeURIComponent(options.link);
} else if (options.scene) {
//扫码
let data = await this.getParams(
options.scene || "959ce6ac97cf4f43a1759eb41ec12798"
);
if (data.sso == "sso" && !wx.getStorageSync("sessionid")) {
let link = decodeURIComponent(data.link).replace(
"${token}",
wx.getStorageSync("sessionid")
);
wx.redirectTo({
url: `../login/main?scene=sso&back=${link}`,
});
} else {
this.link = data.link;
let data = await this.getParams(options.scene);
if (data.sso) {
if (!wx.getStorageSync("sessionid")) {
wx.redirectTo({
url: `../login/main?scene=sso&back=${data.link}`,
});
}else{
let link = decodeURIComponent(data.link).replace(
"${token}",
wx.getStorageSync("sessionid")
);
this.link = decodeURIComponent(link);
}
}
}
},
methods: {
getParams(options) {
return indexApi
.getShareSceneRecord(options)
.then((res) => {
if (res.data.code == "200") {
console.log("5666666", res);
let scene = JSON.parse(res.data.data.scene);
resolve(scene.link);
}
})
.catch((err) => {});
return new Promise((resolve, reject) => {
indexApi
.getShareSceneRecord(options)
.then((res) => {
if (res.data.code == "200") {
let scene = JSON.parse(res.data.data.scene);
resolve(scene);
}
})
.catch((err) => {});
});
},
//加载成功
handleLoad() {
......
{
"navigationBarTitleText": "文章"
}
\ No newline at end of file
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 to comment