代码删除
This commit is contained in:
parent
e4daef774b
commit
4db5488f90
@ -130,10 +130,7 @@ const onChange = (current: number) => {
|
|||||||
// 请求轮播
|
// 请求轮播
|
||||||
const fetchBannerList = async () => {
|
const fetchBannerList = async () => {
|
||||||
try {
|
try {
|
||||||
console.log('开始请求轮播图数据...');
|
|
||||||
const res: any = await getBannerList();
|
const res: any = await getBannerList();
|
||||||
console.log('API返回数据:', res);
|
|
||||||
|
|
||||||
// 处理返回的数据
|
// 处理返回的数据
|
||||||
if (res && Array.isArray(res) && res.length > 0) {
|
if (res && Array.isArray(res) && res.length > 0) {
|
||||||
const processedList = res.map((item: any, index: number) => {
|
const processedList = res.map((item: any, index: number) => {
|
||||||
@ -152,10 +149,8 @@ const fetchBannerList = async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
bannerList.value = processedList;
|
bannerList.value = processedList;
|
||||||
console.log('处理后的轮播图数据:', bannerList.value);
|
|
||||||
} else {
|
} else {
|
||||||
// API返回空数据或无效数据,使用默认图片
|
// API返回空数据或无效数据,使用默认图片
|
||||||
console.log('API返回无效数据,使用默认图片');
|
|
||||||
bannerList.value = [{ id: 0, image_url: defaultBanner }];
|
bannerList.value = [{ id: 0, image_url: defaultBanner }];
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
@ -169,9 +164,7 @@ const fetchBannerList = async () => {
|
|||||||
const getGPUList = async () => {
|
const getGPUList = async () => {
|
||||||
try {
|
try {
|
||||||
const res: any = await getGpuList();
|
const res: any = await getGpuList();
|
||||||
console.log('数据内容:', JSON.stringify(res, null, 2));
|
|
||||||
source.value = res;
|
source.value = res;
|
||||||
console.log('GPU列表请求成功:', res);
|
|
||||||
|
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error('GPU列表请求失败:', error);
|
console.error('GPU列表请求失败:', error);
|
||||||
@ -203,22 +196,12 @@ const getAdvantageList = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 热门产品
|
|
||||||
const getHotProductList = async () => {
|
|
||||||
try {
|
|
||||||
const res = await getHotProduct();
|
|
||||||
console.log('热门产品请求成功:', res);
|
|
||||||
} catch (error: any) { // 捕获错误
|
|
||||||
console.error('热门产品请求失败:', error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fetchBannerList();
|
fetchBannerList();
|
||||||
getGPUList();
|
getGPUList();
|
||||||
getAdvantageList();
|
getAdvantageList();
|
||||||
// getHotProductList();
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user