Skip to content

Commit b6b79e9

Browse files
committed
update other list view
skills list and view
1 parent f6f8a8f commit b6b79e9

23 files changed

+566
-70
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# Roco-Codex
2-
A Codex application for Roco,
1+
# Rocox-Codex
2+
3+
A Codex application for Roco

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<meta name="referrer" content="no-referrer" />
8-
<title>Roco Codex</title>
8+
<title>RoCoX Codex</title>
99
</head>
1010

1111
<body>

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "roco-codex",
2+
"name": "rocox-codex",
33
"private": false,
4-
"version": "0.0.1",
4+
"version": "1.0.0-beta.1",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
2-
name = "roco-codex"
2+
name = "rocox-codex"
33
version = "1.0.0-beta.1"
4-
description = "Roco Codex"
4+
description = "Rocox Codex"
55
authors = ["NeserCode"]
66
license = "MIT"
77
repository = ""

src-tauri/tauri.conf.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"withGlobalTauri": false
88
},
99
"package": {
10-
"productName": "Roco Codex",
11-
"version": "0.0.1"
10+
"productName": "RoCoX Codex",
11+
"version": "1.0.0-beta.1"
1212
},
1313
"tauri": {
1414
"allowlist": {
@@ -17,7 +17,7 @@
1717
"bundle": {
1818
"active": true,
1919
"targets": "all",
20-
"identifier": "com.nesercode.roco-codex.dev",
20+
"identifier": "com.nesercode.rocox-codex.dev",
2121
"icon": [
2222
"icons/32x32.png",
2323
"icons/128x128.png",
@@ -33,7 +33,7 @@
3333
{
3434
"fullscreen": false,
3535
"resizable": false,
36-
"title": "Roco Codex",
36+
"title": "RoCox Codex",
3737
"width": 500,
3838
"height": 600,
3939
"decorations": false,

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { nextTickToShow } from "./composables/useLocal"
99
1010
const isOpenModelDialog = ref(false)
1111
const slideDirection = useStorage(
12-
"roco-navigation-transition-direction",
12+
"rocox-navigation-transition-direction",
1313
"slideleft"
1414
)
1515

src/components/SearchFilter.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts" setup>
2-
import { ref, inject, watch } from "vue"
2+
import { ref, inject, watch, computed } from "vue"
33
import { UpdateSearchFunctionalKey } from "../tokens"
44
import { useStorage } from "@vueuse/core"
55
const innerValue = ref("")
@@ -16,7 +16,7 @@ function submitChangetoTop() {
1616
searchUpdateFn(innerValue.value)
1717
}
1818
19-
const category = useStorage("roco-categroy", "angels")
19+
const category = useStorage("rocox-categroy", "angels")
2020
const categoryNameMap = new Map([
2121
["angels", "精灵"],
2222
["skills", "技能"],
@@ -45,6 +45,9 @@ function getMatchPlaceHolder() {
4545
@apply w-72 h-full
4646
transition-all;
4747
}
48+
.search-filter-main.extending {
49+
@apply w-96;
50+
}
4851
4952
.filter-body {
5053
@apply w-full inline-flex items-center py-1 px-2

src/components/SkillList.vue

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
<script lang="ts" setup>
2+
import { CubeTransparentIcon, BugAntIcon } from "@heroicons/vue/20/solid"
3+
import { Ref, ref, toRefs, watch } from "vue"
4+
import { useApi } from "../composables/useApi"
5+
import { computedAsync, useStorage } from "@vueuse/core"
6+
import { useRouter } from "vue-router"
7+
import { WindowCreator } from "../composables/useWindow"
8+
9+
const $props = withDefaults(
10+
defineProps<{
11+
id?: string
12+
search?: string
13+
feature?: string
14+
page?: number
15+
}>(),
16+
{
17+
id: "",
18+
search: "",
19+
feature: "",
20+
page: 1,
21+
}
22+
)
23+
24+
const { id, search, feature, page } = toRefs($props)
25+
const { getSkillList, damageTypeStaticMap, featureStaticURL } = useApi()
26+
27+
const listData = computedAsync(async (onCancel) => {
28+
const abortController = new AbortController()
29+
30+
onCancel(() => abortController.abort())
31+
return await getSkillList(
32+
{
33+
id: id.value,
34+
search: search.value,
35+
feature: feature.value,
36+
page: page.value,
37+
},
38+
abortController.signal
39+
)
40+
})
41+
42+
function getFeatureIconSrc(propertyIndex: string) {
43+
return `${featureStaticURL}${propertyIndex}.png`
44+
}
45+
46+
const isEmpty = computedAsync(() => listData.value.length === 0)
47+
const pageSize = useStorage("rocox-api-skill-list-size", 21)
48+
const totalFromID = useStorage("rocox-api-skill-max-id", 0)
49+
50+
const $emits = defineEmits(["update:sizes"])
51+
52+
watch(listData, (val: any[]) => {
53+
if (search.value === "" && feature.value === "" && page.value === 1) {
54+
pageSize.value = val.length
55+
totalFromID.value = parseInt(val[0].id)
56+
}
57+
$emits("update:sizes", {
58+
listSize: val.length,
59+
pageSize: pageSize.value,
60+
total: totalFromID.value,
61+
})
62+
})
63+
64+
const $router = useRouter()
65+
const alwaysTargetNewWindow = useStorage("rocox-new-window-target", false)
66+
const skillPageTitle = useStorage("rocox-skill-page-title", "")
67+
const AngelWindow: Ref<WindowCreator | null> = ref(null)
68+
69+
function setupWindowParams(id: string, name: string, hash: string) {
70+
skillPageTitle.value = `#${id} ${name}`
71+
AngelWindow.value = new WindowCreator(id, {
72+
url: `/#/skill/${hash}`,
73+
title: skillPageTitle.value,
74+
})
75+
76+
goAngelView(hash)
77+
}
78+
function goAngelView(hash: string) {
79+
if (alwaysTargetNewWindow.value) AngelWindow.value!.setup()
80+
else
81+
$router.push({
82+
name: "Skill",
83+
params: { hash },
84+
})
85+
}
86+
</script>
87+
88+
<template>
89+
<div class="skill-list-main custom-scrollbar">
90+
<div
91+
class="skill-card"
92+
v-for="skill in listData"
93+
:key="skill.hash"
94+
@click="setupWindowParams(skill.id, skill.name, skill.hash)"
95+
>
96+
<span class="name-text">
97+
<span class="id">#{{ skill.id }}</span>
98+
<span class="name">{{ skill.name }}</span>
99+
</span>
100+
<span class="details">
101+
<span class="icons">
102+
<img
103+
v-if="skill.property"
104+
class="icon property"
105+
:src="getFeatureIconSrc(skill.property)"
106+
alt="skill property"
107+
/>
108+
<img
109+
v-if="skill.power !== '--'"
110+
class="icon damage"
111+
:src="damageTypeStaticMap.get(skill.damageType)"
112+
:alt="skill.damageType === '1' ? '物理伤害' : '魔法伤害'"
113+
:title="skill.damageType === '1' ? '物理伤害' : '魔法伤害'"
114+
/>
115+
</span>
116+
<span class="text">
117+
<span class="ppMax" title="pp总量">{{ skill.ppMax }}</span> ·
118+
<span class="power" title="威力值">{{ skill.power }}</span> ·
119+
<span class="speed" title="速度值">{{ skill.speed }}</span>
120+
</span>
121+
</span>
122+
</div>
123+
<Transition name="slidedown" mode="in-out" :appear="true">
124+
<div class="empty-palceholder" v-if="isEmpty">
125+
<span class="empty-icons">
126+
<CubeTransparentIcon class="icon" /> ·
127+
<BugAntIcon class="icon" />
128+
</span>
129+
<span class="empty-text"
130+
>筛选结果为空,但不排除小概率因接口、网络等引起的故障。</span
131+
>
132+
</div>
133+
</Transition>
134+
</div>
135+
</template>
136+
137+
<style lang="postcss" scoped>
138+
.skill-list-main {
139+
@apply flex flex-wrap w-full mt-8 h-[22rem] items-start justify-center content-start
140+
overflow-auto snap-y snap-mandatory;
141+
}
142+
143+
.skill-card {
144+
@apply flex flex-col mb-1 mr-1
145+
border-2 border-slate-200 dark:border-slate-600
146+
hover:bg-slate-100 active:bg-slate-200 active:border-slate-300
147+
dark:hover:bg-slate-600 dark:active:bg-slate-800 dark:active:border-slate-600
148+
rounded select-none transition-all snap-start cursor-pointer;
149+
}
150+
151+
.skill-card .name-text {
152+
@apply inline-flex items-center justify-between
153+
font-semibold text-sm;
154+
}
155+
.name-text .id {
156+
@apply inline-block ml-1 mr-2;
157+
}
158+
.name-text .name {
159+
@apply inline-block ml-2 mr-1;
160+
}
161+
162+
.skill-card .details {
163+
@apply inline-flex items-center justify-between;
164+
}
165+
.details .icons {
166+
@apply inline-block ml-1 mr-2;
167+
}
168+
.details .text {
169+
@apply inline-block ml-2 mr-1
170+
font-semibold text-sm;
171+
}
172+
173+
.icons .icon {
174+
@apply w-6 h-6 inline-block my-1 ml-1 p-1
175+
border rounded
176+
bg-slate-200 dark:bg-slate-600 border-slate-400 dark:border-slate-500
177+
overflow-hidden;
178+
}
179+
.icon.damage {
180+
@apply p-0;
181+
}
182+
183+
.text .ppMax {
184+
@apply text-blue-700 dark:text-blue-400;
185+
}
186+
.text .power {
187+
@apply text-red-700 dark:text-red-400;
188+
}
189+
.text .speed {
190+
@apply text-sky-700 dark:text-sky-400;
191+
}
192+
193+
.empty-palceholder {
194+
@apply w-full h-full flex flex-col items-center justify-center
195+
select-none;
196+
}
197+
.empty-text {
198+
@apply inline-block
199+
text-sm font-bold text-center;
200+
}
201+
.empty-icons {
202+
@apply inline-flex justify-center items-center pb-4;
203+
}
204+
.empty-icons .icon {
205+
@apply w-12 h-12 inline-block m-2
206+
animate-pulse;
207+
}
208+
</style>

0 commit comments

Comments
 (0)