From 214c7ad7943c915bc166d4a8dbb5618e26df6f55 Mon Sep 17 00:00:00 2001 From: 63f1bb74d2451104dc7d8b9f <63f1bb74d2451104dc7d8b9f@devide> Date: Fri, 30 Jun 2023 01:29:49 +0000 Subject: [PATCH] Auto Commit --- src/components/SearchGrade.vue | 40 +++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/src/components/SearchGrade.vue b/src/components/SearchGrade.vue index 390c906..3cd501a 100644 --- a/src/components/SearchGrade.vue +++ b/src/components/SearchGrade.vue @@ -10,23 +10,22 @@ const state = reactive({ columns: [{ title: '文章名称', dataIndex: 'title', - fixed:true + fixed: true }, { title: '链接', - dataIndex: 'url', - sorter: true, + key: 'url' }, { title: '浏览量', dataIndex: 'viewCount', - sorter: true, + sorter: (a, b) => a.viewCount - b.viewCount, }, { title: '收藏量', dataIndex: 'collectCount', - sorter: true, + sorter: (a, b) => a.collectCount - b.collectCount, }, { title: '分数', dataIndex: 'score', - sorter: true, + sorter: (a, b) => a.score - b.score, }, { title: '建议', dataIndex: 'message', @@ -34,7 +33,16 @@ const state = reactive({ title: '发文时间', dataIndex: 'postTime', }], - dataSource: [] + dataSource: [], + pagination: { + total: 100, + current: 1, + pageSize: 10, + pageSizeOptions: ['10', '20', '30'], + showTotal: (total, range) => { + return range[0] + '-' + range[1] + ' 共' + total + '条'; + }, + } }) const getCsdnData = (uId) => { @@ -43,11 +51,14 @@ const getCsdnData = (uId) => { uId } state.loading = true + state.pagination.current = 1 axios.post(url, data, { timeout: 100000 }).then(res => { state.dataSource = res.data.data + state.pagination.total = state.dataSource.length state.loading = false initFirstData() }).catch((r) => { + state.pagination.total = 0 console.log(r) state.loading = false state.dataSource = [] @@ -112,10 +123,11 @@ function initFirstData() { const findItem = state.dataSource.find(item => { return item.postTime == params.name }) - return `- 博客标题:${params.name}
+ return `- 博客标题:${findItem.title}
- 博客质量:${params.value}
- 博客建议:${findItem.message}
- 博客地址:${findItem.url}
+ - 发文时间:${params.name}
` }, }, @@ -170,11 +182,19 @@ function initFirstData() {
+ @search="onSearch" />

- + +
-- GitLab