3860082966@qq.com 1 هفته پیش
والد
کامیت
39472d0cb1

+ 25 - 0
ios/App/App/Info.plist

@@ -61,5 +61,30 @@
 	<!-- 相册保存权限(可选) -->
 	<key>NSPhotoLibraryAddUsageDescription</key>
 	<string>我们需要保存照片到您的相册。</string>
+
+	<!-- 支付宝支付相关的URL Scheme -->
+	<key>CFBundleURLTypes</key>
+	<array>
+		<dict>
+			<key>CFBundleURLSchemes</key>
+			<array>
+				<string>alipay</string>
+			</array>
+		</dict>
+	</array>
+
+	<!-- Safari View Controller 相关权限 -->
+	<key>NSAppTransportSecurity</key>
+	<dict>
+		<key>NSAllowsArbitraryLoads</key>
+		<true/>
+	</dict>
+
+	<!-- 允许查询特定 URL Scheme -->
+	<key>LSApplicationQueriesSchemes</key>
+	<array>
+		<string>alipay</string>
+	</array>
+
 </dict>
 </plist>

+ 1 - 1
ios/App/Podfile.lock

@@ -57,7 +57,7 @@ SPEC CHECKSUMS:
   CapacitorHaptics: 4fc15afe22b123d093e6ace24d95e8e3b1f261b9
   CapacitorKeyboard: e89189ad398b815b6ff7e52271f0fb4f911a0a0a
   CapacitorStatusBar: 129c68650d3f950e080e8e7e03d69c3b361dbe52
-  CordovaPlugins: 086b0aba49af3593b83c9bd4b22d1421013294c4
+  CordovaPlugins: 461cc8b877ba9ff7ae0d1357ef9b827a991264e0
 
 PODFILE CHECKSUM: 531d09dd0af64bce06d29f414b83f2f566466951
 

+ 42 - 0
package-lock.json

@@ -25,6 +25,7 @@
         "@capacitor/ios": "^7.0.1",
         "@capacitor/keyboard": "^6.0.3",
         "@capacitor/status-bar": "^6.0.0",
+        "@ionic-native/safari-view-controller": "^5.36.0",
         "@ionic/angular": "^8.4.0",
         "@ionic/angular-server": "^8.4.0",
         "@ionic/angular-toolkit": "^11.0.1",
@@ -32,6 +33,7 @@
         "@ionic/core": "^8.4.0",
         "agora-extension-beauty-effect": "^1.0.2-beta",
         "cordova-android": "13.0.0",
+        "cordova-plugin-safariviewcontroller": "^2.0.0",
         "ionicons": "^7.4.0",
         "ngx-build-plus": "^18.0.0",
         "parse": "^5.3.0",
@@ -3112,6 +3114,30 @@
         "node": ">=18"
       }
     },
+    "node_modules/@ionic-native/core": {
+      "version": "5.36.0",
+      "resolved": "https://registry.npmjs.org/@ionic-native/core/-/core-5.36.0.tgz",
+      "integrity": "sha512-lOrkktadlKYbYf1LrDyAtsu1JnQ0oCCdkOU7iHQ8oXnNOkMwobFfD2m62F1CoOr0u9LIkpYnZSPjng8lZbmbNw==",
+      "peer": true,
+      "dependencies": {
+        "@types/cordova": "latest"
+      },
+      "peerDependencies": {
+        "rxjs": "^5.5.0 || ^6.5.0"
+      }
+    },
+    "node_modules/@ionic-native/safari-view-controller": {
+      "version": "5.36.0",
+      "resolved": "https://registry.npmjs.org/@ionic-native/safari-view-controller/-/safari-view-controller-5.36.0.tgz",
+      "integrity": "sha512-pvqnzro3bBZ0bQOMjBRKhmjHDaLKfDS75QY7uqe9UzjufMnHtBUUWgMvTuL7MsjTXRj8iRhe1wnUv8aBkz4SVA==",
+      "dependencies": {
+        "@types/cordova": "latest"
+      },
+      "peerDependencies": {
+        "@ionic-native/core": "^5.1.0",
+        "rxjs": "^5.5.0 || ^6.5.0"
+      }
+    },
     "node_modules/@ionic/angular": {
       "version": "8.4.1",
       "resolved": "https://registry.npmmirror.com/@ionic/angular/-/angular-8.4.1.tgz",
@@ -4724,6 +4750,11 @@
       "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==",
       "devOptional": true
     },
+    "node_modules/@types/cordova": {
+      "version": "11.0.3",
+      "resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-11.0.3.tgz",
+      "integrity": "sha512-kyuRQ40/NWQVhqGIHq78Ehu2Bf9Mlg0LhmSmis6ZFJK7z933FRfYi8tHe/k/0fB+PGfCf95rJC6TO7dopaFvAg=="
+    },
     "node_modules/@types/cors": {
       "version": "2.8.17",
       "resolved": "https://registry.npmmirror.com/@types/cors/-/cors-2.8.17.tgz",
@@ -6337,6 +6368,17 @@
         }
       }
     },
+    "node_modules/cordova-plugin-safariviewcontroller": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/cordova-plugin-safariviewcontroller/-/cordova-plugin-safariviewcontroller-2.0.0.tgz",
+      "integrity": "sha512-pYYM4hcS9YsS47N97HA5dIG7JAVrsCLaD/RLG/0rBfFuGVWQmu776TazPjrvZs3chZDYQTLPZGkx4othrig0AQ==",
+      "engines": [
+        {
+          "name": "cordova",
+          "version": ">=3.0.0"
+        }
+      ]
+    },
     "node_modules/cordova-plugin-statusbar": {
       "version": "2.4.2",
       "resolved": "https://registry.npmmirror.com/cordova-plugin-statusbar/-/cordova-plugin-statusbar-2.4.2.tgz",

+ 2 - 0
package.json

@@ -28,6 +28,7 @@
     "@capacitor/ios": "^7.0.1",
     "@capacitor/keyboard": "^6.0.3",
     "@capacitor/status-bar": "^6.0.0",
+    "@ionic-native/safari-view-controller": "^5.36.0",
     "@ionic/angular": "^8.4.0",
     "@ionic/angular-server": "^8.4.0",
     "@ionic/angular-toolkit": "^11.0.1",
@@ -35,6 +36,7 @@
     "@ionic/core": "^8.4.0",
     "agora-extension-beauty-effect": "^1.0.2-beta",
     "cordova-android": "13.0.0",
+    "cordova-plugin-safariviewcontroller": "^2.0.0",
     "ionicons": "^7.4.0",
     "ngx-build-plus": "^18.0.0",
     "parse": "^5.3.0",

+ 2 - 0
projects/live-app/src/app/app.component.ts

@@ -8,12 +8,14 @@ import { Router } from '@angular/router';
 import { addIcons } from 'ionicons';
 import * as icons from 'ionicons/icons';
 addIcons(icons)
+import { SafariViewController } from '@ionic-native/safari-view-controller/ngx';
 @Component({
   selector: 'app-root',
   standalone: true,
   imports: [IonApp, IonRouterOutlet],
   templateUrl: './app.component.html',
   styleUrl: './app.component.scss',
+  providers: [SafariViewController],
 })
 export class AppComponent implements OnInit {
   title = 'live-app';

+ 54 - 27
projects/live-app/src/app/components/pay-comp/pay-comp.component.ts

@@ -10,6 +10,8 @@ import {
   ToastController,
   LoadingController,
 } from '../../../modules/ionic-standalone.modules';
+import { DeviceService } from '../../../services/device.service';
+import { SafariViewController } from '@ionic-native/safari-view-controller/ngx';
 declare var wx: any;
 
 @Component({
@@ -37,7 +39,7 @@ export class PayCompComponent implements OnInit {
   user: Parse.Object = Parse.User.current()!;
   timer: any; //定时查询
   accountLog?: Parse.Object; // 充值记录
-  loading:any //等待
+  loading: any //等待
   constructor(
     private accServ: AccountService,
     private toastController: ToastController,
@@ -45,7 +47,9 @@ export class PayCompComponent implements OnInit {
     private http: HttpClient,
     private activRoute: ActivatedRoute,
     private loadingCtrl: LoadingController,
-  ) {}
+    private deviceSer: DeviceService,
+    private safariViewController: SafariViewController
+  ) { }
 
   ngOnInit() {
     this.activRoute.paramMap.subscribe((params) => {
@@ -58,6 +62,9 @@ export class PayCompComponent implements OnInit {
       }
     });
   }
+  ngOnDestroy(): void {
+    this.timer && clearInterval(this.timer);
+  }
   onchangPay(val: string) {
     this.checkpay = val;
     console.log(val);
@@ -185,7 +192,7 @@ export class PayCompComponent implements OnInit {
           {
             role: 'ok',
             text: '确认',
-            handler: () => {},
+            handler: () => { },
           },
         ],
       });
@@ -225,29 +232,48 @@ export class PayCompComponent implements OnInit {
     try {
       this.isDisabled = true;
       await this.getOrderId();
-      let data: any = await this.getAliPayUrl();
-      console.log(data);
-
-      const tempDiv = document.createElement('div');
-      tempDiv.innerHTML = data.pay_url; // 假设data.pay_url是完整的HTML字符串
-      const formElement = tempDiv.querySelector('form');
-      if (formElement) {
-        // 阻止默认行为,避免页面刷新
-        formElement.addEventListener('submit', (event) => {
-          event.preventDefault();
+      let htmlStringOrUrl: any = await this.getAliPayUrl();
+      console.log(htmlStringOrUrl);
+      if (this.deviceSer.isIOS) {
+        this.safariViewController.show({
+          url: htmlStringOrUrl,
+          hidden: false,
+          animated: true,
+          transition: 'curl'
+        }).subscribe((result: any) => {
+          if (result.event === 'opened') {
+            console.log('Opened');
+          } else if (result.event === 'loaded') {
+            console.log('Loaded');
+          } else if (result.event === 'closed') {
+            console.log('Closed');
+          }
+        }, (error: any) => {
+          console.log(error);
         });
-        // 添加隐藏的iframe来提交表单
-        const iframe = document.createElement('iframe');
-        iframe.style.display = 'none';
-        document.body.appendChild(iframe);
-        formElement.target = iframe.name;
-
-        document.body.appendChild(formElement);
-        formElement.submit();
-        document.body.removeChild(formElement); // 提交后移除表单元素
       } else {
-        console.error('未找到表单元素');
-        this.loading?.dismiss();
+        const tempDiv = document.createElement('div');
+        tempDiv.innerHTML = htmlStringOrUrl; // 假设htmlString是完整的HTML字符串
+        const formElement = tempDiv.querySelector('form');
+        if (formElement) {
+          // 阻止默认行为,避免页面刷新
+          formElement.addEventListener('submit', (event) => {
+            event.preventDefault();
+          });
+          // 添加隐藏的iframe来提交表单
+          const iframe = document.createElement('iframe');
+          iframe.style.display = 'none';
+          document.body.appendChild(iframe);
+          formElement.target = iframe.name;
+          console.log(formElement);
+
+          document.body.appendChild(formElement);
+          formElement.submit();
+          document.body.removeChild(formElement); // 提交后移除表单元素
+        } else {
+          console.error('未找到表单元素');
+          this.loading?.dismiss();
+        }
       }
 
       this.timer = setInterval(async () => {
@@ -286,7 +312,7 @@ export class PayCompComponent implements OnInit {
           {
             role: 'ok',
             text: '确认',
-            handler: () => {},
+            handler: () => { },
           },
         ],
       });
@@ -304,6 +330,7 @@ export class PayCompComponent implements OnInit {
         tradetype: 'wap',
         orderTitle: this.title,
         returnUrl: beforURL,
+        returnType: this.deviceSer.isIOS ? 'get' : 'post',
       };
       try {
         this.http
@@ -314,7 +341,7 @@ export class PayCompComponent implements OnInit {
               return;
             }
             if (res.data && res.data.pay_url) {
-              resolve(res.data);
+              resolve(res.data.pay_url);
             }
           });
       } catch (err) {
@@ -392,7 +419,7 @@ export class PayCompComponent implements OnInit {
             });
           }
         })
-        .catch((err) => {});
+        .catch((err) => { });
     }, 3000);
   }
 

+ 1 - 0
projects/live-app/src/modules/tabs/anthorhome/anthorhome.component.ts

@@ -316,6 +316,7 @@ export class AnthorhomeComponent implements OnInit {
 
   onChange(e: any) {
     // console.log(e.detail.value);
+    this.roomList = [];
     this.currentValue = e.detail.value;
     this.getRoom();
   }

+ 1 - 1
projects/live-app/src/modules/tabs/my/my.component.ts

@@ -27,7 +27,7 @@ export class MyComponent implements OnInit {
     private loadingCtrl: LoadingController,
     private modalController: ModalController,
     private alertController: AlertController,
-    public authServ: AuthService,
+    private authServ: AuthService,
     private toastController: ToastController,
     private activateRoute: ActivatedRoute,
     private router: Router,

+ 9 - 12
projects/live-app/src/modules/tabs/tabs/tabs.component.html

@@ -1,17 +1,14 @@
-<div class="tabs">
+<div [ngClass]="{
+  'tabs': true,
+  'pad-but-ios': deviceSer.isIOS
+}">
   @for (item of option; track $index) {
-  <div
-    class="buttom {{ $index == 99 ? 'center' : '' }}"
-    (click)="goTabPage($index, item.url)"
-  >
-    <img
-      class="icon-img {{ $index == 99 ? 'box-icon' : '' }}"
-      src="{{ $index == active ? item.active : item.src }}"
-      alt=""
-    />
+  <div class="buttom {{ $index == 99 ? 'center' : '' }}" (click)="goTabPage($index, item.url)">
+    <img class="icon-img {{ $index == 99 ? 'box-icon' : '' }}" src="{{ $index == active ? item.active : item.src }}"
+      alt="" />
     <ion-label [style.color]="active == $index ? '#FD7884' : '#808080'">{{
       item.name
-    }}</ion-label>
+      }}</ion-label>
   </div>
   }
 </div>
@@ -45,4 +42,4 @@
   </ion-tab-bar>
 </ion-tabs>
 
-<app-flutter-comp></app-flutter-comp>
+<app-flutter-comp></app-flutter-comp>

+ 4 - 0
projects/live-app/src/modules/tabs/tabs/tabs.component.scss

@@ -45,4 +45,8 @@
 }
 ion-tab-button{
   height: 0vw;
+}
+.pad-but-ios{
+  height: 72px !important;
+  padding-bottom: 20px;
 }

+ 4 - 1
projects/live-app/src/modules/tabs/tabs/tabs.component.ts

@@ -13,13 +13,15 @@ import { FlutterCompComponent } from '../../../app/components/flutter-comp/flutt
 
 import { Camera } from '@capacitor/camera';
 import { Filesystem } from '@capacitor/filesystem';
+import { DeviceService } from '../../../services/device.service';
+import { CommonModule } from '@angular/common';
 
 @Component({
   selector: 'live-tabs',
   templateUrl: 'tabs.component.html',
   styleUrls: ['tabs.component.scss'],
   standalone: true,
-  imports: [IonicModule, FlutterCompComponent],
+  imports: [IonicModule, FlutterCompComponent,CommonModule],
 })
 export class TabsComponent implements OnInit {
   @Input('tabsOption') tabsOption: any = {};
@@ -28,6 +30,7 @@ export class TabsComponent implements OnInit {
     private router: Router,
     // private alertController: AlertController,
     private activateRoute: ActivatedRoute,
+    public deviceSer: DeviceService
   ) // private connectTask: ConnectTaskService
   {
     this.activateRoute.paramMap.subscribe(async (params) => {

+ 1 - 1
projects/live-app/src/modules/user/anchor/anchor.component.scss

@@ -38,7 +38,7 @@
   width: 84vw;
   height: 13.333vw;
   display: flex;
-  align-items: flex-start;
+  align-items: center;
   justify-content: center;
   font-size: 3.5897vw;
   font-weight: 400;

+ 13 - 3
projects/live-app/src/services/auth.guard.ts

@@ -8,6 +8,7 @@ import { Observable } from 'rxjs';
 import { Router } from '@angular/router';
 import Parse from 'parse';
 import { AlertController } from '../modules/ionic-standalone.modules';
+import { AuthService } from './auth.service';
 
 @Injectable({
   providedIn: 'root',
@@ -17,8 +18,9 @@ export class AuthGuard implements CanActivate {
 
   constructor(
     public router: Router,
-    private alertController: AlertController
-  ) {}
+    private alertController: AlertController,
+    private authServ: AuthService,
+  ) { }
 
   canActivate(
     next: ActivatedRouteSnapshot,
@@ -37,7 +39,7 @@ export class AuthGuard implements CanActivate {
       return false;
     }
     let p = localStorage.getItem('profile');
-    let missPaths = ['/user/certification','tabs/home'];
+    let missPaths = ['/user/certification', 'tabs/home'];
     if (!missPaths.includes(url) && (!p || !JSON.parse(p)?.isCross)) {
       this.alertModal();
     }
@@ -50,6 +52,14 @@ export class AuthGuard implements CanActivate {
       message: '根据相关法律法规要求,请先完成实名',
       backdropDismiss: false,
       buttons: [
+        {
+          text: '退出',
+          role: 'cancel',
+          cssClass: 'secondary',
+          handler: (blah) => {
+            this.authServ.logout();
+          },
+        },
         {
           text: '去认证',
           handler: () => {