courseDetail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. <template>
  2. <div class="pb_content">
  3. <div class="pb_content_body" style="height: 100%">
  4. <div class="body_student">
  5. <div class="student_head">
  6. <div
  7. class="return"
  8. @click.stop="
  9. goTo(
  10. '/index?userid=' +
  11. userid +
  12. '&oid=' +
  13. oid +
  14. '&org='+
  15. org +
  16. '&cid=' +
  17. classId +
  18. '&tType=' +
  19. tType +
  20. '&screenType=' +
  21. screenType
  22. )
  23. "
  24. >
  25. 返回
  26. <!-- <img src="../assets/icon/return.png" alt="" /> -->
  27. </div>
  28. <div class="box_course">
  29. <div class="wheel">
  30. <img
  31. style="object-fit: contain"
  32. :src="
  33. this.courseDetail.cover != null &&
  34. this.courseDetail.cover != ''
  35. ? JSON.parse(this.courseDetail.cover).length > 0
  36. ? JSON.parse(this.courseDetail.cover)[0].url
  37. : mr
  38. : mr
  39. "
  40. alt
  41. />
  42. </div>
  43. <div class="right_box">
  44. <div class="rightT">
  45. <div class="right_box_title">{{ courseDetail.title }}</div>
  46. <div class="jd">{{ chapInfo.length }}阶段</div>
  47. <div class="jd">{{ rw }}任务</div>
  48. </div>
  49. <div class="cType">
  50. <div
  51. class="all_choose"
  52. v-for="(item, index) in courseType"
  53. :key="index"
  54. >
  55. <span style="color: #6c6c6c">{{ item + ":" }}</span>
  56. <span
  57. class="type_children"
  58. v-for="(item2, index2) in courseTypeJson[item]"
  59. :key="index2"
  60. >{{ item2 }}</span
  61. >
  62. </div>
  63. </div>
  64. <div class="cType" style="font-size: 18px; color: #6c6c6c">
  65. <div>
  66. 创建者:<span style="color: #000">{{
  67. courseDetail.username
  68. }}</span>
  69. </div>
  70. <div class="Tname" v-if="Tname.length > 0">
  71. 协同人员:<span
  72. v-for="(tname, tIndex) in Tname"
  73. :key="tIndex"
  74. style="margin: 0 5px; color: #000"
  75. >{{ tname }}</span
  76. >
  77. </div>
  78. </div>
  79. <div class="people">
  80. <div class="man">
  81. <img src="../assets/people.png" alt />
  82. </div>
  83. <div class="person">
  84. {{ courseDetail.vcount != null ? courseDetail.vcount : 0 }}人
  85. </div>
  86. </div>
  87. <div class="now_study" @click="dialogVisible = true">
  88. 立即学习
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. <div class="student_body">
  94. <div class="sLeft" v-if="courseDetail.brief">
  95. <div class="courseT">项目详情</div>
  96. <div class="courseTd">{{ courseDetail.brief }}</div>
  97. </div>
  98. <div :class="courseDetail.brief != '' ? 'rightTd' : 'noBRight'">
  99. <div
  100. class="blue_box_one"
  101. v-for="(item, index) in chapInfo"
  102. :key="index"
  103. @click="addUserRate(index)"
  104. >
  105. <div>第{{ index + 1 }}阶段</div>
  106. <div :title="item.dyName">{{ item.dyName }}</div>
  107. <div>{{ item.chapterInfo[0].taskJson.length }}个任务</div>
  108. </div>
  109. </div>
  110. </div>
  111. <!-- <div
  112. style="
  113. text-align: center;
  114. padding: 30px 0 20px 0;
  115. box-sizing: border-box;
  116. "
  117. >
  118. 此处滚动加载..
  119. </div>-->
  120. <el-dialog
  121. title="阶段选择"
  122. :visible.sync="dialogVisible"
  123. :append-to-body="true"
  124. width="700px"
  125. :before-close="handleClose"
  126. class="dialog_change"
  127. >
  128. <div style="font-size: 20px">请选择阶段</div>
  129. <div
  130. style="
  131. padding: 20px 30px;
  132. display: flex;
  133. flex-direction: row;
  134. flex-wrap: wrap;
  135. "
  136. >
  137. <div
  138. class="blue_box"
  139. v-for="(item, index) in chapInfo"
  140. :key="index"
  141. @click="addUserRate(index)"
  142. >
  143. <div>第{{ index + 1 }}阶段</div>
  144. <div>{{ item.dyName }}</div>
  145. <div>{{ item.chapterInfo[0].taskJson.length }}个任务</div>
  146. </div>
  147. </div>
  148. </el-dialog>
  149. </div>
  150. </div>
  151. </div>
  152. </template>
  153. <script>
  154. export default {
  155. data() {
  156. return {
  157. choose: 0,
  158. dialogVisible: false,
  159. id: this.$route.query.courseId,
  160. userid: this.$route.query.userid,
  161. oid: this.$route.query.oid,
  162. org:this.$route.query.org,
  163. classId: this.$route.query.cid,
  164. tType: this.$route.query.tType,
  165. screenType: this.$route.query.screenType,
  166. courseDetail: {},
  167. aStudentName: [],
  168. chapInfo: [],
  169. courseType: [],
  170. Tname: [],
  171. courseTypeJson: {},
  172. userinfo: [],
  173. mr: require("../assets/icon/wheel.png"),
  174. rw: 0,
  175. };
  176. },
  177. methods: {
  178. handleClose(done) {
  179. done();
  180. },
  181. goTo(path) {
  182. this.$router.push(path);
  183. },
  184. addUserRate(i) {
  185. // var suid = this.userid;
  186. // if (
  187. // JSON.parse(this.courseDetail.course_student).indexOf(suid) == -1 &&
  188. // JSON.parse(this.courseDetail.userid) != suid
  189. // ) {
  190. // this.$message.error("你没有该权限");
  191. // return;
  192. // }
  193. // var a =
  194. // this.courseDetail.course_student != ""
  195. // ? JSON.parse(this.courseDetail.course_student)
  196. // : "";
  197. // if (this.courseDetail.userid != suid) {
  198. // if (this.userinfo.type == 2) {
  199. // if (a != "") {
  200. // if (
  201. // JSON.parse(this.courseDetail.course_student).indexOf(suid) == -1
  202. // ) {
  203. // this.$message.error("你没有该权限");
  204. // return;
  205. // }
  206. // } else {
  207. // this.$message.error("暂无项目学员,请联系老师添加项目学员!");
  208. // return;
  209. // }
  210. // }
  211. // }
  212. let params = {
  213. uid: this.userid,
  214. cid: this.id,
  215. };
  216. this.ajax
  217. .get(this.$store.state.api + "addUserR", params)
  218. .then((res) => {
  219. console.log(res.data);
  220. this.updateVc();
  221. if (this.tType == 1 || this.tType == 2) {
  222. this.goTo(
  223. "/studyStudent?type=" +
  224. i +
  225. "&courseId=" +
  226. this.id +
  227. "&userid=" +
  228. this.userid +
  229. "&oid=" +
  230. this.oid +
  231. "&cid=" +
  232. this.classId +
  233. "&tType=" +
  234. this.tType +
  235. "&screenType=" +
  236. this.screenType
  237. );
  238. } else {
  239. this.goTo(
  240. "/study?type=" +
  241. i +
  242. "&courseId=" +
  243. this.id +
  244. "&userid=" +
  245. this.userid +
  246. "&oid=" +
  247. this.oid +
  248. "&cid=" +
  249. this.classId +
  250. "&tType=" +
  251. this.tType +
  252. "&screenType=" +
  253. this.screenType
  254. );
  255. }
  256. })
  257. .catch((err) => {
  258. console.error(err);
  259. });
  260. },
  261. updateVc() {
  262. let params = {
  263. cid: this.id,
  264. };
  265. this.ajax
  266. .get(this.$store.state.api + "updateVc", params)
  267. .then((res) => {
  268. console.log(res.data);
  269. })
  270. .catch((err) => {
  271. console.error(err);
  272. });
  273. },
  274. getCourseDetail() {
  275. const loading = this.$loading.service({
  276. background: "rgba(255, 255, 255, 0.7)",
  277. target: document.querySelector(".student_table"),
  278. });
  279. let params = {
  280. courseId: this.id,
  281. };
  282. this.ajax
  283. .get(this.$store.state.api + "selectCourseDetail", params)
  284. .then((res) => {
  285. loading.close();
  286. // this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
  287. this.courseDetail = res.data[0][0];
  288. var a = res.data[0];
  289. var b = res.data[1];
  290. var c = res.data[2];
  291. for (var i = 0; i < b.length; i++) {
  292. // if (!this.id) {
  293. // this.courseType[b[i].id] = [];
  294. // }
  295. for (var j = 0; j < a.length; j++) {
  296. if (b[i].id == a[j].pid) {
  297. if (!this.courseTypeJson[b[i].name]) {
  298. this.courseType.push(b[i].name);
  299. this.courseTypeJson[b[i].name] = [];
  300. }
  301. this.courseTypeJson[b[i].name].push(a[j].name);
  302. }
  303. }
  304. }
  305. for (var k = 0; k < c.length; k++) {
  306. this.Tname.push(c[k].name);
  307. }
  308. console.log(this.courseTypeJson.length);
  309. this.aStudentName = res.data[2];
  310. this.chapInfo = JSON.parse(this.courseDetail.chapters);
  311. for (var z = 0; z < this.chapInfo.length; z++) {
  312. this.rw += this.chapInfo[z].chapterInfo[0].taskJson.length;
  313. }
  314. })
  315. .catch((err) => {
  316. loading.close();
  317. console.error(err);
  318. });
  319. },
  320. getUser() {
  321. let params = { uid: this.userid };
  322. this.ajax
  323. .get(this.$store.state.api + "getUser", params)
  324. .then((res) => {
  325. this.userinfo = res.data[0][0];
  326. })
  327. .catch((err) => {
  328. console.error(err);
  329. });
  330. },
  331. // getSName() {
  332. // let params = {
  333. // uid: JSON.stringify(this.courseDetail.course_student),
  334. // };
  335. // this.ajax
  336. // .get(this.$store.state.api + "selectSName", params)
  337. // .then((res) => {
  338. // this.aStudentName = res.data[0];
  339. // })
  340. // .catch((err) => {
  341. // console.error(err);
  342. // });
  343. // },
  344. },
  345. created() {
  346. this.getCourseDetail();
  347. this.getUser();
  348. document.scrollingElement.scrollTop = 0;
  349. // this.getSName();
  350. },
  351. };
  352. </script>
  353. <style scoped>
  354. @media screen and (max-width: 1024px) {
  355. .Tname {
  356. width: 500px;
  357. white-space: nowrap;
  358. overflow: hidden;
  359. text-overflow: ellipsis;
  360. }
  361. }
  362. .body_student {
  363. margin: 10px auto;
  364. width: 98%;
  365. height: 100%;
  366. }
  367. .student_head {
  368. width: 100%;
  369. background: #fff;
  370. height: 30%;
  371. position: relative;
  372. }
  373. .wheel {
  374. width: 250px;
  375. max-height: 146px;
  376. display: flex;
  377. align-items: center;
  378. }
  379. .man {
  380. width: 16px;
  381. height: 16px;
  382. }
  383. .wheel > img,
  384. .man > img {
  385. width: 100%;
  386. height: 100%;
  387. }
  388. .box_course {
  389. display: flex;
  390. padding: 25px 0 20px 60px;
  391. }
  392. .right_box {
  393. display: flex;
  394. flex-direction: column;
  395. margin-left: 30px;
  396. align-items: flex-start;
  397. width: calc(100% - 350px);
  398. }
  399. .right_box_title {
  400. font-size: 23px;
  401. max-width: calc(100% - 190px);
  402. white-space: nowrap;
  403. overflow: hidden;
  404. text-overflow: ellipsis;
  405. }
  406. .people {
  407. display: flex;
  408. margin-top: 20px;
  409. }
  410. .person {
  411. margin-left: 10px;
  412. line-height: 18px;
  413. }
  414. .now_study {
  415. width: 150px;
  416. height: 35px;
  417. color: #fff;
  418. background: #4a9eed;
  419. text-align: center;
  420. line-height: 35px;
  421. border-radius: 5px;
  422. font-size: 13px;
  423. cursor: pointer;
  424. margin-top: 30px;
  425. }
  426. .choose_who {
  427. display: flex;
  428. margin: 15px 0 0 25px;
  429. }
  430. .who_choose {
  431. height: 28px;
  432. cursor: pointer;
  433. }
  434. .choose_who > div:nth-child(2) {
  435. margin-left: 35px;
  436. }
  437. .choose {
  438. border-bottom: 5px solid #4a9eed;
  439. color: #4a9eed;
  440. }
  441. .student_body {
  442. display: flex;
  443. }
  444. .student_body,
  445. .right {
  446. width: 100%;
  447. margin: 10px auto;
  448. min-height: 688px;
  449. }
  450. .nav {
  451. margin: auto 25px;
  452. width: 80%;
  453. padding-top: 5px;
  454. text-indent: 25px;
  455. }
  456. .pic {
  457. width: 100%;
  458. display: flex;
  459. flex-direction: row;
  460. flex-wrap: wrap;
  461. height: 100%;
  462. justify-content: space-evenly;
  463. }
  464. .Img {
  465. /*width: 30%; */
  466. width: 300px;
  467. margin: 20px 50px;
  468. margin: 20px 10px;
  469. border: 1px solid #dbdbdb;
  470. border-radius: 5px;
  471. overflow: hidden;
  472. }
  473. .Img > img {
  474. width: 100%;
  475. height: 100%;
  476. }
  477. .student_body_one,
  478. .right_one {
  479. width: 100%;
  480. margin: 0 auto;
  481. background: #fff;
  482. margin-top: 10px;
  483. min-height: 688px;
  484. }
  485. .student {
  486. width: 85%;
  487. display: flex;
  488. flex-direction: row;
  489. flex-wrap: wrap;
  490. justify-content: flex-start;
  491. margin: auto 10px;
  492. }
  493. .student > div {
  494. width: 12%;
  495. height: 35px;
  496. background: #e3759a;
  497. text-align: center;
  498. border: 1px solid #e3759a;
  499. border-radius: 5px;
  500. color: #fff;
  501. line-height: 35px;
  502. margin: 10px;
  503. }
  504. .dialog_change >>> .el-dialog {
  505. border-radius: 5px;
  506. }
  507. .dialog_change >>> .el-dialog__header {
  508. background: #303030;
  509. height: 36px;
  510. line-height: 36px;
  511. padding-left: 10px;
  512. padding: 0px 10px 0px;
  513. }
  514. .dialog_change >>> .el-dialog__headerbtn {
  515. top: 10px !important;
  516. right: 10px !important;
  517. }
  518. .dialog_change >>> .el-dialog__title {
  519. color: #fff;
  520. font-size: 14px;
  521. line-height: 5px;
  522. }
  523. .dialog_change >>> .el-dialog__body {
  524. background: #f5f5f5;
  525. }
  526. .blue_box {
  527. align-items: center;
  528. display: flex;
  529. flex-direction: column;
  530. justify-content: center;
  531. }
  532. .blue_box,
  533. .blue_box_one {
  534. width: 30%;
  535. height: 100px;
  536. text-align: center;
  537. color: #fff;
  538. background-image: linear-gradient(90deg, #477cd7, #65b9fc);
  539. border-radius: 15px;
  540. margin: 15px 0 15px 15px;
  541. cursor: pointer;
  542. }
  543. .blue_box_one {
  544. width: 200px;
  545. height: 200px;
  546. background-image: linear-gradient(90deg, #477cd7, #65b9fc);
  547. display: flex;
  548. flex-direction: column;
  549. flex-wrap: nowrap;
  550. align-items: center;
  551. justify-content: center;
  552. }
  553. .blue_box_one > div {
  554. margin: 5px 0;
  555. }
  556. .blue_box_one > div:nth-child(1) {
  557. font-size: 20px;
  558. font-weight: bold;
  559. }
  560. .blue_box > div:nth-child(2) {
  561. margin-top: 10px;
  562. }
  563. .blue_box_one > div:nth-child(2) {
  564. white-space: nowrap;
  565. text-overflow: ellipsis;
  566. overflow: hidden;
  567. word-break: break-all;
  568. width: 100%;
  569. text-align: center;
  570. max-width: calc(100% - 85px);
  571. margin: 0 auto;
  572. }
  573. .return {
  574. background: #205cc6;
  575. width: 70px;
  576. height: 30px;
  577. color: #fff;
  578. text-align: center;
  579. line-height: 32px;
  580. margin-right: 20px;
  581. cursor: pointer;
  582. border-radius: 5px;
  583. position: absolute;
  584. right: 0;
  585. top: 24px;
  586. font-size: 14px;
  587. }
  588. .return > img {
  589. width: 100%;
  590. height: 100%;
  591. }
  592. .cType {
  593. display: flex;
  594. flex-direction: row;
  595. justify-content: center;
  596. align-items: center;
  597. margin-top: 20px;
  598. }
  599. .cType > div > span {
  600. font-size: 18px;
  601. }
  602. .type_children + .type_children {
  603. margin-left: 10px;
  604. }
  605. .all_choose {
  606. margin-right: 10px;
  607. max-width: 250px;
  608. white-space: nowrap;
  609. overflow: hidden;
  610. text-overflow: ellipsis;
  611. }
  612. .rightT {
  613. display: flex;
  614. flex-direction: row;
  615. flex-wrap: nowrap;
  616. align-items: center;
  617. width: calc(100% - 20px);
  618. }
  619. .jd {
  620. background: #4a9eed;
  621. margin-left: 15px;
  622. border-radius: 10px;
  623. color: #fff;
  624. width: 70px;
  625. height: 25px;
  626. text-align: center;
  627. line-height: 25px;
  628. }
  629. .sLeft {
  630. width: 14%;
  631. margin-right: 10px;
  632. background: rgb(255, 255, 255);
  633. padding: 20px 0 0 15px;
  634. border-radius: 10px;
  635. }
  636. .courseT {
  637. border-left: 3px solid #2e66c9;
  638. padding-left: 5px;
  639. color: #2e66c9;
  640. font-weight: bold;
  641. }
  642. .courseTd {
  643. padding-top: 15px;
  644. height: 700px;
  645. overflow: auto;
  646. word-break: break-word;
  647. }
  648. .courseTd::-webkit-scrollbar {
  649. /*滚动条整体样式*/
  650. width: 6px;
  651. /*高宽分别对应横竖滚动条的尺寸*/
  652. height: 6px;
  653. }
  654. /*定义滚动条轨道 内阴影+圆角*/
  655. .courseTd::-webkit-scrollbar {
  656. border-radius: 10px;
  657. background-color: #eee;
  658. }
  659. /*定义滑块 内阴影+圆角*/
  660. .courseTd::-webkit-scrollbar-thumb {
  661. border-radius: 10px;
  662. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  663. background-color: rgba(0, 0, 0, 0.1);
  664. }
  665. .rightTd,
  666. .noBRight {
  667. width: 84%;
  668. background: #fff;
  669. display: flex;
  670. flex-direction: row;
  671. flex-wrap: wrap;
  672. align-content: flex-start;
  673. align-items: center;
  674. justify-content: flex-start;
  675. }
  676. .noBRight {
  677. width: 100%;
  678. }
  679. .Tname {
  680. margin-left: 40px;
  681. }
  682. </style>