markDialog.vue 59 KB

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