markDialog.vue 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411
  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
  8. v-if="finalMarkList == toolIndex"
  9. v-loading="ScLoading"
  10. >
  11. <div class="scoreTit">
  12. <div>任务得分</div>
  13. <div>
  14. <span style="color: rgba(54, 129, 252, 1);margin-right: 3px;">{{
  15. totalScore ? totalScore : 0
  16. }}</span
  17. >分
  18. </div>
  19. </div>
  20. <div class="allD">
  21. <div class="scoreStar">
  22. <div
  23. v-show="reveal"
  24. v-for="(e, index) in scoTitList"
  25. :key="index + 'a'"
  26. >
  27. <div class="scoreStarBack" >
  28. <el-tooltip
  29. class="item"
  30. effect="dark"
  31. :content="e.detail"
  32. placement="top"
  33. >
  34. <div class="briefTit">
  35. <img class="titRoot" src="../../../assets/icon/newIcons/blueRoot.png" alt="">
  36. {{ e.detail }}
  37. </div>
  38. </el-tooltip>
  39. <el-rate @change="submit" v-model="e.cog"></el-rate>
  40. </div>
  41. </div>
  42. <div
  43. v-show="!reveal"
  44. v-for="(e, index) in scoTitList.slice(0, 3)"
  45. :key="index + 'b'"
  46. >
  47. <div class="scoreStarBack">
  48. <el-tooltip
  49. class="item"
  50. effect="dark"
  51. :content="e.detail"
  52. placement="top"
  53. >
  54. <div class="briefTit">
  55. <img class="titRoot" src="../../../assets/icon/newIcons/blueRoot.png" alt="">
  56. {{ e.detail }}
  57. </div>
  58. </el-tooltip>
  59. <el-rate @change="submit" v-model="e.cog"></el-rate>
  60. </div>
  61. </div>
  62. </div>
  63. <div
  64. v-if="reveal && scoTitList.length > 3"
  65. class="scoreStar2"
  66. @click="revealBtn"
  67. >
  68. 折叠 <i class="el-icon-arrow-up"></i>
  69. </div>
  70. <div
  71. v-if="!reveal && scoTitList.length > 3"
  72. class="scoreStar2"
  73. @click="revealBtn"
  74. >
  75. 全部 <i class="el-icon-arrow-down"></i>
  76. </div>
  77. </div>
  78. <div class="AreaCss">
  79. <el-input
  80. type="textarea"
  81. placeholder="您可在此输入评语"
  82. v-model="textarea"
  83. @blur="submit"
  84. >
  85. <!-- style="padding-bottom: 10px;" -->
  86. </el-input>
  87. <!-- <div
  88. class="AreaBtn"
  89. v-if="
  90. currentUid.type == 10 || currentUid.type == 13 || isMarkCom == 1
  91. "
  92. @click="generateMsg(currentUid)"
  93. >
  94. <span>重新生成</span>
  95. </div> -->
  96. </div>
  97. <div
  98. style="width:100%;display:flex;height: 25px;;justify-content: space-between;"
  99. >
  100. <div ></div>
  101. <div style="display: flex;">
  102. <div
  103. class="ScrBtn"
  104. @click="reset"
  105. style="color: rgba(0, 0, 0, 0.6);background-color: rgba(243, 247, 253, 1);border: none;"
  106. >
  107. 清空
  108. </div>
  109. <div
  110. class="ScrBtn"
  111. style="margin-left: 10px;"
  112. @click="AIsubmit(currentUid)"
  113. v-if="
  114. currentUid.type == 10 || currentUid.type == 13 || isMarkCom == 1
  115. "
  116. >
  117. <img
  118. src="../../../assets/icon/newIcons/Brootper.svg"
  119. alt=""
  120. />AI评分
  121. </div>
  122. <!-- <div
  123. class="ScrBtn"
  124. @click="submit"
  125. style="margin-left: 10px;color:#fff;border: none;background-color: rgba(54, 129, 252, 1);"
  126. >
  127. 确认
  128. </div> -->
  129. </div>
  130. </div>
  131. </div>
  132. <!-- 提交列表 -->
  133. <div style="flex: 1;display: flex;flex-direction: column;overflow: auto;">
  134. <div class="workListTit" @click="workListTitBtn">
  135. <i class="el-icon-arrow-down"></i>提交列表 ({{ workList.length }})
  136. </div>
  137. <div style="overflow: auto;flex: 1;">
  138. <div
  139. v-if="workListShow"
  140. v-for="(i, index) in workList"
  141. :key="index"
  142. :class="['schPer', i.userid == DgUid ? 'selBlock' : '']"
  143. style="cursor: pointer;"
  144. @click="cutPer(i.userid,index)"
  145. >
  146. <img v-if="i.headportrait" :src="i.headportrait" alt="" />
  147. <img
  148. v-else
  149. src="https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/static/img/portal.b3cf7fa.png"
  150. alt=""
  151. />
  152. <div class="con">
  153. <div class="tit">
  154. <span
  155. style="font-size: 14px;color: rgba(0, 0, 0, 0.9);font-weight: 400;"
  156. >{{ i.name }}</span
  157. >
  158. <span
  159. style="font-size: 14px;color:rgba(0, 0, 0, 0.4);"
  160. v-if="i.markSco == null"
  161. >未评分</span
  162. >
  163. <span
  164. v-else
  165. style="font-size: 16px;color: rgba(0, 0, 0, 0.9);font-weight: 600;"
  166. >{{ i.markSco }}</span
  167. >
  168. </div>
  169. <div class="Timer">{{ i.time }}</div>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. <!-- 作业展示区 -->
  177. <div class="Rig">
  178. <div class="RigTop">
  179. <div
  180. style="display: flex;align-items: center;justify-content: space-between;width: 100%;"
  181. >
  182. <div
  183. class="schPer"
  184. style="border: none;width: 300px;padding: 0;margin: 0;"
  185. >
  186. <img
  187. v-if="currentUid.headportrait"
  188. :src="currentUid.headportrait"
  189. alt=""
  190. />
  191. <img
  192. v-else
  193. src="https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/static/img/portal.b3cf7fa.png"
  194. alt=""
  195. />
  196. <div class="con">
  197. <div class="tit">
  198. <span
  199. style="font-size: 14px;color: rgba(0, 0, 0, 0.9);font-weight: 400;"
  200. >{{ currentUid.name }}</span
  201. >
  202. </div>
  203. <div class="Timer">{{ currentUid.time }}</div>
  204. </div>
  205. </div>
  206. <div class="cutStuBtn">
  207. <div>
  208. <span v-if="current == 0" style="cursor: pointer;color:#ccc">上一个</span>
  209. <span v-else @click="prevStu" style="cursor: pointer;color: rgba(54, 129, 252, 1)">上一个</span>
  210. </div>
  211. <div>
  212. <span v-if="current >= workList.length -1" style="cursor: pointer;color: #ccc">下一个</span>
  213. <span v-else @click="nextStu" style="cursor: pointer;color: rgba(54, 129, 252, 1)">下一个</span>
  214. </div>
  215. <!-- <div><span @click="prevStu" v-if="this.current > 0">上一个</span></div>
  216. <div><span @click="nextStu" v-if="this.current < this.workList.length-1">下一个</span></div> -->
  217. </div>
  218. </div>
  219. </div>
  220. <div class="RigConTit">
  221. <div :class="[cutNum ? '' : 'RigConTitOn']" @click="cutPage(0)">
  222. 学生作业
  223. </div>
  224. <div :class="[cutNum ? 'RigConTitOn' : '']" @click="cutPage(1)">
  225. 点赞与评论
  226. </div>
  227. </div>
  228. <div class="RigCon">
  229. <!-- 作业内容 -->
  230. <div v-if="cutNum == 0" style="height: 97%;">
  231. <div
  232. v-if="
  233. currentUid.type == 13 || currentUid.type == 10
  234. // currentUid.type == 15
  235. "
  236. >
  237. <div class="cont" v-html="currentUid.content.text"></div>
  238. </div>
  239. <div v-if="currentUid.type == 1">
  240. <img
  241. @click="previewImg(currentUid.content)"
  242. style="max-width: 100%;object-fit: cover;"
  243. :src="currentUid.content"
  244. alt=""
  245. />
  246. </div>
  247. <div v-if="currentUid.type == 3">
  248. <div style="width: 100%;text-align: center;">
  249. <div
  250. style="margin-bottom: 20px;font-weight: 600;font-size: 16px;"
  251. >
  252. {{ currentUid.content[0].answerTitle }}
  253. </div>
  254. <div>{{ currentUid.content[0].answer }}</div>
  255. </div>
  256. </div>
  257. <div v-if="currentUid.type == 4" style="height: 100%;">
  258. <iframe
  259. v-if="ifPdf == 1"
  260. style="width: 100%; height: 99%; border: none"
  261. :src="
  262. 'https://cloud.cocorobo.cn/pdf.js/web/viewer.html?file=' +
  263. encodeURIComponent(currentUid.content)
  264. "
  265. ></iframe>
  266. <iframe
  267. v-else
  268. style="width: 100%; height: 100%; border: none"
  269. :src="
  270. 'https://view.officeapps.live.com/op/view.aspx?src=' +
  271. encodeURIComponent(currentUid.content)
  272. "
  273. frameborder="0"
  274. ></iframe>
  275. </div>
  276. <div v-if="currentUid.type == 12" style="height: 100%;">
  277. <div>
  278. <div
  279. style="cursor: pointer;"
  280. @click="downloadFile(currentUid.content)"
  281. >
  282. 下载txt
  283. </div>
  284. <!-- <div>{{ currentUid.content }}</div> -->
  285. </div>
  286. </div>
  287. <div v-if="currentUid.type == 15" style="height: 100%;">
  288. <div
  289. class="worksAnswer"
  290. v-if="currentUid.content"
  291. @click="
  292. openCocoPi(57, toolIndex, currentUid.userid, currentUid.name)
  293. "
  294. >
  295. <img src="../../../assets/icon/codeFile.png" />
  296. <div>点击打开CocoPi</div>
  297. </div>
  298. </div>
  299. <div v-if="currentUid.type == 5" style="height: 100%;">
  300. <video-player
  301. class="video-player vjs-custom-skin"
  302. :playsinline="true"
  303. :options="playerOptions"
  304. @play="onPlayerPlay($event)"
  305. style="width: 90%; height: 95%; margin: 0 0 0 30px"
  306. ></video-player>
  307. </div>
  308. </div>
  309. <!-- 点赞与评论 -->
  310. <div v-if="cutNum == 1">
  311. <div style="display: flex;align-items: center;">
  312. <img
  313. style="margin-right: 3px;"
  314. src="../../../assets/icon/newIcons/likeG.png"
  315. alt=""
  316. />点赞({{ likeList.length }})
  317. </div>
  318. <div class="likeList">
  319. <div v-for="i in likeList" :key="i.id">{{ i.username }}</div>
  320. </div>
  321. <div style="display: flex;align-items: center;">
  322. <img
  323. style="margin-right: 3px;"
  324. src="../../../assets/icon/newIcons/commG.png"
  325. alt=""
  326. />评论({{ commentList.length }})
  327. </div>
  328. <div class="commentListCss" v-if="commentList.length">
  329. <div
  330. style="padding-bottom: 25px;display: flex;justify-content: space-between;"
  331. v-for="i in commentList"
  332. :key="i.id"
  333. >
  334. <div class="schPer2" style="border: none;width: 90%;padding: 0;">
  335. <img v-if="i.headportrait" :src="i.headportrait" alt="" />
  336. <img
  337. v-else
  338. src="https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/static/img/portal.b3cf7fa.png"
  339. alt=""
  340. />
  341. <div class="con">
  342. <div class="tit2">
  343. <div class="TitName">{{ i.username }}</div>
  344. <span
  345. style="font-size: 14px;color: rgba(0, 0, 0, 0.9);font-weight: 400;width: 200px;"
  346. >{{ i.time }}</span
  347. >
  348. </div>
  349. <div class="Timer">{{ i.comment }}</div>
  350. </div>
  351. </div>
  352. <div>
  353. <span
  354. style="color: #3B7BD7;cursor: pointer;"
  355. @click="deleteComment(i.id)"
  356. >删除</span
  357. >
  358. </div>
  359. </div>
  360. </div>
  361. </div>
  362. </div>
  363. </div>
  364. </div>
  365. </template>
  366. <script>
  367. import { v4 as uuidv4 } from "uuid";
  368. export default {
  369. props: [
  370. "uid",
  371. "stage",
  372. "toolIndex",
  373. "task",
  374. "scoTit",
  375. "markScoreVisible",
  376. "markScoreworksStudent",
  377. "finalMarkList"
  378. ],
  379. data() {
  380. return {
  381. textarea: "",
  382. reveal: false, //得分详情框全部与折叠
  383. workListShow: true, //作业显示
  384. cutNum: 0, //作业与评论切换
  385. scoTitList: [], //得分详情框数据
  386. workList: [], //作业列表
  387. cid: this.$route.query.courseId,
  388. cUserid: this.$route.query.userid, //账号登录人id
  389. cuScoCon: "",
  390. currentUid: {}, //当前评分框学生信息
  391. current: "", //上一位下一位中的第几位
  392. DgUid: this.uid, //当前评分框学生id
  393. likeList: [], //喜欢list
  394. commentList: [], //评分list
  395. workId: "", //作业id。用于分类评论与点赞list
  396. vLoading: false,
  397. allSco: 0,
  398. ifPdf: 1,
  399. ScLoading: false,
  400. playerOptions: {
  401. playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
  402. autoplay: false, //如果true,浏览器准备好时开始回放。
  403. muted: false, // 默认情况下将会消除任何音频。
  404. loop: false, // 导致视频一结束就重新开始。
  405. preload: "auto", // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
  406. language: "zh-CN",
  407. aspectRatio: "16:9", // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
  408. fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
  409. sources: [
  410. {
  411. type: "video/mp4", //这里的种类支持很多种:基本视频格式、直播、流媒体等,具体可以参看git网址项目 || "video/ogg"|| "video/webm"
  412. src: "" //url地址require("../../../assets/media/aaa.mp4")
  413. }
  414. ],
  415. // poster: require("../../../assets/tu31.png"), //你的封面地址
  416. // poster: dataRes.imgUrl, //你的封面地址
  417. notSupportedMessage: "此视频暂无法播放,请稍后再试", //允许覆盖Video.js无法播放媒体源时显示的默认信息。
  418. controlBar: {
  419. timeDivider: true, //当前时间和持续时间的分隔符
  420. durationDisplay: true, //显示持续时间
  421. remainingTimeDisplay: false, //是否显示剩余时间功能
  422. fullscreenToggle: true //全屏按钮
  423. }
  424. },
  425. xianObj: ["DOCX", "MD", "TXT", "PDF" ,"PPTX"]
  426. };
  427. },
  428. watch: {
  429. markScoreVisible(newVal) {
  430. this.workListShow = true;
  431. this.reveal = false;
  432. this.cutNum = 0;
  433. this.textarea = "";
  434. this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
  435. this.selectSWorksData();
  436. }
  437. },
  438. computed: {
  439. totalScore() {
  440. let a = 0;
  441. this.scoTitList.forEach(e => {
  442. if (e.cog) {
  443. a += e.cog * 1;
  444. }
  445. });
  446. return (a / this.scoTit.length).toFixed(1);
  447. },
  448. isMarkCom() {
  449. // console.log('a',this.currentUid);
  450. if (this.currentUid.type == 4 || this.currentUid.type == 12) {
  451. let a = this.currentUid.content.slice(
  452. this.currentUid.content.lastIndexOf(".") + 1
  453. );
  454. if (this.xianObj.indexOf(a.toUpperCase()) != -1) {
  455. return 1;
  456. } else {
  457. return 0;
  458. }
  459. } else {
  460. return 0;
  461. }
  462. }
  463. },
  464. mounted() {
  465. this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
  466. this.selectSWorksData();
  467. },
  468. methods: {
  469. // 预览图片
  470. previewImg(url) {
  471. //预览图片
  472. this.$hevueImgPreview(url);
  473. },
  474. onPlayerPlay() {},
  475. // 获取文档id
  476. createFileid(url) {
  477. let _this = this;
  478. return new Promise((resolve, reject) => {
  479. try {
  480. _this.ajax
  481. .put("https://gpt4.cocorobo.cn/upload_file_knowledge", {
  482. url: url
  483. })
  484. .then(res => {
  485. let _data = res.data.FunctionResponse;
  486. if (_data.result && _data.result.id) {
  487. resolve(_data.result.id);
  488. } else {
  489. resolve(1);
  490. }
  491. })
  492. .catch(function(error) {
  493. resolve(1);
  494. });
  495. } catch (e) {
  496. resolve(1);
  497. }
  498. });
  499. },
  500. // 老师提交评分
  501. submit() {
  502. let data = this.scoTitList.map(e => {
  503. return e.detail + ":" + e.cog;
  504. });
  505. // console.log("data", data);
  506. const processedData = {};
  507. data.forEach(item => {
  508. const [key, value] = item.split(":");
  509. processedData[key] = Number(value) ? Number(value) : 0;
  510. });
  511. processedData.content = this.textarea;
  512. // console.log(processedData);
  513. let params = {
  514. cid: this.cid,
  515. s: this.stage,
  516. t: this.task,
  517. rate: JSON.stringify(processedData),
  518. uid: this.DgUid
  519. };
  520. // return console.log(params);
  521. this.ajax
  522. .get(this.$store.state.api + "updateWorksEva", params)
  523. .then(res => {
  524. // this.$message({
  525. // message: "评价成功",
  526. // type: "success"
  527. // });
  528. this.ScLoading = false;
  529. // this.selectSWorksData();
  530. // this.$emit("refreshOther", this.toolIndex);
  531. })
  532. .catch(err => {
  533. this.$message.error("评价失败");
  534. console.error(err);
  535. });
  536. },
  537. // 重置
  538. reset() {
  539. this.$confirm("是否清空评分和评语?", "提示", {
  540. confirmButtonText: "确定",
  541. cancelButtonText: "取消",
  542. type: "warning"
  543. })
  544. .then(() => {
  545. this.scoTitList.forEach(e => {
  546. e.cog = 0;
  547. });
  548. this.textarea = "";
  549. })
  550. .catch(() => {});
  551. // this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
  552. },
  553. // ai评分
  554. async AIsubmit(work) {
  555. // return console.log("con", this.scoTit, this.cuScoCon);
  556. this.ScLoading = true;
  557. let _fileid = "";
  558. if (work.type == 4 || work.type == 12) {
  559. _fileid = await this.createFileid(work.content);
  560. }
  561. let tit = JSON.parse(JSON.stringify(this.scoTit));
  562. tit.forEach((e, index) => {
  563. if (!e.isai) {
  564. e.isai = 1;
  565. }
  566. });
  567. let con = this.cuScoCon;
  568. let laws = "";
  569. for (let i = 0; i < tit.length; i++) {
  570. if (tit[i].isai == 1) {
  571. let a = tit[i].detail
  572. let result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  573. laws += `评价维度:“${result}”, 评价细则:${tit[i].rule} \n`;
  574. }
  575. }
  576. let msg = `NOTICE
  577. Role: 你是一个专业的项目式学习导师,你要对学生的评价高度负责。你要根据“六级评价细则”给学生作品评分,并生成需要的JSON数据。
  578. Language: Please use the same language as the user requirement, if the user speaks Chinese, the specific text of your answer should also be in Chinese.
  579. ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced "Format example".
  580. Instruction: Based on the context, follow "Format example", write content.
  581. #Context
  582. ##要求
  583. 根据<评价细则>和<作业内容>的相关性评价作业,判断该作业属于六级中的哪个等级,结合“评价细则”和等级写评语。如果作业内容与评价细则无关,则直接评为0星。
  584. ##评分资料
  585. 评价细则:${laws}
  586. 作业内容:${_fileid ? "上传的文件内容" : con}
  587. #输出要求#
  588. 输出每个维度的“等级”和作业的综合性“评语”
  589. “评语”控制在150字左右
  590. 评价维度要按原样输出,只输出 ##评分资料 “评分细则”引号内的
  591. # Format example
  592. [{'评价维度':'评价等级0-5(数字)'},{'评价维度':'评价等级0-5(数字)'},{'评价维度':'评价等级0-5(数字)'},{'评价维度':'评价等级0-5(数字)'},{'评语':'评语(150个字左右)'}]
  593. `;
  594. // console.log(msg);
  595. this.aiGet2(msg, _fileid);
  596. },
  597. // ai打分
  598. aiGet2(messages, _fileid) {
  599. let _this = this;
  600. let params = {
  601. assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
  602. message: [
  603. {
  604. type: "text",
  605. text: messages.replaceAll("\n", " ").replaceAll("*", "")
  606. }
  607. ],
  608. session_name: uuidv4(),
  609. userId: this.cUserid,
  610. file_ids: _fileid ? [_fileid] : [],
  611. model: "gpt-4o-2024-08-06"
  612. };
  613. this.ajax
  614. .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
  615. .then(response => {
  616. let data = response.data.FunctionResponse;
  617. console.log("data", data);
  618. if (data.message) {
  619. let dArray = {};
  620. try {
  621. dArray = JSON.parse(
  622. data.message.replaceAll("```json", "").replaceAll("```", "")
  623. );
  624. } catch (error) {
  625. console.log("error_________________" + error);
  626. try {
  627. let regex = new RegExp("(?<=```json)([\\s\\S]*?)(?=```)");
  628. let match = data.message.match(regex);
  629. dArray = JSON.parse(
  630. match[0]
  631. .replace(/\n/g, "")
  632. .replace(/\s{2,}/g, "")
  633. .replace(/\'/g, '"')
  634. );
  635. } catch (error) {
  636. try {
  637. dArray = JSON.parse(
  638. data.message
  639. .replaceAll("```json", "")
  640. .replaceAll("# Solution", "")
  641. .replaceAll("```", "")
  642. .replace(/\n/g, "")
  643. .replace(/\s{2,}/g, "")
  644. .replace(/\'/g, '"')
  645. );
  646. } catch (error) {
  647. console.log("error_________________" + error);
  648. }
  649. console.log("error_________________" + error);
  650. }
  651. }
  652. let processedData = {};
  653. // console.log(JSON.parse(JSON.stringify(dArray)));
  654. dArray.forEach(function(item) {
  655. let key = Object.keys(item)[0];
  656. let value = item[key];
  657. processedData[key] = value;
  658. });
  659. let IsAIsuccess = 0
  660. for (const tKey in this.scoTitList) {
  661. for (const key in processedData) {
  662. let result = this.scoTitList[tKey].detail.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  663. let key2 = key.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  664. if (key != "评语") {
  665. if (result.indexOf(key2) != -1) {
  666. IsAIsuccess++
  667. }
  668. continue;
  669. }
  670. }
  671. continue;
  672. }
  673. let scotNum = 0
  674. this.scoTitList.forEach(e=>{
  675. if (e.isai == 1) {
  676. scotNum++
  677. }
  678. })
  679. if (IsAIsuccess != scotNum) {
  680. // _this.$message.error("评价失败");
  681. // _this.ScLoading = false;
  682. this.aiGet2(messages,_fileid)
  683. return
  684. }
  685. for (const key in processedData) {
  686. if (key == "评语") {
  687. processedData.content = processedData[key];
  688. }
  689. }
  690. delete processedData["评语"];
  691. let params = {
  692. cid: _this.cid,
  693. s: _this.stage,
  694. t: _this.task,
  695. rate: JSON.stringify(processedData),
  696. uid: _this.DgUid
  697. };
  698. _this.ajax
  699. .get(_this.$store.state.api + "updateWorksEva", params)
  700. .then(res => {
  701. _this.$message({
  702. message: "评价成功",
  703. type: "success"
  704. });
  705. _this.ScLoading = false;
  706. _this.selectSWorksData();
  707. })
  708. .catch(err => {
  709. // _this.ScLoading = false;
  710. // _this.$message.error("评价失败");
  711. this.aiGet2(messages,_fileid)
  712. console.error(err);
  713. });
  714. }
  715. this.$forceUpdate();
  716. })
  717. .catch(error => {
  718. // _this.$message.error("评价失败");
  719. // _this.ScLoading = false;
  720. this.aiGet2(messages,_fileid)
  721. console.log(error);
  722. });
  723. },
  724. // 上一个
  725. prevStu() {
  726. if (this.ScLoading) return this.$message.info("请稍后,正在ai评价中");
  727. if (this.current > 0) {
  728. this.current--;
  729. this.DgUid = this.workList[this.current].userid;
  730. this.selectSWorksData();
  731. } else {
  732. this.$message.info("已经是第一位了");
  733. }
  734. },
  735. // 下一个
  736. nextStu() {
  737. if (this.ScLoading) return this.$message.info("请稍后,正在ai评价中");
  738. if (this.current < this.workList.length - 1) {
  739. this.current++;
  740. this.DgUid = this.workList[this.current].userid;
  741. this.selectSWorksData2();
  742. } else {
  743. this.$message.info("已经是最后一位了");
  744. }
  745. },
  746. // 提交列表点击切换
  747. cutPer(val,index) {
  748. if (this.ScLoading) return this.$message.info("请稍后,正在ai评价中");
  749. this.current = index;
  750. this.DgUid = val;
  751. this.selectSWorksData2();
  752. },
  753. // 任务得分折叠
  754. revealBtn() {
  755. this.reveal = !this.reveal;
  756. },
  757. // 提交列表折叠
  758. workListTitBtn() {
  759. this.workListShow = !this.workListShow;
  760. },
  761. // 点赞与评论切换
  762. cutPage(val) {
  763. this.cutNum = val;
  764. },
  765. // 删除评论
  766. deleteComment(wid) {
  767. this.$confirm("确定删除此评论吗?", "提示", {
  768. confirmButtonText: "确定",
  769. cancelButtonText: "取消",
  770. type: "warning"
  771. })
  772. .then(() => {
  773. let params = {
  774. id: wid
  775. };
  776. this.ajax
  777. .get(this.$store.state.api + "deleteComment2", params)
  778. .then(res => {
  779. this.$message({
  780. message: "删除评论成功",
  781. type: "success"
  782. });
  783. this.selectSWorksData();
  784. })
  785. .catch(err => {
  786. console.error(err);
  787. });
  788. })
  789. .catch(() => {});
  790. },
  791. openCocoPi(tool, i, uid, uname) {
  792. // return console.log('?????',tool, i, uid, uname);
  793. let student = {
  794. userid: uid,
  795. student: uname
  796. };
  797. if (tool == 57) {
  798. window.parent.postMessage(
  799. {
  800. tools: tool + "teacher",
  801. cid: this.cid,
  802. stage: this.stage,
  803. task: this.task,
  804. tool: this.toolIndex,
  805. student: student
  806. },
  807. "*"
  808. );
  809. }
  810. },
  811. //全部作业
  812. selectSWorksData() {
  813. this.vLoading = true;
  814. this.textarea = "";
  815. let params = {
  816. uid: this.DgUid,
  817. cid: this.cid,
  818. s: this.stage,
  819. t: this.task,
  820. g: this.toolIndex
  821. };
  822. // return console.log(params);
  823. this.ajax
  824. .get(this.$store.state.api + "selectMarkDialogWorks", params)
  825. .then(res => {
  826. let data = res.data[0];
  827. data.forEach(e => {
  828. if (e.rate) {
  829. let data2 = JSON.parse(e.rate);
  830. e.markSco = 0;
  831. let k = 0
  832. for (const key in data2) {
  833. if (data2[key] && key != "content" || data2[key] == "0" ) {
  834. e.markSco += data2[key] * 1;
  835. }else{
  836. k += 1
  837. }
  838. }
  839. if (k > 1) {
  840. e.markSco = null;
  841. }else{
  842. e.markSco = (e.markSco / this.scoTitList.length).toFixed(1);
  843. }
  844. } else {
  845. e.markSco = null;
  846. }
  847. });
  848. this.workList = data;
  849. data.forEach((e, index) => {
  850. if (e.userid == this.DgUid) {
  851. this.currentUid = e;
  852. if (
  853. this.currentUid.type == 3 ||
  854. this.currentUid.type == 10 ||
  855. this.currentUid.type == 13
  856. // this.currentUid.type == 15
  857. ) {
  858. this.currentUid.content = JSON.parse(e.content);
  859. this.cuScoCon = this.currentUid.content.text;
  860. }
  861. if (this.currentUid.type == 4) {
  862. let a = this.currentUid.content;
  863. let data = a.slice(a.lastIndexOf(".") + 1);
  864. this.cuScoCon = this.currentUid.content;
  865. if (data == "pdf") {
  866. this.ifPdf = 1;
  867. } else {
  868. this.ifPdf = 0;
  869. }
  870. }
  871. if (this.currentUid.type == 5) {
  872. this.playerOptions.sources[0].src = this.currentUid.content;
  873. }
  874. this.current = index;
  875. this.workId = e.id;
  876. this.appraise(e);
  877. }
  878. });
  879. let likeData = res.data[1];
  880. this.likeList = [];
  881. likeData.forEach(e => {
  882. if (e.workId == this.workId) {
  883. this.likeList.push(e);
  884. }
  885. });
  886. let commentData = res.data[2];
  887. this.commentList = [];
  888. commentData.forEach(e => {
  889. if (e.workId == this.workId) {
  890. this.commentList.push(e);
  891. }
  892. });
  893. this.vLoading = false;
  894. });
  895. },
  896. selectSWorksData2() {
  897. this.vLoading = true;
  898. this.textarea = "";
  899. let params = {
  900. uid: this.DgUid,
  901. cid: this.cid,
  902. s: this.stage,
  903. t: this.task,
  904. g: this.toolIndex
  905. };
  906. // return console.log(params);
  907. this.ajax
  908. .get(this.$store.state.api + "selectMarkDialogWorks", params)
  909. .then(res => {
  910. let data = res.data[0];
  911. data.forEach(e => {
  912. if (e.rate) {
  913. let data2 = JSON.parse(e.rate);
  914. e.markSco = 0;
  915. let k = 0
  916. for (const key in data2) {
  917. if (data2[key] && key != "content" || data2[key] == "0" ) {
  918. e.markSco += data2[key] * 1;
  919. }else{
  920. k += 1
  921. }
  922. }
  923. if (k > 1) {
  924. e.markSco = null;
  925. }else{
  926. e.markSco = (e.markSco / this.scoTitList.length).toFixed(1);
  927. }
  928. } else {
  929. e.markSco = null;
  930. }
  931. });
  932. this.workList = data;
  933. data.forEach((e, index) => {
  934. if (e.userid == this.DgUid) {
  935. this.currentUid = e;
  936. if (
  937. this.currentUid.type == 3 ||
  938. this.currentUid.type == 10 ||
  939. this.currentUid.type == 13
  940. // this.currentUid.type == 15
  941. ) {
  942. this.currentUid.content = JSON.parse(e.content);
  943. this.cuScoCon = this.currentUid.content.text;
  944. }
  945. if (this.currentUid.type == 4) {
  946. let a = this.currentUid.content;
  947. let data = a.slice(a.lastIndexOf(".") + 1);
  948. this.cuScoCon = this.currentUid.content;
  949. if (data == "pdf") {
  950. this.ifPdf = 1;
  951. } else {
  952. this.ifPdf = 0;
  953. }
  954. }
  955. if (this.currentUid.type == 5) {
  956. this.playerOptions.sources[0].src = this.currentUid.content;
  957. }
  958. this.workId = e.id;
  959. this.appraise(e);
  960. }
  961. });
  962. let likeData = res.data[1];
  963. this.likeList = [];
  964. likeData.forEach(e => {
  965. if (e.workId == this.workId) {
  966. this.likeList.push(e);
  967. }
  968. });
  969. let commentData = res.data[2];
  970. this.commentList = [];
  971. commentData.forEach(e => {
  972. if (e.workId == this.workId) {
  973. this.commentList.push(e);
  974. }
  975. });
  976. this.vLoading = false;
  977. });
  978. },
  979. downloadFile(url) {
  980. var credentials = {
  981. accessKeyId: "AKIATLPEDU37QV5CHLMH",
  982. secretAccessKey: "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"
  983. }; //秘钥形式的登录上传
  984. window.AWS.config.update(credentials);
  985. window.AWS.config.region = "cn-northwest-1"; //设置区域
  986. let url2 = url;
  987. let _url2 = "";
  988. if (
  989. url2.indexOf("https://view.officeapps.live.com/op/view.aspx?src=") != -1
  990. ) {
  991. _url2 = url2.split(
  992. "https://view.officeapps.live.com/op/view.aspx?src="
  993. )[1];
  994. } else {
  995. _url2 = url2;
  996. }
  997. const loading2 = this.$loading.service({
  998. background: "rgba(255, 255, 255, 0.7)",
  999. target: document.body,
  1000. text: "文件加载中..."
  1001. });
  1002. var s3 = new window.AWS.S3({ params: { Bucket: "ccrb" } });
  1003. let name = decodeURIComponent(
  1004. _url2.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1]
  1005. );
  1006. var params = {
  1007. Bucket: "ccrb",
  1008. Key: name
  1009. };
  1010. s3.getObject(params, function(err, data) {
  1011. loading2.close();
  1012. if (err) console.log(err, err.stack);
  1013. // an error occurred
  1014. else {
  1015. let url = window.URL.createObjectURL(new Blob([data.Body]));
  1016. let a = document.createElement("a");
  1017. a.name = name;
  1018. a.href = url;
  1019. a.download = name;
  1020. a.click();
  1021. console.log(data);
  1022. } // sxuccessful response
  1023. });
  1024. },
  1025. // 处理任务的分展示
  1026. appraise(val) {
  1027. if (val.rate) {
  1028. let data = JSON.parse(val.rate);
  1029. this.scoTitList.forEach((e, index) => {
  1030. e.cog = null;
  1031. for (const key in data) {
  1032. let result = e.detail.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1033. let key2 = key.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
  1034. if (result.indexOf(key2) != -1) {
  1035. e.cog = data[key];
  1036. }
  1037. if ("content" == key) {
  1038. this.textarea = data[key];
  1039. }
  1040. }
  1041. });
  1042. } else {
  1043. this.scoTitList.forEach(e => {
  1044. e.cog = 0;
  1045. });
  1046. }
  1047. }
  1048. }
  1049. };
  1050. </script>
  1051. <style scoped>
  1052. .markDialog {
  1053. display: flex;
  1054. /* height: 100%; */
  1055. min-height: 600px;
  1056. height: 100%;
  1057. }
  1058. .left {
  1059. /* overflow: auto; */
  1060. width: 310px;
  1061. /* border-right: 1px rgba(231, 231, 231, 1) solid; */
  1062. padding: 20px 20px 0;
  1063. box-sizing: border-box;
  1064. padding-right: 10px;
  1065. display: flex;
  1066. flex-direction: column;
  1067. height: 100%;
  1068. }
  1069. .Rig {
  1070. flex: 1;
  1071. padding: 15px;
  1072. display: flex;
  1073. flex-direction: column;
  1074. }
  1075. .RigTop {
  1076. border-bottom: 1px rgba(231, 231, 231, 1) solid;
  1077. padding: 0px 0 15px;
  1078. }
  1079. .AreaCss {
  1080. position: relative;
  1081. margin-bottom: 5px;
  1082. }
  1083. .AreaCss >>> .el-textarea__inner {
  1084. min-height: 150px !important;
  1085. /* max-height: 150px; */
  1086. /* padding-bottom: 20px; */
  1087. }
  1088. .AreaBtn {
  1089. position: absolute;
  1090. width: calc(100% - 30px);
  1091. text-align: right;
  1092. background-color: #fff;
  1093. bottom: 11px;
  1094. right: 20px;
  1095. color: rgba(54, 129, 252, 1);
  1096. cursor: pointer;
  1097. }
  1098. .likeList {
  1099. width: 100%;
  1100. display: flex;
  1101. padding: 10px 0;
  1102. flex-wrap: wrap;
  1103. }
  1104. .likeList > div {
  1105. padding: 4px 0px;
  1106. background-color: rgba(243, 247, 253, 1);
  1107. margin-right: 10px;
  1108. width: calc((100% - 60px) / 7);
  1109. text-align: center;
  1110. text-overflow: ellipsis;
  1111. white-space: nowrap;
  1112. overflow: hidden;
  1113. margin-bottom: 10px;
  1114. }
  1115. .likeList > div:nth-child(7n) {
  1116. margin-right: 0px;
  1117. }
  1118. .commentListCss {
  1119. background-color: #fafafa;
  1120. padding: 25px 15px 0;
  1121. box-sizing: border-box;
  1122. margin-top: 10px;
  1123. border-radius: 5px;
  1124. }
  1125. .RigConTit {
  1126. width: 100%;
  1127. display: flex;
  1128. margin: 10px 0;
  1129. }
  1130. .RigConTit > div {
  1131. font-size: 14px;
  1132. color: rgba(0, 0, 0, 0.6);
  1133. padding: 8px;
  1134. cursor: pointer;
  1135. }
  1136. .RigConTitOn {
  1137. border-bottom: 3px solid rgba(54, 129, 252, 1);
  1138. }
  1139. .RigCon {
  1140. width: 100%;
  1141. overflow: auto;
  1142. flex: 1;
  1143. padding: 10px 0;
  1144. box-sizing: border-box;
  1145. /* background-color: aqua; */
  1146. }
  1147. .selBlock {
  1148. background-color: #f3f7fd !important;
  1149. border: 1px #68a0fc solid !important;
  1150. }
  1151. .cutStuBtn {
  1152. display: flex;
  1153. color: rgba(54, 129, 252, 1);
  1154. }
  1155. .cutStuBtn > div {
  1156. margin-left: 10px;
  1157. }
  1158. .scoreTit {
  1159. font-size: 16px;
  1160. font-weight: 600;
  1161. display: flex;
  1162. justify-content: space-between;
  1163. box-sizing: border-box;
  1164. color: rgba(0, 0, 0, 0.9);
  1165. }
  1166. .allD {
  1167. margin: 10px 0;
  1168. min-height: 60px;
  1169. background-color: #f3f7fd;
  1170. margin-left: 17px;
  1171. }
  1172. .scoreStar2 {
  1173. padding: 0 10px 10px;
  1174. height: 100%;
  1175. flex: 1;
  1176. color: rgba(54, 129, 252, 1);
  1177. cursor: pointer;
  1178. }
  1179. .scoreStar {
  1180. padding: 0px 10px 10px;
  1181. height: 100%;
  1182. flex: 1;
  1183. }
  1184. .scoreStarBack {
  1185. flex: 1;
  1186. display: flex;
  1187. justify-content: space-between;
  1188. padding-top: 10px;
  1189. position: relative;
  1190. }
  1191. /* .scoreStar > div:first-child > .scoreStarBack {
  1192. margin-top: 0;
  1193. } */
  1194. .ScrBtn {
  1195. display: flex;
  1196. justify-content: center;
  1197. align-items: center;
  1198. cursor: pointer;
  1199. padding: 2px 8px;
  1200. border-radius: 5px;
  1201. color: rgba(54, 129, 252, 1);
  1202. border: 1px rgba(54, 129, 252, 1) solid;
  1203. }
  1204. .worksAnswer {
  1205. color: #4078dd;
  1206. margin: 10px 0;
  1207. font-size: 16px;
  1208. display: flex;
  1209. align-items: center;
  1210. cursor: pointer;
  1211. }
  1212. .worksAnswer > img {
  1213. width: 100%;
  1214. height: 300px;
  1215. object-fit: contain;
  1216. margin: 0 auto;
  1217. display: block;
  1218. }
  1219. .briefTit {
  1220. width: 120px;
  1221. text-overflow: ellipsis;
  1222. overflow: hidden;
  1223. white-space: nowrap;
  1224. }
  1225. .briefTit > .titRoot{
  1226. position: absolute;
  1227. top: 0;
  1228. left: -27px;
  1229. transform: translate(0,10px);
  1230. }
  1231. .workListTit {
  1232. color: rgba(0, 0, 0, 0.6);
  1233. font-size: 12px;
  1234. font-weight: 400;
  1235. margin: 10px 0;
  1236. cursor: pointer;
  1237. }
  1238. .schPer2 {
  1239. padding: 10px;
  1240. box-sizing: border-box;
  1241. display: flex;
  1242. border-radius: 5px;
  1243. border: 1px solid rgba(240, 242, 245, 1);
  1244. /* margin-bottom: 10px; */
  1245. }
  1246. .schPer2 > img {
  1247. width: 45px;
  1248. height: 45px;
  1249. border-radius: 50%;
  1250. object-fit: cover;
  1251. }
  1252. .schPer {
  1253. padding: 10px;
  1254. box-sizing: border-box;
  1255. display: flex;
  1256. border-radius: 5px;
  1257. border: 1px solid rgba(240, 242, 245, 1);
  1258. margin-bottom: 10px;
  1259. }
  1260. .schPer > img {
  1261. width: 40px;
  1262. height: 40px;
  1263. border-radius: 50%;
  1264. object-fit: cover;
  1265. }
  1266. .con {
  1267. flex: 1;
  1268. display: flex;
  1269. flex-direction: column;
  1270. justify-content: space-between;
  1271. padding: 0 10px;
  1272. box-sizing: border-box;
  1273. }
  1274. .con > .tit {
  1275. width: 100%;
  1276. display: flex;
  1277. justify-content: space-between;
  1278. }
  1279. .con > .tit2 {
  1280. width: 100%;
  1281. display: flex;
  1282. margin-bottom: 15px;
  1283. }
  1284. .TitName {
  1285. width: 70px;
  1286. overflow: hidden;
  1287. text-overflow: ellipsis;
  1288. white-space: nowrap;
  1289. margin-right: 10px;
  1290. }
  1291. .worksAnswer {
  1292. color: #4078dd;
  1293. margin: 10px 0;
  1294. font-size: 16px;
  1295. position: relative;
  1296. }
  1297. .worksAnswer > img {
  1298. width: 500px;
  1299. height: 300px;
  1300. object-fit: contain;
  1301. margin: 0 auto;
  1302. display: block;
  1303. }
  1304. .cont {
  1305. overflow-wrap: break-word;
  1306. word-break: break-word;
  1307. white-space: pre-line;
  1308. }
  1309. .cont >>> table {
  1310. border-top: 1px solid #ccc;
  1311. border-left: 1px solid #ccc;
  1312. }
  1313. .cont >>> table td,
  1314. .cont >>> table th {
  1315. border-bottom: 1px solid #ccc;
  1316. border-right: 1px solid #ccc;
  1317. padding: 5px 10px;
  1318. max-width: 0px;
  1319. height: 30px;
  1320. vertical-align: baseline;
  1321. box-sizing: border-box;
  1322. }
  1323. .video-player >>> .video-js {
  1324. height: 100%;
  1325. }
  1326. </style>