Lijy 6 kuukautta sitten
vanhempi
commit
20f72119e1

+ 13 - 8
fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/static/knowledge.ftl

@@ -95,9 +95,14 @@
 
 <script>
   // 获取当前页面的 URL 参数
-  const params = new URLSearchParams(window.location.search);
-  const pageIndex = +params.get('pageIndex') || 1;
-  const pageSize = +params.get('pageSize') || 10;
+  // const params = new URLSearchParams(window.location.search);
+  const url = window.location.search
+  const match = url.match(/pageList\/(\d+)/);
+  const number = match ? match[1] : null;
+  const pageIndex = +number || 1
+  const pageSize = 10
+  // const pageIndex = +params.get('pageIndex') || 1;
+  // const pageSize = +params.get('pageSize') || 10;
 
   let total = ${total}
   let totalPages = Math.ceil(total / pageSize); // 总页数
@@ -105,14 +110,14 @@
   let currentPage = pageIndex; // 当前页
   const knowledgeUrl = '/articleTemplate/pageList'
   const knowledgeDetails = '/articleTemplate/articleDetail'
-  const fixedParameters = '?pageIndex=' + currentPage + '&pageSize=' + currentSize + '&info=' // 分页固定参数
+  const fixedParameters = '/' + currentPage
 
   function search() {
     const inputVal = document.getElementById("knowledgeInput").value;
-    window.location.href = knowledgeUrl + fixedParameters + inputVal
+    window.location.href = knowledgeUrl + fixedParameters + '?&info=' + inputVal
   }
   function learnMore(id) {
-    window.location.href = knowledgeDetails + `?id=` + id
+    window.location.href = knowledgeDetails + `/` + id
   }
   function triggerButtonClick(itemId) {
     // 找到该 item 对应的按钮并触发点击事件
@@ -132,7 +137,7 @@
     if(!inputVal) {
       return
     }
-    window.location.href = knowledgeUrl + '?pageIndex=' + inputVal + '&pageSize=' + currentSize
+    window.location.href = knowledgeUrl + '/' + inputVal
   }
 
   // 初始化分页组件
@@ -155,7 +160,7 @@
 
   // 跳转到指定页面
   function goToPage(page) {
-    window.location.href = knowledgeUrl + '?pageIndex=' + page + '&pageSize=' + currentSize
+    window.location.href = knowledgeUrl + '/' + page
   }
 
   // 初始化分页

+ 6 - 6
fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/static/knowledgeDetails.ftl

@@ -86,12 +86,12 @@
         <div class="latestArticles">
           <div class="knowledgeDetails-right-title">
             <div>最新文章</div>
-            <a href="/articleTemplate/pageList?pageIndex=1&pageSize=10" class="linkButton">查看更多></a>
+            <a href="/articleTemplate/pageList/1" class="linkButton">查看更多></a>
           </div>
           <div class="line"></div>
           <div class="latestList">
             <#list latestList as item>
-              <a href="/articleTemplate/articleDetail?id=${item.id}">
+              <a href="/articleTemplate/articleDetail/${item.id}">
                 <div class="latestList-item" data-item='${item.id}'>
                   <div class="latestList-item-image">
                     <img src="${item.coverImgUrl}" class="wh100"></img>
@@ -108,12 +108,12 @@
         <div class="relatedRecommendations">
           <div class="knowledgeDetails-right-title">
             <div>相关推荐</div>
-            <a href="/articleTemplate/pageList?pageIndex=1&pageSize=10" class="linkButton">查看更多></a>
+            <a href="/articleTemplate/pageList/1" class="linkButton">查看更多></a>
           </div>
           <div class="line"></div>
           <div class="latestList">
             <#list relatedList as item>
-              <a href="/articleTemplate/articleDetail?id=${item.id}">
+              <a href="/articleTemplate/articleDetail/${item.id}">
                 <div class="latestList-item" data-item='${item.id}'>
                   <div class="latestList-item-image">
                     <img src="${item.coverImgUrl}" class="wh100"></img>
@@ -197,7 +197,7 @@
   
   const knowledgeDetails = '/articleTemplate/articleDetail'
   function toKnowledge() {
-    window.location.href = `/articleTemplate/pageList?pageIndex=1&pageSize=10`
+    window.location.href = `/articleTemplate/pageList/1`
   }
   
   $('#returnIcon').click(function () {
@@ -225,7 +225,7 @@
   //      item.addEventListener('click', function () {
   //        const itemData = item.getAttribute('data-item');
   //        console.log('点击了', itemData)
-  //        window.location.href = knowledgeDetails + `?id=` + itemData
+  //        window.location.href = knowledgeDetails + `/` + itemData
   //      });
   //    });
   //  });

+ 1 - 1
fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/static/moduleView/header.html

@@ -68,7 +68,7 @@
             { label: '产品定价', value: '../index.html#pricing', class: 'header-item' },
             { label: '关于我们', value: '../about.html', class: 'header-item' },
             { label: '企业动态', value: '../dynamic.html', class: 'header-item' },
-            { label: '知识园地', value: '/articleTemplate/pageList?pageIndex=1&pageSize=10', class: 'header-item' },
+            { label: '知识园地', value: '/articleTemplate/pageList/1', class: 'header-item' },
           ],
           otherList: [
             { label: '工时管家', path: '../index.html', icon: './image/icon/workHour.png', hoverIcon: './image/icon/workHourHover.png' },