2025/4/29/(1)
This commit is contained in:
parent
c62aa6280a
commit
56bcc8b672
@ -1,5 +1,7 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
bauseUrl:"http://192.168.2.123:8084",
|
// bauseUrl:"http://iwenwiki.com:3001",//公共地址
|
||||||
banner:"/api/banner",
|
bauseUrl:"http://192.168.2.192:8084",
|
||||||
goods:/api/front/pageList/suggest
|
// goods:"/api/goods", //商品列表
|
||||||
|
goods:"/api/front/pagelist/product/0? page=1&limit=10",
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,7 +1,11 @@
|
|||||||
const {require} = require("../utils/request")
|
const {request} = require("../utils/request")
|
||||||
const { goods} = require("./base")
|
const { goods, bauseUrl} = require("./base")
|
||||||
|
|
||||||
|
|
||||||
function getGoods(data){
|
function getGoods(data){
|
||||||
return request()
|
return request(bauseUrl + goods,"GET",data)
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
getGoods
|
||||||
}
|
}
|
||||||
22
app/components/back-to-top/back-to-top.js
Normal file
22
app/components/back-to-top/back-to-top.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
Component({
|
||||||
|
properties: {
|
||||||
|
// 是否显示返回顶部按钮
|
||||||
|
show: {
|
||||||
|
type: Boolean,
|
||||||
|
value: false,
|
||||||
|
observer: function(newVal) {
|
||||||
|
this.setData({ isVisible: newVal });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
isVisible: false
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 触发父页面的返回顶部方法
|
||||||
|
scrollToTop() {
|
||||||
|
// 使用 triggerEvent 触发父页面的事件
|
||||||
|
this.triggerEvent('scrolltomain');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
4
app/components/back-to-top/back-to-top.json
Normal file
4
app/components/back-to-top/back-to-top.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
3
app/components/back-to-top/back-to-top.wxml
Normal file
3
app/components/back-to-top/back-to-top.wxml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<view class="back-to-top" wx:if="{{isVisible}}" bindtap="scrollToTop">
|
||||||
|
<image src="/images/arrow-up.png" mode="aspectFit"></image>
|
||||||
|
</view>
|
||||||
18
app/components/back-to-top/back-to-top.wxss
Normal file
18
app/components/back-to-top/back-to-top.wxss
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
.back-to-top {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 50px;
|
||||||
|
right: 20px;
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
background-color: rgba(85, 84, 84, 0.5);
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-to-top image {
|
||||||
|
width: 35px;
|
||||||
|
height: 35px;
|
||||||
|
}
|
||||||
@ -5,7 +5,10 @@ Component({
|
|||||||
* 组件的属性列表
|
* 组件的属性列表
|
||||||
*/
|
*/
|
||||||
properties: {
|
properties: {
|
||||||
|
goodsData: {
|
||||||
|
type: Array,
|
||||||
|
value: []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,68 +1,18 @@
|
|||||||
<view class="list">
|
<view class="list">
|
||||||
<view class="item">
|
<view class="item" wx:for="{{goodsData}}" wx:key="index">
|
||||||
<view class="goods_img">
|
<view class="goods_img">
|
||||||
<image src="http://iwenwiki.com:3001/images/goods/1.webp" mode="widthFix" />
|
<image mode="widthFix" src="{{item.image}}" />
|
||||||
</view>
|
</view>
|
||||||
<view class="goods_info">
|
<view class="goods_info">
|
||||||
<text class="goods_name">松下(Panasonic)DC-BS1HGK微单相机 数码相机 模块化摄影机 视频 直播多机位 电影</text>
|
<text class="goods_name">{{item.storeName}}</text>
|
||||||
|
<view class="goods_weight">规格:{{item.size}}</view>
|
||||||
<view class="goods_price">
|
<view class="goods_price">
|
||||||
¥<text>21298</text>.00
|
<view>¥<text>{{item.price}}</text></view>
|
||||||
|
|
||||||
|
<view class="goods_gwc" bindtap="addToCart">
|
||||||
|
<image class="cart-icon" src="/images/gouwuche2.png"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
|
||||||
<view class="goods_img">
|
|
||||||
<image src="http://iwenwiki.com:3001/images/goods/1.webp" mode="widthFix" />
|
|
||||||
</view>
|
|
||||||
<view class="goods_info">
|
|
||||||
<text class="goods_name">松下(Panasonic)DC-BS1HGK微单相机 数码相机 模块化摄影机 视频 直播多机位 电影</text>
|
|
||||||
<view class="goods_price">
|
|
||||||
¥<text>21298</text>.00
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="item">
|
|
||||||
<view class="goods_img">
|
|
||||||
<image src="http://iwenwiki.com:3001/images/goods/1.webp" mode="widthFix" />
|
|
||||||
</view>
|
|
||||||
<view class="goods_info">
|
|
||||||
<text class="goods_name">松下(Panasonic)DC-BS1HGK微单相机 数码相机 模块化摄影机 视频 直播多机位 电影</text>
|
|
||||||
<view class="goods_price">
|
|
||||||
¥<text>21298</text>.00
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="item">
|
|
||||||
<view class="goods_img">
|
|
||||||
<image src="http://iwenwiki.com:3001/images/goods/1.webp" mode="widthFix" />
|
|
||||||
</view>
|
|
||||||
<view class="goods_info">
|
|
||||||
<text class="goods_name">松下(Panasonic)DC-BS1HGK微单相机 数码相机 模块化摄影机 视频 直播多机位 电影</text>
|
|
||||||
<view class="goods_price">
|
|
||||||
¥<text>21298</text>.00
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="item">
|
|
||||||
<view class="goods_img">
|
|
||||||
<image src="http://iwenwiki.com:3001/images/goods/1.webp" mode="widthFix" />
|
|
||||||
</view>
|
|
||||||
<view class="goods_info">
|
|
||||||
<text class="goods_name">松下(Panasonic)DC-BS1HGK微单相机 数码相机 模块化摄影机 视频 直播多机位 电影</text>
|
|
||||||
<view class="goods_price">
|
|
||||||
¥<text>21298</text>.00
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="item">
|
|
||||||
<view class="goods_img">
|
|
||||||
<image src="http://iwenwiki.com:3001/images/goods/1.webp" mode="widthFix" />
|
|
||||||
</view>
|
|
||||||
<view class="goods_info">
|
|
||||||
<text class="goods_name">松下(Panasonic)DC-BS1HGK微单相机 数码相机 模块化摄影机 视频 直播多机位 电影</text>
|
|
||||||
<view class="goods_price">
|
|
||||||
¥<text>21298</text>.00
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -18,7 +18,7 @@
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
line-height:1.05rem;
|
line-height:1.05rem;
|
||||||
height: 4.8rem;
|
height: 2rem;
|
||||||
font-family: -apple-system,'Helvetica Neue', sans-serif;
|
font-family: -apple-system,'Helvetica Neue', sans-serif;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
@ -34,3 +34,17 @@
|
|||||||
.list .item .goods_info .goods_price text{
|
.list .item .goods_info .goods_price text{
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
.goods_weight{
|
||||||
|
color: rgb(107, 107, 107);
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
.cart-icon{
|
||||||
|
height: 25px;
|
||||||
|
width: 25px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
.list .item .goods_info .goods_price{
|
||||||
|
display: flex;
|
||||||
|
align-items:center;
|
||||||
|
justify-content:space-between;
|
||||||
|
}
|
||||||
BIN
app/images/arrow-up.png
Normal file
BIN
app/images/arrow-up.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
BIN
app/images/gouwuche2.png
Normal file
BIN
app/images/gouwuche2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
@ -1,6 +1,10 @@
|
|||||||
|
const {
|
||||||
|
getGoods
|
||||||
|
} = require("../../api/index.js")
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
value: "",
|
value: "",
|
||||||
|
showBackToTop: false,
|
||||||
navData: [{
|
navData: [{
|
||||||
id: "1",
|
id: "1",
|
||||||
text: "即将开团",
|
text: "即将开团",
|
||||||
@ -19,14 +23,65 @@ Page({
|
|||||||
icon: "stop-circle-o",
|
icon: "stop-circle-o",
|
||||||
color: "#36ab60"
|
color: "#36ab60"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
page: 1,
|
||||||
|
goodsData: []
|
||||||
},
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.http(this.data.page)
|
||||||
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
点击搜索框获取焦点
|
点击搜索框获取焦点
|
||||||
*/
|
*/
|
||||||
clickSearch(){
|
clickSearch() {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/search/search',
|
url: '/pages/search/search',
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
onScroll(event) {
|
||||||
|
// 获取滚动位置
|
||||||
|
const scrollTop = event.detail.scrollTop;
|
||||||
|
// 当滚动到一定位置时显示返回顶部按钮
|
||||||
|
this.setData({
|
||||||
|
showBackToTop: scrollTop > 300
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
handleScrollToTop() {
|
||||||
|
// console.log("尝试返回顶部");
|
||||||
|
wx.pageScrollTo({
|
||||||
|
scrollTop: 0,
|
||||||
|
duration: 300,
|
||||||
|
// success: () => console.log("返回顶部成功"),
|
||||||
|
// fail: (err) => console.error("返回顶部失败", err)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
http(page) {
|
||||||
|
getGoods({
|
||||||
|
page
|
||||||
|
}).then(res => {
|
||||||
|
if (!res.data.msg) {
|
||||||
|
this.setData({
|
||||||
|
// 老数据合并新数据,做累加操作
|
||||||
|
goodsData: this.data.goodsData.concat(res.data.data)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
//给出用户提示
|
||||||
|
wx.showToast({
|
||||||
|
title: res.data.msg,
|
||||||
|
icon: "success",
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onScrollToLower() {
|
||||||
|
// 更改页面
|
||||||
|
this.setData({
|
||||||
|
page: this.data.page += 1
|
||||||
|
})
|
||||||
|
this.http(this.data.page)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -4,7 +4,8 @@
|
|||||||
"van-search": "@vant/weapp/search/index",
|
"van-search": "@vant/weapp/search/index",
|
||||||
"van-grid": "@vant/weapp/grid/index",
|
"van-grid": "@vant/weapp/grid/index",
|
||||||
"van-grid-item": "@vant/weapp/grid-item/index",
|
"van-grid-item": "@vant/weapp/grid-item/index",
|
||||||
"goods-list":"/components/goods-list/goods-list"
|
"goods-list":"/components/goods-list/goods-list",
|
||||||
|
"back-to-top":"/components/back-to-top/back-to-top"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,4 +1,7 @@
|
|||||||
<view class="head">
|
<view class="head">
|
||||||
|
<scroll-view scroll-y style="height: 100vh;" bindscroll="onScroll"
|
||||||
|
bindscrolltolower="onScrollToLower">
|
||||||
|
<!-- 页面内容 -->
|
||||||
<view class="head_a">
|
<view class="head_a">
|
||||||
<view class="head_b">
|
<view class="head_b">
|
||||||
<!-- <view class="head_c">
|
<!-- <view class="head_c">
|
||||||
@ -12,10 +15,20 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="head_box" >
|
<view class="head_box" >
|
||||||
<van-grid column-num="3" gutter="10" border="{{false}}">
|
<van-grid column-num="3" gutter="10" border="{{false}}">
|
||||||
<van-grid-item wx:for="{{navData}}" wx:key="id" icon="{{item.icon}}" text="{{item.text}}" icon-color="{{item.color}}" />
|
<van-grid-item
|
||||||
|
wx:key="index"
|
||||||
|
wx:for="{{navData}}" wx:key="id" icon="{{item.icon}}" text="{{item.text}}" icon-color="{{item.color}}" />
|
||||||
</van-grid>
|
</van-grid>
|
||||||
<goods-list></goods-list>
|
<goods-list goodsData="{{goodsData}}"></goods-list>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- -->
|
||||||
|
<back-to-top show="{{showBackToTop}}" bind:scrolltomain="handleScrollToTop"></back-to-top>
|
||||||
|
<view wx:if="{{!hasMore}}" style="text-align: center; padding: 20px; color: #999;">
|
||||||
|
已经到底啦,往上看看吧
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|||||||
@ -19,13 +19,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
/* .head_c{
|
|
||||||
position: relative;
|
|
||||||
bottom: 10px;
|
|
||||||
display: flex;
|
|
||||||
align-items:center;
|
|
||||||
justify-content:space-between;
|
|
||||||
} */
|
|
||||||
.van-search{
|
.van-search{
|
||||||
width: 360px;
|
width: 360px;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
const {
|
||||||
|
getGoods
|
||||||
|
} = require("../../api/index.js")
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -5,6 +8,7 @@ Page({
|
|||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
searchText: ""
|
searchText: ""
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"van-search": "@vant/weapp/search/index",
|
"van-search": "@vant/weapp/search/index",
|
||||||
"van-button": "@vant/weapp/button/index"
|
"van-button": "@vant/weapp/button/index",
|
||||||
|
"goods-list":"/components/goods-list/goods-list"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9,4 +9,6 @@
|
|||||||
|
|
||||||
</van-search>
|
</van-search>
|
||||||
<van-button style="margin-right: 10px;" type="primary" size="small" slot="action" bind:tap="onSearchCliclk">搜索</van-button>
|
<van-button style="margin-right: 10px;" type="primary" size="small" slot="action" bind:tap="onSearchCliclk">搜索</van-button>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
<goods-list goodsData="{{goodsData}}"></goods-list>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user