123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599 |
- <template>
- <div class="pb_content">
- <div class="pb_content_body" style="height: 100%">
- <div class="body_student">
- <div class="student_head">
- <div
- class="return"
- @click.stop="
- goTo(
- '/index?userid=' +
- userid +
- '&oid=' +
- oid +
- '&cid=' +
- classId +
- '&tType=' +
- tType
- )
- "
- >
- 返回
- <!-- <img src="../assets/icon/return.png" alt="" /> -->
- </div>
- <div class="box_course">
- <div class="wheel">
- <img
- :src="
- this.courseDetail.cover != null &&
- this.courseDetail.cover != ''
- ? JSON.parse(this.courseDetail.cover).length > 0
- ? JSON.parse(this.courseDetail.cover)[0].url
- : mr
- : mr
- "
- alt
- />
- </div>
- <div class="right_box">
- <div class="right_box_title">{{ courseDetail.title }}</div>
- <div class="people">
- <div class="man">
- <img src="../assets/people.png" alt />
- </div>
- <div class="person">
- {{ courseDetail.vcount != null ? courseDetail.vcount : 0 }}人
- </div>
- </div>
- <div class="cType">
- <div
- class="all_choose"
- v-for="(item, index) in courseType"
- :key="index"
- >
- <span
- style="
- {
- 'margin-left':index>0?'10px': '';
- }
- "
- >{{ item + ":" }}</span
- >
- <span
- class="type_children"
- v-for="(item2, index2) in courseTypeJson[item]"
- :key="index2"
- >{{ item2 }}</span
- >
- </div>
- </div>
- <div class="now_study" @click="dialogVisible = true">
- 立即学习
- </div>
- </div>
- </div>
- </div>
- <div class="student_body">
- <div
- style="
- width: 20%;
- margin-right: 10px;
- background: #fff;
- padding-right: 10px;
- "
- >
- <div
- class="blue_box_one"
- v-for="(item, index) in chapInfo"
- :key="index"
- @click="addUserRate(index)"
- >
- <div>第{{ index + 1 }}阶段</div>
- <div :title="item.dyName">{{ item.dyName }}</div>
- </div>
- </div>
- <div style="width: 80%; background: #fff">
- <div class="choose_who">
- <div
- class="who_choose"
- :class="choose == 0 ? 'choose' : ''"
- @click="choose = 0"
- >
- 项目详情
- </div>
- <!-- <div
- class="who_choose"
- :class="choose == 1 ? 'choose' : ''"
- @click="choose = 1"
- >
- 项目学员
- </div> -->
- </div>
- <div class="right" v-if="choose == 0">
- <div class="nav">
- {{
- courseDetail.brief != null
- ? courseDetail.brief
- : "暂无课程简介"
- }}
- </div>
- </div>
- <!-- <div class="right_one" v-else>
- <div class="student" v-if="aStudentName.length > 0">
- <div v-for="(item, index) in aStudentName" :key="index">
- {{ item.name }}
- </div>
- </div>
- <div class="student" v-else>暂无课程学员</div>
- </div> -->
- </div>
- </div>
- <!-- <div
- style="
- text-align: center;
- padding: 30px 0 20px 0;
- box-sizing: border-box;
- "
- >
- 此处滚动加载..
- </div>-->
- <el-dialog
- title="阶段选择"
- :visible.sync="dialogVisible"
- :append-to-body="true"
- width="700px"
- :before-close="handleClose"
- class="dialog_change"
- >
- <div style="font-size: 20px">请选择阶段</div>
- <div
- style="
- padding: 20px 30px;
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- "
- >
- <div
- class="blue_box"
- v-for="(item, index) in chapInfo"
- :key="index"
- @click="addUserRate(index)"
- >
- <div>第{{ index + 1 }}阶段</div>
- <div>{{ item.dyName }}</div>
- </div>
- </div>
- </el-dialog>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- choose: 0,
- dialogVisible: false,
- id: this.$route.query.courseId,
- userid: this.$route.query.userid,
- oid: this.$route.query.oid,
- classId: this.$route.query.cid,
- tType: this.$route.query.tType,
- courseDetail: {},
- aStudentName: [],
- chapInfo: [],
- courseType: [],
- courseTypeJson: {},
- userinfo: [],
- mr: require("../assets/icon/wheel.png"),
- };
- },
- methods: {
- handleClose(done) {
- done();
- },
- goTo(path) {
- this.$router.push(path);
- },
- addUserRate(i) {
- // var suid = this.userid;
- // if (
- // JSON.parse(this.courseDetail.course_student).indexOf(suid) == -1 &&
- // JSON.parse(this.courseDetail.userid) != suid
- // ) {
- // this.$message.error("你没有该权限");
- // return;
- // }
- // var a =
- // this.courseDetail.course_student != ""
- // ? JSON.parse(this.courseDetail.course_student)
- // : "";
- // if (this.courseDetail.userid != suid) {
- // if (this.userinfo.type == 2) {
- // if (a != "") {
- // if (
- // JSON.parse(this.courseDetail.course_student).indexOf(suid) == -1
- // ) {
- // this.$message.error("你没有该权限");
- // return;
- // }
- // } else {
- // this.$message.error("暂无项目学员,请联系老师添加项目学员!");
- // return;
- // }
- // }
- // }
- let params = {
- uid: this.userid,
- cid: this.id,
- };
- this.ajax
- .get(this.$store.state.api + "addUserR", params)
- .then((res) => {
- console.log(res.data);
- this.updateVc();
- this.goTo(
- "/study?type=" +
- i +
- "&courseId=" +
- this.id +
- "&userid=" +
- this.userid +
- "&oid=" +
- this.oid +
- "&cid=" +
- this.classId +
- "&tType=" +
- this.tType
- );
- })
- .catch((err) => {
- console.error(err);
- });
- },
- updateVc() {
- let params = {
- cid: this.id,
- };
- this.ajax
- .get(this.$store.state.api + "updateVc", params)
- .then((res) => {
- console.log(res.data);
- })
- .catch((err) => {
- console.error(err);
- });
- },
- getCourseDetail() {
- const loading = this.$loading.service({
- background: "rgba(255, 255, 255, 0.7)",
- target: document.querySelector(".student_table"),
- });
- let params = {
- courseId: this.id,
- };
- this.ajax
- .get(this.$store.state.api + "selectCourseDetail", params)
- .then((res) => {
- loading.close();
- // this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
- this.courseDetail = res.data[0][0];
- var a = res.data[0];
- var b = res.data[1];
- for (var i = 0; i < b.length; i++) {
- // if (!this.id) {
- // this.courseType[b[i].id] = [];
- // }
- for (var j = 0; j < a.length; j++) {
- if (b[i].id == a[j].pid) {
- if (!this.courseTypeJson[b[i].name]) {
- this.courseType.push(b[i].name);
- this.courseTypeJson[b[i].name] = [];
- }
- this.courseTypeJson[b[i].name].push(a[j].name);
- }
- }
- }
- console.log(this.courseTypeJson.length);
- this.aStudentName = res.data[2];
- this.chapInfo = JSON.parse(this.courseDetail.chapters);
- })
- .catch((err) => {
- loading.close();
- console.error(err);
- });
- },
- getUser() {
- let params = { uid: this.userid };
- this.ajax
- .get(this.$store.state.api + "getUser", params)
- .then((res) => {
- this.userinfo = res.data[0][0];
- })
- .catch((err) => {
- console.error(err);
- });
- },
- // getSName() {
- // let params = {
- // uid: JSON.stringify(this.courseDetail.course_student),
- // };
- // this.ajax
- // .get(this.$store.state.api + "selectSName", params)
- // .then((res) => {
- // this.aStudentName = res.data[0];
- // })
- // .catch((err) => {
- // console.error(err);
- // });
- // },
- },
- created() {
- this.getCourseDetail();
- this.getUser();
- document.scrollingElement.scrollTop = 0;
- // this.getSName();
- },
- };
- </script>
- <style scoped>
- .body_student {
- margin: 10px auto;
- width: 98%;
- height: 100%;
- }
- .student_head {
- width: 100%;
- background: #fff;
- height: 30%;
- position: relative;
- }
- .wheel {
- width: 210px;
- max-height: 146px;
- }
- .man {
- width: 16px;
- height: 16px;
- }
- .wheel > img,
- .man > img {
- width: 100%;
- height: 100%;
- }
- .box_course {
- display: flex;
- padding: 25px 0 20px 60px;
- }
- .right_box {
- display: flex;
- flex-direction: column;
- margin-left: 30px;
- align-items: flex-start;
- }
- .right_box_title {
- font-size: 23px;
- }
- .people {
- display: flex;
- margin-top: 20px;
- }
- .person {
- margin-left: 10px;
- line-height: 18px;
- }
- .now_study {
- width: 150px;
- height: 35px;
- color: #fff;
- background: #4a9eed;
- text-align: center;
- line-height: 35px;
- border-radius: 5px;
- font-size: 13px;
- cursor: pointer;
- margin-top: 30px;
- }
- .choose_who {
- display: flex;
- margin: 15px 0 0 25px;
- }
- .who_choose {
- height: 28px;
- cursor: pointer;
- }
- .choose_who > div:nth-child(2) {
- margin-left: 35px;
- }
- .choose {
- border-bottom: 5px solid #4a9eed;
- color: #4a9eed;
- }
- .student_body {
- display: flex;
- }
- .student_body,
- .right {
- width: 100%;
- margin: 0 auto;
- margin-top: 10px;
- padding: 0 0 20px;
- min-height: 688px;
- }
- .nav {
- margin: auto 25px;
- width: 80%;
- padding-top: 5px;
- text-indent: 25px;
- }
- .pic {
- width: 100%;
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- height: 100%;
- justify-content: space-evenly;
- }
- .Img {
- /*width: 30%; */
- width: 300px;
- margin: 20px 50px;
- margin: 20px 10px;
- border: 1px solid #dbdbdb;
- border-radius: 5px;
- overflow: hidden;
- }
- .Img > img {
- width: 100%;
- height: 100%;
- }
- .student_body_one,
- .right_one {
- width: 100%;
- margin: 0 auto;
- background: #fff;
- margin-top: 10px;
- min-height: 688px;
- }
- .student {
- width: 85%;
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- justify-content: flex-start;
- margin: auto 10px;
- }
- .student > div {
- width: 12%;
- height: 35px;
- background: #e3759a;
- text-align: center;
- border: 1px solid #e3759a;
- border-radius: 5px;
- color: #fff;
- line-height: 35px;
- margin: 10px;
- }
- .dialog_change >>> .el-dialog {
- border-radius: 5px;
- }
- .dialog_change >>> .el-dialog__header {
- background: #303030;
- height: 36px;
- line-height: 36px;
- padding-left: 10px;
- padding: 0px 10px 0px;
- }
- .dialog_change >>> .el-dialog__headerbtn {
- top: 10px !important;
- right: 10px !important;
- }
- .dialog_change >>> .el-dialog__title {
- color: #fff;
- font-size: 14px;
- line-height: 5px;
- }
- .dialog_change >>> .el-dialog__body {
- background: #f5f5f5;
- }
- .blue_box {
- align-items: center;
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .blue_box,
- .blue_box_one {
- width: 30%;
- height: 100px;
- text-align: center;
- color: #fff;
- background-image: linear-gradient(90deg, #477cd7, #65b9fc);
- border-radius: 7px;
- margin: 10px;
- cursor: pointer;
- }
- .blue_box_one {
- width: 95% !important;
- height: 45px !important;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- align-items: center;
- background-image: linear-gradient(90deg, #477cd7, #65b9fc);
- }
- .blue_box > div:nth-child(1),
- .blue_box_one > div:nth-child(1) {
- /* line-height: 65px; */
- }
- .blue_box_one > div:nth-child(1) {
- margin: 0 5px;
- width: 40%;
- line-height: 30px !important;
- border-radius: 4px;
- background: #4e7ac6;
- }
- .blue_box > div:nth-child(2) {
- /* line-height: 0px; */
- margin-top: 10px;
- }
- .blue_box_one > div:nth-child(1) {
- line-height: 65px;
- margin: 0 5px 0 10px;
- width: 30%;
- min-width: 70px;
- }
- .blue_box_one > div:nth-child(2) {
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- word-break: break-all;
- width: 70%;
- text-align: left;
- max-width: calc(100% - 85px);
- margin-right: 10px;
- }
- .return {
- background: rgb(238, 238, 238);
- width: 58px;
- height: 30px;
- color: rgb(22, 22, 22);
- text-align: center;
- line-height: 32px;
- margin-right: 20px;
- cursor: pointer;
- border-radius: 5px;
- position: absolute;
- right: 0;
- top: 24px;
- }
- .return > img {
- width: 100%;
- height: 100%;
- }
- .cType {
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- margin-top: 20px;
- }
- .cType > div > span {
- font-size: 18px;
- }
- .type_children + .type_children {
- margin-left: 10px;
- }
- .all_choose {
- margin-right: 10px;
- max-width: 180px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- </style>
|