Commit f2a0ac00 by 程默

第三方跳转 sso

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