Commit 5babe6db by 程默

add sso

parent de7b8371
...@@ -18,23 +18,47 @@ ...@@ -18,23 +18,47 @@
</template> </template>
<script> <script>
import indexApi from "@/api/index.js";
export default { export default {
data(){ data() {
return{ return {
link : '' link: "",
} };
}, },
onLoad(options){ async onLoad(options) {
if (options.scene=='sso' && !wx.getStorageSync("sessionid")) { 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({ wx.redirectTo({
url: `../login/main?scene=sso&back=${link}` url: `../login/main?scene=sso&back=${link}`,
}); });
}else{ } else {
console.log(decodeURIComponent(options.link),'地址') this.link = data.link;
this.link = decodeURIComponent(options.link) }
} }
}, },
methods: { 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) => {});
},
//加载成功 //加载成功
handleLoad() { handleLoad() {
console.log("网页加载成功"); console.log("网页加载成功");
...@@ -44,7 +68,7 @@ export default { ...@@ -44,7 +68,7 @@ export default {
title: "网页加载失败 请右上角刷新", title: "网页加载失败 请右上角刷新",
}); });
}, },
} },
}; };
</script> </script>
......
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