Skip to content

Commit

Permalink
fix: minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dragon-fish authored Mar 5, 2024
1 parent 8b6aba6 commit 2cdb7a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 2 additions & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ declare module 'vue' {
NButton: typeof import('naive-ui')['NButton']
NFlex: typeof import('naive-ui')['NFlex']
NProgress: typeof import('./src/components/NProgress.vue')['default']
NSpace: typeof import('naive-ui')['NSpace']
NTabPane: typeof import('naive-ui')['NTabPane']
NTabs: typeof import('naive-ui')['NTabs']
NTabsPane: typeof import('naive-ui')['NTabsPane']
NTag: typeof import('naive-ui')['NTag']
Placeholder: typeof import('./src/components/Placeholder.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Expand Down
21 changes: 13 additions & 8 deletions src/view/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
IFasInfoCircle

NModal(
:title='`背景图片:${randomBg.info.title}`'
:title='`背景图片:${randomBg.alt}`'
closable
preset='card'
v-model:show='isShowBgInfo'
Expand All @@ -32,10 +32,16 @@
RouterLink.thumb(:to='"/artworks/" + randomBg.id')
img(:src='randomBg.urls?.regular || randomBg.url' lazyload)
.desc
strong {{ randomBg.title }}
|  — 
RouterLink(:to='"/users/" + randomBg.userId') {{ randomBg.userName }}
| 的作品 (ID: {{ randomBg.id }})
.author
RouterLink(:to='"/users/" + randomBg.userId') {{ randomBg.userName }}
| 的作品 (ID: {{ randomBg.id }})
NSpace(justify='center' size='small' style='margin-top: 1rem')
NTag(
:key='tag'
@click='$router.push({ name: "search", params: { keyword: tag, p: 1 } })'
style='cursor: pointer'
v-for='tag in randomBg.tags'
) {{ tag }}

.body-inner
section.discover
Expand Down Expand Up @@ -75,13 +81,12 @@ const randomBg = ref<Artwork>({ ...defaultArtwork, urls: {} } as any)
async function setRandomBgNoCache(): Promise<void> {
try {
const { data } = await ajax.get<{ illusts: Artwork[] }>('/api/random', {
const { data } = await ajax.get<Artwork[]>('/api/random', {
params: {
mode: 'safe',
max: '1',
},
})
const info = data.illusts[0]
const info = data[0]
randomBg.value = info
setCache('home.randomBg', info)
} catch (err) {
Expand Down

0 comments on commit 2cdb7a1

Please sign in to comment.