@x-edu/service 0.0.7 → 0.0.9
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/dist/config/index.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/request/cdn.d.ts +3 -0
- package/dist/request/uc.d.ts +5 -0
- package/dist/service/ndr.d.ts +95 -0
- package/dist/service.js +173 -13
- package/dist/service.mjs +173 -13
- package/dist/service.umd.js +173 -13
- package/package.json +1 -1
package/dist/config/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ declare const config: {
|
|
|
31
31
|
'e-favorite-api': string;
|
|
32
32
|
'x-study-record': string;
|
|
33
33
|
cdn: string;
|
|
34
|
+
'cdn-hot-proxy': string;
|
|
34
35
|
'site-config': string;
|
|
35
36
|
serviceName: {
|
|
36
37
|
site: string;
|
|
@@ -41,6 +42,7 @@ declare const config: {
|
|
|
41
42
|
};
|
|
42
43
|
defaultAreaSite: string;
|
|
43
44
|
'elearning-library': string;
|
|
45
|
+
uc: string;
|
|
44
46
|
};
|
|
45
47
|
};
|
|
46
48
|
export default config;
|
package/dist/index.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export declare const serviceConfig: {
|
|
|
48
48
|
'e-favorite-api': string;
|
|
49
49
|
'x-study-record': string;
|
|
50
50
|
cdn: string;
|
|
51
|
+
'cdn-hot-proxy': string;
|
|
51
52
|
'site-config': string;
|
|
52
53
|
serviceName: {
|
|
53
54
|
site: string;
|
|
@@ -58,5 +59,6 @@ export declare const serviceConfig: {
|
|
|
58
59
|
};
|
|
59
60
|
defaultAreaSite: string;
|
|
60
61
|
'elearning-library': string;
|
|
62
|
+
uc: string;
|
|
61
63
|
};
|
|
62
64
|
};
|
package/dist/request/cdn.d.ts
CHANGED
|
@@ -7,3 +7,6 @@ export declare const cdnSFileAPI: ({ env, }: {
|
|
|
7
7
|
export declare const cdnBdcsFileAPI: ({ env, }: {
|
|
8
8
|
env: any;
|
|
9
9
|
}) => import('../../node_modules/@x-edu/functions/dist/request/interface').RequestInstance;
|
|
10
|
+
export declare const cdnHotProxyAPI: ({ env }: {
|
|
11
|
+
env: any;
|
|
12
|
+
}) => import('../../node_modules/@x-edu/functions/dist/request/interface').RequestInstance;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
declare class Ndr {
|
|
2
|
+
request: any;
|
|
3
|
+
config: any;
|
|
4
|
+
constructor(props: any);
|
|
5
|
+
getResourceDetail: ({ contentId, serviceName }: {
|
|
6
|
+
contentId: any;
|
|
7
|
+
serviceName: any;
|
|
8
|
+
}) => Promise<any>;
|
|
9
|
+
getThematicCourseTree: ({ contentId, serviceName }: {
|
|
10
|
+
contentId: any;
|
|
11
|
+
serviceName: any;
|
|
12
|
+
}) => Promise<any>;
|
|
13
|
+
getThematicList: ({ contentId, serviceName }: {
|
|
14
|
+
contentId: any;
|
|
15
|
+
serviceName: any;
|
|
16
|
+
}) => Promise<any>;
|
|
17
|
+
fetchRegionLessonCourseList: ({ regionId, businessType, teachingmaterialId }: {
|
|
18
|
+
regionId: any;
|
|
19
|
+
businessType: any;
|
|
20
|
+
teachingmaterialId: any;
|
|
21
|
+
}) => Promise<never[]>;
|
|
22
|
+
BusinessType: {
|
|
23
|
+
AutoLearning: string;
|
|
24
|
+
Prepare: string;
|
|
25
|
+
};
|
|
26
|
+
fetchPrepareLessonChapter: ({ id, serviceName }: {
|
|
27
|
+
id: any;
|
|
28
|
+
serviceName: any;
|
|
29
|
+
}) => Promise<any>;
|
|
30
|
+
fetchPrepareLessonTreeCourseList: ({ id, serviceName }: {
|
|
31
|
+
id: any;
|
|
32
|
+
serviceName: any;
|
|
33
|
+
}) => Promise<never[]>;
|
|
34
|
+
fetchPrepareType: ({ serviceName }: {
|
|
35
|
+
serviceName: any;
|
|
36
|
+
}) => Promise<any>;
|
|
37
|
+
fetchNationalLessonChapter: ({ id, serviceName }: {
|
|
38
|
+
id: any;
|
|
39
|
+
serviceName: any;
|
|
40
|
+
}) => Promise<any>;
|
|
41
|
+
fetchNationalLessonCourseList: ({ id, serviceName }: {
|
|
42
|
+
id: any;
|
|
43
|
+
serviceName: any;
|
|
44
|
+
}) => Promise<never[]>;
|
|
45
|
+
fetchNationalLessonDetail: ({ id, serviceName }: {
|
|
46
|
+
id: any;
|
|
47
|
+
serviceName: any;
|
|
48
|
+
}) => Promise<any>;
|
|
49
|
+
fetchPrepareLessonRelate: ({ id, serviceName }: {
|
|
50
|
+
id: any;
|
|
51
|
+
serviceName: any;
|
|
52
|
+
}) => Promise<any>;
|
|
53
|
+
fetchPrepareLesson: ({ id, serviceName }: {
|
|
54
|
+
id: any;
|
|
55
|
+
serviceName: any;
|
|
56
|
+
}) => Promise<any>;
|
|
57
|
+
fetchPrepareLessonSubResource: ({ id, serviceName }: {
|
|
58
|
+
id: any;
|
|
59
|
+
serviceName: any;
|
|
60
|
+
}) => Promise<any>;
|
|
61
|
+
fetchNationalLessonCourseDetail: ({ id, serviceName }: {
|
|
62
|
+
id: any;
|
|
63
|
+
serviceName: any;
|
|
64
|
+
}) => Promise<any>;
|
|
65
|
+
fetchPrepareLessonDetail: ({ id, serviceName }: {
|
|
66
|
+
id: any;
|
|
67
|
+
serviceName: any;
|
|
68
|
+
}) => Promise<any>;
|
|
69
|
+
fetchRegionResourceDetail: ({ regionId, containerId, resourceId, serviceName }: {
|
|
70
|
+
regionId: any;
|
|
71
|
+
containerId: any;
|
|
72
|
+
resourceId: any;
|
|
73
|
+
serviceName: any;
|
|
74
|
+
}) => Promise<any>;
|
|
75
|
+
fetchRegionLessonRelate: ({ regionId, containerId, resourceId, serviceName }: {
|
|
76
|
+
regionId: any;
|
|
77
|
+
containerId: any;
|
|
78
|
+
resourceId: any;
|
|
79
|
+
serviceName: any;
|
|
80
|
+
}) => Promise<any>;
|
|
81
|
+
fetchQualityCourse: ({ courseId, isTest, service }: {
|
|
82
|
+
courseId: any;
|
|
83
|
+
isTest: any;
|
|
84
|
+
service: any;
|
|
85
|
+
}) => Promise<any>;
|
|
86
|
+
fetchTeachingLessonDetail: ({ id, serviceName }: {
|
|
87
|
+
id: any;
|
|
88
|
+
serviceName: any;
|
|
89
|
+
}) => Promise<any>;
|
|
90
|
+
fetchTeachingLessonRelate: ({ id, serviceName }: {
|
|
91
|
+
id: any;
|
|
92
|
+
serviceName: any;
|
|
93
|
+
}) => Promise<any>;
|
|
94
|
+
}
|
|
95
|
+
export default Ndr;
|
package/dist/service.js
CHANGED
|
@@ -15161,7 +15161,7 @@ var Auth = /* @__PURE__ */ function() {
|
|
|
15161
15161
|
});
|
|
15162
15162
|
_defineProperty(this, "getIndentity", /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee9() {
|
|
15163
15163
|
var _this$userInfo;
|
|
15164
|
-
var userId, force, userIdentities, _userIdentities$userI, _userIdentities$userI2,
|
|
15164
|
+
var userId, force, userIdentities, _userIdentities$userI, _userIdentities$userI2, ucAPI2, url, _ref15, _ref15$items, items, identities, _getUserIdentitiesCac, userIdentitiesCache, _args9 = arguments;
|
|
15165
15165
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
15166
15166
|
while (1)
|
|
15167
15167
|
switch (_context9.prev = _context9.next) {
|
|
@@ -15176,14 +15176,14 @@ var Auth = /* @__PURE__ */ function() {
|
|
|
15176
15176
|
case 4:
|
|
15177
15177
|
userIdentities = _this.userIdentities;
|
|
15178
15178
|
_context9.prev = 5;
|
|
15179
|
-
|
|
15179
|
+
ucAPI2 = _this.ucApi();
|
|
15180
15180
|
if (!(!((_userIdentities$userI = userIdentities[userId]) !== null && _userIdentities$userI !== void 0 && (_userIdentities$userI = _userIdentities$userI.data) !== null && _userIdentities$userI !== void 0 && (_userIdentities$userI = _userIdentities$userI.items) !== null && _userIdentities$userI !== void 0 && _userIdentities$userI.length) || force)) {
|
|
15181
15181
|
_context9.next = 12;
|
|
15182
15182
|
break;
|
|
15183
15183
|
}
|
|
15184
15184
|
url = `/users/${userId}/identities`;
|
|
15185
15185
|
_context9.next = 11;
|
|
15186
|
-
return
|
|
15186
|
+
return ucAPI2.get(url);
|
|
15187
15187
|
case 11:
|
|
15188
15188
|
userIdentities[userId] = _context9.sent;
|
|
15189
15189
|
case 12:
|
|
@@ -15260,7 +15260,7 @@ var Auth = /* @__PURE__ */ function() {
|
|
|
15260
15260
|
_defineProperty(this, "addUserIdentities", /* @__PURE__ */ function() {
|
|
15261
15261
|
var _ref19 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee11(_ref18) {
|
|
15262
15262
|
var _this$userInfo2;
|
|
15263
|
-
var _ref18$userId, userId, code,
|
|
15263
|
+
var _ref18$userId, userId, code, ucAPI2;
|
|
15264
15264
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
15265
15265
|
while (1)
|
|
15266
15266
|
switch (_context11.prev = _context11.next) {
|
|
@@ -15272,9 +15272,9 @@ var Auth = /* @__PURE__ */ function() {
|
|
|
15272
15272
|
}
|
|
15273
15273
|
return _context11.abrupt("return");
|
|
15274
15274
|
case 3:
|
|
15275
|
-
|
|
15275
|
+
ucAPI2 = _this.ucApi();
|
|
15276
15276
|
_context11.next = 6;
|
|
15277
|
-
return
|
|
15277
|
+
return ucAPI2.post(`/users/${userId}/identities`, {
|
|
15278
15278
|
identity_code: code
|
|
15279
15279
|
});
|
|
15280
15280
|
case 6:
|
|
@@ -15337,7 +15337,7 @@ var Auth = /* @__PURE__ */ function() {
|
|
|
15337
15337
|
}());
|
|
15338
15338
|
_defineProperty(this, "isStudent", /* @__PURE__ */ function() {
|
|
15339
15339
|
var _ref21 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee13(curUserInfo) {
|
|
15340
|
-
var checkOrg,
|
|
15340
|
+
var checkOrg, ucAPI2, checkIsStudent, isStudent, response, inst, _args13 = arguments;
|
|
15341
15341
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
15342
15342
|
while (1)
|
|
15343
15343
|
switch (_context13.prev = _context13.next) {
|
|
@@ -15349,7 +15349,7 @@ var Auth = /* @__PURE__ */ function() {
|
|
|
15349
15349
|
}
|
|
15350
15350
|
return _context13.abrupt("return", false);
|
|
15351
15351
|
case 3:
|
|
15352
|
-
|
|
15352
|
+
ucAPI2 = _this.ucApi();
|
|
15353
15353
|
checkIsStudent = true;
|
|
15354
15354
|
isStudent = false;
|
|
15355
15355
|
if (!checkOrg) {
|
|
@@ -15357,7 +15357,7 @@ var Auth = /* @__PURE__ */ function() {
|
|
|
15357
15357
|
break;
|
|
15358
15358
|
}
|
|
15359
15359
|
_context13.next = 9;
|
|
15360
|
-
return
|
|
15360
|
+
return ucAPI2.get("/institutions/actions/search", {
|
|
15361
15361
|
params: {
|
|
15362
15362
|
app_id: _this.getSdpAppId()
|
|
15363
15363
|
}
|
|
@@ -17654,6 +17654,7 @@ const config = {
|
|
|
17654
17654
|
// 学习记录
|
|
17655
17655
|
"x-study-record": "//x-study-record-api.beta.101.com",
|
|
17656
17656
|
cdn: "//ndcs-pre.101.com",
|
|
17657
|
+
"cdn-hot-proxy": "//betacs.101.com",
|
|
17657
17658
|
// 站点配置(存在灰度能力)
|
|
17658
17659
|
"site-config": "//grey-config-web.ykt.cbern.com.cn",
|
|
17659
17660
|
serviceName: {
|
|
@@ -17665,7 +17666,8 @@ const config = {
|
|
|
17665
17666
|
},
|
|
17666
17667
|
defaultAreaSite: "hn",
|
|
17667
17668
|
// 内容库
|
|
17668
|
-
"elearning-library": "//elearning-library-gateway.beta.101.com"
|
|
17669
|
+
"elearning-library": "//elearning-library-gateway.beta.101.com",
|
|
17670
|
+
uc: "https://uc-gateway.sdp.101.com"
|
|
17669
17671
|
}
|
|
17670
17672
|
};
|
|
17671
17673
|
const recommendAPIV2 = ({
|
|
@@ -17806,6 +17808,12 @@ const cdnBdcsFileAPI = ({
|
|
|
17806
17808
|
prefix: "",
|
|
17807
17809
|
noSdpAppId: true
|
|
17808
17810
|
});
|
|
17811
|
+
const cdnHotProxyAPI = ({
|
|
17812
|
+
env
|
|
17813
|
+
}) => getApi({
|
|
17814
|
+
host: config[env]["cdn-hot-proxy"],
|
|
17815
|
+
prefix: "/v0.1/static"
|
|
17816
|
+
});
|
|
17809
17817
|
const siteConfigAPI = ({
|
|
17810
17818
|
env,
|
|
17811
17819
|
sdpAppId
|
|
@@ -17824,6 +17832,16 @@ const eLearningLibraryAPI = ({
|
|
|
17824
17832
|
uc,
|
|
17825
17833
|
sdpAppId
|
|
17826
17834
|
});
|
|
17835
|
+
const ucAPI = ({
|
|
17836
|
+
uc,
|
|
17837
|
+
env,
|
|
17838
|
+
sdpAppId
|
|
17839
|
+
}) => getApi({
|
|
17840
|
+
host: config[env]["uc"],
|
|
17841
|
+
prefix: "/v1.1",
|
|
17842
|
+
uc,
|
|
17843
|
+
sdpAppId
|
|
17844
|
+
});
|
|
17827
17845
|
async function getStatByChunk(resIds, requestFn, ...args) {
|
|
17828
17846
|
try {
|
|
17829
17847
|
const chunkSize = 100;
|
|
@@ -18274,7 +18292,7 @@ class Assessment {
|
|
|
18274
18292
|
return assessmentVo;
|
|
18275
18293
|
});
|
|
18276
18294
|
__publicField(this, "getUserAssessmentRate", async ({ assessmentId, assessmentType = "course", userInfo }) => {
|
|
18277
|
-
const cacheKey = assessmentRateCacheKey(assessmentId, userInfo.user_id);
|
|
18295
|
+
const cacheKey = assessmentRateCacheKey(assessmentId, userInfo == null ? void 0 : userInfo.user_id);
|
|
18278
18296
|
let userAssessmentVo = localStorage.getItem(cacheKey);
|
|
18279
18297
|
if (userAssessmentVo) {
|
|
18280
18298
|
try {
|
|
@@ -19291,6 +19309,143 @@ class Library {
|
|
|
19291
19309
|
this.config = config2;
|
|
19292
19310
|
}
|
|
19293
19311
|
}
|
|
19312
|
+
class Ndr {
|
|
19313
|
+
constructor(props) {
|
|
19314
|
+
__publicField(this, "request");
|
|
19315
|
+
__publicField(this, "config");
|
|
19316
|
+
__publicField(this, "getResourceDetail", async ({ contentId, serviceName: serviceName2 }) => {
|
|
19317
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19318
|
+
`${serviceName2}/ndrs/special_edu/resources/details/${contentId}.json`
|
|
19319
|
+
);
|
|
19320
|
+
return data;
|
|
19321
|
+
});
|
|
19322
|
+
__publicField(this, "getThematicCourseTree", async ({ contentId, serviceName: serviceName2 }) => {
|
|
19323
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19324
|
+
`${serviceName2}/ndrs/special_edu/thematic_course/trees/${contentId}.json`
|
|
19325
|
+
);
|
|
19326
|
+
return data;
|
|
19327
|
+
});
|
|
19328
|
+
__publicField(this, "getThematicList", async ({ contentId, serviceName: serviceName2 }) => {
|
|
19329
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19330
|
+
`${serviceName2}/ndrs/special_edu/thematic_course/${contentId}/resources/list.json`
|
|
19331
|
+
);
|
|
19332
|
+
return data;
|
|
19333
|
+
});
|
|
19334
|
+
__publicField(this, "fetchRegionLessonCourseList", async ({ regionId, businessType, teachingmaterialId }) => {
|
|
19335
|
+
const { zxxRegion } = this.config.serviceName;
|
|
19336
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19337
|
+
`${zxxRegion}/${regionId}/${businessType}/teachingmaterials/${teachingmaterialId}/resources/parts.json`
|
|
19338
|
+
);
|
|
19339
|
+
const result = [];
|
|
19340
|
+
await Promise.all(
|
|
19341
|
+
data.map(async (t2, index) => {
|
|
19342
|
+
const { data: partData } = await this.request.cdn.cdnAPI.get(t2);
|
|
19343
|
+
result[index] = partData;
|
|
19344
|
+
})
|
|
19345
|
+
);
|
|
19346
|
+
return [].concat(...result);
|
|
19347
|
+
});
|
|
19348
|
+
__publicField(this, "BusinessType", {
|
|
19349
|
+
AutoLearning: "auto_learning",
|
|
19350
|
+
Prepare: "prepare"
|
|
19351
|
+
});
|
|
19352
|
+
__publicField(this, "fetchPrepareLessonChapter", async ({ id, serviceName: serviceName2 }) => {
|
|
19353
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/resources/trees/${id}.json`);
|
|
19354
|
+
return data;
|
|
19355
|
+
});
|
|
19356
|
+
__publicField(this, "fetchPrepareLessonTreeCourseList", async ({ id, serviceName: serviceName2 }) => {
|
|
19357
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19358
|
+
`${serviceName2}/ndrs/teachingmaterials/${id}/resources/parts.json`
|
|
19359
|
+
);
|
|
19360
|
+
const result = [];
|
|
19361
|
+
await Promise.all(
|
|
19362
|
+
data.map(async (t2, index) => {
|
|
19363
|
+
const { data: partData } = await this.request.cdn.cdnAPI.get(t2);
|
|
19364
|
+
result[index] = partData;
|
|
19365
|
+
})
|
|
19366
|
+
);
|
|
19367
|
+
return [].concat(...result);
|
|
19368
|
+
});
|
|
19369
|
+
__publicField(this, "fetchPrepareType", async ({ serviceName: serviceName2 }) => {
|
|
19370
|
+
var _a2, _b2;
|
|
19371
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/tags/res_types.json`);
|
|
19372
|
+
return (_b2 = (_a2 = data == null ? void 0 : data.hierarchies) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.children;
|
|
19373
|
+
});
|
|
19374
|
+
__publicField(this, "fetchNationalLessonChapter", async ({ id, serviceName: serviceName2 }) => {
|
|
19375
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/lessons/trees/${id}.json`);
|
|
19376
|
+
return data;
|
|
19377
|
+
});
|
|
19378
|
+
__publicField(this, "fetchNationalLessonCourseList", async ({ id, serviceName: serviceName2 }) => {
|
|
19379
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/teachingmaterials/${id}/lessons/parts.json`);
|
|
19380
|
+
const result = [];
|
|
19381
|
+
await Promise.all(
|
|
19382
|
+
data.map(async (t2, index) => {
|
|
19383
|
+
const { data: partData } = await this.request.cdn.cdnAPI.get(t2);
|
|
19384
|
+
result[index] = partData;
|
|
19385
|
+
})
|
|
19386
|
+
);
|
|
19387
|
+
return [].concat(...result);
|
|
19388
|
+
});
|
|
19389
|
+
__publicField(this, "fetchNationalLessonDetail", async ({ id, serviceName: serviceName2 }) => {
|
|
19390
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/teachingmaterials/details/${id}.json`);
|
|
19391
|
+
return data;
|
|
19392
|
+
});
|
|
19393
|
+
__publicField(this, "fetchPrepareLessonRelate", async ({ id, serviceName: serviceName2 }) => {
|
|
19394
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19395
|
+
`${serviceName2}/ndrs/prepare_lesson/resources/${id}/relation_resource.json`
|
|
19396
|
+
);
|
|
19397
|
+
return data;
|
|
19398
|
+
});
|
|
19399
|
+
__publicField(this, "fetchPrepareLesson", async ({ id, serviceName: serviceName2 }) => {
|
|
19400
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19401
|
+
`${serviceName2}/ndrv2/prepare_lesson/resources/details/${id}.json`
|
|
19402
|
+
);
|
|
19403
|
+
return data;
|
|
19404
|
+
});
|
|
19405
|
+
__publicField(this, "fetchPrepareLessonSubResource", async ({ id, serviceName: serviceName2 }) => {
|
|
19406
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/special_edu/resources/details/${id}.json`);
|
|
19407
|
+
return data;
|
|
19408
|
+
});
|
|
19409
|
+
__publicField(this, "fetchNationalLessonCourseDetail", async ({ id, serviceName: serviceName2 }) => {
|
|
19410
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19411
|
+
`${serviceName2}/ndrv2/national_lesson/resources/details/${id}.json`
|
|
19412
|
+
);
|
|
19413
|
+
return data;
|
|
19414
|
+
});
|
|
19415
|
+
__publicField(this, "fetchPrepareLessonDetail", async ({ id, serviceName: serviceName2 }) => {
|
|
19416
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/teachingmaterials/details/${id}.json`);
|
|
19417
|
+
return data;
|
|
19418
|
+
});
|
|
19419
|
+
__publicField(this, "fetchRegionResourceDetail", async ({ regionId, containerId, resourceId, serviceName: serviceName2 }) => {
|
|
19420
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19421
|
+
`${serviceName2}/${regionId}/containers/${containerId}/resources/${resourceId}.json`
|
|
19422
|
+
);
|
|
19423
|
+
return data;
|
|
19424
|
+
});
|
|
19425
|
+
__publicField(this, "fetchRegionLessonRelate", async ({ regionId, containerId, resourceId, serviceName: serviceName2 }) => {
|
|
19426
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19427
|
+
`${serviceName2}/${regionId}/containers/${containerId}/resources/${resourceId}/relation_resource.json`
|
|
19428
|
+
);
|
|
19429
|
+
return data;
|
|
19430
|
+
});
|
|
19431
|
+
__publicField(this, "fetchQualityCourse", async ({ courseId, isTest, service }) => {
|
|
19432
|
+
const requestURL = isTest ? `https://bdcs-file-2.ykt.cbern.com.cn/zxx_secondary/ndrv2/resources/${courseId}.json` : `/${service}/ndrv2/resources/${courseId}.json`;
|
|
19433
|
+
const { data } = await this.request.cdn.cdnAPI.get(requestURL);
|
|
19434
|
+
return data;
|
|
19435
|
+
});
|
|
19436
|
+
__publicField(this, "fetchTeachingLessonDetail", async ({ id, serviceName: serviceName2 }) => {
|
|
19437
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/special_edu/resources/details/${id}.json`);
|
|
19438
|
+
return data;
|
|
19439
|
+
});
|
|
19440
|
+
__publicField(this, "fetchTeachingLessonRelate", async ({ id, serviceName: serviceName2 }) => {
|
|
19441
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/teaching_lesson/resources/${id}/relation_resource.json`);
|
|
19442
|
+
return data;
|
|
19443
|
+
});
|
|
19444
|
+
const { request, config: config2 } = props;
|
|
19445
|
+
this.request = request;
|
|
19446
|
+
this.config = config2;
|
|
19447
|
+
}
|
|
19448
|
+
}
|
|
19294
19449
|
const _Service = class _Service {
|
|
19295
19450
|
constructor(props) {
|
|
19296
19451
|
__publicField(this, "env");
|
|
@@ -19360,13 +19515,17 @@ const _Service = class _Service {
|
|
|
19360
19515
|
cdn: {
|
|
19361
19516
|
cdnAPI,
|
|
19362
19517
|
cdnBdcsFileAPI,
|
|
19363
|
-
cdnSFileAPI
|
|
19518
|
+
cdnSFileAPI,
|
|
19519
|
+
cdnHotProxyAPI
|
|
19364
19520
|
},
|
|
19365
19521
|
siteConfig: {
|
|
19366
19522
|
siteConfigAPI
|
|
19367
19523
|
},
|
|
19368
19524
|
elearningLibrary: {
|
|
19369
19525
|
eLearningLibraryAPI
|
|
19526
|
+
},
|
|
19527
|
+
uc: {
|
|
19528
|
+
ucAPI
|
|
19370
19529
|
}
|
|
19371
19530
|
};
|
|
19372
19531
|
this.request = {};
|
|
@@ -19387,7 +19546,8 @@ const _Service = class _Service {
|
|
|
19387
19546
|
channel: Channel,
|
|
19388
19547
|
elearningTrain: ElearningTrain,
|
|
19389
19548
|
siteConfig: SiteConfig,
|
|
19390
|
-
library: Library
|
|
19549
|
+
library: Library,
|
|
19550
|
+
Ndr
|
|
19391
19551
|
};
|
|
19392
19552
|
this.service = {};
|
|
19393
19553
|
Object.keys(services).forEach((key) => {
|
package/dist/service.mjs
CHANGED
|
@@ -15159,7 +15159,7 @@ var Auth = /* @__PURE__ */ function() {
|
|
|
15159
15159
|
});
|
|
15160
15160
|
_defineProperty(this, "getIndentity", /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee9() {
|
|
15161
15161
|
var _this$userInfo;
|
|
15162
|
-
var userId, force, userIdentities, _userIdentities$userI, _userIdentities$userI2,
|
|
15162
|
+
var userId, force, userIdentities, _userIdentities$userI, _userIdentities$userI2, ucAPI2, url, _ref15, _ref15$items, items, identities, _getUserIdentitiesCac, userIdentitiesCache, _args9 = arguments;
|
|
15163
15163
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
15164
15164
|
while (1)
|
|
15165
15165
|
switch (_context9.prev = _context9.next) {
|
|
@@ -15174,14 +15174,14 @@ var Auth = /* @__PURE__ */ function() {
|
|
|
15174
15174
|
case 4:
|
|
15175
15175
|
userIdentities = _this.userIdentities;
|
|
15176
15176
|
_context9.prev = 5;
|
|
15177
|
-
|
|
15177
|
+
ucAPI2 = _this.ucApi();
|
|
15178
15178
|
if (!(!((_userIdentities$userI = userIdentities[userId]) !== null && _userIdentities$userI !== void 0 && (_userIdentities$userI = _userIdentities$userI.data) !== null && _userIdentities$userI !== void 0 && (_userIdentities$userI = _userIdentities$userI.items) !== null && _userIdentities$userI !== void 0 && _userIdentities$userI.length) || force)) {
|
|
15179
15179
|
_context9.next = 12;
|
|
15180
15180
|
break;
|
|
15181
15181
|
}
|
|
15182
15182
|
url = `/users/${userId}/identities`;
|
|
15183
15183
|
_context9.next = 11;
|
|
15184
|
-
return
|
|
15184
|
+
return ucAPI2.get(url);
|
|
15185
15185
|
case 11:
|
|
15186
15186
|
userIdentities[userId] = _context9.sent;
|
|
15187
15187
|
case 12:
|
|
@@ -15258,7 +15258,7 @@ var Auth = /* @__PURE__ */ function() {
|
|
|
15258
15258
|
_defineProperty(this, "addUserIdentities", /* @__PURE__ */ function() {
|
|
15259
15259
|
var _ref19 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee11(_ref18) {
|
|
15260
15260
|
var _this$userInfo2;
|
|
15261
|
-
var _ref18$userId, userId, code,
|
|
15261
|
+
var _ref18$userId, userId, code, ucAPI2;
|
|
15262
15262
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
15263
15263
|
while (1)
|
|
15264
15264
|
switch (_context11.prev = _context11.next) {
|
|
@@ -15270,9 +15270,9 @@ var Auth = /* @__PURE__ */ function() {
|
|
|
15270
15270
|
}
|
|
15271
15271
|
return _context11.abrupt("return");
|
|
15272
15272
|
case 3:
|
|
15273
|
-
|
|
15273
|
+
ucAPI2 = _this.ucApi();
|
|
15274
15274
|
_context11.next = 6;
|
|
15275
|
-
return
|
|
15275
|
+
return ucAPI2.post(`/users/${userId}/identities`, {
|
|
15276
15276
|
identity_code: code
|
|
15277
15277
|
});
|
|
15278
15278
|
case 6:
|
|
@@ -15335,7 +15335,7 @@ var Auth = /* @__PURE__ */ function() {
|
|
|
15335
15335
|
}());
|
|
15336
15336
|
_defineProperty(this, "isStudent", /* @__PURE__ */ function() {
|
|
15337
15337
|
var _ref21 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee13(curUserInfo) {
|
|
15338
|
-
var checkOrg,
|
|
15338
|
+
var checkOrg, ucAPI2, checkIsStudent, isStudent, response, inst, _args13 = arguments;
|
|
15339
15339
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
15340
15340
|
while (1)
|
|
15341
15341
|
switch (_context13.prev = _context13.next) {
|
|
@@ -15347,7 +15347,7 @@ var Auth = /* @__PURE__ */ function() {
|
|
|
15347
15347
|
}
|
|
15348
15348
|
return _context13.abrupt("return", false);
|
|
15349
15349
|
case 3:
|
|
15350
|
-
|
|
15350
|
+
ucAPI2 = _this.ucApi();
|
|
15351
15351
|
checkIsStudent = true;
|
|
15352
15352
|
isStudent = false;
|
|
15353
15353
|
if (!checkOrg) {
|
|
@@ -15355,7 +15355,7 @@ var Auth = /* @__PURE__ */ function() {
|
|
|
15355
15355
|
break;
|
|
15356
15356
|
}
|
|
15357
15357
|
_context13.next = 9;
|
|
15358
|
-
return
|
|
15358
|
+
return ucAPI2.get("/institutions/actions/search", {
|
|
15359
15359
|
params: {
|
|
15360
15360
|
app_id: _this.getSdpAppId()
|
|
15361
15361
|
}
|
|
@@ -17652,6 +17652,7 @@ const config = {
|
|
|
17652
17652
|
// 学习记录
|
|
17653
17653
|
"x-study-record": "//x-study-record-api.beta.101.com",
|
|
17654
17654
|
cdn: "//ndcs-pre.101.com",
|
|
17655
|
+
"cdn-hot-proxy": "//betacs.101.com",
|
|
17655
17656
|
// 站点配置(存在灰度能力)
|
|
17656
17657
|
"site-config": "//grey-config-web.ykt.cbern.com.cn",
|
|
17657
17658
|
serviceName: {
|
|
@@ -17663,7 +17664,8 @@ const config = {
|
|
|
17663
17664
|
},
|
|
17664
17665
|
defaultAreaSite: "hn",
|
|
17665
17666
|
// 内容库
|
|
17666
|
-
"elearning-library": "//elearning-library-gateway.beta.101.com"
|
|
17667
|
+
"elearning-library": "//elearning-library-gateway.beta.101.com",
|
|
17668
|
+
uc: "https://uc-gateway.sdp.101.com"
|
|
17667
17669
|
}
|
|
17668
17670
|
};
|
|
17669
17671
|
const recommendAPIV2 = ({
|
|
@@ -17804,6 +17806,12 @@ const cdnBdcsFileAPI = ({
|
|
|
17804
17806
|
prefix: "",
|
|
17805
17807
|
noSdpAppId: true
|
|
17806
17808
|
});
|
|
17809
|
+
const cdnHotProxyAPI = ({
|
|
17810
|
+
env
|
|
17811
|
+
}) => getApi({
|
|
17812
|
+
host: config[env]["cdn-hot-proxy"],
|
|
17813
|
+
prefix: "/v0.1/static"
|
|
17814
|
+
});
|
|
17807
17815
|
const siteConfigAPI = ({
|
|
17808
17816
|
env,
|
|
17809
17817
|
sdpAppId
|
|
@@ -17822,6 +17830,16 @@ const eLearningLibraryAPI = ({
|
|
|
17822
17830
|
uc,
|
|
17823
17831
|
sdpAppId
|
|
17824
17832
|
});
|
|
17833
|
+
const ucAPI = ({
|
|
17834
|
+
uc,
|
|
17835
|
+
env,
|
|
17836
|
+
sdpAppId
|
|
17837
|
+
}) => getApi({
|
|
17838
|
+
host: config[env]["uc"],
|
|
17839
|
+
prefix: "/v1.1",
|
|
17840
|
+
uc,
|
|
17841
|
+
sdpAppId
|
|
17842
|
+
});
|
|
17825
17843
|
async function getStatByChunk(resIds, requestFn, ...args) {
|
|
17826
17844
|
try {
|
|
17827
17845
|
const chunkSize = 100;
|
|
@@ -18272,7 +18290,7 @@ class Assessment {
|
|
|
18272
18290
|
return assessmentVo;
|
|
18273
18291
|
});
|
|
18274
18292
|
__publicField(this, "getUserAssessmentRate", async ({ assessmentId, assessmentType = "course", userInfo }) => {
|
|
18275
|
-
const cacheKey = assessmentRateCacheKey(assessmentId, userInfo.user_id);
|
|
18293
|
+
const cacheKey = assessmentRateCacheKey(assessmentId, userInfo == null ? void 0 : userInfo.user_id);
|
|
18276
18294
|
let userAssessmentVo = localStorage.getItem(cacheKey);
|
|
18277
18295
|
if (userAssessmentVo) {
|
|
18278
18296
|
try {
|
|
@@ -19289,6 +19307,143 @@ class Library {
|
|
|
19289
19307
|
this.config = config2;
|
|
19290
19308
|
}
|
|
19291
19309
|
}
|
|
19310
|
+
class Ndr {
|
|
19311
|
+
constructor(props) {
|
|
19312
|
+
__publicField(this, "request");
|
|
19313
|
+
__publicField(this, "config");
|
|
19314
|
+
__publicField(this, "getResourceDetail", async ({ contentId, serviceName: serviceName2 }) => {
|
|
19315
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19316
|
+
`${serviceName2}/ndrs/special_edu/resources/details/${contentId}.json`
|
|
19317
|
+
);
|
|
19318
|
+
return data;
|
|
19319
|
+
});
|
|
19320
|
+
__publicField(this, "getThematicCourseTree", async ({ contentId, serviceName: serviceName2 }) => {
|
|
19321
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19322
|
+
`${serviceName2}/ndrs/special_edu/thematic_course/trees/${contentId}.json`
|
|
19323
|
+
);
|
|
19324
|
+
return data;
|
|
19325
|
+
});
|
|
19326
|
+
__publicField(this, "getThematicList", async ({ contentId, serviceName: serviceName2 }) => {
|
|
19327
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19328
|
+
`${serviceName2}/ndrs/special_edu/thematic_course/${contentId}/resources/list.json`
|
|
19329
|
+
);
|
|
19330
|
+
return data;
|
|
19331
|
+
});
|
|
19332
|
+
__publicField(this, "fetchRegionLessonCourseList", async ({ regionId, businessType, teachingmaterialId }) => {
|
|
19333
|
+
const { zxxRegion } = this.config.serviceName;
|
|
19334
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19335
|
+
`${zxxRegion}/${regionId}/${businessType}/teachingmaterials/${teachingmaterialId}/resources/parts.json`
|
|
19336
|
+
);
|
|
19337
|
+
const result = [];
|
|
19338
|
+
await Promise.all(
|
|
19339
|
+
data.map(async (t2, index) => {
|
|
19340
|
+
const { data: partData } = await this.request.cdn.cdnAPI.get(t2);
|
|
19341
|
+
result[index] = partData;
|
|
19342
|
+
})
|
|
19343
|
+
);
|
|
19344
|
+
return [].concat(...result);
|
|
19345
|
+
});
|
|
19346
|
+
__publicField(this, "BusinessType", {
|
|
19347
|
+
AutoLearning: "auto_learning",
|
|
19348
|
+
Prepare: "prepare"
|
|
19349
|
+
});
|
|
19350
|
+
__publicField(this, "fetchPrepareLessonChapter", async ({ id, serviceName: serviceName2 }) => {
|
|
19351
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/resources/trees/${id}.json`);
|
|
19352
|
+
return data;
|
|
19353
|
+
});
|
|
19354
|
+
__publicField(this, "fetchPrepareLessonTreeCourseList", async ({ id, serviceName: serviceName2 }) => {
|
|
19355
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19356
|
+
`${serviceName2}/ndrs/teachingmaterials/${id}/resources/parts.json`
|
|
19357
|
+
);
|
|
19358
|
+
const result = [];
|
|
19359
|
+
await Promise.all(
|
|
19360
|
+
data.map(async (t2, index) => {
|
|
19361
|
+
const { data: partData } = await this.request.cdn.cdnAPI.get(t2);
|
|
19362
|
+
result[index] = partData;
|
|
19363
|
+
})
|
|
19364
|
+
);
|
|
19365
|
+
return [].concat(...result);
|
|
19366
|
+
});
|
|
19367
|
+
__publicField(this, "fetchPrepareType", async ({ serviceName: serviceName2 }) => {
|
|
19368
|
+
var _a2, _b2;
|
|
19369
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/tags/res_types.json`);
|
|
19370
|
+
return (_b2 = (_a2 = data == null ? void 0 : data.hierarchies) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.children;
|
|
19371
|
+
});
|
|
19372
|
+
__publicField(this, "fetchNationalLessonChapter", async ({ id, serviceName: serviceName2 }) => {
|
|
19373
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/lessons/trees/${id}.json`);
|
|
19374
|
+
return data;
|
|
19375
|
+
});
|
|
19376
|
+
__publicField(this, "fetchNationalLessonCourseList", async ({ id, serviceName: serviceName2 }) => {
|
|
19377
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/teachingmaterials/${id}/lessons/parts.json`);
|
|
19378
|
+
const result = [];
|
|
19379
|
+
await Promise.all(
|
|
19380
|
+
data.map(async (t2, index) => {
|
|
19381
|
+
const { data: partData } = await this.request.cdn.cdnAPI.get(t2);
|
|
19382
|
+
result[index] = partData;
|
|
19383
|
+
})
|
|
19384
|
+
);
|
|
19385
|
+
return [].concat(...result);
|
|
19386
|
+
});
|
|
19387
|
+
__publicField(this, "fetchNationalLessonDetail", async ({ id, serviceName: serviceName2 }) => {
|
|
19388
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/teachingmaterials/details/${id}.json`);
|
|
19389
|
+
return data;
|
|
19390
|
+
});
|
|
19391
|
+
__publicField(this, "fetchPrepareLessonRelate", async ({ id, serviceName: serviceName2 }) => {
|
|
19392
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19393
|
+
`${serviceName2}/ndrs/prepare_lesson/resources/${id}/relation_resource.json`
|
|
19394
|
+
);
|
|
19395
|
+
return data;
|
|
19396
|
+
});
|
|
19397
|
+
__publicField(this, "fetchPrepareLesson", async ({ id, serviceName: serviceName2 }) => {
|
|
19398
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19399
|
+
`${serviceName2}/ndrv2/prepare_lesson/resources/details/${id}.json`
|
|
19400
|
+
);
|
|
19401
|
+
return data;
|
|
19402
|
+
});
|
|
19403
|
+
__publicField(this, "fetchPrepareLessonSubResource", async ({ id, serviceName: serviceName2 }) => {
|
|
19404
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/special_edu/resources/details/${id}.json`);
|
|
19405
|
+
return data;
|
|
19406
|
+
});
|
|
19407
|
+
__publicField(this, "fetchNationalLessonCourseDetail", async ({ id, serviceName: serviceName2 }) => {
|
|
19408
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19409
|
+
`${serviceName2}/ndrv2/national_lesson/resources/details/${id}.json`
|
|
19410
|
+
);
|
|
19411
|
+
return data;
|
|
19412
|
+
});
|
|
19413
|
+
__publicField(this, "fetchPrepareLessonDetail", async ({ id, serviceName: serviceName2 }) => {
|
|
19414
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/teachingmaterials/details/${id}.json`);
|
|
19415
|
+
return data;
|
|
19416
|
+
});
|
|
19417
|
+
__publicField(this, "fetchRegionResourceDetail", async ({ regionId, containerId, resourceId, serviceName: serviceName2 }) => {
|
|
19418
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19419
|
+
`${serviceName2}/${regionId}/containers/${containerId}/resources/${resourceId}.json`
|
|
19420
|
+
);
|
|
19421
|
+
return data;
|
|
19422
|
+
});
|
|
19423
|
+
__publicField(this, "fetchRegionLessonRelate", async ({ regionId, containerId, resourceId, serviceName: serviceName2 }) => {
|
|
19424
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19425
|
+
`${serviceName2}/${regionId}/containers/${containerId}/resources/${resourceId}/relation_resource.json`
|
|
19426
|
+
);
|
|
19427
|
+
return data;
|
|
19428
|
+
});
|
|
19429
|
+
__publicField(this, "fetchQualityCourse", async ({ courseId, isTest, service }) => {
|
|
19430
|
+
const requestURL = isTest ? `https://bdcs-file-2.ykt.cbern.com.cn/zxx_secondary/ndrv2/resources/${courseId}.json` : `/${service}/ndrv2/resources/${courseId}.json`;
|
|
19431
|
+
const { data } = await this.request.cdn.cdnAPI.get(requestURL);
|
|
19432
|
+
return data;
|
|
19433
|
+
});
|
|
19434
|
+
__publicField(this, "fetchTeachingLessonDetail", async ({ id, serviceName: serviceName2 }) => {
|
|
19435
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/special_edu/resources/details/${id}.json`);
|
|
19436
|
+
return data;
|
|
19437
|
+
});
|
|
19438
|
+
__publicField(this, "fetchTeachingLessonRelate", async ({ id, serviceName: serviceName2 }) => {
|
|
19439
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/teaching_lesson/resources/${id}/relation_resource.json`);
|
|
19440
|
+
return data;
|
|
19441
|
+
});
|
|
19442
|
+
const { request, config: config2 } = props;
|
|
19443
|
+
this.request = request;
|
|
19444
|
+
this.config = config2;
|
|
19445
|
+
}
|
|
19446
|
+
}
|
|
19292
19447
|
const _Service = class _Service {
|
|
19293
19448
|
constructor(props) {
|
|
19294
19449
|
__publicField(this, "env");
|
|
@@ -19358,13 +19513,17 @@ const _Service = class _Service {
|
|
|
19358
19513
|
cdn: {
|
|
19359
19514
|
cdnAPI,
|
|
19360
19515
|
cdnBdcsFileAPI,
|
|
19361
|
-
cdnSFileAPI
|
|
19516
|
+
cdnSFileAPI,
|
|
19517
|
+
cdnHotProxyAPI
|
|
19362
19518
|
},
|
|
19363
19519
|
siteConfig: {
|
|
19364
19520
|
siteConfigAPI
|
|
19365
19521
|
},
|
|
19366
19522
|
elearningLibrary: {
|
|
19367
19523
|
eLearningLibraryAPI
|
|
19524
|
+
},
|
|
19525
|
+
uc: {
|
|
19526
|
+
ucAPI
|
|
19368
19527
|
}
|
|
19369
19528
|
};
|
|
19370
19529
|
this.request = {};
|
|
@@ -19385,7 +19544,8 @@ const _Service = class _Service {
|
|
|
19385
19544
|
channel: Channel,
|
|
19386
19545
|
elearningTrain: ElearningTrain,
|
|
19387
19546
|
siteConfig: SiteConfig,
|
|
19388
|
-
library: Library
|
|
19547
|
+
library: Library,
|
|
19548
|
+
Ndr
|
|
19389
19549
|
};
|
|
19390
19550
|
this.service = {};
|
|
19391
19551
|
Object.keys(services).forEach((key) => {
|
package/dist/service.umd.js
CHANGED
|
@@ -15163,7 +15163,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15163
15163
|
});
|
|
15164
15164
|
_defineProperty(this, "getIndentity", /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee9() {
|
|
15165
15165
|
var _this$userInfo;
|
|
15166
|
-
var userId, force, userIdentities, _userIdentities$userI, _userIdentities$userI2,
|
|
15166
|
+
var userId, force, userIdentities, _userIdentities$userI, _userIdentities$userI2, ucAPI2, url, _ref15, _ref15$items, items, identities, _getUserIdentitiesCac, userIdentitiesCache, _args9 = arguments;
|
|
15167
15167
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
15168
15168
|
while (1)
|
|
15169
15169
|
switch (_context9.prev = _context9.next) {
|
|
@@ -15178,14 +15178,14 @@ var __publicField = (obj, key, value) => {
|
|
|
15178
15178
|
case 4:
|
|
15179
15179
|
userIdentities = _this.userIdentities;
|
|
15180
15180
|
_context9.prev = 5;
|
|
15181
|
-
|
|
15181
|
+
ucAPI2 = _this.ucApi();
|
|
15182
15182
|
if (!(!((_userIdentities$userI = userIdentities[userId]) !== null && _userIdentities$userI !== void 0 && (_userIdentities$userI = _userIdentities$userI.data) !== null && _userIdentities$userI !== void 0 && (_userIdentities$userI = _userIdentities$userI.items) !== null && _userIdentities$userI !== void 0 && _userIdentities$userI.length) || force)) {
|
|
15183
15183
|
_context9.next = 12;
|
|
15184
15184
|
break;
|
|
15185
15185
|
}
|
|
15186
15186
|
url = `/users/${userId}/identities`;
|
|
15187
15187
|
_context9.next = 11;
|
|
15188
|
-
return
|
|
15188
|
+
return ucAPI2.get(url);
|
|
15189
15189
|
case 11:
|
|
15190
15190
|
userIdentities[userId] = _context9.sent;
|
|
15191
15191
|
case 12:
|
|
@@ -15262,7 +15262,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15262
15262
|
_defineProperty(this, "addUserIdentities", /* @__PURE__ */ function() {
|
|
15263
15263
|
var _ref19 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee11(_ref18) {
|
|
15264
15264
|
var _this$userInfo2;
|
|
15265
|
-
var _ref18$userId, userId, code,
|
|
15265
|
+
var _ref18$userId, userId, code, ucAPI2;
|
|
15266
15266
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
15267
15267
|
while (1)
|
|
15268
15268
|
switch (_context11.prev = _context11.next) {
|
|
@@ -15274,9 +15274,9 @@ var __publicField = (obj, key, value) => {
|
|
|
15274
15274
|
}
|
|
15275
15275
|
return _context11.abrupt("return");
|
|
15276
15276
|
case 3:
|
|
15277
|
-
|
|
15277
|
+
ucAPI2 = _this.ucApi();
|
|
15278
15278
|
_context11.next = 6;
|
|
15279
|
-
return
|
|
15279
|
+
return ucAPI2.post(`/users/${userId}/identities`, {
|
|
15280
15280
|
identity_code: code
|
|
15281
15281
|
});
|
|
15282
15282
|
case 6:
|
|
@@ -15339,7 +15339,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15339
15339
|
}());
|
|
15340
15340
|
_defineProperty(this, "isStudent", /* @__PURE__ */ function() {
|
|
15341
15341
|
var _ref21 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee13(curUserInfo) {
|
|
15342
|
-
var checkOrg,
|
|
15342
|
+
var checkOrg, ucAPI2, checkIsStudent, isStudent, response, inst, _args13 = arguments;
|
|
15343
15343
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
15344
15344
|
while (1)
|
|
15345
15345
|
switch (_context13.prev = _context13.next) {
|
|
@@ -15351,7 +15351,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15351
15351
|
}
|
|
15352
15352
|
return _context13.abrupt("return", false);
|
|
15353
15353
|
case 3:
|
|
15354
|
-
|
|
15354
|
+
ucAPI2 = _this.ucApi();
|
|
15355
15355
|
checkIsStudent = true;
|
|
15356
15356
|
isStudent = false;
|
|
15357
15357
|
if (!checkOrg) {
|
|
@@ -15359,7 +15359,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15359
15359
|
break;
|
|
15360
15360
|
}
|
|
15361
15361
|
_context13.next = 9;
|
|
15362
|
-
return
|
|
15362
|
+
return ucAPI2.get("/institutions/actions/search", {
|
|
15363
15363
|
params: {
|
|
15364
15364
|
app_id: _this.getSdpAppId()
|
|
15365
15365
|
}
|
|
@@ -17656,6 +17656,7 @@ var __publicField = (obj, key, value) => {
|
|
|
17656
17656
|
// 学习记录
|
|
17657
17657
|
"x-study-record": "//x-study-record-api.beta.101.com",
|
|
17658
17658
|
cdn: "//ndcs-pre.101.com",
|
|
17659
|
+
"cdn-hot-proxy": "//betacs.101.com",
|
|
17659
17660
|
// 站点配置(存在灰度能力)
|
|
17660
17661
|
"site-config": "//grey-config-web.ykt.cbern.com.cn",
|
|
17661
17662
|
serviceName: {
|
|
@@ -17667,7 +17668,8 @@ var __publicField = (obj, key, value) => {
|
|
|
17667
17668
|
},
|
|
17668
17669
|
defaultAreaSite: "hn",
|
|
17669
17670
|
// 内容库
|
|
17670
|
-
"elearning-library": "//elearning-library-gateway.beta.101.com"
|
|
17671
|
+
"elearning-library": "//elearning-library-gateway.beta.101.com",
|
|
17672
|
+
uc: "https://uc-gateway.sdp.101.com"
|
|
17671
17673
|
}
|
|
17672
17674
|
};
|
|
17673
17675
|
const recommendAPIV2 = ({
|
|
@@ -17808,6 +17810,12 @@ var __publicField = (obj, key, value) => {
|
|
|
17808
17810
|
prefix: "",
|
|
17809
17811
|
noSdpAppId: true
|
|
17810
17812
|
});
|
|
17813
|
+
const cdnHotProxyAPI = ({
|
|
17814
|
+
env
|
|
17815
|
+
}) => getApi({
|
|
17816
|
+
host: config[env]["cdn-hot-proxy"],
|
|
17817
|
+
prefix: "/v0.1/static"
|
|
17818
|
+
});
|
|
17811
17819
|
const siteConfigAPI = ({
|
|
17812
17820
|
env,
|
|
17813
17821
|
sdpAppId
|
|
@@ -17826,6 +17834,16 @@ var __publicField = (obj, key, value) => {
|
|
|
17826
17834
|
uc,
|
|
17827
17835
|
sdpAppId
|
|
17828
17836
|
});
|
|
17837
|
+
const ucAPI = ({
|
|
17838
|
+
uc,
|
|
17839
|
+
env,
|
|
17840
|
+
sdpAppId
|
|
17841
|
+
}) => getApi({
|
|
17842
|
+
host: config[env]["uc"],
|
|
17843
|
+
prefix: "/v1.1",
|
|
17844
|
+
uc,
|
|
17845
|
+
sdpAppId
|
|
17846
|
+
});
|
|
17829
17847
|
async function getStatByChunk(resIds, requestFn, ...args) {
|
|
17830
17848
|
try {
|
|
17831
17849
|
const chunkSize = 100;
|
|
@@ -18276,7 +18294,7 @@ var __publicField = (obj, key, value) => {
|
|
|
18276
18294
|
return assessmentVo;
|
|
18277
18295
|
});
|
|
18278
18296
|
__publicField(this, "getUserAssessmentRate", async ({ assessmentId, assessmentType = "course", userInfo }) => {
|
|
18279
|
-
const cacheKey = assessmentRateCacheKey(assessmentId, userInfo.user_id);
|
|
18297
|
+
const cacheKey = assessmentRateCacheKey(assessmentId, userInfo == null ? void 0 : userInfo.user_id);
|
|
18280
18298
|
let userAssessmentVo = localStorage.getItem(cacheKey);
|
|
18281
18299
|
if (userAssessmentVo) {
|
|
18282
18300
|
try {
|
|
@@ -19293,6 +19311,143 @@ var __publicField = (obj, key, value) => {
|
|
|
19293
19311
|
this.config = config2;
|
|
19294
19312
|
}
|
|
19295
19313
|
}
|
|
19314
|
+
class Ndr {
|
|
19315
|
+
constructor(props) {
|
|
19316
|
+
__publicField(this, "request");
|
|
19317
|
+
__publicField(this, "config");
|
|
19318
|
+
__publicField(this, "getResourceDetail", async ({ contentId, serviceName: serviceName2 }) => {
|
|
19319
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19320
|
+
`${serviceName2}/ndrs/special_edu/resources/details/${contentId}.json`
|
|
19321
|
+
);
|
|
19322
|
+
return data;
|
|
19323
|
+
});
|
|
19324
|
+
__publicField(this, "getThematicCourseTree", async ({ contentId, serviceName: serviceName2 }) => {
|
|
19325
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19326
|
+
`${serviceName2}/ndrs/special_edu/thematic_course/trees/${contentId}.json`
|
|
19327
|
+
);
|
|
19328
|
+
return data;
|
|
19329
|
+
});
|
|
19330
|
+
__publicField(this, "getThematicList", async ({ contentId, serviceName: serviceName2 }) => {
|
|
19331
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19332
|
+
`${serviceName2}/ndrs/special_edu/thematic_course/${contentId}/resources/list.json`
|
|
19333
|
+
);
|
|
19334
|
+
return data;
|
|
19335
|
+
});
|
|
19336
|
+
__publicField(this, "fetchRegionLessonCourseList", async ({ regionId, businessType, teachingmaterialId }) => {
|
|
19337
|
+
const { zxxRegion } = this.config.serviceName;
|
|
19338
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19339
|
+
`${zxxRegion}/${regionId}/${businessType}/teachingmaterials/${teachingmaterialId}/resources/parts.json`
|
|
19340
|
+
);
|
|
19341
|
+
const result = [];
|
|
19342
|
+
await Promise.all(
|
|
19343
|
+
data.map(async (t2, index) => {
|
|
19344
|
+
const { data: partData } = await this.request.cdn.cdnAPI.get(t2);
|
|
19345
|
+
result[index] = partData;
|
|
19346
|
+
})
|
|
19347
|
+
);
|
|
19348
|
+
return [].concat(...result);
|
|
19349
|
+
});
|
|
19350
|
+
__publicField(this, "BusinessType", {
|
|
19351
|
+
AutoLearning: "auto_learning",
|
|
19352
|
+
Prepare: "prepare"
|
|
19353
|
+
});
|
|
19354
|
+
__publicField(this, "fetchPrepareLessonChapter", async ({ id, serviceName: serviceName2 }) => {
|
|
19355
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/resources/trees/${id}.json`);
|
|
19356
|
+
return data;
|
|
19357
|
+
});
|
|
19358
|
+
__publicField(this, "fetchPrepareLessonTreeCourseList", async ({ id, serviceName: serviceName2 }) => {
|
|
19359
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19360
|
+
`${serviceName2}/ndrs/teachingmaterials/${id}/resources/parts.json`
|
|
19361
|
+
);
|
|
19362
|
+
const result = [];
|
|
19363
|
+
await Promise.all(
|
|
19364
|
+
data.map(async (t2, index) => {
|
|
19365
|
+
const { data: partData } = await this.request.cdn.cdnAPI.get(t2);
|
|
19366
|
+
result[index] = partData;
|
|
19367
|
+
})
|
|
19368
|
+
);
|
|
19369
|
+
return [].concat(...result);
|
|
19370
|
+
});
|
|
19371
|
+
__publicField(this, "fetchPrepareType", async ({ serviceName: serviceName2 }) => {
|
|
19372
|
+
var _a2, _b2;
|
|
19373
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/tags/res_types.json`);
|
|
19374
|
+
return (_b2 = (_a2 = data == null ? void 0 : data.hierarchies) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.children;
|
|
19375
|
+
});
|
|
19376
|
+
__publicField(this, "fetchNationalLessonChapter", async ({ id, serviceName: serviceName2 }) => {
|
|
19377
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/lessons/trees/${id}.json`);
|
|
19378
|
+
return data;
|
|
19379
|
+
});
|
|
19380
|
+
__publicField(this, "fetchNationalLessonCourseList", async ({ id, serviceName: serviceName2 }) => {
|
|
19381
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/teachingmaterials/${id}/lessons/parts.json`);
|
|
19382
|
+
const result = [];
|
|
19383
|
+
await Promise.all(
|
|
19384
|
+
data.map(async (t2, index) => {
|
|
19385
|
+
const { data: partData } = await this.request.cdn.cdnAPI.get(t2);
|
|
19386
|
+
result[index] = partData;
|
|
19387
|
+
})
|
|
19388
|
+
);
|
|
19389
|
+
return [].concat(...result);
|
|
19390
|
+
});
|
|
19391
|
+
__publicField(this, "fetchNationalLessonDetail", async ({ id, serviceName: serviceName2 }) => {
|
|
19392
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/teachingmaterials/details/${id}.json`);
|
|
19393
|
+
return data;
|
|
19394
|
+
});
|
|
19395
|
+
__publicField(this, "fetchPrepareLessonRelate", async ({ id, serviceName: serviceName2 }) => {
|
|
19396
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19397
|
+
`${serviceName2}/ndrs/prepare_lesson/resources/${id}/relation_resource.json`
|
|
19398
|
+
);
|
|
19399
|
+
return data;
|
|
19400
|
+
});
|
|
19401
|
+
__publicField(this, "fetchPrepareLesson", async ({ id, serviceName: serviceName2 }) => {
|
|
19402
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19403
|
+
`${serviceName2}/ndrv2/prepare_lesson/resources/details/${id}.json`
|
|
19404
|
+
);
|
|
19405
|
+
return data;
|
|
19406
|
+
});
|
|
19407
|
+
__publicField(this, "fetchPrepareLessonSubResource", async ({ id, serviceName: serviceName2 }) => {
|
|
19408
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/special_edu/resources/details/${id}.json`);
|
|
19409
|
+
return data;
|
|
19410
|
+
});
|
|
19411
|
+
__publicField(this, "fetchNationalLessonCourseDetail", async ({ id, serviceName: serviceName2 }) => {
|
|
19412
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19413
|
+
`${serviceName2}/ndrv2/national_lesson/resources/details/${id}.json`
|
|
19414
|
+
);
|
|
19415
|
+
return data;
|
|
19416
|
+
});
|
|
19417
|
+
__publicField(this, "fetchPrepareLessonDetail", async ({ id, serviceName: serviceName2 }) => {
|
|
19418
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/teachingmaterials/details/${id}.json`);
|
|
19419
|
+
return data;
|
|
19420
|
+
});
|
|
19421
|
+
__publicField(this, "fetchRegionResourceDetail", async ({ regionId, containerId, resourceId, serviceName: serviceName2 }) => {
|
|
19422
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19423
|
+
`${serviceName2}/${regionId}/containers/${containerId}/resources/${resourceId}.json`
|
|
19424
|
+
);
|
|
19425
|
+
return data;
|
|
19426
|
+
});
|
|
19427
|
+
__publicField(this, "fetchRegionLessonRelate", async ({ regionId, containerId, resourceId, serviceName: serviceName2 }) => {
|
|
19428
|
+
const { data } = await this.request.cdn.cdnAPI.get(
|
|
19429
|
+
`${serviceName2}/${regionId}/containers/${containerId}/resources/${resourceId}/relation_resource.json`
|
|
19430
|
+
);
|
|
19431
|
+
return data;
|
|
19432
|
+
});
|
|
19433
|
+
__publicField(this, "fetchQualityCourse", async ({ courseId, isTest, service }) => {
|
|
19434
|
+
const requestURL = isTest ? `https://bdcs-file-2.ykt.cbern.com.cn/zxx_secondary/ndrv2/resources/${courseId}.json` : `/${service}/ndrv2/resources/${courseId}.json`;
|
|
19435
|
+
const { data } = await this.request.cdn.cdnAPI.get(requestURL);
|
|
19436
|
+
return data;
|
|
19437
|
+
});
|
|
19438
|
+
__publicField(this, "fetchTeachingLessonDetail", async ({ id, serviceName: serviceName2 }) => {
|
|
19439
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/special_edu/resources/details/${id}.json`);
|
|
19440
|
+
return data;
|
|
19441
|
+
});
|
|
19442
|
+
__publicField(this, "fetchTeachingLessonRelate", async ({ id, serviceName: serviceName2 }) => {
|
|
19443
|
+
const { data } = await this.request.cdn.cdnAPI.get(`${serviceName2}/ndrs/teaching_lesson/resources/${id}/relation_resource.json`);
|
|
19444
|
+
return data;
|
|
19445
|
+
});
|
|
19446
|
+
const { request, config: config2 } = props;
|
|
19447
|
+
this.request = request;
|
|
19448
|
+
this.config = config2;
|
|
19449
|
+
}
|
|
19450
|
+
}
|
|
19296
19451
|
const _Service = class _Service {
|
|
19297
19452
|
constructor(props) {
|
|
19298
19453
|
__publicField(this, "env");
|
|
@@ -19362,13 +19517,17 @@ var __publicField = (obj, key, value) => {
|
|
|
19362
19517
|
cdn: {
|
|
19363
19518
|
cdnAPI,
|
|
19364
19519
|
cdnBdcsFileAPI,
|
|
19365
|
-
cdnSFileAPI
|
|
19520
|
+
cdnSFileAPI,
|
|
19521
|
+
cdnHotProxyAPI
|
|
19366
19522
|
},
|
|
19367
19523
|
siteConfig: {
|
|
19368
19524
|
siteConfigAPI
|
|
19369
19525
|
},
|
|
19370
19526
|
elearningLibrary: {
|
|
19371
19527
|
eLearningLibraryAPI
|
|
19528
|
+
},
|
|
19529
|
+
uc: {
|
|
19530
|
+
ucAPI
|
|
19372
19531
|
}
|
|
19373
19532
|
};
|
|
19374
19533
|
this.request = {};
|
|
@@ -19389,7 +19548,8 @@ var __publicField = (obj, key, value) => {
|
|
|
19389
19548
|
channel: Channel,
|
|
19390
19549
|
elearningTrain: ElearningTrain,
|
|
19391
19550
|
siteConfig: SiteConfig,
|
|
19392
|
-
library: Library
|
|
19551
|
+
library: Library,
|
|
19552
|
+
Ndr
|
|
19393
19553
|
};
|
|
19394
19554
|
this.service = {};
|
|
19395
19555
|
Object.keys(services).forEach((key) => {
|