11<script setup lang="ts">
2+ import SIconButton from ' @qingfeng346/ui-kit/components/button/SIconButton.vue'
3+ import STag from ' @qingfeng346/ui-kit/components/STag.vue'
4+ import SEmpty from ' @qingfeng346/ui-kit/components/SEmpty.vue'
5+ import SHint from ' @qingfeng346/ui-kit/components/SHint.vue'
26import SInput from ' @qingfeng346/ui-kit/components/input/SInput.vue'
37import SButton from ' @qingfeng346/ui-kit/components/button/SButton.vue'
48import { computed , nextTick , ref , watch } from ' vue'
9+ import RemoteSelect from ' ./RemoteSelect.vue'
510import type { SaveState } from ' ../emulator/runner'
611import type { DownloadProgress } from ' ../store/romDownloader'
712import { acquireRomByKey } from ' ../store/romResolver'
@@ -33,6 +38,11 @@ const records = ref<SaveStateRecord[]>([])
3338const query = ref (' ' )
3439// 过滤范围:'current' 当前游戏 / 'all' 全部 / 其余为某游戏的 sha256。
3540const filter = ref <' current' | ' all' | string >(' all' )
41+ const filterOptions = computed (() => [
42+ ... (props .currentRomKey ? [{ value: ' current' , label: ' 当前游戏' }] : []),
43+ { value: ' all' , label: ' 全部游戏' },
44+ ... games .value .map (game => ({ value: game .key , label: game .name })),
45+ ])
3646const busyKey = ref <string | null >(null )
3747const error = ref <string | null >(null )
3848const progress = ref <DownloadProgress | null >(null )
@@ -118,8 +128,7 @@ async function loadRecord(record: SaveStateRecord) {
118128 onProgress : (p ) => (progress .value = p ),
119129 })
120130 if (! resolved ) {
121- error .value = null
122- window .alert (` 未在游戏库中找到《${record .name }》,无法读档。请先在 ROM 库中添加该游戏。 ` )
131+ error .value = ` 未在游戏库中找到《${record .name }》,无法读档。请先在 ROM 库中添加该游戏。 `
123132 return
124133 }
125134 emit (' load' , {
@@ -200,32 +209,29 @@ function formatError(err: unknown): string {
200209 <section class =" store-panel" >
201210 <div class =" store-tools" >
202211 <SInput v-model :value =" query " class="search" type="search" placeholder="搜索存档名、游戏名" />
203- <select v-model =" filter" class =" select" >
204- <option v-if =" currentRomKey" value =" current" >当前游戏</option >
205- <option value =" all" >全部游戏</option >
206- <option v-for =" g in games" :key =" g.key" :value =" g.key" >{{ g.name }}</option >
207- </select >
212+ <RemoteSelect v-model =" filter " class="select" :options =" filterOptions " />
208213 </div >
209214
210215 <div class =" store-summary" >
211216 <span >显示 {{ filteredRecords.length }} 条</span >
212- <span v-if =" error" class =" error" >{{ error }}</span >
217+ <SHint v-if =" error " type="error" class="error" role="alert" >{{ error }}</SHint >
213218 </div >
214219
215220 <div class =" save-list" >
216221 <article v-for =" record in filteredRecords" :key =" record.key" class =" save-card" >
217222 <div class =" save-main" >
218223 <div class =" save-title-row" >
219- <span
224+ <STag
225+ size="small"
220226 class="badge"
221- :class =" isQuickSave(record) ? 'badge-quick ' : 'badge-normal '"
227+ :type =" isQuickSave (record ) ? ' warning ' : ' info ' "
222228 :title =" isQuickSave (record ) ? ' 快速存档(S 键覆盖式单槽)' : ' 普通存档' "
223229 >
224230 {{ isQuickSave(record) ? '快速' : '普通' }}
225- </span >
226- <input
231+ </STag >
232+ <SInput
227233 v-if =" editingKey === record .key "
228- v-model =" editingText"
234+ v-model : value =" editingText "
229235 class="rename-input"
230236 type="text"
231237 @keydown .enter .prevent =" commitEdit (record )"
@@ -235,15 +241,17 @@ function formatError(err: unknown): string {
235241 <h3 v-else :title =" saveLabel(record)" @click =" startEdit(record)" >
236242 {{ saveLabel(record) }}
237243 </h3 >
238- <SButton
244+ <SIconButton
239245 v-if =" editingKey !== record .key "
246+ :size =" 44 "
247+ aria-label="重命名"
240248 class="icon-btn"
241249 title="重命名"
242250 :disabled =" busyKey !== null "
243251 @click =" startEdit (record )"
244252 >
245253 ✎
246- </SButton >
254+ </SIconButton >
247255 </div >
248256 <p class =" meta" >{{ record.name }}</p >
249257 <p class =" meta time" >{{ formatTime(record.savedAt) }}</p >
@@ -260,9 +268,7 @@ function formatError(err: unknown): string {
260268 </div >
261269 </article >
262270
263- <p v-if =" filteredRecords.length === 0" class =" empty" >
264- {{ records.length === 0 ? '还没有任何存档' : '没有匹配的存档' }}
265- </p >
271+ <SEmpty v-if =" filteredRecords .length === 0 " class="empty" :description =" records .length === 0 ? ' 还没有任何存档' : ' 没有匹配的存档' " />
266272 </div >
267273 </section >
268274</template >
@@ -341,21 +347,6 @@ function formatError(err: unknown): string {
341347}
342348.badge {
343349 flex : 0 0 auto ;
344- padding : 2px 7px ;
345- border-radius : 4px ;
346- font-size : 11px ;
347- font-weight : 600 ;
348- line-height : 1.4 ;
349- }
350- .badge-quick {
351- background : rgba (214 , 179 , 106 , 0.18 );
352- color : #e3c178 ;
353- border : 1px solid rgba (214 , 179 , 106 , 0.4 );
354- }
355- .badge-normal {
356- background : rgba (47 , 111 , 159 , 0.18 );
357- color : #8fc4ec ;
358- border : 1px solid rgba (47 , 111 , 159 , 0.4 );
359350}
360351.save-title-row h3 {
361352 min-width : 0 ;
0 commit comments