1const apiUrlConfig = { 2 dev: "http://192.168.1.103:8004", 3 uat: "https://chatuat.uoocuniversity.com/backend-api", 4 prod: "https://chat.uoocuniversity.com/backend-api", 5}; 6const env = location.host.startsWith("210") 7 ? "dev" 8 : location.host.startsWith("beta") 9 ? "uat" 10 : "prod"; 11const apiUrl = apiUrlConfig[env]; 12 13// é¢è§è§é¢ 14app.directive("chapterVideo", [ 15 "courseService", 16 "$rootScope", 17 "$filter", 18 "$compile", 19 "$timeout", 20 function (courseService, $rootScope, $filter, $compile, $timeout) { 21 return { 22 restrict: "AE", 23 scope: { 24 source: "=", 25 }, 26 require: "?^sourceManage", 27 templateUrl: "/tpl/teacher/chapter-4c2837f37b.source.video.html", // 页é¢å 鍿¨¡æ¿ 28 link: function (scope, element, attrs, sourceManage) { 29 scope.updateResource = sourceManage.updateResource; 30 scope.visibleShow = sourceManage.visibleShow; 31 scope.sourceView = sourceManage.sourceView; 32 scope.updateResTask = sourceManage.updateResTask; 33 scope.staticRoot = window.staticRoot; 34 35 // ä» ä¸ºé¢è§ 36 scope.justview = angular.isDefined(attrs.justview); 37 38 // å®ä¹äºopenedåé»è®¤è®¾ç½®ä¸ºæå¼ 39 scope.source.visibleShow = angular.isDefined(attrs.opened); 40 41 // 黿¢å泡 42 scope.stopBubble = function ($event) { 43 $event.stopPropagation(); // 黿¢å泡 44 }; 45 46 // ä»åºä¸éæ©æä»¶æ¿æ¢ 47 scope.replaceFile = function (source) { 48 scope.$emit("replaceFile", source); 49 }; 50 51 scope.$watch("source.uri", function () { 52 scope.sourceView(scope.source); 53 }); 54 55 /** 56 * 跳转è§é¢æå®æ¶é´ 57 * @param {*} sliceTime åä½ï¼ç§ 58 */ 59 scope.jumpSlice = function (sliceTime) { 60 if (scope.player && !scope.isDragging) { 61 scope.player.currentTime(sliceTime); 62 } 63 }; 64 65 let manualScrollingLock = false; 66 let manualLockTimer = null; 67 68 function lockManualScroll() { 69 manualScrollingLock = true; 70 clearTimeout(manualLockTimer); 71 manualLockTimer = setTimeout( 72 () => (manualScrollingLock = false), 73 3000 74 ); 75 } 76 // è§é¢åçå·¦å/å³å 77 scope.moveSlice = function (direction) { 78 const el = document.querySelector( 79 `.video_slice_content_center_${scope.source.id}` 80 ); 81 if(!el) return 82 const itemWidth = el.querySelector( 83 `.video_slice_content_center_${scope.source.id} .video_slice_content_center_item` 84 ).offsetWidth; 85 lockManualScroll(); 86 el.scrollTo({ 87 left: el.scrollLeft + itemWidth * direction, 88 behavior: "smooth", 89 }); 90 }; 91 92 // è§é¢åçæ°æ® 93 scope.sliceData = { 94 startM: "", 95 startS: "", 96 endM: "", 97 endS: "", 98 pointName: "", 99 pointId: "", 100 }; 101 102 // åçä»»å¡ç¶æï¼PENDING-å¾ å¤çï¼PROCESSING-å¤çä¸ï¼COMPLETED-已宿ï¼FAILED-失败 103 scope.sliceStatus = ""; 104 105 // AIè§é¢åçå表 106 scope.slices = []; 107 // æ¯å¦å¼å¯AIè§é¢åçæé 108 scope.aiSliceAuthority = false; 109 // æ¯å¦å¼å¯è¯¾ç¨å¾è°±æé 110 scope.aiGraphAuthority = false; 111 112 // éæ©ç¥è¯ç¹å¼¹çªæ°æ® 113 scope.pointData = { 114 name: "", 115 id: "", 116 }; 117 118 scope.point = { 119 searchValue: "", // æç´¢ç¥è¯ç¹ 120 }; 121 // ç¥è¯ç¹å表 122 scope.pointList = []; 123 // çéåçç¥è¯ç¹å表 124 scope.filteredPointList = []; 125 126 // æç´¢ç¥è¯ç¹ 127 scope.searchPoint = function (searchPoint) { 128 scope.filteredPointList = scope.pointList.filter((point) => { 129 return point.name.includes(searchPoint); 130 }); 131 }; 132 133 // è·åç¥è¯ç¹å表 134 scope.getPointList = function () { 135 const uooc_auth = document.cookie.match(/uooc_auth=(.*?);/)[1]; 136 $.get({ 137 url: `${location.origin}/teacher/course/getAiToken?course_id=${$rootScope.courseId}`, 138 headers: { 139 Authorization: "Bearer " + uooc_auth, 140 }, 141 success: function (res) { 142 const aiToken = res.data.Authorization; 143 $.get({ 144 url: `${apiUrl}/knowledge_graph/getPointAndRelationList?courseId=${$rootScope.courseId}&packageCourseId=${$rootScope.parent}`, 145 headers: { 146 Authorization: aiToken, 147 }, 148 success: function (res) { 149 // æµè¯æ°æ® 150 // res.data.pointVOList = JSON.parse( 151 // localStorage.getItem("testPoints") 152 // ); 153 // æµè¯æ°æ® 154 scope.pointList = res.data?.pointVOList || []; 155 }, 156 }); 157 }, 158 }); 159 }; 160 161 scope.getPointList(); 162 163 // å°ç§æ°è½¬æ¢ä¸º 00:00 æ ¼å¼ 164 scope.toMinuteString = (seconds = 0) => { 165 const m = Math.floor(seconds / 60); 166 const s = seconds % 60; 167 return `${m.toString().padStart(2, "0")}:${s 168 .toString() 169 .padStart(2, "0")}`; 170 }; 171 172 // è·åå½åè§é¢æ¶é´ 173 scope.getVideoTime = function () { 174 var vtime = parseInt(scope.source.viewOpts.currentTime) || 0; // è§é¢æ¶é´ç§ 175 var timerObj = $filter("timerObj")(vtime); // è½¬ææ¶åç§å¯¹è±¡ 176 scope.sliceData.startM = timerObj.hours * 60 + timerObj.minutes; 177 scope.sliceData.startS = timerObj.seconds; 178 }; 179 180 // éæ°çæåç 181 scope.retrySlice = function () { 182 courseService.buildCourseSliceResApi({ 183 cid: $rootScope.courseId, 184 rid: scope.source.id 185 }).then(function () { 186 layer.msg('éè¯æå'); 187 scope.sliceStatus = 'PROCESSING'; 188 }) 189 }; 190 191 // æå¼ç¥è¯ç¹å表 192 scope.openPointList = () => { 193 scope.point.searchValue = ""; 194 scope.searchPoint(""); 195 $(`#video_slice_point_list_${scope.source.id}`).toggle(); 196 }; 197 198 // ç¹å»éæ©ç¥è¯ç¹ 199 scope.selectPoint = function (point) { 200 scope.pointData = { 201 name: point.name, 202 id: point.id, 203 }; 204 $(`#video_slice_point_list_${scope.source.id}`).hide(); 205 }; 206 207 // çå¬ä¿®æ¹åçåç§° 208 scope.onPointNameInput = function (pointName) { 209 const point = scope.pointList.find((item) => item.name == pointName); 210 scope.pointData = { 211 name: point?.name || "", 212 id: point?.id || "", 213 }; 214 scope.sliceData = { 215 ...scope.sliceData, 216 pointId: scope.pointData.id, 217 }; 218 }; 219 220 // æå¼éæ©ç¥è¯ç¹å¼¹çª 221 scope.openAddPoint = function () { 222 const point = 223 scope.pointList.find( 224 (item) => item.id == scope.sliceData?.pointId 225 ) || {}; 226 227 scope.pointData = { 228 name: point?.name || "", 229 id: point?.id || "", 230 }; 231 $(`#video_slice_point_list_${scope.source.id}`).hide(); 232 layer.open({ 233 type: 1, 234 title: "éæ©ç¥è¯ç¹", 235 area: ["400px", "400px"], 236 content: $(`#video_slice_point_${scope.source.id}`), 237 btn: ["确认", "åæ¶"], 238 yes: function (index) { 239 if (scope.pointData.name === "") return layer.msg("è¯·éæ©ç¥è¯ç¹"); 240 scope.sliceData = { 241 ...scope.sliceData, 242 pointName: scope.pointData.name, 243 pointId: scope.pointData.id, 244 }; 245 scope.$digest(); 246 layer.close(index); // å ³éå¼¹çª 247 }, 248 btn2: function (index) {}, 249 }); 250 }; 251 252 // æ°å¢åç 253 scope.addSlice = ($event) => { 254 scope.sliceData = { 255 startM: "", 256 startS: "", 257 endM: "", 258 endS: "", 259 pointName: "", 260 pointId: "", 261 }; 262 $event.stopPropagation(); 263 scope.openAddSlice(); 264 }; 265 266 // ç¼è¾åç 267 scope.editSlice = ($event, sliceItem) => { 268 scope.sliceData = { 269 startM: Math.floor(sliceItem.startTime / 60), 270 startS: sliceItem.startTime % 60, 271 endM: Math.floor(sliceItem.endTime / 60), 272 endS: sliceItem.endTime % 60, 273 pointName: sliceItem.knowledgePointName, 274 pointId: sliceItem.knowledgePointId, 275 slice_index: sliceItem.sliceIndex, 276 }; 277 $event.stopPropagation(); 278 scope.openAddSlice(); 279 }; 280 281 // æå¼æ°å¢/ç¼è¾åçå¼¹çª 282 scope.openAddSlice = () => { 283 layer.open({ 284 type: 1, 285 title: "ç¼è¾å 容", 286 area: ["580px", "320px"], 287 btn: ["确认", "åæ¶"], 288 content: $(`#video_slice_edit_${scope.source.id}`), 289 yes: function (index) { 290 const sd = scope.sliceData; 291 292 // ======== å¿ å¡«æ ¡éªï¼0 è§ä¸ºåæ³ï¼======== 293 if ( 294 sd.startM === null || 295 sd.startM === undefined || 296 sd.startM === "" || 297 sd.endM === null || 298 sd.endM === undefined || 299 sd.endM === "" || 300 sd.startS === null || 301 sd.startS === undefined || 302 sd.startS === "" || 303 sd.endS === null || 304 sd.endS === undefined || 305 sd.endS === "" 306 ) { 307 return layer.msg("请è¾å ¥å®æ´çæ¶é´"); 308 } 309 310 // ======== ç§æ°èå´ 0-59 ======== 311 if ( 312 sd.startS < 0 || 313 sd.startS > 59 || 314 sd.endS < 0 || 315 sd.endS > 59 316 ) { 317 return layer.msg("ç§æ°å¿ é¡»å¨ 0-59 ä¹é´"); 318 } 319 320 // ======== å¼å§æ¶é´ â¤ ç»ææ¶é´ ======== 321 const startTotal = Number(sd.startM) * 60 + Number(sd.startS); 322 const endTotal = Number(sd.endM) * 60 + Number(sd.endS); 323 324 if (startTotal > endTotal) { 325 return layer.msg("å¼å§æ¶é´ä¸è½å¤§äºç»ææ¶é´"); 326 } 327 328 // ç»ææ¶é´ä¸è½è¶ è¿è§é¢æ¶é¿ 329 if (endTotal > scope.player.duration()) { 330 return layer.msg("ç»ææ¶é´ä¸è½è¶ è¿è§é¢æ¶é¿"); 331 } 332 333 // ======== ç¥è¯ç¹å¿ å¡« ======== 334 if (!sd.pointName) return layer.msg("请è¾å ¥ç¥è¯ç¹"); 335 336 const api = !sd.slice_index && sd.slice_index != 0 ? courseService.addCourseSliceDataApi : courseService.upCourseSliceDataApi; 337 338 api({ 339 cid: $rootScope.courseId, 340 rid: scope.source.id, 341 slice_index: sd.slice_index, 342 point_id: sd.pointId, 343 point_name: sd.pointName, 344 start_time: startTotal, 345 end_time: endTotal, 346 }) 347 .then((res) => { 348 layer.msg("ä¿åæå"); 349 scope.getSliceList(); 350 }) 351 .finally(() => { 352 layer.close(index); 353 }); 354 }, 355 356 btn2: function (index) {}, 357 }); 358 }; 359 360 // å é¤åç 361 scope.removeSlice = ($event, sliceItem) => { 362 $event.stopPropagation(); 363 layer.confirm( 364 `<div> 365 <div style="font-weight: bold">确认å é¤è¯¥åçï¼</div> 366 <div style="color: #999;margin-top: 6px;">å é¤åä¸å¯æ¢å¤</div> 367 </div>`, 368 { 369 title: "æç¤º", 370 icon: 3, 371 btn: ["确认", "åæ¶"], 372 success: function (layero, index) {}, 373 }, 374 function (index) { 375 courseService 376 .delCourseSliceDataApi({ 377 cid: $rootScope.courseId, 378 rid: scope.source.id, 379 slice_index: sliceItem.sliceIndex, 380 }) 381 .then((res) => { 382 layer.msg("å 餿å"); 383 scope.getSliceList(); 384 }) 385 .finally(() => { 386 layer.close(index); 387 }); 388 }, 389 function (index) {} 390 ); 391 }; 392 393 // è·ååçå表 394 scope.getSliceList = () => { 395 courseService 396 .getCourseSliceDataTeacherApi({ 397 cid: scope.source.cid, 398 rid: scope.source.id, 399 }) 400 .then((res) => { 401 // æµè¯æ°æ® 402 // res.data = JSON.parse(localStorage.getItem("testSlices")); 403 // æµè¯æ°æ® 404 scope.aiSliceAuthority = !JSON.parse( 405 localStorage.getItem("aiConfig") || "{}" 406 )["1011"]; 407 scope.aiGraphAuthority = !JSON.parse( 408 localStorage.getItem("aiConfig") || "{}" 409 )["1005"] 410 scope.sliceStatus = res.data.status; 411 // åç以å¼å§æ¶é´æåº 412 scope.slices = res.data?.slices?.sort((a, b) => a.startTime - b.startTime) || []; 413 scope.onMousemove(); 414 }); 415 }; 416 417 // çå¬é¼ æ æ»å¨åç 418 scope.onMousemove = function (e) { 419 $timeout(() => { 420 // çå¬é¼ æ æ»å¨AIè§é¢åç 421 const el = document.querySelector( 422 `.video_slice_content_center_${scope.source.id}` 423 ); 424 425 if (!el) return; 426 427 let isDown = false;
428 let startX; 429 let scrollLeft; 430 scope.isDragging = false; 431 432 el.addEventListener("mousedown", (e) => { 433 isDown = true; 434 el.classList.add("dragging"); 435 startX = e.pageX - el.offsetLeft; 436 scrollLeft = el.scrollLeft; 437 scope.isDragging = false; 438 }); 439 el.addEventListener("mouseleave", () => { 440 isDown = false; 441 el.classList.remove("dragging"); 442 }); 443 el.addEventListener("mouseup", () => { 444 isDown = false; 445 el.classList.remove("dragging"); 446 }); 447 el.addEventListener("mousemove", (e) => { 448 if (!isDown) return; 449 e.preventDefault(); 450 lockManualScroll(); 451 const x = e.pageX - el.offsetLeft; 452 const walk = x - startX; 453 if (Math.abs(walk) > 5) { 454 scope.isDragging = true; 455 } 456 el.scrollLeft = scrollLeft - walk; 457 }); 458 }, 0); 459 }; 460 461 scope.$on("playerInit", function (e, player) { 462 scope.player = player; 463 464 scope.getSliceList(); 465 466 player.on("play", function () { 467 // courseService.updateVideoLength({ 468 // 'cid': $rootScope.courseId, 469 // 'hidemsg_': true, 470 // 'resource_id': scope.source.id, 471 // 'video_length': player.duration().toFixed(2) 472 // }); 473 }); 474 player.on("timeupdate", function (e) { 475 // æ¾å°å½åææ¾çè§é¢åç 476 if (scope.slices?.length) { 477 let targetId = ""; 478 scope.slices.forEach((item) => { 479 if ( 480 scope.source.viewOpts.currentTime >= item.startTime && 481 scope.source.viewOpts.currentTime <= item.endTime 482 ) { 483 targetId = `${item.sliceIndex}_${item.startTime}_slice`; 484 } 485 }); 486 // if (!manualScrollingLock && targetId) { 487 // let target = document.getElementById(targetId); 488 // if (target) { 489 // target.scrollIntoView({ 490 // behavior: "smooth", 491 // }); 492 // } 493 // } 494 } 495 }); 496 }); 497 498 // 妿é»è®¤åå¨opened, åé¢è§ 499 if (scope.source.opened) { 500 scope.source.visibleShow = true; // é¢è§ 501 scope.sourceView(scope.source); 502 503 setTimeout(function () { 504 var offsetTop = angular.element(element).offset().top; 505 $("html,body").scrollTop(offsetTop); 506 }, 30); 507 } 508 509 // ä¸ä¼ åå¹ 510 scope.uploadTrack = function (source) { 511 scope.$emit("uploadTrack", source); 512 }; 513 514 /** 515 * æ·»å æ´æ°å°æµ 516 */ 517 518 // å°æµå表 519 scope.quizList = []; 520 521 // è·åå°æµå表 522 scope.getQuizlist = function () { 523 scope.loadding = true; 524 courseService 525 .quizlist({ 526 cid: $rootScope.courseId, 527 resource_id: scope.source.id, 528 load: false, 529 }) 530 .then(function (rdata) { 531 scope.loadding = false; 532 var quizList_ = rdata.data || []; 533 scope.quizList = []; 534 535 angular.forEach(quizList_, function (quiz) { 536 var timerObj = $filter("timerObj")(quiz.set_time); 537 quiz.minutes = timerObj.hours * 60 + timerObj.minutes; 538 quiz.seconds = timerObj.seconds; 539 scope.quizList.push(quiz); 540 }); 541 }); 542 }; 543 544 // ç嬿¯å¦ä¸ºå±å¼ 545 scope.$watch("source.visibleShow", function (e, visibleShow) { 546 if (scope.source.visibleShow) { 547 scope.getQuizlist(); 548 } 549 }); 550 551 // æ·»å æ°çå°æµ 552 scope.addEmptyQuiz = function (type) { 553 var cdata = { 554 id: 0, 555 type: type, 556 pattern: 20, 557 set_time: parseInt(scope.source.viewOpts.currentTime) || 0, 558 question: "", 559 minutes: 0, 560 seconds: 0, 561 options: JSON.stringify({ 562 A: type == 20 ? "æ£ç¡®" : "", 563 B: type == 20 ? "é误" : "", 564 }), 565 }; 566 scope.applyVideoTime(cdata); 567 scope.layerQuiz(cdata); 568 }; 569 570 // ç¼è¾å°æµ 571 scope.layerQuiz = function (quizItem) { 572 scope.curTestSource = angular.copy(quizItem); 573 scope.curTestSource.old_ = quizItem; 574 var ele = angular.element("#testLayer"); 575 576 ele 577 .find(".questionSub") 578 .html( 579 '<div ng-if="curTestSource" question-common question-object qsource="curTestSource" pattern="20"></div>' 580 ); 581 $compile(ele.contents())(scope); 582 583 layer.open({ 584 type: 1, 585 zIndex: 99, 586 move: false, 587 scrollbar: false, 588 title: quizItem.id ? "æ´æ°å°æµ" : "æ·»å å°æµ", 589 area: ["600px", "540px"], 590 content: ele, 591 }); 592 }; 593 594 scope.quizListLib = []; // åºä¸çå°æµ 595 596 // åºä¸å°æµçéååé¡µæ°æ® 597 scope.quizSearch = { 598 cid: $rootScope.courseId, 599 keyword: "", 600 type: 0, 601 page: 1, 602 pagesize: 7, 603 }; 604 605 // åºä¸æ·»å å°æµè®¡æ¶å¨ 606 scope.libTimer = { 607 set_time: 0, 608 minutes: 0, 609 seconds: 0, 610 }; 611 // è·ååºä¸å°æµå表 612 scope.getLibQuizlist = function (page) { 613 scope.applyVideoTime(scope.libTimer); 614 scope.quizSearch.page = page || scope.quizSearch.page; 615 courseService 616 .quizQuestionList(scope.quizSearch) 617 .then(function (rdata) { 618 scope.quizListLib = rdata.data.data; 619 scope.quizSearch.pages = rdata.data.page.pages; 620 }); 621 }; 622 623 // çéé¢å 624 scope.typeSearch = function (type) { 625 scope.quizSearch.type = type || 0; 626 scope.getLibQuizlist(1); 627 }; 628 629 // è·ååºä¸æµéªå表
630 scope.getQuizFromLib = function () { 631 scope.applyVideoTime(scope.libTimer); 632 layer.open({ 633 type: 1, 634 move: false, 635 scrollbar: false, 636 title: "é¢åºéé¢", 637 area: ["860px", "600px"], 638 content: angular.element(element).find("#quizlib"), 639 }); 640 scope.quizSearch.type = 0; 641 scope.quizSearch.keyword = ""; 642 scope.getLibQuizlist(); 643 }; 644 645 // å ³é®åæç´¢ 646 // scope.keywordSearch = function(type){ 647 // scope.quizSearch.type = type || 0; 648 // }; 649 650 // æ·»å å°æµä»åº 651 scope.addQuizFromLib = function (qsource) { 652 qsource.minutes = parseInt(scope.libTimer.minutes) || 0; 653 qsource.seconds = parseInt(scope.libTimer.seconds) || 0; 654 qsource.set_time = qsource.minutes * 60 + qsource.seconds; 655 656 courseService 657 .pullQuiz({ 658 id: 0, 659 qid: qsource.id, 660 cid: $rootScope.courseId, 661 resource_id: scope.source.id, 662 set_time: qsource.set_time, 663 }) 664 .then(function (rdata) { 665 layer.closeAll(); 666 layer.msg("æ·»å æå"); 667 668 qsource.id = rdata.data.id; 669 scope.quizList.push(qsource); 670 }); 671 }; 672 673 // åºç¨å½åè§é¢çææ¾æ¶é´ 674 scope.applyVideoTime = function (qsource) { 675 var vtime = parseInt(scope.source.viewOpts.currentTime) || 0; // è§é¢æ¶é´ç§ 676 var timerObj = $filter("timerObj")(vtime); // è½¬ææ¶åç§å¯¹è±¡ 677 qsource.set_time = vtime; 678 qsource.minutes = timerObj.hours * 60 + timerObj.minutes; 679 qsource.seconds = timerObj.seconds; 680 }; 681 682 // ä¸è½ä¸ºåæ¯ä¸å ¶ä»ç¹æ®å符 683 scope.onlyNumber = function (e) { 684 var ss = window.event || e; 685 var kcode = ss.keyCode; 686 if ( 687 (kcode > 64 && kcode < 91) || 688 (kcode > 105 && kcode < 108) || 689 (kcode > 108 && kcode < 112) || 690 (kcode >= 186 && kcode <= 222) 691 ) { 692 ss.preventDefault(); 693 } 694 }; 695 696 // ç¹å»ç¡®å®æ·»å å°æµ 697 scope.$on("sureQuestion", function (e, qsource, qscope) { 698 var isUpdate = qsource.id; // 妿ä¸åå¨idåä¸ºæ´æ°, å¦å为æ°å¢ 699 700 if ( 701 isNaN(qsource.minutes) || 702 isNaN(qsource.minutes) || 703 qsource.seconds > 60 704 ) { 705 layer.msg("请è¾å ¥åæ³çæ¶é´"); 706 return; 707 } 708 709 qsource.minutes = parseInt(qsource.minutes) || 0; 710 qsource.seconds = parseInt(qsource.seconds) || 0; 711 qsource.set_time = qsource.minutes * 60 + qsource.seconds; 712 713 if (qsource.set_time > 4 * 3600) { 714 layer.msg("å°æµå 许æå¤§æ¶é¿ä¸º4å°æ¶(240åé)"); 715 return false; 716 } 717 718 // è§£æanswer 719 var answer_; 720 if (qsource.type == 10 || qsource.type == 20) { 721 // åé 722 answer_ = [qsource.eanswer]; 723 } else if (qsource.type == 11) { 724 // å¤éé¢ 725 answer_ = qsource.answer.split(","); 726 qsource.answer = answer_; 727 } 728 729 var options_ = { 730 id: qsource.id || 0, 731 cid: $rootScope.courseId, 732 resource_id: scope.source.id, 733 set_time: qsource.set_time, 734 minutes: qsource.minutes, 735 seconds: qsource.seconds, 736 question: qsource.question, 737 type: qsource.type, 738 options: JSON.stringify(qsource.voptions), 739 answer: JSON.stringify(answer_), 740 }; 741 742 // æ·»å quiz 743 courseService.addQuiz(options_).then(function (rdata) { 744 qscope.updateView(qsource); 745 layer.closeAll(); 746 if (isUpdate) { 747 layer.msg("æ´æ°æå"); 748 qsource.id = qsource.id || rdata.data.id; 749 } else { 750 layer.msg("æ·»å æå"); 751 options_.id = rdata.data.id; 752 scope.quizList.push(options_); 753 } 754 }); 755 }); 756 757 scope.$on("delQuestion", function (e, qsource) { 758 if (qsource.id) { 759 // 妿åå¨idåæ·»å è¯¢é® 760 layer.confirm( 761 "ç¡®å®å é¤å½åå°æµ?", 762 { 763 btn: ["ç¡®å®", "åæ¶"], //æé® 764 }, 765 function () { 766 courseService 767 .delQuiz({ 768 id: qsource.id, 769 }) 770 .then(function () { 771 qsource.hidesource = true; 772 layer.closeAll(); 773 }); 774 }, 775 function () { 776 layer.closeAll(); 777 } 778 ); 779 } else { 780 qsource.hidesource = true; 781 } 782 }); 783 784 scope.$on("editQuestion", function (e, qsource) {
785 scope.layerQuiz(qsource); 786 }); 787 788 // å é¤èµæº 789 scope.delSource = function (curSource) { 790 var options = curSource.options || {}, 791 data = curSource.data || {}; 792 layer.confirm( 793 "ç¡®å®å é¤å½ååå¹?", 794 { 795 area: ["260px", "150px"], 796 btn: ["ç¡®å®", "åæ¶"], //æé® 797 }, 798 function () { 799 courseService 800 .delResource({ 801 cid: $rootScope.courseId, 802 id: curSource.id || options.id || data.id, 803 }) 804 .then(function () { 805 layer.closeAll(); 806 curSource.hide = true; 807 }); 808 } 809 ); 810 }; 811 }, 812 }; 813 }, 814]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.