|
|
|
|
@ -30,13 +30,14 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
const moduleHistoryMap = JSON.parse(localStorage.getItem('moduleHistoryMap')) ?? {}
|
|
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
|
import Wujie from 'wujie-vue2'
|
|
|
|
|
// import Wujie from 'wujie-vue2'
|
|
|
|
|
import { mapGetters } from 'vuex'
|
|
|
|
|
import Cookies from 'js-cookie'
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
Wujie
|
|
|
|
|
// Wujie
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
@ -46,6 +47,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
auth_uri: '',
|
|
|
|
|
isLoading: false
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
@ -61,6 +63,7 @@ export default {
|
|
|
|
|
auth_token: window.encodeURIComponent(getToken()),
|
|
|
|
|
module_name: this.module_name,
|
|
|
|
|
theme: window.encodeURIComponent(Cookies.get('defaultTheme')),
|
|
|
|
|
to: moduleHistoryMap[this.module_name],
|
|
|
|
|
...this.$route.query
|
|
|
|
|
}
|
|
|
|
|
this.auth_uri = `${newVal}/#/?${this.obj2Query(query)}`
|
|
|
|
|
@ -81,13 +84,24 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
|
|
|
|
|
window.addEventListener('beforeunload', this.refreshWindowListener)
|
|
|
|
|
},
|
|
|
|
|
mounted() {},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
this.$refs['program'].onload = null
|
|
|
|
|
window.removeEventListener('beforeunload', this.refreshWindowListener)
|
|
|
|
|
},
|
|
|
|
|
beforeRouteLeave(to, from, next) {
|
|
|
|
|
moduleHistoryMap[from.meta.moduleName] = new URL(document.querySelector('#iframe-cpn').contentDocument.URL).hash?.replace('#', '')
|
|
|
|
|
next()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
refreshWindowListener(e) {
|
|
|
|
|
if (this.$route.meta.isModule) {
|
|
|
|
|
moduleHistoryMap[this.$route.meta.moduleName] = new URL(document.querySelector('#iframe-cpn').contentDocument.URL).hash?.replace('#', '')
|
|
|
|
|
}
|
|
|
|
|
localStorage.setItem('moduleHistoryMap', JSON.stringify(moduleHistoryMap))
|
|
|
|
|
},
|
|
|
|
|
postMessage() {
|
|
|
|
|
if (this.props.auth_token && this.props.module_name) {
|
|
|
|
|
this.$refs['program'].contentWindow.postMessage(this.props)
|
|
|
|
|
|