Skip to content

Commit

Permalink
🐛 修复成就页点击异常,调整UI
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Nov 19, 2024
1 parent 62171b7 commit be4e2c1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
30 changes: 24 additions & 6 deletions src/components/userAchi/tua-achi-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ interface TuaAchiListProps {
hideFin: boolean;
series?: number;
search?: string;
isSearch: boolean;
}
interface TuaAchiListEmits {
(e: "update:series", v: number): void;
(e: "update:isSearch", v: boolean): false;
}
const props = defineProps<TuaAchiListProps>();
Expand All @@ -72,17 +75,32 @@ const renderAchi = computed<Array<TGApp.Sqlite.Achievement.RenderAchi>>(() => {
onMounted(async () => await loadAchi());
watch(
() => [props.series, props.search, props.uid],
() => [props.search, props.isSearch],
async () => await searchAchi(),
);
watch(
() => [props.series, props.uid],
async () => await loadAchi(),
);
async function loadAchi(): Promise<void> {
if (props.search && props.search !== "") {
nameCard.value = undefined;
ncData.value = undefined;
achievements.value = await TSUserAchi.searchAchi(props.uid, props.search);
async function searchAchi(): Promise<void> {
if (!props.isSearch) return;
if (!props.search || props.search === "") {
showSnackbar.warn("请输入搜索内容");
emits("update:isSearch", false);
return;
}
nameCard.value = undefined;
ncData.value = undefined;
achievements.value = await TSUserAchi.searchAchi(props.uid, props.search);
if (achievements.value.length > 0) {
showSnackbar.success(`成功获取${achievements.value.length}条成就`);
}
emits("update:isSearch", false);
}
async function loadAchi(): Promise<void> {
achievements.value = await TSUserAchi.getAchievements(props.uid, props.series);
if (!selectedAchi.value && achievements.value.length > 0) {
selectedAchi.value = achievements.value[0];
Expand Down
2 changes: 1 addition & 1 deletion src/components/wiki/twc-character.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const box = computed(() => {
height: "128px",
display: "inner",
lt: `/icon/element/${data.value?.element}元素.webp`,
ltSize: "40px",
ltSize: "30px",
innerHeight: 30,
innerIcon: `/icon/weapon/${data.value?.weapon}.webp`,
innerText: data.value?.name,
Expand Down
3 changes: 3 additions & 0 deletions src/pages/common/Achievements.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
label="搜索"
:hide-details="true"
:single-line="true"
@keydown.enter="isSearch = true"
/>
</div>
</template>
Expand Down Expand Up @@ -46,6 +47,7 @@
:hideFin="hideFin"
v-model:series="selectedSeries"
v-model:search="search"
v-model:isSearch="isSearch"
/>
</div>
</template>
Expand Down Expand Up @@ -74,6 +76,7 @@ import {
} from "../../utils/UIAF.js";
const search = ref<string>("");
const isSearch = ref<boolean>(false);
const hideFin = ref<boolean>(false);
const uidList = ref<number[]>([]);
Expand Down

0 comments on commit be4e2c1

Please sign in to comment.