1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<template>
<div id="app">
<app-debug-actions />
<router-view v-if="isRouterAlive" />
</div>
</template>
<script lang="ts">
import { Vue, Component, Provide } from 'vue-property-decorator';
import qs from 'qs';
import { AppServiceBase } from 'ibiz-core';
import store from '@/store';
import { NotificationFactory } from 'ibiz-vue';
@Component({})
export default class App extends Vue {
/**
* 控制视图是否显示
*/
public isRouterAlive: boolean = true;
/**
* 向后代注入加载行为
*/
@Provide()
public reload = this.viewreload;
/**
* vue生命周期初始化
*/
public created() {
const APP = AppServiceBase.getInstance();
if (!APP.getAppStore()) {
APP.setAppStore(store);
}
this.initThridParam();
}
/**
* vue生命周期销毁前
*/
public beforeDestroy(){
NotificationFactory.getInstance().destroy();
}
/**
* 视图重新加载
*/
public viewreload() {
const redirectedFrom:string = window.location.hash.substring(1);
AppServiceBase.getInstance().setRedirectedFromRoute(redirectedFrom);
this.isRouterAlive = false;
this.$nextTick(function () {
this.isRouterAlive = true;
});
}
/**
* 初始化第三方参数
*
*/
public initThridParam() {
if (window.location && window.location.href.indexOf('?') > -1) {
let tempViewParam: any = {};
const tempViewparam: any = window.location.href.slice(window.location.href.lastIndexOf('?') + 1);
const viewparamArray: Array<string> = decodeURIComponent(tempViewparam).split(';');
if (viewparamArray.length > 0) {
viewparamArray.forEach((item: any) => {
Object.assign(tempViewParam, qs.parse(item));
});
}
if (tempViewParam.srffullscreen) {
this.$store.commit('addCustomParam', { tag: 'srffullscreen', param: tempViewParam.srffullscreen });
}
if (tempViewParam.srftoken) {
sessionStorage.setItem('srftoken', tempViewParam.srftoken);
}
}
}
}
</script>
<style lang='less'>
#app{
width: 100vw;
height: 100vh;
}
</style>