markDialog.vue 57 KB

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