Browse Source

教师查询发布课程

natasha 3 years ago
parent
commit
063f21b25f

+ 4 - 4
src/components/Personalcenter/Mycollect.vue

@@ -21,9 +21,9 @@
         <!-- <el-menu-item index="all">全部</el-menu-item> -->
         <el-menu-item index="book">教材</el-menu-item>
         <el-menu-item index="teaching">教学课程</el-menu-item>
-        <el-menu-item index="video">视频</el-menu-item>
-        <el-menu-item index="live">直播</el-menu-item>
-        <el-menu-item index="jiaoyan">教研资料</el-menu-item>
+        <el-menu-item index="video" v-if="userType != 'STUDENT'">视频</el-menu-item>
+        <el-menu-item index="live" v-if="userType != 'STUDENT'">直播</el-menu-item>
+        <el-menu-item index="jiaoyan" v-if="userType != 'STUDENT'">教研资料</el-menu-item>
         <el-menu-item index="hanzi">字词</el-menu-item>
         <el-menu-item index="sentence">句子</el-menu-item>
       </el-menu>
@@ -202,7 +202,7 @@ export default {
     SentenceEn,
     Enword,
   },
-  props: {},
+  props: ['userType'],
   data() {
     //这里存放数据
     return {

+ 51 - 28
src/components/Personalcenter/Teachcourse.vue

@@ -7,13 +7,13 @@
         <div v-for="(item, i) in list" :key="i" @click="jump(item)">
           <div class="img-box" :class="item.checked ? 'active' : ''">
             <div class="fengmian">
-              <img :src="item.goods_picture_url" alt="" />
+              <img :src="userType=='TEACHER'?item.picture_url:item.goods_picture_url" alt="" />
             </div>
             <div class="checkout-box" v-if="isShowCheckBox">
               <img src="@/assets/Personalcenter/selected-icon.png" />
             </div>
           </div>
-          <p class="goods_name">{{ item.goods_name }}</p>
+          <p class="goods_name">{{ userType=='TEACHER'?item.name:item.goods_name }}</p>
         </div>
       </div>
       <div class="paging" :class="list.length < 16 ? 'paging1' : ''">
@@ -45,7 +45,7 @@ export default {
     EditTitle,
     Empty,
   },
-  props: {},
+  props: ["userType"],
   data() {
     //这里存放数据
     return {
@@ -67,7 +67,13 @@ export default {
   //方法集合
   methods: {
     jump(item) {
-      jumpPath(item);
+        if(this.userType=='TEACHER'){
+            let url = `/GCLS-Learn/#/GoodsDetail?goods_id=${item.id}&goods_type=201`
+            window.open(url);
+        }else{
+            jumpPath(item);
+        }
+      
     },
     //   修改当前页
     changecurrentPage(val) {
@@ -78,35 +84,52 @@ export default {
     getOrderList() {
       let _this = this;
       _this.loading = true;
-      let MethodName = "page_query-PageQueryMyGoodsList";
-      let data = {
-        goods_id_list: [], // 商品 ID 列表,空表示查询所有商品
-        goods_type_list: JSON.parse(_this.activeIndex), // 商品类型列表,具体参看数据字典 6.9,订单商品类型。空表示查询所有类型
-        goods_name: _this.goods_name, // 商品名称,模糊查询,空表示查询所有
-        pay_status: 1, //支付状态 -1全部0未支付1已支付
-        cancel_status: 0, //取消状态 -1 全部 0 未取消 1 已取消(只有未支付的订单才会有取消状态)
-        page_capacity: _this.pageSize, // 每页容量,最大不能超过 200
-        cur_page: _this.pageNum, // 当前查询第几页,页码序号从 1 开始
-      };
+      let MethodName = ''
+      let data = null
+      if(_this.userType=='TEACHER'){
+          MethodName = "page_query-PageQueryMyCourseList";
+          data = {
+            finish_status: -1, // 完成状态列表, - 1 表示查询所有
+            release_status: -1, // 发布状态 -1【全部】,1 【已发布】,0【未发布】
+            name: "", // 课程名称,模糊查询
+            page_capacity: _this.pageSize, // 每页容量,最大不能超过 200
+            cur_page: _this.pageNum, // 当前查询第几页,页码序号从 1 开始
+          };
+      }else{
+          MethodName = "page_query-PageQueryMyGoodsList";
+          data = {
+            goods_id_list: [], // 商品 ID 列表,空表示查询所有商品
+            goods_type_list: JSON.parse(_this.activeIndex), // 商品类型列表,具体参看数据字典 6.9,订单商品类型。空表示查询所有类型
+            goods_name: _this.goods_name, // 商品名称,模糊查询,空表示查询所有
+            pay_status: 1, //支付状态 -1全部0未支付1已支付
+            cancel_status: 0, //取消状态 -1 全部 0 未取消 1 已取消(只有未支付的订单才会有取消状态)
+            page_capacity: _this.pageSize, // 每页容量,最大不能超过 200
+            cur_page: _this.pageNum, // 当前查询第几页,页码序号从 1 开始
+          };
+      }
       getLearnWebContent(MethodName, data).then((res) => {
         _this.loading = false;
         this.total = res.total_count;
-        if (res.goods_list && res.goods_list.length > 0) {
-          let list = res.goods_list;
-          list = list.map((item) => {
-            // let obj = this.handleGoodsType(item.goods_type);
-            // console.log(obj);
-            // item.coverUrl = obj.imgUrl;
-            // item.goods_type_root_name = obj.rootName;
+        let list = []
+        if(_this.userType=='TEACHER'){
+            if (res.course_list && res.course_list.length > 0) {
+                list = res.course_list;
+            } else {
+                this.isEmpty = true;
+            }
+        }else{
+            if (res.goods_list && res.goods_list.length > 0) {
+                list = res.goods_list; 
+            } else {
+                this.isEmpty = true;
+            }
+        }
+        list = list.map((item) => {
             item.checked = false;
             return item;
-          });
-          this.list = list;
-          console.log(this.list);
-          this.isEmpty = false;
-        } else {
-          this.isEmpty = true;
-        }
+        });
+        this.list = list;
+        this.isEmpty = false;
       });
     },
     handleGoodsType(type) {

+ 2 - 2
src/views/Personalcenter.vue

@@ -54,11 +54,11 @@
         <div class="right">
           <Mymessage v-if="SeleNavId == 0" />
           <Mytextbook v-if="SeleNavId == 1" />
-          <Teachcourse v-if="SeleNavId == 2" />
+          <Teachcourse v-if="SeleNavId == 2" :userType="userMessage.user_type" />
           <Traincourse v-if="SeleNavId == 3" />
           <TeachMaterial v-if="SeleNavId == 4" />
           <OrderManage v-if="SeleNavId == 5" />
-          <Mycollect v-if="SeleNavId == 6" />
+          <Mycollect v-if="SeleNavId == 6" :userType="userMessage.user_type" />
           <AccountSet v-if="SeleNavId == 7" />
         </div>
       </div>