Compare commits

...

3 Commits

Author SHA1 Message Date
duanliangtao 84dead01a0 跳转商城修复ticket失效问题 11 months ago
duanliangtao fedda58ce8 增加一个商品分类页面 11 months ago
duanliangtao 9ab24d29e0 志愿有礼前端样式的修改 11 months ago
  1. 78
      src/views/modules/volunteer/mall/category.vue
  2. 78
      src/views/modules/volunteer/mall/index.vue

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

@ -0,0 +1,78 @@
<template>
<div>
<!-- 隐藏 iframe等子页面加载完成并修改后再显示 -->
<iframe
id="childIframe"
ref="childIframe"
:src="iframeSrc"
width="100%"
height="1000px"
frameborder="0"
style="display: none;"
@load="onIframeLoad"
></iframe>
</div>
</template>
<script>
import http from "@/utils/request";
export default {
data() {
return {
//
iframeSrc: '', // iframeSrc
};
},
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?ticket=" + ticket;
});
},
methods: {
// iframe
onIframeLoad() {
if(this.iframeSrc==''){
return;
}
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;
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>

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

@ -0,0 +1,78 @@
<template>
<div>
<!-- 隐藏 iframe等子页面加载完成并修改后再显示 -->
<iframe
id="childIframe"
ref="childIframe"
:src="iframeSrc"
width="100%"
height="1000px"
frameborder="0"
style="display: none;"
@load="onIframeLoad"
></iframe>
</div>
</template>
<script>
import http from "@/utils/request";
export default {
data() {
return {
//
iframeSrc: '', // iframeSrc
};
},
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?ticket=" + ticket;
});
},
methods: {
// iframe
onIframeLoad() {
if(this.iframeSrc==''){
return;
}
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;
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>
Loading…
Cancel
Save