123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822 |
- <template>
- <div class="pb_content">
- <div class="pb_content_body">
- <div class="student_head">
- <!-- <img src="../assets/banner.png" alt="" /> -->
- <el-carousel trigger="click" style="width: 100%; height: 100%">
- <el-carousel-item v-for="item in bannerList" :key="item.id">
- <!-- <h3 class="small">{{ item }}</h3> -->
- <img class="imgS" :src="item.poster" alt="" />
- </el-carousel-item>
- </el-carousel>
- </div>
- <div class="reBox">
- <div class="reTop">
- <div>课程</div>
- <div>
- <div class="search" @click="selectAll">
- <img src="../assets/icon/search.png" alt="" />
- </div>
- <input
- class="sInput"
- type="text"
- placeholder="请输入关键字"
- v-model="sCourse"
- />
- </div>
- </div>
- <div class="choose">
- <div
- class="all_choose"
- v-for="(item, index) in CourseType[0]"
- :key="index"
- >
- <span>{{ item.name }}:</span>
- <div class="typeCss">
- <div
- class="cName"
- @click="getCourse(item.name, '', item.id, 1)"
- :class="typeE.indexOf(item.id) != -1 ? 'isCType' : ''"
- >
- 全部
- </div>
- <div
- v-for="item1 in CourseTypeJson[item.id]"
- :key="item1.id"
- :label="item1.id"
- @click="getCourse(item.name, item.id, item1.id, 2)"
- >
- <div
- class="cName"
- :class="
- typea == item1.id || typeb == item1.id || typed == item1.id
- ? 'isCType'
- : ''
- "
- >
- {{ item1.name }}
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="body_student">
- <!-- <div class="top">
- <div :class="{ active: 0 == zoneListId }" @click="selectAll()">
- 所有课程
- </div>
- <div
- :class="{ active: item.id == zoneListId }"
- v-for="(item, index) in zoneList"
- :key="index"
- @click="checkZone(item.id)"
- >
- {{ item.name }}
- </div>
- </div> -->
- <div>
- <div class="main_box">
- <div
- class="box_course"
- v-for="(item, index) in zoneClass"
- :key="index"
- >
- <div class="wheel">
- <img
- :src="
- item.cover
- ? JSON.parse(item.cover)[0].url
- : require('../assets/wheel.png')
- "
- alt=""
- />
- </div>
- <div class="middle_white">
- <div class="textOverflow">{{ item.title }}</div>
- <div class="nameAndLength">
- <el-tooltip
- class="typeN"
- effect="light"
- :content="item.typename"
- placement="top"
- >
- <div>{{ item.typename }}</div>
- </el-tooltip>
- <div style="min-width: 50px">
- {{ JSON.parse(item.chapters).length }}阶段
- </div>
- </div>
- <!-- <div class="people">
- <div class="man">
- <img src="../assets/people.png" alt="" />
- </div>
- <div>
- {{
- item.pNum != null && item.pNum != "" ? item.pNum : "0"
- }}人学习
- </div>
- </div> -->
- </div>
- <div
- class="now_study"
- @click="
- goTo(
- '/courseDetail?courseId=' +
- item.courseId +
- '&userid=' +
- userid +
- '&oid=' +
- oid +
- '&org='+
- org +
- '&cid=' +
- classId +
- '&tType=' +
- tType +
- '&screenType=' +
- screenType
- )
- "
- >
- 立即学习
- </div>
- </div>
- <div class="course_empty" v-if="zoneClass.length == 0">
- 暂无课程
- </div>
- </div>
- </div>
- <div
- class="student_page"
- style="margin: 15px 0 0"
- v-if="zoneClass.length > 0"
- >
- <el-pagination
- background
- layout="prev, pager, next"
- :page-size="10"
- :total="total"
- v-if="page && zoneListId != 0"
- @current-change="handleCurrentChange"
- >
- </el-pagination>
- <el-pagination
- background
- layout="prev, pager, next"
- :page-size="10"
- :total="total"
- v-if="page && zoneListId == 0"
- @current-change="handleCurrentChange1"
- >
- </el-pagination>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- zoneList: [],
- zoneClass: [],
- page: 1,
- total: 0,
- isListAjax: false,
- zoneListId: "",
- bannerList: [],
- userid: this.$route.query.userid,
- oid: this.$route.query.oid,
- classId: this.$route.query.cid,
- tType: this.$route.query.tType,
- org: this.$route.query.org,
- screenType: this.$route.query.screenType,
- CourseType: [],
- CourseTypeJson: {},
- courseTypeId: {},
- sCourse: "",
- isCType: "",
- typea: "",
- typeb: "",
- typed: "",
- typeE: [],
- loading: "",
- };
- },
- methods: {
- goTo(path) {
- this.$router.push(path);
- },
- // getZone() {
- // this.ajax
- // .get(this.$store.state.api + "getZone", "")
- // .then((res) => {
- // this.zoneList = res.data[0];
- // // this.zoneListId = this.zoneList[0].id;
- // // this.getZoneClass(this.zoneList[0].id);
- // this.selectAll();
- // })
- // .catch((err) => {
- // console.error(err);
- // });
- // },
- //获取专区下的课程
- getZoneClass(zid) {
- this.isListAjax = true;
- const loading = this.openLoading(document.querySelector(".main_box"));
- let params = {
- bid: zid,
- oid: this.oid,
- page: this.page,
- };
- this.ajax
- .get(this.$store.state.api + "getZoneClassStudent", params)
- .then((res) => {
- loading.close();
- this.isListAjax = false;
- this.zoneClass = res.data[0];
- this.total = res.data[0].length ? res.data[0][0].num : 0;
- })
- .catch((err) => {
- console.error(err);
- });
- },
- getCourse(typeName, ftypeId, typeid, type) {
- if (typeName == "年级") {
- if (type == 1) {
- if (this.typeE.indexOf(typeid) != -1) {
- this.typeE.splice(this.typeE.indexOf(typeid), 1);
- } else {
- this.typeE.push(typeid);
- if (this.typea != "") {
- this.typea = "";
- }
- }
- } else {
- if (this.typea == typeid) {
- this.typea = "";
- } else {
- this.typea = typeid;
- if (this.typeE.indexOf(ftypeId) != -1) {
- this.typeE.splice(this.typeE.indexOf(ftypeId), 1);
- }
- }
- }
- } else if (typeName == "专栏") {
- if (type == 1) {
- if (this.typeE.indexOf(typeid) != -1) {
- this.typeE.splice(this.typeE.indexOf(typeid), 1);
- } else {
- this.typeE.push(typeid);
- if (this.typeb != "") {
- this.typeb = "";
- }
- }
- } else {
- if (this.typeb == typeid) {
- this.typeb = "";
- } else {
- this.typeb = typeid;
- if (this.typeE.indexOf(ftypeId) != -1) {
- this.typeE.splice(this.typeE.indexOf(ftypeId), 1);
- }
- }
- }
- } else if (typeName == "栏目") {
- if (type == 1) {
- if (this.typeE.indexOf(typeid) != -1) {
- this.typeE.splice(this.typeE.indexOf(typeid), 1);
- } else {
- this.typeE.push(typeid);
- if (this.typeb != "") {
- this.typeb = "";
- }
- }
- } else {
- if (this.typeb == typeid) {
- this.typeb = "";
- } else {
- this.typeb = typeid;
- if (this.typeE.indexOf(ftypeId) != -1) {
- this.typeE.splice(this.typeE.indexOf(ftypeId), 1);
- }
- }
- }
- } else if (typeName == "主题") {
- if (type == 1) {
- if (this.typeE.indexOf(typeid) != -1) {
- this.typeE.splice(this.typeE.indexOf(typeid), 1);
- } else {
- this.typeE.push(typeid);
- if (this.typeb != "") {
- this.typeb = "";
- }
- }
- } else {
- if (this.typeb == typeid) {
- this.typeb = "";
- } else {
- this.typeb = typeid;
- if (this.typeE.indexOf(ftypeId) != -1) {
- this.typeE.splice(this.typeE.indexOf(ftypeId), 1);
- }
- }
- }
- } else if (typeName == "学院") {
- if (type == 1) {
- if (this.typeE.indexOf(typeid) != -1) {
- this.typeE.splice(this.typeE.indexOf(typeid), 1);
- } else {
- this.typeE.push(typeid);
- if (this.typeb != "") {
- this.typeb = "";
- }
- }
- } else {
- if (this.typeb == typeid) {
- this.typeb = "";
- } else {
- this.typeb = typeid;
- if (this.typeE.indexOf(ftypeId) != -1) {
- this.typeE.splice(this.typeE.indexOf(ftypeId), 1);
- }
- }
- }
- } else if (typeName == "学科") {
- if (type == 1) {
- if (this.typeE.indexOf(typeid) != -1) {
- this.typeE.splice(this.typeE.indexOf(typeid), 1);
- } else {
- this.typeE.push(typeid);
- if (this.typed != "") {
- this.typed = "";
- }
- }
- } else {
- if (this.typed == typeid) {
- this.typed = "";
- } else {
- this.typed = typeid;
- if (this.typeE.indexOf(ftypeId) != -1) {
- this.typeE.splice(this.typeE.indexOf(ftypeId), 1);
- }
- }
- }
- }
- this.selectAll();
- },
- selectAll() {
- this.zoneListId = 0;
- this.isListAjax = true;
- if (!this.loading) {
- this.loading = this.openLoading(document.querySelector(".main_box"));
- }
- let params = {
- uid: this.userid,
- oid: this.oid,
- typea: this.typea != undefined ? this.typea : "",
- typeb: this.typeb != undefined ? this.typeb : "",
- typec: "",
- typed: this.typed != undefined ? this.typed : "",
- typeE: this.typeE.join(","),
- cu: "",
- cn: this.sCourse,
- classid: this.classId,
- org: this.org,
- page: this.page,
- };
- this.ajax
- .get(this.$store.state.api + "selectTypeCourse2", params)
- .then((res) => {
- this.loading.close();
- this.loading = "";
- this.isListAjax = false;
- this.zoneClass = res.data[0];
- this.total = res.data[0].length ? res.data[0][0].num : 0;
- })
- .catch((err) => {
- console.error(err);
- });
- },
- checkZone(id) {
- this.page = 1;
- this.zoneListId = id;
- this.getZoneClass(id);
- },
- handleCurrentChange(val) {
- this.page = val;
- this.getZoneClass(this.zoneListId);
- },
- handleCurrentChange1(val) {
- this.page = val;
- this.selectAll();
- },
- //获取banner
- getBanner() {
- var a = false;
- if(this.org == "eb2af5e9-ac3d-46b6-9fe3-3c1c364f018d"){
- a = true;
- }
- let params = {
- oid: a == false ? this.oid : this.org ,
- };
- this.ajax
- .get(this.$store.state.api + "selectBannerByOid", params)
- .then((res) => {
- if (res.data[0].length > 0) {
- this.bannerList = res.data[0];
- } else {
- this.getOldBanner();
- }
- })
- .catch((err) => {
- console.error(err);
- });
- },
- getOldBanner() {
- this.ajax
- .get(this.$store.state.api + "getBanner", "")
- .then((res) => {
- this.bannerList = res.data[0];
- })
- .catch((err) => {
- console.error(err);
- });
- },
- selectType() {
- this.ajax
- .get(this.$store.state.api + "selectType")
- .then((res) => {
- this.CourseType = res.data;
- for (var i = 0; i < res.data[0].length; i++) {
- if (!this.cid) {
- this.courseTypeId[res.data[0][i].id] = "";
- }
- if (this.oid == "69893dca-1d47-11ed-8c78-005056b86db5") {
- if (res.data[0][i].name == "栏目") {
- this.CourseType[0][i].name = "主题";
- }
- }
- for (var j = 0; j < res.data[1].length; j++) {
- if (res.data[0][i].id == res.data[1][j].pid) {
- if (!this.CourseTypeJson[res.data[0][i].id]) {
- this.CourseTypeJson[res.data[0][i].id] = [];
- }
- this.CourseTypeJson[res.data[0][i].id].push(res.data[1][j]);
- }
- }
- }
- this.selectTypeByOid();
- this.selectTypeByOrg();
- })
- .catch((err) => {
- console.error(err);
- });
- },
- selectTypeByOid() {
- let params = {
- oid: this.oid,
- };
- this.ajax
- .get(this.$store.state.api + "selectTypeByOid", params)
- .then((res) => {
- for (var i = 0; i < res.data[0].length; i++) {
- for (var j = 0; j < res.data[1].length; j++) {
- if (res.data[0][i].id == res.data[1][j].pid) {
- if (!this.CourseTypeJson[res.data[0][i].id]) {
- this.CourseTypeJson[res.data[0][i].id] = [];
- }
- this.CourseTypeJson[res.data[0][i].id].push(res.data[1][j]);
- }
- }
- }
- this.$forceUpdate();
- })
- .catch((err) => {
- console.error(err);
- });
- },
- selectTypeByOrg() {
- let params = {
- oid: this.org,
- };
- this.ajax
- .get(this.$store.state.api + "selectTypeByOrg", params)
- .then((res) => {
- for (var i = 0; i < res.data[0].length; i++) {
- for (var j = 0; j < res.data[1].length; j++) {
- if (res.data[0][i].id == res.data[1][j].pid) {
- if (!this.CourseTypeJson[res.data[0][i].id]) {
- this.CourseTypeJson[res.data[0][i].id] = [];
- }
- this.CourseTypeJson[res.data[0][i].id].push(res.data[1][j]);
- }
- }
- }
- this.$forceUpdate();
- })
- .catch((err) => {
- console.error(err);
- });
- },
- },
- created() {
- this.selectType();
- this.selectAll();
- this.getBanner();
- document.scrollingElement.scrollTop = 0;
- },
- };
- </script>
- <style scoped>
- @media screen and (max-width: 1024px) {
- .box_course {
- margin: 0px 5px 20px 5px !important;
- }
- }
- .student_head .imgS {
- width: 100%;
- height: 100%;
- cursor: pointer;
- object-fit: cover;
- }
- .top {
- padding: 20px 30px 20px 1%;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- }
- .top div {
- cursor: pointer;
- box-sizing: border-box;
- height: 35px;
- line-height: 35px;
- margin: 0 10px 0 0;
- padding-bottom: 5px;
- width: 80px;
- text-align: center;
- }
- .top .active {
- border-bottom: 3px solid #0e71e6;
- }
- .isactive {
- border-bottom: 3px solid #0e71e6;
- }
- .box_fk {
- width: 8px;
- height: 21px;
- background: #0e71e6;
- margin-right: 5px;
- }
- .wheel {
- width: 100%;
- height: 140px;
- }
- .man {
- width: 16px;
- height: 16px;
- }
- .wheel > img,
- .man > img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- .box_course {
- display: flex;
- flex-direction: column;
- flex-wrap: nowrap;
- margin: 0px 1% 20px;
- width: 300px;
- height: 260px;
- /*border: 1px solid #cecece; */
- border-radius: 10px;
- overflow: hidden;
- box-shadow: 0px 1px 3px 0px rgb(0 0 0 / 20%), 0px 1px 1px 0px rgb(0 0 0 / 14%),
- 0px 2px 1px -1px rgb(0 0 0 / 12%);
- justify-content: space-between;
- }
- .middle_white {
- font-size: 14px;
- margin: 5px 0 5px 10px;
- }
- .people {
- display: flex;
- align-items: center;
- }
- .people > div:nth-child(2) {
- margin-left: 10px;
- }
- .now_study {
- width: 100%;
- height: 40px;
- color: #fff;
- background: #4a9eed;
- text-align: center;
- line-height: 40px;
- font-size: 13px;
- cursor: pointer;
- }
- .now_study:hover {
- background: #205cc6;
- }
- .main_box {
- width: 100%;
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- justify-content: flex-start;
- margin: 0 auto;
- }
- .right_bottom_flex {
- width: 219px;
- height: 144px;
- margin: auto 0;
- }
- .right_bottom_flex > img {
- width: 100%;
- height: 100%;
- }
- .body_student {
- margin: 10px auto;
- width: 91.5%;
- height: 100%;
- }
- .student_head {
- width: 100%;
- /* height: 30%; */
- }
- .textOverflow {
- padding: 0 5px 0 0px;
- width: 95%;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- font-weight: bold;
- font-size: 16px;
- }
- .student_page {
- margin-top: 10px;
- }
- .course_empty {
- width: 100%;
- height: 200px;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .choose {
- display: flex;
- flex-direction: column;
- flex-wrap: nowrap;
- height: 100%;
- justify-content: space-evenly;
- align-items: flex-start;
- padding: 10px 0;
- }
- .all_choose {
- display: flex;
- flex-direction: row;
- align-items: baseline;
- margin: 10px 0;
- width: 100%;
- }
- .all_choose > span {
- min-width: 80px;
- display: block;
- letter-spacing: 14px;
- }
- .all_choose > span:nth-child(1) {
- font-weight: bold;
- }
- .all_choose >>> .el-checkbox-group {
- display: flex;
- flex-direction: row;
- width: 820px;
- flex-wrap: wrap;
- align-content: center;
- justify-content: flex-start;
- align-items: center;
- margin-top: 3px;
- }
- .all_choose > .el-checkbox-group >>> .el-checkbox {
- margin-bottom: 10px;
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- .all_choose > .el-checkbox-group > .el-checkbox >>> .el-checkbox__label {
- min-width: 80px;
- overflow: hidden;
- width: 80px;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .all_choose > .el-checkbox-group > .el-checkbox >>> .el-checkbox__label:hover {
- width: auto;
- }
- .cName {
- cursor: pointer;
- margin: 0 10px 10px 0;
- color: #b9b6b9;
- min-width: 80px;
- width: 80px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .reBox {
- position: relative;
- top: -25px;
- z-index: 999;
- left: 5%;
- background: #fff;
- width: 90%;
- border-radius: 5px;
- padding-left: 20px;
- }
- .reTop {
- padding: 20px 0 0 0;
- border-bottom: 1px solid #eee;
- width: 98%;
- display: flex;
- flex-direction: row;
- flex-wrap: nowrap;
- align-items: center;
- justify-content: space-between;
- }
- .reTop > div:nth-child(1) {
- font-weight: bold;
- width: 40px;
- border-bottom: 1px solid #205cc6;
- padding-bottom: 20px;
- color: #205cc6;
- font-size: 20px;
- }
- .reTop > div:nth-child(2) {
- display: flex;
- flex-direction: row;
- align-items: center;
- border: 1px solid #ccced3;
- width: 300px;
- border-radius: 8px;
- padding: 5px 0;
- margin-bottom: 10px;
- }
- .search {
- width: 20px;
- padding: 0 5px;
- }
- .search > img {
- width: 100%;
- height: 100%;
- }
- .sInput {
- border: none;
- width: 85%;
- }
- .sInput:focus-visible {
- outline: none;
- }
- .nameAndLength {
- display: flex;
- flex-direction: row;
- flex-wrap: nowrap;
- align-items: center;
- justify-content: space-between;
- margin: 5px 0;
- }
- .typeN {
- width: 200px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .isCType {
- color: #6282c2;
- }
- .typeCss {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- justify-content: flex-start;
- align-items: center;
- }
- </style>
|