Commit 764deb33 authored by 刘岩's avatar 刘岩

测试通知返回事件

parent 8beefa98
...@@ -77,8 +77,7 @@ export default { ...@@ -77,8 +77,7 @@ export default {
methods: { methods: {
// 返回按钮 // 返回按钮
back() { back() {
alert(this.$route.query.goindex) if (this.$route.name === 'Home' || this.$route.path === sessionStorage.getItem('toPath')) {
if (this.$route.name === 'Home' || this.$route.query.goindex === 'true') {
alert('进入关闭方法') alert('进入关闭方法')
// sendInfoToJava('close') // sendInfoToJava('close')
} else if (this.$route.name === 'Zcdsh') { } else if (this.$route.name === 'Zcdsh') {
......
...@@ -2,7 +2,6 @@ import router from '@/router' ...@@ -2,7 +2,6 @@ import router from '@/router'
import {getUrlParam} from '@/utils' import {getUrlParam} from '@/utils'
import {getToken, getUserId} from '@/api/test' import {getToken, getUserId} from '@/api/test'
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
console.log('PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP')
const userCode = getUrlParam('userCode'), const userCode = getUrlParam('userCode'),
corpId = getUrlParam('corpId'), corpId = getUrlParam('corpId'),
data = { data = {
......
...@@ -451,14 +451,8 @@ export function curriculumTrainRouter(lessonType, id, fromName, valueConsume, le ...@@ -451,14 +451,8 @@ export function curriculumTrainRouter(lessonType, id, fromName, valueConsume, le
} }
// 判断首次进入项目 路由路径数量(通知进入页面,点击返回箭头关闭项目) // 判断首次进入项目 路由路径数量(通知进入页面,点击返回箭头关闭项目)
export function setgoindex() { export function setgoindex() {
console.log(window.history.length)
alert(window.history.length)
if (window.history.length <= 1) { if (window.history.length <= 1) {
if (location.href.indexOf('?') === -1) { sessionStorage.setItem('toPath', this.$route.path)
window.location.href = location.href + '?goindex=true'
} else if (location.href.indexOf('?') !== -1 && location.href.indexOf('goindex') === -1) {
window.location.href = location.href + '&goindex=true'
}
} }
} }
...@@ -340,6 +340,8 @@ export default { ...@@ -340,6 +340,8 @@ export default {
}, },
// 组件实例创建前调用 // 组件实例创建前调用
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {
// console.log(to.path)
// sessionStorage.setItem('toPath', to.path)
// 判断是否被禁用 // 判断是否被禁用
get.getQueryMenuById({}).then(res => { get.getQueryMenuById({}).then(res => {
next(vm => { next(vm => {
......
...@@ -267,6 +267,7 @@ export default { ...@@ -267,6 +267,7 @@ export default {
mounted() { mounted() {
this.examination() this.examination()
this.fromName = this.$route.params.fromName this.fromName = this.$route.params.fromName
this.$setgoindex()
// console.log(this.$route.name) // console.log(this.$route.name)
}, },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
......
...@@ -186,7 +186,6 @@ export default { ...@@ -186,7 +186,6 @@ export default {
}, },
mounted() { mounted() {
this.myInfo() this.myInfo()
this.$setgoindex()
} }
} }
</script> </script>
......
...@@ -961,6 +961,7 @@ export default { ...@@ -961,6 +961,7 @@ export default {
}, },
mounted() { mounted() {
this.readyToDo() this.readyToDo()
this.$setgoindex()
}, },
destroyed() { destroyed() {
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment