From 015d1946c3770b1d6dfb0837b8c65343c19c5bd8 Mon Sep 17 00:00:00 2001 From: Jo <479214531@qq.com> Date: Mon, 22 Nov 2021 23:09:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E7=83=AD=E9=97=A8=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libs/route/addRoutes.js | 1 - src/pages/index/list/index.vue | 29 ++++++++++++++++++++++------- src/pages/stat/list/index.vue | 2 +- 3 files changed, 23 insertions(+), 9 deletions(-) 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 @@

账号数量: