qsh-webview-sdk 2.3.7 → 2.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -58,7 +58,7 @@ import qsh from 'qsh-webview-sdk';
58
58
 
59
59
  if(qsh.environment.isWeixinMiniProgram) {
60
60
  qsh.config({
61
- clientId: 'your-client-id',
61
+ clientId: 'your-client-id', // 注意区分生产和测试的clientId
62
62
  isProd: false
63
63
  })
64
64
  }
@@ -478,7 +478,7 @@ qsh.getLocation({
478
478
  // Promise 版本
479
479
  try {
480
480
  const location = await qsh.getLocationAsync({
481
- type: 'gcj02',
481
+ type: 'wgs84',
482
482
  altitude: true
483
483
  });
484
484
  console.log('位置:', location.latitude, location.longitude);
@@ -511,7 +511,7 @@ await qsh.openLocationAsync({
511
511
  ```
512
512
 
513
513
  #### 坐标类型
514
-
514
+ 目前定位相关接口仅支持wgs84
515
515
  | 类型 | 说明 | 常量 |
516
516
  |------|------|------|
517
517
  | `wgs84` | GPS 坐标 | `qsh.CoordinateTypes.WGS84` |
@@ -665,6 +665,40 @@ qsh.printPdf({
665
665
  - NVUE 页面
666
666
  - UVUE 页面 (UniApp X)
667
667
 
668
+ ### 跳转其他微信小程序
669
+
670
+ ```javascript
671
+ qsh.navigateToMiniProgram({
672
+ appid: ',
673
+ path: ',
674
+ // release/trial/develop
675
+ env: 'release',
676
+ success: (res) => console.log('跳转成功', res),
677
+ fail: (err) => console.error('跳转失败:', err),
678
+ });
679
+ ```
680
+
681
+ > `appid` 在微信小程序环境下传目标小程序 `AppID`,在 App-plus 环境下传微信小程序原始 ID。
682
+ > `env` 为可选参数,取值 `release` / `trial` / `develop`,不传时由基座按默认逻辑处理。
683
+ > 微信小程序 `web-view` 下,SDK 会先通过 `wx.miniProgram.postMessage` 把跳转请求投递给宿主,再调用 `wx.miniProgram.navigateBack` 触发宿主处理,因此当前 H5 页面会退出,且只能拿到“请求已投递”的结果,不能拿到宿主侧实时回调。
684
+
685
+ ### 在小程序中通过弹出层分享(仅小程序)
686
+
687
+ ```javascript
688
+ qsh.manualShare({
689
+ title: '分享标题',
690
+ h5Url: 'https://example.com/activity?id=123', // 要通过分享打开的h5页面地址
691
+ clientId: 'your-client-id', // 注意区分生产和测试的clientId
692
+ isPublic: false, // 默认false 分享打开的h5页面如果不需要登录权限可直接打开则传true
693
+ imageUrl: 'https://example.com/share.png',
694
+ description: '分享描述',
695
+ success: (res) => console.log('分享成功', res),
696
+ fail: (err) => console.error('分享失败:', err)
697
+ });
698
+ ```
699
+ 对于isPublic:true时 用户点击分享的内容后会直接从基座首页跳转到h5Url, 对于isPublic:false时,基座完成登录流程后会携带参数h5Url=encodeURIComponent${h5Url}跳转到配置的h5首页
700
+ 此方法会销毁当前H5页面并返回小程序基座,基座会将 h5Url 自动包装为小程序 webview 落地页
701
+
668
702
  ## License
669
703
 
670
704
  MIT
@@ -695,7 +729,7 @@ onMounted(async () => {
695
729
  // 小程序环境下要先进行签名
696
730
  if (qsh.environment.isWeixinMiniProgram) {
697
731
  qsh.config({
698
- clientId: '',
732
+ clientId: '', // 注意区分生产和测试的clientId
699
733
  isProd: import.meta.env.MODE === 'production'
700
734
  })
701
735
  }
package/dist/index.d.ts CHANGED
@@ -333,6 +333,22 @@ declare namespace UniWebView {
333
333
  complete?: () => void;
334
334
  }
335
335
 
336
+ interface ManualSharePayload {
337
+ title: string;
338
+ /** 分享后打开的 H5 地址,基座会自动包装为小程序 webview 页面 */
339
+ h5Url: string;
340
+ clientId: string;
341
+ isPublic?: boolean;
342
+ imageUrl?: string;
343
+ description?: string;
344
+ }
345
+
346
+ interface ManualShareOptions extends ManualSharePayload {
347
+ success?: (res: ShareResult) => void;
348
+ fail?: (error: any) => void;
349
+ complete?: (res?: ShareResult | any) => void;
350
+ }
351
+
336
352
  interface BluetoothOptions {
337
353
  success?: (res: any) => void;
338
354
  fail?: (error: any) => void;
@@ -397,8 +413,7 @@ declare namespace UniWebView {
397
413
  }
398
414
 
399
415
  /**
400
- * 人脸识别选项(仅支持微信小程序环境)
401
- * 只发送请求,不返回任何结果给调用者
416
+ * 人脸识别选项
402
417
  */
403
418
  interface FaceVerifyOptions {
404
419
  /** 姓名(必填) */
@@ -411,18 +426,20 @@ declare namespace UniWebView {
411
426
  * 人脸识别功能能力信息
412
427
  */
413
428
  interface FaceCapabilities {
414
- /** 是否支持人脸识别(仅微信小程序环境返回 true) */
429
+ /** 是否支持人脸识别 */
415
430
  supported: boolean;
416
431
  /** 当前环境类型 */
417
432
  environment: string;
418
- /** 底层实现类型,固定为 'weixin' */
419
- implementation: "weixin";
433
+ /** 底层实现类型 */
434
+ implementation: "weixin" | "uniapp";
420
435
  /** 功能特性 */
421
436
  features: {
422
437
  /** 支持 Promise */
423
438
  asyncSupport: boolean;
424
439
  /** 通过宿主页跳转实现 */
425
440
  hostPageNavigation?: boolean;
441
+ /** 通过宿主桥接实现 */
442
+ hostBridge?: boolean;
426
443
  };
427
444
  }
428
445
 
@@ -497,6 +514,12 @@ declare namespace UniWebView {
497
514
  options: Omit<ShareDirectedOptions, "success" | "fail" | "complete">,
498
515
  ): Promise<ShareResult>;
499
516
 
517
+ /** 手动分享预览:仅微信小程序 web-view,触发宿主分享弹窗 */
518
+ manualShare(options: ManualShareOptions): Promise<ShareResult> | void;
519
+ manualShareAsync(
520
+ options: Omit<ManualShareOptions, "success" | "fail" | "complete">,
521
+ ): Promise<ShareResult>;
522
+
500
523
  /** 蓝牙 API */
501
524
  openBluetoothAdapter(options?: BluetoothOptions): Promise<any> | void;
502
525
  openBluetoothAdapterAsync(options?: BluetoothOptions): Promise<any>;
@@ -521,8 +544,8 @@ declare namespace UniWebView {
521
544
  getPrintCapabilities(): PrintPdfCapabilities;
522
545
 
523
546
  /**
524
- * 人脸识别(仅支持微信小程序环境)
525
- * 通过 wx.miniProgram.navigateTo 跳转宿主 /pages/face/index,不返回任何结果给调用者
547
+ * 人脸识别(仅支持微信小程序和 UniApp 环境)
548
+ * 微信环境通过 wx.miniProgram.navigateTo 跳转宿主 /pages/face/index,UniApp 环境通过桥接调用宿主实现
526
549
  */
527
550
  faceVerify(options: FaceVerifyOptions): void;
528
551
  /** 获取人脸识别功能能力信息 */