|
@@ -28,10 +28,20 @@ export default defineComponent({
|
|
|
search: '',
|
|
|
page: 1,
|
|
|
rows: 20
|
|
|
- }
|
|
|
+ },
|
|
|
+ theory:null
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
+ let theoryStr = sessionStorage.getItem('theoryCache')
|
|
|
+ if (theoryStr) {
|
|
|
+ const theory = JSON.parse(theoryStr)
|
|
|
+ this.theory = theory
|
|
|
+ let activeNames = theory.activeNames.split(',').map(item => item * 1)
|
|
|
+ this.activeNames = activeNames
|
|
|
+ this.params.search = theory.search || ''
|
|
|
+
|
|
|
+ }
|
|
|
this.getList()
|
|
|
},
|
|
|
methods: {
|
|
@@ -55,11 +65,19 @@ export default defineComponent({
|
|
|
this.dataShow = this.list.length > 0
|
|
|
|
|
|
const tempList: any = this.list
|
|
|
- this.list.length > 0 && this.activeNames.push(tempList[0].id)
|
|
|
+ if (this.activeNames.length <= 0) {
|
|
|
+ this.list.length > 0 && this.activeNames.push(tempList[0].id)
|
|
|
+ }
|
|
|
} catch {
|
|
|
this.dataShow = false
|
|
|
this.finished = true
|
|
|
}
|
|
|
+ if(this.theory&&this.theory?.scrollTop){
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ window.scrollTo(0, this.theory?.scrollTop)
|
|
|
+ })
|
|
|
+ //
|
|
|
+ }
|
|
|
},
|
|
|
onSearch(val: string) {
|
|
|
this.params.search = val
|
|
@@ -71,7 +89,15 @@ export default defineComponent({
|
|
|
this.getList()
|
|
|
},
|
|
|
onDetail(item: any) {
|
|
|
- // location.sessionstorage;
|
|
|
+ let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
|
|
+ console.log(scrollTop)
|
|
|
+ let obj = JSON.stringify({
|
|
|
+ search: this.params.search,
|
|
|
+ activeNames: this.activeNames.join(','),
|
|
|
+ scrollTop:scrollTop
|
|
|
+ })
|
|
|
+
|
|
|
+ sessionStorage.setItem('theoryCache', obj)
|
|
|
if (item.linkUrl) {
|
|
|
window.location.href = item.linkUrl
|
|
|
} else {
|
|
@@ -86,9 +112,9 @@ export default defineComponent({
|
|
|
},
|
|
|
render() {
|
|
|
return (
|
|
|
- <div class={styles['theory']}>
|
|
|
+ <div class={[styles['theory'],'theory']}>
|
|
|
<Sticky offsetTop={0} position="top" class={'mb12'}>
|
|
|
- <ColSearch onSearch={this.onSearch} />
|
|
|
+ <ColSearch onSearch={this.onSearch} modelValue={this.params.search} />
|
|
|
</Sticky>
|
|
|
{this.dataShow ? (
|
|
|
<List
|