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

首页预售页面轮播图获取数据

parent aaeb1eaf
import { request } from '../../utils/request'; import { request } from '../../utils/request';
// 获取指定类型轮播图 // 筑农专区分类
export function getSortList(data) { export function getSortList(data) {
return request({ return request({
url: `/sgyrdd/category/znList`, url: `/sgyrdd/category/znList`,
...@@ -9,6 +9,24 @@ export function getSortList(data) { ...@@ -9,6 +9,24 @@ export function getSortList(data) {
}); });
} }
// 预售板块轮播图
export function getPresaleList(data) {
return request({
url: `/sgyrdd/carousel/presaleList`,
method: 'GET',
data,
});
}
// 筑农严选分类
export function getStrictSelection(data) {
return request({
url: `/sgyrdd/category/getZnyx`,
method: 'GET',
data,
});
}
// 筑农严选首页-分类预售商品列表 // 筑农严选首页-分类预售商品列表
export function getPresaleCategory(data) { export function getPresaleCategory(data) {
return request({ return request({
...@@ -18,28 +36,28 @@ export function getPresaleCategory(data) { ...@@ -18,28 +36,28 @@ export function getPresaleCategory(data) {
}); });
} }
// 预售板块轮播图 // 筑农严选首页-好货特卖商品列表
export function getPresaleList(data) { export function getGoodSaleProdList(data) {
return request({ return request({
url: `/sgyrdd/carousel/presaleList`, url: `/sgyrdd/znprod/getGoodSaleProdList`,
method: 'GET', method: 'GET',
data, data,
}); });
} }
// 筑农严选分类 // 筑农严选首页-分类查询商品列表
export function getStrictSelection(data) { export function getPlatformProdList(data) {
return request({ return request({
url: `/sgyrdd/category/getZnyx`, url: `/sgyrdd/znprod/getPlatformProdList`,
method: 'GET', method: 'GET',
data, data,
}); });
} }
// 筑农预售分类 // 筑农首页-分类查询商品列表
export function getBuindingSort(data) { export function getPresaleProdList(data) {
return request({ return request({
url: `/sgyrdd/category/presaleList`, url: `/sgyrdd/znprod/getPresaleProdList`,
method: 'GET', method: 'GET',
data, data,
}); });
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<view class="hot-sale"> <view class="hot-sale">
<view class="top-title"> <view class="top-title">
<text class="left-title">好货热卖</text> <text class="left-title">好货热卖</text>
<text class="right-title">更多</text> <text class="right-title" @tap="toPresale">更多</text>
</view> </view>
<wd-icon <wd-icon
name="arrow-right" name="arrow-right"
......
...@@ -8,21 +8,16 @@ ...@@ -8,21 +8,16 @@
placeholderText="请输入要搜索的内容" placeholderText="请输入要搜索的内容"
></Search> ></Search>
<view> <view>
<img <wd-swiper
class="img1" :list="swiperList"
src="/static/assistingAgriculture/assets/bacImg.png" autoplay
style="width: 750rpx; height: 440rpx" v-model:current="current"
/> @click="handleClick"
<img @change="onChange"
class="img2" customClass="guiyang"
src="/static/assistingAgriculture/assets/bottom.png" height="220"
style="width: 750rpx; height: 32rpx" imageMode="aspectFill"
/> ></wd-swiper>
<img
class="img3"
src="/static/assistingAgriculture/assets/right.png"
style="width: 288rpx; height: 124rpx"
/>
</view> </view>
<view class="sort"> <view class="sort">
<view style="display: flex; flex-direction: row"> <view style="display: flex; flex-direction: row">
...@@ -62,11 +57,19 @@ ...@@ -62,11 +57,19 @@
import Search from '../../../components/assistingAgriculture/index/Search.vue'; import Search from '../../../components/assistingAgriculture/index/Search.vue';
import { import {
getPresaleCategory, getPresaleCategory,
getPresaleList,
getSortList, getSortList,
getStrictSelection, getStrictSelection,
} from '../../../api/assistingAgriculture/building'; } from '../../../api/assistingAgriculture/building';
import { onMounted } from 'vue'; import { onMounted, ref } from 'vue';
import { groupImgList } from '@/api';
const list = ref([]); const list = ref([]);
const sortList = ref([]);
const swiperList = ref([]);
const current = ref(0);
// 轮播图数据
let lunboData;
const detailList = ref([ const detailList = ref([
{ {
img: '/static/assistingAgriculture/assets/detailedMapOne.png', img: '/static/assistingAgriculture/assets/detailedMapOne.png',
...@@ -84,11 +87,11 @@ const detailList = ref([ ...@@ -84,11 +87,11 @@ const detailList = ref([
text: '麻辣鱼豆腐', text: '麻辣鱼豆腐',
}, },
]); ]);
const sortList = ref([]);
onMounted(async () => { onMounted(async () => {
getList(); getList();
getPresaleCategoryList(); getPresaleCategoryList();
getStrictSelectionList(); getStrictSelectionList();
getPresale();
}); });
// 获取筑农专区分类; // 获取筑农专区分类;
const getList = () => { const getList = () => {
...@@ -107,7 +110,6 @@ const getPresaleCategoryList = () => { ...@@ -107,7 +110,6 @@ const getPresaleCategoryList = () => {
item.commodityList = item.prodSimples; item.commodityList = item.prodSimples;
item.commodityList.forEach((item) => { item.commodityList.forEach((item) => {
item.commodityImg = import.meta.env.VITE_APP_IMG_URL + item.pic; item.commodityImg = import.meta.env.VITE_APP_IMG_URL + item.pic;
console.log(item.commodityImg, 111);
}); });
}); });
list.value = res.data; list.value = res.data;
...@@ -115,23 +117,40 @@ const getPresaleCategoryList = () => { ...@@ -115,23 +117,40 @@ const getPresaleCategoryList = () => {
}; };
// 筑农严选分类 // 筑农严选分类
const getStrictSelectionList = () => { const getStrictSelectionList = () => {
getStrictSelection().then((res) => { getStrictSelection().then((res) => {});
console.log(res, 333); };
// 预售板块轮播图
const getPresale = () => {
getPresaleList({ place: 'index_top' }).then((res) => {
console.log(res, 111);
res.data.forEach((item) => {
item.imgUrl = import.meta.env.VITE_APP_IMG_URL + item.imgUrl;
});
lunboData = res.data;
swiperList.value = res.data.map((item) => {
return item.imgUrl;
});
}); });
}; };
const onChange = (e) => {
// console.log(e);
};
function toBuilding(index) { function toBuilding(index) {
if (index === 0) { if (index === 0) {
// TODO: 跳转到筑农严选 // TODO: 跳转到筑农严选
xma.navigateTo({ xma.navigateTo({
url: '/pages/assistingAgriculture/index/building', url: '/pages/assistingAgriculture/index/building',
}); });
} else if (index === 1) {
console.log(111);
} else if (index === 2) { } else if (index === 2) {
// TODO: 跳转到乡村旅居 // TODO: 跳转到乡村旅居
xma.navigateTo({ xma.navigateTo({
url: '/pages/assistingAgriculture/RuralTravel/RuralTravel', url: '/pages/assistingAgriculture/RuralTravel/RuralTravel',
}); });
} else if (index === 3) {
console.log(222);
} }
console.log(index, 121);
} }
// 跳转详情页 // 跳转详情页
function toDetail() { function toDetail() {
...@@ -157,15 +176,6 @@ page { ...@@ -157,15 +176,6 @@ page {
.img1 { .img1 {
display: flex; display: flex;
} }
.img2 {
display: flex;
margin-top: -31rpx;
}
.img3 {
display: flex;
margin-top: -120rpx;
margin-left: 462rpx;
}
.bottom-image { .bottom-image {
position: relative; position: relative;
top: -40rpx; top: -40rpx;
...@@ -273,8 +283,8 @@ page { ...@@ -273,8 +283,8 @@ page {
color: #fa5151; color: #fa5151;
} }
::v-deep .icon { ::v-deep .icon {
width: 40rpx; width: 40 rpx;
height: 40rpx; height: 40 rpx;
margin-left: 40rpx; margin-left: 40 rpx;
} }
</style> </style>
...@@ -10,13 +10,14 @@ ...@@ -10,13 +10,14 @@
</view> </view>
<view class="nav"> <view class="nav">
<wd-swiper <wd-swiper
class="main-img"
:list="swiperList" :list="swiperList"
autoplay autoplay
v-model:current="current" v-model:current="current"
@click="handleClick" @click="handleClick"
@change="onChange" @change="onChange"
height="188" customClass="guiyang"
height="220"
imageMode="aspectFill"
></wd-swiper> ></wd-swiper>
</view> </view>
<view class="sort"> <view class="sort">
...@@ -143,12 +144,11 @@ ...@@ -143,12 +144,11 @@
<script setup> <script setup>
import Search from '../../../components/assistingAgriculture/index/Search.vue'; import Search from '../../../components/assistingAgriculture/index/Search.vue';
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import { import { getPresaleList } from '../../../api/assistingAgriculture/building';
getBuindingSort, const swiperList = ref([]);
getPresaleList,
getStrictSelection,
} from '../../../api/assistingAgriculture/building';
const current = ref(0); const current = ref(0);
// 轮播图数据
let lunboData;
const light = ref(0); const light = ref(0);
const sortList = ref([ const sortList = ref([
{ img: '/static/assistingAgriculture/presale/bacImg.png', price: '25', text: '应季好物' }, { img: '/static/assistingAgriculture/presale/bacImg.png', price: '25', text: '应季好物' },
...@@ -157,11 +157,6 @@ const sortList = ref([ ...@@ -157,11 +157,6 @@ const sortList = ref([
{ img: '/static/assistingAgriculture/presale/img4.png', price: '25', text: '预选蔬菜' }, { img: '/static/assistingAgriculture/presale/img4.png', price: '25', text: '预选蔬菜' },
{ img: '/static/assistingAgriculture/presale/img5.png', price: '25', text: '心选水果' }, { img: '/static/assistingAgriculture/presale/img5.png', price: '25', text: '心选水果' },
]); ]);
const swiperList = ref([
'../../../static/assistingAgriculture/presale/img.png',
'../../../static/assistingAgriculture/presale/img.png',
'../../../static/assistingAgriculture/presale/img.png',
]);
const tabsData = ref([ const tabsData = ref([
{ img: '/static/assistingAgriculture/assets/mainPicture.png', text: '全部' }, { img: '/static/assistingAgriculture/assets/mainPicture.png', text: '全部' },
{ img: '/static/assistingAgriculture/assets/presale.png', text: '分类1' }, { img: '/static/assistingAgriculture/assets/presale.png', text: '分类1' },
...@@ -235,18 +230,18 @@ const goodList = ref([ ...@@ -235,18 +230,18 @@ const goodList = ref([
]); ]);
onMounted(async () => { onMounted(async () => {
getPresale(); getPresale();
getBuindingSortList();
}); });
// 预售板块轮播图 // 预售板块轮播图
const getPresale = () => { const getPresale = () => {
getPresaleList({ place: 3 }).then((res) => { getPresaleList({ place: 'presale' }).then((res) => {
console.log(res, 111); console.log(res, 111);
}); res.data.forEach((item) => {
}; item.imgUrl = import.meta.env.VITE_APP_IMG_URL + item.imgUrl;
// 筑农预售分类 });
const getBuindingSortList = () => { lunboData = res.data;
getBuindingSort({ level: 3 }).then((res) => { swiperList.value = res.data.map((item) => {
console.log(res, 222); return item.imgUrl;
});
}); });
}; };
// 左侧数据列表 // 左侧数据列表
......
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