Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

wangkaiyue 4 anni fa
parent
commit
be1e8daa69

+ 14 - 4
jydocs-mobile/src/views/Search.vue

@@ -178,6 +178,7 @@ export default class extends Vue {
       finished: true,
       pageNum: 1,
       total: 0,
+      scrollTop: 0,
       list: []
     }
     Object.assign(this.listState, state)
@@ -190,6 +191,7 @@ export default class extends Vue {
   docTypeChange () {
     if (!this.listState.value) return
     this.resetListState()
+    this.setScrollTop()
     this.listState.finished = false
     this.getList()
   }
@@ -206,12 +208,14 @@ export default class extends Vue {
     }
     if (!this.listState.value) return
     this.resetListState()
+    this.setScrollTop()
     this.listState.finished = false
     this.getList()
   }
 
   doSearch () {
     this.resetListState()
+    this.setScrollTop()
     this.listState.finished = false
     this.getList()
   }
@@ -278,6 +282,13 @@ export default class extends Vue {
     return [dateFormatter(uploadDate, 'yyyy/MM/dd'), `${downTimes}次下载`]
   }
 
+  setScrollTop () {
+    this.$nextTick(() => {
+      const wrapper: any = this.$refs.scrollWrap
+      wrapper.scrollTop = this.listState.scrollTop
+    })
+  }
+
   reStoreState () {
     const listInfo = this.searchState
     if (!listInfo || Object.keys(listInfo).length === 0) {
@@ -286,11 +297,10 @@ export default class extends Vue {
       for (const key in listInfo) {
         this.$data[key] = listInfo[key]
       }
-      this.$nextTick(() => {
-        const wrapper: any = this.$refs.scrollWrap
-        wrapper.scrollTop = this.listState.scrollTop
+      setTimeout(() => {
+        this.setScrollTop()
         this.clearSearchState()
-      })
+      }, 50)
       return true
     }
   }

+ 2 - 10
jydocs-pc/src/router.js

@@ -18,16 +18,6 @@ export default new Router({
       name: 'content',
       component: () => import('@/views/Content.vue')
     },
-    {
-      path: '/keep',
-      name: 'keep',
-      component: () => import('@/views/Keep.vue')
-    },
-    {
-      path: '/mine',
-      name: 'mine',
-      component: () => import('@/views/Mine.vue')
-    },
     {
       path: '/search',
       name: 'search',
@@ -46,12 +36,14 @@ export default new Router({
     {
       // 我的文库
       path: '/user/docs',
+      alias: '/mine',
       name: 'user-docs',
       component: () => import('@/views/UserDocs.vue')
     },
     {
       // 我的收藏
       path: '/user/collections',
+      alias: '/keep',
       name: 'user-docs',
       component: () => import('@/views/UserCollections.vue')
     },

+ 25 - 0
jydocs-pc/src/views/404.vue

@@ -1,5 +1,30 @@
 <template>
   <div class="page-404">
     <h3>这里什么也没有</h3>
+    <div v-if="false">
+      <el-button @click="getTest" :loading="fullscreenLoading" type="primary">模拟Ajax</el-button>
+      <el-button  @click="getLoginStatus" type="info">获取登录状态</el-button>
+    </div>
   </div>
 </template>
+
+<script>
+import { Button } from 'element-ui'
+
+export default {
+  name: '404',
+  components: {
+    [Button.name]: Button
+  },
+  data () {
+    return {
+      fullscreenLoading: false
+    }
+  },
+  methods: {
+    getLoginStatus: function () {
+      alert(loginflag)
+    }
+  }
+}
+</script>

+ 0 - 27
jydocs-pc/src/views/Keep.vue

@@ -1,27 +0,0 @@
-<template>
-  <div class="home">
-      <el-button @click="getTest" :loading="fullscreenLoading" type="primary">模拟Ajax</el-button>
-      <el-button  @click="getLoginStatus" type="info">获取登录状态</el-button>
-  </div>
-</template>
-
-<script>
-import { Button } from 'element-ui'
-
-export default {
-  name: 'home',
-  components: {
-    [Button.name]: Button
-  },
-  data () {
-    return {
-      fullscreenLoading: false
-    }
-  },
-  methods: {
-    getLoginStatus: function () {
-      alert(loginflag)
-    }
-  }
-}
-</script>

+ 0 - 27
jydocs-pc/src/views/Mine.vue

@@ -1,27 +0,0 @@
-<template>
-  <div class="home">
-      <el-button @click="getTest" :loading="fullscreenLoading" type="primary">模拟Ajax</el-button>
-      <el-button  @click="getLoginStatus" type="info">获取登录状态</el-button>
-  </div>
-</template>
-
-<script>
-import { Button } from 'element-ui'
-
-export default {
-  name: 'home',
-  components: {
-    [Button.name]: Button
-  },
-  data () {
-    return {
-      fullscreenLoading: false
-    }
-  },
-  methods: {
-    getLoginStatus: function () {
-      alert(loginflag)
-    }
-  }
-}
-</script>