edit.vue 56 KB

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