index.tsx 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418
  1. import { closeToast, Icon, Popup, showDialog, showToast } from 'vant'
  2. import {
  3. defineComponent,
  4. onMounted,
  5. reactive,
  6. nextTick,
  7. onUnmounted,
  8. ref,
  9. watch,
  10. Transition,
  11. computed,
  12. onBeforeUnmount
  13. } from 'vue'
  14. import iconBack from './image/back.svg'
  15. import styles from './index.module.less'
  16. import 'plyr/dist/plyr.css'
  17. import request from '@/helpers/request'
  18. import { state } from '@/state'
  19. import { useRoute } from 'vue-router'
  20. import { listenerMessage, postMessage, promisefiyPostMessage } from '@/helpers/native-message'
  21. import qs from 'query-string'
  22. import MusicScore from './component/musicScore'
  23. import iconDian from './image/icon-dian.svg'
  24. import iconPoint from './image/icon-point.svg'
  25. import { iconUp, iconDown, iconPen, iconTouping, iconMenu } from './image/icons.json'
  26. import Points from './component/points'
  27. import { browser } from '@/helpers/utils'
  28. import { Vue3Lottie } from 'vue3-lottie'
  29. import playLoadData from './datas/data.json'
  30. import { usePageVisibility } from '@vant/use'
  31. import { useInterval, useIntervalFn } from '@vueuse/core'
  32. import PlayRecordTime from './playRecordTime'
  33. import { handleCheckVip } from '../hook/useFee'
  34. import OGuide from '@/components/o-guide'
  35. import Tool, { ToolItem, ToolType } from './component/tool'
  36. import Pen from './component/tools/pen'
  37. import VideoItem from './component/video-item'
  38. import deepClone from '@/helpers/deep-clone'
  39. import VideoPlay from './component/video-play'
  40. export default defineComponent({
  41. name: 'CoursewarePlay',
  42. setup() {
  43. const pageVisibility = usePageVisibility()
  44. /** 页面显示和隐藏 */
  45. watch(
  46. () => pageVisibility.value,
  47. (value) => {
  48. if (value == 'hidden') {
  49. handleStop()
  50. }
  51. }
  52. )
  53. /** 设置播放容器 16:9 */
  54. const parentContainer = reactive({
  55. width: '100vw'
  56. })
  57. const setContainer = () => {
  58. const min = Math.min(screen.width, screen.height)
  59. const max = Math.max(screen.width, screen.height)
  60. const width = min * (16 / 9)
  61. if (width > max) {
  62. parentContainer.width = '100vw'
  63. return
  64. } else {
  65. parentContainer.width = width + 'px'
  66. }
  67. }
  68. const handleInit = (type = 0) => {
  69. //设置容器16:9
  70. setContainer()
  71. // 横屏
  72. postMessage(
  73. {
  74. api: 'setRequestedOrientation',
  75. content: {
  76. orientation: type
  77. }
  78. },
  79. () => {
  80. console.log(234)
  81. }
  82. )
  83. // 头,包括返回箭头
  84. // postMessage({
  85. // api: 'setTitleBarVisibility',
  86. // content: {
  87. // status: type
  88. // }
  89. // })
  90. // 安卓的状态栏
  91. postMessage({
  92. api: 'setStatusBarVisibility',
  93. content: {
  94. isVisibility: type
  95. }
  96. })
  97. // 进入页面设置常量
  98. postMessage({
  99. api: 'keepScreenLongLight',
  100. content: {
  101. isOpenLight: type ? true : false
  102. }
  103. })
  104. }
  105. handleInit()
  106. onUnmounted(() => {
  107. handleInit(1)
  108. window.removeEventListener('message', iframeHandle)
  109. })
  110. const route = useRoute()
  111. const headeRef = ref()
  112. const data = reactive({
  113. detail: null as any,
  114. knowledgePointList: [] as any,
  115. itemList: [] as any,
  116. lookVideoDataList: [] as any, // 观看视频统计数据
  117. showHead: true,
  118. isCourse: false,
  119. isRecordPlay: false,
  120. videoRefs: {},
  121. videoState: 'init' as 'init' | 'play',
  122. videoItemRef: null as any,
  123. animationState: 'start' as 'start' | 'end',
  124. disableScreenRecordingFlag: '0' // 是否禁止录屏
  125. })
  126. const activeData = reactive({
  127. isAutoPlay: true, // 是否自动播放
  128. nowTime: 0,
  129. model: true, // 遮罩
  130. isAnimation: true, // 是否动画
  131. videoBtns: true, // 视频
  132. currentTime: 0,
  133. duration: 0,
  134. timer: null as any,
  135. item: null as any
  136. })
  137. // 获取缓存路径
  138. const getCacheFilePath = async (material: any) => {
  139. const res = await promisefiyPostMessage({
  140. api: 'getCourseFilePath',
  141. content: {
  142. url: material.content,
  143. localPath: '',
  144. materialId: material.materialId,
  145. updateTime: material.updateTime,
  146. type: material.type // SONG VIDEO IMAGE
  147. }
  148. })
  149. // console.log('缓存路径返回', res)
  150. return res
  151. }
  152. // 获取当前课程是否签退
  153. const getCourseSchedule = async () => {
  154. if (!route.query.courseId) return
  155. try {
  156. const res = await request.get(
  157. `${state.platformApi}/courseSchedule/detail/${route.query.courseId}`,
  158. {
  159. hideLoading: true
  160. }
  161. )
  162. if (res?.data) {
  163. data.isCourse =
  164. res.data.status === 'ING' && state.platformType == 'TEACHER' ? true : false
  165. // data.isRecordPlay = Date.now() > dayjs(res.data.startTime).valueOf()
  166. }
  167. } catch (e) {
  168. console.log(e)
  169. }
  170. }
  171. const getTempList = async (materialList: any, name: any) => {
  172. const list: any = []
  173. const browserInfo = browser()
  174. for (let j = 0; j < materialList.length; j++) {
  175. const material = materialList[j]
  176. //请求本地缓存
  177. if (browserInfo.isApp && ['VIDEO', 'IMG'].includes(material.type)) {
  178. const localData = await getCacheFilePath(material)
  179. if (localData?.content?.localPath) {
  180. material.url = material.content
  181. material.content = localData.content.localPath
  182. }
  183. }
  184. const videoData = data.lookVideoDataList.find(
  185. (i: any) => i.materialId === material.materialId
  186. )
  187. material.moreTime = videoData?.videoBrowseData ? JSON.parse(videoData.videoBrowseData) : []
  188. material.videoTime = videoData?.videoTime || 0 // 视频时长
  189. material.iframeRef = null
  190. material.videoEle = null
  191. material.tabName = name
  192. material.autoPlay = false //加载完成是否自动播放
  193. material.isprepare = false // 视频是否加载完成
  194. material.isRender = false // 是否渲染了
  195. list.push(material)
  196. // list.push({
  197. // ...material,
  198. // moreTime: videoData?.videoBrowseData ? JSON.parse(videoData.videoBrowseData) : [],
  199. // videoTime: videoData?.videoTime || 0, // 视频时长
  200. // iframeRef: null,
  201. // videoEle: null,
  202. // tabName: name,
  203. // autoPlay: false, //加载完成是否自动播放
  204. // isprepare: false, // 视频是否加载完成
  205. // isRender: false // 是否渲染了
  206. // })
  207. }
  208. return list
  209. }
  210. const getItemList = async () => {
  211. const list: any = []
  212. for (let i = 0; i < data.knowledgePointList.length; i++) {
  213. const item = data.knowledgePointList[i]
  214. if (item.materialList && item.materialList.length > 0) {
  215. const tempList = await getTempList(item.materialList, item.name)
  216. list.push(...tempList)
  217. }
  218. // 第二层级
  219. if (item.children && item.children.length > 0) {
  220. const childrenList = item.children || []
  221. for (let j = 0; j < childrenList.length; j++) {
  222. const childItem = childrenList[j]
  223. const tempList = await getTempList(childItem.materialList, childItem.name)
  224. list.push(...tempList)
  225. }
  226. }
  227. }
  228. // console.log(list, 'list')
  229. let _firstIndex = list.findIndex(
  230. (n: any) =>
  231. n.knowledgePointMaterialRelationId == route.query.kId || n.materialId == route.query.kId
  232. )
  233. _firstIndex = _firstIndex > -1 ? _firstIndex : 0
  234. const item = list[_firstIndex]
  235. // console.log(_firstIndex, '_firstIndex', route.query.kId, 'route.query.kId', item)
  236. // 是否自动播放
  237. if (activeData.isAutoPlay) {
  238. item.autoPlay = true
  239. }
  240. popupData.activeIndex = _firstIndex
  241. popupData.playIndex = _firstIndex
  242. popupData.tabName = item.tabName
  243. popupData.tabActive = item.knowledgePointId
  244. popupData.itemActive = item.id
  245. popupData.itemName = item.name
  246. nextTick(() => {
  247. data.itemList = list
  248. checkedAnimation(popupData.activeIndex)
  249. postMessage({
  250. api: 'courseLoading',
  251. content: {
  252. show: false,
  253. type: 'fullscreen'
  254. }
  255. })
  256. //检测是否录屏
  257. if (data.disableScreenRecordingFlag === '1') {
  258. handleLimitScreenRecord()
  259. }
  260. setTimeout(() => {
  261. data.animationState = 'end'
  262. }, 500)
  263. })
  264. }
  265. const getDetail = async () => {
  266. try {
  267. const res: any = await request.get(
  268. state.platformApi + `/lessonCoursewareDetail/detail/${route.query.id}`,
  269. {
  270. hideLoading: true
  271. }
  272. )
  273. data.detail = res.data
  274. if (res?.data?.lockFlag) {
  275. postMessage({
  276. api: 'courseLoading',
  277. content: {
  278. show: false,
  279. type: 'fullscreen'
  280. }
  281. })
  282. showDialog({
  283. title: '温馨提示',
  284. message: '课件已锁定'
  285. }).then(() => {
  286. goback()
  287. })
  288. return
  289. }
  290. if (Array.isArray(res?.data?.knowledgePointList)) {
  291. let index = 0
  292. data.knowledgePointList = res.data.knowledgePointList.map((n: any) => {
  293. if (Array.isArray(n.materialList)) {
  294. n.materialList = n.materialList.map((item: any) => {
  295. index++
  296. const materialRefs = item.materialRefs ? item.materialRefs : []
  297. const materialMusicId = materialRefs.length > 0 ? materialRefs[0].resourceId : null
  298. return {
  299. ...item,
  300. materialMusicId,
  301. knowledgePointId: [item.knowledgePointId],
  302. materialId: item.id,
  303. id: index + ''
  304. }
  305. })
  306. }
  307. if (Array.isArray(n.children)) {
  308. n.children = n.children.map((cn: any) => {
  309. cn.materialList = cn.materialList.map((item: any) => {
  310. index++
  311. const materialRefs = item.materialRefs ? item.materialRefs : []
  312. const materialMusicId =
  313. materialRefs.length > 0 ? materialRefs[0].resourceId : null
  314. return {
  315. ...item,
  316. materialMusicId,
  317. knowledgePointId: [n.id, item.knowledgePointId],
  318. materialId: item.id,
  319. id: index + ''
  320. }
  321. })
  322. return cn
  323. })
  324. }
  325. return n
  326. })
  327. getItemList()
  328. }
  329. } catch (error) {
  330. console.log(error)
  331. }
  332. }
  333. // ifram事件处理
  334. const iframeHandle = (ev: MessageEvent) => {
  335. if (ev.data?.api === 'headerTogge') {
  336. activeData.model = ev.data.show || (ev.data.playState == 'play' ? false : true)
  337. }
  338. }
  339. // 获取学生观看数据
  340. const getLookVideoData = async () => {
  341. try {
  342. const res = await request.get(
  343. state.platformApi + `/studentCoursewareMaterialRelation/findByDetailId`,
  344. {
  345. hideLoading: true,
  346. params: {
  347. lessonCoursewareDetailId: route.query.id
  348. }
  349. }
  350. )
  351. data.lookVideoDataList = res.data || [] // 视频播放数据
  352. } catch {
  353. //
  354. }
  355. }
  356. // 切换播放
  357. const togglePlay = (m: any, isPlay: boolean) => {
  358. if (isPlay) {
  359. m.videoEle?.play()
  360. } else {
  361. m.videoEle?.pause()
  362. }
  363. }
  364. let timers: any = null
  365. const checkVideoPlay = () => {
  366. const activeVideoRef = data.videoItemRef?.getPlyrRef()
  367. if (activeVideoRef) {
  368. timers = setInterval(() => {
  369. if (!activeVideoRef.paused()) {
  370. activeVideoRef.pause()
  371. clearInterval(timers)
  372. }
  373. activeVideoRef.pause()
  374. }, 100)
  375. }
  376. setTimeout(() => {
  377. clearInterval(timers)
  378. }, 3000)
  379. }
  380. //录屏时间触发
  381. const handleLimitScreenRecord = async () => {
  382. const result = await promisefiyPostMessage({
  383. api: 'getDeviceStatus',
  384. content: { type: 'video' }
  385. })
  386. const { status } = result?.content || {}
  387. if (status == '1') {
  388. data.itemList.forEach((item: any) => (item.autoPlay = false))
  389. handleStop()
  390. // 处理事件 - 事件事件后加载的
  391. checkVideoPlay()
  392. showDialog({
  393. title: '温馨提示',
  394. message: '课件内容请勿录屏',
  395. beforeClose: () => {
  396. return new Promise((resolve) => {
  397. promisefiyPostMessage({
  398. api: 'getDeviceStatus',
  399. content: { type: 'video' }
  400. }).then((res: any) => {
  401. const content = res.content
  402. if (content?.status == '1') {
  403. const activeItem = data.itemList[popupData.activeIndex]
  404. togglePlay(activeItem, false)
  405. resolve(false)
  406. } else {
  407. const activeItem = data.itemList[popupData.activeIndex]
  408. togglePlay(activeItem, true)
  409. resolve(true)
  410. }
  411. })
  412. })
  413. }
  414. })
  415. }
  416. }
  417. // 获取禁止录屏
  418. const sysParamConfig = async () => {
  419. try {
  420. const res = await request.get(`${state.platformApi}/sysParamConfig/queryByParamName`, {
  421. params: {
  422. paramName: 'disable_screen_recording_flag'
  423. }
  424. })
  425. data.disableScreenRecordingFlag = res.data.paramValue || ''
  426. } catch {
  427. //
  428. }
  429. }
  430. onMounted(async () => {
  431. await sysParamConfig()
  432. if (state.platformType === 'STUDENT') {
  433. await getLookVideoData()
  434. }
  435. await getDetail()
  436. const hasFree = String(data.detail?.accessScope) === '0'
  437. if (!hasFree) {
  438. const hasVip = handleCheckVip()
  439. if (!hasVip) {
  440. nextTick(() => {
  441. postMessage({
  442. api: 'courseLoading',
  443. content: {
  444. show: false,
  445. type: 'fullscreen'
  446. }
  447. })
  448. })
  449. return
  450. }
  451. }
  452. getCourseSchedule()
  453. window.addEventListener('message', iframeHandle)
  454. if (data.disableScreenRecordingFlag === '1') {
  455. //禁止录屏 ios
  456. listenerMessage('setVideoPlayer', (result) => {
  457. if (result?.content?.status == 'pause') {
  458. handleLimitScreenRecord()
  459. }
  460. })
  461. // 安卓
  462. postMessage({
  463. api: 'limitScreenRecord',
  464. content: {
  465. type: 1
  466. }
  467. })
  468. }
  469. })
  470. onBeforeUnmount(() => {
  471. postMessage({
  472. api: 'limitScreenRecord',
  473. content: {
  474. type: 0
  475. }
  476. })
  477. })
  478. const playRef = ref()
  479. // 返回
  480. const goback = () => {
  481. try {
  482. playRef.value?.handleOut()
  483. } catch (error) {
  484. console.log(error)
  485. }
  486. postMessage({ api: 'goBack' })
  487. }
  488. const popupData = reactive({
  489. open: false,
  490. activeIndex: 0,
  491. playIndex: 0,
  492. tabActive: '',
  493. tabName: '',
  494. itemActive: '',
  495. itemName: '',
  496. guideOpen: false,
  497. toolOpen: false // 工具弹窗控制
  498. })
  499. const stopVideo = (el: HTMLVideoElement) => {
  500. return new Promise((resolve) => {
  501. if (el.paused) return resolve(true)
  502. el.onpause = () => {
  503. console.log('暂停')
  504. resolve(true)
  505. }
  506. el.pause()
  507. })
  508. }
  509. /**停止所有的播放 */
  510. const handleStop = () => {
  511. for (let i = 0; i < data.itemList.length; i++) {
  512. const activeItem = data.itemList[i]
  513. if (activeItem.type === 'VIDEO') {
  514. // activeItem.videoEle?.currentTime(0)
  515. activeItem.videoEle?.pause()
  516. // activeItem.videoEle?.stop()
  517. }
  518. // 停止曲谱的播放
  519. if (activeItem.type === 'SONG') {
  520. activeItem.iframeRef?.contentWindow?.postMessage({ api: 'setPlayState' }, '*')
  521. }
  522. }
  523. console.log('视频暂停完成')
  524. data.itemList.forEach((item: any) => {
  525. if (item.type === 'SONG') {
  526. item.iframeRef?.contentWindow?.postMessage({ api: 'setPlayState' }, '*')
  527. }
  528. })
  529. }
  530. // 切换素材
  531. const toggleMaterial = (itemActive: any) => {
  532. const index = data.itemList.findIndex((n: any) => n.id == itemActive)
  533. if (index > -1) {
  534. handleSwipeChange(index)
  535. }
  536. }
  537. /** 延迟收起模态框 */
  538. const setModelOpen = () => {
  539. clearTimeout(activeData.timer)
  540. closeToast()
  541. activeData.timer = setTimeout(() => {
  542. activeData.model = false
  543. }, 4000)
  544. }
  545. /** 立即收起所有的模态框 */
  546. const clearModel = () => {
  547. clearTimeout(activeData.timer)
  548. closeToast()
  549. activeData.model = false
  550. }
  551. const toggleModel = (type = true) => {
  552. activeData.model = type
  553. }
  554. // 去点名,签退
  555. const gotoRollCall = (pageTag: string) => {
  556. postMessage({
  557. api: 'open_app_page',
  558. content: {
  559. action: 'app',
  560. pageTag: pageTag,
  561. url: '',
  562. params: JSON.stringify({ courseId: route.query.courseId })
  563. }
  564. })
  565. }
  566. // 双击
  567. const handleDbClick = () => {
  568. if (activeVideoItem.value.type === 'VIDEO') {
  569. const activeVideoRef = data.videoItemRef?.getPlyrRef()
  570. if (activeVideoRef) {
  571. if (activeVideoRef.paused()) {
  572. activeVideoRef.play()
  573. } else {
  574. activeVideoRef.pause()
  575. showToast('已暂停')
  576. }
  577. }
  578. }
  579. }
  580. const effectIndex = ref(0)
  581. const effects = [
  582. {
  583. prev: {
  584. transform: 'translate3d(0, 0, -800px) rotateX(180deg)'
  585. },
  586. next: {
  587. transform: 'translate3d(0, 0, -800px) rotateX(-180deg)'
  588. }
  589. },
  590. {
  591. prev: {
  592. transform: 'translate3d(-100%, 0, -800px)'
  593. },
  594. next: {
  595. transform: 'translate3d(100%, 0, -800px)'
  596. }
  597. },
  598. {
  599. prev: {
  600. transform: 'translate3d(-50%, 0, -800px) rotateY(80deg)'
  601. },
  602. next: {
  603. transform: 'translate3d(50%, 0, -800px) rotateY(-80deg)'
  604. }
  605. },
  606. {
  607. prev: {
  608. transform: 'translate3d(-100%, 0, -800px) rotateY(-120deg)'
  609. },
  610. next: {
  611. transform: 'translate3d(100%, 0, -800px) rotateY(120deg)'
  612. }
  613. },
  614. // 风车4
  615. {
  616. prev: {
  617. transform: 'translate3d(-50%, 50%, -800px) rotateZ(-14deg)',
  618. opacity: 0
  619. },
  620. next: {
  621. transform: 'translate3d(50%, 50%, -800px) rotateZ(14deg)',
  622. opacity: 0
  623. }
  624. },
  625. // 翻页5
  626. {
  627. prev: {
  628. transform: 'translateZ(-800px) rotate3d(0, -1, 0, 90deg)',
  629. opacity: 0
  630. },
  631. next: {
  632. transform: 'translateZ(-800px) rotate3d(0, 1, 0, 90deg)',
  633. opacity: 0
  634. },
  635. current: { transitionDelay: '700ms' }
  636. }
  637. ]
  638. const acitveTimer = ref()
  639. // 轮播切换
  640. const handleSwipeChange = async (index: number) => {
  641. // 如果是当前正在播放 或者是视频最后一个
  642. if (popupData.activeIndex == index) return
  643. await handleStop()
  644. data.animationState = 'start'
  645. data.videoState = 'init'
  646. clearTimeout(acitveTimer.value)
  647. checkedAnimation(popupData.activeIndex, index)
  648. nextTick(() => {
  649. popupData.activeIndex = index
  650. acitveTimer.value = setTimeout(
  651. () => {
  652. popupData.playIndex = index
  653. const item = data.itemList[index]
  654. if (item) {
  655. popupData.tabActive = item.knowledgePointId
  656. popupData.itemActive = item.id
  657. popupData.itemName = item.name
  658. popupData.tabName = item.tabName
  659. if (item.type == 'SONG') {
  660. activeData.model = true
  661. }
  662. }
  663. if (item.type === 'VIDEO') {
  664. // 自动播放下一个视频
  665. clearTimeout(activeData.timer)
  666. closeToast()
  667. item.autoPlay = true
  668. // console.log(item, 'item')
  669. // 当视屏异常时重置链接
  670. if (item.error) {
  671. item.videoEle?.src(item.content)
  672. item.error = false
  673. }
  674. nextTick(() => {
  675. item.videoEle?.play()
  676. })
  677. }
  678. requestAnimationFrame(() => {
  679. const _effectIndex = effectIndex.value + 1
  680. effectIndex.value = _effectIndex >= effects.length - 1 ? 0 : _effectIndex
  681. })
  682. },
  683. activeData.isAnimation ? 800 : 0
  684. )
  685. })
  686. }
  687. /** 是否有转场动画 */
  688. const checkedAnimation = (index: number, nextIndex?: number) => {
  689. nextIndex = nextIndex ? nextIndex : index + 1
  690. const item = data.itemList[index]
  691. const nextItem = data.itemList[nextIndex]
  692. if (nextItem) {
  693. if (nextItem.knowledgePointId != item.knowledgePointId) {
  694. activeData.isAnimation = true
  695. return
  696. }
  697. const videoEle = item.videoEle
  698. const nextVideo = nextItem.videoEle
  699. if (videoEle && videoEle.duration < 8 && index < nextIndex) {
  700. activeData.isAnimation = false
  701. } else if (nextVideo && nextVideo.duration < 8 && index > nextIndex) {
  702. activeData.isAnimation = false
  703. } else {
  704. activeData.isAnimation = true
  705. }
  706. } else {
  707. activeData.isAnimation = item?.adviseStudyTimeSecond < 8 ? false : true
  708. }
  709. }
  710. // 上一个知识点, 下一个知识点
  711. const handlePreAndNext = (type: string) => {
  712. if (type === 'up') {
  713. handleSwipeChange(popupData.activeIndex - 1)
  714. } else {
  715. handleSwipeChange(popupData.activeIndex + 1)
  716. }
  717. }
  718. /** 弹窗关闭 */
  719. const handleClosePopup = () => {
  720. const item = data.itemList[popupData.activeIndex]
  721. if (item?.type == 'VIDEO' && !item.videoEle?.paused) {
  722. setModelOpen()
  723. }
  724. }
  725. /** 教学数据 */
  726. const studyData = reactive({
  727. type: '' as ToolType,
  728. penShow: false
  729. })
  730. /** 打开教学工具 */
  731. const openStudyTool = (item: ToolItem) => {
  732. const activeItem = data.itemList[popupData.activeIndex]
  733. // 暂停视频和曲谱的播放
  734. if (activeItem.type === 'VIDEO' && activeItem.videoEle) {
  735. activeItem.videoEle.pause()
  736. }
  737. if (activeItem.type === 'SONG') {
  738. activeItem.iframeRef?.contentWindow?.postMessage({ api: 'setPlayState' }, '*')
  739. }
  740. clearModel()
  741. popupData.toolOpen = false
  742. studyData.type = item.type
  743. switch (item.type) {
  744. case 'pen':
  745. studyData.penShow = true
  746. break
  747. }
  748. }
  749. /** 关闭教学工具 */
  750. const closeStudyTool = () => {
  751. studyData.type = 'init'
  752. toggleModel()
  753. }
  754. const activeVideoItem = computed(() => {
  755. const item = data.itemList[popupData.activeIndex]
  756. if (item && item.type && item.type.toLocaleUpperCase() === 'VIDEO') {
  757. return item
  758. }
  759. return {}
  760. })
  761. let closeModelTimer: any = null
  762. /**
  763. * 统计视频播放时间段
  764. */
  765. const intervalFnRef = ref() // 定时任务
  766. // 播放视频总时长
  767. const videoIntervalRef = useInterval(1000, { controls: true })
  768. videoIntervalRef.pause()
  769. /**
  770. * 格式化视屏播放有效时间 - 合并区间
  771. * @param intervals [[], []]
  772. * @example [[4, 8],[0, 4],[10, 30]]
  773. * @returns [[0, 8], [10, 30]]
  774. */
  775. const formatEffectiveTime = (intervals: any[]) => {
  776. const res: any = []
  777. intervals.sort((a, b) => a[0] - b[0])
  778. let prev = intervals[0]
  779. for (let i = 1; i < intervals.length; i++) {
  780. const cur = intervals[i]
  781. if (prev[1] >= cur[0]) {
  782. // 有重合
  783. prev[1] = Math.max(cur[1], prev[1])
  784. } else {
  785. // 不重合,prev推入res数组
  786. res.push(prev)
  787. prev = cur // 更新 prev
  788. }
  789. }
  790. res.push(prev)
  791. // console.log(res, 'formatEffectiveTime')
  792. return res
  793. }
  794. /**
  795. * 获取数据有效期
  796. * @param intervals [[], []]
  797. * @returns 0s
  798. */
  799. const formatTimer = (intervals: any[]) => {
  800. const afterIntervals = formatEffectiveTime(intervals)
  801. let time = 0
  802. afterIntervals.forEach((t: any) => {
  803. time += t[1] - t[0]
  804. })
  805. return time
  806. }
  807. // 保存零时时间
  808. // const moreTime: any = ref([]) // 多个观看时间段 已经放到列表里面了
  809. let tempTime: any = [] // 临时存储时间
  810. const currentTimer = useInterval(1000, { controls: true })
  811. // 监听播放状态,
  812. watch(
  813. () => videoIntervalRef.isActive.value,
  814. (newVal: boolean) => {
  815. initVideoCount(newVal)
  816. }
  817. )
  818. /**
  819. * 初始化视频时长
  820. * @param newVal 播放状态
  821. * @param repeat 是否为定时发送的
  822. */
  823. const initVideoCount = (newVal: any, repeat = false) => {
  824. // console.log('watch', forms.player.currentTime)
  825. const activeVideoRef = data.videoItemRef?.getPlyrRef()
  826. const initTime = deepClone(tempTime)
  827. if (repeat) {
  828. if (tempTime.length > 0) {
  829. // console.log('join video', tempTime, 'initTime', initTime)
  830. tempTime[1] = Math.floor(activeVideoRef.currentTime())
  831. }
  832. } else {
  833. if (newVal) {
  834. tempTime[0] = Math.floor(activeVideoRef.currentTime())
  835. } else {
  836. tempTime[1] = Math.floor(activeVideoRef.currentTime())
  837. }
  838. }
  839. if (tempTime.length >= 2) {
  840. // console.log(tempTime, 'tempTime', moreTime.value)
  841. // 处理在短时间内的时间差 【视屏拖动,点击可能会导致时间差太大】
  842. const diffTime = tempTime[1] - tempTime[0] - currentTimer.counter.value > 2
  843. // 结束时间,如果 大于开始时间则清除
  844. if (tempTime[1] >= tempTime[0] && !diffTime) {
  845. data.itemList[popupData.activeIndex].moreTime.push(tempTime)
  846. // moreTime.value.push(tempTime)
  847. }
  848. if (repeat) {
  849. tempTime = deepClone(initTime)
  850. } else {
  851. tempTime = []
  852. currentTimer.counter.value = 0
  853. }
  854. }
  855. }
  856. // 更新时间
  857. const updateStat = async () => {
  858. try {
  859. const itemList = data.itemList
  860. const params: any = []
  861. itemList.forEach((item: any) => {
  862. if (item.moreTime.length > 0) {
  863. const videoBrowseData = formatEffectiveTime(item.moreTime)
  864. const time = videoBrowseData.length > 0 ? formatTimer(videoBrowseData) : 0
  865. const temp = {
  866. lessonCoursewareDetailId: route.query.id,
  867. browseTime: time, // 播放时长
  868. videoBrowseData: JSON.stringify(videoBrowseData), // 播放的数据
  869. videoTime: item.videoTime, // 视频时长
  870. materialId: item.materialId
  871. }
  872. params.push(temp)
  873. }
  874. })
  875. // 只有学生才统计数据
  876. if (params.length > 0 && state.platformType === 'STUDENT') {
  877. await request.post(`${state.platformApi}/studentCoursewareMaterialRelation/save`, {
  878. data: params
  879. })
  880. }
  881. } catch {
  882. //
  883. }
  884. }
  885. onMounted(() => {
  886. // 间隔多少时间同步数据
  887. intervalFnRef.value = useIntervalFn(async () => {
  888. // 同步数据时先进行有效时间进行保存
  889. initVideoCount(false, true)
  890. await updateStat()
  891. videoIntervalRef.counter.value = 0
  892. }, 10000)
  893. })
  894. /** 统计视频播放时间段 */
  895. return () => (
  896. <div id="playContent" class={styles.playContent}>
  897. <div
  898. class={styles.coursewarePlay}
  899. style={{ width: parentContainer.width }}
  900. onClick={() => {
  901. clearTimeout(closeModelTimer)
  902. clearTimeout(activeData.timer)
  903. closeToast()
  904. if (Date.now() - activeData.nowTime < 300) {
  905. handleDbClick()
  906. return
  907. }
  908. activeData.nowTime = Date.now()
  909. closeModelTimer = setTimeout(() => {
  910. activeData.model = !activeData.model
  911. }, 300)
  912. }}
  913. >
  914. <div class={styles.wraps}>
  915. <div
  916. style={
  917. activeVideoItem.value.type &&
  918. data.animationState === 'end' &&
  919. data.videoState === 'play'
  920. ? {
  921. zIndex: 15,
  922. opacity: 1
  923. }
  924. : { opacity: 0, zIndex: -1, pointerEvents: "none" }
  925. }
  926. class={styles.itemDiv}
  927. >
  928. {/* <VideoItem
  929. ref={(el: any) => (data.videoItemRef = el)}
  930. item={activeVideoItem.value}
  931. activeModel={activeData.model}
  932. onClose={setModelOpen}
  933. onPlay={() => {
  934. data.videoState = 'play'
  935. // 设置视频时长
  936. const videoTime = data.videoItemRef.getPlyrRef().duration || 0
  937. data.itemList[popupData.activeIndex].videoTime = Math.floor(videoTime)
  938. }}
  939. onPause={() => {
  940. clearTimeout(activeData.timer)
  941. activeData.model = true
  942. videoIntervalRef.pause()
  943. }}
  944. onEnded={async () => {
  945. const _index = popupData.activeIndex + 1
  946. if (_index < data.itemList.length) {
  947. handleSwipeChange(_index)
  948. } else {
  949. // 说明是最后一个
  950. intervalFnRef.value.pause()
  951. // 同步数据时先进行有效时间进行保存
  952. initVideoCount(false, true)
  953. await updateStat()
  954. }
  955. }}
  956. onSeeked={() => {
  957. videoIntervalRef.isActive.value && videoIntervalRef.pause()
  958. }}
  959. onSeeking={() => {
  960. videoIntervalRef.isActive.value && videoIntervalRef.pause()
  961. }}
  962. onWaiting={() => {
  963. videoIntervalRef.isActive.value && videoIntervalRef.pause()
  964. }}
  965. onTimeupdate={() => {
  966. const activeVideoRef = data.videoItemRef?.getPlyrRef()
  967. if (
  968. !videoIntervalRef.isActive.value &&
  969. activeVideoRef?.currentTime > 0 &&
  970. activeVideoRef?.playing
  971. ) {
  972. videoIntervalRef.resume()
  973. }
  974. }}
  975. /> */}
  976. <VideoPlay
  977. ref={(el: any) => (data.videoItemRef = el)}
  978. item={activeVideoItem.value}
  979. activeModel={activeData.model}
  980. // isEmtry={isEmtry}
  981. onPlay={() => {
  982. data.videoState = 'play'
  983. data.animationState = 'end'
  984. }}
  985. onLoadedmetadata={(videoItem: any) => {
  986. data.videoState = 'play'
  987. activeVideoItem.value.videoEle = videoItem
  988. if (!activeVideoItem.value.isprepare) {
  989. activeVideoItem.value.isprepare = true
  990. }
  991. }}
  992. onPause={() => {
  993. clearTimeout(activeData.timer)
  994. activeData.model = true
  995. videoIntervalRef.pause()
  996. }}
  997. onSeeked={() => {
  998. videoIntervalRef.isActive.value && videoIntervalRef.pause()
  999. }}
  1000. onSeeking={() => {
  1001. videoIntervalRef.isActive.value && videoIntervalRef.pause()
  1002. }}
  1003. onWaiting={() => {
  1004. videoIntervalRef.isActive.value && videoIntervalRef.pause()
  1005. }}
  1006. onTimeupdate={() => {
  1007. const activeVideoRef = data.videoItemRef?.getPlyrRef()
  1008. if (
  1009. !videoIntervalRef.isActive.value &&
  1010. activeVideoRef?.currentTime() > 0 &&
  1011. !activeVideoRef?.paused()
  1012. ) {
  1013. videoIntervalRef.resume()
  1014. }
  1015. }}
  1016. onTogglePlay={(paused: boolean) => {
  1017. // console.log('播放切换', paused)
  1018. // 首次播放完成
  1019. if (!activeVideoItem.value.isprepare) {
  1020. activeVideoItem.value.isprepare = true
  1021. }
  1022. activeVideoItem.value.autoPlay = false
  1023. if (paused || popupData.open || popupData.guideOpen) {
  1024. clearTimeout(activeData.timer)
  1025. } else {
  1026. setModelOpen()
  1027. }
  1028. }}
  1029. onEnded={async () => {
  1030. const _index = popupData.activeIndex + 1
  1031. if (_index < data.itemList.length) {
  1032. handleSwipeChange(_index)
  1033. } else {
  1034. // 说明是最后一个
  1035. intervalFnRef.value.pause()
  1036. // 同步数据时先进行有效时间进行保存
  1037. initVideoCount(false, true)
  1038. await updateStat()
  1039. }
  1040. }}
  1041. onReset={() => {
  1042. if (!activeVideoItem.value.videoEle?.paused) {
  1043. setModelOpen()
  1044. }
  1045. }}
  1046. onError={() => {
  1047. // 视屏异常
  1048. activeVideoItem.value.error = true
  1049. }}
  1050. />
  1051. </div>
  1052. {data.itemList.map((m: any, mIndex: number) => {
  1053. const isRenderItem = Math.abs(popupData.activeIndex - mIndex) < 2
  1054. const isRender = Math.abs(popupData.playIndex - mIndex) < 2
  1055. // 判断是否是当前选中的元素
  1056. const activeEle = popupData.playIndex === mIndex ? true : false
  1057. return isRenderItem ? (
  1058. <div
  1059. key={'index' + mIndex}
  1060. data-id={'data' + mIndex}
  1061. class={[
  1062. styles.itemDiv,
  1063. activeEle && styles.itemActive,
  1064. activeData.isAnimation && styles.acitveAnimation,
  1065. isRenderItem ? styles.show : styles.hide
  1066. ]}
  1067. style={
  1068. mIndex < popupData.activeIndex
  1069. ? effects[effectIndex.value].prev
  1070. : mIndex > popupData.activeIndex
  1071. ? effects[effectIndex.value].next
  1072. : {}
  1073. }
  1074. >
  1075. {/* {m.type === 'VIDEO' && (
  1076. <>
  1077. <VideoPlay
  1078. ref={(v: any) => (data.videoRefs[mIndex] = v)}
  1079. item={m}
  1080. isActive={activeEle}
  1081. isEmtry={isEmtry}
  1082. onPrepare={(val) => {
  1083. m.isprepare = val
  1084. }}
  1085. onLoadedmetadata={(videoItem: any) => {
  1086. m.videoEle = videoItem
  1087. if (!m.isprepare) {
  1088. m.isprepare = true
  1089. }
  1090. }}
  1091. onTogglePlay={(paused: boolean) => {
  1092. // console.log('播放切换', paused)
  1093. if (!m.isprepare) {
  1094. m.isprepare = true
  1095. }
  1096. m.autoPlay = false
  1097. if (paused || popupData.open || popupData.guideOpen) {
  1098. clearTimeout(activeData.timer)
  1099. } else {
  1100. setModelOpen()
  1101. }
  1102. }}
  1103. onEnded={() => {
  1104. const _index = popupData.activeIndex + 1
  1105. if (_index < data.itemList.length) {
  1106. handleSwipeChange(_index)
  1107. }
  1108. }}
  1109. onReset={() => {
  1110. if (!m.videoEle?.paused) {
  1111. setModelOpen()
  1112. }
  1113. }}
  1114. onError={() => {
  1115. // 视屏异常
  1116. m.error = true
  1117. }}
  1118. />
  1119. <Transition name="van-fade">
  1120. {!m.isprepare && (
  1121. <div class={styles.loadWrap}>
  1122. <Vue3Lottie animationData={playLoadData}></Vue3Lottie>
  1123. </div>
  1124. )}
  1125. </Transition>
  1126. </>
  1127. )} */}
  1128. <Transition name="van-fade">
  1129. {m.type === 'VIDEO' &&
  1130. data.animationState !== 'end' &&
  1131. data.videoState != 'play' &&
  1132. !m.isprepare && (
  1133. <div class={styles.loadWrap}>
  1134. <Vue3Lottie animationData={playLoadData}></Vue3Lottie>
  1135. </div>
  1136. )}
  1137. </Transition>
  1138. {isRender && m.type === 'IMG' && (
  1139. <>
  1140. <img src={m.content} />
  1141. {m.materialMusicId && state.platformType !== 'SCHOOL' && (
  1142. <div
  1143. class={[styles.goPractice, activeData.model ? '' : styles.hide]}
  1144. onClick={(e: any) => {
  1145. // 去云练习完整版
  1146. e.stopPropagation()
  1147. const parmas = qs.stringify({
  1148. id: m.materialMusicId
  1149. })
  1150. const src = `${location.origin}/orchestra-music-score/?` + parmas
  1151. postMessage({
  1152. api: 'openAccompanyWebView',
  1153. content: {
  1154. url: src,
  1155. orientation: 0,
  1156. c_orientation: 0,
  1157. isHideTitle: true,
  1158. statusBarTextColor: false,
  1159. isOpenLight: true
  1160. }
  1161. })
  1162. }}
  1163. ></div>
  1164. )}
  1165. </>
  1166. )}
  1167. {isRender && m.type === 'SONG' && (
  1168. <MusicScore
  1169. activeModel={activeData.model}
  1170. data-vid={m.id}
  1171. music={m}
  1172. onSetIframe={(el: any) => {
  1173. m.iframeRef = el
  1174. }}
  1175. />
  1176. )}
  1177. </div>
  1178. ) : (
  1179. ''
  1180. )
  1181. })}
  1182. </div>
  1183. <Transition name="right">
  1184. {activeData.model && (
  1185. <div
  1186. class={styles.rightFixedBtns}
  1187. onClick={(e: Event) => {
  1188. e.stopPropagation()
  1189. clearTimeout(activeData.timer)
  1190. }}
  1191. >
  1192. <div class={styles.btnsWrap}>
  1193. <div
  1194. class={[styles.fullBtn, styles.point]}
  1195. onClick={() => (popupData.open = true)}
  1196. >
  1197. <img src={iconMenu} />
  1198. <span>知识点</span>
  1199. </div>
  1200. </div>
  1201. <div class={[styles.btnsWrap, styles.btnsBottom]}>
  1202. {/* <div class={styles.fullBtn} onClick={() => (popupData.guideOpen = true)}>
  1203. <img src={iconTouping} />
  1204. <span>投屏</span>
  1205. </div> */}
  1206. {data.isCourse && (
  1207. <>
  1208. <div class={styles.fullBtn} onClick={() => gotoRollCall('student_roll_call')}>
  1209. <img src={iconDian} />
  1210. <span>点名</span>
  1211. </div>
  1212. <div class={styles.fullBtn} onClick={() => gotoRollCall('sign_out')}>
  1213. <img src={iconPoint} />
  1214. <span>签退</span>
  1215. </div>
  1216. </>
  1217. )}
  1218. </div>
  1219. </div>
  1220. )}
  1221. </Transition>
  1222. <Transition name="left">
  1223. {activeData.model && (
  1224. <div class={styles.leftFixedBtns} onClick={(e: Event) => e.stopPropagation()}>
  1225. {popupData.activeIndex != 0 && (
  1226. <div class={[styles.btnsWrap, styles.prePoint]}>
  1227. <div
  1228. class={styles.fullBtn}
  1229. onClick={() => {
  1230. // useThrottleFn(() => {
  1231. // handlePreAndNext('up')
  1232. // }, 300)
  1233. // onChangeSwiper('up')
  1234. handlePreAndNext('up')
  1235. }}
  1236. >
  1237. <img src={iconUp} />
  1238. <span style={{ textAlign: 'center' }}>上一个</span>
  1239. </div>
  1240. </div>
  1241. )}
  1242. {popupData.activeIndex != data.itemList.length - 1 && (
  1243. <div class={styles.btnsWrap}>
  1244. <div
  1245. class={styles.fullBtn}
  1246. onClick={() => {
  1247. // console.log('click down')
  1248. // useThrottleFn(() => {
  1249. // console.log('click down pass')
  1250. // handlePreAndNext('down')
  1251. // }, 300)
  1252. // onChangeSwiper('down')
  1253. console.log(notdefined);
  1254. handlePreAndNext('down')
  1255. }}
  1256. >
  1257. <span style={{ textAlign: 'center' }}>下一个</span>
  1258. <img src={iconDown} />
  1259. </div>
  1260. </div>
  1261. )}
  1262. </div>
  1263. )}
  1264. </Transition>
  1265. </div>
  1266. <div
  1267. style={{ transform: activeData.model ? '' : 'translateY(-100%)' }}
  1268. id="coursePlayHeader"
  1269. class={styles.headerContainer}
  1270. ref={headeRef}
  1271. >
  1272. <div class={styles.backBtn} onClick={() => goback()}>
  1273. <Icon name={iconBack} />
  1274. 返回
  1275. </div>
  1276. {data.isCourse && <PlayRecordTime ref={playRef} list={data.knowledgePointList} />}
  1277. <div
  1278. class={styles.menu}
  1279. onClick={() => {
  1280. const _effectIndex = effectIndex.value + 1
  1281. effectIndex.value = _effectIndex >= effects.length - 1 ? 0 : _effectIndex
  1282. setModelOpen()
  1283. }}
  1284. >
  1285. <p>{popupData.tabName}</p>
  1286. </div>
  1287. {state.platformType == 'TEACHER' && (
  1288. <div
  1289. class={styles.headRight}
  1290. onClick={(e: Event) => {
  1291. e.stopPropagation()
  1292. clearTimeout(activeData.timer)
  1293. }}
  1294. >
  1295. <div class={styles.rightBtn} onClick={() => (popupData.guideOpen = true)}>
  1296. <img src={iconTouping} />
  1297. </div>
  1298. <div
  1299. class={styles.rightBtn}
  1300. onClick={() => {
  1301. openStudyTool({
  1302. type: 'pen',
  1303. icon: iconPen,
  1304. name: '批注'
  1305. })
  1306. }}
  1307. >
  1308. <img src={iconPen} />
  1309. </div>
  1310. {/* <div class={styles.rightBtn} onClick={() => (popupData.toolOpen = true)}>
  1311. <img src={iconMore} />
  1312. </div> */}
  1313. </div>
  1314. )}
  1315. </div>
  1316. {/* 更多弹窗 */}
  1317. <Popup
  1318. class={styles.popupMore}
  1319. overlayClass={styles.overlayClass}
  1320. position="right"
  1321. round
  1322. v-model:show={popupData.toolOpen}
  1323. onClose={handleClosePopup}
  1324. >
  1325. <Tool onHandleTool={openStudyTool} />
  1326. </Popup>
  1327. <Popup
  1328. class={styles.popup}
  1329. style={{ background: 'rgba(0,0,0, 0.75)' }}
  1330. overlayClass={styles.overlayClass}
  1331. position="right"
  1332. round
  1333. v-model:show={popupData.open}
  1334. onClose={handleClosePopup}
  1335. >
  1336. <Points
  1337. data={data.knowledgePointList}
  1338. tabActive={popupData.tabActive}
  1339. itemActive={popupData.itemActive}
  1340. onHandleSelect={(res: any) => {
  1341. // onChangeSwiper('change', res.itemActive)
  1342. popupData.open = false
  1343. toggleMaterial(res.itemActive)
  1344. }}
  1345. />
  1346. </Popup>
  1347. <Popup
  1348. class={styles.popup}
  1349. overlayClass={styles.overlayClass}
  1350. position="right"
  1351. round
  1352. v-model:show={popupData.guideOpen}
  1353. onClose={handleClosePopup}
  1354. >
  1355. <OGuide />
  1356. </Popup>
  1357. {studyData.penShow && (
  1358. <Pen show={studyData.type === 'pen'} close={() => closeStudyTool()} />
  1359. )}
  1360. </div>
  1361. )
  1362. }
  1363. })