dev
xiaowen 3 years ago
parent 6642875d34
commit f0d39648ca

@ -46,7 +46,7 @@
"text": "洞察" "text": "洞察"
}, },
{ {
"pagePath": "pages/brandCrisis/index", "pagePath": "pages/brandSearch/index",
"iconPath": "/custom-tab-bar/icons/appSearch.png", "iconPath": "/custom-tab-bar/icons/appSearch.png",
"selectedIconPath": "/custom-tab-bar/icons/appSearchActive.png", "selectedIconPath": "/custom-tab-bar/icons/appSearchActive.png",
"text": "品牌搜索" "text": "品牌搜索"
@ -93,7 +93,8 @@
"van-dialog": "@vant/weapp/dialog/index", "van-dialog": "@vant/weapp/dialog/index",
"van-row": "@vant/weapp/row/index", "van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index", "van-col": "@vant/weapp/col/index",
"van-divider": "@vant/weapp/divider/index" "van-divider": "@vant/weapp/divider/index",
"van-toast": "@vant/weapp/toast/index"
} }
} }

@ -16,7 +16,7 @@ Component({
"text": "洞察" "text": "洞察"
}, },
{ {
"pagePath": "pages/brandCrisis/index", "pagePath": "pages/brandSearch/index",
"iconPath": "icons/appSearch.png", "iconPath": "icons/appSearch.png",
"selectedIconPath": "icons/appSearchActive.png", "selectedIconPath": "icons/appSearchActive.png",
"text": "", "text": "",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

@ -8,36 +8,10 @@ Page({
height:app.globalData.navBarHeight + app.globalData.statusBarHeight, height:app.globalData.navBarHeight + app.globalData.statusBarHeight,
statusBarHeight:app.globalData.statusBarHeight, statusBarHeight:app.globalData.statusBarHeight,
navBarHeight:app.globalData.navBarHeight, navBarHeight:app.globalData.navBarHeight,
navData: [ navData: [],
{ sourceData: [],
img: "./cars/audi.jpg", mockData: [],
title: "奥迪" heightTop: 210
},
{
img: "./cars/audi.jpg",
title: "奥迪"
},
{
img: "./cars/audi.jpg",
title: "奥迪"
},
{
img: "./cars/audi.jpg",
title: "奥迪"
},
{
img: "./cars/audi.jpg",
title: "奥迪"
},
{
img: "./cars/audi.jpg",
title: "奥迪"
},
{
img: "./cars/audi.jpg",
title: "奥迪"
}
]
}, },
onLaunch() { onLaunch() {
wx.getSystemInfo({ wx.getSystemInfo({
@ -54,6 +28,71 @@ Page({
}, },
onShow() { onShow() {
this.getTabBar().init(); this.getTabBar().init();
this.getData();
this.createSelectorQuery().select(".nav-top").boundingClientRect(res => {
if (res) {
const { height } = res;
this.setData({
heightTop: height
})
}
}).exec();
},
handlerSearch(e) {
let val = e.detail;
const arr = this.data.sourceData.filter(ele => {
return ele.brandname.toLowerCase().indexOf(val.toLowerCase()) != -1
})
this.setData({
navData: arr
})
}, },
handlerChoose(e) {
const row = e.currentTarget.dataset.row;
wx.setStorageSync('sBrand', row.brandname);
},
getData() {
//页面数据
wx.showToast({
title: '加载中',
icon: 'loading',
duration: 30000
})
app.globalData.request({
action: 'getUserBrand',
token: 't%2BrswgjvzGM=',
}).then(res => {
let arr = [];
for (let i = 65; i <= 90; i++) {
arr.push({
name: String.fromCharCode(i),
data: []
});
}
for(let i of res){
for(let j of arr){
if(i.firstword == j.name){
j.data.push(i)
}
}
}
let newArr = [];
let obj = {};
for (var i = 0; i < res.length; i++) {
if (!obj[res[i].brandid]) {
newArr.push(res[i])
obj[res[i].brandid] = true
}
}
this.setData({
mockData:arr,
navData: newArr,
sourceData: newArr
})
setTimeout(() => {
wx.hideToast();
}, 1000)
})
}
}); });

@ -4,77 +4,24 @@
<view style="height:{{statusBarHeight}}px;width: 100%;"></view> <view style="height:{{statusBarHeight}}px;width: 100%;"></view>
<view class="bs-top-title" style="height: {{navBarHeight}}px;width: 100%;">硕为思汽车智能洞察</view> <view class="bs-top-title" style="height: {{navBarHeight}}px;width: 100%;">硕为思汽车智能洞察</view>
<view class="bs-top"> <view class="bs-top">
<van-search style="width: 100%;" background="#006BFF" value="{{ value }}" placeholder="请输入品牌" /> <van-search style="width: 100%;" background="#006BFF" value="{{ value }}" placeholder="请输入品牌" bind:search="handlerSearch" />
</view> </view>
<view class="bs-tabs"> <view class="bs-tabs">
<scroll-view class="bs-tab-sv" scroll-x="true"> <scroll-view class="bs-tab-sv" scroll-x="true" enable-flex="true">
<view class="bs-tab-sv-item" wx:for="{{navData}}" wx:key="{{index}}"> <view class="bs-tab-sv-item" wx:for="{{navData}}" data-row="{{item}}" wx:key="index" bindtap="handlerChoose">
<image class="userAvatar" src="{{item.img}}" /> <image class="userAvatar" src="{{item.img}}" />
<view class="bs-tab-title">{{item.title}}</view> <view class="bs-tab-title">{{item.brandname}}</view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
</view> </view>
<view class="bs-block"></view> <view class="bs-block" style="height: {{heightTop}}px;"></view>
<van-index-bar class="bs-bar" sticky-offset-top="196"> <van-index-bar class="bs-bar" sticky-offset-top="{{heightTop}}">
<view> <view wx:for="{{mockData}}" wx:key="idx">
<van-index-anchor index="A" /> <van-index-anchor index="{{item.name}}" />
<view class="bs-item"> <view class="bs-item" wx:for="{{item.data}}" wx:key="idx" wx:for-item="item2">
<image slot="icon" class="bs-item-image" src="./cars/audi.jpg" /> <image slot="icon" class="bs-item-image" src="{{item2.img}}" lazy-load="{{true}}"/>
<text>奥迪</text> <text>{{item2.brandname}}</text>
</view>
<view class="bs-item">
<image slot="icon" class="bs-item-image" src="./cars/audi.jpg" />
<text>奥迪</text>
</view>
<view class="bs-item">
<image slot="icon" class="bs-item-image" src="./cars/audi.jpg" />
<text>奥迪</text>
</view>
</view>
<view>
<van-index-anchor index="B" />
<view class="bs-item">
<image slot="icon" class="bs-item-image" src="./cars/audi.jpg" />
<text>奥迪</text>
</view>
<view class="bs-item">
<image slot="icon" class="bs-item-image" src="./cars/audi.jpg" />
<text>奥迪</text>
</view>
<view class="bs-item">
<image slot="icon" class="bs-item-image" src="./cars/audi.jpg" />
<text>奥迪</text>
</view>
</view>
<view>
<van-index-anchor index="C" />
<view class="bs-item">
<image slot="icon" class="bs-item-image" src="./cars/audi.jpg" />
<text>奥迪</text>
</view>
<view class="bs-item">
<image slot="icon" class="bs-item-image" src="./cars/audi.jpg" />
<text>奥迪</text>
</view>
<view class="bs-item">
<image slot="icon" class="bs-item-image" src="./cars/audi.jpg" />
<text>奥迪</text>
</view>
</view>
<view>
<van-index-anchor index="D" />
<view class="bs-item">
<image slot="icon" class="bs-item-image" src="./cars/audi.jpg" />
<text>奥迪</text>
</view>
<view class="bs-item">
<image slot="icon" class="bs-item-image" src="./cars/audi.jpg" />
<text>奥迪</text>
</view>
<view class="bs-item">
<image slot="icon" class="bs-item-image" src="./cars/audi.jpg" />
<text>奥迪</text>
</view> </view>
</view> </view>
</van-index-bar> </van-index-bar>

@ -32,17 +32,18 @@
justify-items: flex-start; justify-items: flex-start;
align-items: center; align-items: center;
padding: 15px 13px; padding: 15px 13px;
font-size: 27rpx; font-size: 30rpx;
color: #3C3C3C;
} }
.bs-item-image { .bs-item-image {
display: inline-block; display: inline-block;
width: 54rpx; width: 80rpx;
height: 54rpx; height: 80rpx;
margin-right: 15rpx; margin-right: 20rpx;
} }
.bs-block { .bs-block {
position: relative; position: relative;
height: 395rpx; height: 430rpx;
} }
.bs-bar { .bs-bar {
position: relative; position: relative;
@ -58,7 +59,7 @@
.bs-tabs { .bs-tabs {
width: 100%; width: 100%;
margin-top: 0px; margin-top: 0px;
height: 120rpx; height: 150rpx;
background: #fff; background: #fff;
border-top-left-radius: 12px; border-top-left-radius: 12px;
border-top-right-radius: 12px; border-top-right-radius: 12px;
@ -71,16 +72,15 @@
width: 100%; width: 100%;
white-space: nowrap; white-space: nowrap;
display: flex; display: flex;
justify-content: flex-start;
} }
.bs-tab-sv-item { .bs-tab-sv-item {
width: 20%;
height: 100rpx;
text-align: center; text-align: center;
display: inline-block; padding: 0rpx 36rpx;
} }
.userAvatar{ .userAvatar{
width: 68rpx; width: 78rpx;
height: 60rpx; height: 78rpx;
border-radius: 4px; border-radius: 4px;
} }
.bs-tab-title{ .bs-tab-title{

@ -65,7 +65,6 @@ Component({
mockData:arr mockData:arr
}) })
}) })
} }
}, },
}) })

@ -2,7 +2,6 @@
<van-dialog id="van-dialog" /> <van-dialog id="van-dialog" />
<view class="box"> <view class="box">
<view class="add1"> <view class="add1">
<view style="display: inline-block;" wx:for="{{result}}" wx:key="idx" wx:for-index="index"> <view style="display: inline-block;" wx:for="{{result}}" wx:key="idx" wx:for-index="index">
<view class="add_box1" wx:if="{{item==undefined}}"> <view class="add_box1" wx:if="{{item==undefined}}">
<view class="heng1"></view> <view class="heng1"></view>
@ -39,7 +38,6 @@
<text>{{item2.brandname}}</text> <text>{{item2.brandname}}</text>
</view> </view>
</view> </view>
</van-index-bar> </van-index-bar>
</van-checkbox-group> </van-checkbox-group>
</view> </view>

Loading…
Cancel
Save