|
|
@ -1,5 +1,10 @@ |
|
|
|
<template> |
|
|
|
<div class="login-container"> |
|
|
|
<iframe v-show="showGrabimageIframe == 'true'" id="getGrabimageIframe" :src='getGrabimageIframeUrl' style="z-index:200;background:#fff;width:200px;height:200px;position:fixed;left:0"></iframe> |
|
|
|
<el-button v-if="showGrabimageIframe == 'true'" style="z-index:200;position:fixed;left:0;bottom:0;background:#000737;border:none" @click="getBase64">获取base64</el-button> |
|
|
|
<div v-if="showGrabimageIframe == 'true'" style="z-index:200;position:fixed;left:0;bottom:40px;background:#000737;border:none" @click="getBase64"> |
|
|
|
<img :src="getGrabimageUrl"/> |
|
|
|
</div> |
|
|
|
<img class="loginLogoImg" src="../../../public/login_logo.png" alt=""> |
|
|
|
<div class="login-form-wrapper"> |
|
|
|
<div class="left"></div> |
|
|
@ -92,6 +97,9 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
return { |
|
|
|
getGrabimageIframeUrl:localStorage.getItem('grabimageURL'), |
|
|
|
showGrabimageIframe:localStorage.getItem('showGrabimageIframeTest'), |
|
|
|
getGrabimageUrl:null, |
|
|
|
loginForm: { |
|
|
|
grant_type: 'password', |
|
|
|
client_id: 'Auth_App', |
|
|
@ -142,11 +150,26 @@ export default { |
|
|
|
} else if (this.loginForm.password === '') { |
|
|
|
this.$refs.password.focus() |
|
|
|
} |
|
|
|
|
|
|
|
let _this = this |
|
|
|
window.addEventListener('message', function(event) { |
|
|
|
// if (event.origin === 'http://iframe-domain.com') { // 确保消息来自iframe的域 |
|
|
|
var result = event.data; // 接收函数执行结果 |
|
|
|
_this.getGrabimageUrl = result.data; |
|
|
|
console.log('登录页返回base64',result) |
|
|
|
// } |
|
|
|
}); |
|
|
|
}, |
|
|
|
destroyed () { |
|
|
|
// window.removeEventListener('storage', this.afterQRScan) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getBase64(){ |
|
|
|
// 在你的页面中 |
|
|
|
this.getGrabimageIframeUrl = localStorage.getItem('grabimageURL') + '?time='+new Date().getTime() |
|
|
|
var iframeWindow = document.getElementById('getGrabimageIframe').contentWindow; |
|
|
|
iframeWindow.postMessage('callMyFunction', '*'); |
|
|
|
}, |
|
|
|
checkCapslock (e) { |
|
|
|
const { key } = e |
|
|
|
this.capsTooltip = key && key.length === 1 && (key >= 'A' && key <= 'Z') |
|
|
|