zane 1 month ago
parent
commit
4e70f2d6ff

+ 3 - 0
assets/resources/prefab/hall/HallTitleBar.ts

@@ -106,6 +106,9 @@ export class HallTitleBar extends BaseUI {
         break;
       case "btn_game_pass":
         let page = await Hall.ins.switchPage(Hall.PageShop);
+        if (!page) {
+          return;
+        }
         let shop = page.getComponent(PageShop);
         shop.switchTab(PageShop.TAB_GAME_PASS);
         if (UserM.ins.getGamePassCount() <= 0) {

+ 4 - 3
assets/resources/prefab/hall/PageShop.ts

@@ -139,15 +139,16 @@ export class PageShop extends BaseUI implements OnTabClickListener {
     scrollView.content.removeAllChildren();
     let gamePassItem = this.FindNode("GamePassItem");
 
-    let list = await ShopM.ins.getShopListByStoreId(1);
+    let shopGamePassId = 1;
+    let list = await ShopM.ins.getShopListByStoreId(shopGamePassId);
 
     for (let i = 0; i < list.length; i++) {
       let item = instantiate(gamePassItem);
       item.active = true;
       scrollView.content.addChild(item);
 
-      let c = ConfigM.ins.getShopListByStoreId(1)[i];
-      item.getComponent(GamePassItem).init(list[i], c);
+    
+      item.getComponent(GamePassItem).init(list[i]);
     }
   }
 

+ 5 - 2
assets/resources/prefab/item/GamePassItem.ts

@@ -8,7 +8,7 @@ import Utils from "../../scripts/utils/Utils";
 import { instantiate } from "cc";
 import UIUtils from "../../scripts/base/UIUtils";
 import { Vec3 } from "cc";
-import { ConfigShopItem } from "../../scripts/api/ConfigM";
+import ConfigM, { ConfigShopItem } from "../../scripts/api/ConfigM";
 
 const { ccclass, property } = _decorator;
 
@@ -48,7 +48,7 @@ export class GamePassItem extends BaseUI implements IPayListener {
     this.setTitles();
   }
   setTitles() {}
-  init(data: ShopDto,c:ConfigShopItem) {
+  init(data: ShopDto) {
     this._data = data;
     
     this.setText(
@@ -69,6 +69,9 @@ export class GamePassItem extends BaseUI implements IPayListener {
       "End Time:" + Utils.formattedOnlyDate(data.endTimeAt)
     );
 
+
+    let c = ConfigM.ins.getShopListByStoreId(1)[0];
+
     this.setText(
       "lbl_desc4",
       Utils.setI18nLabel(