12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <template>
- <div class="home">
- <Header
- v-if="route.meta && !route.meta.hideHeader"
- :color="route.meta.color"
- :metaObj="route.meta"
- />
- <div
- :class="!route.meta.hideHeader ? 'ptheader' : ''"
- :style="{ background: route.meta.color }"
- />
- <router-view :key="route.fullPath" />
- </div>
- </template>
- <script lang="ts">
- import { defineComponent, nextTick, onMounted, reactive, toRefs } from "vue";
- import Header from "@/components/header/Comheader.vue";
- import { useRoute, onBeforeRouteUpdate } from "vue-router";
- import axios from "axios";
- export default defineComponent({
- components: {
- Header,
- },
- setup() {
- const route: any = useRoute();
- const proxyData = reactive({
- route: route,
- transitionName: "slide-right",
- showHeader: false,
- getPadVersion() {
- axios.get(`/sgipad/pad_mtime`).then((res: any) => {
- let data: any = res.data || {};
- let pad_mtime: any = data.pad_mtime;
- let oldTime: any = localStorage.getItem("pad_mtime");
- if (oldTime && oldTime !== pad_mtime) {
- localStorage.setItem("pad_mtime", pad_mtime);
- window.location.reload();
- } else {
- localStorage.setItem("pad_mtime", pad_mtime);
- }
- });
- },
- timerPadVersion() {
- setInterval(() => {
- proxyData.getPadVersion();
- }, 5000);
- },
- });
- nextTick(() => {
- const document: any = window.document;
- document.addEventListener("touchstart", function (event: any) {
- if (event.touches.length > 1) {
- event.preventDefault();
- }
- });
- document.addEventListener("gesturestart", function (event: any) {
- event.preventDefault();
- });
- });
- onMounted(() => {
- proxyData.timerPadVersion();
- });
- return {
- ...toRefs(proxyData),
- };
- },
- });
- </script>
- <style lang="scss" scoped>
- .home {
- .child-view {
- position: absolute;
- width: 100%;
- transition: all 0.8s cubic-bezier(0.55, 0, 0.1, 1);
- }
- .slide-left-enter,
- .slide-right-leave-active {
- opacity: 0;
- -webkit-transform: translate(50px, 0);
- transform: translate(50px, 0);
- }
- .slide-left-leave-active,
- .slide-right-enter {
- opacity: 0;
- -webkit-transform: translate(-50px, 0);
- transform: translate(-50px, 0);
- }
- }
- </style>
- function getVersionTime() {
- throw new Error("Function not implemented.");
- }
|