banner
This commit is contained in:
parent
90ece932c9
commit
6b7fb86023
|
|
@ -2,6 +2,7 @@ const request = require('../../utils/request');
|
|||
Page({
|
||||
data: {
|
||||
carList: [],
|
||||
type:1,
|
||||
selectedSort: 'default',
|
||||
selectedBrand: '',
|
||||
selectedPrice: '',
|
||||
|
|
@ -75,6 +76,7 @@ Page({
|
|||
brand:this.data.selectedSeriesId,
|
||||
price:this.data.selectedPrice,
|
||||
attr:this.data.filterParams,
|
||||
type:this.data.type,
|
||||
}
|
||||
try {
|
||||
const raw = await request({
|
||||
|
|
@ -97,7 +99,12 @@ Page({
|
|||
address
|
||||
})
|
||||
},
|
||||
onLoad(){
|
||||
onLoad(options){
|
||||
if (options.type) {
|
||||
this.setData({
|
||||
type: options.type
|
||||
});
|
||||
}
|
||||
this.loadBrandData();
|
||||
},
|
||||
async loadBrandData() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const request = require('../../utils/request');
|
||||
Page({
|
||||
data: {
|
||||
|
||||
|
||||
bannerList: [
|
||||
'http://192.168.1.11:8089/uploads/20250630/054c53776891b766c6f1bd65059a5b27.jpg',
|
||||
'http://192.168.1.11:8089/uploads/20250630/c7f45ec56c19eac42a23c5e987cacc93.jpg'
|
||||
|
|
@ -14,24 +14,35 @@ Page({
|
|||
phone: '021-88888888'
|
||||
}
|
||||
},
|
||||
// 跳转到新车页面
|
||||
goToNewCar: function() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/car_new/car_new'
|
||||
});
|
||||
},
|
||||
|
||||
// 跳转到租车页面
|
||||
goToRental: function() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/rental/rental'
|
||||
});
|
||||
},
|
||||
|
||||
// 跳转到二手车页面
|
||||
goToUsedCar: function() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/usedcar/usedcar'
|
||||
});
|
||||
},
|
||||
onShow() {
|
||||
// 页面显示时刷新数据
|
||||
this.loadBanner();
|
||||
},
|
||||
// 跳转到新车页面
|
||||
goToNewCar: function () {
|
||||
wx.navigateTo({
|
||||
url: '/pages/car_new/car_new?type=' + 1
|
||||
});
|
||||
},
|
||||
|
||||
// 跳转到租车页面
|
||||
goToRental: function () {
|
||||
wx.navigateTo({
|
||||
url: '/pages/car_new/car_new?type=' + 2
|
||||
});
|
||||
},
|
||||
|
||||
// 跳转到二手车页面
|
||||
goToUsedCar: function () {
|
||||
wx.navigateTo({
|
||||
url: '/pages/car_new/car_new?type=' + 3
|
||||
});
|
||||
},
|
||||
|
||||
async loadBanner() {
|
||||
const data = await request({
|
||||
url: '/admin/wechat/api/banners'
|
||||
});
|
||||
this.setData({ bannerList: data })
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,21 @@
|
|||
const request = require('../../utils/request');
|
||||
Page({
|
||||
data: null,
|
||||
data: {
|
||||
currentImageIndex: 0
|
||||
},
|
||||
onSwiperChange(e) {
|
||||
this.setData({
|
||||
currentImageIndex: e.detail.current
|
||||
});
|
||||
},
|
||||
|
||||
previewImage(e) {
|
||||
const current = e.currentTarget.dataset.src;
|
||||
wx.previewImage({
|
||||
current,
|
||||
urls: this.data.carDetail.cover_image
|
||||
});
|
||||
},
|
||||
onLoad(options) {
|
||||
// 获取车辆ID
|
||||
if (options.id) {
|
||||
|
|
@ -275,58 +290,12 @@ Page({
|
|||
url: `/pages/loan-calculator/loan-calculator?price=${this.data.carDetail.price}`
|
||||
});
|
||||
},
|
||||
|
||||
// 预约看车
|
||||
bookViewing() {
|
||||
wx.navigateTo({
|
||||
url: `/pages/book-viewing/book-viewing?id=${this.data.carId}`
|
||||
});
|
||||
},
|
||||
|
||||
// 举报车辆
|
||||
reportVehicle() {
|
||||
wx.showActionSheet({
|
||||
itemList: ['价格有误', '车况描述不符', '联系方式错误', '其他问题'],
|
||||
success: (res) => {
|
||||
const reasons = ['价格有误', '车况描述不符', '联系方式错误', '其他问题'];
|
||||
const reason = reasons[res.tapIndex];
|
||||
|
||||
wx.showModal({
|
||||
title: '举报确认',
|
||||
content: `您要举报的原因:${reason}`,
|
||||
success: (modalRes) => {
|
||||
if (modalRes.confirm) {
|
||||
// 提交举报
|
||||
this.submitReport(reason);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 提交举报
|
||||
submitReport(reason) {
|
||||
// 这里应该调用举报API
|
||||
wx.showToast({
|
||||
title: '举报成功',
|
||||
icon: 'success'
|
||||
});
|
||||
},
|
||||
|
||||
// 页面下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.loadCarDetail().then(() => {
|
||||
wx.stopPullDownRefresh();
|
||||
});
|
||||
},
|
||||
|
||||
// 页面触底加载
|
||||
onReachBottom() {
|
||||
// 如果有相关推荐车辆,可以在这里加载
|
||||
console.log('触底加载更多');
|
||||
},
|
||||
|
||||
// 用户点击右上角分享
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -7,31 +7,29 @@
|
|||
</view>
|
||||
</van-overlay>
|
||||
|
||||
<!-- 头部图片区域 -->
|
||||
<view class="hero-section">
|
||||
<image
|
||||
src="{{carDetail.cover_image[0]}}"
|
||||
class="car-image"
|
||||
mode="aspectFill"
|
||||
bindtap="previewImage"
|
||||
data-src="{{carDetail.cover_image[0]}}"
|
||||
/>
|
||||
<!-- 头部图片区域 -->
|
||||
<view class="hero-section">
|
||||
<swiper
|
||||
class="car-swiper"
|
||||
indicator-dots="true"
|
||||
autoplay="false"
|
||||
current="{{currentImageIndex}}"
|
||||
bindchange="onSwiperChange"
|
||||
>
|
||||
<block wx:for="{{carDetail.cover_image}}" wx:key="index">
|
||||
<swiper-item>
|
||||
<image
|
||||
src="{{item}}"
|
||||
class="car-image"
|
||||
mode="aspectFill"
|
||||
bindtap="previewImage"
|
||||
data-src="{{item}}"
|
||||
/>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="car-desc">{{carDetail.desc}}</view>
|
||||
|
||||
|
||||
<!-- 图片指示器 -->
|
||||
<view class="image-indicator" wx:if="{{carDetail.cover_image.length > 1}}">
|
||||
<text>1/{{carDetail.cover_image.length}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 更多图片按钮 -->
|
||||
<view class="more-images-btn" bindtap="viewMoreImages" wx:if="{{carDetail.cover_image.length > 1}}">
|
||||
<van-icon name="photo" size="16px" />
|
||||
<text>查看更多</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="car-info-card car-type-{{carDetail.car_type}}">
|
||||
<view class="car-header">
|
||||
|
|
|
|||
|
|
@ -34,7 +34,10 @@
|
|||
overflow: hidden;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.car-swiper{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.car-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const BASE_URL = 'https://car.cherrybless.com'; // 👈 换成你的后端地址
|
||||
const BASE_URL = 'http://car.cherrybless.com'; // 👈 换成你的后端地址
|
||||
|
||||
function request({ url, method = 'GET', data = {}, header = {} }) {
|
||||
const token = '';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user