Browse Source

修复ticket失效的问题

feature
duanliangtao 11 months ago
parent
commit
cacb91dff4
  1. 63
      src/views/modules/volunteer/mall/category.vue
  2. 63
      src/views/modules/volunteer/mall/index.vue

63
src/views/modules/volunteer/mall/category.vue

@ -26,46 +26,53 @@ export default {
created() { created() {
// ,ticket // ,ticket
http.get("/auth/sso/getTicket") http.get("/auth/sso/getTicket")
.then(({data: res}) => { .then(({ data: res }) => {
let ticket = res.data let ticket = res.data;
console.log('ticket:', ticket) console.log('ticket:', ticket);
this.iframeSrc = "../../../epmet-voluntary-mall-admin/pms/productCategory?target=_blank&ticket=" + ticket this.iframeSrc = "../../../epmet-voluntary-mall-admin/pms/productCategory?ticket=" + ticket;
}) });
}, },
methods: { methods: {
// iframe // iframe
onIframeLoad() { onIframeLoad() {
// iframe
if(this.iframeSrc==''){
return;
}
const iframe = this.$refs.childIframe; const iframe = this.$refs.childIframe;
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
if (iframeDocument) { if (this.iframeSrc.indexOf("ticket")!== -1) {
const styleElement = iframeDocument.createElement('style'); // iframeSrc URL ticket
styleElement.type = 'text/css'; this.iframeSrc = "../../../epmet-voluntary-mall-admin/pms/productCategory";
}else{
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
const newStyles = ` if (iframeDocument) {
#app .main-container { const styleElement = iframeDocument.createElement('style');
margin-left: 0px !important; styleElement.type = 'text/css';
}
#app .sidebar-container {
display: none !important;
}
.navbar {
display: none !important;
}
`;
styleElement.appendChild(iframeDocument.createTextNode(newStyles)); const newStyles = `
#app .main-container {
margin-left: 0px !important;
}
#app .sidebar-container {
display: none !important;
}
.navbar {
display: none !important;
}
`;
iframeDocument.head.appendChild(styleElement); styleElement.appendChild(iframeDocument.createTextNode(newStyles));
iframeDocument.head.appendChild(styleElement);
// iframe // iframe
iframe.style.display = 'block'; iframe.style.display = 'block';
}
} }
} }
} }
}; };
</script> </script>
<style scoped>
</style>

63
src/views/modules/volunteer/mall/index.vue

@ -26,46 +26,53 @@ export default {
created() { created() {
// ,ticket // ,ticket
http.get("/auth/sso/getTicket") http.get("/auth/sso/getTicket")
.then(({data: res}) => { .then(({ data: res }) => {
let ticket = res.data let ticket = res.data;
console.log('ticket:', ticket) console.log('ticket:', ticket);
this.iframeSrc = "../../../epmet-voluntary-mall-admin/pms/product?target=_blank&ticket=" + ticket this.iframeSrc = "../../../epmet-voluntary-mall-admin/pms/product?ticket=" + ticket;
}) });
}, },
methods: { methods: {
// iframe // iframe
onIframeLoad() { onIframeLoad() {
// iframe
if(this.iframeSrc==''){
return;
}
const iframe = this.$refs.childIframe; const iframe = this.$refs.childIframe;
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
if (iframeDocument) { if (this.iframeSrc.indexOf("ticket")!== -1) {
const styleElement = iframeDocument.createElement('style'); // iframeSrc URL ticket
styleElement.type = 'text/css'; this.iframeSrc = "../../../epmet-voluntary-mall-admin/pms/product";
}else{
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
const newStyles = ` if (iframeDocument) {
#app .main-container { const styleElement = iframeDocument.createElement('style');
margin-left: 0px !important; styleElement.type = 'text/css';
}
#app .sidebar-container {
display: none !important;
}
.navbar {
display: none !important;
}
`;
styleElement.appendChild(iframeDocument.createTextNode(newStyles)); const newStyles = `
#app .main-container {
margin-left: 0px !important;
}
#app .sidebar-container {
display: none !important;
}
.navbar {
display: none !important;
}
`;
iframeDocument.head.appendChild(styleElement); styleElement.appendChild(iframeDocument.createTextNode(newStyles));
iframeDocument.head.appendChild(styleElement);
// iframe // iframe
iframe.style.display = 'block'; iframe.style.display = 'block';
}
} }
} }
} }
}; };
</script> </script>
<style scoped>
</style>

Loading…
Cancel
Save