import Vue from "vue";
|
import App from "./App.vue";
|
import router from "./router";
|
import store from "./store";
|
|
// import VideoPlayer from "vue-video-player";
|
// Vue.use(VideoPlayer);
|
|
// 自定义配置
|
import config from "@/assets/js/config";
|
Vue.prototype.config = config;
|
|
// axios
|
import service from "@/plugin/axios";
|
Vue.prototype.request = service;
|
|
// ElementUI
|
import ElementUI from "element-ui";
|
import "element-ui/lib/theme-chalk/index.css";
|
ElementUI.Dialog.props.lockScroll.default = false;
|
Vue.use(ElementUI);
|
|
// 请求处理
|
import MG from "@/assets/js/middleGround/WebMiddleGroundApi";
|
Vue.prototype.MG = MG;
|
|
//工具类
|
import toolClass from "./assets/js/toolClass";
|
Vue.prototype.tool = toolClass;
|
|
// 时间处理
|
import moment from "moment";
|
Vue.prototype.moment = moment;
|
|
// 视频播放
|
import VideoPlayer from "vue-video-player";
|
require("video.js/dist/video-js.css");
|
require("vue-video-player/src/custom-theme.css");
|
Vue.use(VideoPlayer);
|
|
Vue.config.productionTip = false;
|
Vue.directive("dialogDrag", {});
|
|
// 路由判断登录 根据路由配置文件的参数
|
router.beforeEach((to, from, next) => {
|
if (to.matched.some((record) => record.meta.authentication)) {
|
// 判断该路由是否需要登录权限
|
if (toolClass.getCookie(config.tokenKey)) {
|
// 判断当前的token是否存在; 登录存入的token
|
next();
|
} else {
|
next({
|
path: "/login",
|
query: {
|
redirect: to.fullPath,
|
}, // 将跳转的路由path作为参数,登录成功后跳转到该路由
|
});
|
}
|
} else {
|
next();
|
}
|
});
|
|
new Vue({
|
router,
|
store,
|
render: (h) => h(App),
|
}).$mount("#app");
|