Commit e7b19a99 authored by 张娇(东信)'s avatar 张娇(东信)

旅居列表渲染

parent 1c43cb48
...@@ -340,7 +340,8 @@ const sortParams = (sortMode) => { ...@@ -340,7 +340,8 @@ const sortParams = (sortMode) => {
// }; // };
const dataParams = (item, datePart) => { const dataParams = (item, datePart) => {
if (item) { if (item) {
dateType.value = item.key.toString(); console.log(item, 212);
dateType.value = String(item.key);
getProd(); getProd();
} else { } else {
dateType.value = '8'; dateType.value = '8';
...@@ -353,30 +354,50 @@ const dataParams = (item, datePart) => { ...@@ -353,30 +354,50 @@ const dataParams = (item, datePart) => {
}; };
// 景点 // 景点
const placeParams = (item) => { const placeParams = (item) => {
const ids = item.map((i) => i.id); if (item.length !== 0) {
const arr = ids.join(','); const ids = item.map((i) => i.id);
attractionIdList.value = arr.split(',').map(String); const arr = ids.join(',');
getProd(); attractionIdList.value = arr.split(',').map(String);
getProd();
} else if (item.length === 0) {
attractionIdList.value = [];
getProd();
}
}; };
// 筛选 // 筛选
const screenParams = (selectedItems, type) => { const screenParams = (selectedItems, type) => {
console.log(selectedItems, type, 111); console.log(selectedItems.length, type, 111);
if (type === 'screen') { if (type === 'screen') {
const ids = selectedItems.map((i) => i.tripCityId); if (selectedItems.length !== 0) {
const arr = ids.join(','); const ids = selectedItems.map((i) => i.tripCityId);
startCityList.value = arr.split(',').map(String); const arr = ids.join(',');
getProd(); startCityList.value = arr.split(',').map(String);
getProd();
} else if (selectedItems.length === 0) {
startCityList.value = [];
getProd();
}
} else if (type === 'serve') { } else if (type === 'serve') {
const ids = selectedItems.map((i) => i.labelId); if (selectedItems.length !== 0) {
const arr = ids.join(','); const ids = selectedItems.map((i) => i.labelId);
serviceList.value = arr.split(',').map(String); const arr = ids.join(',');
getProd(); serviceList.value = arr.split(',').map(String);
getProd();
} else if (selectedItems.length === 0) {
serviceList.value = [];
getProd();
}
} else if (type === 'people') { } else if (type === 'people') {
const ids = selectedItems.map((i) => i.labelId); if (selectedItems.length !== 0) {
const arr = ids.join(','); const ids = selectedItems.map((i) => i.labelId);
forPeopleList.value = arr.split(',').map(String); const arr = ids.join(',');
getProd(); forPeopleList.value = arr.split(',').map(String);
getProd();
} else if (selectedItems.length === 0) {
forPeopleList.value = [];
getProd();
}
} }
}; };
// 搜索 // 搜索
...@@ -391,7 +412,7 @@ const getProd = (searchKeyword = '') => { ...@@ -391,7 +412,7 @@ const getProd = (searchKeyword = '') => {
}); });
const params = { const params = {
current: currentPage.value, current: currentPage.value,
size: 3, size: 5,
...(sortType.value && { sortType: sortType.value.sortMode }), ...(sortType.value && { sortType: sortType.value.sortMode }),
...(attractionIdList.value && ...(attractionIdList.value &&
attractionIdList.value.length > 0 && attractionIdList.value.length > 0 &&
...@@ -402,10 +423,6 @@ const getProd = (searchKeyword = '') => { ...@@ -402,10 +423,6 @@ const getProd = (searchKeyword = '') => {
...(serviceList.value && serviceList.value.length > 0 && { serviceList: serviceList.value }), ...(serviceList.value && serviceList.value.length > 0 && { serviceList: serviceList.value }),
...(forPeopleList.value && ...(forPeopleList.value &&
forPeopleList.value.length > 0 && { forPeopleList: forPeopleList.value }), forPeopleList.value.length > 0 && { forPeopleList: forPeopleList.value }),
// ...(startCityList.value && { startCityList: startCityList.value.split(',') }),
// ...(serviceList.value && { serviceList: serviceList.value.split(',') }),
// ...(forPeopleList.value && { forPeopleList: forPeopleList.value.split(',') }),
...(dateType.value === '8' && { allocateDate: allocateDate.value }), ...(dateType.value === '8' && { allocateDate: allocateDate.value }),
...(searchKeyword && { keyword: searchKeyword }), ...(searchKeyword && { keyword: searchKeyword }),
}; };
...@@ -418,7 +435,7 @@ const getProd = (searchKeyword = '') => { ...@@ -418,7 +435,7 @@ const getProd = (searchKeyword = '') => {
if (currentPage.value === 1) { if (currentPage.value === 1) {
cardList.value = res.data.records; cardList.value = res.data.records;
} else { } else {
cardList.value = cardList.value.concat(res.data.records); cardList.value = [...cardList.value, ...res.data.content];
} }
// 判断是否还有更多数据 // 判断是否还有更多数据
if (res.data.records.length < params.size) { if (res.data.records.length < params.size) {
...@@ -450,16 +467,6 @@ const resetParams = () => { ...@@ -450,16 +467,6 @@ const resetParams = () => {
getProd(); getProd();
} }
}; };
// const resetParams = () => {
// sortType.value = null;
// attractionIdList.value = [];
// dateType.value = null;
// startCityList.value = [];
// serviceList.value = [];
// forPeopleList.value = [];
// allocateDate.value = null;
// getProd();
// };
function toRouteDetails(item) { function toRouteDetails(item) {
console.log(item, 22222); console.log(item, 22222);
// TODO: 跳转到线路详情 // TODO: 跳转到线路详情
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment