test.vue 41 KB

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