@uxda/appkit 4.2.20 → 4.2.22

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/dist/index.js CHANGED
@@ -117,7 +117,7 @@ function requestPayment$2(json) {
117
117
  }
118
118
 
119
119
  function useSafeArea() {
120
- const systemInfo = Taro.getSystemInfoSync(), capsule = Taro.getMenuButtonBoundingClientRect();
120
+ const systemInfo = Taro.getEnv() === "WEAPP" ? Taro.getSystemInfoSync() : { statusBarHeight: 0, safeArea: { bottom: 0 }, screenHeight: 0 }, capsule = Taro.getEnv() === "WEAPP" ? Taro.getMenuButtonBoundingClientRect() : { top: 0, height: 0 };
121
121
  const status = systemInfo.statusBarHeight || 0, gap = capsule.top - status, nav = capsule.height + gap * 2, safeAreaBottom = (systemInfo.safeArea || {}).bottom || 0, bottom = systemInfo.screenHeight - safeAreaBottom;
122
122
  return {
123
123
  status,
@@ -344,6 +344,7 @@ const defaultLogOptions = {
344
344
  topic: "appkit",
345
345
  enable: true
346
346
  };
347
+ console.log(Taro.getEnv(), "Taro.getEnv");
347
348
  function generateUniqueId(pre) {
348
349
  return `${pre ? pre + "-" : ""}${Date.now().toString(16)}-${Math.random().toString(36).substr(2)}`;
349
350
  }
@@ -365,10 +366,10 @@ function useLogger(options) {
365
366
  const baseUrl = `https://${projectName}.cn-shenzhen.log.aliyuncs.com/logstores/${logStore}/track?APIVersion=${APIVersion}`;
366
367
  const alislsURL = topic ? `${baseUrl}&__topic__=${topic}` : baseUrl;
367
368
  const enable = options.enable === void 0 ? true : options.enable;
368
- const { miniProgram } = Taro.getAccountInfoSync();
369
+ const { miniProgram } = Taro.getEnv() === "WEAPP" ? Taro.getAccountInfoSync() : { miniProgram: { version: "" } };
369
370
  const systemInfo = JSON.stringify({
370
- ...Taro.getSystemInfoSync(),
371
- appVersion: miniProgram.version
371
+ ...Taro.getEnv() === "WEAPP" ? Taro.getSystemInfoSync() : {},
372
+ appVersion: miniProgram?.version
372
373
  }) || "\u672A\u77E5";
373
374
  function send(params) {
374
375
  if (!enable) return;
@@ -936,7 +937,7 @@ var script$E = /* @__PURE__ */ defineComponent({
936
937
  }, 100);
937
938
  onMounted(async () => {
938
939
  await getPropertieByCode();
939
- const systemInfo = Taro.getSystemInfoSync();
940
+ const systemInfo = Taro.getEnv() === "WEAPP" ? Taro.getSystemInfoSync() : { SDKVersion: "2.24.0" };
940
941
  const version = systemInfo.SDKVersion;
941
942
  function compareVersion(v1, v2) {
942
943
  const v1Arr = v1.split(".").map(Number);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "4.2.20",
3
+ "version": "4.2.22",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -1,11 +1,6 @@
1
1
  <template>
2
- <DdNoticeBar
3
- v-if="showAlert"
4
- showClose
5
- :style="topStype"
6
- @close="showAlert = !showAlert"
7
- text="您当前使用的微信客户端版本较低,可能不支持全部功能或体验效果可能不佳,建议至应用商店或App Store升级至最新版本。"
8
- />
2
+ <DdNoticeBar v-if="showAlert" showClose :style="topStype" @close="showAlert = !showAlert"
3
+ text="您当前使用的微信客户端版本较低,可能不支持全部功能或体验效果可能不佳,建议至应用商店或App Store升级至最新版本。" />
9
4
  </template>
10
5
 
11
6
  <script setup lang="ts">
@@ -41,7 +36,7 @@ const getPropertieByCode = debounce(async () => {
41
36
  onMounted(async () => {
42
37
  await getPropertieByCode()
43
38
 
44
- const systemInfo = Taro.getSystemInfoSync()
39
+ const systemInfo = Taro.getEnv() === 'WEAPP' ? Taro.getSystemInfoSync() : { SDKVersion: '2.24.0' }
45
40
  const version = systemInfo.SDKVersion
46
41
 
47
42
  // 版本号比较函数
@@ -23,6 +23,8 @@ const defaultLogOptions: LogType = {
23
23
  enable: true,
24
24
  }
25
25
 
26
+ console.log(Taro.getEnv(), 'Taro.getEnv')
27
+
26
28
  // 使用时间戳生成唯一标识
27
29
  export function generateUniqueId(pre?: string) {
28
30
  return `${pre ? pre + '-' : ''}${Date.now().toString(16)}-${Math.random().toString(36).substr(2)}`
@@ -49,11 +51,12 @@ export function useLogger(options?: LogType) {
49
51
  const alislsURL = topic ? `${baseUrl}&__topic__=${topic}` : baseUrl
50
52
  const enable = options.enable === undefined ? true : options.enable
51
53
 
52
- const { miniProgram } = Taro.getAccountInfoSync()
54
+ const { miniProgram } =
55
+ Taro.getEnv() === 'WEAPP' ? Taro.getAccountInfoSync() : { miniProgram: { version: '' } }
53
56
  const systemInfo =
54
57
  JSON.stringify({
55
- ...Taro.getSystemInfoSync(),
56
- appVersion: miniProgram.version,
58
+ ...(Taro.getEnv() === 'WEAPP' ? Taro.getSystemInfoSync() : {}),
59
+ appVersion: miniProgram?.version,
57
60
  }) || '未知'
58
61
 
59
62
  function send(params: Record<string, any>) {
@@ -24,8 +24,12 @@ export type SafeArea = {
24
24
  * @returns
25
25
  */
26
26
  export function useSafeArea(): SafeArea {
27
- const systemInfo = Taro.getSystemInfoSync(),
28
- capsule = Taro.getMenuButtonBoundingClientRect()
27
+ const systemInfo =
28
+ Taro.getEnv() === 'WEAPP'
29
+ ? Taro.getSystemInfoSync()
30
+ : { statusBarHeight: 0, safeArea: { bottom: 0 }, screenHeight: 0 },
31
+ capsule =
32
+ Taro.getEnv() === 'WEAPP' ? Taro.getMenuButtonBoundingClientRect() : { top: 0, height: 0 }
29
33
  /**
30
34
  * 状态条高度
31
35
  */