Skip to content

Commit 783c666

Browse files
committed
add help layout
1 parent 1184d48 commit 783c666

File tree

10 files changed

+210
-18
lines changed

10 files changed

+210
-18
lines changed

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ onMounted(async () => {
6060

6161
<router-view id="context" v-slot="{ Component }">
6262
<Transition :name="slideDirection" mode="out-in" :appear="true">
63-
<keep-alive :include="['Home', 'About']">
63+
<keep-alive :include="['Home', 'About', 'Help']">
6464
<component :is="Component" :key="$route.fullPath" />
6565
</keep-alive>
6666
</Transition>

src/components/AngelPowerChart.vue

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ const chartValues = computed(() => [
4646
angel.value.sm,
4747
angel.value.sd,
4848
])
49+
const powerLimit = computed(() =>
50+
parseInt(angel.value.id ?? "99999") > 10000 ? 300 : 200
51+
)
4952
const optTitleColor = computed(() => (isDarkMode.value ? "#ccc" : "#333"))
5053
const optTextColor = computed(() => (isDarkMode.value ? "#aaa" : "#555"))
54+
const optBorderColor = computed(() => (isDarkMode.value ? "#666" : "#ccc"))
5155
const optBlurBg = computed(() =>
5256
isDarkMode.value ? "rgba(32, 32, 32, 0.5)" : "rgba(255, 255, 255, 0.5)"
5357
)
@@ -77,20 +81,50 @@ const opt = computed(() => ({
7781
nameGap: 5,
7882
slient: true,
7983
indicator: [
80-
{ name: `物攻`, min: 0, max: 200, color: optTextColor.value },
81-
{ name: `魔攻`, min: 0, max: 200, color: optTextColor.value },
82-
{ name: `物抗`, min: 0, max: 200, color: optTextColor.value },
83-
{ name: `魔抗`, min: 0, max: 200, color: optTextColor.value },
84-
{ name: `精力`, min: 0, max: 200, color: optTextColor.value },
85-
{ name: `速度`, min: 0, max: 200, color: optTextColor.value },
84+
{
85+
name: `物攻`,
86+
min: 0,
87+
max: powerLimit.value,
88+
color: optTextColor.value,
89+
},
90+
{
91+
name: `魔攻`,
92+
min: 0,
93+
max: powerLimit.value,
94+
color: optTextColor.value,
95+
},
96+
{
97+
name: `物抗`,
98+
min: 0,
99+
max: powerLimit.value,
100+
color: optTextColor.value,
101+
},
102+
{
103+
name: `魔抗`,
104+
min: 0,
105+
max: powerLimit.value,
106+
color: optTextColor.value,
107+
},
108+
{
109+
name: `精力`,
110+
min: 0,
111+
max: powerLimit.value,
112+
color: optTextColor.value,
113+
},
114+
{
115+
name: `速度`,
116+
min: 0,
117+
max: powerLimit.value,
118+
color: optTextColor.value,
119+
},
86120
],
87121
axisLine: {
88122
show: false,
89123
},
90124
splitLine: {
91125
show: true,
92126
lineStyle: {
93-
color: optTextColor.value,
127+
color: optBorderColor.value,
94128
width: 2,
95129
},
96130
},

src/components/ItemList.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,16 @@ watch(listData, (val: any[]) => {
5858
})
5959
console.log(listData.value)
6060
})
61+
62+
// Auto-scroll to the top of the page when the page is loaded.
63+
const container = ref<HTMLElement | null>(null)
64+
watch(page, () => {
65+
if (container.value) container.value.scrollTop = 0
66+
})
6167
</script>
6268

6369
<template>
64-
<div class="item-list-main custom-scrollbar">
70+
<div class="item-list-main custom-scrollbar" ref="container">
6571
<div class="item-card" v-for="item in listData" :key="item.id!">
6672
<span class="name-text">
6773
<span class="id">#{{ item.id }}</span>
@@ -84,8 +90,8 @@ watch(listData, (val: any[]) => {
8490
>
8591
<span class="price">售价 · {{ item.Price }}</span>
8692
<span class="desc"
87-
>描述 · {{ item.Desc ?? "这是一段空白的描述" }}</span
88-
>
93+
>描述 · <span v-html="item.Desc ?? '这是一段空白的描述'"></span
94+
></span>
8995
</span>
9096
</span>
9197
</div>
@@ -113,7 +119,7 @@ watch(listData, (val: any[]) => {
113119
}
114120
115121
.item-card {
116-
@apply inline-flex flex-col items-center justify-center p-2 pt-0
122+
@apply inline-flex flex-col w-full items-center justify-center p-2 pt-0
117123
border-2 rounded border-slate-300 dark:border-slate-600
118124
snap-start transition-all ease-in-out duration-300;
119125
}
@@ -127,7 +133,7 @@ watch(listData, (val: any[]) => {
127133
}
128134
129135
.details {
130-
@apply inline-flex w-full items-center justify-center;
136+
@apply inline-flex w-full items-center justify-start;
131137
}
132138
.details .icon {
133139
@apply inline-flex justify-center items-center w-16 h-fit box-content mr-1
@@ -146,7 +152,7 @@ watch(listData, (val: any[]) => {
146152
.text .desc {
147153
@apply inline-flex items-center h-fit px-1 py-0.5 mr-1 mb-1
148154
text-sm font-bold opacity-75
149-
transition-all;
155+
transition-all whitespace-pre-line;
150156
}
151157
.text .desc {
152158
@apply w-full mb-0;

src/components/SkillList.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,16 @@ function goSkillView(hash: string) {
8181
params: { hash },
8282
})
8383
}
84+
85+
// Auto-scroll to the top of the page when the page is loaded.
86+
const container = ref<HTMLElement | null>(null)
87+
watch(page, () => {
88+
if (container.value) container.value.scrollTop = 0
89+
})
8490
</script>
8591

8692
<template>
87-
<div class="skill-list-main custom-scrollbar">
93+
<div class="skill-list-main custom-scrollbar" ref="container">
8894
<div
8995
class="skill-card"
9096
v-for="skill in listData"

src/components/SpiritList.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,16 @@ function goAngelView(hash: string) {
8585
params: { hash },
8686
})
8787
}
88+
89+
// Auto-scroll to the top of the page when the page is loaded.
90+
const container = ref<HTMLElement | null>(null)
91+
watch(page, () => {
92+
if (container.value) container.value.scrollTop = 0
93+
})
8894
</script>
8995

9096
<template>
91-
<div class="angel-list-main custom-scrollbar">
97+
<div class="angel-list-main custom-scrollbar" ref="container">
9298
<div
9399
class="angel-card"
94100
v-for="angel in listData"

src/components/TopLinks.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<script lang="ts" setup>
2-
import { BookOpenIcon, QuestionMarkCircleIcon } from "@heroicons/vue/20/solid"
2+
import {
3+
BookOpenIcon,
4+
QuestionMarkCircleIcon,
5+
LightBulbIcon,
6+
} from "@heroicons/vue/20/solid"
37
import Menu from "./native/Menu.vue"
48
import GoBack from "./native/GoBack.vue"
59
import { computed, onMounted } from "vue"
@@ -8,7 +12,7 @@ import { useStorage } from "@vueuse/core"
812
import { nextTickToShow } from "../composables/useLocal"
913
1014
const $route = useRoute()
11-
const shouldShowLinksPath = ["home", "about"]
15+
const shouldShowLinksPath = ["home", "about", "help"]
1216
const hasActivedLink = computed(() => {
1317
return shouldShowLinksPath.includes(
1418
(($route.name as string) ?? "").toLowerCase()
@@ -41,6 +45,10 @@ onMounted(() => {
4145
<BookOpenIcon class="icon" />
4246
<span class="text">{{ getMatchCategoryName() }}</span>
4347
</RouterLink>
48+
<RouterLink draggable="false" class="link" to="/help">
49+
<LightBulbIcon class="icon" />
50+
<span class="text">帮助</span>
51+
</RouterLink>
4452
<RouterLink draggable="false" class="link" to="/about">
4553
<QuestionMarkCircleIcon class="icon" />
4654
<span class="text">关于</span>

src/composables/useLocal.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export function nextTickToShow() {
1717

1818
export function useDeCryptKey(salt: string, password: string) {
1919
// return Base64.stringify(HmacSHA512(sha256(password), salt)) // use in dev, product use below
20+
// console.log(Base64.stringify(HmacSHA512(sha256("RoCoX Codex"), "NCS.RoCoX")))
21+
2022
return (
2123
$DevCryptKey ===
2224
Base64.stringify(HmacSHA512(sha256(password), salt)).toString()

src/router.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ const routes: Array<RouteRecordRaw> = [
1414
meta: {},
1515
component: () => import("./views/About.vue"),
1616
},
17+
{
18+
path: "/help",
19+
name: "Help",
20+
meta: {},
21+
component: () => import("./views/Help.vue"),
22+
},
1723
{
1824
path: "/angel/:hash",
1925
name: "Angel",

src/share.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,9 @@ export type Collections = Map<
184184
| "KeyShortCut",
185185
number
186186
>
187+
188+
export interface Help {
189+
id: number
190+
question: string
191+
answer: string
192+
}

src/views/Help.vue

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<script lang="ts" setup>
2+
import { Disclosure, DisclosureButton, DisclosurePanel } from "@headlessui/vue"
3+
import { ChevronUpIcon } from "@heroicons/vue/20/solid"
4+
5+
import type { Help } from "../share"
6+
7+
const getComputedOpenClass = (state: any) => {
8+
return !!state ? "open" : null
9+
}
10+
const defaultOpenList: number[] = [1]
11+
const getDefaultOpenState = (id: number) => {
12+
return defaultOpenList.includes(id)
13+
}
14+
const helpList: Help[] = [
15+
{
16+
id: 1,
17+
question: "快捷键 · 我能使用什么快捷键",
18+
answer:
19+
"1. 使用 Ctrl+Q 进行快速刷新;" +
20+
"\n2. 使用 Ctrl+P 进行切换软件置顶状态。" +
21+
"\n3. 使用 Ctrl+D 进行切换软件主题状态。",
22+
},
23+
{
24+
id: 2,
25+
question: "快捷键 · 为什么不推荐使用快捷键",
26+
answer:
27+
"1. 由于软件基层使用的快捷键拦截机制会导致用户对应的全局键盘事件劫持,从用户操作性上考虑软件本应当默认禁用快捷键;" +
28+
"\n2. 快捷键一般用于开发调试所用,且在多窗口快捷键的机制上是有一定的次序缺陷(同样由本解第一点中提出的问题引起),暂时软件默认禁用部分快捷键。",
29+
},
30+
{
31+
id: 3,
32+
question: "快捷键&开发模式 · 如何启用开发模式及刷新快捷键",
33+
answer: "暂不提供",
34+
},
35+
{
36+
id: 4,
37+
question: "数据 · 为什么部分数据不对/不公开/无法显示",
38+
answer:
39+
"1. 接口数据造成的错误不由本软件负责;" +
40+
"\n2. 异常数据大多是由于网络接口开发人员设计上的不合理或是缺陷造成,其中官方的静态资源例如宠物的小头像命名与存储比较杂乱" +
41+
",本软件有使用记忆缓存的方法记忆正确资源,在第二次访问该异常头像资源会恢复正常,而其他问题资源则暂时无法解决;",
42+
},
43+
]
44+
</script>
45+
46+
<template>
47+
<div>
48+
<div class="disclosure-main custom-scrollbar">
49+
<Disclosure
50+
v-for="help in helpList"
51+
:key="help.id"
52+
as="div"
53+
class="disclosure"
54+
v-slot="{ open }"
55+
:defaultOpen="getDefaultOpenState(help.id)"
56+
>
57+
<DisclosureButton class="disclosure-btn">
58+
<span class="id">#{{ help.id }}</span>
59+
<span class="question">{{ help.question }}</span>
60+
<ChevronUpIcon :class="['icon', getComputedOpenClass(open)]" />
61+
</DisclosureButton>
62+
<transition
63+
enter-active-class="transition duration-100 ease-out"
64+
enter-from-class="transform scale-95 opacity-0"
65+
enter-to-class="transform scale-100 opacity-100"
66+
leave-active-class="transition duration-75 ease-out"
67+
leave-from-class="transform scale-100 opacity-100"
68+
leave-to-class="transform scale-95 opacity-0"
69+
>
70+
<DisclosurePanel class="disclosure-panel">
71+
<span class="answer">{{ help.answer }}</span>
72+
</DisclosurePanel>
73+
</transition>
74+
</Disclosure>
75+
</div>
76+
</div>
77+
</template>
78+
79+
<style lang="postcss">
80+
.disclosure-main {
81+
@apply flex flex-col w-full max-h-[30rem] p-2 gap-2 mx-auto
82+
bg-teal-100 dark:bg-teal-800
83+
rounded transition-all ease-in-out
84+
select-none overflow-y-auto;
85+
86+
@apply sm:max-h-[42rem];
87+
}
88+
.disclosure-btn {
89+
@apply flex justify-between w-full px-4 py-2
90+
text-sm font-medium text-left
91+
bg-sky-200 dark:bg-sky-700
92+
focus:ring-2 ring-green-400 dark:ring-green-600
93+
rounded outline-none
94+
transition-all ease-in-out;
95+
}
96+
.disclosure-panel {
97+
@apply px-4 pt-4 pb-2
98+
opacity-80
99+
whitespace-pre-line
100+
transition-all ease-in-out;
101+
}
102+
</style>
103+
<style lang="postcss" scoped>
104+
.disclosure-btn .icon {
105+
@apply w-5 h-5
106+
transition-all ease-in-out;
107+
}
108+
.disclosure-btn .icon.open {
109+
@apply rotate-180;
110+
}
111+
112+
.question {
113+
@apply font-black text-base;
114+
}
115+
.answer {
116+
@apply font-semibold text-sm;
117+
}
118+
</style>

0 commit comments

Comments
 (0)