stepsBox.vue 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481
  1. <template>
  2. <div class="sb-container" v-if="chapInfo && chapInfo.chapterInfo">
  3. <div class="steps-box" v-for="(step, stepI) in toolChoose()" :key="stepI">
  4. <div class="step-title">
  5. <div class="step">
  6. <span>步骤{{ stepI + 1 }}</span>
  7. </div>
  8. <div
  9. class="do"
  10. v-if="isCloseList[stepI] && worksStudent[stepI] && worksStudent[stepI].length > 4"
  11. @click="contract(stepI)"
  12. :class="{ close: isCloseList[stepI] && isCloseList[stepI].isClose == '1' }"
  13. >
  14. {{ isCloseList[stepI].isClose == '1' ? '展开' : '收缩' }}
  15. </div>
  16. </div>
  17. <div class="tool-box" v-if="tools[step.tool[0]] && canWork.indexOf(step.tool[0]) !== -1" @click="addImg($event)">
  18. <div class="tool-img"><img :src="tools[step.tool[0]].img" /></div>
  19. <div class="tool-name">{{ tools[step.tool[0]].name }}</div>
  20. <input
  21. type="file"
  22. accept="video/mp4, video/quicktime, video/x-msvideo,image/*"
  23. style="display: none"
  24. multiple
  25. @change="beforeUpload($event, step.tool[0], stepI)"
  26. v-if="step.tool[0] === 50"
  27. />
  28. <input
  29. type="file"
  30. accept="video/mp4, video/quicktime, video/x-msvideo,image/*"
  31. style="display: none"
  32. @change="beforeUpload($event, step.tool[0], stepI)"
  33. v-else
  34. />
  35. </div>
  36. <div
  37. class="tool-box"
  38. v-else-if="tools[step.tool[0]] && canWork2.indexOf(step.tool[0]) !== -1"
  39. @click="addWork(step.tool[0], stepI, step)"
  40. >
  41. <div class="tool-img"><img :src="tools[step.tool[0]].img" /></div>
  42. <div class="tool-name">{{ tools[step.tool[0]].name }}</div>
  43. </div>
  44. <div class="tool-box" v-else-if="tools[step.tool[0]]">
  45. <div class="tool-img"><img :src="tools[step.tool[0]].img" /></div>
  46. <div class="tool-name">{{ tools[step.tool[0]].name }}</div>
  47. </div>
  48. <div
  49. class="works-box"
  50. v-if="isWorkTool.indexOf(step.tool[0]) !== -1 && worksStudent[stepI] && worksStudent[stepI].length"
  51. >
  52. <div class="title">作业预览</div>
  53. <div class="works">
  54. <Works
  55. class="work"
  56. v-for="(work, workI) in isCloseList[stepI].isClose == 0
  57. ? worksStudent[stepI]
  58. : worksStudent[stepI].slice(0, 4)"
  59. :key="stepI + '-' + workI"
  60. :work="work"
  61. >
  62. </Works>
  63. </div>
  64. </div>
  65. <div
  66. class="no-works-box"
  67. v-if="isWorkTool.indexOf(step.tool[0]) !== -1 && noWorksS[stepI] && noWorksS[stepI].length"
  68. >
  69. <div class="title">未提交</div>
  70. <div class="no-works-box-students">
  71. <div
  72. v-for="(student, noI) in noWorksS[stepI]"
  73. :key="stepI + '-' + noI"
  74. class="student"
  75. @click="teacherSubmit(step.tool[0], student, $event, step)"
  76. >
  77. {{ student.student }}
  78. <input
  79. v-if="canWork.indexOf(step.tool[0]) !== -1"
  80. type="file"
  81. accept="video/mp4, video/quicktime, video/x-msvideo,image/*"
  82. style="display: none"
  83. @change="beforeUpload2($event, stepI)"
  84. />
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <div v-if="!toolChoose().length" class="noMssage">
  90. <img src="@/assets/images/course/isNoMessage.png" />
  91. </div>
  92. <div v-if="proVisible" class="mask">
  93. <div class="progressBox">
  94. <div class="lbox"><img src="@/assets/images/loading.gif" />上传中,请稍后</div>
  95. <div style="margin-bottom: 10px" v-if="pVisible">
  96. <span>{{ isFinishSize }}M</span> / <span>{{ isAllSize }}M</span>
  97. </div>
  98. <el-progress
  99. :text-inside="true"
  100. :stroke-width="20"
  101. :percentage="progress"
  102. style="width: 80%"
  103. v-if="pVisible"
  104. ></el-progress>
  105. </div>
  106. </div>
  107. <answerPanel
  108. v-if="answerPanelVisible"
  109. @setPanelVisible="setPanelVisible"
  110. :panelVisible="answerPanelVisible"
  111. :courseid="courseid"
  112. :courseType="courseType"
  113. :taskCount="taskCount"
  114. :toolindex="toolindex"
  115. :isTeacher="isTeacher"
  116. :answerQ="answerQ"
  117. :sStudent="sStudent"
  118. ></answerPanel>
  119. <askPanel
  120. v-if="askPanelVisible"
  121. @setAskPanelVisible="setAskPanelVisible"
  122. :panelVisible="askPanelVisible"
  123. :courseid="courseid"
  124. :courseType="courseType"
  125. :taskCount="taskCount"
  126. :toolindex="toolindex"
  127. :isTeacher="isTeacher"
  128. :askJson="askJson"
  129. :sStudent="sStudent"
  130. ></askPanel>
  131. <choosePanel
  132. v-if="choosePanelVisible"
  133. @setChoosePanelVisible="setChoosePanelVisible"
  134. :panelVisible="choosePanelVisible"
  135. :courseid="courseid"
  136. :courseType="courseType"
  137. :taskCount="taskCount"
  138. :toolindex="toolindex"
  139. :isTeacher="isTeacher"
  140. :chooseJson="chooseJson"
  141. :sStudent="sStudent"
  142. ></choosePanel>
  143. </div>
  144. </template>
  145. <script>
  146. import '@/assets/js/aws-sdk-2.235.1.min.js'
  147. import * as imageConversion from 'image-conversion'
  148. import {
  149. getCourseWorks,
  150. getCourseWorksStudentJuri,
  151. addCourseWorksR,
  152. addCourseWorksTeacher,
  153. addCourseWorks5,
  154. addCourseWorksPl
  155. } from '@/api/course'
  156. import { tools } from '@/const/index'
  157. import Works from './works.vue'
  158. import { mapGetters } from 'vuex'
  159. import answerPanel from './answerPanel.vue'
  160. import askPanel from './askPanel.vue'
  161. import choosePanel from './choosePanel.vue'
  162. export default {
  163. props: {
  164. chapInfo: {
  165. type: Object,
  166. default: () => {}
  167. },
  168. courseDetail: {
  169. type: Object,
  170. default: () => {}
  171. },
  172. courseType: {
  173. type: Number,
  174. default: 0
  175. },
  176. taskCount: {
  177. type: Number,
  178. default: 0
  179. },
  180. courseid: {
  181. type: String,
  182. default: ''
  183. },
  184. tcid: {
  185. type: String,
  186. default: ''
  187. },
  188. oid: {
  189. type: String,
  190. default: ''
  191. },
  192. isLoading: {
  193. type: Boolean
  194. },
  195. answerPanelVisible: {
  196. type: Boolean
  197. },
  198. askPanelVisible: {
  199. type: Boolean
  200. },
  201. choosePanelVisible: {
  202. type: Boolean
  203. }
  204. },
  205. components: {
  206. Works,
  207. answerPanel,
  208. askPanel,
  209. choosePanel
  210. },
  211. data() {
  212. return {
  213. worksStudent: [],
  214. isWorksS: [],
  215. isCloseList: [],
  216. noWorksS: [],
  217. isWorkTool: [16, 32, 57, 4, 45, 15, 1, 3, 6, 7, 26, 41, 47, 48, 52, 50, 40, 63], //, 49
  218. canWork: [16, 50], //, 49
  219. canWork2: [15,4,45],
  220. fileType: 0,
  221. tools: tools,
  222. proVisible: false,
  223. pVisible: false,
  224. progress: 0,
  225. isFinishSize: 0,
  226. isAllSize: 0,
  227. sTool: 0,
  228. sStudent: {},
  229. isTeacher: false,
  230. toolindex: 0,
  231. answerQ: '',
  232. askJson: {},
  233. chooseJson: {}
  234. }
  235. },
  236. watch: {
  237. courseid(newValue, oldValue) {
  238. this.getWorks()
  239. },
  240. courseType(newValue, oldValue) {
  241. this.getWorks()
  242. },
  243. taskCount(newValue, oldValue) {
  244. this.getWorks()
  245. },
  246. isLoading(newValue) {
  247. if (newValue) {
  248. this.getWorks()
  249. }
  250. },
  251. answerPanelVisible(newValue) {
  252. if (!newValue) {
  253. this.getWorks()
  254. }
  255. },
  256. askPanelVisible(newValue) {
  257. if (!newValue) {
  258. this.getWorks()
  259. }
  260. },
  261. choosePanelVisible(newValue) {
  262. if (!newValue) {
  263. this.getWorks()
  264. }
  265. },
  266. },
  267. computed: {
  268. ...mapGetters(['userinfo']),
  269. toolChoose() {
  270. return () => {
  271. let toolchoose = this.chapInfo.chapterInfo[0].taskJson[this.taskCount].toolChoose
  272. toolchoose = toolchoose.filter(el => {
  273. return el.tool.length
  274. })
  275. return toolchoose
  276. }
  277. }
  278. },
  279. methods: {
  280. setPanelVisible(bool) {
  281. this.$emit('update:answerPanelVisible', bool)
  282. },
  283. setAskPanelVisible(bool) {
  284. this.$emit('update:askPanelVisible', bool)
  285. },
  286. setChoosePanelVisible(bool) {
  287. this.$emit('update:choosePanelVisible', bool)
  288. },
  289. arrayToArray(arrayo, arrayt) {
  290. const array1 = arrayo
  291. const array2 = arrayt
  292. const commonElements = []
  293. for (let i = 0; i < array1.length; i++) {
  294. for (let j = 0; j < array2.length; j++) {
  295. if (array1[i] === array2[j]) {
  296. commonElements.push(array1[i])
  297. }
  298. }
  299. }
  300. return commonElements
  301. },
  302. getWorks() {
  303. // 教师查看全部作业
  304. const params = {
  305. cid: this.courseid,
  306. s: this.courseType,
  307. t: this.taskCount
  308. }
  309. getCourseWorks(params)
  310. .then(res => {
  311. const works = res[0]
  312. const f = res[3]
  313. const steps = this.chapInfo.chapterInfo[0].taskJson[this.taskCount].toolChoose
  314. const worksStudent = []
  315. const isCloseList = []
  316. const groupStudent = []
  317. const groupStudentUid = []
  318. const isWorksS = []
  319. const wordPan = ['PDF', 'DOC', 'DOCX', 'PPT', 'PPTX', 'XLSX', 'XLS']
  320. const videoPan = [
  321. 'AVI',
  322. 'NAVI',
  323. 'MPEG',
  324. 'ASF',
  325. 'MOV',
  326. 'WMV',
  327. '3GP',
  328. 'RM',
  329. 'RMVB',
  330. 'FLV',
  331. 'F4V',
  332. 'H.264',
  333. 'H.265',
  334. 'REAL VIDEO',
  335. 'MKV',
  336. 'WebM',
  337. 'HDDVD',
  338. 'MP4',
  339. 'MPG',
  340. 'M4V',
  341. 'MGV',
  342. 'OGV',
  343. 'QTM',
  344. 'STR',
  345. 'AMC',
  346. 'DVX',
  347. 'EVO',
  348. 'DAT',
  349. 'OGG',
  350. 'OGM'
  351. ]
  352. console.log(works)
  353. for (var step = 0; step < steps.length; step++) {
  354. worksStudent[step] = []
  355. if (!isCloseList[step] || isCloseList[step].isClose === undefined) {
  356. isCloseList[step] = { isClose: 0 }
  357. }
  358. groupStudent[step] = []
  359. isWorksS[step] = []
  360. groupStudentUid[step] = []
  361. if (steps[step].tool[0] === 49) {
  362. for (var gA = 0; gA < steps[step].groupJson.group.length; gA++) {
  363. groupStudent[step][gA] = []
  364. groupStudentUid[step][gA] = []
  365. worksStudent[step][gA] = []
  366. isCloseList[step][gA] = []
  367. for (var g = 0; g < f.length; g++) {
  368. if (
  369. f[g].ttype === 2 &&
  370. this.tcid &&
  371. this.arrayToArray(f[g].classid.split(','), this.tcid.split(',')).length === 0
  372. ) {
  373. continue
  374. }
  375. if (gA === f[g].group && f[g].tool === step) {
  376. this.groupStudent[step][gA].push(f[g])
  377. this.groupStudentUid[step][gA].push(f[g].userid)
  378. }
  379. }
  380. }
  381. this.$forceUpdate()
  382. }
  383. for (var j = 0; j < works.length; j++) {
  384. if (
  385. works[j].ttype === 2 &&
  386. this.tcid &&
  387. this.arrayToArray(works[j].classid.split(','), this.tcid.split(',')).length === 0
  388. ) {
  389. continue
  390. }
  391. var likesCount = 0
  392. var commentCount = 0
  393. var isLikes = false
  394. var commentJson = []
  395. if (step === works[j].tool) {
  396. if (
  397. (works[j].type === 1 ||
  398. works[j].type === 4 ||
  399. works[j].type === 5 ||
  400. works[j].type === 6 ||
  401. works[j].type === 12 ||
  402. works[j].type === 7) &&
  403. steps[step].tool[0] !== 15 &&
  404. steps[step].tool[0] !== 4 &&
  405. steps[step].tool[0] !== 45 &&
  406. steps[step].tool[0] !== 50 &&
  407. steps[step].tool[0] !== 32 &&
  408. steps[step].tool[0] !== 57 &&
  409. steps[step].tool[0] !== 52
  410. ) {
  411. if (
  412. wordPan.indexOf(
  413. works[j].content.split('.')[works[j].content.split('.').length - 1].toLocaleUpperCase()
  414. ) !== -1 &&
  415. steps[step].tool[0] === 16 &&
  416. (works[j].atool ? parseInt(works[j].atool) : '') !== 50
  417. ) {
  418. const _works = {
  419. userid: works[j].userid,
  420. ateacher: works[j].ateacher,
  421. wid: works[j].id,
  422. works: works[j].content,
  423. sName: works[j].name,
  424. type: 1,
  425. time: works[j].time,
  426. score: works[j].score,
  427. img: works[j].img,
  428. likesCount: likesCount,
  429. commentCount: commentCount,
  430. isLikes: isLikes,
  431. commentJson: commentJson
  432. }
  433. worksStudent[step].push(_works)
  434. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  435. } else if (
  436. videoPan.indexOf(
  437. works[j].content.split('.')[works[j].content.split('.').length - 1].toLocaleUpperCase()
  438. ) !== -1 &&
  439. steps[step].tool[0] === 16 &&
  440. (works[j].atool ? parseInt(works[j].atool) : '') !== 50
  441. ) {
  442. const _works = {
  443. userid: works[j].userid,
  444. ateacher: works[j].ateacher,
  445. wid: works[j].id,
  446. works: works[j].content,
  447. sName: works[j].name,
  448. type: 3,
  449. time: works[j].time,
  450. score: works[j].score,
  451. img: works[j].img,
  452. likesCount: likesCount,
  453. commentCount: commentCount,
  454. isLikes: isLikes,
  455. commentJson: commentJson
  456. }
  457. worksStudent[step].push(_works)
  458. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  459. } else if (works[j].type === 6 && (works[j].atool ? parseInt(works[j].atool) : '') !== 50) {
  460. const _works = {
  461. userid: works[j].userid,
  462. ateacher: works[j].ateacher,
  463. wid: works[j].id,
  464. works: works[j].content,
  465. sName: works[j].name,
  466. type: 4,
  467. time: works[j].time,
  468. score: works[j].score,
  469. img: works[j].img,
  470. likesCount: likesCount,
  471. commentCount: commentCount,
  472. isLikes: isLikes,
  473. commentJson: commentJson
  474. }
  475. worksStudent[step].push(_works)
  476. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  477. } else if (works[j].type === 7 && (works[j].atool ? parseInt(works[j].atool) : '') !== 50) {
  478. const _works = {
  479. userid: works[j].userid,
  480. ateacher: works[j].ateacher,
  481. wid: works[j].id,
  482. works: works[j].content,
  483. sName: works[j].name,
  484. type: 5,
  485. time: works[j].time,
  486. score: works[j].score,
  487. img: works[j].img,
  488. likesCount: likesCount,
  489. commentCount: commentCount,
  490. isLikes: isLikes,
  491. commentJson: commentJson
  492. }
  493. worksStudent[step].push(_works)
  494. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  495. } else if (
  496. works[j].type === 12 &&
  497. steps[step].tool[0] === (works[j].atool ? parseInt(works[j].atool) : '')
  498. ) {
  499. const _works = {
  500. userid: works[j].userid,
  501. ateacher: works[j].ateacher,
  502. wid: works[j].id,
  503. works: works[j].content,
  504. sName: works[j].name,
  505. type: 12,
  506. time: works[j].time,
  507. score: works[j].score,
  508. img: works[j].img,
  509. likesCount: likesCount,
  510. commentCount: commentCount,
  511. isLikes: isLikes,
  512. commentJson: commentJson
  513. }
  514. worksStudent[step].push(_works)
  515. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  516. } else if (
  517. works[j].type === 1 &&
  518. steps[step].tool[0] === (works[j].atool ? parseInt(works[j].atool) : '')
  519. ) {
  520. const _works = {
  521. userid: works[j].userid,
  522. ateacher: works[j].ateacher,
  523. wid: works[j].id,
  524. works: works[j].content,
  525. sName: works[j].name,
  526. type: 0,
  527. time: works[j].time,
  528. score: works[j].score,
  529. img: works[j].img,
  530. likesCount: likesCount,
  531. commentCount: commentCount,
  532. isLikes: isLikes,
  533. commentJson: commentJson
  534. }
  535. worksStudent[step].push(_works)
  536. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  537. } else if (works[j].type === 1 && !parseInt(works[j].atool ? parseInt(works[j].atool) : '')) {
  538. const _works = {
  539. userid: works[j].userid,
  540. ateacher: works[j].ateacher,
  541. wid: works[j].id,
  542. works: works[j].content,
  543. sName: works[j].name,
  544. type: 0,
  545. time: works[j].time,
  546. score: works[j].score,
  547. img: works[j].img,
  548. likesCount: likesCount,
  549. commentCount: commentCount,
  550. isLikes: isLikes,
  551. commentJson: commentJson
  552. }
  553. worksStudent[step].push(_works)
  554. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  555. }
  556. } else if (works[j].type === 3 && steps[step].tool[0] === 15) {
  557. const _works = {
  558. userid: works[j].userid,
  559. ateacher: works[j].ateacher,
  560. wid: works[j].id,
  561. works: works[j].content,
  562. sName: works[j].name,
  563. type: 2,
  564. time: works[j].time,
  565. score: works[j].score,
  566. img: works[j].img,
  567. likesCount: likesCount,
  568. commentCount: commentCount,
  569. isLikes: isLikes,
  570. commentJson: commentJson
  571. }
  572. worksStudent[step].push(_works)
  573. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  574. } else if (works[j].type === 2 && steps[step].tool[0] === 4) {
  575. // 问卷
  576. const _works = {
  577. userid: works[j].userid,
  578. ateacher: works[j].ateacher,
  579. wid: works[j].id,
  580. works: works[j].content,
  581. sName: works[j].name,
  582. type: 4,
  583. time: works[j].time,
  584. score: works[j].score,
  585. img: works[j].img,
  586. likesCount: likesCount,
  587. commentCount: commentCount,
  588. isLikes: isLikes,
  589. commentJson: commentJson
  590. }
  591. worksStudent[step].push(_works)
  592. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  593. } else if (works[j].type === 8 && steps[step].tool[0] === 45) {
  594. // 选择题
  595. const _works = {
  596. userid: works[j].userid,
  597. ateacher: works[j].ateacher,
  598. wid: works[j].id,
  599. works: works[j].content,
  600. sName: works[j].name,
  601. type: 8,
  602. time: works[j].time,
  603. score: works[j].score,
  604. img: works[j].img,
  605. likesCount: likesCount,
  606. commentCount: commentCount,
  607. isLikes: isLikes,
  608. commentJson: commentJson
  609. }
  610. worksStudent[step].push(_works)
  611. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  612. } else if (works[j].type === 9 && steps[step].tool[0] === 47) {
  613. // 选择题
  614. const _works = {
  615. userid: works[j].userid,
  616. ateacher: works[j].ateacher,
  617. wid: works[j].id,
  618. works: works[j].content,
  619. sName: works[j].name,
  620. type: 9,
  621. time: works[j].time,
  622. score: works[j].score,
  623. img: works[j].img,
  624. likesCount: likesCount,
  625. commentCount: commentCount,
  626. isLikes: isLikes,
  627. commentJson: commentJson
  628. }
  629. worksStudent[step].push(_works)
  630. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  631. } else if (works[j].type === 10 && steps[step].tool[0] === 48) {
  632. // 选择题
  633. const _works = {
  634. userid: works[j].userid,
  635. ateacher: works[j].ateacher,
  636. wid: works[j].id,
  637. works: works[j].content,
  638. sName: works[j].name,
  639. type: 10,
  640. time: works[j].time,
  641. score: works[j].score,
  642. img: works[j].img,
  643. likesCount: likesCount,
  644. commentCount: commentCount,
  645. isLikes: isLikes,
  646. commentJson: commentJson
  647. }
  648. worksStudent[step].push(_works)
  649. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  650. } else if (works[j].type === 13 && steps[step].tool[0] === 52) {
  651. // 选择题
  652. const _works = {
  653. userid: works[j].userid,
  654. ateacher: works[j].ateacher,
  655. wid: works[j].id,
  656. works: works[j].content,
  657. sName: works[j].name,
  658. type: 13,
  659. time: works[j].time,
  660. score: works[j].score,
  661. img: works[j].img,
  662. likesCount: likesCount,
  663. commentCount: commentCount,
  664. isLikes: isLikes,
  665. commentJson: commentJson
  666. }
  667. worksStudent[step].push(_works)
  668. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  669. } else if (works[j].type === 11 && steps[step].tool[0] === 49) {
  670. const _gindex = JSON.parse(works[j].content)
  671. if (groupStudentUid[step][_gindex.groupIndex].indexOf(works[j].userid) !== -1) {
  672. worksStudent[step][_gindex.groupIndex].push({
  673. userid: works[j].userid,
  674. ateacher: works[j].ateacher,
  675. wid: works[j].id,
  676. works: _gindex.url,
  677. sName: works[j].name,
  678. type: _gindex.type,
  679. time: works[j].time,
  680. score: works[j].score,
  681. img: works[j].img,
  682. likesCount: likesCount,
  683. commentCount: commentCount,
  684. isLikes: isLikes,
  685. commentJson: commentJson
  686. })
  687. }
  688. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  689. } else if (steps[step].tool[0] === 50 && (works[j].atool ? parseInt(works[j].atool) : '') === 50) {
  690. const _works = {
  691. userid: works[j].userid,
  692. ateacher: works[j].ateacher,
  693. wid: works[j].id,
  694. works: works[j].content,
  695. sName: works[j].name ? works[j].name : works[j].userid,
  696. type: works[j].type === 1 ? 0 : works[j].type === 4 ? 1 : 3,
  697. time: works[j].time,
  698. score: works[j].score,
  699. img: works[j].img,
  700. likesCount: likesCount,
  701. commentCount: commentCount,
  702. isLikes: isLikes,
  703. commentJson: commentJson
  704. }
  705. worksStudent[step].push(_works)
  706. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  707. } else if (steps[step].tool[0] === 32 && (works[j].atool ? parseInt(works[j].atool) : '') === 32) {
  708. const _works = {
  709. userid: works[j].userid,
  710. ateacher: works[j].ateacher,
  711. wid: works[j].id,
  712. works: works[j].content,
  713. sName: works[j].name ? works[j].name : works[j].userid,
  714. type: 12,
  715. time: works[j].time,
  716. score: works[j].score,
  717. img: works[j].img,
  718. likesCount: likesCount,
  719. commentCount: commentCount,
  720. isLikes: isLikes,
  721. commentJson: commentJson
  722. }
  723. worksStudent[step].push(_works)
  724. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  725. } else if (steps[step].tool[0] === 57 && (works[j].atool ? parseInt(works[j].atool) : '') === 57) {
  726. const _works = {
  727. userid: works[j].userid,
  728. ateacher: works[j].ateacher,
  729. wid: works[j].id,
  730. works: works[j].content,
  731. sName: works[j].name ? works[j].name : works[j].userid,
  732. type: 12,
  733. time: works[j].time,
  734. score: works[j].score,
  735. img: works[j].img,
  736. likesCount: likesCount,
  737. commentCount: commentCount,
  738. isLikes: isLikes,
  739. commentJson: commentJson
  740. }
  741. worksStudent[step].push(_works)
  742. isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
  743. }
  744. }
  745. }
  746. }
  747. // if (worksStudent[step] && worksStudent[step].length) {
  748. // worksStudent[step] = worksStudent[step].sort(function(a, b) {
  749. // const jscoreA = a.score ? JSON.parse(a.score).wScore : 0
  750. // const jscoreB = b.score ? JSON.parse(b.score).wScore : 0
  751. // var scoreA = parseFloat(jscoreA)
  752. // var scoreB = parseFloat(jscoreB)
  753. // if (scoreA === scoreB) {
  754. // return b.likesCount - a.likesCount
  755. // }
  756. // return scoreB - scoreA
  757. // })
  758. // }
  759. this.worksStudent = worksStudent
  760. this.isCloseList = isCloseList
  761. this.groupStudent = groupStudent
  762. this.groupStudentUid = groupStudentUid
  763. this.isWorksS = isWorksS
  764. this.$forceUpdate()
  765. this.selectWorksStudent()
  766. })
  767. .catch(err => {
  768. console.error(err)
  769. })
  770. },
  771. selectWorksStudent() {
  772. const params = {
  773. oid: this.oid,
  774. cid: this.courseDetail.juri
  775. }
  776. getCourseWorksStudentJuri(params)
  777. .then(res => {
  778. var a = res[0]
  779. for (var i = 0; i < this.isWorksS.length; i++) {
  780. this.noWorksS[i] = []
  781. var studentK = []
  782. for (var z = 0; z < this.isWorksS[i].length; z++) {
  783. studentK.push(this.isWorksS[i][z].uid)
  784. }
  785. studentK = studentK.join(',')
  786. for (var j = 0; j < a.length; j++) {
  787. if (studentK.indexOf(a[j].userid) === -1) {
  788. if (this.tcid) {
  789. if (this.arrayToArray(a[j].classid.split(','), this.tcid.split(',')).length) {
  790. this.noWorksS[i].push({
  791. student: a[j].name,
  792. userid: a[j].userid
  793. })
  794. }
  795. } else {
  796. this.noWorksS[i].push({
  797. student: a[j].name,
  798. userid: a[j].userid
  799. })
  800. }
  801. }
  802. }
  803. }
  804. this.$forceUpdate()
  805. })
  806. .catch(err => {
  807. console.log(err)
  808. })
  809. },
  810. contract(i) {
  811. if (this.isCloseList[i].isClose === 0) {
  812. this.isCloseList[i].isClose = 1
  813. } else {
  814. this.isCloseList[i].isClose = 0
  815. }
  816. this.$forceUpdate()
  817. },
  818. addImg(e) {
  819. var el = e.currentTarget
  820. el.getElementsByTagName('input')[0].click()
  821. e.target.value = ''
  822. },
  823. pngToWhiteBg(file) {
  824. const _file = file
  825. const read = new FileReader()
  826. read.readAsDataURL(file) // 文件转base64
  827. return new Promise((resolve, reject) => {
  828. read.onload = e => {
  829. const img = new Image()
  830. img.src = e.target.result
  831. // eslint-disable-next-line space-before-function-paren
  832. img.onload = async () => {
  833. // 生成canvas
  834. const canvas = document.createElement('canvas')
  835. const context = canvas.getContext('2d')
  836. // 绘制图片到canvas上
  837. canvas.width = img.width
  838. canvas.height = img.height
  839. // 在canvas绘制前填充白色背景
  840. context.fillStyle = '#fff'
  841. context.fillRect(0, 0, canvas.width, canvas.height)
  842. context.drawImage(img, 0, 0)
  843. const base64 = canvas.toDataURL(file['type'], 1)
  844. const newFile = this.dataUrlToFile(base64, _file)
  845. resolve(newFile)
  846. }
  847. }
  848. })
  849. },
  850. dataUrlToFile(dataurl, file) {
  851. const arr = dataurl.split(',')
  852. const mime = arr[0].match(/:(.*?);/)[1]
  853. const bstr = atob(arr[1])
  854. let n = bstr.length
  855. const u8arr = new Uint8Array(n)
  856. while (n--) {
  857. u8arr[n] = bstr.charCodeAt(n)
  858. }
  859. // return new Blob([u8arr], { type: mime });
  860. return new File([new Blob([u8arr], { type: mime })], file.name, {
  861. type: mime
  862. })
  863. },
  864. async beforeUpload(event, type, i) {
  865. // this.$message.success('进入上传')
  866. var file = ''
  867. const files = event.target.files
  868. const plfile = []
  869. for (let cfindex2 = 0; cfindex2 < files.length; cfindex2++) {
  870. if (files.length > 1) {
  871. this.pVisible = false
  872. } else {
  873. this.pVisible = true
  874. }
  875. file = files[cfindex2]
  876. var credentials = {
  877. accessKeyId: 'AKIATLPEDU37QV5CHLMH',
  878. secretAccessKey: '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'
  879. } // 秘钥形式的登录上传
  880. window.AWS.config.update(credentials)
  881. window.AWS.config.region = 'cn-northwest-1' // 设置区域
  882. // eslint-disable-next-line prettier/prettier
  883. var bucket = new window.AWS.S3({ params: { Bucket: 'ccrb' } }) // 选择桶
  884. var _this = this
  885. _this.progress = 0
  886. _this.proVisible = true
  887. _this.isFinishSize = 0
  888. _this.isAllSize = (file.size / 1024 / 1024).toFixed(2)
  889. var photoA = ['BMP', 'GIF', 'PNG', 'JPGE', 'JPEG', 'JPG', 'TIF', 'PCX', 'TGA', 'EXIF', 'FPX', 'SVG', 'APNG']
  890. if (
  891. photoA.indexOf(file.name.split('.')[file.name.split('.').length - 1].toLocaleUpperCase()) !== -1 &&
  892. type !== 4
  893. ) {
  894. file = await this.pngToWhiteBg(file)
  895. const blob = await imageConversion.compressAccurately(file, 256)
  896. file = new File([blob], file.name, { type: file.type })
  897. }
  898. if (file) {
  899. var params = {
  900. Key:
  901. file.name.split('.')[0] +
  902. new Date().getTime() +
  903. '.' +
  904. file.name.split('.')[file.name.split('.').length - 1],
  905. ContentType: file.type,
  906. Body: file,
  907. 'Access-Control-Allow-Credentials': '*',
  908. ACL: 'public-read'
  909. } // key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
  910. var options = {
  911. // partSize: 2048 * 1024 * 1024,
  912. partSize: 1024 * 1024 * 1024,
  913. queueSize: 2,
  914. leavePartsOnError: true
  915. }
  916. bucket
  917. .upload(params, options)
  918. .on('httpUploadProgress', function (evt) {
  919. // 这里可以写进度条
  920. // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
  921. _this.progress = parseInt((evt.loaded / evt.total) * 100)
  922. _this.isFinishSize = (evt.loaded / 1024 / 1024).toFixed(2)
  923. })
  924. .send(function (err, data) {
  925. _this.progress = 100
  926. _this.isFinishSize = _this.isAllSize
  927. if (cfindex2 === files.length - 1 || cfindex2 > files.length - 1) {
  928. setTimeout(() => {
  929. _this.proVisible = false
  930. }, 1000)
  931. }
  932. if (err) {
  933. var a = _this.$refs.upload1.uploadFiles
  934. a.splice(a.length - 1, a.length)
  935. _this.$message.error('上传失败')
  936. } else {
  937. var b = ['PDF', 'DOC', 'DOCX', 'PPT', 'PPTX', 'XLSX', 'XLS']
  938. var c = [
  939. 'AVI',
  940. 'NAVI',
  941. 'MPEG',
  942. 'ASF',
  943. 'MOV',
  944. 'WMV',
  945. '3GP',
  946. 'RM',
  947. 'RMVB',
  948. 'FLV',
  949. 'F4V',
  950. 'H.264',
  951. 'H.265',
  952. 'REAL VIDEO',
  953. 'MKV',
  954. 'WebM',
  955. 'HDDVD',
  956. 'MP4',
  957. 'MPG',
  958. 'M4V',
  959. 'MGV',
  960. 'OGV',
  961. 'QTM',
  962. 'STR',
  963. 'AMC',
  964. 'DVX',
  965. 'EVO',
  966. 'DAT',
  967. 'OGG',
  968. 'OGM'
  969. ]
  970. if (type === 16) {
  971. if (
  972. c.indexOf(data.Location.split('.')[data.Location.split('.').length - 1].toLocaleUpperCase()) !== -1
  973. ) {
  974. _this.fileType = 2
  975. } else if (
  976. b.indexOf(data.Location.split('.')[data.Location.split('.').length - 1].toLocaleUpperCase()) !== -1
  977. ) {
  978. _this.fileType = 1
  979. } else if (
  980. photoA.indexOf(
  981. data.Location.split('.')[data.Location.split('.').length - 1].toLocaleUpperCase()
  982. ) !== -1
  983. ) {
  984. _this.fileType = 0
  985. } else {
  986. _this.fileType = 3
  987. }
  988. _this.addCourseWorks(data.Location, i)
  989. } else if (type === 50) {
  990. var _ftype = 1
  991. if (
  992. c.indexOf(data.Location.split('.')[data.Location.split('.').length - 1].toLocaleUpperCase()) !== -1
  993. ) {
  994. _ftype = 5
  995. } else if (
  996. b.indexOf(data.Location.split('.')[data.Location.split('.').length - 1].toLocaleUpperCase()) !== -1
  997. ) {
  998. _ftype = 4
  999. } else {
  1000. _ftype = 1
  1001. }
  1002. plfile.push({
  1003. fileType: _ftype,
  1004. url: data.Location,
  1005. username: _this.userinfo.userid
  1006. })
  1007. if (cfindex2 === files.length - 1 || cfindex2 > files.length - 1) {
  1008. _this.addCourseWorksPl(plfile, i)
  1009. }
  1010. }
  1011. console.log(data.Location)
  1012. }
  1013. })
  1014. }
  1015. }
  1016. },
  1017. async beforeUpload2(event, i) {
  1018. // this.$message.success('进入上传')
  1019. var file = ''
  1020. file = event.target.files[0]
  1021. var credentials = {
  1022. accessKeyId: 'AKIATLPEDU37QV5CHLMH',
  1023. secretAccessKey: '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'
  1024. } // 秘钥形式的登录上传
  1025. window.AWS.config.update(credentials)
  1026. window.AWS.config.region = 'cn-northwest-1' // 设置区域
  1027. // eslint-disable-next-line prettier/prettier
  1028. var bucket = new window.AWS.S3({ params: { Bucket: 'ccrb' } }) // 选择桶
  1029. var _this = this
  1030. _this.progress = 0
  1031. _this.proVisible = true
  1032. _this.isFinishSize = 0
  1033. _this.isAllSize = (file.size / 1024 / 1024).toFixed(2)
  1034. var photoA = ['BMP', 'GIF', 'PNG', 'JPGE', 'JPEG', 'JPG', 'TIF', 'PCX', 'TGA', 'EXIF', 'FPX', 'SVG', 'APNG']
  1035. if (photoA.indexOf(file.name.split('.')[file.name.split('.').length - 1].toLocaleUpperCase()) !== -1) {
  1036. file = await this.pngToWhiteBg(file)
  1037. const blob = await imageConversion.compressAccurately(file, 256)
  1038. file = new File([blob], file.name, { type: file.type })
  1039. }
  1040. if (file) {
  1041. var params = {
  1042. Key:
  1043. file.name.split('.')[0] +
  1044. new Date().getTime() +
  1045. '.' +
  1046. file.name.split('.')[file.name.split('.').length - 1],
  1047. ContentType: file.type,
  1048. Body: file,
  1049. 'Access-Control-Allow-Credentials': '*',
  1050. ACL: 'public-read'
  1051. } // key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
  1052. var options = {
  1053. // partSize: 2048 * 1024 * 1024,
  1054. partSize: 1024 * 1024 * 1024,
  1055. queueSize: 2,
  1056. leavePartsOnError: true
  1057. }
  1058. bucket
  1059. .upload(params, options)
  1060. .on('httpUploadProgress', function (evt) {
  1061. // 这里可以写进度条
  1062. // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
  1063. _this.progress = parseInt((evt.loaded / evt.total) * 100)
  1064. _this.isFinishSize = (evt.loaded / 1024 / 1024).toFixed(2)
  1065. })
  1066. .send(function (err, data) {
  1067. _this.progress = 100
  1068. _this.isFinishSize = _this.isAllSize
  1069. setTimeout(() => {
  1070. _this.proVisible = false
  1071. }, 1000)
  1072. if (err) {
  1073. var a = _this.$refs.upload1.uploadFiles
  1074. a.splice(a.length - 1, a.length)
  1075. _this.$message.error('上传失败')
  1076. } else {
  1077. var b = ['PDF', 'DOC', 'DOCX', 'PPT', 'PPTX', 'XLSX', 'XLS']
  1078. var c = [
  1079. 'AVI',
  1080. 'NAVI',
  1081. 'MPEG',
  1082. 'ASF',
  1083. 'MOV',
  1084. 'WMV',
  1085. '3GP',
  1086. 'RM',
  1087. 'RMVB',
  1088. 'FLV',
  1089. 'F4V',
  1090. 'H.264',
  1091. 'H.265',
  1092. 'REAL VIDEO',
  1093. 'MKV',
  1094. 'WebM',
  1095. 'HDDVD',
  1096. 'MP4',
  1097. 'MPG',
  1098. 'M4V',
  1099. 'MGV',
  1100. 'OGV',
  1101. 'QTM',
  1102. 'STR',
  1103. 'AMC',
  1104. 'DVX',
  1105. 'EVO',
  1106. 'DAT',
  1107. 'OGG',
  1108. 'OGM'
  1109. ]
  1110. if (_this.sTool === 16 || _this.sTool === 50) {
  1111. if (
  1112. c.indexOf(data.Location.split('.')[data.Location.split('.').length - 1].toLocaleUpperCase()) !== -1
  1113. ) {
  1114. _this.fileType = 2
  1115. } else if (
  1116. b.indexOf(data.Location.split('.')[data.Location.split('.').length - 1].toLocaleUpperCase()) !== -1
  1117. ) {
  1118. _this.fileType = 1
  1119. } else if (
  1120. photoA.indexOf(data.Location.split('.')[data.Location.split('.').length - 1].toLocaleUpperCase()) !==
  1121. -1
  1122. ) {
  1123. _this.fileType = 0
  1124. } else {
  1125. _this.fileType = 3
  1126. }
  1127. _this.addCourseWorksTeacher(data.Location, i)
  1128. }
  1129. console.log(data.Location)
  1130. }
  1131. })
  1132. }
  1133. },
  1134. addCourseWorks(data, toolindex) {
  1135. var typesql
  1136. if (this.fileType === 0) {
  1137. typesql = 1
  1138. } else if (this.fileType === 1) {
  1139. typesql = 4
  1140. } else if (this.fileType === 2) {
  1141. typesql = 5
  1142. } else if (this.fileType === 3) {
  1143. typesql = 12
  1144. }
  1145. const params = [
  1146. {
  1147. uid: this.userinfo.userid,
  1148. cid: this.courseid,
  1149. stage: this.courseType,
  1150. task: this.taskCount,
  1151. tool: toolindex,
  1152. content: data,
  1153. type: typesql
  1154. }
  1155. ]
  1156. addCourseWorksR(params)
  1157. .then(res => {
  1158. this.$toast({
  1159. message: '添加成功',
  1160. type: 'success'
  1161. })
  1162. setTimeout(() => {
  1163. this.getWorks()
  1164. }, 2000)
  1165. })
  1166. .catch(err => {
  1167. console.error(err)
  1168. })
  1169. },
  1170. addCourseWorks5(data, toolindex, tool, typesql) {
  1171. const params = [
  1172. {
  1173. uid: this.userinfo.userid,
  1174. cid: this.courseid,
  1175. stage: this.courseType,
  1176. task: this.taskCount,
  1177. tool: toolindex,
  1178. content: data,
  1179. type: typesql,
  1180. atool: tool,
  1181. text: ''
  1182. }
  1183. ]
  1184. addCourseWorks5(params)
  1185. .then(res => {
  1186. this.$toast({
  1187. message: '添加成功',
  1188. type: 'success'
  1189. })
  1190. setTimeout(() => {
  1191. this.getWorks()
  1192. }, 2000)
  1193. })
  1194. .catch(err => {
  1195. console.error(err)
  1196. })
  1197. },
  1198. addCourseWorksTeacher(data, toolindex) {
  1199. var typesql
  1200. if (this.sTool === 32 || this.sTool === 57) {
  1201. this.addCourseWorksGongTeacher(this.toolindex, data, this.sTool)
  1202. return
  1203. }
  1204. if (this.fileType === 0) {
  1205. typesql = 1
  1206. } else if (this.fileType === 1) {
  1207. typesql = 4
  1208. } else if (this.fileType === 2) {
  1209. typesql = 5
  1210. } else if (this.fileType === 3) {
  1211. typesql = 12
  1212. }
  1213. if (this.sTool === 50) {
  1214. this.addCourseWorks5(data, toolindex, this.sTool, typesql)
  1215. return
  1216. }
  1217. if (!data) {
  1218. this.$message.error('请上传文件')
  1219. return
  1220. }
  1221. const params = [
  1222. {
  1223. uid: this.sStudent.userid,
  1224. cid: this.courseid,
  1225. stage: this.courseType,
  1226. task: this.taskCount,
  1227. tool: toolindex,
  1228. content: data,
  1229. type: typesql,
  1230. ateacher: this.userinfo.userid
  1231. }
  1232. ]
  1233. addCourseWorksTeacher(params)
  1234. .then(res => {
  1235. this.$toast({
  1236. message: '添加成功',
  1237. type: 'success'
  1238. })
  1239. setTimeout(() => {
  1240. this.getWorks()
  1241. }, 2000)
  1242. })
  1243. .catch(err => {
  1244. this.$message.error('提交失败')
  1245. console.error(err)
  1246. })
  1247. },
  1248. addCourseWorksPl(files, toolindex) {
  1249. const _files = files
  1250. const params = [
  1251. {
  1252. ateacher: this.userinfo.userid,
  1253. cid: this.courseid,
  1254. stage: this.courseType,
  1255. task: this.taskCount,
  1256. tool: toolindex,
  1257. content: JSON.stringify(_files).replaceAll(/%/g, '%25')
  1258. }
  1259. ]
  1260. addCourseWorksPl(params)
  1261. .then(res => {
  1262. this.$toast({
  1263. message: '添加成功',
  1264. type: 'success'
  1265. })
  1266. setTimeout(() => {
  1267. this.getWorks()
  1268. }, 2000)
  1269. })
  1270. .catch(err => {
  1271. this.$message.error('提交失败')
  1272. console.error(err)
  1273. })
  1274. },
  1275. teacherSubmit(tool, studnet, e, content) {
  1276. this.sStudent = studnet
  1277. this.sTool = tool
  1278. if (this.userinfo.type === 1) {
  1279. if (tool === 16 || tool === 50) {
  1280. var el = e.currentTarget
  1281. el.getElementsByTagName('input')[0].click()
  1282. e.target.value = ''
  1283. } else if (tool === 15) {
  1284. this.isTeacher = false
  1285. this.answerQ = content.answerQ
  1286. this.setPanelVisible(true)
  1287. }
  1288. }
  1289. },
  1290. addWork(tool, toolindex, content) {
  1291. this.sStudent = {}
  1292. this.toolindex = toolindex
  1293. if (tool === 15) {
  1294. this.isTeacher = true
  1295. this.answerQ = content.answerQ
  1296. this.setPanelVisible(true)
  1297. } else if (tool === 4) {
  1298. this.isTeacher = true
  1299. this.askJson = content
  1300. this.setAskPanelVisible(true)
  1301. }else if(tool == 45){
  1302. this.isTeacher = true
  1303. this.chooseJson = content
  1304. this.setChoosePanelVisible(true)
  1305. }
  1306. }
  1307. },
  1308. mounted() {
  1309. this.getWorks()
  1310. }
  1311. }
  1312. </script>
  1313. <style lang="scss" scoped>
  1314. .sb-container {
  1315. width: 100%;
  1316. box-sizing: border-box;
  1317. padding: 0 15px 60px;
  1318. .steps-box {
  1319. width: 100%;
  1320. border-bottom: 1px solid rgb(239, 239, 239);
  1321. padding: 15px 0;
  1322. .step-title {
  1323. display: flex;
  1324. align-items: center;
  1325. justify-content: space-between;
  1326. height: 0.8rem;
  1327. .step {
  1328. font-size: 18px;
  1329. font-weight: bold;
  1330. display: flex;
  1331. height: 100%;
  1332. align-items: center;
  1333. &::before {
  1334. content: '';
  1335. height: 100%;
  1336. width: 3px;
  1337. display: block;
  1338. margin-right: 0.2rem;
  1339. background-image: linear-gradient(180deg, #2c5cbd, #a1cff4);
  1340. }
  1341. }
  1342. .do {
  1343. font-size: 14px;
  1344. color: #b9b9b9;
  1345. display: flex;
  1346. align-items: center;
  1347. cursor: pointer;
  1348. &::after {
  1349. content: '';
  1350. width: 5px;
  1351. height: 5px;
  1352. border-top: 2px solid #b9b9b9;
  1353. border-left: 2px solid #b9b9b9;
  1354. transform: rotate(-135deg);
  1355. transition: all 0.5s;
  1356. margin-left: 5px;
  1357. }
  1358. &.close {
  1359. &::after {
  1360. transform: rotate(-45deg);
  1361. }
  1362. }
  1363. }
  1364. }
  1365. }
  1366. .tool-box {
  1367. margin: 10px 0;
  1368. display: flex;
  1369. flex-direction: column;
  1370. justify-content: center;
  1371. align-items: center;
  1372. width: 1.5rem;
  1373. .tool-img {
  1374. width: 1.5rem;
  1375. border-radius: 15px;
  1376. box-shadow: 0 1px 8px 0 #14141424;
  1377. > img {
  1378. width: 100%;
  1379. height: auto;
  1380. object-fit: cover;
  1381. }
  1382. }
  1383. .tool-name {
  1384. font-size: 14px;
  1385. margin-top: 5px;
  1386. white-space: nowrap;
  1387. }
  1388. }
  1389. .works-box {
  1390. .title {
  1391. font-size: 14px;
  1392. color: #858585;
  1393. }
  1394. .works {
  1395. margin: 10px 0 0;
  1396. display: flex;
  1397. flex-wrap: wrap;
  1398. .work {
  1399. }
  1400. }
  1401. }
  1402. .no-works-box {
  1403. margin-top: 10px;
  1404. .title {
  1405. font-size: 14px;
  1406. color: #858585;
  1407. }
  1408. .no-works-box-students {
  1409. width: 100%;
  1410. display: flex;
  1411. flex-wrap: wrap;
  1412. margin: 10px 0 0;
  1413. .student {
  1414. background: #7cbcf1;
  1415. color: #fff;
  1416. width: 70px;
  1417. height: 20px;
  1418. text-align: center;
  1419. line-height: 20px;
  1420. border-radius: 5px;
  1421. margin: 0 15px 10px 0;
  1422. padding: 5px;
  1423. font-size: 14px;
  1424. cursor: pointer;
  1425. white-space: nowrap;
  1426. overflow: hidden;
  1427. text-overflow: ellipsis;
  1428. word-break: break-word;
  1429. max-width: 70px;
  1430. // @include textoverflow();
  1431. }
  1432. }
  1433. }
  1434. .noMssage {
  1435. width: 100%;
  1436. height: 5rem;
  1437. display: flex;
  1438. align-items: center;
  1439. justify-content: center;
  1440. > img {
  1441. width: 3rem;
  1442. }
  1443. }
  1444. }
  1445. </style>