|
@@ -8,12 +8,12 @@ import './permission'; // 权限
|
|
|
import './error'; // 日志
|
|
|
import './cache';//页面缓存
|
|
|
import store from './store';
|
|
|
-import {loadStyle} from './util/util'
|
|
|
+import { loadStyle } from './util/util'
|
|
|
import * as urls from '@/config/env';
|
|
|
import Element from 'element-ui';
|
|
|
import {
|
|
|
- iconfontUrl,
|
|
|
- iconfontVersion
|
|
|
+ iconfontUrl,
|
|
|
+ iconfontVersion
|
|
|
} from '@/config/env';
|
|
|
import i18n from './lang'; // Internationalization
|
|
|
import './styles/common.scss';
|
|
@@ -23,6 +23,7 @@ import thirdRegister from './components/third-register/main';
|
|
|
import avueUeditor from 'avue-plugin-ueditor';
|
|
|
import website from '@/config/website';
|
|
|
import crudCommon from '@/mixins/crud';
|
|
|
+import { setToken } from '@/util/auth';
|
|
|
|
|
|
//cdn迁移进src目录
|
|
|
import './assets/cdn/element-ui/2.15.1/theme-chalk/index.css'
|
|
@@ -37,13 +38,13 @@ window.$crudCommon = crudCommon;
|
|
|
Vue.use(router);
|
|
|
Vue.use(VueAxios, axios);
|
|
|
Vue.use(Element, {
|
|
|
- i18n: (key, value) => i18n.t(key, value)
|
|
|
+ i18n: (key, value) => i18n.t(key, value)
|
|
|
});
|
|
|
Vue.use(window.AVUE, {
|
|
|
- size: 'small',
|
|
|
- tableSize: 'small',
|
|
|
- calcHeight: 65,
|
|
|
- i18n: (key, value) => i18n.t(key, value)
|
|
|
+ size: 'small',
|
|
|
+ tableSize: 'small',
|
|
|
+ calcHeight: 65,
|
|
|
+ i18n: (key, value) => i18n.t(key, value)
|
|
|
});
|
|
|
// 注册全局容器
|
|
|
Vue.component('basicContainer', basicContainer);
|
|
@@ -52,56 +53,73 @@ Vue.component('thirdRegister', thirdRegister);
|
|
|
Vue.component('avueUeditor', avueUeditor);
|
|
|
// 加载相关url地址
|
|
|
Object.keys(urls).forEach(key => {
|
|
|
- Vue.prototype[key] = urls[key];
|
|
|
+ Vue.prototype[key] = urls[key];
|
|
|
});
|
|
|
// 加载website
|
|
|
Vue.prototype.website = website;
|
|
|
// 动态加载阿里云字体库
|
|
|
iconfontVersion.forEach(ele => {
|
|
|
- loadStyle(iconfontUrl.replace('$key', ele));
|
|
|
+ loadStyle(iconfontUrl.replace('$key', ele));
|
|
|
});
|
|
|
|
|
|
|
|
|
-
|
|
|
+console.log(store)
|
|
|
//乾坤代码
|
|
|
Vue.config.productionTip = false;
|
|
|
let instance = null;
|
|
|
function render({ props = {} } = {}) {
|
|
|
+ console.log(props)
|
|
|
const { container } = props;
|
|
|
instance = new Vue({
|
|
|
router,
|
|
|
store,
|
|
|
i18n,
|
|
|
-
|
|
|
+ data(){},
|
|
|
render: h => h(App)
|
|
|
- }).$mount(container ? container.querySelector('#fjhxCloudVue') : '#fjhxCloudVue');
|
|
|
+ }).$mount(container ? container.querySelector('#iotPlatformRoom') : '#iotPlatformRoom');
|
|
|
console.log(instance)
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
+}
|
|
|
// 独立运行时
|
|
|
(function () {
|
|
|
console.log(window.__POWERED_BY_QIANKUN__)
|
|
|
if (window.__POWERED_BY_QIANKUN__) {
|
|
|
__webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
|
|
|
- } else{
|
|
|
+ } else {
|
|
|
render()
|
|
|
}
|
|
|
-
|
|
|
})()
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
export async function bootstrap() {
|
|
|
console.log('vue app bootstraped');
|
|
|
}
|
|
|
+
|
|
|
export async function mount(props) {
|
|
|
- console.log('props from main framework', props.data);
|
|
|
- render(props);
|
|
|
+ //设置token
|
|
|
+ console.log(props.data.token)
|
|
|
+ Vue.prototype.$parentRouter = props.data.router
|
|
|
+ if(props.data.token != null){
|
|
|
+ setToken(props.data.token.access_token)
|
|
|
+ //挂载父路由
|
|
|
+
|
|
|
+ store.commit('SET_TOKEN',props.data.token.access_token)
|
|
|
+ store.commit('SET_REFRESH_TOKEN', props.data.token.refresh_token);
|
|
|
+ store.commit('SET_TENANT_ID', props.data.token.tenant_id);
|
|
|
+ store.commit('SET_USER_INFO', props.data.token);
|
|
|
+ //设置监听事件触发方法
|
|
|
+ props.onGlobalStateChange((state, prev) => {
|
|
|
+ // state: 变更后的状态; prev 变更前的状态
|
|
|
+ console.log(state, prev, '子组件监听');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //发送数据给全局
|
|
|
+ // props.setGlobalState({ token: 21312312 })
|
|
|
+ render(props)
|
|
|
}
|
|
|
export async function unmount() {
|
|
|
- instance.$destroy();
|
|
|
+ // instance.$destroy();
|
|
|
instance.$el.innerHTML = "";
|
|
|
instance = null;
|
|
|
// router = null;
|
|
@@ -113,4 +131,4 @@ Vue.config.productionTip = false;
|
|
|
// store,
|
|
|
// i18n,
|
|
|
// render: h => h(App)
|
|
|
-// }).$mount('#fjhxCloudVue');
|
|
|
+// }).$mount('#iotPlatformRoom');
|