Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"i18n-ally.localesPaths": ["i18n/locales"]
}
2 changes: 1 addition & 1 deletion app/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import NProgress from '~/components/NProgress.vue'
import SiteHeader from '~/components/SiteHeader.vue'
import SiteFooter from '~/components/SiteFooter.vue'
import { existsSessionId, initUser } from '~/composables/userData'
import { useUserStore } from '~/stores/session'
import { useUserStore } from '~/composables/session'

const SideNav = defineAsyncComponent(
() => import('~/components/SideNav/SideNav.vue')
Expand Down
13 changes: 0 additions & 13 deletions app/auto-imports.d.ts

This file was deleted.

34 changes: 0 additions & 34 deletions app/components.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion app/components/Artwork/ArtworkCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
<script lang="ts" setup>
import DeferLoad from '../DeferLoad.vue'
import { NSkeleton } from 'naive-ui'
import { IllustType } from '~/utils/constants'
import IFasEye from '~icons/fa-solid/eye'
import IFasHeart from '~icons/fa-solid/heart'
import IFasImages from '~icons/fa-solid/images'
Expand Down
21 changes: 17 additions & 4 deletions app/components/Artwork/ArtworkLargeCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
:alt='illust.title',
:src='illust.url.replace("p0_master", "p0_square")'
)
.restrict.x-restrict(aria-label='R-18' role='img' title='R-18' v-if='illust.xRestrict === 2')
.restrict.x-restrict(
aria-label='R-18'
role='img'
title='R-18'
v-if='illust.xRestrict === 2'
)
IFasEye(aria-hidden='true')
.restrict.ai-restrict(aria-label='AI生成' role='img' title='AI生成' v-if='illust.aiType === 2')
.restrict.ai-restrict(
aria-label='AI生成'
role='img'
title='AI生成'
v-if='illust.aiType === 2'
)
IFasRobot(aria-hidden='true')
.page-count(
:title='"共 " + illust.pageCount + " 张"'
Expand All @@ -27,15 +37,18 @@
RouterLink(:to='"/artworks/" + illust.id') {{ illust.title }}
.author(:title='illust.userName')
RouterLink(:to='"/users/" + illust.userId')
img.avatar(:alt='illust.userName' :src='illust.profileImageUrl' lazyload)
img.avatar(
:alt='illust.userName',
:src='illust.profileImageUrl'
lazyload
)
| {{ illust.userName }}
.tags
ArtTag(:key='_', :tag='item' v-for='(item, _) in illust.tags')
</template>

<script lang="ts" setup>
import type { ArtworkInfo } from '~/types'
import { IllustType } from '~/utils/constants'
import DeferLoad from '../DeferLoad.vue'
import ArtTag from '../ArtTag.vue'
import IFasEye from '~icons/fa-solid/eye'
Expand Down
2 changes: 1 addition & 1 deletion app/components/Artwork/ArtworkListByUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<script setup lang="ts">
import type { ArtworkInfo } from '~/types'
import { NPagination } from 'naive-ui'
import { useUserArtworksStore } from '~/stores/user-artworks'
import { useUserArtworksStore } from '~/composables/user-artworks'

const props = withDefaults(
defineProps<{
Expand Down
9 changes: 6 additions & 3 deletions app/components/AuthorCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
.author-inner(v-if='user')
.flex-center
.left
RouterLink(:to='"/users/" + user.userId' :aria-label='"查看作者: " + user.name')
img(:alt='user.name + " 的头像"' :src='user.imageBig')
RouterLink(
:aria-label='"查看作者: " + user.name',
:to='"/users/" + user.userId'
)
img(:alt='user.name + " 的头像"', :src='user.imageBig')
.right
.flex
h4.plain
Expand Down Expand Up @@ -40,7 +43,7 @@ import type { User } from '~/types'
import { NButton, NEllipsis, NSkeleton } from 'naive-ui'
import IFasCheck from '~icons/fa-solid/check'
import IFasPlus from '~icons/fa-solid/plus'
import { useUserStore } from '~/stores/session'
import { useUserStore } from '~/composables/session'

const userStore = useUserStore()

Expand Down
2 changes: 1 addition & 1 deletion app/components/Comment/Comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ li.comment-block
<script lang="ts" setup>
import stampList from './stampList.json'
import type { Comments } from '~/types'
import { useUserStore } from '~/stores/session'
import { useUserStore } from '~/composables/session'

defineProps<{ comment: Comments }>()
const store = useUserStore()
Expand Down
2 changes: 1 addition & 1 deletion app/components/Comment/CommentSubmit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<script lang="ts" setup>
import Cookies from 'js-cookie'
import { useUserStore } from '~/stores/session'
import { useUserStore } from '~/composables/session'

const store = useUserStore()

Expand Down
3 changes: 2 additions & 1 deletion app/components/DeferLoad.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const loaded = ref(false)
const error = ref(false)
const imgRef = ref<HTMLImageElement | null>(null)

const ob = useIntersectionObserver(imgRef, async ([{ isIntersecting }]) => {
const ob = useIntersectionObserver(imgRef, async (entries) => {
const isIntersecting = entries[0]?.isIntersecting
if (isIntersecting) {
await nextTick()
loadImage()
Expand Down
2 changes: 1 addition & 1 deletion app/components/ErrorPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const props = defineProps<{
}>()
const msg = ref('')
function randomMsg(): void {
const newValue = msgList[Math.floor(Math.random() * msgList.length)]
const newValue = msgList[Math.floor(Math.random() * msgList.length)]!
Comment thread
NekoCharm01 marked this conversation as resolved.
Outdated
if (newValue !== msg.value) {
msg.value = newValue
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/components/FollowUserCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import type { User, UserListItem } from '~/types'
import { NButton, NEllipsis, NSkeleton } from 'naive-ui'
import IFasCheck from '~icons/fa-solid/check'
import IFasPlus from '~icons/fa-solid/plus'
import { useUserStore } from '~/stores/session'
import { useUserStore } from '~/composables/session'

const userStore = useUserStore()
const pixivClient = usePixivClientStore().client
Expand Down
7 changes: 5 additions & 2 deletions app/components/SideNav/SideNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ aside.global-side-nav(:class='{ hidden: !sideNavStore.isOpened }')
.group
.title PixivNow
ul
SideNavListLink(externalLink='https://www.pixiv.net/' text='Pixiv.net')
SideNavListLink(
externalLink='https://www.pixiv.net/'
text='Pixiv.net'
)
IFasExternalLinkAlt.link-icon
SideNavListLink(link='/about' text='关于我们')
IFasHeart.link-icon
Expand All @@ -57,7 +60,7 @@ import IFasHeart from '~icons/fa-solid/heart'
import IFasHome from '~icons/fa-solid/home'
import IFasImage from '~icons/fa-solid/image'
import IFasUser from '~icons/fa-solid/user'
import { useSideNavStore, useUserStore } from '~/stores/session'
import { useSideNavStore, useUserStore } from '~/composables/session'

const sideNavStore = useSideNavStore()
const userStore = useUserStore()
Expand Down
94 changes: 44 additions & 50 deletions app/components/SiteHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
header.global-navbar(:class='{ "not-at-top": notAtTop, hidden }')
.flex
button.side-nav-toggle.plain(
@click='toggleSideNav'
aria-label='打开导航菜单'
title='导航菜单'
@click='toggleSideNav'
)
IFasBars(aria-hidden='true')

Expand All @@ -16,70 +16,64 @@ header.global-navbar(:class='{ "not-at-top": notAtTop, hidden }')
.search-full.align-right.flex-1
SearchBox
.search-icon.align-right.flex-1
button.pointer.plain(
aria-label='搜索'
title='搜索'
@click='openSideNav'
)
button.pointer.plain(@click='openSideNav' aria-label='搜索' title='搜索')
IFasSearch(aria-hidden='true')
| &nbsp;搜索
.flex.search-area(v-else)

#global-nav__user-area.user-area
.user-link(ref='userLinkRef')
button.dropdown-btn.plain.pointer(
:aria-expanded='showUserDropdown'
:aria-label='userStore.isLoggedIn ? "用户菜单: " + userStore.userName : "用户菜单"'
:class='{ "show-user": showUserDropdown }'
:aria-expanded='showUserDropdown',
:aria-label='userStore.isLoggedIn ? "用户菜单: " + userStore.userName : "用户菜单"',
:class='{ "show-user": showUserDropdown }',
:title='userStore.isLoggedIn ? userStore.userId + " (" + userStore.userPixivId + ")" : "未登入"'
@click='showUserDropdown = !showUserDropdown'
)
img.avatar(
:alt='userStore.isLoggedIn ? userStore.userName : "未登入"'
:alt='userStore.isLoggedIn ? userStore.userName : "未登入"',
:src='userStore.isLoggedIn ? userStore.userProfileImg : "/~/common/images/no_profile.png"'
)

.dropdown-content(:class='{ visible: showUserDropdown }')
ul
//- notLogIn
li(v-if='!userStore.isLoggedIn')
.nav-user-card
.top
.banner-bg
img.avatar(:src='"/~/common/images/no_profile.png"')
.details
a.user-name 游客
.uid 绑定令牌,同步您的 Pixiv 信息!

//- isLogedIn
li(v-if='userStore.isLoggedIn')
.nav-user-card
.top
.banner-bg
RouterLink.plain.name(:to='"/users/" + userStore.userId')
img.avatar(:src='userStore.userProfileImgBig')
.details
RouterLink.plain.user-name(
:to='"/users/" + userStore.userId'
) {{ userStore.userName }}
.uid @{{ userStore.userPixivId }}

li(v-if='userStore.isLoggedIn')
RouterLink.plain(
:to='`/users/${userStore.userId}?tab=public_bookmarks`'
) 公开收藏
li(v-if='userStore.isLoggedIn')
RouterLink.plain(
:to='`/users/${userStore.userId}?tab=hidden_bookmarks`'
) 私密收藏
li(v-if='userStore.isLoggedIn')
RouterLink.plain(
:to='`/users/${userStore.userId}/following`'
) 我的关注
li(v-if='$route.path !== "/login"')
RouterLink.plain(:to='"/login?back=" + $route.path') {{ userStore.isLoggedIn ? '查看令牌' : '用户登入' }}
li(v-if='userStore.isLoggedIn')
a.plain(@click='logoutUser') 用户登出
//- notLogIn
li(v-if='!userStore.isLoggedIn')
.nav-user-card
.top
.banner-bg
img.avatar(:src='"/~/common/images/no_profile.png"')
.details
a.user-name 游客
.uid 绑定令牌,同步您的 Pixiv 信息!

//- isLogedIn
li(v-if='userStore.isLoggedIn')
.nav-user-card
.top
.banner-bg
RouterLink.plain.name(:to='"/users/" + userStore.userId')
img.avatar(:src='userStore.userProfileImgBig')
.details
RouterLink.plain.user-name(
:to='"/users/" + userStore.userId'
) {{ userStore.userName }}
.uid @{{ userStore.userPixivId }}

li(v-if='userStore.isLoggedIn')
RouterLink.plain(
:to='`/users/${userStore.userId}?tab=public_bookmarks`'
) 公开收藏
li(v-if='userStore.isLoggedIn')
RouterLink.plain(
:to='`/users/${userStore.userId}?tab=hidden_bookmarks`'
) 私密收藏
li(v-if='userStore.isLoggedIn')
RouterLink.plain(:to='`/users/${userStore.userId}/following`') 我的关注
li(v-if='$route.path !== "/login"')
RouterLink.plain(:to='"/login?back=" + $route.path') {{ userStore.isLoggedIn ? '查看令牌' : '用户登入' }}
li(v-if='userStore.isLoggedIn')
a.plain(@click='logoutUser') 用户登出
</template>

<script lang="ts" setup>
Expand All @@ -88,7 +82,7 @@ import IFasBars from '~icons/fa-solid/bars'
import IFasSearch from '~icons/fa-solid/search'
import { logout } from '~/composables/userData'
import LogoH from '~/assets/LogoH.png'
import { useSideNavStore, useUserStore } from '~/stores/session'
import { useSideNavStore, useUserStore } from '~/composables/session'

const hidden = ref(false)
const notAtTop = ref(false)
Expand Down
3 changes: 0 additions & 3 deletions app/stores/artwork.ts → app/composables/artwork.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { defineStore } from 'pinia'
import type { Artwork, ArtworkGallery, ArtworkInfo } from '~/types'

export const useArtworkStore = defineStore('artwork', () => {
const pixivClient = usePixivClientStore().client
const artworkCache = ref(new Map<string, Artwork>())
Expand Down
4 changes: 1 addition & 3 deletions app/stores/following.ts → app/composables/following.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { defineStore } from 'pinia'
import type { ArtworkInfo, UserListItem } from '~/types'

export const useFollowingStore = defineStore('following', () => {
// Following list state
const publicList = ref<UserListItem[]>([])
Expand Down Expand Up @@ -64,6 +61,7 @@ export const useFollowingStore = defineStore('following', () => {
if (latestLoading.value) return
latestLoading.value = true
try {
const pixivClient = usePixivClientStore().client
const data = await pixivClient.getFollowLatest({
p: latestNextPage.value,
mode: 'all',
Expand Down
3 changes: 0 additions & 3 deletions app/stores/home.ts → app/composables/home.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { defineStore } from 'pinia'
import type { ArtworkInfo } from '~/types'

export const useHomeStore = defineStore('home', () => {
const pixivClient = usePixivClientStore().client
const randomBg = ref<ArtworkInfo | null>(null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { PixivWebClient } from '~/api/pixiv-client'

export const usePixivClientStore = defineStore('pixiv-client', () => {
const runtimeConfig = useRuntimeConfig()
const client = markRaw(
Expand Down
3 changes: 0 additions & 3 deletions app/stores/ranking.ts → app/composables/ranking.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { defineStore } from 'pinia'
import type { ArtworkRank } from '~/types'

export const useRankingStore = defineStore('ranking', () => {
const rankingData = ref<{
date: Date
Expand Down
3 changes: 0 additions & 3 deletions app/stores/search.ts → app/composables/search.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { defineStore } from 'pinia'
import type { ArtworkInfo } from '~/types'

export const useSearchStore = defineStore('search', () => {
const pixivClient = usePixivClientStore().client
const results = ref<ArtworkInfo[]>([])
Expand Down
2 changes: 0 additions & 2 deletions app/stores/session.ts → app/composables/session.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { defineStore } from 'pinia'
import type { PixivUser } from '~/types'
import Cookies from 'js-cookie'

export const useSideNavStore = defineStore('sidenav', () => {
Expand Down
Loading
Loading