edit.vue 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561
  1. <template>
  2. <div class="edit-page">
  3. <el-steps :active="stepsType" simple class="top-steps-box" >
  4. <el-step title="资源信息" icon="el-icon-edit" :status="stepsType==0?'finish ':'process'" @click.native="stepsClick(0,$event)" style="cursor:pointer;"></el-step>
  5. <el-step title="资源章节" icon="el-icon-folder-add" :status="stepsType==1?'finish ':'process'" @click.native="stepsClick(1,$event)" style="cursor:pointer;"></el-step>
  6. <el-step title="资源设置" icon="el-icon-setting" :status="stepsType==2?'finish ':'process'" @click.native="stepsClick(2,$event)" style="cursor:pointer;"></el-step>
  7. </el-steps>
  8. <!--课程信息-->
  9. <div class="center-content-max-box info-max-box" v-if="stepsType === 0">
  10. <el-form :model="infoForm" ref="infoForm" :rules="infoRules" label-width="80px">
  11. <el-form-item label="课程名称" prop="title">
  12. <el-input
  13. style="width:400px;"
  14. v-model="infoForm.title"
  15. maxLength="25"
  16. placeholder="请输入课程名称"
  17. clearable
  18. size="small"
  19. />
  20. {{infoForm.title.length}}/25
  21. </el-form-item>
  22. <el-form-item label="课程分类" prop="cateName">
  23. <div style="display: flex">
  24. <el-input
  25. style="width:400px;"
  26. v-model="infoForm.cateName"
  27. disabled
  28. maxLength="25"
  29. placeholder="请选择课程分类"
  30. clearable
  31. size="small"
  32. />
  33. <p class="add-button-one-90"
  34. style="margin-left:20px;"
  35. @click="openClassTreeClick"
  36. >选择分类</p>
  37. </div>
  38. </el-form-item>
  39. <!-- <el-form-item label="课程分类" prop="cateName">
  40. <el-select v-model="infoForm.cateName" placeholder="请选择">
  41. <el-option
  42. v-for="item in courseTypeList"
  43. :key="item.id"
  44. :label="item.name"
  45. :value="item.id">
  46. </el-option>
  47. </el-select>
  48. </el-form-item>-->
  49. <el-form-item label="适用类型" prop="checkList">
  50. <el-checkbox-group v-model="infoForm.checkList">
  51. <el-checkbox
  52. v-for="item in scopeTypeList"
  53. :label="item.id"
  54. :key="item.id">{{item.value}}</el-checkbox>
  55. </el-checkbox-group>
  56. </el-form-item>
  57. <el-form-item label="适用学院" prop="deptId">
  58. <el-select v-model="infoForm.deptId" placeholder="请选择适用学院" style="width:400px;">
  59. <el-option
  60. v-for="item in deptOptions"
  61. :key="item.deptId"
  62. :label="item.deptName"
  63. :value="item.deptId"
  64. >
  65. </el-option>
  66. </el-select>
  67. </el-form-item>
  68. <!--<el-form-item label="上传封面" prop="certUrl">-->
  69. <!--<el-upload-->
  70. <!--class="certificate-avatar-uploader"-->
  71. <!--:action="uploadImgUrl"-->
  72. <!--:show-file-list="false"-->
  73. <!--accept="image/jpeg,image/gif,image/png"-->
  74. <!--:on-success="handleAvatarSuccess"-->
  75. <!--:headers="headers"-->
  76. <!--:before-upload="beforeAvatarUpload">-->
  77. <!--<img v-if="infoForm.certUrl" :src="infoForm.certUrl" class="avatar" style="height:80px;width:80px;">-->
  78. <!--<i v-if="!infoForm.certUrl" class="el-icon-plus avatar-uploader-icon"></i>-->
  79. <!--</el-upload>-->
  80. <!--</el-form-item>-->
  81. <!--<el-form-item label="资料介绍" prop="content" style="width:1000px;height:400px;">-->
  82. <!--<editor style="height:400px;" v-model="infoForm.content" :min-height="192"/>-->
  83. <!--</el-form-item>-->
  84. </el-form>
  85. </div>
  86. <!--课程章节-->
  87. <div class="center-content-max-box chapter-max-box" v-if="stepsType === 1">
  88. <div class="left-new-chapter-box">
  89. <p class="title-p">新建章节</p>
  90. <p class="add-chapter-p add-button-one-120" @click="add_el_chapterClick">新增章节</p>
  91. <div class="chapter-list-for-max-box scrollbar-box">
  92. <div class="chapter-list-for-big-box" v-for="(item,index) in chapterList" :key="index" :index="item.id">
  93. <div class="chapter-list-for-box" :class="{'checkChapter':item.id == chapterIndex}" @click.stop="checkChapterClick(item)">
  94. <p v-if="item.showType" @click.stop="chapterTreeClick(item,false)"><i class="el-icon-remove-outline"></i></p>
  95. <p v-if="!item.showType" @click.stop="chapterTreeClick(item,true)"><i class="el-icon-circle-plus-outline"></i></p>
  96. <p>{{item.title}}</p>
  97. <p @click.stop="del_el_chapter(item)"><i class="el-icon-circle-close"></i></p>
  98. </div>
  99. <div class="chapter-list-min-for-box" :class="{'checkChapter':minItem.id == chapterIndex}"
  100. @click.stop="checkChapterClick(minItem)"
  101. v-if="item.showType"
  102. v-for="(minItem,index2) in item.children" :key="index2" :index="minItem.id">
  103. <p>{{minItem.title}}</p>
  104. <p @click.stop="del_el_chapter(minItem)"><i class="el-icon-circle-close"></i></p>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. <div class="center-content-box scrollbar-box">
  110. <p class="title-p">编辑框</p>
  111. <p class="null-add-p" v-if="!chapterData.id">请先在左侧动作条选择或创建章节</p>
  112. <div class="center-content-box-one" v-if="!exerciseAddType">
  113. <el-form :model="chapterData" ref="chapterForm" :rules="chapterRules" v-if="chapterData.id">
  114. <div style="display: flex">
  115. <el-form-item label="标题" prop="title" style="margin:20px 0;" label-width="100px">
  116. <el-input
  117. style="width:190px;margin-right:20px;"
  118. v-model="chapterData.title"
  119. maxLength="20"
  120. minlength="1"
  121. placeholder="请输入标题"
  122. clearable
  123. size="small"
  124. />
  125. </el-form-item>
  126. <el-form-item label="时间" prop="timeValue" style="margin:20px 0;display: flex" v-if="chapterData.chapterData">
  127. <el-time-picker
  128. @change="timeChange"
  129. v-model="chapterData.timeValue"
  130. format = 'HH:mm:ss'
  131. value-format = 'HH:mm:ss'
  132. placeholder="请选择时间">
  133. </el-time-picker>
  134. </el-form-item>
  135. <el-form-item label="课后考核" prop="exerciseValue1" style="margin:20px 0;" label-width="100px" v-if="chapterData.chapterData">
  136. <el-switch
  137. v-model="chapterData.isAssess"
  138. :active-value="1"
  139. :inactive-value="0">
  140. </el-switch>
  141. </el-form-item>
  142. <p style="flex:1;"></p>
  143. <el-button type="primary" style="margin:20px 20px 0 20px;" @click="edit_el_chapterClick">保存</el-button>
  144. </div>
  145. <div class="exercise-title-max-box" v-if="chapterData.isAssess == 1">
  146. <el-form-item label="考核名称" prop="assessName" label-width="100px">
  147. <el-input
  148. style="width:300px;"
  149. v-model="chapterData.assessName"
  150. maxLength="20"
  151. minlength="1"
  152. placeholder="请输入考核名称"
  153. clearable
  154. size="small"
  155. />
  156. </el-form-item>
  157. <div class="exercise-add-max-box">
  158. <p class="exercise-add-button inquire-button-one" @click="exerciseAddClickOn">设置考核题目</p>
  159. <div class="exercise-add-text-box">
  160. <div>题目总数:{{totalNum}}</div>
  161. <div>单选题数:{{oneNum}}</div>
  162. <div>多选题数:{{manyNum}}</div>
  163. <div>判断题数:{{judgeNum}}</div>
  164. </div>
  165. </div>
  166. </div>
  167. <!--<el-form-item label="简介" prop="description" v-if="!chapterData.chapterData">-->
  168. <!--<el-input-->
  169. <!--style="width:790px;"-->
  170. <!--:rows="6"-->
  171. <!--v-model="chapterData.description"-->
  172. <!--maxLength="150"-->
  173. <!--placeholder="请输入简介"-->
  174. <!--clearable-->
  175. <!--type="textarea"-->
  176. <!--resize="none"-->
  177. <!--size="small"-->
  178. <!--/>-->
  179. <!--</el-form-item>-->
  180. </el-form>
  181. <div class="center-info-components-max-box scrollbar-box" v-loading="loading">
  182. <!--图片-->
  183. <img
  184. style="display: block;margin:0 auto;max-width:900px;"
  185. v-if="chapterData.postfix == 'png' || chapterData.postfix == 'jpeg' || chapterData.postfix == 'gif'"
  186. :src="chapterData.chapterData">
  187. <!--视频-->
  188. <!--<video-player-->
  189. <!--class="video-player vjs-custom-skin"-->
  190. <!--v-if="chapterData.postfix == 'mp4' || chapterData.postfix == 'webm'"-->
  191. <!--@pause="demo($event)"-->
  192. <!--:playsinline="true"-->
  193. <!--:options="playerOptions">-->
  194. <!--</video-player>-->
  195. <!--poster="@/assets/ZDimages/video_logo.jpg"-->
  196. <video class="video-player vjs-custom-skin"
  197. style="width:810px;height:512px;"
  198. autoplay="autoplay"
  199. :poster="videoCover"
  200. v-if="chapterData.chapterData && chapterData.postfix == 'mp4'">
  201. <source :src="chapterData.chapterData" type="video/mp4">
  202. </video>
  203. <!--word-->
  204. <iframe
  205. class="iframe"
  206. v-if="chapterData.postfix == 'pdf' || chapterData.postfix == 'doc' || chapterData.postfix == 'docx' || chapterData.postfix == 'ppt' || chapterData.postfix == 'pptx'"
  207. :src="chapterData.iframeSrc" scrolling="auto" frameborder="0">
  208. </iframe>
  209. <!--富文本-->
  210. <div v-if="chapterData.type == 5" v-html="chapterData.chapterData"></div>
  211. </div>
  212. </div>
  213. <!--课后练习-->
  214. <div class="center-content-box-two" v-if="exerciseAddType">
  215. <el-form class="center-content-box-two-top" style="margin-bottom:10px;" :model="exerciseQueryParams" ref="exerciseQueryParams" :inline="true" label-width="80px">
  216. <el-form-item label="题目名称" prop="content">
  217. <el-input
  218. style="width:140px;"
  219. v-model="exerciseQueryParams.content"
  220. placeholder="请输入题目名称"
  221. />
  222. </el-form-item>
  223. <el-form-item label="题目类型" prop="quType">
  224. <el-select
  225. style="width:150px;"
  226. v-model="exerciseQueryParams.quType"
  227. placeholder="请选择题目类型">
  228. <el-option
  229. v-for="dict in quTypes"
  230. :key="dict.type"
  231. :label="dict.value"
  232. :value="dict.type">
  233. </el-option>
  234. </el-select>
  235. </el-form-item>
  236. <el-form-item label="题目分类" prop="cIds">
  237. <el-select
  238. style="width:150px;"
  239. v-model="exerciseQueryParams.cIds"
  240. placeholder="请选择题目分类">
  241. <el-option
  242. v-for="dict in optionList"
  243. :key="dict.id"
  244. :label="dict.title"
  245. :value="dict.id">
  246. </el-option>
  247. </el-select>
  248. </el-form-item>
  249. <el-form-item>
  250. <p class="inquire-button-one" @click="exerciseHandleQuery" style="margin:0 10px;">查询</p>
  251. <p class="reset-button-one" @click="exerciseResetQuery">重置</p>
  252. </el-form-item>
  253. </el-form>
  254. <div class="center-content-box-two-bottom">
  255. <div class="center-content-box-two-bottom-left">
  256. <el-table v-loading="loading" border :data="exerciseList" empty-text="请在右侧添加题目">
  257. <el-table-column label="题目名称" align="left" prop="content" :show-overflow-tooltip="true"/>
  258. <el-table-column width="40">
  259. <template slot-scope="scope">
  260. <i class="el-icon-circle-close del-i" @click="delExerciseListClick(scope.row)"></i>
  261. </template>
  262. </el-table-column>
  263. </el-table>
  264. </div>
  265. <div class="center-content-box-two-bottom-right">
  266. <div class="center-content-box-two-bottom-right-table ">
  267. <el-table v-loading="loading" border :data="el_courseList">
  268. <el-table-column label="题目名称" align="left" prop="content" :show-overflow-tooltip="true"/>
  269. <el-table-column label="题目类型" align="left" prop="title" width="120" :show-overflow-tooltip="true">
  270. <template slot-scope="scope">
  271. <span
  272. v-for="(item, index) in quTypes"
  273. :key="index"
  274. v-if="scope.row.quType == item.type"
  275. >{{ item.value }}</span>
  276. </template>
  277. </el-table-column>
  278. <el-table-column label="操作" align="left" width="100">
  279. <template slot-scope="scope">
  280. <div class="table-button-box">
  281. <p class="table-button-null"></p>
  282. <p class="table-button-p"
  283. @click="exerciseAdd(scope.row)">添加</p>
  284. <p class="table-button-null"></p>
  285. </div>
  286. </template>
  287. </el-table-column>
  288. </el-table>
  289. <pagination :page-sizes="[20, 30, 40, 50]"
  290. v-show="el_courseTotal>0"
  291. :total="el_courseTotal"
  292. :pager-count="5"
  293. layout="total, pager, jumper"
  294. :page.sync="exerciseQueryParams.pageNum"
  295. :limit.sync="exerciseQueryParams.pageSize"
  296. @pagination="getExerciseList"
  297. />
  298. </div>
  299. </div>
  300. </div>
  301. <div class="center-content-box-two-bottom-button">
  302. <p></p>
  303. <p class="reset-button-one" @click="exerciseAddClickOff">取消</p>
  304. <p class="inquire-button-one" @click="exerciseAddClickSave">确定</p>
  305. </div>
  306. </div>
  307. </div>
  308. <div class="right-courseware-box">
  309. <p class="title-p">资源管理</p>
  310. <div class="el-resources-tree scrollbar-box">
  311. <el-select v-model="selectTree" placeholder="请选择分类" style="width: 100%;margin-top: 20px;">
  312. <el-option :value="selectTreeValue" style="height: auto;">
  313. <el-tree
  314. :data="treeData"
  315. :props="defaultProps"
  316. :highlight-current="true"
  317. :expand-on-click-node="false"
  318. :filter-node-method="filterNode"
  319. ref="resourcesTree"
  320. default-expand-all
  321. @node-click="handleNodeClick"
  322. />
  323. </el-option>
  324. </el-select>
  325. <el-input class="el-resources-search" placeholder="请输入资源名称" v-model="resourceName" clearable style="margin-top: 14px;">
  326. <i slot="append" class="el-icon-search" style="font-size: 22px;" @click="queryResources"></i>
  327. </el-input>
  328. <!-- <el-tree
  329. :data="treeData"
  330. :props="defaultProps"
  331. :highlight-current="true"
  332. :expand-on-click-node="false"
  333. :filter-node-method="filterNode"
  334. ref="resourcesTree"
  335. default-expand-all
  336. @node-click="handleNodeClick"
  337. />-->
  338. </div>
  339. <div class="el-resources-list ">
  340. <el-table :data="el_resourcesList" border :show-header="false">
  341. <el-table-column label="课件名称" align="left" prop="title" width="240" :show-overflow-tooltip="true"/>
  342. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="80">
  343. <template slot-scope="scope">
  344. <div class="table-button-box">
  345. <p class="table-button-null"></p>
  346. <p class="table-button-p" @click="addMinChildren(scope.row)">添加</p>
  347. <p class="table-button-null"></p>
  348. </div>
  349. </template>
  350. </el-table-column>
  351. </el-table>
  352. <pagination :page-sizes="[20, 30, 40, 50]"
  353. style="height:50px;margin-left:10px;"
  354. v-show="total>0"
  355. :total="total"
  356. layout="total, prev, next"
  357. :page.sync="queryParams.pageNum"
  358. :limit.sync="queryParams.pageSize"
  359. @pagination="getResources"
  360. />
  361. </div>
  362. </div>
  363. </div>
  364. <!--课程设置-->
  365. <div class="center-content-max-box set-up-max-box" v-if="stepsType === 2">
  366. <el-form :model="setUpForm" ref="setUpForm" :rules="setUpRules" label-width="180px">
  367. <!--<el-form-item label="课程学习时长(分钟)" prop="duration" style="margin-top:20px;">-->
  368. <!--<el-input-number-->
  369. <!--style="width:220px;"-->
  370. <!--v-model="setUpForm.duration"-->
  371. <!--:min="1" :max="1000"-->
  372. <!--label="请输入课程学习时长">-->
  373. <!--</el-input-number>-->
  374. <!--</el-form-item>-->
  375. <!--<el-form-item label="积分值" prop="points" style="margin-top:20px;">-->
  376. <!--<el-input-number-->
  377. <!--style="width:220px;"-->
  378. <!--v-model="setUpForm.points"-->
  379. <!--:min="0" :max="1000"-->
  380. <!--label="请输入积分值">-->
  381. <!--</el-input-number>-->
  382. <!--</el-form-item>-->
  383. <!--<el-form-item label="学习机积分值" prop="machinePoints" style="margin-top:20px;">-->
  384. <!--<el-input-number-->
  385. <!--style="width:220px;"-->
  386. <!--v-model="setUpForm.machinePoints"-->
  387. <!--:min="0" :max="1000"-->
  388. <!--label="请输入学习机积分值">-->
  389. <!--</el-input-number>-->
  390. <!--</el-form-item>-->
  391. <el-form-item label="有效时间类型" prop="ceType" style="margin-top:20px;">
  392. <el-radio v-model="setUpForm.ceType" :label="0" style="margin-right:20px;">永久</el-radio>
  393. <el-radio v-model="setUpForm.ceType" :label="1">有限</el-radio>
  394. </el-form-item>
  395. <el-form-item label="过期日期" prop="ceTime" v-if="setUpForm.ceType == 1" style="margin-top:20px;">
  396. <el-date-picker
  397. v-model="setUpForm.ceTime"
  398. type="date"
  399. value-format="yyyy-MM-dd"
  400. placeholder="请选择过期日期">
  401. </el-date-picker>
  402. </el-form-item>
  403. <el-form-item label="课程上架状态" prop="status" style="margin-top:20px;">
  404. <el-switch
  405. v-model="setUpForm.status"
  406. active-color="#00b7ee"
  407. inactive-color="#dedede"
  408. :active-value="1"
  409. :inactive-value="0">
  410. </el-switch>
  411. </el-form-item>
  412. <el-form-item label="显示课程拖拽进度" prop="videoDraggable" style="margin-top:20px;">
  413. <el-switch
  414. v-model="setUpForm.videoDraggable"
  415. active-color="#00b7ee"
  416. inactive-color="#dedede"
  417. :active-value="1"
  418. :inactive-value="0">
  419. </el-switch>
  420. </el-form-item>
  421. </el-form>
  422. </div>
  423. <div class="bottom-button-box">
  424. <el-button @click="offPage">取 消</el-button>
  425. <el-button type="primary" style="width:200px;" @click="stepsClick">{{stepsType==0?'保存并进入下一步':(stepsType==1?'下一步':stepsType==2?'完成':'')}}</el-button>
  426. </div>
  427. <!--选择分类-->
  428. <el-dialog title="选择分类" :visible.sync="openClassTree" width="700px" append-to-body :close-on-click-modal="false">
  429. <div style="height:500px;" class="scrollbar-box">
  430. <el-tree
  431. v-if="openClassTree"
  432. :data="classTree"
  433. show-checkbox
  434. default-expand-all
  435. node-key="id"
  436. :check-strictly="true"
  437. ref="ditTree"
  438. highlight-current
  439. @node-click="editCheck"
  440. @check="editCheck"
  441. :props="defaultProps">
  442. </el-tree>
  443. </div>
  444. <div slot="footer" class="dialog-footer">
  445. <el-button @click="openClassTreeClickOff">取 消</el-button>
  446. <el-button type="primary" @click="openClassSubmit">确 定</el-button>
  447. </div>
  448. </el-dialog>
  449. </div>
  450. </template>
  451. <script>
  452. import { listQu } from "@/api/exam/qu";
  453. import { list_option } from "@/api/exam/el_classify";
  454. import { getDeptNoAuthList } from "@/api/system/dept";
  455. import { listEl_resources } from "@/api/exam/el_resources";
  456. import { getEl_course,addEl_course, updateEl_course,add_el_chapter,edit_el_chapter,del_el_chapter,queryChapterQu } from "@/api/exam/el_course";
  457. import { listEl_category} from "@/api/exam/el_category";
  458. import { getToken } from "@/utils/auth";
  459. import { videoPlayer } from 'vue-video-player'
  460. import 'video.js/dist/video-js.css'
  461. export default {
  462. name: "edit",
  463. props:{
  464. infoId:{},
  465. },
  466. components:{
  467. videoPlayer
  468. },
  469. data() {
  470. return {
  471. videoCover:window.location.href.split('://')[0]+'://' + this.judgmentNetworkReturnAddress() + "/admin/" + localStorage.getItem('videoCover'),
  472. selectTree: '',
  473. selectTreeValue: [],
  474. /******************基本信息-开始******************/
  475. //上传封面设置
  476. uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
  477. headers: {
  478. Authorization: "Bearer " + getToken(),
  479. },
  480. //步骤条状态
  481. stepsType:0,
  482. //课程信息
  483. infoForm:{
  484. title:"",
  485. // content:"",
  486. cateName:"",
  487. // certUrl:"",
  488. checkList:[],
  489. deptId:"",
  490. },
  491. courseTypeList:[
  492. {id:'0',name:'基础课程'},
  493. {id:'1',name:'视频课程'},
  494. {id:'2',name:'VR课程'},
  495. {id:'3',name:'趣味学习'},
  496. ],
  497. resourceName:'',//资源名称
  498. //课程信息校验
  499. infoRules: {
  500. title: [
  501. { required: true, message: "请输入课程名称", trigger: "blur" },
  502. { required: true, message: "请输入课程名称", validator: this.spaceJudgment, trigger: "blur" }
  503. ],
  504. cateName: [
  505. { required: true, message: "请选择课程分类", trigger: "blur" },
  506. ],
  507. checkList: [
  508. { required: true, message: "请选择适用类型", trigger: "blur" },
  509. ],
  510. deptId: [
  511. { required: true, message: "请选择适用学院", trigger: "blur" },
  512. ],
  513. // certUrl: [
  514. // { required: true, message: "请上传封面", trigger: "blur" },
  515. // ],
  516. // content: [
  517. // { required: true, message: "请输入资料介绍", trigger: "blur" },
  518. // ],
  519. },
  520. //分类页面
  521. openClassTree:false,
  522. //分类树数据
  523. classTree:[],
  524. defaultProps: {
  525. children: "children",
  526. label: "title"
  527. },
  528. //分类选择临时数据
  529. openClassTreeType:{},
  530. //学院
  531. deptOptions:[],
  532. //适用类型
  533. scopeTypeList:[
  534. {id:"1",value:'安全准入考试'},
  535. {id:"2",value:'负面清单考试'},
  536. {id:"3",value:'黑名单考试'}
  537. ],
  538. /******************基本信息-结束******************/
  539. /******************章节信息-开始******************/
  540. // 章节数组
  541. chapterList:[],
  542. chapterIndex:0,
  543. chapterData:{},
  544. //课程信息校验
  545. chapterRules: {
  546. title: [
  547. { required: true, message: "请输入标题", trigger: "blur" },
  548. ],
  549. assessName: [
  550. { required: true, message: "请输入考核名称", trigger: "blur" },
  551. ],
  552. },
  553. //课件列表
  554. // 查询参数
  555. queryParams: {
  556. pageNum: 1,
  557. pageSize:20,
  558. },
  559. //树列表
  560. treeData:[],
  561. //课件列表
  562. el_resourcesList:[],
  563. total:0,
  564. //加载动画
  565. loading:false,
  566. //pdf页数
  567. pdfNumPages:null,
  568. pageNum: 1,
  569. pageTotalNum: 1, //# 总页数
  570. loadedRatio: 0, //# 当前页面的加载进度,范围是0-1 ,等于1的时候代表当前页已经完全加载完成了
  571. //视频设置
  572. playerOptions: {
  573. playbackRates: [0.5, 1.0, 1.5, 2.0], // 可选的播放速度
  574. autoplay: false, // 如果为true,浏览器准备好时开始回放。
  575. muted: false, // 默认情况下将会消除任何音频。
  576. loop: false, // 是否视频一结束就重新开始。
  577. preload: 'auto', // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
  578. language: 'zh-CN',
  579. aspectRatio: '16:9', // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
  580. fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
  581. sources: [],
  582. poster: '', // 封面地址
  583. notSupportedMessage: '此视频暂无法播放,请稍后再试', // 允许覆盖Video.js无法播放媒体源时显示的默认信息。
  584. controlBar: {
  585. timeDivider: true, // 当前时间和持续时间的分隔符
  586. durationDisplay: true, // 显示持续时间
  587. remainingTimeDisplay: false, // 是否显示剩余时间功能
  588. fullscreenToggle: true // 是否显示全屏按钮
  589. }
  590. },
  591. //课后题添加
  592. exerciseAddType:false,
  593. //题目类型
  594. quTypes: [
  595. {
  596. type: 1,
  597. value: "单选题",
  598. },
  599. {
  600. type: 2,
  601. value: "多选题",
  602. },
  603. {
  604. type: 3,
  605. value: "判断题",
  606. },
  607. ],
  608. //题目分类
  609. optionList:[],
  610. //题目搜索项
  611. exerciseQueryParams:{
  612. pageNum: 1,
  613. pageSize:20,
  614. content:null,
  615. quType:null,
  616. cIds:null,
  617. },
  618. //题目数量
  619. el_courseTotal:0,
  620. //题目列表
  621. el_courseList:[],
  622. //选中题目数据
  623. exerciseList:[],
  624. //总题数
  625. totalNum:0,
  626. //单选数
  627. oneNum:0,
  628. //多选数
  629. manyNum:0,
  630. //判断数
  631. judgeNum:0,
  632. /******************章节信息-结束******************/
  633. /******************设置信息-开始******************/
  634. setUpForm:{},
  635. durationNum:{},
  636. setUpRules:{
  637. duration: [
  638. { required: true, message: "请输入课程学习时长", trigger: "blur" },
  639. ],
  640. // points: [
  641. // { required: true, message: "请输入积分值", trigger: "blur" },
  642. // ],
  643. // machinePoints: [
  644. // { required: true, message: "请输入学习机积分值", trigger: "blur" },
  645. // ],
  646. ceType: [
  647. { required: true, message: "请选择有效时间类型", trigger: "blur" },
  648. ],
  649. ceTime: [
  650. { required: true, message: "请选择过期日期", trigger: "blur" },
  651. ],
  652. }
  653. /******************设置信息-结束******************/
  654. }
  655. },
  656. created() {
  657. console.log(this.infoId);
  658. if(this.infoId.id){
  659. this.getInfoData();
  660. }
  661. },
  662. mounted(){
  663. this.getTreeData();
  664. this.getResourceTreeData();
  665. this.getResources();
  666. this.getDeptList();
  667. this.getList_option();
  668. this.getExerciseList();
  669. },
  670. methods:{
  671. /******************基本信息-开始******************/
  672. /* 查询学院列表 */
  673. getDeptList(){
  674. getDeptNoAuthList().then(response => {
  675. // this.deptOptions = response.data;
  676. this.$set(this, 'deptOptions', response.data)
  677. });
  678. },
  679. //步骤条下一步按钮
  680. stepsClick(type,e){
  681. if (type == 0||type == 1||type == 2){
  682. if(this.infoId.id && this.stepsType != type){
  683. if(type == 1){
  684. this.queryParams.cateId = "";
  685. this.queryParams.pageNum = 1;
  686. this.queryParams.pageSize = 20;
  687. this.getResources();
  688. }
  689. this.getInfoData();
  690. this.stepsType = type;
  691. }
  692. }else if(this.stepsType == 0){
  693. if(this.stepsType == 0){
  694. this.addElCourseClick();
  695. }
  696. }else if(this.stepsType == 1){
  697. // this.edit_el_chapterClick();
  698. this.stepsType++
  699. }else if(this.stepsType == 2){
  700. this.edutSetUpClick();
  701. }
  702. //关闭课后题目选择页面
  703. this.exerciseAddClickOff();
  704. },
  705. //选择分类页面开启
  706. openClassTreeClick(){
  707. let self = this;
  708. this.openClassTree = true;
  709. if(this.infoForm.cateId){
  710. setTimeout(function(){
  711. self.$refs.ditTree.setCheckedKeys([self.infoForm.cateId]);
  712. },100);
  713. }
  714. },
  715. openClassTreeClickOff(){
  716. this.openClassTree = false;
  717. this.openClassTreeType = {};
  718. },
  719. //上传
  720. handleAvatarSuccess(res, file) {
  721. this.infoForm.certUrl = res.data.url;
  722. this.$forceUpdate()
  723. },
  724. beforeAvatarUpload(file) {
  725. let type = false;
  726. console.log('file',file);
  727. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif') {
  728. type = true;
  729. }else{
  730. this.$message.error('只能上传png/jpeg/gif格式图片');
  731. type = false;
  732. }
  733. return type;
  734. },
  735. /** 查询课程分类树 */
  736. getTreeData() {
  737. listEl_category({},2).then( response => {
  738. this.classTree = JSON.parse(JSON.stringify(response.data));
  739. });
  740. },
  741. /** 查询资源分类树 */
  742. getResourceTreeData(){
  743. listEl_category({},1).then( response => {
  744. //this.classTree = JSON.parse(JSON.stringify(response.data));
  745. let list = [];
  746. let obj = {
  747. children:[],
  748. title:"所有分类",
  749. id:"",
  750. };
  751. list.push(obj);
  752. for(let i=0;i<response.data.length;i++){
  753. list.push(response.data[i]);
  754. }
  755. this.treeData = list;
  756. });
  757. },
  758. //分类树点击事件
  759. editCheck(event) {
  760. this.$refs.ditTree.setCheckedKeys([event.id]);
  761. this.openClassTreeType.cateName = event.title;
  762. this.openClassTreeType.cateId= event.id;
  763. },
  764. //选择分类确定
  765. openClassSubmit(){
  766. let obj = JSON.parse(JSON.stringify(this.openClassTreeType));
  767. this.infoForm.cateId = obj.cateId;
  768. this.infoForm.cateName = obj.cateName;
  769. this.openClassTree = !this.openClassTree;
  770. },
  771. //退出上一页
  772. offPage(){
  773. this.$parent.goPageEdit(4);
  774. },
  775. //获取课程数据
  776. getInfoData(){
  777. let self = this;
  778. getEl_course(this.infoId.id).then( response => {
  779. //基础信息
  780. this.$set(this.infoForm,'title',response.data.title);
  781. this.$set(this.infoForm,'cateName',response.data.cateTitle);
  782. this.$set(this.infoForm,'cateId',response.data.cateId);
  783. // this.$set(this.infoForm,'certUrl',response.data.img);
  784. // this.$set(this.infoForm,'content',unescape(response.data.description));
  785. if(response.data.scopeType){
  786. let scopeList = response.data.scopeType.split(',')
  787. this.$set(this.infoForm,'checkList',scopeList);
  788. }
  789. this.$set(this.infoForm,'deptId',parseInt(response.data.deptIds));
  790. //章节信息
  791. for(let i=0;i<response.data.chapterList.length;i++){
  792. response.data.chapterList[i].showType = true;
  793. }
  794. this.$set(this,'chapterList',response.data.chapterList);
  795. if(response.data.chapterList[0]){
  796. this.chapterIndex = response.data.chapterList[0].id;
  797. this.chapterData = JSON.parse(JSON.stringify(response.data.chapterList[0]))
  798. }else{
  799. this.chapterIndex = "";
  800. this.chapterData = {};
  801. }
  802. //设置信息
  803. this.$set(this.setUpForm,'duration',response.data.duration);
  804. // this.$set(this.setUpForm,'points',response.data.points);
  805. // this.$set(this.setUpForm,'machinePoints',response.data.machinePoints);
  806. this.$set(this.setUpForm,'ceType',response.data.ceType);
  807. this.$set(this.setUpForm,'ceTime',response.data.ceTime);
  808. this.$set(this.setUpForm,'status',response.data.status);
  809. this.$set(this.setUpForm,'videoDraggable',response.data.videoDraggable);
  810. });
  811. },
  812. //获取课程信息不从新定义index
  813. getInfoDataTow(){
  814. getEl_course(this.infoId.id).then( response => {
  815. console.log("课程数据",response)
  816. this.$set(this.infoForm,'title',response.data.title);
  817. this.$set(this.infoForm,'cateName',response.data.cateTitle);
  818. this.$set(this.infoForm,'cateId',response.data.cateId);
  819. // this.$set(this.infoForm,'certUrl',response.data.img);
  820. // this.$set(this.infoForm,'content',unescape(response.data.description));
  821. if(response.data.scopeType){
  822. let scopeList = response.data.scopeType.split(',')
  823. this.$set(this.infoForm,'checkList',scopeList);
  824. }
  825. this.$set(this.infoForm,'dictType',response.data.dictType);
  826. for(let i=0;i<response.data.chapterList.length;i++){
  827. response.data.chapterList[i].showType = true;
  828. }
  829. this.$set(this,'chapterList',response.data.chapterList);
  830. });
  831. },
  832. //信息保存
  833. addElCourseClick(){
  834. let self = this;
  835. this.$refs["infoForm"].validate(valid => {
  836. if (valid) {
  837. if(this.infoId.id){
  838. let obj = {
  839. id:this.infoId.id,
  840. title:this.infoForm.title,
  841. cateId:this.infoForm.cateId,
  842. // img:this.infoForm.certUrl,
  843. // description:escape(this.infoForm.content),
  844. deptIds:this.infoForm.deptId,
  845. };
  846. let scopeText = this.infoForm.checkList+'';
  847. obj.scopeType = scopeText;
  848. // let scopeType = [];
  849. // for(let i=0;i<self.infoForm.checkList.length;i++){
  850. // if(self.infoForm.checkList[i] == ''){
  851. //
  852. // }
  853. // }
  854. updateEl_course(obj).then( response => {
  855. this.msgSuccess("修改成功");
  856. this.stepsType++;
  857. });
  858. }else{
  859. let obj = {
  860. title:this.infoForm.title,
  861. cateId:this.infoForm.cateId,
  862. // img:this.infoForm.certUrl,
  863. // description:escape(this.infoForm.content),
  864. deptIds:this.infoForm.deptId,
  865. };
  866. let scopeText = this.infoForm.checkList+'';
  867. obj.scopeType = scopeText;
  868. addEl_course(obj).then( response => {
  869. this.infoId.id = response.data.id;
  870. this.getInfoData();
  871. this.msgSuccess("新增成功");
  872. this.stepsType++;
  873. });
  874. }
  875. }
  876. });
  877. },
  878. /******************基本信息-结束******************/
  879. /******************章节信息-开始******************/
  880. //搜索查询课件
  881. queryResources() {
  882. this.queryParams.title=this.resourceName;
  883. listEl_resources(this.queryParams).then( response => {
  884. this.el_resourcesList = response.rows;
  885. this.total = response.total;
  886. });
  887. },
  888. //获取课件
  889. getResources() {
  890. listEl_resources(this.queryParams).then( response => {
  891. this.el_resourcesList = response.rows;
  892. this.total = response.total;
  893. });
  894. },
  895. //获取题目分类
  896. getList_option(){
  897. list_option({}).then(response => {
  898. this.optionList = response.data;
  899. });
  900. },
  901. //选中章节
  902. checkChapterClick(item){
  903. this.chapterIndex = item.id;
  904. this.$set(this,'chapterData',JSON.parse(JSON.stringify(item)))
  905. let hour = parseInt(this.chapterData.duration/3600);
  906. let hourNum = this.chapterData.duration - this.accMul(hour,3600);
  907. let minute = parseInt(hourNum/60)
  908. let second = hourNum - this.accMul(minute,60);
  909. let timeValue = hour+':'+minute+':'+second;
  910. this.$set(this.chapterData,'timeValue',timeValue);
  911. if(this.chapterData.postfix == "mp4"){
  912. this.getVideo();
  913. }else if(this.chapterData.postfix == "pdf" || this.chapterData.postfix == "doc" || this.chapterData.postfix == "docx"||this.chapterData.postfix == "ppt" || this.chapterData.postfix == "pptx"){
  914. this.getWord();
  915. }else if(this.chapterData.type == 5){
  916. this.getRichText();
  917. }
  918. if(this.chapterData.isAssess == 1){
  919. this.getQueryChapterQu(this.chapterData.id);
  920. }
  921. this.countTheNumberOfQuestions();
  922. this.exerciseAddClickOff();
  923. this.$forceUpdate();
  924. },
  925. //富文本处理
  926. getRichText(){
  927. this.chapterData.chapterData = unescape(this.chapterData.chapterData)
  928. },
  929. //视频处理
  930. getVideo(){
  931. let list = [];
  932. let obj = {
  933. type:'video/'+this.chapterData.postfix,
  934. src:this.chapterData.chapterData,
  935. };
  936. list.push(obj);
  937. this.playerOptions.sources = list;
  938. },
  939. //word处理
  940. async getWord(){
  941. this.chapterData.iframeSrc = this.urlJudge(this.chapterData.chapterData);
  942. },
  943. demo(player){
  944. console.log("123",player)
  945. },
  946. //子类展开/关闭
  947. chapterTreeClick(item,type){
  948. item.showType = type;
  949. },
  950. //添加新章节
  951. add_el_chapterClick(){
  952. let obj = {
  953. type:0,
  954. courseId:this.infoId.id,
  955. parentId:0,
  956. title:"新章节"
  957. };
  958. add_el_chapter(obj).then( response => {
  959. response.data.showType = true;
  960. if(this.chapterList[0]){
  961. this.chapterList.push(response.data);
  962. }else{
  963. this.chapterList.push(response.data);
  964. this.chapterIndex = response.data.id
  965. this.chapterData = JSON.parse(JSON.stringify(response.data))
  966. }
  967. this.msgSuccess("新增成功");
  968. });
  969. },
  970. //时间确定
  971. timeChange(data){
  972. // this.$set(this.chapterData,'timeValue',data);
  973. let timeList = data.split(":");
  974. let hour = timeList[0];
  975. let minute = timeList[1];
  976. let second = timeList[2];
  977. minute = this.accAdd(minute,this.accMul(hour,60));
  978. second = this.accAdd(second,this.accMul(minute,60));
  979. this.$set(this.chapterData,'duration',second);
  980. this.$forceUpdate();
  981. },
  982. //修改章节
  983. edit_el_chapterClick(){
  984. let self = this;
  985. console.log("this.chapterData.duration",this.chapterData.duration)
  986. this.$refs["chapterForm"].validate(valid => {
  987. if (valid) {
  988. if(this.chapterData.chapterData){
  989. if(self.chapterData.isAssess == 1&& !self.chapterData.exerciseList){
  990. this.msgError("请添加题目或关闭课后考核")
  991. return
  992. }
  993. if(self.chapterData.isAssess == 1&& !self.chapterData.exerciseList[0]){
  994. this.msgError("请添加题目或关闭课后考核")
  995. return
  996. }
  997. let list = [];
  998. if(self.chapterData.isAssess == 1&& self.chapterData.exerciseList){
  999. for(let i=0;i<self.chapterData.exerciseList.length;i++){
  1000. let minObj = {
  1001. quId:self.chapterData.exerciseList[i].quId
  1002. }
  1003. list.push(minObj);
  1004. }
  1005. }
  1006. let obj ={
  1007. courseId:this.infoId.id,
  1008. id:this.chapterData.id,
  1009. title:this.chapterData.title,
  1010. // description:this.chapterData.description,
  1011. duration:this.chapterData.duration,
  1012. isAssess:this.chapterData.isAssess,
  1013. };
  1014. if(list[0]){
  1015. obj.assessName = this.chapterData.assessName
  1016. obj.chapterQuList = list;
  1017. }
  1018. edit_el_chapter(obj).then( response => {
  1019. this.msgSuccess("修改成功");
  1020. this.getInfoDataTow();
  1021. this.stepsType++
  1022. });
  1023. }else{
  1024. let obj ={
  1025. courseId:this.infoId.id,
  1026. id:this.chapterData.id,
  1027. title:this.chapterData.title,
  1028. // description:this.chapterData.description,
  1029. }
  1030. edit_el_chapter(obj).then( response => {
  1031. this.msgSuccess("修改成功");
  1032. this.getInfoDataTow();
  1033. this.stepsType++
  1034. });
  1035. }
  1036. }
  1037. });
  1038. },
  1039. //删除章节
  1040. del_el_chapter(item){
  1041. let self = this;
  1042. del_el_chapter(item.id).then( response => {
  1043. for(let i=0;i<self.chapterList.length;i++){
  1044. if(item.id == self.chapterList[i].id){
  1045. self.chapterList.splice(i,1);
  1046. }
  1047. }
  1048. if(item.id == this.chapterIndex){
  1049. if(self.chapterList[0]){
  1050. this.chapterIndex = self.chapterList[0].id
  1051. this.chapterData = JSON.parse(JSON.stringify(self.chapterList[0]))
  1052. }else{
  1053. this.chapterIndex = "";
  1054. this.chapterData = {};
  1055. }
  1056. }
  1057. this.$forceUpdate();
  1058. this.msgSuccess("删除成功");
  1059. this.getInfoDataTow();
  1060. });
  1061. },
  1062. //添加节
  1063. addMinChildren(item){
  1064. console.log("item",item);
  1065. if(!this.chapterData.id){
  1066. this.msgError("请先选择或添加章节");
  1067. return
  1068. }
  1069. if(this.chapterData.chapterData){
  1070. this.msgError("无法给课程添加课程");
  1071. return
  1072. }
  1073. let obj = {
  1074. type:1,
  1075. courseId:this.infoId.id,
  1076. parentId:this.chapterData.id,
  1077. resourcesId:item.id,
  1078. chapterData:item.path,
  1079. title:item.title,
  1080. duration:item.duration
  1081. };
  1082. if(item.type == 5){
  1083. obj.chapterData = item.content
  1084. }
  1085. add_el_chapter(obj).then( response => {
  1086. this.msgSuccess("添加成功");
  1087. this.getInfoDataTow();
  1088. });
  1089. },
  1090. // 筛选节点
  1091. filterNode(value, data) {
  1092. if (!value) return true;
  1093. return data.label.indexOf(value) !== -1;
  1094. },
  1095. // 节点单击事件
  1096. handleNodeClick(data) {
  1097. this.selectTree = data.title;
  1098. this.queryParams.cateId = data.id;
  1099. console.log('data',data);
  1100. this.getResources();
  1101. },
  1102. //打开课后练习页面
  1103. exerciseAddClickOn(){
  1104. this.exerciseAddType = true;
  1105. if(!this.chapterData.exerciseList){
  1106. this.$set(this.chapterData,'exerciseList',[]);
  1107. this.exerciseList = [];
  1108. }else{
  1109. this.$set(this,'exerciseList',this.chapterData.exerciseList);
  1110. }
  1111. },
  1112. //关闭课后练习页面
  1113. exerciseAddClickOff(){
  1114. this.exerciseAddType = false;
  1115. },
  1116. //保存课后练习页面数据并计算题目数量
  1117. exerciseAddClickSave(){
  1118. this.$set(this.chapterData,'exerciseList',this.exerciseList);
  1119. this.countTheNumberOfQuestions();
  1120. this.exerciseAddType = false;
  1121. },
  1122. //删除已添加题目
  1123. delExerciseListClick(row){
  1124. let self = this;
  1125. for(let i=0;self.exerciseList.length;i++){
  1126. if(row.quId == self.exerciseList[i].quId){
  1127. self.exerciseList.splice(i,1)
  1128. }
  1129. }
  1130. },
  1131. //获取题目列表
  1132. getExerciseList() {
  1133. this.loading = true;
  1134. listQu(this.exerciseQueryParams).then((response) => {
  1135. this.el_courseList = response.rows;
  1136. this.el_courseTotal = response.total;
  1137. this.loading = false;
  1138. });
  1139. },
  1140. /** 搜索按钮操作 */
  1141. exerciseHandleQuery() {
  1142. this.exerciseQueryParams.pageNum = 1;
  1143. this.getExerciseList();
  1144. },
  1145. /** 重置按钮操作 */
  1146. exerciseResetQuery() {
  1147. this.resetForm("exerciseQueryParams");
  1148. this.handleQuery();
  1149. },
  1150. /** 添加题目*/
  1151. exerciseAdd(row){
  1152. let self = this;
  1153. for(let i=0;i<self.exerciseList.length;i++){
  1154. if(row.id == self.exerciseList[i].quId){
  1155. this.msgError("该题目已添加")
  1156. return
  1157. }
  1158. }
  1159. row.quId = row.id;
  1160. this.exerciseList.push(row);
  1161. },
  1162. /** 计算题目数量 */
  1163. countTheNumberOfQuestions(){
  1164. let self = this;
  1165. if(this.stepsType == 1){
  1166. console.log('1');
  1167. if(this.chapterData.chapterData){
  1168. console.log('2');
  1169. if(this.chapterData.exerciseList){
  1170. console.log('3');
  1171. let total = 0;
  1172. let one = 0;
  1173. let many = 0;
  1174. let judge = 0;
  1175. for(let i=0;i<self.chapterData.exerciseList.length;i++){
  1176. console.log('4');
  1177. total++
  1178. if(self.chapterData.exerciseList[i].quType == 1){
  1179. one++
  1180. }else if(self.chapterData.exerciseList[i].quType == 2){
  1181. many++
  1182. }else if(self.chapterData.exerciseList[i].quType == 3){
  1183. judge++
  1184. }
  1185. }
  1186. this.totalNum = total;
  1187. this.oneNum = one;
  1188. this.manyNum = many;
  1189. this.judgeNum = judge;
  1190. }else{
  1191. this.totalNum = 0;
  1192. this.oneNum = 0;
  1193. this.manyNum = 0;
  1194. this.judgeNum = 0;
  1195. }
  1196. }else{
  1197. this.totalNum = 0;
  1198. this.oneNum = 0;
  1199. this.manyNum = 0;
  1200. this.judgeNum = 0;
  1201. }
  1202. }
  1203. },
  1204. //获取章节题目数据
  1205. getQueryChapterQu(id){
  1206. console.log("id",id)
  1207. queryChapterQu(id).then( res => {
  1208. // console.log("res",res)
  1209. this.$set(this.chapterData,'exerciseList',res.data)
  1210. this.countTheNumberOfQuestions();
  1211. });
  1212. },
  1213. /******************章节信息-结束******************/
  1214. /******************设置信息-开始******************/
  1215. edutSetUpClick(){
  1216. this.$refs["setUpForm"].validate(valid => {
  1217. if (valid) {
  1218. let obj = {
  1219. id:this.infoId.id,
  1220. // duration:this.setUpForm.duration,
  1221. // points:this.setUpForm.points,
  1222. ceTime:this.setUpForm.ceTime,
  1223. ceType:this.setUpForm.ceType,
  1224. status:this.setUpForm.status,
  1225. videoDraggable:this.setUpForm.videoDraggable,
  1226. };
  1227. updateEl_course(obj).then( response => {
  1228. this.msgSuccess("修改成功");
  1229. this.offPage();
  1230. });
  1231. }
  1232. });
  1233. },
  1234. /******************设置信息-结束******************/
  1235. //乘法
  1236. accMul(arg1,arg2){
  1237. var m=0,s1=arg1.toString(),s2=arg2.toString();
  1238. try{m+=s1.split(".")[1].length}catch(e){}
  1239. try{m+=s2.split(".")[1].length}catch(e){}
  1240. return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
  1241. },
  1242. //加法
  1243. accAdd(arg1,arg2){
  1244. var r1,r2,m;
  1245. try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}
  1246. try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}
  1247. m=Math.pow(10,Math.max(r1,r2))
  1248. return ((arg1*m+arg2*m)/m).toFixed(0);
  1249. },
  1250. },
  1251. }
  1252. </script>
  1253. <style scoped lang="scss">
  1254. .edit-page {
  1255. flex:1;
  1256. display: flex!important;
  1257. flex-direction: column;
  1258. overflow: hidden;
  1259. /*box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);*/
  1260. /*padding:20px!important;*/
  1261. /*margin:9px 20px 20px;*/
  1262. .top-steps-box{
  1263. margin:20px 20px 0;
  1264. }
  1265. .center-content-max-box{
  1266. flex:1;
  1267. }
  1268. .bottom-button-box{
  1269. width:280px;
  1270. margin:0 auto 20px;
  1271. }
  1272. .info-max-box{
  1273. margin:20px 20px 0;
  1274. }
  1275. .chapter-max-box{
  1276. *{
  1277. margin:0;
  1278. padding:0;
  1279. }
  1280. display: flex;
  1281. overflow: hidden;
  1282. .left-new-chapter-box{
  1283. /*backAnimation-color: blueviolet;*/
  1284. box-shadow: 0 0 4px 1px rgba(0, 0, 0, 0.1);
  1285. border-radius:6px;
  1286. width:270px;
  1287. overflow: hidden;
  1288. margin:20px;
  1289. display: flex;
  1290. flex-direction: column;
  1291. .add-chapter-p{
  1292. margin:15px auto;
  1293. }
  1294. .chapter-list-for-max-box{
  1295. flex:1;
  1296. margin-bottom:20px;
  1297. overflow-y: scroll;
  1298. padding:0!important;
  1299. .chapter-list-for-big-box{
  1300. margin: 10px 6px 0 10px;
  1301. .chapter-list-for-box{
  1302. display: flex;
  1303. background: #F2F2F2;
  1304. border:1px solid #F2F2F2;
  1305. p{
  1306. line-height:30px;
  1307. font-size:15px;
  1308. }
  1309. p:nth-child(1){
  1310. width:30px;
  1311. text-align: center;
  1312. font-size:18px;
  1313. cursor:pointer;
  1314. }
  1315. p:nth-child(2){
  1316. flex:1;
  1317. display:block;
  1318. overflow:hidden;
  1319. text-overflow:ellipsis;
  1320. white-space:nowrap;
  1321. }
  1322. p:nth-child(3){
  1323. width:30px;
  1324. text-align: center;
  1325. font-size:18px;
  1326. cursor:pointer;
  1327. }
  1328. }
  1329. .chapter-list-min-for-box{
  1330. display: flex;
  1331. margin:10px 0 0 10px;
  1332. border:1px solid #F2F2F2;
  1333. p{
  1334. line-height:30px;
  1335. font-size:15px;
  1336. }
  1337. p:nth-child(1){
  1338. flex:1;
  1339. margin-left:10px;
  1340. display:block;
  1341. overflow:hidden;
  1342. text-overflow:ellipsis;
  1343. white-space:nowrap;
  1344. }
  1345. p:nth-child(2){
  1346. width:30px;
  1347. text-align: center;
  1348. font-size:18px;
  1349. cursor:pointer;
  1350. }
  1351. }
  1352. }
  1353. }
  1354. }
  1355. .center-content-box{
  1356. display: flex;
  1357. flex-direction: column;
  1358. /*backAnimation-color: red;*/
  1359. box-shadow: 0 0 4px 1px rgba(0, 0, 0, 0.1);
  1360. border-radius:6px;
  1361. flex:1;
  1362. margin:20px 0;
  1363. width: 861px;
  1364. .center-content-box-one{
  1365. flex:1;
  1366. display: flex;
  1367. flex-direction: column;
  1368. }
  1369. .center-content-box-two{
  1370. flex:1;
  1371. display: flex;
  1372. flex-direction: column;
  1373. overflow: hidden;
  1374. .center-content-box-two-top{
  1375. padding-top:10px;
  1376. }
  1377. .center-content-box-two-bottom{
  1378. flex:1;
  1379. display: flex;
  1380. overflow: hidden;
  1381. /*max-width:956px;*/
  1382. .center-content-box-two-bottom-left{
  1383. width:320px;
  1384. border:1px solid #dedede;
  1385. border-radius:4px;
  1386. margin:0 20px;
  1387. display: flex;
  1388. flex-direction: column;
  1389. overflow-y: hidden;
  1390. .del-i{
  1391. color:#999;
  1392. cursor:pointer;
  1393. font-size:16px;
  1394. }
  1395. .del-i:hover{
  1396. color:#FF6666;
  1397. }
  1398. .center-content-box-two-bottom-left-title{
  1399. background: #f8f8f9;
  1400. border-bottom:1px solid #dfe6ec;
  1401. height:40px;
  1402. line-height:40px;
  1403. padding-left:10px;
  1404. font-size:14px;
  1405. }
  1406. .center-content-box-two-bottom-left-null{
  1407. line-height:100px;
  1408. text-align: center;
  1409. font-size:14px;
  1410. color:#999;
  1411. }
  1412. .center-content-box-two-bottom-left-for-box{
  1413. flex:1;
  1414. display: flex;
  1415. flex-direction: column;
  1416. .center-content-box-two-bottom-left-for-p{
  1417. border-top:1px solid #dfe6ec;
  1418. flex:1;
  1419. line-height:40px;
  1420. font-size:14px;
  1421. color:#999;
  1422. font-weight:500;
  1423. padding:0 10px;
  1424. display:block;
  1425. white-space:nowrap;
  1426. }
  1427. }
  1428. }
  1429. .center-content-box-two-bottom-right{
  1430. flex:1;
  1431. border:1px solid #dedede;
  1432. border-radius:4px;
  1433. display: flex;
  1434. flex-direction: column;
  1435. overflow-y: hidden;
  1436. margin-right:20px;
  1437. position: relative;
  1438. .center-content-box-two-bottom-right-table{
  1439. display: flex;
  1440. flex-direction: column;
  1441. position: absolute;
  1442. width:100%;
  1443. height:100%;
  1444. }
  1445. }
  1446. }
  1447. .center-content-box-two-bottom-button{
  1448. height:60px;
  1449. display: flex;
  1450. p:nth-child(1){
  1451. flex:1;
  1452. }
  1453. p:nth-child(2){
  1454. width:80px;
  1455. margin:10px 0;
  1456. }
  1457. p:nth-child(3){
  1458. width:80px;
  1459. margin:10px 20px;
  1460. }
  1461. }
  1462. }
  1463. .center-info-components-max-box{
  1464. margin:20px;
  1465. overflow-y: scroll;
  1466. flex:1;
  1467. display: flex;
  1468. flex-direction: column;
  1469. iframe{
  1470. flex:1;
  1471. }
  1472. }
  1473. .exercise-add-max-box{
  1474. margin:20px 20px 0;
  1475. display: flex;
  1476. .exercise-add-text-box{
  1477. display: flex;
  1478. flex:1;
  1479. div{
  1480. flex:1;
  1481. padding:10px 20px;
  1482. background: #f5f5f5;
  1483. }
  1484. }
  1485. .exercise-add-button{
  1486. width:200px;
  1487. line-height:40px;
  1488. text-align: center;
  1489. border-radius:6px;
  1490. margin-right:20px;
  1491. }
  1492. }
  1493. }
  1494. .right-courseware-box{
  1495. /*backAnimation-color: blue;*/
  1496. display: flex;
  1497. flex-direction: column;
  1498. box-shadow: 0 0 4px 1px rgba(0, 0, 0, 0.1);
  1499. border-radius:6px;
  1500. width:365px;
  1501. margin:20px;
  1502. padding: 0 20px;
  1503. box-sizing: border-box;
  1504. .el-resources-tree{
  1505. /* flex:1;*/
  1506. border-bottom:1px solid #dedede;
  1507. overflow-y: scroll;
  1508. height: 130px;
  1509. }
  1510. .el-resources-search{
  1511. flex:1;
  1512. }
  1513. .el-resources-list{
  1514. height: 72%;
  1515. overflow-y: auto;
  1516. }
  1517. }
  1518. }
  1519. .set-up-max-box{
  1520. *{
  1521. margin:0;
  1522. padding:0;
  1523. }
  1524. }
  1525. .title-p{
  1526. margin:0;
  1527. line-height:40px;
  1528. font-size:16px;
  1529. color:#0045AF;
  1530. font-weight:500;
  1531. padding-left:20px;
  1532. border-bottom:2px solid #E0E0E0;
  1533. }
  1534. .null-add-p{
  1535. font-size:20px;
  1536. color:#999;
  1537. text-align: center;
  1538. line-height:300px;
  1539. font-weight:500;
  1540. }
  1541. .checkChapter{
  1542. border:1px solid #0045AF !important;
  1543. }
  1544. .video-player{
  1545. video{
  1546. object-fit:fill!important;
  1547. }
  1548. }
  1549. }
  1550. </style>