index.vue 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442
  1. <template>
  2. <div class="pptEasyClass">
  3. <div class="pec_main" v-loading="pageLoading">
  4. <!-- 录音转文字 -->
  5. <iframe allow="camera *; microphone *;display-capture;midi;encrypted-media;" :src="iframeSrcop" ref="iiframe"
  6. v-show="false"></iframe>
  7. <div class="pec_header">
  8. <div class="pec_h_left">
  9. <!-- || tType == 1 -->
  10. <div @click.stop="back" class="backBtn" v-if="screenType != 2 && noLogin != 2 ">
  11. <img src="../../assets/icon/newIcon/return.svg" alt="" />
  12. </div>
  13. <div @click.stop="gotoCourseManage" class="backBtn" v-if="screenType == 2 && tType == 1 && noLogin != 2">
  14. <img src="../../assets/icon/newIcon/return.svg" alt="" />
  15. </div>
  16. <div v-if="tcid" class="class-info-group">
  17. <span class="class-label">{{ lang.ssClass }}</span>
  18. <span class="class-value class-value2" @click="openSelectClass">
  19. {{ className }}
  20. <svg t="1776672009773" class="xia-icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
  21. p-id="4735" xmlns:xlink="http://www.w3.org/1999/xlink" width="12" height="12">
  22. <path
  23. d="M562.5 771c-14.3 14.3-33.7 27.5-52 23.5-18.4 3.1-35.7-11.2-50-23.5L18.8 327.3c-22.4-22.4-22.4-59.2 0-81.6s59.2-22.4 81.6 0L511.5 668l412.1-422.3c22.4-22.4 59.2-22.4 81.6 0s22.4 59.2 0 81.6L562.5 771z"
  24. p-id="4736" fill="currentColor"></path>
  25. </svg>
  26. </span>
  27. </div>
  28. <div v-if="tcid" class="class-info-group">
  29. <span class="class-label" v-if="inviteCode">{{ lang.ssInviteCode }}</span>
  30. <span class="class-value" v-if="inviteCode">{{ inviteCode }}</span>
  31. </div>
  32. <div @click.stop="openShareDialog" class="shareBtn" v-if="tcid && tType == 1">
  33. <img src="../../assets/share.svg" alt="" />
  34. </div>
  35. </div>
  36. <div class="pec_h_center">
  37. <el-tooltip effect="dark" :content="lang.ssRefresh" placement="bottom">
  38. <div class="refresh_icon" @click="refreshCourse">
  39. <img src="../../assets/icon/course/refresh-2.svg" />
  40. </div>
  41. </el-tooltip>
  42. <el-tooltip class="item" effect="dark"
  43. :content="recordedForm.status == 1 ? lang.ssFinishClassRecording : lang.ssBeginClassRecording"
  44. placement="bottom"
  45. v-show="(jArray.includes(oid) || jArray.includes(org)) && courseDetail.userid == userid && tcid">
  46. <div class="pec_h_r_btn_refresh" :class="{ 'recording': recordedForm.status == 1 }"
  47. @click="toggleRecording">
  48. <svg t="1772588344140" viewBox="0 0 1024 1024" p-id="1693" width="200" height="200">
  49. <path
  50. d="M512 1024a512.568889 512.568889 0 0 1-512-512 512.625778 512.625778 0 0 1 512-512 512.568889 512.568889 0 0 1 512 512 512.568889 512.568889 0 0 1-512 512zM512 73.329778c-241.948444 0-438.670222 196.835556-438.670222 438.670222S270.051556 950.670222 512 950.670222s438.670222-196.835556 438.670222-438.670222S753.948444 73.329778 512 73.329778z m0 686.592a245.191111 245.191111 0 1 1 0-490.382222 245.191111 245.191111 0 0 1 0 490.382222z"
  51. p-id="1694"></path>
  52. </svg>
  53. <span>{{ recordedForm.status == 1 ? lang.ssStopRecording2 : lang.ssRecord }}</span>
  54. </div>
  55. </el-tooltip>
  56. <el-tooltip effect="dark" :content="courseDetail.title" placement="bottom">
  57. <div class="pec_h_l_title">
  58. <span>{{ courseDetail.title }}</span>
  59. </div>
  60. </el-tooltip>
  61. <div class="free-browse-switch" v-if="courseDetail.userid == userid">
  62. <el-switch v-model="freeBrowse" :active-value="false" :inactive-value="true" class="custom-switch"
  63. active-color="#03ae2b" inactive-color="#d8d8d8" @change="onFreeBrowseChange"></el-switch>
  64. <span class="switch-label" :class="{ active: freeBrowse }">{{ freeBrowse ? lang.ssFreeBrowse :
  65. lang.ssFollowMode }}</span>
  66. </div>
  67. <!-- <div class="free-browse-switch" v-if="courseDetail.userid == userid">
  68. <el-switch v-model="isCan" :active-value="true" :inactive-value="false" class="custom-switch"
  69. active-color="#03ae2b" inactive-color="#d8d8d8" @change="onIsCanChange"></el-switch>
  70. <span class="switch-label" :class="{ active: isCan }">{{ isCan ? lang.ssShowResult : lang.ssHideResult }}</span>
  71. </div> -->
  72. <div class="free-browse-switch" v-if="tType == 2">
  73. <span class="switch-label" :class="{ active: freeBrowse }">{{ freeBrowse ? lang.ssFreeBrowse :
  74. lang.ssFollowMode }}</span>
  75. </div>
  76. </div>
  77. <div class="pec_h_right">
  78. <div class="pec_h_r_btnArea">
  79. <!-- openObserveDialog -->
  80. <!-- toggleRecording -->
  81. <div class="pec_h_r_btn_uploadVoiceBtn" @click="uploadVoiceBtn" v-if="courseDetail.userid == userid"
  82. v-show="false">
  83. <span>{{ lang.ssUploadRecordingFile }}</span>
  84. </div>
  85. <div class="pec_h_r_btn_afterClass" @click="afterClass" v-if="courseDetail.userid == userid">
  86. <img src="../../assets/icon/newIcon/afterClass.svg" alt="" />
  87. <span>{{ lang.ssEndClass }}</span>
  88. </div>
  89. <div class="name_box" v-if="tType == 2">
  90. {{ userJson.username }}
  91. </div>
  92. <div class="pec_h_r_btn_afterClass" v-if="tType == 2" @click="afterClass2">
  93. {{ lang.ssExit }}
  94. </div>
  95. <!-- tType == 2 && courseDetail.userid == userid && object.keys(pptJSON).length > 0 -->
  96. <div class="pec_h_r_btn_analyze" v-show="courseDetail.userid == userid && Object.keys(pptJSON).length > 0 && tcid" @click="openDataBoard">
  97. {{ lang.ssAnalyze }}
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. <div class="pec_content">
  103. <iframe allow="camera *; microphone *;display-capture;midi;encrypted-media;clipboard-write;clipboard-read"
  104. webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" frameborder="no" border="0" :src="iframeSrc"
  105. v-if="showIframe" style="width: 100%; height: 100%; border: none" ref="ppt"></iframe>
  106. </div>
  107. </div>
  108. <!-- 课堂观察弹窗 -->
  109. <el-dialog :visible.sync="showObserveDialog" :close-on-click-modal="false" :close-on-press-escape="false"
  110. :show-close="true" width="90%" top="5vh" class="observe-dialog">
  111. <iframe v-if="showObserveDialog" :src="observeDialogUrl" frameborder="0"
  112. style="width: 100%; height: 85vh; border: none;"></iframe>
  113. </el-dialog>
  114. <selectTeachingClassDialog :courseDetail="courseDetail" :userId="userid" ref="selectTeachingClassDialogRef" @success="selectClassSuccess" @changeClassList="changeClassList"/>
  115. <!-- 消息提示组件 -->
  116. <messageInstruction ref="messageInstructionRef"></messageInstruction>
  117. <!-- 确认提示组件 -->
  118. <confirmInstruction ref="confirmInstructionRef"></confirmInstruction>
  119. <!-- 分享弹窗 -->
  120. <shareDialog ref="shareDialogRef"></shareDialog>
  121. <!-- 数据看板 -->
  122. <dataBoard ref="dataBoardRef" :courseDetail="courseDetail" :classList="classList" :pptJSON="pptJSON"></dataBoard>
  123. </div>
  124. </template>
  125. <script>
  126. import { myMixin } from '../../mixins/mixin';
  127. import selectTeachingClassDialog from "../dialog/selectTeachingClassDialog2.vue";
  128. import messageInstruction from '../components/messageInstruction.vue';
  129. import confirmInstruction from '../components/confirmInstruction.vue';
  130. import shareDialog from './shareDialog.vue';
  131. import dataBoard from './dataBoard/teacher.vue';
  132. const getFile = (url) => {
  133. return new Promise((resolve, reject) => {
  134. var credentials = {
  135. accessKeyId: "AKIATLPEDU37QV5CHLMH",
  136. secretAccessKey: "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",
  137. }; //秘钥形式的登录上传
  138. window.AWS.config.update(credentials);
  139. window.AWS.config.region = "cn-northwest-1"; //设置区域
  140. let url2 = url;
  141. let _url2 = "";
  142. if (
  143. url2.indexOf("https://view.officeapps.live.com/op/view.aspx?src=") != -1
  144. ) {
  145. _url2 = url2.split(
  146. "https://view.officeapps.live.com/op/view.aspx?src="
  147. )[1];
  148. } else {
  149. _url2 = url2;
  150. }
  151. var s3 = new window.AWS.S3({ params: { Bucket: "ccrb" } });
  152. let name = decodeURIComponent(_url2.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1])
  153. var params = {
  154. Bucket: "ccrb",
  155. Key: name
  156. };
  157. s3.getObject(params, function (err, data) {
  158. if (err) {
  159. console.log(err, err.stack)
  160. resolve({ data: 1 });
  161. }else {
  162. resolve({ data: data.Body });
  163. console.log(data);
  164. } // sxuccessful response
  165. });
  166. // axios({
  167. // method: "get",
  168. // url,
  169. // responseType: "blob",
  170. // })
  171. // .then((data) => {
  172. // resolve({ data: data.data });
  173. // })
  174. // .catch((error) => {
  175. // resolve({ data: 1 });
  176. // // reject(error.toString());
  177. // });
  178. });
  179. };
  180. export default {
  181. mixins: [myMixin],
  182. components: {
  183. messageInstruction,
  184. confirmInstruction,
  185. selectTeachingClassDialog,
  186. shareDialog,
  187. dataBoard
  188. },
  189. data() {
  190. return {
  191. id: this.$route.query.courseId,
  192. userid: this.$route.query.userid,
  193. classId: this.$route.query.cid,
  194. role: this.$route.query.role,
  195. oid: this.$route.query.oid,
  196. org: this.$route.query.org,
  197. tType: this.$route.query.tType,
  198. courseType: this.$route.query.type,
  199. screenType: this.$route.query.screenType,
  200. tcid2: this.$route.query.tcid,
  201. noLogin: this.$route.query.noLogin,
  202. classList: [],
  203. tcid: "",
  204. className: "",
  205. showIframe: false,
  206. iframeSrc: "",
  207. courseDetail: {},
  208. pageLoading: false,
  209. inviteCode: "",
  210. startTime: "",
  211. freeBrowse: true, // 默认自由浏览
  212. opertimer: null, // 定时器
  213. jArray: [],
  214. // 录音相关变量
  215. languageRadio: 2, // 语言选择
  216. recordedForm: {
  217. status: 0, // 0: 未开始, 1: 录音中, 2: 暂停, 3: 结束
  218. startTime: 0,
  219. endTime: 0,
  220. timeDuration: 0,
  221. textList: [],
  222. audioBlob: []
  223. },
  224. controlsStatus: 0, // 控制状态
  225. showIndexPage: true, // 显示索引页
  226. pageStatus: 1, // 页面状态
  227. editorBarData: {
  228. type: "0",
  229. content: ""
  230. },
  231. uploadFileLoading: false, // 上传文件加载状态
  232. transcriptionData: {
  233. content: ""
  234. },
  235. showGetTextLoading: false, // 显示获取文本加载状态
  236. // 弹窗相关
  237. showObserveDialog: false, // 显示课堂观察弹窗
  238. observeDialogUrl: "", // 课堂观察链接
  239. // 录音时间记录
  240. recordingStartTime: "", // 开始录音时间
  241. recordingEndTime: "", // 结束录音时间
  242. isResultArray: [],
  243. isCan: false,
  244. timeoutPan: null,
  245. dataBoardDebounce: null,
  246. isTimeOutPan: false,
  247. pptJSON: {},
  248. };
  249. },
  250. computed: {
  251. iframeSrcop() {
  252. if (this.$region == 'hk') {
  253. return `https://cloud.cocorobo.hk/browser/public/index.html`;
  254. } else if (this.$region == 'com') {
  255. return `https://cloud.cocorobo.com/browser/public/index.html`;
  256. } else {
  257. return `https://beta.cloud.cocorobo.cn/browser/public/index.html`;
  258. }
  259. }
  260. },
  261. methods: {
  262. openSelectClass(){
  263. this.$refs.selectTeachingClassDialogRef.open({classList:this.classList}, this.tcid2)
  264. },
  265. addInviteCodeOne(cid) {
  266. return new Promise((resolve)=>{
  267. let params = [
  268. {
  269. courseId: this.id,
  270. inviteCode: cid,
  271. },
  272. ];
  273. this.ajax
  274. .post(this.$store.state.api + "add_courseInviteCode2", params)
  275. .then((res) => {
  276. console.log(res.data)
  277. resolve(res.data)
  278. })
  279. .catch((err) => {
  280. resolve(err.messages)
  281. console.error(err);
  282. });
  283. })
  284. },
  285. async selectClassSuccess(classId){
  286. if(classId){
  287. let data = await this.addInviteCodeOne(classId)
  288. console.log("addInviteCodeOne",data)
  289. this.tcid2 = classId
  290. this.getClassName()
  291. this.getCourseDetail();
  292. }else if(this.tcid2){
  293. this.ticd2 = ''
  294. this.getCourseDetail();
  295. }
  296. // this.gotoCourse(classId);
  297. this.$refs.selectTeachingClassDialogRef.close();
  298. this.setoTime("1");
  299. },
  300. async changeClassList(data){
  301. this.classList = JSON.parse(JSON.stringify(data))
  302. let params = [{
  303. cid:this.id,
  304. juri:this.classList.map(i=>i.id).join(',')
  305. }]
  306. this.ajax.post(this.$store.state.api+"update_CourseJuriById",params).then(res=>{
  307. if(res.data==1){
  308. console.log(this.lang.ssModifySuccess)
  309. }
  310. })
  311. //this.inviteCodeFn();
  312. },
  313. goTo(path) {
  314. this.$router.push(path);
  315. },
  316. refreshCourse() {
  317. this.getCourseDetail();
  318. },
  319. audioStart() {
  320. this.onStartRecordWithMicrosoft();
  321. },
  322. async toggleRecording() {
  323. return new Promise(async resolve => {
  324. if (this.recordedForm.status == 1) {
  325. // 检查录音时间是否至少为5秒
  326. const now = new Date(await this.getServerTime());
  327. const duration = (now - new Date(this.recordingStartTime)) / 1000;
  328. if (duration < 5) {
  329. this.$message.warning(this.lang.ssRecordingTimeAtLeast5Seconds);
  330. return;
  331. }
  332. this.$refs.confirmInstructionRef.open({
  333. title: this.lang.ssStopRecordingConfirm,
  334. message: this.lang.ssStopRecordingNotice,
  335. cancelText: this.lang.ssCancel,
  336. submitText: this.lang.ssConfirm,
  337. submitCallback: () => {
  338. console.log("确定")
  339. this.onFinishRecordWithMicrosoft().then(() => {
  340. resolve(true)
  341. });
  342. },
  343. cancelCallback: () => {
  344. console.log("取消")
  345. resolve(false)
  346. },
  347. })
  348. // this.$confirm(this.lang.ssStopRecordingNotice, this.lang.ssStopRecordingConfirm, {
  349. // confirmButtonText: this.lang.ssConfirm,
  350. // cancelButtonText: this.lang.ssCancel,
  351. // confirmButtonClass: "pptEasyClassConfirmButtonText",
  352. // cancelButtonClass: "pptEasyClassCancelButtonText"
  353. // }).then(() => {
  354. // console.log("确定")
  355. // // this.$message({
  356. // // dangerouslyUseHTMLString: true,
  357. // // customClass:"pptEasyClassMessage",
  358. // // message: '已停止录制 <p style="color:#3AB855;text-decoration: underline;cursor: pointer;float:right;margin-left:10px" target="_blank">查看结果</p>'
  359. // // });
  360. // this.onFinishRecordWithMicrosoft().then(() => {
  361. // resolve(true)
  362. // });
  363. // }).catch(() => {
  364. // console.log("取消")
  365. // resolve(false)
  366. // });
  367. } else {
  368. console.log('recordingEndTime',this.recordingEndTime)
  369. const now = new Date(await this.getServerTime());
  370. console.log('now', now)
  371. const duration = (now - new Date(this.recordingEndTime)) / 1000;
  372. if (duration < 5) {
  373. this.$message.warning(this.lang.ssRecordingTimeAtLeast5Seconds);
  374. return;
  375. }
  376. this.onStartRecordWithMicrosoft();
  377. resolve(true)
  378. }
  379. })
  380. // })
  381. },
  382. // ============ start 微软录音转译
  383. async onStartRecordWithMicrosoft() {
  384. let iiframe = this.$refs["iiframe"];
  385. iiframe.contentWindow.window.document.getElementById(
  386. "languageOptions"
  387. ).selectedIndex = this.languageRadio;
  388. // 录音开始
  389. let flag = true;
  390. console.log("开始录音", iiframe);
  391. this.recordedForm.status = 1;
  392. // 记录开始录音时间
  393. this.recordingStartTime = await this.getServerTime();
  394. iiframe.contentWindow.window.onRecognizedResult = e => {
  395. console.log("onRecognizedResult", e);
  396. this.recordedForm.endTime = this.recordedForm.timeDuration;
  397. if (flag) {
  398. this.controlsStatus = 1;
  399. this.showIndexPage = false;
  400. this.pageStatus = 2;
  401. this.editorBarData.type = "0";
  402. flag = false;
  403. this.uploadFileLoading = false;
  404. this.transcriptionData.content = "";
  405. this.editorBarData.content = "";
  406. this.recordedForm.textList = [];
  407. }
  408. this.showGetTextLoading = true;
  409. let privText = e.privText;
  410. let privSpeakerId = e.privSpeakerId;
  411. let _copyPrivSpeakerId = privSpeakerId;
  412. console.log("👇转译对象👇");
  413. console.log(e);
  414. console.log("👇转译结果👇");
  415. console.log(privText);
  416. if (!privText || !privSpeakerId || privSpeakerId == "Unknown") {
  417. return;
  418. }
  419. const newItem = {
  420. value: privText,
  421. role: "",
  422. startTime: this.updateRecordedTime({
  423. duration: this.recordedForm.startTime
  424. }),
  425. endTime: this.updateRecordedTime({
  426. duration: this.recordedForm.endTime
  427. }),
  428. time: this.updateRecordedTime({
  429. duration: this.recordedForm.endTime - this.recordedForm.startTime
  430. })
  431. };
  432. this.recordedForm.textList.push(newItem);
  433. this.recordedForm.startTime = this.recordedForm.timeDuration + 1;
  434. this.transcriptionData.content +=
  435. _copyPrivSpeakerId + ":" + privText + "\n";
  436. this.onRecordAddLine(newItem);
  437. };
  438. iiframe.contentWindow.ConversationTranscriber();
  439. setTimeout(() => {
  440. navigator.permissions && navigator.permissions.query({ name: 'microphone' }).then(permissionStatus => {
  441. if (permissionStatus.state !== "granted") {
  442. // 没有开启录音权限,直接确定停止录音
  443. this.recordedForm.status = "0";
  444. let iframe = this.$refs["iiframe"];
  445. iframe.contentWindow.onSessionStopped = null;
  446. iframe.contentWindow.window.onRecognizedResult = null;
  447. this.$message.success(this.lang.ssNoPermStop);
  448. return;
  449. }
  450. })
  451. }, 10000)
  452. },
  453. async onFinishRecordWithMicrosoft() {
  454. return new Promise(resolve => {
  455. navigator.permissions && navigator.permissions.query({ name: 'microphone' }).then(async permissionStatus => {
  456. if (permissionStatus.state !== "granted") {
  457. // 没有开启录音权限,直接确定停止录音
  458. this.recordedForm.status = "0";
  459. let iframe = this.$refs["iiframe"];
  460. iframe.contentWindow.onSessionStopped = null;
  461. iframe.contentWindow.window.onRecognizedResult = null;
  462. this.$message.success(this.lang.ssNoPermStop);
  463. return;
  464. }
  465. if (this.recordedForm.status == 1) {
  466. //正在录音时
  467. let iiframe = this.$refs["iiframe"];
  468. iiframe.contentWindow.window.document
  469. .getElementById("scenarioStopButton")
  470. .click();
  471. // 录音借宿
  472. iiframe.contentWindow.onSessionStopped = async (s, e) => {
  473. this.recordedForm.status = 0;
  474. this.controlsStatus = 2;
  475. this.showGetTextLoading = false;
  476. // this.$message.success("已结束录音");
  477. console.log("结束录音👇");
  478. console.log("结束录音", e);
  479. this.recordedForm.audioBlob.push(e.preaudio);
  480. let blob = new Blob(this.recordedForm.audioBlob, {
  481. type: "audio/wav"
  482. });
  483. let file = new File([blob], "recordedFile.wav", {
  484. type: "audio/wav"
  485. });
  486. // 存储文件和文本到全局对象
  487. await this.storeRecordingData(file);
  488. // 记录结束录音时间
  489. this.recordingEndTime = await this.getServerTime()
  490. // 调用 addPPTClass 接口
  491. this.addPPTClass(file);
  492. iiframe.contentWindow.onSessionStopped = null;
  493. iiframe.contentWindow.window.onRecognizedResult = null;
  494. resolve(true)
  495. };
  496. } else if (this.recordedForm.status == 2) {
  497. //暂停录音时
  498. this.recordedForm.status = 0;
  499. this.controlsStatus = 2;
  500. this.showGetTextLoading = false;
  501. let blob = new Blob(this.recordedForm.audioBlob, {
  502. type: "audio/wav"
  503. });
  504. let file = new File([blob], "recordedFile.wav", { type: "audio/wav" });
  505. // 存储文件和文本到全局对象
  506. await this.storeRecordingData(file);
  507. // 记录结束录音时间
  508. this.recordingEndTime = await this.getServerTime()
  509. // 调用 addPPTClass 接口
  510. this.addPPTClass(file);
  511. resolve(true)
  512. }
  513. })
  514. })
  515. },
  516. storeRecordingData(file) {
  517. // 配置全局 window 对象存储录音数据
  518. return new Promise((resolve) => {
  519. if (!window.recordingData) {
  520. window.recordingData = {};
  521. }
  522. window.recordingData.file = file;
  523. window.recordingData.text = this.transcriptionData.content;
  524. window.recordingData.textList = this.recordedForm.textList;
  525. // 将录音文件转为base64并存入localStorage
  526. // const reader = new FileReader();
  527. // reader.onload = function(e) {
  528. // const base64data = e.target.result;
  529. // try {
  530. // localStorage.setItem("recordedFileBase64", base64data);
  531. // localStorage.setItem('recordedFileName', file.name);
  532. // localStorage.setItem('recordedFileType', file.type);
  533. resolve(true)
  534. // console.log("录音数据已存储到全局对象:", window.recordingData);
  535. // } catch (err) {
  536. // resolve(false)
  537. // console.error("localStorage存储base64文件失败:", err);
  538. // }
  539. // };
  540. // reader.readAsDataURL(file);
  541. })
  542. },
  543. openObserveDialog(pptid, file) {
  544. // this.observeDialogUrl = `https://observe.cocorobo.cn/#/newClassroom?userid=${this.userid}&oid=${this.oid}&org=${this.org}&pptid=${pptid}`;
  545. // this.showObserveDialog = true;
  546. const url = `https://observe.cocorobo.cn/#/newClassroom?userid=${this.userid}&oid=${this.oid}&org=${this.org}&pptid=${pptid}`;
  547. const _pageWindow = window.open(url, '_blank');
  548. // if(!_pageWindow){
  549. // alert('浏览器弹窗被拦截,请允许弹窗后重试');
  550. // return;
  551. // }
  552. const sendData = {
  553. type: 'fileData',
  554. file,
  555. }
  556. const sendMessageToVue3 = () => {
  557. _pageWindow.postMessage(
  558. sendData,
  559. '*' // targetOrigin:必须是Vue3的实际域名,不要用*(安全)
  560. );
  561. };
  562. const handleVue3Ready = (e) => {
  563. // 校验消息来源(安全:只处理Vue3域名的消息)
  564. // 校验消息类型(确认是Vue3的就绪通知)
  565. if (e.data.type === 'READY') {
  566. console.log('已就绪,开始发送数据');
  567. sendMessageToVue3();
  568. }
  569. // 校验Vue3的"接收成功"确认(可选,进一步确保送达)
  570. if (e.data.type === 'DATA_RECEIVED') {
  571. console.log('数据已被接收');
  572. // 收到确认后移除监听,避免内存泄漏
  573. window.removeEventListener('message', handleVue3Ready);
  574. }
  575. };
  576. window.addEventListener('message', handleVue3Ready);
  577. const timeoutTimer = setTimeout(() => {
  578. console.log('未收到就绪通知,主动发送数据');
  579. sendMessageToVue3();
  580. // 移除监听(兜底后清理)
  581. window.removeEventListener('message', handleVue3Ready);
  582. }, 5000);
  583. const checkWinClosed = setInterval(() => {
  584. if (_pageWindow.closed) {
  585. clearTimeout(timeoutTimer);
  586. clearInterval(checkWinClosed);
  587. window.removeEventListener('message', handleVue3Ready);
  588. }
  589. }, 1000);
  590. // 优化:仅通过轮询方式检查窗口是否加载完成并发送消息,被打开页面无需做任何处理
  591. // const sendFileData = () => {
  592. // if (_pageWindow && !_pageWindow.closed) {
  593. // _pageWindow.postMessage(
  594. // {
  595. // type: 'fileData',
  596. // file,
  597. // },
  598. // '*'
  599. // );
  600. // }
  601. // };
  602. // let checkCount = 0;
  603. // const checkLoadedInterval = setInterval(() => {
  604. // if (!_pageWindow || _pageWindow.closed) {
  605. // clearInterval(checkLoadedInterval);
  606. // return;
  607. // }
  608. // try {
  609. // if (_pageWindow.document && _pageWindow.document.readyState === 'complete') {
  610. // clearInterval(checkLoadedInterval);
  611. // sendFileData();
  612. // }
  613. // } catch (err) {
  614. // // 跨域下直接尝试发送
  615. // clearInterval(checkLoadedInterval);
  616. // sendFileData();
  617. // }
  618. // if (++checkCount > 20) {
  619. // // 最多检测2秒(20次)
  620. // clearInterval(checkLoadedInterval);
  621. // sendFileData();
  622. // }
  623. // }, 100);
  624. setTimeout(() => {
  625. window.focus()
  626. }, 100)
  627. function openPageWindow() {
  628. _pageWindow.focus()
  629. }
  630. this.$refs.messageInstructionRef.pptMessage(`${this.lang.ssStoppedRecording} <p style="color:#3AB855;text-decoration: underline;cursor: pointer;float:right;margin-left:10px" target="_blank" onClick="(${openPageWindow.toString()})()">${this.lang.ssViewRecordingResult}</p>`)
  631. },
  632. addPPTClass(file) {
  633. let params = {
  634. pptid: this.id,
  635. cid: this.tcid,
  636. st: this.recordingStartTime,
  637. et: this.recordingEndTime
  638. };
  639. this.ajax
  640. .post(this.$store.state.api + "addPPTClass", [params])
  641. .then(res => {
  642. console.log("addPPTClass", res);
  643. let id = res.data[0][0].id;
  644. this.openObserveDialog(id, file);
  645. })
  646. .catch(err => {
  647. console.error(err);
  648. this.$message.error("保存录音信息失败");
  649. });
  650. },
  651. updateRecordedTime({ duration }) {
  652. // 格式化录音时间
  653. const minutes = Math.floor(duration / 60);
  654. const seconds = Math.floor(duration % 60);
  655. return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
  656. },
  657. onRecordAddLine(item) {
  658. // 添加录音文本行
  659. console.log("添加录音文本行:", item);
  660. // 这里可以根据需要添加更多处理逻辑
  661. },
  662. getCourseDetail() {
  663. this.pageLoading = true;
  664. let params = {
  665. courseId: this.id
  666. };
  667. this.ajax
  668. .get(this.$store.state.api + "selectCourseDetail3", params)
  669. .then(res => {
  670. console.log("getCourseDetail", res);
  671. this.courseDetail = res.data[0][0];
  672. this.courseDetail.chapters = JSON.parse(this.courseDetail.chapters);
  673. getFile(this.courseDetail.chapters.pptData).then(res => {
  674. let pptdata = res
  675. // pptdata.data 是 ArrayBuffer,需要先转成字符串再解析为 JSON
  676. let jsonStr = ''
  677. if (pptdata && pptdata.data) {
  678. // 先将 ArrayBuffer 转为字符串
  679. const uint8Array = new Uint8Array(pptdata.data)
  680. jsonStr = new TextDecoder('utf-8').decode(uint8Array)
  681. try {
  682. const jsonObj = JSON.parse(jsonStr)
  683. this.pptJSON = jsonObj
  684. console.log(this.pptJSON)
  685. } catch (error) {
  686. console.error('JSON 解析错误:', error);
  687. }
  688. }
  689. })
  690. if(this.tType == '2'){
  691. this.cid = this.$route.query.cid || ''
  692. }else {
  693. this.tcid = this.arrayToArray(
  694. this.courseDetail.juri ? this.courseDetail.juri.split(",") : [],
  695. this.tcid2 ? this.tcid2.split(",") : []
  696. )[0] || "";
  697. }
  698. console.log('tcid', this.tcid)
  699. console.log('tcid2', this.tcid2)
  700. if (this.tcid && res.data[1].length) {
  701. let _inviteA = [];
  702. for (var ik = 0; ik < res.data[1].length; ik++) {
  703. _inviteA.push({
  704. cid: res.data[1][ik].classid,
  705. ic: res.data[1][ik].code,
  706. });
  707. }
  708. for (var ik = 0; ik < _inviteA.length; ik++) {
  709. if (
  710. this.arrayToArray(
  711. _inviteA[ik].cid.split(","),
  712. this.tcid.split(",")
  713. ).length
  714. ) {
  715. this.inviteCode = _inviteA[ik].ic;
  716. break;
  717. }
  718. }
  719. }
  720. this.setPptIframe()
  721. this.classList = res.data[2]
  722. if(!this.tcid2 && this.tType == '1' && this.noLogin != 2 && this.noLogin != 3){
  723. this.$refs.selectTeachingClassDialogRef.open({classList:this.classList})
  724. }
  725. this.pageLoading = false;
  726. })
  727. .catch(err => {
  728. console.log(err);
  729. this.$message.error(this.lang.ssGetCourseDataFail);
  730. this.pageLoading = false;
  731. });
  732. },
  733. setPptIframe() {
  734. this.showIframe = false;
  735. this.$nextTick(() => {
  736. let api = 'https://beta.ppt.cocorobo.cn'
  737. if (this.$region == 'beta') {
  738. api = 'https://beta.ppt.cocorobo.cn'
  739. } else if (this.$region == 'hk') {
  740. api = 'https://ppt.cocorobo.hk'
  741. } else if (this.$region == 'com') {
  742. api = 'https://ppt.cocorobo.com'
  743. } else {
  744. api = 'https://ppt.cocorobo.cn'
  745. }
  746. let _url = api + `/?mode=student&courseid=${this.id}&userid=${this.userid}&oid=${this.oid}&org=${this.org}&cid=${this.tcid}&type=${this.tType}`;
  747. this.iframeSrc = _url;
  748. this.showIframe = true;
  749. });
  750. },
  751. arrayToArray(arrayo, arrayt) {
  752. let array1 = arrayo;
  753. let array2 = arrayt;
  754. let commonElements = [];
  755. for (let i = 0; i < array1.length; i++) {
  756. for (let j = 0; j < array2.length; j++) {
  757. if (array1[i] === array2[j]) {
  758. commonElements.push(array1[i]);
  759. }
  760. }
  761. }
  762. return commonElements;
  763. },
  764. async getClassName() {
  765. let courseGrade = await this.ajax.get(this.$store.state.api + "getClassById", { id: this.tcid2 });
  766. this.className = courseGrade.data[0][0].grade;
  767. },
  768. back() {
  769. // if (this.tType != 2) {
  770. // this.goTo(
  771. // '/courseDetail?userid=' +
  772. // this.userid +
  773. // '&oid=' +
  774. // this.oid +
  775. // '&org=' +
  776. // this.org +
  777. // '&cid=' +
  778. // this.classId +
  779. // '&courseId=' +
  780. // this.id +
  781. // '&tType=' +
  782. // this.tType +
  783. // '&screenType=' +
  784. // this.screenType
  785. // )
  786. // } else {
  787. this.goTo(
  788. '/index?userid=' +
  789. this.userid +
  790. '&oid=' +
  791. this.oid +
  792. '&org=' +
  793. this.org +
  794. '&cid=' +
  795. this.classId +
  796. '&tType=' +
  797. this.tType +
  798. '&screenType=' +
  799. this.screenType
  800. )
  801. // }
  802. },
  803. gotoCourseManage(){
  804. this.doSyncClassData(2);
  805. },
  806. afterClass() {
  807. if (this.recordedForm.status == 1) {
  808. this.toggleRecording().then((flag) => {
  809. if (flag) {
  810. this.$refs.confirmInstructionRef.open({
  811. title: this.lang.ssPrompt,
  812. message: this.lang.ssEndClassConfirm,
  813. cancelText: this.lang.ssCancel,
  814. submitText: this.lang.ssConfirm,
  815. submitCallback: () => {
  816. this.isTimeOutPan = false;
  817. this.$refs.ppt.contentWindow.PPTistStudent.forceLogout();
  818. this.$refs.messageInstructionRef.pptMessage(this.lang.ssStudentLoggedOut)
  819. setTimeout(() => {
  820. this.tcid2 = ""
  821. this.refreshCourse()
  822. if(this.screenType != 2){
  823. this.back()
  824. }else if(this.screenType == 2){
  825. this.gotoCourseManage()
  826. }
  827. }, 1000)
  828. },
  829. cancelCallback: () => {
  830. this.isTimeOutPan = false;
  831. console.log("取消")
  832. }
  833. })
  834. // this.$confirm(this.lang.ssEndClassConfirm, this.lang.ssPrompt, {
  835. // confirmButtonText: this.lang.ssConfirm,
  836. // cancelButtonText: this.lang.ssCancel,
  837. // type: 'warning'
  838. // }).then(() => {
  839. // this.$refs.ppt.contentWindow.PPTistStudent.forceLogout();
  840. // this.$refs.messageInstructionRef.pptMessage(this.lang.ssStudentLoggedOut)
  841. // setTimeout(() => {
  842. // this.tcid2 = ""
  843. // this.refreshCourse()
  844. // }, 1000)
  845. // }).catch(() => { });
  846. }
  847. })
  848. } else {
  849. // this.$confirm(this.lang.ssEndClassConfirm, this.lang.ssPrompt, {
  850. // confirmButtonText: this.lang.ssConfirm,
  851. // cancelButtonText: this.lang.ssCancel,
  852. // type: 'warning'
  853. // }).then(() => {
  854. // this.$refs.ppt.contentWindow.PPTistStudent.forceLogout();
  855. // this.$refs.messageInstructionRef.pptMessage(this.lang.ssStudentLoggedOut)
  856. // setTimeout(() => {
  857. // this.tcid2 = ""
  858. // this.refreshCourse()
  859. // }, 1000)
  860. // }).catch(() => { });
  861. this.$refs.confirmInstructionRef.open({
  862. title: this.lang.ssPrompt,
  863. message: this.lang.ssEndClassConfirm,
  864. cancelText: this.lang.ssCancel,
  865. submitText: this.lang.ssConfirm,
  866. submitCallback: () => {
  867. this.$refs.ppt.contentWindow.PPTistStudent.forceLogout();
  868. this.$refs.messageInstructionRef.pptMessage(this.lang.ssStudentLoggedOut)
  869. setTimeout(() => {
  870. this.tcid2 = ""
  871. this.refreshCourse()
  872. if(this.screenType != 2){
  873. this.back()
  874. }else if(this.screenType == 2){
  875. this.gotoCourseManage()
  876. }
  877. }, 1000)
  878. },
  879. cancelCallback: () => {
  880. console.log("取消")
  881. }
  882. })
  883. }
  884. },
  885. afterClass2(){
  886. this.$refs.confirmInstructionRef.open({
  887. title: this.lang.ssPrompt,
  888. message: this.lang.ssConfirmExit,
  889. cancelText: this.lang.ssCancel,
  890. submitText: this.lang.ssConfirm,
  891. submitCallback: () => {
  892. this.$refs.ppt.contentWindow.PPTistStudent.forceLogout2();
  893. this.$refs.messageInstructionRef.pptMessage(this.lang.ssStudentLoggedOut)
  894. },
  895. cancelCallback: () => {
  896. console.log("取消")
  897. }
  898. })
  899. },
  900. onFreeBrowseChange(value) {
  901. this.freeBrowse = value;
  902. console.log('自由浏览模式已切换为1:', this.freeBrowse);
  903. this.$refs.ppt.contentWindow.PPTistStudent.toggleFollowMode()
  904. },
  905. onIsCanChange(value) {
  906. this.isCan = value;
  907. for(var i = 0; i < this.isResultArray.length; i++){
  908. let item = this.isResultArray[i];
  909. if(value && item.isTool){
  910. item.can = true
  911. }else if(item.isTool){
  912. item.can = false
  913. item.like = false
  914. }
  915. }
  916. this.$refs.ppt.contentWindow.PPTistStudent.setCan(this.isResultArray)
  917. },
  918. setOperationTime() {
  919. let _this = this;
  920. if (_this.opertimer) {
  921. clearInterval(_this.opertimer);
  922. _this.opertimer = null;
  923. }
  924. _this.opertimer = setInterval(() => {
  925. _this.setoTime("600");
  926. }, 600000);
  927. },
  928. async setoTime(time) {
  929. this.startTime = await this.getServerTime()
  930. this.doSyncClassData();
  931. let params = [
  932. {
  933. uid: this.userid,
  934. cid: this.id + (this.tcid2 || ''),
  935. type: "2",
  936. time: time,
  937. },
  938. ];
  939. this.ajax
  940. .post(this.$store.state.api + "addOperationTimeT2", params)
  941. .then((res) => { })
  942. .catch((err) => {
  943. console.error(err);
  944. });
  945. },
  946. getAIJ() {
  947. this.ajax.get(this.$store.state.api + "getAIJ", "").then(res => {
  948. let a = res.data[4];
  949. console.log(a)
  950. let Array = [];
  951. a.forEach(i => Array.push(i.oid))
  952. this.jArray = Array;
  953. })
  954. },
  955. async doSyncClassData(type) {
  956. let userArray = ['6fbc6471-1d48-11ed-8c78-005056b86db5','333d0dfc-1cd9-11ef-bee5-005056b86db5','6fbce5ef-1d48-11ed-8c78-005056b86db5','66feffcc-ad35-11ed-b13d-005056b86db5']
  957. if (this.courseDetail.userid == this.userid && (this.org == '16ace517-b5c7-4168-a9bb-a9e0035df840' || userArray.includes(this.userid))) {
  958. let endTime = await this.getServerTime()
  959. let courseTime = Math.max(1, Math.ceil((new Date(endTime) - new Date(this.startTime)) / (1000 * 60)))
  960. this.syncClassData({
  961. courseId: this.id,
  962. title: this.courseDetail.title,
  963. ctitle: this.courseDetail.copyTitle || this.courseDetail.title,
  964. courseGrade: this.tcid2 ? this.tcid2 : '',
  965. courseTime: courseTime,
  966. startTime: this.startTime,
  967. endTime: endTime,
  968. }, 'selectUser', ()=>{
  969. type == 2 ? parent.setCourseUrl() : '';
  970. })
  971. console.log('同步数据')
  972. } else {
  973. type == 2 ? parent.setCourseUrl() : '';
  974. }
  975. },
  976. // 直接上传录制音频/视频
  977. uploadVoiceBtn() {
  978. const input = document.createElement('input');
  979. input.type = 'file';
  980. input.accept = '.m4a,.mp4,.mov,.mp3,.wav';
  981. input.click();
  982. input.onchange = (e) => {
  983. const fileList = e.target.files;
  984. const file = fileList[0]
  985. this.recordingStartTime = new Date(window.recordingStartTime ? window.recordingStartTime : new Date()).toLocaleString("zh-CN", {
  986. hour12: false,
  987. timeZone: "Asia/Shanghai"
  988. }).replace(/\//g, "-");
  989. this.recordingEndTime = new Date(window.recordingEndTime ? window.recordingEndTime : new Date()).toLocaleString("zh-CN", {
  990. hour12: false,
  991. timeZone: "Asia/Shanghai"
  992. }).replace(/\//g, "-");
  993. this.addPPTClass(file)
  994. // 判断文件类型并获取音频或视频时长
  995. // if (file && (file.type.startsWith('audio/') || file.type.startsWith('video/'))) {
  996. // const url = URL.createObjectURL(file);
  997. // let media;
  998. // if (file.type.startsWith('audio/')) {
  999. // media = new Audio();
  1000. // } else {
  1001. // media = document.createElement('video');
  1002. // }
  1003. // media.preload = 'metadata';
  1004. // media.src = url;
  1005. // media.onloadedmetadata = () => {
  1006. // const duration = media.duration;
  1007. // console.log('文件时长(秒):', duration);
  1008. // // 这里可以赋值或者进一步处理时长 duration
  1009. // URL.revokeObjectURL(url);
  1010. // };
  1011. // media.onerror = () => {
  1012. // console.error('无法读取文件时长');
  1013. // URL.revokeObjectURL(url);
  1014. // };
  1015. // }
  1016. }
  1017. },
  1018. // 打开分享弹窗
  1019. openShareDialog() {
  1020. let code = this.userJson.oidCode || this.userJson.orgCode
  1021. this.$refs.shareDialogRef.open(code, this.inviteCode)
  1022. },
  1023. resetIdleOp(){
  1024. if(this.courseDetail.userId == this.userid){
  1025. this.isTimeOutPan = true;
  1026. this.afterClass()
  1027. setTimeout(() => {
  1028. if(this.isTimeOutPan){
  1029. this.$refs.ppt.contentWindow.PPTistStudent.forceLogout();
  1030. this.$refs.messageInstructionRef.pptMessage(this.lang.ssStudentLoggedOut)
  1031. setTimeout(() => {
  1032. this.tcid2 = ""
  1033. this.refreshCourse()
  1034. }, 1000)
  1035. }
  1036. }, 5000);
  1037. }
  1038. // console.log('resetIdleOp','重置空闲定时器')
  1039. },
  1040. openDataBoard(){
  1041. if (this.dataBoardDebounce) clearTimeout(this.dataBoardDebounce);
  1042. this.dataBoardDebounce = setTimeout(async () => {
  1043. let sec = Math.ceil((new Date(await this.getServerTime()) - new Date(this.startTime)) / (1000 * 60))
  1044. this.setoTime(sec);
  1045. this.setOperationTime()
  1046. this.$refs.dataBoardRef.open(this.tcid2)
  1047. }, 500);
  1048. }
  1049. },
  1050. destroyed() {
  1051. clearInterval(this.opertimer);
  1052. this.opertimer = null;
  1053. clearTimeout(this.timeoutPan);
  1054. this.timeoutPan = null;
  1055. clearTimeout(this.dataBoardDebounce);
  1056. this.dataBoardDebounce = null;
  1057. this.doSyncClassData();
  1058. this.stopIdleDetection(this.resetIdleOp);
  1059. },
  1060. async mounted() {
  1061. this.setoTime("1");
  1062. this.startTime = await this.getServerTime()
  1063. console.log('this.startTime', this.startTime)
  1064. this.timeoutPan = setTimeout(() => {
  1065. this.startIdleDetection(this.resetIdleOp);
  1066. }, 40 * 60 * 1000)
  1067. // this.startIdleDetection(this.resetIdleOp);
  1068. this.getClassName()
  1069. this.getAIJ();
  1070. this.getCourseDetail();
  1071. this.setOperationTime();
  1072. window.onFreeBrowseChange = (value) => {
  1073. this.freeBrowse = value;
  1074. console.log('自由浏览模式已切换为:', this.freeBrowse);
  1075. }
  1076. window.setIsResultArray = (value) => {
  1077. this.isResultArray = value;
  1078. // 判断数组中isTool为true的项的can是否都为true
  1079. const toolItems = value.filter(item => item.isTool);
  1080. if (toolItems.length > 0) {
  1081. const allCanTrue = toolItems.every(item => item.can === true);
  1082. const allCanFalse = toolItems.every(item => item.can === false);
  1083. if (allCanTrue) {
  1084. this.isCan = true;
  1085. } else if (allCanFalse) {
  1086. this.isCan = false;
  1087. }
  1088. }
  1089. }
  1090. if (!this.userJson || !this.userJson.accountNumber) {
  1091. let res = await this.ajax.get(this.$store.state.api + "selectUser2", {
  1092. userid: this.$route.query.userid
  1093. });
  1094. this.userJson = res.data[0][0]
  1095. }
  1096. setTimeout(() => {
  1097. this.doSyncClassData();
  1098. }, 1000);
  1099. }
  1100. };
  1101. </script>
  1102. <style scoped>
  1103. .pptEasyClass {
  1104. width: 100vw;
  1105. height: 100vh;
  1106. display: flex;
  1107. flex-direction: column;
  1108. overflow: hidden;
  1109. box-sizing: border-box;
  1110. background-color: #f2f2f2;
  1111. min-height: unset;
  1112. }
  1113. .pec_main {
  1114. width: 100%;
  1115. height: 100%;
  1116. background-color: #fff;
  1117. }
  1118. .pec_header {
  1119. width: 100%;
  1120. height: 60px;
  1121. background: #FCCF00;
  1122. box-sizing: border-box;
  1123. display: flex;
  1124. align-items: center;
  1125. justify-content: space-between;
  1126. position: relative;
  1127. box-shadow: 0px 4px 12px 0px #3648601F;
  1128. padding: 0 10px;
  1129. box-sizing: border-box;
  1130. }
  1131. .pec_h_left {
  1132. width: auto;
  1133. height: 100%;
  1134. display: flex;
  1135. align-items: center;
  1136. gap: 25px;
  1137. /* 保持左侧靠左 */
  1138. }
  1139. .pec_h_center {
  1140. position: absolute;
  1141. left: 50%;
  1142. top: 0;
  1143. height: 100%;
  1144. display: flex;
  1145. align-items: center;
  1146. transform: translateX(-50%);
  1147. z-index: 1;
  1148. }
  1149. .pec_h_l_title {
  1150. font-weight: bold;
  1151. font-size: 20px;
  1152. color: #0e1e33;
  1153. overflow: hidden;
  1154. white-space: nowrap;
  1155. max-width: 500px;
  1156. text-overflow: ellipsis;
  1157. }
  1158. .pec_h_right {
  1159. width: auto;
  1160. height: 100%;
  1161. display: flex;
  1162. align-items: center;
  1163. }
  1164. .pec_h_r_btnArea {
  1165. display: flex;
  1166. align-items: center;
  1167. justify-content: center;
  1168. }
  1169. .pec_h_r_btnArea>div {
  1170. width: auto;
  1171. height: auto;
  1172. display: flex;
  1173. align-items: center;
  1174. justify-content: center;
  1175. padding: 10px 20px;
  1176. background-color: #f0f4fa;
  1177. border-radius: 4px;
  1178. cursor: pointer;
  1179. font-size: 14px;
  1180. font-weight: 400;
  1181. color: #000;
  1182. border: 1px solid #cad1dc;
  1183. }
  1184. .pec_h_r_btnArea>div+div {
  1185. margin-left: 10px;
  1186. }
  1187. .pec_h_r_btnArea>div>img {
  1188. width: 15px;
  1189. height: 15px;
  1190. margin-right: 5px;
  1191. }
  1192. .pec_h_center>.pec_h_r_btn_refresh {
  1193. color: #fff;
  1194. /* background-color: #0061ff;
  1195. border-color: #0061ff; */
  1196. padding: 9px 10px;
  1197. margin-right: 15px;
  1198. border-radius: 26px;
  1199. display: flex;
  1200. align-items: center;
  1201. justify-content: center;
  1202. gap: 5px;
  1203. background: #FFF7F5;
  1204. color: #000000;
  1205. font-weight: 400;
  1206. cursor: pointer;
  1207. fill: #666666;
  1208. }
  1209. .pec_h_center>.pec_h_r_btn_refresh>svg {
  1210. width: 1rem;
  1211. height: 1rem;
  1212. }
  1213. .pec_h_center>.pec_h_r_btn_refresh.recording {
  1214. /* background-color: #F53F3F;
  1215. border-color: #F53F3F; */
  1216. background: #FFF7E8;
  1217. fill: #FF9300;
  1218. animation: pulse 1.5s infinite;
  1219. }
  1220. @keyframes pulse {
  1221. 0% {
  1222. box-shadow: 0 0 0 0 rgba(245, 63, 63, 0.4);
  1223. }
  1224. 70% {
  1225. box-shadow: 0 0 0 10px rgba(245, 63, 63, 0);
  1226. }
  1227. 100% {
  1228. box-shadow: 0 0 0 0 rgba(245, 63, 63, 0);
  1229. }
  1230. }
  1231. .pec_h_r_btnArea>.pec_h_r_btn_afterClass {
  1232. border-color: #F0E1DD;
  1233. background-color: #FFF7F5;
  1234. color: #F53F3F;
  1235. }
  1236. .pec_h_r_btnArea>.pec_h_r_btn_analyze {
  1237. border-color: #C5D4EC;
  1238. background-color: #E8F0FE;
  1239. color: #3370FF;
  1240. }
  1241. .pec_h_r_btn_uploadVoiceBtn {
  1242. border-color: #F0E1DD;
  1243. background-color: #FFF7F5;
  1244. color: #000;
  1245. }
  1246. .backBtn {
  1247. width: 15px;
  1248. height: 15px;
  1249. display: flex;
  1250. align-items: center;
  1251. justify-content: center;
  1252. cursor: pointer;
  1253. }
  1254. .backBtn img {
  1255. width: 100%;
  1256. height: 100%;
  1257. }
  1258. .shareBtn {
  1259. width: 25px;
  1260. height: 25px;
  1261. display: flex;
  1262. align-items: center;
  1263. justify-content: center;
  1264. cursor: pointer;
  1265. }
  1266. .shareBtn img {
  1267. width: 100%;
  1268. height: 100%;
  1269. }
  1270. .class-info-group {
  1271. display: flex;
  1272. align-items: center;
  1273. gap: 10px;
  1274. }
  1275. .class-label {
  1276. font-size: 18px;
  1277. font-weight: bold;
  1278. color: #222;
  1279. margin-right: 5px;
  1280. }
  1281. .class-value {
  1282. font-size: 16px;
  1283. color: #222;
  1284. background: #FFFFFF3D;
  1285. border: 1px solid #00000080;
  1286. border-radius: 5px;
  1287. padding: 5px 18px;
  1288. min-width: 60px;
  1289. text-align: center;
  1290. display: inline-block;
  1291. box-sizing: border-box;
  1292. display: flex;
  1293. align-items: center;
  1294. }
  1295. .class-value2 {
  1296. cursor: pointer;
  1297. background: #fff;
  1298. }
  1299. .class-value > svg{
  1300. width: 13px;
  1301. height: 13px;
  1302. margin-left: 8px;
  1303. }
  1304. .pec_content {
  1305. width: 100%;
  1306. height: calc(100% - 60px);
  1307. border-radius: 0 0 12px 12px;
  1308. background-color: #fff;
  1309. }
  1310. .free-browse-switch {
  1311. display: flex;
  1312. align-items: center;
  1313. padding: 9px 10px;
  1314. background: #FFF7F5;
  1315. border-radius: 26px;
  1316. margin-left: 15px;
  1317. gap: 5px;
  1318. }
  1319. .switch-label {
  1320. /* background: linear-gradient(to right, #F53F3F, #FCCF00); */
  1321. /* -webkit-background-clip: text; */
  1322. color: #000;
  1323. }
  1324. .refresh_icon {
  1325. width: 35px;
  1326. height: 35px;
  1327. display: flex;
  1328. align-items: center;
  1329. justify-content: center;
  1330. background-color: #fff7f5;
  1331. border-radius: 45%;
  1332. cursor: pointer;
  1333. margin-right: 15px;
  1334. padding: 0 3px;
  1335. }
  1336. .refresh_icon img {
  1337. width: 16px;
  1338. height: 16px;
  1339. }
  1340. .name_box {
  1341. background: unset !important;
  1342. border: none !important;
  1343. cursor: unset !important;
  1344. }
  1345. .observe-dialog>>>.el-dialog__header {
  1346. padding: 0;
  1347. }
  1348. .observe-dialog>>>.el-dialog__body {
  1349. padding: 0;
  1350. }
  1351. .observe-dialog>>>.el-dialog__headerbtn {
  1352. top: 22px;
  1353. right: 20px;
  1354. z-index: 100;
  1355. }
  1356. </style>