|
|
@@ -1,69 +1,42 @@
|
|
|
-// The Vue build version to load with the `import` command
|
|
|
-// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
|
|
|
+// workPage 优化版入口 - 只引入必需的依赖
|
|
|
import Vue from 'vue'
|
|
|
import App from '../App'
|
|
|
import router from '../router/index2'
|
|
|
import store from '../config/config'
|
|
|
-import { Loading } from 'element-ui';
|
|
|
-// Message,
|
|
|
-import { myMessage } from '../components/tools/message';
|
|
|
+
|
|
|
+// 只引入 workPage 需要的 Element UI 组件
|
|
|
+import { Loading, Input, Button, Dialog } from 'element-ui'
|
|
|
+import 'element-ui/lib/theme-chalk/index.css'
|
|
|
+
|
|
|
+import { myMessage } from '../components/tools/message'
|
|
|
import ajax from '../common/axios.config'
|
|
|
-import qs from 'qs'
|
|
|
-import '../common/player.css'
|
|
|
-import VideoPlayer from 'vue-video-player'
|
|
|
-import 'video.js/dist/video-js.css' //videoJs的样式
|
|
|
-import 'vue-video-player/src/custom-theme.css' //vue-video-player的样式
|
|
|
import VueCookies from 'vue-cookies'
|
|
|
-import Viewer from 'v-viewer'
|
|
|
-import 'viewerjs/dist/viewer.css'
|
|
|
-import Clipboard from "clipboard";
|
|
|
-import hevueImgPreview from '../components/tools/hevue-img-preview'
|
|
|
+
|
|
|
+// workPage 需要的基础样式
|
|
|
import '../assets/css/button.css'
|
|
|
import '../assets/css/dialog.css'
|
|
|
-import '../assets/css/markdownCss.css'
|
|
|
-import '../assets/css/markdownCssCopy.css'
|
|
|
-
|
|
|
-import VueAudio from 'vue-audio-better'
|
|
|
|
|
|
-const echarts = require('echarts');
|
|
|
+// 按需注册 Element UI 组件
|
|
|
+Vue.use(Loading)
|
|
|
+Vue.use(Input)
|
|
|
+Vue.use(Button)
|
|
|
+Vue.use(Dialog)
|
|
|
+Vue.use(VueCookies)
|
|
|
|
|
|
-//
|
|
|
-Vue.use(VideoPlayer).use(VueAudio).use(VueCookies).use(Viewer).use(hevueImgPreview, {
|
|
|
- clickMaskCLose: true
|
|
|
-})
|
|
|
Vue.config.productionTip = false
|
|
|
-Vue.prototype.$store = store; // 将store实例挂在vue原型上
|
|
|
+Vue.prototype.$store = store
|
|
|
Vue.prototype.ajax = ajax
|
|
|
-Vue.prototype.Clipboard = Clipboard
|
|
|
-// Vue.prototype.$message = Message
|
|
|
Vue.prototype.$message = myMessage
|
|
|
Vue.prototype.$loading = Loading
|
|
|
-Vue.prototype.$echarts = echarts
|
|
|
Vue.prototype.openLoading = function(target) {
|
|
|
- const loading = this.$loading.service({ // 声明一个loading对象
|
|
|
- lock: true, // 是否锁屏
|
|
|
- background: 'rgba(255, 255, 255, 0.7)', // 背景颜色
|
|
|
- target: target ? target : document.body, // 需要遮罩的区域
|
|
|
+ const loading = this.$loading.service({
|
|
|
+ lock: true,
|
|
|
+ background: 'rgba(255, 255, 255, 0.7)',
|
|
|
+ target: target ? target : document.body,
|
|
|
body: true,
|
|
|
})
|
|
|
- return loading;
|
|
|
+ return loading
|
|
|
}
|
|
|
-Vue.prototype.$qs = qs
|
|
|
-Viewer.setDefaults({
|
|
|
- 'inline': false, //启用inline模式
|
|
|
- 'button': false, //显示右上角关闭按钮
|
|
|
- 'navbar': false, //显示缩略图导航
|
|
|
- 'title': false, //显示当前图片的标题
|
|
|
- 'toolbar': true, //显示工具栏
|
|
|
- 'tooltip': true, //显示缩略百分比
|
|
|
- 'movable': true, //图片是否可移动
|
|
|
- 'zoomable': true, //图片是否可缩放
|
|
|
- 'rotatable': true, //图片是否可旋转
|
|
|
- 'scalable': true, //图片是否可反转
|
|
|
- 'transition': true, //使用css3过度
|
|
|
- 'fullscreen': false, //播放时是否全屏
|
|
|
- 'keyboard': true, //
|
|
|
-})
|
|
|
|
|
|
/* eslint-disable no-new */
|
|
|
new Vue({
|
|
|
@@ -80,34 +53,31 @@ router.beforeEach((to, from, next) => {
|
|
|
document.title = to.meta.title
|
|
|
}
|
|
|
const requireAuth = to.meta.requireAuth
|
|
|
- // 判断该路由是否需要登录权限
|
|
|
if (requireAuth) {
|
|
|
var isLogin = VueCookies.get('tlogin')
|
|
|
if (isLogin == "1") {
|
|
|
var userinfo = VueCookies.get('teacherInfo')
|
|
|
- store.commit("update", ["isLogin", true]);
|
|
|
-
|
|
|
- // var info = JSON.parse(window.sessionStorage.getItem("userInfo"))
|
|
|
- store.commit("update", ["userInfo", userinfo]);
|
|
|
+ store.commit("update", ["isLogin", true])
|
|
|
+ store.commit("update", ["userInfo", userinfo])
|
|
|
store.state.luyou = store.state.luyou + 1
|
|
|
- store.commit("update", ["luyou", store.state.luyou]);
|
|
|
+ store.commit("update", ["luyou", store.state.luyou])
|
|
|
next()
|
|
|
} else {
|
|
|
const loading = Loading.service({
|
|
|
background: "rgba(255, 255, 255)",
|
|
|
target: document.querySelector("body"),
|
|
|
- });
|
|
|
- store.commit("update", ["isLogin", false]);
|
|
|
- Message({
|
|
|
+ })
|
|
|
+ store.commit("update", ["isLogin", false])
|
|
|
+ myMessage({
|
|
|
message: '未登录,请登录',
|
|
|
type: 'warning'
|
|
|
- });
|
|
|
+ })
|
|
|
setTimeout(() => {
|
|
|
- loading.close();
|
|
|
+ loading.close()
|
|
|
next('/login')
|
|
|
- }, 2000);
|
|
|
+ }, 2000)
|
|
|
}
|
|
|
} else {
|
|
|
- next() // 确保一定要有next()被调用
|
|
|
+ next()
|
|
|
}
|
|
|
-})
|
|
|
+})
|