y595705120 преди 3 седмици
родител
ревизия
cdaf47ec56

+ 1 - 1
src/containers/center/components/menu/index.css

@@ -4,7 +4,7 @@
 }
 .m-left-list {
   margin-top: 20px;
-  min-height: 400px;
+  min-height: 665px;
   border-top: 1px solid #f8f8f8;
 }
 .m-left-list a {

+ 22 - 3
src/containers/center/components/menu/index.vue

@@ -11,14 +11,14 @@
     </div>
 
     <ul class="m-left-list">
-      <li v-for="(item, index) in menu" :key="index"  :class="{'current':item.active}">
+      <li v-for="(item, index) in menu" :key="index"  :class="{'current':item.active||item.show}">
 
         <a href="javascript:void(0)" style="text-decoration: none" @click="goState(item)"
           class="ng-binding"><span class="p-ico2" :class="item.icon" ></span>{{item.name}}</a>
 
         <div class="sub-list ng-scope" v-if="item.children" >
           <a v-for="subItem in item.children" :key="subItem.path" v-if="!subItem.hidden"
-            @click="goSubState(subItem)" :class="{'current':subItem.active}" href="javascript:void(0)"
+            @click="goState2(subItem, item)" :class="{'current':$route.path == subItem.path}" href="javascript:void(0)"
             class="ng-binding ng-scope">{{subItem.name}}</a>
         </div>
       </li>
@@ -61,21 +61,40 @@
           if( item.path != path ){
             item.active = false
           }
+          this.unActiveChild(path, this.menu[i].children)
+        }
+      },
+      unActiveChild( path, children ){
+        if(!children) return;
+        for( let i in children){
+          let item = children[i];
+          item.active  = item.path == path;
         }
       },
       goState( item ){
+        this.allUnactive(this.$route.path)
         if( item.children ){
           item.active = !item.active;
           if( item.active ){
             this.allUnactive( item.path )
+            item.children[0].active = true
           }
         }else{
-          this.goSubState( item );
+          this.goSubState(item);
         }
       },
+      goState2(child, parent){
+        parent.active = true;
+        this.unActiveChild( child.path, parent.children);
+        this.goSubState(child)
+      },
       goSubState(item){
         if(item.path == this.$route.path) return;
         item.active = true;
+        window.scrollTo({
+             top: 0,
+             behavior: 'smooth' // 平滑滚动效果
+        });
         this.$router.push(item.path);
       }
     }

+ 3 - 0
src/containers/center/components/menu/menu.js

@@ -22,10 +22,12 @@ const menu = [
    {
      path: '/center/markets',
      name: '推荐课程',
+     show: true,
      icon: 'ico-course',
      children: [
        {
          path: '/center/market',
+         active: true,
          name: '继续教育'
        },
        {
@@ -43,6 +45,7 @@ const menu = [
      path: '/center/exam',
      name: '考试培训',
      icon: 'ico-files',
+     show: true,
      children: [
        {
          path: '/center/examSeat',

+ 1 - 0
src/containers/center/market/index.vue

@@ -374,6 +374,7 @@
               message: '邮箱格式不正确',
               trigger: 'blur',
               transform(value) {
+                value = value.trim();
                 if (!/^\w+((-\w+)|(\.\w+))*@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(value)) {
                   return true
                 } else {}

+ 0 - 1
src/containers/center/market/trainIndex.vue

@@ -608,4 +608,3 @@
       position: relative;
   }
 </style>
-ss