10 changed files with 213 additions and 135 deletions
@ -0,0 +1,22 @@ |
|||||
|
const state = { |
||||
|
chooseName: "金湖路社区", |
||||
|
}; |
||||
|
|
||||
|
const mutations = { |
||||
|
CHOOSE_NAME: (state, name) => { |
||||
|
state.chooseName = name; |
||||
|
}, |
||||
|
}; |
||||
|
|
||||
|
const actions = { |
||||
|
chooseName({ commit }, name) { |
||||
|
commit("CHOOSE_NAME", name); |
||||
|
}, |
||||
|
}; |
||||
|
|
||||
|
export default { |
||||
|
namespaced: true, |
||||
|
state, |
||||
|
mutations, |
||||
|
actions, |
||||
|
}; |
@ -1,118 +1,107 @@ |
|||||
<template> |
<template> |
||||
<main class="g-main"> |
<main class="g-main"> |
||||
<!-- tab展示内容 --> |
<!-- tab展示内容 --> |
||||
<template> |
<template> |
||||
<template v-if="tabIsIframe($router.currentRoute.meta.iframeURL)"> |
<template v-if="tabIsIframe($router.currentRoute.meta.iframeURL)"> |
||||
<iframe :src=" |
<iframe :src="$router.currentRoute.meta.iframeURL + '?token=' + token + '&customerId=' + customerId" ref="iframe" class="m-iframe" id="iframe" width="100%" height="100%" frameborder="0" scrolling="yes" :style="{ height: $store.state.fixed1920.height - 100 + 'px' }" /> |
||||
$router.currentRoute.meta.iframeURL + |
</template> |
||||
'?token=' + |
<keep-alive v-show="!tabIsIframe($router.currentRoute.meta.iframeURL)"> |
||||
token + |
<router-view ref="reloadPage" @changeCustomerName="changeCustomerName" /> |
||||
'&customerId=' + |
</keep-alive> |
||||
customerId |
</template> |
||||
" ref="iframe" class="m-iframe" id="iframe" width="100%" height="100%" frameborder="0" scrolling="yes" |
</main> |
||||
:style="{ height: $store.state.fixed1920.height - 100 + 'px' }" /> |
|
||||
</template> |
|
||||
<keep-alive v-show="!tabIsIframe($router.currentRoute.meta.iframeURL)"> |
|
||||
<router-view @changeCustomerName="changeCustomerName" /> |
|
||||
</keep-alive> |
|
||||
</template> |
|
||||
</main> |
|
||||
</template> |
</template> |
||||
<script> |
<script> |
||||
import { |
import { isURL } from "@/utils/validate"; |
||||
isURL |
import Cookie from "js-cookie"; |
||||
} from "@/utils/validate"; |
export default { |
||||
import Cookie from "js-cookie"; |
props: ["name"], |
||||
export default { |
data() { |
||||
data() { |
return { |
||||
return { |
iframeUrl: "", |
||||
iframeUrl: "", |
token: "", |
||||
token: "", |
customerId: "", |
||||
customerId: "", |
}; |
||||
}; |
}, |
||||
}, |
watch: { |
||||
watch: { |
// "$router.currentRoute.name": function () { |
||||
// "$router.currentRoute.name": function () { |
// console.log($router.currentRoute); |
||||
// console.log($router.currentRoute); |
// }, |
||||
// }, |
}, |
||||
}, |
created() { |
||||
created() { |
// console.log("name", this.name); |
||||
this.token = localStorage.getItem("token"); |
this.token = localStorage.getItem("token"); |
||||
this.customerId = localStorage.getItem("customerId"); |
this.customerId = localStorage.getItem("customerId"); |
||||
}, |
}, |
||||
methods: { |
methods: { |
||||
changeCustomerName(customerName) { |
changeCustomerName(customerName) { |
||||
this.$emit("changeCustomerName", customerName); |
this.$emit("changeCustomerName", customerName); |
||||
}, |
}, |
||||
// tabs, 是否通过iframe展示 |
// tabs, 是否通过iframe展示 |
||||
tabIsIframe(url) { |
tabIsIframe(url) { |
||||
// this.appendIframe(url) |
// this.appendIframe(url) |
||||
// this.iframeUrl = |
// this.iframeUrl = |
||||
// url + |
// url + |
||||
// "?token=" + |
// "?token=" + |
||||
// localStorage.getItem("token") + |
// localStorage.getItem("token") + |
||||
// "&customerId=" + |
// "&customerId=" + |
||||
// localStorage.getItem("customerId"); |
// localStorage.getItem("customerId"); |
||||
// return /^http[s]?:\/\/.*/.test(url); |
// return /^http[s]?:\/\/.*/.test(url); |
||||
return isURL(url); |
return isURL(url); |
||||
}, |
}, |
||||
// tabs, 选中tab |
// tabs, 选中tab |
||||
tabSelectedHandle(tab) { |
tabSelectedHandle(tab) { |
||||
tab = this.$store.state.contentTabs.filter( |
tab = this.$store.state.contentTabs.filter((item) => item.name === tab.name)[0]; |
||||
(item) => item.name === tab.name)[0]; |
if (tab) { |
||||
if (tab) { |
this.$router.push({ |
||||
this.$router.push({ |
name: tab.name, |
||||
name: tab.name, |
params: { |
||||
params: { |
...tab.params, |
||||
...tab.params |
}, |
||||
}, |
query: { |
||||
query: { |
...tab.query, |
||||
...tab.query |
}, |
||||
}, |
}); |
||||
}); |
} |
||||
} |
}, |
||||
}, |
// tabs, 删除tab |
||||
// tabs, 删除tab |
tabRemoveHandle(tabName) { |
||||
tabRemoveHandle(tabName) { |
if (tabName === "home") { |
||||
if (tabName === "home") { |
return false; |
||||
return false; |
} |
||||
} |
this.$store.state.contentTabs = this.$store.state.contentTabs.filter((item) => item.name !== tabName); |
||||
this.$store.state.contentTabs = this.$store.state.contentTabs.filter( |
if (this.$store.state.contentTabs.length <= 0) { |
||||
(item) => item.name !== tabName); |
this.$store.state.sidebarMenuActiveName = this.$store.state.contentTabsActiveName = "home"; |
||||
if (this.$store.state.contentTabs.length <= 0) { |
return false; |
||||
this.$store.state.sidebarMenuActiveName = this.$store.state.contentTabsActiveName = "home"; |
} |
||||
return false; |
// 当前选中tab被删除 |
||||
} |
if (tabName === this.$store.state.contentTabsActiveName) { |
||||
// 当前选中tab被删除 |
let tab = this.$store.state.contentTabs[this.$store.state.contentTabs.length - 1]; |
||||
if (tabName === this.$store.state.contentTabsActiveName) { |
this.$router.push({ |
||||
let tab = this.$store.state.contentTabs[this.$store.state.contentTabs.length - 1]; |
name: tab.name, |
||||
this.$router.push({ |
params: { |
||||
name: tab.name, |
...tab.params, |
||||
params: { |
}, |
||||
...tab.params |
query: { |
||||
}, |
...tab.query, |
||||
query: { |
}, |
||||
...tab.query |
}); |
||||
}, |
} |
||||
}); |
}, |
||||
} |
// tabs, 关闭其它 |
||||
}, |
tabsCloseOtherHandle() { |
||||
// tabs, 关闭其它 |
this.$store.state.contentTabs = this.$store.state.contentTabs.filter((item) => { |
||||
tabsCloseOtherHandle() { |
return item.name === "home" || item.name === this.$store.state.contentTabsActiveName; |
||||
this.$store.state.contentTabs = this.$store.state.contentTabs.filter( |
}); |
||||
(item) => { |
}, |
||||
return (item.name === "home" || item.name === this.$store.state.contentTabsActiveName); |
// tabs, 关闭全部 |
||||
}); |
tabsCloseAllHandle() { |
||||
}, |
this.$store.state.contentTabs = this.$store.state.contentTabs.filter((item) => item.name === "home"); |
||||
// tabs, 关闭全部 |
this.$router.push({ |
||||
tabsCloseAllHandle() { |
name: "home", |
||||
this.$store.state.contentTabs = this.$store.state.contentTabs.filter( |
}); |
||||
(item) => item.name === "home"); |
}, |
||||
this.$router.push({ |
}, |
||||
name: "home" |
}; |
||||
}); |
|
||||
}, |
|
||||
}, |
|
||||
}; |
|
||||
</script> |
</script> |
||||
<style lang="scss" src="@/assets/scss/dataBoardMain.scss" scoped></style> |
<style lang="scss" src="@/assets/scss/dataBoardMain.scss" scoped></style> |
||||
|
Loading…
Reference in new issue