|
@@ -309,6 +309,8 @@ export default {
|
|
|
name: "loginPage",
|
|
|
data() {
|
|
|
return {
|
|
|
+ // 微信监听
|
|
|
+ messageHandler:'',
|
|
|
// 判断显示组织号区域
|
|
|
SuffixShow: false,
|
|
|
// 组织号查询区域结果
|
|
@@ -404,7 +406,11 @@ export default {
|
|
|
}),
|
|
|
// 获取组织后缀
|
|
|
async getSuffix() {
|
|
|
- if (!this.SuffixData) return
|
|
|
+ if (!this.SuffixData){
|
|
|
+ this.orginfo = [];
|
|
|
+ this.org = "";
|
|
|
+ return
|
|
|
+ }
|
|
|
let res = await GetSuffix({ mode: this.SuffixData });
|
|
|
console.log("res.data[0]", res.data[0]);
|
|
|
|
|
@@ -1069,25 +1075,50 @@ export default {
|
|
|
},
|
|
|
mounted() {
|
|
|
let _this = this;
|
|
|
- window.addEventListener("message", function (e) {
|
|
|
+ // window.addEventListener("message", function (e) {
|
|
|
+ // // 监听 message 事件
|
|
|
+ // console.log('longin',e);
|
|
|
+ // if (e.data && e.data.method == "getOpenId") {
|
|
|
+ // console.log('e',e);
|
|
|
+ // console.log('e.data.code',e.data.code);
|
|
|
+ // console.log('_this.loginType',_this.loginType);
|
|
|
+
|
|
|
+ // if (e.data.code == 200) {
|
|
|
+ // _this.getOpenId(e.data.data.openid);
|
|
|
+ // } else {
|
|
|
+ // _this.$message.error("扫码登录失败请重新扫码");
|
|
|
+ // _this.wechatLogin();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ this.messageHandler = function (e) {
|
|
|
// 监听 message 事件
|
|
|
- console.log('longin',e);
|
|
|
- if (e.data && e.data.method == "getOpenId") {
|
|
|
- console.log('e',e);
|
|
|
- console.log('e.data.code',e.data.code);
|
|
|
- console.log('_this.loginType',_this.loginType);
|
|
|
+ console.log('userinfo', e);
|
|
|
+ if (e.data && e.data.method === "getOpenId") {
|
|
|
+ console.log('e', e);
|
|
|
+ console.log('e.data.code', e.data.code);
|
|
|
+ console.log('_this.loginType', _this.loginType);
|
|
|
|
|
|
- if (e.data.code == 200) {
|
|
|
+ if (e.data.code === 200) {
|
|
|
_this.getOpenId(e.data.data.openid);
|
|
|
} else {
|
|
|
_this.$message.error("扫码登录失败请重新扫码");
|
|
|
- _this.wechatLogin();
|
|
|
+ _this.wechatDialogVisible = false;
|
|
|
+ setTimeout(() => {
|
|
|
+ _this.wechatDialogVisible = true;
|
|
|
+ _this.wechatLogin();
|
|
|
+ }, 1000);
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ };
|
|
|
+
|
|
|
+ window.addEventListener("message", this.messageHandler);
|
|
|
this.getLoading();
|
|
|
this.getOrdOidData();
|
|
|
},
|
|
|
+ // beforeDestroy() {
|
|
|
+ // window.removeEventListener("message", this.messageHandler);
|
|
|
+ // }
|
|
|
};
|
|
|
</script>
|
|
|
<style scoped>
|