@foundbyte/uni-libs 1.1.1 → 1.1.3

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.
Files changed (37) hide show
  1. package/README.md +9 -0
  2. package/es/_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/asyncToGenerator.js +2 -1
  3. package/es/_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/defineProperty.js +3 -1
  4. package/es/_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/objectSpread2.js +3 -1
  5. package/es/_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/objectWithoutProperties.js +3 -1
  6. package/es/_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/objectWithoutPropertiesLoose.js +2 -1
  7. package/es/_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/toPrimitive.js +3 -1
  8. package/es/_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/toPropertyKey.js +3 -1
  9. package/es/_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/typeof.js +2 -1
  10. package/es/configs/app/app.hwtest.js +2 -1
  11. package/es/configs/app/app.prod.js +2 -1
  12. package/es/configs/app/index.js +4 -2
  13. package/es/constants/permission/index.js +2 -1
  14. package/es/constants/routes/index.js +2 -1
  15. package/es/entry.js +5 -3
  16. package/es/enums/business-line/index.d.ts +4 -1
  17. package/es/enums/business-line/index.js +6 -2
  18. package/es/enums/environment/index.js +2 -1
  19. package/es/enums/platform/index.js +2 -1
  20. package/es/enums/sdk/index.js +2 -1
  21. package/es/enums/sub/enjoy/index.js +2 -1
  22. package/es/enums/sub/foods/index.js +2 -1
  23. package/es/enums/sub/hotel/index.js +2 -1
  24. package/es/index.d.ts +2 -2
  25. package/es/index.js +3 -2
  26. package/es/services/goods/service.js +11 -9
  27. package/es/utils/common/index.js +2 -1
  28. package/es/utils/native-app/index.js +3 -1
  29. package/es/utils/obs/image.js +3 -1
  30. package/es/utils/pages/activity-calendar/index.js +3 -1
  31. package/es/utils/pages/food/index.js +3 -1
  32. package/es/utils/pages/movie/index.js +3 -1
  33. package/es/utils/pages/webview/index.js +3 -1
  34. package/es/utils/uni-env/index.js +3 -1
  35. package/es/utils/web-view/index.d.ts +6 -1
  36. package/es/utils/web-view/index.js +35 -1
  37. package/package.json +1 -1
package/README.md CHANGED
@@ -98,6 +98,15 @@ businessType: EBusinessLine.Foods
98
98
  )
99
99
  ```
100
100
 
101
+ ### downLoadFile
102
+ 下载文件
103
+ ```typescript
104
+ import { downLoadFile } from '@foundbyte/uni-libs'
105
+
106
+ // 传入要下载的文件链接
107
+ downLoadFile('https://xxx.pdf')
108
+ ```
109
+
101
110
  ### 环境判断
102
111
  ```typescript
103
112
  import { isAlipay, isWeixin, isHarmony, isAndroid, isiOS } from '@foundbyte/uni-libs'
@@ -23,5 +23,6 @@ function _asyncToGenerator(n) {
23
23
  });
24
24
  };
25
25
  }
26
+
26
27
  //#endregion
27
- export { _asyncToGenerator };
28
+ export { _asyncToGenerator };
@@ -1,4 +1,5 @@
1
1
  import { toPropertyKey } from "./toPropertyKey.js";
2
+
2
3
  //#region \0@oxc-project+runtime@0.135.0/helpers/esm/defineProperty.js
3
4
  function _defineProperty(e, r, t) {
4
5
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
@@ -8,5 +9,6 @@ function _defineProperty(e, r, t) {
8
9
  writable: !0
9
10
  }) : e[r] = t, e;
10
11
  }
12
+
11
13
  //#endregion
12
- export { _defineProperty };
14
+ export { _defineProperty };
@@ -1,4 +1,5 @@
1
1
  import { _defineProperty } from "./defineProperty.js";
2
+
2
3
  //#region \0@oxc-project+runtime@0.135.0/helpers/esm/objectSpread2.js
3
4
  function ownKeys(e, r) {
4
5
  var t = Object.keys(e);
@@ -21,5 +22,6 @@ function _objectSpread2(e) {
21
22
  }
22
23
  return e;
23
24
  }
25
+
24
26
  //#endregion
25
- export { _objectSpread2 };
27
+ export { _objectSpread2 };
@@ -1,4 +1,5 @@
1
1
  import { _objectWithoutPropertiesLoose } from "./objectWithoutPropertiesLoose.js";
2
+
2
3
  //#region \0@oxc-project+runtime@0.135.0/helpers/esm/objectWithoutProperties.js
3
4
  function _objectWithoutProperties(e, t) {
4
5
  if (null == e) return {};
@@ -9,5 +10,6 @@ function _objectWithoutProperties(e, t) {
9
10
  }
10
11
  return i;
11
12
  }
13
+
12
14
  //#endregion
13
- export { _objectWithoutProperties };
15
+ export { _objectWithoutProperties };
@@ -8,5 +8,6 @@ function _objectWithoutPropertiesLoose(r, e) {
8
8
  }
9
9
  return t;
10
10
  }
11
+
11
12
  //#endregion
12
- export { _objectWithoutPropertiesLoose };
13
+ export { _objectWithoutPropertiesLoose };
@@ -1,4 +1,5 @@
1
1
  import { _typeof } from "./typeof.js";
2
+
2
3
  //#region \0@oxc-project+runtime@0.135.0/helpers/esm/toPrimitive.js
3
4
  function toPrimitive(t, r) {
4
5
  if ("object" != _typeof(t) || !t) return t;
@@ -10,5 +11,6 @@ function toPrimitive(t, r) {
10
11
  }
11
12
  return ("string" === r ? String : Number)(t);
12
13
  }
14
+
13
15
  //#endregion
14
- export { toPrimitive };
16
+ export { toPrimitive };
@@ -1,9 +1,11 @@
1
1
  import { _typeof } from "./typeof.js";
2
2
  import { toPrimitive } from "./toPrimitive.js";
3
+
3
4
  //#region \0@oxc-project+runtime@0.135.0/helpers/esm/toPropertyKey.js
4
5
  function toPropertyKey(t) {
5
6
  var i = toPrimitive(t, "string");
6
7
  return "symbol" == _typeof(i) ? i : i + "";
7
8
  }
9
+
8
10
  //#endregion
9
- export { toPropertyKey };
11
+ export { toPropertyKey };
@@ -7,5 +7,6 @@ function _typeof(o) {
7
7
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
8
8
  }, _typeof(o);
9
9
  }
10
+
10
11
  //#endregion
11
- export { _typeof };
12
+ export { _typeof };
@@ -11,5 +11,6 @@ domain: {
11
11
  /** 电影票 */
12
12
  movie: "https://147gn9gm.life.mczjk.cn/#/"
13
13
  } };
14
+
14
15
  //#endregion
15
- export { config as default };
16
+ export { config as default };
@@ -11,5 +11,6 @@ domain: {
11
11
  /** 电影票 */
12
12
  movie: "https://147gn9gm.life.mczjk.cn/#/"
13
13
  } };
14
+
14
15
  //#endregion
15
- export { config as default };
16
+ export { config as default };
@@ -1,7 +1,8 @@
1
- import "../../enums/environment/index.js";
1
+ import { EAppEnv } from "../../enums/environment/index.js";
2
2
  import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/objectSpread2.js";
3
3
  import config from "./app.hwtest.js";
4
4
  import config$1 from "./app.prod.js";
5
+
5
6
  //#region src/configs/app/index.ts
6
7
  /**
7
8
  * 获取App配置信息
@@ -24,5 +25,6 @@ function getAppConfig(appEnv) {
24
25
  movie: ""
25
26
  } }, config$2);
26
27
  }
28
+
27
29
  //#endregion
28
- export { getAppConfig };
30
+ export { getAppConfig };
@@ -42,5 +42,6 @@ const app_permission = {
42
42
  denied: "获取相机/相册权限失败,请手动打开授权"
43
43
  }
44
44
  };
45
+
45
46
  //#endregion
46
- export { app_permission };
47
+ export { app_permission };
@@ -77,5 +77,6 @@ const routePrefix = Object.freeze({
77
77
  /** 智能行程 */
78
78
  smartRoute: "/sub/smart-route/pages"
79
79
  });
80
+
80
81
  //#endregion
81
- export { routePrefix, routes };
82
+ export { routePrefix, routes };
package/es/entry.js CHANGED
@@ -1,9 +1,10 @@
1
- import "./enums/environment/index.js";
2
- import "./enums/sdk/index.js";
1
+ import { EAppEnv } from "./enums/environment/index.js";
2
+ import { ECaller } from "./enums/sdk/index.js";
3
3
  import { _defineProperty } from "./_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/defineProperty.js";
4
4
  import { _objectSpread2 } from "./_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/objectSpread2.js";
5
5
  import { getAppConfig } from "./configs/app/index.js";
6
6
  import { GoodsService } from "./services/goods/service.js";
7
+
7
8
  //#region src/entry.ts
8
9
  /**
9
10
  * 一码游SDK
@@ -26,5 +27,6 @@ var OneTravelSDK = class {
26
27
  return getAppConfig(this.sdkConfig.appEnv);
27
28
  }
28
29
  };
30
+
29
31
  //#endregion
30
- export { OneTravelSDK };
32
+ export { OneTravelSDK };
@@ -3,8 +3,10 @@
3
3
  * 业务线
4
4
  */
5
5
  declare enum EBusinessLine {
6
- /** 景区/门票 */
6
+ /** 景区/门票(景区) */
7
7
  Scenic = 1,
8
+ /** 景区/门票(商品) */
9
+ ScenicGoods = 111,
8
10
  /** 酒店 */
9
11
  Hotel = 2,
10
12
  /** 民宿 */
@@ -103,6 +105,7 @@ declare enum EBusinessLine {
103
105
  */
104
106
  declare const BusinessLineDict: Readonly<{
105
107
  1: "景区";
108
+ 111: "景区/门票(商品)";
106
109
  2: "酒店";
107
110
  3: "民宿";
108
111
  "2,3": "酒店/民宿";
@@ -3,8 +3,10 @@
3
3
  * 业务线
4
4
  */
5
5
  let EBusinessLine = /* @__PURE__ */ function(EBusinessLine) {
6
- /** 景区/门票 */
6
+ /** 景区/门票(景区) */
7
7
  EBusinessLine[EBusinessLine["Scenic"] = 1] = "Scenic";
8
+ /** 景区/门票(商品) */
9
+ EBusinessLine[EBusinessLine["ScenicGoods"] = 111] = "ScenicGoods";
8
10
  /** 酒店 */
9
11
  EBusinessLine[EBusinessLine["Hotel"] = 2] = "Hotel";
10
12
  /** 民宿 */
@@ -104,6 +106,7 @@ let EBusinessLine = /* @__PURE__ */ function(EBusinessLine) {
104
106
  */
105
107
  const BusinessLineDict = Object.freeze({
106
108
  [1]: "景区",
109
+ [111]: "景区/门票(商品)",
107
110
  [2]: "酒店",
108
111
  [3]: "民宿",
109
112
  ["2,3"]: "酒店/民宿",
@@ -151,5 +154,6 @@ let ESubBizType = /* @__PURE__ */ function(ESubBizType) {
151
154
  ESubBizType[ESubBizType["EntertainmentVenue"] = 82] = "EntertainmentVenue";
152
155
  return ESubBizType;
153
156
  }({});
157
+
154
158
  //#endregion
155
- export { BusinessLineDict, EBusinessLine, ESubBizType };
159
+ export { BusinessLineDict, EBusinessLine, ESubBizType };
@@ -9,5 +9,6 @@ let EAppEnv = /* @__PURE__ */ function(EAppEnv) {
9
9
  EAppEnv["prod"] = "prod";
10
10
  return EAppEnv;
11
11
  }({});
12
+
12
13
  //#endregion
13
- export { EAppEnv };
14
+ export { EAppEnv };
@@ -5,5 +5,6 @@ let EUniPlatform = /* @__PURE__ */ function(EUniPlatform) {
5
5
  EUniPlatform["harmony"] = "harmony";
6
6
  return EUniPlatform;
7
7
  }({});
8
+
8
9
  //#endregion
9
- export { EUniPlatform };
10
+ export { EUniPlatform };
@@ -9,5 +9,6 @@ let ECaller = /* @__PURE__ */ function(ECaller) {
9
9
  ECaller["host"] = "host";
10
10
  return ECaller;
11
11
  }({});
12
+
12
13
  //#endregion
13
- export { ECaller };
14
+ export { ECaller };
@@ -22,5 +22,6 @@ let EVenueSimpleTypes = /* @__PURE__ */ function(EVenueSimpleTypes) {
22
22
  EVenueSimpleTypes["Movie"] = "4";
23
23
  return EVenueSimpleTypes;
24
24
  }({});
25
+
25
26
  //#endregion
26
- export { EVenueSimpleTypes, EVenueTypes };
27
+ export { EVenueSimpleTypes, EVenueTypes };
@@ -12,5 +12,6 @@ let EFoodPackageType = /* @__PURE__ */ function(EFoodPackageType) {
12
12
  EFoodPackageType[EFoodPackageType["Enjoy"] = 2] = "Enjoy";
13
13
  return EFoodPackageType;
14
14
  }({});
15
+
15
16
  //#endregion
16
- export { EFoodPackageType, EFoodsModuleType };
17
+ export { EFoodPackageType, EFoodsModuleType };
@@ -6,5 +6,6 @@ let EHotelType = /* @__PURE__ */ function(EHotelType) {
6
6
  EHotelType["hotel"] = "hotel";
7
7
  return EHotelType;
8
8
  }({});
9
+
9
10
  //#endregion
10
- export { EHotelType };
11
+ export { EHotelType };
package/es/index.d.ts CHANGED
@@ -13,9 +13,9 @@ import { ActivityCalendarDetailPageParams, getActivityCalendarDetailPage } from
13
13
  import { WebviewPageParams, getWebviewPage } from "./utils/pages/webview/index.js";
14
14
  import { getFoodPackagePage, getFoodStorePage } from "./utils/pages/food/index.js";
15
15
  import { getMoviePage } from "./utils/pages/movie/index.js";
16
- import { EMessagesType, IShareParam, getWebViewEnv, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay } from "./utils/web-view/index.js";
16
+ import { EMessagesType, IShareParam, downLoadFile, getWebViewEnv, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay } from "./utils/web-view/index.js";
17
17
  import { isAlipayEnv, isAndroidEnv, isAppEnv, isH5Env, isHarmonyEnv, isToutiaoEnv, isWeixinEnv, isiOSEnv } from "./utils/uni-env/index.js";
18
18
  import { checkAndRequestNativeAppPermission } from "./utils/native-app/index.js";
19
19
  import { CompressOptions, EObsSource, compressHuaweiObsImg, compressObsImg } from "./utils/obs/image.js";
20
20
  import { OneTravelSDK } from "./entry.js";
21
- export { ActivityCalendarDetailPageParams, BusinessLineDict, CompressOptions, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, EObsSource, ESubBizType, EUniPlatform, EVenueSimpleTypes, EVenueTypes, IOneTravelSDKConfig, IShareParam, OneTravelSDK, WebviewPageParams, app_permission, checkAndRequestNativeAppPermission, compressHuaweiObsImg, compressObsImg, getActivityCalendarDetailPage, getFoodPackagePage, getFoodStorePage, getMoviePage, getQueryParameters, getWebViewEnv, getWebviewPage, isAlipay, isAlipayEnv, isAndroid, isAndroidEnv, isAppEnv, isEmpty, isH5Env, isHarmony, isHarmonyEnv, isIOSOrAndroid, isToutiaoEnv, isWeixin, isWeixinEnv, isiOS, isiOSEnv, navigateBack, navigateTo, postMessage, query2url, redirectTo, routePrefix, routes, setShareParam, toPay };
21
+ export { ActivityCalendarDetailPageParams, BusinessLineDict, CompressOptions, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, EObsSource, ESubBizType, EUniPlatform, EVenueSimpleTypes, EVenueTypes, IOneTravelSDKConfig, IShareParam, OneTravelSDK, WebviewPageParams, app_permission, checkAndRequestNativeAppPermission, compressHuaweiObsImg, compressObsImg, downLoadFile, getActivityCalendarDetailPage, getFoodPackagePage, getFoodStorePage, getMoviePage, getQueryParameters, getWebViewEnv, getWebviewPage, isAlipay, isAlipayEnv, isAndroid, isAndroidEnv, isAppEnv, isEmpty, isH5Env, isHarmony, isHarmonyEnv, isIOSOrAndroid, isToutiaoEnv, isWeixin, isWeixinEnv, isiOS, isiOSEnv, navigateBack, navigateTo, postMessage, query2url, redirectTo, routePrefix, routes, setShareParam, toPay };
package/es/index.js CHANGED
@@ -12,9 +12,10 @@ import { getActivityCalendarDetailPage } from "./utils/pages/activity-calendar/i
12
12
  import { getWebviewPage } from "./utils/pages/webview/index.js";
13
13
  import { getFoodPackagePage, getFoodStorePage } from "./utils/pages/food/index.js";
14
14
  import { getMoviePage } from "./utils/pages/movie/index.js";
15
- import { EMessagesType, getWebViewEnv, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay } from "./utils/web-view/index.js";
15
+ import { EMessagesType, downLoadFile, getWebViewEnv, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay } from "./utils/web-view/index.js";
16
16
  import { isAlipayEnv, isAndroidEnv, isAppEnv, isH5Env, isHarmonyEnv, isToutiaoEnv, isWeixinEnv, isiOSEnv } from "./utils/uni-env/index.js";
17
17
  import { checkAndRequestNativeAppPermission } from "./utils/native-app/index.js";
18
18
  import { EObsSource, compressHuaweiObsImg, compressObsImg } from "./utils/obs/image.js";
19
19
  import { OneTravelSDK } from "./entry.js";
20
- export { BusinessLineDict, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, EObsSource, ESubBizType, EUniPlatform, EVenueSimpleTypes, EVenueTypes, OneTravelSDK, app_permission, checkAndRequestNativeAppPermission, compressHuaweiObsImg, compressObsImg, getActivityCalendarDetailPage, getFoodPackagePage, getFoodStorePage, getMoviePage, getQueryParameters, getWebViewEnv, getWebviewPage, isAlipay, isAlipayEnv, isAndroid, isAndroidEnv, isAppEnv, isEmpty, isH5Env, isHarmony, isHarmonyEnv, isIOSOrAndroid, isToutiaoEnv, isWeixin, isWeixinEnv, isiOS, isiOSEnv, navigateBack, navigateTo, postMessage, query2url, redirectTo, routePrefix, routes, setShareParam, toPay };
20
+
21
+ export { BusinessLineDict, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, EObsSource, ESubBizType, EUniPlatform, EVenueSimpleTypes, EVenueTypes, OneTravelSDK, app_permission, checkAndRequestNativeAppPermission, compressHuaweiObsImg, compressObsImg, downLoadFile, getActivityCalendarDetailPage, getFoodPackagePage, getFoodStorePage, getMoviePage, getQueryParameters, getWebViewEnv, getWebviewPage, isAlipay, isAlipayEnv, isAndroid, isAndroidEnv, isAppEnv, isEmpty, isH5Env, isHarmony, isHarmonyEnv, isIOSOrAndroid, isToutiaoEnv, isWeixin, isWeixinEnv, isiOS, isiOSEnv, navigateBack, navigateTo, postMessage, query2url, redirectTo, routePrefix, routes, setShareParam, toPay };
@@ -1,15 +1,16 @@
1
1
  import { routePrefix } from "../../constants/routes/index.js";
2
- import "../../enums/business-line/index.js";
3
- import "../../enums/sdk/index.js";
4
- import "../../enums/sub/enjoy/index.js";
5
- import "../../enums/sub/foods/index.js";
6
- import "../../enums/sub/hotel/index.js";
2
+ import { EBusinessLine, ESubBizType } from "../../enums/business-line/index.js";
3
+ import { ECaller } from "../../enums/sdk/index.js";
4
+ import { EVenueSimpleTypes } from "../../enums/sub/enjoy/index.js";
5
+ import { EFoodsModuleType } from "../../enums/sub/foods/index.js";
6
+ import { EHotelType } from "../../enums/sub/hotel/index.js";
7
7
  import { getWebviewPage } from "../../utils/pages/webview/index.js";
8
8
  import { getFoodPackagePage, getFoodStorePage } from "../../utils/pages/food/index.js";
9
9
  import { getMoviePage } from "../../utils/pages/movie/index.js";
10
10
  import { _defineProperty } from "../../_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/defineProperty.js";
11
11
  import { navigateTo } from "../../utils/web-view/index.js";
12
12
  import { getAppConfig } from "../../configs/app/index.js";
13
+
13
14
  //#region src/services/goods/service.ts
14
15
  var GoodsService = class {
15
16
  constructor(config) {
@@ -56,8 +57,8 @@ var GoodsService = class {
56
57
  const subBizType = (item === null || item === void 0 || (_item$homestay3 = item.homestay) === null || _item$homestay3 === void 0 ? void 0 : _item$homestay3.subBizType) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.subBizType);
57
58
  const id = (item === null || item === void 0 || (_item$homestay4 = item.homestay) === null || _item$homestay4 === void 0 ? void 0 : _item$homestay4.id) || (item === null || item === void 0 || (_item$common12 = item.common) === null || _item$common12 === void 0 ? void 0 : _item$common12.spuId) || (item === null || item === void 0 || (_item$common13 = item.common) === null || _item$common13 === void 0 ? void 0 : _item$common13.id) || "";
58
59
  /** 民宿 */
59
- if (`${subBizType}` === `32`) page = `${routePrefix.hotel}/home/details/index?id=${id}`;
60
- else if (`${subBizType}` === `31`) page = `${routePrefix.hotel}/home/hot-sale-details/index?id=${id}`;
60
+ if (`${subBizType}` === `${32}`) page = `${routePrefix.hotel}/home/details/index?id=${id}`;
61
+ else if (`${subBizType}` === `${31}`) page = `${routePrefix.hotel}/home/hot-sale-details/index?id=${id}`;
61
62
  else page = `${routePrefix.hotel}/home/pms-details/index?id=${id}`;
62
63
  }
63
64
  break;
@@ -108,7 +109,7 @@ var GoodsService = class {
108
109
  const entertainmentSubBizType = (item === null || item === void 0 || (_item$entertainment3 = item.entertainment) === null || _item$entertainment3 === void 0 ? void 0 : _item$entertainment3.subBizType) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.subBizType);
109
110
  const entertainmentType = (item === null || item === void 0 || (_item$entertainment4 = item.entertainment) === null || _item$entertainment4 === void 0 ? void 0 : _item$entertainment4.type) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.type) || (item === null || item === void 0 || (_item$common29 = item.common) === null || _item$common29 === void 0 ? void 0 : _item$common29.type);
110
111
  const entertainmentReservationId = (item === null || item === void 0 || (_item$entertainment5 = item.entertainment) === null || _item$entertainment5 === void 0 ? void 0 : _item$entertainment5.reservationId) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.reservationId) || (item === null || item === void 0 || (_item$common30 = item.common) === null || _item$common30 === void 0 ? void 0 : _item$common30.reservationId);
111
- if (`${entertainmentType}` === "3" || `${entertainmentSubBizType}` === `81`) page = `${routePrefix.enjoy}/g-activity/detail?id=` + entertainmentId + "&mchId=" + entertainmentStoreId;
112
+ if (`${entertainmentType}` === "3" || `${entertainmentSubBizType}` === `${81}`) page = `${routePrefix.enjoy}/g-activity/detail?id=` + entertainmentId + "&mchId=" + entertainmentStoreId;
112
113
  else page = `${routePrefix.enjoy}/g-venue/detail?id=${entertainmentId}&reservationId=${entertainmentReservationId}`;
113
114
  break;
114
115
  /** 电影 */
@@ -151,5 +152,6 @@ var GoodsService = class {
151
152
  this.goodsServiceConfig = config;
152
153
  }
153
154
  };
155
+
154
156
  //#endregion
155
- export { GoodsService };
157
+ export { GoodsService };
@@ -40,5 +40,6 @@ function getQueryParameters(url) {
40
40
  }
41
41
  return params;
42
42
  }
43
+
43
44
  //#endregion
44
- export { getQueryParameters, isEmpty, query2url };
45
+ export { getQueryParameters, isEmpty, query2url };
@@ -1,5 +1,6 @@
1
1
  import { app_permission } from "../../constants/permission/index.js";
2
2
  import { isH5Env, isHarmonyEnv, isWeixinEnv, isiOSEnv } from "../uni-env/index.js";
3
+
3
4
  //#region src/utils/native-app/index.ts
4
5
  let plusNativeObjView;
5
6
  /**
@@ -109,5 +110,6 @@ const checkAndRequestNativeAppPermission = (options) => {
109
110
  fail === null || fail === void 0 || fail();
110
111
  });
111
112
  };
113
+
112
114
  //#endregion
113
- export { checkAndRequestNativeAppPermission };
115
+ export { checkAndRequestNativeAppPermission };
@@ -1,4 +1,5 @@
1
1
  import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/objectSpread2.js";
2
+
2
3
  //#region src/utils/obs/image.ts
3
4
  let EObsSource = /* @__PURE__ */ function(EObsSource) {
4
5
  /** 华为 */
@@ -105,5 +106,6 @@ function compressObsImg(url, opts) {
105
106
  default: return compressTencentObsImg(url, opts);
106
107
  }
107
108
  }
109
+
108
110
  //#endregion
109
- export { EObsSource, compressHuaweiObsImg, compressObsImg };
111
+ export { EObsSource, compressHuaweiObsImg, compressObsImg };
@@ -1,9 +1,11 @@
1
1
  import { routePrefix } from "../../../constants/routes/index.js";
2
2
  import { query2url } from "../../common/index.js";
3
+
3
4
  //#region src/utils/pages/activity-calendar/index.ts
4
5
  const rootPage = routePrefix.activityCalendar;
5
6
  function getActivityCalendarDetailPage(params) {
6
7
  return `${rootPage}/detail/index${query2url(params, { encode: false })}`;
7
8
  }
9
+
8
10
  //#endregion
9
- export { getActivityCalendarDetailPage };
11
+ export { getActivityCalendarDetailPage };
@@ -1,4 +1,5 @@
1
1
  import { query2url } from "../../common/index.js";
2
+
2
3
  //#region src/utils/pages/food/index.ts
3
4
  /**
4
5
  * 店铺
@@ -28,5 +29,6 @@ const getFoodPackagePage = (domain, storeId, packageId, storePrecedentType) => {
28
29
  storePrecedentType
29
30
  }, { encode: false })}`;
30
31
  };
32
+
31
33
  //#endregion
32
- export { getFoodPackagePage, getFoodStorePage };
34
+ export { getFoodPackagePage, getFoodStorePage };
@@ -1,4 +1,5 @@
1
1
  import { query2url } from "../../common/index.js";
2
+
2
3
  //#region src/utils/pages/movie/index.ts
3
4
  /**
4
5
  * 电影票地址
@@ -9,5 +10,6 @@ const getMoviePage = (domain, movie_id) => {
9
10
  movie_id
10
11
  }, { encode: false })}`;
11
12
  };
13
+
12
14
  //#endregion
13
- export { getMoviePage };
15
+ export { getMoviePage };
@@ -1,8 +1,10 @@
1
1
  import { routes } from "../../../constants/routes/index.js";
2
2
  import { query2url } from "../../common/index.js";
3
+
3
4
  //#region src/utils/pages/webview/index.ts
4
5
  function getWebviewPage(params) {
5
6
  return `${routes.webView}${query2url(params)}`;
6
7
  }
8
+
7
9
  //#endregion
8
- export { getWebviewPage };
10
+ export { getWebviewPage };
@@ -1,4 +1,5 @@
1
1
  import { isAlipay, isAndroid, isApp, isH5, isHarmony, isToutiao, isWeixin, isiOS } from "@foundbyte/uni-hooks";
2
+
2
3
  //#region src/utils/uni-env/index.ts
3
4
  const isAlipayEnv = isAlipay;
4
5
  const isH5Env = isH5;
@@ -8,5 +9,6 @@ const isAppEnv = isApp;
8
9
  const isHarmonyEnv = isHarmony;
9
10
  const isAndroidEnv = isAndroid;
10
11
  const isiOSEnv = isiOS;
12
+
11
13
  //#endregion
12
- export { isAlipayEnv, isAndroidEnv, isAppEnv, isH5Env, isHarmonyEnv, isToutiaoEnv, isWeixinEnv, isiOSEnv };
14
+ export { isAlipayEnv, isAndroidEnv, isAppEnv, isH5Env, isHarmonyEnv, isToutiaoEnv, isWeixinEnv, isiOSEnv };
@@ -80,5 +80,10 @@ declare const toPay: (data: {
80
80
  cashStageUrl: string;
81
81
  orderNo: string;
82
82
  }) => void;
83
+ /**
84
+ * 下载文件
85
+ * @param url
86
+ */
87
+ declare const downLoadFile: (url: string) => void;
83
88
  //#endregion
84
- export { EMessagesType, IShareParam, getWebViewEnv, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay };
89
+ export { EMessagesType, IShareParam, downLoadFile, getWebViewEnv, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay };
@@ -2,8 +2,12 @@ import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.135.0/
2
2
  import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/objectWithoutProperties.js";
3
3
  import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/objectSpread2.js";
4
4
  import wx from "weixin-js-sdk";
5
+
5
6
  //#region src/utils/web-view/index.ts
7
+ //! #ifdef WEB
6
8
  const _excluded = ["shareUrl"];
9
+ //! #endif
10
+ //! #ifdef WEB
7
11
  const userAgent = navigator.userAgent.toLowerCase();
8
12
  /** 判断是否是iOS还是安卓 */
9
13
  const isIOSOrAndroid = !userAgent.includes("miniprogram") && (userAgent.includes("android") || userAgent.includes("iphone") || userAgent.includes("ipad"));
@@ -38,6 +42,7 @@ function _loadWebview() {
38
42
  return _loadWebview.apply(this, arguments);
39
43
  }
40
44
  loadWebview();
45
+ //! #endif
41
46
  let env = {};
42
47
  document.addEventListener("UniAppJSBridgeReady", function() {
43
48
  uni.webView.getEnv(function(res) {
@@ -156,11 +161,40 @@ const toPay = (data) => {
156
161
  }
157
162
  });
158
163
  };
164
+ /**
165
+ * 下载文件
166
+ * @param url
167
+ */
168
+ const downLoadFile = (url) => {
169
+ if (isWeixin || isAlipay) navigateTo({
170
+ src: "/pages/web-view/download-file/index",
171
+ params: { url }
172
+ });
173
+ else {
174
+ const fileName = url.split("/").pop() || "download";
175
+ if (isiOS) {
176
+ var _appBridge;
177
+ if ((_appBridge = window.appBridge) === null || _appBridge === void 0 ? void 0 : _appBridge.downloadFile) window.appBridge.downloadFile({
178
+ url,
179
+ fileName
180
+ });
181
+ else window.open(url, "_blank");
182
+ } else {
183
+ const link = document.createElement("a");
184
+ link.href = url;
185
+ link.download = fileName;
186
+ document.body.appendChild(link);
187
+ link.click();
188
+ document.body.removeChild(link);
189
+ }
190
+ }
191
+ };
159
192
  function objectToQueryString(obj) {
160
193
  return Object.entries(obj).map(([key, value]) => {
161
194
  if (Array.isArray(value)) return value.map((val) => `${encodeURI(key)}[]=${encodeURI(val)}`).join("&");
162
195
  return `${encodeURI(key)}=${encodeURI(value)}`;
163
196
  }).join("&");
164
197
  }
198
+
165
199
  //#endregion
166
- export { EMessagesType, getWebViewEnv, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay };
200
+ export { EMessagesType, downLoadFile, getWebViewEnv, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@foundbyte/uni-libs",
3
3
  "description": "FoundByte Uni Libs",
4
4
  "author": "yangshuai <704807396@qq.com>",
5
- "version": "1.1.1",
5
+ "version": "1.1.3",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",