🐛 修复部分角色生日数据缺失

This commit is contained in:
目棃
2024-04-11 00:58:41 +08:00
parent 98541e1b49
commit d9cdea9670
3 changed files with 38 additions and 10 deletions

View File

@@ -4,13 +4,14 @@
<img src="/source/UI/empty.webp" alt="empty" />
<span>今天没有角色过生日哦~</span>
</div>
<div class="tcb-top-active" @click="toBirth(true)" v-else>
<img @click="toPost()" src="/source/UI/act_birthday.png" alt="empty" class="active" />
<div class="tcb-top-active" v-else>
<img @click="toBirth(true)" src="/source/UI/act_birthday.png" alt="empty" class="active" />
<span>今天是{{ cur.map((i) => i.name).join("、") }}的生日哦~</span>
<img v-for="i in cur" :key="i.role_id" class="tcb-cur" :alt="i.name" :src="i.head_icon" />
</div>
<div>即将到来{{ next[0].role_birthday }}</div>
<div v-for="i in next" :key="i.role_id" class="tcb-item">
<img :src="i.head_icon" :alt="i.name" @click="toBirth(i)" />
<img :src="i.head_icon" :alt="i.name" @click="toBirth(i)" :title="i.name" />
<div class="tcb-item-info">
<span>{{ i.name }} 所属{{ i.belong }}</span>
<span>{{ i.introduce }}</span>
@@ -38,10 +39,6 @@ onBeforeMount(async () => {
next.value = TSAvatarBirth.getNextAvatarBirth();
});
async function toPost() {
await router.push("/news/2");
}
function toBirth(type: TGApp.Archive.Birth.RoleItem | true) {
let dateStr;
if (type === true) {
@@ -52,6 +49,14 @@ function toBirth(type: TGApp.Archive.Birth.RoleItem | true) {
} else {
dateStr = type.role_birthday;
}
if (type != true) {
router.push({ name: "留影叙佳期", params: { date: dateStr } });
return;
}
if (cur.value.length > 0 && !cur.value[0].is_subscribe) {
router.push("/news/2/news");
return;
}
router.push({ name: "留影叙佳期", params: { date: dateStr } });
}
</script>
@@ -87,6 +92,14 @@ function toBirth(type: TGApp.Archive.Birth.RoleItem | true) {
cursor: pointer;
}
.tcb-top-active img.tcb-cur {
width: 50px;
height: 50px;
border-radius: 50%;
margin-left: 5px;
background: var(--common-shadow-1);
}
.tcb-item {
position: relative;
display: flex;

View File

@@ -79,7 +79,7 @@ type RawData = {
// 路由
const router = useRouter();
const gid = <string>useRoute().params.gid;
let type = <string | undefined>useRoute().params.type;
// loading
const loading = ref<boolean>(true);
const loadingTitle = ref<string>("正在加载");
@@ -120,6 +120,9 @@ const rawData = ref<RawData>({
onMounted(async () => {
await TGLogger.Info(`[News][${gid}][onMounted] 打开咨讯页面`);
const typeList = ["notice", "activity", "news"];
if (type != undefined) {
appStore.recentNewsType = type;
}
const curType = appStore.recentNewsType;
if (typeList.includes(curType)) {
tab.value = <NewsKey>curType;

View File

@@ -4,7 +4,7 @@
* @since Beta v0.4.6
*/
import { ArcBirCalendar, ArcBirRole } from "../../../data";
import { AppCharacterData, ArcBirCalendar, ArcBirRole } from "../../../data";
/**
* @description 判断今天是不是角色生日
@@ -16,7 +16,19 @@ function isAvatarBirth(): TGApp.Archive.Birth.CalendarItem[] {
const month = date.getMonth() + 1;
const day = date.getDate();
const days = ArcBirCalendar[month];
return days.filter((i) => i.role_birthday === `${month}/${day}`);
const find = days.filter((i) => i.role_birthday === `${month}/${day}`);
if (find.length > 0) return find.map((i) => (i.is_subscribe = true));
const find2 = AppCharacterData.filter((i) => i.birthday.toString() === [month, day].toString());
return find2.map(
(i) =>
<TGApp.Archive.Birth.CalendarItem>{
role_id: i.id,
name: i.name,
role_birthday: `${month}/${day}`,
head_icon: `/WIKI/character/${i.id}.webp`,
is_subscribe: false,
},
);
}
/**