|
@@ -29,6 +29,7 @@ import tortContrast from '@/views/report/tort/components/tortContrast1.vue'
|
|
|
import teamwork from '@/views/report/components/dialog/teamwork.vue'
|
|
|
import notPatentDetails from './components/notPatentDetails.vue'
|
|
|
import {mapGetters} from 'vuex'
|
|
|
+import {getLastRoute} from '@/router'
|
|
|
export default {
|
|
|
components: {
|
|
|
articleMenu,
|
|
@@ -129,22 +130,28 @@ export default {
|
|
|
created() { },
|
|
|
mounted() {
|
|
|
if(this.search && !this.search.fromPath){
|
|
|
- this.search.fromPath = window.history.length
|
|
|
- if(window.history.state){
|
|
|
- this.currentState = window.history.state.key
|
|
|
+ var lastRoute = getLastRoute()
|
|
|
+ if(lastRoute){
|
|
|
+ this.search.fromPath = JSON.stringify(lastRoute)
|
|
|
+ }else{
|
|
|
+ this.search.fromPath = 'noLastRoute'
|
|
|
}
|
|
|
- var that = this
|
|
|
- window.addEventListener('popstate', function(event) {
|
|
|
- // console.log(event,that.currentState,event.state.key)
|
|
|
- // 在这里处理历史记录变化时的逻辑
|
|
|
- if(that.currentState<event.state.key){
|
|
|
- that.search.fromPath += 1
|
|
|
- }else{
|
|
|
- that.search.fromPath -= 1
|
|
|
- }
|
|
|
+ // this.search.fromPath = window.history.length
|
|
|
+ // if(window.history.state){
|
|
|
+ // this.currentState = window.history.state.key
|
|
|
+ // }
|
|
|
+ // var that = this
|
|
|
+ // window.addEventListener('popstate', function(event) {
|
|
|
+ // // console.log(event,that.currentState,event.state.key)
|
|
|
+ // // 在这里处理历史记录变化时的逻辑
|
|
|
+ // if(that.currentState<event.state.key){
|
|
|
+ // that.search.fromPath += 1
|
|
|
+ // }else{
|
|
|
+ // that.search.fromPath -= 1
|
|
|
+ // }
|
|
|
|
|
|
- that.currentState = event.state.key
|
|
|
- })
|
|
|
+ // that.currentState = event.state.key
|
|
|
+ // })
|
|
|
this.$s.setSession('search',this.search)
|
|
|
}
|
|
|
if(this.noveltySearch){
|
|
@@ -292,11 +299,19 @@ export default {
|
|
|
},
|
|
|
//返回
|
|
|
goBack() {
|
|
|
- if(this.search.fromPath){
|
|
|
- var now = window.history.length
|
|
|
- var history= this.search.fromPath
|
|
|
- var len = Number(now) - Number(history) + 1
|
|
|
- window.history.go(-len)
|
|
|
+ if(this.search.fromPath && this.search.fromPath != 'noLastRoute'){
|
|
|
+ // var now = window.history.length
|
|
|
+ // var history= this.search.fromPath
|
|
|
+ // var len = Number(now) - Number(history) + 1
|
|
|
+ // window.history.go(-len)
|
|
|
+ var redirectUrl = JSON.parse(this.search.fromPath)
|
|
|
+ this.$router.push({
|
|
|
+ path:redirectUrl.path,
|
|
|
+ query:redirectUrl.query,
|
|
|
+ params:redirectUrl.params
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.$message.warning('未找到上级页面')
|
|
|
}
|
|
|
},
|
|
|
//协同
|