@x-edu/live-player 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.browserslistrc +10 -0
- package/.eslintignore +8 -0
- package/.eslintrc.js +26 -0
- package/.gem-mine +11 -0
- package/.postcssrc.js +6 -0
- package/babel.config.js +33 -0
- package/dist/XEduLivePlayer.umd.min.js +29419 -0
- package/dist/img/icon_coffee.afc4fe2f.png +0 -0
- package/dist/img/icon_completed.19a464a3.png +0 -0
- package/dist/img/play-button-hover.fdb338b1.png +0 -0
- package/dist/img/play-button.f4b271fb.png +0 -0
- package/dist/img/reload.3cf8ef22.png +0 -0
- package/gem-mine.config.js +86 -0
- package/jest.config.js +9 -0
- package/jsconfig.json +15 -0
- package/mock/helper.js +8 -0
- package/mock/index.js +34 -0
- package/package.json +96 -0
- package/public/.well-known/apple-app-site-association +1 -0
- package/public/3rd/ali-player/alipayercomponents-1.0.8.min.js +26 -0
- package/public/3rd/ali-player/aliplayer-hls-min.js +28 -0
- package/public/3rd/ali-player/aliplayer-min.css +1 -0
- package/public/3rd/ali-player/aliplayer-min.js +2 -0
- package/public/3rd/ali-player/img/fullscreen.png +0 -0
- package/public/3rd/ali-player/img/playanimation.png +0 -0
- package/public/3rd/ali-player/img/smallscreen.png +0 -0
- package/public/3rd/ali-player/img/volume.png +0 -0
- package/public/3rd/im-web-push/index.umd.js +14 -0
- package/public/JsBridge.js +1602 -0
- package/public/fish/editor/lang/zh-cn/zh-cn.min.js +1 -0
- package/public/fish/editor/loading.gif +0 -0
- package/public/fish/editor/themes/default/css/ueditor.css +1906 -0
- package/public/fish/editor/themes/default/images/icons.png +0 -0
- package/public/fish/editor/themes/default/images/scale.png +0 -0
- package/public/fish/editor/themes/default/images/spacer.gif +0 -0
- package/public/fish/editor/themes/default/images/videologo.gif +0 -0
- package/public/fish/editor/themes/iframe.css +0 -0
- package/public/fish/editor/third-party/codemirror/codemirror.css +104 -0
- package/public/fish/editor/third-party/codemirror/codemirror.js +3581 -0
- package/public/fish/editor/third-party/zeroclipboard/ZeroClipboard.js +1256 -0
- package/public/fish/editor/ueditor.all.min.js +17 -0
- package/public/fish/editor/ueditor.config.js +467 -0
- package/public/fish/icon/umd-4.1.2.js +2 -0
- package/public/fish/video/icon_active.gif +0 -0
- package/public/fish/video/videoplayer.min.css +7 -0
- package/public/fish/video/videoplayer.min.js +32 -0
- package/public/fish/video/zh-CN.js +83 -0
- package/public/icon/demo.css +539 -0
- package/public/icon/demo_index.html +2189 -0
- package/public/icon/iconfont.css +363 -0
- package/public/icon/iconfont.js +1 -0
- package/public/icon/iconfont.json +618 -0
- package/public/icon/iconfont.ttf +0 -0
- package/public/icon/iconfont.woff +0 -0
- package/public/icon/iconfont.woff2 +0 -0
- package/public/index.html +50 -0
- package/script/image/readme.md +77 -0
- package/script/postcss.js +48 -0
- package/src/App.jsx +18 -0
- package/src/asset/img/activeBanner//342/200/234/345/217/214/345/207/217/342/200/235/345/267/245/344/275/234.png +0 -0
- package/src/asset/img/activeBanner//344/271/211/345/212/241/346/225/231/350/202/262.png +0 -0
- package/src/asset/img/activeBanner//344/274/230/347/247/200/344/274/240/347/273/237/346/226/207/345/214/226.png +0 -0
- package/src/asset/img/activeBanner//344/275/223/350/202/262/351/224/273/347/202/274.png +0 -0
- package/src/asset/img/activeBanner//345/205/232/345/217/262/345/255/246/344/271/240.png +0 -0
- package/src/asset/img/activeBanner//345/205/232/345/273/272/345/276/267/350/202/262.png +0 -0
- package/src/asset/img/activeBanner//345/212/263/345/212/250/345/205/211/350/215/243.png +0 -0
- package/src/asset/img/activeBanner//345/212/263/345/212/250/345/257/274/350/210/252.png +0 -0
- package/src/asset/img/activeBanner//345/212/263/345/212/250/346/225/231/350/202/262.png +0 -0
- package/src/asset/img/activeBanner//345/212/263/345/212/250/346/231/272/346/205/247.png +0 -0
- package/src/asset/img/activeBanner//345/223/201/345/276/267/346/225/231/350/202/262.png +0 -0
- package/src/asset/img/activeBanner//345/255/246/345/211/215/346/225/231/350/202/262.png +0 -0
- package/src/asset/img/activeBanner//345/256/252/346/263/225/346/263/225/346/262/273.png +0 -0
- package/src/asset/img/activeBanner//345/256/266/345/272/255/346/225/231/350/202/262/346/214/207/345/257/274.png +0 -0
- package/src/asset/img/activeBanner//345/256/266/345/272/255/346/225/231/350/202/262/346/226/271/346/263/225.png +0 -0
- package/src/asset/img/activeBanner//345/256/266/345/272/255/346/225/231/350/202/262/350/247/202/345/277/265.png +0 -0
- package/src/asset/img/activeBanner//345/275/261/350/247/206/346/225/231/350/202/262.png +0 -0
- package/src/asset/img/activeBanner//345/277/203/347/220/206/345/201/245/345/272/267.png +0 -0
- package/src/asset/img/activeBanner//346/200/235/346/224/277/350/257/276/347/250/213.png +0 -0
- package/src/asset/img/activeBanner//346/225/231/345/255/246/346/210/220/346/236/234.png +0 -0
- package/src/asset/img/activeBanner//346/225/231/346/235/220/344/270/223/345/214/272.png +0 -0
- package/src/asset/img/activeBanner//346/225/231/350/202/262/344/277/241/346/201/257/345/214/226.png +0 -0
- package/src/asset/img/activeBanner//346/226/207/345/214/226/350/211/272/346/234/257.png +0 -0
- package/src/asset/img/activeBanner//346/231/256/351/200/232/351/253/230/344/270/255.png +0 -0
- package/src/asset/img/activeBanner//347/210/261/345/233/275/344/270/273/344/271/211.png +0 -0
- package/src/asset/img/activeBanner//347/211/271/346/256/212/346/225/231/350/202/262.png +0 -0
- package/src/asset/img/activeBanner//347/224/237/345/221/275/344/270/216/345/256/211/345/205/250.png +0 -0
- package/src/asset/img/activeBanner//347/224/237/346/200/201/346/226/207/346/230/216.png +0 -0
- package/src/asset/img/activeBanner//347/240/224/345/255/246/345/256/236/350/267/265.png +0 -0
- package/src/asset/img/activeBanner//347/247/221/346/231/256/346/225/231/350/202/262.png +0 -0
- package/src/asset/img/activeBanner//347/273/217/345/205/270/351/230/205/350/257/273.png +0 -0
- package/src/asset/img/activeBanner//347/273/274/345/220/210/346/224/271/351/235/251.png +0 -0
- package/src/asset/img/advertisement.png +0 -0
- package/src/asset/img/bg-block.png +0 -0
- package/src/asset/img/bookhover.png +0 -0
- package/src/asset/img/card.png +0 -0
- package/src/asset/img/catalog/article.png +0 -0
- package/src/asset/img/catalog/audio.png +0 -0
- package/src/asset/img/catalog/course.png +0 -0
- package/src/asset/img/catalog/document.png +0 -0
- package/src/asset/img/catalog/image.png +0 -0
- package/src/asset/img/catalog/link.png +0 -0
- package/src/asset/img/catalog/openClassLive.png +0 -0
- package/src/asset/img/catalog/other.png +0 -0
- package/src/asset/img/catalog/video.png +0 -0
- package/src/asset/img/class-live-header-icon.png +0 -0
- package/src/asset/img/content/article.png +0 -0
- package/src/asset/img/content/document.png +0 -0
- package/src/asset/img/content/image.png +0 -0
- package/src/asset/img/content/url.png +0 -0
- package/src/asset/img/content/video.png +0 -0
- package/src/asset/img/contentType/default.png +0 -0
- package/src/asset/img/contentType/x_article.png +0 -0
- package/src/asset/img/contentType/x_audio_video.png +0 -0
- package/src/asset/img/contentType/x_course.png +0 -0
- package/src/asset/img/contentType/x_document.png +0 -0
- package/src/asset/img/contentType/x_image_list.png +0 -0
- package/src/asset/img/course/book.svg +1 -0
- package/src/asset/img/course/courseBg.png +0 -0
- package/src/asset/img/course/default.png +0 -0
- package/src/asset/img/course/document.png +0 -0
- package/src/asset/img/course/done.png +0 -0
- package/src/asset/img/course/file_doc.svg +1 -0
- package/src/asset/img/course/file_doc_active.svg +1 -0
- package/src/asset/img/course/file_video.svg +1 -0
- package/src/asset/img/course/file_video_active.svg +1 -0
- package/src/asset/img/course/icon_checkbox_linear.svg +1 -0
- package/src/asset/img/course/icondown.png +0 -0
- package/src/asset/img/course/learning.png +0 -0
- package/src/asset/img/course/lecturerDefault.png +0 -0
- package/src/asset/img/course/nolearn.png +0 -0
- package/src/asset/img/course/noplay.png +0 -0
- package/src/asset/img/course/pause.png +0 -0
- package/src/asset/img/course/people.png +0 -0
- package/src/asset/img/course/play.png +0 -0
- package/src/asset/img/course/playing.svg +22 -0
- package/src/asset/img/course/reload.png +0 -0
- package/src/asset/img/course/shouqi_icon.png +0 -0
- package/src/asset/img/course/test.png +0 -0
- package/src/asset/img/course/video.png +0 -0
- package/src/asset/img/def/resource_def.png +0 -0
- package/src/asset/img/def/studio_def.png +0 -0
- package/src/asset/img/def-avatar.jpg +0 -0
- package/src/asset/img/download-active.png +0 -0
- package/src/asset/img/download.png +0 -0
- package/src/asset/img/eduReform/djdy-cover.png +0 -0
- package/src/asset/img/eduReform/djdy.png +0 -0
- package/src/asset/img/eduReform/jxcg-1.png +0 -0
- package/src/asset/img/eduReform/jxcg-2.png +0 -0
- package/src/asset/img/eduReform/jxcg-3.png +0 -0
- package/src/asset/img/eduReform/jxcg-4.png +0 -0
- package/src/asset/img/eduReform/jxcg-cover.png +0 -0
- package/src/asset/img/eduReform/jxgg.png +0 -0
- package/src/asset/img/eduReform/jyxxh-cover.png +0 -0
- package/src/asset/img/eduReform/jyxxh.png +0 -0
- package/src/asset/img/eduReform/ptgz-cover.png +0 -0
- package/src/asset/img/eduReform/ptgz.png +0 -0
- package/src/asset/img/eduReform/sjgz-cover.png +0 -0
- package/src/asset/img/eduReform/sjgz.png +0 -0
- package/src/asset/img/eduReform/tsjy-cover.png +0 -0
- package/src/asset/img/eduReform/tsjy.png +0 -0
- package/src/asset/img/eduReform/xqjy-1.png +0 -0
- package/src/asset/img/eduReform/xqjy-2.png +0 -0
- package/src/asset/img/eduReform/xqjy-3.png +0 -0
- package/src/asset/img/eduReform/xqjy-4.png +0 -0
- package/src/asset/img/eduReform/xqjy-cover.png +0 -0
- package/src/asset/img/eduReform/xqjy.png +0 -0
- package/src/asset/img/eduReform/ywjy-1.png +0 -0
- package/src/asset/img/eduReform/ywjy-2.png +0 -0
- package/src/asset/img/eduReform/ywjy-cover.png +0 -0
- package/src/asset/img/eduReform/ywjy.png +0 -0
- package/src/asset/img/eduReform/zhgg-1.png +0 -0
- package/src/asset/img/eduReform/zhgg-2.png +0 -0
- package/src/asset/img/eduReform/zhgg-cover.png +0 -0
- package/src/asset/img/eduReform/zhgg.png +0 -0
- package/src/asset/img/family/1.jpg +0 -0
- package/src/asset/img/family/ff-1.png +0 -0
- package/src/asset/img/family/ff-2.png +0 -0
- package/src/asset/img/family/ff-3.png +0 -0
- package/src/asset/img/family/ff-cover.png +0 -0
- package/src/asset/img/family/gn-1.png +0 -0
- package/src/asset/img/family/gn-2.png +0 -0
- package/src/asset/img/family/gn-3.png +0 -0
- package/src/asset/img/family/gn-cover.png +0 -0
- package/src/asset/img/family/icon/jyff.png +0 -0
- package/src/asset/img/family/icon/jygn.png +0 -0
- package/src/asset/img/family/icon/jyzd.png +0 -0
- package/src/asset/img/family/zd-1.png +0 -0
- package/src/asset/img/family/zd-2.png +0 -0
- package/src/asset/img/family/zd-3.png +0 -0
- package/src/asset/img/family/zd-cover.png +0 -0
- package/src/asset/img/favicon-m.png +0 -0
- package/src/asset/img/favicon.png +0 -0
- package/src/asset/img/icon-course-white.svg +3 -0
- package/src/asset/img/icon-course.svg +3 -0
- package/src/asset/img/icon-eye-white.svg +4 -0
- package/src/asset/img/icon-eye.svg +4 -0
- package/src/asset/img/icon-school-white.svg +3 -0
- package/src/asset/img/icon-school.svg +3 -0
- package/src/asset/img/img-jgsj/10.png +0 -0
- package/src/asset/img/img-jgsj/3.png +0 -0
- package/src/asset/img/img-jgsj/4.png +0 -0
- package/src/asset/img/img-jgsj/5.png +0 -0
- package/src/asset/img/img-jgsj/6.png +0 -0
- package/src/asset/img/img-jgsj/7-1.png +0 -0
- package/src/asset/img/img-jgsj/7-2.png +0 -0
- package/src/asset/img/img-jgsj/8.png +0 -0
- package/src/asset/img/img-jgsj/8s.png +0 -0
- package/src/asset/img/img-jgsj/9.png +0 -0
- package/src/asset/img/img-search-tag-bottom.png +0 -0
- package/src/asset/img/img-ztjy/1.png +0 -0
- package/src/asset/img/img-ztjy/2.png +0 -0
- package/src/asset/img/img-ztjy/3.png +0 -0
- package/src/asset/img/img-ztjy/4.png +0 -0
- package/src/asset/img/img-ztjy/5.png +0 -0
- package/src/asset/img/img-ztjy/6.png +0 -0
- package/src/asset/img/img-ztjy/icon/agzy.png +0 -0
- package/src/asset/img/img-ztjy/icon/dsxx.png +0 -0
- package/src/asset/img/img-ztjy/icon/kcjx.png +0 -0
- package/src/asset/img/img-ztjy/icon/pdjy.png +0 -0
- package/src/asset/img/img-ztjy/icon/smyaq.png +0 -0
- package/src/asset/img/img-ztjy/icon/stwm.png +0 -0
- package/src/asset/img/img-ztjy/icon/xffz.png +0 -0
- package/src/asset/img/img-ztjy/icon/xljk.png +0 -0
- package/src/asset/img/img-ztjy/icon/yxctwh.png +0 -0
- package/src/asset/img/incentives/star.png +0 -0
- package/src/asset/img/juhe-bg.png +0 -0
- package/src/asset/img/left-hover.png +0 -0
- package/src/asset/img/left-nor.png +0 -0
- package/src/asset/img/living-gif-web.gif +0 -0
- package/src/asset/img/loading.svg +52 -0
- package/src/asset/img/person.png +0 -0
- package/src/asset/img/personalCenter/calendar_icon.png +0 -0
- package/src/asset/img/personalCenter/clock.png +0 -0
- package/src/asset/img/personalCenter/cover.jpg +0 -0
- package/src/asset/img/personalCenter/default_cover.png +0 -0
- package/src/asset/img/personalCenter/header_bg.png +0 -0
- package/src/asset/img/personalCenter/video_icon.png +0 -0
- package/src/asset/img/resource/cover.png +0 -0
- package/src/asset/img/resource/more_close.png +0 -0
- package/src/asset/img/resource/more_open.png +0 -0
- package/src/asset/img/resource/remove.png +0 -0
- package/src/asset/img/resource/tags.png +0 -0
- package/src/asset/img/resource/upload.png +0 -0
- package/src/asset/img/resource//346/211/271/351/207/217/347/274/226/350/276/221@2x.png +0 -0
- package/src/asset/img/right-hover.png +0 -0
- package/src/asset/img/right-icon.png +0 -0
- package/src/asset/img/right-nor.png +0 -0
- package/src/asset/img/schoolService/jdyd-1.png +0 -0
- package/src/asset/img/schoolService/jdyd-2.png +0 -0
- package/src/asset/img/schoolService/jdyd-3.png +0 -0
- package/src/asset/img/schoolService/jdyd-cover.png +0 -0
- package/src/asset/img/schoolService/jdyd.png +0 -0
- package/src/asset/img/schoolService/kpjy-1.png +0 -0
- package/src/asset/img/schoolService/kpjy-2.png +0 -0
- package/src/asset/img/schoolService/kpjy-3.png +0 -0
- package/src/asset/img/schoolService/kpjy-cover.png +0 -0
- package/src/asset/img/schoolService/kpjy.png +0 -0
- package/src/asset/img/schoolService/tydl-1.png +0 -0
- package/src/asset/img/schoolService/tydl-2.png +0 -0
- package/src/asset/img/schoolService/tydl-3.png +0 -0
- package/src/asset/img/schoolService/tydl-cover.png +0 -0
- package/src/asset/img/schoolService/tydl.png +0 -0
- package/src/asset/img/schoolService/whys-1.png +0 -0
- package/src/asset/img/schoolService/whys-2.png +0 -0
- package/src/asset/img/schoolService/whys-3.png +0 -0
- package/src/asset/img/schoolService/whys-4.png +0 -0
- package/src/asset/img/schoolService/whys-cover.png +0 -0
- package/src/asset/img/schoolService/whys.png +0 -0
- package/src/asset/img/schoolService/ysjy-1.png +0 -0
- package/src/asset/img/schoolService/ysjy-2.png +0 -0
- package/src/asset/img/schoolService/ysjy-3.png +0 -0
- package/src/asset/img/schoolService/ysjy-4.png +0 -0
- package/src/asset/img/schoolService/ysjy-cover.png +0 -0
- package/src/asset/img/schoolService/ysjy.png +0 -0
- package/src/asset/img/schoolService/yxjy-cover.png +0 -0
- package/src/asset/img/schoolService/yxsj-1.png +0 -0
- package/src/asset/img/schoolService/yxsj-2.png +0 -0
- package/src/asset/img/schoolService/yxsj-3.png +0 -0
- package/src/asset/img/schoolService/yxsj.png +0 -0
- package/src/asset/img/sedu/catalog/list.png +0 -0
- package/src/asset/img/sedu/icon/agzy-prefix.png +0 -0
- package/src/asset/img/sedu/icon/agzy.png +0 -0
- package/src/asset/img/sedu/icon/arrow-hover.png +0 -0
- package/src/asset/img/sedu/icon/arrow.png +0 -0
- package/src/asset/img/sedu/icon/dsxx-prefix.png +0 -0
- package/src/asset/img/sedu/icon/dsxx.png +0 -0
- package/src/asset/img/sedu/icon/epidemic-prevention-bg.png +0 -0
- package/src/asset/img/sedu/icon/epidemic-prevention.png +0 -0
- package/src/asset/img/sedu/icon/family-bg.png +0 -0
- package/src/asset/img/sedu/icon/family.png +0 -0
- package/src/asset/img/sedu/icon/film-bg.png +0 -0
- package/src/asset/img/sedu/icon/film.png +0 -0
- package/src/asset/img/sedu/icon/go-more-hover.png +0 -0
- package/src/asset/img/sedu/icon/go-more.png +0 -0
- package/src/asset/img/sedu/icon/kcjx.png +0 -0
- package/src/asset/img/sedu/icon/ldjy-prefix.png +0 -0
- package/src/asset/img/sedu/icon/life-safe-bg.png +0 -0
- package/src/asset/img/sedu/icon/life-safe.png +0 -0
- package/src/asset/img/sedu/icon/morality-bg.png +0 -0
- package/src/asset/img/sedu/icon/morality.png +0 -0
- package/src/asset/img/sedu/icon/more-bg.png +0 -0
- package/src/asset/img/sedu/icon/more.png +0 -0
- package/src/asset/img/sedu/icon/party-history-bg.png +0 -0
- package/src/asset/img/sedu/icon/party-history.png +0 -0
- package/src/asset/img/sedu/icon/pdjy-prefix.png +0 -0
- package/src/asset/img/sedu/icon/pdjy.png +0 -0
- package/src/asset/img/sedu/icon/psychological-bg.png +0 -0
- package/src/asset/img/sedu/icon/psychological.png +0 -0
- package/src/asset/img/sedu/icon/read-bg.png +0 -0
- package/src/asset/img/sedu/icon/read.png +0 -0
- package/src/asset/img/sedu/icon/smaq-prefix.png +0 -0
- package/src/asset/img/sedu/icon/smyaq.png +0 -0
- package/src/asset/img/sedu/icon/study-bg.png +0 -0
- package/src/asset/img/sedu/icon/study.png +0 -0
- package/src/asset/img/sedu/icon/stwm-prefix.png +0 -0
- package/src/asset/img/sedu/icon/stwm.png +0 -0
- package/src/asset/img/sedu/icon/xffz-prefix.png +0 -0
- package/src/asset/img/sedu/icon/xffz.png +0 -0
- package/src/asset/img/sedu/icon/xljk-prefix.png +0 -0
- package/src/asset/img/sedu/icon/xljk.png +0 -0
- package/src/asset/img/sedu/icon/yxctwh-prefix.png +0 -0
- package/src/asset/img/sedu/icon/yxctwh.png +0 -0
- package/src/asset/img/sedu/nav_new/agzy-1.png +0 -0
- package/src/asset/img/sedu/nav_new/agzy-2.png +0 -0
- package/src/asset/img/sedu/nav_new/agzy-3.png +0 -0
- package/src/asset/img/sedu/nav_new/agzy-cover.png +0 -0
- package/src/asset/img/sedu/nav_new/agzy.png +0 -0
- package/src/asset/img/sedu/nav_new/dsxx-1.png +0 -0
- package/src/asset/img/sedu/nav_new/dsxx-2.png +0 -0
- package/src/asset/img/sedu/nav_new/dsxx-3.png +0 -0
- package/src/asset/img/sedu/nav_new/dsxx-cover.png +0 -0
- package/src/asset/img/sedu/nav_new/dsxx.png +0 -0
- package/src/asset/img/sedu/nav_new/jdwy-1.png +0 -0
- package/src/asset/img/sedu/nav_new/jdwy-2.png +0 -0
- package/src/asset/img/sedu/nav_new/jdwy-3.png +0 -0
- package/src/asset/img/sedu/nav_new/ldjy-1.png +0 -0
- package/src/asset/img/sedu/nav_new/ldjy-2.png +0 -0
- package/src/asset/img/sedu/nav_new/ldjy-3.png +0 -0
- package/src/asset/img/sedu/nav_new/ldjy-cover.png +0 -0
- package/src/asset/img/sedu/nav_new/ldjy.png +0 -0
- package/src/asset/img/sedu/nav_new/pdjy-1.png +0 -0
- package/src/asset/img/sedu/nav_new/pdjy-2.png +0 -0
- package/src/asset/img/sedu/nav_new/pdjy-3.png +0 -0
- package/src/asset/img/sedu/nav_new/pdjy-cover.png +0 -0
- package/src/asset/img/sedu/nav_new/pdjy.png +0 -0
- package/src/asset/img/sedu/nav_new/smyaq-1.png +0 -0
- package/src/asset/img/sedu/nav_new/smyaq-2.png +0 -0
- package/src/asset/img/sedu/nav_new/smyaq-3.png +0 -0
- package/src/asset/img/sedu/nav_new/smyaq-4.png +0 -0
- package/src/asset/img/sedu/nav_new/smyaq-cover.png +0 -0
- package/src/asset/img/sedu/nav_new/smyaq.png +0 -0
- package/src/asset/img/sedu/nav_new/stwm-1.png +0 -0
- package/src/asset/img/sedu/nav_new/stwm-2.png +0 -0
- package/src/asset/img/sedu/nav_new/stwm-3.png +0 -0
- package/src/asset/img/sedu/nav_new/stwm-cover.png +0 -0
- package/src/asset/img/sedu/nav_new/stwm.png +0 -0
- package/src/asset/img/sedu/nav_new/xffz-1.png +0 -0
- package/src/asset/img/sedu/nav_new/xffz-2.png +0 -0
- package/src/asset/img/sedu/nav_new/xffz-3.png +0 -0
- package/src/asset/img/sedu/nav_new/xffz-4.png +0 -0
- package/src/asset/img/sedu/nav_new/xffz-cover.png +0 -0
- package/src/asset/img/sedu/nav_new/xffz.png +0 -0
- package/src/asset/img/sedu/nav_new/xljk-1.png +0 -0
- package/src/asset/img/sedu/nav_new/xljk-2.png +0 -0
- package/src/asset/img/sedu/nav_new/xljk-3.png +0 -0
- package/src/asset/img/sedu/nav_new/xljk-cover.png +0 -0
- package/src/asset/img/sedu/nav_new/xljk.png +0 -0
- package/src/asset/img/sedu/nav_new/yxctwh-1.png +0 -0
- package/src/asset/img/sedu/nav_new/yxctwh-2.png +0 -0
- package/src/asset/img/sedu/nav_new/yxctwh-3.png +0 -0
- package/src/asset/img/sedu/nav_new/zgwhct-cover.png +0 -0
- package/src/asset/img/sedu/nav_new/zgwhct.png +0 -0
- package/src/asset/img/star.png +0 -0
- package/src/asset/img/star_filled.png +0 -0
- package/src/asset/img/star_hover.png +0 -0
- package/src/asset/img/up-hover.png +0 -0
- package/src/asset/img/up-nor.png +0 -0
- package/src/asset/img/video-play.svg +6 -0
- package/src/asset/style/background.less +20 -0
- package/src/asset/style/banner.less +36 -0
- package/src/asset/style/base.less +74 -0
- package/src/asset/style/index.less +114 -0
- package/src/asset/style/reset-theme.less +142 -0
- package/src/asset/style/theme/index.less +55 -0
- package/src/asset/style/theme/party/global.less +20 -0
- package/src/asset/style/theme/party/img/footer-bg.png +0 -0
- package/src/asset/style/theme/party/img/header-bg-1.png +0 -0
- package/src/asset/style/theme/party/img/header-bg-2.png +0 -0
- package/src/asset/style/theme/party/img/header-bg.png +0 -0
- package/src/asset/style/theme/party/img/logo.png +0 -0
- package/src/asset/style/theme/party/override.less +57 -0
- package/src/asset/style/theme/test/global.less +18 -0
- package/src/asset/style/theme/test/img/footer-bg.png +0 -0
- package/src/asset/style/theme/test/img/header-bg-1.png +0 -0
- package/src/asset/style/theme/test/img/header-bg-2.png +0 -0
- package/src/asset/style/theme/test/img/header-bg.png +0 -0
- package/src/asset/style/theme/test/img/logo.png +0 -0
- package/src/asset/style/theme/test/override.less +45 -0
- package/src/asset/style/variable.less +12 -0
- package/src/component/AliPlayer/index.jsx +46 -0
- package/src/component/Avatar/index.jsx +52 -0
- package/src/component/Empty/img/empty.png +0 -0
- package/src/component/Empty/index.jsx +36 -0
- package/src/component/Empty/index.module.less +37 -0
- package/src/component/IMChatroom/asset/style/images/welcome-m.png +0 -0
- package/src/component/IMChatroom/asset/style/images/welcome.png +0 -0
- package/src/component/IMChatroom/asset/style/index.module.less +0 -0
- package/src/component/IMChatroom/component/status/403.jsx +13 -0
- package/src/component/IMChatroom/component/status/404.jsx +13 -0
- package/src/component/IMChatroom/component/status/Error.jsx +23 -0
- package/src/component/IMChatroom/component/status/Loading.jsx +5 -0
- package/src/component/IMChatroom/config/app/config.js +118 -0
- package/src/component/IMChatroom/config/app/index.js +60 -0
- package/src/component/IMChatroom/config/env.js +5 -0
- package/src/component/IMChatroom/config/index.js +3 -0
- package/src/component/IMChatroom/config/request/config/base.js +124 -0
- package/src/component/IMChatroom/config/request/config/chatroom.js +26 -0
- package/src/component/IMChatroom/config/request/config/imCoreApi.js +21 -0
- package/src/component/IMChatroom/config/request/index.js +21 -0
- package/src/component/IMChatroom/config/request/proxy.js +39 -0
- package/src/component/IMChatroom/config/url.js +7 -0
- package/src/component/IMChatroom/constants/errorCode.js +9 -0
- package/src/component/IMChatroom/constants/index.js +84 -0
- package/src/component/IMChatroom/constants/origin.js +27 -0
- package/src/component/IMChatroom/context/chatroom.js +154 -0
- package/src/component/IMChatroom/context/connect.js +28 -0
- package/src/component/IMChatroom/i18n/en/index.json +73 -0
- package/src/component/IMChatroom/i18n/index.jsx +14 -0
- package/src/component/IMChatroom/i18n/language.js +9 -0
- package/src/component/IMChatroom/i18n/zh-CN/index.json +73 -0
- package/src/component/IMChatroom/index.jsx +49 -0
- package/src/component/IMChatroom/page/chat/index.jsx +27 -0
- package/src/component/IMChatroom/page/chat/messageEditor/index.jsx +375 -0
- package/src/component/IMChatroom/page/chat/messageList/index.jsx +354 -0
- package/src/component/IMChatroom/page/chat/stickedMessage/index.jsx +59 -0
- package/src/component/IMChatroom/page/chat/stickedMessage/style/index.module.less +8 -0
- package/src/component/IMChatroom/page/chat/style/index.module.less +52 -0
- package/src/component/IMChatroom/page/home/connect/index.jsx +188 -0
- package/src/component/IMChatroom/page/home/connect/status.jsx +124 -0
- package/src/component/IMChatroom/page/home/context/cmd.jsx +37 -0
- package/src/component/IMChatroom/page/home/context/index.jsx +67 -0
- package/src/component/IMChatroom/page/home/index.jsx +164 -0
- package/src/component/IMChatroom/page/home/notice/index.jsx +123 -0
- package/src/component/IMChatroom/page/home/notice/style/index.module.less +50 -0
- package/src/component/IMChatroom/page/home/style/images/font-size-active-m.png +0 -0
- package/src/component/IMChatroom/page/home/style/images/font-size-active.png +0 -0
- package/src/component/IMChatroom/page/home/style/images/font-size-m.png +0 -0
- package/src/component/IMChatroom/page/home/style/images/font-size.png +0 -0
- package/src/component/IMChatroom/page/home/style/images/notice-active-m.png +0 -0
- package/src/component/IMChatroom/page/home/style/images/notice-active.png +0 -0
- package/src/component/IMChatroom/page/home/style/images/notice-m.png +0 -0
- package/src/component/IMChatroom/page/home/style/images/notice.png +0 -0
- package/src/component/IMChatroom/page/home/style/index.module.less +111 -0
- package/src/component/IMChatroom/page/member/index.jsx +15 -0
- package/src/component/IMChatroom/page/member/memberCount/index.jsx +44 -0
- package/src/component/IMChatroom/page/member/memberList/index.jsx +121 -0
- package/src/component/IMChatroom/page/member/style/index.module.less +3 -0
- package/src/component/IMChatroom/sdk/bridge.js +39 -0
- package/src/component/IMChatroom/sdk/cs/constants.js +20 -0
- package/src/component/IMChatroom/sdk/cs/index.js +101 -0
- package/src/component/IMChatroom/sdk/imChatroom.js +15 -0
- package/src/component/IMChatroom/sdk/imcore/constants.js +128 -0
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomDestroyed.js +5 -0
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomInfoGetFail.js +5 -0
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomKickedByAdmin.js +5 -0
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomKickedBySelf.js +5 -0
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomLoginFail.js +5 -0
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomLoginSuccess.js +5 -0
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomMemberLogin.js +5 -0
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomMemberLogout.js +5 -0
- package/src/component/IMChatroom/sdk/imcore/emitters/connectionConnected.js +5 -0
- package/src/component/IMChatroom/sdk/imcore/emitters/connectionConnecting.js +5 -0
- package/src/component/IMChatroom/sdk/imcore/emitters/connectionDisconnect.js +5 -0
- package/src/component/IMChatroom/sdk/imcore/emitters/index.js +57 -0
- package/src/component/IMChatroom/sdk/imcore/emitters/messageReceive.js +36 -0
- package/src/component/IMChatroom/sdk/imcore/index.js +178 -0
- package/src/component/IMChatroom/sdk/imcore/interceptors/request.js +7 -0
- package/src/component/IMChatroom/sdk/imcore/interceptors/response.js +5 -0
- package/src/component/IMChatroom/sdk/imcore/plugins/getAuth.js +64 -0
- package/src/component/IMChatroom/sdk/imcore/plugins/getConversationId.js +20 -0
- package/src/component/IMChatroom/sdk/imcore/plugins/getExtInfo.js +10 -0
- package/src/component/IMChatroom/sdk/imcore/plugins/getLoginInfo.js +48 -0
- package/src/component/IMChatroom/sdk/imcore/plugins/getPlatformType.js +12 -0
- package/src/component/IMChatroom/sdk/imcore/plugins/index.js +22 -0
- package/src/component/IMChatroom/sdk/imcore/util/format.js +177 -0
- package/src/component/IMChatroom/sdk/imcore/util/parser.js +35 -0
- package/src/component/IMChatroom/sdk/oms.js +18 -0
- package/src/component/IMChatroom/sdk/uc.js +3 -0
- package/src/component/IMChatroom/subscription/channel/app.js +5 -0
- package/src/component/IMChatroom/subscription/channel/ctl.js +22 -0
- package/src/component/IMChatroom/subscription/channel/member.js +40 -0
- package/src/component/IMChatroom/subscription/channel/message.js +13 -0
- package/src/component/IMChatroom/subscription/channel/ntf.js +86 -0
- package/src/component/IMChatroom/subscription/channel/tel.js +5 -0
- package/src/component/IMChatroom/subscription/channel/websocket.js +5 -0
- package/src/component/IMChatroom/subscription/event.js +37 -0
- package/src/component/IMChatroom/subscription/index.js +19 -0
- package/src/component/IMChatroom/util/account.js +8 -0
- package/src/component/IMChatroom/util/chatroom.js +255 -0
- package/src/component/IMChatroom/util/jsonBigInt.js +5 -0
- package/src/component/IMChatroom/util/location.js +12 -0
- package/src/component/PlayerTip/index.jsx +34 -0
- package/src/component/VideoBase/index.jsx +242 -0
- package/src/component/VideoBase/style.less +66 -0
- package/src/component/VideoBase/utils.js +81 -0
- package/src/component/mixin.less +10 -0
- package/src/component/status/403.jsx +15 -0
- package/src/component/status/404/img/404.png +0 -0
- package/src/component/status/404/index.jsx +73 -0
- package/src/component/status/404/index.module.less +36 -0
- package/src/component/status/Error/error.module.less +14 -0
- package/src/component/status/Error/img/error.png +0 -0
- package/src/component/status/Error/index.jsx +47 -0
- package/src/component/status/Loading/img/loading.svg +52 -0
- package/src/component/status/Loading/index.jsx +31 -0
- package/src/component/status/Loading/index.less +57 -0
- package/src/component/status/None/img/404.png +0 -0
- package/src/component/status/None/index.jsx +20 -0
- package/src/component/status/None/index.module.less +35 -0
- package/src/component/status/Status/index.jsx +26 -0
- package/src/component/status/Status/index.module.less +9 -0
- package/src/config/constant/commonUrl.js +2 -0
- package/src/config/constant/user.js +6 -0
- package/src/config/context/site-config.js +48 -0
- package/src/config/env/index.js +5 -0
- package/src/config/env/local/index.js +13 -0
- package/src/config/env/ncet-xedu/api.js +175 -0
- package/src/config/env/ncet-xedu/app.js +12 -0
- package/src/config/env/ncet-xedu/cs.js +8 -0
- package/src/config/env/ncet-xedu/index.js +14 -0
- package/src/config/env/ncet-xedu/push.js +5 -0
- package/src/config/env/preproduction/api.js +144 -0
- package/src/config/env/preproduction/app.js +12 -0
- package/src/config/env/preproduction/cs.js +8 -0
- package/src/config/env/preproduction/index.js +14 -0
- package/src/config/env/preproduction/push.js +5 -0
- package/src/config/env/product/api.js +113 -0
- package/src/config/env/product/app.js +12 -0
- package/src/config/env/product/cs.js +5 -0
- package/src/config/env/product/index.js +14 -0
- package/src/config/env/product/push.js +5 -0
- package/src/config/live.js +80 -0
- package/src/config/publicLive.js +53 -0
- package/src/config/request/assessments.js +24 -0
- package/src/config/request/config-center.js +8 -0
- package/src/config/request/helper.js +166 -0
- package/src/config/request/im-broadcasts.js +12 -0
- package/src/config/request/live-activity-gateway.js +8 -0
- package/src/config/request/live-activity.js +13 -0
- package/src/config/request/raw.js +6 -0
- package/src/config/request/x-cloud-web.js +13 -0
- package/src/config/request/x-proxy.js +34 -0
- package/src/detail/LineSwitch/index.jsx +71 -0
- package/src/detail/LineSwitch/index.module.less +0 -0
- package/src/detail/LiveCountDown/index.jsx +44 -0
- package/src/detail/LiveCountDown/index.module.less +32 -0
- package/src/detail/LiveOnlineCount/img/icon.svg +16 -0
- package/src/detail/LiveOnlineCount/index.jsx +68 -0
- package/src/detail/LiveOnlineCount/index.module.less +33 -0
- package/src/detail/LiveOnlineCount/util.js +74 -0
- package/src/detail/LiveStatus/AnchorOnTheWay.jsx +78 -0
- package/src/detail/LiveStatus/index.jsx +186 -0
- package/src/detail/LiveStatus/index.module.less +193 -0
- package/src/detail/LiveVideo/asset/play-button-hover-m.png +0 -0
- package/src/detail/LiveVideo/asset/play-button-hover.png +0 -0
- package/src/detail/LiveVideo/asset/play-button-m.png +0 -0
- package/src/detail/LiveVideo/asset/play-button.png +0 -0
- package/src/detail/LiveVideo/config.js +37 -0
- package/src/detail/LiveVideo/index.jsx +186 -0
- package/src/detail/LiveVideo/index.module.less +41 -0
- package/src/detail/NotLoginChatroom/asset/empty-m.png +0 -0
- package/src/detail/NotLoginChatroom/asset/empty.png +0 -0
- package/src/detail/NotLoginChatroom/index.jsx +37 -0
- package/src/detail/NotLoginChatroom/index.module.less +46 -0
- package/src/detail/RecordVideo/index.jsx +148 -0
- package/src/detail/RecordVideo/index.module.less +32 -0
- package/src/detail/ReplayVideo/index.jsx +93 -0
- package/src/detail/ReplayVideo/index.module.less +65 -0
- package/src/detail/const.js +20 -0
- package/src/detail/hook/usePullSource.js +50 -0
- package/src/detail/hook/usePullState.js +51 -0
- package/src/detail/img/icon_coffee.png +0 -0
- package/src/detail/img/icon_completed.png +0 -0
- package/src/detail/index.jsx +479 -0
- package/src/detail/index.module.less +164 -0
- package/src/hook/useAsync.js +84 -0
- package/src/hook/useGoToPage.js +83 -0
- package/src/hook/useInterval.js +28 -0
- package/src/hook/useIsMounted.js +17 -0
- package/src/hook/useModuleByRole.js +53 -0
- package/src/hook/usePageScrollable.js +52 -0
- package/src/hook/usePortal.js +83 -0
- package/src/hook/useScrollRestore/index.js +32 -0
- package/src/hook/useScrollRestore/scrollContext.js +20 -0
- package/src/hook/useTrackRef.js +11 -0
- package/src/hook/useWindowSize.js +28 -0
- package/src/hook/useZoom.js +47 -0
- package/src/index.js +15 -0
- package/src/lib/getServiceConfig.js +102 -0
- package/src/service/common.js +73 -0
- package/src/service/content-mgr.js +73 -0
- package/src/service/im-group.js +12 -0
- package/src/service/im.js +7 -0
- package/src/service/imBroadcasts.js +33 -0
- package/src/service/like.js +134 -0
- package/src/service/live.js +236 -0
- package/src/service/manageApi.js +7 -0
- package/src/service/managePortal.js +6 -0
- package/src/service/myStudyRecord.js +93 -0
- package/src/service/navigation.js +47 -0
- package/src/service/ndMeeting.js +10 -0
- package/src/service/ndr.js +122 -0
- package/src/service/news.js +93 -0
- package/src/service/personalCenter.js +270 -0
- package/src/service/qualityCourse.js +31 -0
- package/src/service/recommend.js +81 -0
- package/src/service/school.js +323 -0
- package/src/service/search.js +170 -0
- package/src/service/site-config.js +7 -0
- package/src/service/socialCensor.js +45 -0
- package/src/service/specialEdu.js +31 -0
- package/src/service/suggestion.js +85 -0
- package/src/service/syncClassroom.js +321 -0
- package/src/service/tCourse.js +204 -0
- package/src/service/tchTraining.js +37 -0
- package/src/service/uc.js +45 -0
- package/src/util/app.js +1 -0
- package/src/util/array.js +3 -0
- package/src/util/auth/func.js +57 -0
- package/src/util/date.js +53 -0
- package/src/util/env.js +9 -0
- package/src/util/getTimestamp.js +10 -0
- package/src/util/hof.js +105 -0
- package/src/util/live/index.js +42 -0
- package/src/util/netUrl.js +35 -0
- package/src/util/object.js +13 -0
- package/src/util/push/index.js +58 -0
- package/src/util/request.js +227 -0
- package/src/util/type.js +17 -0
- package/src/util/url.js +203 -0
- package/src/util/video.js +26 -0
- package/test/setup.js +21 -0
- package/test/unit/component/header/logo.spec.jsx +8 -0
- package/test/unit/helper.jsx +25 -0
- package/test/unit/util/date.spec.js +40 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useState, useMemo, useEffect } from 'react'
|
|
2
|
+
import throttle from 'lodash/throttle'
|
|
3
|
+
import reactDom from 'react-dom'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* useAsync
|
|
7
|
+
*
|
|
8
|
+
* Notice: 所有参数不应发生变化
|
|
9
|
+
*
|
|
10
|
+
* @param {function} fn 执行函数
|
|
11
|
+
* @param {object} options
|
|
12
|
+
* @param {number?} options.throttleInterval 默认0不生效
|
|
13
|
+
* @param {number?} options.loadingDelay 默认0不生效
|
|
14
|
+
* @param {string?} options.cacheKey 默认不Cache
|
|
15
|
+
* @returns {object} { }
|
|
16
|
+
*/
|
|
17
|
+
export default function useAsync(fn, {
|
|
18
|
+
throttleInterval = 0,
|
|
19
|
+
loadingDelay = 0,
|
|
20
|
+
immediate = false
|
|
21
|
+
} = {}) {
|
|
22
|
+
const [hasRequested, setHasRequested] = useState(false)
|
|
23
|
+
const [loading, setLoading] = useState(false)
|
|
24
|
+
const [data, setData] = useState()
|
|
25
|
+
const [error, setError] = useState()
|
|
26
|
+
|
|
27
|
+
const run = useMemo(() => {
|
|
28
|
+
const execFn = async (...args) => {
|
|
29
|
+
let result
|
|
30
|
+
setLoading(true)
|
|
31
|
+
setHasRequested(true)
|
|
32
|
+
try {
|
|
33
|
+
result = await fn(...args)
|
|
34
|
+
} catch (e) {
|
|
35
|
+
if (loadingDelay) {
|
|
36
|
+
await sleep(loadingDelay)
|
|
37
|
+
}
|
|
38
|
+
batchSet(() => {
|
|
39
|
+
setLoading(false)
|
|
40
|
+
setError(e)
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
if (loadingDelay) {
|
|
44
|
+
await sleep(loadingDelay)
|
|
45
|
+
}
|
|
46
|
+
batchSet(() => {
|
|
47
|
+
setLoading(false)
|
|
48
|
+
setData(result)
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
if (throttleInterval) {
|
|
52
|
+
return throttle(execFn, throttleInterval, {
|
|
53
|
+
leading: true,
|
|
54
|
+
trailing: true
|
|
55
|
+
})
|
|
56
|
+
} else {
|
|
57
|
+
return execFn
|
|
58
|
+
}
|
|
59
|
+
}, [])
|
|
60
|
+
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (immediate) {
|
|
63
|
+
run()
|
|
64
|
+
}
|
|
65
|
+
}, [immediate])
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
hasRequested,
|
|
69
|
+
loading,
|
|
70
|
+
data,
|
|
71
|
+
error,
|
|
72
|
+
run
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function batchSet(fn) {
|
|
77
|
+
reactDom.unstable_batchedUpdates(fn)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function sleep(ms) {
|
|
81
|
+
return new Promise((resolve) => {
|
|
82
|
+
setTimeout(resolve, ms)
|
|
83
|
+
})
|
|
84
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useHistory } from 'react-router-dom'
|
|
2
|
+
|
|
3
|
+
const smartcan = window.Bridge && window.navigator.userAgent.indexOf('SmartCanWebView') !== -1
|
|
4
|
+
|
|
5
|
+
// function getQueryVariable(variable, path) {
|
|
6
|
+
// const vars = path.split('&')
|
|
7
|
+
// for (let i = 0; i < vars.length; i++) {
|
|
8
|
+
// const pair = vars[i].split('=')
|
|
9
|
+
// if (pair[0] === variable) {
|
|
10
|
+
// return pair[1]
|
|
11
|
+
// }
|
|
12
|
+
// }
|
|
13
|
+
// return null
|
|
14
|
+
// }
|
|
15
|
+
|
|
16
|
+
export default function useGoToPage() {
|
|
17
|
+
const history = useHistory()
|
|
18
|
+
return async (subPath, {
|
|
19
|
+
useBridge = false,
|
|
20
|
+
newPage
|
|
21
|
+
} = {}) => {
|
|
22
|
+
if (smartcan && useBridge) {
|
|
23
|
+
let targetPath
|
|
24
|
+
// url 是cmp地址,直接跳转
|
|
25
|
+
if (subPath?.startsWith('cmp://')) {
|
|
26
|
+
targetPath = subPath
|
|
27
|
+
} else if (subPath.indexOf('http') === 0) {
|
|
28
|
+
targetPath = subPath
|
|
29
|
+
} else if (subPath.substr(0, 1) === '/') {
|
|
30
|
+
targetPath = `${window.location.origin}${subPath}`
|
|
31
|
+
} else {
|
|
32
|
+
targetPath = `${window.location.href}${subPath.substr(1)}`
|
|
33
|
+
}
|
|
34
|
+
// const title = getQueryVariable('_maf_webview_title', targetPath) || '国家智慧教育读书平台'
|
|
35
|
+
targetPath = addQuery(targetPath, {
|
|
36
|
+
_maf_menu_ids: getMenuIds(subPath),
|
|
37
|
+
_maf_show_progress_bar: false,
|
|
38
|
+
_maf_need_decode: true
|
|
39
|
+
})
|
|
40
|
+
const appfactory = window.Bridge.require('sdp.appfactory').promise()
|
|
41
|
+
const result = await appfactory.goPage({
|
|
42
|
+
page: targetPath
|
|
43
|
+
})
|
|
44
|
+
return result
|
|
45
|
+
} else if (window.parent === window.self) {
|
|
46
|
+
if (newPage) {
|
|
47
|
+
window.open(subPath, '_blank')
|
|
48
|
+
} else if (subPath.indexOf('http') === 0) {
|
|
49
|
+
window.location.href = subPath
|
|
50
|
+
} else {
|
|
51
|
+
const [
|
|
52
|
+
pathname,
|
|
53
|
+
search
|
|
54
|
+
] = subPath.split('?')
|
|
55
|
+
history.push({
|
|
56
|
+
pathname,
|
|
57
|
+
search: search && `?${search}`
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
window.open(subPath, '_blank')
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const ShowIdsSubPath = [
|
|
67
|
+
'/teacherTraining?firstLevel=t_type_M52vKqPtOQ'
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
function getMenuIds(subPath) {
|
|
71
|
+
const needMenu = ShowIdsSubPath.some((t) => subPath.indexOf(t) === 0)
|
|
72
|
+
return needMenu ? 'all' : 'none'
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function addQuery(url, params) {
|
|
76
|
+
const paramStr = Object.keys(params).map((key) => {
|
|
77
|
+
const value = params[key]
|
|
78
|
+
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
|
|
79
|
+
}).join('&')
|
|
80
|
+
return url.indexOf('?') > 0
|
|
81
|
+
? `${url}&${paramStr}`
|
|
82
|
+
: `${url}?${paramStr}`
|
|
83
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react'
|
|
2
|
+
|
|
3
|
+
function useInterval(
|
|
4
|
+
callback,
|
|
5
|
+
delay
|
|
6
|
+
) {
|
|
7
|
+
const savedCallback = useRef(callback)
|
|
8
|
+
|
|
9
|
+
// Remember the latest callback if it changes.
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
savedCallback.current = callback
|
|
12
|
+
}, [callback])
|
|
13
|
+
|
|
14
|
+
// Set up the interval.
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
// Don't schedule if no delay is specified.
|
|
17
|
+
// Note: 0 is a valid value for delay.
|
|
18
|
+
if (!delay && delay !== 0) {
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const id = setInterval(() => savedCallback.current(), delay)
|
|
23
|
+
|
|
24
|
+
return () => clearInterval(id)
|
|
25
|
+
}, [delay])
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default useInterval
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react'
|
|
2
|
+
|
|
3
|
+
function useIsMounted() {
|
|
4
|
+
const isMounted = useRef(false)
|
|
5
|
+
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
isMounted.current = true
|
|
8
|
+
|
|
9
|
+
return () => {
|
|
10
|
+
isMounted.current = false
|
|
11
|
+
}
|
|
12
|
+
}, [])
|
|
13
|
+
|
|
14
|
+
return useCallback(() => isMounted.current, [])
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default useIsMounted
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useContext, useEffect, useState } from 'react'
|
|
2
|
+
import { USER_IDENTITY } from '@/config/live'
|
|
3
|
+
import UserContext from '@/component/Login/UserContext'
|
|
4
|
+
|
|
5
|
+
// 四个模块
|
|
6
|
+
export const Module = {
|
|
7
|
+
SYNC_CLASSROOM_PICKED: 'SYNC_CLASSROOM_PICKED', // 首页精选课
|
|
8
|
+
TCH_TRAINING: 'TCH_TRAINING',
|
|
9
|
+
FAMILY_EDU: 'FAMILY_EDU',
|
|
10
|
+
EVO_EXP: 'EVO_EXP',
|
|
11
|
+
STUDIO: 'STUDIO' // 工作室
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// 每个角色不可见的模块
|
|
15
|
+
export const inaccessible = {
|
|
16
|
+
[USER_IDENTITY.TEACHER]: [],
|
|
17
|
+
[USER_IDENTITY.STUDENT]: [Module.SYNC_CLASSROOM_PICKED, Module.TCH_TRAINING, Module.FAMILY_EDU, Module.EVO_EXP, Module.STUDIO],
|
|
18
|
+
[USER_IDENTITY.GUARDIAN]: [Module.SYNC_CLASSROOM_PICKED, Module.TCH_TRAINING, Module.EVO_EXP, Module.STUDIO],
|
|
19
|
+
[USER_IDENTITY.ACADEMIC_STAFF]: [],
|
|
20
|
+
[USER_IDENTITY.ELECTRIC_TEACHER]: [],
|
|
21
|
+
[USER_IDENTITY.EDU_ADMIN]: [],
|
|
22
|
+
[USER_IDENTITY.SOCIAL_LEARNER]: []
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// 四个模块可见性(默认都可见)
|
|
26
|
+
const moduleVisible = {
|
|
27
|
+
[Module.SYNC_CLASSROOM_PICKED]: true,
|
|
28
|
+
[Module.TCH_TRAINING]: true,
|
|
29
|
+
[Module.FAMILY_EDU]: true,
|
|
30
|
+
[Module.EVO_EXP]: true,
|
|
31
|
+
[Module.STUDIO]: true
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default function useModuleByRole() {
|
|
35
|
+
const { userInfo, userRole, loginStatus } = useContext(UserContext)
|
|
36
|
+
const [visibleModule, setVisibleModule] = useState(moduleVisible)
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (userInfo && userRole) {
|
|
40
|
+
Object.keys(moduleVisible).forEach((key) => {
|
|
41
|
+
moduleVisible[key] = !inaccessible[userRole].includes(key)
|
|
42
|
+
})
|
|
43
|
+
setVisibleModule({
|
|
44
|
+
...moduleVisible
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
}, [userInfo, userRole])
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
visibleModule,
|
|
51
|
+
loginStatus
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useContext,
|
|
4
|
+
useLayoutEffect,
|
|
5
|
+
useRef,
|
|
6
|
+
useState
|
|
7
|
+
} from 'react'
|
|
8
|
+
import { useLocation } from 'react-router-dom'
|
|
9
|
+
import { isInElectron } from '@/util/env'
|
|
10
|
+
|
|
11
|
+
export function usePageScrollableRoot() {
|
|
12
|
+
const location = useLocation()
|
|
13
|
+
const [pageScrollable, setPageScrollable] = useState(!isInElectron)
|
|
14
|
+
const pageScrollableRef = useRef(pageScrollable)
|
|
15
|
+
|
|
16
|
+
const setCurrentPageScrollable = (value) => {
|
|
17
|
+
setPageScrollable(value)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
useLayoutEffect(() => {
|
|
21
|
+
// page不变,是location发生变化
|
|
22
|
+
if (pageScrollableRef.current === pageScrollable) {
|
|
23
|
+
if (!pageScrollable) {
|
|
24
|
+
if (!isInElectron) {
|
|
25
|
+
setPageScrollable(true)
|
|
26
|
+
pageScrollableRef.current = true
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
// 是page发生变化则同步更新
|
|
31
|
+
pageScrollableRef.current = pageScrollable
|
|
32
|
+
}
|
|
33
|
+
}, [location.key, pageScrollable])
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
pageScrollable,
|
|
37
|
+
setCurrentPageScrollable
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const PageScrollableContext = createContext()
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @typedef {Object} UsePageScrollable
|
|
45
|
+
* @property {Boolean} pageScrollable 页面是否可以滚动,默认可以滚动
|
|
46
|
+
* @property {(isPageScrollable: Boolean) => void} setCurrentPageScrollable 设置当前页面是否可以滚动,设置仅对当前路由有效,切换则设置恢复滚动
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* 用于React组件下获取siteConfig,注意siteConfig本身是异步获取,所以同步获取的值只能用于React组件渲染
|
|
50
|
+
* @returns {UsePageScrollable}
|
|
51
|
+
*/
|
|
52
|
+
export const usePageScrollable = () => useContext(PageScrollableContext)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useRef, useEffect } from 'react'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates DOM element to be used as React root.
|
|
5
|
+
* @returns {HTMLElement}
|
|
6
|
+
*/
|
|
7
|
+
function createRootElement(id) {
|
|
8
|
+
const rootContainer = document.createElement('div')
|
|
9
|
+
rootContainer.setAttribute('id', id)
|
|
10
|
+
return rootContainer
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Appends element as last child of body.
|
|
15
|
+
* @param {HTMLElement} rootElem
|
|
16
|
+
*/
|
|
17
|
+
function addRootElement(rootElem) {
|
|
18
|
+
document.body.insertBefore(
|
|
19
|
+
rootElem,
|
|
20
|
+
document.body.lastElementChild.nextElementSibling
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Hook to create a React Portal.
|
|
26
|
+
* Automatically handles creating and tearing-down the root elements (no SRR
|
|
27
|
+
* makes this trivial), so there is no need to ensure the parent target already
|
|
28
|
+
* exists.
|
|
29
|
+
* @example
|
|
30
|
+
* const target = usePortal(id, [id]);
|
|
31
|
+
* return createPortal(children, target);
|
|
32
|
+
* @param {String} selector The selector of the target container, e.g '#modal' or '.spotlight'
|
|
33
|
+
* @param {containerClass} containerClass
|
|
34
|
+
* @returns {HTMLElement} The DOM node to use as the Portal target.
|
|
35
|
+
*/
|
|
36
|
+
function usePortal(selector, containerClass) {
|
|
37
|
+
const rootElemRef = useRef(null)
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
// Look for existing target dom element to append to
|
|
41
|
+
const existingParent = document.querySelector(selector)
|
|
42
|
+
// Parent is either a new root or the existing dom element
|
|
43
|
+
const parentElem = existingParent || createRootElement(selector)
|
|
44
|
+
|
|
45
|
+
// If there is no existing DOM element, add a new one.
|
|
46
|
+
if (!existingParent) {
|
|
47
|
+
addRootElement(parentElem)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Add the detached element to the parent
|
|
51
|
+
parentElem.appendChild(rootElemRef.current)
|
|
52
|
+
|
|
53
|
+
return function removeElement() {
|
|
54
|
+
rootElemRef.current.remove()
|
|
55
|
+
if (!parentElem.childElementCount) {
|
|
56
|
+
parentElem.remove()
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, [selector])
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* It's important we evaluate this lazily:
|
|
63
|
+
* - We need first render to contain the DOM element, so it shouldn't happen
|
|
64
|
+
* in useEffect. We would normally put this in the constructor().
|
|
65
|
+
* - We can't do 'const rootElemRef = useRef(document.createElement('div))',
|
|
66
|
+
* since this will run every single render (that's a lot).
|
|
67
|
+
* - We want the ref to consistently point to the same DOM element and only
|
|
68
|
+
* ever run once.
|
|
69
|
+
* @link https://reactjs.org/docs/hooks-faq.html#how-to-create-expensive-objects-lazily
|
|
70
|
+
*/
|
|
71
|
+
function getRootElem() {
|
|
72
|
+
if (!rootElemRef.current) {
|
|
73
|
+
const div = document.createElement('div')
|
|
74
|
+
div.classList.add(containerClass)
|
|
75
|
+
rootElemRef.current = div
|
|
76
|
+
}
|
|
77
|
+
return rootElemRef.current
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return getRootElem()
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export default usePortal
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useContext, useLayoutEffect, useEffect } from 'react'
|
|
2
|
+
import { useLocation } from 'react-router-dom'
|
|
3
|
+
import { ScrollContext } from './scrollContext'
|
|
4
|
+
import { isSticky, StickyTop } from '@/util/stickyStatus'
|
|
5
|
+
import { isInElectron } from '@/util/env'
|
|
6
|
+
|
|
7
|
+
export function useScrollRestoration(
|
|
8
|
+
identifier = 'default'
|
|
9
|
+
) {
|
|
10
|
+
const location = useLocation()
|
|
11
|
+
const state = useContext(ScrollContext)
|
|
12
|
+
|
|
13
|
+
useLayoutEffect(() => {
|
|
14
|
+
if (!isInElectron) {
|
|
15
|
+
const isStickyVal = isSticky()
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
const position = state.read(location, identifier)
|
|
18
|
+
document.scrollingElement.scrollTo(0, isStickyVal ? StickyTop + 10 : position || 0)
|
|
19
|
+
}, 10)
|
|
20
|
+
}
|
|
21
|
+
}, [location.key])
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const onScroll = () => {
|
|
25
|
+
state.save(location, identifier, document.scrollingElement.scrollTop)
|
|
26
|
+
}
|
|
27
|
+
window.addEventListener('scroll', onScroll)
|
|
28
|
+
return () => {
|
|
29
|
+
window.removeEventListener('scroll', onScroll)
|
|
30
|
+
}
|
|
31
|
+
}, [])
|
|
32
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createContext } from 'react'
|
|
2
|
+
|
|
3
|
+
const ScrollCache = {}
|
|
4
|
+
|
|
5
|
+
class SessionStorage {
|
|
6
|
+
read(location, key) {
|
|
7
|
+
const cacheKey = `${location}: ${key}`
|
|
8
|
+
return ScrollCache[cacheKey]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
save(location, key, value) {
|
|
12
|
+
const cacheKey = `${location}: ${key}`
|
|
13
|
+
ScrollCache[cacheKey] = value
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const ScrollContext = createContext(
|
|
18
|
+
new SessionStorage()
|
|
19
|
+
)
|
|
20
|
+
ScrollContext.displayName = 'ScrollContext'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const { useState, useEffect } = require('react')
|
|
2
|
+
|
|
3
|
+
// Hook
|
|
4
|
+
export default function useWindowSize() {
|
|
5
|
+
// Initialize state with undefined width/height so server and client renders match
|
|
6
|
+
// Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/
|
|
7
|
+
const [windowSize, setWindowSize] = useState({
|
|
8
|
+
width: undefined,
|
|
9
|
+
height: undefined
|
|
10
|
+
})
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
// Handler to call on window resize
|
|
13
|
+
function handleResize() {
|
|
14
|
+
// Set window width/height to state
|
|
15
|
+
setWindowSize({
|
|
16
|
+
width: window.innerWidth,
|
|
17
|
+
height: window.innerHeight
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
// Add event listener
|
|
21
|
+
window.addEventListener('resize', handleResize)
|
|
22
|
+
// Call handler right away so state gets updated with initial window size
|
|
23
|
+
handleResize()
|
|
24
|
+
// Remove event listener on cleanup
|
|
25
|
+
return () => window.removeEventListener('resize', handleResize)
|
|
26
|
+
}, []) // Empty array ensures that effect is only run on mount
|
|
27
|
+
return windowSize
|
|
28
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useEffect } from 'react'
|
|
2
|
+
|
|
3
|
+
const MiniContentWitdh = 1368
|
|
4
|
+
|
|
5
|
+
export default function useZoom() {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
zoomToViewPort()
|
|
8
|
+
}, [])
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function zoomToViewPort() {
|
|
12
|
+
if (window.location.pathname === '/home') {
|
|
13
|
+
const target = document.querySelector('.main')
|
|
14
|
+
if (target) {
|
|
15
|
+
const availWidth = window.innerWidth
|
|
16
|
+
if (availWidth < MiniContentWitdh) {
|
|
17
|
+
const scale = availWidth / MiniContentWitdh
|
|
18
|
+
target.style.width = `${MiniContentWitdh}px`
|
|
19
|
+
target.style.transform = `scale(${scale})`
|
|
20
|
+
target.style.transformOrigin = '0 0'
|
|
21
|
+
setTimeout(() => {
|
|
22
|
+
const wrapTarget = document.querySelector('.main-wrapper')
|
|
23
|
+
wrapTarget.style.height = `${window.screen.availHeight - 300}px`
|
|
24
|
+
wrapTarget.addEventListener('scroll', () => {
|
|
25
|
+
const maxHeight = target.getBoundingClientRect().height
|
|
26
|
+
- wrapTarget.getBoundingClientRect().height
|
|
27
|
+
if (wrapTarget.scrollTop >= maxHeight) {
|
|
28
|
+
wrapTarget.scrollTop = maxHeight
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
setInterval(() => {
|
|
32
|
+
let n = 0
|
|
33
|
+
const t = setInterval(() => {
|
|
34
|
+
n += 1
|
|
35
|
+
if (n < 8) {
|
|
36
|
+
const h = wrapTarget.getBoundingClientRect().height
|
|
37
|
+
window.parent.postMessage(h, '*')
|
|
38
|
+
} else {
|
|
39
|
+
clearInterval(t)
|
|
40
|
+
}
|
|
41
|
+
}, 300)
|
|
42
|
+
}, 1000)
|
|
43
|
+
}, 100)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from 'react-dom'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
PublicLiveDetail
|
|
6
|
+
} from './App'
|
|
7
|
+
|
|
8
|
+
// 测试页面内容
|
|
9
|
+
render(
|
|
10
|
+
<PublicLiveDetail
|
|
11
|
+
liveId="13aafbce-8ca2-4587-bc6e-eab183c9d5b6"
|
|
12
|
+
appId="e5649925-441d-4a53-b525-51a2f1c4e0a8"
|
|
13
|
+
/>,
|
|
14
|
+
document.querySelector('#root')
|
|
15
|
+
)
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import MutexLock from 'mutex-lock'
|
|
2
|
+
import configCenterAPI from '@/config/request/config-center'
|
|
3
|
+
import config from '@/config/env'
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
app,
|
|
7
|
+
env: defaultEnv
|
|
8
|
+
} = config
|
|
9
|
+
const LiveCache = {}
|
|
10
|
+
const defaultSdpAppId = app.appid
|
|
11
|
+
|
|
12
|
+
const useLocalDirectly = true // 不发请求,直接使用本地数据
|
|
13
|
+
const localConfig = {
|
|
14
|
+
'x-cloud': {
|
|
15
|
+
properties: {
|
|
16
|
+
recommend_week: 'week_1', // 首页本周推荐(周数)
|
|
17
|
+
live_close_login: '0', // 直播间登录验证降级配置(启用后所有人都以游客身份进入直播间,跳过UC鉴权),默认不启用
|
|
18
|
+
live_record_random_delay_sec: 99, // 用于各端上报用户参与直播的随机离散时间
|
|
19
|
+
download_url: ''
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 获取服务组件配置
|
|
26
|
+
*
|
|
27
|
+
* @param {string} sdpAppId
|
|
28
|
+
* @param {string} serviceName 服务组件标识
|
|
29
|
+
* @param {string?} env 环境
|
|
30
|
+
*/
|
|
31
|
+
export default async function getServiceConfig(
|
|
32
|
+
serviceName,
|
|
33
|
+
sdpAppId = defaultSdpAppId,
|
|
34
|
+
env = defaultEnv
|
|
35
|
+
) {
|
|
36
|
+
if (useLocalDirectly) {
|
|
37
|
+
return localConfig[serviceName]
|
|
38
|
+
}
|
|
39
|
+
const key = `ServiceConfig_${serviceName}_${sdpAppId}`
|
|
40
|
+
const mutexLock = getMutexLock(key)
|
|
41
|
+
const lockId = await mutexLock.request()
|
|
42
|
+
|
|
43
|
+
const cacheData = loadFromCache(key)
|
|
44
|
+
if (cacheData) {
|
|
45
|
+
mutexLock.release(lockId)
|
|
46
|
+
return cacheData
|
|
47
|
+
}
|
|
48
|
+
const url = `/configs/merge/config_type/service_component/format_code/${encodeURIComponent(serviceName)
|
|
49
|
+
}/open_way/${encodeURIComponent(`${sdpAppId}||||`)}/public_configs/for_web`
|
|
50
|
+
|
|
51
|
+
let data
|
|
52
|
+
try {
|
|
53
|
+
const result = await configCenterAPI.get(url, {
|
|
54
|
+
headers: {
|
|
55
|
+
'x-config-dispatch-env': env
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
data = result.data
|
|
59
|
+
} catch (e) {
|
|
60
|
+
mutexLock.release(lockId)
|
|
61
|
+
throw e
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// const ttl = data.ttl || 3600
|
|
65
|
+
const ttl = 900 // 登录降级产品配置需求调整为 15 分钟,服务端也有 1 小时缓存
|
|
66
|
+
data.expire = new Date().getTime() + ttl * 1000
|
|
67
|
+
LiveCache[key] = data
|
|
68
|
+
window.localStorage.setItem(key, JSON.stringify(data))
|
|
69
|
+
mutexLock.release(lockId)
|
|
70
|
+
return data
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function loadFromCache(key) {
|
|
74
|
+
if (LiveCache[key]) {
|
|
75
|
+
return LiveCache[key]
|
|
76
|
+
}
|
|
77
|
+
const cacheStr = window.localStorage.getItem(key)
|
|
78
|
+
let cacheData
|
|
79
|
+
try {
|
|
80
|
+
cacheData = JSON.parse(cacheStr)
|
|
81
|
+
} catch (e) {
|
|
82
|
+
return null
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (cacheData) {
|
|
86
|
+
const expire = cacheData.expire || 0
|
|
87
|
+
if (expire > new Date().getTime()) {
|
|
88
|
+
return cacheData
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 根据key给与不同的同步锁
|
|
95
|
+
*/
|
|
96
|
+
const Lock = {}
|
|
97
|
+
function getMutexLock(key) {
|
|
98
|
+
if (!Lock[key]) {
|
|
99
|
+
Lock[key] = new MutexLock()
|
|
100
|
+
}
|
|
101
|
+
return Lock[key]
|
|
102
|
+
}
|