@foundbyte/uni-libs 1.0.1 → 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";
@@ -102,16 +97,21 @@ const postMessage = (data) => {
102
97
  return;
103
98
  }
104
99
  }
105
- uni?.webView?.postMessage({ data });
106
- wx.miniProgram.postMessage({ data });
107
- my?.postMessage({ data });
100
+ try {
101
+ uni?.webView?.postMessage({ data });
102
+ wx.miniProgram.postMessage({ data });
103
+ my?.postMessage({ data });
104
+ } catch (error) {
105
+ if (error?.message?.includes("my is not defined")) return;
106
+ console.error(error);
107
+ }
108
108
  };
109
109
  /**
110
110
  * 设置页面分享信息
111
111
  * @param data
112
112
  */
113
113
  const setShareParam = (data, businessType) => {
114
- const { shareUrl,...res } = data;
114
+ const { shareUrl, ...res } = data;
115
115
  const params = { data: {
116
116
  ...res,
117
117
  businessType,
@@ -136,11 +136,10 @@ const toPay = (data) => {
136
136
  });
137
137
  };
138
138
  function objectToQueryString(obj) {
139
- const params = Object.entries(obj).map(([key, value]) => {
139
+ return Object.entries(obj).map(([key, value]) => {
140
140
  if (Array.isArray(value)) return value.map((val) => `${encodeURI(key)}[]=${encodeURI(val)}`).join("&");
141
141
  return `${encodeURI(key)}=${encodeURI(value)}`;
142
- });
143
- return params.join("&");
142
+ }).join("&");
144
143
  }
145
144
 
146
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.1",
5
+ "version": "1.0.3",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",