|
@@ -46,7 +46,7 @@
|
|
|
<div>
|
|
|
<!-- <div class="knowledgeField-content-item" onclick="triggerButtonClick(${item.id})"> -->
|
|
|
<div class="knowledgeField-content-item">
|
|
|
- <a href="/articleTemplate/articleDetail?id=${item.id}">
|
|
|
+ <a href="/articleTemplate/articleDetail/${item.id}">
|
|
|
<div class="image"><img src="${item.coverImgUrl}" class="wh100" class="wh100"></img>
|
|
|
</div>
|
|
|
<div class="textContent">
|
|
@@ -55,7 +55,7 @@
|
|
|
<div class="textContentUnderstand">
|
|
|
<div class="textContentUnderstandText">发布于:${item.createTimeStr} 预览量:${item.viewCount}</div>
|
|
|
<!-- <button class="linkButtonss" onclick="learnMore(${item.id})">了解详情></button> -->
|
|
|
- <a class="linkButtonss" href="/articleTemplate/articleDetail?id=${item.id}">查看详情></a>
|
|
|
+ <a class="linkButtonss" href="/articleTemplate/articleDetail/${item.id}">查看详情></a>
|
|
|
</div>
|
|
|
</div>
|
|
|
</a>
|
|
@@ -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
|
|
|
}
|
|
|
|
|
|
// 初始化分页
|