Commit 1fa9c5ee by luyt

feat:选中场景,产品下标

1 parent af2a3c32
......@@ -18,6 +18,27 @@ Component({
senceData: Array,
headerHeight: Number,
},
computed: {
// 特色产品
prodList(data) {
if(data.mainActiveIndex == 0){
return data.senceData[data.tabActive].productList
}else{
let type = data.items[data.mainActiveIndex].type
return data.senceData[data.tabActive].productList.filter(item=>item.type == type )
}
},
// 视频
prodVideoList(data){
return data.senceData[data.tabActive].videoList
},
// 海报
prodPosterList(data){
return data.senceData[data.tabActive].posterList
},
},
// 默认已深度监听
watch: {
'tabActive': function (a, b) {
......@@ -36,7 +57,8 @@ Component({
refresherFlag: true,
IMG_URL,
// 头部tab
tabActive: 0,
tabActive: 3,
tabHeaderShow:false,
items: [
{
text: "全部",
......@@ -46,8 +68,12 @@ Component({
mainActiveIndex: 0,
contentHeight: 0,
// 视频海报
videoActive: 1,
videoActive: 0,
overlayShow: false,
checkPosterItem:{
src:`${IMG_URL}index/poster/poster3-0.png`
},
// checkVideoItem:{}
},
lifetimes: {
attached() {
......@@ -72,6 +98,13 @@ Component({
});
});
query.exec();
//头部tab显示
setTimeout(() => {
this.setData({
tabHeaderShow:true
})
},200)
},
},
/**
......@@ -127,7 +160,7 @@ Component({
onclickVideoTab(event) {
// console.log('event: ', event);
let videoActive = +event.currentTarget.dataset.num;
console.log("videoActive: ", videoActive);
// console.log("videoActive: ", videoActive);
this.setData({
videoActive,
});
......@@ -146,6 +179,41 @@ Component({
tabActive:index
})
},
checkProd(e){
let {tabActive} = this.data
// let item = e.currentTarget.dataset.item
let index = e.currentTarget.dataset.index
let obj = {
actNum:tabActive, //选中的场景
activeNavIdx:index //选中的产品
}
wx.$router.go("/pages/viewProd/index",obj)
},
// 查看海报 视频
checkVideo(e){
// console.log('e: ', e);
let {tabActive} = this.data
// let item = e.currentTarget.dataset.item
let index = e.currentTarget.dataset.index
// this.setData({
// checkVideoItem:item
// })
let obj = {
tabActive,
videoIndex:index
}
wx.$router.go("/pages/viewVideo/index",obj)
},
checkPoster(e){
// console.log('e: ', e);
let item = e.currentTarget.dataset.item
this.setData({
checkPosterItem:item,
overlayShow:true
})
},
// 选车场景切换
selectCar(e) {
......
......@@ -104,6 +104,9 @@
// }
.page-pro {
.pro-head {
.pro-head-hidden{
visibility: hidden;
}
.van-tabs__line {
width: 40rpx !important;
height: 8rpx;
......@@ -186,7 +189,7 @@
.list {
}
.pro {
margin-right: 20rpx;
margin-right: 14rpx;
margin-bottom: 20rpx;
display: inline-block;
width: 176rpx;
......@@ -195,6 +198,9 @@
border: 2rpx solid #ffffff;
box-shadow: 0 8rpx 20rpx 0 rgba(180, 186, 204, 0.32);
border-radius: 8rpx;
&:nth-child(3n+3){
margin-right: 0;
}
.pro-img {
margin: 0 auto;
width: 176rpx;
......@@ -206,6 +212,9 @@
line-height: 52rpx;
font-size: 24rpx;
color: #323436;
overflow: hidden;//溢出隐藏
white-space: nowrap;//禁止换行
text-overflow: ellipsis;//...
}
}
}
......
<view class="page-wrapper page-pro">
<view class="pro-head">
<van-tabs active="{{ tabActive }}" bind:change="onTabChange">
<van-tabs active="{{ tabActive }}" class="{{tabHeaderShow?'':'pro-head-hidden'}}" bind:change="onTabChange">
<van-tab wx:for="{{senceData}}" wx:key="index" title="{{item.tabname}}">
<image class="pro-banner" src="{{item.banner}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" />
</van-tab>
......@@ -16,9 +16,9 @@
<view class="tab-pro">
<view class="title">特色产品</view>
<view class="list">
<view class="pro">
<image class="pro-img" src="{{IMG_URL}}index/prod2/prod0-0.png" />
<view class="pro-name">数字无忧权益卡</view>
<view class="pro" wx:for="{{prodList}}" wx:key="index" data-item="{{item}}" data-index="{{index}}" bindtap="checkProd">
<image class="pro-img" src="{{item.prodImg}}?v={{img_version}}" />
<view class="pro-name">{{item.productName}}</view>
</view>
</view>
</view>
......@@ -33,18 +33,16 @@
</view>
</view>
<view class="video-cont" wx:if="{{videoActive == 0}}">
<video-item even-class=""></video-item>
<video-item even-class="even-class"></video-item>
<video-item></video-item>
<video-item wx:for="{{prodVideoList}}" wx:key="index" even-class="{{index%2?'even-class':''}}" item="{{item}}" data-item="{{item}}" data-index="{{index}}" bindtap="checkVideo"></video-item>
<!-- 无 -->
<image wx:if="{{false}}" class="empty" src="{{IMG_URL}}index/no-video.png?v={{img_version}}" />
<image wx:if="{{prodVideoList.length == 0}}" class="empty" src="{{IMG_URL}}index/no-video.png?v={{img_version}}" />
</view>
<view class="poster-cont" wx:else>
<poster-item even-class=""></poster-item>
<poster-item even-class="even-class"></poster-item>
<poster-item></poster-item>
<poster-item wx:for="{{prodPosterList}}" wx:key="index" even-class="{{index%2?'even-class':''}}" item="{{item}}" data-item="{{item}}" bindtap="checkPoster"></poster-item>
<!-- <poster-item even-class="even-class"></poster-item>
<poster-item></poster-item> -->
<!-- 无 -->
<image wx:if="{{false}}" class="empty" src="{{IMG_URL}}index/no-video.png?v={{img_version}}" />
<image wx:if="{{prodPosterList.length == 0}}" class="empty" src="{{IMG_URL}}index/no-video.png?v={{img_version}}" />
</view>
</view>
</view>
......@@ -63,7 +61,7 @@
<!-- 图片预览弹窗 -->
<van-overlay show="{{ overlayShow }}" z-index="100">
<view class="overlay-wrap">
<image class="overlay-img" show-menu-by-longpress src="{{IMG_URL}}index/poster/poster0-0.png?v={{img_version}}" />
<image class="overlay-img" show-menu-by-longpress src="{{checkPosterItem.src}}?v={{img_version}}" />
<view class="overlay-msg">
<image class="hand" src="{{IMG_URL}}index/hand.png?v={{img_version}}"/>
<view class="forward">长按图片转发</view>
......
<!-- pages/tab/index/components/poster-item/index.wxml -->
<view class="poster-item even-class">
<image class="img" src="{{IMG_URL}}index/poster/poster0-0.png?v={{img_version}}" />
<image class="img" src="{{item.src}}?v={{img_version}}" />
<view class="msg">生成专属海报</view>
</view>
<!-- <view class="poster-item">
......
......@@ -29,10 +29,19 @@
margin-bottom: 12rpx;
margin-left:16rpx;
margin-right: 16rpx;
height: 80rpx;
// height: 80rpx;
font-weight: 500;
font-size: 26rpx;
color: #323436;
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
word-wrap: break-word;
white-space: normal !important;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.detail{
display: flex;
......
<!-- pages/tab/index/components/video-item/index.wxml -->
<view class="video-item even-class">
<image class="play" src="{{IMG_URL}}index/poster/play.png?v={{img_version}}" />
<!-- <image class="img" src="{{item.posterUrl}}?v={{img_version}}" alt="" /> -->
<image class="img" src="{{IMG_URL}}index/poster/poster0-0.png?v={{img_version}}" alt="" />
<view class="name">30秒告诉你数字无忧卡是什么</view>
<view class="name">{{item.name}}</view>
<view class="detail">
<image class="avtor" src="{{IMG_URL}}index/poster/avtor.png?v={{img_version}}" />
<view class="location">嘀加智慧</view>
<view class="location">{{item.manufacturer}}</view>
<image class="check" src="{{IMG_URL}}index/poster/check.png?v={{img_version}}" />
<view class="num">12345</view>
<view class="num">{{item.view}}</view>
</view>
</view>
<!-- <view class="video-item">
......
import { IMG_URL } from "~/utils/constantData.js";
const videoBaseUrl = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
var senceData = [
{
name: '新车洽谈场景',
......@@ -33,34 +34,41 @@ var senceData = [
"productCode":"PC001",
"productName":"数字无忧权益卡",
"category":"服务类",
prodImg: `${IMG_URL}index/prod2/prod0-0.png`,
}
],
videoList: [
{
videoUrl: 'digital_card_30s',
posterUrl: 'digital_card_30s_bitmap',
videoUrl: `${videoBaseUrl}video/digital_card_30s.mp4`,
posterUrl: `${videoBaseUrl}video/digital_card_30s_bitmap.png`,
name: '数字无忧卡服务30秒',
view:1004
manufacturer:'嘀加智慧',
view:1004,
},
{
videoUrl: 'digital_card_money3',
posterUrl: 'digital_card_money3_bitmap',
videoUrl: `${videoBaseUrl}video/digital_card_money3.mp4`,
posterUrl: `${videoBaseUrl}video/digital_card_money3_bitmap.png`,
name: '数字无忧卡3道钱',
manufacturer:'嘀加智慧',
view:1563
},
{
videoUrl: 'digital_card',
posterUrl: 'digital_card_bitmap',
videoUrl: `${videoBaseUrl}video/digital_card.mp4`,
posterUrl: `${videoBaseUrl}video/digital_card_bitmap.png`,
name: '数字无忧卡服务',
manufacturer:'嘀加智慧',
view:1320
},
{
videoUrl: 'digital_card_reason6',
posterUrl: 'digital_card_reason6_bitmap',
videoUrl: `${videoBaseUrl}video/digital_card_reason6.mp4`,
posterUrl: `${videoBaseUrl}video/digital_card_reason6_bitmap.png`,
name: '数字无忧卡6大理由',
manufacturer:'嘀加智慧',
view:1485
}
]
],
posterList:[]
},
{
name: '新车交付场景',
......@@ -94,16 +102,19 @@ var senceData = [
"productCode":"PC002",
"productName":"汽车太阳膜",
"category":"膜类",
prodImg: `${IMG_URL}index/prod2/prod1-0.png`,
}
],
videoList:[
{
videoUrl: 'solar',
posterUrl: 'solar_bitmap',
videoUrl: `${videoBaseUrl}video/solar.mp4`,
posterUrl: `${videoBaseUrl}video/solar_bitmap.png`,
name: '太阳膜转化售中案例-门店新增产值12w每月',
manufacturer:'嘀加智慧',
view:1178
}
]
],
posterList:[]
},
{
name: '0-6个月',
......@@ -137,6 +148,7 @@ var senceData = [
"productCode":"PC003",
"productName":"漆面保护膜(车衣)",
"category":"膜类",
prodImg: `${IMG_URL}index/prod2/prod2-0.png`,
},
{
img: 'product-img4',
......@@ -152,8 +164,11 @@ var senceData = [
"productCode":"PC004",
"productName":"改色膜",
"category":"膜类",
prodImg: `${IMG_URL}index/prod2/prod2-1.png`,
}
]
],
videoList:[],
posterList:[]
},
{
name: '6个月以上',
......@@ -187,6 +202,7 @@ var senceData = [
"productCode":"PC005",
"productName":"数字化美容",
"category":"美容类",
prodImg: `${IMG_URL}index/prod2/prod3-4.png`,
},
{
img: 'product-img6',
......@@ -202,6 +218,7 @@ var senceData = [
"productCode":"PC006",
"productName":"座椅通风",
"category":"轻改类",
prodImg: `${IMG_URL}index/prod2/prod3-3.png`,
},
{
img: 'product-img7',
......@@ -217,6 +234,7 @@ var senceData = [
"productCode":"PC007",
"productName":"AR导航",
"category":"轻改类",
prodImg: `${IMG_URL}index/prod2/prod3-0.png`,
},
{
img: 'product-img8',
......@@ -232,6 +250,7 @@ var senceData = [
"productCode":"PC008",
"productName":"氛围灯",
"category":"轻改类",
prodImg: `${IMG_URL}index/prod2/prod3-2.png`,
},
{
img: 'product-img9',
......@@ -247,33 +266,57 @@ var senceData = [
"productCode":"PC009",
"productName":"360全景导航",
"category":"轻改类",
prodImg: `${IMG_URL}index/prod2/prod3-1.png`,
}
],
videoList: [
{
videoUrl: 'seat',
posterUrl: 'seat_bitmap',
videoUrl: `${videoBaseUrl}video/seat.mp4`,
posterUrl: `${videoBaseUrl}video/seat_bitmap.png`,
name: '座椅通风系统-新增产值20w',
manufacturer:'嘀加智慧',
view:1365
},
{
videoUrl: 'AR',
posterUrl: 'AR_bitmap',
videoUrl: `${videoBaseUrl}video/AR.mp4`,
posterUrl: `${videoBaseUrl}video/AR_bitmap.png`,
name: '单品AR导航-新增产值20w+',
manufacturer:'嘀加智慧',
view:1172
},
{
videoUrl: 'light',
posterUrl: 'light_bitmap',
videoUrl: `${videoBaseUrl}video/light.mp4`,
posterUrl: `${videoBaseUrl}video/light_bitmap.png`,
name: '单品类氛围灯-新增产值27w',
manufacturer:'嘀加智慧',
view:1006
},
{
videoUrl: '360_AR',
posterUrl: '360_AR_bitmap',
videoUrl: `${videoBaseUrl}video/360_AR.mp4`,
posterUrl: `${videoBaseUrl}video/360_AR_bitmap.png`,
name: '360全景导航-新增产值57w+',
manufacturer:'嘀加智慧',
view:1891
}
],
posterList:[
{
src:`${IMG_URL}index/poster/poster3-0.png`,
name:'劲爆来袭'
},
{
src:`${IMG_URL}index/poster/poster3-1.png`,
name:'疯狂让利'
},
{
src:`${IMG_URL}index/poster/poster3-2.png`,
name:'娱乐系统'
},
{
src:`${IMG_URL}index/poster/poster3-3.png`,
name:'AR实景导航'
}
]
},
// {
......
......@@ -27,6 +27,7 @@ Page({
},
/**
* 生命周期函数--监听页面加载
* 分享出去,或扫码进来
*/
onLoad(options) {
if (!options || utils.isEmptyObj(options)) return
......@@ -58,8 +59,8 @@ Page({
let { actNum = 0, activeNavIdx = 0 } = options;
this.setData({
actNum,
activeNavIdx,
actNum, //选中的场景下标
activeNavIdx, //选中的产品
});
// 设置标题
......
// pages/viewVideo/index.js
import { IMG_URL } from '~/utils/constantData.js'
import { IMG_URL } from "~/utils/constantData.js";
import { senceData } from "~/pages/tab/index/constant/data";
// 导入方法
import { behavior as computedBehavior } from "~/utils/lib/miniprogram-computed";
Page({
// 混入
behaviors: [computedBehavior],
/**
* 页面的初始数据
*/
data: {
IMG_URL,
videoSrc:''
videoSrc: "",
senceData,
tabActive: 0, //场景值
videoIndex: 0, //场景中的视频下表
},
// 使用
computed: {
videoitem(data) {
let { senceData, tabActive, videoIndex } = data;
return senceData[tabActive].videoList[videoIndex];
},
videoLeft(data) {
let { senceData, tabActive, videoIndex } = data;
// return senceData[tabActive].videoList.filter((item,index) => index != videoIndex)
return senceData[tabActive].videoList;
},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
onLoad(options) {},
//接受跳转的路由参数(小程序页面跳转)
onRoute(options) {
console.log("options: ", options);
this.setData({
tabActive: options.tabActive,
videoIndex: options.videoIndex,
});
wx.setNavigationBarTitle({
title: '当前页面当前页面当前页面当前页面当前页面'
})
title: "当前页面当前页面当前页面当前页面当前页面",
});
},
changeVideo(e) {
let { index } = e.currentTarget.dataset;
this.setData({
videoIndex: index,
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file
onShareAppMessage() {},
});
<!--pages/viewVideo/index.wxml-->
<view class="view-video" >
<video class="frame" src=""></video>
<!-- poster="{{videoitem.posterUrl}}?v={{img_version}}" -->
<video class="frame" src="{{videoitem.videoUrl}}"></video>
<view class="title-wrap">
<view class="title" >
单品AR导航-新增产值20w+
{{videoitem.name}}
</view>
<image class="check" src="{{IMG_URL}}index/poster/check.png?v={{img_version}}" />
<view class="num">
3256
{{videoitem.view}}
</view>
</view>
<view class="gus-like">
......@@ -16,9 +17,11 @@
<view class="gus-list">
<scroll-view scroll-x="true" style="height: 336rpx;">
<view class="gus-scroll">
<video-item></video-item>
<video-item></video-item>
<video-item></video-item>
<block wx:for="{{videoLeft}}" wx:key="index">
<video-item wx:if="{{index != videoIndex}}" item="{{item}}" data-index="{{index}}" bindtap="changeVideo"></video-item>
</block>
</view>
</scroll-view>
</view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!