112 lines
2.8 KiB
Vue
112 lines
2.8 KiB
Vue
<template>
|
|
<div>
|
|
<Nav @gotoIfreamPage="gotoIfreamPage" @gotoPage="gotoPage" />
|
|
<div :style="{ 'height': documentClientHeight-64 + 'px' ,'margin-top':'64px'}">
|
|
<iframe v-if="iframeUrl" :src="iframeUrl" width="100%" height="100%" frameborder="0" scrolling="yes">
|
|
</iframe>
|
|
<keep-alive v-else>
|
|
<router-view />
|
|
</keep-alive>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import Nav from "@/pages/index/components/nav/index2.vue";
|
|
export default {
|
|
name: "Main",
|
|
data() {
|
|
return {
|
|
iframeUrl: '',
|
|
documentClientHeight: 100
|
|
};
|
|
},
|
|
components: {
|
|
Nav,
|
|
},
|
|
computed: {
|
|
// documentClientHeight: {
|
|
// get() {
|
|
// return this.$store.state.common.documentClientHeight;
|
|
// },
|
|
// set(val) {
|
|
// this.$store.commit("common/updateDocumentClientHeight", val);
|
|
// },
|
|
// },
|
|
|
|
},
|
|
created() {
|
|
|
|
|
|
|
|
// this.getUserInfo();
|
|
|
|
//防止浏览器刷新导致store丢失 浏览器刷新时存入sessionStore
|
|
this.bakStore();
|
|
},
|
|
mounted() {
|
|
this.resetDocumentClientHeight();
|
|
},
|
|
methods: {
|
|
gotoPage(name) {
|
|
// this.$router.push({
|
|
// name: name
|
|
// })
|
|
|
|
// this.$router.replace({ name: name, force: true })
|
|
|
|
window.location.href = name
|
|
},
|
|
|
|
gotoIfreamPage(iframeUrl) {
|
|
this.iframeUrl = iframeUrl;
|
|
},
|
|
|
|
|
|
|
|
// 重置窗口可视高度
|
|
resetDocumentClientHeight() {
|
|
this.documentClientHeight = document.documentElement["clientHeight"];
|
|
window.onresize = () => {
|
|
this.documentClientHeight = document.documentElement["clientHeight"];
|
|
};
|
|
},
|
|
// 获取当前管理员信息
|
|
// getUserInfo() {
|
|
// this.$http({
|
|
// url: this.$http.adornUrl("/sys/user/info"),
|
|
// method: "get",
|
|
// params: this.$http.adornParams(),
|
|
// }).then(({ data }) => {
|
|
// if (data && data.code === 0) {
|
|
// this.loading = false;
|
|
// this.userId = data.user.userId;
|
|
// this.userName = data.user.username;
|
|
// this.realname = data.user.realname;
|
|
// this.companyId = data.user.companyId;
|
|
// this.companyTaxNo = data.user.companyTaxNo;
|
|
// this.companyName = data.user.companyName;
|
|
// }
|
|
// });
|
|
// },
|
|
|
|
bakStore() {
|
|
// 在页面加载时读取sessionStorage里的状态信息
|
|
if (sessionStorage.getItem("store")) {
|
|
this.$store.replaceState(
|
|
Object.assign(
|
|
{},
|
|
this.$store.state,
|
|
JSON.parse(sessionStorage.getItem("store"))
|
|
)
|
|
);
|
|
} // 在页面刷新时将vuex里的信息保存到sessionStorage里 // beforeunload事件在页面刷新时先触发
|
|
|
|
window.addEventListener("beforeunload", () => {
|
|
sessionStorage.setItem("store", JSON.stringify(this.$store.state));
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|