index.vue 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356
  1. <template>
  2. <div class="pb_content" style="background: #f0f2f5;" v-loading="loading">
  3. <div class="pb_content_body" style="position: relative; margin: 0">
  4. <div class="right">
  5. <div class="courseTop">
  6. <div class="stepsNav">
  7. <el-breadcrumb separator-class="el-icon-arrow-right">
  8. <el-breadcrumb-item :to="{
  9. path:
  10. '/test?userid=' +
  11. userid +
  12. '&oid=' +
  13. oid +
  14. '&org=' +
  15. org +
  16. '&role=' +
  17. role,
  18. }">表单管理</el-breadcrumb-item>
  19. <el-breadcrumb-item>
  20. <span style="color: rgb(15, 126, 255)">查看表单</span>
  21. </el-breadcrumb-item>
  22. </el-breadcrumb>
  23. </div>
  24. <div class="r_pub_button_retrun" @click="retrunCourse">返回</div>
  25. </div>
  26. <div class="step_box" ref="stepBox" v-loading="pdfLoading">
  27. <div class="test_title">
  28. <div class="left">
  29. <div class="title">{{ testJson.title }}</div>
  30. <div class="info" v-if="isDesktop">
  31. <div class="info_box" v-if="testJson.typeN">
  32. <span>类型:</span>
  33. <span>{{ testJson.typeN }}</span>
  34. </div>
  35. <div class="info_box">
  36. <span>填写范围:</span>
  37. <span>{{ testJson.juriP ? testJson.juriP : '所有人' }}</span>
  38. </div>
  39. <div class="info_box" v-if="testJson.overtime">
  40. <span>截止时间:</span>
  41. <span>{{ testJson.overtime }}</span>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="right" v-if="isDesktop">
  46. <div class="data_box">
  47. <span>提交数量</span>
  48. <span><span class="big">{{ works.length }}</span>份</span>
  49. </div>
  50. <div class="data_box" v-if="testJson.juriP">
  51. <span>表单完成率</span>
  52. <span><span class="big">{{ (iscount / pcount * 100).toFixed(0) }}</span>%</span>
  53. </div>
  54. <div class="data_box" v-if="testJson.juriP">
  55. <span>未完成人数</span>
  56. <span><span class="big">{{ pcount - iscount }}</span></span>
  57. </div>
  58. <div class="btn_box" @click="dialogVisibleShare = true">
  59. <span></span>
  60. <span>提醒</span>
  61. </div>
  62. </div>
  63. </div>
  64. <div class="search_nav">
  65. <div class="right">
  66. <span :class="{ active: stype == 1 }" @click="checkDataType(1)">按题目查看</span>
  67. <span :class="{ active: stype == 2 }" @click="checkDataType(2)">按人员查看</span>
  68. <span :class="{ active: stype == 3 }" @click="checkDataType(3)" v-show="false">按数量查看</span>
  69. </div>
  70. <div class="left" v-if="isDesktop">
  71. <div style="margin-right: 10px;position: relative;" v-if="stype == 2 || stype == 3">
  72. <el-select v-model="TeachingValue" @change="searchCourse" placeholder="按教研室">
  73. <el-option
  74. label="全部"
  75. value="">
  76. </el-option>
  77. <el-option
  78. v-for="item in TeachingOptions"
  79. :key="item.id"
  80. :label="item.name"
  81. :value="item.id">
  82. </el-option>
  83. </el-select>
  84. </div>
  85. <div style="margin-right: 10px;position: relative;" v-if="stype == 2 || stype == 3">
  86. <el-date-picker
  87. v-model="SubmitTime"
  88. type="date"
  89. @change="searchCourse"
  90. value-format="yyyy-MM-dd"
  91. placeholder="选择日期">
  92. </el-date-picker>
  93. <!-- <el-select v-model="SubmitTime" placeholder="按提交时间筛选">
  94. <el-option
  95. label="全部"
  96. value="">
  97. </el-option>
  98. <el-option
  99. v-for="item in SubmitTimeOptions"
  100. :key="item.id"
  101. :label="item.name"
  102. :value="item.id">
  103. </el-option>
  104. </el-select> -->
  105. </div>
  106. <div style="margin-right: 10px;position: relative;" v-if="stype == 2 || stype == 3">
  107. <el-input v-model="courseName" class="student_input" placeholder="请输入需要搜索的姓名"></el-input>
  108. <span class="serach_icon" @click="searchCourse"></span>
  109. </div>
  110. <div class="btnA" v-if="stype == 1 && !pdfLoading" @click="exportPDF">导出PDF</div>
  111. <div class="btnA" v-if="stype == 2" @mouseenter="btnDisplay = true" @mouseleave="btnDisplay = false">
  112. 导出数据
  113. <div v-show="btnDisplay" class="buttonBox">
  114. <div type="primary" @click="exportExcel">下载汇总表格</div>
  115. <div type="primary" @click="exportAllWord">导出人员数据</div>
  116. </div>
  117. </div>
  118. <div class="btnA" v-if="stype == 3" @click="exportAllWord2">导出人员数据</div>
  119. </div>
  120. </div>
  121. <div class="title_content" v-if="stype == 1">
  122. <div class="title_box" v-if="!testArray.length"
  123. style="display: flex;align-items: center;justify-content: center;height: 500px;">
  124. 暂无内容
  125. </div>
  126. <div class="title_box" v-for="(item, index) in testArray" :key="index">
  127. <div class="title">
  128. <el-tooltip :content="selectType(item)" placement="top" effect="dark">
  129. <span class="test_icon"
  130. :class="{ test_icon_check: item.type == 1 && item.atype == 2, test_icon_checkO: item.type == 1 && item.atype == 1, test_icon_gap: item.type == 3, test_icon_file: item.type == 5, test_course_file: item.type == 6, test_eva_file: item.type == 7,test_icon_time: item.type == 8 }"></span>
  131. </el-tooltip>
  132. <span>{{ item.title }}</span>
  133. <el-button v-if="item.type == 5 && item.array.length>0" class="title_downBtn" type="primary" size="small" @click.stop="downloadFileType5(item.array,item.title)">批量下载附件</el-button>
  134. <div v-if="item.type==7" style="right:0;position: absolute;">平均分:{{ getAverageScore(index) }}</div>
  135. </div>
  136. <div class="detail" v-if="item.detail">{{ item.detail }}</div>
  137. <div class="content1" v-if="item.type == 1">
  138. <div class="left">
  139. <div class="title">
  140. <span>选项</span>
  141. <span>小计</span>
  142. <span>比例</span>
  143. </div>
  144. <div class="data" v-for="(data, index2) in item.array" :key="index + '-' + index2">
  145. <span>
  146. <el-tooltip :content="data.name" placement="top" effect="dark">
  147. <!-- content to trigger tooltip here -->
  148. <span>{{ data.name }}</span>
  149. </el-tooltip>
  150. </span>
  151. <span>{{ data.count }}</span>
  152. <span>
  153. <el-progress style="display: flex;align-items: center;" :stroke-width="12" color="#3681fc"
  154. :percentage="data.count ? parseFloat(((data.count / item.count) * 100).toFixed(2)) : 0"></el-progress>
  155. </span>
  156. </div>
  157. </div>
  158. <div class="right">
  159. <checkPie :dataJ="item.array"></checkPie>
  160. </div>
  161. </div>
  162. <div class="content2" v-if="item.type == 3">
  163. <div class="left">
  164. <div class="title">
  165. <span>序号</span>
  166. <span>词频</span>
  167. <span>答案文本</span>
  168. </div>
  169. <div class="data" v-for="(data, index2) in item.array" :key="index + '-' + index2">
  170. <span>{{ index2 + 1 }}</span>
  171. <span>{{ data.count }}次</span>
  172. <el-tooltip :content="data.name" placement="top" effect="dark">
  173. <!-- content to trigger tooltip here -->
  174. <span>{{ data.name }}</span>
  175. </el-tooltip>
  176. </div>
  177. </div>
  178. <div class="right">
  179. <wordcloud :data="item.array" nameKey="name" valueKey="count" :showTooltip="false"
  180. :wordClick="wordClickHandler">
  181. </wordcloud>
  182. </div>
  183. </div>
  184. <div class="content3" v-if="item.type == 5">
  185. <div class="file" v-for="(file, index2) in item.array" :key="index + '-' + index2"
  186. @click.stop="checkFile(file)">
  187. <img class="download" src="../../../../assets/icon/fileIcon/download.png"
  188. @click.stop="downloadFile(file)" :style="{ right: '10px' }" />
  189. <img class="img" :src="wordIcon" alt="" v-if="file.type == 1" />
  190. <img class="img" :src="videoIcon" alt="" v-if="file.type == 2" />
  191. <img class="img" :src="file.url" alt="" v-if="file.type == 3" />
  192. <img class="img" :src="wordIcon" alt="" v-if="file.type == 4" />
  193. <img class="img" :src="fileIcon" alt="" v-if="file.type == 5" />
  194. <div class="name">
  195. <el-tooltip :content="file.name" placement="top" effect="dark">
  196. <span>{{ file.name }}</span>
  197. </el-tooltip>
  198. </div>
  199. </div>
  200. </div>
  201. <div class="content4" v-if="item.type == 6">
  202. <div class="out_box" v-for="(item, index) in item.courseArray" :key="index + '-' + index2">
  203. <div class="tup">
  204. <img :src="item.cover != null && item.cover != ''
  205. ? JSON.parse(item.cover).length > 0
  206. ? JSON.parse(item.cover)[0].url
  207. : mr
  208. : mr
  209. " alt />
  210. <div class="bottom_box">
  211. <div>
  212. <el-tooltip :content="item.title" popper-class="text_tooltip" placement="top" effect="dark">
  213. <span>{{ item.title }}</span>
  214. </el-tooltip>
  215. </div>
  216. <div class="kc_t">
  217. <span>{{ item.username }}</span>
  218. <span>{{ item.state == 1 ? '阶段模式' : item.state == 2 ? '任务模式' : '极简模式' }}</span>
  219. </div>
  220. <div class="kc_time">
  221. <span style="color: #717C8D">创建日期:</span>{{ item.time }}
  222. </div>
  223. <div class="kc_time">
  224. <span style="color: #717C8D">修改日期:</span>{{ item.update_at }}
  225. </div>
  226. </div>
  227. </div>
  228. </div>
  229. <!-- <div class="courses" v-for="(courses, index2) in item.array" :key="index + '-' + index2">
  230. {{ courses }}
  231. </div> -->
  232. </div>
  233. <div class="content1" v-if="item.type == 7">
  234. <div class="left">
  235. <div class="title">
  236. <span>评分</span>
  237. <span>小计</span>
  238. <span>比例</span>
  239. </div>
  240. <div class="data" v-for="(data, index2) in item.array" :key="index + '-' + index2">
  241. <span>
  242. <span>{{ data.name }}</span>
  243. </span>
  244. <span>{{ data.count }}</span>
  245. <span>
  246. <el-progress style="display: flex;align-items: center;" :stroke-width="12" color="#3681fc"
  247. :percentage="data.count ? parseFloat(((data.count / item.count) * 100).toFixed(2)) : 0"></el-progress>
  248. </span>
  249. </div>
  250. </div>
  251. <div class="right">
  252. <checkPie :dataJ="item.array"></checkPie>
  253. </div>
  254. </div>
  255. <div class="content2" v-if="item.type == 8">
  256. <div class="left">
  257. <div class="title">
  258. <span>序号</span>
  259. <span>词频</span>
  260. <span>日期</span>
  261. </div>
  262. <div class="data" v-for="(data, index2) in item.array" :key="index + '-' + index2">
  263. <span>{{ index2 + 1 }}</span>
  264. <span>{{ data.count }}次</span>
  265. <el-tooltip :content="data.name" placement="top" effect="dark">
  266. <!-- content to trigger tooltip here -->
  267. <span>{{ data.name }}</span>
  268. </el-tooltip>
  269. </div>
  270. </div>
  271. <div class="right">
  272. <wordcloud :data="item.array" nameKey="name" valueKey="count" :showTooltip="false"
  273. :wordClick="wordClickHandler">
  274. </wordcloud>
  275. </div>
  276. </div>
  277. </div>
  278. </div>
  279. <div class="table_content" v-if="stype == 2">
  280. <el-table class="el-table" ref="table" :data="worksArray" border :fit="true" :key="2" v-loading="isLoading"
  281. style="width: 100%" :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }"
  282. @filter-change="handleFilterChange">
  283. <el-table-column fixed label="序号" width="80px" align="left">
  284. <template slot-scope="scope">
  285. {{ scope.$index + 1 }}
  286. </template>
  287. </el-table-column>
  288. <el-table-column fixed prop="name" label="提交人" width="120px" align="left">
  289. </el-table-column>
  290. <el-table-column prop="time" label="提交时间" width="170px" align="left">
  291. <template slot-scope="scope">
  292. <span :style="`${testJson.overtime&&new Date(testJson.overtime)<new Date(scope.row.time)?'color:#d12920':''}`">{{ scope.row.time }}</span>
  293. </template>
  294. </el-table-column>
  295. <el-table-column v-for="(item, index) in chapters" :key="index" :label="item.json.title"
  296. :min-width="item.type == 5 ? 200 : 150" align="left" :filters="item.type == 1 ? item.nameFilters : item.type == 6? item.nameFilters : null"
  297. :filter-method="item.type == 1 ? (value, row) => { return filterName(value, row, index) } : item.type == 6?(value, row) => { return filterCourse(value, row, index)}:null"
  298. :filter-placement="item.type == 1 || item.type ==6 ? filterPlacement : null">
  299. <template slot-scope="scope">
  300. <div v-if="scope.row.array[index].type == 1" style="display: flex; flex-wrap: wrap;">
  301. <span class="answer_type" v-for="(answer2, index2) in scope.row.array[index].json.answer2"
  302. :key="index + '-' + index2">{{ scope.row.array[index].json.array[answer2].option }}</span>
  303. </div>
  304. <div v-if="scope.row.array[index].type == 3 || scope.row.array[index].type == 8" style="display: flex; flex-wrap: wrap;">
  305. {{ scope.row.array[index].json.answer2 }}
  306. </div>
  307. <div v-if="scope.row.array[index].type == 5" style="display: flex; flex-wrap: wrap;"
  308. class="table_file">
  309. <div class="file" v-for="(file, index2) in scope.row.array[index].json.file"
  310. :key="index + '-' + index2" @click.stop="checkFile(file)">
  311. <img class="download" src="../../../../assets/icon/fileIcon/download.png"
  312. @click.stop="downloadFile(file)" :style="{ right: '10px' }" />
  313. <img class="img" :src="wordIcon" alt="" v-if="file.type == 1" />
  314. <img class="img" :src="videoIcon" alt="" v-if="file.type == 2" />
  315. <img class="img" :src="file.url" alt="" v-if="file.type == 3" />
  316. <img class="img" :src="wordIcon" alt="" v-if="file.type == 4" />
  317. <img class="img" :src="fileIcon" alt="" v-if="file.type == 5" />
  318. <div class="name">
  319. <el-tooltip :content="file.name" placement="top" effect="dark">
  320. <span>{{ file.name }}</span>
  321. </el-tooltip>
  322. </div>
  323. </div>
  324. </div>
  325. <div v-if="scope.row.array[index].type == 6" style="display: flex; flex-wrap: wrap;">
  326. {{ scope.row.array[index].json.answer2}}
  327. </div>
  328. <div v-if="scope.row.array[index].type == 7" style="display: flex; flex-wrap: wrap;">
  329. {{ getScore(scope.row.array[index].json) }}
  330. </div>
  331. </template>
  332. </el-table-column>
  333. <el-table-column label="操作" width="300px" fixed="right" v-if="isN!=1">
  334. <template slot-scope="scope">
  335. <el-button @click="getTest(scope.row)" type="primary" size="small">查看</el-button>
  336. <el-button @click="setWordHtml(scope.row)" type="primary" size="small">导出答题信息</el-button>
  337. <el-button @click="deleteTest(scope.row.id)" type="primary" size="small">删除</el-button>
  338. </template>
  339. </el-table-column>
  340. </el-table>
  341. </div>
  342. <div class="table_content" v-if="stype == 3">
  343. <div class="student_table">
  344. <el-table ref="table" :data="tableData" border :fit="true" v-loading="isLoading" style="width: 100%"
  345. :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }" :row-class-name="tableRowClassName">
  346. <el-table-column prop="username" label="提交人" min-width="15" align="center">
  347. </el-table-column>
  348. <el-table-column prop="time" label="提交时间" min-width="15" align="center">
  349. </el-table-column>
  350. <el-table-column label="是否批改" min-width="15" align="center">
  351. <template slot-scope="scope">
  352. <div>{{ scope.row.type == 3 ? '是' : '否' }}</div>
  353. </template>
  354. </el-table-column>
  355. <el-table-column label="操作" width="300px" v-if="isDesktop">
  356. <template slot-scope="scope" >
  357. <el-button @click="getTest(scope.row)" type="primary" size="small">查看</el-button>
  358. <el-button @click="setWordHtml2(scope.row)" type="primary" size="small">导出答题信息</el-button>
  359. <el-button @click="deleteTest(scope.row.id)" type="primary" size="small">删除</el-button>
  360. </template>
  361. </el-table-column>
  362. </el-table>
  363. </div>
  364. <div class="student_page">
  365. <el-pagination background layout="prev, pager, next" :page-size="pageSize" :total="total"
  366. @current-change="handleCurrentChange">
  367. </el-pagination>
  368. </div>
  369. </div>
  370. </div>
  371. </div>
  372. </div>
  373. <share-box :testJson="testJson" :TeachingValue="TeachingValue" :TeachName="TeachNameCpt" :dialogVisibleShare.sync="dialogVisibleShare"></share-box>
  374. <wpdf :dialogVisiblePdf.sync="dialogVisiblePdf" :url="wurl"></wpdf>
  375. <wVideo :dialogVisibleVideo.sync="dialogVisibleVideo" :url="wurl"></wVideo>
  376. <wOffice :dialogVisibleOffice.sync="dialogVisibleOffice" :url="wurl"></wOffice>
  377. </div>
  378. </template>
  379. <script>
  380. import shareBox from '../shareBox/index.vue'
  381. import videoIcon from '../../../../assets/icon/fileIcon/isVideo.png'
  382. import wordIcon from '../../../../assets/icon/fileIcon/isWord.png'
  383. import fileIcon from '../../../../assets/icon/fileIcon/word2.png'
  384. import wVideo from "../file/wVideo.vue";
  385. import wpdf from "../file/wPdf2.vue";
  386. import wOffice from "../file/wOffice.vue";
  387. import wordcloud from 'vue-wordcloud';
  388. import checkPie from '../data/checkPie.vue';
  389. import { downloadPDF } from '../../../tools/pdf'
  390. import JSZip from "jszip";
  391. import FileSaver from "file-saver";
  392. import XLSX from "xlsx-js-style";
  393. const getFile = (url) => {
  394. return new Promise((resolve, reject) => {
  395. var credentials = {
  396. accessKeyId: "AKIATLPEDU37QV5CHLMH",
  397. secretAccessKey: "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",
  398. }; //秘钥形式的登录上传
  399. window.AWS.config.update(credentials);
  400. window.AWS.config.region = "cn-northwest-1"; //设置区域
  401. let url2 = url;
  402. let _url2 = "";
  403. if (
  404. url2.indexOf("https://view.officeapps.live.com/op/view.aspx?src=") != -1
  405. ) {
  406. _url2 = url2.split(
  407. "https://view.officeapps.live.com/op/view.aspx?src="
  408. )[1];
  409. } else {
  410. _url2 = url2;
  411. }
  412. var s3 = new window.AWS.S3({ params: { Bucket: "ccrb" } });
  413. let name = decodeURIComponent(_url2.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1])
  414. var params = {
  415. Bucket: "ccrb",
  416. Key: name
  417. };
  418. s3.getObject(params, function (err, data) {
  419. if (err) {
  420. console.log(err, err.stack)
  421. resolve({ data: 1 });
  422. } else {
  423. resolve({ data: data.Body });
  424. console.log(data);
  425. } // sxuccessful response
  426. });
  427. // axios({
  428. });
  429. };
  430. export default {
  431. components: {
  432. shareBox,
  433. wVideo,
  434. wpdf,
  435. wOffice,
  436. checkPie,
  437. wordcloud
  438. },
  439. data() {
  440. return {
  441. userid: this.$route.query.userid,
  442. oid: this.$route.query.oid,
  443. org: this.$route.query.org,
  444. role: this.$route.query.role,
  445. cid: this.$route.query.cid,
  446. isN: this.$route.query.isN,
  447. screenWidth: window.innerWidth,
  448. isDesktop: false,
  449. title: "",
  450. testType: [],
  451. see: false,
  452. cJson: [],
  453. loading: false,
  454. look: "",
  455. TeachingOptions:[],
  456. TeachingValue :'',
  457. SubmitTimeOptions: [],
  458. SubmitTime: '',
  459. tableHeight: 500,
  460. isLoading: false,
  461. pageSize: 10,
  462. total: 0,
  463. page: 1,
  464. tableData: [],
  465. testJson: {},
  466. works: [],
  467. iscount: 0,
  468. pcount: 0,
  469. stype: 1,
  470. courseName: "",
  471. dialogVisibleShare: false,
  472. worksArray: [],
  473. testArray: [],
  474. options2: {
  475. 1: "选择题",
  476. // 2: "问答题",
  477. 3: "问答题",
  478. 4: "添加文档",
  479. 5: "附件"
  480. },
  481. videoIcon: videoIcon,
  482. wordIcon: wordIcon,
  483. fileIcon: fileIcon,
  484. dialogVisiblePdf: false,
  485. dialogVisibleVideo: false,
  486. dialogVisibleOffice: false,
  487. wurl: "",
  488. chapters: [],
  489. filterPlacement: 'bottom-end',
  490. pdfLoading: false,
  491. btnDisplay: false
  492. };
  493. },
  494. watch: {},
  495. computed: {
  496. TeachNameCpt: function () {
  497. // `this` 指向 vm 实例
  498. return this.TeachingOptions.filter(i => {return i.id == this.TeachingValue})
  499. },
  500. // TeachNameCpt(){
  501. // return function (val) {
  502. // let a = this.TeachingOptions.filter(i => {
  503. // if (i.id == val) {
  504. // return i.name
  505. // }}
  506. // )
  507. // console.log('aaaaaaaaaaaaaa',a);
  508. // return a;
  509. // };
  510. // },
  511. // vcWords() {
  512. // return function (array) {
  513. // let _array = [];
  514. // if (array.length) {
  515. // for (var i = 0; i < array.length; i++) {
  516. // _array.push(
  517. // {
  518. // text: array[i].name,
  519. // weight: array[i].count,
  520. // }
  521. // )
  522. // }
  523. // }
  524. // console.log(_array);
  525. // return array.length ? _array : [];
  526. // };
  527. // },
  528. getScore() {
  529. return function (item) {
  530. let array = []
  531. for (var i = parseInt(item.small); i <= parseInt(item.big); i++) {
  532. array.push(i)
  533. }
  534. return item.answer2 ? array[item.answer2] : ''
  535. };
  536. },
  537. selectType() {
  538. return function (item) {
  539. if (item.type == 1 && item.atype == 2) {
  540. return '多选题'
  541. } else if (item.type == 1 && item.atype == 1) {
  542. return '单选题'
  543. } else if (item.type == 3) {
  544. return '问答题'
  545. } else if (item.type == 5) {
  546. return '附件'
  547. } else if (item.type == 6) {
  548. return '课程'
  549. } else if (item.type == 7) {
  550. return '评分'
  551. } else if (item.type == 8) {
  552. return '日期'
  553. }
  554. };
  555. },
  556. // 获取评分的平均分
  557. getAverageScore(){
  558. return (_index)=>{
  559. let _result = 0;
  560. let _sum = 0;
  561. this.worksArray.forEach(i1=>{
  562. _result+=i1.array[_index].json.answer2
  563. _sum+=1;
  564. })
  565. _result=(_result/_sum).toFixed(2)
  566. return _result;
  567. }
  568. }
  569. },
  570. methods: {
  571. //获取教研室列表
  572. getClass2() {
  573. let params = {
  574. oid: this.oid,
  575. };
  576. this.ajax
  577. .get(this.$store.state.api + "selectTeacherOfficeBySchool", params)
  578. .then((res) => {
  579. this.TeachingOptions = res.data[0];
  580. console.log('this.TeachingOptions',this.TeachingOptions);
  581. })
  582. .catch((err) => {
  583. this.isLoading = false;
  584. console.error(err);
  585. });
  586. },
  587. filterName(value, row, index) {
  588. let name = []
  589. for (var i = 0; i < row.array[index].json.answer2.length; i++) {
  590. name.push(row.array[index].json.array[row.array[index].json.answer2[i]].option)
  591. }
  592. console.log(name.indexOf(value) != -1);
  593. return name.indexOf(value) != -1;
  594. },
  595. // 筛选课程
  596. filterCourse(value, row, index) {
  597. return row.array[index].json.answer2 == value;
  598. },
  599. wordClickHandler(name, value) {
  600. // this.$notify({
  601. // title: name,
  602. // message: "数量:"+value
  603. // });
  604. },
  605. retrunCourse() {
  606. this.goTo(
  607. "/test?userid=" +
  608. this.userid +
  609. "&oid=" +
  610. this.oid +
  611. "&org=" +
  612. this.org +
  613. "&role=" +
  614. this.role
  615. );
  616. },
  617. goTo(path) {
  618. this.$router.push(path);
  619. },
  620. tableRowClassName({ row, rowIndex }) {
  621. if ((rowIndex + 1) % 2 === 0) {
  622. return "even_row";
  623. } else {
  624. return "";
  625. }
  626. },
  627. changeHeight() {
  628. if (this.stype == 1) {
  629. return
  630. }
  631. this.tableHeight = this.$refs.stepBox.offsetHeight - 120;
  632. if (this.tableHeight <= 530) {
  633. this.tableHeight = 530;
  634. }
  635. // 监听窗口大小变化
  636. let self = this;
  637. window.onresize = function () {
  638. if (self.stype == 1) {
  639. return
  640. }
  641. self.tableHeight = this.$refs.stepBox.offsetHeight - 120;
  642. if (self.tableHeight <= 530) {
  643. self.tableHeight = 530;
  644. }
  645. };
  646. // this.$refs.table.$el.offsetTop:表格距离浏览器的高度 //200表示你想要调整的表格距离底部的高度(你可以自己随意调整),因为我们一般都有放分页组件的,所以需要给它留一个高度
  647. },
  648. handleCurrentChange(val) {
  649. this.page = val;
  650. this.getData2();
  651. },
  652. getTest(row) {
  653. this.$router.push(
  654. "/checkTest2?cid=" +
  655. row.courseid +
  656. "&userid=" +
  657. this.userid +
  658. "&userid2=" +
  659. row.userid +
  660. "&tid=" +
  661. row.id +
  662. "&oid=" +
  663. this.oid +
  664. "&org=" +
  665. this.org +
  666. "&type=2" +
  667. "&role=" +
  668. this.role
  669. );
  670. },
  671. checkDataType(type) {
  672. if (this.stype != type) {
  673. this.stype = type
  674. this.courseName = ''
  675. if (type == 3) {
  676. this.getData2();
  677. } else {
  678. this.getData();
  679. }
  680. this.changeHeight();
  681. }
  682. },
  683. searchCourse() {
  684. if (this.stype == 3) {
  685. this.getData2()
  686. } else {
  687. this.getData()
  688. }
  689. },
  690. getData() {
  691. this.isLoading = true;
  692. let params = {
  693. cid: this.cid,
  694. cn: this.courseName,
  695. tim : !this.SubmitTime? '' : this.SubmitTime,
  696. tea: this.TeachingValue
  697. };
  698. this.ajax
  699. .get(this.$store.state.api + "getTestWorksNoPageCopy", params)
  700. .then(async (res) => {
  701. this.testJson = res.data[0][0]
  702. console.log('this.testJson',JSON.parse(JSON.stringify(this.testJson)));
  703. if (this.testJson.juriP) {
  704. let ajuri2 = this.testJson.juri2.split (',');
  705. let ajurip = this.testJson.juriP.split (',');
  706. let JData = ajuri2.reverse()
  707. this.TeachingOptions = JData.map((key, index) => ({
  708. id : key,
  709. name: ajurip[index]
  710. }));
  711. }else{
  712. this.getClass2()
  713. }
  714. // console.log('dddd',this.TeachingOptions);
  715. this.works = res.data[1]
  716. this.iscount = res.data[2][0].count
  717. this.pcount = res.data[3][0].count
  718. let chapters = this.setJSON(this.setJson2(JSON.parse(JSON.stringify(JSON.parse(res.data[0][0].chapters)))))
  719. this.chapters = this.setFilter(this.JSONSetting(JSON.parse(JSON.stringify(JSON.parse(res.data[0][0].chapters)))))
  720. let testArray = []
  721. let array = []
  722. for (let i = 0; i < this.works.length; i++) {
  723. let cJson = this.setJSON(JSON.parse(JSON.stringify(JSON.parse(this.works[i].courseJson))))
  724. if (JSON.stringify(cJson) == JSON.stringify(chapters)) {
  725. let _json = this.JSONSetting(JSON.parse(JSON.stringify(JSON.parse(this.works[i].courseJson))))
  726. for (var ja = 0; ja < _json.length; ja++) {
  727. let _json2 = _json[ja].json
  728. if (_json[ja].type == 6) {
  729. let _cjson = await this.getCourse(_json2.answer2)
  730. _json2.answer2 = _cjson.title
  731. }
  732. }
  733. array.push({
  734. courseid: this.works[i].courseid,
  735. id: this.works[i].id,
  736. userid: this.works[i].userid,
  737. name: this.works[i].username ? this.works[i].username : '匿名',
  738. time: this.works[i].time,
  739. array: _json,
  740. courseJson: JSON.parse(this.works[i].courseJson),
  741. })
  742. }
  743. }
  744. for (var i = 0; i < this.chapters.length; i++) {
  745. let el = this.chapters[i]
  746. let topic = {
  747. type: el.type,
  748. title: el.json ? el.json.title : '',
  749. detail: el.json ? el.json.detail : '',
  750. atype: el.json ? el.json.type : '',
  751. choice: el.json ? el.json.array : '',
  752. array: [],
  753. answer: el.json ? el.json.answer : '',
  754. count: 0,
  755. courses: el.json ? el.json.courses : [],
  756. small: el.json ? el.json.small : '',
  757. big: el.json ? el.json.big : '',
  758. }
  759. if (topic.type == 1) {
  760. for (var t = 0; t < topic.choice.length; t++) {
  761. topic.array.push({
  762. name: topic.choice[t].option,
  763. count: 0
  764. })
  765. }
  766. } else if (topic.type == 3) {
  767. } else if (topic.type == 5) {
  768. } else if (topic.type == 6) {
  769. let _answer = topic.courses
  770. topic.array = _answer
  771. topic.courseArray = [];
  772. let params = {
  773. cid:topic.array.join(",")
  774. }
  775. let data = await this.ajax.get(this.$store.state.api + 'getCourseInfoTestAll',params);
  776. let result = data.data[0]
  777. // this.chapters.find(i=>i.type==6).nameFilters = result.map(r=>{return{text:r.title,value:r.courseId}})
  778. result.forEach(i=>{
  779. if(this.chapters.find(f=>f.type==6).nameFilters.find(c=>c.value==i.title)==undefined){
  780. this.chapters.find(i=>i.type==6).nameFilters.push({text:i.title,value:i.title})
  781. }
  782. })
  783. // this.chapters.find(i=>i.type==6).nameFilters = result.map(r=>{return{text:r.title,value:r.title}})
  784. result.forEach(i=>i.update_at=new Date(i.update_at).toLocaleString('zh-CN', {year: 'numeric',month: '2-digit',day: '2-digit',hour: '2-digit',minute: '2-digit',second: '2-digit',hour12: false}).replace(/\//g,'-'))
  785. topic.courseArray = result;
  786. // topic.array.forEach(async i => {
  787. // let data = await this.getCourse(i)
  788. // console.log(data.update_at)
  789. // data.update_at = new Date(data.update_at).toLocaleString('zh-CN', {year: 'numeric',month: '2-digit',day: '2-digit',hour: '2-digit',minute: '2-digit',second: '2-digit',hour12: false}).replace(/\//g,'-')
  790. // topic.courseArray.push(data)
  791. // })
  792. } else if (topic.type == 7) {
  793. for (var t = parseInt(topic.small); t <= parseInt(topic.big); t++) {
  794. topic.array.push({
  795. name: t,
  796. count: 0
  797. })
  798. }
  799. }
  800. for (var j = 0; j < array.length; j++) {
  801. let el2 = array[j]
  802. if (topic.type == 1) {
  803. let _answer = el2.array[i].json.answer2
  804. for (var k = 0; k < _answer.length; k++) {
  805. topic.array[_answer[k]].count++
  806. topic.count++
  807. }
  808. } else if (topic.type == 3 || topic.type == 8) {
  809. let type3 = 1
  810. let _answer = el2.array[i].json.answer2
  811. if (_answer) {
  812. for (var k = 0; k < topic.array.length; k++) {
  813. if (topic.array[k].name == _answer) {
  814. topic.array[k].count++
  815. type3 = 2
  816. topic.count++
  817. break;
  818. }
  819. }
  820. if (type3 == 1) {
  821. topic.array.push({
  822. name: _answer,
  823. count: 1
  824. })
  825. }
  826. }
  827. } else if (topic.type == 5) {
  828. let _answer = el2.array[i].json.file ? el2.array[i].json.file : []
  829. console.log(el2)
  830. let _user = {userid:el2.userid,username:el2.name}
  831. for (var k = 0; k < _answer.length; k++) {
  832. topic.array.push({..._answer[k],..._user})
  833. }
  834. } else if (topic.type == 7) {
  835. if(el2.array[i].json.answer2){
  836. let _answer = el2.array[i].json.answer2
  837. topic.array[_answer].count++
  838. topic.count++
  839. }
  840. }
  841. }
  842. console.log(topic)
  843. testArray.push(topic)
  844. }
  845. this.testArray = testArray
  846. this.worksArray = array
  847. this.isLoading = false;
  848. })
  849. .catch((err) => {
  850. console.error(err);
  851. });
  852. },
  853. getData2() {
  854. this.isLoading = true;
  855. let params = {
  856. cid: this.cid,
  857. page: this.page,
  858. pageSize: this.pageSize,
  859. cn: this.courseName
  860. };
  861. this.ajax
  862. .get(this.$store.state.api + "getTestWorksPage3", params)
  863. .then((res) => {
  864. this.isLoading = false;
  865. this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
  866. this.tableData = res.data[0];
  867. })
  868. .catch((err) => {
  869. console.error(err);
  870. });
  871. },
  872. setJSON(json) {
  873. return json.filter((item) => {
  874. if (item.array) {
  875. item.array = item.array.filter((item2) => {
  876. if (item2.ttype == 1 && item2.json) {
  877. delete item2.json.answer2
  878. delete item2.json.score2
  879. delete item2.json.file
  880. }
  881. if (item2.array) {
  882. item2.array = item2.array.filter((item3) => {
  883. if (item3.ttype == 1 && item3.json) {
  884. delete item3.json.answer2
  885. delete item3.json.score2
  886. delete item3.json.file
  887. }
  888. return item3;
  889. });
  890. }
  891. return item2;
  892. });
  893. } else if (item.ttype == 1 && item.json) {
  894. delete item.json.answer2
  895. delete item.json.score2
  896. delete item.json.file
  897. }
  898. return item
  899. console.log(item.array);
  900. });
  901. },
  902. setJson2(json) {
  903. let _json = json;
  904. // this.type = _json[0].ttype;
  905. let checkArray = _json.filter((item) => {
  906. if (item.array) {
  907. item.array = item.array.filter((item2) => {
  908. if (item2.ttype == 1 && item2.json && !item2.json.answer2) {
  909. item2.json.answer2 = [];
  910. }
  911. if (item2.array) {
  912. item2.array = item2.array.filter((item3) => {
  913. if (item3.ttype == 1 && item3.json && !item3.json.answer2) {
  914. item3.json.answer2 = [];
  915. }
  916. return item3;
  917. });
  918. }
  919. return (
  920. (item2.ttype != 1 && item2.array.length > 0) || item2.ttype == 1
  921. );
  922. });
  923. }
  924. if (item.ttype == 1 && item.json && !item.json.answer2) {
  925. item.json.answer2 = [];
  926. }
  927. console.log(item.array);
  928. return (item.ttype != 1 && item.array.length > 0) || item.ttype == 1;
  929. });
  930. console.log(checkArray);
  931. return checkArray;
  932. },
  933. JSONSetting(json) {
  934. let _json = json
  935. let array = []
  936. _json.filter((item) => {
  937. if (item.array) {
  938. item.array = item.array.filter((item2) => {
  939. if (item2.ttype == 1 && item2.json) {
  940. array.push(item2)
  941. }
  942. if (item2.array) {
  943. item2.array = item2.array.filter((item3) => {
  944. if (item3.ttype == 1 && item3.json) {
  945. array.push(item3)
  946. }
  947. return item3;
  948. });
  949. }
  950. return item2;
  951. });
  952. }
  953. if (item.ttype == 1 && item.json) {
  954. array.push(item)
  955. }
  956. console.log(item.array);
  957. return item;
  958. });
  959. console.log(array);
  960. return array;
  961. },
  962. setFilter(json) {
  963. let _json = json
  964. let array = []
  965. _json.filter((item) => {
  966. item.nameFilters = [],
  967. item.filterParams = {
  968. name: [],
  969. }
  970. if (item.type == 1) {
  971. for (var i = 0; i < item.json.array.length; i++) {
  972. item.nameFilters.push({ text: item.json.array[i].option, value: item.json.array[i].option })
  973. }
  974. }
  975. array.push(item)
  976. return item;
  977. });
  978. return array
  979. },
  980. checkFile(item) {
  981. if (item.type == 3) {
  982. this.$hevueImgPreview(item.url);
  983. } else if (item.type == 5) {
  984. this.downloadFile(item);
  985. } else if (item.type == 1) {
  986. this.dialogVisibleOffice = true
  987. this.wurl = item.url
  988. } else if (item.type == 2) {
  989. this.dialogVisibleVideo = true
  990. this.wurl = item.url
  991. } else if (item.type == 4) {
  992. this.dialogVisiblePdf = true
  993. this.wurl = item.url
  994. }
  995. },
  996. downloadFile(f) {
  997. var credentials = {
  998. accessKeyId: "AKIATLPEDU37QV5CHLMH",
  999. secretAccessKey: "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",
  1000. }; //秘钥形式的登录上传
  1001. window.AWS.config.update(credentials);
  1002. window.AWS.config.region = "cn-northwest-1"; //设置区域
  1003. let url2 = f.url;
  1004. let _url2 = "";
  1005. if (
  1006. url2.indexOf("https://view.officeapps.live.com/op/view.aspx?src=") != -1
  1007. ) {
  1008. _url2 = url2.split(
  1009. "https://view.officeapps.live.com/op/view.aspx?src="
  1010. )[1];
  1011. } else {
  1012. _url2 = url2;
  1013. }
  1014. let _this = this;
  1015. _this.downLoading = _url2
  1016. var s3 = new window.AWS.S3({ params: { Bucket: "ccrb" } });
  1017. let name = decodeURIComponent(_url2.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1])
  1018. var params = {
  1019. Bucket: "ccrb",
  1020. Key: name
  1021. };
  1022. s3.getObject(params, function (err, data) {
  1023. _this.downLoading = ''
  1024. if (err) console.log(err, err.stack); // an error occurred
  1025. else {
  1026. let url = window.URL.createObjectURL(new Blob([data.Body]));
  1027. let a = document.createElement("a");
  1028. a.name = f.name;
  1029. a.href = url;
  1030. a.download = f.name;
  1031. a.click();
  1032. console.log(data);
  1033. } // sxuccessful response
  1034. });
  1035. },
  1036. deleteTest(tid) {
  1037. let _this = this
  1038. _this
  1039. .$confirm("确定删除此提交的表单么?", "提示", {
  1040. confirmButtonText: "确定",
  1041. cancelButtonText: "取消",
  1042. type: "warning",
  1043. })
  1044. .then(() => {
  1045. let params = [{
  1046. tid: tid,
  1047. }];
  1048. _this.ajax
  1049. .post(_this.$store.state.api + "deleteTestCourseWorks", params)
  1050. .then((res) => {
  1051. _this.$message.success("删除成功");
  1052. if (_this.stype == 3) {
  1053. _this.getData2();
  1054. } else {
  1055. _this.getData();
  1056. }
  1057. })
  1058. .catch((err) => {
  1059. console.error(err);
  1060. });
  1061. })
  1062. .catch(() => {
  1063. return;
  1064. });
  1065. },
  1066. exportPDF() {
  1067. this.pdfLoading = true
  1068. var a = document.getElementsByTagName("img")
  1069. for (var i = 0; i < a.length; i++) { a[i].crossOrigin = "*" }
  1070. downloadPDF(this.$refs.stepBox, this.testJson.title, () => {
  1071. var _a = document.getElementsByTagName("img")
  1072. for (var i = 0; i < _a.length; i++) {
  1073. _a[i].removeAttribute("crossorigin")
  1074. }
  1075. setTimeout(() => {
  1076. this.pdfLoading = false
  1077. }, 2000);
  1078. })
  1079. },
  1080. score(json) {
  1081. let score = 0
  1082. json.forEach(el => {
  1083. if ((el.ttype == 3 || el.ttype == 2) && el.array.length > 0) {
  1084. el.array.forEach(item => {
  1085. if (item.ttype == 2 && item.array.length > 0) {
  1086. item.array.forEach(item2 => {
  1087. if (item2.ttype == 1 && item2.json) {
  1088. score += item2.json.score ? parseFloat(item2.json.score) : 0
  1089. }
  1090. })
  1091. } else if (item.ttype == 1 && item.json) {
  1092. score += item.json.score ? parseFloat(item.json.score) : 0
  1093. }
  1094. })
  1095. } else if (el.ttype == 1 && el.json) {
  1096. score += el.json.score ? parseFloat(el.json.score) : 0
  1097. }
  1098. })
  1099. return score > 0 ? score + '分' : ''
  1100. },
  1101. score2(json) {
  1102. let score = 0
  1103. // let type = 1
  1104. json.forEach(el => {
  1105. if ((el.ttype == 3 || el.ttype == 2) && el.array.length > 0) {
  1106. el.array.forEach(item => {
  1107. if (item.ttype == 2 && item.array.length > 0) {
  1108. item.array.forEach(item2 => {
  1109. if (item2.ttype == 1 && item2.json) {
  1110. score += item2.json.score2 ? parseFloat(item2.json.score2) : 0
  1111. }
  1112. })
  1113. } else if (item.ttype == 1 && item.json) {
  1114. score += item.json.score2 ? parseFloat(item.json.score2) : 0
  1115. }
  1116. })
  1117. } else if (el.ttype == 1 && el.json) {
  1118. score += el.json.score2 ? parseFloat(el.json.score2) : 0
  1119. }
  1120. })
  1121. return score + '分'
  1122. },
  1123. setWordHtml(data) {
  1124. let _data = data
  1125. let _title = `<div style="font-size:30px;font-weight:bold;text-align:center;">${this.testJson.title}</div>`;
  1126. let score = this.score(data.courseJson)
  1127. let isScore = this.score2(data.courseJson)
  1128. let scoreContent = score ? `<b>(得分/总分)${isScore}/${score}</b>` : ''
  1129. let _content = `<div style="text-align:center;margin-top: 20px;"><b style="margin-right:40px">(答题人)${_data.name}</b>${scoreContent}(填写范围)${this.testJson.juriP ? this.testJson.juriP : '所有人'}(提交时间)${_data.time}</div>`
  1130. let _detail = this.testJson.brief ? `<div style="text-align:center;margin-top: 20px;">${this.testJson.brief}</div>` : ''
  1131. let _test = `<div style='margin-top:40px;'>`
  1132. for (let i = 0; i < _data.array.length; i++) {
  1133. let item = _data.array[i]
  1134. let _div = `<div style='margin-top:20px;font-weight:bold;'>${i + 1}、${item.json.title}</div>`
  1135. _test += _div
  1136. if (item.type == 1) {
  1137. for (let j = 0; j < item.json.array.length; j++) {
  1138. let check = item.json.array[j]
  1139. let _option = `<div style='margin:10px 0 0 40px;'>${(item.json.answer2 && item.json.answer2.indexOf(j) !== -1) ? '☑' : '☐'} ${check.option}</div>`
  1140. _test += _option
  1141. }
  1142. } else if (item.type == 3 && item.json.answer2) {
  1143. let _option = `<div style='margin:10px 0 0 40px;'>${item.json.answer2}</div>`
  1144. _test += _option
  1145. } else if (item.type == 5 && item.json.file) {
  1146. for (let j = 0; j < item.json.file.length; j++) {
  1147. let check = item.json.file[j]
  1148. let _option = `<div style='margin:10px 0 0 40px;'>${check.name} <a href='${check.url}'>${check.url}</a></div>`
  1149. _test += _option
  1150. }
  1151. } else if (item.type == 6 && item.json.answer2) {
  1152. let _option = `<div style='margin:10px 0 0 40px;'>打分课程:${item.json.answer2}</div>`
  1153. _test += _option
  1154. } else if (item.type == 7 && item.json.answer2 ) {
  1155. let _score = this.getScore2(item.json)
  1156. let _option = `<div style='margin:10px 0 0 40px;'>打分:${_score}分</div>`
  1157. _test += _option
  1158. } else if (item.type == 8 && item.json.answer2) {
  1159. let _option = `<div style='margin:10px 0 0 40px;'>${item.json.answer2}</div>`
  1160. _test += _option
  1161. }
  1162. }
  1163. _test += `</div>`
  1164. let _html = _title + _content + _detail + _test;
  1165. this.exportToWord(_data.name + '-' + _data.time, _html);
  1166. },
  1167. setWordHtml2(data) {
  1168. let _data = data
  1169. _data.array = this.JSONSetting(JSON.parse(JSON.stringify(JSON.parse(data.courseJson))))
  1170. let _title = `<div style="font-size:30px;font-weight:bold;text-align:center;">${this.testJson.title}</div>`;
  1171. let score = this.score(JSON.parse(data.courseJson))
  1172. let isScore = this.score2(JSON.parse(data.courseJson))
  1173. let scoreContent = score ? `<b>(得分/总分)${isScore}/${score}</b>` : ''
  1174. let _content = `<div style="text-align:center;margin-top: 20px;"><b style="margin-right:40px">(答题人)${_data.username ? _data.username : '匿名'}</b>${scoreContent}(填写范围)${this.testJson.juriP ? this.testJson.juriP : '所有人'}(提交时间)${_data.time}</div>`
  1175. let _detail = this.testJson.brief ? `<div style="text-align:center;margin-top: 20px;">${this.testJson.brief}</div>` : ''
  1176. let _test = `<div style='margin-top:40px;'>`
  1177. for (let i = 0; i < _data.array.length; i++) {
  1178. let item = _data.array[i]
  1179. let _div = `<div style='margin-top:20px;font-weight:bold;'>${i + 1}、${item.json.title}</div>`
  1180. _test += _div
  1181. if (item.type == 1) {
  1182. for (let j = 0; j < item.json.array.length; j++) {
  1183. let check = item.json.array[j]
  1184. let _option = `<div style='margin:10px 0 0 40px;'>${(item.json.answer2 && item.json.answer2.indexOf(j) !== -1) ? '☑' : '☐'} ${check.option}</div>`
  1185. _test += _option
  1186. }
  1187. } else if (item.type == 3 && item.json.answer2) {
  1188. let _option = `<div style='margin:10px 0 0 40px;'>${item.json.answer2}</div>`
  1189. _test += _option
  1190. } else if (item.type == 5 && item.json.file) {
  1191. for (let j = 0; j < item.json.file.length; j++) {
  1192. let check = item.json.file[j]
  1193. let _option = `<div style='margin:10px 0 0 40px;'>${check.name} <a href='${check.url}'>${check.url}</a></div>`
  1194. _test += _option
  1195. }
  1196. } else if (item.type == 6 && item.json.answer2) {
  1197. let _option = `<div style='margin:10px 0 0 40px;'>打分课程:${item.json.answer2}</div>`
  1198. _test += _option
  1199. } else if (item.type == 7 && item.json.answer2 ) {
  1200. let _score = this.getScore2(item.json)
  1201. let _option = `<div style='margin:10px 0 0 40px;'>打分:${_score}分</div>`
  1202. _test += _option
  1203. } else if (item.type == 8 && item.json.answer2) {
  1204. let _option = `<div style='margin:10px 0 0 40px;'>${item.json.answer2}</div>`
  1205. _test += _option
  1206. }
  1207. }
  1208. _test += `</div>`
  1209. let _html = _title + _content + _detail + _test;
  1210. this.exportToWord(_data.username ? _data.username : '匿名' + '-' + _data.time, _html);
  1211. },
  1212. async exportToWord(a, html) {
  1213. // 将html文件中需要用到的数据挂载到store上
  1214. const content = `<!DOCTYPE html>
  1215. <html lang="en">
  1216. <head>
  1217. <meta charset="UTF-8">
  1218. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  1219. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  1220. <title>${a}</title>
  1221. <style>
  1222. </style>
  1223. </head>
  1224. <body>
  1225. ${html}
  1226. </body>
  1227. </html>`;
  1228. // debugger
  1229. // 生成报告
  1230. const link = document.createElement("a");
  1231. let dname = a + ".doc";
  1232. // link.download = "报告.html"; // 文件名
  1233. link.download = dname; // 文件名
  1234. link.style.display = "none";
  1235. // 创建文件流
  1236. // 创建bolb实例时,内容一定要放在[]中
  1237. const blob = new Blob([content], {
  1238. type: "text/plain;charset='utf-8'",
  1239. });
  1240. link.href = window.URL.createObjectURL(blob);
  1241. document.body.appendChild(link);
  1242. link.click();
  1243. document.body.removeChild(link);
  1244. },
  1245. setWordHtmlAll(data) {
  1246. let _data = data
  1247. let _title = `<div style="font-size:30px;font-weight:bold;text-align:center;">${this.testJson.title}</div>`;
  1248. let score = this.score(data.courseJson)
  1249. let isScore = this.score2(data.courseJson)
  1250. let scoreContent = score ? `<b>(得分/总分)${isScore}/${score}</b>` : ''
  1251. let _content = `<div style="text-align:center;margin-top: 20px;"><b style="margin-right:40px">(答题人)${_data.name}</b>${scoreContent}(填写范围)${this.testJson.juriP ? this.testJson.juriP : '所有人'}(提交时间)${_data.time}</div>`
  1252. let _detail = this.testJson.brief ? `<div style="text-align:center;margin-top: 20px;">${this.testJson.brief}</div>` : ''
  1253. let _test = `<div style='margin-top:40px;'>`
  1254. for (let i = 0; i < _data.array.length; i++) {
  1255. let item = _data.array[i]
  1256. let _div = `<div style='margin-top:20px;font-weight:bold;'>${i + 1}、${item.json.title}</div>`
  1257. _test += _div
  1258. if (item.type == 1) {
  1259. for (let j = 0; j < item.json.array.length; j++) {
  1260. let check = item.json.array[j]
  1261. let _option = `<div style='margin:10px 0 0 40px;'>${(item.json.answer2 && item.json.answer2.indexOf(j) !== -1) ? '☑' : '☐'} ${check.option}</div>`
  1262. _test += _option
  1263. }
  1264. } else if (item.type == 3 && item.json.answer2) {
  1265. let _option = `<div style='margin:10px 0 0 40px;'>${item.json.answer2}</div>`
  1266. _test += _option
  1267. } else if (item.type == 5 && item.json.file) {
  1268. for (let j = 0; j < item.json.file.length; j++) {
  1269. let check = item.json.file[j]
  1270. let _option = `<div style='margin:10px 0 0 40px;'>${check.name} <a href='${check.url}'>${check.url}</a></div>`
  1271. _test += _option
  1272. }
  1273. } else if (item.type == 6 && item.json.answer2) {
  1274. let _option = `<div style='margin:10px 0 0 40px;'>打分课程:${item.json.answer2}</div>`
  1275. _test += _option
  1276. } else if (item.type == 7 && item.json.answer2 ) {
  1277. let _score = this.getScore2(item.json)
  1278. let _option = `<div style='margin:10px 0 0 40px;'>打分:${_score}分</div>`
  1279. _test += _option
  1280. } else if (item.type == 8 && item.json.answer2) {
  1281. let _option = `<div style='margin:10px 0 0 40px;'>${item.json.answer2}</div>`
  1282. _test += _option
  1283. }
  1284. }
  1285. _test += `</div>`
  1286. let _html = _title + _content + _detail + _test;
  1287. return this.exportToWordAll(_data.name + '-' + _data.time, _html);
  1288. },
  1289. async setWordHtmlAll2(data) {
  1290. let _data = data
  1291. _data.array = this.JSONSetting(JSON.parse(JSON.stringify(JSON.parse(data.courseJson))))
  1292. let _title = `<div style="font-size:30px;font-weight:bold;text-align:center;">${this.testJson.title}</div>`;
  1293. let score = this.score(JSON.parse(data.courseJson))
  1294. let isScore = this.score2(JSON.parse(data.courseJson))
  1295. let scoreContent = score ? `<b>(得分/总分)${isScore}/${score}</b>` : ''
  1296. let _content = `<div style="text-align:center;margin-top: 20px;"><b style="margin-right:40px">(答题人)${_data.username ? _data.username : '匿名'}</b>${scoreContent}(填写范围)${this.testJson.juriP ? this.testJson.juriP : '所有人'}(提交时间)${_data.time}</div>`
  1297. let _detail = this.testJson.brief ? `<div style="text-align:center;margin-top: 20px;">${this.testJson.brief}</div>` : ''
  1298. let _test = `<div style='margin-top:40px;'>`
  1299. for (let i = 0; i < _data.array.length; i++) {
  1300. let item = _data.array[i]
  1301. let _div = `<div style='margin-top:20px;font-weight:bold;'>${i + 1}、${item.json.title}</div>`
  1302. _test += _div
  1303. if (item.type == 1) {
  1304. for (let j = 0; j < item.json.array.length; j++) {
  1305. let check = item.json.array[j]
  1306. let _option = `<div style='margin:10px 0 0 40px;'>${(item.json.answer2 && item.json.answer2.indexOf(j) !== -1) ? '☑' : '☐'} ${check.option}</div>`
  1307. _test += _option
  1308. }
  1309. } else if (item.type == 3 && item.json.answer2) {
  1310. let _option = `<div style='margin:10px 0 0 40px;'>${item.json.answer2}</div>`
  1311. _test += _option
  1312. } else if (item.type == 5 && item.json.file) {
  1313. for (let j = 0; j < item.json.file.length; j++) {
  1314. let check = item.json.file[j]
  1315. let _option = `<div style='margin:10px 0 0 40px;'>${check.name} <a href='${check.url}'>${check.url}</a></div>`
  1316. _test += _option
  1317. }
  1318. } else if (item.type == 6 && item.json.answer2) {
  1319. let _cjson = await this.getCourse(item.json.answer2)
  1320. let _option = `<div style='margin:10px 0 0 40px;'>打分课程:${_cjson.title}</div>`
  1321. _test += _option
  1322. } else if (item.type == 7 && item.json.answer2 ) {
  1323. let _score = this.getScore2(item.json)
  1324. let _option = `<div style='margin:10px 0 0 40px;'>打分:${_score}分</div>`
  1325. _test += _option
  1326. } else if (item.type == 8 && item.json.answer2) {
  1327. let _option = `<div style='margin:10px 0 0 40px;'>${item.json.answer2}</div>`
  1328. _test += _option
  1329. }
  1330. }
  1331. _test += `</div>`
  1332. let _html = _title + _content + _detail + _test;
  1333. return this.exportToWordAll(_data.username ? _data.username : '匿名' + '-' + _data.time, _html);
  1334. },
  1335. async exportToWordAll(a, html) {
  1336. // 将html文件中需要用到的数据挂载到store上
  1337. const content = `<!DOCTYPE html>
  1338. <html lang="en">
  1339. <head>
  1340. <meta charset="UTF-8">
  1341. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  1342. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  1343. <title>${a}</title>
  1344. <style>
  1345. </style>
  1346. </head>
  1347. <body>
  1348. ${html}
  1349. </body>
  1350. </html>`;
  1351. // debugger
  1352. // 生成报告
  1353. const link = document.createElement("a");
  1354. let dname = a + ".doc";
  1355. // link.download = "报告.html"; // 文件名
  1356. link.download = dname; // 文件名
  1357. link.style.display = "none";
  1358. // 创建文件流
  1359. // 创建bolb实例时,内容一定要放在[]中
  1360. const blob = new Blob([content], {
  1361. type: "text/plain;charset='utf-8'",
  1362. });
  1363. return blob;
  1364. },
  1365. exportAllWord() {
  1366. this.pdfLoading = true;
  1367. const _chapInfo = this.worksArray;
  1368. let url = [];
  1369. for (let i = 0; i < _chapInfo.length; i++) {
  1370. url.push({
  1371. name: _chapInfo[i].name + '-' + _chapInfo[i].time,
  1372. blob: this.setWordHtmlAll(_chapInfo[i]),
  1373. });
  1374. }
  1375. console.log(url);
  1376. this.downLoadAll(url);
  1377. },
  1378. exportAllWord2() {
  1379. this.pdfLoading = true;
  1380. let params = {
  1381. cid: this.cid,
  1382. page: 1,
  1383. pageSize: 999,
  1384. cn: this.courseName
  1385. };
  1386. this.ajax
  1387. .get(this.$store.state.api + "getTestWorksPage3", params)
  1388. .then((res) => {
  1389. const _chapInfo = res.data[0];
  1390. let url = [];
  1391. for (let i = 0; i < _chapInfo.length; i++) {
  1392. url.push({
  1393. name: _chapInfo[i].username + '-' + _chapInfo[i].time,
  1394. blob: this.setWordHtmlAll2(_chapInfo[i]),
  1395. });
  1396. }
  1397. console.log(url);
  1398. this.downLoadAll(url);
  1399. })
  1400. .catch((err) => {
  1401. console.error(err);
  1402. });
  1403. },
  1404. downLoadAll(url) {
  1405. const data = url; // 需要下载打包的路径, 可以是本地相对路径, 也可以是跨域的全路径
  1406. const zip = new JSZip();
  1407. const cache = {};
  1408. data.forEach((item) => {
  1409. // 下载文件, 并存成ArrayBuffer对象
  1410. const file_name = item.name; // 获取文件名
  1411. zip.file(file_name + '.doc', item.blob, { binary: true }); // 逐个添加文件
  1412. cache[file_name] = item.blob;
  1413. });
  1414. zip.generateAsync({ type: "blob" }).then((content) => {
  1415. // 生成二进制流
  1416. FileSaver.saveAs(content, this.testJson.title + ".zip"); // 利用file-saver保存文件 自定义文件名
  1417. setTimeout(() => {
  1418. this.pdfLoading = false;
  1419. }, 2000);
  1420. });
  1421. },
  1422. handleFilterChange() {
  1423. console.log(this.$refs.table.store.states.data);
  1424. },
  1425. exportExcel() {
  1426. let res = this.$refs.table.store.states.data
  1427. if (!res.length) {
  1428. this.$message.error('无导出数据')
  1429. return
  1430. }
  1431. this.isLoading = true;
  1432. let chapters = this.chapters
  1433. var array = [];
  1434. for (var i = 0; i < res.length; i++) {
  1435. var _json = {};
  1436. _json["序号"] = i + 1;
  1437. _json["提交人"] = res[i].name ? res[i].name : '匿名';
  1438. _json["提交时间"] = res[i].time;
  1439. for (var j = 0; j < chapters.length; j++) {
  1440. _json[j + 1 + "." + chapters[j].json.title] = '';
  1441. if (res[i].array[j].type == 1 && res[i].array[j].json.answer2) {
  1442. let a = []
  1443. for (var answer2 = 0; answer2 < res[i].array[j].json.answer2.length; answer2++) {
  1444. a.push(res[i].array[j].json.array[res[i].array[j].json.answer2[answer2]].option)
  1445. }
  1446. _json[j + 1 + "." + chapters[j].json.title] = a.join('、')
  1447. } else if (res[i].array[j].type == 3 && res[i].array[j].json.answer2) {
  1448. _json[j + 1 + "." + chapters[j].json.title] = res[i].array[j].json.answer2
  1449. } else if (res[i].array[j].type == 5 && res[i].array[j].json.file) {
  1450. let files = []
  1451. for (let file = 0; file < res[i].array[j].json.file.length; file++) {
  1452. let check = res[i].array[j].json.file[file]
  1453. files.push(file + 1 + '.' + check.name + '----' + check.url)
  1454. }
  1455. _json[j + 1 + "." + chapters[j].json.title] = files.join('\n')
  1456. } else if (res[i].array[j].type == 6 && res[i].array[j].json.answer2) {
  1457. _json[j + 1 + "." + chapters[j].json.title] = res[i].array[j].json.answer2
  1458. } else if (res[i].array[j].type == 7 && res[i].array[j].json.answer2) {
  1459. let _score = this.getScore2(res[i].array[j].json)
  1460. _json[j + 1 + "." + chapters[j].json.title] = _score
  1461. } else if (res[i].array[j].type == 8 && res[i].array[j].json.answer2) {
  1462. _json[j + 1 + "." + chapters[j].json.title] = res[i].array[j].json.answer2
  1463. }
  1464. }
  1465. array.push(_json);
  1466. }
  1467. let widthJson = []
  1468. let widthArray = Object.keys(array[0])
  1469. for (let i = 0; i < widthArray.length; i++) {
  1470. if (i == 0) {
  1471. widthJson.push({ wch: 5 })
  1472. } else {
  1473. widthJson.push({ wch: 30 })
  1474. }
  1475. }
  1476. const workbook = XLSX.utils.book_new(); //创建一个新的工作簿对象
  1477. let ws = XLSX.utils.json_to_sheet(array); //将json对象数组转化成工作表
  1478. ws["!cols"] = widthJson;
  1479. const styleObj = {
  1480. alignment: {
  1481. horizontal: "center",
  1482. vertical: "center" // 设置垂直居中
  1483. }
  1484. }; // 设置居中对齐和加粗样式
  1485. for (let cell in ws) {
  1486. if (!cell[0].startsWith("!")) {
  1487. ws[cell]["s"] = styleObj;
  1488. }
  1489. }
  1490. XLSX.utils.book_append_sheet(workbook, ws, "sheet1"); //把sheet添加到workbook里,第三个参数是sheet名
  1491. XLSX.writeFile(workbook, this.testJson.title + ".xlsx");
  1492. this.isLoading = false;
  1493. this.$message({
  1494. message: "导出成功",
  1495. type: "success"
  1496. });
  1497. },
  1498. async getCourse(id) {
  1499. let params = {
  1500. cid: id,
  1501. };
  1502. let res = await this.ajax.get(this.$store.state.api + "getCourseInfoTest", params)
  1503. return res.data[0][0]
  1504. },
  1505. getScore2(item) {
  1506. let array = []
  1507. for (var i = parseInt(item.small); i <= parseInt(item.big); i++) {
  1508. array.push(i)
  1509. }
  1510. return item.answer2 ? array[item.answer2] : ''
  1511. },
  1512. checkScreenSize() {
  1513. this.screenWidth = window.innerWidth;
  1514. this.isDesktop = this.screenWidth > 750; // 你可以根据需要调整这个阈值
  1515. },
  1516. downloadFileType5(fileData,title="附件"){
  1517. let data = fileData;
  1518. const zip = new JSZip();
  1519. let downFileArray = [];
  1520. let uniqueArr = data.filter((v,i,a)=>a.map(mb=>mb.userid).indexOf(v.userid)==i);
  1521. uniqueArr.forEach(i=>{
  1522. downFileArray.push({userid:i.userid,username:i.username ? i.username : '匿名',urlList:data.filter(d=>d.userid==i.userid).map(m=>m)});
  1523. })
  1524. let promises = [];
  1525. if(downFileArray.length==1){//只有一位老师的情况
  1526. if(downFileArray[0].urlList.length>1){//多个文件的情况
  1527. const folder = zip.folder(`${downFileArray[0].username}`);
  1528. downFileArray[0].urlList.forEach(i=>{
  1529. const promise = getFile(i.url).then((data) => {
  1530. if (data.data != 1) {
  1531. // 下载文件, 并存成ArrayBuffer对象
  1532. const file_name = i.name; // 获取文件名
  1533. folder.file(file_name, data.data, { binary: true }); // 逐个添加文件
  1534. }
  1535. });
  1536. promises.push(promise)
  1537. })
  1538. }else{//只有一个文件的情况
  1539. promises.push(getFile(downFileArray[0].urlList[0].url).then((data) => {
  1540. if (data.data != 1) {
  1541. // 下载文件, 并存成ArrayBuffer对象
  1542. const file_name = `${downFileArray[0].username}-${downFileArray[0].urlList[0].name}`; // 获取文件名
  1543. zip.file(file_name, data.data, { binary: true }); // 逐个添加文件
  1544. }
  1545. }))
  1546. }
  1547. }else if(downFileArray.length>1){//有多位老师的情况
  1548. downFileArray.forEach(i=>{
  1549. if(i.urlList.length==1){//只有一个文件的情况
  1550. promises.push(getFile(i.urlList[0].url).then((data) => {
  1551. if (data.data != 1) {
  1552. // 下载文件, 并存成ArrayBuffer对象
  1553. const file_name = `${i.username ? i.username : '匿名'}-${i.urlList[0].name}`; // 获取文件名
  1554. zip.file(file_name, data.data, { binary: true }); // 逐个添加文件
  1555. }
  1556. }))
  1557. }else if(i.urlList.length>1){//有多个文件的
  1558. const folder = zip.folder(`${i.username ? i.username : '匿名'}`);
  1559. i.urlList.forEach(ui=>{
  1560. const promise = getFile(ui.url).then((data) => {
  1561. if (data.data != 1) {
  1562. // 下载文件, 并存成ArrayBuffer对象
  1563. const file_name = ui.name; // 获取文件名
  1564. folder.file(file_name, data.data, { binary: true }); // 逐个添加文件
  1565. }
  1566. })
  1567. promises.push(promise)
  1568. })
  1569. }
  1570. })
  1571. }
  1572. Promise.all(promises).then(() => {
  1573. zip.generateAsync({ type: "blob" }).then((content) => {
  1574. // 生成二进制流
  1575. FileSaver.saveAs(content, `${this.testJson.title}-${title}.zip`); // 利用file-saver保存文件 自定义文件名
  1576. });
  1577. });
  1578. },
  1579. },
  1580. beforeDestroy() {
  1581. document.getElementsByTagName('html')[0].style.overflow = '';
  1582. window.removeEventListener("resize", this.checkScreenSize);
  1583. },
  1584. mounted() {
  1585. this.checkScreenSize();
  1586. window.addEventListener("resize", this.checkScreenSize);
  1587. document.getElementsByTagName('html')[0].scrollTop = 0
  1588. document.getElementsByTagName('html')[0].style.overflow = 'hidden'
  1589. this.$nextTick(function () {
  1590. this.getData();
  1591. // this.getClass2()
  1592. this.changeHeight()
  1593. });
  1594. },
  1595. };
  1596. </script>
  1597. <style scoped>
  1598. .pb_content {
  1599. height: 100% !important;
  1600. /* margin: 0 20px 0 20px; */
  1601. }
  1602. .pb_content_body {
  1603. width: 100% !important;
  1604. height: 100%;
  1605. }
  1606. .pb_content_body>.right {
  1607. height: 100%;
  1608. width: 100%;
  1609. display: flex;
  1610. overflow: hidden;
  1611. flex-direction: column;
  1612. }
  1613. .basic_box {
  1614. margin: 0 auto;
  1615. position: relative;
  1616. padding: 0 20px 0 20px;
  1617. }
  1618. .courseTop {
  1619. display: flex;
  1620. flex-direction: row;
  1621. justify-content: space-between;
  1622. align-items: center;
  1623. width: calc(100% - 40px);
  1624. margin: 0 auto;
  1625. padding: 10px 0;
  1626. }
  1627. .stepsNav {
  1628. display: flex;
  1629. flex-direction: row;
  1630. justify-content: flex-start;
  1631. align-items: center;
  1632. }
  1633. .step_box {
  1634. width: calc(100% - 40px);
  1635. margin: 0 auto;
  1636. height: calc(100% - 50px);
  1637. overflow: auto;
  1638. background: #ffff;
  1639. border-radius: 5px;
  1640. }
  1641. .el-table>>>.even_row {
  1642. background-color: #f1f1f1 !important;
  1643. }
  1644. .student_page {
  1645. margin-top: 10px;
  1646. }
  1647. .test_title {
  1648. display: flex;
  1649. padding: 15px 15px;
  1650. width: 100%;
  1651. box-sizing: border-box;
  1652. justify-content: space-between;
  1653. align-items: center;
  1654. flex-wrap: wrap;
  1655. margin-bottom: 10px;
  1656. }
  1657. .test_title .left {
  1658. max-width: 100%;
  1659. margin-top: 10px
  1660. }
  1661. .test_title .left .title {
  1662. width: 100%;
  1663. font-size: 24px;
  1664. font-weight: 700;
  1665. overflow: hidden;
  1666. text-overflow: ellipsis;
  1667. white-space: nowrap;
  1668. }
  1669. .test_title .left .info {
  1670. display: flex;
  1671. margin-top: 15px;
  1672. }
  1673. .test_title .left .info .info_box {
  1674. font-size: 14px;
  1675. }
  1676. .test_title .left .info .info_box+.info_box {
  1677. margin-left: 20px;
  1678. padding-left: 20px;
  1679. border-left: 1px solid #E7E7E7;
  1680. }
  1681. .test_title .left .info .info_box span:nth-child(1) {
  1682. color: #00000099;
  1683. }
  1684. .test_title .left .info .info_box span:nth-child(2) {}
  1685. .test_title .right {
  1686. display: flex;
  1687. align-items: center;
  1688. margin-top: 10px;
  1689. max-width: 100%;
  1690. }
  1691. .test_title .right .data_box {
  1692. margin-right: 15px;
  1693. width: 150px;
  1694. border: 1px solid #e7e7e7;
  1695. border-radius: 5px;
  1696. padding: 0 10px;
  1697. height: 57px;
  1698. font-size: 14px;
  1699. color: #00000099;
  1700. display: flex;
  1701. justify-content: space-between;
  1702. align-items: center;
  1703. }
  1704. .test_title .right .data_box span:nth-child(1) {}
  1705. .test_title .right .data_box span:nth-child(2) {}
  1706. .test_title .right .data_box span:nth-child(2) .big {
  1707. font-size: 22px;
  1708. }
  1709. .test_title .right .btn_box {
  1710. display: flex;
  1711. flex-direction: column;
  1712. width: 57px;
  1713. height: 57px;
  1714. background: #3681fc;
  1715. border-radius: 5px;
  1716. font-size: 14px;
  1717. cursor: pointer;
  1718. align-items: center;
  1719. justify-content: center;
  1720. color: #fff;
  1721. }
  1722. .test_title .right .btn_box span:nth-child(1) {
  1723. display: block;
  1724. width: 12px;
  1725. height: 14px;
  1726. margin-bottom: 5px;
  1727. background-image: url('../../../../assets/icon/test/icon_share.png');
  1728. background-size: 100% 100%;
  1729. }
  1730. .test_title .right .btn_box span:nth-child(2) {}
  1731. .search_nav {
  1732. border-bottom: 1px solid #E7E7E7;
  1733. width: 100%;
  1734. box-sizing: border-box;
  1735. padding: 0 15px 10px;
  1736. display: flex;
  1737. align-items: flex-end;
  1738. height: 50px;
  1739. }
  1740. .search_nav>.right {
  1741. display: flex;
  1742. align-items: center;
  1743. }
  1744. .search_nav>.right>span {
  1745. height: 24px;
  1746. font-size: 14px;
  1747. color: #000;
  1748. cursor: pointer;
  1749. position: relative;
  1750. }
  1751. .search_nav>.right>span+span {
  1752. margin-left: 35px;
  1753. }
  1754. .search_nav>.right>span.active {
  1755. color: #3681FC;
  1756. font-weight: 600;
  1757. }
  1758. .search_nav>.right>span.active::before {
  1759. content: "";
  1760. position: absolute;
  1761. bottom: -10px;
  1762. width: 15px;
  1763. height: 3px;
  1764. background: #3681fc;
  1765. left: 50%;
  1766. transform: translateX(-50%);
  1767. }
  1768. .search_nav>.left {
  1769. display: flex;
  1770. align-items: center;
  1771. margin-left: auto;
  1772. }
  1773. .student_input>>>.el-input__inner {
  1774. height: 40px;
  1775. width: 190px;
  1776. font-size: 13px;
  1777. padding: 0 35px 0 10px;
  1778. }
  1779. .serach_icon {
  1780. position: absolute;
  1781. right: 12px;
  1782. top: 50%;
  1783. transform: translateY(-50%);
  1784. width: 13px;
  1785. height: 13px;
  1786. background: url("../../../../assets/icon/test/test_search.png") no-repeat;
  1787. background-size: 100% 100%;
  1788. cursor: pointer;
  1789. }
  1790. .title_content {
  1791. padding-bottom: 10px;
  1792. }
  1793. .title_content>.title_box {
  1794. width: calc(100% - 48px);
  1795. margin: 20px auto 0;
  1796. }
  1797. .title_content>.title_box>.title {
  1798. font-size: 18px;
  1799. display: flex;
  1800. white-space: pre-line;
  1801. position: relative;
  1802. }
  1803. .title_content>.title_box>.title>.test_icon {
  1804. min-width: 20px;
  1805. height: 20px;
  1806. }
  1807. .title_content>.title_box>.detail {
  1808. font-size: 14px;
  1809. color: #00000099;
  1810. margin-top: 8px;
  1811. white-space: pre-line;
  1812. }
  1813. .title_content>.title_box>.content1 {
  1814. display: flex;
  1815. width: 100%;
  1816. margin-top: 10px;
  1817. }
  1818. .title_content>.title_box>.content1>>>.el-progress__text {
  1819. color: #3681FC;
  1820. min-width: 55px;
  1821. font-size: 16px !important;
  1822. }
  1823. .title_content>.title_box>.content1>.left {
  1824. width: calc(100% - 620px);
  1825. border: 1px solid #e7e7e7;
  1826. }
  1827. .title_content>.title_box>.content1>.left>div+div {
  1828. border-top: 1px solid #e7e7e7;
  1829. }
  1830. .title_content>.title_box>.content1>.left>.title,
  1831. .title_content>.title_box>.content1>.left>.data {
  1832. display: flex;
  1833. height: 40px;
  1834. align-items: center;
  1835. width: 100%;
  1836. padding: 0 15px;
  1837. box-sizing: border-box;
  1838. line-height: 16px;
  1839. }
  1840. .title_content>.title_box>.content1>.left>.title>span,
  1841. .title_content>.title_box>.content1>.left>.data>span {
  1842. overflow: hidden;
  1843. text-overflow: ellipsis;
  1844. white-space: nowrap;
  1845. }
  1846. .title_content>.title_box>.content1>.left>.title>span:nth-child(1),
  1847. .title_content>.title_box>.content1>.left>.data>span:nth-child(1) {
  1848. width: calc(100% - 320px - 110px);
  1849. }
  1850. .title_content>.title_box>.content1>.left>.title>span:nth-child(2),
  1851. .title_content>.title_box>.content1>.left>.data>span:nth-child(2) {
  1852. width: 110px;
  1853. }
  1854. .title_content>.title_box>.content1>.left>.title>span:nth-child(3),
  1855. .title_content>.title_box>.content1>.left>.data>span:nth-child(3) {
  1856. width: 320px;
  1857. }
  1858. .title_content>.title_box>.content1>.left>.title {
  1859. font-weight: 700;
  1860. background: #F9FAFB;
  1861. }
  1862. .title_content>.title_box>.content1>.right {
  1863. width: 600px;
  1864. margin-left: 20px;
  1865. border: 1px solid #e7e7e7;
  1866. min-height: 300px;
  1867. }
  1868. .title_content>.title_box>.content2 {
  1869. display: flex;
  1870. width: 100%;
  1871. margin-top: 10px;
  1872. }
  1873. .title_content>.title_box>.content2>.left {
  1874. width: calc(100% - 620px);
  1875. border: 1px solid #e7e7e7;
  1876. }
  1877. .title_content>.title_box>.content2>.left>div+div {
  1878. border-top: 1px solid #e7e7e7;
  1879. }
  1880. .title_content>.title_box>.content2>.left>.title,
  1881. .title_content>.title_box>.content2>.left>.data {
  1882. display: flex;
  1883. height: 40px;
  1884. align-items: center;
  1885. width: 100%;
  1886. padding: 0 15px;
  1887. box-sizing: border-box;
  1888. line-height: 16px;
  1889. }
  1890. .title_content>.title_box>.content2>.left>.title>span,
  1891. .title_content>.title_box>.content2>.left>.data>span {
  1892. overflow: hidden;
  1893. text-overflow: ellipsis;
  1894. white-space: nowrap;
  1895. }
  1896. .title_content>.title_box>.content2>.left>.title>span:nth-child(1),
  1897. .title_content>.title_box>.content2>.left>.data>span:nth-child(1) {
  1898. width: 55px;
  1899. }
  1900. .title_content>.title_box>.content2>.left>.title>span:nth-child(2),
  1901. .title_content>.title_box>.content2>.left>.data>span:nth-child(2) {
  1902. width: 110px;
  1903. }
  1904. .title_content>.title_box>.content2>.left>.title>span:nth-child(3),
  1905. .title_content>.title_box>.content2>.left>.data>span:nth-child(3) {
  1906. max-width: calc(100% - 110px - 55px);
  1907. }
  1908. .title_content>.title_box>.content2>.left>.title {
  1909. font-weight: 700;
  1910. background: #F9FAFB;
  1911. }
  1912. .title_content>.title_box>.content2>.right {
  1913. width: 600px;
  1914. margin-left: 20px;
  1915. border: 1px solid #e7e7e7;
  1916. }
  1917. .title_content>.title_box>.content2>.right>>>.wordCloud {
  1918. height: auto;
  1919. min-height: 300px;
  1920. }
  1921. .title_content>.title_box>.content3 {
  1922. display: flex;
  1923. width: 100%;
  1924. overflow: auto;
  1925. }
  1926. .title_content>.title_box>.content3>.file {
  1927. min-width: 200px;
  1928. width: 200px;
  1929. height: 140px;
  1930. margin: 10px 10px 10px 0px;
  1931. border-radius: 15px;
  1932. box-shadow: rgb(223, 218, 218) 0px 0px 6px 1px;
  1933. overflow: hidden;
  1934. margin-right: 15px;
  1935. position: relative;
  1936. display: flex;
  1937. flex-direction: column;
  1938. }
  1939. .title_content>.title_box>.content3>.file>.img {
  1940. width: 100%;
  1941. height: calc(100% - 35px);
  1942. object-fit: cover;
  1943. cursor: pointer;
  1944. }
  1945. .title_content>.title_box>.content3>.file>.del {
  1946. position: absolute;
  1947. width: 25px;
  1948. top: 10px;
  1949. right: 10px;
  1950. cursor: pointer;
  1951. }
  1952. .title_content>.title_box>.content3>.file>.download {
  1953. position: absolute;
  1954. width: 25px;
  1955. top: 10px;
  1956. right: 35px;
  1957. cursor: pointer;
  1958. opacity: .8;
  1959. }
  1960. .title_content>.title_box>.content3>.file>.name {
  1961. height: 35px;
  1962. width: 100%;
  1963. background: #f9f9f9;
  1964. display: flex;
  1965. align-items: center;
  1966. padding: 0 10px;
  1967. box-sizing: border-box;
  1968. }
  1969. .title_content>.title_box>.content3>.file>.name>span {
  1970. display: block;
  1971. text-overflow: ellipsis;
  1972. max-width: 100%;
  1973. white-space: nowrap;
  1974. overflow: hidden;
  1975. }
  1976. .table_content {
  1977. /* width: calc(100% - 48px);
  1978. margin: 20px auto 0; */
  1979. padding: 20px 24px;
  1980. width: 100%;
  1981. box-sizing: border-box;
  1982. }
  1983. .table_content>>>.el-table td {
  1984. padding: 5px 0;
  1985. }
  1986. .answer_type {
  1987. background: #F0F2F5;
  1988. padding: 5px 10px;
  1989. display: block;
  1990. border-radius: 3px;
  1991. margin: 5px;
  1992. }
  1993. .table_file>.file {
  1994. min-width: 100px;
  1995. width: 100px;
  1996. height: 70px;
  1997. margin: 10px 10px 10px 0px;
  1998. border-radius: 5px;
  1999. box-shadow: rgb(223, 218, 218) 0px 0px 6px 1px;
  2000. overflow: hidden;
  2001. margin-right: 15px;
  2002. position: relative;
  2003. display: flex;
  2004. flex-direction: column;
  2005. }
  2006. .table_file>.file>.img {
  2007. width: 100%;
  2008. height: calc(100% - 20px);
  2009. object-fit: cover;
  2010. cursor: pointer;
  2011. }
  2012. .table_file>.file>.del {
  2013. position: absolute;
  2014. width: 25px;
  2015. top: 10px;
  2016. right: 10px;
  2017. cursor: pointer;
  2018. }
  2019. .table_file>.file>.download {
  2020. position: absolute;
  2021. width: 25px;
  2022. top: 10px;
  2023. right: 35px;
  2024. cursor: pointer;
  2025. opacity: .8;
  2026. }
  2027. .table_file>.file>.name {
  2028. height: 20px;
  2029. width: 100%;
  2030. background: #f9f9f9;
  2031. display: flex;
  2032. align-items: center;
  2033. padding: 0 10px;
  2034. box-sizing: border-box;
  2035. font-size: 12px;
  2036. }
  2037. .table_file>.file>.name>span {
  2038. display: block;
  2039. text-overflow: ellipsis;
  2040. max-width: 100%;
  2041. white-space: nowrap;
  2042. overflow: hidden;
  2043. }
  2044. .btnA {
  2045. color: #fff;
  2046. background-color: #0061FF;
  2047. padding: 0 24px;
  2048. font-size: 14px;
  2049. min-width: 64px;
  2050. font-weight: 500;
  2051. border-radius: 4px;
  2052. box-sizing: border-box;
  2053. border: none;
  2054. cursor: pointer;
  2055. transition: all 0.2s ease-in-out;
  2056. height: 36px;
  2057. display: flex;
  2058. align-items: center;
  2059. justify-content: center;
  2060. line-height: 1;
  2061. margin-right: 10px;
  2062. position: relative;
  2063. }
  2064. .buttonBox {
  2065. position: absolute;
  2066. bottom: -0;
  2067. transform: translateY(100%);
  2068. background: #fff;
  2069. border-radius: 5px;
  2070. box-shadow: 0 0 3px 1px #e3e3e3;
  2071. width: 100%;
  2072. z-index: 999;
  2073. }
  2074. .buttonBox>div {
  2075. height: 40px;
  2076. line-height: 40px;
  2077. width: 100%;
  2078. text-align: center;
  2079. color: #000;
  2080. box-sizing: border-box;
  2081. }
  2082. .buttonBox>div+div {
  2083. border-top: 1px solid #e0e0e0;
  2084. }
  2085. .buttonBox>div:hover {
  2086. background: #f6f8ff;
  2087. }
  2088. .content4 {
  2089. width: 100%;
  2090. height: auto;
  2091. display: flex;
  2092. flex-wrap: nowrap;
  2093. overflow: auto;
  2094. }
  2095. .out_box {
  2096. display: flex;
  2097. flex-direction: column;
  2098. flex-wrap: nowrap;
  2099. /* width: 200px; */
  2100. min-width: 280px;
  2101. width: 280px;
  2102. background: #fff;
  2103. /* background-color: white; */
  2104. margin-right: 15px;
  2105. /* border: 1px solid #ccc; */
  2106. height: fit-content;
  2107. box-sizing: border-box;
  2108. border-radius: 0px 0px 5px 5px;
  2109. /* overflow: hidden; */
  2110. margin-bottom: 15px;
  2111. position: relative;
  2112. border-radius: 8px;
  2113. box-sizing: border-box;
  2114. overflow: hidden;
  2115. border: 1px solid #3682fc00;
  2116. cursor: pointer;
  2117. border: 1px solid #6a9ff5;
  2118. height: auto;
  2119. }
  2120. .out_boxActive {
  2121. box-sizing: border-box;
  2122. border: 3px solid #3681FC !important;
  2123. }
  2124. .out_box:hover {
  2125. border: 1px solid #3681FC;
  2126. }
  2127. .bottom_box {
  2128. width: 100%;
  2129. display: flex;
  2130. padding: 10px;
  2131. flex-direction: column;
  2132. box-sizing: border-box;
  2133. height: 121px;
  2134. flex-wrap: nowrap;
  2135. justify-content: space-evenly;
  2136. }
  2137. .bottom_box>div:nth-child(1) {
  2138. width: 100%;
  2139. /* overflow: hidden;
  2140. text-overflow: ellipsis;
  2141. white-space: nowrap;
  2142. font-weight: bold; */
  2143. display: flex;
  2144. align-items: center;
  2145. justify-content: space-between;
  2146. }
  2147. .bottom_box>div:nth-child(1)>span:nth-child(1) {
  2148. max-width: 100%;
  2149. overflow: hidden;
  2150. text-overflow: ellipsis;
  2151. white-space: nowrap;
  2152. font-weight: bold;
  2153. }
  2154. .bottom_box>div:nth-child(1)>span:nth-child(2) {
  2155. min-width: fit-content;
  2156. font-size: 14px;
  2157. color: #8c8c8c;
  2158. }
  2159. .tup {
  2160. width: 100%;
  2161. height: auto;
  2162. margin: 0 auto;
  2163. overflow: hidden;
  2164. display: flex;
  2165. flex-direction: column;
  2166. align-items: center;
  2167. padding: 10px;
  2168. box-sizing: border-box;
  2169. }
  2170. .tup>img {
  2171. width: 100%;
  2172. height: 100%;
  2173. object-fit: cover;
  2174. }
  2175. .kc_time {
  2176. margin-top: 8px;
  2177. font-size: 14px;
  2178. color: #717C8D;
  2179. }
  2180. .kc_time+.kc_time {
  2181. margin-top: 0;
  2182. }
  2183. .kc_t {
  2184. margin-top: 5px;
  2185. width: 100%;
  2186. white-space: nowrap;
  2187. overflow: hidden;
  2188. text-overflow: ellipsis;
  2189. display: flex;
  2190. align-items: center;
  2191. justify-content: space-between;
  2192. }
  2193. .kc_t>span:nth-child(1) {
  2194. max-width: 100%;
  2195. overflow: hidden;
  2196. text-overflow: ellipsis;
  2197. white-space: nowrap;
  2198. }
  2199. .kc_t>span:nth-child(2) {
  2200. min-width: fit-content;
  2201. font-size: 14px;
  2202. color: #8c8c8c;
  2203. }
  2204. .title_box>.title>.title_downBtn{
  2205. position: absolute;
  2206. right: 10px;
  2207. top: 0;
  2208. }
  2209. </style>