YZProjectCloud/yanzhu-bigscreen/src/views/init.js

108 lines
3.9 KiB
JavaScript

import Vue from "vue";
import Api from "../api/index";
import dayjs from "dayjs";
import "./style/index.less";
import dayfilter from "@/utils/dayfilter";
import { tryToJson } from "../utils/tools";
import { Loading } from "element-ui";
import moduleOne11 from "../components/module/module-one-1-1.vue";
import moduleOne12 from "../components/module/module-one-1-2.vue";
import moduleOne13 from "../components/module/module-one-1-3.vue";
import moduleOne21 from "../components/module/module-one-2-1.vue";
import moduleOne22 from "../components/module/module-one-2-2.vue";
import moduleOne23 from "../components/module/module-one-2-3.vue";
import moduleOne31 from "../components/module/module-one-3-1.vue";
import moduleOne32 from "../components/module/module-one-3-2.vue";
import moduleOne33 from "../components/module/module-one-3-3.vue";
import staffSurveyChart from "../components/staffSurveyChart.vue";
import trendChartLine from "../components/trend-chart-line.vue";
import trendLineChart from "../components/trend-line-chart.vue";
import peopleNumber from "@/components/people-number.vue";
import dictTag from "@/components/DictTag/index.vue";
import MyDialog from "@/components/MyDialog.vue";
import MyChart from "@/components/MyChart.vue";
import projectOverviewChart from "@/components/project-overview-chart.vue";
//import projectOverviewChart from '../components/project-overview-chart.vue'
//import peopleNumber from '../components/people-number.vue'
import header from "../components/header.vue";
Loading.install(Vue);
//H265Player.install(Vue);
dayfilter(Vue);
const vue = new Vue();
Vue.component("screen-header", header);
Vue.component("module-one-1-1", moduleOne11);
Vue.component("module-one-1-2", moduleOne12);
Vue.component("module-one-1-3", moduleOne13);
Vue.component("module-one-2-1", moduleOne21);
Vue.component("module-one-2-2", moduleOne22);
Vue.component("module-one-2-3", moduleOne23);
Vue.component("module-one-3-1", moduleOne31);
Vue.component("module-one-3-2", moduleOne32);
Vue.component("module-one-3-3", moduleOne33);
Vue.component("people-number", peopleNumber);
Vue.component("staff-survey-chart", staffSurveyChart);
Vue.component("trend-chart-line", trendChartLine);
Vue.component("trend-line-chart", trendLineChart);
Vue.component("my-chart", MyChart);
Vue.component("dict-tag", dictTag);
Vue.component("MyDialog", MyDialog);
Vue.component("project-overview-chart", projectOverviewChart);
Vue.prototype.$bus = new Vue();
Vue.prototype.$api = Api;
Vue.prototype.$bus = vue;
Vue.prototype.$apiPath = process.env.VUE_APP_BASE_API;
Vue.prototype.$dt = dayjs;
Vue.prototype.$tryToJson = tryToJson;
Vue.prototype.$toggleFullScreen = (el) => {
if (document.fullscreenElement == el) {
let screen =
document.cancelFullScreen ||
document.webkitCancelFullScreen ||
document.mozCancelFullScreen ||
document.exitFullScreen;
if (typeof screen != "undefined" && screen) {
screen.call(document);
return;
}
} else {
let screen =
el.requestFullScreen ||
el.webkitRequestFullScreen ||
el.mozRequestFullScreen ||
el.msRequestFullScreen;
if (typeof screen != "undefined" && screen) {
screen.call(el);
return;
}
}
};
Vue.prototype.$dpi = () => {
let w = document.querySelector(".main-app").clientWidth;
return w > 2561 ? "4K" : w < 1920 ? "1K" : "2K";
};
Vue.filter("toDate", (d) => {
return dayjs(d).format("YYYY-MM-DD");
});
Vue.filter("toDateTime", (d) => {
return dayjs(d).format("YYYY-MM-DD HH:mm:ss");
});
Vue.filter("toTime", (d) => {
return dayjs(d).format("HH:mm:ss");
});
window.__isfull__ = false;
window.fullscreenInterval = setInterval(() => {
if (document.fullscreenElement) {
if (!window.__isfull__) {
vue.$emit("fullscreen", true);
window.__isfull__ = true;
}
} else {
if (window.__isfull__) {
vue.$emit("fullscreen", false);
window.__isfull__ = false;
}
}
}, 500);
window.xdcaches = {};