|
@@ -5,44 +5,45 @@ import App from './App'
|
|
import router from './router'
|
|
import router from './router'
|
|
import store from './config/config'
|
|
import store from './config/config'
|
|
import ajax from './common/axios.config'
|
|
import ajax from './common/axios.config'
|
|
-import { Message } from 'element-ui'
|
|
|
|
|
|
+import { Message, Loading } from 'element-ui'
|
|
|
|
|
|
|
|
|
|
Vue.config.productionTip = false
|
|
Vue.config.productionTip = false
|
|
import { Form } from 'element-ui'
|
|
import { Form } from 'element-ui'
|
|
-Vue.prototype.$store = store;// 将store实例挂在vue原型上
|
|
|
|
|
|
+Vue.prototype.$store = store; // 将store实例挂在vue原型上
|
|
Vue.prototype.ajax = ajax
|
|
Vue.prototype.ajax = ajax
|
|
Vue.prototype.$message = Message
|
|
Vue.prototype.$message = Message
|
|
|
|
+Vue.prototype.$loading = Loading
|
|
|
|
|
|
|
|
|
|
/* eslint-disable no-new */
|
|
/* eslint-disable no-new */
|
|
new Vue({
|
|
new Vue({
|
|
- el: '#app',
|
|
|
|
- router,
|
|
|
|
- components: { App },
|
|
|
|
- template: '<App/>'
|
|
|
|
|
|
+ el: '#app',
|
|
|
|
+ router,
|
|
|
|
+ components: { App },
|
|
|
|
+ template: '<App/>'
|
|
})
|
|
})
|
|
router.beforeEach((to, from, next) => {
|
|
router.beforeEach((to, from, next) => {
|
|
- console.log('1');
|
|
|
|
- ajax
|
|
|
|
- .get(`${store.state.server}getcookieuserid`)
|
|
|
|
- .then((res) => {
|
|
|
|
- var userid = res.data[0][0].userid
|
|
|
|
- store.commit("update", ["userId", userid]);
|
|
|
|
- ajax
|
|
|
|
- .get(
|
|
|
|
- `${store.state.edu}admin/userinfo/userinfoById/${userid}/`
|
|
|
|
- )
|
|
|
|
- .then((r) => {
|
|
|
|
- let data = r.data[0][0];
|
|
|
|
- console.log(data);
|
|
|
|
- store.commit("update", ["userName", data.alias || data.username]);
|
|
|
|
|
|
+ console.log('1');
|
|
|
|
+ ajax
|
|
|
|
+ .get(`${store.state.server}getcookieuserid`)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ var userid = res.data[0][0].userid
|
|
|
|
+ store.commit("update", ["userId", userid]);
|
|
|
|
+ ajax
|
|
|
|
+ .get(
|
|
|
|
+ `${store.state.edu}admin/userinfo/userinfoById/${userid}/`
|
|
|
|
+ )
|
|
|
|
+ .then((r) => {
|
|
|
|
+ let data = r.data[0][0];
|
|
|
|
+ console.log(data);
|
|
|
|
+ store.commit("update", ["userName", data.alias || data.username]);
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ .catch((err) => {
|
|
|
|
+ // window.location.href = "https://edu.cocorobo.cn/course/login?type=1";
|
|
|
|
+ var type = localStorage.getItem("type")
|
|
|
|
+ // window.location.href = "https://edu.cocorobo.cn/course/login?type=1&UnityType=" + type;
|
|
});
|
|
});
|
|
- })
|
|
|
|
- .catch((err) => {
|
|
|
|
- // window.location.href = "https://edu.cocorobo.cn/course/login?type=1";
|
|
|
|
- var type = localStorage.getItem("type")
|
|
|
|
- // window.location.href = "https://edu.cocorobo.cn/course/login?type=1&UnityType=" + type;
|
|
|
|
- });
|
|
|
|
- next();
|
|
|
|
|
|
+ next();
|
|
})
|
|
})
|