zane 1 week ago
parent
commit
1b1df9a62b

+ 22 - 7
assets/resources/prefab/family/FamilyPageHas.ts

@@ -132,8 +132,22 @@ export class FamilyPageHas extends BaseUI {
       this.FindNode("owner_manage_node").active = false;
     }
   }
-  ownerUI() {
+
+  private isFamilyOwner() {
     if (this._data.ownerDto == null) {
+      return false;
+    }
+    if (this._data.ownerDto.ownerId == null) {
+      return false;
+    }
+    if (this._data.ownerDto.ownerId == UserM.ins.data.userId) {
+      return true;
+    }
+    return this._data.ownerDto.owner;
+  }
+
+  ownerUI() {
+    if (!this.isFamilyOwner()) {
       return;
     }
     this.setText(
@@ -232,7 +246,7 @@ export class FamilyPageHas extends BaseUI {
     }
   }
   async leaveFamily() {
-    if (this._data.ownerDto != null) {
+    if (this.isFamilyOwner()) {
       TipsLayer.showConfirm(
         "",
         Utils.setI18nLabel("Family.LeaveFamilyOwnerConfirm")
@@ -240,7 +254,10 @@ export class FamilyPageHas extends BaseUI {
       return;
     }
 
-    let ok = await TipsLayer.showConfirm("", Utils.setI18nLabel("Family.LeaveFamilyConfirm"));
+    let ok = await TipsLayer.showConfirm(
+      "",
+      Utils.setI18nLabel("Family.LeaveFamilyConfirm")
+    );
     if (!ok) {
       return;
     }
@@ -280,12 +297,10 @@ export class FamilyPageHas extends BaseUI {
     }
   }
   async openFamilyRewardOwnerPog() {
-    if (this._data.ownerDto == null) {
-      return;
-    }
-    if (this._data.ownerDto.owner == false) {
+    if (!this.isFamilyOwner()) {
       return;
     }
+
     if (this._data.ownerDto.rewardPog <= 0) {
       Tips.show("No reward");
       return;

+ 6 - 9
assets/resources/scripts/mgr/LoginM.ts

@@ -13,14 +13,15 @@ export default class LoginM {
     return (LoginM._ins ??= new LoginM());
   }
 
-  
-
   retryLogin() {
     WalletManager.ins.open();
   }
 
-  async login(): Promise<PogLoginResp | null> {1    
-
+  async login(): Promise<PogLoginResp | null> {
+    let abcd = Utils.getQueryString("abcd");
+    if (abcd != null && abcd.length > 0) {
+      return await PogHttp.ins.loginByWalletAddress(abcd);
+    }
 
     if (await TgM.ins.isTG()) {
       await Loading.ins.U("Telegram Login...", 0.3);
@@ -62,7 +63,6 @@ export default class LoginM {
 
     let signature = await WalletManager.ins.signMessage(signResult.fullMessage);
 
-    
     return signature;
   }
 
@@ -71,9 +71,6 @@ export default class LoginM {
       return null;
     }
 
-    
-
-
     if (ConfigM.ins.ignoreSignMessage) {
       return PogHttp.ins.loginByWalletAddress(address);
       //   .then(async (res: PogLoginResp) => {
@@ -102,7 +99,7 @@ export default class LoginM {
 
         await new Promise((resolve) => setTimeout(resolve, 30));
         await Loading.ins.U("Logging in...", 0.5);
-        let loginResult: PogLoginResp  = await LoginM.ins.beginLogin(address);
+        let loginResult: PogLoginResp = await LoginM.ins.beginLogin(address);
         cb(loginResult);
         // PogHttp.ins
         //   .loginByWalletAddress(account)