coreContent.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. <template>
  2. <div id="coreContent">
  3. <div class="left_box">
  4. <video-cy
  5. :class="video_iframe == 'video' ? 'smallView' : ''"
  6. v-show="video_iframe == 'video' && !viewStatus ? false : true"
  7. ref="video_cy"
  8. @videoScript="videoScript"
  9. :activeSection.sync="activeSection"
  10. ></video-cy>
  11. <div
  12. class="office_style"
  13. :class="video_iframe == 'iframe' ? 'smallView' : ''"
  14. v-show="video_iframe == 'iframe' && !viewStatus ? false : true"
  15. v-if="SwitchOfficeData.url"
  16. >
  17. <iframe
  18. width="100%"
  19. height="100%"
  20. :src="
  21. 'https://preview.xyyxt.net?src=' +
  22. $tools.splitImgHost(SwitchOfficeData.url)
  23. "
  24. ></iframe>
  25. </div>
  26. <div v-if="SwitchOfficeData.url && viewStatus" class="floatView">
  27. <el-button size="small" type="primary" @click="switchView"
  28. >切换</el-button
  29. >
  30. <el-button size="small" type="warning" @click="viewStatus = !viewStatus"
  31. >隐藏</el-button
  32. >
  33. </div>
  34. <el-button
  35. v-if="!viewStatus"
  36. size="small"
  37. class="showOK"
  38. @click="viewStatus = !viewStatus"
  39. >显示</el-button
  40. >
  41. </div>
  42. <div class="right_box">
  43. <el-tabs stretch v-model="courseTabIndex">
  44. <el-tab-pane
  45. lazy
  46. :name="tab.name"
  47. v-for="(tab, index) in menuTab"
  48. :key="index"
  49. >
  50. <div slot="label">
  51. <span class="label">{{ tab.label }}</span>
  52. </div>
  53. <!-- 章节目录 -->
  54. <template v-if="tab.name == '1'">
  55. <course-tree ref="courseTree" :activeSection.sync="activeSection">
  56. </course-tree>
  57. </template>
  58. <!-- 重修目录 -->
  59. <template v-if="tab.name == '2'">
  60. <course-tree :activeSection.sync="activeSection" :rebuild="1">
  61. </course-tree>
  62. </template>
  63. <template v-if="tab.name == '3'">
  64. <answer-questions
  65. ref="answerQuestions"
  66. :activeSection.sync="activeSection"
  67. ></answer-questions>
  68. </template>
  69. <template v-if="tab.name == '4'">
  70. <Notes ref="notes"></Notes>
  71. </template>
  72. <template v-if="tab.name == '5'">
  73. <hand-out
  74. ref="handOut"
  75. @backSwitchOfficeData="backSwitchOfficeData"
  76. ></hand-out>
  77. </template>
  78. </el-tab-pane>
  79. </el-tabs>
  80. </div>
  81. <dataReview ref="dataReview" @callbackDataReview="callbackDataReview" />
  82. <preference ref="preference" />
  83. </div>
  84. </template>
  85. <script>
  86. import preference from "@/components/preference";
  87. import dataReview from "@/components/dataReview";
  88. import CourseTree from "./CourseTree.vue";
  89. import AnswerQuestions from "./AnswerQuestions.vue";
  90. import HandOut from "./HandOut.vue";
  91. import Notes from "./Notes.vue";
  92. export default {
  93. components: {
  94. videoCy: () => import("@/components/videoCy/index.vue"),
  95. Notes,
  96. HandOut,
  97. AnswerQuestions,
  98. CourseTree,
  99. dataReview,
  100. preference,
  101. },
  102. inject: ["getGoodsData"],
  103. provide() {
  104. return {
  105. getPlayer: () => this.player,
  106. getActiveSection: () => this.activeSection,
  107. };
  108. },
  109. data() {
  110. return {
  111. video_iframe: "iframe", //当前缩小视图层
  112. viewStatus: true, //开关隐藏
  113. courseTabIndex: "",
  114. menuTab: [
  115. {
  116. name: "1",
  117. label: "章节目录",
  118. },
  119. {
  120. name: "3",
  121. label: "答疑",
  122. },
  123. {
  124. name: "4",
  125. label: "笔记",
  126. },
  127. {
  128. name: "5",
  129. label: "讲义",
  130. },
  131. ],
  132. gradeDetail: {}, //班级详情
  133. player: null, //视频播放器实例
  134. SwitchOfficeData: {}, //当前选中讲义数据
  135. activeSection: {}, //当前选中节数据
  136. };
  137. },
  138. computed: {
  139. goodsData() {
  140. return this.getGoodsData();
  141. },
  142. },
  143. watch: {
  144. //因为刚开始获取不到goodsData的数据 所以需要监听
  145. goodsData: function (newVal, oldVal) {
  146. if (newVal) {
  147. this.getBeforeWork(); //处理前置任务
  148. }
  149. },
  150. },
  151. methods: {
  152. //切换视图
  153. switchView() {
  154. this.video_iframe == "iframe"
  155. ? (this.video_iframe = "video")
  156. : (this.video_iframe = "iframe");
  157. },
  158. //处理前置任务
  159. getBeforeWork() {
  160. //商品优选操作
  161. if (this.goodsData.firstChoiceStatus) {
  162. this.$refs.preference.openBoxs(this.goodsData);
  163. } else {
  164. this.$refs.dataReview.init({
  165. goodsId: this.goodsData.goodsId,
  166. orderGoodsId: this.goodsData.orderGoodsId,
  167. gradeId: this.goodsData.gradeId,
  168. goodsName: this.goodsData.goodsName,
  169. educationName: this.goodsData.educationName,
  170. projectName: this.goodsData.projectName,
  171. businessName: this.goodsData.businessName,
  172. categoryName: this.goodsData.categoryName,
  173. });
  174. }
  175. },
  176. //资料填写回调
  177. async callbackDataReview() {
  178. await this.RequiredCourse(); //检测必修
  179. await this.orderstudycheckFunc(); //七大员是否允许学习
  180. await this.confirmInfoDetail(); //判断开通信息推送是否成功
  181. if (this.goodsData.gradeId > 0 && this.goodsData.jjShiGongYuan) {
  182. await this.getGradeInfo(); //提交完资料返回判断是否已开班
  183. //继教七大员公共课程同步
  184. const res = await this.$request.ordersevenyear(
  185. this.goodsData.orderGoodsId
  186. );
  187. if (res.data) {
  188. this.goodsData.orderYears = res.data;
  189. await this.sevenCommonCourse();
  190. }
  191. }
  192. await this.getRebuildCourse(); //获取重修列表
  193. this.courseTabIndex = "1";
  194. },
  195. //七大员是否允许学习
  196. orderstudycheckFunc() {
  197. return new Promise((resolve, reject) => {
  198. this.$request
  199. .orderstudycheck(this.goodsData.orderGoodsId)
  200. .then((res) => {
  201. resolve();
  202. })
  203. .catch((err) => {
  204. this.$confirm(err.msg, "提示", {
  205. confirmButtonText: "确定",
  206. closeOnClickModal: false,
  207. closeOnPressEscape: false,
  208. showCancelButton: false,
  209. distinguishCancelAndClose: false,
  210. showClose: false,
  211. })
  212. .then((_) => {
  213. this.$router.back(-1);
  214. })
  215. .catch((_) => {});
  216. reject();
  217. });
  218. });
  219. },
  220. //检测必修
  221. RequiredCourse() {
  222. return new Promise((resolve, reject) => {
  223. if (
  224. this.goodsData.educationName == "继续教育" &&
  225. this.goodsData.businessName == "二级" &&
  226. (this.goodsData.projectName == "建造师" ||
  227. this.goodsData.projectName == "造价师")
  228. ) {
  229. this.$request
  230. .goodsGradeCheckFinishRequiredCourse({
  231. businessId: this.goodsData.businessId,
  232. goodsId: this.goodsData.goodsId,
  233. })
  234. .then((res) => {
  235. if (res.data > 0) {
  236. this.$confirm(`请先学习必修商品`, "提示", {
  237. confirmButtonText: "确定",
  238. closeOnClickModal: false,
  239. closeOnPressEscape: false,
  240. showCancelButton: false,
  241. distinguishCancelAndClose: false,
  242. showClose: false,
  243. })
  244. .then((_) => {
  245. this.$router.back(-1);
  246. })
  247. .catch((_) => {});
  248. reject();
  249. } else {
  250. resolve();
  251. }
  252. })
  253. .catch((err) => {
  254. this.$confirm(err.msg, "提示", {
  255. confirmButtonText: "确定",
  256. closeOnClickModal: false,
  257. closeOnPressEscape: false,
  258. showCancelButton: false,
  259. distinguishCancelAndClose: false,
  260. showClose: false,
  261. })
  262. .then((_) => {
  263. this.$router.back(-1);
  264. })
  265. .catch((_) => {});
  266. reject();
  267. });
  268. } else {
  269. resolve();
  270. }
  271. });
  272. },
  273. //提交完资料返回判断是否已开班
  274. getGradeInfo() {
  275. return new Promise((resolve, reject) => {
  276. this.$request.goodsGradeInfo(this.goodsData.gradeId).then((res) => {
  277. if (res.code == 200) {
  278. this.gradeDetail = res.data;
  279. let nowTime = parseInt(new Date().getTime() / 1000);
  280. if (this.goodsData.erJianErZao || this.goodsData.jjShiGongYuan) {
  281. if (res.data.classEndTime && res.data.classEndTime < nowTime) {
  282. this.$confirm(
  283. `当前课程所属班级有效期已过期,无法继续学习!`,
  284. "提示",
  285. {
  286. confirmButtonText: "确定",
  287. closeOnClickModal: false,
  288. closeOnPressEscape: false,
  289. showCancelButton: false,
  290. distinguishCancelAndClose: false,
  291. showClose: false,
  292. }
  293. )
  294. .then((_) => {
  295. this.$router.back(-1);
  296. })
  297. .catch((_) => {});
  298. return;
  299. }
  300. }
  301. if (res.data.interfaceAccountId > 0 && res.data.learnStatus > 0) {
  302. const confirmText = [
  303. "您的学习账号已经开通,请按照步骤操作,进行学习。",
  304. "1.点击【跳转学习网址】按钮",
  305. "2.打开学习网址后,选择【个人用户】进行登录",
  306. "(1)账号:您个人的身份证号码",
  307. "(2)密码:身份证号码,再加111111",
  308. ];
  309. const newDatas = [];
  310. const h = this.$createElement;
  311. for (const i in confirmText) {
  312. newDatas.push(h("p", null, confirmText[i]));
  313. }
  314. this.$confirm(h("div", null, newDatas), "温馨提示", {
  315. beforeClose: (type, y, done) => {
  316. if (type == "confirm") {
  317. window.open("http://admin.zhujianpeixun.com/", "_blank");
  318. } else if (type == "cancel") {
  319. this.$router.back(-1);
  320. }
  321. },
  322. confirmButtonText: "跳转学习网址",
  323. cancelButtonText: "关闭",
  324. closeOnClickModal: false,
  325. closeOnPressEscape: false,
  326. distinguishCancelAndClose: false,
  327. showClose: false,
  328. });
  329. return;
  330. }
  331. if (res.data.learningStatus == 2) {
  332. this.$confirm(
  333. `当前课程正在申请中,正式开班后方可进行学习,请耐心等候!`,
  334. "提示",
  335. {
  336. confirmButtonText: "确定",
  337. closeOnClickModal: false,
  338. closeOnPressEscape: false,
  339. showCancelButton: false,
  340. distinguishCancelAndClose: false,
  341. showClose: false,
  342. }
  343. )
  344. .then((_) => {
  345. this.$router.back(-1);
  346. })
  347. .catch((_) => {});
  348. return;
  349. }
  350. if (
  351. res.data.learningStatus == 3 &&
  352. Number(res.data.learningTimeStart) > Number(new Date() / 1000)
  353. ) {
  354. this.$confirm(
  355. `当前课程正在申请中,正式开班后方可进行学习,请耐心等候!`,
  356. "提示",
  357. {
  358. confirmButtonText: "返回",
  359. closeOnClickModal: false,
  360. closeOnPressEscape: false,
  361. showCancelButton: false,
  362. distinguishCancelAndClose: false,
  363. showClose: false,
  364. }
  365. )
  366. .then((_) => {
  367. this.$router.back(-1);
  368. })
  369. .catch((_) => {});
  370. return;
  371. }
  372. if (
  373. (res.data.interfaceAccountId > 0 && res.data.learnStatus > 0) ||
  374. res.data.learningStatus == 2 ||
  375. (res.data.learningStatus == 3 &&
  376. Number(res.data.learningTimeStart) > Number(new Date() / 1000))
  377. ) {
  378. reject();
  379. } else {
  380. resolve();
  381. }
  382. }
  383. });
  384. });
  385. },
  386. //继教七大员公共课程同步
  387. sevenCommonCourse() {
  388. return new Promise((resolve, reject) => {
  389. this.$request
  390. .syncSevenPublicClass({ orderGoodsId: this.goodsData.orderGoodsId })
  391. .then((res) => {
  392. if (res.code == 200) {
  393. resolve();
  394. } else {
  395. reject();
  396. }
  397. })
  398. .catch((err) => {
  399. if(err.msg=='课程定位错误')
  400. {
  401. resolve();
  402. }
  403. else{
  404. this.$alert(err.msg, "提示", {
  405. confirmButtonText: "返回",
  406. showClose: false,
  407. callback: (action) => {
  408. this.$router.go(-1);
  409. },
  410. });
  411. reject();
  412. }
  413. });
  414. });
  415. },
  416. //判断开通信息推送是否成功
  417. confirmInfoDetail() {
  418. return new Promise(async (resolve, reject) => {
  419. if (this.goodsData.erJianErZao || this.goodsData.jjShiGongYuan) {
  420. let info = await this.$request.userConfirmInfoDetail({
  421. orderGoodsId: this.goodsData.orderGoodsId,
  422. });
  423. if (!info.data || info.data.pushInfo !== 1) {
  424. this.$confirm(`您的信息正在推送中,请稍后再进入学习!`, "提示", {
  425. confirmButtonText: "确定",
  426. closeOnClickModal: false,
  427. closeOnPressEscape: false,
  428. distinguishCancelAndClose: false,
  429. showCancelButton: false,
  430. showClose: false,
  431. })
  432. .then((_) => {
  433. //停止执行-退出页面
  434. this.$router.back(-1);
  435. })
  436. .catch((_) => {
  437. //停止执行-退出页面
  438. this.$router.back(-1);
  439. });
  440. reject();
  441. } else {
  442. resolve();
  443. }
  444. } else {
  445. resolve();
  446. }
  447. });
  448. },
  449. //获取重修列表
  450. getRebuildCourse() {
  451. return new Promise((resolve, reject) => {
  452. this.$request
  453. .getRebuildCourse({
  454. goodsId: this.goodsData.goodsId,
  455. rebuild: 1,
  456. gradeId: this.goodsData.gradeId,
  457. orderGoodsId: this.goodsData.orderGoodsId,
  458. })
  459. .then(async (res) => {
  460. if (res.data.length > 0) {
  461. console.log(res.data, "resda");
  462. this.menuTab.splice(1, 0, {
  463. name: "2",
  464. label: "重修目录",
  465. });
  466. }
  467. resolve();
  468. })
  469. .catch((err) => {
  470. this.$message.error(err + "、重修列表获取失败");
  471. reject();
  472. });
  473. });
  474. },
  475. //讲义模块返回
  476. backSwitchOfficeData(item) {
  477. this.SwitchOfficeData = Object.assign({}, item);
  478. },
  479. //视频播放实例
  480. videoScript(player) {
  481. this.player = player;
  482. this.video_iframe = "iframe"; //当前缩小视图层
  483. this.viewStatus = true; //开关隐藏
  484. },
  485. },
  486. };
  487. </script>
  488. <style lang="scss" scoped>
  489. #coreContent {
  490. // background-color: skyblue;
  491. display: flex;
  492. width: 100%;
  493. height: 455px;
  494. & > .left_box {
  495. width: 810px;
  496. flex-shrink: 0;
  497. position: relative;
  498. & > .office_style {
  499. width: 810px;
  500. height: 455px;
  501. }
  502. & > .smallView {
  503. position: absolute;
  504. z-index: 123;
  505. right: 4px;
  506. bottom: 60px;
  507. transform: scale(0.2);
  508. transform-origin: 100% 100%;
  509. }
  510. & > .floatView {
  511. position: absolute;
  512. z-index: 124;
  513. right: 4px;
  514. bottom: 60px;
  515. width: 162px;
  516. height: 91px;
  517. background-color: rgba(225, 225, 225, 0.8);
  518. display: flex;
  519. align-items: center;
  520. justify-content: space-around;
  521. }
  522. & > .showOK {
  523. position: absolute;
  524. z-index: 124;
  525. right: 10px;
  526. bottom: 87px;
  527. opacity: 0.3;
  528. &:hover {
  529. opacity: 0.8;
  530. }
  531. }
  532. }
  533. & > .right_box {
  534. width: 1px;
  535. flex: 1;
  536. & > .el-tabs {
  537. height: 100%;
  538. background-color: #3f4449;
  539. display: flex;
  540. flex-direction: column;
  541. /deep/ .el-tabs__header {
  542. background-color: #3f4449 !important;
  543. margin: 0px !important;
  544. .label {
  545. color: #fff;
  546. }
  547. }
  548. /deep/ .el-tabs__content {
  549. flex: 1;
  550. height: 1px;
  551. overflow: auto;
  552. background-color: #3f4449 !important;
  553. }
  554. }
  555. }
  556. }
  557. </style>