liveProjectDetail.vue 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427
  1. <template>
  2. <div
  3. style="
  4. background: rgb(230, 234, 240);
  5. width: 100%;
  6. margin: 0;
  7. position: relate;
  8. height: 100%;
  9. "
  10. >
  11. <div class="blackBottom">
  12. <div
  13. style="
  14. display: flex;
  15. flex-direction: row;
  16. flex-wrap: nowrap;
  17. align-items: stretch;
  18. padding-left: 10px;
  19. "
  20. >
  21. <div class="logoLive">
  22. <img src="../assets/icon/logo.png" alt />
  23. </div>
  24. <div style="color: #fff; line-height: 45px; padding-left: 15px">展示课件</div>
  25. </div>
  26. </div>
  27. <div class="isNoOther">
  28. <div
  29. class="imgMiddle"
  30. :class="isBlock > 0 ? 'imghalf' : 'imgMiddle'"
  31. v-show="!full"
  32. >
  33. <pdf
  34. :pdfUrl="pdfUrl"
  35. style="width: 100%; height: 100%"
  36. :ppage="ppage"
  37. @getPageTotal="getPageTotal"
  38. ></pdf>
  39. </div>
  40. <div
  41. style="
  42. background: #d0d6e4;
  43. width: 40%;
  44. height: 100%;
  45. max-width: 40%;
  46. overflow: auto;
  47. "
  48. :class="{ fullStyle: full }"
  49. v-if="isBlock > 0"
  50. >
  51. <div
  52. style="
  53. background: #fff;
  54. width: 96%;
  55. margin: 10px auto;
  56. height: 96%;
  57. position: relative;
  58. "
  59. >
  60. <div
  61. style="color: #bfbfbf; padding: 15px 0 15px 25px; font-size: 20px"
  62. v-if="isBlock == 3"
  63. >
  64. 课堂评价
  65. </div>
  66. <div
  67. style="
  68. margin-left: 25px;
  69. border-bottom: 3px solid #2c83ee;
  70. width: 70px;
  71. padding-bottom: 3px;
  72. text-align: center;
  73. padding-top: 15px;
  74. "
  75. v-if="isBlock == 1"
  76. >
  77. 开始答题
  78. </div>
  79. <div class="answerBox" v-if="isBlock == 1">
  80. <div class="answerBox">
  81. <div
  82. style="
  83. display: flex;
  84. flex-direction: column;
  85. flex-wrap: wrap;
  86. align-items: center;
  87. justify-content: center;
  88. "
  89. v-for="item in 1"
  90. :key="item"
  91. >
  92. <div class="choose_style">
  93. <span
  94. @click="isChooseActive(1)"
  95. :class="typeC.indexOf(1) != -1 ? 'isChoose' : ''"
  96. >A</span
  97. >
  98. <span
  99. @click="isChooseActive(2)"
  100. :class="typeC.indexOf(2) != -1 ? 'isChoose' : ''"
  101. >B</span
  102. >
  103. <span
  104. @click="isChooseActive(3)"
  105. :class="typeC.indexOf(3) != -1 ? 'isChoose' : ''"
  106. >C</span
  107. >
  108. <span
  109. @click="isChooseActive(4)"
  110. :class="typeC.indexOf(4) != -1 ? 'isChoose' : ''"
  111. >D</span
  112. >
  113. </div>
  114. <el-button style="margin: 0 auto" @click="showMember(item)"
  115. >提交</el-button
  116. >
  117. </div>
  118. </div>
  119. </div>
  120. <div
  121. class="answerBox tools_box"
  122. v-if="isBlock == 4"
  123. style="padding: 10px 0 0 25px; width: 100%; max-width: 100%"
  124. >
  125. <div style="color: #d1d1d1; font-size: 24px">课堂实践</div>
  126. <div
  127. style="
  128. margin: 20px 0 20px 0;
  129. border-bottom: 4px solid #3e86f3;
  130. width: 75px;
  131. text-align: center;
  132. padding-bottom: 3px;
  133. "
  134. >
  135. 选择工具
  136. </div>
  137. <div
  138. style="
  139. display: flex;
  140. flex-direction: row;
  141. flex-wrap: wrap;
  142. width: 100%;
  143. justify-content: flex-start;
  144. align-items: center;
  145. "
  146. >
  147. <div
  148. v-if="tools[ppage - 1].tools && tools[ppage - 1].tools.indexOf(1) != -1"
  149. @click="checkTools(1)"
  150. class="toolCss"
  151. >
  152. <div class="toolImg">
  153. <img src="../assets/icon/secondToolList/whiteBoard.png" alt />
  154. <div>电子白板</div>
  155. </div>
  156. </div>
  157. <div
  158. v-if="tools[ppage - 1].tools && tools[ppage - 1].tools.indexOf(3) != -1"
  159. @click="checkTools(3)"
  160. class="toolCss"
  161. >
  162. <div class="toolImg">
  163. <img src="../assets/icon/secondToolList/mindMapping.png" alt />
  164. <div>思维导图</div>
  165. </div>
  166. </div>
  167. <div
  168. v-if="tools[ppage - 1].tools && tools[ppage - 1].tools.indexOf(4) != -1"
  169. @click="checkTools(4)"
  170. class="toolCss"
  171. >
  172. <div class="toolImg">
  173. <img src="../assets/icon/thirdToolList/ask.png" alt />
  174. <div>问卷调查</div>
  175. </div>
  176. </div>
  177. <div
  178. v-if="tools[ppage - 1].tools && tools[ppage - 1].tools.indexOf(6) != -1"
  179. @click="checkTools(6)"
  180. class="toolCss"
  181. >
  182. <div class="toolImg">
  183. <img src="../assets/icon/secondToolList/doc.png" alt />
  184. <div>协同文档</div>
  185. </div>
  186. </div>
  187. <div
  188. v-if="tools[ppage - 1].tools && tools[ppage - 1].tools.indexOf(7) != -1"
  189. @click="checkTools(7)"
  190. class="toolCss"
  191. >
  192. <div class="toolImg">
  193. <img src="../assets/icon/secondToolList/mindNetwork.png" alt />
  194. <div>思维网格</div>
  195. </div>
  196. </div>
  197. </div>
  198. </div>
  199. <div
  200. class="answerBox"
  201. style="height: 100%"
  202. v-if="isBlock == 2"
  203. ref="qrcodePicture"
  204. >
  205. <div style="height: 100%; width: 100%">
  206. <div v-if="toolCount == 1" class="tools_child_box">
  207. <div class="tools_title">
  208. <span>电子白板</span>
  209. <div>
  210. <img src="../assets/full.png" class="full" @click="fullTools" />
  211. </div>
  212. </div>
  213. <iframe
  214. style="width: 100%; height: 100%; border: none"
  215. src="https://iwb.cocorobo.cn/"
  216. ref="whiteBoard"
  217. ></iframe>
  218. </div>
  219. <div v-if="toolCount == 3" class="tools_child_box">
  220. <div class="tools_title">
  221. <span>思维导图</span>
  222. <div>
  223. <img src="../assets/full.png" class="full" @click="fullTools" />
  224. </div>
  225. </div>
  226. <iframe
  227. style="width: 100%; height: 100%; border: none"
  228. src="https://cloud.cocorobo.cn/kityminder-editor/dist/index.html"
  229. ref="mind"
  230. ></iframe>
  231. </div>
  232. <div v-if="toolCount == 7" class="tools_child_box">
  233. <div class="tools_title">
  234. <span>思维网格</span>
  235. <div>
  236. <img src="../assets/full.png" class="full" @click="fullTools" />
  237. </div>
  238. </div>
  239. <iframe
  240. style="width: 100%; height: 100%; border: none"
  241. src="https://pbl.cocorobo.cn/pbl-teacher-table/dist/#/Grid"
  242. ref="grid"
  243. ></iframe>
  244. </div>
  245. <div
  246. id="shishi_loading"
  247. style="
  248. width: 100%;
  249. height: 100%;
  250. background: #0000008f;
  251. position: absolute;
  252. top: 0;
  253. left: 0;
  254. z-index: 99999999999999;
  255. display: none;
  256. justify-content: center;
  257. align-items: center;
  258. "
  259. >
  260. <div
  261. style="
  262. color: #fff;
  263. padding: 15px;
  264. background: #00000070;
  265. border-radius: 5px;
  266. font-size: 18px;
  267. display: flex;
  268. align-items: center;
  269. "
  270. >
  271. <img
  272. src="https://pbl.cocorobo.cn/pbl-student-table/dist/js/loading.gif"
  273. alt
  274. style="width: 26px; margin-right: 10px"
  275. />
  276. <span>上传中...</span>
  277. </div>
  278. </div>
  279. <div class="nextStepBox">
  280. <div class="nextStepOne" @click="isBlock = 4">返回</div>
  281. </div>
  282. <div
  283. class="nextStepOne"
  284. style="float: right"
  285. @click="getImg"
  286. v-if="toolCount == 1 || toolCount == 3 || toolCount == 7"
  287. >
  288. 截图
  289. </div>
  290. <div
  291. class="nextStepOne"
  292. style="float: right"
  293. @click="addImg($event)"
  294. v-if="toolCount == 1 || toolCount == 3 || toolCount == 7"
  295. >
  296. 上传文件
  297. <input
  298. type="file"
  299. accept="image/png, image/gif, image/jpeg"
  300. style="display: none"
  301. @change="beforeUpload1($event, 1)"
  302. />
  303. </div>
  304. </div>
  305. </div>
  306. <div class="answerBox" v-if="isBlock == 3" style="padding: 0 0 0 25px">
  307. <div>
  308. <div class="score_box">
  309. <span>自我评价</span>
  310. <el-rate v-model="rateList.ca"></el-rate>
  311. </div>
  312. <div class="score_box">
  313. <span>他人评价</span>
  314. <el-rate v-model="rateList.sia"></el-rate>
  315. </div>
  316. </div>
  317. <div>
  318. <div style="padding-bottom: 15px; sont-size: 14px">备注</div>
  319. <div class="bz">
  320. <el-input
  321. type="textarea"
  322. placeholder="请输入备注…"
  323. :rows="6"
  324. resize="none"
  325. v-model="rateList.content"
  326. ></el-input>
  327. </div>
  328. </div>
  329. <span
  330. slot="footer"
  331. class="dialog-footer sztFooter"
  332. style="padding: 0 0 30px 0px; position: absolute; right: 20px; bottom: 0"
  333. >
  334. <el-button @click="isBlock = 0">取消</el-button>
  335. <el-button type="primary" @click="dialogVisible = true">确定</el-button>
  336. </span>
  337. </div>
  338. </div>
  339. </div>
  340. </div>
  341. <div class="blackBottomB"></div>
  342. <div v-if="proVisible" class="mask">
  343. <div class="progressBox">
  344. <div class="lbox"><img src="../assets/loading.gif" />上传中,请稍后</div>
  345. <el-progress
  346. :text-inside="true"
  347. :stroke-width="20"
  348. :percentage="progress"
  349. style="width: 80%"
  350. ></el-progress>
  351. </div>
  352. </div>
  353. <el-dialog
  354. :visible.sync="dialogVisible"
  355. :append-to-body="true"
  356. width="500px"
  357. :before-close="handleClose"
  358. class="dialog_diy"
  359. >
  360. <div style="text-align: center; padding: 20px 0 50px 0; font-size: 18px">
  361. 提交成功
  362. </div>
  363. <div
  364. style="
  365. width: 200px;
  366. background: #4d8ae0;
  367. height: 35px;
  368. margin: 0 auto;
  369. text-align: center;
  370. line-height: 35px;
  371. color: #fff;
  372. border-radius: 5px;
  373. cursor: pointer;
  374. "
  375. @click="dialogVisible = false"
  376. >
  377. 确定
  378. </div>
  379. </el-dialog>
  380. <div v-html="iframeInnerHtml" ref="iframeIh" class="iframeBox"></div>
  381. </div>
  382. </template>
  383. <script>
  384. import pdf from "./components/pdf";
  385. import html2canvas from "html2canvas";
  386. export default {
  387. components: {
  388. pdf,
  389. },
  390. data() {
  391. return {
  392. iframeInnerHtml: "",
  393. pdfUrl:
  394. "https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/%E4%B8%8A%E8%AF%BE%E8%AF%BE%E4%BB%B6---%E4%BA%94%E4%B8%8Bintroduce%20a%20festival%20%28Final%20%29_202208231345451661233676307.pdf",
  395. ppage: 2,
  396. full: false,
  397. pageTotal: 0,
  398. howTools: 0,
  399. toolsList: [],
  400. timer: null,
  401. isLoading: false,
  402. formLabelWidth: "100px",
  403. userid: this.$route.query.userid,
  404. cid: this.$route.query.courseId,
  405. oid: this.$route.query.oid,
  406. mr: require("../assets/kc1.png"),
  407. timu: [],
  408. dialogVisible: false,
  409. answerBox: "",
  410. isNoHomeWork: false,
  411. answer: [
  412. { name: "A.1568" },
  413. { name: "B.720" },
  414. { name: "C.1728" },
  415. { name: "D.480" },
  416. ],
  417. steps: 0,
  418. isBlock: 0,
  419. isNext: false,
  420. isAnswer: false,
  421. upload: [
  422. {
  423. upImg: [],
  424. upVedio: [],
  425. upIntro: "",
  426. },
  427. ],
  428. noneBtnImg: false,
  429. proVisible: false,
  430. progress: 0,
  431. typeC: [],
  432. toolCount: 0,
  433. tools: [
  434. "",
  435. "",
  436. "", //选择题
  437. "", //倒计时
  438. "", //问答题
  439. "", //问答题
  440. "", //思维导图/电子白板
  441. "", //选人回答
  442. "", //倒计时、分小组
  443. "", //思维导图/电子白板/思维网格
  444. "", //查看作业
  445. //1、电子白板 2、便签 3、思维导图 4、问卷调查 5、量规评分 6、协同文档 7、思维网格 8、素材库 9、选择题 10、倒计时 11、问答题 12、选人回答 13、分小组 14、老师对提交作业进行评价
  446. ],
  447. rateList: {
  448. ca: 0,
  449. sia: 0,
  450. content: "",
  451. },
  452. imgUrl: "",
  453. imgFile: "",
  454. imgFileUp: [],
  455. };
  456. },
  457. methods: {
  458. change(val) {
  459. console.log(val);
  460. },
  461. goTo(path) {
  462. this.$router.push(path);
  463. },
  464. tableRowClassName({ row, rowIndex }) {
  465. if ((rowIndex + 1) % 2 === 0) {
  466. return "even_row";
  467. } else {
  468. return "";
  469. }
  470. },
  471. jump(cid) {
  472. window.parent.postMessage({ cid: cid, type: "1" }, "*");
  473. },
  474. handleCurrentChange(val) {
  475. // console.log(`当前页: ${val}`);
  476. this.page = val;
  477. },
  478. init() {},
  479. handleClose(done) {
  480. done();
  481. },
  482. handleRemove(file, fileList) {
  483. console.log(file, fileList);
  484. },
  485. onExceed() {
  486. this.$message.error("课程海报仅支持上传一张,请删除后再进行上传");
  487. },
  488. //uuid生成
  489. guid() {
  490. return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
  491. var r = (Math.random() * 16) | 0,
  492. v = c == "x" ? r : (r & 0x3) | 0x8;
  493. return v.toString(16);
  494. });
  495. },
  496. time() {
  497. if (!this.now) {
  498. this.now = new Date().getTime();
  499. return true;
  500. } else {
  501. let time = new Date().getTime();
  502. if (time - this.now > 3000) {
  503. this.now = time;
  504. return true;
  505. } else {
  506. return false;
  507. }
  508. }
  509. },
  510. // answerWork() {
  511. // this.steps++;
  512. // },
  513. addTool(t) {
  514. if (t == 1) {
  515. window.parent.postMessage({ tools: "1" }, "*");
  516. } else if (t == 3) {
  517. window.parent.postMessage({ tools: "3" }, "*");
  518. } else if (t == 7) {
  519. window.parent.postMessage({ tools: "7" }, "*");
  520. }
  521. },
  522. answerQue() {
  523. this.dialogVisible = true;
  524. },
  525. isChooseActive(t) {
  526. if (this.isAnswer == true) {
  527. return;
  528. } else {
  529. if (this.typeC.length == 0) {
  530. this.typeC.push(t);
  531. } else {
  532. if (this.typeC.indexOf(t) != -1) {
  533. this.typeC.splice(this.typeC.indexOf(t), 1);
  534. } else {
  535. this.typeC.push(t);
  536. }
  537. }
  538. }
  539. },
  540. showMember(i) {
  541. if (this.typeC.length > 0) {
  542. // this.steps = 2;
  543. this.isAnswer = true;
  544. this.dialogVisible = true;
  545. } else {
  546. this.$message.error("至少选择一个答案!");
  547. }
  548. },
  549. clean(type) {
  550. if (type == 1) {
  551. this.upload[0].upImg.splice(0, 1);
  552. } else if (type == 2) {
  553. this.upload[0].upVedio.splice(0, 1);
  554. }
  555. },
  556. addImg(e) {
  557. var el = e.currentTarget;
  558. el.getElementsByTagName("input")[0].click();
  559. },
  560. imgChange(file, fileList, type) {
  561. if (type == 1) {
  562. var _tmp = this.upload[0].upImg;
  563. } else if (type == 2) {
  564. var _tmp = this.upload[0].upVedio;
  565. } else if (type == 100) {
  566. var _tmp = this.imgFileUp;
  567. }
  568. this.noneBtnImg = _tmp.length >= 1;
  569. },
  570. beforeUpload1(event, type) {
  571. var file = event.target.files[0];
  572. var credentials = {
  573. accessKeyId: "AKIATLPEDU37QV5CHLMH",
  574. secretAccessKey: "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",
  575. }; //秘钥形式的登录上传
  576. window.AWS.config.update(credentials);
  577. window.AWS.config.region = "cn-northwest-1"; //设置区域
  578. var bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
  579. var _this = this;
  580. _this.progress = 0;
  581. _this.proVisible = true;
  582. if (file) {
  583. var params = {
  584. Key:
  585. file.name.split(".")[0] +
  586. new Date().getTime() +
  587. "." +
  588. file.name.split(".")[1],
  589. ContentType: file.type,
  590. Body: file,
  591. "Access-Control-Allow-Credentials": "*",
  592. ACL: "public-read",
  593. }; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
  594. var options = {
  595. partSize: 2048 * 1024 * 1024,
  596. queueSize: 2,
  597. leavePartsOnError: true,
  598. };
  599. bucket
  600. .upload(params, options)
  601. .on("httpUploadProgress", function (evt) {
  602. //这里可以写进度条
  603. // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
  604. _this.progress = parseInt((evt.loaded * 80) / evt.total);
  605. })
  606. .send(function (err, data) {
  607. _this.progress = 100;
  608. setTimeout(() => {
  609. _this.proVisible = false;
  610. }, 1000);
  611. if (err) {
  612. var a = _this.$refs.upload1.uploadFiles;
  613. a.splice(a.length - 1, a.length);
  614. _this.$message.error("上传失败");
  615. } else {
  616. if (type == 1) {
  617. _this.upload[0].upImg.push({
  618. name: file.name,
  619. url: data.Location,
  620. uid: file.uid,
  621. });
  622. _this.imgChange(null, null, type);
  623. _this.addSWork();
  624. } else if (type == 2) {
  625. _this.upload[0].upVedio.push({
  626. name: file.name,
  627. url: data.Location,
  628. uid: file.uid,
  629. });
  630. _this.imgChange(null, null, type);
  631. }
  632. console.log(data.Location);
  633. }
  634. });
  635. }
  636. },
  637. beforeUpload2(event) {
  638. var file = event;
  639. var credentials = {
  640. accessKeyId: "AKIATLPEDU37QV5CHLMH",
  641. secretAccessKey: "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",
  642. }; //秘钥形式的登录上传
  643. window.AWS.config.update(credentials);
  644. window.AWS.config.region = "cn-northwest-1"; //设置区域
  645. var bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
  646. var _this = this;
  647. _this.progress = 0;
  648. _this.proVisible = true;
  649. if (file) {
  650. var params = {
  651. Key: file.name.split(".")[0] + new Date().getTime() + "." + "png",
  652. ContentType: file.type,
  653. Body: file,
  654. "Access-Control-Allow-Credentials": "*",
  655. ACL: "public-read",
  656. }; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
  657. var options = {
  658. partSize: 2048 * 1024 * 1024,
  659. queueSize: 2,
  660. leavePartsOnError: true,
  661. };
  662. bucket
  663. .upload(params, options)
  664. .on("httpUploadProgress", function (evt) {
  665. //这里可以写进度条
  666. // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
  667. _this.progress = parseInt((evt.loaded * 80) / evt.total);
  668. })
  669. .send(function (err, data) {
  670. _this.progress = 100;
  671. setTimeout(() => {
  672. _this.proVisible = false;
  673. }, 1000);
  674. if (err) {
  675. var a = _this.$refs.upload1.uploadFiles;
  676. a.splice(a.length - 1, a.length);
  677. _this.$message.error("上传失败");
  678. } else {
  679. _this.imgFileUp.push({
  680. name: file.name,
  681. url: data.Location,
  682. uid: file.uid,
  683. });
  684. _this.imgChange(null, null, type);
  685. console.log(data.Location);
  686. }
  687. });
  688. }
  689. },
  690. addWork() {
  691. if (this.upload[0].upImg.length == 0) {
  692. this.$message.error("请上传图片");
  693. return;
  694. }
  695. // else if (this.upload[0].upVedio.length == 0) {
  696. // this.$message.error("请上传视频");
  697. // return;
  698. // }
  699. else if (this.upload[0].upIntro == "") {
  700. this.$message.error("请填写简要描述");
  701. return;
  702. }
  703. if (this.isNoHomeWork == true) {
  704. this.$confirm(
  705. "您已经提交了该作业了,如果您再提交将覆盖上次提交的作业!",
  706. "提示",
  707. {
  708. confirmButtonText: "确定",
  709. cancelButtonText: "取消",
  710. type: "warning",
  711. }
  712. )
  713. .then(() => {
  714. this.addSWork();
  715. })
  716. .catch(() => {});
  717. } else {
  718. this.addSWork();
  719. }
  720. },
  721. addSWork() {
  722. let params = {
  723. uid: this.userid,
  724. cid: this.cid,
  725. upload: JSON.stringify(this.upload),
  726. // upload: JSON.stringify(this.imgFileUp),
  727. };
  728. this.ajax
  729. .get(this.$store.state.api + "insertSWork", params)
  730. .then((res) => {
  731. // this.isNoHomeWork = true;
  732. // this.dialogVisible = true;
  733. // this.selectSWork(); // this.upload = res.data[0][0].upload;
  734. this.$message({
  735. message: "截图上传成功",
  736. type: "success",
  737. });
  738. })
  739. .catch((err) => {
  740. this.$message.error("截图上传失败");
  741. console.error(err);
  742. });
  743. },
  744. selectSWork() {
  745. let params = {
  746. uid: this.userid,
  747. cid: this.cid,
  748. };
  749. this.ajax
  750. .get(this.$store.state.api + "selectSWork", params)
  751. .then((res) => {
  752. if (res.data[0].length > 0) {
  753. this.isNoHomeWork = true;
  754. }
  755. })
  756. .catch((err) => {
  757. this.$message.error("暂无作业");
  758. console.error(err);
  759. });
  760. },
  761. getImg() {
  762. var iframeHtml;
  763. let iframeBody;
  764. if (this.toolCount == 1) {
  765. iframeHtml = this.$refs.whiteBoard;
  766. } else if (this.toolCount == 3) {
  767. iframeHtml = this.$refs.mind;
  768. } else if (this.toolCount == 7) {
  769. iframeHtml = this.$refs.grid;
  770. }
  771. iframeBody = iframeHtml.contentWindow.document.body;
  772. this.iframeInnerHtml = iframeBody.innerHTML;
  773. var iframeIh = this.$refs.iframeIh;
  774. iframeIh.innerHTML = this.iframeInnerHtml;
  775. this.$forceUpdate();
  776. console.log(iframeIh);
  777. // var iframeHtml = this.$refs.whiteBoard;
  778. document.getElementById("shishi_loading").style.display = "flex";
  779. var _ajs = iframeHtml.contentWindow.document.createElement("script");
  780. _ajs.type = "text/javascript";
  781. _ajs.innerHTML =
  782. 'var _js = document.createElement("script");\n' +
  783. '_js.type="text/javascript";\n' +
  784. '_js.src="https://html2canvas.hertzen.com/dist/html2canvas.min.js";\n' +
  785. "_js.onload = function(){\n" +
  786. ' var a = document.getElementsByTagName("img")\n' +
  787. ' for(var i = 0;i<a.length;i++){a[i].crossOrigin="anonymous"}\n' +
  788. " html2canvas(document.body).then(canvas => {\n" +
  789. ' var base64Url = canvas.toDataURL("image/png");\n' +
  790. 'var base64 = "<img src=" + base64Url + " />"\n' +
  791. 'var file = dataURLtoFile_shishi(base64Url, "截图")\n' +
  792. "beforeUpload_shishi(file," +
  793. "'" +
  794. this.userid +
  795. "'" +
  796. ", " +
  797. "'" +
  798. this.cid +
  799. "'" +
  800. ")\n" +
  801. " });\n" +
  802. "}\n" +
  803. "document.head.appendChild(_js);\n";
  804. iframeHtml.contentWindow.document.head.appendChild(_ajs);
  805. // iframeHtml.contentWindow.jietu_shishi(this.userid, this.cid);
  806. // 第一个参数是需要生成截图的元素,第二个是自己需要配置的参数,宽高等
  807. // html2canvas(iframeBody, {
  808. // allowTaint: true,
  809. // backgroundColor: null, //画出来的图片有白色的边框,不要可设置背景为透明色(null)
  810. // useCORS: true, //支持图片跨域
  811. // scale: 1, //设置放大的倍数
  812. // }).then((canvas) => {
  813. // // 把生成的base64位图片上传到服务器,生成在线图片地址
  814. // let url = canvas.toDataURL("image/png"); // toDataURL: 图片格式转成 base64
  815. // this.imgUrl = url; //将图片下载到本地
  816. // let a = document.createElement("a"); // 生成一个a元素
  817. // let event = new MouseEvent("click"); // 创建一个单击事件
  818. // a.download = "作业"; // 设置图片名称没有设置则为默认
  819. // a.href = this.imgUrl; // 将生成的URL设置为a.href属性
  820. // a.dispatchEvent(event); // 触发a的单击事件
  821. // let file = this.dataURLtoFile(url, "作业");
  822. // this.imgFile = file;
  823. // this.beforeUpload2(this.imgFile);
  824. // this.addSWork();
  825. // console.log(this.imgFile);
  826. // });
  827. },
  828. dataURLtoFile(dataurl, filename) {
  829. let arr = dataurl.split(","),
  830. mime = arr[0].match(/:(.*?);/)[1],
  831. bstr = atob(arr[1]),
  832. n = bstr.length,
  833. u8arr = new Uint8Array(n);
  834. while (n--) {
  835. u8arr[n] = bstr.charCodeAt(n);
  836. }
  837. return new File([u8arr], filename, { type: mime });
  838. },
  839. search() {},
  840. howPage(page) {
  841. if (!this.pageTotal) {
  842. return;
  843. }
  844. if (page == this.pageTotal) {
  845. this.isBlock = 3;
  846. } else {
  847. this.isBlock = 0;
  848. if (this.tools[page - 1].tools && this.tools[page - 1].tools.indexOf(9) != -1) {
  849. this.isBlock = 1;
  850. }
  851. // if (this.ppage > 3) {
  852. // this.isBlock = 2;
  853. // }
  854. this.full = false;
  855. this.howTools = 0;
  856. this.toolCount = 0;
  857. if (
  858. this.tools[page - 1].tools &&
  859. (this.tools[page - 1].tools[0] == 14 || this.tools[page - 1].tools[0] == 12)
  860. ) {
  861. this.isBlock = 0;
  862. }
  863. if (
  864. this.tools[page - 1].tools &&
  865. (this.tools[page - 1].tools.indexOf(1) != -1 ||
  866. this.tools[page - 1].tools.indexOf(3) != -1 ||
  867. this.tools[page - 1].tools.indexOf(7) != -1)
  868. ) {
  869. this.isBlock = 4;
  870. }
  871. if (this.tools[page - 1].tools && this.tools[page - 1].tools.length > 1) {
  872. this.isBlock = 4;
  873. }
  874. if (this.tools[page - 1].tools && !this.tools[page - 1].tools.length) {
  875. this.isBlock = 0;
  876. }
  877. }
  878. },
  879. setPage() {
  880. this.ajax
  881. .get(this.$store.state.api + "selectPptPage", "")
  882. .then((res) => {
  883. if (res.data[0].length > 0) {
  884. if (this.ppage == res.data[0][0].page) {
  885. return;
  886. } else {
  887. this.ppage = res.data[0][0].page;
  888. console.log(1);
  889. this.howPage(this.ppage);
  890. }
  891. }
  892. })
  893. .catch((err) => {
  894. // this.$message.error("查询失败");
  895. console.error(err);
  896. });
  897. },
  898. getPageTotal(total) {
  899. this.pageTotal = total;
  900. },
  901. fullTools() {
  902. this.full = !this.full;
  903. },
  904. checkTools(tcount) {
  905. this.isBlock = 2;
  906. this.toolCount = tcount;
  907. let _this = this;
  908. _this.$nextTick(() => {
  909. setTimeout(() => {
  910. const script1 = document.createElement("script");
  911. script1.type = "text/javascript";
  912. script1.src =
  913. "https://pbl.cocorobo.cn/pbl-student-table/dist/jquery-3.6.0.min.js";
  914. const script2 = document.createElement("script");
  915. script2.type = "text/javascript";
  916. script2.src =
  917. "https://pbl.cocorobo.cn/pbl-student-table/dist/aws-sdk-2.235.1.min.js";
  918. const script3 = document.createElement("script");
  919. script3.type = "text/javascript";
  920. script3.src = "https://html2canvas.hertzen.com/dist/html2canvas.min.js";
  921. const script4 = document.createElement("script");
  922. script4.type = "text/javascript";
  923. script4.src = "https://pbl.cocorobo.cn/pbl-student-table/dist/jietu.js";
  924. if (_this.toolCount == 1) {
  925. _this.$refs.whiteBoard.onload = () => {
  926. _this.$refs.whiteBoard.contentWindow.document.body.appendChild(script1);
  927. _this.$refs.whiteBoard.contentWindow.document.body.appendChild(script2);
  928. // _this.$refs.whiteBoard.contentWindow.document.body.appendChild(script3);
  929. _this.$refs.whiteBoard.contentWindow.document.body.appendChild(script4);
  930. };
  931. } else if (_this.toolCount == 3) {
  932. _this.$refs.mind.onload = () => {
  933. _this.$refs.mind.contentWindow.document.body.appendChild(script1);
  934. _this.$refs.mind.contentWindow.document.body.appendChild(script2);
  935. // _this.$refs.mind.contentWindow.document.body.appendChild(script3);
  936. _this.$refs.mind.contentWindow.document.body.appendChild(script4);
  937. };
  938. } else if (_this.toolCount == 7) {
  939. _this.$refs.grid.onload = () => {
  940. _this.$refs.grid.contentWindow.document.body.appendChild(script1);
  941. _this.$refs.grid.contentWindow.document.body.appendChild(script2);
  942. // _this.$refs.grid.contentWindow.document.body.appendChild(script3);
  943. _this.$refs.grid.contentWindow.document.body.appendChild(script4);
  944. };
  945. }
  946. }, 0);
  947. });
  948. },
  949. },
  950. beforeDestroy() {
  951. clearInterval(this.timer);
  952. this.timer = null;
  953. // window.removeEventListener("message");
  954. },
  955. created() {
  956. // this.selectSWork();
  957. let _this = this;
  958. this.timer = setInterval(() => {
  959. _this.setPage();
  960. }, 1000);
  961. // window.addEventListener("message", function (e) {
  962. // // 监听 message 事件
  963. // if (e.data.type && e.data.type == "shishi_canvas") {
  964. // console.log(e.data.data);
  965. // }
  966. // });
  967. },
  968. };
  969. </script>
  970. <style scoped>
  971. .dialog_diy >>> .el-dialog__header {
  972. background: #3d67bc !important;
  973. padding: 15px 20px;
  974. }
  975. .dialog_diy >>> .el-dialog__title {
  976. color: #fff;
  977. }
  978. .dialog_diy >>> .el-dialog__headerbtn {
  979. top: 9px;
  980. }
  981. .dialog_diy >>> .el-dialog__headerbtn .el-dialog__close {
  982. color: #fff;
  983. }
  984. .dialog_diy >>> .el-dialog__headerbtn .el-dialog__close:hover {
  985. color: #fff;
  986. }
  987. .blackBottom {
  988. background: rgb(0, 0, 0);
  989. height: 45px;
  990. width: 100%;
  991. display: flex;
  992. flex-direction: row;
  993. flex-wrap: nowrap;
  994. align-items: center;
  995. justify-content: space-between;
  996. }
  997. .imgMiddle {
  998. width: 100%;
  999. }
  1000. .imgMiddle > img,
  1001. .imghalf > img,
  1002. .szt > img,
  1003. .uploadImg > img,
  1004. .uploadVedio > img,
  1005. .uploadImgPic > img,
  1006. .logoLive > img,
  1007. .close > img,
  1008. .deleteWord > img {
  1009. width: 100%;
  1010. height: 100%;
  1011. }
  1012. .deleteWord {
  1013. width: 22px !important;
  1014. height: 22px;
  1015. position: absolute;
  1016. right: -5px;
  1017. top: -5px;
  1018. cursor: pointer;
  1019. }
  1020. .blackBottomB {
  1021. position: absolute;
  1022. bottom: 0px;
  1023. left: 0px;
  1024. display: flex;
  1025. flex-direction: row;
  1026. flex-wrap: wrap;
  1027. align-content: center;
  1028. justify-content: flex-start;
  1029. align-items: center;
  1030. background: rgb(0, 0, 0);
  1031. height: 45px;
  1032. width: 100%;
  1033. }
  1034. .blackBottomB > div:nth-child(1) {
  1035. margin-left: 10px !important;
  1036. }
  1037. .blackButton {
  1038. color: #fff;
  1039. background: #066ebe;
  1040. width: 100px;
  1041. height: 30px;
  1042. line-height: 30px;
  1043. text-align: center;
  1044. margin: 0 25px;
  1045. border-radius: 5px;
  1046. font-size: 15px;
  1047. cursor: pointer;
  1048. }
  1049. .isNoOther {
  1050. width: 100%;
  1051. display: flex;
  1052. height: calc(100% - 90px);
  1053. }
  1054. .imghalf {
  1055. width: 60% !important;
  1056. }
  1057. .answerBox {
  1058. padding: 25px;
  1059. overflow: auto;
  1060. height: 70%;
  1061. box-sizing: border-box;
  1062. }
  1063. .answerTimuBox {
  1064. display: flex;
  1065. flex-direction: row;
  1066. flex-wrap: nowrap;
  1067. align-items: center;
  1068. justify-content: space-between;
  1069. padding-bottom: 15px;
  1070. }
  1071. .memberBox {
  1072. display: flex;
  1073. flex-direction: row;
  1074. flex-wrap: wrap;
  1075. align-items: center;
  1076. }
  1077. .memberBox > div {
  1078. background: rgb(240, 185, 204);
  1079. width: 120px;
  1080. color: #fff;
  1081. height: 40px;
  1082. text-align: center;
  1083. line-height: 40px;
  1084. border-radius: 5px;
  1085. margin: 0 15px 15px 0;
  1086. cursor: pointer;
  1087. }
  1088. .viewSta {
  1089. background: rgb(97, 97, 97);
  1090. color: #bebebe;
  1091. margin: 20% auto 20px;
  1092. width: 300px;
  1093. height: 40px;
  1094. text-align: center;
  1095. line-height: 40px;
  1096. border-radius: 5px;
  1097. cursor: pointer;
  1098. }
  1099. .szt {
  1100. width: 450px;
  1101. margin: 20px auto;
  1102. }
  1103. .sztFooter {
  1104. padding: 20px 10px 50px 0;
  1105. display: flex;
  1106. flex-direction: row;
  1107. flex-wrap: nowrap;
  1108. justify-content: flex-end;
  1109. align-items: center;
  1110. }
  1111. .timuButton {
  1112. background: #649ef2;
  1113. width: 75px;
  1114. height: 27px;
  1115. line-height: 27px;
  1116. text-align: center;
  1117. border-radius: 5px;
  1118. color: #fff;
  1119. margin-right: 20px;
  1120. display: inline-block;
  1121. }
  1122. .anserBoxCss {
  1123. margin: 30px 0 20px 0;
  1124. }
  1125. .anserBoxCss >>> .el-radio__label {
  1126. font-size: 18px;
  1127. }
  1128. .anserBoxCss >>> .el-radio__inner {
  1129. border-radius: 0px !important;
  1130. }
  1131. .nextStepBox {
  1132. display: flex;
  1133. justify-content: center;
  1134. margin-top: 10px;
  1135. }
  1136. .nextStepOne {
  1137. background: #6b92c9;
  1138. color: #fff;
  1139. width: 110px;
  1140. text-align: center;
  1141. height: 35px;
  1142. line-height: 35px;
  1143. font-size: 14px;
  1144. border-radius: 5px;
  1145. cursor: pointer;
  1146. }
  1147. .nextStepOne,
  1148. .nextStepOne {
  1149. margin-left: 10px;
  1150. }
  1151. .toolList {
  1152. display: flex;
  1153. flex-direction: row;
  1154. flex-wrap: wrap;
  1155. justify-content: flex-start;
  1156. align-items: center;
  1157. }
  1158. .tools {
  1159. display: flex;
  1160. flex-direction: column;
  1161. align-items: center;
  1162. margin-right: 20px;
  1163. }
  1164. .tools > div:nth-child(1) {
  1165. width: 60px;
  1166. }
  1167. .tools > div:nth-child(1) > img {
  1168. width: 100%;
  1169. height: 100%;
  1170. }
  1171. .uploadImg {
  1172. width: 100px;
  1173. margin: 10px 0 0 15px;
  1174. cursor: pointer;
  1175. }
  1176. .upImg {
  1177. display: flex;
  1178. flex-direction: column;
  1179. flex-wrap: nowrap;
  1180. align-items: center;
  1181. justify-content: center;
  1182. color: rgb(182, 182, 182);
  1183. font-size: 20px;
  1184. }
  1185. .binfo_input {
  1186. font: inherit;
  1187. color: currentColor;
  1188. width: 100%;
  1189. margin: 0;
  1190. padding: 15px 14px;
  1191. display: block;
  1192. min-width: 0;
  1193. outline: none;
  1194. box-sizing: content-box;
  1195. background: none;
  1196. -webkit-tap-highlight-color: transparent;
  1197. border: 1px solid rgba(0, 0, 0, 0.23);
  1198. border-radius: 4px;
  1199. box-sizing: border-box;
  1200. resize: none;
  1201. }
  1202. .binfo_input:focus-visible {
  1203. border: 1px solid rgba(61, 103, 188);
  1204. }
  1205. .hengCss {
  1206. display: flex;
  1207. flex-direction: row;
  1208. flex-wrap: wrap;
  1209. align-items: center;
  1210. padding: 5px 0 0 20px;
  1211. }
  1212. .uploadImgPic {
  1213. width: 100px;
  1214. height: 100px;
  1215. position: relative;
  1216. margin: 0 20px 0 0;
  1217. }
  1218. .uploadImgPic > div {
  1219. width: 100px;
  1220. white-space: nowrap;
  1221. overflow: hidden;
  1222. text-overflow: ellipsis;
  1223. }
  1224. .mask {
  1225. background-color: rgba(0, 0, 0, 0);
  1226. position: fixed;
  1227. top: 0;
  1228. left: 0;
  1229. width: 100%;
  1230. height: 100%;
  1231. z-index: 20000;
  1232. display: flex;
  1233. align-items: center;
  1234. justify-content: center;
  1235. }
  1236. .progressBox {
  1237. width: 500px;
  1238. height: 180px;
  1239. background: #fff;
  1240. border-radius: 10px;
  1241. box-shadow: 0 0 6px 1px #bfbfbf;
  1242. display: flex;
  1243. align-items: center;
  1244. justify-content: center;
  1245. flex-direction: column;
  1246. }
  1247. .progressBox .lbox {
  1248. height: 100px;
  1249. font-size: 19px;
  1250. display: flex;
  1251. align-items: center;
  1252. }
  1253. .progressBox .lbox img {
  1254. width: 40px;
  1255. margin-right: 20px;
  1256. }
  1257. .progressBox >>> .el-progress-bar__outer {
  1258. background-color: #d1dfff !important;
  1259. }
  1260. .progressBox .lbox {
  1261. height: 100px;
  1262. font-size: 19px;
  1263. display: flex;
  1264. align-items: center;
  1265. }
  1266. .progressBox .lbox img {
  1267. width: 40px;
  1268. margin-right: 20px;
  1269. }
  1270. .logoLive {
  1271. width: 35px;
  1272. }
  1273. .choose_style {
  1274. display: flex;
  1275. justify-content: center;
  1276. align-items: center;
  1277. width: 100%;
  1278. margin: 10px 0 30px;
  1279. }
  1280. .choose_style span {
  1281. background: #f8f9ff;
  1282. color: #677fff;
  1283. border: 1px solid #95b5ff;
  1284. padding: 15px 20px;
  1285. font-size: 25px;
  1286. border-radius: 18px;
  1287. cursor: pointer;
  1288. }
  1289. .choose_style span + span {
  1290. margin-left: 25px;
  1291. }
  1292. .isChoose {
  1293. color: #fff !important;
  1294. background: #5e78fa !important;
  1295. }
  1296. .close {
  1297. position: absolute;
  1298. right: 10px;
  1299. top: 10px;
  1300. width: 20px;
  1301. cursor: pointer;
  1302. }
  1303. .score_box {
  1304. font-size: 14px;
  1305. }
  1306. .score_box >>> .el-rate {
  1307. margin: 10px 0 20px 0;
  1308. }
  1309. .score_box >>> .el-rate__icon {
  1310. font-size: 23px;
  1311. }
  1312. .bz >>> .el-textarea__inner {
  1313. width: 80%;
  1314. background: #f9f9f9;
  1315. border: 1px solid #afafaf;
  1316. border-radius: 0px;
  1317. }
  1318. .tools_title {
  1319. background: #000;
  1320. position: absolute;
  1321. width: 100%;
  1322. top: 0;
  1323. left: 0;
  1324. display: flex;
  1325. align-items: center;
  1326. height: 40px;
  1327. justify-content: space-between;
  1328. padding: 0 15px;
  1329. box-sizing: border-box;
  1330. }
  1331. .tools_title span {
  1332. color: #fff;
  1333. }
  1334. .tools_title div {
  1335. display: flex;
  1336. align-items: center;
  1337. }
  1338. .full,
  1339. .closeImg {
  1340. height: 22px;
  1341. cursor: pointer;
  1342. }
  1343. .tools_title img,
  1344. img {
  1345. margin-left: 10px;
  1346. }
  1347. .tools_box {
  1348. width: 38.5%;
  1349. max-width: 38.5%;
  1350. overflow: auto;
  1351. background: rgb(255, 255, 255);
  1352. height: 91.5%;
  1353. position: relative;
  1354. margin: 10px 15px;
  1355. }
  1356. .tools_child_box {
  1357. width: 100%;
  1358. height: calc(90% - 40px);
  1359. padding-top: 40px;
  1360. }
  1361. .fullStyle {
  1362. width: 100% !important;
  1363. max-width: 100% !important;
  1364. }
  1365. .toolCss {
  1366. display: flex;
  1367. flex-direction: column;
  1368. flex-wrap: wrap;
  1369. width: calc(100% / 6);
  1370. align-items: center;
  1371. text-align: center;
  1372. }
  1373. .toolImg {
  1374. width: 70px;
  1375. height: 70px;
  1376. cursor: pointer;
  1377. }
  1378. .toolImg > img {
  1379. width: 100%;
  1380. height: 100%;
  1381. margin: 0 !important;
  1382. }
  1383. .toolImg > div {
  1384. font-size: 14px;
  1385. }
  1386. .iframeBox {
  1387. overflow: auto;
  1388. position: absolute;
  1389. top: 0;
  1390. z-index: -2;
  1391. width: 100%;
  1392. height: 100%;
  1393. }
  1394. </style>