From 656420f77490e22de84faf07cf315af018b2ad1d Mon Sep 17 00:00:00 2001
From: xuhuajiao <13476289682@163.com>
Date: Thu, 31 Jul 2025 16:09:30 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=87=E7=8C=AE/=E9=98=85=E8=AF=BB=E4=B9=8B?=
=?UTF-8?q?=E6=98=9F=E6=8E=A5=E5=8F=A3=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/lengingRanking/index.vue | 44 ++------
src/views/lengingRanking/index2.vue | 162 ++++++++++++++++++++++++++++
src/views/readStar/index.vue | 47 ++++++--
3 files changed, 209 insertions(+), 44 deletions(-)
create mode 100644 src/views/lengingRanking/index2.vue
diff --git a/src/views/lengingRanking/index.vue b/src/views/lengingRanking/index.vue
index 3bc20ce..5329b3c 100644
--- a/src/views/lengingRanking/index.vue
+++ b/src/views/lengingRanking/index.vue
@@ -17,8 +17,8 @@
-
{{ item.TITLE }}
-
{{ item.AUTHOR }}
+
{{ item.bookName }}
+
{{ item.author }}
{{ index+1 }}
-
读者{{ item.RDNAME }}上周借阅图书{{ item.TOTALNUM }}册
+
读者{{ item.RDNAME }}近30天借阅图书{{ item.TOTALNUM }}册
{{ mondayDate }}
@@ -38,21 +38,52 @@ export default {
this.getReadRanking()
},
methods: {
+ formatDateTime(date, type) {
+ const year = date.getFullYear()
+ const month = String(date.getMonth() + 1).padStart(2, '0')
+ const day = String(date.getDate()).padStart(2, '0')
+
+ let timePart = '00:00:00'
+ if (type === 'end') {
+ timePart = '23:59:59'
+ }
+
+ return `${year}-${month}-${day} ${timePart}`
+ },
getReadRanking() {
- const currentDate = new Date() // 获取当前日期
+ // const currentDate = new Date() // 获取当前日期
+ // currentDate.setDate(currentDate.getDate() - 30) // 将当前日期减去30天
+ // const year = currentDate.getFullYear() // 获取年份
+ // const month = currentDate.getMonth() + 1 // 获取月份(注意月份从0开始,需要加1)
+ // const day = currentDate.getDate() // 获取日期
+ // const formattedDate = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`
+
+ // const params = {
+ // 'libcode': this.libcode,
+ // 'starttime': formattedDate,
+ // 'endtime': this.getFormattedDate(new Date()),
+ // 'rownum': 6,
+ // 'nordtype': 'JXTSG_E'
+ // }
+
+ // 获取当前日期
+ const currentDate = new Date()
currentDate.setDate(currentDate.getDate() - 30) // 将当前日期减去30天
- const year = currentDate.getFullYear() // 获取年份
- const month = currentDate.getMonth() + 1 // 获取月份(注意月份从0开始,需要加1)
- const day = currentDate.getDate() // 获取日期
- const formattedDate = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`
+
+ // 获取开始日期(格式:YYYY-MM-DD 00:00:00)
+ const startDate = encodeURIComponent(this.formatDateTime(currentDate, 'start'))
+
+ // 获取结束日期(格式:YYYY-MM-DD 23:59:59)
+ const endDate = encodeURIComponent(this.formatDateTime(new Date(), 'end'))
const params = {
'libcode': this.libcode,
- 'starttime': formattedDate,
- 'endtime': this.getFormattedDate(new Date()),
+ 'starttime': startDate,
+ 'endtime': endDate,
'rownum': 6,
'nordtype': 'JXTSG_E'
}
+
FetchReadRanking(params).then(res => {
const result = JSON.parse(res.data)