优化popup,增加更多的游戏开发工具

This commit is contained in:
xu_yanfeng
2025-02-07 14:10:46 +08:00
parent d2800bc24a
commit e331c51dc3
5 changed files with 153 additions and 26 deletions

View File

@@ -34,7 +34,7 @@ export default defineComponent({
console.log(`not find any ad`);
return;
}
ads.value = data.data;
ads.value = data.data.filter((item) => item.valid);
console.log("get ads ", toRaw(ads.value));
ga(GA_EventName.ShowAd);

View File

@@ -12,7 +12,7 @@ export class AdItem {
/**
* 插件的试用地址
*/
try: string = "";
try: string | Array<{ name: string; url: string }> = "";
/**
* 广告的store购买链接
*/
@@ -29,6 +29,14 @@ export class AdItem {
* 背景图
*/
img: string = "";
getTryInfos(): Array<{ name: string; url: string }> {
if (typeof this.try === "string" && this.try) {
return [{ name: this.name, url: this.try }];
} else if (Array.isArray(this.try)) {
return this.try;
}
return [];
}
parse(data: AdItem) {
this.name = data.name;
this.store = data.store || "";
@@ -95,10 +103,6 @@ export class AdData {
console.warn(`add failed, ad.duration is ${item.duration}, ${JSON.stringify(item)}`);
return;
}
if (!item.valid) {
console.warn(`add failed, ad is invalid, ${JSON.stringify(item)}`);
return;
}
this.data.push(item);
});
}