@foundbyte/uni-libs 1.0.4 → 1.0.6
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/configs/app/app.hwtest.js +1 -1
- package/es/configs/app/index.js +9 -7
- package/es/entry.js +6 -7
- package/es/services/goods/service.js +104 -127
- package/es/services/goods/type.d.ts +70 -70
- package/es/utils/common/index.js +1 -1
- package/es/utils/native-app/index.js +7 -7
- package/es/utils/uni-env/index.js +4 -2
- package/es/utils/web-view/index.js +25 -39
- package/package.json +3 -2
- package/es/_virtual/_@oxc-project_runtime@0.103.0/helpers/asyncToGenerator.js +0 -28
- package/es/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.js +0 -14
- package/es/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.js +0 -27
- package/es/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectWithoutProperties.js +0 -15
- package/es/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectWithoutPropertiesLoose.js +0 -13
- package/es/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.js +0 -16
- package/es/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.js +0 -11
- package/es/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.js +0 -12
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const config = { domain: {
|
|
3
3
|
shopping: "https://shopping-h5.onetravelgz.cn/#/",
|
|
4
4
|
food: "https://food-h5.onetravelgz.cn/#/",
|
|
5
|
-
onebuygz: "https://testb2ch5-travel.gcongo.cn/#/",
|
|
5
|
+
onebuygz: "https://testb2ch5-travel.gcongo.com.cn/#/",
|
|
6
6
|
movie: "https://147gn9gm.life.mczjk.cn/#/"
|
|
7
7
|
} };
|
|
8
8
|
var app_hwtest_default = config;
|
package/es/configs/app/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { EAppEnv } from "../../enums/environment/index.js";
|
|
2
|
-
import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.js";
|
|
3
2
|
import app_hwtest_default from "./app.hwtest.js";
|
|
4
3
|
import app_prod_default from "./app.prod.js";
|
|
5
4
|
|
|
@@ -18,12 +17,15 @@ function getAppConfig(appEnv) {
|
|
|
18
17
|
config = app_prod_default;
|
|
19
18
|
break;
|
|
20
19
|
}
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
return {
|
|
21
|
+
domain: {
|
|
22
|
+
shopping: "",
|
|
23
|
+
food: "",
|
|
24
|
+
onebuygz: "",
|
|
25
|
+
movie: ""
|
|
26
|
+
},
|
|
27
|
+
...config
|
|
28
|
+
};
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
//#endregion
|
package/es/entry.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { EAppEnv } from "./enums/environment/index.js";
|
|
2
2
|
import { ECaller } from "./enums/sdk/index.js";
|
|
3
|
-
import { _defineProperty } from "./_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.js";
|
|
4
|
-
import { _objectSpread2 } from "./_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.js";
|
|
5
3
|
import { getAppConfig } from "./configs/app/index.js";
|
|
6
4
|
import { GoodsService } from "./services/goods/service.js";
|
|
7
5
|
|
|
@@ -10,13 +8,14 @@ import { GoodsService } from "./services/goods/service.js";
|
|
|
10
8
|
* 一码游SDK
|
|
11
9
|
*/
|
|
12
10
|
var OneTravelSDK = class {
|
|
11
|
+
sdkConfig;
|
|
12
|
+
goodsService;
|
|
13
13
|
constructor(config) {
|
|
14
|
-
|
|
15
|
-
_defineProperty(this, "goodsService", void 0);
|
|
16
|
-
const value = _objectSpread2(_objectSpread2({}, {
|
|
14
|
+
const value = {
|
|
17
15
|
appEnv: EAppEnv.prod,
|
|
18
|
-
caller: ECaller.web
|
|
19
|
-
|
|
16
|
+
caller: ECaller.web,
|
|
17
|
+
...config || {}
|
|
18
|
+
};
|
|
20
19
|
this.sdkConfig = value;
|
|
21
20
|
this.goodsService = new GoodsService({ sdkConfig: value });
|
|
22
21
|
}
|
|
@@ -7,141 +7,118 @@ 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
|
-
import { _defineProperty } from "../../_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.js";
|
|
11
10
|
import { navigateTo } from "../../utils/web-view/index.js";
|
|
12
11
|
import { getAppConfig } from "../../configs/app/index.js";
|
|
13
12
|
|
|
14
13
|
//#region src/services/goods/service.ts
|
|
15
14
|
var GoodsService = class {
|
|
15
|
+
goodsServiceConfig;
|
|
16
16
|
constructor(config) {
|
|
17
|
-
_defineProperty(this, "goodsServiceConfig", void 0);
|
|
18
|
-
_defineProperty(
|
|
19
|
-
this,
|
|
20
|
-
/**
|
|
21
|
-
* 跳转商品详情页面
|
|
22
|
-
* @param item 商品数据
|
|
23
|
-
*/
|
|
24
|
-
"jumpToProductDetailPage",
|
|
25
|
-
(item) => {
|
|
26
|
-
var _item$common, _item$common2, _item$common3, _item$common4, _item$common5;
|
|
27
|
-
const configOptions = this.goodsServiceConfig.sdkConfig;
|
|
28
|
-
const appConfig = getAppConfig(configOptions.appEnv);
|
|
29
|
-
let page = "";
|
|
30
|
-
const businessLine = (item === null || item === void 0 ? void 0 : item.businessLine) || (item === null || item === void 0 || (_item$common = item.common) === null || _item$common === void 0 ? void 0 : _item$common.bizType) || (item === null || item === void 0 || (_item$common2 = item.common) === null || _item$common2 === void 0 ? void 0 : _item$common2.linkBusinessLine) || (item === null || item === void 0 || (_item$common3 = item.common) === null || _item$common3 === void 0 ? void 0 : _item$common3.businessType);
|
|
31
|
-
const extInfo = (item === null || item === void 0 || (_item$common4 = item.common) === null || _item$common4 === void 0 ? void 0 : _item$common4.extInfoMap) || (item === null || item === void 0 || (_item$common5 = item.common) === null || _item$common5 === void 0 ? void 0 : _item$common5.extInfo);
|
|
32
|
-
switch (businessLine) {
|
|
33
|
-
case EBusinessLine.Scenic:
|
|
34
|
-
var _item$scenic, _item$common6, _item$common7, _item$scenic2, _item$common8, _item$scenic3;
|
|
35
|
-
const scenicId = (item === null || item === void 0 || (_item$scenic = item.scenic) === null || _item$scenic === void 0 ? void 0 : _item$scenic.id) || (item === null || item === void 0 || (_item$common6 = item.common) === null || _item$common6 === void 0 ? void 0 : _item$common6.spuId) || (item === null || item === void 0 || (_item$common7 = item.common) === null || _item$common7 === void 0 ? void 0 : _item$common7.id) || "";
|
|
36
|
-
const scenicReservationId = (item === null || item === void 0 || (_item$scenic2 = item.scenic) === null || _item$scenic2 === void 0 ? void 0 : _item$scenic2.reservationId) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.reservationId) || (item === null || item === void 0 || (_item$common8 = item.common) === null || _item$common8 === void 0 ? void 0 : _item$common8.reservationId) || "";
|
|
37
|
-
const scenicIsOld = (item === null || item === void 0 || (_item$scenic3 = item.scenic) === null || _item$scenic3 === void 0 ? void 0 : _item$scenic3.isOld) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.isOld);
|
|
38
|
-
page = `${routePrefix.ticket}/detail/index?scenicId=${scenicId}&reservationId=${scenicReservationId}&isOld=${scenicIsOld}`;
|
|
39
|
-
break;
|
|
40
|
-
case EBusinessLine.Hotel:
|
|
41
|
-
var _item$hotel, _item$common9;
|
|
42
|
-
const hotelId = (item === null || item === void 0 || (_item$hotel = item.hotel) === null || _item$hotel === void 0 ? void 0 : _item$hotel.id) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.storeId) || (item === null || item === void 0 || (_item$common9 = item.common) === null || _item$common9 === void 0 ? void 0 : _item$common9.storeId) || "";
|
|
43
|
-
page = `${routePrefix.hotel}/home/details/index?id=${hotelId}`;
|
|
44
|
-
break;
|
|
45
|
-
case EBusinessLine.Homestay:
|
|
46
|
-
var _item$homestay, _item$common10;
|
|
47
|
-
if (((item === null || item === void 0 || (_item$homestay = item.homestay) === null || _item$homestay === void 0 ? void 0 : _item$homestay.type) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.type) || (item === null || item === void 0 || (_item$common10 = item.common) === null || _item$common10 === void 0 ? void 0 : _item$common10.type) || "") === EHotelType.hotel) {
|
|
48
|
-
var _item$homestay2, _item$common11;
|
|
49
|
-
/** 酒店 (天下房仓酒店详情页) */
|
|
50
|
-
const id = (item === null || item === void 0 || (_item$homestay2 = item.homestay) === null || _item$homestay2 === void 0 ? void 0 : _item$homestay2.id) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.storeId) || (item === null || item === void 0 || (_item$common11 = item.common) === null || _item$common11 === void 0 ? void 0 : _item$common11.storeId) || "";
|
|
51
|
-
page = `${routePrefix.hotel}/home/details/index?id=${id}`;
|
|
52
|
-
} else {
|
|
53
|
-
var _item$homestay3, _item$homestay4, _item$common12, _item$common13;
|
|
54
|
-
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);
|
|
55
|
-
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) || "";
|
|
56
|
-
/** 民宿 */
|
|
57
|
-
if (`${subBizType}` === `${ESubBizType.HomestayHotel}`) page = `${routePrefix.hotel}/home/details/index?id=${id}`;
|
|
58
|
-
else if (`${subBizType}` === `${ESubBizType.HomestayHot}`) page = `${routePrefix.hotel}/home/hot-sale-details/index?id=${id}`;
|
|
59
|
-
else page = `${routePrefix.hotel}/home/pms-details/index?id=${id}`;
|
|
60
|
-
}
|
|
61
|
-
break;
|
|
62
|
-
case EBusinessLine.Route:
|
|
63
|
-
var _item$route, _item$common14, _item$common15;
|
|
64
|
-
const routeId = (item === null || item === void 0 || (_item$route = item.route) === null || _item$route === void 0 ? void 0 : _item$route.id) || (item === null || item === void 0 || (_item$common14 = item.common) === null || _item$common14 === void 0 ? void 0 : _item$common14.spuId) || (item === null || item === void 0 || (_item$common15 = item.common) === null || _item$common15 === void 0 ? void 0 : _item$common15.id);
|
|
65
|
-
page = `${routePrefix.road}/product-detail/index?id=${routeId}`;
|
|
66
|
-
break;
|
|
67
|
-
case EBusinessLine.Travel:
|
|
68
|
-
var _item$travel, _item$common16, _item$common17;
|
|
69
|
-
const travelId = (item === null || item === void 0 || (_item$travel = item.travel) === null || _item$travel === void 0 ? void 0 : _item$travel.id) || (item === null || item === void 0 || (_item$common16 = item.common) === null || _item$common16 === void 0 ? void 0 : _item$common16.spuId) || (item === null || item === void 0 || (_item$common17 = item.common) === null || _item$common17 === void 0 ? void 0 : _item$common17.id);
|
|
70
|
-
page = `${routePrefix.travel}/charter/detail?routeId=${travelId}`;
|
|
71
|
-
break;
|
|
72
|
-
case EBusinessLine.Buy:
|
|
73
|
-
var _item$buy, _item$common18, _item$common19;
|
|
74
|
-
const buySpuId = (item === null || item === void 0 || (_item$buy = item.buy) === null || _item$buy === void 0 ? void 0 : _item$buy.spuId) || (item === null || item === void 0 || (_item$common18 = item.common) === null || _item$common18 === void 0 ? void 0 : _item$common18.spuId) || (item === null || item === void 0 || (_item$common19 = item.common) === null || _item$common19 === void 0 ? void 0 : _item$common19.id);
|
|
75
|
-
page = getWebviewPage({ url: appConfig.domain.shopping + `goods?itemId=${buySpuId}` });
|
|
76
|
-
break;
|
|
77
|
-
case EBusinessLine.Onebuygz:
|
|
78
|
-
var _item$onebuygz, _item$common20, _item$common21, _item$onebuygz2, _item$common22;
|
|
79
|
-
const onebuySpuId = (item === null || item === void 0 || (_item$onebuygz = item.onebuygz) === null || _item$onebuygz === void 0 ? void 0 : _item$onebuygz.spuId) || (item === null || item === void 0 || (_item$common20 = item.common) === null || _item$common20 === void 0 ? void 0 : _item$common20.spuId) || (item === null || item === void 0 || (_item$common21 = item.common) === null || _item$common21 === void 0 ? void 0 : _item$common21.id);
|
|
80
|
-
const onebuySkuId = (item === null || item === void 0 || (_item$onebuygz2 = item.onebuygz) === null || _item$onebuygz2 === void 0 ? void 0 : _item$onebuygz2.skuId) || (item === null || item === void 0 || (_item$common22 = item.common) === null || _item$common22 === void 0 ? void 0 : _item$common22.skuId);
|
|
81
|
-
page = getWebviewPage({ url: appConfig.domain.onebuygz + `pages/commodity-detail/index?itemId=${onebuySpuId}&skuId=${onebuySkuId}` });
|
|
82
|
-
break;
|
|
83
|
-
case EBusinessLine.Foods:
|
|
84
|
-
var _item$food, _item$food2, _item$common23, _item$food3, _item$common24, _item$common25, _item$food4;
|
|
85
|
-
const moduleType = (item === null || item === void 0 || (_item$food = item.food) === null || _item$food === void 0 ? void 0 : _item$food.moduleType) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.moduleType);
|
|
86
|
-
const storeId = (item === null || item === void 0 || (_item$food2 = item.food) === null || _item$food2 === void 0 ? void 0 : _item$food2.storeId) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.storeId) || (item === null || item === void 0 || (_item$common23 = item.common) === null || _item$common23 === void 0 ? void 0 : _item$common23.storeId) || "";
|
|
87
|
-
const spuId = (item === null || item === void 0 || (_item$food3 = item.food) === null || _item$food3 === void 0 ? void 0 : _item$food3.spuId) || (item === null || item === void 0 || (_item$common24 = item.common) === null || _item$common24 === void 0 ? void 0 : _item$common24.spuId) || (item === null || item === void 0 || (_item$common25 = item.common) === null || _item$common25 === void 0 ? void 0 : _item$common25.id) || "";
|
|
88
|
-
const storePrecedentType = (item === null || item === void 0 || (_item$food4 = item.food) === null || _item$food4 === void 0 ? void 0 : _item$food4.storePrecedentType) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.storePrecedentType) || void 0;
|
|
89
|
-
if (moduleType === EFoodsModuleType.store)
|
|
90
|
-
/** 收藏跳店铺 */
|
|
91
|
-
page = getWebviewPage({ url: getFoodStorePage(appConfig.domain.food, storeId) });
|
|
92
|
-
else
|
|
93
|
-
/** 跳转套餐 */
|
|
94
|
-
page = getWebviewPage({ url: getFoodPackagePage(appConfig.domain.food, storeId, spuId, storePrecedentType) });
|
|
95
|
-
break;
|
|
96
|
-
case EBusinessLine.Entertainment:
|
|
97
|
-
var _item$entertainment, _item$common26, _item$common27, _item$entertainment2, _item$common28, _item$entertainment3, _item$entertainment4, _item$common29, _item$entertainment5, _item$common30;
|
|
98
|
-
const entertainmentId = (item === null || item === void 0 || (_item$entertainment = item.entertainment) === null || _item$entertainment === void 0 ? void 0 : _item$entertainment.id) || (item === null || item === void 0 || (_item$common26 = item.common) === null || _item$common26 === void 0 ? void 0 : _item$common26.spuId) || (item === null || item === void 0 || (_item$common27 = item.common) === null || _item$common27 === void 0 ? void 0 : _item$common27.id);
|
|
99
|
-
const entertainmentStoreId = (item === null || item === void 0 || (_item$entertainment2 = item.entertainment) === null || _item$entertainment2 === void 0 ? void 0 : _item$entertainment2.storeId) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.storeId) || (item === null || item === void 0 || (_item$common28 = item.common) === null || _item$common28 === void 0 ? void 0 : _item$common28.storeId) || "";
|
|
100
|
-
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);
|
|
101
|
-
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);
|
|
102
|
-
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);
|
|
103
|
-
if (`${entertainmentType}` === EVenueSimpleTypes.Activity || `${entertainmentSubBizType}` === `${ESubBizType.EntertainmentPerform}`) page = `${routePrefix.enjoy}/g-activity/detail?id=` + entertainmentId + "&mchId=" + entertainmentStoreId;
|
|
104
|
-
else page = `${routePrefix.enjoy}/g-venue/detail?id=${entertainmentId}&reservationId=${entertainmentReservationId}`;
|
|
105
|
-
break;
|
|
106
|
-
case EBusinessLine.Movie:
|
|
107
|
-
var _item$movie;
|
|
108
|
-
let movieId = (item === null || item === void 0 || (_item$movie = item.movie) === null || _item$movie === void 0 ? void 0 : _item$movie.id) || "";
|
|
109
|
-
try {
|
|
110
|
-
var _JSON$parse;
|
|
111
|
-
movieId = ((_JSON$parse = JSON.parse((extInfo === null || extInfo === void 0 ? void 0 : extInfo.extInfo) || "{}")) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse.thirdMovieId) || "";
|
|
112
|
-
} catch (_unused) {}
|
|
113
|
-
page = getMoviePage(appConfig.domain.movie, movieId);
|
|
114
|
-
break;
|
|
115
|
-
case EBusinessLine.Strategy:
|
|
116
|
-
var _item$strategy, _item$common31, _item$common32;
|
|
117
|
-
const strategyId = (item === null || item === void 0 || (_item$strategy = item.strategy) === null || _item$strategy === void 0 ? void 0 : _item$strategy.id) || (item === null || item === void 0 || (_item$common31 = item.common) === null || _item$common31 === void 0 ? void 0 : _item$common31.spuId) || (item === null || item === void 0 || (_item$common32 = item.common) === null || _item$common32 === void 0 ? void 0 : _item$common32.id);
|
|
118
|
-
page = `${routePrefix.strategy}/strategy-detail/index?id=` + strategyId;
|
|
119
|
-
break;
|
|
120
|
-
case EBusinessLine.Recommend:
|
|
121
|
-
var _item$recommend, _item$common33, _item$common34, _item$recommend2;
|
|
122
|
-
const recommendId = (item === null || item === void 0 || (_item$recommend = item.recommend) === null || _item$recommend === void 0 ? void 0 : _item$recommend.id) || (item === null || item === void 0 || (_item$common33 = item.common) === null || _item$common33 === void 0 ? void 0 : _item$common33.spuId) || (item === null || item === void 0 || (_item$common34 = item.common) === null || _item$common34 === void 0 ? void 0 : _item$common34.id);
|
|
123
|
-
const recommendMoreParameter = (item === null || item === void 0 || (_item$recommend2 = item.recommend) === null || _item$recommend2 === void 0 ? void 0 : _item$recommend2.moreParameter) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.moreParameter) || "";
|
|
124
|
-
page = `${routePrefix.show}/details/index?id=${recommendId}${recommendMoreParameter}`;
|
|
125
|
-
break;
|
|
126
|
-
case EBusinessLine.SoundGuizhou:
|
|
127
|
-
var _item$soundGuizhou, _item$common35, _item$common36;
|
|
128
|
-
const soundGuizhouId = (item === null || item === void 0 || (_item$soundGuizhou = item.soundGuizhou) === null || _item$soundGuizhou === void 0 ? void 0 : _item$soundGuizhou.id) || (item === null || item === void 0 || (_item$common35 = item.common) === null || _item$common35 === void 0 ? void 0 : _item$common35.spuId) || (item === null || item === void 0 || (_item$common36 = item.common) === null || _item$common36 === void 0 ? void 0 : _item$common36.id);
|
|
129
|
-
page = `${routePrefix.soundGuizhou}/detail?audioLibId=${soundGuizhouId}`;
|
|
130
|
-
break;
|
|
131
|
-
case EBusinessLine.ExcitingVideo:
|
|
132
|
-
var _item$excitingVideo, _item$common37, _item$common38;
|
|
133
|
-
const excitingVideoId = (item === null || item === void 0 || (_item$excitingVideo = item.excitingVideo) === null || _item$excitingVideo === void 0 ? void 0 : _item$excitingVideo.id) || (item === null || item === void 0 || (_item$common37 = item.common) === null || _item$common37 === void 0 ? void 0 : _item$common37.spuId) || (item === null || item === void 0 || (_item$common38 = item.common) === null || _item$common38 === void 0 ? void 0 : _item$common38.id);
|
|
134
|
-
page = `${routePrefix.living}/wonderful-video/index?vid=${excitingVideoId}`;
|
|
135
|
-
break;
|
|
136
|
-
default: break;
|
|
137
|
-
}
|
|
138
|
-
if (!page) return;
|
|
139
|
-
if (configOptions.caller === ECaller.web) navigateTo({ src: page });
|
|
140
|
-
else if (configOptions.caller === ECaller.host) uni.navigateTo({ url: page });
|
|
141
|
-
}
|
|
142
|
-
);
|
|
143
17
|
this.goodsServiceConfig = config;
|
|
144
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* 跳转商品详情页面
|
|
21
|
+
* @param item 商品数据
|
|
22
|
+
*/
|
|
23
|
+
jumpToProductDetailPage = (item) => {
|
|
24
|
+
const configOptions = this.goodsServiceConfig.sdkConfig;
|
|
25
|
+
const appConfig = getAppConfig(configOptions.appEnv);
|
|
26
|
+
let page = "";
|
|
27
|
+
const businessLine = item?.businessLine || item?.common?.bizType || item?.common?.linkBusinessLine || item?.common?.businessType;
|
|
28
|
+
const extInfo = item?.common?.extInfoMap || item?.common?.extInfo;
|
|
29
|
+
switch (businessLine) {
|
|
30
|
+
case EBusinessLine.Scenic:
|
|
31
|
+
const scenicId = item?.scenic?.id || item?.common?.spuId || item?.common?.id || "";
|
|
32
|
+
const scenicReservationId = item?.scenic?.reservationId || extInfo?.reservationId || item?.common?.reservationId || "";
|
|
33
|
+
const scenicIsOld = item?.scenic?.isOld || extInfo?.isOld;
|
|
34
|
+
page = `${routePrefix.ticket}/detail/index?scenicId=${scenicId}&reservationId=${scenicReservationId}&isOld=${scenicIsOld}`;
|
|
35
|
+
break;
|
|
36
|
+
case EBusinessLine.Hotel:
|
|
37
|
+
const hotelId = item?.hotel?.id || extInfo?.storeId || item?.common?.storeId || "";
|
|
38
|
+
page = `${routePrefix.hotel}/home/details/index?id=${hotelId}`;
|
|
39
|
+
break;
|
|
40
|
+
case EBusinessLine.Homestay:
|
|
41
|
+
if ((item?.homestay?.type || extInfo?.type || item?.common?.type || "") === EHotelType.hotel) {
|
|
42
|
+
/** 酒店 (天下房仓酒店详情页) */
|
|
43
|
+
const id = item?.homestay?.id || extInfo?.storeId || item?.common?.storeId || "";
|
|
44
|
+
page = `${routePrefix.hotel}/home/details/index?id=${id}`;
|
|
45
|
+
} else {
|
|
46
|
+
const subBizType = item?.homestay?.subBizType || extInfo?.subBizType;
|
|
47
|
+
const id = item?.homestay?.id || item?.common?.spuId || item?.common?.id || "";
|
|
48
|
+
/** 民宿 */
|
|
49
|
+
if (`${subBizType}` === `${ESubBizType.HomestayHotel}`) page = `${routePrefix.hotel}/home/details/index?id=${id}`;
|
|
50
|
+
else if (`${subBizType}` === `${ESubBizType.HomestayHot}`) page = `${routePrefix.hotel}/home/hot-sale-details/index?id=${id}`;
|
|
51
|
+
else page = `${routePrefix.hotel}/home/pms-details/index?id=${id}`;
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
case EBusinessLine.Route:
|
|
55
|
+
const routeId = item?.route?.id || item?.common?.spuId || item?.common?.id;
|
|
56
|
+
page = `${routePrefix.road}/product-detail/index?id=${routeId}`;
|
|
57
|
+
break;
|
|
58
|
+
case EBusinessLine.Travel:
|
|
59
|
+
const travelId = item?.travel?.id || item?.common?.spuId || item?.common?.id;
|
|
60
|
+
page = `${routePrefix.travel}/charter/detail?routeId=${travelId}`;
|
|
61
|
+
break;
|
|
62
|
+
case EBusinessLine.Buy:
|
|
63
|
+
const buySpuId = item?.buy?.spuId || item?.common?.spuId || item?.common?.id;
|
|
64
|
+
page = getWebviewPage({ url: appConfig.domain.shopping + `goods?itemId=${buySpuId}` });
|
|
65
|
+
break;
|
|
66
|
+
case EBusinessLine.Onebuygz:
|
|
67
|
+
const onebuySpuId = item?.onebuygz?.spuId || item?.common?.spuId || item?.common?.id;
|
|
68
|
+
const onebuySkuId = item?.onebuygz?.skuId || item?.common?.skuId;
|
|
69
|
+
page = getWebviewPage({ url: appConfig.domain.onebuygz + `pages/commodity-detail/index?itemId=${onebuySpuId}&skuId=${onebuySkuId}` });
|
|
70
|
+
break;
|
|
71
|
+
case EBusinessLine.Foods:
|
|
72
|
+
const moduleType = item?.food?.moduleType || extInfo?.moduleType;
|
|
73
|
+
const storeId = item?.food?.storeId || extInfo?.storeId || item?.common?.storeId || "";
|
|
74
|
+
const spuId = item?.food?.spuId || item?.common?.spuId || item?.common?.id || "";
|
|
75
|
+
const storePrecedentType = item?.food?.storePrecedentType || extInfo?.storePrecedentType || void 0;
|
|
76
|
+
if (moduleType === EFoodsModuleType.store)
|
|
77
|
+
/** 收藏跳店铺 */
|
|
78
|
+
page = getWebviewPage({ url: getFoodStorePage(appConfig.domain.food, storeId) });
|
|
79
|
+
else
|
|
80
|
+
/** 跳转套餐 */
|
|
81
|
+
page = getWebviewPage({ url: getFoodPackagePage(appConfig.domain.food, storeId, spuId, storePrecedentType) });
|
|
82
|
+
break;
|
|
83
|
+
case EBusinessLine.Entertainment:
|
|
84
|
+
const entertainmentId = item?.entertainment?.id || item?.common?.spuId || item?.common?.id;
|
|
85
|
+
const entertainmentStoreId = item?.entertainment?.storeId || extInfo?.storeId || item?.common?.storeId || "";
|
|
86
|
+
const entertainmentSubBizType = item?.entertainment?.subBizType || extInfo?.subBizType;
|
|
87
|
+
const entertainmentType = item?.entertainment?.type || extInfo?.type || item?.common?.type;
|
|
88
|
+
const entertainmentReservationId = item?.entertainment?.reservationId || extInfo?.reservationId || item?.common?.reservationId;
|
|
89
|
+
if (`${entertainmentType}` === EVenueSimpleTypes.Activity || `${entertainmentSubBizType}` === `${ESubBizType.EntertainmentPerform}`) page = `${routePrefix.enjoy}/g-activity/detail?id=` + entertainmentId + "&mchId=" + entertainmentStoreId;
|
|
90
|
+
else page = `${routePrefix.enjoy}/g-venue/detail?id=${entertainmentId}&reservationId=${entertainmentReservationId}`;
|
|
91
|
+
break;
|
|
92
|
+
case EBusinessLine.Movie:
|
|
93
|
+
let movieId = item?.movie?.id || "";
|
|
94
|
+
try {
|
|
95
|
+
movieId = JSON.parse(extInfo?.extInfo || "{}")?.thirdMovieId || "";
|
|
96
|
+
} catch {}
|
|
97
|
+
page = getMoviePage(appConfig.domain.movie, movieId);
|
|
98
|
+
break;
|
|
99
|
+
case EBusinessLine.Strategy:
|
|
100
|
+
const strategyId = item?.strategy?.id || item?.common?.spuId || item?.common?.id;
|
|
101
|
+
page = `${routePrefix.strategy}/strategy-detail/index?id=` + strategyId;
|
|
102
|
+
break;
|
|
103
|
+
case EBusinessLine.Recommend:
|
|
104
|
+
const recommendId = item?.recommend?.id || item?.common?.spuId || item?.common?.id;
|
|
105
|
+
const recommendMoreParameter = item?.recommend?.moreParameter || extInfo?.moreParameter || "";
|
|
106
|
+
page = `${routePrefix.show}/details/index?id=${recommendId}${recommendMoreParameter}`;
|
|
107
|
+
break;
|
|
108
|
+
case EBusinessLine.SoundGuizhou:
|
|
109
|
+
const soundGuizhouId = item?.soundGuizhou?.id || item?.common?.spuId || item?.common?.id;
|
|
110
|
+
page = `${routePrefix.soundGuizhou}/detail?audioLibId=${soundGuizhouId}`;
|
|
111
|
+
break;
|
|
112
|
+
case EBusinessLine.ExcitingVideo:
|
|
113
|
+
const excitingVideoId = item?.excitingVideo?.id || item?.common?.spuId || item?.common?.id;
|
|
114
|
+
page = `${routePrefix.living}/wonderful-video/index?vid=${excitingVideoId}`;
|
|
115
|
+
break;
|
|
116
|
+
default: break;
|
|
117
|
+
}
|
|
118
|
+
if (!page) return;
|
|
119
|
+
if (configOptions.caller === ECaller.web) navigateTo({ src: page });
|
|
120
|
+
else if (configOptions.caller === ECaller.host) uni.navigateTo({ url: page });
|
|
121
|
+
};
|
|
145
122
|
};
|
|
146
123
|
|
|
147
124
|
//#endregion
|
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
import { EBusinessLine, ESubBizType } from
|
|
2
|
-
import { EFoodPackageType, EFoodsModuleType } from
|
|
1
|
+
import { EBusinessLine, ESubBizType } from '../../enums/business-line/index.js'
|
|
2
|
+
import { EFoodPackageType, EFoodsModuleType } from '../../enums/sub/foods/index.js'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// #region src/services/goods/type.d.ts
|
|
5
5
|
type IJumpProductDetailItemCommonExtInfo = {
|
|
6
|
-
reservationId?: string
|
|
7
|
-
type?: 'hotel' | '1' | '3'
|
|
8
|
-
storeId?: string
|
|
9
|
-
subBizType?: ESubBizType
|
|
6
|
+
reservationId?: string
|
|
7
|
+
type?: 'hotel' | '1' | '3'
|
|
8
|
+
storeId?: string
|
|
9
|
+
subBizType?: ESubBizType
|
|
10
10
|
/** ********** 景区相关字段 ************/
|
|
11
|
-
isOld?: number
|
|
11
|
+
isOld?: number
|
|
12
12
|
/** ********** 景区相关字段 ************/
|
|
13
13
|
/** ********** 美食相关字段 ************/
|
|
14
|
-
storePrecedentType?: EFoodPackageType
|
|
15
|
-
moduleType?: EFoodsModuleType
|
|
14
|
+
storePrecedentType?: EFoodPackageType
|
|
15
|
+
moduleType?: EFoodsModuleType
|
|
16
16
|
/** ********** 美食相关字段 ************/
|
|
17
17
|
/** ********** 种草相关字段 ************/
|
|
18
|
-
moreParameter?: string
|
|
18
|
+
moreParameter?: string
|
|
19
19
|
/** ********** 种草相关字段 ************/
|
|
20
20
|
/** ********** 电影相关字段 ************/
|
|
21
|
-
extInfo: string
|
|
22
|
-
}
|
|
21
|
+
extInfo: string
|
|
22
|
+
}
|
|
23
23
|
/**
|
|
24
24
|
* 商品数据
|
|
25
25
|
*/
|
|
26
26
|
type IJumpProductDetailItem = {
|
|
27
27
|
/** 业务线(如果是common字段,则不用传,没有common必传) */
|
|
28
|
-
businessLine?: EBusinessLine
|
|
28
|
+
businessLine?: EBusinessLine
|
|
29
29
|
/** 通用数据-(包含装修数据文本导航、商品组件) */
|
|
30
30
|
common?: {
|
|
31
31
|
/** 业务线字段(可能是三个中的一个) */
|
|
32
|
-
bizType?: EBusinessLine
|
|
33
|
-
linkBusinessLine?: EBusinessLine
|
|
34
|
-
businessType?: EBusinessLine
|
|
32
|
+
bizType?: EBusinessLine
|
|
33
|
+
linkBusinessLine?: EBusinessLine
|
|
34
|
+
businessType?: EBusinessLine
|
|
35
35
|
/** skuId 字段 */
|
|
36
|
-
skuId: string
|
|
36
|
+
skuId: string
|
|
37
37
|
/** spuId */
|
|
38
|
-
spuId: string
|
|
38
|
+
spuId: string
|
|
39
39
|
/** ****** 收藏、搜索等(优先取扩展字段里面的) ********/
|
|
40
|
-
id?: string
|
|
41
|
-
storeId?: string
|
|
42
|
-
type?: 'hotel' | '1' | '3'
|
|
43
|
-
reservationId?: string
|
|
40
|
+
id?: string
|
|
41
|
+
storeId?: string
|
|
42
|
+
type?: 'hotel' | '1' | '3'
|
|
43
|
+
reservationId?: string
|
|
44
44
|
/** ****** 收藏、搜索等 ********/
|
|
45
45
|
/** 扩展字段 */
|
|
46
|
-
extInfo?: IJumpProductDetailItemCommonExtInfo
|
|
46
|
+
extInfo?: IJumpProductDetailItemCommonExtInfo
|
|
47
47
|
/** 扩展字段 */
|
|
48
|
-
extInfoMap?: IJumpProductDetailItemCommonExtInfo
|
|
49
|
-
}
|
|
48
|
+
extInfoMap?: IJumpProductDetailItemCommonExtInfo
|
|
49
|
+
}
|
|
50
50
|
/** 景区门票 */
|
|
51
51
|
scenic?: {
|
|
52
|
-
id: string
|
|
53
|
-
reservationId?: string
|
|
54
|
-
isOld?: number
|
|
55
|
-
}
|
|
52
|
+
id: string
|
|
53
|
+
reservationId?: string
|
|
54
|
+
isOld?: number
|
|
55
|
+
}
|
|
56
56
|
/** 酒店 */
|
|
57
57
|
hotel?: {
|
|
58
|
-
id: string
|
|
59
|
-
}
|
|
58
|
+
id: string
|
|
59
|
+
}
|
|
60
60
|
/** 名宿 */
|
|
61
61
|
homestay?: {
|
|
62
|
-
id: string
|
|
63
|
-
type?: 'hotel'
|
|
64
|
-
subBizType?: ESubBizType
|
|
65
|
-
}
|
|
62
|
+
id: string
|
|
63
|
+
type?: 'hotel'
|
|
64
|
+
subBizType?: ESubBizType
|
|
65
|
+
}
|
|
66
66
|
/** 路线/定制 */
|
|
67
67
|
route?: {
|
|
68
|
-
id: string
|
|
69
|
-
}
|
|
68
|
+
id: string
|
|
69
|
+
}
|
|
70
70
|
/** 出行 */
|
|
71
71
|
travel?: {
|
|
72
|
-
id: string
|
|
73
|
-
}
|
|
72
|
+
id: string
|
|
73
|
+
}
|
|
74
74
|
/** 购物 */
|
|
75
75
|
buy?: {
|
|
76
|
-
spuId: string
|
|
77
|
-
}
|
|
76
|
+
spuId: string
|
|
77
|
+
}
|
|
78
78
|
/** 购物(新) */
|
|
79
79
|
onebuygz?: {
|
|
80
|
-
spuId: string
|
|
81
|
-
skuId: string
|
|
82
|
-
}
|
|
80
|
+
spuId: string
|
|
81
|
+
skuId: string
|
|
82
|
+
}
|
|
83
83
|
/** 美食 */
|
|
84
84
|
food?: {
|
|
85
|
-
storeId: string
|
|
86
|
-
spuId?: string
|
|
87
|
-
moduleType?: EFoodsModuleType
|
|
88
|
-
storePrecedentType?: EFoodPackageType
|
|
89
|
-
}
|
|
85
|
+
storeId: string
|
|
86
|
+
spuId?: string
|
|
87
|
+
moduleType?: EFoodsModuleType
|
|
88
|
+
storePrecedentType?: EFoodPackageType
|
|
89
|
+
}
|
|
90
90
|
/** 电影 */
|
|
91
91
|
movie?: {
|
|
92
|
-
id: string
|
|
93
|
-
}
|
|
92
|
+
id: string
|
|
93
|
+
}
|
|
94
94
|
/** 文娱 */
|
|
95
95
|
entertainment?: {
|
|
96
|
-
id: string
|
|
97
|
-
type?: string
|
|
98
|
-
subBizType?: ESubBizType
|
|
99
|
-
storeId?: string
|
|
100
|
-
reservationId?: string
|
|
101
|
-
}
|
|
96
|
+
id: string
|
|
97
|
+
type?: string
|
|
98
|
+
subBizType?: ESubBizType
|
|
99
|
+
storeId?: string
|
|
100
|
+
reservationId?: string
|
|
101
|
+
}
|
|
102
102
|
/** 攻略 */
|
|
103
103
|
strategy?: {
|
|
104
|
-
id: string
|
|
105
|
-
}
|
|
104
|
+
id: string
|
|
105
|
+
}
|
|
106
106
|
/** 种草 */
|
|
107
107
|
recommend?: {
|
|
108
|
-
id: string
|
|
109
|
-
moreParameter?: string
|
|
110
|
-
}
|
|
108
|
+
id: string
|
|
109
|
+
moreParameter?: string
|
|
110
|
+
}
|
|
111
111
|
/** 声入贵州 */
|
|
112
112
|
soundGuizhou?: {
|
|
113
|
-
id: string
|
|
114
|
-
}
|
|
113
|
+
id: string
|
|
114
|
+
}
|
|
115
115
|
/** 精彩视频 */
|
|
116
116
|
excitingVideo?: {
|
|
117
|
-
id: string
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export { IJumpProductDetailItem }
|
|
117
|
+
id: string
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// #endregion
|
|
121
|
+
export { IJumpProductDetailItem }
|
package/es/utils/common/index.js
CHANGED
|
@@ -62,7 +62,7 @@ const showAndroidTip = (options) => {
|
|
|
62
62
|
const checkAndRequestNativeAppPermission = (options) => {
|
|
63
63
|
const { type, success, fail } = options || {};
|
|
64
64
|
if (isWeixinEnv() || isH5Env() || isHarmonyEnv() || isiOSEnv()) {
|
|
65
|
-
success
|
|
65
|
+
success?.();
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
const ActivityCompat = plus.android.importClass("androidx.core.app.ActivityCompat");
|
|
@@ -77,19 +77,19 @@ const checkAndRequestNativeAppPermission = (options) => {
|
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
if (!hasPermission) {
|
|
80
|
-
success
|
|
80
|
+
success?.();
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
showAndroidTip(detail);
|
|
84
84
|
plus.android.requestPermissions(detail.permissionId, function(resultObj) {
|
|
85
85
|
if (resultObj.granted.length > 0) {
|
|
86
86
|
closeAndroidTip();
|
|
87
|
-
success
|
|
87
|
+
success?.();
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
if (resultObj.deniedPresent.length > 0) {
|
|
91
91
|
closeAndroidTip();
|
|
92
|
-
fail
|
|
92
|
+
fail?.();
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
if (resultObj.deniedAlways.length > 0) {
|
|
@@ -99,15 +99,15 @@ const checkAndRequestNativeAppPermission = (options) => {
|
|
|
99
99
|
confirmText: "去设置",
|
|
100
100
|
success: function(res) {
|
|
101
101
|
closeAndroidTip();
|
|
102
|
-
if (res.confirm) uni.openAppAuthorizeSetting({ success: () => fail
|
|
103
|
-
if (res.cancel) fail
|
|
102
|
+
if (res.confirm) uni.openAppAuthorizeSetting({ success: () => fail?.() });
|
|
103
|
+
if (res.cancel) fail?.();
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
}, function() {
|
|
109
109
|
closeAndroidTip();
|
|
110
|
-
fail
|
|
110
|
+
fail?.();
|
|
111
111
|
});
|
|
112
112
|
};
|
|
113
113
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { EUniPlatform } from "../../enums/platform/index.js";
|
|
2
|
-
import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.js";
|
|
3
2
|
|
|
4
3
|
//#region src/utils/uni-env/index.ts
|
|
5
4
|
/**
|
|
@@ -55,7 +54,10 @@ const isiOSEnv = () => {
|
|
|
55
54
|
return false;
|
|
56
55
|
};
|
|
57
56
|
function getSystemInfoSync() {
|
|
58
|
-
return
|
|
57
|
+
return {
|
|
58
|
+
...uni.getDeviceInfo(),
|
|
59
|
+
...uni.getWindowInfo()
|
|
60
|
+
};
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
//#endregion
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.103.0/helpers/asyncToGenerator.js";
|
|
2
|
-
import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.103.0/helpers/objectWithoutProperties.js";
|
|
3
|
-
import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.js";
|
|
4
1
|
import wx from "weixin-js-sdk";
|
|
5
2
|
|
|
6
3
|
//#region src/utils/web-view/index.ts
|
|
7
|
-
const _excluded = ["shareUrl"];
|
|
8
4
|
const userAgent = navigator.userAgent.toLowerCase();
|
|
9
5
|
/** 判断是否是iOS还是安卓 */
|
|
10
6
|
const isIOSOrAndroid = !userAgent.includes("miniprogram") && (userAgent.includes("android") || userAgent.includes("iphone") || userAgent.includes("ipad"));
|
|
@@ -19,20 +15,14 @@ const isAndroid = !userAgent.includes("miniprogram") && userAgent.includes("andr
|
|
|
19
15
|
/** 判断是否苹果APP */
|
|
20
16
|
const isiOS = !userAgent.includes("miniprogram") && (userAgent.includes("iphone") || userAgent.includes("ipad"));
|
|
21
17
|
let uni = {};
|
|
22
|
-
function loadWebview() {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const scriptTag = document.createElement("script");
|
|
31
|
-
scriptTag.src = "https://appx/web-view.min.js";
|
|
32
|
-
document.head.appendChild(scriptTag);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
return _loadWebview.apply(this, arguments);
|
|
18
|
+
async function loadWebview() {
|
|
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;
|
|
21
|
+
if (isAlipay) {
|
|
22
|
+
const scriptTag = document.createElement("script");
|
|
23
|
+
scriptTag.src = "https://appx/web-view.min.js";
|
|
24
|
+
document.head.appendChild(scriptTag);
|
|
25
|
+
}
|
|
36
26
|
}
|
|
37
27
|
loadWebview();
|
|
38
28
|
document.addEventListener("UniAppJSBridgeReady", function() {
|
|
@@ -55,11 +45,10 @@ const navigateTo = (parameters) => {
|
|
|
55
45
|
const { src, params } = parameters;
|
|
56
46
|
const url = `${src}${params ? `?${objectToQueryString(params)}` : ""}`;
|
|
57
47
|
try {
|
|
58
|
-
|
|
59
|
-
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 });
|
|
48
|
+
uni?.webView?.navigateTo?.({ url });
|
|
60
49
|
/** 不兼容上面的方法会自动往下执行 */
|
|
61
|
-
wx
|
|
62
|
-
|
|
50
|
+
wx.miniProgram.navigateTo({ url });
|
|
51
|
+
my?.navigateTo({ url });
|
|
63
52
|
} catch (error) {
|
|
64
53
|
console.error(error);
|
|
65
54
|
}
|
|
@@ -72,11 +61,10 @@ const redirectTo = (parameters) => {
|
|
|
72
61
|
const { src, params } = parameters;
|
|
73
62
|
const url = `${src}${params ? `?${objectToQueryString(params)}` : ""}`;
|
|
74
63
|
try {
|
|
75
|
-
|
|
76
|
-
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 });
|
|
64
|
+
uni?.webView?.redirectTo?.({ url });
|
|
77
65
|
/** 不兼容上面的方法会自动往下执行 */
|
|
78
|
-
wx
|
|
79
|
-
|
|
66
|
+
wx.miniProgram.redirectTo({ url });
|
|
67
|
+
my?.redirectTo({ url });
|
|
80
68
|
} catch (error) {
|
|
81
69
|
console.error(error);
|
|
82
70
|
}
|
|
@@ -87,11 +75,10 @@ const redirectTo = (parameters) => {
|
|
|
87
75
|
*/
|
|
88
76
|
const navigateBack = (parameters) => {
|
|
89
77
|
try {
|
|
90
|
-
|
|
91
|
-
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);
|
|
78
|
+
uni?.webView?.navigateBack?.(parameters);
|
|
92
79
|
/** 不兼容上面的方法会自动往下执行 */
|
|
93
|
-
wx
|
|
94
|
-
|
|
80
|
+
wx.miniProgram.navigateBack(parameters);
|
|
81
|
+
my?.navigateBack(parameters);
|
|
95
82
|
} catch (error) {
|
|
96
83
|
console.error(error);
|
|
97
84
|
}
|
|
@@ -111,13 +98,11 @@ const postMessage = (data) => {
|
|
|
111
98
|
}
|
|
112
99
|
}
|
|
113
100
|
try {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
(_my4 = my) === null || _my4 === void 0 || _my4.postMessage({ data });
|
|
101
|
+
uni?.webView?.postMessage({ data });
|
|
102
|
+
wx.miniProgram.postMessage({ data });
|
|
103
|
+
my?.postMessage({ data });
|
|
118
104
|
} catch (error) {
|
|
119
|
-
|
|
120
|
-
if (error === null || error === void 0 || (_message = error.message) === null || _message === void 0 ? void 0 : _message.includes("my is not defined")) return;
|
|
105
|
+
if (error?.message?.includes("my is not defined")) return;
|
|
121
106
|
console.error(error);
|
|
122
107
|
}
|
|
123
108
|
};
|
|
@@ -126,11 +111,12 @@ const postMessage = (data) => {
|
|
|
126
111
|
* @param data
|
|
127
112
|
*/
|
|
128
113
|
const setShareParam = (data, businessType) => {
|
|
129
|
-
const { shareUrl } = data;
|
|
130
|
-
const params = { data:
|
|
114
|
+
const { shareUrl, ...res } = data;
|
|
115
|
+
const params = { data: {
|
|
116
|
+
...res,
|
|
131
117
|
businessType,
|
|
132
118
|
shareUrl: encodeURIComponent(shareUrl || "")
|
|
133
|
-
}
|
|
119
|
+
} };
|
|
134
120
|
postMessage({
|
|
135
121
|
type: EMessagesType.shareParam,
|
|
136
122
|
params
|
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.
|
|
5
|
+
"version": "1.0.6",
|
|
6
6
|
"private": false,
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "es/index.js",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"weixin-js-sdk": "^1.6.5"
|
|
21
|
+
"weixin-js-sdk": "^1.6.5",
|
|
22
|
+
"@foundbyte/uni-hooks": "^1.0.4"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"typescript": "~5.7.2",
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.103.0/helpers/asyncToGenerator.js
|
|
2
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
3
|
-
try {
|
|
4
|
-
var i = n[a](c), u = i.value;
|
|
5
|
-
} catch (n$1) {
|
|
6
|
-
e(n$1);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
10
|
-
}
|
|
11
|
-
function _asyncToGenerator(n) {
|
|
12
|
-
return function() {
|
|
13
|
-
var t = this, e = arguments;
|
|
14
|
-
return new Promise(function(r, o) {
|
|
15
|
-
var a = n.apply(t, e);
|
|
16
|
-
function _next(n$1) {
|
|
17
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n$1);
|
|
18
|
-
}
|
|
19
|
-
function _throw(n$1) {
|
|
20
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n$1);
|
|
21
|
-
}
|
|
22
|
-
_next(void 0);
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
export { _asyncToGenerator };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { toPropertyKey } from "./toPropertyKey.js";
|
|
2
|
-
|
|
3
|
-
//#region \0@oxc-project+runtime@0.103.0/helpers/defineProperty.js
|
|
4
|
-
function _defineProperty(e, r, t) {
|
|
5
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
6
|
-
value: t,
|
|
7
|
-
enumerable: !0,
|
|
8
|
-
configurable: !0,
|
|
9
|
-
writable: !0
|
|
10
|
-
}) : e[r] = t, e;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
|
-
export { _defineProperty };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { _defineProperty } from "./defineProperty.js";
|
|
2
|
-
|
|
3
|
-
//#region \0@oxc-project+runtime@0.103.0/helpers/objectSpread2.js
|
|
4
|
-
function ownKeys(e, r) {
|
|
5
|
-
var t = Object.keys(e);
|
|
6
|
-
if (Object.getOwnPropertySymbols) {
|
|
7
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
8
|
-
r && (o = o.filter(function(r$1) {
|
|
9
|
-
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
10
|
-
})), t.push.apply(t, o);
|
|
11
|
-
}
|
|
12
|
-
return t;
|
|
13
|
-
}
|
|
14
|
-
function _objectSpread2(e) {
|
|
15
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
16
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
17
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
|
|
18
|
-
_defineProperty(e, r$1, t[r$1]);
|
|
19
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
|
|
20
|
-
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return e;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
export { _objectSpread2 };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { _objectWithoutPropertiesLoose } from "./objectWithoutPropertiesLoose.js";
|
|
2
|
-
|
|
3
|
-
//#region \0@oxc-project+runtime@0.103.0/helpers/objectWithoutProperties.js
|
|
4
|
-
function _objectWithoutProperties(e, t) {
|
|
5
|
-
if (null == e) return {};
|
|
6
|
-
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
7
|
-
if (Object.getOwnPropertySymbols) {
|
|
8
|
-
var s = Object.getOwnPropertySymbols(e);
|
|
9
|
-
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
10
|
-
}
|
|
11
|
-
return i;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
//#endregion
|
|
15
|
-
export { _objectWithoutProperties };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.103.0/helpers/objectWithoutPropertiesLoose.js
|
|
2
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
3
|
-
if (null == r) return {};
|
|
4
|
-
var t = {};
|
|
5
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
6
|
-
if (e.includes(n)) continue;
|
|
7
|
-
t[n] = r[n];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
export { _objectWithoutPropertiesLoose };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { _typeof } from "./typeof.js";
|
|
2
|
-
|
|
3
|
-
//#region \0@oxc-project+runtime@0.103.0/helpers/toPrimitive.js
|
|
4
|
-
function toPrimitive(t, r) {
|
|
5
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
6
|
-
var e = t[Symbol.toPrimitive];
|
|
7
|
-
if (void 0 !== e) {
|
|
8
|
-
var i = e.call(t, r || "default");
|
|
9
|
-
if ("object" != _typeof(i)) return i;
|
|
10
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11
|
-
}
|
|
12
|
-
return ("string" === r ? String : Number)(t);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
export { toPrimitive };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { _typeof } from "./typeof.js";
|
|
2
|
-
import { toPrimitive } from "./toPrimitive.js";
|
|
3
|
-
|
|
4
|
-
//#region \0@oxc-project+runtime@0.103.0/helpers/toPropertyKey.js
|
|
5
|
-
function toPropertyKey(t) {
|
|
6
|
-
var i = toPrimitive(t, "string");
|
|
7
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
|
-
export { toPropertyKey };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.103.0/helpers/typeof.js
|
|
2
|
-
function _typeof(o) {
|
|
3
|
-
"@babel/helpers - typeof";
|
|
4
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
5
|
-
return typeof o$1;
|
|
6
|
-
} : function(o$1) {
|
|
7
|
-
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
8
|
-
}, _typeof(o);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
export { _typeof };
|