소스 검색

课程中心

11wqe1 4 시간 전
부모
커밋
af9e593a41
1개의 변경된 파일54개의 추가작업 그리고 26개의 파일을 삭제
  1. 54 26
      src/components/pages/liyuan/page/courseCenter.vue

+ 54 - 26
src/components/pages/liyuan/page/courseCenter.vue

@@ -21,7 +21,7 @@
       >
       </el-input>
     </div>
-    <div class="courseDataL" v-loading="loading">
+    <div :class="courseList.length > 5 ? 'courseDataL' : 'courseDataLFlex'" v-loading="loading">
       <div class="Conblock" v-for="(i, index) in courseList" :key="index">
         <img
           class="PimgL"
@@ -65,11 +65,8 @@
   </div>
 </template>
 <script>
-import { myMixin } from "@/mixins/mixin.js"
-
 export default {
   name: "courseCenter",
-  mixins: [ myMixin ],
   data() {
     return {
       search: "",
@@ -108,27 +105,53 @@ export default {
           console.log(err);
         });
     },
-    entCourse(item) {
-      let _str = "";
-      if (item.state == 1) {
-        _str = "course_stageMode_open";
-      }
-      if (item.state == 2) {
-        _str = "course_taskMode_open";
-      }
-      if (item.state == 3) {
-        _str = "course_easyMode_open";
-      }
-      if (item.state == 5) {
-        _str = "course_aiMode_open";
-      }
-      if (item.state == 6) {
-        _str = "course_aiEasyMode_open";
+    async entCourse(item) {
+      // let _str = "";
+      // if (item.state == 1) {
+      //   _str = "course_stageMode_open";
+      // }
+      // if (item.state == 2) {
+      //   _str = "course_taskMode_open";
+      // }
+      // if (item.state == 3) {
+      //   _str = "course_easyMode_open";
+      // }
+      // if (item.state == 5) {
+      //   _str = "course_aiMode_open";
+      // }
+      // if (item.state == 6) {
+      //   _str = "course_aiEasyMode_open";
+      // }
+      const user = await this.getUser();
+
+      let url = '';
+      if (user.type == '1') {
+        url = `https://pbl.cocorobo.cn/pbl-student-table/dist/#/courseDetail?userid=${user.userid}&oid=${user.organizeid}&org=${user.org}&courseId=${item.courseId}&tType=${user.type}&cid=${user.classid}&screenType=2`
+        // https://pbl.cocorobo.cn/pbl-student-table/dist/#/index?userid=&oid=&org=&tType=&cid=TscreenType=1
+      }else{
+        url = `https://pbl.cocorobo.cn/pbl-student-table/dist/#/courseDetail?courseId=${item.courseId}&userid=${user.userid}&oid=${user.organizeid}&org=${user.org}&cid=${user.classid}&tType=${user.type}&screenType=2`
       }
+      console.log('url',url);
+      window.topU.U.MD.D.I.openInApplication('setUrl',{url:url,title:'课程详情',id:new Date().getTime()})
       this.addOp3("1", "", { courseid: item.courseId, type: _str }, "success");
-
-      window.topU.postMessage({ cid: item.courseId, screenType: "3" }, "*");
-    }
+    },
+     // 获取创建学生用户后缀
+    async getUser() {
+      return new Promise((resolve, reject) => {
+        let params = {
+          userid: this.userid
+        };
+        this.ajax
+          .get(this.$store.state.api + "selectUser", params)
+          .then(res => {
+            resolve(res.data[0][0]);
+          })
+          .catch(err => {
+            reject(err);
+          });
+      })
+      
+    },
   },
   mounted() {
     this.getCourseList();
@@ -202,9 +225,14 @@ export default {
   flex-direction: column;
 }
 .courseDataL {
-    grid-template-columns: repeat(4, 1fr);
-    gap: 20px;
     display: grid;
+    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
+    gap: 20px;
+}
+.courseDataLFlex {
+  display: flex;
+  gap: 20px;
+  flex-wrap: wrap;
 }
 .Conblock {
   display: flex;
@@ -212,9 +240,9 @@ export default {
   gap: 10px;
   background: #fff;
   border-radius: 12px;
+  min-width: 300px;
   overflow: hidden;
   padding-bottom: 10px;
-  /* padding: 14px 16px; */
   box-sizing: border-box;
   box-shadow: 0px 4px 10px 0px #0000001a;
 }