@foundbyte/uni-libs 0.0.11 → 0.0.13
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/README.md +6 -4
- package/es/configs/app/app.hwtest.js +4 -3
- package/es/configs/app/app.prod.js +4 -3
- package/es/configs/app/app.type.d.ts +2 -0
- package/es/configs/app/index.js +2 -1
- package/es/constants/permission/index.d.ts +35 -0
- package/es/constants/permission/index.js +47 -0
- package/es/entry.d.ts +4 -13
- package/es/entry.js +3 -14
- package/es/enums/business-line/index.d.ts +2 -0
- package/es/enums/business-line/index.js +4 -1
- package/es/enums/sub/enjoy/index.d.ts +10 -6
- package/es/enums/sub/enjoy/index.js +14 -6
- package/es/index.d.ts +5 -2
- package/es/index.js +5 -2
- package/es/services/goods/service.d.ts +18 -0
- package/es/services/goods/service.js +10 -109
- package/es/services/goods/type.d.ts +8 -22
- package/es/services/native-app/service.d.ts +29 -0
- package/es/services/native-app/service.js +123 -0
- package/es/utils/pages/movie/index.d.ts +7 -0
- package/es/utils/pages/movie/index.js +15 -0
- package/es/utils/uni-env/index.d.ts +33 -0
- package/es/utils/uni-env/index.js +47 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,10 +22,12 @@ const oneTravelSdk = new OneTravelSDK({
|
|
|
22
22
|
| appEnv | 环境变量 | EAppEnv | 否 | EAppEnv.PROD |
|
|
23
23
|
| caller | 调用者 | ECaller | 否 | ECaller.WEB |
|
|
24
24
|
|
|
25
|
-
### 2.
|
|
26
|
-
|
|
25
|
+
### 2.goodsService
|
|
26
|
+
商品服务
|
|
27
|
+
|
|
28
|
+
#### 2.1跳转商品详情页
|
|
27
29
|
```typescript
|
|
28
|
-
oneTravelSdk.
|
|
30
|
+
oneTravelSdk.goodsService.jumpToProductDetailPage({
|
|
29
31
|
...
|
|
30
32
|
})
|
|
31
33
|
```
|
|
@@ -33,7 +35,7 @@ oneTravelSdk.jumpToGoodsDetailPage({
|
|
|
33
35
|
#### 参数
|
|
34
36
|
| 参数名 | 描述 | 类型 | 是否必填 | 默认值 |
|
|
35
37
|
|-----|-----|-----|-----|-----|
|
|
36
|
-
|
|
|
38
|
+
| item | 商品项 | IJumpProductDetailItem | 是 | - |
|
|
37
39
|
|
|
38
40
|
|
|
39
41
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
//#region src/configs/app/app.hwtest.ts
|
|
2
2
|
const config = { domain: {
|
|
3
|
-
shopping:
|
|
4
|
-
food:
|
|
5
|
-
onebuygz: "https://testb2ch5-travel.gcongo.com.cn/#/"
|
|
3
|
+
shopping: "https://shopping-h5.onetravelgz.cn/#/",
|
|
4
|
+
food: "https://food-h5.onetravelgz.cn/#/",
|
|
5
|
+
onebuygz: "https://testb2ch5-travel.gcongo.com.cn/#/",
|
|
6
|
+
movie: "https://147gn9gm.life.mczjk.cn/#/"
|
|
6
7
|
} };
|
|
7
8
|
var app_hwtest_default = config;
|
|
8
9
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
//#region src/configs/app/app.prod.ts
|
|
2
2
|
const config = { domain: {
|
|
3
|
-
shopping:
|
|
4
|
-
food:
|
|
5
|
-
onebuygz: "https://travel.onebuygz.com/#/"
|
|
3
|
+
shopping: "https://shopping-h5.onetravelgz.com/#/",
|
|
4
|
+
food: "https://home.onetravelgz.com/food/index.html#/",
|
|
5
|
+
onebuygz: "https://travel.onebuygz.com/#/",
|
|
6
|
+
movie: "https://147gn9gm.life.mczjk.cn/#/"
|
|
6
7
|
} };
|
|
7
8
|
var app_prod_default = config;
|
|
8
9
|
|
package/es/configs/app/index.js
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/constants/permission/index.d.ts
|
|
2
|
+
declare const app_permission: {
|
|
3
|
+
microphoneAuthorized: {
|
|
4
|
+
permissionId: string[];
|
|
5
|
+
title: string;
|
|
6
|
+
value: string;
|
|
7
|
+
denied: string;
|
|
8
|
+
};
|
|
9
|
+
locationAccuracy: {
|
|
10
|
+
permissionId: string[];
|
|
11
|
+
title: string;
|
|
12
|
+
value: string;
|
|
13
|
+
denied: string;
|
|
14
|
+
};
|
|
15
|
+
albumAuthorized: {
|
|
16
|
+
permissionId: string[];
|
|
17
|
+
title: string;
|
|
18
|
+
value: string;
|
|
19
|
+
denied: string;
|
|
20
|
+
};
|
|
21
|
+
cameraAuthorized: {
|
|
22
|
+
permissionId: string[];
|
|
23
|
+
title: string;
|
|
24
|
+
value: string;
|
|
25
|
+
denied: string;
|
|
26
|
+
};
|
|
27
|
+
chooseImage: {
|
|
28
|
+
permissionId: string[];
|
|
29
|
+
title: string;
|
|
30
|
+
value: string;
|
|
31
|
+
denied: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { app_permission };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region src/constants/permission/index.ts
|
|
2
|
+
const app_permission = {
|
|
3
|
+
microphoneAuthorized: {
|
|
4
|
+
permissionId: ["android.permission.RECORD_AUDIO"],
|
|
5
|
+
title: "麦克风权限说明",
|
|
6
|
+
value: "请求访问麦克风权限,以便使用语音搜索功能",
|
|
7
|
+
denied: "获取麦克风权限失败,请手动打开授权"
|
|
8
|
+
},
|
|
9
|
+
locationAccuracy: {
|
|
10
|
+
permissionId: ["android.permission.ACCESS_FINE_LOCATION"],
|
|
11
|
+
title: "定位权限说明",
|
|
12
|
+
value: "请求获得您的定位权限,方便为您推荐所在城市的景区、酒店等旅游信息内容",
|
|
13
|
+
denied: "获取定位权限失败,请手动打开授权或检查系统定位开关"
|
|
14
|
+
},
|
|
15
|
+
albumAuthorized: {
|
|
16
|
+
permissionId: [
|
|
17
|
+
"android.permission.READ_EXTERNAL_STORAGE",
|
|
18
|
+
"android.permission.READ_MEDIA_IMAGES",
|
|
19
|
+
"android.permission.READ_MEDIA_VIDEO",
|
|
20
|
+
"android.permission.READ_MEDIA_VISUAL_USER_SELECTED"
|
|
21
|
+
],
|
|
22
|
+
title: "相册权限说明",
|
|
23
|
+
value: "请求访问相册,便于您使用该功能上传您的照片/图片/视频",
|
|
24
|
+
denied: "获取相册权限失败,请手动打开授权"
|
|
25
|
+
},
|
|
26
|
+
cameraAuthorized: {
|
|
27
|
+
permissionId: ["android.permission.CAMERA"],
|
|
28
|
+
title: "相机权限说明",
|
|
29
|
+
value: "请求访问相机,便于您使用该功能拍摄图片/视频",
|
|
30
|
+
denied: "获取相机权限失败,请手动打开授权"
|
|
31
|
+
},
|
|
32
|
+
chooseImage: {
|
|
33
|
+
permissionId: [
|
|
34
|
+
"android.permission.CAMERA",
|
|
35
|
+
"android.permission.READ_EXTERNAL_STORAGE",
|
|
36
|
+
"android.permission.READ_MEDIA_IMAGES",
|
|
37
|
+
"android.permission.READ_MEDIA_VIDEO",
|
|
38
|
+
"android.permission.READ_MEDIA_VISUAL_USER_SELECTED"
|
|
39
|
+
],
|
|
40
|
+
title: "权限说明",
|
|
41
|
+
value: "您即将使用上传功能,该功能会请求访问相册,便于您使用该功能上传您的照片/图片/视频;请求访问相机,便于您使用该功能拍摄图片/视频",
|
|
42
|
+
denied: "获取相机/相册权限失败,请手动打开授权"
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { app_permission };
|
package/es/entry.d.ts
CHANGED
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
import { IOneTravelSDKConfig } from "./types/one-travel-service/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { GoodsService } from "./services/goods/service.js";
|
|
3
|
+
import { NativeAppService } from "./services/native-app/service.js";
|
|
3
4
|
import { IAppConfig } from "./configs/app/app.type.js";
|
|
4
5
|
|
|
5
6
|
//#region src/entry.d.ts
|
|
6
|
-
|
|
7
7
|
/**
|
|
8
8
|
* 一码游SDK
|
|
9
9
|
*/
|
|
10
10
|
declare class OneTravelSDK {
|
|
11
11
|
private sdkConfig;
|
|
12
|
-
|
|
12
|
+
readonly goodsService: GoodsService;
|
|
13
|
+
readonly nativeAppService: NativeAppService;
|
|
13
14
|
constructor(config?: Partial<IOneTravelSDKConfig>);
|
|
14
15
|
/**
|
|
15
16
|
* 获取App配置信息
|
|
16
17
|
*/
|
|
17
18
|
getAppConfig(): IAppConfig;
|
|
18
|
-
/**
|
|
19
|
-
* 跳转商品详情页(老)
|
|
20
|
-
* @param goodsItem 商品数据
|
|
21
|
-
*/
|
|
22
|
-
jumpToGoodsDetailPage(goodsItem: IJumpGoodsDetailItem): void;
|
|
23
|
-
/**
|
|
24
|
-
* 跳转商品详情页
|
|
25
|
-
* @param item
|
|
26
|
-
*/
|
|
27
|
-
jumpToProductDetailPage(item: IJumpProductDetailItem): void;
|
|
28
19
|
}
|
|
29
20
|
//#endregion
|
|
30
21
|
export { OneTravelSDK };
|
package/es/entry.js
CHANGED
|
@@ -2,6 +2,7 @@ import { EAppEnv } from "./enums/environment/index.js";
|
|
|
2
2
|
import { ECaller } from "./enums/sdk/index.js";
|
|
3
3
|
import { getAppConfig } from "./configs/app/index.js";
|
|
4
4
|
import { GoodsService } from "./services/goods/service.js";
|
|
5
|
+
import { NativeAppService } from "./services/native-app/service.js";
|
|
5
6
|
|
|
6
7
|
//#region src/entry.ts
|
|
7
8
|
/**
|
|
@@ -10,6 +11,7 @@ import { GoodsService } from "./services/goods/service.js";
|
|
|
10
11
|
var OneTravelSDK = class {
|
|
11
12
|
sdkConfig;
|
|
12
13
|
goodsService;
|
|
14
|
+
nativeAppService;
|
|
13
15
|
constructor(config) {
|
|
14
16
|
const value = {
|
|
15
17
|
appEnv: EAppEnv.prod,
|
|
@@ -18,6 +20,7 @@ var OneTravelSDK = class {
|
|
|
18
20
|
};
|
|
19
21
|
this.sdkConfig = value;
|
|
20
22
|
this.goodsService = new GoodsService({ sdkConfig: value });
|
|
23
|
+
this.nativeAppService = new NativeAppService({ sdkConfig: value });
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
23
26
|
* 获取App配置信息
|
|
@@ -25,20 +28,6 @@ var OneTravelSDK = class {
|
|
|
25
28
|
getAppConfig() {
|
|
26
29
|
return getAppConfig(this.sdkConfig.appEnv);
|
|
27
30
|
}
|
|
28
|
-
/**
|
|
29
|
-
* 跳转商品详情页(老)
|
|
30
|
-
* @param goodsItem 商品数据
|
|
31
|
-
*/
|
|
32
|
-
jumpToGoodsDetailPage(goodsItem) {
|
|
33
|
-
this.goodsService.jumpToGoodsDetailPage(goodsItem);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* 跳转商品详情页
|
|
37
|
-
* @param item
|
|
38
|
-
*/
|
|
39
|
-
jumpToProductDetailPage(item) {
|
|
40
|
-
this.goodsService.jumpToProductDetailPage(item);
|
|
41
|
-
}
|
|
42
31
|
};
|
|
43
32
|
|
|
44
33
|
//#endregion
|
|
@@ -59,6 +59,8 @@ let EBusinessLine = /* @__PURE__ */ function(EBusinessLine$1) {
|
|
|
59
59
|
EBusinessLine$1[EBusinessLine$1["Living"] = 907] = "Living";
|
|
60
60
|
/** 实名认证 前端定义,后端无定义 */
|
|
61
61
|
EBusinessLine$1[EBusinessLine$1["RealName"] = 908] = "RealName";
|
|
62
|
+
/** 电影票 */
|
|
63
|
+
EBusinessLine$1[EBusinessLine$1["Movie"] = 1e4] = "Movie";
|
|
62
64
|
return EBusinessLine$1;
|
|
63
65
|
}({});
|
|
64
66
|
/**
|
|
@@ -92,7 +94,8 @@ const BusinessLineDict = {
|
|
|
92
94
|
[EBusinessLine.Onebuygz]: "购物",
|
|
93
95
|
[EBusinessLine.ConsumerCoupon]: "消费券",
|
|
94
96
|
[EBusinessLine.Living]: "直播",
|
|
95
|
-
[EBusinessLine.RealName]: "实名认证"
|
|
97
|
+
[EBusinessLine.RealName]: "实名认证",
|
|
98
|
+
[EBusinessLine.Movie]: "电影票"
|
|
96
99
|
};
|
|
97
100
|
/** 子业务线 */
|
|
98
101
|
let ESubBizType = /* @__PURE__ */ function(ESubBizType$1) {
|
|
@@ -7,14 +7,18 @@ declare enum EVenueTypes {
|
|
|
7
7
|
Exhibitions = "02",
|
|
8
8
|
/** 演艺活动 */
|
|
9
9
|
Activity = "03",
|
|
10
|
+
/** 电影 */
|
|
11
|
+
Movie = "04",
|
|
10
12
|
}
|
|
11
|
-
declare
|
|
13
|
+
declare enum EVenueSimpleTypes {
|
|
12
14
|
/** 博物馆 */
|
|
13
|
-
"
|
|
15
|
+
Museums = "1",
|
|
14
16
|
/** 展览馆 */
|
|
15
|
-
"
|
|
17
|
+
Exhibitions = "2",
|
|
16
18
|
/** 演艺活动 */
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
+
Activity = "3",
|
|
20
|
+
/** 电影 */
|
|
21
|
+
Movie = "4",
|
|
22
|
+
}
|
|
19
23
|
//#endregion
|
|
20
|
-
export {
|
|
24
|
+
export { EVenueSimpleTypes, EVenueTypes };
|
|
@@ -7,13 +7,21 @@ let EVenueTypes = /* @__PURE__ */ function(EVenueTypes$1) {
|
|
|
7
7
|
EVenueTypes$1["Exhibitions"] = "02";
|
|
8
8
|
/** 演艺活动 */
|
|
9
9
|
EVenueTypes$1["Activity"] = "03";
|
|
10
|
+
/** 电影 */
|
|
11
|
+
EVenueTypes$1["Movie"] = "04";
|
|
10
12
|
return EVenueTypes$1;
|
|
11
13
|
}({});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
let EVenueSimpleTypes = /* @__PURE__ */ function(EVenueSimpleTypes$1) {
|
|
15
|
+
/** 博物馆 */
|
|
16
|
+
EVenueSimpleTypes$1["Museums"] = "1";
|
|
17
|
+
/** 展览馆 */
|
|
18
|
+
EVenueSimpleTypes$1["Exhibitions"] = "2";
|
|
19
|
+
/** 演艺活动 */
|
|
20
|
+
EVenueSimpleTypes$1["Activity"] = "3";
|
|
21
|
+
/** 电影 */
|
|
22
|
+
EVenueSimpleTypes$1["Movie"] = "4";
|
|
23
|
+
return EVenueSimpleTypes$1;
|
|
24
|
+
}({});
|
|
17
25
|
|
|
18
26
|
//#endregion
|
|
19
|
-
export {
|
|
27
|
+
export { EVenueSimpleTypes, EVenueTypes };
|
package/es/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { routePrefix, routes } from "./constants/routes/index.js";
|
|
2
|
+
import { app_permission } from "./constants/permission/index.js";
|
|
2
3
|
import { BusinessLineDict, EBusinessLine, ESubBizType } from "./enums/business-line/index.js";
|
|
3
4
|
import { EAppEnv } from "./enums/environment/index.js";
|
|
4
5
|
import { ECaller } from "./enums/sdk/index.js";
|
|
5
|
-
import {
|
|
6
|
+
import { EVenueSimpleTypes, EVenueTypes } from "./enums/sub/enjoy/index.js";
|
|
6
7
|
import { EFoodPackageType, EFoodsModuleType } from "./enums/sub/foods/index.js";
|
|
7
8
|
import { EHotelType } from "./enums/sub/hotel/index.js";
|
|
8
9
|
import { IOneTravelSDKConfig } from "./types/one-travel-service/index.js";
|
|
@@ -10,6 +11,8 @@ import { getQueryParameters, isEmpty, query2url } from "./utils/common/index.js"
|
|
|
10
11
|
import { ActivityCalendarDetailPageParams, getActivityCalendarDetailPage } from "./utils/pages/activity-calendar/index.js";
|
|
11
12
|
import { WebviewPageParams, getWebviewPage } from "./utils/pages/webview/index.js";
|
|
12
13
|
import { getFoodPackagePage, getFoodStorePage } from "./utils/pages/food/index.js";
|
|
14
|
+
import { getMoviePage } from "./utils/pages/movie/index.js";
|
|
13
15
|
import { EMessagesType, navigateBack, navigateTo, postMessage, redirectTo } from "./utils/web-view/index.js";
|
|
16
|
+
import { isAndroid, isApp, isH5, isHarmony, isWeixin, isiOS } from "./utils/uni-env/index.js";
|
|
14
17
|
import { OneTravelSDK } from "./entry.js";
|
|
15
|
-
export { ActivityCalendarDetailPageParams, BusinessLineDict, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, ESubBizType,
|
|
18
|
+
export { ActivityCalendarDetailPageParams, BusinessLineDict, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, ESubBizType, EVenueSimpleTypes, EVenueTypes, IOneTravelSDKConfig, OneTravelSDK, WebviewPageParams, app_permission, getActivityCalendarDetailPage, getFoodPackagePage, getFoodStorePage, getMoviePage, getQueryParameters, getWebviewPage, isAndroid, isApp, isEmpty, isH5, isHarmony, isWeixin, isiOS, navigateBack, navigateTo, postMessage, query2url, redirectTo, routePrefix, routes };
|
package/es/index.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { routePrefix, routes } from "./constants/routes/index.js";
|
|
2
|
+
import { app_permission } from "./constants/permission/index.js";
|
|
2
3
|
import { BusinessLineDict, EBusinessLine, ESubBizType } from "./enums/business-line/index.js";
|
|
3
4
|
import { EAppEnv } from "./enums/environment/index.js";
|
|
4
5
|
import { ECaller } from "./enums/sdk/index.js";
|
|
5
|
-
import {
|
|
6
|
+
import { EVenueSimpleTypes, EVenueTypes } from "./enums/sub/enjoy/index.js";
|
|
6
7
|
import { EFoodPackageType, EFoodsModuleType } from "./enums/sub/foods/index.js";
|
|
7
8
|
import { EHotelType } from "./enums/sub/hotel/index.js";
|
|
8
9
|
import { getQueryParameters, isEmpty, query2url } from "./utils/common/index.js";
|
|
9
10
|
import { getActivityCalendarDetailPage } from "./utils/pages/activity-calendar/index.js";
|
|
10
11
|
import { getWebviewPage } from "./utils/pages/webview/index.js";
|
|
11
12
|
import { getFoodPackagePage, getFoodStorePage } from "./utils/pages/food/index.js";
|
|
13
|
+
import { getMoviePage } from "./utils/pages/movie/index.js";
|
|
12
14
|
import { EMessagesType, navigateBack, navigateTo, postMessage, redirectTo } from "./utils/web-view/index.js";
|
|
15
|
+
import { isAndroid, isApp, isH5, isHarmony, isWeixin, isiOS } from "./utils/uni-env/index.js";
|
|
13
16
|
import { OneTravelSDK } from "./entry.js";
|
|
14
17
|
|
|
15
|
-
export { BusinessLineDict, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, ESubBizType,
|
|
18
|
+
export { BusinessLineDict, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, ESubBizType, EVenueSimpleTypes, EVenueTypes, OneTravelSDK, app_permission, getActivityCalendarDetailPage, getFoodPackagePage, getFoodStorePage, getMoviePage, getQueryParameters, getWebviewPage, isAndroid, isApp, isEmpty, isH5, isHarmony, isWeixin, isiOS, navigateBack, navigateTo, postMessage, query2url, redirectTo, routePrefix, routes };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IOneTravelSDKConfig } from "../../types/one-travel-service/index.js";
|
|
2
|
+
import { IJumpProductDetailItem } from "./type.js";
|
|
3
|
+
|
|
4
|
+
//#region src/services/goods/service.d.ts
|
|
5
|
+
type IGoodsServiceConfig = {
|
|
6
|
+
sdkConfig: IOneTravelSDKConfig;
|
|
7
|
+
};
|
|
8
|
+
declare class GoodsService {
|
|
9
|
+
private goodsServiceConfig;
|
|
10
|
+
constructor(config: IGoodsServiceConfig);
|
|
11
|
+
/**
|
|
12
|
+
* 跳转商品详情页面
|
|
13
|
+
* @param item 商品数据
|
|
14
|
+
*/
|
|
15
|
+
jumpToProductDetailPage: (item: IJumpProductDetailItem) => void;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { GoodsService };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { routePrefix } from "../../constants/routes/index.js";
|
|
2
2
|
import { EBusinessLine, ESubBizType } from "../../enums/business-line/index.js";
|
|
3
3
|
import { ECaller } from "../../enums/sdk/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { EVenueSimpleTypes } from "../../enums/sub/enjoy/index.js";
|
|
5
5
|
import { EFoodsModuleType } from "../../enums/sub/foods/index.js";
|
|
6
6
|
import { EHotelType } from "../../enums/sub/hotel/index.js";
|
|
7
|
-
import { getActivityCalendarDetailPage } from "../../utils/pages/activity-calendar/index.js";
|
|
8
7
|
import { getWebviewPage } from "../../utils/pages/webview/index.js";
|
|
9
8
|
import { getFoodPackagePage, getFoodStorePage } from "../../utils/pages/food/index.js";
|
|
9
|
+
import { getMoviePage } from "../../utils/pages/movie/index.js";
|
|
10
10
|
import { navigateTo } from "../../utils/web-view/index.js";
|
|
11
11
|
import { getAppConfig } from "../../configs/app/index.js";
|
|
12
12
|
|
|
@@ -17,112 +17,6 @@ var GoodsService = class {
|
|
|
17
17
|
this.goodsServiceConfig = config;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* 跳转到各商品详情
|
|
21
|
-
* @param options 可选项
|
|
22
|
-
*/
|
|
23
|
-
jumpToGoodsDetail = async (options) => {
|
|
24
|
-
const configOptions = this.goodsServiceConfig.sdkConfig;
|
|
25
|
-
const appConfig = getAppConfig(configOptions.appEnv);
|
|
26
|
-
const { skuId, linkBusinessLine, type = "", item } = options || {};
|
|
27
|
-
let page = "";
|
|
28
|
-
switch (linkBusinessLine) {
|
|
29
|
-
case EBusinessLine.Scenic:
|
|
30
|
-
/** 景区/门票 */
|
|
31
|
-
page = `${routePrefix.ticket}/detail/index?scenicId=${skuId}&reservationId=${item.reservationId}&isOld=${item.isOld}`;
|
|
32
|
-
break;
|
|
33
|
-
case EBusinessLine.Hotel:
|
|
34
|
-
/** 酒店 */
|
|
35
|
-
page = `${routePrefix.hotel}/home/details/index?id=${skuId}`;
|
|
36
|
-
break;
|
|
37
|
-
case EBusinessLine.Homestay:
|
|
38
|
-
/** 民宿 */
|
|
39
|
-
if (type === EHotelType.hotel)
|
|
40
|
-
/** 酒店 (天下房仓酒店详情页)*/
|
|
41
|
-
page = `${routePrefix.hotel}/home/details/index?id=${skuId}`;
|
|
42
|
-
else if (`${item.subBizType}` === `${ESubBizType.HomestayHotel}`) page = `${routePrefix.hotel}/home/details/index?id=${skuId}`;
|
|
43
|
-
else page = `${routePrefix.hotel}/home/hot-sale-details/index?id=${skuId}`;
|
|
44
|
-
break;
|
|
45
|
-
case EBusinessLine.Route:
|
|
46
|
-
/** 路线/定制 */
|
|
47
|
-
page = `${routePrefix.road}/product-detail/index?id=${skuId}`;
|
|
48
|
-
break;
|
|
49
|
-
case EBusinessLine.Travel:
|
|
50
|
-
/** 出行 */
|
|
51
|
-
break;
|
|
52
|
-
case EBusinessLine.Foods:
|
|
53
|
-
/** 美食 */
|
|
54
|
-
if (item?.moduleType === EFoodsModuleType.store)
|
|
55
|
-
/** 收藏跳店铺 */
|
|
56
|
-
page = getWebviewPage({ url: getFoodStorePage(appConfig.domain.food, item.storeId || item.id) });
|
|
57
|
-
else
|
|
58
|
-
/** 跳转套餐 */
|
|
59
|
-
page = getWebviewPage({ url: getFoodPackagePage(appConfig.domain.food, item.storeId || item.id, skuId) });
|
|
60
|
-
break;
|
|
61
|
-
case EBusinessLine.Buy:
|
|
62
|
-
/** 购物 */
|
|
63
|
-
page = getWebviewPage({ url: appConfig.domain.shopping + `goods?itemId=${item.id || item.spuId}` });
|
|
64
|
-
break;
|
|
65
|
-
case EBusinessLine.Onebuygz:
|
|
66
|
-
/** 新购物 */
|
|
67
|
-
page = getWebviewPage({ url: appConfig.domain.onebuygz + `pages/commodity-detail/index?itemId=${item.spuId || item.id}&skuId=${item.skuId}` });
|
|
68
|
-
break;
|
|
69
|
-
case EBusinessLine.Entertainment:
|
|
70
|
-
/** 文娱 */
|
|
71
|
-
if (`${item.type}` === EVenueTypesDes[EVenueTypes.Activity] || `${item.subBizType}` === `${ESubBizType.EntertainmentPerform}`) page = `${routePrefix.enjoy}/g-activity/detail?id=` + skuId + "&mchId=" + (item.storeId || "");
|
|
72
|
-
else page = `${routePrefix.enjoy}/g-venue/detail?id=${skuId}&reservationId=${item.reservationId}`;
|
|
73
|
-
break;
|
|
74
|
-
case EBusinessLine.Strategy:
|
|
75
|
-
/** 攻略 */
|
|
76
|
-
page = `${routePrefix.strategy}/strategy-detail/index?id=` + skuId;
|
|
77
|
-
break;
|
|
78
|
-
case EBusinessLine.Recommend:
|
|
79
|
-
/** 种草 */
|
|
80
|
-
page = `${routePrefix.show}/details/index?id=${skuId}${item?.moreParameter ? item.moreParameter : ""}`;
|
|
81
|
-
break;
|
|
82
|
-
case EBusinessLine.Activity:
|
|
83
|
-
/** 活动 */
|
|
84
|
-
page = getActivityCalendarDetailPage({
|
|
85
|
-
id: skuId,
|
|
86
|
-
date: item.collectTime
|
|
87
|
-
});
|
|
88
|
-
break;
|
|
89
|
-
case EBusinessLine.SoundGuizhou:
|
|
90
|
-
/** 声入贵州 */
|
|
91
|
-
page = `${routePrefix.soundGuizhou}/detail?audioLibId=${skuId}`;
|
|
92
|
-
break;
|
|
93
|
-
case EBusinessLine.ExcitingVideo:
|
|
94
|
-
/** 精彩视频 */
|
|
95
|
-
page = `${routePrefix.living}/wonderful-video/index?vid=${skuId}`;
|
|
96
|
-
break;
|
|
97
|
-
default: break;
|
|
98
|
-
}
|
|
99
|
-
if (page) {
|
|
100
|
-
if (configOptions.caller === ECaller.web) navigateTo({ src: page });
|
|
101
|
-
else if (configOptions.caller === ECaller.host) {}
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
* 跳转商品详情页
|
|
106
|
-
* @param item
|
|
107
|
-
*/
|
|
108
|
-
jumpToGoodsDetailPage = (item) => {
|
|
109
|
-
let extInfo = item?.extInfoMap || item?.extInfo || {};
|
|
110
|
-
try {
|
|
111
|
-
extInfo = typeof extInfo === "string" ? JSON.parse(extInfo) : extInfo;
|
|
112
|
-
} catch {}
|
|
113
|
-
const obj = item?.extInfoMap || item?.extInfo ? {
|
|
114
|
-
...item,
|
|
115
|
-
...extInfo
|
|
116
|
-
} : item;
|
|
117
|
-
if (obj?.type === EHotelType.hotel) item.skuId = obj?.storeId;
|
|
118
|
-
this.jumpToGoodsDetail({
|
|
119
|
-
skuId: item?.skuId || item?.spuId || item?.id || "",
|
|
120
|
-
linkBusinessLine: obj.linkBusinessLine || obj.bizType || obj.businessType,
|
|
121
|
-
type: obj.type,
|
|
122
|
-
item: obj
|
|
123
|
-
}).then().catch();
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
20
|
* 跳转商品详情页面
|
|
127
21
|
* @param item 商品数据
|
|
128
22
|
*/
|
|
@@ -192,9 +86,16 @@ var GoodsService = class {
|
|
|
192
86
|
const entertainmentSubBizType = item?.entertainment?.subBizType || extInfo?.subBizType;
|
|
193
87
|
const entertainmentType = item?.entertainment?.type || extInfo?.type || item?.common?.type;
|
|
194
88
|
const entertainmentReservationId = item?.entertainment?.reservationId || extInfo?.reservationId || item?.common?.reservationId;
|
|
195
|
-
if (`${entertainmentType}` ===
|
|
89
|
+
if (`${entertainmentType}` === EVenueSimpleTypes.Activity || `${entertainmentSubBizType}` === `${ESubBizType.EntertainmentPerform}`) page = `${routePrefix.enjoy}/g-activity/detail?id=` + entertainmentId + "&mchId=" + entertainmentStoreId;
|
|
196
90
|
else page = `${routePrefix.enjoy}/g-venue/detail?id=${entertainmentId}&reservationId=${entertainmentReservationId}`;
|
|
197
91
|
break;
|
|
92
|
+
case EBusinessLine.Movie:
|
|
93
|
+
let movieId = item?.movie?.id || "";
|
|
94
|
+
try {
|
|
95
|
+
movieId = JSON.parse(extInfo?.extInfo || "{}")?.thirdMovieId || "";
|
|
96
|
+
} catch (e) {}
|
|
97
|
+
page = getMoviePage(appConfig.domain.movie, movieId);
|
|
98
|
+
break;
|
|
198
99
|
case EBusinessLine.Strategy:
|
|
199
100
|
const strategyId = item?.strategy?.id || item?.common?.spuId || item?.common?.id;
|
|
200
101
|
page = `${routePrefix.strategy}/strategy-detail/index?id=` + strategyId;
|
|
@@ -1,28 +1,7 @@
|
|
|
1
1
|
import { EBusinessLine, ESubBizType } from "../../enums/business-line/index.js";
|
|
2
2
|
import { EFoodPackageType, EFoodsModuleType } from "../../enums/sub/foods/index.js";
|
|
3
|
-
import { EHotelType } from "../../enums/sub/hotel/index.js";
|
|
4
3
|
|
|
5
4
|
//#region src/services/goods/type.d.ts
|
|
6
|
-
type IJumpGoodsDetailItem = {
|
|
7
|
-
/** 扩展参数(JSON数据) */
|
|
8
|
-
extInfoMap?: string;
|
|
9
|
-
/** 扩展参数(JSON数据) */
|
|
10
|
-
extInfo?: string;
|
|
11
|
-
/** 商品skuId */
|
|
12
|
-
skuId?: string;
|
|
13
|
-
/** 商品spuId */
|
|
14
|
-
spuId?: string;
|
|
15
|
-
/** 商品id */
|
|
16
|
-
id?: string;
|
|
17
|
-
/** 类型 (只有linkBusinessLine === EBusinessType.Homestay 才有用, 有就是酒店商品,没有就是爆款商品) */
|
|
18
|
-
type?: EHotelType;
|
|
19
|
-
/** 酒店或名宿 */
|
|
20
|
-
storeId?: string;
|
|
21
|
-
/** 业务线(不同的字段) */
|
|
22
|
-
linkBusinessLine?: EBusinessLine;
|
|
23
|
-
bizType?: EBusinessLine;
|
|
24
|
-
businessType?: EBusinessLine;
|
|
25
|
-
};
|
|
26
5
|
type IJumpProductDetailItemCommonExtInfo = {
|
|
27
6
|
reservationId?: string;
|
|
28
7
|
type?: 'hotel' | '1' | '3';
|
|
@@ -37,6 +16,9 @@ type IJumpProductDetailItemCommonExtInfo = {
|
|
|
37
16
|
/************ 美食相关字段 ************/
|
|
38
17
|
/************ 种草相关字段 ************/
|
|
39
18
|
moreParameter?: string;
|
|
19
|
+
/************ 种草相关字段 ************/
|
|
20
|
+
/************ 电影相关字段 ************/
|
|
21
|
+
extInfo: string;
|
|
40
22
|
};
|
|
41
23
|
/**
|
|
42
24
|
* 商品数据
|
|
@@ -105,6 +87,10 @@ type IJumpProductDetailItem = {
|
|
|
105
87
|
moduleType?: EFoodsModuleType;
|
|
106
88
|
storePrecedentType?: EFoodPackageType;
|
|
107
89
|
};
|
|
90
|
+
/** 电影 */
|
|
91
|
+
movie?: {
|
|
92
|
+
id: string;
|
|
93
|
+
};
|
|
108
94
|
/** 文娱 */
|
|
109
95
|
entertainment?: {
|
|
110
96
|
id: string;
|
|
@@ -132,4 +118,4 @@ type IJumpProductDetailItem = {
|
|
|
132
118
|
};
|
|
133
119
|
};
|
|
134
120
|
//#endregion
|
|
135
|
-
export {
|
|
121
|
+
export { IJumpProductDetailItem };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { app_permission } from "../../constants/permission/index.js";
|
|
2
|
+
import { IOneTravelSDKConfig } from "../../types/one-travel-service/index.js";
|
|
3
|
+
|
|
4
|
+
//#region src/services/native-app/service.d.ts
|
|
5
|
+
type INativeAppServiceConfig = {
|
|
6
|
+
sdkConfig: IOneTravelSDKConfig;
|
|
7
|
+
};
|
|
8
|
+
declare class NativeAppService {
|
|
9
|
+
private nativeAppServiceConfig;
|
|
10
|
+
constructor(config: INativeAppServiceConfig);
|
|
11
|
+
/**
|
|
12
|
+
* 关闭安卓提示弹框
|
|
13
|
+
*/
|
|
14
|
+
private closeAndroidTip;
|
|
15
|
+
/**
|
|
16
|
+
* 显示安卓提示弹框
|
|
17
|
+
* @param options
|
|
18
|
+
*/
|
|
19
|
+
private showAndroidTip;
|
|
20
|
+
/**
|
|
21
|
+
* 检测并申请app权限
|
|
22
|
+
* @param type
|
|
23
|
+
* @param success
|
|
24
|
+
* @param fail
|
|
25
|
+
*/
|
|
26
|
+
checkAndRequestNativeAppPermissions: (type: keyof typeof app_permission, success?: () => void, fail?: () => void) => void;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { NativeAppService };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { app_permission } from "../../constants/permission/index.js";
|
|
2
|
+
import { isH5, isHarmony, isWeixin, isiOS } from "../../utils/uni-env/index.js";
|
|
3
|
+
|
|
4
|
+
//#region src/services/native-app/service.ts
|
|
5
|
+
let view;
|
|
6
|
+
var NativeAppService = class {
|
|
7
|
+
nativeAppServiceConfig;
|
|
8
|
+
constructor(config) {
|
|
9
|
+
this.nativeAppServiceConfig = config;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 关闭安卓提示弹框
|
|
13
|
+
*/
|
|
14
|
+
closeAndroidTip = () => {
|
|
15
|
+
if (view) {
|
|
16
|
+
view.close();
|
|
17
|
+
view = void 0;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* 显示安卓提示弹框
|
|
22
|
+
* @param options
|
|
23
|
+
*/
|
|
24
|
+
showAndroidTip = (options) => {
|
|
25
|
+
const { title, value } = options;
|
|
26
|
+
view = new plus.nativeObj.View("per-modal", {
|
|
27
|
+
top: "0px",
|
|
28
|
+
left: "0px",
|
|
29
|
+
width: "100%",
|
|
30
|
+
backgroundColor: "rgba(0,0,0,0.2)"
|
|
31
|
+
});
|
|
32
|
+
view.drawRect({
|
|
33
|
+
color: "#fff",
|
|
34
|
+
radius: "5px"
|
|
35
|
+
}, {
|
|
36
|
+
top: "45px",
|
|
37
|
+
left: "5%",
|
|
38
|
+
width: "90%",
|
|
39
|
+
height: "130px"
|
|
40
|
+
});
|
|
41
|
+
view.drawText(title, {
|
|
42
|
+
top: "50px",
|
|
43
|
+
left: "8%",
|
|
44
|
+
height: "30px"
|
|
45
|
+
}, {
|
|
46
|
+
align: "left",
|
|
47
|
+
weight: "bold",
|
|
48
|
+
color: "#000"
|
|
49
|
+
});
|
|
50
|
+
view.drawText(value, {
|
|
51
|
+
top: "75px",
|
|
52
|
+
height: "90px",
|
|
53
|
+
left: "8%",
|
|
54
|
+
width: "84%"
|
|
55
|
+
}, {
|
|
56
|
+
whiteSpace: "normal",
|
|
57
|
+
size: "14px",
|
|
58
|
+
align: "left",
|
|
59
|
+
color: "#656563"
|
|
60
|
+
});
|
|
61
|
+
view.show();
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* 检测并申请app权限
|
|
65
|
+
* @param type
|
|
66
|
+
* @param success
|
|
67
|
+
* @param fail
|
|
68
|
+
*/
|
|
69
|
+
checkAndRequestNativeAppPermissions = (type, success, fail) => {
|
|
70
|
+
let that = this;
|
|
71
|
+
if (isWeixin() || isH5() || isHarmony() || isiOS()) {
|
|
72
|
+
success?.();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const ActivityCompat = plus.android.importClass("androidx.core.app.ActivityCompat");
|
|
76
|
+
const PackageManager = plus.android.importClass("android.content.pm.PackageManager");
|
|
77
|
+
const context = plus.android.runtimeMainActivity();
|
|
78
|
+
const detail = app_permission[type];
|
|
79
|
+
let hasPermission = false;
|
|
80
|
+
detail.permissionId.forEach((item) => {
|
|
81
|
+
if (ActivityCompat.checkSelfPermission(context, item) !== PackageManager.PERMISSION_GRANTED) {
|
|
82
|
+
hasPermission = true;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
if (!hasPermission) {
|
|
87
|
+
success?.();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
that.showAndroidTip(detail);
|
|
91
|
+
plus.android.requestPermissions(detail.permissionId, function(resultObj) {
|
|
92
|
+
if (resultObj.granted.length > 0) {
|
|
93
|
+
that.closeAndroidTip();
|
|
94
|
+
success?.();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (resultObj.deniedPresent.length > 0) {
|
|
98
|
+
that.closeAndroidTip();
|
|
99
|
+
fail?.();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (resultObj.deniedAlways.length > 0) {
|
|
103
|
+
uni.showModal({
|
|
104
|
+
title: "提示",
|
|
105
|
+
content: app_permission[type].denied,
|
|
106
|
+
confirmText: "去设置",
|
|
107
|
+
success: function(res) {
|
|
108
|
+
that.closeAndroidTip();
|
|
109
|
+
if (res.confirm) uni.openAppAuthorizeSetting({ success: () => fail?.() });
|
|
110
|
+
if (res.cancel) fail?.();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
}, function() {
|
|
116
|
+
that.closeAndroidTip();
|
|
117
|
+
fail?.();
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
//#endregion
|
|
123
|
+
export { NativeAppService };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { query2url } from "../../common/index.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/pages/movie/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* 电影票地址
|
|
6
|
+
*/
|
|
7
|
+
const getMoviePage = (domain, movie_id) => {
|
|
8
|
+
return `${domain}pages/film/home${query2url({
|
|
9
|
+
my: 1,
|
|
10
|
+
movie_id
|
|
11
|
+
}, { encode: false })}`;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getMoviePage };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/utils/uni-env/index.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* 是否是web环境
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
declare const isH5: () => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* 是否是微信小程序
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
declare const isWeixin: () => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 是否是鸿蒙
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
declare const isHarmony: () => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 是否是app
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
declare const isApp: () => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 是否是安卓
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
declare const isAndroid: () => boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 是否是iOS
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
declare const isiOS: () => boolean;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { isAndroid, isApp, isH5, isHarmony, isWeixin, isiOS };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region src/utils/uni-env/index.ts
|
|
2
|
+
/**
|
|
3
|
+
* 是否是web环境
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
const isH5 = () => {
|
|
7
|
+
return true;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* 是否是微信小程序
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
const isWeixin = () => {
|
|
14
|
+
return true;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* 是否是鸿蒙
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
const isHarmony = () => {
|
|
21
|
+
return true;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* 是否是app
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
const isApp = () => {
|
|
28
|
+
if (isHarmony()) return true;
|
|
29
|
+
return true;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* 是否是安卓
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
const isAndroid = () => {
|
|
36
|
+
return true;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* 是否是iOS
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
const isiOS = () => {
|
|
43
|
+
return true;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { isAndroid, isApp, isH5, isHarmony, isWeixin, isiOS };
|