You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.9 KiB
JavaScript
72 lines
1.9 KiB
JavaScript
import Vue from "vue";
|
|
import App from "./App.vue";
|
|
import router from "./router";
|
|
import store from "./store";
|
|
//import "./utils/rem"; //设置body文字大小
|
|
Vue.config.productionTip = false;
|
|
|
|
import "../src/assets/css/theme/index.css"; //l绿色主题
|
|
import ElementUI from "element-ui";
|
|
//样式
|
|
import "./assets/css/reset.css"; //默认样式
|
|
import "./assets/css/global.less"; //全局定义颜色
|
|
import "./assets/css/element.less"; //全局定义颜色
|
|
import "./assets/fonts/iconfont.css"; //按钮
|
|
|
|
//引入Echarts;
|
|
import * as echarts from "echarts";
|
|
Vue.prototype.$echarts = echarts;
|
|
//引入日期// 注册全局 moment
|
|
import moment from "moment";
|
|
Vue.prototype.$moment = moment;
|
|
import { message } from "@/utils/resetMessage";
|
|
// import "element-ui/lib/theme-chalk/index.css";
|
|
Vue.use(ElementUI, {
|
|
size: "small",
|
|
});
|
|
//图片懒加载
|
|
//引入插件
|
|
// import VueLazyload from "vue-lazyload";
|
|
// //注册插件
|
|
// Vue.use(VueLazyload, {
|
|
// error: require("./assets/img/nodatapic2.jpg"),
|
|
// });
|
|
|
|
//挂载弹出信息
|
|
|
|
Vue.prototype.$message = message;
|
|
//防抖
|
|
Vue.directive("noMoreClick", {
|
|
inserted(el, binding) {
|
|
el.addEventListener("click", (e) => {
|
|
el.classList.add("is-disabled");
|
|
el.disabled = true;
|
|
setTimeout(() => {
|
|
el.disabled = false;
|
|
el.classList.remove("is-disabled");
|
|
}, 2000); //我这里设置的是2000毫秒也就是2秒
|
|
});
|
|
},
|
|
});
|
|
|
|
//使用钩子函数对路由进行权限跳转
|
|
router.beforeEach((to, from, next) => {
|
|
document.title = `${to.meta.title} | 视频监控可视化平台`;
|
|
const role = localStorage.getItem("role");
|
|
const token = localStorage.getItem("token");
|
|
console.log(role, token);
|
|
if (!token && to.path !== "/login") {
|
|
//next("/login");
|
|
next({
|
|
path: "/login",
|
|
});
|
|
} else {
|
|
next();
|
|
}
|
|
});
|
|
new Vue({
|
|
router,
|
|
store,
|
|
render: (h) => h(App),
|
|
}).$mount("#app");
|