Commit 96f68995 by zhangquan

dev:发现页开发

1 parent 89bd9f45
...@@ -6,7 +6,7 @@ page { ...@@ -6,7 +6,7 @@ page {
color: #282829; color: #282829;
font-size: 28rpx; font-size: 28rpx;
--themeColor: #F13C3D; --themeColor: #F13C3D;
--btnColor: #FC5B32; --btnColor: #3666FE;
--borderRadius: 8rpx; --borderRadius: 8rpx;
--margin: 32rpx; --margin: 32rpx;
} }
......
// components/Tab/Tab.js // components/Tab/Tab.js
import {componentsMixin } from '../../mixins/index'
Component({ Component({
behaviors:[componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
width: 100%; width: 100%;
height: 92rpx; height: 92rpx;
box-sizing: border-box; box-sizing: border-box;
border-bottom: 1rpx solid #EAEBEF;
} }
.tab-box.left{ .tab-box.left{
padding-left: 32rpx; padding-left: 32rpx;
...@@ -25,8 +26,12 @@ ...@@ -25,8 +26,12 @@
display: flex; display: flex;
align-items: center; align-items: center;
box-sizing: border-box; box-sizing: border-box;
color: #A9A9A9; color: #8A8C90;
justify-content: center; justify-content: center;
margin: 0 24rpx;
font-weight: 400;
font-size: 28rpx;
font-family: PingFangSC-Medium;
} }
.left .text{ .left .text{
justify-content: flex-start; justify-content: flex-start;
...@@ -39,14 +44,14 @@ ...@@ -39,14 +44,14 @@
font-weight: 500; font-weight: 500;
font-size: 28rpx; font-size: 28rpx;
transition: all .25s; transition: all .25s;
color: #2C2C2C; color: var(--btnColor);
} }
.tab .line { .tab .line {
width: 48rpx; width: 48rpx;
height: var(--borderRadius); height: var(--borderRadius);
background: var(--btnColor); background: var(--btnColor);
border-radius: 2rpx; border-radius: 8rpx 8rpx 0 0;
margin: 0 auto; margin: 0 auto;
transform: scale(0); transform: scale(0);
transition: all .25s; transition: all .25s;
......
import {IMG_URL} from '~/utils/constantData'
module.exports = Behavior({
data: {
IMGURL: IMG_URL
}
})
\ No newline at end of file \ No newline at end of file
import imgUrlMixin from './imgUrl'
module.exports = { module.exports = {
imgUrlMixin
} }
\ No newline at end of file \ No newline at end of file
// pages/tab/discovery/components/headerNav/headerNav.js
const navStyle = "background-color: transparent;";
import {imgUrlMixin} from '~/mixins/index'
Component({
behaviors: [imgUrlMixin],
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
navStyle,
// IMG_URL,
sceneList:['scene_talk.png','scene_delivery.png','scene_within_12mth.png','scene_more_12mth.png'],
},
navbarReady(e) {
let {
height
} = e.detail;
this.setData({
user_box_style: `padding-top:${height + 20}px`,
});
},
/**
* 组件的方法列表
*/
methods: {
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* pages/tab/discovery/components/headerNav/headerNav.wxss */
.header{
position: relative;
width: 100%;
height: 304rpx;
margin-bottom: 80rpx;
box-shadow: 0 16rpx 16rpx 0 rgba(230, 236, 245, 0.6);
}
.scene-wrap{
position: absolute;
bottom: 0;
transform: translateY(75rpx);
white-space: nowrap;
}
.scene-item{
width: 672rpx;
height: 180rpx;
}
\ No newline at end of file \ No newline at end of file
<!--pages/tab/discovery/components/headerNav/headerNav.wxml-->
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="发现">
<text>发现</text>
</navigation-bar>
<view class="header">
<image style="width: 100%;height: 100%" src="{{IMGURL}}discovery_center_bg.png"></image>
<scroll-view class="scene-wrap" scroll-x="{{true}}">
<block wx:for="{{sceneList}}" wx:key="index">
<image class="scene-item" src="{{IMGURL}}{{item}}"></image>
</block>
</scroll-view>
</view>
// pages/tab/discovery/components/product/product.js
import {imgUrlMixin} from '~/mixins/index'
Component({
behaviors: [imgUrlMixin],
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
navList:['360全景导航','AR实景导航','座椅通风','氛围灯','数字化美容'],
activeNavIdx: 0,
tab:['适用场景','营销链路','项目亮点','适用场景','转化漏斗','合作流程','适用场景','营销链路','项目亮点','适用场景','转化漏斗','合作流程'],
heightArr:[],
curTabIdx:0,
intoViewId: 'to-0'
},
lifetimes:{
ready: function (){
console.log(11111)
this.getImgHeight()
},
},
/**
* 组件的方法列表
*/
methods: {
changeTab(e){
let idx = e.detail
this.setData({
intoViewId: `to-${idx}`
})
},
changeNav(event){
console.log(event,event.target.dataset.index,111)
this.setData({
activeNavIdx: event.target.dataset.index
})
},
scrolltoupper(event){
const idx = this.data.heightArr.findIndex(item => item>event.detail.scrollTop)
this.setData({
curTabIdx: idx
})
console.log(this.data.curTabIdx1)
},
getImgHeight(){
let query = wx.createSelectorQuery().in(this)
let heightArr = []
let s = 0
query.selectAll('.img-item').boundingClientRect((react) => {
react.forEach(item => {
s += item.height
heightArr.push(s)
})
this.data.heightArr = heightArr
console.log( this.data.heightArr)
}).exec()
}
}
})
{
"component": true,
"usingComponents": {
"tab": "../../../../../components/Tab/Tab"
}
}
\ No newline at end of file \ No newline at end of file
// 特色产品
.prod-wrap .big-title{
margin-left: 40rpx;
font-family: PingFangSC-S0pxibold;
font-weight: 600;
font-size: 36rpx;
color: #1B233D;
line-height: 56rpx;
}
.prod-wrap .nav-wrap{
white-space: nowrap;
box-sizing: border-box;
margin-top: 24rpx;
margin-bottom: 32rpx;
padding: 0 20rpx;
}
.prod-wrap .nav-wrap .nav{
display: inline-block;
width: 188rpx;
height: 64rpx;
border-radius: 12rpx;
font-weight: 600;
font-size: 24rpx;
letter-spacing: 0;
text-align: center;
font-family: PingFangSC-Regular;
line-height: 64rpx;
margin-right: 12rpx;
background: #FFFFFF;
border: 2rpx solid #DDE3F0;
}
.prod-wrap .nav-wrap .active-nav{
background-image: linear-gradient(0deg, #EBEFFF 8%, #FCFDFF 85%);
border: 2rpx solid rgba(68,97,240,0.50);
box-shadow: 0 8rpx 16rpx 0 rgba(175,187,219,0.35);
}
.prod-wrap .nav-wrap .nav:last-child{
margin-right: 0;
}
.prod-item{
background-color: #F5F7FB;
border-radius: 48rpx 48rpx 0 0;
padding: 40rpx 24rpx 32rpx;
}
.prod-card{
display: flex;
height: 208rpx;
background-image: linear-gradient(1deg, #FFFFFF 10%, #FDFCFF 100%);
border: 2rpx solid #FFFFFF;
box-shadow: 0 8rpx 20rpx 0 rgba(197,205,235,0.35);
border-radius: 20rpx;
padding: 20rpx 24rpx;
box-sizing: border-box;
position: relative;
}
.prod-card .card-img{
width: 160rpx;
height: 160rpx;
flex-shrink: 0;
border-radius: 4rpx;
}
.img-desc{
position: absolute;
width: 104rpx;
height: 40rpx;
line-height: 40rpx;
background: #D7F5EB;
border-radius: 4rpx;
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 24rpx;
color: #24B38C;
letter-spacing: 0;
text-align: center;
}
.prod-info{
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 12rpx 0;
margin-left: 24rpx;
}
.prod-info>text{
display: block;
white-space: nowrap;
height: 40rpx;
line-height: 40rpx;
}
.prod-info .title{
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 28rpx;
color: #323436;
}
.prod-info .sale,.prod-info .earnings{
font-size: 26rpx;
color: #7A8299;
}
.prod-info .sale-num{
font-size: 26rpx;
color: #323436;
}
.prod-info .earnings-num{
font-size: 28rpx;
font-family: DINAlternate-Bold;
font-weight: Bold;
color: #F35251;
}
.share-btn{
height: 56rpx;
line-height: 56rpx;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 24rpx;
background-image: linear-gradient(-60deg, #556AF5 0%, #7197FF 100%);
border-radius: 12rpx;
color: #fff;
padding: 0 20rpx;
display: flex;
align-items: center;
position: absolute;
right: 24rpx;
top: 50%;
transform: translateY(-50%);
}
.share-btn .icon{
width: 24rpx;
height: 24rpx;
margin-right: 8rpx;
}
.project-wrap{
background-color: #F5F7FB;
}
.project-img{
height: 500rpx;
white-space: nowrap;
.img-item{
height: 300rpx;
}
}
\ No newline at end of file \ No newline at end of file
<!--pages/tab/discovery/components/product/product.wxml-->
<view class="prod-wrap">
<text class="big-title">特色产品</text>
<scroll-view class="nav-wrap" scroll-x="{{true}}">
<block wx:for="{{navList}}" wx:key="index">
<text class='nav {{activeNavIdx==index ? "active-nav": ""}}' bindtap="changeNav" data-index="{{index}}">{{item}}</text>
</block>
</scroll-view>
<view class="prod-item">
<view class="prod-card">
<view class="card-img">
<text class="img-desc">轻改类</text>
<image src="{{IMGURL}}discovery_prod1.png"></image>
</view>
<view class="prod-info">
<text class="title">360全景导航</text>
<text class="sale">新车销量 <text class="sale-num">100</text></text>
<text class="earnings">预估收益 <text class="earnings-num">92.4 万</text></text>
</view>
<view class="share-btn">
<image class="icon" src="{{IMGURL}}share.png"></image>
<text>分享</text>
</view>
</view>
</view>
</view>
<view class="project-wrap">
<tab openScroll="{{true}}" tab="{{tab}}" index="{{curTabIdx}}" bindclick="changeTab"></tab>
<scroll-view class="project-img" scroll-into-view="{{intoViewId}}" bindscroll="scrolltoupper" scroll-y="{{true}}">
<block wx:for="{{tab}}" wx:key="index">
<view id="to-{{index}}" class="img-item">
{{item}}
</view>
</block>
</scroll-view>
</view>
...@@ -7,14 +7,14 @@ Page({ ...@@ -7,14 +7,14 @@ Page({
data: { data: {
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
}, },
methods:{
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
......
{ {
"usingComponents": {} "usingComponents": {
"headerNav": "./components/headerNav/headerNav",
"product": "./components/product/product"
},
"navigationStyle": "custom"
} }
\ No newline at end of file \ No newline at end of file
/* pages/tab/output/output.wxss */ /* pages/tab/output/output.wxss */
<!--pages/tab/output/output.wxml--> <view style="background: #fff;">
<text>pages/tab/output/output.wxml</text> <headerNav></headerNav>
<product></product>
</view>
\ No newline at end of file \ No newline at end of file
...@@ -55,6 +55,13 @@ ...@@ -55,6 +55,13 @@
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
},
{
"name": "",
"pathName": "pages/tab/discovery/discovery",
"query": "",
"launchMode": "default",
"scene": null
} }
] ]
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!