Repository navigation
完善首页布局、侧栏和个人主页 #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
完善首页布局、侧栏和个人主页 #13
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,12 +19,31 @@ const emits = defineEmits<{ | |
| }>(); | ||
| const isMobile = useMediaQuery("(max-width: 768px)"); | ||
| const openMobile = ref(false); | ||
| const SIDEBAR_OPEN_KEY = "xmoj.sidebar.open.v1"; | ||
| function initialOpen(): boolean { | ||
| try { | ||
| const saved = localStorage.getItem(SIDEBAR_OPEN_KEY); | ||
| return saved === null ? props.defaultOpen : saved === "true"; | ||
| } | ||
| catch { | ||
| return props.defaultOpen; | ||
| } | ||
| } | ||
| const open = useVModel(props, "open", emits, { | ||
| defaultValue: props.defaultOpen ?? false, | ||
| defaultValue: initialOpen(), | ||
| passive: (props.open === undefined) as false, | ||
| }) as Ref<boolean>; | ||
| function setOpen(value: boolean, _persist = true) { | ||
| const pinnedOpen = ref(initialOpen()); | ||
| function setOpen(value: boolean, persist = true) { | ||
| open.value = value; | ||
| if (persist) { | ||
| pinnedOpen.value = value; | ||
|
Comment on lines
+37
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
如果快捷键只应切换显隐,应传 |
||
| try { | ||
| localStorage.setItem(SIDEBAR_OPEN_KEY, String(value)); | ||
| } | ||
| catch { | ||
| } | ||
| } | ||
| } | ||
| function setOpenMobile(value: boolean) { | ||
| openMobile.value = value; | ||
|
|
@@ -42,6 +61,7 @@ const state = computed(() => open.value ? "expanded" : "collapsed"); | |
| provideSidebarContext({ | ||
| state, | ||
| open, | ||
| pinnedOpen, | ||
| setOpen, | ||
| isMobile, | ||
| openMobile, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,8 +9,10 @@ import AnnouncementBody from '@/components/AnnouncementBody.vue'; | |
| import UserChip from '@/components/UserChip.vue'; | ||
| import { createPost, createReply, fetchBoards, fetchPost, fetchPosts } from '@/services/api'; | ||
| import { useSession } from '@/stores/session'; | ||
| import { useNavigation } from '@/stores/navigation'; | ||
| import type { BbsBoard, BbsPost, BbsPostDetail } from '@/shared/community'; | ||
| const session = useSession(); | ||
| const navigation = useNavigation(); | ||
| const boards = ref<BbsBoard[]>([]); | ||
| const selectedBoard = ref(-1); | ||
| const posts = ref<BbsPost[]>([]); | ||
|
|
@@ -212,7 +214,11 @@ function formatTime(value?: number): string { | |
| const replies = computed(() => thread.value?.Reply ?? []); | ||
| onMounted(async () => { | ||
| await loadBoards(true); | ||
| await loadPosts(); | ||
| const target = navigation.consumeDiscussionTarget(); | ||
| if (target) | ||
| await openThread(target.postId, target.page); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里只在 更糟的是 target 会留在 store 里,等用户先切到别的页面再切回讨论页时被消费,意外打开之前那条通知对应的帖子。 建议把 pending target 以响应式 ref 暴露出来,在 Discussion 内 |
||
| else | ||
| await loadPosts(); | ||
| }); | ||
| </script> | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
electron/parsers.ts:392里11对应的是 Compile Error。这里的>= 5 && <= 10会把编译错误排除在失败数之外,导致calculateRating里的成功率偏高(把 CE 当成了成功提交)。若意图是统计所有非 AC 的终态,区间应改为<= 11,同时继续排除 0–3 的 pending 状态。Fix this →