@rolatech/angular-course 17.5.4 → 17.6.1

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.
Files changed (52) hide show
  1. package/esm2022/index.mjs +2 -1
  2. package/esm2022/lib/components/course-action/course-action.component.mjs +3 -3
  3. package/esm2022/lib/components/course-details/course-details.component.mjs +3 -3
  4. package/esm2022/lib/components/course-details-dialog/course-details-dialog.component.mjs +3 -3
  5. package/esm2022/lib/components/course-edit-dialog/course-edit-dialog.component.mjs +3 -3
  6. package/esm2022/lib/components/course-info/course-info.component.mjs +7 -6
  7. package/esm2022/lib/components/course-item/course-item.component.mjs +3 -3
  8. package/esm2022/lib/components/course-media/course-media.component.mjs +3 -3
  9. package/esm2022/lib/components/course-media-owner-renderer/course-media-owner-renderer.component.mjs +3 -3
  10. package/esm2022/lib/components/course-preview/course-preview.component.mjs +3 -3
  11. package/esm2022/lib/components/course-pricing/course-pricing.component.mjs +3 -3
  12. package/esm2022/lib/components/course-pricing-add-dialog/course-pricing-add-dialog.component.mjs +3 -3
  13. package/esm2022/lib/components/course-pricing-dialog/course-pricing-dialog.component.mjs +3 -3
  14. package/esm2022/lib/components/course-schedule/course-schedule.component.mjs +3 -3
  15. package/esm2022/lib/components/course-schedule-add-dialog/course-schedule-add-dialog.component.mjs +3 -3
  16. package/esm2022/lib/components/course-schedule-dialog/course-schedule-dialog.component.mjs +3 -3
  17. package/esm2022/lib/components/course-section-item/course-section-item.component.mjs +3 -3
  18. package/esm2022/lib/components/course-section-lecture-item/course-section-lecture-item.component.mjs +4 -6
  19. package/esm2022/lib/components/course-section-lecture-video-dialog/course-section-lecture-video-dialog.component.mjs +4 -5
  20. package/esm2022/lib/components/course-section-lecture-video-item/course-section-lecture-video-item.component.mjs +3 -3
  21. package/esm2022/lib/components/course-sections/course-sections.component.mjs +3 -3
  22. package/esm2022/lib/components/detail-item/detail-item.component.mjs +3 -3
  23. package/esm2022/lib/components/pricing-item/pricing-item.component.mjs +3 -3
  24. package/esm2022/lib/components/schedule-item/schedule-item.component.mjs +3 -3
  25. package/esm2022/lib/pages/course/course-category/course-category.component.mjs +3 -3
  26. package/esm2022/lib/pages/course/course-detail/course-detail.component.mjs +5 -5
  27. package/esm2022/lib/pages/course/course-index/course-index.component.mjs +3 -3
  28. package/esm2022/lib/pages/course/course-layout/course-layout.component.mjs +3 -3
  29. package/esm2022/lib/pages/course/course-section-content/course-section-content.component.mjs +5 -5
  30. package/esm2022/lib/pages/course-manage/course-manage-content/course-manage-content.component.mjs +3 -3
  31. package/esm2022/lib/pages/course-manage/course-manage-details/course-manage-details.component.mjs +3 -3
  32. package/esm2022/lib/pages/course-manage/course-manage-info/course-manage-info.component.mjs +6 -6
  33. package/esm2022/lib/pages/course-manage/course-manage-layout/course-manage-layout.component.mjs +3 -3
  34. package/esm2022/lib/pages/course-manage/course-manage-media/course-manage-media.component.mjs +3 -3
  35. package/esm2022/lib/pages/course-manage/course-manage-pricing/course-manage-pricing.component.mjs +3 -3
  36. package/esm2022/lib/pages/course-manage/course-manage-schedule/course-manage-schedule.component.mjs +3 -3
  37. package/esm2022/lib/pages/course-manage/course-manage-section/course-manage-section.component.mjs +4 -5
  38. package/esm2022/lib/services/booking.service.mjs +3 -3
  39. package/esm2022/lib/services/category.service.mjs +3 -3
  40. package/esm2022/lib/services/course-section.service.mjs +3 -3
  41. package/esm2022/lib/services/course.service.mjs +4 -4
  42. package/esm2022/lib/services/instructor.service.mjs +3 -3
  43. package/fesm2022/{rolatech-angular-course-course-index.component-C89fCBfR.mjs → rolatech-angular-course-course-index.component-DqcW95VP.mjs} +5 -5
  44. package/fesm2022/{rolatech-angular-course-course-index.component-C89fCBfR.mjs.map → rolatech-angular-course-course-index.component-DqcW95VP.mjs.map} +1 -1
  45. package/fesm2022/rolatech-angular-course.mjs +3033 -28
  46. package/fesm2022/rolatech-angular-course.mjs.map +1 -1
  47. package/index.d.ts +1 -0
  48. package/lib/pages/course-manage/course-manage-info/course-manage-info.component.d.ts +1 -1
  49. package/package.json +1 -1
  50. package/themes/_default.scss +1 -1
  51. package/fesm2022/rolatech-angular-course-rolatech-angular-course-DzJibnO6.mjs +0 -3038
  52. package/fesm2022/rolatech-angular-course-rolatech-angular-course-DzJibnO6.mjs.map +0 -1
@@ -1,3038 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, importProvidersFrom, makeEnvironmentProviders, Component, input, effect, inject, output, ViewEncapsulation, model, PLATFORM_ID, ElementRef, Inject, viewChild, booleanAttribute } from '@angular/core';
3
- import * as i4 from '@angular/forms';
4
- import { ReactiveFormsModule, FormsModule } from '@angular/forms';
5
- import { CommonModule, NgClass, DatePipe, isPlatformBrowser, ViewportScroller } from '@angular/common';
6
- import * as i1$3 from '@angular/router';
7
- import { RouterModule, RouterLink, ActivatedRoute, Router, RouterLinkActive, RouterOutlet } from '@angular/router';
8
- import { BaseService, DialogService } from '@rolatech/angular-services';
9
- import * as i2 from '@angular/material/icon';
10
- import { MatIconModule } from '@angular/material/icon';
11
- import * as i1$2 from '@angular/material/dialog';
12
- import { MatDialog, MAT_DIALOG_DATA, MatDialogClose } from '@angular/material/dialog';
13
- import { ImagePreviewDialogComponent, ThumbnailComponent, AccordionComponent, PanelComponent, InputComponent, IconButtonComponent, AngularComponentsModule, ImageComponent, MediaListComponent, MediaListItemComponent, BaseComponent, RichViewComponent, RichItemComponent, ContainerComponent, ListComponent, ConfirmationDialogComponent, ToolbarComponent } from '@rolatech/angular-components';
14
- import * as i1 from '@angular/material/button';
15
- import { MatButtonModule } from '@angular/material/button';
16
- import * as i3$1 from '@angular/material/checkbox';
17
- import { MatCheckboxModule } from '@angular/material/checkbox';
18
- import { DurationPipe, AngularCommonModule } from '@rolatech/angular-common';
19
- import * as i5$1 from '@angular/material/divider';
20
- import { MatDividerModule } from '@angular/material/divider';
21
- import * as i6$2 from '@angular/material/stepper';
22
- import { MatStepperModule, MatStepper } from '@angular/material/stepper';
23
- import { MomentDateAdapter } from '@angular/material-moment-adapter';
24
- import * as i6$1 from '@angular/material/core';
25
- import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS, MatOptionModule } from '@angular/material/core';
26
- import moment from 'moment';
27
- import * as i6 from '@angular/material/select';
28
- import { MatSelectModule } from '@angular/material/select';
29
- import * as i5 from '@angular/material/datepicker';
30
- import { MatDatepickerModule } from '@angular/material/datepicker';
31
- import * as i3 from '@angular/cdk/text-field';
32
- import { TextFieldModule } from '@angular/cdk/text-field';
33
- import * as i2$1 from '@angular/material/input';
34
- import { MatInputModule } from '@angular/material/input';
35
- import * as i1$1 from '@angular/material/form-field';
36
- import { MatFormFieldModule } from '@angular/material/form-field';
37
- import * as i3$3 from '@angular/material/snack-bar';
38
- import { MatSnackBar } from '@angular/material/snack-bar';
39
- import * as i3$2 from '@angular/material/progress-bar';
40
- import { MatProgressBarModule } from '@angular/material/progress-bar';
41
- import { first, remove, findLastIndex, findIndex, clone } from 'lodash';
42
- import { AuthService, AuthUserService } from '@rolatech/angular-auth';
43
- import { CommentsComponent } from '@rolatech/angular-comment';
44
- import { Observable, from, concatMap, take } from 'rxjs';
45
-
46
- var CourseStatus;
47
- (function (CourseStatus) {
48
- CourseStatus[CourseStatus["ACTIVE"] = '已发布'] = "ACTIVE";
49
- CourseStatus[CourseStatus["ACCEPTED"] = '已通过'] = "ACCEPTED";
50
- CourseStatus[CourseStatus["AWAITING"] = '审核中'] = "AWAITING";
51
- CourseStatus[CourseStatus["PENDING"] = '审核中'] = "PENDING";
52
- CourseStatus[CourseStatus["STARTED"] = '已开始'] = "STARTED";
53
- CourseStatus[CourseStatus["ENDED"] = '已完成'] = "ENDED";
54
- CourseStatus[CourseStatus["DELETED"] = '已删除'] = "DELETED";
55
- CourseStatus[CourseStatus["DRAFT"] = '草稿'] = "DRAFT";
56
- })(CourseStatus || (CourseStatus = {}));
57
- var CourseRequestStatus;
58
- (function (CourseRequestStatus) {
59
- CourseRequestStatus["AWAITING"] = "\u5BA1\u6838\u4E2D";
60
- CourseRequestStatus["ACTIVE"] = "\u5DF2\u901A\u8FC7";
61
- CourseRequestStatus["REJECTED"] = "\u5DF2\u62D2\u7EDD";
62
- })(CourseRequestStatus || (CourseRequestStatus = {}));
63
- var CourseReviewStatus;
64
- (function (CourseReviewStatus) {
65
- CourseReviewStatus["ACCEPTED"] = "\u5DF2\u901A\u8FC7";
66
- CourseReviewStatus["REJECTED"] = "\u672A\u901A\u8FC7";
67
- })(CourseReviewStatus || (CourseReviewStatus = {}));
68
- var CourseSectionLectureContentType;
69
- (function (CourseSectionLectureContentType) {
70
- CourseSectionLectureContentType[CourseSectionLectureContentType["VIDEO"] = '视频'] = "VIDEO";
71
- CourseSectionLectureContentType[CourseSectionLectureContentType["ARTICLE"] = '文章'] = "ARTICLE";
72
- })(CourseSectionLectureContentType || (CourseSectionLectureContentType = {}));
73
- // export const CourseType = [
74
- // {
75
- // key: 'ONLINE',
76
- // value: '线上',
77
- // },
78
- // {
79
- // key: 'OFFLINE',
80
- // value: '线下',
81
- // },
82
- // {
83
- // key: 'MIXED',
84
- // value: '混合',
85
- // },
86
- // ];
87
- var CourseType;
88
- (function (CourseType) {
89
- CourseType[CourseType["ONLINE"] = '线上'] = "ONLINE";
90
- CourseType[CourseType["OFFLINE"] = '线下'] = "OFFLINE";
91
- CourseType[CourseType["MIXED"] = '混合'] = "MIXED";
92
- })(CourseType || (CourseType = {}));
93
- const ScheduleDate = [
94
- '00:00',
95
- '00:15',
96
- '00:30',
97
- '00:45',
98
- '01:00',
99
- '01:15',
100
- '01:30',
101
- '01:45',
102
- '02:00',
103
- '02:15',
104
- '02:30',
105
- '02:45',
106
- '03:00',
107
- '03:15',
108
- '03:30',
109
- '03:45',
110
- '04:00',
111
- '04:15',
112
- '04:30',
113
- '04:45',
114
- '05:00',
115
- '05:15',
116
- '05:30',
117
- '05:45',
118
- '06:00',
119
- '06:15',
120
- '06:30',
121
- '06:45',
122
- '07:00',
123
- '07:15',
124
- '07:30',
125
- '07:45',
126
- '08:00',
127
- '08:15',
128
- '08:30',
129
- '08:45',
130
- '09:00',
131
- '09:15',
132
- '09:30',
133
- '09:45',
134
- '10:00',
135
- '10:15',
136
- '10:30',
137
- '10:45',
138
- '11:00',
139
- '11:15',
140
- '11:30',
141
- '11:45',
142
- '12:00',
143
- '12:15',
144
- '12:30',
145
- '12:45',
146
- '13:00',
147
- '13:15',
148
- '13:30',
149
- '13:45',
150
- '14:00',
151
- '14:15',
152
- '14:30',
153
- '14:45',
154
- '15:00',
155
- '15:15',
156
- '15:30',
157
- '15:45',
158
- '16:00',
159
- '16:15',
160
- '16:30',
161
- '16:45',
162
- '17:00',
163
- '17:15',
164
- '17:30',
165
- '17:45',
166
- '18:00',
167
- '18:15',
168
- '18:30',
169
- '18:45',
170
- '19:00',
171
- '19:15',
172
- '19:30',
173
- '19:45',
174
- '20:00',
175
- '20:15',
176
- '20:30',
177
- '20:45',
178
- '21:00',
179
- '21:15',
180
- '21:30',
181
- '21:45',
182
- '22:00',
183
- '22:15',
184
- '22:30',
185
- '22:45',
186
- '23:00',
187
- '23:15',
188
- '23:30',
189
- '23:45',
190
- ];
191
-
192
- class CourseService extends BaseService {
193
- init() {
194
- this.endpoint = 'courses';
195
- super.init();
196
- }
197
- me(options) {
198
- return this.http.get(`${this.actionUrl}/me`, {
199
- params: options,
200
- withCredentials: true,
201
- });
202
- }
203
- findSchedule(id) {
204
- return this.http.get(`${this.actionUrl}/${id}/schedule`, {
205
- withCredentials: true,
206
- });
207
- }
208
- findPricing(id) {
209
- return this.http.get(`${this.actionUrl}/${id}/pricing`, {
210
- withCredentials: true,
211
- });
212
- }
213
- addDetail(id, data) {
214
- return this.http.post(`${this.actionUrl}/${id}/details`, data, {
215
- withCredentials: true,
216
- });
217
- }
218
- addBatchDetails(id, data) {
219
- return this.http.post(`${this.actionUrl}/${id}/details/batch`, data, {
220
- withCredentials: true,
221
- });
222
- }
223
- findDetails(id) {
224
- return this.http.get(`${this.actionUrl}/${id}/details`, {
225
- withCredentials: true,
226
- });
227
- }
228
- updateDetail(id, detailId, data) {
229
- return this.http.put(`${this.actionUrl}/${id}/details/${detailId}`, data, {
230
- withCredentials: true,
231
- });
232
- }
233
- deleteDetail(id, detailId) {
234
- return this.http.delete(`${this.actionUrl}/${id}/details/${detailId}`, {
235
- withCredentials: true,
236
- });
237
- }
238
- uploadDetailMedia(id, detailId, data) {
239
- return this.http.post(`${this.actionUrl}/${id}/details/${detailId}/media`, data, {
240
- withCredentials: true,
241
- });
242
- }
243
- deleteDetailMedia(id, detailId, mediaId) {
244
- return this.http.delete(`${this.actionUrl}/${id}/details/${detailId}/media/${mediaId}`, {
245
- withCredentials: true,
246
- });
247
- }
248
- review(id) {
249
- return this.http.post(`${this.actionUrl}/${id}/review`, {}, {
250
- withCredentials: true,
251
- });
252
- }
253
- start(id) {
254
- return this.http.post(`${this.actionUrl}/${id}/start`, {}, {
255
- withCredentials: true,
256
- });
257
- }
258
- finish(id) {
259
- return this.http.post(`${this.actionUrl}/${id}/finish`, {}, {
260
- withCredentials: true,
261
- });
262
- }
263
- publish(id) {
264
- return this.http.post(`${this.actionUrl}/${id}/publish`, {}, {
265
- withCredentials: true,
266
- });
267
- }
268
- upload(data) {
269
- return this.http.post(`${this.actionUrl}/upload`, data, {
270
- withCredentials: true,
271
- });
272
- }
273
- uploadMedia(id, data) {
274
- return this.http.post(`${this.actionUrl}/${id}/media`, data, {
275
- withCredentials: true,
276
- });
277
- }
278
- deleteMedia(id, mediaId) {
279
- return this.http.delete(`${this.actionUrl}/${id}/media/${mediaId}`, {
280
- withCredentials: true,
281
- });
282
- }
283
- importFromExcel(data) {
284
- return this.http.post(`${this.actionUrl}/excel`, data, {
285
- withCredentials: true,
286
- });
287
- }
288
- createFromExcel(data) {
289
- return this.http.post(`${this.actionUrl}/list`, data, {
290
- withCredentials: true,
291
- });
292
- }
293
- findAllRequests(options) {
294
- return this.http.get(`${this.actionUrl}/requests`, {
295
- params: options,
296
- withCredentials: true,
297
- });
298
- }
299
- findRequestDetail(id) {
300
- return this.http.get(`${this.actionUrl}/requests/${id}`, {
301
- withCredentials: true,
302
- });
303
- }
304
- accept(id) {
305
- return this.http.post(`${this.actionUrl}/${id}/reviews/accept`, {}, {
306
- withCredentials: true,
307
- });
308
- }
309
- reject(id, body) {
310
- return this.http.post(`${this.actionUrl}/${id}/reviews/reject`, body, {
311
- withCredentials: true,
312
- });
313
- }
314
- acceptRequest(id) {
315
- return this.http.post(`${this.actionUrl}/requests/${id}/reviews/accept`, {}, {
316
- withCredentials: true,
317
- });
318
- }
319
- rejectRequest(id, body) {
320
- return this.http.post(`${this.actionUrl}/requests/${id}/reviews/reject`, body, {
321
- withCredentials: true,
322
- });
323
- }
324
- addPricing(id, data) {
325
- return this.http.post(`${this.actionUrl}/${id}/pricing`, data, {
326
- withCredentials: true,
327
- });
328
- }
329
- updatePricing(id, pricingId, data) {
330
- return this.http.put(`${this.actionUrl}/${id}/pricing/${pricingId}`, data, {
331
- withCredentials: true,
332
- });
333
- }
334
- deletePricing(id, pricingId) {
335
- return this.http.delete(`${this.actionUrl}/${id}/pricing/${pricingId}`, {
336
- withCredentials: true,
337
- });
338
- }
339
- addSchedule(id, data) {
340
- return this.http.post(`${this.actionUrl}/${id}/schedule`, data, {
341
- withCredentials: true,
342
- });
343
- }
344
- updateSchedule(id, scheduleId, data) {
345
- return this.http.put(`${this.actionUrl}/${id}/schedule/${scheduleId}`, data, {
346
- withCredentials: true,
347
- });
348
- }
349
- deleteSchedule(id, scheduleId) {
350
- return this.http.delete(`${this.actionUrl}/${id}/schedule/${scheduleId}`, {
351
- withCredentials: true,
352
- });
353
- }
354
- findAllReviews(options) {
355
- return this.http.get(`${this.actionUrl}/reviews`, {
356
- params: options,
357
- withCredentials: true,
358
- });
359
- }
360
- getReview(id) {
361
- return this.http.get(`${this.actionUrl}/reviews/${id}`, {
362
- withCredentials: true,
363
- });
364
- }
365
- findReviews(options) {
366
- return this.http.get(`${this.actionUrl}/reviews/me`, {
367
- params: options,
368
- withCredentials: true,
369
- });
370
- }
371
- countUsers(options) {
372
- return this.http.get(`${this.actionUrl}/users/count/by`, {
373
- params: options,
374
- withCredentials: true,
375
- });
376
- }
377
- findByIds(ids) {
378
- return this.http.get(`${this.actionUrl}/by`, {
379
- params: { ids },
380
- withCredentials: true,
381
- });
382
- }
383
- findWishlist(options) {
384
- return this.http.get(`${this.actionUrl}/wishlist`, { params: options, withCredentials: true });
385
- }
386
- addToWishlist(courseId) {
387
- return this.http.post(`${this.actionUrl}/${courseId}/wishlist`, {}, { withCredentials: true });
388
- }
389
- removeFromWishlist(courseId) {
390
- return this.http.delete(`${this.actionUrl}/${courseId}/wishlist`, { withCredentials: true });
391
- }
392
- findWishlistBy(courseId) {
393
- return this.http.get(`${this.actionUrl}/${courseId}/wishlist/by`, { withCredentials: true });
394
- }
395
- findMyCourses(options) {
396
- return this.http.get(`${this.actionUrl}/users`, { params: options, withCredentials: true });
397
- }
398
- findPurchasedByCourseId(courseId) {
399
- return this.http.get(`${this.actionUrl}/users/me/by?courseId=${courseId}`, {
400
- withCredentials: true,
401
- });
402
- }
403
- deleteFromWishlist(sectionId) {
404
- return this.http.delete(`${this.actionUrl}/sections/${sectionId}`, { withCredentials: true });
405
- }
406
- // Course sections
407
- findCourseSections(options) {
408
- return this.http.get(`${this.actionUrl}/sections`, { params: options, withCredentials: false });
409
- }
410
- addCourseSection(courseId, data) {
411
- return this.http.post(`${this.actionUrl}/${courseId}/sections`, data, { withCredentials: true });
412
- }
413
- updateCourseSection(sectionId, data) {
414
- return this.http.put(`${this.actionUrl}/sections/${sectionId}`, data, { withCredentials: true });
415
- }
416
- deleteCourseSection(sectionId) {
417
- return this.http.delete(`${this.actionUrl}/sections/${sectionId}`, { withCredentials: true });
418
- }
419
- getCourseSection(courseId) {
420
- return this.http.get(`${this.actionUrl}/${courseId}/sections`, { withCredentials: false });
421
- }
422
- addLecture(sectionId, data) {
423
- return this.http.post(`${this.actionUrl}/sections/${sectionId}/lectures`, data, { withCredentials: true });
424
- }
425
- updateLecture(lectureId, data) {
426
- return this.http.put(`${this.actionUrl}/sections/lectures/${lectureId}`, data, { withCredentials: true });
427
- }
428
- deleteLecture(lectureId) {
429
- return this.http.delete(`${this.actionUrl}/sections/lectures/${lectureId}`, { withCredentials: true });
430
- }
431
- uploadVideoInit(lectureId, data) {
432
- return this.http.post(`${this.actionUrl}/sections/lectures/${lectureId}/videos/init`, data, {
433
- withCredentials: true,
434
- });
435
- }
436
- uploadVideoPartsToLecture(lectureId, data) {
437
- return this.http.post(`${this.actionUrl}/sections/lectures/${lectureId}/videos/parts`, data, {
438
- withCredentials: true,
439
- });
440
- }
441
- completePartUpload(lectureId, data) {
442
- return this.http.put(`${this.actionUrl}/sections/lectures/${lectureId}/videos/parts`, data, {
443
- withCredentials: true,
444
- });
445
- }
446
- uploadVideoToLecture(lectureId, data) {
447
- return this.http.post(`${this.actionUrl}/sections/lectures/${lectureId}/videos`, data, {
448
- withCredentials: true,
449
- });
450
- }
451
- deleteLectureVideo(videoId) {
452
- return this.http.delete(`${this.actionUrl}/sections/lectures/videos/${videoId}`, { withCredentials: true });
453
- }
454
- uploadLectureVideoThumbnail(videoId, data) {
455
- return this.http.post(`${this.actionUrl}/sections/lectures/videos/${videoId}/thumbnail`, data, {
456
- withCredentials: true,
457
- });
458
- }
459
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
460
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseService, providedIn: 'root' }); }
461
- }
462
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseService, decorators: [{
463
- type: Injectable,
464
- args: [{
465
- providedIn: 'root',
466
- }]
467
- }] });
468
-
469
- class CourseSectionService extends BaseService {
470
- init() {
471
- this.endpoint = 'courses';
472
- super.init();
473
- }
474
- findSections(id) {
475
- return this.http.get(`${this.actionUrl}/${id}/sections`);
476
- }
477
- canBePreviewed(videoId, data) {
478
- return this.http.post(`${this.actionUrl}/sections/lectures/videos/${videoId}/preview`, data, {
479
- withCredentials: true,
480
- });
481
- }
482
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseSectionService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
483
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseSectionService, providedIn: 'root' }); }
484
- }
485
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseSectionService, decorators: [{
486
- type: Injectable,
487
- args: [{
488
- providedIn: 'root',
489
- }]
490
- }] });
491
-
492
- class CategoryService extends BaseService {
493
- init() {
494
- this.endpoint = 'categories';
495
- super.init();
496
- }
497
- uploadMedia(id, data) {
498
- return this.http.post(`${this.actionUrl}/${id}/media`, data, {
499
- withCredentials: true,
500
- });
501
- }
502
- deleteMedia(id, mediaId) {
503
- return this.http.delete(`${this.actionUrl}/${id}/media/${mediaId}`, {
504
- withCredentials: true,
505
- });
506
- }
507
- importFromExcel(data) {
508
- return this.http.post(`${this.actionUrl}/excel`, data, {
509
- withCredentials: true,
510
- });
511
- }
512
- createFromExcel(data) {
513
- return this.http.post(`${this.actionUrl}/list`, data, {
514
- withCredentials: true,
515
- });
516
- }
517
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CategoryService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
518
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CategoryService, providedIn: 'root' }); }
519
- }
520
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CategoryService, decorators: [{
521
- type: Injectable,
522
- args: [{
523
- providedIn: 'root',
524
- }]
525
- }] });
526
-
527
- const services = [CourseService, CourseSectionService, CategoryService];
528
-
529
- function provideAngularCourse() {
530
- const providers = [
531
- ...services,
532
- importProvidersFrom(CommonModule, ReactiveFormsModule, FormsModule, RouterModule),
533
- ];
534
- return makeEnvironmentProviders(providers);
535
- }
536
-
537
- class CoursePreviewComponent {
538
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CoursePreviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
539
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.1", type: CoursePreviewComponent, isStandalone: true, selector: "rolatech-course-preview", ngImport: i0, template: "<p>course-preview works!</p>\n", styles: [""] }); }
540
- }
541
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CoursePreviewComponent, decorators: [{
542
- type: Component,
543
- args: [{ selector: 'rolatech-course-preview', standalone: true, imports: [], template: "<p>course-preview works!</p>\n" }]
544
- }] });
545
-
546
- class CourseInfoComponent {
547
- constructor() {
548
- this.course = input.required();
549
- this.instructor = input();
550
- this.username = input();
551
- this.dataToDisplay = effect(() => {
552
- return this.course();
553
- });
554
- }
555
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseInfoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
556
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseInfoComponent, isStandalone: true, selector: "rolatech-course-info", inputs: { course: { classPropertyName: "course", publicName: "course", isSignal: true, isRequired: true, transformFunction: null }, instructor: { classPropertyName: "instructor", publicName: "instructor", isSignal: true, isRequired: false, transformFunction: null }, username: { classPropertyName: "username", publicName: "username", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div>\n <div>\n <div class=\"text-2xl font-medium\">{{ course().name }}</div>\n @if (course().type && course().type.toString() !== 'ONLINE') {\n <div class=\"flex items-center pt-2\">\n <mat-icon>place</mat-icon>\n <span class=\"text-sm opacity-75\">{{ course().classroom.address }}</span>\n </div>\n }\n <div class=\"py-3 flex justify-between\">\n <div>\n <div class=\"mb-1 flex items-center\">\n <span class=\"font-medium\">\u4E3B\u8BB2\u6559\u5E08: </span>\n <a class=\"ml-2 underline text-orange-600 text-[0.9rem]\" [routerLink]=\"['/@' + username()]\">{{ instructor() }}</a>\n </div>\n <span class=\"text-sm opacity-75\">\u6700\u540E\u7F16\u8F91: {{ course().updatedAt }} </span>\n </div>\n </div>\n </div>\n <!-- \u63CF\u8FF0 -->\n <div class=\"mb-3\">\n {{ course().description }}\n </div>\n</div>\n", styles: ["mat-icon{transform:scale(.8)}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "ngmodule", type: RouterModule }] }); }
557
- }
558
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseInfoComponent, decorators: [{
559
- type: Component,
560
- args: [{ selector: 'rolatech-course-info', standalone: true, imports: [MatIconModule, RouterLink, RouterModule], template: "<div>\n <div>\n <div class=\"text-2xl font-medium\">{{ course().name }}</div>\n @if (course().type && course().type.toString() !== 'ONLINE') {\n <div class=\"flex items-center pt-2\">\n <mat-icon>place</mat-icon>\n <span class=\"text-sm opacity-75\">{{ course().classroom.address }}</span>\n </div>\n }\n <div class=\"py-3 flex justify-between\">\n <div>\n <div class=\"mb-1 flex items-center\">\n <span class=\"font-medium\">\u4E3B\u8BB2\u6559\u5E08: </span>\n <a class=\"ml-2 underline text-orange-600 text-[0.9rem]\" [routerLink]=\"['/@' + username()]\">{{ instructor() }}</a>\n </div>\n <span class=\"text-sm opacity-75\">\u6700\u540E\u7F16\u8F91: {{ course().updatedAt }} </span>\n </div>\n </div>\n </div>\n <!-- \u63CF\u8FF0 -->\n <div class=\"mb-3\">\n {{ course().description }}\n </div>\n</div>\n", styles: ["mat-icon{transform:scale(.8)}\n"] }]
561
- }] });
562
-
563
- class CourseMediaComponent {
564
- constructor() {
565
- this.dialog = inject(MatDialog);
566
- this.media = input([]);
567
- this.min = input(false);
568
- this.mediaIndex = 0;
569
- }
570
- onImageClick(i) {
571
- const dialogRef = this.dialog.open(ImagePreviewDialogComponent, {
572
- maxWidth: '80vw',
573
- maxHeight: '80vh',
574
- height: '80%',
575
- width: '80%',
576
- panelClass: 'full-screen-modal',
577
- data: {
578
- media: this.media,
579
- selected: i,
580
- },
581
- });
582
- dialogRef.afterClosed().subscribe((result) => { });
583
- }
584
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseMediaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
585
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseMediaComponent, isStandalone: true, selector: "rolatech-course-media", inputs: { media: { classPropertyName: "media", publicName: "media", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (media()) {\n @if (min()) {\n <div class=\"md:w-80 object-cover aspect-video bg-[--rt-10-percent-layer] rounded-lg\">\n @if (media()) {\n <rolatech-thumbnail [src]=\"media()[0].url\" size=\"small\"></rolatech-thumbnail>\n }\n </div>\n } @else {\n <div>\n <div class=\"object-cover aspect-video bg-[--rt-10-percent-layer]\">\n <rolatech-thumbnail [src]=\"media()[mediaIndex].url\" size=\"small\"></rolatech-thumbnail>\n </div>\n @for (item of media(); track $index) {\n <div\n class=\"inline-flex flex-row mt-3 mr-3 cursor-pointer rounded-md\"\n (click)=\"mediaIndex = $index\"\n [ngClass]=\"mediaIndex === $index ? '' : 'opacity-30'\"\n >\n <rolatech-thumbnail [src]=\"item.url\" size=\"small\"></rolatech-thumbnail>\n </div>\n }\n </div>\n }\n}\n", styles: [""], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ThumbnailComponent, selector: "rolatech-thumbnail", inputs: ["src", "size", "mode", "width", "height"] }] }); }
586
- }
587
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseMediaComponent, decorators: [{
588
- type: Component,
589
- args: [{ selector: 'rolatech-course-media', standalone: true, imports: [NgClass, ThumbnailComponent], template: "@if (media()) {\n @if (min()) {\n <div class=\"md:w-80 object-cover aspect-video bg-[--rt-10-percent-layer] rounded-lg\">\n @if (media()) {\n <rolatech-thumbnail [src]=\"media()[0].url\" size=\"small\"></rolatech-thumbnail>\n }\n </div>\n } @else {\n <div>\n <div class=\"object-cover aspect-video bg-[--rt-10-percent-layer]\">\n <rolatech-thumbnail [src]=\"media()[mediaIndex].url\" size=\"small\"></rolatech-thumbnail>\n </div>\n @for (item of media(); track $index) {\n <div\n class=\"inline-flex flex-row mt-3 mr-3 cursor-pointer rounded-md\"\n (click)=\"mediaIndex = $index\"\n [ngClass]=\"mediaIndex === $index ? '' : 'opacity-30'\"\n >\n <rolatech-thumbnail [src]=\"item.url\" size=\"small\"></rolatech-thumbnail>\n </div>\n }\n </div>\n }\n}\n" }]
590
- }] });
591
-
592
- class CoursePricingComponent {
593
- constructor() {
594
- this.pricing = input([]);
595
- }
596
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CoursePricingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
597
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CoursePricingComponent, isStandalone: true, selector: "rolatech-course-pricing", inputs: { pricing: { classPropertyName: "pricing", publicName: "pricing", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (pricing()) {\n <div class=\"py-3\">\n <div class=\"text-lg font-medium py-2\">\u4EF7\u683C</div>\n @for (item of pricing(); track $index) {\n <div>\n <span>{{ item.min }} \u81F3 {{ item.max }}\u4EBA</span>\n <span class=\"ml-3\">{{ item.total / 100 }}\u5143</span>\n </div>\n }\n </div>\n}\n", styles: [""] }); }
598
- }
599
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CoursePricingComponent, decorators: [{
600
- type: Component,
601
- args: [{ selector: 'rolatech-course-pricing', standalone: true, template: "@if (pricing()) {\n <div class=\"py-3\">\n <div class=\"text-lg font-medium py-2\">\u4EF7\u683C</div>\n @for (item of pricing(); track $index) {\n <div>\n <span>{{ item.min }} \u81F3 {{ item.max }}\u4EBA</span>\n <span class=\"ml-3\">{{ item.total / 100 }}\u5143</span>\n </div>\n }\n </div>\n}\n" }]
602
- }] });
603
-
604
- class CourseActionComponent {
605
- constructor() {
606
- this.course = input.required();
607
- this.inWishList = input(false);
608
- this.cart = output();
609
- this.wish = output();
610
- this.checkout = output();
611
- }
612
- onCart(course) {
613
- this.cart.emit(course);
614
- }
615
- onWish(course) {
616
- this.wish.emit(course);
617
- }
618
- onCheckout(course) {
619
- this.checkout.emit(course);
620
- }
621
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseActionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
622
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.1.1", type: CourseActionComponent, isStandalone: true, selector: "rolatech-course-action", inputs: { course: { classPropertyName: "course", publicName: "course", isSignal: true, isRequired: true, transformFunction: null }, inWishList: { classPropertyName: "inWishList", publicName: "inWishList", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { cart: "cart", wish: "wish", checkout: "checkout" }, ngImport: i0, template: "<div class=\"flex flex-col\">\n <!-- <a class=\"p-3 bg-orange-600 text-center mt-3\" target=\"_blank\" (click)=\"onCart(course)\">\u52A0\u5165\u8D2D\u7269\u8F66</a> -->\n <a mat-flat-button class=\"mt-3 min-h-11\" target=\"_blank\" (click)=\"onCheckout(course())\">\u7ACB\u5373\u8D2D\u4E70</a>\n <a mat-stroked-button class=\"mt-3 min-h-11\" target=\"_blank\" (click)=\"onWish(course())\">{{\n inWishList() ? '\u79FB\u9664\u6536\u85CF' : '\u52A0\u5165\u6536\u85CF'\n }}</a>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatAnchor, selector: "a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button]", exportAs: ["matButton", "matAnchor"] }] }); }
623
- }
624
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseActionComponent, decorators: [{
625
- type: Component,
626
- args: [{ standalone: true, selector: 'rolatech-course-action', imports: [MatButtonModule], template: "<div class=\"flex flex-col\">\n <!-- <a class=\"p-3 bg-orange-600 text-center mt-3\" target=\"_blank\" (click)=\"onCart(course)\">\u52A0\u5165\u8D2D\u7269\u8F66</a> -->\n <a mat-flat-button class=\"mt-3 min-h-11\" target=\"_blank\" (click)=\"onCheckout(course())\">\u7ACB\u5373\u8D2D\u4E70</a>\n <a mat-stroked-button class=\"mt-3 min-h-11\" target=\"_blank\" (click)=\"onWish(course())\">{{\n inWishList() ? '\u79FB\u9664\u6536\u85CF' : '\u52A0\u5165\u6536\u85CF'\n }}</a>\n</div>\n" }]
627
- }] });
628
-
629
- class CourseScheduleComponent {
630
- constructor() {
631
- this.schedule = input([]);
632
- }
633
- ngOnInit() {
634
- // this.formatSchedule();
635
- }
636
- formatSchedule() { }
637
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseScheduleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
638
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseScheduleComponent, isStandalone: true, selector: "rolatech-course-schedule", inputs: { schedule: { classPropertyName: "schedule", publicName: "schedule", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (schedule()) {\n <div class=\"py-3\" id=\"schedule\">\n <div class=\"text-xl font-medium py-2\">\u8BFE\u8868</div>\n <rolatech-accordion>\n @for (item of schedule(); track $index) {\n <rolatech-panel [title]=\"item.title\" [expanded]=\"$index === 0\">\n <div>\n <div class=\"text-gray-600 pt-2 text-sm\">\n <span>{{ item.startAt }} - {{ item.endAt }}</span>\n </div>\n <div class=\"py-3\">\n <div>{{ item.content }}</div>\n </div>\n </div>\n </rolatech-panel>\n }\n </rolatech-accordion>\n </div>\n}\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: AccordionComponent, selector: "rolatech-accordion" }, { kind: "component", type: PanelComponent, selector: "rolatech-panel", inputs: ["border", "divider", "expanded", "title", "subtitle"], outputs: ["expandedChange"] }] }); }
639
- }
640
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseScheduleComponent, decorators: [{
641
- type: Component,
642
- args: [{ selector: 'rolatech-course-schedule', standalone: true, imports: [MatIconModule, AccordionComponent, PanelComponent], template: "@if (schedule()) {\n <div class=\"py-3\" id=\"schedule\">\n <div class=\"text-xl font-medium py-2\">\u8BFE\u8868</div>\n <rolatech-accordion>\n @for (item of schedule(); track $index) {\n <rolatech-panel [title]=\"item.title\" [expanded]=\"$index === 0\">\n <div>\n <div class=\"text-gray-600 pt-2 text-sm\">\n <span>{{ item.startAt }} - {{ item.endAt }}</span>\n </div>\n <div class=\"py-3\">\n <div>{{ item.content }}</div>\n </div>\n </div>\n </rolatech-panel>\n }\n </rolatech-accordion>\n </div>\n}\n" }]
643
- }] });
644
-
645
- class CourseSectionsComponent {
646
- constructor() {
647
- this.purchased = input(false);
648
- this.sections = input([]);
649
- this.section = output();
650
- this.checkout = output();
651
- }
652
- onSection(section, lecture) {
653
- this.section.emit({ section, lecture });
654
- }
655
- onCheckout(section, lecture) {
656
- this.checkout.emit({ section, lecture });
657
- }
658
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseSectionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
659
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseSectionsComponent, isStandalone: true, selector: "rolatech-course-sections", inputs: { purchased: { classPropertyName: "purchased", publicName: "purchased", isSignal: true, isRequired: false, transformFunction: null }, sections: { classPropertyName: "sections", publicName: "sections", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { section: "section", checkout: "checkout" }, ngImport: i0, template: "@if (sections()) {\n <div id=\"sections()\">\n <div class=\"text-2xl font-medium py-3 lg:pt-0\">\u8BFE\u7A0B\u5185\u5BB9</div>\n <rolatech-accordion>\n @for (item of sections(); track $index) {\n <rolatech-panel [expanded]=\"$index === 0\" [title]=\"item.title\">\n @for (lecture of item.lectures; track $index) {\n <div class=\"flex items-center justify-between py-1\">\n @if (lecture.item && lecture.type === 'VIDEO') {\n <div class=\"flex items-center gap-3\">\n <mat-icon>live_tv</mat-icon>\n <span class=\"text-md\"> {{ lecture.title }}</span>\n </div>\n <div>\n @if (purchased()) {\n <a\n class=\"text-sm mr-1 underline underline-offset-2 cursor-pointer text-orange-600\"\n (click)=\"onSection(item, lecture)\"\n >\u64AD\u653E</a\n >\n } @else {\n @if (lecture.item.canBePreviewed) {\n <a\n class=\"text-sm mr-1 underline underline-offset-2 cursor-pointer text-orange-600\"\n (click)=\"onSection(item, lecture)\"\n >\u8BD5\u770B</a\n >\n } @else {\n <a\n class=\"text-sm mr-1 underline underline-offset-2 cursor-pointer text-orange-600\"\n (click)=\"onCheckout(item, lecture)\"\n >\u8D2D\u4E70</a\n >\n }\n }\n\n <a class=\"text-gray-500 inline-block w-[60px] text-right\">{{ lecture.item.duration | duration }}</a>\n </div>\n }\n </div>\n }\n </rolatech-panel>\n }\n </rolatech-accordion>\n </div>\n}\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "pipe", type: DurationPipe, name: "duration" }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: AccordionComponent, selector: "rolatech-accordion" }, { kind: "component", type: PanelComponent, selector: "rolatech-panel", inputs: ["border", "divider", "expanded", "title", "subtitle"], outputs: ["expandedChange"] }], encapsulation: i0.ViewEncapsulation.None }); }
660
- }
661
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseSectionsComponent, decorators: [{
662
- type: Component,
663
- args: [{ selector: 'rolatech-course-sections', encapsulation: ViewEncapsulation.None, standalone: true, imports: [MatIconModule, DurationPipe, MatCheckboxModule, AccordionComponent, PanelComponent], template: "@if (sections()) {\n <div id=\"sections()\">\n <div class=\"text-2xl font-medium py-3 lg:pt-0\">\u8BFE\u7A0B\u5185\u5BB9</div>\n <rolatech-accordion>\n @for (item of sections(); track $index) {\n <rolatech-panel [expanded]=\"$index === 0\" [title]=\"item.title\">\n @for (lecture of item.lectures; track $index) {\n <div class=\"flex items-center justify-between py-1\">\n @if (lecture.item && lecture.type === 'VIDEO') {\n <div class=\"flex items-center gap-3\">\n <mat-icon>live_tv</mat-icon>\n <span class=\"text-md\"> {{ lecture.title }}</span>\n </div>\n <div>\n @if (purchased()) {\n <a\n class=\"text-sm mr-1 underline underline-offset-2 cursor-pointer text-orange-600\"\n (click)=\"onSection(item, lecture)\"\n >\u64AD\u653E</a\n >\n } @else {\n @if (lecture.item.canBePreviewed) {\n <a\n class=\"text-sm mr-1 underline underline-offset-2 cursor-pointer text-orange-600\"\n (click)=\"onSection(item, lecture)\"\n >\u8BD5\u770B</a\n >\n } @else {\n <a\n class=\"text-sm mr-1 underline underline-offset-2 cursor-pointer text-orange-600\"\n (click)=\"onCheckout(item, lecture)\"\n >\u8D2D\u4E70</a\n >\n }\n }\n\n <a class=\"text-gray-500 inline-block w-[60px] text-right\">{{ lecture.item.duration | duration }}</a>\n </div>\n }\n </div>\n }\n </rolatech-panel>\n }\n </rolatech-accordion>\n </div>\n}\n" }]
664
- }] });
665
-
666
- class CourseSectionItemComponent {
667
- constructor() {
668
- this.section = model.required();
669
- this.actions = model();
670
- this.hasUnsaved = model();
671
- this.editId = model();
672
- this.save = output();
673
- this.cancel = output();
674
- this.delete = output();
675
- this.edit = output();
676
- this.addLecture = output();
677
- this.editing = false;
678
- this.isExpand = false;
679
- }
680
- ngOnInit() { }
681
- onSave(section) {
682
- this.editing = false;
683
- this.editId.set(null);
684
- this.save.emit(section);
685
- }
686
- onCancel(section) {
687
- this.editing = false;
688
- this.editId.set(null);
689
- this.cancel.emit(section);
690
- }
691
- onDelete(section) {
692
- this.delete.emit(section);
693
- }
694
- onEdit(section) {
695
- this.editId.set(null);
696
- this.editing = true;
697
- this.edit.emit(section);
698
- }
699
- onAddLecture(section) {
700
- this.addLecture.emit(section);
701
- }
702
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseSectionItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
703
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseSectionItemComponent, isStandalone: true, selector: "rolatech-course-section-item", inputs: { section: { classPropertyName: "section", publicName: "section", isSignal: true, isRequired: true, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, hasUnsaved: { classPropertyName: "hasUnsaved", publicName: "hasUnsaved", isSignal: true, isRequired: false, transformFunction: null }, editId: { classPropertyName: "editId", publicName: "editId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { section: "sectionChange", actions: "actionsChange", hasUnsaved: "hasUnsavedChange", editId: "editIdChange", save: "save", cancel: "cancel", delete: "delete", edit: "edit", addLecture: "addLecture" }, ngImport: i0, template: "<div class=\"flex flex-col grow\">\n @if (section().id !== editId()) {\n <div>\n <div class=\"flex justify-between items-center cursor-pointer\" (click)=\"isExpand = !isExpand\">\n <div class=\"w-full flex items-center gap-3 pl-3\">\n <span>{{ section().title }}</span>\n <button mat-icon-button class=\"max-w-8 max-h-8 !p-1\" (click)=\"onEdit(section()); $event.stopPropagation()\">\n <mat-icon>edit</mat-icon>\n </button>\n <button mat-icon-button class=\"max-w-8 max-h-8 !p-1\" (click)=\"onDelete(section()); $event.stopPropagation()\">\n <mat-icon>delete</mat-icon>\n </button>\n </div>\n <button mat-icon-button class=\"max-w-8 max-h-8 !p-1\">\n <mat-icon>{{ isExpand ? 'expand_less' : 'expand_more' }}</mat-icon>\n </button>\n </div>\n @if (isExpand) {\n <div>\n <ng-content></ng-content>\n </div>\n }\n </div>\n } @else {\n <div class=\"flex flex-col justify-between items-center\">\n <rolatech-input [(title)]=\"section().title\" placeholder=\"\u6807\u9898\"></rolatech-input>\n <div class=\"w-full flex flex-row justify-end p-3 gap-3\">\n <button mat-button class=\"max-h-8\" (click)=\"onCancel(section())\">\u53D6\u6D88</button>\n <button mat-flat-button class=\"max-h-8\" (click)=\"onSave(section())\">\u4FDD\u5B58</button>\n </div>\n </div>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: InputComponent, selector: "rolatech-input", inputs: ["title", "placeholder"], outputs: ["titleChange"] }] }); }
704
- }
705
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseSectionItemComponent, decorators: [{
706
- type: Component,
707
- args: [{ selector: 'rolatech-course-section-item', standalone: true, imports: [MatIconModule, FormsModule, MatButtonModule, IconButtonComponent, InputComponent], template: "<div class=\"flex flex-col grow\">\n @if (section().id !== editId()) {\n <div>\n <div class=\"flex justify-between items-center cursor-pointer\" (click)=\"isExpand = !isExpand\">\n <div class=\"w-full flex items-center gap-3 pl-3\">\n <span>{{ section().title }}</span>\n <button mat-icon-button class=\"max-w-8 max-h-8 !p-1\" (click)=\"onEdit(section()); $event.stopPropagation()\">\n <mat-icon>edit</mat-icon>\n </button>\n <button mat-icon-button class=\"max-w-8 max-h-8 !p-1\" (click)=\"onDelete(section()); $event.stopPropagation()\">\n <mat-icon>delete</mat-icon>\n </button>\n </div>\n <button mat-icon-button class=\"max-w-8 max-h-8 !p-1\">\n <mat-icon>{{ isExpand ? 'expand_less' : 'expand_more' }}</mat-icon>\n </button>\n </div>\n @if (isExpand) {\n <div>\n <ng-content></ng-content>\n </div>\n }\n </div>\n } @else {\n <div class=\"flex flex-col justify-between items-center\">\n <rolatech-input [(title)]=\"section().title\" placeholder=\"\u6807\u9898\"></rolatech-input>\n <div class=\"w-full flex flex-row justify-end p-3 gap-3\">\n <button mat-button class=\"max-h-8\" (click)=\"onCancel(section())\">\u53D6\u6D88</button>\n <button mat-flat-button class=\"max-h-8\" (click)=\"onSave(section())\">\u4FDD\u5B58</button>\n </div>\n </div>\n }\n</div>\n" }]
708
- }] });
709
-
710
- const COURSE_SCHEDULE_DATE_FORMATS = {
711
- parse: {
712
- dateInput: 'YYYY-MM-DD',
713
- },
714
- display: {
715
- dateInput: 'YYYY-MM-DD',
716
- monthYearLabel: 'MMM YYYY',
717
- dateA11yLabel: 'YYYY-MM-DD',
718
- monthYearA11yLabel: 'MMMM YYYY',
719
- },
720
- };
721
- class ScheduleItemComponent {
722
- constructor() {
723
- this.value = input();
724
- this.actions = input(false);
725
- this.delete = output();
726
- this.save = output();
727
- this.date = ScheduleDate;
728
- this.schedule = effect(() => {
729
- this.schedule = this.value() || {
730
- title: '',
731
- content: '',
732
- startAt: '',
733
- endAt: '',
734
- };
735
- this.schedule.startDate = moment(this.schedule.startAt).format('YYYY-MM-DD');
736
- this.schedule.startTime = moment(this.schedule.startAt).format('HH:mm');
737
- this.schedule.endDate = moment(this.schedule.endAt).format('YYYY-MM-DD');
738
- this.schedule.endTime = moment(this.schedule.endAt).format('HH:mm');
739
- });
740
- }
741
- // constructor() {
742
- // this.schedule = this.value();
743
- // }
744
- ngOnInit() {
745
- // this.schedule = computed(() => {
746
- // return this.value();
747
- // })();
748
- // this.schedule = this.value();
749
- // this.schedule.startDate = moment(this.schedule.startAt).format('YYYY-MM-DD');
750
- // this.schedule.startTime = moment(this.schedule.startAt).format('HH:mm');
751
- // this.schedule.endDate = moment(this.schedule.endAt).format('YYYY-MM-DD');
752
- // this.schedule.endTime = moment(this.schedule.endAt).format('HH:mm');
753
- }
754
- ngOnDestroy() {
755
- const { startAt, endAt, startTime, startDate, endDate, endTime } = this.schedule;
756
- this.schedule.startAt = this.schedule.startDate + ' ' + this.schedule.startTime;
757
- this.schedule.endAt = this.schedule.endDate + ' ' + this.schedule.endTime;
758
- delete this.schedule.startDate;
759
- delete this.schedule.startTime;
760
- delete this.schedule.endDate;
761
- delete this.schedule.endTime;
762
- }
763
- startDateChanged(event) { }
764
- startTimeChanged(event) { }
765
- endDateChanged(event) { }
766
- endTimeChanged(event) { }
767
- onSave(schedule) {
768
- this.format();
769
- this.save.emit(schedule);
770
- }
771
- onDelete(schedule) {
772
- this.delete.emit(schedule);
773
- }
774
- format() {
775
- this.schedule.startAt = this.schedule.startDate + ' ' + this.schedule.startTime;
776
- this.schedule.endAt = this.schedule.endDate + ' ' + this.schedule.endTime;
777
- }
778
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ScheduleItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
779
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: ScheduleItemComponent, isStandalone: true, selector: "rolatech-schedule-item", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { delete: "delete", save: "save" }, providers: [
780
- {
781
- provide: DateAdapter,
782
- useClass: MomentDateAdapter,
783
- deps: [MAT_DATE_LOCALE],
784
- },
785
- { provide: MAT_DATE_FORMATS, useValue: COURSE_SCHEDULE_DATE_FORMATS },
786
- DatePipe,
787
- ], ngImport: i0, template: "<div class=\"flex flex-col py-3\">\n <mat-form-field appearance=\"fill\">\n <mat-label> \u6807\u9898 </mat-label>\n <input matInput type=\"text\" [(ngModel)]=\"schedule.title\" name=\"title\" required />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u5185\u5BB9 </mat-label>\n <textarea\n matInput\n type=\"text\"\n [(ngModel)]=\"schedule.content\"\n name=\"content\"\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"3\"\n required\n ></textarea>\n </mat-form-field>\n <div class=\"flex flex-row gap-3\">\n <mat-form-field appearance=\"fill\">\n <mat-label>\u5F00\u59CB\u65E5\u671F</mat-label>\n <input\n matInput\n [matDatepicker]=\"picker\"\n (focus)=\"picker.open()\"\n name=\"startAt\"\n [(ngModel)]=\"schedule.startDate\"\n (ngModelChange)=\"startDateChanged($event)\"\n (dateInput)=\"schedule.startDate = $event.value.format('YYYY-MM-DD')\"\n readonly\n required\n />\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label>\u5F00\u59CB\u65F6\u95F4</mat-label>\n <mat-select [(ngModel)]=\"schedule.startTime\" (selectionChange)=\"startTimeChanged($event)\" required readonly>\n @for (d of date; track d) {\n <mat-option [value]=\"d\">\n {{ d }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"flex flex-row gap-3\">\n <mat-form-field appearance=\"fill\">\n <mat-label>\u7ED3\u675F\u65E5\u671F</mat-label>\n <input\n matInput\n [matDatepicker]=\"picker2\"\n name=\"endAt\"\n (focus)=\"picker2.open()\"\n (ngModelChange)=\"endDateChanged($event)\"\n [(ngModel)]=\"schedule.endDate\"\n (dateInput)=\"schedule.endDate = $event.value.format('YYYY-MM-DD')\"\n readonly\n required\n />\n <mat-datepicker-toggle matIconSuffix [for]=\"picker2\"></mat-datepicker-toggle>\n <mat-datepicker #picker2></mat-datepicker>\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label>\u7ED3\u675F\u65F6\u95F4</mat-label>\n <mat-select [(ngModel)]=\"schedule.endTime\" (selectionChange)=\"endTimeChanged($event)\" required readonly>\n @for (d of date; track d) {\n <mat-option [value]=\"d\">\n {{ d }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n</div>\n@if (actions()) {\n <div class=\"flex flex-row justify-end p-3 gap-3\">\n <button mat-button class=\"max-h-8\" (click)=\"onDelete(schedule)\">\u5220\u9664</button>\n <button mat-flat-button class=\"max-h-8\" (click)=\"onSave(schedule)\">\u4FDD\u5B58</button>\n </div>\n}\n<mat-divider></mat-divider>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i3.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TextFieldModule }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i5.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i5.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i5.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i6.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i6$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatOptionModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i5$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }] }); }
788
- }
789
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ScheduleItemComponent, decorators: [{
790
- type: Component,
791
- args: [{ selector: 'rolatech-schedule-item', providers: [
792
- {
793
- provide: DateAdapter,
794
- useClass: MomentDateAdapter,
795
- deps: [MAT_DATE_LOCALE],
796
- },
797
- { provide: MAT_DATE_FORMATS, useValue: COURSE_SCHEDULE_DATE_FORMATS },
798
- DatePipe,
799
- ], standalone: true, imports: [
800
- NgClass,
801
- MatFormFieldModule,
802
- MatInputModule,
803
- FormsModule,
804
- TextFieldModule,
805
- MatDatepickerModule,
806
- MatSelectModule,
807
- MatOptionModule,
808
- MatButtonModule,
809
- MatDividerModule,
810
- ], template: "<div class=\"flex flex-col py-3\">\n <mat-form-field appearance=\"fill\">\n <mat-label> \u6807\u9898 </mat-label>\n <input matInput type=\"text\" [(ngModel)]=\"schedule.title\" name=\"title\" required />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u5185\u5BB9 </mat-label>\n <textarea\n matInput\n type=\"text\"\n [(ngModel)]=\"schedule.content\"\n name=\"content\"\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"3\"\n required\n ></textarea>\n </mat-form-field>\n <div class=\"flex flex-row gap-3\">\n <mat-form-field appearance=\"fill\">\n <mat-label>\u5F00\u59CB\u65E5\u671F</mat-label>\n <input\n matInput\n [matDatepicker]=\"picker\"\n (focus)=\"picker.open()\"\n name=\"startAt\"\n [(ngModel)]=\"schedule.startDate\"\n (ngModelChange)=\"startDateChanged($event)\"\n (dateInput)=\"schedule.startDate = $event.value.format('YYYY-MM-DD')\"\n readonly\n required\n />\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label>\u5F00\u59CB\u65F6\u95F4</mat-label>\n <mat-select [(ngModel)]=\"schedule.startTime\" (selectionChange)=\"startTimeChanged($event)\" required readonly>\n @for (d of date; track d) {\n <mat-option [value]=\"d\">\n {{ d }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"flex flex-row gap-3\">\n <mat-form-field appearance=\"fill\">\n <mat-label>\u7ED3\u675F\u65E5\u671F</mat-label>\n <input\n matInput\n [matDatepicker]=\"picker2\"\n name=\"endAt\"\n (focus)=\"picker2.open()\"\n (ngModelChange)=\"endDateChanged($event)\"\n [(ngModel)]=\"schedule.endDate\"\n (dateInput)=\"schedule.endDate = $event.value.format('YYYY-MM-DD')\"\n readonly\n required\n />\n <mat-datepicker-toggle matIconSuffix [for]=\"picker2\"></mat-datepicker-toggle>\n <mat-datepicker #picker2></mat-datepicker>\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label>\u7ED3\u675F\u65F6\u95F4</mat-label>\n <mat-select [(ngModel)]=\"schedule.endTime\" (selectionChange)=\"endTimeChanged($event)\" required readonly>\n @for (d of date; track d) {\n <mat-option [value]=\"d\">\n {{ d }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n</div>\n@if (actions()) {\n <div class=\"flex flex-row justify-end p-3 gap-3\">\n <button mat-button class=\"max-h-8\" (click)=\"onDelete(schedule)\">\u5220\u9664</button>\n <button mat-flat-button class=\"max-h-8\" (click)=\"onSave(schedule)\">\u4FDD\u5B58</button>\n </div>\n}\n<mat-divider></mat-divider>\n" }]
811
- }] });
812
-
813
- class CourseSectionLectureVideoDialogComponent {
814
- constructor(dialogRef, data) {
815
- this.dialogRef = dialogRef;
816
- this.data = data;
817
- this.thumbnailUpload = output();
818
- this.courseService = inject(CourseService);
819
- this.courseSectionService = inject(CourseSectionService);
820
- this.snackBar = inject(MatSnackBar);
821
- this.platformId = inject(PLATFORM_ID);
822
- this.el = inject(ElementRef);
823
- this.lecture = data.data;
824
- }
825
- ngAfterViewInit() {
826
- this.initPlayer(this.lecture.item.url, this.lecture.item.thumbnail);
827
- }
828
- close() {
829
- this.dialogRef.close();
830
- }
831
- initPlayer(url, thumbnail) {
832
- if (!isPlatformBrowser(this.platformId)) {
833
- return;
834
- }
835
- // 'https://cos-video-1258344699.cos.ap-guangzhou.tencentcos.cn/test.mp4',
836
- if (!this.player) {
837
- const playerContainer = this.el.nativeElement.querySelector('#dplayer');
838
- this.player = new DPlayer({
839
- container: playerContainer,
840
- screenshot: true,
841
- preload: 'metadata',
842
- video: {
843
- url: url,
844
- pic: thumbnail,
845
- },
846
- });
847
- // this.player.on('loadedmetadata', () => {
848
- // console.log('Video duration:', this.player.video.duration);
849
- // });
850
- }
851
- }
852
- ngOnInit() { }
853
- ngOnDestroy() {
854
- if (this.player) {
855
- this.player.destroy();
856
- }
857
- }
858
- onThumbnailUpload(event) {
859
- const file = event.target.files[0];
860
- if (file) {
861
- const reader = new FileReader();
862
- reader.readAsDataURL(file);
863
- reader.onload = () => {
864
- this.mediaSrc = reader.result;
865
- const formData = new FormData();
866
- formData.append('file', file);
867
- this.courseService.uploadLectureVideoThumbnail(this.lecture.item.id, formData).subscribe({
868
- next: (res) => {
869
- this.lecture.item = res.data;
870
- this.snackBar.open('上传成功');
871
- this.player.switchVideo({
872
- url: this.lecture.item.url,
873
- pic: res.data.thumbnail,
874
- });
875
- },
876
- });
877
- };
878
- reader.onerror = (error) => { };
879
- }
880
- }
881
- onPreviewChange(event) {
882
- this.courseSectionService.canBePreviewed(this.lecture.item.id, { canBePreviewed: event.checked }).subscribe({
883
- next: (res) => {
884
- this.lecture.item.canBePreviewed = res.data.canBePreviewed;
885
- // this.lecture = res.data;
886
- },
887
- });
888
- }
889
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseSectionLectureVideoDialogComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
890
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseSectionLectureVideoDialogComponent, isStandalone: true, selector: "rolatech-course-section-lecture-video-dialog", outputs: { thumbnailUpload: "thumbnailUpload" }, ngImport: i0, template: "<div class=\"flex flex-col-reverse md:flex-row justify-between h-full gap-3\">\n <div class=\"w-full md:w-1/2\">\n <div>\n <div class=\"py-3 flex flex-col\">\n <span class=\"text-lg font-bold\"> \u5C01\u9762 </span>\n <span class=\"text-sm\">\u4E00\u4E2A\u597D\u7684\u5C01\u9762\u53EF\u4EE5\u5F15\u8D77\u66F4\u591A\u7684\u5173\u6CE8</span>\n </div>\n\n <div class=\"flex gap-3\">\n <div\n class=\"p-3 w-36 flex flex-col items-center justify-center outline-dashed outline-1 rounded cursor-pointer\"\n (click)=\"fileInput.click()\"\n >\n <mat-icon>upload</mat-icon>\n <span class=\"text-sm\">\u4E0A\u4F20\u5C01\u9762</span>\n </div>\n <input type=\"file\" accept=\"image/*\" (change)=\"onThumbnailUpload($event)\" #fileInput style=\"display: none\" />\n @if (lecture.item.thumbnail) {\n <div class=\"aspect-video w-32 h-auto bg-black\">\n <img [src]=\"lecture.item.thumbnail\" class=\"aspect-video object-contain\" />\n </div>\n } @else {\n <div class=\"aspect-video w-32 h-auto\">\n <img [src]=\"mediaSrc\" class=\"aspect-video object-contain\" />\n </div>\n }\n </div>\n </div>\n <div class=\"mt-3\">\n <div class=\"py-3 flex flex-col\">\n <span class=\"text-lg font-bold\"> \u8BD5\u770B\u5185\u5BB9 </span>\n <span class=\"text-sm\">\u5C11\u91CF\u7684\u8BD5\u770B\u5185\u5BB9, \u53EF\u4EE5\u589E\u52A0\u8D2D\u4E70\u7387</span>\n </div>\n <mat-checkbox color=\"primary\" (change)=\"onPreviewChange($event)\" [checked]=\"lecture.item.canBePreviewed\"\n >\u5141\u8BB8\u8BD5\u770B</mat-checkbox\n >\n </div>\n </div>\n <div class=\"w-full md:w-1/2\">\n @if (lecture) {\n <div>\n <div id=\"dplayer\" class=\"w-full h-auto aspect-video md:rounded-xl\"></div>\n </div>\n }\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: MatStepperModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i3$1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }] }); }
891
- }
892
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseSectionLectureVideoDialogComponent, decorators: [{
893
- type: Component,
894
- args: [{ selector: 'rolatech-course-section-lecture-video-dialog', standalone: true, imports: [
895
- MatIconModule,
896
- MatDividerModule,
897
- FormsModule,
898
- MatStepperModule,
899
- ScheduleItemComponent,
900
- MatButtonModule,
901
- MatDialogClose,
902
- MatCheckboxModule,
903
- ], template: "<div class=\"flex flex-col-reverse md:flex-row justify-between h-full gap-3\">\n <div class=\"w-full md:w-1/2\">\n <div>\n <div class=\"py-3 flex flex-col\">\n <span class=\"text-lg font-bold\"> \u5C01\u9762 </span>\n <span class=\"text-sm\">\u4E00\u4E2A\u597D\u7684\u5C01\u9762\u53EF\u4EE5\u5F15\u8D77\u66F4\u591A\u7684\u5173\u6CE8</span>\n </div>\n\n <div class=\"flex gap-3\">\n <div\n class=\"p-3 w-36 flex flex-col items-center justify-center outline-dashed outline-1 rounded cursor-pointer\"\n (click)=\"fileInput.click()\"\n >\n <mat-icon>upload</mat-icon>\n <span class=\"text-sm\">\u4E0A\u4F20\u5C01\u9762</span>\n </div>\n <input type=\"file\" accept=\"image/*\" (change)=\"onThumbnailUpload($event)\" #fileInput style=\"display: none\" />\n @if (lecture.item.thumbnail) {\n <div class=\"aspect-video w-32 h-auto bg-black\">\n <img [src]=\"lecture.item.thumbnail\" class=\"aspect-video object-contain\" />\n </div>\n } @else {\n <div class=\"aspect-video w-32 h-auto\">\n <img [src]=\"mediaSrc\" class=\"aspect-video object-contain\" />\n </div>\n }\n </div>\n </div>\n <div class=\"mt-3\">\n <div class=\"py-3 flex flex-col\">\n <span class=\"text-lg font-bold\"> \u8BD5\u770B\u5185\u5BB9 </span>\n <span class=\"text-sm\">\u5C11\u91CF\u7684\u8BD5\u770B\u5185\u5BB9, \u53EF\u4EE5\u589E\u52A0\u8D2D\u4E70\u7387</span>\n </div>\n <mat-checkbox color=\"primary\" (change)=\"onPreviewChange($event)\" [checked]=\"lecture.item.canBePreviewed\"\n >\u5141\u8BB8\u8BD5\u770B</mat-checkbox\n >\n </div>\n </div>\n <div class=\"w-full md:w-1/2\">\n @if (lecture) {\n <div>\n <div id=\"dplayer\" class=\"w-full h-auto aspect-video md:rounded-xl\"></div>\n </div>\n }\n </div>\n</div>\n" }]
904
- }], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
905
- type: Inject,
906
- args: [MAT_DIALOG_DATA]
907
- }] }] });
908
-
909
- class CourseSectionLectureItemComponent {
910
- constructor() {
911
- this.platformId = inject(PLATFORM_ID);
912
- this.el = inject(ElementRef);
913
- this.dialogService = inject(DialogService);
914
- this.myVideo = viewChild('video');
915
- this.progress = input(0);
916
- this.lecture = input.required();
917
- this.actions = input(true);
918
- this.hasUnsaved = input(false);
919
- this.editId = model();
920
- this.save = output();
921
- this.cancel = output();
922
- this.delete = output();
923
- this.edit = output();
924
- this.mediaEdit = output();
925
- this.thumbnailUpload = output();
926
- this.upload = output();
927
- this.deleteMedia = output();
928
- this.editing = false;
929
- }
930
- ngOnInit() { }
931
- onSave(lecture) {
932
- this.editing = false;
933
- this.editId.set(null);
934
- this.save.emit(lecture);
935
- }
936
- onCancel(lecture) {
937
- this.editing = false;
938
- this.editId.set(null);
939
- this.cancel.emit(lecture);
940
- }
941
- onDelete(lecture) {
942
- this.delete.emit(lecture);
943
- }
944
- onEdit(lecture) {
945
- this.editId.set(lecture.id);
946
- this.editing = true;
947
- this.edit.emit(lecture);
948
- }
949
- onMediaEdit(lecture) {
950
- this.editId.set(lecture.id);
951
- this.editing = true;
952
- // this.mediaEdit.emit(lecture);
953
- const options = {
954
- title: '编辑视频',
955
- cancelText: '取消',
956
- confirmText: '确定',
957
- data: this.lecture(),
958
- width: '80vw',
959
- maxWidth: '80vw',
960
- height: '100%',
961
- component: CourseSectionLectureVideoDialogComponent,
962
- };
963
- this.dialogService.open(options);
964
- this.dialogService.confirmed().subscribe({
965
- next: (res) => {
966
- if (res) {
967
- const data = {
968
- name: res,
969
- };
970
- }
971
- },
972
- });
973
- }
974
- onVideoThumbnailUpload(video) {
975
- this.thumbnailUpload.emit(video);
976
- }
977
- onUpload(id, data) {
978
- this.lecture().isUploading = true;
979
- this.upload.emit({ id, data });
980
- }
981
- onDeleteMedia(data) {
982
- this.deleteMedia.emit(data);
983
- }
984
- onLoadedMetadata(event) {
985
- if (this.lecture().item.duration) {
986
- return;
987
- }
988
- const videoElement = event.target;
989
- this.lecture().item.duration = videoElement.duration;
990
- // console.log('Video Width:', videoElement.videoWidth);
991
- // console.log('Video Height:', videoElement.videoHeight);
992
- }
993
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseSectionLectureItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
994
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseSectionLectureItemComponent, isStandalone: true, selector: "rolatech-course-section-lecture-item", inputs: { progress: { classPropertyName: "progress", publicName: "progress", isSignal: true, isRequired: false, transformFunction: null }, lecture: { classPropertyName: "lecture", publicName: "lecture", isSignal: true, isRequired: true, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, hasUnsaved: { classPropertyName: "hasUnsaved", publicName: "hasUnsaved", isSignal: true, isRequired: false, transformFunction: null }, editId: { classPropertyName: "editId", publicName: "editId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { editId: "editIdChange", save: "save", cancel: "cancel", delete: "delete", edit: "edit", mediaEdit: "mediaEdit", thumbnailUpload: "thumbnailUpload", upload: "upload", deleteMedia: "deleteMedia" }, viewQueries: [{ propertyName: "myVideo", first: true, predicate: ["video"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"flex flex-col grow p-2\">\n @if (lecture().id !== editId()) {\n <div class=\"w-full flex gap-3 p-3 items-center\">\n <span>{{ lecture().title }}</span>\n <button mat-icon-button (click)=\"onEdit(lecture()); $event.stopPropagation()\" class=\"max-w-8 max-h-8 !p-1\">\n <mat-icon>edit</mat-icon>\n </button>\n <button mat-icon-button (click)=\"onDelete(lecture()); $event.stopPropagation()\" class=\"max-w-8 max-h-8 !p-1\">\n <mat-icon>delete</mat-icon>\n </button>\n </div>\n } @else {\n <div class=\"flex flex-col justify-between items-center\">\n <rolatech-input [(title)]=\"lecture().title\" placeholder=\"\u6807\u9898\"></rolatech-input>\n <div class=\"w-full flex flex-row justify-end p-3 gap-3\">\n <button mat-button class=\"max-h-8\" (click)=\"onCancel(lecture())\">\u53D6\u6D88</button>\n <button mat-flat-button class=\"max-h-8\" (click)=\"onSave(lecture())\">\u4FDD\u5B58</button>\n </div>\n </div>\n }\n\n <div>\n @if (lecture().item) {\n <div class=\"flex flex-row p-2 gap-3\">\n <div class=\"bg-black h-fit\">\n <video\n id=\"video\"\n #video\n [src]=\"lecture().item.url\"\n class=\"w-32 aspect-video\"\n (loadedmetadata)=\"onLoadedMetadata($event)\"\n [poster]=\"lecture().item.thumbnail\"\n ></video>\n </div>\n <div class=\"flex flex-col justify-between w-full\">\n <div class=\"flex justify-between items-center w-full\">\n <div class=\"flex justify-between items-center w-full px-2\">\n <span>\u89C6\u9891\u5185\u5BB9</span>\n </div>\n @if (lecture().isUploading) {\n <div>\n <span> {{ lecture().item.progress }}%</span>\n </div>\n }\n </div>\n <div class=\"flex justify-between items-center\">\n <div>\n <button mat-button class=\"max-h-8\" (click)=\"onMediaEdit(lecture().item); $event.stopPropagation()\">\n <mat-icon>edit</mat-icon>\n <span>\u7F16\u8F91</span>\n </button>\n <button mat-button class=\"max-h-8\" (click)=\"onDeleteMedia(lecture().item); $event.stopPropagation()\">\n <mat-icon>delete</mat-icon>\n <span>\u5220\u9664</span>\n </button>\n </div>\n <div>\n <span>{{ lecture().item.duration | duration }}</span>\n </div>\n </div>\n </div>\n </div>\n @if (lecture().isUploading) {\n <div class=\"p-2\">\n <mat-progress-bar color=\"primary\" mode=\"determinate\" [value]=\"lecture().item.progress\"> </mat-progress-bar>\n </div>\n }\n } @else {\n @if (lecture().id !== editId()) {\n <div class=\"px-3\">\n <input\n class=\"ud-sr-only\"\n type=\"file\"\n accept=\".avi,.mpg,.mpeg,.flv,.mov,.m2v,.m4v,.mp4,.rm,.ram,.vob,.ogv,.webm,.wmv\"\n (change)=\"onUpload(lecture().id, $event)\"\n #fileInput\n />\n <div class=\"flex justify-between items-center\">\n <div>\u65E0\u89C6\u9891\u6587\u4EF6</div>\n <button mat-flat-button class=\"max-h-8\" (click)=\"fileInput.click()\">\u4E0A\u4F20\u89C6\u9891</button>\n </div>\n </div>\n }\n }\n </div>\n @if (!hasUnsaved) {\n <ng-content></ng-content>\n }\n</div>\n", styles: [".ud-sr-only{position:absolute!important;height:1px;width:1px;overflow:hidden;clip:rect(1px,1px,1px,1px)}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: AngularCommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "ngmodule", type: AngularComponentsModule }, { kind: "component", type: i3$2.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "pipe", type: DurationPipe, name: "duration" }, { kind: "component", type: InputComponent, selector: "rolatech-input", inputs: ["title", "placeholder"], outputs: ["titleChange"] }] }); }
995
- }
996
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseSectionLectureItemComponent, decorators: [{
997
- type: Component,
998
- args: [{ selector: 'rolatech-course-section-lecture-item', standalone: true, imports: [
999
- MatIconModule,
1000
- AngularCommonModule,
1001
- FormsModule,
1002
- MatButtonModule,
1003
- MatDividerModule,
1004
- AngularComponentsModule,
1005
- DurationPipe,
1006
- InputComponent,
1007
- ], template: "<div class=\"flex flex-col grow p-2\">\n @if (lecture().id !== editId()) {\n <div class=\"w-full flex gap-3 p-3 items-center\">\n <span>{{ lecture().title }}</span>\n <button mat-icon-button (click)=\"onEdit(lecture()); $event.stopPropagation()\" class=\"max-w-8 max-h-8 !p-1\">\n <mat-icon>edit</mat-icon>\n </button>\n <button mat-icon-button (click)=\"onDelete(lecture()); $event.stopPropagation()\" class=\"max-w-8 max-h-8 !p-1\">\n <mat-icon>delete</mat-icon>\n </button>\n </div>\n } @else {\n <div class=\"flex flex-col justify-between items-center\">\n <rolatech-input [(title)]=\"lecture().title\" placeholder=\"\u6807\u9898\"></rolatech-input>\n <div class=\"w-full flex flex-row justify-end p-3 gap-3\">\n <button mat-button class=\"max-h-8\" (click)=\"onCancel(lecture())\">\u53D6\u6D88</button>\n <button mat-flat-button class=\"max-h-8\" (click)=\"onSave(lecture())\">\u4FDD\u5B58</button>\n </div>\n </div>\n }\n\n <div>\n @if (lecture().item) {\n <div class=\"flex flex-row p-2 gap-3\">\n <div class=\"bg-black h-fit\">\n <video\n id=\"video\"\n #video\n [src]=\"lecture().item.url\"\n class=\"w-32 aspect-video\"\n (loadedmetadata)=\"onLoadedMetadata($event)\"\n [poster]=\"lecture().item.thumbnail\"\n ></video>\n </div>\n <div class=\"flex flex-col justify-between w-full\">\n <div class=\"flex justify-between items-center w-full\">\n <div class=\"flex justify-between items-center w-full px-2\">\n <span>\u89C6\u9891\u5185\u5BB9</span>\n </div>\n @if (lecture().isUploading) {\n <div>\n <span> {{ lecture().item.progress }}%</span>\n </div>\n }\n </div>\n <div class=\"flex justify-between items-center\">\n <div>\n <button mat-button class=\"max-h-8\" (click)=\"onMediaEdit(lecture().item); $event.stopPropagation()\">\n <mat-icon>edit</mat-icon>\n <span>\u7F16\u8F91</span>\n </button>\n <button mat-button class=\"max-h-8\" (click)=\"onDeleteMedia(lecture().item); $event.stopPropagation()\">\n <mat-icon>delete</mat-icon>\n <span>\u5220\u9664</span>\n </button>\n </div>\n <div>\n <span>{{ lecture().item.duration | duration }}</span>\n </div>\n </div>\n </div>\n </div>\n @if (lecture().isUploading) {\n <div class=\"p-2\">\n <mat-progress-bar color=\"primary\" mode=\"determinate\" [value]=\"lecture().item.progress\"> </mat-progress-bar>\n </div>\n }\n } @else {\n @if (lecture().id !== editId()) {\n <div class=\"px-3\">\n <input\n class=\"ud-sr-only\"\n type=\"file\"\n accept=\".avi,.mpg,.mpeg,.flv,.mov,.m2v,.m4v,.mp4,.rm,.ram,.vob,.ogv,.webm,.wmv\"\n (change)=\"onUpload(lecture().id, $event)\"\n #fileInput\n />\n <div class=\"flex justify-between items-center\">\n <div>\u65E0\u89C6\u9891\u6587\u4EF6</div>\n <button mat-flat-button class=\"max-h-8\" (click)=\"fileInput.click()\">\u4E0A\u4F20\u89C6\u9891</button>\n </div>\n </div>\n }\n }\n </div>\n @if (!hasUnsaved) {\n <ng-content></ng-content>\n }\n</div>\n", styles: [".ud-sr-only{position:absolute!important;height:1px;width:1px;overflow:hidden;clip:rect(1px,1px,1px,1px)}\n"] }]
1008
- }] });
1009
-
1010
- class CourseSectionLectureVideoItemComponent {
1011
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseSectionLectureVideoItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1012
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.1", type: CourseSectionLectureVideoItemComponent, isStandalone: true, selector: "rolatech-course-section-lecture-video-item", ngImport: i0, template: "<p>course-section-lecture-video-item works!</p>\n", styles: [""] }); }
1013
- }
1014
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseSectionLectureVideoItemComponent, decorators: [{
1015
- type: Component,
1016
- args: [{ selector: 'rolatech-course-section-lecture-video-item', standalone: true, template: "<p>course-section-lecture-video-item works!</p>\n" }]
1017
- }] });
1018
-
1019
- class CourseItemComponent {
1020
- constructor() {
1021
- this.course = input.required();
1022
- this.row = input(true);
1023
- this.inset = input(false, { transform: booleanAttribute });
1024
- }
1025
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1026
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseItemComponent, isStandalone: true, selector: "rolatech-course-item", inputs: { course: { classPropertyName: "course", publicName: "course", isSignal: true, isRequired: true, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: false, transformFunction: null }, inset: { classPropertyName: "inset", publicName: "inset", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (row()) {\n <div class=\"flex w-full flex-row\" [style]=\"inset() ? 'padding: 0 16px' : ''\">\n <div class=\"h-fit w-2/5 md:w-1/4 aspect-video bg-[--rt-10-percent-layer] rounded-lg\">\n @if (course().media) {\n @defer (on viewport()) {\n <rolatech-thumbnail [src]=\"course().media[0].url + '!w400'\" size=\"medium\"></rolatech-thumbnail>\n } @placeholder {\n <div class=\"bg-[--rt-10-percent-layer] h-full w-full object-cover aspect-video rounded-lg\"></div>\n }\n }\n </div>\n <div class=\"w-3/5 md:w-3/4 ml-3 flex flex-col justify-between\">\n <div>\n <div class=\"md:text-xl font-medium break-words line-clamp-1 md:line-clamp-2 whitespace-normal\">\n {{ course().name }}\n </div>\n <div class=\"invisible h-0 md:h-auto md:visible break-words line-clamp-1 whitespace-normal\">\n {{ course().description }}\n </div>\n </div>\n @if (course().pricing) {\n <div class=\"md:text-lg font-medium py-1\">\u00A5{{ course().pricing[0].total / 100 }}</div>\n }\n </div>\n </div>\n} @else {\n <div>\n <div>\n @if (course().media; as media) {\n @defer (on viewport()) {\n <rolatech-thumbnail [src]=\"course().media[0].url + '!w400'\" size=\"medium\"></rolatech-thumbnail>\n } @placeholder {\n <div class=\"bg-[--rt-10-percent-layer] w-full h-full object-cover aspect-video rounded-lg\"></div>\n }\n }\n </div>\n <div class=\"mt-2\">\n <div class=\"text-md md:text-xl font-medium break-words line-clamp-2\">{{ course().name }}</div>\n @if (course().pricing) {\n <div class=\"text-md md:text-lg font-medium py-1\">\u00A5{{ course().pricing[0].total / 100 }}</div>\n }\n </div>\n </div>\n}\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }], deferBlockDependencies: [() => [ThumbnailComponent], () => [ThumbnailComponent]] }); }
1027
- }
1028
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseItemComponent, decorators: [{
1029
- type: Component,
1030
- args: [{ selector: 'rolatech-course-item', standalone: true, imports: [CommonModule, ImageComponent, ThumbnailComponent], template: "@if (row()) {\n <div class=\"flex w-full flex-row\" [style]=\"inset() ? 'padding: 0 16px' : ''\">\n <div class=\"h-fit w-2/5 md:w-1/4 aspect-video bg-[--rt-10-percent-layer] rounded-lg\">\n @if (course().media) {\n @defer (on viewport()) {\n <rolatech-thumbnail [src]=\"course().media[0].url + '!w400'\" size=\"medium\"></rolatech-thumbnail>\n } @placeholder {\n <div class=\"bg-[--rt-10-percent-layer] h-full w-full object-cover aspect-video rounded-lg\"></div>\n }\n }\n </div>\n <div class=\"w-3/5 md:w-3/4 ml-3 flex flex-col justify-between\">\n <div>\n <div class=\"md:text-xl font-medium break-words line-clamp-1 md:line-clamp-2 whitespace-normal\">\n {{ course().name }}\n </div>\n <div class=\"invisible h-0 md:h-auto md:visible break-words line-clamp-1 whitespace-normal\">\n {{ course().description }}\n </div>\n </div>\n @if (course().pricing) {\n <div class=\"md:text-lg font-medium py-1\">\u00A5{{ course().pricing[0].total / 100 }}</div>\n }\n </div>\n </div>\n} @else {\n <div>\n <div>\n @if (course().media; as media) {\n @defer (on viewport()) {\n <rolatech-thumbnail [src]=\"course().media[0].url + '!w400'\" size=\"medium\"></rolatech-thumbnail>\n } @placeholder {\n <div class=\"bg-[--rt-10-percent-layer] w-full h-full object-cover aspect-video rounded-lg\"></div>\n }\n }\n </div>\n <div class=\"mt-2\">\n <div class=\"text-md md:text-xl font-medium break-words line-clamp-2\">{{ course().name }}</div>\n @if (course().pricing) {\n <div class=\"text-md md:text-lg font-medium py-1\">\u00A5{{ course().pricing[0].total / 100 }}</div>\n }\n </div>\n </div>\n}\n" }]
1031
- }] });
1032
-
1033
- class PricingItemComponent {
1034
- constructor() {
1035
- this.actions = input(false);
1036
- this.pricing = model.required();
1037
- this.delete = output();
1038
- this.save = output();
1039
- }
1040
- ngOnInit() {
1041
- this.pricing().total = this.pricing().total / 100;
1042
- }
1043
- onSave(pricing) {
1044
- const finalPricing = {
1045
- ...pricing,
1046
- total: pricing.total * 100,
1047
- };
1048
- this.save.emit(finalPricing);
1049
- }
1050
- onDelete(pricing) {
1051
- this.delete.emit(pricing);
1052
- }
1053
- setTwoNumberDecimal(e) {
1054
- this.pricing().total = e;
1055
- }
1056
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: PricingItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1057
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: PricingItemComponent, isStandalone: true, selector: "rolatech-pricing-item", inputs: { actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, pricing: { classPropertyName: "pricing", publicName: "pricing", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { pricing: "pricingChange", delete: "delete", save: "save" }, ngImport: i0, template: "<div class=\"flex flex-col py-3\">\n <mat-form-field appearance=\"fill\">\n <mat-label> \u6700\u5C11\u4EBA\u6570 </mat-label>\n <input matInput type=\"number\" [(ngModel)]=\"pricing().min\" name=\"min\" required />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u6700\u591A\u4EBA\u6570 </mat-label>\n <input matInput type=\"number\" [(ngModel)]=\"pricing().max\" name=\"max\" required />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u4EF7\u683C </mat-label>\n <!-- <input matInput type=\"number\" step=\"0.01\" [ngModel]=\"pricing().total\"\n (ngModelChange)=\"setTwoNumberDecimal($event)\" name=\"total\" required placeholder=\"20.23\" /> -->\n <input matInput rolatechDecimal type=\"text\" [(ngModel)]=\"pricing().total\" name=\"total\" required />\n </mat-form-field>\n</div>\n@if (actions()) {\n <div class=\"flex flex-row justify-end p-3 gap-3\">\n <button mat-button class=\"max-h-8\" (click)=\"onDelete(pricing())\">\u5220\u9664</button>\n <button mat-flat-button class=\"max-h-8\" (click)=\"onSave(pricing())\">\u4FDD\u5B58</button>\n </div>\n}\n<mat-divider></mat-divider>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i5$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }] }); }
1058
- }
1059
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: PricingItemComponent, decorators: [{
1060
- type: Component,
1061
- args: [{ selector: 'rolatech-pricing-item', standalone: true, imports: [NgClass, MatFormFieldModule, MatInputModule, FormsModule, MatButtonModule, MatDividerModule], template: "<div class=\"flex flex-col py-3\">\n <mat-form-field appearance=\"fill\">\n <mat-label> \u6700\u5C11\u4EBA\u6570 </mat-label>\n <input matInput type=\"number\" [(ngModel)]=\"pricing().min\" name=\"min\" required />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u6700\u591A\u4EBA\u6570 </mat-label>\n <input matInput type=\"number\" [(ngModel)]=\"pricing().max\" name=\"max\" required />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u4EF7\u683C </mat-label>\n <!-- <input matInput type=\"number\" step=\"0.01\" [ngModel]=\"pricing().total\"\n (ngModelChange)=\"setTwoNumberDecimal($event)\" name=\"total\" required placeholder=\"20.23\" /> -->\n <input matInput rolatechDecimal type=\"text\" [(ngModel)]=\"pricing().total\" name=\"total\" required />\n </mat-form-field>\n</div>\n@if (actions()) {\n <div class=\"flex flex-row justify-end p-3 gap-3\">\n <button mat-button class=\"max-h-8\" (click)=\"onDelete(pricing())\">\u5220\u9664</button>\n <button mat-flat-button class=\"max-h-8\" (click)=\"onSave(pricing())\">\u4FDD\u5B58</button>\n </div>\n}\n<mat-divider></mat-divider>\n" }]
1062
- }], ctorParameters: () => [] });
1063
-
1064
- class CoursePricingAddDialogComponent {
1065
- constructor() {
1066
- this.output = output();
1067
- this.pricing = {
1068
- min: 0,
1069
- max: 0,
1070
- total: 0,
1071
- };
1072
- }
1073
- ngDoCheck() {
1074
- this.output.emit(this.pricing);
1075
- }
1076
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CoursePricingAddDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1077
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.1", type: CoursePricingAddDialogComponent, isStandalone: true, selector: "rolatech-course-pricing-add-dialog", outputs: { output: "output" }, ngImport: i0, template: "<rolatech-pricing-item [pricing]=\"pricing\"></rolatech-pricing-item>\n", styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: PricingItemComponent, selector: "rolatech-pricing-item", inputs: ["actions", "pricing"], outputs: ["pricingChange", "delete", "save"] }, { kind: "ngmodule", type: MatButtonModule }] }); }
1078
- }
1079
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CoursePricingAddDialogComponent, decorators: [{
1080
- type: Component,
1081
- args: [{ selector: 'rolatech-course-pricing-add-dialog', standalone: true, imports: [MatIconModule, PricingItemComponent, MatButtonModule], template: "<rolatech-pricing-item [pricing]=\"pricing\"></rolatech-pricing-item>\n", styles: ["mat-form-field{width:100%}\n"] }]
1082
- }] });
1083
-
1084
- class CourseScheduleAddDialogComponent {
1085
- constructor() {
1086
- this.output = output();
1087
- this.schedule = {
1088
- title: '',
1089
- content: '',
1090
- startAt: '',
1091
- endAt: '',
1092
- };
1093
- }
1094
- ngDoCheck() {
1095
- this.output.emit(this.schedule);
1096
- }
1097
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseScheduleAddDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1098
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.1", type: CourseScheduleAddDialogComponent, isStandalone: true, selector: "rolatech-course-schedule-add-dialog", outputs: { output: "output" }, ngImport: i0, template: "<rolatech-schedule-item [value]=\"schedule\"></rolatech-schedule-item>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: ScheduleItemComponent, selector: "rolatech-schedule-item", inputs: ["value", "actions"], outputs: ["delete", "save"] }, { kind: "ngmodule", type: MatButtonModule }] }); }
1099
- }
1100
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseScheduleAddDialogComponent, decorators: [{
1101
- type: Component,
1102
- args: [{ selector: 'rolatech-course-schedule-add-dialog', standalone: true, imports: [MatIconModule, ScheduleItemComponent, MatButtonModule], template: "<rolatech-schedule-item [value]=\"schedule\"></rolatech-schedule-item>\n" }]
1103
- }] });
1104
-
1105
- class CoursePricingDialogComponent {
1106
- constructor(dialogRef, data, courseService, snackBar, dialog) {
1107
- this.dialogRef = dialogRef;
1108
- this.data = data;
1109
- this.courseService = courseService;
1110
- this.snackBar = snackBar;
1111
- this.dialog = dialog;
1112
- this.pricing = [];
1113
- this.courseId = data.courseId;
1114
- this.pricing = data.pricing;
1115
- }
1116
- close() {
1117
- this.dialogRef.close();
1118
- }
1119
- addPricing() {
1120
- this.pricing.push({
1121
- min: 0,
1122
- max: 0,
1123
- total: 0,
1124
- });
1125
- }
1126
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CoursePricingDialogComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: CourseService }, { token: i3$3.MatSnackBar }, { token: i1$2.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
1127
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CoursePricingDialogComponent, isStandalone: true, selector: "rolatech-course-pricing-dialog", ngImport: i0, template: "<div class=\"flex flex-col h-full overflow-hidden\">\n <div class=\"h-16 flex justify-between items-center px-5\">\n @if (data.title) {\n <div class=\"text-md font-medium\">{{ data.title }}</div>\n }\n <div class=\"cursor-pointer\" (click)=\"close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n </div>\n </div>\n <mat-divider></mat-divider>\n <div class=\"flex-1 overflow-hidden mt-3 overflow-y-auto w-2/3 max-h-[55vh]\">\n <form #detailForm=\"ngForm\" class=\"p-3\">\n <ng-template matStepLabel>\u8BE6\u60C5</ng-template>\n @for (item of pricing; track item) {\n <rolatech-pricing-item [pricing]=\"item\"> </rolatech-pricing-item>\n }\n <div class=\"mb-6\">\n <button mat-button (click)=\"addPricing()\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u4EF7\u683C</span>\n </button>\n </div>\n </form>\n </div>\n <mat-divider></mat-divider>\n <div class=\"h-16 flex justify-end items-center px-5\">\n <button mat-button [mat-dialog-close]=\"pricing\" cdkFocusInitial>\u4FDD\u5B58</button>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i5$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatStepperModule }, { kind: "directive", type: i6$2.MatStepLabel, selector: "[matStepLabel]" }, { kind: "component", type: PricingItemComponent, selector: "rolatech-pricing-item", inputs: ["actions", "pricing"], outputs: ["pricingChange", "delete", "save"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }] }); }
1128
- }
1129
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CoursePricingDialogComponent, decorators: [{
1130
- type: Component,
1131
- args: [{ selector: 'rolatech-course-pricing-dialog', standalone: true, imports: [
1132
- MatIconModule,
1133
- MatDividerModule,
1134
- FormsModule,
1135
- MatStepperModule,
1136
- PricingItemComponent,
1137
- MatButtonModule,
1138
- MatDialogClose,
1139
- ], template: "<div class=\"flex flex-col h-full overflow-hidden\">\n <div class=\"h-16 flex justify-between items-center px-5\">\n @if (data.title) {\n <div class=\"text-md font-medium\">{{ data.title }}</div>\n }\n <div class=\"cursor-pointer\" (click)=\"close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n </div>\n </div>\n <mat-divider></mat-divider>\n <div class=\"flex-1 overflow-hidden mt-3 overflow-y-auto w-2/3 max-h-[55vh]\">\n <form #detailForm=\"ngForm\" class=\"p-3\">\n <ng-template matStepLabel>\u8BE6\u60C5</ng-template>\n @for (item of pricing; track item) {\n <rolatech-pricing-item [pricing]=\"item\"> </rolatech-pricing-item>\n }\n <div class=\"mb-6\">\n <button mat-button (click)=\"addPricing()\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u4EF7\u683C</span>\n </button>\n </div>\n </form>\n </div>\n <mat-divider></mat-divider>\n <div class=\"h-16 flex justify-end items-center px-5\">\n <button mat-button [mat-dialog-close]=\"pricing\" cdkFocusInitial>\u4FDD\u5B58</button>\n </div>\n</div>\n" }]
1140
- }], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
1141
- type: Inject,
1142
- args: [MAT_DIALOG_DATA]
1143
- }] }, { type: CourseService }, { type: i3$3.MatSnackBar }, { type: i1$2.MatDialog }] });
1144
-
1145
- class CourseScheduleDialogComponent {
1146
- constructor(dialogRef, data) {
1147
- this.dialogRef = dialogRef;
1148
- this.data = data;
1149
- this.schedule = [];
1150
- this.courseId = data.courseId;
1151
- this.schedule = data.schedule;
1152
- }
1153
- close() {
1154
- this.dialogRef.close();
1155
- }
1156
- addSchedule() {
1157
- if (!this.schedule) {
1158
- this.schedule = [];
1159
- }
1160
- this.schedule.push({
1161
- title: '',
1162
- content: '',
1163
- startAt: '',
1164
- endAt: '',
1165
- });
1166
- }
1167
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseScheduleDialogComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
1168
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseScheduleDialogComponent, isStandalone: true, selector: "rolatech-course-schedule-dialog", ngImport: i0, template: "<div class=\"flex flex-col h-full overflow-hidden\">\n <div class=\"h-16 flex justify-between items-center px-5\">\n @if (data.title) {\n <div class=\"text-md font-medium\">{{ data.title }}</div>\n }\n <div class=\"cursor-pointer\" (click)=\"close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n </div>\n </div>\n <mat-divider></mat-divider>\n <div class=\"flex-1 overflow-hidden mt-3 overflow-y-auto\">\n <form #detailForm=\"ngForm\" class=\"p-3\">\n <ng-template matStepLabel>\u8BE6\u60C5</ng-template>\n @for (item of schedule; track item) {\n <rolatech-schedule-item [value]=\"item\"></rolatech-schedule-item>\n }\n <div class=\"mb-6\">\n <button mat-button (click)=\"addSchedule()\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u8BFE\u8868</span>\n </button>\n </div>\n </form>\n </div>\n <mat-divider></mat-divider>\n <div class=\"h-16 flex justify-end items-center px-5\">\n <button mat-button [mat-dialog-close]=\"schedule\" cdkFocusInitial>\u4FDD\u5B58</button>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i5$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatStepperModule }, { kind: "directive", type: i6$2.MatStepLabel, selector: "[matStepLabel]" }, { kind: "component", type: ScheduleItemComponent, selector: "rolatech-schedule-item", inputs: ["value", "actions"], outputs: ["delete", "save"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }] }); }
1169
- }
1170
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseScheduleDialogComponent, decorators: [{
1171
- type: Component,
1172
- args: [{ selector: 'rolatech-course-schedule-dialog', standalone: true, imports: [
1173
- MatIconModule,
1174
- MatDividerModule,
1175
- FormsModule,
1176
- MatStepperModule,
1177
- ScheduleItemComponent,
1178
- MatButtonModule,
1179
- MatDialogClose,
1180
- ], template: "<div class=\"flex flex-col h-full overflow-hidden\">\n <div class=\"h-16 flex justify-between items-center px-5\">\n @if (data.title) {\n <div class=\"text-md font-medium\">{{ data.title }}</div>\n }\n <div class=\"cursor-pointer\" (click)=\"close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n </div>\n </div>\n <mat-divider></mat-divider>\n <div class=\"flex-1 overflow-hidden mt-3 overflow-y-auto\">\n <form #detailForm=\"ngForm\" class=\"p-3\">\n <ng-template matStepLabel>\u8BE6\u60C5</ng-template>\n @for (item of schedule; track item) {\n <rolatech-schedule-item [value]=\"item\"></rolatech-schedule-item>\n }\n <div class=\"mb-6\">\n <button mat-button (click)=\"addSchedule()\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u8BFE\u8868</span>\n </button>\n </div>\n </form>\n </div>\n <mat-divider></mat-divider>\n <div class=\"h-16 flex justify-end items-center px-5\">\n <button mat-button [mat-dialog-close]=\"schedule\" cdkFocusInitial>\u4FDD\u5B58</button>\n </div>\n</div>\n" }]
1181
- }], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
1182
- type: Inject,
1183
- args: [MAT_DIALOG_DATA]
1184
- }] }] });
1185
-
1186
- class DetailItemComponent {
1187
- constructor() {
1188
- this.isUploading = input();
1189
- this.detail = input.required();
1190
- this.actions = input(false);
1191
- this.selectMedia = input();
1192
- this.upload = output();
1193
- this.delete = output();
1194
- this.save = output();
1195
- this.deleteMedia = output();
1196
- }
1197
- ngOnInit() {
1198
- this.selectedImg = this.detail().media ? this.detail().media[0] : null;
1199
- }
1200
- onUpload(id, data) {
1201
- this.upload.emit({ id, data });
1202
- }
1203
- onMediaItemClick(image) {
1204
- this.selectedImg = image;
1205
- }
1206
- select(item) {
1207
- this.selectedImg = item;
1208
- }
1209
- deleteImage() { }
1210
- onSave(detail) {
1211
- this.save.emit(detail);
1212
- }
1213
- onDelete(detail) {
1214
- this.delete.emit(detail);
1215
- }
1216
- onDeleteMedia(id, media) {
1217
- this.deleteMedia.emit({ id, media });
1218
- this.selectedImg = this.detail().media ? first(this.detail().media) : null;
1219
- }
1220
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: DetailItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1221
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: DetailItemComponent, isStandalone: true, selector: "rolatech-detail-item", inputs: { isUploading: { classPropertyName: "isUploading", publicName: "isUploading", isSignal: true, isRequired: false, transformFunction: null }, detail: { classPropertyName: "detail", publicName: "detail", isSignal: true, isRequired: true, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, selectMedia: { classPropertyName: "selectMedia", publicName: "selectMedia", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { upload: "upload", delete: "delete", save: "save", deleteMedia: "deleteMedia" }, ngImport: i0, template: "<div class=\"mb-8\">\n <div class=\"flex flex-col lg:flex-row\">\n <div class=\"flex flex-col grow\">\n <mat-form-field appearance=\"fill\">\n <mat-label>\u6807\u9898</mat-label>\n <input matInput placeholder=\"\u6807\u9898\" [(ngModel)]=\"detail().title\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\" [hideRequiredMarker]=\"true\">\n <mat-label>\u63CF\u8FF0</mat-label>\n <input matInput placeholder=\"\u63CF\u8FF0\" [(ngModel)]=\"detail().description\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\" [hideRequiredMarker]=\"true\">\n <mat-label>\u5185\u5BB9</mat-label>\n <textarea\n matInput\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"3\"\n placeholder=\"\u5185\u5BB9\"\n [(ngModel)]=\"detail().content\"\n ></textarea>\n </mat-form-field>\n </div>\n <!-- image -->\n <div class=\"lg:basis-1/2 px-3\">\n <div class=\"flex flex-row justify-center pb-4 p-1\">\n @if (selectedImg) {\n <img class=\"object-contain w-80 h-80\" [src]=\"selectedImg.url\" [alt]=\"selectedImg.alt\" />\n }\n @if (selectedImg) {\n <button mat-icon-button (click)=\"onDeleteMedia(detail().id, selectedImg)\">\n <mat-icon>delete</mat-icon>\n </button>\n }\n </div>\n <!-- media -->\n <div>\n <div class=\"flex flex-row flex-wrap cursor-pointer relative box-border\" fxLayout=\"row\">\n <div class=\"progress-bar\">\n @if (detail().isUploading) {\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n }\n </div>\n @for (media of detail().media; track media) {\n <div class=\"media-list-item\">\n <img class=\"tile-media\" (click)=\"onMediaItemClick(media)\" [src]=\"media.url\" [alt]=\"media.alt\" />\n </div>\n }\n <input style=\"display: none\" type=\"file\" accept=\"image/*\" (change)=\"onUpload(detail().id, $event)\" #fileInput />\n <div class=\"add-button\">\n <div (click)=\"fileInput.click()\" class=\"tile-media flex justify-center items-center\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"48px\" viewBox=\"0 -960 960 960\" width=\"48px\" fill=\"#5f6368\">\n <path d=\"M444-444H240v-72h204v-204h72v204h204v72H516v204h-72v-204Z\" />\n </svg>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n@if (actions()) {\n <div class=\"flex flex-row justify-end p-3 gap-3\">\n <button mat-button class=\"max-h-8\" (click)=\"onDelete(detail())\">\u5220\u9664</button>\n <button mat-flat-button class=\"max-h-8\" (click)=\"onSave(detail())\">\u4FDD\u5B58</button>\n </div>\n}\n<mat-divider></mat-divider>\n", styles: [".media-list{flex-wrap:wrap;box-sizing:border-box}.progress-bar{display:block;min-height:6px;width:100%}.media-list-item{cursor:pointer;position:relative;box-sizing:border-box;padding:2px}.tile-media{height:80px;width:80px;object-fit:contain;cursor:pointer;border:1px solid grey;padding:6px;position:relative;box-sizing:border-box}.add-button{cursor:pointer;position:relative;box-sizing:border-box;padding:2px}\n"], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i3.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TextFieldModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i3$2.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i5$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }] }); }
1222
- }
1223
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: DetailItemComponent, decorators: [{
1224
- type: Component,
1225
- args: [{ selector: 'rolatech-detail-item', standalone: true, imports: [
1226
- NgClass,
1227
- MatFormFieldModule,
1228
- MatInputModule,
1229
- FormsModule,
1230
- TextFieldModule,
1231
- MatButtonModule,
1232
- MatIconModule,
1233
- MatProgressBarModule,
1234
- MatDividerModule,
1235
- ], template: "<div class=\"mb-8\">\n <div class=\"flex flex-col lg:flex-row\">\n <div class=\"flex flex-col grow\">\n <mat-form-field appearance=\"fill\">\n <mat-label>\u6807\u9898</mat-label>\n <input matInput placeholder=\"\u6807\u9898\" [(ngModel)]=\"detail().title\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\" [hideRequiredMarker]=\"true\">\n <mat-label>\u63CF\u8FF0</mat-label>\n <input matInput placeholder=\"\u63CF\u8FF0\" [(ngModel)]=\"detail().description\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\" [hideRequiredMarker]=\"true\">\n <mat-label>\u5185\u5BB9</mat-label>\n <textarea\n matInput\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"3\"\n placeholder=\"\u5185\u5BB9\"\n [(ngModel)]=\"detail().content\"\n ></textarea>\n </mat-form-field>\n </div>\n <!-- image -->\n <div class=\"lg:basis-1/2 px-3\">\n <div class=\"flex flex-row justify-center pb-4 p-1\">\n @if (selectedImg) {\n <img class=\"object-contain w-80 h-80\" [src]=\"selectedImg.url\" [alt]=\"selectedImg.alt\" />\n }\n @if (selectedImg) {\n <button mat-icon-button (click)=\"onDeleteMedia(detail().id, selectedImg)\">\n <mat-icon>delete</mat-icon>\n </button>\n }\n </div>\n <!-- media -->\n <div>\n <div class=\"flex flex-row flex-wrap cursor-pointer relative box-border\" fxLayout=\"row\">\n <div class=\"progress-bar\">\n @if (detail().isUploading) {\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n }\n </div>\n @for (media of detail().media; track media) {\n <div class=\"media-list-item\">\n <img class=\"tile-media\" (click)=\"onMediaItemClick(media)\" [src]=\"media.url\" [alt]=\"media.alt\" />\n </div>\n }\n <input style=\"display: none\" type=\"file\" accept=\"image/*\" (change)=\"onUpload(detail().id, $event)\" #fileInput />\n <div class=\"add-button\">\n <div (click)=\"fileInput.click()\" class=\"tile-media flex justify-center items-center\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"48px\" viewBox=\"0 -960 960 960\" width=\"48px\" fill=\"#5f6368\">\n <path d=\"M444-444H240v-72h204v-204h72v204h204v72H516v204h-72v-204Z\" />\n </svg>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n@if (actions()) {\n <div class=\"flex flex-row justify-end p-3 gap-3\">\n <button mat-button class=\"max-h-8\" (click)=\"onDelete(detail())\">\u5220\u9664</button>\n <button mat-flat-button class=\"max-h-8\" (click)=\"onSave(detail())\">\u4FDD\u5B58</button>\n </div>\n}\n<mat-divider></mat-divider>\n", styles: [".media-list{flex-wrap:wrap;box-sizing:border-box}.progress-bar{display:block;min-height:6px;width:100%}.media-list-item{cursor:pointer;position:relative;box-sizing:border-box;padding:2px}.tile-media{height:80px;width:80px;object-fit:contain;cursor:pointer;border:1px solid grey;padding:6px;position:relative;box-sizing:border-box}.add-button{cursor:pointer;position:relative;box-sizing:border-box;padding:2px}\n"] }]
1236
- }], ctorParameters: () => [] });
1237
-
1238
- class CourseDetailsDialogComponent {
1239
- constructor(dialogRef, data, courseService, snackBar, dialog) {
1240
- this.dialogRef = dialogRef;
1241
- this.data = data;
1242
- this.courseService = courseService;
1243
- this.snackBar = snackBar;
1244
- this.dialog = dialog;
1245
- this.details = [];
1246
- this.courseId = data.courseId;
1247
- }
1248
- close() {
1249
- this.dialogRef.close();
1250
- }
1251
- addDetail() {
1252
- this.courseService
1253
- .addDetail(this.courseId, {
1254
- title: '',
1255
- description: '',
1256
- content: '',
1257
- media: [],
1258
- })
1259
- .subscribe({
1260
- next: (res) => {
1261
- const detail = res.data;
1262
- this.details.push({
1263
- id: detail.id,
1264
- title: '',
1265
- description: '',
1266
- content: '',
1267
- media: [],
1268
- });
1269
- },
1270
- error: (e) => {
1271
- this.snackBar.open(e.message);
1272
- },
1273
- });
1274
- }
1275
- onDetailMediaUpload(event) { }
1276
- onDetailMediaDelete(event) { }
1277
- onDetailSave(event) { }
1278
- onDetailDelete(detail) {
1279
- this.courseService.deleteDetail(this.courseId, detail.id).subscribe({
1280
- next: (res) => {
1281
- this.snackBar.open(res.data);
1282
- remove(this.details, {
1283
- id: detail.id,
1284
- });
1285
- },
1286
- error: (e) => {
1287
- this.snackBar.open(e.message);
1288
- },
1289
- });
1290
- }
1291
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseDetailsDialogComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: CourseService }, { token: i3$3.MatSnackBar }, { token: i1$2.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
1292
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseDetailsDialogComponent, isStandalone: true, selector: "rolatech-course-details-dialog", ngImport: i0, template: "<div class=\"flex flex-col h-full overflow-hidden\">\n <div class=\"h-16 flex justify-between items-center px-5\">\n @if (data.title) {\n <div class=\"text-md font-medium\">{{ data.title }}</div>\n }\n <div class=\"cursor-pointer\" (click)=\"close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n </div>\n </div>\n <mat-divider></mat-divider>\n <div class=\"flex-1 overflow-hidden mt-3 overflow-y-auto\">\n <form #detailForm=\"ngForm\" class=\"p-3\">\n <ng-template matStepLabel>\u8BE6\u60C5</ng-template>\n @for (item of details; track item) {\n <rolatech-detail-item\n [detail]=\"item\"\n (upload)=\"onDetailMediaUpload($event)\"\n (deleteMedia)=\"onDetailMediaDelete($event)\"\n (save)=\"onDetailSave($event)\"\n (delete)=\"onDetailDelete($event)\"\n ></rolatech-detail-item>\n }\n <div class=\"mb-6\">\n <button mat-button (click)=\"addDetail()\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u8BE6\u60C5</span>\n </button>\n </div>\n </form>\n </div>\n <mat-divider></mat-divider>\n <div class=\"h-16 flex justify-end items-center px-5\">\n <button mat-button [mat-dialog-close]=\"true\" cdkFocusInitial>\u4FDD\u5B58</button>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i5$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatStepperModule }, { kind: "directive", type: i6$2.MatStepLabel, selector: "[matStepLabel]" }, { kind: "component", type: DetailItemComponent, selector: "rolatech-detail-item", inputs: ["isUploading", "detail", "actions", "selectMedia"], outputs: ["upload", "delete", "save", "deleteMedia"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }] }); }
1293
- }
1294
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseDetailsDialogComponent, decorators: [{
1295
- type: Component,
1296
- args: [{ selector: 'rolatech-course-details-dialog', standalone: true, imports: [
1297
- MatIconModule,
1298
- MatDividerModule,
1299
- FormsModule,
1300
- MatStepperModule,
1301
- DetailItemComponent,
1302
- MatButtonModule,
1303
- MatDialogClose,
1304
- ], template: "<div class=\"flex flex-col h-full overflow-hidden\">\n <div class=\"h-16 flex justify-between items-center px-5\">\n @if (data.title) {\n <div class=\"text-md font-medium\">{{ data.title }}</div>\n }\n <div class=\"cursor-pointer\" (click)=\"close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n </div>\n </div>\n <mat-divider></mat-divider>\n <div class=\"flex-1 overflow-hidden mt-3 overflow-y-auto\">\n <form #detailForm=\"ngForm\" class=\"p-3\">\n <ng-template matStepLabel>\u8BE6\u60C5</ng-template>\n @for (item of details; track item) {\n <rolatech-detail-item\n [detail]=\"item\"\n (upload)=\"onDetailMediaUpload($event)\"\n (deleteMedia)=\"onDetailMediaDelete($event)\"\n (save)=\"onDetailSave($event)\"\n (delete)=\"onDetailDelete($event)\"\n ></rolatech-detail-item>\n }\n <div class=\"mb-6\">\n <button mat-button (click)=\"addDetail()\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u8BE6\u60C5</span>\n </button>\n </div>\n </form>\n </div>\n <mat-divider></mat-divider>\n <div class=\"h-16 flex justify-end items-center px-5\">\n <button mat-button [mat-dialog-close]=\"true\" cdkFocusInitial>\u4FDD\u5B58</button>\n </div>\n</div>\n" }]
1305
- }], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
1306
- type: Inject,
1307
- args: [MAT_DIALOG_DATA]
1308
- }] }, { type: CourseService }, { type: i3$3.MatSnackBar }, { type: i1$2.MatDialog }] });
1309
-
1310
- class CourseEditDialogComponent {
1311
- constructor(dialogRef, data, categoryService, courseService, snackBar, dialog) {
1312
- this.dialogRef = dialogRef;
1313
- this.data = data;
1314
- this.categoryService = categoryService;
1315
- this.courseService = courseService;
1316
- this.snackBar = snackBar;
1317
- this.dialog = dialog;
1318
- this.isUploading = false;
1319
- this.courseType = [
1320
- {
1321
- key: 'ONLINE',
1322
- value: '线上',
1323
- },
1324
- {
1325
- key: 'OFFLINE',
1326
- value: '线下',
1327
- },
1328
- {
1329
- key: 'MIXED',
1330
- value: '混合',
1331
- },
1332
- ];
1333
- this.date = ScheduleDate;
1334
- this.lastStepper = false;
1335
- this.firstStepper = true;
1336
- this.stepper = viewChild.required(MatStepper);
1337
- this.course = data.course;
1338
- this.classrooms = data.classrooms;
1339
- }
1340
- ngOnInit() {
1341
- this.categoryService.find({}).subscribe({
1342
- next: (res) => {
1343
- this.categories = res.data;
1344
- },
1345
- });
1346
- }
1347
- close() {
1348
- this.dialogRef.close();
1349
- }
1350
- compareFn(o1, o2) {
1351
- return o1.id === o2.id;
1352
- }
1353
- addDetail() {
1354
- if (!this.course.details) {
1355
- this.course.details = [];
1356
- }
1357
- this.courseService
1358
- .addDetail(this.course.id, {
1359
- title: '',
1360
- description: '',
1361
- content: '',
1362
- media: [],
1363
- })
1364
- .subscribe({
1365
- next: (res) => {
1366
- const detail = res.data;
1367
- this.course.details.push({
1368
- id: detail.id,
1369
- title: '',
1370
- description: '',
1371
- content: '',
1372
- media: [],
1373
- });
1374
- },
1375
- error: (e) => {
1376
- this.snackBar.open(e.message);
1377
- },
1378
- });
1379
- }
1380
- addSchedule() {
1381
- if (!this.course.schedule) {
1382
- this.course.schedule = [];
1383
- }
1384
- this.course.schedule.push({
1385
- title: '',
1386
- content: '',
1387
- });
1388
- }
1389
- addPricing() {
1390
- if (!this.course.pricing) {
1391
- this.course.pricing = [];
1392
- }
1393
- this.course.pricing.push({
1394
- min: 0,
1395
- max: 0,
1396
- total: 0,
1397
- });
1398
- }
1399
- onSelectionChange(event) {
1400
- this.selectedCategoyIds = event.value;
1401
- }
1402
- onStepperChange(event) {
1403
- this.lastStepper = event.selectedIndex === 3;
1404
- this.firstStepper = event.selectedIndex === 0;
1405
- }
1406
- previous() {
1407
- this.stepper().previous();
1408
- }
1409
- next() {
1410
- this.stepper().next();
1411
- }
1412
- onDetailMediaUpload(event) { }
1413
- onDetailMediaDelete(event) { }
1414
- onDetailSave(event) { }
1415
- onDetailDelete(detail) {
1416
- this.courseService.deleteDetail(this.course.id, detail.id).subscribe({
1417
- next: (res) => {
1418
- this.snackBar.open(res.message);
1419
- remove(this.details, {
1420
- id: detail.id,
1421
- });
1422
- },
1423
- error: (e) => {
1424
- this.snackBar.open(e.message);
1425
- },
1426
- });
1427
- }
1428
- onImageClick(i) {
1429
- const dialogRef = this.dialog.open(ImagePreviewDialogComponent, {
1430
- maxWidth: '80vw',
1431
- maxHeight: '80vh',
1432
- height: '80%',
1433
- width: '80%',
1434
- panelClass: 'full-screen-modal',
1435
- data: {
1436
- media: this.course.media,
1437
- selected: i,
1438
- },
1439
- });
1440
- }
1441
- onUpload(event) {
1442
- const file = event.target.files[0];
1443
- if (file) {
1444
- const reader = new FileReader();
1445
- reader.readAsDataURL(file);
1446
- reader.onload = () => {
1447
- if (this.course.media) {
1448
- this.course.media.push({
1449
- url: reader.result,
1450
- alt: 'upload image',
1451
- });
1452
- }
1453
- else {
1454
- this.course.media = [];
1455
- this.course.media.push({
1456
- url: reader.result,
1457
- alt: 'upload image',
1458
- });
1459
- }
1460
- this.isUploading = true;
1461
- const formData = new FormData();
1462
- formData.append('file', file);
1463
- this.courseService.upload(formData).subscribe({
1464
- next: (res) => {
1465
- this.isUploading = false;
1466
- const index = findLastIndex(this.course.media);
1467
- // Replace item at index using native splice
1468
- this.course.media.splice(index, 1, res.data);
1469
- },
1470
- error: (e) => {
1471
- this.isUploading = false;
1472
- this.snackBar.open('上传失败: ' + e.message);
1473
- },
1474
- });
1475
- };
1476
- reader.onerror = (error) => {
1477
- this.isUploading = false;
1478
- };
1479
- }
1480
- }
1481
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseEditDialogComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: CategoryService }, { token: CourseService }, { token: i3$3.MatSnackBar }, { token: i1$2.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
1482
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseEditDialogComponent, isStandalone: true, selector: "rolatech-course-edit-dialog", viewQueries: [{ propertyName: "stepper", first: true, predicate: MatStepper, descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"flex flex-col h-full overflow-hidden\">\n <div class=\"h-16 flex justify-between items-center px-5\">\n @if (data.title) {\n <div class=\"text-md font-medium\">{{ data.title }}</div>\n }\n <div class=\"cursor-pointer\" (click)=\"close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n </div>\n </div>\n <mat-divider></mat-divider>\n <div class=\"flex-1 overflow-hidden mt-3 overflow-y-auto\">\n <mat-stepper #stepper (selectionChange)=\"onStepperChange($event)\">\n <mat-step [editable]=\"true\">\n <form #infoForm=\"ngForm\" class=\"py-3\">\n <ng-template matStepLabel>\u57FA\u672C\u4FE1\u606F</ng-template>\n <div class=\"flex flex-col\">\n <mat-form-field appearance=\"fill\">\n <mat-label> \u8BFE\u7A0B\u540D\u79F0 </mat-label>\n <input matInput type=\"text\" [(ngModel)]=\"course.name\" name=\"name\" required />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u8BFE\u7A0B\u63CF\u8FF0 </mat-label>\n <textarea\n matInput\n type=\"text\"\n [(ngModel)]=\"course.description\"\n name=\"description\"\n required\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"3\"\n ></textarea>\n </mat-form-field>\n <mat-form-field appearance=\"fill\" ngModelGroup=\"categories\">\n <mat-label>\u5206\u7C7B</mat-label>\n <mat-select\n multiple\n name=\"id\"\n [compareWith]=\"compareFn\"\n [(ngModel)]=\"course.categories\"\n #select=\"matSelect\"\n (selectionChange)=\"onSelectionChange($event)\"\n >\n @for (item of categories; track item) {\n <mat-option [value]=\"item\">\n {{ item.name }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label>\u7C7B\u578B</mat-label>\n <mat-select name=\"type\" [(ngModel)]=\"course.type\">\n @for (item of courseType; track item) {\n <mat-option [value]=\"item.key\">\n {{ item.value }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n @if (course.type.toString() !== 'ONLINE') {\n <mat-form-field appearance=\"fill\" ngModelGroup=\"classroom\">\n <mat-label>\u6559\u5BA4</mat-label>\n <mat-select [(ngModel)]=\"course.classroom\" name=\"id\">\n @for (classroom of classrooms; track classroom) {\n <mat-option [value]=\"classroom.id\">\n <div class=\"flex gap-3\">\n <span>{{ classroom.name }}</span>\n <span> {{ classroom.address }}</span>\n </div>\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n </div>\n <div>\n <div class=\"py-3\">\n <h2>\u56FE\u7247\u4FE1\u606F</h2>\n </div>\n <rolatech-media-list (upload)=\"onUpload($event)\" [isUploading]=\"isUploading\">\n @for (item of course.media; track item; let i = $index) {\n <rolatech-media-list-item [media]=\"item\" (mediaItemClick)=\"onImageClick(i)\"></rolatech-media-list-item>\n }\n </rolatech-media-list>\n </div>\n </form>\n </mat-step>\n <mat-step [editable]=\"true\">\n <form #detailForm=\"ngForm\" class=\"py-3\">\n <ng-template matStepLabel>\u8BE6\u60C5</ng-template>\n @for (item of course.details; track item) {\n <rolatech-detail-item\n [detail]=\"item\"\n (upload)=\"onDetailMediaUpload($event)\"\n (deleteMedia)=\"onDetailMediaDelete($event)\"\n (save)=\"onDetailSave($event)\"\n (delete)=\"onDetailDelete($event)\"\n ></rolatech-detail-item>\n }\n <div class=\"mb-6\">\n <button mat-button (click)=\"addDetail()\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u8BE6\u60C5</span>\n </button>\n </div>\n </form>\n </mat-step>\n <mat-step [editable]=\"true\">\n <form #pricingForm=\"ngForm\" class=\"py-3\">\n <ng-template matStepLabel>\u4EF7\u683C</ng-template>\n <div>\n @for (item of course.pricing; track item) {\n <rolatech-pricing-item [pricing]=\"item\"> </rolatech-pricing-item>\n }\n <div class=\"mb-6\">\n <button mat-button (click)=\"addPricing()\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u4EF7\u683C</span>\n </button>\n </div>\n </div>\n </form>\n </mat-step>\n <mat-step>\n <form #scheduleForm=\"ngForm\">\n <ng-template matStepLabel>\u8BFE\u8868</ng-template>\n <div class=\"flex flex-col\">\n @for (item of course.schedule; track item) {\n <rolatech-schedule-item [value]=\"item\"></rolatech-schedule-item>\n }\n <div class=\"mb-6\">\n <button mat-button (click)=\"addSchedule()\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u8BFE\u8868</span>\n </button>\n </div>\n </div>\n </form>\n </mat-step>\n </mat-stepper>\n </div>\n <mat-divider></mat-divider>\n <div class=\"h-16 flex justify-end items-center px-5\">\n @if (!firstStepper) {\n <button mat-button mat-button (click)=\"previous()\">\u4E0A\u4E00\u6B65</button>\n }\n @if (!lastStepper) {\n <button mat-button (click)=\"next()\">\u4E0B\u4E00\u6B65</button>\n }\n @if (lastStepper) {\n <button mat-button [mat-dialog-close]=\"course\" cdkFocusInitial>\u4FDD\u5B58</button>\n }\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i5$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "ngmodule", type: MatStepperModule }, { kind: "component", type: i6$2.MatStep, selector: "mat-step", inputs: ["color"], exportAs: ["matStep"] }, { kind: "directive", type: i6$2.MatStepLabel, selector: "[matStepLabel]" }, { kind: "component", type: i6$2.MatStepper, selector: "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", inputs: ["disableRipple", "color", "labelPosition", "headerPosition", "animationDuration"], outputs: ["animationDone"], exportAs: ["matStepper", "matVerticalStepper", "matHorizontalStepper"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4.NgModelGroup, selector: "[ngModelGroup]", inputs: ["ngModelGroup"], exportAs: ["ngModelGroup"] }, { kind: "directive", type: i4.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i3.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "ngmodule", type: TextFieldModule }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i6.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i6$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatOptionModule }, { kind: "component", type: MediaListComponent, selector: "rolatech-media-list", inputs: ["isUploading", "media", "showAdd"], outputs: ["mediaItemClick", "upload"] }, { kind: "component", type: MediaListItemComponent, selector: "rolatech-media-list-item", inputs: ["media", "uploadProgress"], outputs: ["mediaItemClick", "deleteMedia"] }, { kind: "component", type: DetailItemComponent, selector: "rolatech-detail-item", inputs: ["isUploading", "detail", "actions", "selectMedia"], outputs: ["upload", "delete", "save", "deleteMedia"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: PricingItemComponent, selector: "rolatech-pricing-item", inputs: ["actions", "pricing"], outputs: ["pricingChange", "delete", "save"] }, { kind: "component", type: ScheduleItemComponent, selector: "rolatech-schedule-item", inputs: ["value", "actions"], outputs: ["delete", "save"] }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }] }); }
1483
- }
1484
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseEditDialogComponent, decorators: [{
1485
- type: Component,
1486
- args: [{ selector: 'rolatech-course-edit-dialog', standalone: true, imports: [
1487
- MatIconModule,
1488
- MatDividerModule,
1489
- MatStepperModule,
1490
- FormsModule,
1491
- MatFormFieldModule,
1492
- MatInputModule,
1493
- TextFieldModule,
1494
- MatSelectModule,
1495
- MatOptionModule,
1496
- MediaListComponent,
1497
- MediaListItemComponent,
1498
- DetailItemComponent,
1499
- MatButtonModule,
1500
- PricingItemComponent,
1501
- ScheduleItemComponent,
1502
- MatDialogClose,
1503
- ], template: "<div class=\"flex flex-col h-full overflow-hidden\">\n <div class=\"h-16 flex justify-between items-center px-5\">\n @if (data.title) {\n <div class=\"text-md font-medium\">{{ data.title }}</div>\n }\n <div class=\"cursor-pointer\" (click)=\"close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n </div>\n </div>\n <mat-divider></mat-divider>\n <div class=\"flex-1 overflow-hidden mt-3 overflow-y-auto\">\n <mat-stepper #stepper (selectionChange)=\"onStepperChange($event)\">\n <mat-step [editable]=\"true\">\n <form #infoForm=\"ngForm\" class=\"py-3\">\n <ng-template matStepLabel>\u57FA\u672C\u4FE1\u606F</ng-template>\n <div class=\"flex flex-col\">\n <mat-form-field appearance=\"fill\">\n <mat-label> \u8BFE\u7A0B\u540D\u79F0 </mat-label>\n <input matInput type=\"text\" [(ngModel)]=\"course.name\" name=\"name\" required />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u8BFE\u7A0B\u63CF\u8FF0 </mat-label>\n <textarea\n matInput\n type=\"text\"\n [(ngModel)]=\"course.description\"\n name=\"description\"\n required\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"3\"\n ></textarea>\n </mat-form-field>\n <mat-form-field appearance=\"fill\" ngModelGroup=\"categories\">\n <mat-label>\u5206\u7C7B</mat-label>\n <mat-select\n multiple\n name=\"id\"\n [compareWith]=\"compareFn\"\n [(ngModel)]=\"course.categories\"\n #select=\"matSelect\"\n (selectionChange)=\"onSelectionChange($event)\"\n >\n @for (item of categories; track item) {\n <mat-option [value]=\"item\">\n {{ item.name }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label>\u7C7B\u578B</mat-label>\n <mat-select name=\"type\" [(ngModel)]=\"course.type\">\n @for (item of courseType; track item) {\n <mat-option [value]=\"item.key\">\n {{ item.value }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n @if (course.type.toString() !== 'ONLINE') {\n <mat-form-field appearance=\"fill\" ngModelGroup=\"classroom\">\n <mat-label>\u6559\u5BA4</mat-label>\n <mat-select [(ngModel)]=\"course.classroom\" name=\"id\">\n @for (classroom of classrooms; track classroom) {\n <mat-option [value]=\"classroom.id\">\n <div class=\"flex gap-3\">\n <span>{{ classroom.name }}</span>\n <span> {{ classroom.address }}</span>\n </div>\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n </div>\n <div>\n <div class=\"py-3\">\n <h2>\u56FE\u7247\u4FE1\u606F</h2>\n </div>\n <rolatech-media-list (upload)=\"onUpload($event)\" [isUploading]=\"isUploading\">\n @for (item of course.media; track item; let i = $index) {\n <rolatech-media-list-item [media]=\"item\" (mediaItemClick)=\"onImageClick(i)\"></rolatech-media-list-item>\n }\n </rolatech-media-list>\n </div>\n </form>\n </mat-step>\n <mat-step [editable]=\"true\">\n <form #detailForm=\"ngForm\" class=\"py-3\">\n <ng-template matStepLabel>\u8BE6\u60C5</ng-template>\n @for (item of course.details; track item) {\n <rolatech-detail-item\n [detail]=\"item\"\n (upload)=\"onDetailMediaUpload($event)\"\n (deleteMedia)=\"onDetailMediaDelete($event)\"\n (save)=\"onDetailSave($event)\"\n (delete)=\"onDetailDelete($event)\"\n ></rolatech-detail-item>\n }\n <div class=\"mb-6\">\n <button mat-button (click)=\"addDetail()\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u8BE6\u60C5</span>\n </button>\n </div>\n </form>\n </mat-step>\n <mat-step [editable]=\"true\">\n <form #pricingForm=\"ngForm\" class=\"py-3\">\n <ng-template matStepLabel>\u4EF7\u683C</ng-template>\n <div>\n @for (item of course.pricing; track item) {\n <rolatech-pricing-item [pricing]=\"item\"> </rolatech-pricing-item>\n }\n <div class=\"mb-6\">\n <button mat-button (click)=\"addPricing()\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u4EF7\u683C</span>\n </button>\n </div>\n </div>\n </form>\n </mat-step>\n <mat-step>\n <form #scheduleForm=\"ngForm\">\n <ng-template matStepLabel>\u8BFE\u8868</ng-template>\n <div class=\"flex flex-col\">\n @for (item of course.schedule; track item) {\n <rolatech-schedule-item [value]=\"item\"></rolatech-schedule-item>\n }\n <div class=\"mb-6\">\n <button mat-button (click)=\"addSchedule()\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u8BFE\u8868</span>\n </button>\n </div>\n </div>\n </form>\n </mat-step>\n </mat-stepper>\n </div>\n <mat-divider></mat-divider>\n <div class=\"h-16 flex justify-end items-center px-5\">\n @if (!firstStepper) {\n <button mat-button mat-button (click)=\"previous()\">\u4E0A\u4E00\u6B65</button>\n }\n @if (!lastStepper) {\n <button mat-button (click)=\"next()\">\u4E0B\u4E00\u6B65</button>\n }\n @if (lastStepper) {\n <button mat-button [mat-dialog-close]=\"course\" cdkFocusInitial>\u4FDD\u5B58</button>\n }\n </div>\n</div>\n" }]
1504
- }], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
1505
- type: Inject,
1506
- args: [MAT_DIALOG_DATA]
1507
- }] }, { type: CategoryService }, { type: CourseService }, { type: i3$3.MatSnackBar }, { type: i1$2.MatDialog }] });
1508
-
1509
- class CourseDetailsComponent {
1510
- constructor() {
1511
- this.details = input.required();
1512
- this.instructor = input();
1513
- this.username = input();
1514
- this.el = inject(ElementRef);
1515
- this.viewportScroller = inject(ViewportScroller);
1516
- this.platformId = inject(PLATFORM_ID);
1517
- this.show = false;
1518
- this.mediaIndex = 0;
1519
- this.finalSchedule = [];
1520
- }
1521
- ngOnInit() { }
1522
- onClickScroller(id) {
1523
- this.viewportScroller.scrollToAnchor(id);
1524
- }
1525
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseDetailsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1526
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseDetailsComponent, isStandalone: true, selector: "rolatech-course-details", inputs: { details: { classPropertyName: "details", publicName: "details", isSignal: true, isRequired: true, transformFunction: null }, instructor: { classPropertyName: "instructor", publicName: "instructor", isSignal: true, isRequired: false, transformFunction: null }, username: { classPropertyName: "username", publicName: "username", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"py-3\" id=\"details\">\n <div class=\"text-xl font-medium py-2\">\u8BE6\u60C5</div>\n @if (details()) {\n @for (detail of details(); track $index) {\n <div>\n @if (detail.title) {\n <div class=\"py-3 flex items-center gap-3\">\n <span class=\"h-4 w-1 bg-orange-500 inline-block\"></span>\n <span class=\"text-lg font-medium py-1\"> {{ detail.title }}</span>\n </div>\n }\n @if (detail.content) {\n <div>\n {{ detail.content }}\n </div>\n }\n @if (detail.media) {\n <div class=\"w-80%\">\n @for (item of detail.media; track item) {\n <div class=\"py-3\">\n <rolatech-thumbnail\n [src]=\"item.url\"\n size=\"small\"\n mode=\"full\"\n [width]=\"item.width\"\n [height]=\"item.height\"\n ></rolatech-thumbnail>\n </div>\n }\n </div>\n }\n </div>\n }\n }\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: ThumbnailComponent, selector: "rolatech-thumbnail", inputs: ["src", "size", "mode", "width", "height"] }] }); }
1527
- }
1528
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseDetailsComponent, decorators: [{
1529
- type: Component,
1530
- args: [{ selector: 'rolatech-course-details', standalone: true, imports: [ThumbnailComponent], template: "<div class=\"py-3\" id=\"details\">\n <div class=\"text-xl font-medium py-2\">\u8BE6\u60C5</div>\n @if (details()) {\n @for (detail of details(); track $index) {\n <div>\n @if (detail.title) {\n <div class=\"py-3 flex items-center gap-3\">\n <span class=\"h-4 w-1 bg-orange-500 inline-block\"></span>\n <span class=\"text-lg font-medium py-1\"> {{ detail.title }}</span>\n </div>\n }\n @if (detail.content) {\n <div>\n {{ detail.content }}\n </div>\n }\n @if (detail.media) {\n <div class=\"w-80%\">\n @for (item of detail.media; track item) {\n <div class=\"py-3\">\n <rolatech-thumbnail\n [src]=\"item.url\"\n size=\"small\"\n mode=\"full\"\n [width]=\"item.width\"\n [height]=\"item.height\"\n ></rolatech-thumbnail>\n </div>\n }\n </div>\n }\n </div>\n }\n }\n</div>\n" }]
1531
- }] });
1532
-
1533
- class CourseMediaOwnerRendererComponent {
1534
- constructor() {
1535
- this.name = input();
1536
- this.avatar = input();
1537
- this.username = input();
1538
- }
1539
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseMediaOwnerRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1540
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseMediaOwnerRendererComponent, isStandalone: true, selector: "rolatech-course-media-owner-renderer", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, avatar: { classPropertyName: "avatar", publicName: "avatar", isSignal: true, isRequired: false, transformFunction: null }, username: { classPropertyName: "username", publicName: "username", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"flex flex-row items-center\">\n <div class=\"flex mr-3 gap-2 items-center\">\n @if (avatar()) {\n <div class=\"cursor-pointer\" [routerLink]=\"['/', '@' + username()]\">\n <img [src]=\"avatar()\" class=\"w-11 h-11 rounded-full\" />\n </div>\n } @else {\n <div class=\"w-11 h-11 rounded-full bg-orange-600\"></div>\n }\n <div class=\"flex items-center text-lg font-bold cursor-pointer\">\n <a [routerLink]=\"['/', '@' + username()]\">\n <span>{{ name() }}</span>\n </a>\n <mat-icon color=\"primary\">verified</mat-icon>\n </div>\n </div>\n</div>\n", styles: ["mat-icon{transform:scale(.8)}\n"], dependencies: [{ kind: "ngmodule", type: AngularCommonModule }, { kind: "directive", type: i1$3.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] }); }
1541
- }
1542
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseMediaOwnerRendererComponent, decorators: [{
1543
- type: Component,
1544
- args: [{ selector: 'rolatech-course-media-owner-renderer', standalone: true, imports: [AngularCommonModule, MatIconModule], template: "<div class=\"flex flex-row items-center\">\n <div class=\"flex mr-3 gap-2 items-center\">\n @if (avatar()) {\n <div class=\"cursor-pointer\" [routerLink]=\"['/', '@' + username()]\">\n <img [src]=\"avatar()\" class=\"w-11 h-11 rounded-full\" />\n </div>\n } @else {\n <div class=\"w-11 h-11 rounded-full bg-orange-600\"></div>\n }\n <div class=\"flex items-center text-lg font-bold cursor-pointer\">\n <a [routerLink]=\"['/', '@' + username()]\">\n <span>{{ name() }}</span>\n </a>\n <mat-icon color=\"primary\">verified</mat-icon>\n </div>\n </div>\n</div>\n", styles: ["mat-icon{transform:scale(.8)}\n"] }]
1545
- }] });
1546
-
1547
- class CourseCategoryComponent extends BaseComponent {
1548
- constructor() {
1549
- super(...arguments);
1550
- this.categoryService = inject(CategoryService);
1551
- this.courseService = inject(CourseService);
1552
- this.courses = [];
1553
- this.categories = [];
1554
- this.loading = false;
1555
- }
1556
- ngOnInit() {
1557
- this.findAllCategories();
1558
- this.route.paramMap.subscribe((params) => {
1559
- const id = params.get('id');
1560
- this.findCategoryById(id);
1561
- this.findCoursesByCategoryId(id);
1562
- });
1563
- }
1564
- findAllCategories() {
1565
- this.categoryService.find({}).subscribe({
1566
- next: (res) => {
1567
- this.categories = res.data;
1568
- },
1569
- });
1570
- }
1571
- findCategoryById(id) {
1572
- this.categoryService.get(id).subscribe({
1573
- next: (res) => {
1574
- this.category = res.data;
1575
- },
1576
- });
1577
- }
1578
- findAllCourses() {
1579
- this.courseService.find({}).subscribe({
1580
- next: (res) => {
1581
- this.courses = res.data;
1582
- },
1583
- });
1584
- }
1585
- findCoursesByCategoryId(id) {
1586
- this.loading = true;
1587
- const options = {
1588
- filter: `categories:${id},published:true`,
1589
- };
1590
- this.courseService.find(options).subscribe({
1591
- next: (res) => {
1592
- this.courses = res.data;
1593
- this.loading = false;
1594
- },
1595
- error: (error) => {
1596
- this.loading = false;
1597
- },
1598
- });
1599
- }
1600
- loadCoursesByCategory(item) {
1601
- // [routerLink] = "['../../', item.id]";
1602
- this.router.navigate([`../../${item.id}`], {
1603
- relativeTo: this.route,
1604
- });
1605
- }
1606
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseCategoryComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1607
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseCategoryComponent, isStandalone: true, selector: "rolatech-course-category", usesInheritance: true, ngImport: i0, template: "<div>\n @if (category) {\n <div class=\"p-3 hidden md:block text-2xl font-medium\">{{ category.name }}</div>\n } @else {\n <div class=\"flex flex-row animate-pulse w-full\">\n <div class=\"h-4 bg-[--rt-base-background] rounded col-span-2\"></div>\n </div>\n }\n @if (loading) {\n @for (number of [0, 1, 2, 3, 4, 5]; track number) {\n <div class=\"flex flex-row animate-pulse mt-3 mr-4 cursor-pointer w-full\">\n <div class=\"h-fit w-2/5 md:w-1/4 aspect-video bg-[--rt-base-background] rounded-lg\"></div>\n <div class=\"w-3/5 md:w-3/4 ml-3 py-1 flex flex-col justify-between\">\n <div class=\"space-y-3\">\n <div class=\"h-4 bg-[--rt-base-background] rounded col-span-2\"></div>\n <div class=\"h-2 bg-[--rt-base-background] rounded col-span-1\"></div>\n <div class=\"h-2 bg-[--rt-base-background] rounded col-span-1 py-1\"></div>\n </div>\n <div>\n <div class=\"h-2 bg-[--rt-base-background] rounded col-span-2 py-1\"></div>\n </div>\n </div>\n </div>\n }\n } @else {\n <rolatech-rich-view list>\n @for (item of courses; track item) {\n @defer {\n <rolatech-rich-item\n [routerLink]=\"['../../', item.id]\"\n [thumbnail]=\"item.media[0].url + '!w400'\"\n [title]=\"item.name\"\n [subtitle]=\"item.description\"\n [price]=\"item.pricing[0].total / 100\"\n ></rolatech-rich-item>\n }\n }\n </rolatech-rich-view>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: AngularCommonModule }, { kind: "ngmodule", type: AngularComponentsModule }, { kind: "component", type: RichViewComponent, selector: "rolatech-rich-view", inputs: ["list", "wrap"] }], deferBlockDependencies: [() => [i1$3.RouterLink, RichItemComponent]] }); }
1608
- }
1609
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseCategoryComponent, decorators: [{
1610
- type: Component,
1611
- args: [{ standalone: true, imports: [AngularCommonModule, AngularComponentsModule, CourseItemComponent, RichViewComponent, RichItemComponent], selector: 'rolatech-course-category', template: "<div>\n @if (category) {\n <div class=\"p-3 hidden md:block text-2xl font-medium\">{{ category.name }}</div>\n } @else {\n <div class=\"flex flex-row animate-pulse w-full\">\n <div class=\"h-4 bg-[--rt-base-background] rounded col-span-2\"></div>\n </div>\n }\n @if (loading) {\n @for (number of [0, 1, 2, 3, 4, 5]; track number) {\n <div class=\"flex flex-row animate-pulse mt-3 mr-4 cursor-pointer w-full\">\n <div class=\"h-fit w-2/5 md:w-1/4 aspect-video bg-[--rt-base-background] rounded-lg\"></div>\n <div class=\"w-3/5 md:w-3/4 ml-3 py-1 flex flex-col justify-between\">\n <div class=\"space-y-3\">\n <div class=\"h-4 bg-[--rt-base-background] rounded col-span-2\"></div>\n <div class=\"h-2 bg-[--rt-base-background] rounded col-span-1\"></div>\n <div class=\"h-2 bg-[--rt-base-background] rounded col-span-1 py-1\"></div>\n </div>\n <div>\n <div class=\"h-2 bg-[--rt-base-background] rounded col-span-2 py-1\"></div>\n </div>\n </div>\n </div>\n }\n } @else {\n <rolatech-rich-view list>\n @for (item of courses; track item) {\n @defer {\n <rolatech-rich-item\n [routerLink]=\"['../../', item.id]\"\n [thumbnail]=\"item.media[0].url + '!w400'\"\n [title]=\"item.name\"\n [subtitle]=\"item.description\"\n [price]=\"item.pricing[0].total / 100\"\n ></rolatech-rich-item>\n }\n }\n </rolatech-rich-view>\n }\n</div>\n" }]
1612
- }] });
1613
-
1614
- class CourseDetailComponent extends BaseComponent {
1615
- constructor() {
1616
- super();
1617
- this.status = CourseStatus;
1618
- this.authService = inject(AuthService);
1619
- this.authUserService = inject(AuthUserService);
1620
- this.courseService = inject(CourseService);
1621
- this.viewportScroller = inject(ViewportScroller);
1622
- this.courseSectionService = inject(CourseSectionService);
1623
- this.authenticated = this.authService.authenticated;
1624
- this.instructorName = '';
1625
- this.username = '';
1626
- this.inWishList = false;
1627
- this.purchased = false;
1628
- this.sections = [];
1629
- this.type = CourseSectionLectureContentType;
1630
- effect(() => {
1631
- if (this.authenticated()) {
1632
- this.findPurchasedByCourseId();
1633
- this.findWishlistBy();
1634
- }
1635
- });
1636
- }
1637
- ngOnInit() {
1638
- this.findOne();
1639
- this.findSections();
1640
- }
1641
- scrollToAnchor(anchorId) {
1642
- // this.viewportScroller.setOffset([100, 100]);
1643
- document.getElementById(anchorId)?.scrollIntoView({
1644
- behavior: 'smooth',
1645
- block: 'start',
1646
- inline: 'nearest',
1647
- });
1648
- }
1649
- findOne() {
1650
- this.courseService.get(this.id).subscribe({
1651
- next: (res) => {
1652
- this.course = res.data;
1653
- this.findUserBaseInfo(this.course.instructorId);
1654
- this.titleService.setTitle(`${this.course.name} - 拼小课`);
1655
- },
1656
- });
1657
- }
1658
- findSections() {
1659
- this.courseSectionService.findSections(this.id).subscribe({
1660
- next: (res) => {
1661
- this.sections = res.data;
1662
- },
1663
- });
1664
- }
1665
- findUserBaseInfo(userId) {
1666
- this.authUserService.getPublicUserInfo(userId).subscribe({
1667
- next: (res) => {
1668
- this.instructorName = res.name;
1669
- this.username = res.username;
1670
- },
1671
- });
1672
- }
1673
- onWish(e) {
1674
- if (this.authenticated()) {
1675
- if (this.inWishList) {
1676
- this.removeFromWishlist();
1677
- }
1678
- else {
1679
- this.addToWishlist();
1680
- }
1681
- }
1682
- else {
1683
- this.snackBarService.open('请先登录');
1684
- }
1685
- }
1686
- checkout(e) {
1687
- if (this.authenticated()) {
1688
- this.router.navigateByUrl(`/carts/checkout/express/courses/${this.id}`);
1689
- }
1690
- else {
1691
- this.snackBarService.open('请先登录');
1692
- }
1693
- }
1694
- removeFromWishlist() {
1695
- this.courseService.removeFromWishlist(this.id).subscribe({
1696
- next: (res) => {
1697
- this.inWishList = false;
1698
- },
1699
- });
1700
- }
1701
- addToWishlist() {
1702
- this.courseService.addToWishlist(this.id).subscribe({
1703
- next: (res) => {
1704
- this.inWishList = true;
1705
- },
1706
- });
1707
- }
1708
- onSection(event) {
1709
- const { section, lecture } = event;
1710
- this.router.navigate(['/courses', this.course.id, 'sections', section.id, 'lectures', lecture.id]);
1711
- }
1712
- findWishlistBy() {
1713
- this.courseService.findWishlistBy(this.id).subscribe({
1714
- next: (res) => {
1715
- this.inWishList = res.data;
1716
- },
1717
- });
1718
- }
1719
- findPurchasedByCourseId() {
1720
- this.courseService.findPurchasedByCourseId(this.id).subscribe({
1721
- next: (res) => {
1722
- this.purchased = res.data ? true : false;
1723
- },
1724
- });
1725
- }
1726
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseDetailComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1727
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseDetailComponent, isStandalone: true, selector: "rolatech-course-detail", usesInheritance: true, ngImport: i0, template: "@if (course) {\n <rolatech-container>\n <div class=\"flex flex-col-reverse gap-3 md:flex-row w-full justify-between\">\n <div class=\"md:w-3/4\">\n <rolatech-course-info [course]=\"course\" [instructor]=\"instructorName\" [username]=\"username\"> </rolatech-course-info>\n <rolatech-course-sections\n [sections]=\"sections\"\n (section)=\"onSection($event)\"\n (checkout)=\"checkout($event)\"\n [purchased]=\"purchased\"\n ></rolatech-course-sections>\n <rolatech-course-schedule [schedule]=\"course.schedule\"></rolatech-course-schedule>\n <rolatech-course-details [details]=\"course.details\"></rolatech-course-details>\n <rolatech-comments [itemId]=\"course.id\"></rolatech-comments>\n </div>\n <div class=\"md:px-3\">\n <!-- <rolatech-course-media [min]=\"!purchased\" [media]=\"course.media\" [min]=\"true\"></rolatech-course-media> -->\n <rolatech-course-media [media]=\"course.media\" [min]=\"true\"></rolatech-course-media>\n @if (!purchased) {\n <rolatech-course-pricing [pricing]=\"course.pricing\"></rolatech-course-pricing>\n <rolatech-course-action\n [course]=\"course\"\n (checkout)=\"checkout($event)\"\n (wish)=\"onWish($event)\"\n [inWishList]=\"inWishList\"\n ></rolatech-course-action>\n }\n </div>\n </div>\n </rolatech-container>\n}\n", styles: [""], dependencies: [{ kind: "ngmodule", type: AngularCommonModule }, { kind: "ngmodule", type: AngularComponentsModule }, { kind: "component", type: CourseInfoComponent, selector: "rolatech-course-info", inputs: ["course", "instructor", "username"] }, { kind: "component", type: CourseSectionsComponent, selector: "rolatech-course-sections", inputs: ["purchased", "sections"], outputs: ["section", "checkout"] }, { kind: "component", type: CourseScheduleComponent, selector: "rolatech-course-schedule", inputs: ["schedule"] }, { kind: "component", type: CourseDetailsComponent, selector: "rolatech-course-details", inputs: ["details", "instructor", "username"] }, { kind: "component", type: CourseMediaComponent, selector: "rolatech-course-media", inputs: ["media", "min"] }, { kind: "component", type: CoursePricingComponent, selector: "rolatech-course-pricing", inputs: ["pricing"] }, { kind: "component", type: CourseActionComponent, selector: "rolatech-course-action", inputs: ["course", "inWishList"], outputs: ["cart", "wish", "checkout"] }, { kind: "component", type: CommentsComponent, selector: "rolatech-comments", inputs: ["itemId"] }, { kind: "component", type: ContainerComponent, selector: "rolatech-container" }] }); }
1728
- }
1729
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseDetailComponent, decorators: [{
1730
- type: Component,
1731
- args: [{ standalone: true, imports: [
1732
- AngularCommonModule,
1733
- AngularComponentsModule,
1734
- CourseInfoComponent,
1735
- CourseSectionsComponent,
1736
- CourseScheduleComponent,
1737
- CourseDetailsComponent,
1738
- CourseMediaComponent,
1739
- CoursePricingComponent,
1740
- CourseActionComponent,
1741
- CommentsComponent,
1742
- ContainerComponent,
1743
- ], selector: 'rolatech-course-detail', template: "@if (course) {\n <rolatech-container>\n <div class=\"flex flex-col-reverse gap-3 md:flex-row w-full justify-between\">\n <div class=\"md:w-3/4\">\n <rolatech-course-info [course]=\"course\" [instructor]=\"instructorName\" [username]=\"username\"> </rolatech-course-info>\n <rolatech-course-sections\n [sections]=\"sections\"\n (section)=\"onSection($event)\"\n (checkout)=\"checkout($event)\"\n [purchased]=\"purchased\"\n ></rolatech-course-sections>\n <rolatech-course-schedule [schedule]=\"course.schedule\"></rolatech-course-schedule>\n <rolatech-course-details [details]=\"course.details\"></rolatech-course-details>\n <rolatech-comments [itemId]=\"course.id\"></rolatech-comments>\n </div>\n <div class=\"md:px-3\">\n <!-- <rolatech-course-media [min]=\"!purchased\" [media]=\"course.media\" [min]=\"true\"></rolatech-course-media> -->\n <rolatech-course-media [media]=\"course.media\" [min]=\"true\"></rolatech-course-media>\n @if (!purchased) {\n <rolatech-course-pricing [pricing]=\"course.pricing\"></rolatech-course-pricing>\n <rolatech-course-action\n [course]=\"course\"\n (checkout)=\"checkout($event)\"\n (wish)=\"onWish($event)\"\n [inWishList]=\"inWishList\"\n ></rolatech-course-action>\n }\n </div>\n </div>\n </rolatech-container>\n}\n" }]
1744
- }], ctorParameters: () => [] });
1745
-
1746
- class CourseLayoutComponent extends BaseComponent {
1747
- constructor() {
1748
- super(...arguments);
1749
- this.categories = [];
1750
- this.categoryService = inject(CategoryService);
1751
- this.courseService = inject(CourseService);
1752
- this.selectIndex = 0;
1753
- }
1754
- ngOnInit() {
1755
- this.findCategories();
1756
- }
1757
- findCategories() {
1758
- this.categoryService.find({}).subscribe({
1759
- next: (res) => {
1760
- this.categories = res.data;
1761
- },
1762
- });
1763
- }
1764
- loadCourseByCategoryIndex(index) {
1765
- this.selectIndex = index;
1766
- const id = this.categories[index].id;
1767
- if (index === 0) {
1768
- this.router.navigate([`/courses`]);
1769
- // this.courseService.find({}).subscribe({
1770
- // next: res => {
1771
- // }
1772
- // })
1773
- }
1774
- else {
1775
- this.router.navigate([`../courses/categories/${id}`], {
1776
- relativeTo: this.route,
1777
- });
1778
- }
1779
- }
1780
- nextCategory() { }
1781
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseLayoutComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1782
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseLayoutComponent, isStandalone: true, selector: "rolatech-course-layout", usesInheritance: true, ngImport: i0, template: "@if (categories) {\n <rolatech-container>\n <div class=\"flex flex-col md:flex-row min-w-[320px] max-w-[1280px] m-auto\">\n <div class=\"h-14 md:h-auto min-w-[240px]\">\n <div class=\"hidden md:block text-2xl font-medium py-3 md:px-1 px-3\">\u5206\u7C7B</div>\n <div\n class=\"flex flex-row md:flex-col md:h-full items-center md:items-start h-14 overflow-x-scroll overflow-y-hidden scrollbar-hide whitespace-pre\"\n >\n <a\n class=\"cursor-pointer h-8 bg-[--rt-badge-chip-background] md:bg-[--rt-base-background] rounded-md flex items-center md:mb-1 mr-2 md:mr-0\"\n routerLinkActive=\"course-layout-active\"\n routerLink=\"/courses\"\n [routerLinkActiveOptions]=\"{ exact: true }\"\n >\n <span class=\"md:px-1 px-3 text-md md:text-lg\">\u5168\u90E8</span>\n </a>\n @for (category of categories; track category; let index = $index) {\n <a\n class=\"cursor-pointer h-8 bg-[--rt-badge-chip-background] md:bg-[--rt-base-background] rounded-md flex items-center mr-2 md:mr-0 md:mb-1\"\n routerLinkActive=\"course-layout-active\"\n [routerLink]=\"['../courses/categories/', category.id]\"\n [routerLinkActiveOptions]=\"{ exact: true }\"\n >\n <span class=\"md:px-1 px-3 text-md md:text-lg\">{{ category.name }}</span>\n </a>\n }\n </div>\n </div>\n <div class=\"w-full\">\n <router-outlet></router-outlet>\n </div>\n </div>\n <!-- <rolatech-list>\n <router-outlet></router-outlet>\n </rolatech-list> -->\n </rolatech-container>\n}\n", styles: [".course-layout-active{border-radius:var(--rt-rounded-base, 8px);background-color:var(-rt-base-background, #fff);color:var(--rt-brand-color, #000)}@media (max-width: 768px){.course-layout-active{background-color:var(--rt-text-primary, #000);color:var(--rt-text-primary-inverse, #000)}}.scrollbar-hide::-webkit-scrollbar{display:none}.scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}\n"], dependencies: [{ kind: "ngmodule", type: AngularCommonModule }, { kind: "directive", type: i1$3.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i1$3.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "directive", type: i1$3.RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "ngmodule", type: AngularComponentsModule }, { kind: "component", type: ContainerComponent, selector: "rolatech-container" }] }); }
1783
- }
1784
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseLayoutComponent, decorators: [{
1785
- type: Component,
1786
- args: [{ standalone: true, imports: [AngularCommonModule, AngularComponentsModule, ContainerComponent, ListComponent], selector: 'rolatech-course-layout', template: "@if (categories) {\n <rolatech-container>\n <div class=\"flex flex-col md:flex-row min-w-[320px] max-w-[1280px] m-auto\">\n <div class=\"h-14 md:h-auto min-w-[240px]\">\n <div class=\"hidden md:block text-2xl font-medium py-3 md:px-1 px-3\">\u5206\u7C7B</div>\n <div\n class=\"flex flex-row md:flex-col md:h-full items-center md:items-start h-14 overflow-x-scroll overflow-y-hidden scrollbar-hide whitespace-pre\"\n >\n <a\n class=\"cursor-pointer h-8 bg-[--rt-badge-chip-background] md:bg-[--rt-base-background] rounded-md flex items-center md:mb-1 mr-2 md:mr-0\"\n routerLinkActive=\"course-layout-active\"\n routerLink=\"/courses\"\n [routerLinkActiveOptions]=\"{ exact: true }\"\n >\n <span class=\"md:px-1 px-3 text-md md:text-lg\">\u5168\u90E8</span>\n </a>\n @for (category of categories; track category; let index = $index) {\n <a\n class=\"cursor-pointer h-8 bg-[--rt-badge-chip-background] md:bg-[--rt-base-background] rounded-md flex items-center mr-2 md:mr-0 md:mb-1\"\n routerLinkActive=\"course-layout-active\"\n [routerLink]=\"['../courses/categories/', category.id]\"\n [routerLinkActiveOptions]=\"{ exact: true }\"\n >\n <span class=\"md:px-1 px-3 text-md md:text-lg\">{{ category.name }}</span>\n </a>\n }\n </div>\n </div>\n <div class=\"w-full\">\n <router-outlet></router-outlet>\n </div>\n </div>\n <!-- <rolatech-list>\n <router-outlet></router-outlet>\n </rolatech-list> -->\n </rolatech-container>\n}\n", styles: [".course-layout-active{border-radius:var(--rt-rounded-base, 8px);background-color:var(-rt-base-background, #fff);color:var(--rt-brand-color, #000)}@media (max-width: 768px){.course-layout-active{background-color:var(--rt-text-primary, #000);color:var(--rt-text-primary-inverse, #000)}}.scrollbar-hide::-webkit-scrollbar{display:none}.scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}\n"] }]
1787
- }] });
1788
-
1789
- class CourseSectionContentComponent {
1790
- constructor() {
1791
- this.route = inject(ActivatedRoute);
1792
- this.router = inject(Router);
1793
- this.courseSectionService = inject(CourseSectionService);
1794
- this.courseService = inject(CourseService);
1795
- this.authService = inject(AuthService);
1796
- this.authUserService = inject(AuthUserService);
1797
- this.el = inject(ElementRef);
1798
- this.platformId = inject(PLATFORM_ID);
1799
- this.authenticated = this.authService.authenticated;
1800
- this.sections = [];
1801
- this.courseId = '';
1802
- this.sectionId = '';
1803
- this.lectureId = '';
1804
- this.videoUrl = '';
1805
- this.instructorName = '';
1806
- this.instructorAvatar = '';
1807
- this.instructorUsername = '';
1808
- this.purchased = false;
1809
- effect(() => {
1810
- if (this.authenticated()) {
1811
- this.findPurchasedByCourseId();
1812
- }
1813
- });
1814
- }
1815
- ngOnInit() {
1816
- this.route.params.subscribe((params) => {
1817
- this.courseId = params['id'];
1818
- this.sectionId = params['sectionId'];
1819
- this.lectureId = params['lectureId'];
1820
- this.findCourse(this.courseId);
1821
- this.findSections(this.courseId);
1822
- });
1823
- }
1824
- ngOnDestroy() {
1825
- if (this.player) {
1826
- this.player.destroy();
1827
- }
1828
- }
1829
- ngAfterViewInit() { }
1830
- initPlayer(url, thumbnail) {
1831
- if (!isPlatformBrowser(this.platformId)) {
1832
- return;
1833
- }
1834
- // 'https://cos-video-1258344699.cos.ap-guangzhou.tencentcos.cn/test.mp4',
1835
- if (!this.player) {
1836
- const playerContainer = this.el.nativeElement.querySelector('#dplayer');
1837
- this.player = new DPlayer({
1838
- container: playerContainer,
1839
- screenshot: true,
1840
- preload: 'metadata',
1841
- video: {
1842
- url: url,
1843
- pic: thumbnail,
1844
- },
1845
- });
1846
- }
1847
- else {
1848
- this.player.switchVideo({
1849
- url: url,
1850
- pic: thumbnail,
1851
- });
1852
- }
1853
- }
1854
- findSections(courseId) {
1855
- this.courseSectionService.findSections(courseId).subscribe({
1856
- next: (res) => {
1857
- this.sections = res.data;
1858
- const section = this.sections.find((item) => item.id === this.sectionId);
1859
- const letcture = section?.lectures.find((item) => item.id === this.lectureId);
1860
- this.videoUrl = letcture?.item.url;
1861
- const thumbnail = letcture?.item.thumbnail;
1862
- this.initPlayer(this.videoUrl, thumbnail);
1863
- },
1864
- });
1865
- }
1866
- findCourse(courseId) {
1867
- this.courseService.get(courseId).subscribe({
1868
- next: (res) => {
1869
- this.course = res.data;
1870
- this.findUserBaseInfo(this.course.instructorId);
1871
- },
1872
- });
1873
- }
1874
- findUserBaseInfo(userId) {
1875
- this.authUserService.getPublicUserInfo(userId).subscribe({
1876
- next: (res) => {
1877
- this.instructorName = res.name;
1878
- this.instructorAvatar = res.avatar;
1879
- this.instructorUsername = res.username;
1880
- },
1881
- });
1882
- }
1883
- findPurchasedByCourseId() {
1884
- this.courseService.findPurchasedByCourseId(this.courseId).subscribe({
1885
- next: (res) => {
1886
- this.purchased = res.data ? true : false;
1887
- },
1888
- });
1889
- }
1890
- onSection(event) {
1891
- const { section, lecture } = event;
1892
- this.router.navigate(['/courses', this.courseId, 'sections', section.id, 'lectures', lecture.id]);
1893
- }
1894
- checkout(e) {
1895
- this.router.navigateByUrl(`/carts/checkout/express/courses/${this.courseId}`);
1896
- }
1897
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseSectionContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1898
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseSectionContentComponent, isStandalone: true, selector: "rolatech-course-section-content", ngImport: i0, template: "<div class=\"flex lg:flex-row flex-col justify-between w-full mt-2 lg:mt-4\">\n <div class=\"lg:w-[70%] flex flex-col items-start justify-center px-4 lg:px-6 h-fit\">\n <div id=\"dplayer\" class=\"w-full h-auto aspect-video rounded-xl\"></div>\n <div class=\"py-3 w-full\">\n @if (course) {\n <div class=\"text-xl font-medium py-3\">\n {{ course.name }}\n </div>\n <div>\n <rolatech-course-media-owner-renderer\n [name]=\"instructorName\"\n [avatar]=\"instructorAvatar\"\n [username]=\"instructorUsername\"\n ></rolatech-course-media-owner-renderer>\n </div>\n <div class=\"hidden lg:block\">\n <rolatech-comments [itemId]=\"lectureId\"></rolatech-comments>\n </div>\n }\n </div>\n </div>\n <div class=\"lg:w-[30%] px-4 lg:px-0 lg:pr-6\">\n <rolatech-course-sections\n [sections]=\"sections\"\n [purchased]=\"purchased\"\n (section)=\"onSection($event)\"\n (checkout)=\"checkout($event)\"\n ></rolatech-course-sections>\n </div>\n <div class=\"lg:hidden block px-4 lg:px-6\">\n <rolatech-comments [itemId]=\"lectureId\"></rolatech-comments>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: AngularCommonModule }, { kind: "ngmodule", type: AngularComponentsModule }, { kind: "component", type: CourseSectionsComponent, selector: "rolatech-course-sections", inputs: ["purchased", "sections"], outputs: ["section", "checkout"] }, { kind: "component", type: CourseMediaOwnerRendererComponent, selector: "rolatech-course-media-owner-renderer", inputs: ["name", "avatar", "username"] }, { kind: "component", type: CommentsComponent, selector: "rolatech-comments", inputs: ["itemId"] }] }); }
1899
- }
1900
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseSectionContentComponent, decorators: [{
1901
- type: Component,
1902
- args: [{ standalone: true, imports: [
1903
- AngularCommonModule,
1904
- AngularComponentsModule,
1905
- CourseSectionsComponent,
1906
- CourseMediaOwnerRendererComponent,
1907
- CommentsComponent,
1908
- ], selector: 'rolatech-course-section-content', template: "<div class=\"flex lg:flex-row flex-col justify-between w-full mt-2 lg:mt-4\">\n <div class=\"lg:w-[70%] flex flex-col items-start justify-center px-4 lg:px-6 h-fit\">\n <div id=\"dplayer\" class=\"w-full h-auto aspect-video rounded-xl\"></div>\n <div class=\"py-3 w-full\">\n @if (course) {\n <div class=\"text-xl font-medium py-3\">\n {{ course.name }}\n </div>\n <div>\n <rolatech-course-media-owner-renderer\n [name]=\"instructorName\"\n [avatar]=\"instructorAvatar\"\n [username]=\"instructorUsername\"\n ></rolatech-course-media-owner-renderer>\n </div>\n <div class=\"hidden lg:block\">\n <rolatech-comments [itemId]=\"lectureId\"></rolatech-comments>\n </div>\n }\n </div>\n </div>\n <div class=\"lg:w-[30%] px-4 lg:px-0 lg:pr-6\">\n <rolatech-course-sections\n [sections]=\"sections\"\n [purchased]=\"purchased\"\n (section)=\"onSection($event)\"\n (checkout)=\"checkout($event)\"\n ></rolatech-course-sections>\n </div>\n <div class=\"lg:hidden block px-4 lg:px-6\">\n <rolatech-comments [itemId]=\"lectureId\"></rolatech-comments>\n </div>\n</div>\n" }]
1909
- }], ctorParameters: () => [] });
1910
-
1911
- const courseRoutes = [
1912
- {
1913
- path: '',
1914
- component: CourseLayoutComponent,
1915
- children: [
1916
- {
1917
- path: '',
1918
- loadComponent: () => import('./rolatech-angular-course-course-index.component-C89fCBfR.mjs').then((x) => x.CourseIndexComponent),
1919
- },
1920
- {
1921
- path: 'categories/:id',
1922
- component: CourseCategoryComponent,
1923
- },
1924
- ],
1925
- },
1926
- {
1927
- path: ':id',
1928
- component: CourseDetailComponent,
1929
- },
1930
- {
1931
- path: ':id/sections/:sectionId/lectures/:lectureId',
1932
- component: CourseSectionContentComponent,
1933
- },
1934
- {
1935
- path: 'my-courses',
1936
- component: CourseDetailComponent,
1937
- },
1938
- ];
1939
-
1940
- class CourseManageContentComponent {
1941
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManageContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1942
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.1", type: CourseManageContentComponent, isStandalone: true, selector: "rolatech-course-manage-content", ngImport: i0, template: "<ng-content select=\"rolatech-toolbar\"></ng-content>\n<div class=\"p-3\">\n <ng-content></ng-content>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }] }); }
1943
- }
1944
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManageContentComponent, decorators: [{
1945
- type: Component,
1946
- args: [{ selector: 'rolatech-course-manage-content', standalone: true, imports: [CommonModule], template: "<ng-content select=\"rolatech-toolbar\"></ng-content>\n<div class=\"p-3\">\n <ng-content></ng-content>\n</div>\n" }]
1947
- }] });
1948
-
1949
- class CourseManageDetailsComponent {
1950
- constructor() {
1951
- this.route = inject(ActivatedRoute);
1952
- this.courseService = inject(CourseService);
1953
- this.dialog = inject(MatDialog);
1954
- this.snackBar = inject(MatSnackBar);
1955
- this.isLoading = false;
1956
- this.isUploading = false;
1957
- this.details = [];
1958
- this.status = CourseStatus;
1959
- this.courseType = CourseType;
1960
- this.id = this.route.parent?.snapshot.paramMap.get('id');
1961
- }
1962
- ngOnInit() {
1963
- this.find();
1964
- }
1965
- find() {
1966
- this.courseService.findDetails(this.id).subscribe({
1967
- next: (res) => {
1968
- if (res.data) {
1969
- this.details = res.data;
1970
- }
1971
- },
1972
- });
1973
- }
1974
- addDetail() {
1975
- if (!this.details) {
1976
- this.details = [];
1977
- }
1978
- this.courseService
1979
- .addDetail(this.id, {
1980
- title: '',
1981
- description: '',
1982
- content: '',
1983
- media: [],
1984
- })
1985
- .subscribe({
1986
- next: (res) => {
1987
- const detail = res.data;
1988
- this.details.push({
1989
- id: detail.id,
1990
- title: '',
1991
- description: '',
1992
- content: '',
1993
- media: [],
1994
- });
1995
- },
1996
- error: (e) => {
1997
- this.snackBar.open(e.message);
1998
- },
1999
- });
2000
- }
2001
- onDetailMediaUpload(event) {
2002
- const detailId = event.id;
2003
- const index = findIndex(this.details, (item) => item.id === detailId);
2004
- const file = event.data.target.files[0];
2005
- if (file) {
2006
- const reader = new FileReader();
2007
- reader.readAsDataURL(file);
2008
- reader.onload = () => {
2009
- if (!this.details[index].media) {
2010
- this.details[index].media = [];
2011
- }
2012
- this.details[index].media.push({
2013
- url: reader.result,
2014
- alt: 'upload image',
2015
- });
2016
- this.details[index].isUploading = true;
2017
- const formData = new FormData();
2018
- formData.append('file', file);
2019
- this.courseService.uploadDetailMedia(this.id, detailId, formData).subscribe({
2020
- next: (res) => {
2021
- this.isUploading = false;
2022
- this.details[index].isUploading = false;
2023
- const tmp = this.details[index].media;
2024
- delete res.data.productDetail;
2025
- this.details[index].media[this.details[index].media.length - 1] = res.data;
2026
- },
2027
- error: (e) => {
2028
- this.isUploading = false;
2029
- this.snackBar.open('上传失败: ' + e.message);
2030
- },
2031
- });
2032
- };
2033
- reader.onerror = (error) => {
2034
- this.isUploading = false;
2035
- };
2036
- }
2037
- }
2038
- onDetailMediaDelete(event) {
2039
- const detailId = event.id;
2040
- const mediaId = event.media.id;
2041
- this.courseService.deleteDetailMedia(this.id, detailId, mediaId).subscribe({
2042
- next: (res) => {
2043
- const detail = this.details.find((item) => item.id === detailId);
2044
- remove(detail.media, {
2045
- id: mediaId,
2046
- });
2047
- },
2048
- });
2049
- }
2050
- onDetailSave(detail) {
2051
- delete detail.isUploading;
2052
- this.courseService.updateDetail(this.id, detail.id, detail).subscribe({
2053
- next: (res) => {
2054
- this.snackBar.open('保存成功');
2055
- },
2056
- error: (e) => {
2057
- this.snackBar.open(e.message);
2058
- },
2059
- });
2060
- }
2061
- onDetailDelete(detail) {
2062
- const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
2063
- width: '400px',
2064
- data: {
2065
- title: '删除详情',
2066
- message: '确定删除此详情吗?',
2067
- },
2068
- });
2069
- dialogRef.afterClosed().subscribe((result) => {
2070
- if (result) {
2071
- this.courseService.deleteDetail(this.id, detail.id).subscribe({
2072
- next: (res) => {
2073
- this.snackBar.open(res.data);
2074
- remove(this.details, {
2075
- id: detail.id,
2076
- });
2077
- },
2078
- error: (e) => {
2079
- this.snackBar.open(e.message);
2080
- },
2081
- });
2082
- }
2083
- });
2084
- }
2085
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManageDetailsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2086
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseManageDetailsComponent, isStandalone: true, selector: "rolatech-course-manage-details", ngImport: i0, template: "<rolatech-course-manage-content>\n <rolatech-toolbar title=\"\u8BE6\u60C5\" class=\"hidden md:block\" divider> </rolatech-toolbar>\n <div>\n <div>\n @for (detail of details; track detail) {\n <rolatech-detail-item\n [detail]=\"detail\"\n (upload)=\"onDetailMediaUpload($event)\"\n (deleteMedia)=\"onDetailMediaDelete($event)\"\n (save)=\"onDetailSave($event)\"\n (delete)=\"onDetailDelete($event)\"\n [actions]=\"true\"\n ></rolatech-detail-item>\n }\n </div>\n <button mat-stroked-button (click)=\"addDetail()\" class=\"mt-3\">\n <mat-icon>add</mat-icon>\n <span>\u6DFB\u52A0\u8BE6\u60C5</span>\n </button>\n </div>\n</rolatech-course-manage-content>\n", styles: [""], dependencies: [{ kind: "component", type: DetailItemComponent, selector: "rolatech-detail-item", inputs: ["isUploading", "detail", "actions", "selectMedia"], outputs: ["upload", "delete", "save", "deleteMedia"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: ToolbarComponent, selector: "rolatech-toolbar", inputs: ["title", "subtitle", "back", "link", "large", "divider"] }, { kind: "component", type: CourseManageContentComponent, selector: "rolatech-course-manage-content" }] }); }
2087
- }
2088
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManageDetailsComponent, decorators: [{
2089
- type: Component,
2090
- args: [{ selector: 'rolatech-course-manage-details', standalone: true, imports: [DetailItemComponent, MatButtonModule, MatIconModule, ToolbarComponent, CourseManageContentComponent], template: "<rolatech-course-manage-content>\n <rolatech-toolbar title=\"\u8BE6\u60C5\" class=\"hidden md:block\" divider> </rolatech-toolbar>\n <div>\n <div>\n @for (detail of details; track detail) {\n <rolatech-detail-item\n [detail]=\"detail\"\n (upload)=\"onDetailMediaUpload($event)\"\n (deleteMedia)=\"onDetailMediaDelete($event)\"\n (save)=\"onDetailSave($event)\"\n (delete)=\"onDetailDelete($event)\"\n [actions]=\"true\"\n ></rolatech-detail-item>\n }\n </div>\n <button mat-stroked-button (click)=\"addDetail()\" class=\"mt-3\">\n <mat-icon>add</mat-icon>\n <span>\u6DFB\u52A0\u8BE6\u60C5</span>\n </button>\n </div>\n</rolatech-course-manage-content>\n" }]
2091
- }], ctorParameters: () => [] });
2092
-
2093
- class CourseManageScheduleComponent extends BaseComponent {
2094
- constructor() {
2095
- super(...arguments);
2096
- this.courseService = inject(CourseService);
2097
- this.isLoading = false;
2098
- this.schedule = [];
2099
- this.status = CourseStatus;
2100
- this.courseType = CourseType;
2101
- }
2102
- ngOnInit() {
2103
- this.id = this.route.parent?.snapshot.paramMap.get('id');
2104
- this.find();
2105
- }
2106
- find() {
2107
- this.courseService.findSchedule(this.id).subscribe({
2108
- next: (res) => {
2109
- if (res.data) {
2110
- this.schedule = res.data;
2111
- }
2112
- },
2113
- });
2114
- }
2115
- addSchedule() {
2116
- const options = {
2117
- width: '500px',
2118
- title: '添加课表',
2119
- cancelText: '取消',
2120
- confirmText: '确认',
2121
- component: CourseScheduleAddDialogComponent,
2122
- data: {},
2123
- };
2124
- this.dialogService.open(options);
2125
- this.dialogService.confirmed().subscribe({
2126
- next: (schedule) => {
2127
- if (schedule) {
2128
- this.courseService.addSchedule(this.id, schedule).subscribe({
2129
- next: (res) => {
2130
- this.schedule.push(res.data);
2131
- this.snackBarService.open('添加成功');
2132
- },
2133
- error: (error) => {
2134
- this.snackBarService.open(error.message);
2135
- },
2136
- });
2137
- }
2138
- },
2139
- });
2140
- }
2141
- editSchedule() {
2142
- const options = {
2143
- width: '500px',
2144
- height: '90%',
2145
- title: '编辑课表',
2146
- cancelText: '取消',
2147
- confirmText: '确认',
2148
- component: ScheduleItemComponent,
2149
- data: {
2150
- courseId: this.id,
2151
- schedule: this.schedule,
2152
- },
2153
- };
2154
- this.dialogService.open(options);
2155
- this.dialogService.confirmed().subscribe({
2156
- next: (result) => {
2157
- if (result) {
2158
- this.courseService.addSchedule(this.id, { schedule: result }).subscribe({
2159
- next: (res) => {
2160
- this.snackBarService.open('编辑成功');
2161
- },
2162
- error: (error) => {
2163
- this.snackBarService.open(error.message);
2164
- },
2165
- });
2166
- }
2167
- },
2168
- });
2169
- }
2170
- onScheduleSave(schedule) {
2171
- this.courseService.updateSchedule(this.id, schedule.id, schedule).subscribe({
2172
- next: (res) => {
2173
- this.snackBarService.open('保存成功');
2174
- },
2175
- error: (e) => {
2176
- this.snackBarService.open(e.message);
2177
- },
2178
- });
2179
- }
2180
- onScheduleDelete(schedule) {
2181
- const options = {
2182
- title: '删除课表',
2183
- message: '确定删除此课表吗?',
2184
- cancelText: '取消',
2185
- confirmText: '确认',
2186
- };
2187
- this.dialogService.open(options);
2188
- this.dialogService.confirmed().subscribe((result) => {
2189
- if (result) {
2190
- this.courseService.deleteSchedule(this.id, schedule.id).subscribe({
2191
- next: (res) => {
2192
- remove(this.schedule, {
2193
- id: schedule.id,
2194
- });
2195
- this.snackBarService.open(res.data);
2196
- },
2197
- error: (e) => {
2198
- this.snackBarService.open(e.message);
2199
- },
2200
- });
2201
- }
2202
- });
2203
- }
2204
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManageScheduleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2205
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseManageScheduleComponent, isStandalone: true, selector: "rolatech-course-manage-schedule", usesInheritance: true, ngImport: i0, template: "<rolatech-course-manage-content>\n <rolatech-toolbar title=\"\u8BFE\u7A0B\u8868\" class=\"hidden md:block\" divider> </rolatech-toolbar>\n <div>\n <div>\n @for (item of schedule; track item) {\n <rolatech-schedule-item\n [value]=\"item\"\n [actions]=\"true\"\n (save)=\"onScheduleSave($event)\"\n (delete)=\"onScheduleDelete($event)\"\n >\n </rolatech-schedule-item>\n }\n </div>\n <button mat-stroked-button (click)=\"addSchedule()\" class=\"mt-3\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u8BFE\u8868</span>\n </button>\n </div>\n</rolatech-course-manage-content>\n", styles: [""], dependencies: [{ kind: "component", type: ScheduleItemComponent, selector: "rolatech-schedule-item", inputs: ["value", "actions"], outputs: ["delete", "save"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: ToolbarComponent, selector: "rolatech-toolbar", inputs: ["title", "subtitle", "back", "link", "large", "divider"] }, { kind: "component", type: CourseManageContentComponent, selector: "rolatech-course-manage-content" }] }); }
2206
- }
2207
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManageScheduleComponent, decorators: [{
2208
- type: Component,
2209
- args: [{ selector: 'rolatech-course-manage-schedule', standalone: true, imports: [ScheduleItemComponent, MatButtonModule, MatIconModule, ToolbarComponent, CourseManageContentComponent], template: "<rolatech-course-manage-content>\n <rolatech-toolbar title=\"\u8BFE\u7A0B\u8868\" class=\"hidden md:block\" divider> </rolatech-toolbar>\n <div>\n <div>\n @for (item of schedule; track item) {\n <rolatech-schedule-item\n [value]=\"item\"\n [actions]=\"true\"\n (save)=\"onScheduleSave($event)\"\n (delete)=\"onScheduleDelete($event)\"\n >\n </rolatech-schedule-item>\n }\n </div>\n <button mat-stroked-button (click)=\"addSchedule()\" class=\"mt-3\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u8BFE\u8868</span>\n </button>\n </div>\n</rolatech-course-manage-content>\n" }]
2210
- }] });
2211
-
2212
- class CourseManagePricingComponent extends BaseComponent {
2213
- constructor() {
2214
- super(...arguments);
2215
- this.courseService = inject(CourseService);
2216
- this.isLoading = false;
2217
- this.pricing = [];
2218
- this.status = CourseStatus;
2219
- this.courseType = CourseType;
2220
- }
2221
- ngOnInit() {
2222
- this.id = this.route.parent?.snapshot.paramMap.get('id');
2223
- this.find();
2224
- }
2225
- find() {
2226
- this.courseService.findPricing(this.id).subscribe({
2227
- next: (res) => {
2228
- if (res.data) {
2229
- this.pricing = res.data;
2230
- }
2231
- },
2232
- });
2233
- }
2234
- editPricing() {
2235
- const options = {
2236
- width: '500px',
2237
- title: '编辑价格',
2238
- height: '90%',
2239
- cancelText: '取消',
2240
- confirmText: '确认',
2241
- component: CoursePricingAddDialogComponent,
2242
- data: {
2243
- courseId: this.id,
2244
- pricing: this.pricing,
2245
- },
2246
- };
2247
- this.dialogService.open(options);
2248
- this.dialogService.confirmed().subscribe((result) => {
2249
- if (result) {
2250
- this.courseService.addPricing(this.id, { pricing: result }).subscribe({
2251
- next: (res) => {
2252
- this.snackBarService.open('编辑成功');
2253
- },
2254
- error: (error) => {
2255
- this.snackBarService.open(error.message);
2256
- },
2257
- });
2258
- }
2259
- });
2260
- }
2261
- addPricing() {
2262
- const options = {
2263
- width: '500px',
2264
- title: '添加价格',
2265
- cancelText: '取消',
2266
- confirmText: '确认',
2267
- component: CoursePricingAddDialogComponent,
2268
- data: {},
2269
- };
2270
- this.dialogService.open(options);
2271
- this.dialogService.confirmed().subscribe((pricing) => {
2272
- if (pricing) {
2273
- this.courseService.addPricing(this.id, { ...pricing, total: pricing.total * 100 }).subscribe({
2274
- next: (res) => {
2275
- this.pricing.push(res.data);
2276
- this.snackBarService.open('添加成功');
2277
- },
2278
- error: (error) => {
2279
- this.snackBarService.open(error.message);
2280
- },
2281
- });
2282
- }
2283
- });
2284
- }
2285
- onPricingSave(pricing) {
2286
- this.courseService.updatePricing(this.id, pricing.id, pricing).subscribe({
2287
- next: (res) => {
2288
- this.snackBarService.open('保存成功');
2289
- },
2290
- error: (e) => {
2291
- this.snackBarService.open(e.message);
2292
- },
2293
- });
2294
- }
2295
- onPricingDelete(pricing) {
2296
- const options = {
2297
- title: '删除价格',
2298
- message: '确定删除此价格吗?',
2299
- cancelText: '取消',
2300
- confirmText: '确认',
2301
- };
2302
- this.dialogService.open(options);
2303
- this.dialogService.confirmed().subscribe((result) => {
2304
- if (result) {
2305
- this.courseService.deletePricing(this.id, pricing.id).subscribe({
2306
- next: (res) => {
2307
- remove(this.pricing, {
2308
- id: pricing.id,
2309
- });
2310
- this.snackBarService.open(res.data);
2311
- },
2312
- error: (e) => {
2313
- this.snackBarService.open(e.message);
2314
- },
2315
- });
2316
- }
2317
- });
2318
- }
2319
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManagePricingComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2320
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseManagePricingComponent, isStandalone: true, selector: "rolatech-course-manage-pricing", usesInheritance: true, ngImport: i0, template: "<rolatech-course-manage-content>\n <rolatech-toolbar title=\"\u4EF7\u683C\" class=\"hidden md:block\" divider> </rolatech-toolbar>\n <div>\n <div>\n @for (item of pricing; track item) {\n <rolatech-pricing-item\n [pricing]=\"item\"\n [actions]=\"true\"\n (save)=\"onPricingSave($event)\"\n (delete)=\"onPricingDelete($event)\"\n >\n </rolatech-pricing-item>\n }\n </div>\n <button mat-stroked-button (click)=\"addPricing()\" class=\"mt-3\">\n <mat-icon>add</mat-icon>\n <span>\u6DFB\u52A0\u4EF7\u683C</span>\n </button>\n </div>\n</rolatech-course-manage-content>\n", styles: [""], dependencies: [{ kind: "component", type: PricingItemComponent, selector: "rolatech-pricing-item", inputs: ["actions", "pricing"], outputs: ["pricingChange", "delete", "save"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: ToolbarComponent, selector: "rolatech-toolbar", inputs: ["title", "subtitle", "back", "link", "large", "divider"] }, { kind: "component", type: CourseManageContentComponent, selector: "rolatech-course-manage-content" }] }); }
2321
- }
2322
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManagePricingComponent, decorators: [{
2323
- type: Component,
2324
- args: [{ selector: 'rolatech-course-manage-pricing', standalone: true, imports: [PricingItemComponent, MatButtonModule, MatIconModule, ToolbarComponent, CourseManageContentComponent], template: "<rolatech-course-manage-content>\n <rolatech-toolbar title=\"\u4EF7\u683C\" class=\"hidden md:block\" divider> </rolatech-toolbar>\n <div>\n <div>\n @for (item of pricing; track item) {\n <rolatech-pricing-item\n [pricing]=\"item\"\n [actions]=\"true\"\n (save)=\"onPricingSave($event)\"\n (delete)=\"onPricingDelete($event)\"\n >\n </rolatech-pricing-item>\n }\n </div>\n <button mat-stroked-button (click)=\"addPricing()\" class=\"mt-3\">\n <mat-icon>add</mat-icon>\n <span>\u6DFB\u52A0\u4EF7\u683C</span>\n </button>\n </div>\n</rolatech-course-manage-content>\n" }]
2325
- }] });
2326
-
2327
- class BookingService extends BaseService {
2328
- init() {
2329
- this.endpoint = 'partners/bookings';
2330
- super.init();
2331
- }
2332
- items(options) {
2333
- return this.http.get(`${this.actionUrl}/items`, {
2334
- params: options,
2335
- withCredentials: true,
2336
- });
2337
- }
2338
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: BookingService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
2339
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: BookingService, providedIn: 'root' }); }
2340
- }
2341
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: BookingService, decorators: [{
2342
- type: Injectable,
2343
- args: [{
2344
- providedIn: 'root',
2345
- }]
2346
- }] });
2347
-
2348
- class InstructorService extends BaseService {
2349
- init() {
2350
- this.endpoint = 'instructors';
2351
- super.init();
2352
- }
2353
- findMyClassrooms(options) {
2354
- return this.http.get(`${this.actionUrl}/classrooms/me`, {
2355
- params: options,
2356
- withCredentials: true,
2357
- });
2358
- }
2359
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: InstructorService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
2360
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: InstructorService, providedIn: 'root' }); }
2361
- }
2362
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: InstructorService, decorators: [{
2363
- type: Injectable,
2364
- args: [{
2365
- providedIn: 'root',
2366
- }]
2367
- }] });
2368
-
2369
- class CourseManageInfoComponent extends BaseComponent {
2370
- constructor() {
2371
- super(...arguments);
2372
- this.courseService = inject(CourseService);
2373
- this.instructorService = inject(InstructorService);
2374
- this.categoryService = inject(CategoryService);
2375
- this.bookingService = inject(BookingService);
2376
- this.isLoading = false;
2377
- this.status = CourseStatus;
2378
- this.courseType = [
2379
- {
2380
- key: 'ONLINE',
2381
- value: '线上',
2382
- },
2383
- {
2384
- key: 'OFFLINE',
2385
- value: '线下',
2386
- },
2387
- {
2388
- key: 'MIXED',
2389
- value: '混合',
2390
- },
2391
- ];
2392
- }
2393
- ngOnInit() {
2394
- this.id = this.route.parent?.snapshot.paramMap.get('id');
2395
- this.find();
2396
- this.categoryService.find({}).subscribe({
2397
- next: (res) => {
2398
- this.categories = res.data;
2399
- },
2400
- });
2401
- this.findClassrooms();
2402
- this.findBookedClassrooms();
2403
- }
2404
- findBookedClassrooms() {
2405
- this.bookingService.items({ status: 'paid' }).subscribe({
2406
- next: (res) => {
2407
- this.bookedClassrooms = res.data;
2408
- },
2409
- });
2410
- }
2411
- findClassrooms() {
2412
- this.instructorService.findMyClassrooms({}).subscribe({
2413
- next: (res) => {
2414
- this.classrooms = res.data;
2415
- },
2416
- });
2417
- }
2418
- find() {
2419
- this.courseService.get(this.id).subscribe({
2420
- next: (res) => {
2421
- this.course = res.data;
2422
- },
2423
- });
2424
- }
2425
- compareFn(o1, o2) {
2426
- return o1.id === o2?.id;
2427
- }
2428
- compareClassroom(o1, o2) {
2429
- if (o1.room) {
2430
- return (o1.latitude === o2?.latitude &&
2431
- o1.longitude === o2?.longitude &&
2432
- o1.room === o2.room &&
2433
- o1.startAt === o2.startAt &&
2434
- o1.endAt === o2.endAt);
2435
- }
2436
- else {
2437
- return o1.latitude === o2?.latitude && o1.longitude === o2?.longitude;
2438
- }
2439
- }
2440
- onSelectionChange(event) {
2441
- this.selectedCategoyIds = event.value;
2442
- }
2443
- onClassroomSelected(event) {
2444
- this.selectedClassroom = event.value;
2445
- }
2446
- update() {
2447
- const { name, description, categories, type, classroom } = this.course;
2448
- const finalClassroom = clone(classroom);
2449
- finalClassroom.address = classroom.room ? classroom.address + ' ' + classroom.room + '室' : classroom.address;
2450
- const data = {
2451
- name,
2452
- description,
2453
- categories,
2454
- type,
2455
- classroom: finalClassroom,
2456
- };
2457
- this.courseService.update(this.id, data).subscribe({
2458
- next: (res) => {
2459
- this.snackBarService.open('保存成功');
2460
- // this.router.navigate([`../${res.data.id}`], { relativeTo: this.route });
2461
- },
2462
- error: (e) => {
2463
- this.snackBarService.open(e.message);
2464
- },
2465
- });
2466
- }
2467
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManageInfoComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2468
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseManageInfoComponent, isStandalone: true, selector: "rolatech-course-manage-info", usesInheritance: true, ngImport: i0, template: "<rolatech-course-manage-content>\n <rolatech-toolbar title=\"\u57FA\u672C\u4FE1\u606F\" class=\"hidden md:block\" divider></rolatech-toolbar>\n @if (course) {\n <div class=\"flex flex-col\">\n <form #courseForm=\"ngForm\" (ngSubmit)=\"update()\">\n <mat-form-field appearance=\"fill\">\n <mat-label> \u8BFE\u7A0B\u540D\u79F0 </mat-label>\n <input matInput type=\"text\" [(ngModel)]=\"course.name\" name=\"name\" required />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u8BFE\u7A0B\u63CF\u8FF0 </mat-label>\n <textarea\n matInput\n type=\"text\"\n [(ngModel)]=\"course.description\"\n name=\"description\"\n required\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"3\"\n ></textarea>\n </mat-form-field>\n <mat-form-field appearance=\"fill\" ngModelGroup=\"categories\" required>\n <mat-label>\u5206\u7C7B</mat-label>\n <mat-select\n multiple\n name=\"id\"\n [compareWith]=\"compareFn\"\n [(ngModel)]=\"course.categories\"\n #select=\"matSelect\"\n (selectionChange)=\"onSelectionChange($event)\"\n >\n @for (item of categories; track item) {\n <mat-option [value]=\"item\">\n {{ item.name }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label>\u7C7B\u578B</mat-label>\n <mat-select name=\"type\" [(ngModel)]=\"course.type\" required>\n @for (item of courseType; track item) {\n <mat-option [value]=\"item.key\">\n {{ item.value }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n @if (course.type && course.type.toString() !== 'ONLINE') {\n <mat-form-field appearance=\"fill\" ngModelGroup=\"classroom\">\n <mat-label>\u6559\u5BA4</mat-label>\n <mat-select\n name=\"id\"\n [(ngModel)]=\"course.classroom\"\n [compareWith]=\"compareClassroom\"\n (selectionChange)=\"onClassroomSelected($event)\"\n required\n >\n <mat-optgroup label=\"\u81EA\u6709\u6559\u5BA4\">\n @for (classroom of classrooms; track classroom) {\n <mat-option [value]=\"classroom\">\n <div class=\"flex gap-3\">\n <span>{{ classroom.name }}</span>\n <span> {{ classroom.address }}</span>\n </div>\n </mat-option>\n }\n </mat-optgroup>\n <mat-optgroup label=\"\u5DF2\u8D2D\u6559\u5BA4\">\n @for (item of bookedClassrooms; track item) {\n <mat-option [value]=\"item\">\n <div class=\"flex flex-col py-3\">\n <span class=\"font-bold\"> {{ item.address }} {{ item.room }}\u5BA4</span>\n <span class=\"text-md font-thin\"> {{ item.startAt }} - {{ item.endAt }}</span>\n </div>\n </mat-option>\n }\n </mat-optgroup>\n </mat-select>\n </mat-form-field>\n }\n </form>\n </div>\n <div>\n <button mat-flat-button type=\"primary\" (click)=\"update()\">\u4FDD\u5B58</button>\n </div>\n }\n</rolatech-course-manage-content>\n", styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4.NgModelGroup, selector: "[ngModelGroup]", inputs: ["ngModelGroup"], exportAs: ["ngModelGroup"] }, { kind: "directive", type: i4.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i3.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "ngmodule", type: TextFieldModule }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i6.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i6$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i6$1.MatOptgroup, selector: "mat-optgroup", inputs: ["label", "disabled"], exportAs: ["matOptgroup"] }, { kind: "ngmodule", type: MatOptionModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: ToolbarComponent, selector: "rolatech-toolbar", inputs: ["title", "subtitle", "back", "link", "large", "divider"] }, { kind: "component", type: CourseManageContentComponent, selector: "rolatech-course-manage-content" }] }); }
2469
- }
2470
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManageInfoComponent, decorators: [{
2471
- type: Component,
2472
- args: [{ selector: 'rolatech-course-manage-info', standalone: true, imports: [
2473
- FormsModule,
2474
- MatFormFieldModule,
2475
- MatInputModule,
2476
- TextFieldModule,
2477
- MatSelectModule,
2478
- MatOptionModule,
2479
- MatButtonModule,
2480
- ToolbarComponent,
2481
- CourseManageContentComponent,
2482
- ], template: "<rolatech-course-manage-content>\n <rolatech-toolbar title=\"\u57FA\u672C\u4FE1\u606F\" class=\"hidden md:block\" divider></rolatech-toolbar>\n @if (course) {\n <div class=\"flex flex-col\">\n <form #courseForm=\"ngForm\" (ngSubmit)=\"update()\">\n <mat-form-field appearance=\"fill\">\n <mat-label> \u8BFE\u7A0B\u540D\u79F0 </mat-label>\n <input matInput type=\"text\" [(ngModel)]=\"course.name\" name=\"name\" required />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u8BFE\u7A0B\u63CF\u8FF0 </mat-label>\n <textarea\n matInput\n type=\"text\"\n [(ngModel)]=\"course.description\"\n name=\"description\"\n required\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"3\"\n ></textarea>\n </mat-form-field>\n <mat-form-field appearance=\"fill\" ngModelGroup=\"categories\" required>\n <mat-label>\u5206\u7C7B</mat-label>\n <mat-select\n multiple\n name=\"id\"\n [compareWith]=\"compareFn\"\n [(ngModel)]=\"course.categories\"\n #select=\"matSelect\"\n (selectionChange)=\"onSelectionChange($event)\"\n >\n @for (item of categories; track item) {\n <mat-option [value]=\"item\">\n {{ item.name }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label>\u7C7B\u578B</mat-label>\n <mat-select name=\"type\" [(ngModel)]=\"course.type\" required>\n @for (item of courseType; track item) {\n <mat-option [value]=\"item.key\">\n {{ item.value }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n @if (course.type && course.type.toString() !== 'ONLINE') {\n <mat-form-field appearance=\"fill\" ngModelGroup=\"classroom\">\n <mat-label>\u6559\u5BA4</mat-label>\n <mat-select\n name=\"id\"\n [(ngModel)]=\"course.classroom\"\n [compareWith]=\"compareClassroom\"\n (selectionChange)=\"onClassroomSelected($event)\"\n required\n >\n <mat-optgroup label=\"\u81EA\u6709\u6559\u5BA4\">\n @for (classroom of classrooms; track classroom) {\n <mat-option [value]=\"classroom\">\n <div class=\"flex gap-3\">\n <span>{{ classroom.name }}</span>\n <span> {{ classroom.address }}</span>\n </div>\n </mat-option>\n }\n </mat-optgroup>\n <mat-optgroup label=\"\u5DF2\u8D2D\u6559\u5BA4\">\n @for (item of bookedClassrooms; track item) {\n <mat-option [value]=\"item\">\n <div class=\"flex flex-col py-3\">\n <span class=\"font-bold\"> {{ item.address }} {{ item.room }}\u5BA4</span>\n <span class=\"text-md font-thin\"> {{ item.startAt }} - {{ item.endAt }}</span>\n </div>\n </mat-option>\n }\n </mat-optgroup>\n </mat-select>\n </mat-form-field>\n }\n </form>\n </div>\n <div>\n <button mat-flat-button type=\"primary\" (click)=\"update()\">\u4FDD\u5B58</button>\n </div>\n }\n</rolatech-course-manage-content>\n", styles: ["mat-form-field{width:100%}\n"] }]
2483
- }] });
2484
-
2485
- const SIZE = 10 * 1024 * 1024; // file slice size 10MB
2486
- class CourseManageMediaComponent {
2487
- constructor() {
2488
- this.route = inject(ActivatedRoute);
2489
- this.courseService = inject(CourseService);
2490
- this.dialog = inject(MatDialog);
2491
- this.snackBar = inject(MatSnackBar);
2492
- this.isUploading = false;
2493
- this.isLoading = false;
2494
- this.media = [];
2495
- this.status = CourseStatus;
2496
- this.courseType = CourseType;
2497
- this.id = this.route.parent?.snapshot.paramMap.get('id');
2498
- }
2499
- ngOnInit() {
2500
- this.find();
2501
- }
2502
- find() {
2503
- this.courseService.get(this.id).subscribe({
2504
- next: (res) => {
2505
- this.media = res.data.media || [];
2506
- },
2507
- });
2508
- }
2509
- onImageClick(i) {
2510
- const dialogRef = this.dialog.open(ImagePreviewDialogComponent, {
2511
- maxWidth: '80vw',
2512
- maxHeight: '80vh',
2513
- height: '80%',
2514
- width: '80%',
2515
- panelClass: 'full-screen-modal',
2516
- data: {
2517
- media: this.media,
2518
- selected: i,
2519
- },
2520
- });
2521
- dialogRef.afterClosed().subscribe((result) => { });
2522
- }
2523
- createFileChunk(file, size = SIZE) {
2524
- const fileChunkList = [];
2525
- let cur = 0;
2526
- while (cur < file.size) {
2527
- fileChunkList.push({ file: file.slice(cur, cur + size) });
2528
- cur += size;
2529
- }
2530
- return fileChunkList;
2531
- }
2532
- onUploadMedia2(event) {
2533
- const file = event.target.files[0];
2534
- const reader = new FileReader();
2535
- reader.onload = (e) => { };
2536
- const fileChunkList = this.createFileChunk(file);
2537
- fileChunkList.forEach((item) => { });
2538
- }
2539
- onUploadMedia(event) {
2540
- const file = event.target.files[0];
2541
- // 5MB * 1024 * 1024 = 5242880
2542
- // if (file?.size > 5242880) {
2543
- // this.snackBar.open('尺寸过大, 请修改后上传');
2544
- // this.isUploading = false;
2545
- // return;
2546
- // }
2547
- if (file) {
2548
- const reader = new FileReader();
2549
- const formData = new FormData();
2550
- formData.append('file', file);
2551
- reader.readAsDataURL(file);
2552
- reader.onload = () => {
2553
- const img = new Image();
2554
- img.onload = () => {
2555
- this.media.push({
2556
- url: img.src,
2557
- alt: 'upload image',
2558
- width: img.width,
2559
- height: img.height,
2560
- });
2561
- this.isUploading = true;
2562
- };
2563
- img.src = reader.result; // This is the data URL
2564
- };
2565
- this.courseService.uploadMedia(this.id, formData).subscribe({
2566
- next: (res) => {
2567
- this.isUploading = false;
2568
- const index = findLastIndex(this.media);
2569
- // Replace item at index using native splice
2570
- this.media.splice(index, 1, res.data);
2571
- },
2572
- error: (e) => {
2573
- this.isUploading = false;
2574
- this.snackBar.open('上传失败: ' + e.message);
2575
- },
2576
- });
2577
- reader.onerror = (error) => {
2578
- this.isUploading = false;
2579
- };
2580
- }
2581
- }
2582
- onMediaDelete(item) {
2583
- const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
2584
- width: '400px',
2585
- data: {
2586
- title: '删除图片',
2587
- message: '确定删除这张课程图片吗?',
2588
- },
2589
- });
2590
- dialogRef.afterClosed().subscribe((result) => {
2591
- if (result) {
2592
- this.courseService.deleteMedia(this.id, item.id).subscribe({
2593
- next: (res) => {
2594
- this.media = this.media.filter((m) => m.id !== item.id);
2595
- this.snackBar.open('删除成功');
2596
- },
2597
- error: (e) => {
2598
- this.snackBar.open(e.message);
2599
- },
2600
- });
2601
- }
2602
- });
2603
- }
2604
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManageMediaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2605
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseManageMediaComponent, isStandalone: true, selector: "rolatech-course-manage-media", ngImport: i0, template: "<rolatech-course-manage-content>\n <rolatech-toolbar title=\"\u56FE\u7247\u4FE1\u606F\" class=\"hidden md:block\" divider></rolatech-toolbar>\n <div>\n <p>*\u56FE\u7247\u6587\u4EF6\u5927\u5C0F\u9650\u5236\u57285MB\u4EE5\u4E0B*</p>\n <rolatech-media-list (upload)=\"onUploadMedia($event)\" [isUploading]=\"isUploading\">\n @for (item of media; track item; let i = $index) {\n <rolatech-media-list-item\n [media]=\"item\"\n (mediaItemClick)=\"onImageClick(i)\"\n (deleteMedia)=\"onMediaDelete(item)\"\n ></rolatech-media-list-item>\n }\n </rolatech-media-list>\n </div>\n</rolatech-course-manage-content>\n", styles: [""], dependencies: [{ kind: "component", type: MediaListComponent, selector: "rolatech-media-list", inputs: ["isUploading", "media", "showAdd"], outputs: ["mediaItemClick", "upload"] }, { kind: "component", type: MediaListItemComponent, selector: "rolatech-media-list-item", inputs: ["media", "uploadProgress"], outputs: ["mediaItemClick", "deleteMedia"] }, { kind: "component", type: ToolbarComponent, selector: "rolatech-toolbar", inputs: ["title", "subtitle", "back", "link", "large", "divider"] }, { kind: "component", type: CourseManageContentComponent, selector: "rolatech-course-manage-content" }] }); }
2606
- }
2607
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManageMediaComponent, decorators: [{
2608
- type: Component,
2609
- args: [{ selector: 'rolatech-course-manage-media', standalone: true, imports: [MediaListComponent, MediaListItemComponent, ToolbarComponent, CourseManageContentComponent], template: "<rolatech-course-manage-content>\n <rolatech-toolbar title=\"\u56FE\u7247\u4FE1\u606F\" class=\"hidden md:block\" divider></rolatech-toolbar>\n <div>\n <p>*\u56FE\u7247\u6587\u4EF6\u5927\u5C0F\u9650\u5236\u57285MB\u4EE5\u4E0B*</p>\n <rolatech-media-list (upload)=\"onUploadMedia($event)\" [isUploading]=\"isUploading\">\n @for (item of media; track item; let i = $index) {\n <rolatech-media-list-item\n [media]=\"item\"\n (mediaItemClick)=\"onImageClick(i)\"\n (deleteMedia)=\"onMediaDelete(item)\"\n ></rolatech-media-list-item>\n }\n </rolatech-media-list>\n </div>\n</rolatech-course-manage-content>\n" }]
2610
- }], ctorParameters: () => [] });
2611
-
2612
- class CourseManageSectionComponent extends BaseComponent {
2613
- constructor() {
2614
- super(...arguments);
2615
- this.courseService = inject(CourseService);
2616
- this.sections = [];
2617
- this.hasUnsaved = false;
2618
- this.editId = '';
2619
- this.lectureEditId = '';
2620
- this.chunkSize = 5 * 1024 * 1024; // 切片大小
2621
- this.fileIndex = 0; // 当前正在被遍历的文件下标
2622
- }
2623
- ngOnInit() {
2624
- this.id = this.route.parent?.snapshot.paramMap.get('id');
2625
- this.find();
2626
- }
2627
- find() {
2628
- this.courseService.getCourseSection(this.id).subscribe({
2629
- next: (res) => {
2630
- if (res.data) {
2631
- this.sections = res.data;
2632
- }
2633
- },
2634
- });
2635
- }
2636
- addSection() {
2637
- const section = {
2638
- title: '',
2639
- description: '',
2640
- };
2641
- this.courseService.addCourseSection(this.id, section).subscribe({
2642
- next: (res) => {
2643
- this.sections.push(res.data);
2644
- this.editId = res.data.id;
2645
- },
2646
- });
2647
- this.hasUnsaved = false;
2648
- }
2649
- onCancel(event) {
2650
- this.sections.pop();
2651
- this.hasUnsaved = false;
2652
- }
2653
- onSectionSave(event) {
2654
- const { id } = event;
2655
- this.courseService.updateCourseSection(id, event).subscribe({
2656
- next: (res) => {
2657
- this.hasUnsaved = false;
2658
- this.snackBarService.open('保存成功');
2659
- },
2660
- });
2661
- this.hasUnsaved = false;
2662
- }
2663
- onSectionEdit(event) {
2664
- this.editId = event.id;
2665
- // this.editIndex = this.sections.find((item: any) => item.id === event.id);
2666
- }
2667
- onSectionDelete(event) {
2668
- const { id } = event;
2669
- const options = {
2670
- title: '确认删除吗',
2671
- message: '删除这个章节吗?',
2672
- cancelText: '取消',
2673
- confirmText: '确认',
2674
- };
2675
- this.dialogService.open(options);
2676
- this.dialogService.confirmed().subscribe({
2677
- next: (res) => {
2678
- if (res) {
2679
- const data = {
2680
- name: res,
2681
- };
2682
- this.courseService.deleteCourseSection(id).subscribe({
2683
- next: (res) => {
2684
- this.sections.pop();
2685
- this.hasUnsaved = false;
2686
- this.snackBarService.open(res.data);
2687
- },
2688
- error: (error) => {
2689
- this.snackBarService.open(error.message);
2690
- },
2691
- });
2692
- }
2693
- },
2694
- });
2695
- }
2696
- addLecture(section) {
2697
- const lecture = {
2698
- title: '',
2699
- type: 'VIDEO',
2700
- };
2701
- this.courseService.addLecture(section.id, lecture).subscribe({
2702
- next: (res) => {
2703
- this.lectureEditId = res.data.id;
2704
- if (section.lectures) {
2705
- section.lectures.push(res.data);
2706
- }
2707
- else {
2708
- const lectures = [];
2709
- lectures.push(res.data);
2710
- section.lectures = lectures;
2711
- }
2712
- },
2713
- });
2714
- }
2715
- onAddLecture(event) { }
2716
- onLectureSave(lecture) {
2717
- this.courseService.updateLecture(lecture.id, lecture).subscribe({
2718
- next: (res) => {
2719
- this.snackBarService.open('保存成功');
2720
- },
2721
- });
2722
- }
2723
- onLectureEdit(lecture) { }
2724
- onMediaEdit(lecture, video) {
2725
- const { id } = lecture;
2726
- const options = {
2727
- title: lecture.title,
2728
- cancelText: '取消',
2729
- confirmText: '保存',
2730
- data: lecture,
2731
- width: '80vw',
2732
- height: '100%',
2733
- component: CourseSectionLectureVideoDialogComponent,
2734
- };
2735
- this.dialogService.open(options);
2736
- this.dialogService.confirmed().subscribe({
2737
- next: (res) => {
2738
- if (res) {
2739
- // this.courseService.deleteLecture(id).subscribe({
2740
- // next: (res) => {},
2741
- // error: (error) => {
2742
- // this.snackBarService.open(error.message);
2743
- // },
2744
- // });
2745
- }
2746
- },
2747
- });
2748
- }
2749
- onLectureDelete(section, lecture) {
2750
- const { id } = lecture;
2751
- const options = {
2752
- title: '确认删除吗',
2753
- message: '删除这一小节吗?',
2754
- cancelText: '取消',
2755
- confirmText: '确认',
2756
- };
2757
- this.dialogService.open(options);
2758
- this.dialogService.confirmed().subscribe({
2759
- next: (res) => {
2760
- if (res) {
2761
- this.courseService.deleteLecture(id).subscribe({
2762
- next: (res) => {
2763
- const index = section.lectures.findIndex((item) => item.id === id);
2764
- section.lectures.splice(index, 1);
2765
- this.hasUnsaved = false;
2766
- this.snackBarService.open(res.data);
2767
- },
2768
- error: (error) => {
2769
- this.snackBarService.open(error.message);
2770
- },
2771
- });
2772
- }
2773
- },
2774
- });
2775
- }
2776
- onMediaUploadInit(lecture, event) {
2777
- const file = event.data.target.files[0];
2778
- if (!file) {
2779
- return;
2780
- }
2781
- const item = {
2782
- url: URL.createObjectURL(file),
2783
- };
2784
- lecture.item = item;
2785
- lecture.isUploading = true;
2786
- lecture.item.progress = 0;
2787
- const reader = new FileReader();
2788
- if (reader.readyState === FileReader.EMPTY) {
2789
- reader.onload = async (e) => {
2790
- const fileBuffer = e.target.result;
2791
- crypto.subtle.digest('SHA-256', fileBuffer).then((res) => {
2792
- const hashArray = Array.from(new Uint8Array(res));
2793
- const hashHex = hashArray.map((byte) => byte.toString(16).padStart(2, '0')).join('');
2794
- const data = { hash: hashHex, filename: file.name, fileType: file.type };
2795
- this.courseService.uploadVideoInit(lecture.id, data).subscribe({
2796
- next: (res) => {
2797
- this.uploadPart(lecture, res.data.uploadId, file);
2798
- },
2799
- error: (e) => { },
2800
- });
2801
- });
2802
- };
2803
- reader.onerror = (error) => { };
2804
- reader.readAsArrayBuffer(file);
2805
- }
2806
- }
2807
- uploadFile(lecture, file, index, uploadId) {
2808
- const reader = new FileReader();
2809
- return new Observable((observer) => {
2810
- reader.readAsArrayBuffer(file);
2811
- reader.onload = (e) => {
2812
- const fileBuffer = e.target.result;
2813
- crypto.subtle.digest('SHA-256', fileBuffer).then((res) => {
2814
- const hashArray = Array.from(new Uint8Array(res));
2815
- const hashHex = hashArray.map((byte) => byte.toString(16).padStart(2, '0')).join('');
2816
- const formData = new FormData();
2817
- formData.append('file', file);
2818
- formData.append('uploadId', uploadId);
2819
- formData.append('number', index + 1);
2820
- formData.append('hash', hashHex);
2821
- this.courseService.uploadVideoPartsToLecture(lecture.id, formData).subscribe({
2822
- next: (res) => {
2823
- observer.next(res);
2824
- observer.complete();
2825
- },
2826
- error: (e) => {
2827
- this.snackBarService.open('上传失败: ' + e.message);
2828
- },
2829
- });
2830
- });
2831
- };
2832
- reader.onerror = (error) => {
2833
- this.snackBarService.open('上传失败: ' + error);
2834
- };
2835
- });
2836
- }
2837
- uploadPart(lecture, uploadId, file) {
2838
- let uploadedCount = 0;
2839
- const fileChunkList = this.createFileChunk(file);
2840
- const numberOfChunks = fileChunkList.length;
2841
- from(fileChunkList)
2842
- .pipe(concatMap((val, index) => this.uploadFile(lecture, val.file, index, uploadId)), take(numberOfChunks))
2843
- .subscribe((res) => {
2844
- uploadedCount++;
2845
- const p = ((uploadedCount / numberOfChunks) * 100).toFixed(0);
2846
- lecture.item.progress = parseFloat(p);
2847
- if (uploadedCount === numberOfChunks) {
2848
- console.log('done');
2849
- this.completePartUpload(lecture, { uploadId });
2850
- }
2851
- });
2852
- }
2853
- completePartUpload(lecture, data) {
2854
- data.duration = lecture.item.duration;
2855
- this.courseService.completePartUpload(lecture.id, data).subscribe({
2856
- next: (res) => {
2857
- lecture.isUploading = false;
2858
- lecture.item.id = res.data.id;
2859
- },
2860
- error: (e) => {
2861
- this.snackBarService.open('上传失败: ' + e.message);
2862
- },
2863
- });
2864
- }
2865
- onMediaUpload(lecture, event) {
2866
- const lectureId = event.id;
2867
- const file = event.data.target.files[0];
2868
- if (!file) {
2869
- return;
2870
- }
2871
- const reader = new FileReader();
2872
- reader.readAsDataURL(file);
2873
- reader.onload = () => {
2874
- const formData = new FormData();
2875
- formData.append('file', file);
2876
- this.courseService.uploadVideoToLecture(lectureId, formData).subscribe({
2877
- next: (res) => {
2878
- lecture.isUploading = false;
2879
- lecture.item = res.data;
2880
- },
2881
- error: (e) => {
2882
- lecture.isUploading = false;
2883
- this.snackBarService.open('上传失败: ' + e.message);
2884
- },
2885
- });
2886
- };
2887
- reader.onerror = (error) => { };
2888
- }
2889
- onMediaDelete(lecture, event) {
2890
- // lecture.item = null;
2891
- const { id } = event;
2892
- const options = {
2893
- title: '确认删除吗',
2894
- message: '删除这个视频吗?',
2895
- cancelText: '取消',
2896
- confirmText: '确认',
2897
- };
2898
- this.dialogService.open(options);
2899
- this.dialogService.confirmed().subscribe({
2900
- next: (res) => {
2901
- if (res) {
2902
- this.courseService.deleteLectureVideo(id).subscribe({
2903
- next: (res) => {
2904
- lecture.item = null;
2905
- this.snackBarService.open(res.data);
2906
- },
2907
- error: (error) => {
2908
- this.snackBarService.open(error.message);
2909
- },
2910
- });
2911
- }
2912
- },
2913
- });
2914
- }
2915
- createFileChunk(file, size = this.chunkSize) {
2916
- const fileChunkList = [];
2917
- let count = 0;
2918
- while (count < file.size) {
2919
- fileChunkList.push({
2920
- file: file.slice(count, count + size),
2921
- });
2922
- count += size;
2923
- }
2924
- return fileChunkList;
2925
- }
2926
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManageSectionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2927
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseManageSectionComponent, isStandalone: true, selector: "rolatech-course-manage-section", usesInheritance: true, ngImport: i0, template: "<rolatech-course-manage-content>\n <rolatech-toolbar title=\"\u7AE0\u8282\" class=\"hidden md:block\" divider> </rolatech-toolbar>\n <div>\n <div>\n @for (section of sections; track $index) {\n <div class=\"bg-[--rt-raised-background] p-2 mb-2 rounded-lg\">\n <rolatech-course-section-item\n [section]=\"section\"\n (edit)=\"onSectionEdit($event)\"\n (save)=\"onSectionSave($event)\"\n (delete)=\"onSectionDelete($event)\"\n [editId]=\"editId\"\n >\n <div class=\"bg-[--rt-base-background] md:ml-8 mt-3 rounded-md divide-y divide-dashed\">\n @if (section?.lectures) {\n @for (lecture of section.lectures; track $index) {\n <div>\n <rolatech-course-section-lecture-item\n [lecture]=\"lecture\"\n (save)=\"onLectureSave($event)\"\n (delete)=\"onLectureDelete(section, $event)\"\n (edit)=\"onLectureEdit($event)\"\n (upload)=\"onMediaUploadInit(lecture, $event)\"\n (mediaEdit)=\"onMediaEdit(lecture, $event)\"\n (deleteMedia)=\"onMediaDelete(lecture, $event)\"\n [editId]=\"lectureEditId\"\n ></rolatech-course-section-lecture-item>\n </div>\n }\n }\n <div class=\"p-3\">\n <button mat-flat-button class=\"max-h-8\" (click)=\"addLecture(section)\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u5C0F\u8282</span>\n </button>\n </div>\n </div>\n </rolatech-course-section-item>\n </div>\n }\n </div>\n @if (!hasUnsaved) {\n <button mat-stroked-button (click)=\"addSection()\" class=\"mt-3\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u7AE0\u8282</span>\n </button>\n }\n </div>\n</rolatech-course-manage-content>\n", styles: [""], dependencies: [{ kind: "component", type: CourseSectionItemComponent, selector: "rolatech-course-section-item", inputs: ["section", "actions", "hasUnsaved", "editId"], outputs: ["sectionChange", "actionsChange", "hasUnsavedChange", "editIdChange", "save", "cancel", "delete", "edit", "addLecture"] }, { kind: "component", type: CourseSectionLectureItemComponent, selector: "rolatech-course-section-lecture-item", inputs: ["progress", "lecture", "actions", "hasUnsaved", "editId"], outputs: ["editIdChange", "save", "cancel", "delete", "edit", "mediaEdit", "thumbnailUpload", "upload", "deleteMedia"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: ToolbarComponent, selector: "rolatech-toolbar", inputs: ["title", "subtitle", "back", "link", "large", "divider"] }, { kind: "component", type: CourseManageContentComponent, selector: "rolatech-course-manage-content" }] }); }
2928
- }
2929
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManageSectionComponent, decorators: [{
2930
- type: Component,
2931
- args: [{ selector: 'rolatech-course-manage-section', standalone: true, imports: [
2932
- CourseSectionItemComponent,
2933
- CourseSectionLectureItemComponent,
2934
- MatButtonModule,
2935
- MatIconModule,
2936
- MatProgressBarModule,
2937
- ToolbarComponent,
2938
- CourseManageContentComponent,
2939
- ], template: "<rolatech-course-manage-content>\n <rolatech-toolbar title=\"\u7AE0\u8282\" class=\"hidden md:block\" divider> </rolatech-toolbar>\n <div>\n <div>\n @for (section of sections; track $index) {\n <div class=\"bg-[--rt-raised-background] p-2 mb-2 rounded-lg\">\n <rolatech-course-section-item\n [section]=\"section\"\n (edit)=\"onSectionEdit($event)\"\n (save)=\"onSectionSave($event)\"\n (delete)=\"onSectionDelete($event)\"\n [editId]=\"editId\"\n >\n <div class=\"bg-[--rt-base-background] md:ml-8 mt-3 rounded-md divide-y divide-dashed\">\n @if (section?.lectures) {\n @for (lecture of section.lectures; track $index) {\n <div>\n <rolatech-course-section-lecture-item\n [lecture]=\"lecture\"\n (save)=\"onLectureSave($event)\"\n (delete)=\"onLectureDelete(section, $event)\"\n (edit)=\"onLectureEdit($event)\"\n (upload)=\"onMediaUploadInit(lecture, $event)\"\n (mediaEdit)=\"onMediaEdit(lecture, $event)\"\n (deleteMedia)=\"onMediaDelete(lecture, $event)\"\n [editId]=\"lectureEditId\"\n ></rolatech-course-section-lecture-item>\n </div>\n }\n }\n <div class=\"p-3\">\n <button mat-flat-button class=\"max-h-8\" (click)=\"addLecture(section)\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u5C0F\u8282</span>\n </button>\n </div>\n </div>\n </rolatech-course-section-item>\n </div>\n }\n </div>\n @if (!hasUnsaved) {\n <button mat-stroked-button (click)=\"addSection()\" class=\"mt-3\">\n <mat-icon>add</mat-icon>\n <span>\u589E\u52A0\u7AE0\u8282</span>\n </button>\n }\n </div>\n</rolatech-course-manage-content>\n" }]
2940
- }] });
2941
-
2942
- class CourseManageLayoutComponent {
2943
- constructor() {
2944
- this.submitted = false;
2945
- this.accepted = false;
2946
- this.isDraft = false;
2947
- this.route = inject(ActivatedRoute);
2948
- this.courseService = inject(CourseService);
2949
- this.dialog = inject(MatDialog);
2950
- this.snackBar = inject(MatSnackBar);
2951
- this.id = this.route.parent?.snapshot.paramMap.get('id');
2952
- }
2953
- ngOnInit() {
2954
- this.get();
2955
- }
2956
- get() {
2957
- this.courseService.get(this.id).subscribe({
2958
- next: (res) => {
2959
- this.course = res.data;
2960
- this.updateStatus();
2961
- },
2962
- });
2963
- }
2964
- updateStatus() {
2965
- this.isDraft = this.course.status.toString() === 'DRAFT' || this.course.status.toString() === 'PENDING';
2966
- this.accepted = this.course.status.toString() === 'ACCEPTED';
2967
- }
2968
- submitForReview() {
2969
- this.courseService.review(this.id).subscribe({
2970
- next: (res) => {
2971
- this.snackBar.open('提交成功, 等待审核');
2972
- this.course.status = CourseStatus['审核中'];
2973
- this.updateStatus();
2974
- },
2975
- error: (error) => {
2976
- this.snackBar.open(error.message);
2977
- },
2978
- });
2979
- }
2980
- publish() {
2981
- this.courseService.publish(this.id).subscribe({
2982
- next: (res) => {
2983
- this.snackBar.open('发布成功');
2984
- this.course.status = CourseStatus['已发布'];
2985
- this.updateStatus();
2986
- },
2987
- error: (error) => {
2988
- this.snackBar.open(error.message);
2989
- },
2990
- });
2991
- }
2992
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManageLayoutComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2993
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.1", type: CourseManageLayoutComponent, isStandalone: true, selector: "rolatech-course-manage-layout", ngImport: i0, template: "<div class=\"flex flex-col md:flex-row m-auto\">\n <div\n class=\"min-w-[256px] px-3 flex flex-row md:flex-col md:h-full items-center md:items-start h-16 overflow-x-scroll overflow-y-hidden scrollbar-hide whitespace-pre\"\n >\n <div class=\"flex flex-row md:flex-col md:w-full\">\n <div class=\"hidden md:flex text-xl font-bold h-14 items-center px-2\">\u8BFE\u7A0B\u4FE1\u606F</div>\n <a routerLink=\"./info\" routerLinkActive=\"manage-active\" class=\"p-2\">\u57FA\u672C\u4FE1\u606F</a>\n <a routerLink=\"./media\" routerLinkActive=\"manage-active\" class=\"p-2\">\u56FE\u7247</a>\n <a routerLink=\"./details\" routerLinkActive=\"manage-active\" class=\"p-2\">\u8BE6\u60C5</a>\n </div>\n <div class=\"flex flex-row md:flex-col md:w-full\">\n <div class=\"hidden md:flex text-xl font-bold h-14 items-center px-2\">\u8BFE\u7A0B\u5185\u5BB9</div>\n <a routerLink=\"./section\" routerLinkActive=\"manage-active\" class=\"p-2\">\u7AE0\u8282</a>\n <a routerLink=\"./schedule\" routerLinkActive=\"manage-active\" class=\"p-2\">\u8BFE\u8868</a>\n </div>\n <div class=\"flex flex-row md:flex-col md:w-full\">\n <div class=\"hidden md:flex text-xl font-bold h-14 items-center px-2\">\u5176\u4ED6\u4FE1\u606F</div>\n <a routerLink=\"./pricing\" routerLinkActive=\"manage-active\" class=\"p-2\">\u4EF7\u683C</a>\n </div>\n\n @if (isDraft) {\n <div class=\"md:mt-6 ml-3 md:ml-2\">\n <!-- <button mat-stroked-button (click)=\"publish()\">\u9884\u89C8</button> -->\n <button mat-flat-button (click)=\"submitForReview()\">\u63D0\u4EA4\u5BA1\u6838</button>\n </div>\n }\n\n @if (accepted) {\n <div class=\"md:mt-6 md:ml-2\">\n <button mat-flat-button color=\"primary\" (click)=\"publish()\">\u53D1\u5E03\u8BFE\u7A0B</button>\n </div>\n }\n </div>\n <div class=\"w-full\">\n <router-outlet></router-outlet>\n </div>\n</div>\n", styles: [".manage-active{background-color:var(--rt-10-percent-layer, rgba(0, 0, 0, .05));box-shadow:4px 0 var(--rt-base-background-inverse, #000) inset;font-weight:600}@media (max-width: 768px){.manage-active{box-shadow:inset 0 -4px 0 0 var(--rt-base-background-inverse, #000)}}\n"], dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
2994
- }
2995
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: CourseManageLayoutComponent, decorators: [{
2996
- type: Component,
2997
- args: [{ selector: 'rolatech-course-manage-layout', standalone: true, imports: [RouterLink, RouterLinkActive, MatButtonModule, RouterOutlet, CourseManageContentComponent], template: "<div class=\"flex flex-col md:flex-row m-auto\">\n <div\n class=\"min-w-[256px] px-3 flex flex-row md:flex-col md:h-full items-center md:items-start h-16 overflow-x-scroll overflow-y-hidden scrollbar-hide whitespace-pre\"\n >\n <div class=\"flex flex-row md:flex-col md:w-full\">\n <div class=\"hidden md:flex text-xl font-bold h-14 items-center px-2\">\u8BFE\u7A0B\u4FE1\u606F</div>\n <a routerLink=\"./info\" routerLinkActive=\"manage-active\" class=\"p-2\">\u57FA\u672C\u4FE1\u606F</a>\n <a routerLink=\"./media\" routerLinkActive=\"manage-active\" class=\"p-2\">\u56FE\u7247</a>\n <a routerLink=\"./details\" routerLinkActive=\"manage-active\" class=\"p-2\">\u8BE6\u60C5</a>\n </div>\n <div class=\"flex flex-row md:flex-col md:w-full\">\n <div class=\"hidden md:flex text-xl font-bold h-14 items-center px-2\">\u8BFE\u7A0B\u5185\u5BB9</div>\n <a routerLink=\"./section\" routerLinkActive=\"manage-active\" class=\"p-2\">\u7AE0\u8282</a>\n <a routerLink=\"./schedule\" routerLinkActive=\"manage-active\" class=\"p-2\">\u8BFE\u8868</a>\n </div>\n <div class=\"flex flex-row md:flex-col md:w-full\">\n <div class=\"hidden md:flex text-xl font-bold h-14 items-center px-2\">\u5176\u4ED6\u4FE1\u606F</div>\n <a routerLink=\"./pricing\" routerLinkActive=\"manage-active\" class=\"p-2\">\u4EF7\u683C</a>\n </div>\n\n @if (isDraft) {\n <div class=\"md:mt-6 ml-3 md:ml-2\">\n <!-- <button mat-stroked-button (click)=\"publish()\">\u9884\u89C8</button> -->\n <button mat-flat-button (click)=\"submitForReview()\">\u63D0\u4EA4\u5BA1\u6838</button>\n </div>\n }\n\n @if (accepted) {\n <div class=\"md:mt-6 md:ml-2\">\n <button mat-flat-button color=\"primary\" (click)=\"publish()\">\u53D1\u5E03\u8BFE\u7A0B</button>\n </div>\n }\n </div>\n <div class=\"w-full\">\n <router-outlet></router-outlet>\n </div>\n</div>\n", styles: [".manage-active{background-color:var(--rt-10-percent-layer, rgba(0, 0, 0, .05));box-shadow:4px 0 var(--rt-base-background-inverse, #000) inset;font-weight:600}@media (max-width: 768px){.manage-active{box-shadow:inset 0 -4px 0 0 var(--rt-base-background-inverse, #000)}}\n"] }]
2998
- }], ctorParameters: () => [] });
2999
-
3000
- const courseManageRoutes = [
3001
- {
3002
- path: '',
3003
- component: CourseManageLayoutComponent,
3004
- children: [
3005
- {
3006
- path: 'info',
3007
- component: CourseManageInfoComponent,
3008
- },
3009
- {
3010
- path: 'media',
3011
- component: CourseManageMediaComponent,
3012
- },
3013
- {
3014
- path: 'details',
3015
- component: CourseManageDetailsComponent,
3016
- },
3017
- {
3018
- path: 'pricing',
3019
- component: CourseManagePricingComponent,
3020
- },
3021
- {
3022
- path: 'schedule',
3023
- component: CourseManageScheduleComponent,
3024
- },
3025
- {
3026
- path: 'section',
3027
- component: CourseManageSectionComponent,
3028
- },
3029
- ],
3030
- },
3031
- ];
3032
-
3033
- /**
3034
- * Generated bundle index. Do not edit.
3035
- */
3036
-
3037
- export { CourseDetailsComponent as A, CourseMediaOwnerRendererComponent as B, CourseService as C, CourseSectionLectureVideoDialogComponent as D, ScheduleItemComponent as E, DetailItemComponent as F, PricingItemComponent as P, ScheduleDate as S, CategoryService as a, CourseItemComponent as b, courseRoutes as c, courseManageRoutes as d, CourseStatus as e, CourseRequestStatus as f, CourseType as g, CourseReviewStatus as h, CourseSectionLectureContentType as i, CoursePreviewComponent as j, CourseInfoComponent as k, CourseMediaComponent as l, CoursePricingComponent as m, CourseActionComponent as n, CourseScheduleComponent as o, provideAngularCourse as p, CourseSectionsComponent as q, CourseSectionItemComponent as r, CourseSectionLectureItemComponent as s, CourseSectionLectureVideoItemComponent as t, CoursePricingAddDialogComponent as u, CourseScheduleAddDialogComponent as v, CoursePricingDialogComponent as w, CourseScheduleDialogComponent as x, CourseDetailsDialogComponent as y, CourseEditDialogComponent as z };
3038
- //# sourceMappingURL=rolatech-angular-course-rolatech-angular-course-DzJibnO6.mjs.map