init
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<view class="diy-banner">
|
||||
<swiper autoplay="{{autoplay}}" bindchange="bindChange" circular="{{true}}" class="banner-box swiper-box dot-{{item.style.btnShape}}" data-item-key="{{item_key}}" duration="{{duration}}" indicatorActiveColor="#000" indicatorColor="{{item.style.btnColor}}" indicatorDots="{{indicatorDots}}" interval="{{interval}}" style="height:{{imgHeights[item_key][ imgCurrent[item_key] ]}}rpx">
|
||||
<navigator hoverClass="none" url="/{{banner.linkUrl}}" wx:for="{{item.data}}" wx:for-item="banner" wx:key="this">
|
||||
<swiper-item itemId="{{index}}">
|
||||
<image bindload="imagesHeight" class="slide-image" data-id="{{index}}" data-item-key="{{item_key}}" src="{{banner.imgUrl}}"></image>
|
||||
</swiper-item>
|
||||
</navigator>
|
||||
</swiper>
|
||||
</view>
|
||||
@@ -0,0 +1,32 @@
|
||||
.diy-banner {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.diy-banner .linear {
|
||||
background: linear-gradient(#111,transparent);
|
||||
height: 3.4rem;
|
||||
left: 0;
|
||||
opacity: .6;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.swiper-box .wx-swiper-dots.wx-swiper-dots-horizontal {
|
||||
margin-bottom: 2rpx;
|
||||
}
|
||||
|
||||
.swiper-box .wx-swiper-dot {
|
||||
height: 20rpx;
|
||||
width: 20rpx;
|
||||
}
|
||||
|
||||
.swiper-box.dot-rectangle .wx-swiper-dot {
|
||||
border-radius: unset;
|
||||
width: 30rpx;
|
||||
}
|
||||
|
||||
.swiper-box.dot-square .wx-swiper-dot {
|
||||
border-radius: unset;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<view class="diy-search-box col-f ts-3">
|
||||
<view class="dis-flex">
|
||||
<view class="diy-search flex-box angle-{{item.style.searchStyle}} text-{{item.style.textAlign}}">
|
||||
<navigator class="cont" hoverClass="none" openType="navigate" url="../search/index">
|
||||
<text class="iconfont icon-sousuo f-30"></text>
|
||||
<text class="f-28">{{item.params.placeholder}}</text>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,43 @@
|
||||
.diy-search-box {
|
||||
background: #f1f1f2;
|
||||
padding: 10px 24rpx;
|
||||
position: unset;
|
||||
}
|
||||
|
||||
.diy-search-box .diy-search {
|
||||
background: #fff;
|
||||
border-bottom: 0;
|
||||
border-radius: unset;
|
||||
box-sizing: border-box;
|
||||
color: #fff;
|
||||
line-height: 60rpx;
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
padding: 0 10px;
|
||||
position: relative;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.diy-search-box .diy-search .cont .icon-sousuo {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.diy-search-box text {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.diy-search-box .diy-search.angle-radius {
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.diy-search-box .diy-search.angle-round {
|
||||
border-radius: 80rpx;
|
||||
}
|
||||
|
||||
.diy-search-box .diy-search.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.diy-search-box .diy-search.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
61
wx214944c362629fc7/pages/index_back/index.js
Normal file
61
wx214944c362629fc7/pages/index_back/index.js
Normal file
@@ -0,0 +1,61 @@
|
||||
var t = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
indicatorDots: !0,
|
||||
autoplay: !0,
|
||||
interval: 3e3,
|
||||
duration: 800,
|
||||
imgHeights: {},
|
||||
imgCurrent: {},
|
||||
items: {},
|
||||
newest: {},
|
||||
best: {},
|
||||
scrollTop: 0
|
||||
},
|
||||
onLoad: function() {
|
||||
t.setTitle(), t.setNavigationBar(), this.getIndexData();
|
||||
},
|
||||
getIndexData: function() {
|
||||
var a = this;
|
||||
t._get("index/page", {}, function(t) {
|
||||
a.setData(t.data);
|
||||
});
|
||||
},
|
||||
imagesHeight: function(t) {
|
||||
var a = t.target.dataset.id, e = t.target.dataset.itemKey, i = 750 / (t.detail.width / t.detail.height), s = this.data.imgHeights;
|
||||
void 0 === s[e] && (s[e] = {}), s[e][a] = i;
|
||||
var n = this.data.imgCurrent;
|
||||
void 0 === n[e] && (n[e] = Object.keys(this.data.items[e].data)[0]), this.setData({
|
||||
imgHeights: s,
|
||||
imgCurrent: n
|
||||
});
|
||||
},
|
||||
bindChange: function(t) {
|
||||
var a = t.target.dataset.itemKey, e = this.data.imgCurrent;
|
||||
e[a] = t.detail.currentItemId, this.setData({
|
||||
imgCurrent: e
|
||||
});
|
||||
},
|
||||
goTop: function(t) {
|
||||
this.setData({
|
||||
scrollTop: 0
|
||||
});
|
||||
},
|
||||
scroll: function(t) {
|
||||
this.setData({
|
||||
indexSearch: t.detail.scrollTop
|
||||
}), t.detail.scrollTop > 300 ? this.setData({
|
||||
floorstatus: !0
|
||||
}) : this.setData({
|
||||
floorstatus: !1
|
||||
});
|
||||
},
|
||||
onShareAppMessage: function() {
|
||||
return {
|
||||
title: "小程序首页",
|
||||
desc: "",
|
||||
path: "/pages/index/index"
|
||||
};
|
||||
}
|
||||
});
|
||||
4
wx214944c362629fc7/pages/index_back/index.json
Normal file
4
wx214944c362629fc7/pages/index_back/index.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
53
wx214944c362629fc7/pages/index_back/index.wxml
Normal file
53
wx214944c362629fc7/pages/index_back/index.wxml
Normal file
@@ -0,0 +1,53 @@
|
||||
<view class="container">
|
||||
<scroll-view bindscroll="scroll" scrollTop="{{scrollTop}}" scrollY="true" style="position:absolute; top:0; left:0; right:0; bottom:0;">
|
||||
<block wx:for="{{items}}" wx:for-index="item_key" wx:key="this">
|
||||
<include src="components/search/search.wxml" wx:if="{{item.type==='search'}}"></include>
|
||||
<include src="components/banner/banner.wxml" wx:if="{{item.type==='banner'}}"></include>
|
||||
</block>
|
||||
<view class="recommended-index-list m-top20">
|
||||
<view class="title-header b-f t-c f-32 col-3">新品推荐</view>
|
||||
</view>
|
||||
<view class="index_sale ">
|
||||
<scroll-view scrollX="true">
|
||||
<navigator hoverClass="none" style="display: inline-block;" url="../goods/index?goods_id={{item.goods_id}}" wx:for="{{newest}}" wx:key="this">
|
||||
<view class="page-column">
|
||||
<view class="sale_img">
|
||||
<image mode="aspectFill" src="{{item.image[0].file_path}}"></image>
|
||||
</view>
|
||||
<view class="content onelist-hidden">
|
||||
<text>{{item.goods_name}}</text>
|
||||
</view>
|
||||
<text class="price col-m f-30">¥{{item.spec[0].goods_price}}</text>
|
||||
</view>
|
||||
</navigator>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="title-hrbg" style="margin-top:10rpx">
|
||||
<text class="cont">
|
||||
<text class="iconfont icon-huo col-m"></text>猜您喜欢 </text>
|
||||
<view class="hr"></view>
|
||||
</view>
|
||||
<view class="category-list">
|
||||
<navigator class="list b-f" hoverClass="none" url="../goods/index?goods_id={{item.goods_id}}" wx:for="{{best}}" wx:key="this">
|
||||
<view class="left">
|
||||
<view class="img">
|
||||
<image class="goodsImg" mode="scaleToFill" src="{{item.image[0].file_path}}"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="cont">
|
||||
<text class="f-30 title twolist-hidden m-top10">{{item.goods_name}}</text>
|
||||
<text class="price f-34 col-m f-w">¥{{item.spec[0].goods_price}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
<view class="title-footer p-r">
|
||||
<text class="f-24 col-9 cont">我是有底线的</text>
|
||||
<view class="hr"></view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view bindtap="goTop" class="widget-goTop" wx:if="{{floorstatus}}">
|
||||
<text class="iconfont icon-fanhuidingbu"></text>
|
||||
</view>
|
||||
</view>
|
||||
110
wx214944c362629fc7/pages/index_back/index.wxss
Normal file
110
wx214944c362629fc7/pages/index_back/index.wxss
Normal file
@@ -0,0 +1,110 @@
|
||||
.diy-search-box {
|
||||
background: #f1f1f2;
|
||||
padding: 10px 24rpx;
|
||||
position: unset;
|
||||
}
|
||||
|
||||
.diy-search-box .diy-search {
|
||||
background: #fff;
|
||||
border-bottom: 0;
|
||||
border-radius: unset;
|
||||
box-sizing: border-box;
|
||||
color: #fff;
|
||||
line-height: 60rpx;
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
padding: 0 10px;
|
||||
position: relative;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.diy-search-box .diy-search .cont .icon-sousuo {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.diy-search-box text {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.diy-search-box .diy-search.angle-radius {
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.diy-search-box .diy-search.angle-round {
|
||||
border-radius: 80rpx;
|
||||
}
|
||||
|
||||
.diy-search-box .diy-search.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.diy-search-box .diy-search.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.diy-banner {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.diy-banner .linear {
|
||||
background: linear-gradient(#111,transparent);
|
||||
height: 3.4rem;
|
||||
left: 0;
|
||||
opacity: .6;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.swiper-box .wx-swiper-dots.wx-swiper-dots-horizontal {
|
||||
margin-bottom: 2rpx;
|
||||
}
|
||||
|
||||
.swiper-box .wx-swiper-dot {
|
||||
height: 20rpx;
|
||||
width: 20rpx;
|
||||
}
|
||||
|
||||
.swiper-box.dot-rectangle .wx-swiper-dot {
|
||||
border-radius: unset;
|
||||
width: 30rpx;
|
||||
}
|
||||
|
||||
.swiper-box.dot-square .wx-swiper-dot {
|
||||
border-radius: unset;
|
||||
}
|
||||
|
||||
.title-hrbg {
|
||||
color: #888;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
margin-top: 30rpx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.title-hrbg .cont {
|
||||
background: #f7f7f7;
|
||||
font-size: 28rpx;
|
||||
padding: 1rem .6rem;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.title-hrbg .cont .icon-huo {
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
|
||||
.title-hrbg .hr {
|
||||
background: #ddd;
|
||||
border: 0;
|
||||
height: 1rpx;
|
||||
left: 10%;
|
||||
margin-top: 1px;
|
||||
position: absolute;
|
||||
right: 10%;
|
||||
top: 50%;
|
||||
z-index: -1;
|
||||
}
|
||||
Reference in New Issue
Block a user