@foundbyte/uni-libs 1.0.6 → 1.0.7
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/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +27 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +12 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +25 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js +13 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutPropertiesLoose.js +12 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +14 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +9 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +11 -0
- package/es/configs/app/app.hwtest.js +2 -4
- package/es/configs/app/app.prod.js +1 -3
- package/es/configs/app/index.js +13 -17
- package/es/constants/permission/index.js +1 -2
- package/es/constants/routes/index.d.ts +0 -2
- package/es/constants/routes/index.js +1 -3
- package/es/entry.js +8 -9
- package/es/enums/business-line/index.d.ts +64 -2
- package/es/enums/business-line/index.js +75 -44
- package/es/enums/environment/index.js +5 -6
- package/es/enums/platform/index.js +6 -7
- package/es/enums/sdk/index.js +5 -6
- package/es/enums/sub/enjoy/index.js +13 -14
- package/es/enums/sub/foods/index.js +8 -9
- package/es/enums/sub/hotel/index.js +4 -5
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -3
- package/es/services/goods/service.js +123 -107
- package/es/services/goods/type.d.ts +70 -70
- package/es/utils/common/index.js +3 -4
- package/es/utils/native-app/index.js +8 -10
- package/es/utils/pages/activity-calendar/index.js +1 -3
- package/es/utils/pages/food/index.js +1 -3
- package/es/utils/pages/movie/index.js +1 -3
- package/es/utils/pages/webview/index.js +1 -3
- package/es/utils/uni-env/index.d.ts +3 -53
- package/es/utils/uni-env/index.js +10 -62
- package/es/utils/web-view/index.js +45 -33
- package/package.json +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { query2url } from "../../common/index.js";
|
|
2
|
-
|
|
3
2
|
//#region src/utils/pages/food/index.ts
|
|
4
3
|
/**
|
|
5
4
|
* 店铺
|
|
@@ -29,6 +28,5 @@ const getFoodPackagePage = (domain, storeId, packageId, storePrecedentType) => {
|
|
|
29
28
|
storePrecedentType
|
|
30
29
|
}, { encode: false })}`;
|
|
31
30
|
};
|
|
32
|
-
|
|
33
31
|
//#endregion
|
|
34
|
-
export { getFoodPackagePage, getFoodStorePage };
|
|
32
|
+
export { getFoodPackagePage, getFoodStorePage };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { query2url } from "../../common/index.js";
|
|
2
|
-
|
|
3
2
|
//#region src/utils/pages/movie/index.ts
|
|
4
3
|
/**
|
|
5
4
|
* 电影票地址
|
|
@@ -10,6 +9,5 @@ const getMoviePage = (domain, movie_id) => {
|
|
|
10
9
|
movie_id
|
|
11
10
|
}, { encode: false })}`;
|
|
12
11
|
};
|
|
13
|
-
|
|
14
12
|
//#endregion
|
|
15
|
-
export { getMoviePage };
|
|
13
|
+
export { getMoviePage };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { routes } from "../../../constants/routes/index.js";
|
|
2
2
|
import { query2url } from "../../common/index.js";
|
|
3
|
-
|
|
4
3
|
//#region src/utils/pages/webview/index.ts
|
|
5
4
|
function getWebviewPage(params) {
|
|
6
5
|
return `${routes.webView}${query2url(params)}`;
|
|
7
6
|
}
|
|
8
|
-
|
|
9
7
|
//#endregion
|
|
10
|
-
export { getWebviewPage };
|
|
8
|
+
export { getWebviewPage };
|
|
@@ -1,61 +1,11 @@
|
|
|
1
1
|
//#region src/utils/uni-env/index.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* 是否是支付宝小程序
|
|
4
|
-
* @returns
|
|
5
|
-
*/
|
|
6
2
|
declare const isAlipayEnv: () => boolean;
|
|
7
|
-
/**
|
|
8
|
-
* 是否是web环境
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
3
|
declare const isH5Env: () => boolean;
|
|
12
|
-
/**
|
|
13
|
-
* 是否是微信小程序
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
4
|
declare const isWeixinEnv: () => boolean;
|
|
17
|
-
|
|
18
|
-
* 是否是鸿蒙
|
|
19
|
-
* @returns
|
|
20
|
-
*/
|
|
21
|
-
declare const isHarmonyEnv: () => boolean;
|
|
22
|
-
/**
|
|
23
|
-
* 是否是app
|
|
24
|
-
* @returns
|
|
25
|
-
*/
|
|
5
|
+
declare const isToutiaoEnv: () => boolean;
|
|
26
6
|
declare const isAppEnv: () => boolean;
|
|
27
|
-
|
|
28
|
-
* 是否是安卓
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
7
|
+
declare const isHarmonyEnv: () => boolean;
|
|
31
8
|
declare const isAndroidEnv: () => boolean;
|
|
32
|
-
/**
|
|
33
|
-
* 是否是iOS
|
|
34
|
-
* @returns
|
|
35
|
-
*/
|
|
36
9
|
declare const isiOSEnv: () => boolean;
|
|
37
|
-
declare function getSystemInfoSync(): UniApp.GetSystemInfoResult | {
|
|
38
|
-
pixelRatio: number;
|
|
39
|
-
screenWidth: number;
|
|
40
|
-
screenHeight: number;
|
|
41
|
-
windowWidth: number;
|
|
42
|
-
windowHeight: number;
|
|
43
|
-
statusBarHeight: number;
|
|
44
|
-
windowTop: number;
|
|
45
|
-
windowBottom: number;
|
|
46
|
-
safeArea: UniApp.SafeArea;
|
|
47
|
-
safeAreaInsets: UniApp.SafeAreaInsets;
|
|
48
|
-
screenTop: number;
|
|
49
|
-
deviceBrand?: string;
|
|
50
|
-
deviceModel: string;
|
|
51
|
-
deviceId: string;
|
|
52
|
-
deviceType: string;
|
|
53
|
-
devicePixelRatio: number;
|
|
54
|
-
deviceOrientation: "portrait" | "landscape";
|
|
55
|
-
brand?: string;
|
|
56
|
-
model: string;
|
|
57
|
-
system: string;
|
|
58
|
-
platform: string;
|
|
59
|
-
};
|
|
60
10
|
//#endregion
|
|
61
|
-
export {
|
|
11
|
+
export { isAlipayEnv, isAndroidEnv, isAppEnv, isH5Env, isHarmonyEnv, isToutiaoEnv, isWeixinEnv, isiOSEnv };
|
|
@@ -1,64 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { isAlipay, isAndroid, isApp, isH5, isHarmony, isToutiao, isWeixin, isiOS } from "@foundbyte/uni-hooks";
|
|
3
2
|
//#region src/utils/uni-env/index.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* 是否是web环境
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
const isH5Env = () => {
|
|
16
|
-
return true;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* 是否是微信小程序
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
|
-
const isWeixinEnv = () => {
|
|
23
|
-
return true;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* 是否是鸿蒙
|
|
27
|
-
* @returns
|
|
28
|
-
*/
|
|
29
|
-
const isHarmonyEnv = () => {
|
|
30
|
-
return true;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* 是否是app
|
|
34
|
-
* @returns
|
|
35
|
-
*/
|
|
36
|
-
const isAppEnv = () => {
|
|
37
|
-
if (isHarmonyEnv()) return true;
|
|
38
|
-
return true;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* 是否是安卓
|
|
42
|
-
* @returns
|
|
43
|
-
*/
|
|
44
|
-
const isAndroidEnv = () => {
|
|
45
|
-
if (isAppEnv() && getSystemInfoSync().platform === EUniPlatform.android) return true;
|
|
46
|
-
return false;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* 是否是iOS
|
|
50
|
-
* @returns
|
|
51
|
-
*/
|
|
52
|
-
const isiOSEnv = () => {
|
|
53
|
-
if (isAppEnv() && getSystemInfoSync().platform === EUniPlatform.ios) return true;
|
|
54
|
-
return false;
|
|
55
|
-
};
|
|
56
|
-
function getSystemInfoSync() {
|
|
57
|
-
return {
|
|
58
|
-
...uni.getDeviceInfo(),
|
|
59
|
-
...uni.getWindowInfo()
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
3
|
+
const isAlipayEnv = isAlipay;
|
|
4
|
+
const isH5Env = isH5;
|
|
5
|
+
const isWeixinEnv = isWeixin;
|
|
6
|
+
const isToutiaoEnv = isToutiao;
|
|
7
|
+
const isAppEnv = isApp;
|
|
8
|
+
const isHarmonyEnv = isHarmony;
|
|
9
|
+
const isAndroidEnv = isAndroid;
|
|
10
|
+
const isiOSEnv = isiOS;
|
|
63
11
|
//#endregion
|
|
64
|
-
export {
|
|
12
|
+
export { isAlipayEnv, isAndroidEnv, isAppEnv, isH5Env, isHarmonyEnv, isToutiaoEnv, isWeixinEnv, isiOSEnv };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
2
|
+
import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
|
|
3
|
+
import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
1
4
|
import wx from "weixin-js-sdk";
|
|
2
|
-
|
|
3
5
|
//#region src/utils/web-view/index.ts
|
|
6
|
+
const _excluded = ["shareUrl"];
|
|
4
7
|
const userAgent = navigator.userAgent.toLowerCase();
|
|
5
8
|
/** 判断是否是iOS还是安卓 */
|
|
6
9
|
const isIOSOrAndroid = !userAgent.includes("miniprogram") && (userAgent.includes("android") || userAgent.includes("iphone") || userAgent.includes("ipad"));
|
|
@@ -15,27 +18,33 @@ const isAndroid = !userAgent.includes("miniprogram") && userAgent.includes("andr
|
|
|
15
18
|
/** 判断是否苹果APP */
|
|
16
19
|
const isiOS = !userAgent.includes("miniprogram") && (userAgent.includes("iphone") || userAgent.includes("ipad"));
|
|
17
20
|
let uni = {};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
function loadWebview() {
|
|
22
|
+
return _loadWebview.apply(this, arguments);
|
|
23
|
+
}
|
|
24
|
+
function _loadWebview() {
|
|
25
|
+
_loadWebview = _asyncToGenerator(function* () {
|
|
26
|
+
if (isIOSOrAndroid) uni = (yield import("../../assets/js/webview/uni.webview.1.5.6.js")).default;
|
|
27
|
+
else uni = (yield import("../../assets/js/webview/uni.webview.1.5.5.js")).default;
|
|
28
|
+
if (isAlipay) {
|
|
29
|
+
const scriptTag = document.createElement("script");
|
|
30
|
+
scriptTag.src = "https://appx/web-view.min.js";
|
|
31
|
+
document.head.appendChild(scriptTag);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return _loadWebview.apply(this, arguments);
|
|
26
35
|
}
|
|
27
36
|
loadWebview();
|
|
28
37
|
document.addEventListener("UniAppJSBridgeReady", function() {
|
|
29
38
|
uni.webView.getEnv(function(_) {});
|
|
30
39
|
});
|
|
31
|
-
let EMessagesType = /* @__PURE__ */ function(EMessagesType
|
|
40
|
+
let EMessagesType = /* @__PURE__ */ function(EMessagesType) {
|
|
32
41
|
/** app直接调用分享 */
|
|
33
|
-
EMessagesType
|
|
42
|
+
EMessagesType["share"] = "share";
|
|
34
43
|
/** 设置分享参数 */
|
|
35
|
-
EMessagesType
|
|
44
|
+
EMessagesType["shareParam"] = "shareParam";
|
|
36
45
|
/** 去支付 */
|
|
37
|
-
EMessagesType
|
|
38
|
-
return EMessagesType
|
|
46
|
+
EMessagesType["pay"] = "pay";
|
|
47
|
+
return EMessagesType;
|
|
39
48
|
}({});
|
|
40
49
|
/**
|
|
41
50
|
* 原生路由跳转
|
|
@@ -45,10 +54,11 @@ const navigateTo = (parameters) => {
|
|
|
45
54
|
const { src, params } = parameters;
|
|
46
55
|
const url = `${src}${params ? `?${objectToQueryString(params)}` : ""}`;
|
|
47
56
|
try {
|
|
48
|
-
|
|
57
|
+
var _uni$webView, _uni$webView$navigate, _my;
|
|
58
|
+
uni === null || uni === void 0 || (_uni$webView = uni.webView) === null || _uni$webView === void 0 || (_uni$webView$navigate = _uni$webView.navigateTo) === null || _uni$webView$navigate === void 0 || _uni$webView$navigate.call(_uni$webView, { url });
|
|
49
59
|
/** 不兼容上面的方法会自动往下执行 */
|
|
50
|
-
wx.miniProgram.navigateTo({ url });
|
|
51
|
-
my
|
|
60
|
+
wx === null || wx === void 0 || wx.miniProgram.navigateTo({ url });
|
|
61
|
+
(_my = my) === null || _my === void 0 || _my.navigateTo({ url });
|
|
52
62
|
} catch (error) {
|
|
53
63
|
console.error(error);
|
|
54
64
|
}
|
|
@@ -61,10 +71,11 @@ const redirectTo = (parameters) => {
|
|
|
61
71
|
const { src, params } = parameters;
|
|
62
72
|
const url = `${src}${params ? `?${objectToQueryString(params)}` : ""}`;
|
|
63
73
|
try {
|
|
64
|
-
|
|
74
|
+
var _uni$webView2, _uni$webView2$redirec, _my2;
|
|
75
|
+
uni === null || uni === void 0 || (_uni$webView2 = uni.webView) === null || _uni$webView2 === void 0 || (_uni$webView2$redirec = _uni$webView2.redirectTo) === null || _uni$webView2$redirec === void 0 || _uni$webView2$redirec.call(_uni$webView2, { url });
|
|
65
76
|
/** 不兼容上面的方法会自动往下执行 */
|
|
66
|
-
wx.miniProgram.redirectTo({ url });
|
|
67
|
-
my
|
|
77
|
+
wx === null || wx === void 0 || wx.miniProgram.redirectTo({ url });
|
|
78
|
+
(_my2 = my) === null || _my2 === void 0 || _my2.redirectTo({ url });
|
|
68
79
|
} catch (error) {
|
|
69
80
|
console.error(error);
|
|
70
81
|
}
|
|
@@ -75,10 +86,11 @@ const redirectTo = (parameters) => {
|
|
|
75
86
|
*/
|
|
76
87
|
const navigateBack = (parameters) => {
|
|
77
88
|
try {
|
|
78
|
-
|
|
89
|
+
var _uni$webView3, _uni$webView3$navigat, _my3;
|
|
90
|
+
uni === null || uni === void 0 || (_uni$webView3 = uni.webView) === null || _uni$webView3 === void 0 || (_uni$webView3$navigat = _uni$webView3.navigateBack) === null || _uni$webView3$navigat === void 0 || _uni$webView3$navigat.call(_uni$webView3, parameters);
|
|
79
91
|
/** 不兼容上面的方法会自动往下执行 */
|
|
80
|
-
wx.miniProgram.navigateBack(parameters);
|
|
81
|
-
my
|
|
92
|
+
wx === null || wx === void 0 || wx.miniProgram.navigateBack(parameters);
|
|
93
|
+
(_my3 = my) === null || _my3 === void 0 || _my3.navigateBack(parameters);
|
|
82
94
|
} catch (error) {
|
|
83
95
|
console.error(error);
|
|
84
96
|
}
|
|
@@ -98,11 +110,13 @@ const postMessage = (data) => {
|
|
|
98
110
|
}
|
|
99
111
|
}
|
|
100
112
|
try {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
113
|
+
var _uni$webView4, _my4;
|
|
114
|
+
uni === null || uni === void 0 || (_uni$webView4 = uni.webView) === null || _uni$webView4 === void 0 || _uni$webView4.postMessage({ data });
|
|
115
|
+
wx === null || wx === void 0 || wx.miniProgram.postMessage({ data });
|
|
116
|
+
(_my4 = my) === null || _my4 === void 0 || _my4.postMessage({ data });
|
|
104
117
|
} catch (error) {
|
|
105
|
-
|
|
118
|
+
var _message;
|
|
119
|
+
if (error === null || error === void 0 || (_message = error.message) === null || _message === void 0 ? void 0 : _message.includes("my is not defined")) return;
|
|
106
120
|
console.error(error);
|
|
107
121
|
}
|
|
108
122
|
};
|
|
@@ -111,12 +125,11 @@ const postMessage = (data) => {
|
|
|
111
125
|
* @param data
|
|
112
126
|
*/
|
|
113
127
|
const setShareParam = (data, businessType) => {
|
|
114
|
-
const { shareUrl
|
|
115
|
-
const params = { data: {
|
|
116
|
-
...res,
|
|
128
|
+
const { shareUrl } = data;
|
|
129
|
+
const params = { data: _objectSpread2(_objectSpread2({}, _objectWithoutProperties(data, _excluded)), {}, {
|
|
117
130
|
businessType,
|
|
118
131
|
shareUrl: encodeURIComponent(shareUrl || "")
|
|
119
|
-
} };
|
|
132
|
+
}) };
|
|
120
133
|
postMessage({
|
|
121
134
|
type: EMessagesType.shareParam,
|
|
122
135
|
params
|
|
@@ -141,6 +154,5 @@ function objectToQueryString(obj) {
|
|
|
141
154
|
return `${encodeURI(key)}=${encodeURI(value)}`;
|
|
142
155
|
}).join("&");
|
|
143
156
|
}
|
|
144
|
-
|
|
145
157
|
//#endregion
|
|
146
|
-
export { EMessagesType, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay };
|
|
158
|
+
export { EMessagesType, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay };
|