mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
✨ 存档新建&删除
This commit is contained in:
@@ -47,7 +47,6 @@ watch(
|
|||||||
|
|
||||||
async function refreshOverview(): Promise<void> {
|
async function refreshOverview(): Promise<void> {
|
||||||
overview.value = await TSUserAchi.getOverview(props.uid, props.series);
|
overview.value = await TSUserAchi.getOverview(props.uid, props.series);
|
||||||
console.log(overview.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function listenAchi(): Promise<UnlistenFn> {
|
async function listenAchi(): Promise<UnlistenFn> {
|
||||||
|
|||||||
@@ -31,8 +31,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</v-app-bar>
|
</v-app-bar>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<!-- 左侧菜单 -->
|
<div class="left-wrap">
|
||||||
<div class="left-wrap" v-if="uidCur">
|
|
||||||
<TuaSeries
|
<TuaSeries
|
||||||
v-for="(series, index) in seriesList"
|
v-for="(series, index) in seriesList"
|
||||||
:key="index"
|
:key="index"
|
||||||
@@ -43,7 +42,6 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<TuaAchiList
|
<TuaAchiList
|
||||||
v-if="uidCur"
|
|
||||||
:uid="uidCur"
|
:uid="uidCur"
|
||||||
:hideFin="hideFin"
|
:hideFin="hideFin"
|
||||||
v-model:series="selectedSeries"
|
v-model:series="selectedSeries"
|
||||||
@@ -271,14 +269,43 @@ async function handleImportOuter(app: string): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function createUid(): Promise<void> {
|
async function createUid(): Promise<void> {
|
||||||
// todo
|
const uidInput = await showConfirm({
|
||||||
|
mode: "input",
|
||||||
|
title: "请输入新存档UID",
|
||||||
|
text: "UID:",
|
||||||
|
});
|
||||||
|
if (uidInput === undefined || uidInput === false) {
|
||||||
|
showSnackbar({ text: "已取消", color: "cancel" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isNaN(Number(uidInput))) {
|
||||||
|
showSnackbar({ text: "请输入合法数字", color: "warn" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (uidList.value.includes(Number(uidInput))) {
|
||||||
|
showSnackbar({ text: "该存档已存在!", color: "warn" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uidList.value.push(Number(uidInput));
|
||||||
|
uidCur.value = Number(uidInput);
|
||||||
|
showSnackbar({ text: `切换到新存档 ${Number(uidInput)}`, color: "success" });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteUid(): Promise<void> {
|
async function deleteUid(): Promise<void> {
|
||||||
// todo
|
const uidInput = await showConfirm({
|
||||||
|
title: "确定删除该存档?",
|
||||||
|
text: `确认则清空存档-${uidCur.value}对应数据`,
|
||||||
|
});
|
||||||
|
if (uidInput === undefined || !uidInput) {
|
||||||
|
showSnackbar({ text: "已取消删除存档", color: "cancel" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await TSUserAchi.delUid(uidCur.value);
|
||||||
|
uidList.value = uidList.value.filter((e) => e !== uidCur.value);
|
||||||
|
if (uidList.value.length === 0) uidList.value = [0];
|
||||||
|
uidCur.value = uidList.value[0];
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<!-- 顶部栏跟 wrap 大概布局 -->
|
|
||||||
<style lang="css" scoped>
|
<style lang="css" scoped>
|
||||||
.achi-search {
|
.achi-search {
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -318,14 +345,12 @@ async function deleteUid(): Promise<void> {
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 内容区域 */
|
|
||||||
.wrap {
|
.wrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: calc(100vh - 150px);
|
height: calc(100vh - 150px);
|
||||||
column-gap: 10px;
|
column-gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 左侧系列 */
|
|
||||||
.left-wrap {
|
.left-wrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
|
|||||||
@@ -310,6 +310,7 @@ async function restoreUiaf(dir: string): Promise<boolean> {
|
|||||||
// 正则匹配 UIAF_xx.json
|
// 正则匹配 UIAF_xx.json
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
try {
|
try {
|
||||||
|
// todo 完善正则判断
|
||||||
const reg = new RegExp(/(.*)UIAF_d{9}.json/);
|
const reg = new RegExp(/(.*)UIAF_d{9}.json/);
|
||||||
if (!file.name.match(reg)) return false;
|
if (!file.name.match(reg)) return false;
|
||||||
const uid: number = Number(file.name.match(reg)![0]);
|
const uid: number = Number(file.name.match(reg)![0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user