diff --git a/src/libs/route/addRoutes.js b/src/libs/route/addRoutes.js index fe8aeda..056b676 100644 --- a/src/libs/route/addRoutes.js +++ b/src/libs/route/addRoutes.js @@ -16,7 +16,6 @@ function createRoute(data){ newRoutes.push({ name: e.path, path: e.path, - path: () => import(`@/pages/${e.path}.vue`), meta }) } diff --git a/src/pages/index/list/index.vue b/src/pages/index/list/index.vue index c3d3fdc..f71e763 100644 --- a/src/pages/index/list/index.vue +++ b/src/pages/index/list/index.vue @@ -5,7 +5,7 @@
@@ -205,11 +205,15 @@ export default { ...mapState('user', [ 'schoolId' ]), + ...mapState('auth', [ + 'routes' + ]) }, watch: { keyword: function(val) { clearTimeout(this.searchTimer) this.searchTimer = setTimeout(() => { + if (!this.keyword) this.listData = [] this.$refs.keyword.focus() this.initData() },500) @@ -220,10 +224,14 @@ export default { }, methods: { getData(){ - this.$post(`${this.api.getTableByCondition}?showName=${this.keyword}&pageNum=${this.page}&pageSize=${this.pageSize}`).then(res => { - this.listData = res.data.records - this.total = res.data.total - }).catch(res => {}) + if (this.keyword) { + this.$post(`${this.api.getTableByCondition}?showName=${this.keyword}&pageNum=${this.page}&pageSize=${this.pageSize}`).then(res => { + this.listData = res.data.records + this.total = res.data.total + }).catch(res => {}) + } else { + this.listData = [] + } }, // 获取热门下载数据 getHot(){ @@ -292,10 +300,18 @@ export default { window.open(route.href) } }, + clearKeyword() { + this.keyword = '' + this.listData = [] + }, toData(row){ // 登录了才能查看数据,否则直接跳转到登录页 if(this.token){ - this.$router.push(`/data?typeId=${row.categoryTwoId}`) + if (this.routes.find(e => e.path === '/data/list')) { + this.$router.push(`/data?typeId=${row.categoryTwoId}`) + } else { + this.keyword = row.categoryTwo + } }else{ let route = this.$router.resolve({ path: '/login' @@ -304,7 +320,6 @@ export default { } }, toPart(i){ - console.log(i) this.active = i document.querySelector(`#part${i}`).scrollIntoView() } diff --git a/src/pages/stat/list/index.vue b/src/pages/stat/list/index.vue index fca2424..4f9ed1f 100644 --- a/src/pages/stat/list/index.vue +++ b/src/pages/stat/list/index.vue @@ -16,7 +16,7 @@

账号数量: