|
|
@@ -3,7 +3,7 @@ |
|
|
|
<!-- tab栏 --> |
|
|
|
<view class="tabBox"> |
|
|
|
<u-tabs |
|
|
|
:list="tabList" |
|
|
|
:list="sexList" |
|
|
|
lineWidth="50" |
|
|
|
lineColor="#ff4f00" |
|
|
|
:itemStyle="{ width: '150rpx', height: '90rpx', padding: '0' }" |
|
|
@@ -26,26 +26,26 @@ |
|
|
|
@open="openPopup" |
|
|
|
> |
|
|
|
<view class="popupBox"> |
|
|
|
<view class="type">类型</view> |
|
|
|
<view class="type">性别</view> |
|
|
|
<view class="typeBox"> |
|
|
|
<view |
|
|
|
v-show="item.name" |
|
|
|
class="typeBox-item" |
|
|
|
:class="item.id == sex ? 'itemActive' : ''" |
|
|
|
@click="sex = item.id" |
|
|
|
v-for="item in tabList" |
|
|
|
@click="chooseSex(item)" |
|
|
|
v-for="item in sexList2" |
|
|
|
:key="item.id" |
|
|
|
>{{ item.name }}</view |
|
|
|
> |
|
|
|
</view> |
|
|
|
<view class="type">风格</view> |
|
|
|
<view class="type">类型</view> |
|
|
|
<view class="typeBox"> |
|
|
|
<view |
|
|
|
v-show="item.name" |
|
|
|
class="typeBox-item" |
|
|
|
:class="item.id == sex ? 'itemActive' : ''" |
|
|
|
@click="sex = item.id" |
|
|
|
v-for="item in tabList" |
|
|
|
:class="item.id == mouldType ? 'itemActive' : ''" |
|
|
|
@click="chooseMouldType(item)" |
|
|
|
v-for="item in mouldTypeList" |
|
|
|
:key="item.id" |
|
|
|
>{{ item.name }}</view |
|
|
|
> |
|
|
@@ -87,20 +87,61 @@ import { getListApi } from "../../api/closeStyle"; |
|
|
|
//#endregion ----------------------- |
|
|
|
|
|
|
|
//#region tab栏 |
|
|
|
// 性别 |
|
|
|
const sex = ref(2); |
|
|
|
const tabList = ref([ |
|
|
|
const sexList = ref([ |
|
|
|
{ name: "女", id: 2 }, |
|
|
|
{ name: "男", id: 1 }, |
|
|
|
{ name: "单人", id: 3 }, |
|
|
|
{ name: "多人", id: 4 }, |
|
|
|
]); |
|
|
|
const sexList2 = ref([ |
|
|
|
{ name: "女", id: 2 }, |
|
|
|
{ name: "男", id: 1 }, |
|
|
|
{ name: "多人", id: 3 }, |
|
|
|
{ name: "电影明星", id: 4 }, |
|
|
|
{ name: "体育", id: 5 }, |
|
|
|
{ name: "多人", id: 6 }, |
|
|
|
// { name: "电影明星", id: 7 }, |
|
|
|
{ name: "体育", id: 8 }, |
|
|
|
{ name: "", id: 999, disabled: true }, |
|
|
|
]); |
|
|
|
|
|
|
|
// 类型 |
|
|
|
const mouldType = ref(""); |
|
|
|
const mouldTypeList = ref([ |
|
|
|
{ name: "单人", id: 1 }, |
|
|
|
{ name: "多人", id: 2 }, |
|
|
|
]); |
|
|
|
// 点击tab |
|
|
|
function chooseTab(item) { |
|
|
|
sex.value = item.id; |
|
|
|
if (item.id < 3) { |
|
|
|
sex.value = item.id; |
|
|
|
mouldType.value = ""; |
|
|
|
} else if (item.id == 3) { |
|
|
|
mouldType.value = 1; |
|
|
|
sex.value = ""; |
|
|
|
} else if (item.id == 4) { |
|
|
|
mouldType.value = 2; |
|
|
|
sex.value = ""; |
|
|
|
} |
|
|
|
} |
|
|
|
// 更多里的tab 性别 |
|
|
|
function chooseSex(item) { |
|
|
|
if (sex.value == item.id) { |
|
|
|
if (mouldType.value == "") { |
|
|
|
return; |
|
|
|
} else { |
|
|
|
sex.value = ""; |
|
|
|
} |
|
|
|
} else { |
|
|
|
sex.value = item.id; |
|
|
|
} |
|
|
|
} |
|
|
|
// 更多里的tab 类型 |
|
|
|
function chooseMouldType(item) { |
|
|
|
if (mouldType.value == item.id) { |
|
|
|
if (sex.value == "") { |
|
|
|
return; |
|
|
|
} else { |
|
|
|
mouldType.value = ""; |
|
|
|
} |
|
|
|
} else { |
|
|
|
mouldType.value = item.id; |
|
|
|
} |
|
|
|
} |
|
|
|
//#endregion |
|
|
|
|
|
|
@@ -127,7 +168,12 @@ async function getList() { |
|
|
|
title: "加载中...", |
|
|
|
mask: true, |
|
|
|
}); |
|
|
|
const res = await getListApi(pageNum.value, pageSize.value, sex.value); |
|
|
|
const res = await getListApi( |
|
|
|
pageNum.value, |
|
|
|
pageSize.value, |
|
|
|
sex.value, |
|
|
|
mouldType.value |
|
|
|
); |
|
|
|
styleList.value = res.data.list; |
|
|
|
uni.hideLoading(); |
|
|
|
} catch (error) { |
|
|
@@ -139,9 +185,17 @@ async function getList() { |
|
|
|
} |
|
|
|
} |
|
|
|
// 监听性别tab变化 |
|
|
|
watch( |
|
|
|
() => mouldType.value, |
|
|
|
(old) => { |
|
|
|
pageNum.value = 1; |
|
|
|
pageSize.value = 20; |
|
|
|
getList(); |
|
|
|
} |
|
|
|
); |
|
|
|
watch( |
|
|
|
() => sex.value, |
|
|
|
(sex) => { |
|
|
|
() => { |
|
|
|
pageNum.value = 1; |
|
|
|
pageSize.value = 20; |
|
|
|
getList(); |
|
|
@@ -156,7 +210,12 @@ const scrolltolower = async () => { |
|
|
|
mask: true, |
|
|
|
}); |
|
|
|
pageNum.value += 1; |
|
|
|
const res = await getListApi(pageNum.value, pageSize.value, sex.value); |
|
|
|
const res = await getListApi( |
|
|
|
pageNum.value, |
|
|
|
pageSize.value, |
|
|
|
sex.value, |
|
|
|
mouldType.value |
|
|
|
); |
|
|
|
styleList.value.push(...res.data.list); |
|
|
|
setTimeout(function () { |
|
|
|
uni.hideLoading(); |
|
|
@@ -167,6 +226,7 @@ const scrolltolower = async () => { |
|
|
|
uni.showToast({ |
|
|
|
title: "已加载全部内容", |
|
|
|
icon: "none", |
|
|
|
mask: false, |
|
|
|
}); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|