瀏覽代碼

feat:登录装置显示新版导航

yangfeng 2 月之前
父節點
當前提交
f5213d073b

+ 1 - 0
resource/staticres/css/common.css

@@ -4,6 +4,7 @@ html,body {
 body {
   position: relative;
   min-width: 1200px;
+  font-family: "Microsoft YaHei","Helvetica Neue","Roboto","Segoe UI","PingFang SC","Hiragino Sans GB",sans-serif;
 }
 
 input,

+ 181 - 11
resource/staticres/css/header.css

@@ -10,7 +10,7 @@
   display: flex;
   align-items: center;
   justify-content: space-between;
-  height: 48px;
+  height: 52px;
 }
 .header-common .header-left{
   display: flex;
@@ -25,6 +25,8 @@
 }
 .header-left .home-title{
   color:#1d1d1d;
+  font-size: 16px;
+  line-height: 24px;
 }
 .header-left .home-message{
   margin-left: 20px;
@@ -37,17 +39,17 @@
   height: 48px;
 }
 .header-left .site-btn{
-  width: 100px;
-  height: 30px;
+  /* width: 100px;
+  height: 30px; */
+  padding: 3px 12px;
   margin-left: 20px;
   border-radius: 4px;
-  font-size: 14px;
-  line-height: 30px;
+  font-size: 16px;
+  line-height: 24px;
   color: #fff;
   background: #2CB7CA;
   border: 0;
   outline: 0;
-  line-height: 30px;
 }
 .header-left .home-site:hover .site-dropdown-panel {
   display: inline-block;
@@ -110,6 +112,7 @@
 }
 
 .header-right{
+  position: relative;
   display: flex;
   height: 100%;
 }
@@ -120,7 +123,7 @@
 }
 .header-right .header-right-list{
   position: relative;
-  margin-left: 32px;
+  margin-right: 20px;
   height: 100%;
   display: flex;
   align-items: center;
@@ -223,7 +226,8 @@
 }
 
 .header-right-list a{
-  font-size: 14px;
+  font-size: 16px;
+  line-height: 24px;
   color: #1D1D1D;
 }
 .jynav-list-title{
@@ -316,7 +320,7 @@
   background: #2ABED1 !important;
   margin: unset !important;
   border: 0;
-  font-size: 14px;
+  font-size: 16px;
   color: #fff !important;
   border-radius: 4px;
 }
@@ -383,14 +387,14 @@
   display: flex;
   align-items: center;
   justify-content: center;
-  width: 100px;
+  min-width: 100px;
   margin-top: 10px;
   margin-left: 16px;
   padding: 0 12px;
   height: 30px;
   background: #2CB7CA;
   font-weight: 400;
-  font-size: 14px;
+  font-size: 16px;
   color: #fff;
   cursor: pointer;
   border-radius: 4px;
@@ -420,4 +424,170 @@
 a.menu-vip-button,
 a.menu-vip-button:hover {
   color: #6F3D03;
+  font-size: 16px;
+}
+
+.menu-list {
+  height: 100%;
+}
+.menu-list .menu-item:not(:last-of-type) {
+  margin-right: 20px;
+}
+
+.menu-item {
+  position: relative;
+}
+.menu-item,
+.menu-item a {
+  height: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  font-size: 16px;
+  line-height: 24px;
+  color: #3C3C3C;
+}
+.menu-item.active a,
+.menu-item.with-underline.active a {
+  color: #2ABED1;
+}
+.menu-item.with-underline.active a::after,
+.menu-item.hover-underline:hover::after {
+  content: '';
+  position: absolute;
+  bottom: 0;
+  left: 50%;
+  transform: translateX(-50%);
+  width: 2em;
+  height: 2px;
+  background-color: #2ABED1;
+}
+.menu-popover-container {
+    position: absolute;
+    top: 52px;
+    right: 0;
+    z-index: 1000;
+}
+.menu-item-popover{
+    width: max-content;
+    max-width: 1200px;
+    height: auto;
+    padding: 32px 40px 12px;
+    border-radius: 12px;
+    border: 1px solid #E0E0E0;
+    box-shadow: 0px 0px 28px 0px #00000029;
+    background-color: #fff;
+}
+
+.popover-list-item .item-title{
+  font-size: 20px;
+  line-height: 32px;
+  color: #1D1D1D;
+  font-weight: 400;
+}
+
+.popover-list-item:not(:first-child) .item-title{
+  padding-top: 8px; 
+}
+
+.popover-list-item .item-title-desc{
+  margin-top: 4px;
+  font-size: 14px;
+  line-height: 22px;
+  color: #686868;
+}
+
+.popover-list-item .item-subtitle{
+  padding-bottom: 8px;
+  font-size: 16px;
+  line-height: 24px;
+  color: #1D1D1D;
+  border-bottom: 1px solid #2ABED1;
+}
+
+.popover-list-item .item-children{
+  display: flex;
+  padding: 20px 0;
+  border-bottom: 1px solid #ECECEC;
+}
+
+.popover-list-item .item-children .item-li-column:not(:last-child){
+  margin-right: 75px;
+}
+
+.popover-list-item .item-flex-column{
+  display: flex;
+  flex-direction: column;
+  padding-top: 8px;
+}
+
+.popover-list-item .item-link-column{
+  display: inline-block;
+  margin-top: 8px;
+  font-size: 14px;
+  line-height: 22px;
+  color: #686868;
+}
+
+.popover-list-item .item-children-row{
+  flex-wrap: wrap;
+  padding-top: 8px;
+}
+.padding-top-0{
+  padding-top: 0!important;
+}
+.popover-list-item .item-link-row{
+  display: inline-block;
+  margin-right: 40px;
+  margin-top: 12px;
+  font-size: 16px;
+  line-height: 24px;
+  color: #1D1D1D;
+}
+
+.popover-list-item:last-child .item-children{
+  border: none;
+}
+.column-wrap-container{
+  max-height: 560px;
+  display: flex;
+  flex-direction: column;
+  flex-wrap: wrap;
+}
+.column-wrap-container .popover-list-item{
+  width: 510px;
+}
+.column-wrap-container .popover-list-item:nth-child(1),
+.column-wrap-container .popover-list-item:nth-child(2){
+  margin-right: 100px;
+}
+.column-wrap-container .popover-list-item:nth-child(2) .item-children{
+  border-bottom: none;
 }
+.column-wrap-container .popover-list-item .item-link-row{
+  font-size: 14px;
+  line-height: 22px;
+}
+.column-wrap-container .popover-list-item .item-link-row:focus,
+.column-wrap-container .popover-list-item .item-link-row:active{
+  color: #2ABED1;
+}
+.popover-list-item a:hover,
+.popover-list-item a:active:focus,
+.popover-list-item a:active{
+  color: #2ABED1;	
+}
+.custom-toast .toast-container{
+  /* display: none; */
+  position: fixed;
+  top: 50%;
+  left: 50%;
+  width: auto;
+  padding: 16px 32px;
+  font-size: 16px;
+  background: rgba(0, 0, 0, 0.65);
+  border-radius: 8px;
+  color: #fff;
+  transform: translateX(-50%) translateY(-50%);
+  z-index: 3001;
+}

+ 1 - 0
resource/staticres/css/index.css

@@ -91,6 +91,7 @@
   font-size: 13px;
   line-height: 20px;
   color: #1D1D1D;
+  white-space: nowrap;
 }
 .action-ad-right .action-words .words-text > span{
   color: #686868;

+ 14 - 1
resource/staticres/js/pc-header.js

@@ -37,4 +37,17 @@
   }
   addPopListener('.work-user-info')
   addPopListener('.nav-avatar', 500)
-})()
+})()
+
+function toastFn (text, duration) {
+  if (!duration) {
+    duration = 1000
+  }
+  var _html = ""
+  _html+='<div class="custom-toast"><div class="mask" style="background-color: transparent;"></div><div class="toast-container">'
+  _html+='<span>' + text + '</span></div></div>'
+  $('body').append(_html)
+  setTimeout(function(){
+    $(".custom-toast").fadeOut().remove();
+  },duration)
+}

+ 123 - 2
resource/template/pc/common/header.html

@@ -26,10 +26,11 @@
       </div>
     </div>
     <nav class="header-right">
-      <ul>
+      <ul class="menu-list">
         <li class="header-right-list">
-          <a class="menu-vip-button" href="{{GetJyWebDomain}}/product/index?serviceType=0" target="_blank"><i class="j-icon base-icon icon-img-vip-v-deep"></i>会员服务列表</a>
+          <a class="menu-vip-button" href="{{GetJyWebDomain}}/product/index?serviceType=0" target="_blank"><i class="j-icon base-icon icon-img-vip-v-deep"></i>会员专区</a>
         </li>
+        {{if not .hasLogin}}
         <li class="header-right-list">
           <a class="jynav-list-title" href="{{GetJyWebDomain}}/front/appDownload" target="_blank">APP下载</a>
         </li>
@@ -54,7 +55,88 @@
         <li class="header-right-list">
           <a class="jynav-list-title" href="{{GetJyWebDomain}}/brand/index" target="_blank">关于剑鱼</a>
         </li>
+        {{else}}
+          {{range $newMenu :=TopMenuNew}}
+          <li class="menu-item hover-underline" name="{{$newMenu.Name}}" {{if gt (len $newMenu.Childs) 0}}data-menu-list="true"{{end}} data-menu-id="{{$newMenu.Name}}">
+            <a href="{{if $newMenu.Href}}{{$newMenu.Href}}{{else}}javascript:;{{end}}" {{if $newMenu.Href}}target="_blank"{{end}}>{{$newMenu.Name}}</a>
+          </li>
+          {{end}}
+        {{end}}
       </ul>
+      <div class="menu-popover-container">
+        {{range $level1 :=TopMenuNew}}
+        <div class="menu-item-popover" data-menu-popover="{{$level1.Name}}" style="display:none;">
+          <div class="popover-list">
+            <!-- 纵向排列flex(企业专区) -->
+            {{if eq $level1.Layout "flex"}}
+            <div class="column-wrap-container">
+              {{range $level2 := $level1.Childs}}
+              <div class="popover-list-item">
+                {{if $level2.Name}}
+                <div>
+                  <h4 class="item-title">{{$level2.Name}}</h4>
+                  {{if $level2.Desc}}
+                  <p class="item-title-desc">{{$level2.Desc}}</p>
+                  {{end}}
+                </div>
+                {{end}}
+                <div class="item-children {{if and (gt (len $level2.Childs) 0) (index $level2.Childs 0) (index $level2.Childs 0).Childs $level2.Name}}{{else}}item-children-row{{end}}">
+                  {{range $level3 := $level2.Childs}}
+                  <div class="{{if $level3.Childs}}item-li-column{{end}}">
+                    {{if $level3.Childs}}
+                    <a href="{{if $level3.Href}}{{$level3.Href}}{{else}}javascript:;{{end}}" {{if $level3.Href}}target="_blank"{{end}} class="item-subtitle">{{$level3.Name}}</a>
+                    <div class="item-flex-column">
+                      {{range $level4 := $level3.Childs}}
+                      <a href="{{if $level4.Href}}{{$level4.Href}}{{else}}javascript:;{{end}}" {{if $level4.Href}}target="_blank"{{end}} {{if not $level4.Href}}onclick="toastFn('敬请期待!')"{{end}} class="item-link-column">{{$level4.Name}}</a>
+                      {{end}}
+                    </div>
+                    {{else}}
+                    <a href="{{if $level3.Href}}{{$level3.Href}}{{else}}javascript:;{{end}}" {{if $level3.Href}}target="_blank"{{end}} {{if not $level3.Href}}onclick="toastFn('敬请期待!')"{{end}} class="item-link-row">{{$level3.Name}}</a>
+                    {{end}}
+                  </div>
+                  {{end}}
+                </div>
+              </div>
+              {{end}}
+            </div>
+            {{else}}
+            <!-- 横向排列 -->
+              {{range $index2,$level2 := $level1.Childs}}
+              <div class="popover-list-item">
+                {{if $level2.Name}}
+                  <div>
+                    <h4 class="item-title">{{$level2.Name}}</h4>
+                    {{if $level2.Desc}}
+                    <p class="item-title-desc">{{$level2.Desc}}</p>
+                    {{end}}
+                  </div>
+                {{end}}
+                <div class="item-children
+                  {{if and (gt (len $level2.Childs) 0) (index $level2.Childs 0) (index $level2.Childs 0).Childs $level2.Name}}{{else}}item-children-row{{end}} 
+                  {{if not $level2.Name}}padding-top-0{{end}}"
+                >
+                  {{range $level3 := $level2.Childs}}
+                  <div class="{{if $level3.Childs}}item-li-column{{end}}">
+                    {{if $level3.Childs}}
+                    <a href="{{if $level3.Href}}{{$level3.Href}}{{else}}javascript:;{{end}}" {{if $level3.Href}}target="_blank"{{end}} class="item-subtitle">{{$level3.Name}}</a>
+                    <div class="item-flex-column">
+                      {{range $level4 := $level3.Childs}}
+                      <a href="{{if $level4.Href}}{{$level4.Href}}{{else}}javascript:;{{end}}" {{if $level4.Href}}target="_blank"{{end}} {{if not $level4.Href}}onclick="toastFn('敬请期待!')"{{end}} class="item-link-column">{{$level4.Name}}</a>
+                      {{end}}
+                    </div>
+                    {{else}}
+                    <a href="{{if $level3.Href}}{{$level3.Href}}{{else}}javascript:;{{end}}" {{if $level3.Href}}target="_blank"{{end}} {{if not $level3.Href}}onclick="toastFn('敬请期待!')"{{end}} class="item-link-row">{{$level3.Name}}</a>
+                    {{end}}
+                  </div>
+                  {{end}}
+                </div>
+              </div>
+              {{end}}
+            {{end}}
+          </div>
+        </div>
+        {{end}}
+      </div>
       <div class='useronline' id="login" style="float:left;">
         <a style="display: none;" href="javascript:void(0);" data-quick-login="login" class='loginBtn login'
           data-toggle='modal'>登录</a>
@@ -75,3 +157,42 @@
 <script src='{{Cdn}}/common-module/login-js/jy-login.umd.js?v={{Msg "version"}}'></script>
 <script src='{{Cdn}}/jybx/js/login.js?v={{Msg "version"}}'></script>
 <script src='{{Cdn}}/jybx/js/pc-header.js?v={{Msg "version"}}'></script>
+{{if .hasLogin}}
+<script>
+  $(function() {
+    document.querySelectorAll('.menu-item').forEach(function(item) {
+      item.addEventListener('mouseenter', function() {
+        var menuId = this.dataset.menuId;
+        var menuList = this.dataset.menuList;
+        var _this = this
+        var popover = document.querySelector(`[data-menu-popover="${menuId}"]`);
+        
+        // 移除所有菜单项的active类
+        document.querySelectorAll('.menu-item').forEach(function(item) {
+            item.classList.remove('active', 'with-underline');
+        });
+        // 隐藏所有下拉框
+        document.querySelectorAll('.menu-item-popover').forEach(function(p) {
+          p.style.display = 'none'
+        });
+        
+        // 显示当前下拉框
+        if(popover && menuList) {
+          popover.style.display = 'block';
+          _this.classList.add('active', 'with-underline');
+        }
+      });
+    });
+
+    // 鼠标离开菜单项时隐藏
+    document.querySelector('.header-right').addEventListener('mouseleave', function() {
+      document.querySelectorAll('.menu-item-popover').forEach(function(p) {
+        p.style.display = 'none';
+      });
+      document.querySelectorAll('.menu-item').forEach(function(item){
+        item.classList.remove('active', 'with-underline');
+      })
+    });
+  })
+</script>
+{{end}}