test.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229
  1. <template>
  2. <div class="i_body_box">
  3. <div class="check_nav">
  4. <!-- <div class="nav all" v-show="this.ExamineBase.length > 0" :class="{ active: type == '1' }" @click="checkType('1')">
  5. 年度考核
  6. </div> -->
  7. <div class="nav all" :class="{ active: checkTypeValue == typeListStr }" @click="changeShowType(typeListStr)">
  8. 全部
  9. </div>
  10. <div class="nav" v-for="item in typeList" :key="item.id" :class="{ active: checkTypeValue == item.id,all:['8bfa67ce-e82a-11ef-b508-005056924926','9d3289d2-e82a-11ef-b508-005056924926','a824c728-e82a-11ef-b508-005056924926','8085418b-e82a-11ef-b508-005056924926'].includes(item.id)}" @click="changeShowType(item.id,item)">{{ item.name }}</div>
  11. <!-- <div class="nav" :class="{
  12. active: type == item.id,
  13. gr: item.id == 'afc3f97f-2429-408d-8dcd-5e63a44d355a',
  14. md: item.id == '478bcccd-e3a1-472b-aa29-3ed7bc479469',
  15. jy: item.id == '178a377a-b4f1-4a75-b3c3-2787a7c98784',
  16. yy: item.id == 'dda9728e-5f11-469e-89ee-aca518daf223',
  17. bj: item.id == 'afc3f97f-2429-408d-8dcd-5e63a44d355c'
  18. }" @click="checkType(item.id)" v-for="(item, index) in typeArray" :key="index">
  19. {{ item.name }}
  20. </div>
  21. <div class="nav all" :class="{ active: type == '0' }" @click="checkType('0')">
  22. 其他
  23. </div> -->
  24. </div>
  25. <div class="check_box" v-loading="loading">
  26. <!-- <examine v-if="type==1"></examine> -->
  27. <div class="noneData" v-if="!worksArray.length && type!=1" style="text-align: center; margin-top: 20px;">
  28. 暂无数据
  29. </div>
  30. <div class="test_panel" v-if="type!=1" v-for="(item, index) in worksArray" :key="index">
  31. <div class="test_panel_title">
  32. <div class="title" :style="{paddingLeft: (item.array.length > 0 || item.carray.length > 0) ? '0' : '30px'}" @click="openWork(index)">
  33. <span class="open" :class="{active: item.open}" v-if="item.array.length > 0 || item.carray.length > 0"></span>
  34. <el-tooltip :content="item.title" placement="top" effect="dark">
  35. <span class="titleN">{{ item.title }}</span>
  36. </el-tooltip>
  37. </div>
  38. <div class="state">
  39. <span :class="{ is: item.array.length > 0, no: !item.array.length }">{{ item.array.length > 0 ? "已完成" : "未完成" }}</span>
  40. </div>
  41. <div class="time">
  42. <span v-if="item.overtime" :class="{isDead: isDeadlinePassed(item.overtime)}">截止时间:{{ item.overtime }}</span>
  43. <span v-else></span>
  44. </div>
  45. <div class="creator" :style="{paddingRight:(!item.carray.length > 0) ? '0' : '0px'}">
  46. <el-tooltip :content="item.username" placement="top" effect="dark">
  47. <span>创建者:{{ item.username }}</span>
  48. </el-tooltip>
  49. </div>
  50. <div class="editBtn2" :style="`${item.open?'display:flex':''}`" v-if="!item.carray.length > 0">
  51. <span v-if="item.array.length === 0">去填写</span>
  52. <span v-else>再填一份</span>
  53. </div>
  54. <div @click="doTest2(item.courseid)" class="editBtn" :style="`${item.open?'display:flex':''}`" v-if="!item.carray.length > 0">
  55. <span v-if="item.array.length === 0">去填写</span>
  56. <span v-else>再填一份</span>
  57. </div>
  58. </div>
  59. <div class="test_panel_box" v-if="item.open">
  60. <div class="test_add_box"
  61. v-if="item.array">
  62. <div class="test" v-for="(test, index) in item.array" :key="test.id">
  63. <div class="time">
  64. <span v-if="!test.editName && !test.name">提交记录{{item.array.length - index}}</span>
  65. <span v-if="!test.editName && test.name">{{test.name}}</span>
  66. <el-input :ref="`changeName_${test.id}`" v-if="test.editName" v-model="test.name" @blur="changeNameUpdate(test.courseid,test.id)" @keyup.enter.native="changeNameUpdate(test.courseid,test.id)"></el-input>
  67. </div>
  68. <!-- <img @click="deleteTest(test.id)" class="delete"
  69. src="../../../../assets/icon/test/delete.png" alt="" /> -->
  70. <div class="utime">
  71. <span>{{ test.utime }}</span>
  72. </div>
  73. <div class="mask">
  74. <div @click="doTest(test.courseid, test.id)">
  75. <span>编辑</span>
  76. </div>
  77. <div @click="deleteTest(test.id)" class="delete">
  78. <span>删除</span>
  79. </div>
  80. <div @click="changeName(test.courseid,test.id)">
  81. <span>重命名</span>
  82. </div>
  83. <!-- <div @click="checkTest(test.courseid, test.id)">
  84. <span></span><span>查看</span>
  85. </div>
  86. <div @click="copyTest(test.id)">
  87. <span></span><span>复制</span>
  88. </div> -->
  89. </div>
  90. </div>
  91. </div>
  92. <div class="test_add_box"
  93. v-else-if="item.carray" v-loading="!item.carray.length">
  94. <!-- <div class="courseLength" v-for="(course, index) in item.carray" :key="index" @click="doTest3(item, course)">
  95. <span class="finish" :class="{is: course.array.length}"></span>
  96. <span>{{ index+1 }}、</span>
  97. <span>{{ course.title }}</span>
  98. <span>{{ course.username }}</span>
  99. </div> -->
  100. <div class="test courseLength" v-for="(course, index) in item.carray" :key="index">
  101. <div class="time">
  102. <el-tooltip :content="course.title+'-'+course.username" placement="top" effect="dark">
  103. <span>{{ course.title }}-{{ course.username }}</span>
  104. </el-tooltip>
  105. </div>
  106. <div class="finishBox" :class="{is: course.array.length}">
  107. <span class="finish"></span>
  108. <span v-if="course.array.length">已评分</span>
  109. <span v-else>未评分</span>
  110. </div>
  111. <div class="utime" style="margin-left: 30px;">
  112. <span v-if="course.array.length">{{ course.array[0].utime }}</span>
  113. <span v-else></span>
  114. </div>
  115. <div class="mask">
  116. <div @click="doTest3(item, course)">
  117. <span>评分</span>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </template>
  127. <script>
  128. // import examine from '../examine/index'
  129. export default {
  130. props: {
  131. userid: {
  132. type: String,
  133. },
  134. oid: {
  135. type: String,
  136. },
  137. typeId:{
  138. type:String,
  139. default:""
  140. },
  141. typeList:{
  142. type:Array,
  143. default:()=>[],
  144. }
  145. },
  146. components:{
  147. // examine
  148. },
  149. data() {
  150. return {
  151. type: "",
  152. ExamineBase: [],
  153. typeArray: [],
  154. typeArrayCheck: [],
  155. worksArray: [],
  156. org: this.$route.query.org,
  157. role: this.$route.query.role,
  158. loading: false,
  159. checkTypeValue:""
  160. };
  161. },
  162. computed: {
  163. getNum() {
  164. return function (array) {
  165. let _array = JSON.parse(array);
  166. let num = 0;
  167. _array.forEach(el => {
  168. if ((el.ttype == 3 || el.ttype == 2) && el.array.length > 0) {
  169. el.array.forEach(item => {
  170. if (item.ttype == 2 && item.array.length > 0) {
  171. item.array.forEach(item2 => {
  172. if (item2.ttype == 1 && item2.json) {
  173. num++;
  174. }
  175. });
  176. } else if (item.ttype == 1 && item.json) {
  177. num++;
  178. }
  179. });
  180. } else if (el.ttype == 1 && el.json) {
  181. num++;
  182. }
  183. });
  184. return num;
  185. };
  186. },
  187. getScore() {
  188. return function (array) {
  189. // let _array = JSON.parse(array)
  190. let _score = 0;
  191. let scoreArray = [];
  192. for (var i = 0; i < array.length; i++) {
  193. let _array = JSON.parse(array[i].courseJson);
  194. let score = 0;
  195. for (var j = 0; j < _array.length; j++) {
  196. let el = _array[j];
  197. if ((el.ttype == 3 || el.ttype == 2) && el.array.length > 0) {
  198. for (var k = 0; k < el.array.length; k++) {
  199. let item = el.array[k];
  200. if (item.ttype == 2 && item.array.length > 0) {
  201. for (var z = 0; z < item.array.length; z++) {
  202. let item2 = item.array[z];
  203. if (item2.ttype == 1 && item2.json && item2.json.score2) {
  204. score += parseInt(item2.json.score2);
  205. }
  206. }
  207. } else if (item.ttype == 1 && item.json && item.json.score2) {
  208. score += parseInt(item.json.score2);
  209. }
  210. }
  211. } else if (el.ttype == 1 && el.json && el.json.score2) {
  212. score += parseInt(el.json.score2);
  213. }
  214. }
  215. scoreArray.push(score);
  216. }
  217. scoreArray.forEach(el => {
  218. _score += el;
  219. });
  220. console.log(scoreArray);
  221. return _score ? _score / scoreArray.length : 0;
  222. };
  223. },
  224. getImg() {
  225. return function (array) {
  226. let _array = JSON.parse(array);
  227. let _img = "";
  228. s: for (var j = 0; j < _array.length; j++) {
  229. let el = _array[j];
  230. if ((el.ttype == 3 || el.ttype == 2) && el.array.length > 0) {
  231. for (var k2 = 0; k2 < el.array.length; k2++) {
  232. let item = el.array[k2];
  233. console.log(k2);
  234. if (item.ttype == 2 && item.array.length > 0) {
  235. for (var z = 0; z < item.array.length; z++) {
  236. let item2 = item.array[z];
  237. if (
  238. item2.ttype == 1 &&
  239. item2.type == 5 &&
  240. item2.json &&
  241. item2.json.file &&
  242. item2.json.file.length > 0
  243. ) {
  244. for (var k4 = 0; k4 < item2.json.file.length; k4++) {
  245. let ik = item2.json.file[k4];
  246. if (ik.type == 3) {
  247. _img = ik.url;
  248. break s;
  249. }
  250. }
  251. }
  252. }
  253. } else if (
  254. item.ttype == 1 &&
  255. item.type == 5 &&
  256. item.json &&
  257. item.json.file &&
  258. item.json.file.length > 0
  259. ) {
  260. for (var k3 = 0; k3 < item.json.file.length; k3++) {
  261. let ik = item.json.file[k3];
  262. if (ik.type == 3) {
  263. _img = ik.url;
  264. break s;
  265. }
  266. }
  267. }
  268. }
  269. } else if (
  270. el.ttype == 1 &&
  271. el.type == 5 &&
  272. el.json &&
  273. el.json.file &&
  274. el.json.file.length > 0
  275. ) {
  276. for (var k = 0; k < el.json.file.length; k++) {
  277. let ik = el.json.file[k];
  278. if (ik.type == 3) {
  279. _img = ik.url;
  280. break s;
  281. }
  282. }
  283. }
  284. }
  285. return _img;
  286. };
  287. },
  288. typeListStr(){
  289. let _result = "";
  290. if(this.typeList.length){
  291. _result = this.typeList.map(i=>i.id)
  292. _result.push(this.typeId);
  293. _result = _result.join(',')
  294. }
  295. return _result;
  296. }
  297. },
  298. watch:{
  299. typeId(newValue){
  300. this.changeShowType(newValue)
  301. }
  302. },
  303. methods: {
  304. getPageBase(type = 1) {
  305. let params = {
  306. typ: type,
  307. org: this.org,
  308. oid: this.oid
  309. };
  310. this.ajax
  311. .get(this.$store.state.api + "selectTestExamineBase", params)
  312. .then(res => {
  313. this.ExamineBase = res.data[0];
  314. if(type == 1 && !res.data[0].length){
  315. this.getPageBase(2)
  316. }
  317. // console.log("selectTestExamineBase", res.data);
  318. })
  319. .catch(error => {
  320. console.log(error);
  321. });
  322. },
  323. isDeadlinePassed(deadline) {
  324. let _line = new Date(deadline)
  325. const currentDate = new Date();
  326. return currentDate > _line;
  327. },
  328. checkType(type) {
  329. this.type = type;
  330. this.getWorks();
  331. },
  332. selectTestType(type) {
  333. let params = {
  334. oid: this.oid
  335. };
  336. this.ajax
  337. .get(this.$store.state.api + "selectTestType", params)
  338. .then(res => {
  339. this.typeArray = res.data[0];
  340. if(type == 1){
  341. this.type = ''
  342. // if (this.typeArray.length) {
  343. // this.type = this.typeArray[0].id;
  344. // } else {
  345. // this.type = '0';
  346. // }
  347. }
  348. this.getWorks()
  349. })
  350. .catch(err => {
  351. console.error(err);
  352. });
  353. },
  354. getWorks() {
  355. this.loading = true;
  356. let params = {
  357. uid: this.userid,
  358. typeid: this.checkTypeValue
  359. };
  360. this.ajax
  361. .get(this.$store.state.api + "getTestWorksPerson_2type", params)
  362. .then(res => {
  363. let array = res.data[0];
  364. let array2 = res.data[1];
  365. // 用于存储归类后的数据的对象
  366. let worksArray = {};
  367. // 遍历原始数据,根据 parentId 进行分组
  368. array2.forEach(item => {
  369. // console.log(item.chapters);
  370. worksArray[item.courseId] = {
  371. id: item.id,
  372. courseid: item.courseId,
  373. title: item.title,
  374. time: item.time,
  375. utime: item.utime,
  376. overtime: item.overtime,
  377. username: item.username,
  378. chapters: item.chapters,
  379. brief: item.brief,
  380. typeid: item.typeid,
  381. array: item.typeid == 'dda9728e-5f11-469e-89ee-aca518daf123' ? 0 : [],
  382. carray: [],
  383. open: false
  384. };
  385. });
  386. worksArray = Object.values(worksArray);
  387. worksArray.forEach(async el => {
  388. if (el.typeid == 'dda9728e-5f11-469e-89ee-aca518daf123') {
  389. let courseJson = this.returnCourseJSON(el.chapters)
  390. if(courseJson && courseJson.courses.length){
  391. let courses = courseJson.courses.join(',')
  392. let _res = await this.getAllCourse(courses)
  393. console.log(_res);
  394. let _carray = []
  395. for(var i=0;i<_res.length;i++){
  396. _carray.push({
  397. courseid: _res[i].courseId,
  398. title: _res[i].title,
  399. username: _res[i].username,
  400. array: []
  401. })
  402. }
  403. el.carray = _carray
  404. }
  405. }
  406. array.forEach(el2 => {
  407. if (el.courseid == el2.courseid && el.typeid != 'dda9728e-5f11-469e-89ee-aca518daf123') {
  408. el.array.push(el2);
  409. }
  410. if(el.courseid == el2.courseid && el.typeid == 'dda9728e-5f11-469e-89ee-aca518daf123'){
  411. let courseid = this.returnCourseId(el2.courseJson)
  412. for(var c = 0; c<el.carray.length;c++){
  413. if(el.carray[c].courseid == courseid){
  414. el.carray[c].array.push(el2);
  415. break
  416. }
  417. }
  418. }
  419. });
  420. });
  421. // worksArray[item.courseid].array.push(item);
  422. this.worksArray = worksArray;
  423. this.loading = false;
  424. this.$forceUpdate();
  425. })
  426. .catch(err => {
  427. this.loading = false;
  428. console.error(err);
  429. });
  430. },
  431. openWork(index){
  432. if(this.worksArray[index].array.length === 0 && this.worksArray[index].carray.length === 0){
  433. return
  434. }
  435. this.worksArray[index].open = !this.worksArray[index].open
  436. this.$forceUpdate()
  437. },
  438. returnA() {
  439. this.$router.push(
  440. "/testStudent?userid=" +
  441. this.userid +
  442. "&oid=" +
  443. this.oid +
  444. "&org=" +
  445. this.org +
  446. "&role=" +
  447. this.role
  448. );
  449. },
  450. checkTest(cid, tid) {
  451. this.$router.push(
  452. "/checkTest?cid=" +
  453. cid +
  454. "&tid=" +
  455. tid +
  456. "&userid=" +
  457. this.userid +
  458. "&oid=" +
  459. this.oid +
  460. "&org=" +
  461. this.org +
  462. "&type=3" +
  463. "&role=" +
  464. this.role
  465. );
  466. },
  467. doTest(cid, tid) {
  468. this.$router.push(
  469. "/doTest?cid=" +
  470. cid +
  471. "&tid=" +
  472. tid +
  473. "&userid=" +
  474. this.userid +
  475. "&oid=" +
  476. this.oid +
  477. "&org=" +
  478. this.org +
  479. "&type=3" +
  480. "&role=" +
  481. this.role
  482. );
  483. },
  484. doTest2(cid) {
  485. this.$router.push(
  486. "/doTest?cid=" +
  487. cid +
  488. "&userid=" +
  489. this.userid +
  490. "&oid=" +
  491. this.oid +
  492. "&org=" +
  493. this.org +
  494. "&type=3" +
  495. "&role=" +
  496. this.role
  497. );
  498. },
  499. doTest3(item, course){
  500. if(course.array.length){
  501. this.$router.push(
  502. "/doTest?cid=" +
  503. item.courseid +
  504. "&tid=" +
  505. course.array[0].id +
  506. "&userid=" +
  507. this.userid +
  508. "&oid=" +
  509. this.oid +
  510. "&org=" +
  511. this.org +
  512. "&type=3" +
  513. "&role=" +
  514. this.role
  515. );
  516. }else{
  517. this.$router.push(
  518. "/doTest?cid=" +
  519. item.courseid +
  520. "&userid=" +
  521. this.userid +
  522. "&oid=" +
  523. this.oid +
  524. "&org=" +
  525. this.org +
  526. "&type=3" +
  527. "&courseid=" +
  528. course.courseid +
  529. "&role=" +
  530. this.role
  531. );
  532. }
  533. },
  534. copyTest(tid) {
  535. let params = [
  536. {
  537. tid: tid,
  538. uid: this.userid
  539. }
  540. ];
  541. this.ajax
  542. .post(this.$store.state.api + "copyTestWorks", params)
  543. .then(res => {
  544. this.$message.success("复制成功");
  545. this.getWorks();
  546. })
  547. .catch(err => {
  548. console.error(err);
  549. });
  550. },
  551. deleteTest(tid) {
  552. let _this = this;
  553. _this
  554. .$confirm("确定删除此填写的表单么?", "提示", {
  555. confirmButtonText: "确定",
  556. cancelButtonText: "取消",
  557. type: "warning"
  558. })
  559. .then(() => {
  560. let params = [
  561. {
  562. tid: tid
  563. }
  564. ];
  565. _this.ajax
  566. .post(_this.$store.state.api + "deleteTestCourseWorks", params)
  567. .then(res => {
  568. _this.$message.success("删除成功");
  569. _this.getWorks();
  570. })
  571. .catch(err => {
  572. console.error(err);
  573. });
  574. })
  575. .catch(() => {
  576. return;
  577. });
  578. },
  579. returnCourseJSON(array) {
  580. let _array = JSON.parse(array);
  581. let courseJson = '';
  582. s: for (var j = 0; j < _array.length; j++) {
  583. let el = _array[j];
  584. if ((el.ttype == 3 || el.ttype == 2) && el.array.length > 0) {
  585. for (var k2 = 0; k2 < el.array.length; k2++) {
  586. let item = el.array[k2];
  587. console.log(k2);
  588. if (item.ttype == 2 && item.array.length > 0) {
  589. for (var z = 0; z < item.array.length; z++) {
  590. let item2 = item.array[z];
  591. if (
  592. item2.ttype == 1 &&
  593. item2.type == 6 &&
  594. item2.json
  595. ) {
  596. courseJson = item2.json
  597. break s;
  598. }
  599. }
  600. } else if (
  601. item.ttype == 1 &&
  602. item.type == 6 &&
  603. item.json
  604. ) {
  605. courseJson = item.json
  606. break s;
  607. }
  608. }
  609. } else if (
  610. el.ttype == 1 &&
  611. el.type == 6 &&
  612. el.json
  613. ) {
  614. courseJson = el.json
  615. break s;
  616. }
  617. }
  618. return courseJson;
  619. },
  620. returnCourseId(array) {
  621. let _array = JSON.parse(array);
  622. let courseJson = '';
  623. s: for (var j = 0; j < _array.length; j++) {
  624. let el = _array[j];
  625. if ((el.ttype == 3 || el.ttype == 2) && el.array.length > 0) {
  626. for (var k2 = 0; k2 < el.array.length; k2++) {
  627. let item = el.array[k2];
  628. console.log(k2);
  629. if (item.ttype == 2 && item.array.length > 0) {
  630. for (var z = 0; z < item.array.length; z++) {
  631. let item2 = item.array[z];
  632. if (
  633. item2.ttype == 1 &&
  634. item2.type == 6 &&
  635. item2.json && item2.json.answer2
  636. ) {
  637. courseJson = item2.json.answer2
  638. break s;
  639. }
  640. }
  641. } else if (
  642. item.ttype == 1 &&
  643. item.type == 6 &&
  644. item.json && item.json.answer2
  645. ) {
  646. courseJson = item.json.answer2
  647. break s;
  648. }
  649. }
  650. } else if (
  651. el.ttype == 1 &&
  652. el.type == 6 &&
  653. el.json && el.json.answer2
  654. ) {
  655. courseJson = el.json.answer2
  656. break s;
  657. }
  658. }
  659. return courseJson;
  660. },
  661. async getAllCourse(id) {
  662. let params = {
  663. cid: id,
  664. };
  665. let res = await this.ajax.get(this.$store.state.api + "getCourseInfoTestAll", params)
  666. return res.data[0]
  667. },
  668. changeShowType(value){
  669. this.checkTypeValue = value;
  670. this.getWorks();
  671. },
  672. changeName(courseId,testId){
  673. let array = this.worksArray.find(i=>i.courseid == courseId);
  674. if(array){
  675. array = array.array;
  676. array.find(i=>i.id==testId).editName = true;
  677. this.$forceUpdate();
  678. this.$nextTick(()=>{
  679. console.log(this.$refs[`changeName_${testId}`])
  680. this.$refs[`changeName_${testId}`][0].focus();
  681. })
  682. }
  683. },
  684. changeNameUpdate(courseId,testId){
  685. let array = this.worksArray.find(i=>i.courseid == courseId);
  686. if(array){
  687. array = array.array;
  688. array.find(i=>i.id==testId).editName = false;
  689. this.$forceUpdate();
  690. let data = array.find(i=>i.id==testId);
  691. let params = [{
  692. uid:this.userid,
  693. testId:testId,
  694. newName:data.name,
  695. }]
  696. this.ajax.post(this.$store.state.api+"update_testCourseWorksNameById",params).then(res=>{
  697. if(res.data == 1){
  698. this.$message.success("修改成功")
  699. }else{
  700. this.$message.error("修改失败")
  701. array.find(i=>i.id==testId).name = "";
  702. }
  703. })
  704. }
  705. }
  706. },
  707. mounted() {
  708. // this.selectTestType(1);
  709. // this.getPageBase()
  710. if(this.typeListStr){
  711. this.changeShowType(this.typeListStr)
  712. // this.checkTypeValue = this.typeId
  713. }
  714. },
  715. activated(){
  716. // this.selectTestType(2);
  717. if(this.typeListStr){
  718. this.changeShowType(this.typeListStr)
  719. // this.checkTypeValue = this.typeId
  720. }
  721. },
  722. };
  723. </script>
  724. <style scoped>
  725. .i_body_box {
  726. height: calc(100% - 10px);
  727. padding: 10px 0 0;
  728. box-sizing: border-box;
  729. }
  730. .check_nav {
  731. display: flex;
  732. height: 50px;
  733. align-items: center;
  734. padding: 0;
  735. box-sizing: border-box;
  736. width: 100%;
  737. overflow: auto;
  738. }
  739. .check_nav>.nav {
  740. width: 120px;
  741. height: 100%;
  742. display: flex;
  743. align-items: center;
  744. justify-content: center;
  745. color: rgb(167, 167, 167);
  746. /* background: #000000; */
  747. cursor: pointer;
  748. min-width: fit-content;
  749. margin-right: 10px;
  750. }
  751. .check_nav>.active {
  752. color: #3681fc;
  753. background: rgb(248, 250, 254);
  754. border-radius: 10px 10px 0 0;
  755. }
  756. .check_nav>.all::before,
  757. .check_nav>.gr::before,
  758. .check_nav>.md::before,
  759. .check_nav>.jy::before,
  760. .check_nav>.bj::before,
  761. .check_nav>.yy::before {
  762. content: "";
  763. display: block;
  764. width: 18px;
  765. height: 18px;
  766. background-size: 100% 100%;
  767. margin-right: 5px;
  768. }
  769. .check_nav>.all::before {
  770. background-image: url('../../../../assets/icon/test/all_icon.png');
  771. }
  772. .check_nav>.active.all::before {
  773. background-image: url('../../../../assets/icon/test/all_icon_active.png');
  774. }
  775. .check_nav>.gr::before {
  776. background-image: url('../../../../assets/icon/test/gr_icon.png');
  777. }
  778. .check_nav>.active.gr::before {
  779. background-image: url('../../../../assets/icon/test/gr_icon_active.png');
  780. }
  781. .check_nav>.md::before {
  782. background-image: url('../../../../assets/icon/test/md_icon.png');
  783. }
  784. .check_nav>.active.md::before {
  785. background-image: url('../../../../assets/icon/test/md_icon_active.png');
  786. }
  787. .check_nav>.jy::before {
  788. background-image: url('../../../../assets/icon/test/jy_icon.png');
  789. }
  790. .check_nav>.active.jy::before {
  791. background-image: url('../../../../assets/icon/test/jy_icon_active.png');
  792. }
  793. .check_nav>.yy::before {
  794. background-image: url('../../../../assets/icon/test/yy_icon.png');
  795. }
  796. .check_nav>.active.yy::before {
  797. background-image: url('../../../../assets/icon/test/yy_icon_active.png');
  798. }
  799. .check_nav>.bj::before {
  800. background-image: url('../../../../assets/icon/test/bj_icon.png');
  801. }
  802. .check_nav>.active.bj::before {
  803. background-image: url('../../../../assets/icon/test/bj_icon_active.png');
  804. }
  805. .check_box {
  806. height: calc(100% - 50px);
  807. overflow: auto;
  808. padding: 0 0 20px;
  809. box-sizing: border-box;
  810. background: rgb(248, 250, 254);
  811. }
  812. .test_panel {
  813. width: calc(100% - 40px);
  814. margin: 20px auto 0;
  815. background: #fff;
  816. border-radius: 10px;
  817. /* height: 300px; */
  818. overflow: hidden;
  819. box-shadow: 0 2px 5px 1px #0001;
  820. }
  821. .test_panel:hover{
  822. box-shadow: 0 0 2px 1px #3681FC;
  823. }
  824. .test_panel:hover>.test_panel_title>.title{
  825. color:#5996FD
  826. }
  827. .test_panel_title:hover>.editBtn{
  828. display: flex;
  829. }
  830. .test_panel_title:hover>.editBtn2{
  831. display: flex;
  832. }
  833. .test_panel+.test_panel {
  834. margin-top: 15px;
  835. }
  836. .test_panel_title {
  837. height: 50px;
  838. display: flex;
  839. align-items: center;
  840. width: 100%;
  841. position: relative;
  842. /* justify-content: space-between; */
  843. /* padding: 0 20px; */
  844. box-sizing: border-box;
  845. /* border-bottom: 2px solid #f0f0f0; */
  846. }
  847. .test_panel_title>.title {
  848. display: flex;
  849. align-items: center;
  850. width: 300px;
  851. margin-left: 20px;
  852. cursor: pointer;
  853. }
  854. .test_panel_title>.title>.open{
  855. width: 20px;
  856. height:20px;
  857. margin-right: 10px;
  858. background-image: url('../../../../assets/icon/test/chevron-right.png');
  859. background-size: 100% 100%;
  860. cursor:pointer;
  861. transition:all .3s;
  862. opacity: .5;
  863. }
  864. .test_panel_title>.title>.open.active{
  865. transform: rotate(90deg);
  866. opacity: 1;
  867. }
  868. .test_panel_title>.state{
  869. margin-left: auto;
  870. min-width: fit-content;
  871. }
  872. .test_panel_title>.state > span {
  873. font-size: 14px;
  874. padding: 5px 8px;
  875. border-radius: 5px;
  876. margin-right: 0;
  877. }
  878. .test_panel_title>.state>.is:nth-child(1) {
  879. color: #17C469;
  880. background: #EFFCF5;
  881. border: 1px solid #EFFCF5;
  882. }
  883. .test_panel_title>.state>.no:nth-child(1) {
  884. color: #3681FC;
  885. background: #E0EAFB;
  886. border: 1px solid #E0EAFB;
  887. }
  888. .test_panel_title>.title>.titleN {
  889. font-size: 18px;
  890. font-weight: 600;
  891. max-width: calc(100% - 20px - 10px);
  892. overflow: hidden;
  893. text-overflow: ellipsis;
  894. white-space: nowrap;
  895. }
  896. .test_panel_title>.time {
  897. font-size: 16px;
  898. color: #a1a1a1;
  899. min-width: 160px;
  900. margin: 0 30px;
  901. }
  902. .test_panel_title>.creator {
  903. font-size: 16px;
  904. color: #a1a1a1;
  905. max-width: 160px;
  906. min-width: 160px;
  907. overflow: hidden;
  908. text-overflow: ellipsis;
  909. white-space: nowrap;
  910. }
  911. .test_panel_title>.editBtn {
  912. font-size: 16px;
  913. color: #fff;
  914. background: #3681fc;
  915. height: 100%;
  916. display: none;
  917. align-items: center;
  918. padding: 0 15px;
  919. cursor: pointer;
  920. position: absolute;
  921. right: 0;
  922. }
  923. .test_panel_title>.editBtn2 {
  924. font-size: 16px;
  925. color: #fff;
  926. background: #3681fc;
  927. height: 100%;
  928. display: none;
  929. align-items: center;
  930. padding: 0 15px;
  931. cursor: pointer;
  932. }
  933. .test_panel_title>.time>span+span {
  934. margin-left: 10px;
  935. }
  936. .test_panel_box {
  937. border-top: 2px solid #f0f0f0;
  938. width: 100%;
  939. display: flex;
  940. align-items: center;
  941. padding: 5px 20px;
  942. box-sizing: border-box;
  943. }
  944. .test_panel_box>.detail {
  945. width: calc(100% - 350px - 20px);
  946. margin-right: 20px;
  947. color: #a1a1a1;
  948. font-size: 14px;
  949. line-height: 24px;
  950. word-break: break-all;
  951. display: -webkit-box;
  952. -webkit-line-clamp: 4;
  953. -webkit-box-orient: vertical;
  954. overflow: hidden;
  955. }
  956. .test_panel_box>.panel {
  957. display: flex;
  958. align-items: center;
  959. justify-content: space-between;
  960. width: 350px;
  961. min-width: 350px;
  962. }
  963. .test_panel_box>.panel>.score {
  964. height: 110px;
  965. display: flex;
  966. align-items: center;
  967. justify-content: center;
  968. flex-direction: column;
  969. border: 1px solid #dbdbdb;
  970. background: rgb(252, 252, 252);
  971. width: 120px;
  972. border-radius: 5px;
  973. }
  974. .test_panel_box>.panel>.score:nth-child(1) {
  975. display: flex;
  976. }
  977. .test_panel_box>.panel>.score>div:nth-child(1)>span:nth-child(1) {
  978. font-size: 30px;
  979. font-weight: 700;
  980. }
  981. .test_panel_box>.panel>.score>div:nth-child(1)>span:nth-child(2) {
  982. margin-left: 5px;
  983. }
  984. .test_panel_box>.panel>.score>div:nth-child(2) {
  985. font-size: 14px;
  986. margin-top: 10px;
  987. color: #a1a1a1;
  988. }
  989. .test_panel_box>.panel>.btn {
  990. height: 100px;
  991. display: flex;
  992. flex-direction: column;
  993. justify-content: space-between;
  994. }
  995. .test_panel_box>.panel>.btn>div {
  996. display: flex;
  997. color: rgb(69, 141, 255);
  998. align-items: center;
  999. cursor: pointer;
  1000. font-size: 14px;
  1001. }
  1002. /* .test_panel_box > .panel >.btn > div + div{
  1003. margin: 15px 0 0 0;
  1004. } */
  1005. .test_panel_box>.panel>.btn>div>span:nth-child(1) {
  1006. display: block;
  1007. width: 13px;
  1008. height: 13px;
  1009. background-size: 100% 100%;
  1010. margin-right: 7px;
  1011. }
  1012. .test_panel_box>.panel>.btn>div:nth-child(1)>span:nth-child(1) {
  1013. background-image: url('../../../../assets/icon/test/edit_icon.png');
  1014. }
  1015. .test_panel_box>.panel>.btn>div:nth-child(2)>span:nth-child(1) {
  1016. background-image: url('../../../../assets/icon/test/check_icon.png');
  1017. }
  1018. .test_panel_box>.panel>.btn>div:nth-child(3)>span:nth-child(1) {
  1019. background-image: url('../../../../assets/icon/test/paste_icon.png');
  1020. }
  1021. .test_add_box {
  1022. width: 100%;
  1023. box-sizing: border-box;
  1024. }
  1025. .test_add_box>.test {
  1026. width: 100%;
  1027. height: 40px;
  1028. border-radius: 5px;
  1029. display: flex;
  1030. align-items: center;
  1031. }
  1032. .test_add_box>.test>img {
  1033. width: 100%;
  1034. height: 100%;
  1035. object-fit: cover;
  1036. border-radius: 5px;
  1037. }
  1038. .test_add_box>.test+.test {
  1039. /* margin-left: 10px; */
  1040. }
  1041. .test_add_box>.test>.time {
  1042. display: flex;
  1043. /* justify-content: center; */
  1044. align-items: center;
  1045. font-size: 14px;
  1046. width: 300px;
  1047. padding-left: 30px;
  1048. box-sizing: border-box;
  1049. }
  1050. .test_add_box>.test>.time>span {
  1051. /* margin-top: 5px; */
  1052. overflow: hidden;
  1053. text-overflow: ellipsis;
  1054. white-space: nowrap;
  1055. }
  1056. .test_add_box>.test>.utime {
  1057. font-size: 14px;
  1058. width: 160px;
  1059. min-width: 160px;
  1060. margin: 0 30px 0 auto;
  1061. }
  1062. .test_add_box>.test>.mask {
  1063. display: flex;
  1064. align-items: center;
  1065. padding-right: 58px;
  1066. max-width: 160px;
  1067. min-width: 160px;
  1068. }
  1069. .test_add_box>.test>.delete {
  1070. position: absolute;
  1071. width: 20px;
  1072. height: 20px;
  1073. right: -5px;
  1074. top: -5px;
  1075. cursor: pointer;
  1076. z-index: 2;
  1077. display: none;
  1078. }
  1079. .test_add_box>.test>.mask>div {
  1080. display: flex;
  1081. align-items: center;
  1082. cursor: pointer;
  1083. font-size: 14px;
  1084. color: #3681FC;
  1085. }
  1086. .test_add_box>.test>.mask>.delete {
  1087. color: #EE3E3E;
  1088. }
  1089. .test_add_box>.test>.mask>div+div {
  1090. /* margin: 10px 0 0 0; */
  1091. margin-left: 15px;
  1092. }
  1093. /*
  1094. .test_add_box>.test>.mask>div>span:nth-child(1) {
  1095. display: block;
  1096. width: 13px;
  1097. height: 13px;
  1098. background-size: 100% 100%;
  1099. margin-right: 7px;
  1100. }
  1101. .test_add_box>.test>.mask>div:nth-child(1)>span:nth-child(1) {
  1102. background-image: url('../../../../assets/icon/test/edit_icon.png');
  1103. }
  1104. .test_add_box>.test>.mask>div:nth-child(2)>span:nth-child(1) {
  1105. background-image: url('../../../../assets/icon/test/check_icon.png');
  1106. }
  1107. .test_add_box>.test>.mask>div:nth-child(3)>span:nth-child(1) {
  1108. background-image: url('../../../../assets/icon/test/paste_icon.png');
  1109. } */
  1110. .bgColor {
  1111. background: #466b99;
  1112. }
  1113. /* .courseLength{
  1114. width: 100%;
  1115. cursor: pointer;
  1116. margin-bottom: 10px;
  1117. display: flex;
  1118. align-items: center;
  1119. }
  1120. .courseLength > span + span{
  1121. margin-left: 10px;
  1122. } */
  1123. .courseLength > .finishBox {
  1124. display: flex;
  1125. color: #a1a1a1;
  1126. font-size: 14px;
  1127. margin-left: auto;
  1128. align-items: center;
  1129. }
  1130. .courseLength > .finishBox > .finish{
  1131. width: 15px;
  1132. height: 15px;
  1133. background-image: url('../../../../assets/icon/test/icon_course.png');
  1134. background-size: 100% 100%;
  1135. margin-right: 5px;
  1136. }
  1137. .courseLength > .finishBox.is > .finish{
  1138. background-image: url('../../../../assets/icon/test/icon_course_check.png');
  1139. }
  1140. .courseLength > .finishBox.is{
  1141. color: #000
  1142. }
  1143. .isDead{
  1144. color:#EE3E3E;
  1145. }
  1146. </style>