Browse Source

修复ticket失效的问题

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

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

@ -26,17 +26,26 @@ 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;
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; const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
if (iframeDocument) { if (iframeDocument) {
@ -56,16 +65,14 @@ export default {
`; `;
styleElement.appendChild(iframeDocument.createTextNode(newStyles)); styleElement.appendChild(iframeDocument.createTextNode(newStyles));
iframeDocument.head.appendChild(styleElement); iframeDocument.head.appendChild(styleElement);
// iframe // iframe
iframe.style.display = 'block'; iframe.style.display = 'block';
} }
} }
}
} }
}; };
</script> </script>
<style scoped>
</style>

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

@ -26,17 +26,26 @@ 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;
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; const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
if (iframeDocument) { if (iframeDocument) {
@ -56,16 +65,14 @@ export default {
`; `;
styleElement.appendChild(iframeDocument.createTextNode(newStyles)); styleElement.appendChild(iframeDocument.createTextNode(newStyles));
iframeDocument.head.appendChild(styleElement); iframeDocument.head.appendChild(styleElement);
// iframe // iframe
iframe.style.display = 'block'; iframe.style.display = 'block';
} }
} }
}
} }
}; };
</script> </script>
<style scoped>
</style>

Loading…
Cancel
Save