Selaa lähdekoodia

feat: 公共头部优化

cuiyalong 1 vuosi sitten
vanhempi
commit
3909e809fd

+ 50 - 1
src/web/staticres/js/index/index_2023.12.js

@@ -19,7 +19,6 @@ var _page = {
     },
   },
   init: function () {
-    headerNavMini.changeHeaderPlaceholder(true)
     this.initEvents()
     this.initHotBuyerShortName()
     this.initHotIndustryTwoLine()
@@ -160,3 +159,53 @@ var _page = {
 $(function () {
   _page.init()
 })
+
+var option = {
+  tooltip: {
+    trigger: 'axis',
+    showDelay: 0,
+    axisPointer: {
+      type: 'shadow',
+      shadowStyle: {
+        color: 'rgba(5,165,242,0.1)',
+        // color: new echarts.graphic.LinearGradient(0,0,0,1, [
+        //   {
+        //     offset: 0,
+        //     color: rgba(0,253,255,0.6)
+        //   },
+        //   {
+        //     offset: 1,
+        //     color: rgba(73,201,229,0)
+        //   }
+        // ])
+      }
+    }
+  },
+  xAxis: {
+    type: 'category',
+    axisTick: false,
+    data: ['Mon\n222', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+  },
+  yAxis: {
+    type: 'value',
+    splitLine: {
+      show: true,
+      lineStyle: {
+        type: 'dashed'
+      }
+    }
+  },
+  series: [
+    {
+      data: [120, 200, 150, 80, 70, 110, 130],
+      type: 'bar',
+      itemStyle: {
+        color: '#2ABED1',
+        normal: {
+          //柱形图圆角设置
+          barBorderRadius:[8,8, 0, 0]
+        }
+      }
+    }
+  ]
+};

+ 5 - 3
src/web/staticres/js/login.js

@@ -502,7 +502,7 @@ var logic = function(data,num){
 		LoginPolling.stop();
 		//登录成功,停止心跳监测
 		webSocketHeartCheck.reset();
-		if(ws.readyState==1){
+		if(ws && ws.readyState==1){
 			ws.send("close");
 			ws.close();
 		}
@@ -821,10 +821,12 @@ var haslogin = function(num,kyorpn,url){
 
         // TODO login callback
         try {
-          loginCallback()
+          // header专用回调。
+          loginCallbackHeader(data)
         } catch (e) {}
         try {
-          headerNavMini.checkLogin(true)
+          // 页面专用回调
+          loginCallback(data)
         } catch (e) {}
   
         encryptId = data.encryptId

+ 3 - 1
src/web/staticres/public-pc/css/header-nav-mini.css

@@ -139,7 +139,7 @@ a.j-s-button:hover {
     width: 100%;
     z-index: 999;
 }
-.header-nav-mini {
+#public-nav.header-nav-mini {
     background-color: #F2F2F4;
 }
 .header-nav-mini-placeholder {
@@ -202,6 +202,8 @@ a.j-s-button:hover {
     display: flex;
     align-items: center;
     justify-content: center;
+    font-size: 14px;
+    color: #444;
 }
 .menu-item.active a,
 .menu-item.with-underline.active a {

+ 15 - 15
src/web/staticres/public-pc/css/pc-header-nav-second.css

@@ -11,10 +11,7 @@
   height: 72px;
 
 }
-.header-nav-mini-placeholder {
-  height: 72px;
-}
-.pc-header-nav-second .pc-header-nav-second-head .pc-header-nav-second-head-content{
+.pc-header-nav-second .pc-header-nav-second-head-content{
   width: 1200px;
   margin: auto;
   height: 72px;
@@ -29,13 +26,13 @@
   width: 130px;
   height: 34px;
 }
-.pc-header-nav-second .pc-header-nav-second-head-left .pc-header-nav-second-head-line{
+.pc-header-nav-second .pc-header-nav-second-head-line{
   margin-left: 16px;
   width: 1px;
   height: 32px;
   background-color:#e0e0e0;
 }
-.pc-header-nav-second .pc-header-nav-second-head-left .pc-header-nav-second-head-desc{
+.pc-header-nav-second .pc-header-nav-second-head-desc{
   font-size: 14px;
   font-weight: 400;
   line-height: 18px;
@@ -48,12 +45,15 @@
   align-items: center;
   justify-content: end;
 }
-.pc-header-nav-second .pc-header-nav-second-head-right .pc-header-nav-second-head-right-item{
-font-size: 16px;
-font-weight: 400;
-line-height: 24px;
-margin-left: 24px;
-color: #1D1D1D;
-cursor: pointer;
-text-decoration: none;
-}
+.pc-header-nav-second .pc-header-nav-second-head-right-item{
+  font-size: 16px;
+  font-weight: 400;
+  line-height: 24px;
+  margin-left: 24px;
+  color: #1D1D1D;
+  cursor: pointer;
+  text-decoration: none;
+}
+/* .pc-header-nav-second .pc-header-nav-second-head-right-item:hover{
+  color: #2abde1;
+} */

+ 25 - 2
src/web/staticres/public-pc/js/header-nav-mini.js

@@ -43,9 +43,9 @@ function Message() {
 var headerNavMini = {
   headerNav: $('#public-nav'),
   headerNavPlaceholder: $('#header-nav-mini-placeholder'),
+  headerNavSecond: $('#pc-header-nav-second'),
   headerHeight: $('#public-nav').height(),
   init: function () {
-    this.initStyle()
     this.initEvents()
   },
   initStyle: function () {},
@@ -57,6 +57,26 @@ var headerNavMini = {
       this.headerNavPlaceholder.hide()
     }
   },
+  // 登陆前不展示。登陆后工作台外的页面顶部统一展示(除了首页)
+  secondHeaderShow: function (login) {
+    if (!login) return
+    // exclude中的页面不会显示第二个头部
+    var pathname = location.pathname
+    var excludeReg = [
+      /^\/$/, // 首页
+      // new RegExp('/brand/index'),
+    ]
+    var findTarget = false
+    for (var i = 0; i < excludeReg.length; i++) {
+      if (excludeReg[i].test(pathname)) {
+        findTarget = true
+        break
+      }
+    }
+    if (!findTarget) {
+      this.headerNavSecond.show()
+    }
+  },
   initEvents: function () {
     this.initLoginButtonEvent()
     this.initHeaderNavMenuEvents()
@@ -127,6 +147,9 @@ var headerNavMini = {
       $('.login-register-button').show()
       $('.go-to-workspace').hide()
     }
+    this.initStyle()
+    this.changeHeaderPlaceholder(true)
+    this.secondHeaderShow(login)
   },
   changeMenuActive: function (name) {
     this.headerNav.find('[name='+name+']').addClass('active')
@@ -142,7 +165,7 @@ $(function () {
 })
 
 headerNavMini.checkLogin(false)
-function loginCallback () {
+function loginCallbackHeader (data) {
   headerNavMini.checkLogin(loginflag)
   window.message = new Message()
   try {

+ 3 - 1
src/web/templates/common/pc-header-nav-mini.html

@@ -68,7 +68,9 @@
         </div>
     </main>
 </section>
-<section class="header-nav-mini-placeholder" id="header-nav-mini-placeholder" style="display: none;"></section>
+<section class="header-nav-mini-placeholder" id="header-nav-mini-placeholder"></section>
+{{include "/common/pc-header-nav-second.html"}}
+
 <!-- Modal -->
 <div class="modal fade" id="downloadApp" tabindex="-1" aria-labelledby="downloadApp" aria-hidden="true">
     <div class="modal-dialog">

+ 1 - 1
src/web/templates/common/pc-header-nav-second.html

@@ -1,5 +1,5 @@
 <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/public-pc/css/pc-header-nav-second.css?v={{Msg "seo" "version"}}' />
-<section id="pc-header-nav-second" class="pc-header-nav-second">
+<section id="pc-header-nav-second" class="pc-header-nav-second" style="display: none;">
  <div class="pc-header-nav-second-head">
   <div class="pc-header-nav-second-head-content">
     <div class="pc-header-nav-second-head-left">