Browse Source

修复ticket失效的问题

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

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

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

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

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

Loading…
Cancel
Save