markDialog.vue 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933
  1. <template>
  2. <div class="markDialog" v-loading="vLoading">
  3. <div
  4. style="overflow: auto;overflow-x: hidden;width: 315px;box-sizing: content-box;border-right: 1px rgba(231, 231, 231, 1) solid;"
  5. >
  6. <div class="left">
  7. <div v-loading="ScLoading">
  8. <div class="scoreTit">
  9. <div>任务得分</div>
  10. <div>
  11. <span style="color: #4380F8;margin-right: 3px;">{{
  12. totalScore ? totalScore : 0
  13. }}</span
  14. >分
  15. </div>
  16. </div>
  17. <div class="allD" :style="{ marginLeft: isMarkSco ? '0' : '17px' }">
  18. <div class="scoreStar">
  19. <div
  20. v-show="reveal"
  21. v-for="(e, index) in scoTitList"
  22. :key="index + 'a'"
  23. >
  24. <div class="scoreStarBack">
  25. <el-tooltip
  26. class="item"
  27. effect="dark"
  28. :content="e.detail"
  29. placement="top"
  30. >
  31. <div class="briefTit">
  32. <img
  33. v-if="e.isai == 1 || !e.isai"
  34. class="titRoot"
  35. src="../../../assets/icon/newIcons/blueRoot.png"
  36. alt=""
  37. />
  38. {{ e.detail }}
  39. </div>
  40. </el-tooltip>
  41. <el-rate @change="submit" v-model="e.cog"></el-rate>
  42. </div>
  43. </div>
  44. <div
  45. v-show="!reveal"
  46. v-for="(e, index) in scoTitList.slice(0, 3)"
  47. :key="index + 'b'"
  48. >
  49. <div class="scoreStarBack">
  50. <el-tooltip
  51. class="item"
  52. effect="dark"
  53. :content="e.detail"
  54. placement="top"
  55. >
  56. <div class="briefTit">
  57. <img
  58. class="titRoot"
  59. v-if="e.isai == 1 || !e.isai"
  60. src="../../../assets/icon/newIcons/blueRoot.png"
  61. alt=""
  62. />
  63. {{ e.detail }}
  64. </div>
  65. </el-tooltip>
  66. <el-rate @change="submit" v-model="e.cog"></el-rate>
  67. </div>
  68. </div>
  69. </div>
  70. <div
  71. v-if="reveal && scoTitList.length > 3"
  72. class="scoreStar2"
  73. @click="revealBtn"
  74. >
  75. 折叠 <i class="el-icon-arrow-up"></i>
  76. </div>
  77. <div
  78. v-if="!reveal && scoTitList.length > 3"
  79. class="scoreStar2"
  80. @click="revealBtn"
  81. >
  82. 全部 <i class="el-icon-arrow-down"></i>
  83. </div>
  84. </div>
  85. <div class="AreaCss">
  86. <el-input
  87. type="textarea"
  88. placeholder="您可在此输入评语"
  89. v-model="textarea"
  90. @blur="submit"
  91. >
  92. </el-input>
  93. <div
  94. v-if="
  95. (currentUid.type == 1 ||
  96. currentUid.type == 10 ||
  97. currentUid.type == 13 ||
  98. isMarkCom == 1) &&
  99. !isMarkSco
  100. "
  101. class="anewC"
  102. @click="anewEva"
  103. >
  104. 重新生成
  105. </div>
  106. </div>
  107. <div
  108. style="width:100%;display:flex;height: 25px;;justify-content: space-between;"
  109. >
  110. <div></div>
  111. <div style="display: flex;">
  112. <div
  113. class="ScrBtn"
  114. @click="reset"
  115. style="color: rgba(0, 0, 0, 0.6);background-color: rgba(243, 247, 253, 1);border: none;"
  116. >
  117. 清空
  118. </div>
  119. <div
  120. class="ScrBtn"
  121. style="margin-left: 10px;"
  122. @click="AIsubmit(currentUid)"
  123. v-if="
  124. (currentUid.type == 1 ||
  125. currentUid.type == 10 ||
  126. currentUid.type == 13 ||
  127. isMarkCom == 1) &&
  128. !isMarkSco
  129. "
  130. >
  131. <img
  132. src="../../../assets/icon/newIcons/rootImg.png"
  133. alt=""
  134. />AI评分
  135. </div>
  136. <div
  137. class="ScrBtn"
  138. style="margin-left: 10px;"
  139. v-if="
  140. (currentUid.type == 1 ||
  141. currentUid.type == 10 ||
  142. currentUid.type == 13 ||
  143. isMarkCom == 1) &&
  144. isMarkSco
  145. "
  146. @click="noIsAi"
  147. >
  148. <img
  149. src="../../../assets/icon/newIcons/rootImg.png"
  150. alt=""
  151. />AI评分
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. <!-- 提交列表 -->
  157. <div
  158. style="flex: 1;display: flex;flex-direction: column;overflow: auto;"
  159. >
  160. <div class="workListTit" @click="workListTitBtn">
  161. <i class="el-icon-arrow-down"></i>提交列表 ({{ workList.length }})
  162. </div>
  163. <div style="overflow: auto;flex: 1;">
  164. <div
  165. v-if="workListShow"
  166. v-for="(i, index) in workList"
  167. :key="index"
  168. :class="['schPer', i.userid == DgUid ? 'selBlock' : '']"
  169. style="cursor: pointer;"
  170. @click="cutPer(i.userid, index)"
  171. >
  172. <img v-if="i.headportrait" :src="i.headportrait" alt="" />
  173. <img
  174. v-else
  175. src="https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/static/img/portal.b3cf7fa.png"
  176. alt=""
  177. />
  178. <div class="con">
  179. <div class="tit">
  180. <span
  181. style="font-size: 14px;color: rgba(0, 0, 0, 0.9);font-weight: 400;"
  182. >{{ i.name }}</span
  183. >
  184. <span
  185. style="font-size: 14px;color:rgba(0, 0, 0, 0.4);"
  186. v-if="i.markSco == null"
  187. >未评分</span
  188. >
  189. <span
  190. v-else
  191. style="font-size: 16px;color: rgba(0, 0, 0, 0.9);font-weight: 600;"
  192. >{{ i.markSco }}</span
  193. >
  194. </div>
  195. <div class="Timer">{{ i.time }}</div>
  196. </div>
  197. </div>
  198. </div>
  199. </div>
  200. </div>
  201. </div>
  202. <!-- 作业展示区 -->
  203. <div class="Rig">
  204. <div class="RigTop">
  205. <div
  206. style="display: flex;align-items: center;justify-content: space-between;width: 100%;"
  207. >
  208. <div
  209. class="schPer"
  210. style="border: none;width: 300px;padding: 0;margin: 0;"
  211. >
  212. <img
  213. v-if="currentUid.headportrait"
  214. :src="currentUid.headportrait"
  215. alt=""
  216. />
  217. <img
  218. v-else
  219. src="https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/static/img/portal.b3cf7fa.png"
  220. alt=""
  221. />
  222. <div class="con">
  223. <div class="tit">
  224. <span
  225. style="font-size: 14px;color: rgba(0, 0, 0, 0.9);font-weight: 400;"
  226. >{{ currentUid.name }}</span
  227. >
  228. </div>
  229. <div class="Timer">{{ currentUid.time }}</div>
  230. </div>
  231. </div>
  232. <div class="cutStuBtn">
  233. <div>
  234. <span v-if="current == 0" style="cursor: pointer;color:#ccc"
  235. >上一个</span
  236. >
  237. <span
  238. v-else
  239. @click="prevStu"
  240. style="cursor: pointer;color: rgba(54, 129, 252, 1)"
  241. >上一个</span
  242. >
  243. </div>
  244. <div>
  245. <span
  246. v-if="current >= workList.length - 1"
  247. style="cursor: pointer;color: #ccc"
  248. >下一个</span
  249. >
  250. <span
  251. v-else
  252. @click="nextStu"
  253. style="cursor: pointer;color: rgba(54, 129, 252, 1)"
  254. >下一个</span
  255. >
  256. </div>
  257. <!-- <div><span @click="prevStu" v-if="this.current > 0">上一个</span></div>
  258. <div><span @click="nextStu" v-if="this.current < this.workList.length-1">下一个</span></div> -->
  259. </div>
  260. </div>
  261. </div>
  262. <div class="RigConTit">
  263. <div :class="[cutNum ? '' : 'RigConTitOn']" @click="cutPage(0)">
  264. 学生作业
  265. </div>
  266. <div :class="[cutNum ? 'RigConTitOn' : '']" @click="cutPage(1)">
  267. 点赞与评论
  268. </div>
  269. </div>
  270. <div class="RigCon">
  271. <!-- 作业内容 -->
  272. <div v-if="cutNum == 0" style="height: 97%;">
  273. <div
  274. v-if="
  275. currentUid.type == 13 || currentUid.type == 10
  276. // currentUid.type == 15
  277. "
  278. >
  279. <div class="cont" v-html="currentUid.content.text"></div>
  280. </div>
  281. <div v-if="currentUid.type == 1">
  282. <img
  283. @click="previewImg(currentUid.content)"
  284. style="max-width: 100%;object-fit: cover;"
  285. :src="currentUid.content"
  286. alt=""
  287. />
  288. </div>
  289. <div v-if="currentUid.type == 3">
  290. <div style="width: 100%;text-align: center;">
  291. <div
  292. style="margin-bottom: 20px;font-weight: 600;font-size: 16px;"
  293. >
  294. {{ currentUid.content[0].answerTitle }}
  295. </div>
  296. <div>{{ currentUid.content[0].answer }}</div>
  297. </div>
  298. </div>
  299. <div v-if="currentUid.type == 4" style="height: 100%;">
  300. <iframe
  301. v-if="ifPdf == 1"
  302. style="width: 100%; height: 99%; border: none"
  303. :src="
  304. 'https://cloud.cocorobo.cn/pdf.js/web/viewer.html?file=' +
  305. encodeURIComponent(currentUid.content)
  306. "
  307. ></iframe>
  308. <iframe
  309. v-else
  310. style="width: 100%; height: 100%; border: none"
  311. :src="
  312. 'https://view.officeapps.live.com/op/view.aspx?src=' +
  313. encodeURIComponent(currentUid.content)
  314. "
  315. frameborder="0"
  316. ></iframe>
  317. </div>
  318. <div v-if="currentUid.type == 12" style="height: 100%;">
  319. <div>{{ TxtMd }}</div>
  320. </div>
  321. <div v-if="currentUid.type == 15" style="height: 100%;">
  322. <div
  323. class="worksAnswer"
  324. v-if="currentUid.content"
  325. @click="
  326. openCocoPi(57, toolIndex, currentUid.userid, currentUid.name)
  327. "
  328. >
  329. <img src="../../../assets/icon/codeFile.png" />
  330. <div>点击打开CocoPi</div>
  331. </div>
  332. </div>
  333. <div v-if="currentUid.type == 5" style="height: 100%;">
  334. <video-player
  335. class="video-player vjs-custom-skin"
  336. :playsinline="true"
  337. :options="playerOptions"
  338. @play="onPlayerPlay($event)"
  339. style="width: 90%; height: 95%; margin: 0 0 0 30px"
  340. ></video-player>
  341. </div>
  342. </div>
  343. <!-- 点赞与评论 -->
  344. <div v-if="cutNum == 1">
  345. <div style="display: flex;align-items: center;">
  346. <img
  347. style="margin-right: 3px;"
  348. src="../../../assets/icon/newIcons/likeG.png"
  349. alt=""
  350. />点赞({{ likeList.length }})
  351. </div>
  352. <div class="likeList">
  353. <div v-for="i in likeList" :key="i.id">{{ i.username }}</div>
  354. </div>
  355. <div style="display: flex;align-items: center;">
  356. <img
  357. style="margin-right: 3px;"
  358. src="../../../assets/icon/newIcons/commG.png"
  359. alt=""
  360. />评论({{ commentList.length }})
  361. </div>
  362. <div class="commentListCss" v-if="commentList.length">
  363. <div
  364. style="padding-bottom: 25px;display: flex;justify-content: space-between;"
  365. v-for="i in commentList"
  366. :key="i.id"
  367. >
  368. <div class="schPer2" style="border: none;width: 90%;padding: 0;">
  369. <img v-if="i.headportrait" :src="i.headportrait" alt="" />
  370. <img
  371. v-else
  372. src="https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/static/img/portal.b3cf7fa.png"
  373. alt=""
  374. />
  375. <div class="con">
  376. <div class="tit2">
  377. <div class="TitName">{{ i.username }}</div>
  378. <span
  379. style="font-size: 14px;color: rgba(0, 0, 0, 0.9);font-weight: 400;width: 200px;"
  380. >{{ i.time }}</span
  381. >
  382. </div>
  383. <div class="Timer">{{ i.comment }}</div>
  384. </div>
  385. </div>
  386. <div>
  387. <span
  388. style="color: #3B7BD7;cursor: pointer;"
  389. @click="deleteComment(i.id)"
  390. >删除</span
  391. >
  392. </div>
  393. </div>
  394. </div>
  395. </div>
  396. </div>
  397. </div>
  398. </div>
  399. </template>
  400. <script>
  401. import { v4 as uuidv4 } from "uuid";
  402. import MarkdownIt from "markdown-it";
  403. const getFile = url => {
  404. return new Promise((resolve, reject) => {
  405. var credentials = {
  406. accessKeyId: "AKIATLPEDU37QV5CHLMH",
  407. secretAccessKey: "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"
  408. }; //秘钥形式的登录上传
  409. window.AWS.config.update(credentials);
  410. window.AWS.config.region = "cn-northwest-1"; //设置区域
  411. let url2 = url;
  412. let _url2 = "";
  413. if (
  414. url2.indexOf("https://view.officeapps.live.com/op/view.aspx?src=") != -1
  415. ) {
  416. _url2 = url2.split(
  417. "https://view.officeapps.live.com/op/view.aspx?src="
  418. )[1];
  419. } else {
  420. _url2 = url2;
  421. }
  422. var s3 = new window.AWS.S3({ params: { Bucket: "ccrb" } });
  423. let name = decodeURIComponent(
  424. _url2.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1]
  425. );
  426. var params = {
  427. Bucket: "ccrb",
  428. Key: name
  429. };
  430. s3.getObject(params, function(err, data) {
  431. if (err) {
  432. console.log(err, err.stack);
  433. resolve({ data: 1 });
  434. } else {
  435. const fileContent = data.Body.toString("utf-8");
  436. resolve({ data: fileContent });
  437. } // sxuccessful response
  438. });
  439. // axios({
  440. });
  441. };
  442. export default {
  443. props: [
  444. "uid",
  445. "stage",
  446. "toolIndex",
  447. "task",
  448. "scoTit",
  449. "markScoreVisible",
  450. "markScoreworksStudent",
  451. "languageSetting",
  452. "taskDetail",
  453. "tool"
  454. ],
  455. data() {
  456. return {
  457. textarea: "",
  458. reveal: false, //得分详情框全部与折叠
  459. workListShow: true, //作业显示
  460. cutNum: 0, //作业与评论切换
  461. scoTitList: [], //得分详情框数据
  462. workList: [], //作业列表
  463. cid: this.$route.query.courseId,
  464. cUserid: this.$route.query.userid, //账号登录人id
  465. cuScoCon: "", //学生作业内容
  466. TxtMd: "", //txt,md作业内容
  467. currentUid: {}, //当前评分框学生信息
  468. current: "", //上一位下一位中的第几位
  469. DgUid: this.uid, //当前评分框学生id
  470. likeList: [], //喜欢list
  471. commentList: [], //评分list
  472. workId: "", //作业id。用于分类评论与点赞list
  473. vLoading: false,
  474. allSco: 0,
  475. ifPdf: 1,
  476. ScLoading: false,
  477. playerOptions: {
  478. playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
  479. autoplay: false, //如果true,浏览器准备好时开始回放。
  480. muted: false, // 默认情况下将会消除任何音频。
  481. loop: false, // 导致视频一结束就重新开始。
  482. preload: "auto", // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
  483. language: "zh-CN",
  484. aspectRatio: "16:9", // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
  485. fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
  486. sources: [
  487. {
  488. type: "video/mp4", //这里的种类支持很多种:基本视频格式、直播、流媒体等,具体可以参看git网址项目 || "video/ogg"|| "video/webm"
  489. src: "" //url地址require("../../../assets/media/aaa.mp4")
  490. }
  491. ],
  492. // poster: require("../../../assets/tu31.png"), //你的封面地址
  493. // poster: dataRes.imgUrl, //你的封面地址
  494. notSupportedMessage: "此视频暂无法播放,请稍后再试", //允许覆盖Video.js无法播放媒体源时显示的默认信息。
  495. controlBar: {
  496. timeDivider: true, //当前时间和持续时间的分隔符
  497. durationDisplay: true, //显示持续时间
  498. remainingTimeDisplay: false, //是否显示剩余时间功能
  499. fullscreenToggle: true //全屏按钮
  500. }
  501. },
  502. xianObj: ["DOCX", "MD", "TXT", "PDF", "JPG", "PNG"]
  503. };
  504. },
  505. watch: {
  506. markScoreVisible(newVal) {
  507. this.workListShow = true;
  508. this.reveal = false;
  509. this.cutNum = 0;
  510. this.textarea = "";
  511. if (this.tool.eList && this.tool.eList.length) {
  512. this.scoTitList = this.tool.eList;
  513. } else {
  514. this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
  515. }
  516. // this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
  517. this.selectSWorksData();
  518. }
  519. },
  520. computed: {
  521. totalScore() {
  522. let a = 0;
  523. this.scoTitList.forEach(e => {
  524. if (e.cog) {
  525. a += e.cog * 1;
  526. }
  527. });
  528. return (a / this.scoTitList.length).toFixed(1);
  529. },
  530. isMarkCom() {
  531. // console.log('this.currentUid',this.currentUid);
  532. if (
  533. this.currentUid.type == 1 ||
  534. this.currentUid.type == 4 ||
  535. this.currentUid.type == 12
  536. ) {
  537. let a = this.currentUid.content.slice(
  538. this.currentUid.content.lastIndexOf(".") + 1
  539. );
  540. if (this.xianObj.indexOf(a.toUpperCase()) != -1) {
  541. return 1;
  542. } else {
  543. return 0;
  544. }
  545. } else {
  546. return 0;
  547. }
  548. },
  549. // 如果评价标准都不是ai评分的话
  550. isMarkSco() {
  551. let c = 0;
  552. this.scoTitList.forEach(e => {
  553. if (e.isai == 2) {
  554. c++;
  555. }
  556. });
  557. // console.log(c , this.scoTitList.length);
  558. this.$forceUpdate();
  559. if (c == this.scoTitList.length) return c;
  560. return 0;
  561. }
  562. },
  563. mounted() {
  564. if (this.tool.eList && this.tool.eList.length) {
  565. this.scoTitList = this.tool.eList;
  566. } else {
  567. this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
  568. }
  569. // this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
  570. // console.log('toolIndex',this.toolIndex);
  571. this.selectSWorksData();
  572. },
  573. methods: {
  574. setZero(index){
  575. console.log(index);
  576. console.log('scoTitList',this.scoTitList);
  577. },
  578. async anewEva() {
  579. this.ScLoading = true;
  580. let _fileid = "";
  581. if (
  582. this.currentUid.type == 1 ||
  583. this.currentUid.type == 4 ||
  584. this.currentUid.type == 12
  585. ) {
  586. _fileid = await this.createFileid(this.currentUid.content);
  587. }
  588. let sco = ""; //分数
  589. this.scoTitList.forEach(e => {
  590. sco += `${e.detail}:${e.cog}星。`;
  591. });
  592. let con = this.cuScoCon;
  593. let std = ""; //维度
  594. let tit = [];
  595. let laws = ""; //细则
  596. if (this.tool.eList && this.tool.eList.length) {
  597. tit = JSON.parse(JSON.stringify(this.tool.eList));
  598. } else {
  599. tit = JSON.parse(JSON.stringify(this.scoTit));
  600. }
  601. if (this.tool.eList && this.tool.eList.length) {
  602. for (let i = 0; i < this.tool.eList.length; i++) {
  603. if (this.tool.eList[i].isai == 1) {
  604. laws += `${this.tool.eList[i].rule}。 \n`;
  605. }
  606. }
  607. for (let i = 0; i < this.tool.eList.length; i++) {
  608. if (this.tool.eList[i].isai == 1) {
  609. let a = this.tool.eList[i].detail;
  610. let result = "";
  611. if (isNaN(parseFloat(a)) && a) {
  612. result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  613. } else {
  614. result = a;
  615. }
  616. std += `${result}。 \n`;
  617. }
  618. }
  619. } else {
  620. for (let i = 0; i < tit.length; i++) {
  621. if (tit[i].isai == 1) {
  622. laws += ` ${tit[i].rule}。 \n`;
  623. }
  624. }
  625. for (let i = 0; i < tit.length; i++) {
  626. if (tit[i].isai == 1) {
  627. let a = tit[i].detail;
  628. let result = "";
  629. if (isNaN(parseFloat(a)) && a) {
  630. result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  631. } else {
  632. result = a;
  633. }
  634. std += `${result}。 \n`;
  635. }
  636. }
  637. }
  638. let messages = `
  639. #NOTICE#
  640. Role: 你是一个资深的教师,你有丰富的项目式学习、跨学科学习、STEAM导师经验,你要对学生的评价高度负责。
  641. Language: ${this.getLang()}
  642. ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced the "Format example".
  643. Instruction: Based on the context, follow "Format example", write content.
  644. #目标#
  645. 你要结合<作业内容><评价标准>和该标准对应的<等级>写评语。
  646. 当作业内容与评价细则无关,或者缺乏原创性会被直接评为0星。此时你可以输出评语“期待看到你自己的想法!必要时,可以请教老师哦~”
  647. ${this.currentUid.type == 1 ? "提取图片内容进行评价" : ""}
  648. #评分资料#
  649. 评价标准:${std}
  650. 评价细则:${laws}
  651. 等级:${sco}
  652. 作业内容:${_fileid ? "上传的文件内容" : con}
  653. #输出要求#
  654. “评语”字数控制在150字左右,参考输出范例。
  655. 严格输出按照格式输出json格式。只输出json格式的内容,其他内容不要输出!
  656. #输出格式#
  657. [{'comment':'评语(150个汉字左右)'}]
  658. #输出范例#
  659. [{'comment':'学生能够全面且正确地描述光合作用中氧气和葡萄糖的生成过程,涵盖光反应和暗反应的每个阶段和主要反应物及产物。同时,学生也能够全面、准确地解释氧气和葡萄糖在植物生命活动中的重要作用,并展示了对光合作用的深入理解。论文结构良好,内容详实,逻辑清晰,论据充分。'}]
  660. `;
  661. // console.log("messages", messages);
  662. let params = {
  663. assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
  664. message: [
  665. {
  666. type: "text",
  667. text: messages.replaceAll("\n", " ").replaceAll("*", "")
  668. }
  669. ],
  670. session_name: uuidv4(),
  671. userId: this.cUserid,
  672. file_ids: _fileid ? [_fileid] : [],
  673. isImage: this.currentUid.type == 1 ? true : "",
  674. model: "gpt-4o-mini"
  675. };
  676. this.ajax
  677. .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
  678. .then(response => {
  679. let data = response.data.FunctionResponse;
  680. console.log("data", data);
  681. if (data.message) {
  682. let dArray = {};
  683. try {
  684. dArray = JSON.parse(
  685. data.message.replaceAll("```json", "").replaceAll("```", "")
  686. );
  687. } catch (error) {
  688. console.log("error_________________" + error);
  689. try {
  690. let regex = new RegExp("(?<=```json)([\\s\\S]*?)(?=```)");
  691. let match = data.message.match(regex);
  692. dArray = JSON.parse(
  693. match[0]
  694. .replace(/\n/g, "")
  695. .replace(/\s{2,}/g, "")
  696. .replace(/\'/g, '"')
  697. );
  698. } catch (error) {
  699. try {
  700. dArray = JSON.parse(
  701. data.message
  702. .replaceAll("```json", "")
  703. .replaceAll("# Solution", "")
  704. .replaceAll("```", "")
  705. .replace(/\n/g, "")
  706. .replace(/\s{2,}/g, "")
  707. .replace(/\'/g, '"')
  708. );
  709. } catch (error) {
  710. console.log("error_________________" + error);
  711. this.anewEva();
  712. return;
  713. }
  714. console.log("error_________________" + error);
  715. }
  716. }
  717. console.log("dArray", dArray);
  718. this.textarea = dArray[0].comment;
  719. }
  720. this.submit()
  721. this.$message.success("重新生成完成");
  722. this.ScLoading = false;
  723. })
  724. .catch(error => {
  725. this.ScLoading = false;
  726. this.$message.error("重新生成失败");
  727. console.log(error);
  728. });
  729. },
  730. noIsAi() {
  731. this.$message.info("您暂未设置AI评分,请修改该工具的评价设置后使用。");
  732. },
  733. // 预览图片
  734. previewImg(url) {
  735. //预览图片
  736. this.$hevueImgPreview(url);
  737. },
  738. onPlayerPlay() {},
  739. // 获取文档id
  740. createFileid(url) {
  741. let _this = this;
  742. return new Promise((resolve, reject) => {
  743. try {
  744. _this.ajax
  745. .put("https://gpt4.cocorobo.cn/upload_file_knowledge", {
  746. url: url
  747. })
  748. .then(res => {
  749. let _data = res.data.FunctionResponse;
  750. if (_data.result && _data.result.id) {
  751. resolve(_data.result.id);
  752. } else {
  753. resolve(1);
  754. }
  755. })
  756. .catch(function(error) {
  757. resolve(1);
  758. });
  759. } catch (e) {
  760. resolve(1);
  761. }
  762. });
  763. },
  764. // 老师提交评分
  765. submit() {
  766. let data = this.scoTitList.map(e => {
  767. return e.detail + ":" + e.cog;
  768. });
  769. const processedData = {};
  770. data.forEach(item => {
  771. const [key, value] = item.split(":");
  772. processedData[key] = Number(value) ? Number(value) : 0;
  773. });
  774. processedData.content = this.textarea;
  775. // console.log(processedData);
  776. let params = {
  777. cid: this.cid,
  778. s: this.stage,
  779. t: this.task,
  780. tool: this.toolIndex ? this.toolIndex : "",
  781. rate: JSON.stringify(processedData),
  782. uid: this.DgUid
  783. };
  784. // return console.log(params);
  785. this.ajax
  786. .get(this.$store.state.api + "updateWorksEvaTwo", params)
  787. .then(res => {
  788. this.ScLoading = false;
  789. })
  790. .catch(err => {
  791. this.$message.error("评价失败");
  792. console.error(err);
  793. });
  794. },
  795. // 重置
  796. reset() {
  797. this.$confirm("是否清空评分和评语?", "提示", {
  798. confirmButtonText: "确定",
  799. cancelButtonText: "取消",
  800. type: "warning"
  801. })
  802. .then(() => {
  803. let params = [
  804. {
  805. id: this.currentUid.id
  806. }
  807. ];
  808. this.ajax
  809. .post(this.$store.state.api + "deleteCourseWorkTwo2", params)
  810. .then(res => {
  811. this.scoTitList.forEach(e => {
  812. e.cog = 0;
  813. });
  814. this.textarea = "";
  815. this.$message({
  816. message: "清空成功",
  817. type: "success"
  818. });
  819. })
  820. .catch(err => {
  821. console.error(err);
  822. });
  823. })
  824. .catch(() => {});
  825. // this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
  826. },
  827. // ai评分
  828. async AIsubmit(work) {
  829. console.log("work", work);
  830. this.ScLoading = true;
  831. let _fileid = "";
  832. if (work.type == 1 || work.type == 4 || work.type == 12) {
  833. _fileid = await this.createFileid(work.content);
  834. }
  835. let tit = [];
  836. if (this.tool.eList && this.tool.eList.length) {
  837. tit = JSON.parse(JSON.stringify(this.tool.eList));
  838. } else {
  839. tit = JSON.parse(JSON.stringify(this.scoTit));
  840. let titRule = 0;
  841. let titRule2 = 0;
  842. tit.forEach((e, index) => {
  843. if (!e.isai) {
  844. e.isai = 1;
  845. }
  846. });
  847. tit.forEach((e, index) => {
  848. if (e.isai == 1) {
  849. titRule2++;
  850. if (e.rule) {
  851. titRule++;
  852. }
  853. }
  854. });
  855. if (titRule != titRule2) {
  856. this.ScLoading = false;
  857. this.$message.info("细则努力生成中,请稍候……");
  858. return;
  859. }
  860. }
  861. console.log("tit", JSON.parse(JSON.stringify(tit)));
  862. let con = this.cuScoCon;
  863. let laws = "";
  864. let std = "";
  865. let text = "";
  866. if (this.tool.eList && this.tool.eList.length) {
  867. for (let i = 0; i < this.tool.eList.length; i++) {
  868. if (this.tool.eList[i].isai == 1) {
  869. laws += `细则${i}:${this.tool.eList[i].rule}, \n`;
  870. }
  871. }
  872. for (let i = 0; i < this.tool.eList.length; i++) {
  873. if (this.tool.eList[i].isai == 1) {
  874. let a = this.tool.eList[i].detail;
  875. let result = "";
  876. if (isNaN(parseFloat(a)) && a) {
  877. result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  878. } else {
  879. result = a;
  880. }
  881. std += `纬度${i}:“${result}”, \n`;
  882. }
  883. }
  884. for (let i = 0; i < this.tool.eList.length; i++) {
  885. if (this.tool.eList[i].isai == 1) {
  886. let a = this.tool.eList[i].detail;
  887. let result = "";
  888. if (isNaN(parseFloat(a)) && a) {
  889. result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  890. } else {
  891. result = a;
  892. }
  893. text += `{'${result}' : '评价等级0-5(数字)'},`;
  894. }
  895. }
  896. } else {
  897. for (let i = 0; i < tit.length; i++) {
  898. if (tit[i].isai == 1) {
  899. let a = tit[i].detail;
  900. let result = "";
  901. if (isNaN(parseFloat(a)) && a) {
  902. result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  903. } else {
  904. result = a;
  905. }
  906. laws += ` 细则${i}:${tit[i].rule}, \n`;
  907. }
  908. }
  909. for (let i = 0; i < tit.length; i++) {
  910. if (tit[i].isai == 1) {
  911. let a = tit[i].detail;
  912. let result = "";
  913. if (isNaN(parseFloat(a)) && a) {
  914. result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  915. } else {
  916. result = a;
  917. }
  918. std += `纬度${i}:“${result}”, \n`;
  919. }
  920. }
  921. for (let i = 0; i < tit.length; i++) {
  922. if (tit[i].isai == 1) {
  923. let a = tit[i].detail;
  924. let result = "";
  925. if (isNaN(parseFloat(a)) && a) {
  926. result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  927. } else {
  928. result = a;
  929. }
  930. text += `{'${result}' : '评价等级0-5(数字)'},`;
  931. }
  932. }
  933. }
  934. let msg = `NOTICE
  935. Role: 你是一个资深的教师,你有丰富的项目式学习、跨学科学习、STEAM导师经验,你要对学生的评价高度负责。
  936. Language: ${this.getLang()}
  937. ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced the "Format example".
  938. Instruction: Based on the context, follow "Format example", write content.
  939. #目标#
  940. 你要根据“六级评价细则”点评学生作品,并生成需要的JSON数据。
  941. 你要根据<评价细则>和<作业内容>的相关性评价作业,判断该作业属于六级中的哪个等级。
  942. 你要结合<评价标准><评价细则>和<你判断的等级>写评语。
  943. 如果作业内容与评价细则无关,则直接评为0星。如果作业内容与<任务描述>或<工具描述>一致或者相似,则直接评为0星,并输出评语“期待看到你自己的想法!必要时,可以请教老师哦~”
  944. ${work.type == 1 ? "提取图片内容进行评价" : ""}
  945. #评分资料#
  946. 评价标准:${std}
  947. 评价细则:${laws}
  948. 作业内容:${_fileid ? "上传的文件内容" : con}
  949. 任务描述:${this.taskDetail ? this.taskDetail : ""}
  950. 工具描述:${this.tool.toolDetail ? this.tool.toolDetail : ""}
  951. #输出要求#
  952. 输出每个评价标准角度的“等级”和作业的综合性“评语”。
  953. “评语”控制在150字左右。
  954. 评价标准要按原样输出,严格按照输出格式输出json格式。只输出json格式的内容,其他内容不要输出!
  955. #输出格式#
  956. [${text}{'comment':'评语(150个汉字左右)'${
  957. work.type == 1 ? "{'pic':'提取图片内容'}" : ""
  958. }}]
  959. `;
  960. // console.log(msg);
  961. this.aiGet2(msg, _fileid, work);
  962. },
  963. // ai打分
  964. aiGet2(messages, _fileid, work) {
  965. let _this = this;
  966. let params = {
  967. assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
  968. message: [
  969. {
  970. type: "text",
  971. text: messages.replaceAll("\n", " ").replaceAll("*", "")
  972. }
  973. ],
  974. session_name: uuidv4(),
  975. userId: this.cUserid,
  976. file_ids: _fileid ? [_fileid] : [],
  977. isImage: work.type == 1 ? true : "",
  978. model: "gpt-4o-mini"
  979. };
  980. this.ajax
  981. .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
  982. .then(response => {
  983. let data = response.data.FunctionResponse;
  984. console.log("data", data);
  985. if (data.message) {
  986. let dArray = {};
  987. try {
  988. dArray = JSON.parse(
  989. data.message.replaceAll("```json", "").replaceAll("```", "")
  990. );
  991. } catch (error) {
  992. console.log("error_________________" + error);
  993. try {
  994. let regex = new RegExp("(?<=```json)([\\s\\S]*?)(?=```)");
  995. let match = data.message.match(regex);
  996. dArray = JSON.parse(
  997. match[0]
  998. .replace(/\n/g, "")
  999. .replace(/\s{2,}/g, "")
  1000. .replace(/\'/g, '"')
  1001. );
  1002. } catch (error) {
  1003. try {
  1004. dArray = JSON.parse(
  1005. data.message
  1006. .replaceAll("```json", "")
  1007. .replaceAll("# Solution", "")
  1008. .replaceAll("```", "")
  1009. .replace(/\n/g, "")
  1010. .replace(/\s{2,}/g, "")
  1011. .replace(/\'/g, '"')
  1012. );
  1013. } catch (error) {
  1014. console.log("error_________________" + error);
  1015. this.aiGet2(messages, _fileid, work);
  1016. return;
  1017. }
  1018. console.log("error_________________" + error);
  1019. }
  1020. }
  1021. let processedData = {};
  1022. console.log(JSON.parse(JSON.stringify(dArray)));
  1023. dArray.forEach(function(item) {
  1024. let key = Object.keys(item)[0];
  1025. let value = item[key];
  1026. processedData[key] = value;
  1027. });
  1028. // 判断返回数据正确数量
  1029. let IsAIsuccess = 0;
  1030. for (const tKey in this.scoTitList) {
  1031. for (const key in processedData) {
  1032. if (
  1033. isNaN(parseFloat(this.scoTitList[tKey].detail)) &&
  1034. this.scoTitList[tKey].detail
  1035. ) {
  1036. var result = this.scoTitList[tKey].detail
  1037. .match(/[\u4e00-\u9fa5a-zA-Z]+/g)
  1038. .join("");
  1039. } else {
  1040. var result = this.scoTitList[tKey].detail;
  1041. }
  1042. if (isNaN(parseFloat(key)) && key) {
  1043. var key2 = key.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1044. } else {
  1045. var key2 = key;
  1046. }
  1047. if (key != "comment") {
  1048. let isNumK = /^\d+(\.\d+)?$/.test(processedData[key]);
  1049. if (result.indexOf(key2) != -1 && isNumK) {
  1050. IsAIsuccess++;
  1051. }
  1052. continue;
  1053. }
  1054. }
  1055. continue;
  1056. }
  1057. // 计算可以ai评分的评价标准数量
  1058. let scotNum = 0;
  1059. this.scoTitList.forEach(e => {
  1060. if (e.isai == 1 || !e.isai) {
  1061. scotNum++;
  1062. }
  1063. });
  1064. if (IsAIsuccess != scotNum) {
  1065. console.log("评价失败");
  1066. this.aiGet2(messages, _fileid, work);
  1067. return;
  1068. }
  1069. // for (const key in processedData) {
  1070. // if (key == "评语") {
  1071. // processedData.content = processedData[key];
  1072. // }
  1073. // }
  1074. // delete processedData["评语"];
  1075. let processedDataCopy = {};
  1076. for (const tKey in _this.scoTitList) {
  1077. for (const key in processedData) {
  1078. if (
  1079. isNaN(parseFloat(_this.scoTitList[tKey].detail)) &&
  1080. _this.scoTitList[tKey].detail
  1081. ) {
  1082. var result = _this.scoTitList[tKey].detail
  1083. .match(/[\u4e00-\u9fa5a-zA-Z]+/g)
  1084. .join("");
  1085. } else {
  1086. var result = _this.scoTitList[tKey].detail;
  1087. }
  1088. if (isNaN(parseFloat(key)) && key) {
  1089. var key2 = key.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1090. } else {
  1091. var key2 = key;
  1092. }
  1093. // let result = _this.scoTitList[tKey].detail.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1094. // let key2 = key.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1095. if (result.indexOf(key2) != -1) {
  1096. let aaa = _this.scoTitList[tKey].detail;
  1097. processedDataCopy[aaa] = processedData[key];
  1098. }
  1099. }
  1100. }
  1101. for (const key in processedData) {
  1102. if (key == "comment") {
  1103. processedDataCopy.content = processedData[key];
  1104. }
  1105. }
  1106. let params = {
  1107. cid: _this.cid,
  1108. s: _this.stage,
  1109. t: _this.task,
  1110. tool: _this.toolIndex ? _this.toolIndex : "",
  1111. rate: JSON.stringify(processedDataCopy),
  1112. uid: _this.DgUid
  1113. };
  1114. // console.log('params',params);
  1115. // return _this.ScLoading = false;
  1116. _this.ajax
  1117. .get(_this.$store.state.api + "updateWorksEvaTwo", params)
  1118. .then(res => {
  1119. _this.$message({
  1120. message: "评价成功",
  1121. type: "success"
  1122. });
  1123. _this.ScLoading = false;
  1124. _this.selectSWorksData();
  1125. })
  1126. .catch(err => {
  1127. this.aiGet2(messages, _fileid, work);
  1128. console.error(err);
  1129. });
  1130. }
  1131. this.$forceUpdate();
  1132. })
  1133. .catch(error => {
  1134. this.aiGet2(messages, _fileid, work);
  1135. console.log(error);
  1136. });
  1137. },
  1138. // 上一个
  1139. prevStu() {
  1140. if (this.ScLoading) return this.$message.info("请稍后,正在ai评价中");
  1141. if (this.current > 0) {
  1142. this.current--;
  1143. this.DgUid = this.workList[this.current].userid;
  1144. this.selectSWorksData();
  1145. } else {
  1146. this.$message.info("已经是第一位了");
  1147. }
  1148. },
  1149. // 下一个
  1150. nextStu() {
  1151. if (this.ScLoading) return this.$message.info("请稍后,正在ai评价中");
  1152. if (this.current < this.workList.length - 1) {
  1153. this.current++;
  1154. this.DgUid = this.workList[this.current].userid;
  1155. this.selectSWorksData2();
  1156. } else {
  1157. this.$message.info("已经是最后一位了");
  1158. }
  1159. },
  1160. // 提交列表点击切换
  1161. cutPer(val, index) {
  1162. if (this.ScLoading) return this.$message.info("请稍后,正在ai评价中");
  1163. this.current = index;
  1164. this.DgUid = val;
  1165. this.selectSWorksData2();
  1166. },
  1167. // 任务得分折叠
  1168. revealBtn() {
  1169. this.reveal = !this.reveal;
  1170. },
  1171. // 提交列表折叠
  1172. workListTitBtn() {
  1173. this.workListShow = !this.workListShow;
  1174. },
  1175. // 点赞与评论切换
  1176. cutPage(val) {
  1177. this.cutNum = val;
  1178. },
  1179. // 删除评论
  1180. deleteComment(wid) {
  1181. this.$confirm("确定删除此评论吗?", "提示", {
  1182. confirmButtonText: "确定",
  1183. cancelButtonText: "取消",
  1184. type: "warning"
  1185. })
  1186. .then(() => {
  1187. let params = {
  1188. id: wid
  1189. };
  1190. this.ajax
  1191. .get(this.$store.state.api + "deleteComment2", params)
  1192. .then(res => {
  1193. this.$message({
  1194. message: "删除评论成功",
  1195. type: "success"
  1196. });
  1197. this.selectSWorksData();
  1198. })
  1199. .catch(err => {
  1200. console.error(err);
  1201. });
  1202. })
  1203. .catch(() => {});
  1204. },
  1205. openCocoPi(tool, i, uid, uname) {
  1206. // return console.log('?????',tool, i, uid, uname);
  1207. let student = {
  1208. userid: uid,
  1209. student: uname
  1210. };
  1211. if (tool == 57) {
  1212. window.parent.postMessage(
  1213. {
  1214. tools: tool + "teacher",
  1215. cid: this.cid,
  1216. stage: this.stage,
  1217. task: this.task,
  1218. tool: this.toolIndex,
  1219. student: student
  1220. },
  1221. "*"
  1222. );
  1223. }
  1224. },
  1225. getLang() {
  1226. let lang = "";
  1227. if (this.languageSetting == 0) {
  1228. lang = "Chinese.";
  1229. } else if (this.languageSetting == 1) {
  1230. lang = "Traditional Chinese.";
  1231. } else if (this.languageSetting == 2) {
  1232. lang = "English.";
  1233. }
  1234. return lang;
  1235. },
  1236. //全部作业
  1237. selectSWorksData() {
  1238. this.vLoading = true;
  1239. this.textarea = "";
  1240. // console.log(this.scoTitList);
  1241. // console.log('toolIndex',this.toolIndex);
  1242. let params = {
  1243. uid: this.DgUid,
  1244. cid: this.cid,
  1245. s: this.stage,
  1246. t: this.task,
  1247. g: this.toolIndex
  1248. };
  1249. // return console.log(params);
  1250. this.ajax
  1251. .get(this.$store.state.api + "selectMarkDialogWorksTwo", params)
  1252. .then(res => {
  1253. let data = res.data[0];
  1254. // markSco为提交列表展示的分数
  1255. data.forEach(e => {
  1256. if (e.rate) {
  1257. let data2 = JSON.parse(e.rate);
  1258. e.markSco = 0;
  1259. let k = 0;
  1260. for (const key in data2) {
  1261. if ((data2[key] && key != "content") || data2[key] == "0") {
  1262. e.markSco += data2[key] * 1;
  1263. } else {
  1264. k += 1;
  1265. }
  1266. }
  1267. if (k > 1) {
  1268. e.markSco = null;
  1269. } else {
  1270. e.markSco = (e.markSco / this.scoTitList.length).toFixed(1);
  1271. }
  1272. } else {
  1273. e.markSco = null;
  1274. }
  1275. });
  1276. // 提交列表
  1277. this.workList = data;
  1278. data.forEach((e, index) => {
  1279. if (e.userid == this.DgUid) {
  1280. this.currentUid = e;
  1281. // console.log('e',e);
  1282. // 1截图 3问答 4word文档类型 5视频 10表格 13文档
  1283. if (
  1284. this.currentUid.type == 3 ||
  1285. this.currentUid.type == 10 ||
  1286. this.currentUid.type == 13
  1287. // this.currentUid.type == 15
  1288. ) {
  1289. this.currentUid.content = JSON.parse(e.content);
  1290. this.cuScoCon = this.currentUid.content.text;
  1291. }
  1292. if (this.currentUid.type == 4) {
  1293. let a = this.currentUid.content;
  1294. let data = a.slice(a.lastIndexOf(".") + 1);
  1295. this.cuScoCon = this.currentUid.content;
  1296. if (data == "pdf") {
  1297. this.ifPdf = 1;
  1298. } else {
  1299. this.ifPdf = 0;
  1300. }
  1301. }
  1302. if (this.currentUid.type == 5) {
  1303. this.playerOptions.sources[0].src = this.currentUid.content;
  1304. }
  1305. if (this.currentUid.type == 12) {
  1306. this.TxtMd = "";
  1307. getFile(this.currentUid.content).then(res => {
  1308. this.TxtMd = res.data;
  1309. });
  1310. }
  1311. this.current = index;
  1312. this.workId = e.id;
  1313. this.appraise(e);
  1314. }
  1315. });
  1316. let likeData = res.data[1];
  1317. this.likeList = [];
  1318. likeData.forEach(e => {
  1319. if (e.workId == this.workId) {
  1320. this.likeList.push(e);
  1321. }
  1322. });
  1323. let commentData = res.data[2];
  1324. this.commentList = [];
  1325. commentData.forEach(e => {
  1326. if (e.workId == this.workId) {
  1327. this.commentList.push(e);
  1328. }
  1329. });
  1330. this.vLoading = false;
  1331. });
  1332. },
  1333. selectSWorksData2() {
  1334. this.vLoading = true;
  1335. this.textarea = "";
  1336. let params = {
  1337. uid: this.DgUid,
  1338. cid: this.cid,
  1339. s: this.stage,
  1340. t: this.task,
  1341. g: this.toolIndex
  1342. };
  1343. // return console.log(params);
  1344. this.ajax
  1345. .get(this.$store.state.api + "selectMarkDialogWorksTwo", params)
  1346. .then(res => {
  1347. let data = res.data[0];
  1348. console.log("data", data);
  1349. // 计算markSco提交列表分数
  1350. data.forEach(e => {
  1351. if (e.rate) {
  1352. let data2 = JSON.parse(e.rate);
  1353. e.markSco = 0;
  1354. let k = 0;
  1355. for (const key in data2) {
  1356. if ((data2[key] && key != "content") || data2[key] == "0") {
  1357. e.markSco += data2[key] * 1;
  1358. } else {
  1359. k += 1;
  1360. }
  1361. }
  1362. if (k > 1) {
  1363. e.markSco = null;
  1364. } else {
  1365. e.markSco = (e.markSco / this.scoTitList.length).toFixed(1);
  1366. }
  1367. } else {
  1368. e.markSco = null;
  1369. }
  1370. });
  1371. // 提交列表
  1372. this.workList = data;
  1373. // 划分作业类型
  1374. data.forEach((e, index) => {
  1375. if (e.userid == this.DgUid) {
  1376. this.currentUid = e;
  1377. // 1截图 3问答 4word文档类型 5视频 10表格 13文档
  1378. if (
  1379. this.currentUid.type == 3 ||
  1380. this.currentUid.type == 10 ||
  1381. this.currentUid.type == 13
  1382. // this.currentUid.type == 15
  1383. ) {
  1384. this.currentUid.content = JSON.parse(e.content);
  1385. this.cuScoCon = this.currentUid.content.text;
  1386. }
  1387. if (this.currentUid.type == 4) {
  1388. let a = this.currentUid.content;
  1389. let data = a.slice(a.lastIndexOf(".") + 1);
  1390. if (data == "pdf") {
  1391. this.ifPdf = 1;
  1392. } else {
  1393. this.ifPdf = 0;
  1394. }
  1395. this.cuScoCon = this.currentUid.content;
  1396. }
  1397. if (this.currentUid.type == 5) {
  1398. this.playerOptions.sources[0].src = this.currentUid.content;
  1399. }
  1400. if (this.currentUid.type == 12) {
  1401. this.TxtMd = "";
  1402. getFile(this.currentUid.content).then(res => {
  1403. this.TxtMd = res.data;
  1404. });
  1405. }
  1406. this.workId = e.id;
  1407. this.appraise(e);
  1408. }
  1409. });
  1410. let likeData = res.data[1];
  1411. this.likeList = [];
  1412. likeData.forEach(e => {
  1413. if (e.workId == this.workId) {
  1414. this.likeList.push(e);
  1415. }
  1416. });
  1417. let commentData = res.data[2];
  1418. this.commentList = [];
  1419. commentData.forEach(e => {
  1420. if (e.workId == this.workId) {
  1421. this.commentList.push(e);
  1422. }
  1423. });
  1424. this.vLoading = false;
  1425. });
  1426. },
  1427. downloadFile(url) {
  1428. var credentials = {
  1429. accessKeyId: "AKIATLPEDU37QV5CHLMH",
  1430. secretAccessKey: "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"
  1431. }; //秘钥形式的登录上传
  1432. window.AWS.config.update(credentials);
  1433. window.AWS.config.region = "cn-northwest-1"; //设置区域
  1434. let url2 = url;
  1435. let _url2 = "";
  1436. if (
  1437. url2.indexOf("https://view.officeapps.live.com/op/view.aspx?src=") != -1
  1438. ) {
  1439. _url2 = url2.split(
  1440. "https://view.officeapps.live.com/op/view.aspx?src="
  1441. )[1];
  1442. } else {
  1443. _url2 = url2;
  1444. }
  1445. const loading2 = this.$loading.service({
  1446. background: "rgba(255, 255, 255, 0.7)",
  1447. target: document.body,
  1448. text: "文件加载中..."
  1449. });
  1450. var s3 = new window.AWS.S3({ params: { Bucket: "ccrb" } });
  1451. let name = decodeURIComponent(
  1452. _url2.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1]
  1453. );
  1454. var params = {
  1455. Bucket: "ccrb",
  1456. Key: name
  1457. };
  1458. s3.getObject(params, function(err, data) {
  1459. loading2.close();
  1460. if (err) console.log(err, err.stack);
  1461. // an error occurred
  1462. else {
  1463. let url = window.URL.createObjectURL(new Blob([data.Body]));
  1464. let a = document.createElement("a");
  1465. a.name = name;
  1466. a.href = url;
  1467. a.download = name;
  1468. a.click();
  1469. console.log(data);
  1470. } // sxuccessful response
  1471. });
  1472. },
  1473. // 处理任务的分展示
  1474. appraise(val) {
  1475. if (val.rate) {
  1476. let data = JSON.parse(val.rate);
  1477. this.scoTitList.forEach((e, index) => {
  1478. e.cog = null;
  1479. for (const key in data) {
  1480. if (isNaN(parseFloat(e.detail)) && e.detail) {
  1481. var result = e.detail.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1482. } else {
  1483. var result = e.detail;
  1484. }
  1485. if (isNaN(parseFloat(key)) && key) {
  1486. var key2 = key.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1487. } else {
  1488. var key2 = key;
  1489. }
  1490. // let result = e.detail.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1491. // let key2 = key.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1492. if (result.indexOf(key2) != -1) {
  1493. e.cog = data[key];
  1494. }
  1495. if ("content" == key) {
  1496. this.textarea = data[key];
  1497. }
  1498. }
  1499. });
  1500. } else {
  1501. this.scoTitList.forEach(e => {
  1502. e.cog = 0;
  1503. });
  1504. }
  1505. }
  1506. }
  1507. };
  1508. </script>
  1509. <style scoped>
  1510. .markDialog {
  1511. display: flex;
  1512. /* height: 100%; */
  1513. min-height: 600px;
  1514. height: 100%;
  1515. }
  1516. .left {
  1517. /* overflow: auto; */
  1518. width: 310px;
  1519. /* border-right: 1px rgba(231, 231, 231, 1) solid; */
  1520. padding: 20px 20px 0;
  1521. box-sizing: border-box;
  1522. padding-right: 10px;
  1523. display: flex;
  1524. flex-direction: column;
  1525. height: 100%;
  1526. }
  1527. .Rig {
  1528. flex: 1;
  1529. padding: 15px;
  1530. display: flex;
  1531. flex-direction: column;
  1532. }
  1533. .RigTop {
  1534. border-bottom: 1px rgba(231, 231, 231, 1) solid;
  1535. padding: 0px 0 15px;
  1536. }
  1537. .AreaCss {
  1538. position: relative;
  1539. margin-bottom: 5px;
  1540. }
  1541. .AreaCss >>> .el-textarea__inner {
  1542. min-height: 150px !important;
  1543. /* max-height: 150px; */
  1544. padding-bottom: 20px;
  1545. }
  1546. .AreaBtn {
  1547. position: absolute;
  1548. width: calc(100% - 30px);
  1549. text-align: right;
  1550. background-color: #fff;
  1551. bottom: 11px;
  1552. right: 20px;
  1553. color: rgba(54, 129, 252, 1);
  1554. cursor: pointer;
  1555. }
  1556. .likeList {
  1557. width: 100%;
  1558. display: flex;
  1559. padding: 10px 0;
  1560. flex-wrap: wrap;
  1561. }
  1562. .likeList > div {
  1563. padding: 4px 0px;
  1564. background-color: rgba(243, 247, 253, 1);
  1565. margin-right: 10px;
  1566. width: calc((100% - 60px) / 7);
  1567. text-align: center;
  1568. text-overflow: ellipsis;
  1569. white-space: nowrap;
  1570. overflow: hidden;
  1571. margin-bottom: 10px;
  1572. }
  1573. .likeList > div:nth-child(7n) {
  1574. margin-right: 0px;
  1575. }
  1576. .commentListCss {
  1577. background-color: #fafafa;
  1578. padding: 25px 15px 0;
  1579. box-sizing: border-box;
  1580. margin-top: 10px;
  1581. border-radius: 5px;
  1582. }
  1583. .RigConTit {
  1584. width: 100%;
  1585. display: flex;
  1586. margin: 10px 0;
  1587. }
  1588. .RigConTit > div {
  1589. font-size: 14px;
  1590. color: rgba(0, 0, 0, 0.6);
  1591. padding: 8px;
  1592. cursor: pointer;
  1593. }
  1594. .RigConTitOn {
  1595. border-bottom: 3px solid rgba(54, 129, 252, 1);
  1596. }
  1597. .RigCon {
  1598. width: 100%;
  1599. overflow: auto;
  1600. flex: 1;
  1601. padding: 10px 0;
  1602. box-sizing: border-box;
  1603. /* background-color: aqua; */
  1604. }
  1605. .selBlock {
  1606. background-color: #f3f7fd !important;
  1607. border: 1px #68a0fc solid !important;
  1608. }
  1609. .cutStuBtn {
  1610. display: flex;
  1611. color: rgba(54, 129, 252, 1);
  1612. }
  1613. .cutStuBtn > div {
  1614. margin-left: 10px;
  1615. }
  1616. .scoreTit {
  1617. font-size: 16px;
  1618. font-weight: 600;
  1619. display: flex;
  1620. justify-content: space-between;
  1621. box-sizing: border-box;
  1622. color: rgba(0, 0, 0, 0.9);
  1623. }
  1624. .allD {
  1625. margin: 10px 0;
  1626. min-height: 60px;
  1627. background-color: #f3f7fd;
  1628. }
  1629. .scoreStar2 {
  1630. padding: 0 10px 10px;
  1631. height: 100%;
  1632. flex: 1;
  1633. color: rgba(54, 129, 252, 1);
  1634. cursor: pointer;
  1635. }
  1636. .scoreStar {
  1637. padding: 0px 10px 10px;
  1638. height: 100%;
  1639. flex: 1;
  1640. }
  1641. .scoreStarBack {
  1642. flex: 1;
  1643. display: flex;
  1644. justify-content: space-between;
  1645. padding-top: 10px;
  1646. position: relative;
  1647. }
  1648. /* .scoreStar > div:first-child > .scoreStarBack {
  1649. margin-top: 0;
  1650. } */
  1651. .ScrBtn {
  1652. display: flex;
  1653. justify-content: center;
  1654. align-items: center;
  1655. cursor: pointer;
  1656. padding: 2px 8px;
  1657. border-radius: 5px;
  1658. color: #fff;
  1659. background-color: rgba(54, 129, 252, 1);
  1660. border: 1px rgba(54, 129, 252, 1) solid;
  1661. }
  1662. .worksAnswer {
  1663. color: #4078dd;
  1664. margin: 10px 0;
  1665. font-size: 16px;
  1666. display: flex;
  1667. align-items: center;
  1668. cursor: pointer;
  1669. }
  1670. .worksAnswer > img {
  1671. width: 100%;
  1672. height: 300px;
  1673. object-fit: contain;
  1674. margin: 0 auto;
  1675. display: block;
  1676. }
  1677. .briefTit {
  1678. width: 120px;
  1679. text-overflow: ellipsis;
  1680. overflow: hidden;
  1681. white-space: nowrap;
  1682. }
  1683. .briefTit > .titRoot {
  1684. position: absolute;
  1685. top: 0;
  1686. left: -27px;
  1687. transform: translate(0, 10px);
  1688. }
  1689. .workListTit {
  1690. color: rgba(0, 0, 0, 0.6);
  1691. font-size: 12px;
  1692. font-weight: 400;
  1693. margin: 10px 0;
  1694. cursor: pointer;
  1695. }
  1696. .schPer2 {
  1697. padding: 10px;
  1698. box-sizing: border-box;
  1699. display: flex;
  1700. border-radius: 5px;
  1701. border: 1px solid rgba(240, 242, 245, 1);
  1702. /* margin-bottom: 10px; */
  1703. }
  1704. .schPer2 > img {
  1705. width: 45px;
  1706. height: 45px;
  1707. border-radius: 50%;
  1708. object-fit: cover;
  1709. }
  1710. .schPer {
  1711. padding: 10px;
  1712. box-sizing: border-box;
  1713. display: flex;
  1714. border-radius: 5px;
  1715. border: 1px solid rgba(240, 242, 245, 1);
  1716. margin-bottom: 10px;
  1717. }
  1718. .schPer > img {
  1719. width: 40px;
  1720. height: 40px;
  1721. border-radius: 50%;
  1722. object-fit: cover;
  1723. }
  1724. .con {
  1725. flex: 1;
  1726. display: flex;
  1727. flex-direction: column;
  1728. justify-content: space-between;
  1729. padding: 0 10px;
  1730. box-sizing: border-box;
  1731. }
  1732. .con > .tit {
  1733. width: 100%;
  1734. display: flex;
  1735. justify-content: space-between;
  1736. }
  1737. .con > .tit2 {
  1738. width: 100%;
  1739. display: flex;
  1740. margin-bottom: 15px;
  1741. }
  1742. .TitName {
  1743. width: 70px;
  1744. overflow: hidden;
  1745. text-overflow: ellipsis;
  1746. white-space: nowrap;
  1747. margin-right: 10px;
  1748. }
  1749. .worksAnswer {
  1750. color: #4078dd;
  1751. margin: 10px 0;
  1752. font-size: 16px;
  1753. position: relative;
  1754. }
  1755. .worksAnswer > img {
  1756. width: 500px;
  1757. height: 300px;
  1758. object-fit: contain;
  1759. margin: 0 auto;
  1760. display: block;
  1761. }
  1762. .cont {
  1763. overflow-wrap: break-word;
  1764. word-break: break-word;
  1765. white-space: pre-line;
  1766. }
  1767. .cont >>> table {
  1768. border-top: 1px solid #ccc;
  1769. border-left: 1px solid #ccc;
  1770. }
  1771. .cont >>> table td,
  1772. .cont >>> table th {
  1773. border-bottom: 1px solid #ccc;
  1774. border-right: 1px solid #ccc;
  1775. padding: 5px 10px;
  1776. max-width: 0px;
  1777. height: 30px;
  1778. vertical-align: baseline;
  1779. box-sizing: border-box;
  1780. }
  1781. .video-player >>> .video-js {
  1782. height: 100%;
  1783. }
  1784. .markBox {
  1785. padding: 20px 14px;
  1786. line-height: 29px;
  1787. font-size: 16px;
  1788. background: #f4f4f4;
  1789. border-radius: 5px;
  1790. }
  1791. .anewC {
  1792. position: absolute;
  1793. width: 91%;
  1794. text-align: right;
  1795. background-color: #fff;
  1796. bottom: 3px;
  1797. right: 22px;
  1798. color: #12b0ff;
  1799. cursor: pointer;
  1800. font-size: 14px;
  1801. transform: translate(0px, 2px);
  1802. }
  1803. </style>