Parcourir la source

add:新需求跳转-唐

Tang il y a 3 ans
Parent
commit
ac827f48ed

+ 4 - 4
src/axios.js

@@ -1,19 +1,19 @@
 import axios from 'axios'
 import store from './store'
 import { Message } from 'element-ui'
-export const BASE_URL = 'https://api.xyyxt.net'   //release
+// export const BASE_URL = 'https://api.xyyxt.net'   //release
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
 // export const BASE_URL = 'https://test.xyyxt.net'   //预发布
 // export const BASE_URL = 'http://192.168.1.7:5055'    //dev
 // export const BASE_URL = 'http://120.79.166.78:19012'    //测试-外网
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
-// export const BASE_URL = 'http://192.168.1.222:5055'    //测试
+export const BASE_URL = 'http://192.168.1.222:5055'    //测试
 export const tenantId = '867735392558919680'
 
 
 //图片上传api
-export const BASE_IMG_URL = 'https://file.xyyxt.net/'     //release
-// export const BASE_IMG_URL = 'https://file-dev.xyyxt.net/'  //test
+// export const BASE_IMG_URL = 'https://file.xyyxt.net/'     //release
+export const BASE_IMG_URL = 'https://file-dev.xyyxt.net/'  //test
 
 import tools from './common/tools'
 import router from './router'

+ 1 - 1
src/components/goodsItem/index.vue

@@ -20,7 +20,7 @@
         {{ item.goodsName }}
       </div>
       <div class="course-item__desc">
-        <div class="price">{{ item.standPrice }}</div>
+        <div class="price">{{item.standPrice === 0 ? '免费' : `¥${item.standPrice}`}}</div>
       </div>
       <div class="course-item__btns">
         <a class="add" @click.stop="addCart(item)">加购物车</a>

+ 1 - 1
src/pages/bank-list/index.vue

@@ -50,7 +50,7 @@
                     :class="{ active: params.businessId == item.id }"
                     @click="changeBusiness(item)"
                   >
-                    {{ item.projectName }} - {{ item.businessName }}
+                    {{ item.aliasName }}
                   </div>
                 </div>
               </div>

+ 1 - 1
src/pages/course-list/index.vue

@@ -50,7 +50,7 @@
                     :class="{ active: params.businessId == item.id }"
                     @click="changeBusiness(item)"
                   >
-                    {{ item.projectName }} - {{ item.businessName }}
+                    {{ item.aliasName }}
                   </div>
                 </div>
               </div>

+ 4 - 1
src/pages/goods-detail/bank-detail.vue

@@ -27,7 +27,10 @@
                   <div class="title">
                     {{ goodsDetail.goodsName }}
                   </div>
-                  <div class="price" v-if="goodsDetail.standPrice">
+                  <div class="price" v-if="goodsDetail.standPrice === 0">
+                    免费
+                  </div>
+                  <div class="price" v-else>
                     ¥{{ goodsDetail.standPrice | toFixed }}
                   </div>
                   <div class="btns">

+ 6 - 3
src/pages/goods-detail/course-detail.vue

@@ -31,7 +31,10 @@
                     {{ courseList.length }} 课程
                     {{ goodsDetail.classHours || "-" }}学时
                   </div>
-                  <div class="price">
+                  <div class="price" v-if="goodsDetail.standPrice === 0">
+                    免费
+                  </div>
+                  <div class="price" v-else>
                     ¥{{ goodsDetail.standPrice | toFixed }}
                   </div>
                   <div class="btns">
@@ -571,8 +574,8 @@ export default {
     };
   },
   beforeDestroy() {
-    if(this.player){
-    this.player.destroy();
+    if (this.player) {
+      this.player.destroy();
     }
   },
   watch: {

+ 4 - 1
src/pages/goods-detail/live-detail.vue

@@ -31,7 +31,10 @@
                     {{ courseList.length }} 课程
                     {{ goodsDetail.classHours || "-" }}学时
                   </div>
-                  <div class="price">
+                  <div class="price" v-if="goodsDetail.standPrice === 0">
+                    免费
+                  </div>
+                  <div class="price" v-else>
                     ¥{{ goodsDetail.standPrice | toFixed }}
                   </div>
                   <div class="btns">

+ 1 - 1
src/pages/live-list/index.vue

@@ -50,7 +50,7 @@
                     :class="{ active: params.businessId == item.id }"
                     @click="changeBusiness(item)"
                   >
-                    {{ item.projectName }} - {{ item.businessName }}
+                    {{ item.aliasName }}
                   </div>
                 </div>
               </div>

+ 76 - 20
src/pages/person-center/my-course/index.vue

@@ -14,24 +14,42 @@
           @click="changeCourse"
           >切换科目</el-button
         >
-        
-        <el-button v-if="
-          goodsData.applyStatus === 1 &&
-          !(
-            sysTime <= goodsData.serviceStartTime ||
-            sysTime >= goodsData.serviceEndTime ||
-            (goodsData.classStartTime &&
-              sysTime <= goodsData.classStartTime) ||
-            (goodsData.classEndTime && sysTime >= goodsData.classEndTime) ||
-            goodsData.learningStatus == 2 ||
-            goodsData.classStatus == 0 ||
-            (goodsData.learningStatus == 3 &&
-              sysTime < goodsData.learningTimeStart) || !goodsData.examApplyGoodsList.length
-          )
-        " size="mini" type="warning" plain style="margin-left: 14px" @click="changeTest()">预约考试
+
+        <el-button
+          v-if="
+            goodsData.applyStatus === 1 &&
+            !(
+              sysTime <= goodsData.serviceStartTime ||
+              sysTime >= goodsData.serviceEndTime ||
+              (goodsData.classStartTime &&
+                sysTime <= goodsData.classStartTime) ||
+              (goodsData.classEndTime && sysTime >= goodsData.classEndTime) ||
+              goodsData.learningStatus == 2 ||
+              goodsData.classStatus == 0 ||
+              (goodsData.learningStatus == 3 &&
+                sysTime < goodsData.learningTimeStart) ||
+              !goodsData.examApplyGoodsList.length
+            )
+          "
+          size="mini"
+          type="warning"
+          plain
+          style="margin-left: 14px"
+          @click="changeTest()"
+          >预约考试
         </el-button>
       </h4>
-      <div v-for="(item, index) in courseList" :key="index">
+      <div style="margin: 14px 0px">
+        <el-button
+          size="small"
+          v-for="(item, index) in subjectList"
+          :type="newActiveSubjectId === item.id ? 'primary' : ''"
+          :key="index"
+          @click="newActiveSubjectId = item.id"
+          >{{ item.name }}</el-button
+        >
+      </div>
+      <div v-for="(item, index) in filterList(courseList)" :key="index">
         <p class="firstTop hoverStyle" @click="changeStatus(item)">
           <span class="iconStyle">课</span
           ><span class="titles">{{ item.courseName }}</span
@@ -517,7 +535,10 @@
     ></RebuildModal>
 
     <!-- 预约考试弹窗 -->
-    <appoint-test :appointModal.sync="appointModal" :appointItem='goodsData'></appoint-test>
+    <appoint-test
+      :appointModal.sync="appointModal"
+      :appointItem="goodsData"
+    ></appoint-test>
   </div>
 </template>
 
@@ -525,7 +546,7 @@
 import { mapGetters, mapActions } from "vuex";
 import courseData from "./courseData.vue";
 import RebuildModal from "@/components/rebuildModal";
-import AppointTest from './components/AppointTest.vue'
+import AppointTest from "./components/AppointTest.vue";
 export default {
   name: "MyCourse",
   components: { courseData, RebuildModal, AppointTest },
@@ -540,10 +561,26 @@ export default {
       confirmTimer: null,
       confirmLoading: false,
       appointModal: false, // 预约考试弹窗
+      subjectList: [], //当前商品课程科目汇总
+      newActiveSubjectId: "", //当前选中ID
     };
   },
   computed: {
     ...mapGetters(["userInfo"]),
+    filterList:function(){
+      return function(item){
+        console.log(this.newActiveSubjectId)
+        let array = []
+        if(this.newActiveSubjectId){
+          array = item.filter(items => {
+            return items.subjectId === this.newActiveSubjectId
+          })
+        }else{
+          return item
+        }
+        return array
+      }
+    }
   },
   mounted() {
     this.getRecord();
@@ -570,16 +607,23 @@ export default {
       });
     },
     changeCourse() {
-      console.log('this.goodsData', this.goodsData)
+      console.log("this.goodsData", this.goodsData);
       this.$refs.courseData.openBoxs(this.goodsData);
     },
     changeTest() {
-      this.appointModal = true
+      this.appointModal = true;
     },
     backData(item) {
       this.goodsData = item;
       this.getGoodsCourseList(item);
     },
+    //数组对象去重
+    uniqueFunc(arr, uniId) {
+      const res = new Map();
+      return arr.filter(
+        (item) => !res.has(item[uniId]) && res.set(item[uniId], 1)
+      );
+    },
     /**
      * 获取课程列表
      */
@@ -591,11 +635,23 @@ export default {
             gradeId: item.gradeId,
           })
           .then((res) => {
+            var array = [];
             res.rows.forEach((element) => {
               element.showStatus = false;
               element.children = [];
+              array.push({
+                id: element.subjectId,
+                name: element.subjectName,
+              });
             });
             this.courseList = res.rows;
+            array = this.uniqueFunc(array, "id");
+            array.unshift({
+              id: "",
+              name: "全部",
+            });
+            this.subjectList = array;
+            this.newActiveSubjectId = "";
             resolve();
             // if (res.rows && res.rows.length > 0) {
             //   this.getRecord(res.rows[0]);