|
@@ -62,9 +62,12 @@
|
|
|
import { ElBreadcrumb, ElBreadcrumbItem, ElPagination } from 'element-plus'
|
|
|
import { ArrowRight } from '@element-plus/icons-vue'
|
|
|
const route = useRoute();
|
|
|
-const category_id = route.query.category_id; //获得该页面的id
|
|
|
-const searchKey = route.query.keyword
|
|
|
-const catids = ref([]);
|
|
|
+const pageCatids = route.query.catids;
|
|
|
+const pageDepartment_id = route.query.department_id;
|
|
|
+
|
|
|
+//const category_id = route.query.category_id; //获得该页面的id
|
|
|
+// const searchKey = route.query.keyword
|
|
|
+// const catids = ref([]);
|
|
|
|
|
|
//关键词
|
|
|
let total = useState("total", () => 0)
|
|
@@ -91,88 +94,135 @@ getAdData();
|
|
|
const newsList = ref([]);
|
|
|
let keywordInput = ref("");
|
|
|
|
|
|
-//直接搜索
|
|
|
+//搜索
|
|
|
let goSearch = async () => {
|
|
|
+ console.log(111222)
|
|
|
+ console.log(page.value)
|
|
|
+ console.log(pageSize.value)
|
|
|
+ console.log(keywordInput.value)
|
|
|
+ console.log(pageCatids)
|
|
|
+ console.log(pageDepartment_id)
|
|
|
const listData = await requestDataPromise('/web/getWebsiteArticleList', {
|
|
|
method: 'GET',
|
|
|
query: {
|
|
|
'page': page.value,
|
|
|
'pageSize': pageSize.value,
|
|
|
- 'keyword':keywordInput.value
|
|
|
+ 'keyword':keywordInput.value,
|
|
|
+ 'cityid':pageCatids,
|
|
|
+ 'department_id':pageDepartment_id
|
|
|
},
|
|
|
});
|
|
|
+ console.log(112233)
|
|
|
+ console.log(listData)
|
|
|
newsList.value = listData.data.rows;
|
|
|
total.value = listData.data.count;
|
|
|
}
|
|
|
|
|
|
+goSearch();
|
|
|
//基于导航池搜索
|
|
|
-let goSearchFont = async (font) => {
|
|
|
- const listData = await requestDataPromise('/web/getWebsiteArticleList', {
|
|
|
- method: 'GET',
|
|
|
- query: {
|
|
|
- 'page': page.value,
|
|
|
- 'pageSize': pageSize.value,
|
|
|
- 'catid': font
|
|
|
- },
|
|
|
- });
|
|
|
- newsList.value = listData.data.rows;
|
|
|
- total.value = listData.data.count;
|
|
|
-}
|
|
|
-
|
|
|
-//基于导航池与关键词搜索
|
|
|
-let goSearchFontandCid = async (font) => {
|
|
|
- const listData = await requestDataPromise('/web/getWebsiteArticleList', {
|
|
|
- method: 'GET',
|
|
|
- query: {
|
|
|
- 'page': page.value,
|
|
|
- 'pageSize': pageSize.value,
|
|
|
- 'catid': category_id,
|
|
|
- 'keyword':searchKey
|
|
|
- },
|
|
|
- });
|
|
|
- newsList.value = listData.data.rows;
|
|
|
- total.value = listData.data.count;
|
|
|
-}
|
|
|
-
|
|
|
-const newslists = async () => {
|
|
|
- try {
|
|
|
- // 从地区跳转
|
|
|
- if (route.query.catids && route.query.catids.length > 0) {
|
|
|
- // 将字符串转换回数组,并过滤掉可能的空值
|
|
|
- catids.value = route.query.catids.split(',').filter(id => id);
|
|
|
-
|
|
|
- if (catids.value.length > 0) {
|
|
|
- // 有效的 catids 数组,可以进行后续操作
|
|
|
- console.log('接收到的分类ID数组:', catids.value);
|
|
|
- let font = catids.value.join(",")
|
|
|
- font = "[" + font + "]"
|
|
|
-
|
|
|
- goSearchFont(font);
|
|
|
- } else {
|
|
|
- // 处理空数组情况
|
|
|
- console.log('未接收到有效的分类ID');
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (category_id == undefined) {
|
|
|
- //直接搜索 默认进来没有导航池的话 不执行搜索
|
|
|
- //goSearch();
|
|
|
- } else {
|
|
|
- goSearchFontandCid();
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-newslists();
|
|
|
+// let goSearchFont = async (font) => {
|
|
|
+// const listData = await requestDataPromise('/web/getWebsiteArticleList', {
|
|
|
+// method: 'GET',
|
|
|
+// query: {
|
|
|
+// 'page': page.value,
|
|
|
+// 'pageSize': pageSize.value,
|
|
|
+// 'catid': font
|
|
|
+// },
|
|
|
+// });
|
|
|
+// newsList.value = listData.data.rows;
|
|
|
+// total.value = listData.data.count;
|
|
|
+// }
|
|
|
+
|
|
|
+// //基于导航池与关键词搜索
|
|
|
+// let goSearchFontandCid = async (font) => {
|
|
|
+// const listData = await requestDataPromise('/web/getWebsiteArticleList', {
|
|
|
+// method: 'GET',
|
|
|
+// query: {
|
|
|
+// 'page': page.value,
|
|
|
+// 'pageSize': pageSize.value,
|
|
|
+// 'catid': category_id,
|
|
|
+// 'keyword':searchKey
|
|
|
+// },
|
|
|
+// });
|
|
|
+// newsList.value = listData.data.rows;
|
|
|
+// total.value = listData.data.count;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+//直接查新闻
|
|
|
+// const newslists = async () => {
|
|
|
+// try {
|
|
|
+// // 从地区跳转
|
|
|
+// if (route.query.catids && route.query.catids.length > 0) {
|
|
|
+// // 将字符串转换回数组,并过滤掉可能的空值
|
|
|
+// catids.value = route.query.catids.split(',').filter(id => id);
|
|
|
+
|
|
|
+// if (catids.value.length > 0) {
|
|
|
+// // 有效的 catids 数组,可以进行后续操作
|
|
|
+// console.log('接收到的分类ID数组:', catids.value);
|
|
|
+// let font = catids.value.join(",")
|
|
|
+// font = "[" + font + "]"
|
|
|
+
|
|
|
+// goSearchFont(font);
|
|
|
+// } else {
|
|
|
+// // 处理空数组情况
|
|
|
+// console.log('未接收到有效的分类ID');
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// if (category_id == undefined) {
|
|
|
+// //直接搜索 默认进来没有导航池的话 不执行搜索
|
|
|
+// goSearch();
|
|
|
+// } else {
|
|
|
+// goSearchFontandCid();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } catch (error) {
|
|
|
+// console.error(error);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// newslists();
|
|
|
+
|
|
|
+
|
|
|
+// 查询导航池的方法
|
|
|
+// const newslists = async () => {
|
|
|
+// try {
|
|
|
+// // 从地区跳转
|
|
|
+// if (route.query.catids && route.query.catids.length > 0) {
|
|
|
+// // 将字符串转换回数组,并过滤掉可能的空值
|
|
|
+// catids.value = route.query.catids.split(',').filter(id => id);
|
|
|
+
|
|
|
+// if (catids.value.length > 0) {
|
|
|
+// // 有效的 catids 数组,可以进行后续操作
|
|
|
+// console.log('接收到的分类ID数组:', catids.value);
|
|
|
+// let font = catids.value.join(",")
|
|
|
+// font = "[" + font + "]"
|
|
|
+
|
|
|
+// goSearchFont(font);
|
|
|
+// } else {
|
|
|
+// // 处理空数组情况
|
|
|
+// console.log('未接收到有效的分类ID');
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// if (category_id == undefined) {
|
|
|
+// //直接搜索 默认进来没有导航池的话 不执行搜索
|
|
|
+// goSearch();
|
|
|
+// } else {
|
|
|
+// goSearchFontandCid();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } catch (error) {
|
|
|
+// console.error(error);
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+// newslists();
|
|
|
|
|
|
//分页事件
|
|
|
let changePage = (value) => {
|
|
|
console.log("当前页码", value);
|
|
|
page.value = value
|
|
|
console.log(page.value);
|
|
|
- newslists()
|
|
|
+ goSearch()
|
|
|
}
|
|
|
//2.页面数据 end ---------------------------------------->
|
|
|
|