xy 1 year ago
parent 01497346c9
commit 0da4733d76

@ -1,5 +1,5 @@
import Vue from 'vue'
import { getQueryParam } from '@/utils'
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import ElementUI from 'element-ui'
@ -75,18 +75,28 @@ if (window.__POWERED_BY_WUJIE__) {
window.__WUJIE_UNMOUNT = () => {
instance.$destroy();
};
} else {
if (window.top !== window.self) {
}
else if(window.top !== window.self) {
// 当前页面在iframe中
window._IN_IFRAME = true;
window.addEventListener("message",function (e) {
const { module_name, auth_token } = e.data;
window.MODULE_NAME = module_name;
console.log('token',auth_token)
setToken(auth_token)
setToken(getQueryParam('auth_token'))
window.MODULE_NAME = getQueryParam('module_name')
new Vue({
router,
store,
render: h => h(App)
}).$mount("#app")
router.push('/')
})
}
// window.addEventListener("message",function (e) {
// const { module_name, auth_token } = e.data;
// window.MODULE_NAME = module_name;
// console.log('token',auth_token)
//
// })
}
else {
new Vue({
router,
store,

@ -3,7 +3,7 @@ import store from './store'
import { Message } from 'element-ui'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
import { getToken } from '@/utils/auth' // get token from cookie
import { getToken, setToken } from '@/utils/auth' // get token from cookie
import getPageTitle from '@/utils/get-page-title'
NProgress.configure({ showSpinner: false }) // NProgress Configuration
@ -16,10 +16,8 @@ router.beforeEach(async(to, from, next) => {
// set page title
document.title = getPageTitle(to.meta.title)
// determine whether the user has logged in
const hasToken = getToken()
console.log(4444,hasToken)
if (hasToken) {
if (to.path === '/login') {
// if is logged in, redirect to the home page

@ -180,3 +180,8 @@ export function throttle(fn, interval, immediate=true) {
}
}
export function getQueryParam(param) {
const params = new URLSearchParams(window.location.search.substring(1));
return params.get(param);
}

Loading…
Cancel
Save