瀏覽代碼

模板修改

dsy 2 周之前
父節點
當前提交
2a81fa33a0

+ 13 - 0
src/api/template.js

@@ -46,3 +46,16 @@ export function UpdateTemplateStatus(data) {
 export function GetTemplateInfo(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=template_manager-GetTemplateInfo`, data);
 }
+
+/**
+ * 得到模板章节结构展开列表
+ * @param {Object} data 数据
+ * @param {String} data.template_id 模板ID
+ * @param {String} data.is_contain_root_node 是否包含根节点
+ */
+export function GetTemplateChapterStructExpandList(data) {
+  return http.post(
+    `${process.env.VUE_APP_EepServer}?MethodName=template_manager-GetTemplateChapterStructExpandList`,
+    data,
+  );
+}

+ 1 - 2
src/common/data.js

@@ -18,7 +18,6 @@ export const unified_title = {
   font_size: '14pt', // 字号
   text_color: '#1d2129', // 文字颜色
   bold: 'false', // 加粗
-  italic: 'false', //斜体
+  italic: 'false', // 斜体
   indent: 0, // 缩进
 };
-

+ 48 - 0
src/icons/svg/components/character.svg

@@ -0,0 +1,48 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
+ width="822.000000pt" height="825.000000pt" viewBox="0 0 822.000000 825.000000"
+ preserveAspectRatio="xMidYMid meet">
+
+<g transform="translate(0.000000,825.000000) scale(0.100000,-0.100000)"
+fill="#000000" stroke="none">
+<path d="M1480 8235 c-491 -68 -911 -325 -1197 -731 -73 -105 -184 -334 -222
+-459 -66 -220 -62 16 -59 -2955 l3 -2695 32 -110 c89 -313 233 -563 449 -779
+283 -282 639 -451 1046 -495 129 -14 5013 -15 5146 -1 516 54 974 328 1257
+750 116 174 198 360 253 580 l27 105 2 2648 3 2648 -25 123 c-93 460 -356 850
+-746 1106 -172 113 -376 197 -603 248 l-121 27 -2575 1 c-2074 2 -2593 0
+-2670 -11z m5185 -545 c530 -76 936 -485 1005 -1013 7 -57 10 -864 7 -2607 -3
+-2326 -4 -2530 -20 -2592 -107 -430 -389 -741 -786 -869 -194 -62 -50 -59
+-2766 -59 -2697 0 -2571 -2 -2755 56 -426 134 -739 501 -806 944 -21 143 -21
+5008 1 5151 77 514 477 913 990 988 86 12 5042 13 5130 1z"/>
+<path d="M3870 6675 c-60 -17 -114 -64 -126 -110 -14 -58 49 -167 200 -341
+172 -200 332 -341 437 -384 31 -13 24 -15 -182 -52 -317 -57 -912 -156 -1009
+-168 -47 -5 -99 -12 -116 -15 -30 -5 -31 -3 -77 88 -94 189 -228 257 -319 159
+-37 -39 -44 -57 -77 -186 -40 -157 -102 -299 -216 -496 -106 -184 -136 -263
+-137 -361 0 -113 32 -196 102 -266 48 -49 94 -67 170 -67 182 0 386 252 507
+626 41 126 42 128 118 128 71 0 331 38 785 114 688 116 1262 197 1494 212
+l108 7 -7 -24 c-12 -42 -82 -201 -134 -308 -39 -79 -51 -115 -51 -150 0 -94
+64 -158 145 -145 22 4 121 47 219 95 208 103 311 138 491 168 236 40 290 59
+325 115 47 77 14 185 -93 302 -147 160 -458 370 -637 429 -76 26 -166 23 -285
+-8 -55 -14 -194 -44 -310 -66 -261 -50 -592 -111 -600 -111 -4 0 13 15 36 33
+87 66 138 211 120 338 -30 210 -164 352 -406 429 -93 30 -387 39 -475 15z"/>
+<path d="M4505 5105 c-27 -7 -88 -31 -135 -53 -243 -115 -634 -199 -1015 -217
+-71 -3 -154 -13 -184 -21 -151 -43 -172 -196 -42 -317 97 -91 263 -167 363
+-167 71 0 114 13 239 70 164 76 769 273 786 257 11 -12 -224 -447 -241 -447
+-5 0 -58 16 -117 35 -117 38 -171 43 -222 21 -52 -22 -70 -49 -71 -109 -1 -68
+34 -129 111 -194 31 -26 72 -63 90 -81 33 -33 89 -120 82 -126 -5 -5 -766 -97
+-1209 -146 -446 -50 -778 -80 -873 -80 -214 0 -322 -60 -302 -166 18 -97 237
+-273 405 -325 82 -25 81 -25 545 66 592 118 984 184 1335 225 201 24 216 24
+224 4 19 -51 38 -236 43 -430 11 -417 -39 -777 -128 -921 -14 -22 -39 -43 -67
+-56 -40 -17 -58 -19 -141 -13 -53 4 -168 21 -256 37 -178 32 -249 36 -300 15
+-58 -25 -84 -111 -51 -174 19 -37 87 -99 170 -157 165 -115 399 -329 471 -430
+143 -198 278 -214 450 -54 105 98 205 260 269 430 84 228 119 403 137 684 18
+287 -11 727 -69 1027 l-19 97 76 7 c42 4 297 8 566 8 l490 1 165 -30 c141 -25
+191 -29 345 -29 194 -1 256 10 325 56 79 54 104 153 60 242 -45 94 -225 227
+-384 285 -88 31 -256 61 -348 61 -52 0 -376 -35 -593 -65 -327 -44 -707 -97
+-760 -105 -108 -18 -105 -19 -158 71 -26 45 -47 84 -47 88 0 9 178 174 274
+255 89 76 230 168 330 217 102 50 141 81 166 129 43 84 18 162 -84 268 -104
+109 -258 212 -373 251 -73 25 -244 28 -328 6z"/>
+</g>
+</svg>

+ 41 - 0
src/icons/svg/components/judge.svg

@@ -0,0 +1,41 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
+ width="824.000000pt" height="825.000000pt" viewBox="0 0 824.000000 825.000000"
+ preserveAspectRatio="xMidYMid meet">
+
+<g transform="translate(0.000000,825.000000) scale(0.100000,-0.100000)"
+fill="#000000" stroke="none">
+<path d="M3758 8230 c-166 -11 -457 -58 -644 -105 -506 -124 -984 -344 -1402
+-644 -960 -689 -1579 -1757 -1694 -2926 -17 -168 -16 -709 0 -880 50 -509 211
+-1051 442 -1490 494 -935 1327 -1645 2321 -1975 478 -159 880 -217 1429 -207
+286 6 431 18 655 56 1237 211 2314 997 2910 2126 215 405 370 904 429 1380 53
+424 35 994 -44 1382 -87 424 -216 784 -414 1150 -250 463 -619 908 -1021 1232
+-627 504 -1321 795 -2130 891 -121 15 -667 21 -837 10z m689 -411 c1411 -115
+2622 -1032 3146 -2379 43 -110 85 -248 126 -415 85 -342 116 -622 108 -980
+-10 -400 -49 -665 -150 -1005 -66 -222 -116 -348 -227 -575 -353 -720 -931
+-1302 -1655 -1666 -529 -265 -1071 -392 -1685 -392 -484 0 -933 87 -1395 270
+-632 250 -1209 700 -1600 1248 -333 465 -532 922 -639 1469 -52 259 -61 367
+-61 716 0 340 8 438 56 695 211 1140 949 2119 1992 2641 390 196 834 325 1262
+369 161 16 551 19 722 4z"/>
+<path d="M4015 6986 c-45 -17 -115 -87 -229 -229 -41 -51 -109 -135 -152 -187
+-290 -354 -1188 -1467 -1227 -1521 l-17 -24 -39 45 c-22 25 -174 218 -338 430
+-164 212 -321 408 -349 436 -109 108 -258 109 -364 2 -47 -46 -70 -103 -70
+-171 0 -98 -3 -93 290 -467 732 -935 693 -889 763 -921 76 -34 184 -22 249 28
+47 36 34 21 1535 1887 134 165 255 325 269 354 60 119 10 267 -110 329 -43 22
+-160 27 -211 9z"/>
+<path d="M5356 6335 c-71 -27 -105 -56 -165 -138 -112 -156 -2595 -3887 -2625
+-3944 -41 -80 -26 -193 35 -267 40 -48 138 -96 194 -95 48 0 115 26 159 61 18
+15 73 86 123 160 317 470 1299 1940 1574 2358 96 146 352 533 570 860 217 327
+408 618 425 645 25 43 29 60 29 121 -1 58 -6 78 -28 116 -62 106 -191 161
+-291 123z"/>
+<path d="M4745 3607 c-122 -58 -179 -206 -124 -327 14 -33 98 -124 317 -342
+l297 -298 -297 -297 c-216 -217 -302 -310 -317 -343 -25 -55 -27 -145 -6 -198
+20 -47 78 -107 130 -135 57 -30 154 -29 215 2 29 15 152 130 340 317 l296 294
+289 -290 c294 -294 341 -333 422 -346 134 -21 283 110 283 250 0 102 -24 133
+-343 454 l-291 292 291 293 c294 295 326 334 339 415 22 140 -107 282 -257
+282 -96 0 -125 -23 -445 -342 l-291 -290 -278 281 c-152 154 -300 295 -328
+313 -43 28 -62 33 -122 36 -57 2 -79 -1 -120 -21z"/>
+</g>
+</svg>

+ 56 - 0
src/icons/svg/components/new_word.svg

@@ -0,0 +1,56 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
+ width="825.000000pt" height="826.000000pt" viewBox="0 0 825.000000 826.000000"
+ preserveAspectRatio="xMidYMid meet">
+
+<g transform="translate(0.000000,826.000000) scale(0.100000,-0.100000)"
+fill="#000000" stroke="none">
+<path d="M1515 8243 c-194 -25 -373 -81 -560 -173 -180 -90 -302 -177 -446
+-320 -261 -260 -419 -566 -485 -940 -18 -100 -19 -218 -19 -2680 0 -2462 1
+-2580 19 -2680 66 -375 227 -685 490 -945 141 -139 264 -227 441 -315 158 -78
+279 -120 439 -153 l111 -22 2630 0 2630 0 102 23 c215 47 447 143 610 253 430
+287 705 739 763 1254 14 123 14 5047 0 5170 -24 215 -77 394 -175 590 -216
+434 -604 754 -1072 885 -226 64 -58 60 -2879 59 -1413 -1 -2582 -4 -2599 -6z
+m5313 -575 c225 -67 386 -162 542 -320 167 -170 286 -413 319 -652 15 -108 15
+-5024 0 -5132 -33 -239 -152 -482 -319 -652 -156 -158 -317 -253 -542 -320
+l-93 -27 -2573 -3 c-2569 -2 -2573 -2 -2675 18 -219 45 -406 143 -570 299
+-182 173 -299 386 -348 636 -21 104 -21 5126 0 5230 93 472 450 837 911 934
+94 19 133 20 2675 18 l2580 -2 93 -27z"/>
+<path d="M2310 7019 c-161 -28 -215 -120 -150 -254 29 -60 88 -120 236 -237
+266 -212 558 -408 658 -442 86 -29 162 9 214 108 24 46 27 62 27 151 0 79 -5
+115 -24 170 -63 188 -162 304 -318 376 -232 108 -480 157 -643 128z"/>
+<path d="M5700 6701 c-25 -11 -79 -37 -120 -59 -96 -52 -213 -86 -425 -122
+-248 -42 -713 -84 -1172 -106 l-143 -7 0 -70 c0 -93 23 -140 109 -219 80 -74
+175 -132 250 -155 51 -14 65 -14 225 7 94 12 369 55 611 95 243 40 468 74 500
+75 167 5 179 -2 194 -100 21 -133 47 -545 81 -1285 6 -121 13 -431 17 -690 8
+-637 -12 -941 -77 -1192 -28 -108 -68 -204 -91 -218 -22 -15 -136 -4 -287 25
+-267 53 -401 53 -454 0 -75 -76 5 -183 295 -392 78 -57 174 -134 213 -173 69
+-69 79 -85 153 -250 85 -186 207 -215 369 -86 179 142 313 486 367 941 35 293
+31 810 -16 2325 -11 363 -19 720 -17 792 l3 133 75 73 c61 58 79 83 93 126 22
+68 21 85 -4 137 -43 90 -248 243 -474 355 -103 51 -126 59 -175 58 -30 0 -75
+-8 -100 -18z"/>
+<path d="M2524 5751 c-44 -11 -97 -45 -176 -112 -79 -68 -168 -121 -303 -182
+-160 -71 -282 -106 -530 -152 -108 -20 -421 -65 -450 -65 -3 0 -5 -29 -5 -65
+0 -103 52 -187 179 -290 142 -115 262 -143 401 -96 84 29 271 109 490 210
+l175 81 3 -82 c9 -215 -68 -1216 -113 -1471 -18 -103 -64 -197 -160 -327 -42
+-58 -89 -127 -103 -155 -48 -92 -32 -177 73 -387 164 -328 319 -330 510 -6
+107 181 194 284 567 672 349 363 453 526 389 608 -32 41 -83 45 -175 14 -98
+-33 -196 -89 -419 -239 -98 -65 -181 -117 -183 -114 -16 16 52 649 101 942 61
+367 105 496 200 596 62 65 105 146 105 199 -1 86 -81 183 -242 291 -156 106
+-264 147 -334 130z"/>
+<path d="M4765 5673 c-102 -15 -827 -137 -909 -154 -117 -24 -150 -39 -176
+-82 -51 -83 12 -199 156 -283 53 -31 183 -64 253 -64 109 0 715 76 886 111
+267 55 371 140 318 260 -35 79 -117 134 -282 189 -87 29 -155 36 -246 23z"/>
+<path d="M4743 4875 c-23 -7 -66 -29 -94 -50 -77 -55 -198 -92 -441 -134 -214
+-37 -315 -44 -388 -26 -88 21 -264 30 -316 16 -116 -31 -183 -142 -154 -251 8
+-31 28 -58 71 -100 74 -70 80 -88 114 -348 40 -312 116 -656 165 -752 10 -21
+35 -51 55 -68 29 -27 44 -32 84 -32 99 0 163 77 186 221 l5 36 93 12 c395 50
+869 135 967 174 125 50 133 159 21 307 -50 65 -50 61 25 220 81 169 107 206
+185 255 79 51 110 91 117 151 12 111 -75 184 -354 295 -117 46 -260 90 -288
+88 -6 0 -30 -6 -53 -14z m-87 -587 c-3 -40 -11 -135 -17 -211 l-12 -137 -36
+-10 c-154 -41 -558 -105 -573 -91 -3 3 -9 95 -13 203 l-7 197 37 7 c21 4 155
+30 299 59 144 29 276 53 295 54 l33 1 -6 -72z"/>
+</g>
+</svg>

+ 31 - 0
src/icons/svg/components/pinyin_base.svg

@@ -0,0 +1,31 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
+ width="825.000000pt" height="823.000000pt" viewBox="0 0 825.000000 823.000000"
+ preserveAspectRatio="xMidYMid meet">
+
+<g transform="translate(0.000000,823.000000) scale(0.100000,-0.100000)"
+fill="#000000" stroke="none">
+<path d="M1365 8209 c-351 -75 -669 -254 -912 -513 -227 -243 -380 -553 -437
+-885 -14 -85 -16 -348 -16 -2691 0 -2841 -4 -2661 57 -2870 86 -299 227 -537
+447 -755 140 -138 263 -226 441 -315 158 -78 279 -120 439 -153 l111 -22 2625
+0 2625 0 110 24 c155 33 271 73 412 141 538 259 896 767 963 1365 14 123 14
+5047 0 5170 -24 215 -77 394 -175 590 -223 447 -610 759 -1114 898 l-116 32
+-2685 2 c-2616 2 -2687 1 -2775 -18z m5453 -551 c225 -67 392 -165 544 -322
+166 -171 284 -412 317 -650 15 -108 15 -5024 0 -5132 -64 -465 -402 -844 -867
+-972 l-97 -27 -2568 -3 c-2563 -2 -2568 -2 -2670 18 -219 45 -406 143 -570
+299 -182 173 -299 386 -348 636 -21 104 -21 5126 0 5230 47 236 146 427 311
+599 167 174 368 286 600 335 94 19 133 20 2675 18 l2580 -2 93 -27z"/>
+<path d="M2980 6485 l0 -275 1145 0 1145 0 0 275 0 275 -1145 0 -1145 0 0
+-275z"/>
+<path d="M3755 5654 c-724 -117 -1330 -691 -1483 -1404 -87 -402 -39 -851 128
+-1205 223 -474 651 -845 1130 -978 301 -84 663 -83 957 2 251 72 499 209 696
+383 l67 60 0 -206 0 -206 300 0 300 0 0 1740 0 1740 -300 0 -300 0 0 -216 0
+-216 -80 74 c-228 212 -498 354 -799 419 -128 28 -480 35 -616 13z m527 -604
+c252 -43 445 -143 631 -328 172 -169 277 -366 334 -625 14 -65 18 -124 17
+-287 -1 -188 -3 -213 -27 -302 -58 -218 -147 -382 -287 -531 -110 -117 -216
+-194 -365 -268 -145 -71 -259 -104 -406 -120 -605 -66 -1195 403 -1304 1035
+-66 385 61 780 349 1085 272 287 656 411 1058 341z"/>
+</g>
+</svg>

+ 2 - 2
src/views/book/courseware/preview/CoursewarePreview.vue

@@ -73,8 +73,8 @@
     <!-- 选中文本的工具栏 -->
     <div v-show="showToolbar" class="contentmenu" :style="contentmenu">
       <template v-if="canRemark">
-        <span class="button" @click="handleMenuItemClick($event, 'tool')"
-          ><SvgIcon icon-class="sidebar-pushpin" size="14" /> 添加批注
+        <span class="button" @click="handleMenuItemClick($event, 'tool')">
+          <SvgIcon icon-class="sidebar-pushpin" size="14" /> 添加批注
         </span>
       </template>
       <template v-else>

+ 153 - 6
src/views/personal_workbench/edit_task/edit/UseTemplate.vue

@@ -11,8 +11,8 @@
         <span>选择模板</span>
       </div>
       <div class="operator">
-        <span class="link" @click="insertTemplate">插入模板内容</span>
-        <span class="link" @click="useTemplate">替换模板内容</span>
+        <span class="link" @click="insertTemplate()">插入模板内容</span>
+        <span class="link" @click="useTemplate()">替换模板内容</span>
       </div>
     </header>
 
@@ -44,6 +44,22 @@
       </div>
 
       <div class="courseware-preview">
+        <el-popover placement="bottom-start" width="300" trigger="click" :disabled="curType === 0">
+          <div class="courseware-tree">
+            <div
+              v-for="{ id: nodeId, name, deep, is_leaf_chapter } in node_list"
+              :key="nodeId"
+              :class="['menu-item', { active: curSelectId === nodeId }, { courseware: isTrue(is_leaf_chapter) }]"
+              :style="computedNameStyle(deep, isTrue(is_leaf_chapter))"
+              @click="selectChapterNode(nodeId, isTrue(is_leaf_chapter))"
+            >
+              <span class="name nowrap-ellipsis" :title="name">
+                {{ name }}
+              </span>
+            </div>
+          </div>
+          <el-button slot="reference" class="courseware-name">{{ coursewareName }}</el-button>
+        </el-popover>
         <CoursewarePreview
           v-if="coursewareData.row_list.length > 0"
           ref="courserware"
@@ -67,6 +83,8 @@ import { unified_attrib } from '@/common/data';
 import { getRandomNumber } from '@/utils/index';
 import { PageQueryTemplateList_EditBookSelect } from '@/api/list';
 import { ContentGetCoursewareContent_View, ContentGetCoursewareContent } from '@/api/book';
+import { GetTemplateChapterStructExpandList } from '@/api/template';
+import { isTrue } from '@/utils/validate';
 
 import PaginationPage from '@/components/PaginationPage.vue';
 import CoursewarePreview from '@/views/book/courseware/preview/CoursewarePreview.vue';
@@ -80,6 +98,8 @@ export default {
   provide() {
     return {
       getTitleList: () => this.title_list,
+      getPermissionControl: () => this.permissionControl,
+      getShowPinYin: () => true,
     };
   },
   inject: ['processHtmlString'],
@@ -91,6 +111,7 @@ export default {
   },
   data() {
     return {
+      isTrue,
       loading: false,
       template_list: [],
       total: 0,
@@ -111,6 +132,7 @@ export default {
       component_list: [],
       content_group_row_list: [],
       curSelectId: '',
+      curType: 0,
       data: {
         background_image_url: '',
         background_position: {
@@ -126,16 +148,54 @@ export default {
       },
       data_content_group_row_list: [],
       title_list: [],
+      permissionControl: {
+        can_answer: false, // 可作答
+        can_judge_correct: false, // 可判断对错(客观题)
+        can_show_answer: false, // 可查看答案
+        can_correct: false, // 可批改
+        can_check_correct: false, // 可查看批改
+      },
+      node_list: [],
     };
   },
+  computed: {
+    coursewareName() {
+      if (!this.curSelectId) return '选择课件';
+      if (this.curType === 0) {
+        const courseware = this.template_list.find((x) => x.id === this.curSelectId);
+        return courseware ? courseware.name : '选择课件';
+      }
+      const node = this.node_list.find((x) => x.id === this.curSelectId);
+      return node ? node.name : '选择章节';
+    },
+  },
+  watch: {
+    curSelectId(newVal) {
+      if (newVal.length > 0) {
+        this.getCoursewareComponentContent_View(newVal);
+        this.getCoursewareContent(newVal);
+      } else {
+        this.coursewareData = { row_list: [] };
+        this.component_list = [];
+        this.content_group_row_list = [];
+      }
+    },
+  },
   methods: {
     dialogClose() {
       this.$emit('update:visible', false);
     },
-    selectCourseware({ courseware_id }) {
-      this.curSelectId = courseware_id;
-      this.getCoursewareComponentContent_View(courseware_id);
-      this.getCoursewareContent(courseware_id);
+    selectCourseware({ type, courseware_id, id }) {
+      this.curType = type;
+      if (type === 0) {
+        this.curSelectId = courseware_id;
+        this.node_list = [];
+      } else {
+        this.curSelectId = '';
+        GetTemplateChapterStructExpandList({ template_id: id, is_contain_root_node: 'true' }).then(({ node_list }) => {
+          this.node_list = node_list || [];
+        });
+      }
     },
     searchTemplateList() {
       this.$refs.pagination.getList();
@@ -308,6 +368,28 @@ export default {
       });
       this.dialogClose();
     },
+    /**
+     * 计算章节名称样式
+     * @param {number} deep - 节点深度
+     * @param {boolean} isLeaf - 是否是叶子节点
+     * @returns {Object} - 样式对象
+     */
+    computedNameStyle(deep, isLeaf) {
+      return {
+        'padding-left': `${(deep - 1) * 8}px`,
+        cursor: isLeaf ? 'pointer' : 'auto',
+      };
+    },
+    /**
+     * 选择节点
+     * @param {string} nodeId - 节点ID
+     * @param {boolean} isLeaf - 是否是叶子节点
+     */
+    selectChapterNode(nodeId, isLeaf) {
+      if (!isLeaf) return;
+      if (this.curSelectId === nodeId) return;
+      this.curSelectId = nodeId;
+    },
   },
 };
 </script>
@@ -345,6 +427,71 @@ export default {
     .courseware-preview {
       flex: 1;
       overflow: auto;
+
+      .courseware-name {
+        margin: 2px 0 0 4px;
+      }
+    }
+  }
+}
+
+.courseware-tree {
+  display: flex;
+  flex: 1;
+  flex-direction: column;
+  row-gap: 8px;
+  height: 540px;
+  padding: 12px;
+  margin-top: 12px;
+  overflow: auto;
+
+  .menu-item {
+    display: flex;
+    align-items: center;
+
+    &:not(.courseware) {
+      font-weight: bold;
+    }
+
+    &.courseware {
+      &:hover {
+        .name,
+        .status {
+          background-color: #f3f3f3;
+        }
+      }
+    }
+
+    .svg-icon {
+      margin-left: 4px;
+
+      &.my-edit-task {
+        color: $right-color;
+      }
+    }
+
+    .name {
+      flex: 1;
+      padding: 4px 8px 4px 4px;
+      border-radius: 4px;
+    }
+
+    .status {
+      height: 32px;
+      padding: 4px 8px 4px 4px;
+      font-size: 12px;
+      line-height: 24px;
+      color: #f00004;
+      border-radius: 4px;
+      border-top-left-radius: 0;
+      border-bottom-left-radius: 0;
+    }
+
+    &.active {
+      .name {
+        font-weight: bold;
+        color: #4095e5;
+      }
     }
   }
 }

+ 25 - 7
src/views/personal_workbench/edit_task/preview/index.vue

@@ -4,12 +4,18 @@
 
     <CommonPreview :id="id" ref="preview" :project-id="project_id" type="edit_preview">
       <template #operator="{ courseware }">
-        <span class="link" @click="saveCoursewareAsTemplate">保存为个人模板</span>
-        <span v-if="isTrue(courseware.is_can_start_edit)" class="link" @click="editTask">开始编辑</span>
-        <span v-if="isTrue(courseware.is_can_submit_audit)" class="link" @click="submitCoursewareToAuditFlow">
+        <el-popover placement="bottom" width="125" trigger="click">
+          <el-link type="primary" @click="saveCoursewareAsTemplate(0)">保存本页为模板</el-link>
+          <el-link type="primary" @click="saveCoursewareAsTemplate(3)">保存本课为模板</el-link>
+          <el-link type="primary" @click="saveCoursewareAsTemplate(1)">保存本书为模板</el-link>
+          <span slot="reference" class="link save-template">保存为个人模板</span>
+        </el-popover>
+        <span class="link"></span>
+        <span v-if="isTrue(courseware.is_can_start_edit)" class="link" @click="editTask()">开始编辑</span>
+        <span v-if="isTrue(courseware.is_can_submit_audit)" class="link" @click="submitCoursewareToAuditFlow()">
           提交审校
         </span>
-        <span class="link" @click="goBackBookList">返回教材列表</span>
+        <span class="link" @click="goBackBookList()">返回教材列表</span>
       </template>
     </CommonPreview>
   </div>
@@ -57,15 +63,16 @@ export default {
     },
     /**
      * 保存为个人模板
+     * @param {Number} scope 范围
      */
-    saveCoursewareAsTemplate() {
-      this.$confirm('确定要将当前课件保存为个人模板吗?', '提示', {
+    saveCoursewareAsTemplate(scope) {
+      this.$confirm('确定保存为个人模板吗?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning',
       })
         .then(() => {
-          SaveCoursewareAsTemplatePersonal({ courseware_id: this.$refs.preview.select_node }).then(() => {
+          SaveCoursewareAsTemplatePersonal({ courseware_id: this.$refs.preview.select_node, scope }).then(() => {
             this.$message.success('已保存为个人模板');
           });
         })
@@ -80,5 +87,16 @@ export default {
 
 .task-preview {
   @include page-content(true);
+
+  .save-template {
+    margin-right: -8px;
+    vertical-align: text-top;
+  }
+}
+</style>
+
+<style lang="scss">
+.el-popover.el-popper {
+  min-width: 100px;
 }
 </style>