| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <template>
- <div class="main">
- <Header @scroll-update="scrollUpdate"></Header>
- <el-scrollbar ref="pagescrollbar" view-style="height:100%">
- <router-view />
- <Footer></Footer>
- </el-scrollbar>
- </div>
- </template>
- <script>
- import { defineAsyncComponent } from "vue";
- import api from "@/api/common";
- export default {
- name: "App",
- components: {
- Header: defineAsyncComponent(() =>
- import("@/components/AppVue/Header.vue")
- ),
- Footer: defineAsyncComponent(() => import("@/components/AppVue/Footer.vue"))
- },
- mounted() {
- let that = this;
- document.querySelector("#app").style.transform = `scale(${this.getScale()}) translate(-50%, 0%)`
- document.querySelector("#app").style.height = window.innerHeight / this.getScale() + "px"
- window.onresize = () => {
- document.querySelector("#app").style.transform = `scale(${this.getScale()}) translate(-50%, 0%)`
- document.querySelector("#app").style.height = window.innerHeight / this.getScale() + "px"
- }
- this.$nextTick(() => {
- this.scrollUpdate();
- });
- api.login({
- userName: systemConfig.defaultAccount.userName,
- password: systemConfig.defaultAccount.password,
- clientId: "1",
- serviceId: "0",
- }).then((result) => {
- if (result.code == 200) {
- that.$store.commit("setUserInfo", result.content);
- that.$store.commit("setToken", result.message);
- that.$store.commit("setUserState", true);
- } else {
- that.$message({
- type: "error",
- message: result.content,
- });
- }
- }).catch((err) => {
- that.$message({
- type: "error",
- message: "服务器忙碌,请稍后重试!",
- });
- });
- },
- methods: {
- scrollUpdate() {
- let that = this;
- setTimeout(() => {
- that.$refs.pagescrollbar.update();
- }, 1000);
- },
- getScale() {
- const ww = window.innerWidth / 1920
- // const wh = window.innerHeight / 945
- // return ww < wh ? ww : wh;
- return ww
- }
- }
- };
- </script>
- <style lang="less">
- body,
- html {
- width: 100vw;
- height: 100vh;
- margin: 0 0;
- padding: 0 0;
- overflow: hidden;
- }
- #app {
- // width: 100vw;
- // height: 100vw;
- width: 1920px;
- height: 100%;
- position: fixed;
- left: 50%;
- top: 0%;
- transform-origin: left top;
- transform: translate(-50%, 0%);
- }
- .main {
- width: 100%;
- height: 100%;
- margin: 0 auto;
- overflow: hidden;
- .el-scrollbar {
- width: 100%;
- // height: calc(100% - 90px);
- box-sizing: border-box;
- overflow: hidden;
- }
- }
- </style>
|