瀏覽代碼

feat: 添加锚点

zhangsiya 1 年之前
父節點
當前提交
77a614c963

+ 3 - 2
src/web/staticres/serviceSystem/css/serviceSystem.css

@@ -807,11 +807,12 @@
     border: 1px solid #ECECEC;
     border-bottom: 1px solid transparent;
 }
-
+.table_content_r_item.active_table_row{
+    border-color: #2ABED1;
+}
 .table_content_r_item:hover {
     border-color: #2ABED1;
     background: #F4FCFD;
-
 }
 
 .table_content_longcell {

+ 18 - 19
src/web/staticres/serviceSystem/js/serviceSystem.js

@@ -20,12 +20,13 @@ var vNode = new Vue({
             vipshow: false,
             type: '',
             showToast: false,
-            toastText: '您已开通大会员'
+            toastText: '您已开通大会员',
+            urlParams: ''  // tjxm 推荐项目, spxm: 审批项目
         }
     },
     created: function() {
-        if (this.getUrlKey('serviceType')) {
-            this.tabs = this.getUrlKey('serviceType')
+        if (this.getUrlKey('from')) {
+          this.urlParams = this.getUrlKey('from')
         }
         this.getcode()
         this.getImage()
@@ -178,22 +179,6 @@ var vNode = new Vue({
         calcFixedTop: function () {
             var headerTop = $('#public-nav').height()
             $('.table_header_new').css({ top: headerTop })
-            $(window).on('scroll', function () {
-                var scrollTop = $(window).scrollTop()
-                var top = $('#header-nav-container').height()
-                if (scrollTop >= top - headerTop) {
-                } else {
-
-                }
-            })
-        },
-        tabclick: function (val) {
-            if (val == this.tabs) {
-                return
-            }
-            window.location.href = "/product/index?serviceType=" + val
-            // this.tabs = val
-            // document.body.scrollTop = document.documentElement.scrollTop = 0
         },
         getUrlKey: function (name) {
             return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null
@@ -260,3 +245,17 @@ function windowScrollFn() {
     }
 }
 $(window).scroll(windowScrollFn)
+// 添加锚点
+$(function () {
+  var from = vNode.getUrlKey('from')
+  var id = '#' + from
+  console.log(from)
+  if(from && document.querySelector(id)) {
+    setTimeout(function () {
+      document.querySelector(id).scrollIntoView({
+        block: 'center',
+        behavior: 'smooth'
+      })
+    }, 1000)
+  }
+})

+ 2 - 2
src/web/templates/frontRouter/pc/serviceSystem/free/index.html

@@ -161,7 +161,7 @@
                                     <div class="table_content_sortcell"><i class="right"></i></div>
                                     <div class="table_content_sortcell"><i class="right"></i></div>
                                 </div>
-                                <div class="table_content_r_item cell_wite">
+                                <div class="table_content_r_item cell_wite" id="tjxm" :class="{'active_table_row': urlParams && urlParams === 'tjxm'}">
                                     <div class="table_content_sortcell">
                                         <span class="text">推荐项目</span>
                                     </div>
@@ -185,7 +185,7 @@
                                     <div class="table_content_sortcell"><i class="right"></i></div>
                                     <div class="table_content_sortcell"><i class="right"></i></div>
                                 </div>
-                                <div class="table_content_r_item cell_wite">
+                                <div class="table_content_r_item cell_wite" id="spxm" :class="{'active_table_row': urlParams && urlParams === 'spxm'}">
                                     <div class="table_content_sortcell">
                                         <span class="text">审批项目</span>
                                     </div>