Просмотр исходного кода

Merge branch 'xqy_recom' into xqy_topic

xuqiaoying 3 лет назад
Родитель
Сommit
d4000ce45f

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

@@ -21,6 +21,7 @@
       </div>
       <div class="course-item__desc">
         <div class="price">{{item.standPrice === 0 ? '免费' : `¥${item.standPrice}`}}</div>
+        <div v-if="item.linePrice" class="linePrice">¥{{item.linePrice}}</div>
       </div>
       <div class="course-item__btns">
         <a class="add" @click.stop="addCart(item)">加购物车</a>
@@ -226,7 +227,8 @@ export default {
   &__desc {
     height: 32px;
     margin-left: 8px;
-
+    display: flex;
+    align-items: center;
     .price {
       font-size: 18px;
       font-family: Microsoft YaHei;
@@ -234,6 +236,12 @@ export default {
       color: #ff2d55;
       line-height: 32px;
     }
+    .linePrice {
+      color: #999999;
+      font-size: 16px;
+      text-decoration:line-through;
+      margin-left: 10px;
+    }
   }
 
   &__btns {

+ 105 - 0
src/pages/bank-report/index.vue

@@ -151,6 +151,40 @@
             >全部解析</el-button
           >
         </div>
+
+        <div v-if="courseList.length" class="course_list">
+          <div class="course__header">
+            <div class="title">相关推荐</div>
+          </div>
+          <div class="course__body">
+            <!-- <p
+              v-if="
+                !courseList.length
+              "
+              class="text_align"
+            >
+              无推荐课程
+            </p> -->
+            <ul class="list clearfix">
+              <template v-for="(item, index) in courseList">
+                <li class="course-item" :key="index">
+                  <GoodsItem :item="item"></GoodsItem>
+                </li>
+              </template>
+            </ul>
+          </div>
+
+          <div class="pagination">
+            <el-pagination
+              @current-change="currentChangeCou"
+              background
+              layout="prev, pager, next"
+              :total="total"
+              :page-size="pageSize"
+            >
+            </el-pagination>
+          </div>
+        </div>
       </div>
     </section>
     <ToolBar></ToolBar>
@@ -162,6 +196,7 @@
 import Footer from "@/components/footer/index";
 import Header from "@/components/header/index";
 import ToolBar from "@/components/toolbar/index";
+import GoodsItem from "@/components/goodsItem/index";
 import { mapGetters } from "vuex";
 export default {
   name: "BankExplain",
@@ -169,6 +204,7 @@ export default {
     Footer,
     Header,
     ToolBar,
+    GoodsItem,
   },
   data() {
     return {
@@ -182,6 +218,10 @@ export default {
       examId: 0,
       recordId: 0,
       orderGoodsId: "",
+      courseList: [],
+			pageNum: 1,
+			pageSize: 10,
+			total: 0,
     };
   },
   computed: {
@@ -195,12 +235,33 @@ export default {
     this.orderGoodsId = this.$route.query.orderGoodsId || "";
     this.goodsId = this.$route.params.goodsId;
 
+    this.getcourList()
     this.examWrongRecordWrongNum();
     this.bankExamNextExam();
     await this.bankExam();
     await this.examReport();
   },
   methods: {
+    getcourList() {
+        this.$axios({
+            url: '/apply/recommend/goodsList',
+            method: 'post',
+            data: {
+                examId: this.examId,
+                pageNum: this.pageNum,
+                pageSize: this.pageSize,
+            }
+        }).then((res) => {
+            if (res.code == 200) {
+              this.courseList = res.rows || []
+              this.total = res.total
+            }
+        })
+    },
+    currentChangeCou(val) {
+      this.pageNum = val
+      this.getcourList()
+    },
     back() {
       // this.$router.replace({
       //   path: "/person-center/my-bank/bank-detail/" + this.goodsId,
@@ -625,5 +686,49 @@ export default {
       }
     }
   }
+
+  .course_list {
+      .course {
+        background: #f5f7fa;
+        padding-top: 40px;
+
+        &__header {
+          display: flex;
+          align-items: center;
+          justify-content: space-between;
+
+          .title {
+            background: url("~@/assets/video.png") no-repeat left center;
+            padding-left: 36px;
+            font-size: 24px;
+            font-family: YouSheBiaoTiHei;
+            font-weight: 400;
+            color: #333333;
+            text-shadow: 0px 6px 6px rgba(249, 113, 13, 0.08);
+          }
+
+          
+        }
+
+        
+
+        &__body {
+          .list {
+            width: 100%;
+
+            .course-item {
+              float: left;
+            }
+          }
+        }
+
+      }
+      .pagination {
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        margin: 20px 0px;
+      }
+    }
 }
 </style>

+ 3 - 0
src/pages/course-exam/index.vue

@@ -2293,6 +2293,9 @@ export default {
             this.setExamResult(result);
             this.$router.replace({
               path: "/course-report",
+              query: {
+                examId: this.examId,
+              }
             });
           }, 1000);
         })

+ 113 - 2
src/pages/course-report/index.vue

@@ -90,6 +90,40 @@
           <el-button type="primary" class="btn">错题解析</el-button>
           <el-button type="primary" class="btn">全部解析</el-button>
         </div> -->
+
+        <div v-if="courseList.length" class="course_list">
+          <div class="course__header">
+            <div class="title">相关推荐</div>
+          </div>
+          <div class="course__body">
+            <!-- <p
+              v-if="
+                !courseList.length
+              "
+              class="text_align"
+            >
+              无推荐课程
+            </p> -->
+            <ul class="list clearfix">
+              <template v-for="(item, index) in courseList">
+                <li class="course-item" :key="index">
+                  <GoodsItem :item="item"></GoodsItem>
+                </li>
+              </template>
+            </ul>
+          </div>
+
+          <div class="pagination">
+            <el-pagination
+              @current-change="currentChangeCou"
+              background
+              layout="prev, pager, next"
+              :total="total"
+              :page-size="pageSize"
+            >
+            </el-pagination>
+          </div>
+        </div>
       </div>
     </section>
     <ToolBar></ToolBar>
@@ -101,6 +135,7 @@
 import Footer from "@/components/footer/index";
 import Header from "@/components/header/index";
 import ToolBar from "@/components/toolbar/index";
+import GoodsItem from "@/components/goodsItem/index";
 import { mapGetters } from "vuex";
 export default {
   name: "BankExplain",
@@ -108,19 +143,51 @@ export default {
     Footer,
     Header,
     ToolBar,
+    GoodsItem,
   },
   data() {
-    return {};
+    return {
+      examId: '',
+      courseList: [],
+			pageNum: 1,
+			pageSize: 10,
+			total: 0,
+    };
   },
   computed: {
     ...mapGetters(["examResult"]),
   },
+  created() {
+    this.examId = this.$route.query.examId
+    this.getcourList()
+  },
   mounted() {
     if (JSON.stringify(this.examResult) == "{}") {
       this.$router.back(-1);
     }
   },
-  methods: {},
+  methods: {
+    getcourList() {
+        this.$axios({
+            url: '/apply/recommend/goodsList',
+            method: 'post',
+            data: {
+                examId: this.examId,
+                pageNum: this.pageNum,
+                pageSize: this.pageSize,
+            }
+        }).then((res) => {
+            if (res.code == 200) {
+              this.courseList = res.rows || []
+              this.total = res.total
+            }
+        })
+    },
+    currentChangeCou(val) {
+      this.pageNum = val
+      this.getcourList()
+    },
+  },
 };
 </script>
 
@@ -380,5 +447,49 @@ export default {
       }
     }
   }
+
+  .course_list {
+      .course {
+        background: #f5f7fa;
+        padding-top: 40px;
+
+        &__header {
+          display: flex;
+          align-items: center;
+          justify-content: space-between;
+
+          .title {
+            background: url("~@/assets/video.png") no-repeat left center;
+            padding-left: 36px;
+            font-size: 24px;
+            font-family: YouSheBiaoTiHei;
+            font-weight: 400;
+            color: #333333;
+            text-shadow: 0px 6px 6px rgba(249, 113, 13, 0.08);
+          }
+
+          
+        }
+
+        
+
+        &__body {
+          .list {
+            width: 100%;
+
+            .course-item {
+              float: left;
+            }
+          }
+        }
+
+      }
+      .pagination {
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        margin: 20px 0px;
+      }
+    }
 }
 </style>

+ 273 - 64
src/pages/home/index.vue

@@ -376,16 +376,19 @@
       <div class="container">
         <div class="course__header">
           <div class="title">推荐课程</div>
-          <div class="tabs">
-            <div
-              v-for="(item, index) in goodsList1"
-              :key="index"
-              class="tab"
-              :class="active1 === index ? 'active' : ''"
-              @click="active1 = index"
-            >
-              {{ item.name }}
-            </div>
+          <div class="course__footer">
+            <div class="btn" @click="go('/course-list')">查看更多</div>
+          </div>
+        </div>
+        <!-- <div class="tabs">
+          <div
+            v-for="(item, index) in goodsList1"
+            :key="index"
+            class="tab"
+            :class="active1 === index ? 'active' : ''"
+            @click="active1 = index"
+          >
+            {{ item.name }}
           </div>
         </div>
         <div class="course__body">
@@ -406,11 +409,51 @@
               </li>
             </template>
           </ul>
+        </div> -->
+        <div class="tabs">
+          <div
+            v-for="(item, index) in courseName"
+            :key="index"
+            class="tab"
+            :class="couIndex === index ? 'active' : ''"
+            @click="changeCou(item.recommendId, index)"
+          >
+            {{ item.name }}
+          </div>
+        </div>
+        <div class="course__body">
+          <p
+            v-if="
+              !goodsList1.length
+            "
+            class="text_align"
+          >
+            该培训项目无推荐课程
+          </p>
+          <ul v-else class="list clearfix">
+            <template v-for="(item, index) in goodsList1">
+              <li class="course-item" :key="index">
+                <GoodsItem :item="item"></GoodsItem>
+              </li>
+            </template>
+          </ul>
         </div>
 
-        <div class="course__footer">
-          <div class="btn" @click="go('/course-list')">查看更多</div>
+        <div class="pagination">
+          <el-pagination
+            @current-change="currentChangeCou"
+            background
+            layout="prev, pager, next"
+            :total="paramList[0].total"
+            :page-size="paramList[0].pageSize"
+          >
+          </el-pagination>
         </div>
+
+        <!-- <div class="course__footer">
+          <div class="btn" @click="go('/course-list')">查看更多</div>
+        </div> -->
+
       </div>
     </section>
 
@@ -418,16 +461,19 @@
       <div class="container">
         <div class="bank__header">
           <div class="title">推荐题库</div>
-          <div class="tabs">
-            <div
-              v-for="(item, index) in goodsList2"
-              :key="index"
-              class="tab"
-              :class="active2 === index ? 'active' : ''"
-              @click="active2 = index"
-            >
-              {{ item.name }}
-            </div>
+          <div class="bank__footer">
+            <div class="btn" @click="go('/bank-list')">查看更多</div>
+          </div>
+        </div>
+        <!-- <div class="tabs">
+          <div
+            v-for="(item, index) in goodsList2"
+            :key="index"
+            class="tab"
+            :class="active2 === index ? 'active' : ''"
+            @click="active2 = index"
+          >
+            {{ item.name }}
           </div>
         </div>
         <div class="bank__body">
@@ -450,29 +496,55 @@
                 @click="goodsDetail(item, 2)"
               >
                 <GoodsItem :item="item"></GoodsItem>
-                <!-- <div class="bank-item__img">
-                  <div class="note" v-if="item.year">{{ item.year }}</div>
-                  <img
-                    v-if="item.coverUrl"
-                    :src="$tools.splitImgHost(item.coverUrl)"
-                    alt=""
-                  />
-                </div>
-                <div class="bank-item__title">
-                  {{ item.goodsName }}
-                </div>
-                <div class="bank-item__desc">
-                  <div class="price">¥{{ item.standPrice }}</div>
-                  <a class="add" @click.stop="addCart(item)">加购物车</a>
-                </div> -->
               </li>
             </template>
           </ul>
-        </div>
+        </div> -->
 
-        <div class="bank__footer">
-          <div class="btn" @click="go('/bank-list')">查看更多</div>
+        <div class="tabs">
+          <div
+            v-for="(item, index) in bankName"
+            :key="index"
+            class="tab"
+            :class="bankIndex === index ? 'active' : ''"
+            @click="changebank(item.recommendId, index)"
+          >
+            {{ item.name }}
+          </div>
         </div>
+        <div class="bank__body">
+          <p
+            v-if="
+              !goodsList2.length
+            "
+            class="text_align"
+          >
+            该培训项目无推荐题库
+          </p>
+          <ul v-else class="list clearfix">
+            <template v-for="(item, index) in goodsList2">
+              <li
+                class="bank-item"
+                :key="index"
+                @click="goodsDetail(item, 2)"
+              >
+                <GoodsItem :item="item"></GoodsItem>
+              </li>
+            </template>
+          </ul>
+        </div>
+        
+        <div class="pagination">
+          <el-pagination
+            @current-change="currentChangeBank"
+            background
+            layout="prev, pager, next"
+            :total="paramList[1].total"
+            :page-size="paramList[1].pageSize"
+          >
+          </el-pagination>
+        </div>
+        
       </div>
     </section>
 
@@ -630,15 +702,45 @@ export default {
       searchKey: "",
       type: "1",
       recordList: {},
+      params: {
+        pageNum: 1,
+        pageSize: 10,
+      },
+      paramList: [
+				{
+					pageNum: 1,
+					pageSize: 10,
+					total: 0,
+				},
+				
+				{
+					pageNum: 1,
+					pageSize: 10,
+					total: 0,
+				}
+			],
+      total1: 0,
+			total2: 0,
+      courseName: [],
+			bankName: [],
+			couIndex: 0,
+			bankIndex: 0,
+			courseId: '',
+			bankId: '',
     };
   },
+  created() {
+    this.goodsList1 = []
+		this.goodsList2 = []
+		this.courseLists()
+  },
   mounted() {
     if (this.userInfo) {
       this.getRecord();
       this.getmsg();
       this.getMsgCount();
     }
-    this.getActivityList();
+    // this.getActivityList();
     // this.color = this.colors[0];
     this.advertisingList();
     this.educationTypeList();
@@ -653,6 +755,101 @@ export default {
     },
   },
   methods: {
+    //课程
+		 courseLists() {			
+			this.$axios({
+				url: '/app/common/activity/recommend/list',
+				method: 'get',
+				params: {
+					platform: 1,
+					status: 1
+				},
+				noToken: true
+			}).then(async (res) => {
+        console.log('----------------res', res)
+        // return
+				if (res.code == 200) {
+					let list = res.rows || []
+					//课程
+					this.courseName = list.filter(x => x.type == 1).sort((a,b) => a.sort - b.sort).map(x => {
+						return {
+							name: x.name,
+							recommendId: x.recommendId
+						}
+					});
+					console.log('couIndex', this.couIndex, this.courseName)
+					//题库
+					this.bankName = list.filter(x => x.type == 2).sort((a,b) => a.sort - b.sort).map(x => {
+						return {
+							name: x.name,
+							recommendId: x.recommendId
+						}
+					});
+					if (this.courseName.length) {
+						this.courseId = this.courseName[0].recommendId
+						let list1 = await this.getGoodsList(this.courseName[0].recommendId, 0)
+						this.goodsList1.push(...list1)
+					}
+					
+					if (this.bankName.length) {
+						this.bankId = this.bankName[0].recommendId
+						let list2 = await this.getGoodsList(this.bankName[0].recommendId, 1)
+						this.goodsList2.push(...list2)
+					}
+
+				}
+			});
+		},
+    getGoodsList(recommendId, num) {	
+			return new Promise((resolve, reject) => {
+				 this.$axios({
+					url: `/app/common/activity/recommend/goodsList`,
+					method: 'get',
+					params: {
+						pageNum: this.paramList[num].pageNum,
+						pageSize: this.paramList[num].pageSize,
+						recommendId: recommendId
+					},
+					noToken: true
+				}).then((res) => {
+					if (res.code == 200) {
+						this.paramList[num].total = res.total
+						resolve(res.rows)
+					}	
+				})
+			})
+			 
+		},
+    async currentChangeCou(val) {
+      console.log('vallll', val)
+      this.paramList[0].pageNum = val
+      this.goodsList1 = []
+      let list1 = await this.getGoodsList(this.courseId, 0)
+      this.goodsList1.push(...list1)
+    },
+    async changeCou(recommendId, index) {
+			this.couIndex = index
+			this.courseId = recommendId
+			this.paramList[0].pageNum = 1
+			this.goodsList1 = []
+			let list1 = await this.getGoodsList(recommendId, 0)
+			this.goodsList1.push(...list1)
+		},
+    async currentChangeBank(val) {
+      console.log('val--', val)
+      this.paramList[1].pageNum = val
+      this.goodsList2 = []
+      let list2 = await this.getGoodsList(this.bankId, 1)
+      this.goodsList2.push(...list2)
+    },
+    async changebank(recommendId, index) {
+			this.bankIndex = index
+			this.bankId = recommendId
+			this.paramList[1].pageNum = 1
+			this.goodsList2 = []
+			let list2 = await this.getGoodsList(recommendId, 1)
+			this.goodsList2.push(...list2)
+		},
     /**
      * 关闭消息
      */
@@ -1918,6 +2115,7 @@ export default {
     &__header {
       display: flex;
       align-items: center;
+      justify-content: space-between;
 
       .title {
         background: url("~@/assets/video.png") no-repeat left center;
@@ -1929,33 +2127,39 @@ export default {
         text-shadow: 0px 6px 6px rgba(249, 113, 13, 0.08);
       }
 
-      .tabs {
-        margin-left: 40px;
-        display: flex;
-        align-items: center;
+      
+    }
+    .tabs {
+      margin-left: 28px;
+      display: flex;
+      align-items: center;
 
-        .tab {
-          cursor: pointer;
-          user-select: none;
-          // width: 88px;
-          padding: 0px 6px;
-          height: 24px;
-          border: 1px solid #f84e05;
-          border-radius: 12px;
-          text-align: center;
-          line-height: 24px;
-          color: #f84e05;
-          font-size: 14px;
-          margin: 0 4px;
+      .tab {
+        cursor: pointer;
+        user-select: none;
+        // width: 88px;
+        padding: 0px 6px;
+        height: 24px;
+        border: 1px solid #f84e05;
+        border-radius: 12px;
+        text-align: center;
+        line-height: 24px;
+        color: #f84e05;
+        font-size: 14px;
+        margin: 0 4px;
 
-          &.active {
-            color: #fff;
-            background: #f84e05;
-          }
+        &.active {
+          color: #fff;
+          background: #f84e05;
         }
       }
     }
 
+    .pagination {
+      padding: 30px 0;
+      text-align: center;
+    }
+
     &__body {
       .list {
         width: 100%;
@@ -1995,7 +2199,7 @@ export default {
     &__header {
       display: flex;
       align-items: center;
-
+      justify-content: space-between;
       .title {
         background: url("~@/assets/exercise.png") no-repeat left center;
         padding-left: 36px;
@@ -2006,7 +2210,9 @@ export default {
         text-shadow: 0px 6px 6px rgba(249, 113, 13, 0.08);
       }
 
-      .tabs {
+      
+    }
+    .tabs {
         margin-left: 40px;
         display: flex;
         align-items: center;
@@ -2031,6 +2237,9 @@ export default {
           }
         }
       }
+    .pagination {
+      padding: 30px 0;
+      text-align: center;
     }
 
     &__body {

+ 105 - 0
src/pages/mock-report/index.vue

@@ -197,6 +197,40 @@
             >全部解析</el-button
           >
         </div>
+
+        <div v-if="courseList.length" class="course_list">
+          <div class="course__header">
+            <div class="title">相关推荐</div>
+          </div>
+          <div class="course__body">
+            <!-- <p
+              v-if="
+                !courseList.length
+              "
+              class="text_align"
+            >
+              无推荐课程
+            </p> -->
+            <ul class="list clearfix">
+              <template v-for="(item, index) in courseList">
+                <li class="course-item" :key="index">
+                  <GoodsItem :item="item"></GoodsItem>
+                </li>
+              </template>
+            </ul>
+          </div>
+
+          <div class="pagination">
+            <el-pagination
+              @current-change="currentChangeCou"
+              background
+              layout="prev, pager, next"
+              :total="total"
+              :page-size="pageSize"
+            >
+            </el-pagination>
+          </div>
+        </div>
       </div>
     </section>
 
@@ -242,6 +276,7 @@
 import Footer from "@/components/footer/index";
 import Header from "@/components/header/index";
 import ToolBar from "@/components/toolbar/index";
+import GoodsItem from "@/components/goodsItem/index";
 import { mapGetters, mapActions } from "vuex";
 export default {
   name: "BankExplain",
@@ -249,6 +284,7 @@ export default {
     Footer,
     Header,
     ToolBar,
+    GoodsItem,
   },
   data() {
     return {
@@ -263,6 +299,10 @@ export default {
       eachExamId: 0,
       subscribeId: 0,
       subscribeInfo: {},
+      courseList: [],
+			pageNum: 1,
+			pageSize: 10,
+			total: 0,
     };
   },
   computed: {
@@ -273,6 +313,7 @@ export default {
     this.examId = this.$route.query.examId;
     this.recordId = this.$route.query.recordId;
     this.subscribeId = this.$route.query.subscribeId;
+    this.getcourList()
     this.setSystemTime();
     this.mockSubscribeInfo();
     this.mockWrongRecordWrongNum();
@@ -281,6 +322,26 @@ export default {
   },
   methods: {
     ...mapActions(["setSystemTime"]),
+      getcourList() {
+        this.$axios({
+            url: '/apply/recommend/goodsList',
+            method: 'post',
+            data: {
+                examId: this.examId,
+                pageNum: this.pageNum,
+                pageSize: this.pageSize,
+            }
+        }).then((res) => {
+            if (res.code == 200) {
+              this.courseList = res.rows || []
+              this.total = res.total
+            }
+        })
+    },
+    currentChangeCou(val) {
+      this.pageNum = val
+      this.getcourList()
+    },
     goLive() {
       this.$router.push({
         path: "/living-room/" + this.subscribeInfo.liveUrl,
@@ -728,6 +789,50 @@ export default {
         margin: 0 4px;
       }
     }
+
+    .course_list {
+      .course {
+        background: #f5f7fa;
+        padding-top: 40px;
+
+        &__header {
+          display: flex;
+          align-items: center;
+          justify-content: space-between;
+
+          .title {
+            background: url("~@/assets/video.png") no-repeat left center;
+            padding-left: 36px;
+            font-size: 24px;
+            font-family: YouSheBiaoTiHei;
+            font-weight: 400;
+            color: #333333;
+            text-shadow: 0px 6px 6px rgba(249, 113, 13, 0.08);
+          }
+
+          
+        }
+
+        
+
+        &__body {
+          .list {
+            width: 100%;
+
+            .course-item {
+              float: left;
+            }
+          }
+        }
+
+      }
+      .pagination {
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        margin: 20px 0px;
+      }
+    }
   }
 
   .info {

+ 1 - 1
src/pages/person-center/my-bank/bank-detailCopy/index.vue

@@ -1165,7 +1165,7 @@ export default {
     },
     // 新增用户视频学习日志
 		studyLog(courseId, moduleId, chapterId, examId) {
-			this.$http({
+			this.$axios({
 				url: '/user/study/log',
 				method: 'post',
 				data: {