qsh-webview-sdk 2.2.1 → 2.3.0

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
@@ -460,7 +460,7 @@ qsh.scanCode({
460
460
  ```javascript
461
461
  // 回调方式
462
462
  qsh.getLocation({
463
- type: 'wgs84', // 坐标类型:wgs84(GPS), gcj02(国测局), bd09(百度)
463
+ type: 'wgs84', // 坐标类型:wgs84(GPS) 目前仅支持wgs84
464
464
  altitude: false, // 是否返回高度信息
465
465
  success: (res) => {
466
466
  console.log('纬度:', res.latitude);
@@ -558,19 +558,6 @@ qsh.stopLocationUpdate({
558
558
  });
559
559
  ```
560
560
 
561
- ### 相机功能
562
-
563
- ```javascript
564
- // 相机拍照(小程序/APP)
565
- qsh.takePhoto({
566
- quality: 'high', // 图片质量:low, normal, high
567
- sizeType: 'compressed', // 图片尺寸:original, compressed
568
- success: (res) => {
569
- console.log('照片路径:', res.tempImagePath);
570
- },
571
- fail: (err) => console.error(err)
572
- });
573
- ```
574
561
 
575
562
  ### 蓝牙功能(仅 APP)
576
563
 
@@ -601,26 +588,6 @@ qsh.createBLEConnection({
601
588
  });
602
589
  ```
603
590
 
604
- ### WiFi 功能(仅 APP)
605
-
606
- ```javascript
607
- // 获取 WiFi 信息
608
- qsh.getWifiInfo({
609
- success: (res) => {
610
- console.log('WiFi SSID:', res.wifi.SSID);
611
- console.log('WiFi BSSID:', res.wifi.BSSID);
612
- },
613
- fail: (err) => console.error(err)
614
- });
615
-
616
- // 连接 WiFi
617
- qsh.connectWifi({
618
- SSID: 'wifi-name',
619
- password: 'wifi-password',
620
- success: () => console.log('连接成功'),
621
- fail: (err) => console.error('连接失败:', err)
622
- });
623
- ```
624
591
 
625
592
  ### 微信分享(仅 APP)
626
593
 
@@ -652,10 +619,10 @@ qsh.chooseFile({
652
619
  });
653
620
  ```
654
621
 
655
- ### 地图选择位置
622
+ ### 地图选择位置(仅 APP)
656
623
 
657
624
  ```javascript
658
- // 打开地图选择位置(小程序/APP)
625
+ // 打开地图选择位置(APP)
659
626
  qsh.chooseLocation({
660
627
  latitude: 39.908823, // 初始纬度
661
628
  longitude: 116.397470, // 初始经度
@@ -682,18 +649,9 @@ qsh.faceVerify({
682
649
  ### 打印服务(仅 APP)
683
650
 
684
651
  ```javascript
685
- // 打印文本
686
- qsh.printText({
687
- content: '打印内容',
688
- printerName: '打印机名称',
689
- success: () => console.log('打印成功'),
690
- fail: (err) => console.error('打印失败:', err)
691
- });
692
-
693
- // 打印图片
694
- qsh.printImage({
695
- imagePath: '/path/to/image.jpg',
696
- printerName: '打印机名称',
652
+ // 调用打印服务
653
+ qsh.printPdf({
654
+ url: '', // pdf文件地址
697
655
  success: () => console.log('打印成功'),
698
656
  fail: (err) => console.error('打印失败:', err)
699
657
  });
@@ -734,7 +692,18 @@ import { onMounted } from 'vue';
734
692
  import qsh from 'qsh-webview-sdk';
735
693
 
736
694
  onMounted(async () => {
737
- await qsh.ready();
695
+ // 小程序环境下要先进行签名
696
+ if (qsh.environment.isWeixinMiniProgram) {
697
+ qsh.config({
698
+ clientId: '',
699
+ isProd: import.meta.env.MODE === 'production'
700
+ })
701
+ }
702
+
703
+ qsh.ready().catch((err) => {
704
+ console.error('qsh ready failed', err)
705
+ })
706
+
738
707
  qsh.navigateTo({ url: '/pages/demo/index' });
739
708
  });
740
709
  </script>
package/dist/index.d.ts CHANGED
@@ -43,6 +43,8 @@ declare namespace UniWebView {
43
43
  nvue?: boolean;
44
44
  /** 是否 UVUE 环境 */
45
45
  uvue?: boolean;
46
+ /** 是否离线包 WebView 环境 */
47
+ offline?: boolean;
46
48
  /** 是否 H5 环境 */
47
49
  h5?: boolean;
48
50
  }
@@ -199,8 +201,10 @@ declare namespace UniWebView {
199
201
  isUniApp: boolean;
200
202
  /** 是否 Html5Plus 环境 */
201
203
  isHtml5Plus: boolean;
204
+ /** 是否离线包 WebView 环境 */
205
+ isOfflineWebview: boolean;
202
206
  /** 环境类型 */
203
- type: "weixin" | "plus" | "nvue" | "uvue" | "UniApp" | "webview" | "h5";
207
+ type: "weixin" | "plus" | "nvue" | "uvue" | "UniApp" | "webview" | "h5" | "offline";
204
208
  }
205
209
 
206
210
  /**