谢杰标 3 лет назад
Родитель
Сommit
f3916cc577
1 измененных файлов с 169 добавлено и 167 удалено
  1. 169 167
      src/pages/home/index.vue

+ 169 - 167
src/pages/home/index.vue

@@ -6,7 +6,6 @@
           <div class="text-list" v-if="!userInfo">
             <a @click="go('/login', { state: 1 })">登录</a>
             <a @click="go('/login', { state: 2 })">注册</a>
-            
           </div>
 
           <div class="icon-list" v-else>
@@ -37,7 +36,7 @@
                 <p style="max-width: 247px">{{ msgData.text }}</p>
                 <div class="toolbth" @click="newGoToStudy">立即学习</div>
                 <i
-                  style="font-size: 18px;cursor:pointer;"
+                  style="font-size: 18px; cursor: pointer"
                   class="el-icon-close"
                   @click="clearMsg"
                 ></i>
@@ -161,7 +160,11 @@
                   :key="'type' + typeItem"
                 >
                   <div class="title" @click="goCourse(type)">
-                    {{ type.educationName }}
+                    {{
+                      type.educationName == "继续教育"
+                        ? "继教"
+                        : type.educationName
+                    }}
                   </div>
                   <ul class="nav">
                     <li
@@ -181,7 +184,11 @@
                 <li v-for="(item, index) in typeList" :key="index">
                   <div class="text">
                     <div class="text__title" @click="goCourse(item)">
-                      {{ item.educationName }}
+                      {{
+                        item.educationName == "继续教育"
+                          ? "继教"
+                          : item.educationName
+                      }}
                     </div>
                     <div class="text__desc">
                       <a
@@ -189,10 +196,10 @@
                         class="item"
                         v-for="(aItem, aIndex) in item.list"
                         :key="'aItem' + aIndex"
-                        >
+                      >
                         <!-- {{ aItem.projectName }}-{{ aItem.businessName }} -->
                         {{ aItem.aliasName }}
-                        </a>
+                      </a>
                     </div>
                   </div>
                 </li>
@@ -425,14 +432,9 @@
             </template>
           </ul>
         </div> -->
-        
+
         <div class="course__body">
-          <p
-            v-if="
-              !goodsList1.length
-            "
-            class="text_align"
-          >
+          <p v-if="!goodsList1.length" class="text_align">
             该培训项目无推荐课程
           </p>
           <ul v-else class="list clearfix">
@@ -459,7 +461,6 @@
         <!-- <div class="course__footer">
           <div class="btn" @click="go('/course-list')">查看更多</div>
         </div> -->
-
       </div>
     </section>
 
@@ -520,29 +521,20 @@
           </ul>
         </div> -->
 
-        
         <div class="bank__body">
-          <p
-            v-if="
-              !goodsList2.length
-            "
-            class="text_align"
-          >
+          <p v-if="!goodsList2.length" class="text_align">
             该培训项目无推荐题库
           </p>
           <ul v-else class="list clearfix">
             <template v-for="(item, index) in goodsList2">
               <!-- @click="goodsDetail(item, 2)" -->
-              <li
-                class="bank-item"
-                :key="index"
-              >
+              <li class="bank-item" :key="index">
                 <GoodsItem :item="item"></GoodsItem>
               </li>
             </template>
           </ul>
         </div>
-        
+
         <div class="pagination">
           <el-pagination
             @current-change="currentChangeBank"
@@ -554,7 +546,6 @@
           >
           </el-pagination>
         </div>
-        
       </div>
     </section>
 
@@ -580,7 +571,11 @@
             </el-input
           ></el-form-item>
           <el-form-item prop="idCard">
-            <el-input placeholder="身份证号码" v-model="bindForm.idCard" maxlength="18">
+            <el-input
+              placeholder="身份证号码"
+              v-model="bindForm.idCard"
+              maxlength="18"
+            >
             </el-input
           ></el-form-item>
           <el-button
@@ -717,31 +712,31 @@ export default {
         pageSize: 10,
       },
       paramList: [
-				{
-					pageNum: 1,
-					pageSize: 15,
-					total: 0,
-				},
-				{
-					pageNum: 1,
-					pageSize: 15,
-					total: 0,
-				}
-			],
+        {
+          pageNum: 1,
+          pageSize: 15,
+          total: 0,
+        },
+        {
+          pageNum: 1,
+          pageSize: 15,
+          total: 0,
+        },
+      ],
       total1: 0,
-			total2: 0,
+      total2: 0,
       courseName: [],
-			bankName: [],
-			couIndex: 0,
-			bankIndex: 0,
-			courseId: '',
-			bankId: '',
+      bankName: [],
+      couIndex: 0,
+      bankIndex: 0,
+      courseId: "",
+      bankId: "",
     };
   },
   created() {
-    this.goodsList1 = []
-		this.goodsList2 = []
-		this.courseLists()
+    this.goodsList1 = [];
+    this.goodsList2 = [];
+    this.courseLists();
   },
   mounted() {
     if (this.userInfo) {
@@ -765,93 +760,105 @@ export default {
   },
   methods: {
     //课程
-		 courseLists() {			
-			this.$request.appCommonActivityRecommendList({ platform: 2, status: 1 }).then(async (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)
-					}	
-				})
-			})
-			 
-		},
+    courseLists() {
+      this.$request
+        .appCommonActivityRecommendList({ platform: 2, status: 1 })
+        .then(async (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)
+      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.paramList[0].currentPage = 1
-			this.goodsList1 = []
-			let list1 = await this.getGoodsList(recommendId, 0)
-			this.goodsList1.push(...list1)
-		},
+      this.couIndex = index;
+      this.courseId = recommendId;
+      this.paramList[0].pageNum = 1;
+      this.paramList[0].currentPage = 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)
+      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.paramList[1].currentPage = 1
-			this.goodsList2 = []
-			let list2 = await this.getGoodsList(recommendId, 1)
-			this.goodsList2.push(...list2)
-		},
+      this.bankIndex = index;
+      this.bankId = recommendId;
+      this.paramList[1].pageNum = 1;
+      this.paramList[1].currentPage = 1;
+      this.goodsList2 = [];
+      let list2 = await this.getGoodsList(recommendId, 1);
+      this.goodsList2.push(...list2);
+    },
     /**
      * 关闭消息
      */
@@ -1119,7 +1126,6 @@ export default {
       localStorage.setItem("user_account", res.data.user_account);
       localStorage.setItem("token", res.data.token);
       if (res.data.full_info) {
-        
         this.getInfo();
       } else {
         this.indexUserAccount = res.data.user_account;
@@ -1173,9 +1179,9 @@ export default {
         case "4":
           this.$tools.exit();
           break;
-        case '5':
-          console.log('------command:', command)
-          break
+        case "5":
+          console.log("------command:", command);
+          break;
         default:
           break;
       }
@@ -1263,6 +1269,7 @@ export default {
     educationTypeList() {
       this.$request.educationTypeList().then((res) => {
         this.typeList = res.rows.slice(0, 5);
+        console.log(this.typeList, "this.typeList");
         this.typeList.forEach((typeItem, index) => {
           this.businessList(typeItem.id, index);
         });
@@ -1273,7 +1280,7 @@ export default {
       this.$request
         .businessList({ educationId })
         .then((res) => {
-          let rows = res.rows.filter((item) => item.aliasName)
+          let rows = res.rows.filter((item) => item.aliasName);
           this.$set(this.slideList, index, rows);
           if (rows.length >= 2) {
             let newRows = rows.slice(0, 2);
@@ -1291,7 +1298,7 @@ export default {
           } else {
             this.$set(this.typeList[index], "list", rows);
           }
-           console.log('this.typeList:',this.slideList, this.typeList)
+          console.log("this.typeList:", this.slideList, this.typeList);
         })
         .catch((err) => {
           console.log(err, "err");
@@ -1344,17 +1351,17 @@ export default {
         });
     },
     goCourse(item) {
-      console.log('sdsf', item)
+      console.log("sdsf", item);
       if (item.topicId) {
         this.$router.push({
           path: "/goodsTopic",
           query: {
             topicId: item.topicId,
           },
-        })
-        return
+        });
+        return;
       }
-      
+
       this.$router.push({
         path: "/course-list",
         query: {
@@ -1495,7 +1502,6 @@ export default {
               localStorage.setItem("token", res.data.token);
               this.$tools.setUuid(new Date().valueOf() + "");
               if (res.data.full_info) {
-                
                 this.getInfo();
               } else {
                 this.indexUserAccount = res.data.user_account;
@@ -1541,7 +1547,7 @@ export default {
      */
     getInfo() {
       this.$request
-        .getInfo({fromPlat: 2})
+        .getInfo({ fromPlat: 2 })
         .then((res) => {
           this.loginForm = {};
           this.loginSmsForm = {};
@@ -2121,7 +2127,7 @@ export default {
       align-items: center;
       justify-content: space-between;
       padding-bottom: 15px;
-      border-bottom: 1px solid #DCDCDC;
+      border-bottom: 1px solid #dcdcdc;
       .lefts {
         display: flex;
       }
@@ -2134,8 +2140,6 @@ export default {
         color: #333333;
         text-shadow: 0px 6px 6px rgba(249, 113, 13, 0.08);
       }
-
-      
     }
     .tabs {
       margin-left: 28px;
@@ -2176,13 +2180,13 @@ export default {
         width: 72px;
         height: 28px;
         line-height: 28px;
-        background: #D5E4FF;
+        background: #d5e4ff;
         border-radius: 4px;
         // margin: 20px auto 40px;
-        color: #3F8DFD;
+        color: #3f8dfd;
         text-align: center;
         transition: all 0.2s;
-        
+
         &:hover {
           color: #fff;
           box-shadow: 0px 8px 4px 0px rgba(7, 82, 208, 0.08);
@@ -2201,7 +2205,7 @@ export default {
       align-items: center;
       justify-content: space-between;
       padding-bottom: 15px;
-      border-bottom: 1px solid #DCDCDC;
+      border-bottom: 1px solid #dcdcdc;
       .lefts {
         display: flex;
       }
@@ -2214,25 +2218,23 @@ export default {
         color: #333333;
         text-shadow: 0px 6px 6px rgba(249, 113, 13, 0.08);
       }
-
-      
     }
     .tabs {
-        margin-left: 40px;
-        display: flex;
-        align-items: center;
+      margin-left: 40px;
+      display: flex;
+      align-items: center;
 
-        .tab {
-          cursor: pointer;
-          color: #888888;
-          font-size: 14px;
-          margin-right: 32px;
-          &.active {
-            font-weight: 600;
-            color: #222222;
-          }
+      .tab {
+        cursor: pointer;
+        color: #888888;
+        font-size: 14px;
+        margin-right: 32px;
+        &.active {
+          font-weight: 600;
+          color: #222222;
         }
       }
+    }
     .pagination {
       padding: 30px 0;
       text-align: center;
@@ -2255,13 +2257,13 @@ export default {
         width: 72px;
         height: 28px;
         line-height: 28px;
-        background: #D5E4FF;
+        background: #d5e4ff;
         border-radius: 4px;
         // margin: 20px auto 40px;
-        color: #3F8DFD;
+        color: #3f8dfd;
         text-align: center;
         transition: all 0.2s;
-        
+
         &:hover {
           color: #fff;
           box-shadow: 0px 8px 4px 0px rgba(7, 82, 208, 0.08);
@@ -2376,9 +2378,9 @@ export default {
   color: #fff;
 }
 .tooltipStyle .popper__arrow {
-  border-bottom-color: #3f8dfd!important;
+  border-bottom-color: #3f8dfd !important;
 }
 .tooltipStyle .popper__arrow::after {
-  border-bottom-color: #3f8dfd!important;
+  border-bottom-color: #3f8dfd !important;
 }
 </style>