<template>
  <div id="appMain" :class="theme" class="g-app-scrollbar">
    <!-- {{ md5 }} -->
    <!-- 本地存储 -->
    <!-- <el-button @click="onLocalforageSetItem">set</el-button>
    <el-button @click="onLocalforageGetItem">get</el-button> -->
    <!-- <div>身份证正面 500次/天免费</div>
    <bs-upload-ocr
      @open-uploading="onOpenUploading"
      ocr-type="idcard-front"
      @change="onChangeOcr"
    >
    </bs-upload-ocr>
    <div>身份证反面 500次/天免费</div>
    <bs-upload-ocr
      @open-uploading="onOpenUploading"
      ocr-type="idcard-back"
      @change="onChangeOcr"
    >
    </bs-upload-ocr>
    <div>营业执照识别 200次/天免费</div>
    <bs-upload-ocr
      @open-uploading="onOpenUploading"
      ocr-type="business-license"
      @change="onChangeOcr"
    >
    </bs-upload-ocr>
    <div>通用文字识别(标准版)50000次/天免费</div>
    <bs-upload-ocr
      @open-uploading="onOpenUploading"
      ocr-type="word-general-basic"
      @change="onChangeOcr"
    >
    </bs-upload-ocr>
    <div>通用文字识别(标准含位置版) 500次/天免费</div>
    <bs-upload-ocr
      @open-uploading="onOpenUploading"
      ocr-type="word-general"
      @change="onChangeOcr"
    >
    </bs-upload-ocr>
    <div>通用文字识别(高精度版) 500次/天免费</div>
    <bs-upload-ocr
      @open-uploading="onOpenUploading"
      ocr-type="word-accurate-basic"
      @change="onChangeOcr"
    >
    </bs-upload-ocr>
    <div>通用文字识别(高精度含位置版) 50次/天免费</div>
    <bs-upload-ocr
      @open-uploading="onOpenUploading"
      ocr-type="word-accurate"
      @change="onChangeOcr"
    >
    </bs-upload-ocr>
    <div>保险单识别 剩余免费500次 + 总量4500次赠送</div>
    <bs-upload-ocr
      @open-uploading="onOpenUploading"
      ocr-type="insurance-documents"
      @change="onChangeOcr"
    >
    </bs-upload-ocr> -->

    <!-- <div class="aa"></div> -->
    <div :class="`lang-${lang}`">
      <!-- 根路径 -->
      <!-- 
      {{$appConfig.imgRootO}}
      {{$appConfig.imgRoot}}
      {{$appConfig.api.root}}
      {{$appConfig.api.upload}}
      {{$appNavs.currentRoot}} -->

      <!-- <div @click='hanldeSetLang'>{{lang}}ssds</div> -->
      <!-- 重新打开页面 -->
      <!-- {{currentUrl}} -->
      <a id="hrefBlankId" style="display: none" target="_blank"></a>
      <!-- <el-scrollbar ref="scrollbar" :class="`bs-app-scrollbar-${$store.getters.bsScroll}`"> -->
      <transition name="fade" mode="out-in">
        <keep-alive>
          <router-view></router-view>
        </keep-alive>
        <!-- <keep-alive>
        <router-view v-if="$route.meta.keepAlive"></router-view>
      </keep-alive>
      <router-view v-if="!$route.meta.keepAlive"></router-view>-->

        <!-- <keep-alive> -->
        <!-- <router-view name="header" ></router-view> -->
        <!-- <router-view ></router-view> -->
        <!-- <router-view name="footer" ></router-view> -->
        <!-- </keep-alive> -->
      </transition>
      <!-- </el-scrollbar> -->
      <!-- <HelloWorld msg="Welcome to Your Vue.js App" ></HelloWorld> -->
      <!-- <img alt="Vue logo" src="./assets/logo.png" />


    <el-button @click="visible = true">按钮</el-button>
    <el-dialog :visible.sync="visible" title="Hello world">
      <p>欢迎使用 Element</p>
    </el-dialog>
    <i class="el-icon-edit"></i>
    <i class="el-icon-share"></i>
    <i class="el-icon-delete"></i>
    <el-button type="primary" icon="el-icon-search">搜索</el-button>-->
      <!-- <console-main></console-main> -->
    </div>
    <el-dialog
      :title="$store.getters.bsDialog.title"
      :close-on-click-modal="false"
      :visible.sync="$store.getters.bsDialog.visible"
      :custom-class="$store.getters.bsDialog.class"
      fullscreen
    >
      <component
        v-if="$store.getters.bsDialog.src==='component'"
        v-bind:is="$store.getters.bsDialog.component"
        v-bind="$store.getters.bsDialog.args"
        {{($store.getters.bsDialog.args||{}).html}}
      ></component>
      <iframe
        v-else-if="$store.getters.bsDialog.src"
        :style="$store.getters.bsDialog.style"
        :src="$store.getters.bsDialog.src"
      ></iframe>
    </el-dialog>
  </div>
</template>
<script>
// import HelloWorld from "./components/HelloWorld.vue";
/* eslint-disable no-undef */
let ownerId = process.env.VUE_APP_OWNERID;

require("@/styles/styles-app-main.scss");
require(`@/styles/styles-app-main-content.scss`);
//根据项目控制打包哪个样式
// if (ownerId === "bt") {
require(`@/styles/${ownerId}/styles-${ownerId}-used.scss`);
// }
import { doShare } from "@/bo-auth/main-auth-share";
export default {
  name: "AppMain",
  data() {
    return {
      md5: null,
      loadingG: null,
      visible: true,
      scrollCurrentTop: {},
    };
  },
  computed: {
    currentUrl() {
      return window.location.href;
    },
    theme() {
      let screens = this.$store.getters.screenApp;
      let screen = "pc";
      if ((screens || []).length > 0) {
        screen = screens[0];
      }

      //控制特定浏览器适配
      let size = this.$store.getters.screenSize;

      return `screen__${screen} screen__size${size} proj-${
        this.$appNavs.project.ownerId
      } sys-${this.$appNavs.system.class} sys-${
        this.$appNavs.system.sysId || "0"
      } area-${
        this.$appNavs.area.areaCode || "0"
      }  theme__${this.$bowUtil.getTheme()} terminal__${
        window.$appNavs.fromTerminal
      }`;

    },
    lang() {
      //语言切换
      return this.$bowUtil.getLang();
    },
  },
  beforeCreate() {
    // console.log("app.beforeCreate");
  },
  created() {
    // var dateS = dayjs("2021-04-24T14:00:00").unix(); //.add(8, 'hour')
    // var dateE = dayjs("2021-04-25T04:00:00").unix(); //.add(8, 'hour')
    // var post_data ={ "start": 1619366400, "end": 1619391600, "ids": ["0_121_1_19_0", "0_121_1_27_0", "0_121_1_42_0"], "agg_interval": "hour" };
    // this.md5 = this.$crypto.md5(JSON.stringify(post_data));
  },
  beforeMount() {
    // console.log("app.beforeMount");
  },
  mounted() {
    this.handleChangeScreenWidth();
    // this.handleScrollEl();
    // console.log("app.mounted");
    this.handleScrollInitApp();
    //只有从分享地址打开过来的才生效
    doShare(this);
    // console.log("app.created");
    //
  },
  beforeUpdate() {
    // console.log("app.beforeUpdate");
  },
  beforeDestroy() {
    // console.log("app.beforeDestroy");
  },
  methods: {
    async onLocalforageGetItem() {
      try {
        const value = await this.$localforage.getItem("somekey");
        console.log(value);
      } catch (err) {
        // This code runs if there were any errors.
        console.log(err);
      }
    },
    async onLocalforageSetItem() {
      let that = this;
      that.$localforage.setItem("somekey", { name: "111" });
    },
    onChangeOcr(file, result) {
      console.log({ file, result });
    },
    onOpenUploading(status) {
      console.log(status);
    },
    hanldeSetLang() {
      //设置语言
      // window.$bowUtil.setLang("us");
      // this.$bowUtil.setLang("us");
    },
    hanldeSetTheme() {
      //设置主题
      // window.$bowUtil.setTheme("us");
      // this.$bowUtil.setTheme("us");
    },
    doLoading() {
      this.loadingG = this.$loading({
        lock: true,
        text: "加载中。。。",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
    },
    handleChangeScreenWidth() {
      let that = this;
      /* eslint-disable */
      $(window).resize(function () {
        that.$store.dispatch("screenHeight", $(window).height());
        that.$store.dispatch("screenWidth", $(window).width());
      });
      $(window).ready(function () {
        that.$store.dispatch("screenHeight", $(window).height());
        that.$store.dispatch("screenWidth", $(window).width());
      });
      /* eslint-disable */
    },
    handleSetScrollTopEl() {
      let that = this;
      let scrollbarEl = that.$refs.scrollbar.wrap;
      let key = that.$crypto.md5(that.$route.fullPath);
      if (!that.scrollCurrentTop[key]) {
        scrollbarEl.scrollTop = 0;
      } else {
        // scrollbarEl.scrollTop = that.scrollCurrentTop[key];
      }
    },
    handleScrollEl() {
      let that = this;
      let scrollbarEl = that.$refs.scrollbar.wrap;
      scrollbarEl.onscroll = () => {
        let key = that.$crypto.md5(that.$route.fullPath);
        that.scrollCurrentTop[key] = scrollbarEl.scrollTop;
      };
    },
    handleScrollApp() {
      let that = this;
      let scrollTop =
        window.pageYOffset ||
        document.documentElement.scrollTop ||
        document.body.scrollTop; // 滚动条偏移量
      let key = that.$crypto.md5(that.$route.fullPath);
      let bsScroll = JSON.parse(
        JSON.stringify(that.$store.getters.bsScroll || {})
      );
      bsScroll[key] = scrollTop;
      that.$store.dispatch("bsScroll", bsScroll);
    },
    handleScrollInitApp() {
      window.addEventListener("scroll", this.handleScrollApp);
    },
  },
  components: {
    // HelloWorld
    // "console-main": () => import("./views/console/main")
  },
  watch: {
    $route: function (to, from) {
      // this.handleSetScrollTop();
    },
    "$store.state.dataLoading": function (to, from) {
      // this.$store.dispatch("dataLoading", true);
      // return JSON.parse(JSON.stringify(this.$store.getters.config));
      //数据加载进度条
      if (to === true) {
        this.doLoading();
      } else if (this.loadingG) {
        this.loadingG.close();
      }
    },
  },
};
</script>

文档更新时间: 2023-03-26 16:04   作者:admin