@foundbyte/uni-libs 1.0.2 → 1.0.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.
@@ -38,8 +38,7 @@ var GoodsService = class {
38
38
  page = `${routePrefix.hotel}/home/details/index?id=${hotelId}`;
39
39
  break;
40
40
  case EBusinessLine.Homestay:
41
- const homestayType = item?.homestay?.type || extInfo?.type || item?.common?.type || "";
42
- if (homestayType === EHotelType.hotel) {
41
+ if ((item?.homestay?.type || extInfo?.type || item?.common?.type || "") === EHotelType.hotel) {
43
42
  /** 酒店 (天下房仓酒店详情页) */
44
43
  const id = item?.homestay?.id || extInfo?.storeId || item?.common?.storeId || "";
45
44
  page = `${routePrefix.hotel}/home/details/index?id=${id}`;
@@ -16,13 +16,8 @@ const isAndroid = !userAgent.includes("miniprogram") && userAgent.includes("andr
16
16
  const isiOS = !userAgent.includes("miniprogram") && (userAgent.includes("iphone") || userAgent.includes("ipad"));
17
17
  let uni = {};
18
18
  async function loadWebview() {
19
- if (isIOSOrAndroid) {
20
- const res = await import("../../assets/js/webview/uni.webview.1.5.6.js");
21
- uni = res.default;
22
- } else {
23
- const res = await import("../../assets/js/webview/uni.webview.1.5.5.js");
24
- uni = res.default;
25
- }
19
+ if (isIOSOrAndroid) uni = (await import("../../assets/js/webview/uni.webview.1.5.6.js")).default;
20
+ else uni = (await import("../../assets/js/webview/uni.webview.1.5.5.js")).default;
26
21
  if (isAlipay) {
27
22
  const scriptTag = document.createElement("script");
28
23
  scriptTag.src = "https://appx/web-view.min.js";
@@ -107,6 +102,7 @@ const postMessage = (data) => {
107
102
  wx.miniProgram.postMessage({ data });
108
103
  my?.postMessage({ data });
109
104
  } catch (error) {
105
+ if (error?.message?.includes("my is not defined")) return;
110
106
  console.error(error);
111
107
  }
112
108
  };
@@ -115,7 +111,7 @@ const postMessage = (data) => {
115
111
  * @param data
116
112
  */
117
113
  const setShareParam = (data, businessType) => {
118
- const { shareUrl,...res } = data;
114
+ const { shareUrl, ...res } = data;
119
115
  const params = { data: {
120
116
  ...res,
121
117
  businessType,
@@ -140,11 +136,10 @@ const toPay = (data) => {
140
136
  });
141
137
  };
142
138
  function objectToQueryString(obj) {
143
- const params = Object.entries(obj).map(([key, value]) => {
139
+ return Object.entries(obj).map(([key, value]) => {
144
140
  if (Array.isArray(value)) return value.map((val) => `${encodeURI(key)}[]=${encodeURI(val)}`).join("&");
145
141
  return `${encodeURI(key)}=${encodeURI(value)}`;
146
- });
147
- return params.join("&");
142
+ }).join("&");
148
143
  }
149
144
 
150
145
  //#endregion
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.0.2",
5
+ "version": "1.0.3",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",