Skip to content

Commit 2b6cdfa

Browse files
committed
[bug] 修复未借书情况下的样式问题 修改标题
1 parent aa9bdcf commit 2b6cdfa

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<link rel="icon" href="/favicon.ico">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<title>Vite App</title>
7+
<title>图书馆管家</title>
88
</head>
99
<body style="margin: 0;">
1010
<div id="app"></div>

src/App.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ const daysDiff = computed(() => {
6363
"
6464
style="position: fixed; width: 100%; z-index: 3"
6565
/>
66-
<div style="position: relative; padding-top: 70px; width: 100%">
66+
<div style="position: relative; width: 100%" :style="daysDiff !== 10000 ? 'padding-top: 70px;' : 'padding-top: 20px'">
6767
<div v-if="loadingContext.length > 0" style="width: 100%; display: flex; justify-content: center;">
68-
<t-loading size="26px" :text="loadingContext" />
68+
<div v-if="loadingContext === 'none'">暂无借阅信息</div>
69+
<t-loading v-else size="26px" :text="loadingContext" />
6970
</div>
7071

7172
<div v-if="data.length > 0" class="vertical-line"></div>

src/rpc.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function parseMainPageTable(html: string): Array<{ barcode: string; returnDate:
4646
const parser = new DOMParser()
4747
const doc = parser.parseFromString(html, 'text/html')
4848
const table = doc.getElementById('contentTable') as HTMLTableElement
49-
const rows = Array.from(table.querySelectorAll('tr')).slice(1) // 跳过表头
49+
const rows = table ? Array.from(table.querySelectorAll('tr')).slice(1) : [] // 跳过表头
5050
return rows.map((row) => {
5151
const cells = row.querySelectorAll('td')
5252
return {
@@ -106,8 +106,8 @@ async function toBookInfoArrayType(originData: Array<OriginBookItem>): Promise<A
106106
}
107107

108108
export async function getDetailInfo(loadingInfo: Ref<string>): Promise<Array<BookInfo>> {
109-
loadingInfo.value = "登录中"
110-
console.log("登录中")
109+
loadingInfo.value = '登录中'
110+
console.log('登录中')
111111
const { ul, pl } = await NativeRPC.call<{ ul: string; pl: string }>('spider.getulpl')
112112
console.log('part1 finished')
113113
const { lib_home: libraryMainPage } = await NativeRPC.call<{ lib_home: string }>('spider.run', {
@@ -139,10 +139,10 @@ export async function getDetailInfo(loadingInfo: Ref<string>): Promise<Array<Boo
139139
}
140140
}
141141
console.log('finish')
142-
if(bookDataArray.length === 0) {
143-
loadingInfo.value = "暂无借阅记录"
144-
}else {
145-
loadingInfo.value = ""
142+
if (bookDataArray.length === 0) {
143+
loadingInfo.value = 'none'
144+
} else {
145+
loadingInfo.value = ''
146146
}
147147
return bookDataArray.reverse()
148148
}

0 commit comments

Comments
 (0)