markDialog.vue 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912
  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: rgba(54, 129, 252, 1);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. async anewEva() {
  575. // if (!this.textarea) {
  576. // return this.$message.info("请先进行AI评分获取评语~");
  577. // }
  578. // return console.log('this.scoTitList',this.scoTitList);
  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 += `细则${i}:${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 += `纬度${i}:“${result}”, \n`;
  617. }
  618. }
  619. } else {
  620. for (let i = 0; i < tit.length; i++) {
  621. if (tit[i].isai == 1) {
  622. let a = tit[i].detail;
  623. let result = "";
  624. if (isNaN(parseFloat(a)) && a) {
  625. result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  626. } else {
  627. result = a;
  628. }
  629. laws += ` 细则${i}:${tit[i].rule}, \n`;
  630. }
  631. }
  632. for (let i = 0; i < tit.length; i++) {
  633. if (tit[i].isai == 1) {
  634. let a = tit[i].detail;
  635. let result = "";
  636. if (isNaN(parseFloat(a)) && a) {
  637. result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  638. } else {
  639. result = a;
  640. }
  641. std += `纬度${i}:“${result}”, \n`;
  642. }
  643. }
  644. }
  645. let messages = `
  646. #NOTICE#
  647. Role: 你是一个资深的教师,你有丰富的项目式学习、跨学科学习、STEAM导师经验,你要对学生的评价高度负责。
  648. Language: ${this.getLang()}
  649. ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced the "Format example".
  650. Instruction: Based on the context, follow "Format example", write content.
  651. #目标#
  652. 你要结合<作业内容><评价标准>和该标准对应的<等级>写评语。
  653. 当作业内容与<评价细则>无关,或者缺乏原创性会被直接评为0星。此时你可以输出评语“==期待看到你自己的想法!必要时,可以请教老师哦~==”
  654. #评分资料#
  655. 评价标准:${std}
  656. 等级:${sco}
  657. 作业内容:${_fileid ? "上传的文件内容" : con}
  658. #输出要求#
  659. “评语”字数控制在150字左右,参考输出范例。
  660. 只输出评价内容,不要输出其他无关内容!
  661. #输出格式#
  662. ==
  663. 学生能够全面且正确地描述光合作用中氧气和葡萄糖的生成过程,涵盖光反应和暗反应的每个阶段和主要反应物及产物。同时,学生也能够全面、准确地解释氧气和葡萄糖在植物生命活动中的重要作用,并展示了对光合作用的深入理解。论文结构良好,内容详实,逻辑清晰,论据充分。
  664. ==
  665. #输出范例#
  666. 学生能够全面且正确地描述光合作用中氧气和葡萄糖的生成过程,涵盖光反应和暗反应的每个阶段和主要反应物及产物。同时,学生也能够全面、准确地解释氧气和葡萄糖在植物生命活动中的重要作用,并展示了对光合作用的深入理解。论文结构良好,内容详实,逻辑清晰,论据充分。
  667. `;
  668. let params = {
  669. assistant_id: "f8e1ebb2-2e0d-11ef-8bf4-12e77c4cb76b",
  670. message: [
  671. {
  672. type: "text",
  673. text: messages.replaceAll("\n", " ").replaceAll("*", "")
  674. }
  675. ],
  676. session_name: uuidv4(),
  677. userId: this.cUserid,
  678. file_ids: _fileid ? [_fileid] : [],
  679. isImage: this.currentUid.type == 1 ? true : "",
  680. model: "gpt-4o-2024-08-06"
  681. };
  682. this.ajax
  683. .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
  684. .then(response => {
  685. let data = response.data.FunctionResponse;
  686. console.log("data", data);
  687. // 找到第一个等号的位置
  688. const startIndex = data.message.indexOf("==") + 2;
  689. // 找到最后一个等号的位置
  690. const endIndex = data.message.lastIndexOf("==");
  691. // 提取中间的文字
  692. const extractedText = data.message
  693. .substring(startIndex, endIndex)
  694. .trim();
  695. this.textarea = extractedText;
  696. this.submit()
  697. this.$message.success("重新生成完成");
  698. this.ScLoading = false;
  699. })
  700. .catch(error => {
  701. this.ScLoading = false;
  702. this.$message.error("重新生成失败");
  703. console.log(error);
  704. });
  705. },
  706. noIsAi() {
  707. this.$message.info("您暂未设置AI评分,请修改该工具的评价设置后使用。");
  708. },
  709. // 预览图片
  710. previewImg(url) {
  711. //预览图片
  712. this.$hevueImgPreview(url);
  713. },
  714. onPlayerPlay() {},
  715. // 获取文档id
  716. createFileid(url) {
  717. let _this = this;
  718. return new Promise((resolve, reject) => {
  719. try {
  720. _this.ajax
  721. .put("https://gpt4.cocorobo.cn/upload_file_knowledge", {
  722. url: url
  723. })
  724. .then(res => {
  725. let _data = res.data.FunctionResponse;
  726. if (_data.result && _data.result.id) {
  727. resolve(_data.result.id);
  728. } else {
  729. resolve(1);
  730. }
  731. })
  732. .catch(function(error) {
  733. resolve(1);
  734. });
  735. } catch (e) {
  736. resolve(1);
  737. }
  738. });
  739. },
  740. // 老师提交评分
  741. submit() {
  742. let data = this.scoTitList.map(e => {
  743. return e.detail + ":" + e.cog;
  744. });
  745. const processedData = {};
  746. data.forEach(item => {
  747. const [key, value] = item.split(":");
  748. processedData[key] = Number(value) ? Number(value) : 0;
  749. });
  750. processedData.content = this.textarea;
  751. // console.log(processedData);
  752. let params = {
  753. cid: this.cid,
  754. s: this.stage,
  755. t: this.task,
  756. tool: this.toolIndex ? this.toolIndex : "",
  757. rate: JSON.stringify(processedData),
  758. uid: this.DgUid
  759. };
  760. // return console.log(params);
  761. this.ajax
  762. .get(this.$store.state.api + "updateWorksEvaTwo", params)
  763. .then(res => {
  764. this.ScLoading = false;
  765. })
  766. .catch(err => {
  767. this.$message.error("评价失败");
  768. console.error(err);
  769. });
  770. },
  771. // 重置
  772. reset() {
  773. this.$confirm("是否清空评分和评语?", "提示", {
  774. confirmButtonText: "确定",
  775. cancelButtonText: "取消",
  776. type: "warning"
  777. })
  778. .then(() => {
  779. let params = [
  780. {
  781. id: this.currentUid.id
  782. }
  783. ];
  784. this.ajax
  785. .post(this.$store.state.api + "deleteCourseWorkTwo2", params)
  786. .then(res => {
  787. this.scoTitList.forEach(e => {
  788. e.cog = 0;
  789. });
  790. this.textarea = "";
  791. this.$message({
  792. message: "清空成功",
  793. type: "success"
  794. });
  795. })
  796. .catch(err => {
  797. console.error(err);
  798. });
  799. })
  800. .catch(() => {});
  801. // this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
  802. },
  803. // ai评分
  804. async AIsubmit(work) {
  805. console.log("work", work);
  806. this.ScLoading = true;
  807. let _fileid = "";
  808. if (work.type == 1 || work.type == 4 || work.type == 12) {
  809. _fileid = await this.createFileid(work.content);
  810. }
  811. let tit = [];
  812. if (this.tool.eList && this.tool.eList.length) {
  813. tit = JSON.parse(JSON.stringify(this.tool.eList));
  814. } else {
  815. tit = JSON.parse(JSON.stringify(this.scoTit));
  816. let titRule = 0;
  817. let titRule2 = 0;
  818. tit.forEach((e, index) => {
  819. if (!e.isai) {
  820. e.isai = 1;
  821. }
  822. });
  823. tit.forEach((e, index) => {
  824. if (e.isai == 1) {
  825. titRule2++;
  826. if (e.rule) {
  827. titRule++;
  828. }
  829. }
  830. });
  831. if (titRule != titRule2) {
  832. this.ScLoading = false;
  833. this.$message.info("细则努力生成中,请稍候……");
  834. return;
  835. }
  836. }
  837. console.log("tit", JSON.parse(JSON.stringify(tit)));
  838. let con = this.cuScoCon;
  839. let laws = "";
  840. let std = "";
  841. let text = "";
  842. if (this.tool.eList && this.tool.eList.length) {
  843. for (let i = 0; i < this.tool.eList.length; i++) {
  844. if (this.tool.eList[i].isai == 1) {
  845. laws += `细则${i}:${this.tool.eList[i].rule}, \n`;
  846. }
  847. }
  848. for (let i = 0; i < this.tool.eList.length; i++) {
  849. if (this.tool.eList[i].isai == 1) {
  850. let a = this.tool.eList[i].detail;
  851. let result = "";
  852. if (isNaN(parseFloat(a)) && a) {
  853. result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  854. } else {
  855. result = a;
  856. }
  857. std += `纬度${i}:“${result}”, \n`;
  858. }
  859. }
  860. for (let i = 0; i < this.tool.eList.length; i++) {
  861. if (this.tool.eList[i].isai == 1) {
  862. let a = this.tool.eList[i].detail;
  863. let result = "";
  864. if (isNaN(parseFloat(a)) && a) {
  865. result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  866. } else {
  867. result = a;
  868. }
  869. text += `{'${result}' : '评价等级0-5(数字)'},`;
  870. }
  871. }
  872. } else {
  873. for (let i = 0; i < tit.length; i++) {
  874. if (tit[i].isai == 1) {
  875. let a = tit[i].detail;
  876. let result = "";
  877. if (isNaN(parseFloat(a)) && a) {
  878. result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  879. } else {
  880. result = a;
  881. }
  882. laws += ` 细则${i}:${tit[i].rule}, \n`;
  883. }
  884. }
  885. for (let i = 0; i < tit.length; i++) {
  886. if (tit[i].isai == 1) {
  887. let a = tit[i].detail;
  888. let result = "";
  889. if (isNaN(parseFloat(a)) && a) {
  890. result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  891. } else {
  892. result = a;
  893. }
  894. std += `纬度${i}:“${result}”, \n`;
  895. }
  896. }
  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. text += `{'${result}' : '评价等级0-5(数字)'},`;
  907. }
  908. }
  909. }
  910. let msg = `NOTICE
  911. Role: 你是一个资深的教师,你有丰富的项目式学习、跨学科学习、STEAM导师经验,你要对学生的评价高度负责。
  912. Language: ${this.getLang()}
  913. ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced the "Format example".
  914. Instruction: Based on the context, follow "Format example", write content.
  915. #目标#
  916. 你要根据“六级评价细则”点评学生作品,并生成需要的JSON数据。
  917. 你要根据<评价细则>和<作业内容>的相关性评价作业,判断该作业属于六级中的哪个等级。
  918. 你要结合<评价标准><评价细则>和<你判断的等级>写评语。
  919. 如果作业内容与评价细则无关,则直接评为0星。如果作业内容与<任务描述>或<工具描述>一致或者相似,则直接评为0星,并输出评语“期待看到你自己的想法!必要时,可以请教老师哦~”
  920. ${work.type == 1 ? "提取图片内容进行评价" : ""}
  921. #评分资料#
  922. 评价标准:${std}
  923. 评价细则:${laws}
  924. 作业内容:${_fileid ? "上传的文件内容" : con}
  925. 任务描述:${this.taskDetail ? this.taskDetail : ""}
  926. 工具描述:${this.tool.toolDetail ? this.tool.toolDetail : ""}
  927. #输出要求#
  928. 输出每个评价标准角度的“等级”和作业的综合性“评语”。
  929. “评语”控制在150字左右。
  930. 评价标准要按原样输出,严格按照输出格式输出json格式。只输出json格式的内容,其他内容不要输出!
  931. #输出格式#
  932. [${text}{'comment':'评语(150个汉字左右)'${
  933. work.type == 1 ? "{'pic':'提取图片内容'}" : ""
  934. }}]
  935. `;
  936. // console.log(msg);
  937. this.aiGet2(msg, _fileid, work);
  938. },
  939. // ai打分
  940. aiGet2(messages, _fileid, work) {
  941. let _this = this;
  942. let params = {
  943. assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
  944. message: [
  945. {
  946. type: "text",
  947. text: messages.replaceAll("\n", " ").replaceAll("*", "")
  948. }
  949. ],
  950. session_name: uuidv4(),
  951. userId: this.cUserid,
  952. file_ids: _fileid ? [_fileid] : [],
  953. isImage: work.type == 1 ? true : "",
  954. model: "gpt-4o-2024-08-06"
  955. };
  956. this.ajax
  957. .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
  958. .then(response => {
  959. let data = response.data.FunctionResponse;
  960. console.log("data", data);
  961. if (data.message) {
  962. let dArray = {};
  963. try {
  964. dArray = JSON.parse(
  965. data.message.replaceAll("```json", "").replaceAll("```", "")
  966. );
  967. } catch (error) {
  968. console.log("error_________________" + error);
  969. try {
  970. let regex = new RegExp("(?<=```json)([\\s\\S]*?)(?=```)");
  971. let match = data.message.match(regex);
  972. dArray = JSON.parse(
  973. match[0]
  974. .replace(/\n/g, "")
  975. .replace(/\s{2,}/g, "")
  976. .replace(/\'/g, '"')
  977. );
  978. } catch (error) {
  979. try {
  980. dArray = JSON.parse(
  981. data.message
  982. .replaceAll("```json", "")
  983. .replaceAll("# Solution", "")
  984. .replaceAll("```", "")
  985. .replace(/\n/g, "")
  986. .replace(/\s{2,}/g, "")
  987. .replace(/\'/g, '"')
  988. );
  989. } catch (error) {
  990. console.log("error_________________" + error);
  991. this.aiGet2(messages, _fileid, work);
  992. return;
  993. }
  994. console.log("error_________________" + error);
  995. }
  996. }
  997. let processedData = {};
  998. console.log(JSON.parse(JSON.stringify(dArray)));
  999. dArray.forEach(function(item) {
  1000. let key = Object.keys(item)[0];
  1001. let value = item[key];
  1002. processedData[key] = value;
  1003. });
  1004. // 判断返回数据正确数量
  1005. let IsAIsuccess = 0;
  1006. for (const tKey in this.scoTitList) {
  1007. for (const key in processedData) {
  1008. if (
  1009. isNaN(parseFloat(this.scoTitList[tKey].detail)) &&
  1010. this.scoTitList[tKey].detail
  1011. ) {
  1012. var result = this.scoTitList[tKey].detail
  1013. .match(/[\u4e00-\u9fa5a-zA-Z]+/g)
  1014. .join("");
  1015. } else {
  1016. var result = this.scoTitList[tKey].detail;
  1017. }
  1018. if (isNaN(parseFloat(key)) && key) {
  1019. var key2 = key.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1020. } else {
  1021. var key2 = key;
  1022. }
  1023. if (key != "comment") {
  1024. let isNumK = /^\d+(\.\d+)?$/.test(processedData[key]);
  1025. if (result.indexOf(key2) != -1 && isNumK) {
  1026. IsAIsuccess++;
  1027. }
  1028. continue;
  1029. }
  1030. }
  1031. continue;
  1032. }
  1033. // 计算可以ai评分的评价标准数量
  1034. let scotNum = 0;
  1035. this.scoTitList.forEach(e => {
  1036. if (e.isai == 1 || !e.isai) {
  1037. scotNum++;
  1038. }
  1039. });
  1040. if (IsAIsuccess != scotNum) {
  1041. console.log("评价失败");
  1042. this.aiGet2(messages, _fileid, work);
  1043. return;
  1044. }
  1045. // for (const key in processedData) {
  1046. // if (key == "评语") {
  1047. // processedData.content = processedData[key];
  1048. // }
  1049. // }
  1050. // delete processedData["评语"];
  1051. let processedDataCopy = {};
  1052. for (const tKey in _this.scoTitList) {
  1053. for (const key in processedData) {
  1054. if (
  1055. isNaN(parseFloat(_this.scoTitList[tKey].detail)) &&
  1056. _this.scoTitList[tKey].detail
  1057. ) {
  1058. var result = _this.scoTitList[tKey].detail
  1059. .match(/[\u4e00-\u9fa5a-zA-Z]+/g)
  1060. .join("");
  1061. } else {
  1062. var result = _this.scoTitList[tKey].detail;
  1063. }
  1064. if (isNaN(parseFloat(key)) && key) {
  1065. var key2 = key.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1066. } else {
  1067. var key2 = key;
  1068. }
  1069. // let result = _this.scoTitList[tKey].detail.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1070. // let key2 = key.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1071. if (result.indexOf(key2) != -1) {
  1072. let aaa = _this.scoTitList[tKey].detail;
  1073. processedDataCopy[aaa] = processedData[key];
  1074. }
  1075. }
  1076. }
  1077. for (const key in processedData) {
  1078. if (key == "comment") {
  1079. processedDataCopy.content = processedData[key];
  1080. }
  1081. }
  1082. let params = {
  1083. cid: _this.cid,
  1084. s: _this.stage,
  1085. t: _this.task,
  1086. tool: _this.toolIndex ? _this.toolIndex : "",
  1087. rate: JSON.stringify(processedDataCopy),
  1088. uid: _this.DgUid
  1089. };
  1090. // console.log('params',params);
  1091. // return _this.ScLoading = false;
  1092. _this.ajax
  1093. .get(_this.$store.state.api + "updateWorksEvaTwo", params)
  1094. .then(res => {
  1095. _this.$message({
  1096. message: "评价成功",
  1097. type: "success"
  1098. });
  1099. _this.ScLoading = false;
  1100. _this.selectSWorksData();
  1101. })
  1102. .catch(err => {
  1103. this.aiGet2(messages, _fileid, work);
  1104. console.error(err);
  1105. });
  1106. }
  1107. this.$forceUpdate();
  1108. })
  1109. .catch(error => {
  1110. this.aiGet2(messages, _fileid, work);
  1111. console.log(error);
  1112. });
  1113. },
  1114. // 上一个
  1115. prevStu() {
  1116. if (this.ScLoading) return this.$message.info("请稍后,正在ai评价中");
  1117. if (this.current > 0) {
  1118. this.current--;
  1119. this.DgUid = this.workList[this.current].userid;
  1120. this.selectSWorksData();
  1121. } else {
  1122. this.$message.info("已经是第一位了");
  1123. }
  1124. },
  1125. // 下一个
  1126. nextStu() {
  1127. if (this.ScLoading) return this.$message.info("请稍后,正在ai评价中");
  1128. if (this.current < this.workList.length - 1) {
  1129. this.current++;
  1130. this.DgUid = this.workList[this.current].userid;
  1131. this.selectSWorksData2();
  1132. } else {
  1133. this.$message.info("已经是最后一位了");
  1134. }
  1135. },
  1136. // 提交列表点击切换
  1137. cutPer(val, index) {
  1138. if (this.ScLoading) return this.$message.info("请稍后,正在ai评价中");
  1139. this.current = index;
  1140. this.DgUid = val;
  1141. this.selectSWorksData2();
  1142. },
  1143. // 任务得分折叠
  1144. revealBtn() {
  1145. this.reveal = !this.reveal;
  1146. },
  1147. // 提交列表折叠
  1148. workListTitBtn() {
  1149. this.workListShow = !this.workListShow;
  1150. },
  1151. // 点赞与评论切换
  1152. cutPage(val) {
  1153. this.cutNum = val;
  1154. },
  1155. // 删除评论
  1156. deleteComment(wid) {
  1157. this.$confirm("确定删除此评论吗?", "提示", {
  1158. confirmButtonText: "确定",
  1159. cancelButtonText: "取消",
  1160. type: "warning"
  1161. })
  1162. .then(() => {
  1163. let params = {
  1164. id: wid
  1165. };
  1166. this.ajax
  1167. .get(this.$store.state.api + "deleteComment2", params)
  1168. .then(res => {
  1169. this.$message({
  1170. message: "删除评论成功",
  1171. type: "success"
  1172. });
  1173. this.selectSWorksData();
  1174. })
  1175. .catch(err => {
  1176. console.error(err);
  1177. });
  1178. })
  1179. .catch(() => {});
  1180. },
  1181. openCocoPi(tool, i, uid, uname) {
  1182. // return console.log('?????',tool, i, uid, uname);
  1183. let student = {
  1184. userid: uid,
  1185. student: uname
  1186. };
  1187. if (tool == 57) {
  1188. window.parent.postMessage(
  1189. {
  1190. tools: tool + "teacher",
  1191. cid: this.cid,
  1192. stage: this.stage,
  1193. task: this.task,
  1194. tool: this.toolIndex,
  1195. student: student
  1196. },
  1197. "*"
  1198. );
  1199. }
  1200. },
  1201. getLang() {
  1202. let lang = "";
  1203. if (this.languageSetting == 0) {
  1204. lang = "Chinese.";
  1205. } else if (this.languageSetting == 1) {
  1206. lang = "Traditional Chinese.";
  1207. } else if (this.languageSetting == 2) {
  1208. lang = "English.";
  1209. }
  1210. return lang;
  1211. },
  1212. //全部作业
  1213. selectSWorksData() {
  1214. this.vLoading = true;
  1215. this.textarea = "";
  1216. // console.log(this.scoTitList);
  1217. // console.log('toolIndex',this.toolIndex);
  1218. let params = {
  1219. uid: this.DgUid,
  1220. cid: this.cid,
  1221. s: this.stage,
  1222. t: this.task,
  1223. g: this.toolIndex
  1224. };
  1225. // return console.log(params);
  1226. this.ajax
  1227. .get(this.$store.state.api + "selectMarkDialogWorksTwo", params)
  1228. .then(res => {
  1229. let data = res.data[0];
  1230. // markSco为提交列表展示的分数
  1231. data.forEach(e => {
  1232. if (e.rate) {
  1233. let data2 = JSON.parse(e.rate);
  1234. e.markSco = 0;
  1235. let k = 0;
  1236. for (const key in data2) {
  1237. if ((data2[key] && key != "content") || data2[key] == "0") {
  1238. e.markSco += data2[key] * 1;
  1239. } else {
  1240. k += 1;
  1241. }
  1242. }
  1243. if (k > 1) {
  1244. e.markSco = null;
  1245. } else {
  1246. e.markSco = (e.markSco / this.scoTitList.length).toFixed(1);
  1247. }
  1248. } else {
  1249. e.markSco = null;
  1250. }
  1251. });
  1252. // 提交列表
  1253. this.workList = data;
  1254. data.forEach((e, index) => {
  1255. if (e.userid == this.DgUid) {
  1256. this.currentUid = e;
  1257. // console.log('e',e);
  1258. // 1截图 3问答 4word文档类型 5视频 10表格 13文档
  1259. if (
  1260. this.currentUid.type == 3 ||
  1261. this.currentUid.type == 10 ||
  1262. this.currentUid.type == 13
  1263. // this.currentUid.type == 15
  1264. ) {
  1265. this.currentUid.content = JSON.parse(e.content);
  1266. this.cuScoCon = this.currentUid.content.text;
  1267. }
  1268. if (this.currentUid.type == 4) {
  1269. let a = this.currentUid.content;
  1270. let data = a.slice(a.lastIndexOf(".") + 1);
  1271. this.cuScoCon = this.currentUid.content;
  1272. if (data == "pdf") {
  1273. this.ifPdf = 1;
  1274. } else {
  1275. this.ifPdf = 0;
  1276. }
  1277. }
  1278. if (this.currentUid.type == 5) {
  1279. this.playerOptions.sources[0].src = this.currentUid.content;
  1280. }
  1281. if (this.currentUid.type == 12) {
  1282. this.TxtMd = "";
  1283. getFile(this.currentUid.content).then(res => {
  1284. this.TxtMd = res.data;
  1285. });
  1286. }
  1287. this.current = index;
  1288. this.workId = e.id;
  1289. this.appraise(e);
  1290. }
  1291. });
  1292. let likeData = res.data[1];
  1293. this.likeList = [];
  1294. likeData.forEach(e => {
  1295. if (e.workId == this.workId) {
  1296. this.likeList.push(e);
  1297. }
  1298. });
  1299. let commentData = res.data[2];
  1300. this.commentList = [];
  1301. commentData.forEach(e => {
  1302. if (e.workId == this.workId) {
  1303. this.commentList.push(e);
  1304. }
  1305. });
  1306. this.vLoading = false;
  1307. });
  1308. },
  1309. selectSWorksData2() {
  1310. this.vLoading = true;
  1311. this.textarea = "";
  1312. let params = {
  1313. uid: this.DgUid,
  1314. cid: this.cid,
  1315. s: this.stage,
  1316. t: this.task,
  1317. g: this.toolIndex
  1318. };
  1319. // return console.log(params);
  1320. this.ajax
  1321. .get(this.$store.state.api + "selectMarkDialogWorksTwo", params)
  1322. .then(res => {
  1323. let data = res.data[0];
  1324. console.log("data", data);
  1325. // 计算markSco提交列表分数
  1326. data.forEach(e => {
  1327. if (e.rate) {
  1328. let data2 = JSON.parse(e.rate);
  1329. e.markSco = 0;
  1330. let k = 0;
  1331. for (const key in data2) {
  1332. if ((data2[key] && key != "content") || data2[key] == "0") {
  1333. e.markSco += data2[key] * 1;
  1334. } else {
  1335. k += 1;
  1336. }
  1337. }
  1338. if (k > 1) {
  1339. e.markSco = null;
  1340. } else {
  1341. e.markSco = (e.markSco / this.scoTitList.length).toFixed(1);
  1342. }
  1343. } else {
  1344. e.markSco = null;
  1345. }
  1346. });
  1347. // 提交列表
  1348. this.workList = data;
  1349. // 划分作业类型
  1350. data.forEach((e, index) => {
  1351. if (e.userid == this.DgUid) {
  1352. this.currentUid = e;
  1353. // 1截图 3问答 4word文档类型 5视频 10表格 13文档
  1354. if (
  1355. this.currentUid.type == 3 ||
  1356. this.currentUid.type == 10 ||
  1357. this.currentUid.type == 13
  1358. // this.currentUid.type == 15
  1359. ) {
  1360. this.currentUid.content = JSON.parse(e.content);
  1361. this.cuScoCon = this.currentUid.content.text;
  1362. }
  1363. if (this.currentUid.type == 4) {
  1364. let a = this.currentUid.content;
  1365. let data = a.slice(a.lastIndexOf(".") + 1);
  1366. if (data == "pdf") {
  1367. this.ifPdf = 1;
  1368. } else {
  1369. this.ifPdf = 0;
  1370. }
  1371. this.cuScoCon = this.currentUid.content;
  1372. }
  1373. if (this.currentUid.type == 5) {
  1374. this.playerOptions.sources[0].src = this.currentUid.content;
  1375. }
  1376. if (this.currentUid.type == 12) {
  1377. this.TxtMd = "";
  1378. getFile(this.currentUid.content).then(res => {
  1379. this.TxtMd = res.data;
  1380. });
  1381. }
  1382. this.workId = e.id;
  1383. this.appraise(e);
  1384. }
  1385. });
  1386. let likeData = res.data[1];
  1387. this.likeList = [];
  1388. likeData.forEach(e => {
  1389. if (e.workId == this.workId) {
  1390. this.likeList.push(e);
  1391. }
  1392. });
  1393. let commentData = res.data[2];
  1394. this.commentList = [];
  1395. commentData.forEach(e => {
  1396. if (e.workId == this.workId) {
  1397. this.commentList.push(e);
  1398. }
  1399. });
  1400. this.vLoading = false;
  1401. });
  1402. },
  1403. downloadFile(url) {
  1404. var credentials = {
  1405. accessKeyId: "AKIATLPEDU37QV5CHLMH",
  1406. secretAccessKey: "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"
  1407. }; //秘钥形式的登录上传
  1408. window.AWS.config.update(credentials);
  1409. window.AWS.config.region = "cn-northwest-1"; //设置区域
  1410. let url2 = url;
  1411. let _url2 = "";
  1412. if (
  1413. url2.indexOf("https://view.officeapps.live.com/op/view.aspx?src=") != -1
  1414. ) {
  1415. _url2 = url2.split(
  1416. "https://view.officeapps.live.com/op/view.aspx?src="
  1417. )[1];
  1418. } else {
  1419. _url2 = url2;
  1420. }
  1421. const loading2 = this.$loading.service({
  1422. background: "rgba(255, 255, 255, 0.7)",
  1423. target: document.body,
  1424. text: "文件加载中..."
  1425. });
  1426. var s3 = new window.AWS.S3({ params: { Bucket: "ccrb" } });
  1427. let name = decodeURIComponent(
  1428. _url2.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1]
  1429. );
  1430. var params = {
  1431. Bucket: "ccrb",
  1432. Key: name
  1433. };
  1434. s3.getObject(params, function(err, data) {
  1435. loading2.close();
  1436. if (err) console.log(err, err.stack);
  1437. // an error occurred
  1438. else {
  1439. let url = window.URL.createObjectURL(new Blob([data.Body]));
  1440. let a = document.createElement("a");
  1441. a.name = name;
  1442. a.href = url;
  1443. a.download = name;
  1444. a.click();
  1445. console.log(data);
  1446. } // sxuccessful response
  1447. });
  1448. },
  1449. // 处理任务的分展示
  1450. appraise(val) {
  1451. if (val.rate) {
  1452. let data = JSON.parse(val.rate);
  1453. this.scoTitList.forEach((e, index) => {
  1454. e.cog = null;
  1455. for (const key in data) {
  1456. if (isNaN(parseFloat(e.detail)) && e.detail) {
  1457. var result = e.detail.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1458. } else {
  1459. var result = e.detail;
  1460. }
  1461. if (isNaN(parseFloat(key)) && key) {
  1462. var key2 = key.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1463. } else {
  1464. var key2 = key;
  1465. }
  1466. // let result = e.detail.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1467. // let key2 = key.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1468. if (result.indexOf(key2) != -1) {
  1469. e.cog = data[key];
  1470. }
  1471. if ("content" == key) {
  1472. this.textarea = data[key];
  1473. }
  1474. }
  1475. });
  1476. } else {
  1477. this.scoTitList.forEach(e => {
  1478. e.cog = 0;
  1479. });
  1480. }
  1481. }
  1482. }
  1483. };
  1484. </script>
  1485. <style scoped>
  1486. .markDialog {
  1487. display: flex;
  1488. /* height: 100%; */
  1489. min-height: 600px;
  1490. height: 100%;
  1491. }
  1492. .left {
  1493. /* overflow: auto; */
  1494. width: 310px;
  1495. /* border-right: 1px rgba(231, 231, 231, 1) solid; */
  1496. padding: 20px 20px 0;
  1497. box-sizing: border-box;
  1498. padding-right: 10px;
  1499. display: flex;
  1500. flex-direction: column;
  1501. height: 100%;
  1502. }
  1503. .Rig {
  1504. flex: 1;
  1505. padding: 15px;
  1506. display: flex;
  1507. flex-direction: column;
  1508. }
  1509. .RigTop {
  1510. border-bottom: 1px rgba(231, 231, 231, 1) solid;
  1511. padding: 0px 0 15px;
  1512. }
  1513. .AreaCss {
  1514. position: relative;
  1515. margin-bottom: 5px;
  1516. }
  1517. .AreaCss >>> .el-textarea__inner {
  1518. min-height: 150px !important;
  1519. /* max-height: 150px; */
  1520. padding-bottom: 20px;
  1521. }
  1522. .AreaBtn {
  1523. position: absolute;
  1524. width: calc(100% - 30px);
  1525. text-align: right;
  1526. background-color: #fff;
  1527. bottom: 11px;
  1528. right: 20px;
  1529. color: rgba(54, 129, 252, 1);
  1530. cursor: pointer;
  1531. }
  1532. .likeList {
  1533. width: 100%;
  1534. display: flex;
  1535. padding: 10px 0;
  1536. flex-wrap: wrap;
  1537. }
  1538. .likeList > div {
  1539. padding: 4px 0px;
  1540. background-color: rgba(243, 247, 253, 1);
  1541. margin-right: 10px;
  1542. width: calc((100% - 60px) / 7);
  1543. text-align: center;
  1544. text-overflow: ellipsis;
  1545. white-space: nowrap;
  1546. overflow: hidden;
  1547. margin-bottom: 10px;
  1548. }
  1549. .likeList > div:nth-child(7n) {
  1550. margin-right: 0px;
  1551. }
  1552. .commentListCss {
  1553. background-color: #fafafa;
  1554. padding: 25px 15px 0;
  1555. box-sizing: border-box;
  1556. margin-top: 10px;
  1557. border-radius: 5px;
  1558. }
  1559. .RigConTit {
  1560. width: 100%;
  1561. display: flex;
  1562. margin: 10px 0;
  1563. }
  1564. .RigConTit > div {
  1565. font-size: 14px;
  1566. color: rgba(0, 0, 0, 0.6);
  1567. padding: 8px;
  1568. cursor: pointer;
  1569. }
  1570. .RigConTitOn {
  1571. border-bottom: 3px solid rgba(54, 129, 252, 1);
  1572. }
  1573. .RigCon {
  1574. width: 100%;
  1575. overflow: auto;
  1576. flex: 1;
  1577. padding: 10px 0;
  1578. box-sizing: border-box;
  1579. /* background-color: aqua; */
  1580. }
  1581. .selBlock {
  1582. background-color: #f3f7fd !important;
  1583. border: 1px #68a0fc solid !important;
  1584. }
  1585. .cutStuBtn {
  1586. display: flex;
  1587. color: rgba(54, 129, 252, 1);
  1588. }
  1589. .cutStuBtn > div {
  1590. margin-left: 10px;
  1591. }
  1592. .scoreTit {
  1593. font-size: 16px;
  1594. font-weight: 600;
  1595. display: flex;
  1596. justify-content: space-between;
  1597. box-sizing: border-box;
  1598. color: rgba(0, 0, 0, 0.9);
  1599. }
  1600. .allD {
  1601. margin: 10px 0;
  1602. min-height: 60px;
  1603. background-color: #f3f7fd;
  1604. }
  1605. .scoreStar2 {
  1606. padding: 0 10px 10px;
  1607. height: 100%;
  1608. flex: 1;
  1609. color: rgba(54, 129, 252, 1);
  1610. cursor: pointer;
  1611. }
  1612. .scoreStar {
  1613. padding: 0px 10px 10px;
  1614. height: 100%;
  1615. flex: 1;
  1616. }
  1617. .scoreStarBack {
  1618. flex: 1;
  1619. display: flex;
  1620. justify-content: space-between;
  1621. padding-top: 10px;
  1622. position: relative;
  1623. }
  1624. /* .scoreStar > div:first-child > .scoreStarBack {
  1625. margin-top: 0;
  1626. } */
  1627. .ScrBtn {
  1628. display: flex;
  1629. justify-content: center;
  1630. align-items: center;
  1631. cursor: pointer;
  1632. padding: 2px 8px;
  1633. border-radius: 5px;
  1634. color: #fff;
  1635. background-color: rgba(54, 129, 252, 1);
  1636. border: 1px rgba(54, 129, 252, 1) solid;
  1637. }
  1638. .worksAnswer {
  1639. color: #4078dd;
  1640. margin: 10px 0;
  1641. font-size: 16px;
  1642. display: flex;
  1643. align-items: center;
  1644. cursor: pointer;
  1645. }
  1646. .worksAnswer > img {
  1647. width: 100%;
  1648. height: 300px;
  1649. object-fit: contain;
  1650. margin: 0 auto;
  1651. display: block;
  1652. }
  1653. .briefTit {
  1654. width: 120px;
  1655. text-overflow: ellipsis;
  1656. overflow: hidden;
  1657. white-space: nowrap;
  1658. }
  1659. .briefTit > .titRoot {
  1660. position: absolute;
  1661. top: 0;
  1662. left: -27px;
  1663. transform: translate(0, 10px);
  1664. }
  1665. .workListTit {
  1666. color: rgba(0, 0, 0, 0.6);
  1667. font-size: 12px;
  1668. font-weight: 400;
  1669. margin: 10px 0;
  1670. cursor: pointer;
  1671. }
  1672. .schPer2 {
  1673. padding: 10px;
  1674. box-sizing: border-box;
  1675. display: flex;
  1676. border-radius: 5px;
  1677. border: 1px solid rgba(240, 242, 245, 1);
  1678. /* margin-bottom: 10px; */
  1679. }
  1680. .schPer2 > img {
  1681. width: 45px;
  1682. height: 45px;
  1683. border-radius: 50%;
  1684. object-fit: cover;
  1685. }
  1686. .schPer {
  1687. padding: 10px;
  1688. box-sizing: border-box;
  1689. display: flex;
  1690. border-radius: 5px;
  1691. border: 1px solid rgba(240, 242, 245, 1);
  1692. margin-bottom: 10px;
  1693. }
  1694. .schPer > img {
  1695. width: 40px;
  1696. height: 40px;
  1697. border-radius: 50%;
  1698. object-fit: cover;
  1699. }
  1700. .con {
  1701. flex: 1;
  1702. display: flex;
  1703. flex-direction: column;
  1704. justify-content: space-between;
  1705. padding: 0 10px;
  1706. box-sizing: border-box;
  1707. }
  1708. .con > .tit {
  1709. width: 100%;
  1710. display: flex;
  1711. justify-content: space-between;
  1712. }
  1713. .con > .tit2 {
  1714. width: 100%;
  1715. display: flex;
  1716. margin-bottom: 15px;
  1717. }
  1718. .TitName {
  1719. width: 70px;
  1720. overflow: hidden;
  1721. text-overflow: ellipsis;
  1722. white-space: nowrap;
  1723. margin-right: 10px;
  1724. }
  1725. .worksAnswer {
  1726. color: #4078dd;
  1727. margin: 10px 0;
  1728. font-size: 16px;
  1729. position: relative;
  1730. }
  1731. .worksAnswer > img {
  1732. width: 500px;
  1733. height: 300px;
  1734. object-fit: contain;
  1735. margin: 0 auto;
  1736. display: block;
  1737. }
  1738. .cont {
  1739. overflow-wrap: break-word;
  1740. word-break: break-word;
  1741. white-space: pre-line;
  1742. }
  1743. .cont >>> table {
  1744. border-top: 1px solid #ccc;
  1745. border-left: 1px solid #ccc;
  1746. }
  1747. .cont >>> table td,
  1748. .cont >>> table th {
  1749. border-bottom: 1px solid #ccc;
  1750. border-right: 1px solid #ccc;
  1751. padding: 5px 10px;
  1752. max-width: 0px;
  1753. height: 30px;
  1754. vertical-align: baseline;
  1755. box-sizing: border-box;
  1756. }
  1757. .video-player >>> .video-js {
  1758. height: 100%;
  1759. }
  1760. .markBox {
  1761. padding: 20px 14px;
  1762. line-height: 29px;
  1763. font-size: 16px;
  1764. background: #f4f4f4;
  1765. border-radius: 5px;
  1766. }
  1767. .anewC {
  1768. position: absolute;
  1769. width: 91%;
  1770. text-align: right;
  1771. background-color: #fff;
  1772. bottom: 3px;
  1773. right: 22px;
  1774. color: #12b0ff;
  1775. cursor: pointer;
  1776. font-size: 16px;
  1777. transform: translate(0px, 2px);
  1778. }
  1779. </style>