dev
xiaowen 3 years ago
parent 7348d51134
commit 8f57b19873

@ -25,7 +25,8 @@
"pages/varComm/pages/brandRatio/index",
"pages/brandCrisis/index",
"pages/detail/index",
"pages/brandCrisis/crisiSet/index"
"pages/brandCrisis/crisiSet/index",
"pages/brandCrisis/chooseModel/index"
],
"window": {
"backgroundTextStyle": "light",
@ -97,7 +98,9 @@
"van-col": "@vant/weapp/col/index",
"van-divider": "@vant/weapp/divider/index",
"van-toast": "@vant/weapp/toast/index",
"van-switch": "@vant/weapp/switch/index"
"van-switch": "@vant/weapp/switch/index",
"van-radio": "@vant/weapp/radio/index",
"van-radio-group": "@vant/weapp/radio-group/index"
}
}

@ -0,0 +1,59 @@
const app = getApp();
Page({
data: {
list: [],
brand: "",
result: []
},
onLoad() {
wx.setNavigationBarTitle({
title: "选择车型"
})
let pages = getCurrentPages();
let currentPage = pages[pages.length - 1]
let options = currentPage.options
this.setData({
brand: options.brand
})
},
onShow() {
this.getData();
if(wx.getStorageSync("sSeriesArr")) {
let arr = wx.getStorageSync("sSeriesArr").split(",");
this.setData({
result: arr
})
}
},
getData() {
let obj = {
action: 'getUserSeriesName',
token: wx.getStorageSync('token') || 't%2BrswgjvzGM=',
sBrandName: this.data.brand
}
app.globalData.request(obj).then(res => {
this.setData({
list: res
})
})
},
onChange(event) {
this.setData({
result: event.detail,
});
},
toggle(event) {
const {
index
} = event.currentTarget.dataset;
const checkbox = this.selectComponent(`.checkboxes-${index}`);
checkbox.toggle();
},
noop() {},
save() {
wx.setStorageSync("sSeriesArr", this.data.result.toString());
wx.redirectTo({
url: '/pages/brandCrisis/crisiSet/index'
})
}
})

@ -0,0 +1,4 @@
{
"usingComponents": {
}
}

@ -0,0 +1,24 @@
<view>
<van-checkbox-group value="{{ result }}" bind:change="onChange">
<van-cell-group>
<van-cell
wx:for="{{ list }}"
wx:key="index"
title="{{ item.name }}"
value-class="value-class"
clickable
data-index="{{ index }}"
bind:click="toggle"
>
<van-checkbox
catch:tap="noop"
class="checkboxes-{{ index }}"
name="{{ item.name }}"
/>
</van-cell>
</van-cell-group>
</van-checkbox-group>
<view class="footer-btn">
<view class="footer-sbn" bindtap="save">确定</view>
</view>
</view>

@ -0,0 +1,22 @@
.value-class {
flex: none !important;
}
.footer-btn {
position: fixed;
width: 100vw;
height: 36px;
bottom: 40px;
line-height: 36px;
left: 0px;
background-color: #fff;
display: flex;
justify-content: center;
}
.footer-sbn {
width: 90%;
height: 100%;
background: #0084FF;
color: #fff;
text-align: center;
border-radius: 2px;
}

@ -11,7 +11,7 @@ Page({
})
},
onShow() {
let sSeriesName = wx.getStorageSync("sSeriesName") || '';
let sSeriesName = wx.getStorageSync("sSeriesArr") || '';
let sCrisis = wx.getStorageSync("sCrisis") || '1,2,3';
this.setData({
sSeriesName: sSeriesName,
@ -33,9 +33,11 @@ Page({
token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
}).then(res => {
wx.navigateTo({
url: '/pages/brandSearch/index?sBrand=' + res
url: '/pages/brandCrisis/chooseModel/index?brand=' + res
})
})
},
save() {
}
})

@ -26,4 +26,7 @@
详情
</view>
</van-cell>
<view class="footer-btn">
<view class="footer-sbn" bindtap="save">保存</view>
</view>
</view>

@ -1,5 +1,7 @@
.cs-container {
width: calc(100% - 32px);
padding: 0px 16px;
}
.cs-dc {
display: flex;
@ -8,6 +10,7 @@
.cs-dc-s1 {
font-size: 14px;
color: #333333;
width: 64%;
}
.cs-dc-s2 {
font-size: 12px;
@ -41,3 +44,22 @@
color: #D0D0D0;
font-size: 13px;
}
.footer-btn {
position: fixed;
width: 100vw;
height: 36px;
bottom: 40px;
line-height: 36px;
left: 0px;
background-color: #fff;
display: flex;
justify-content: center;
}
.footer-sbn {
width: 90%;
height: 100%;
background: #0084FF;
color: #fff;
text-align: center;
border-radius: 2px;
}

@ -76,7 +76,7 @@ Page({
sBrand: this.data.sBrand,
sStartTime: sStartTime,
sEndTime: sEndTime,
sSeriesName: sSeriesName,
// sSeriesName: sSeriesName,
token: wx.getStorageSync('token') || 't%2BrswgjvzGM=',
}
app.globalData.request(obj, (val) => {
@ -138,7 +138,7 @@ Page({
sType: "BrandData",
sCrisis: sCrisis,
sBrand: this.data.sBrand,
sSeriesName: sSeriesName,
// sSeriesName: sSeriesName,
token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
}
app.globalData.request(obj, (val) => {
@ -190,7 +190,7 @@ Page({
sStartTime: sStartTime,
sEndTime: sEndTime,
sBrand: this.data.sBrand,
sSeriesName: sSeriesName,
// sSeriesName: sSeriesName,
token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
}
app.globalData.request(obj).then(res => {

@ -5,9 +5,9 @@ Page({
value: "",
tabActive: 0,
active: 1,
height:app.globalData.navBarHeight + app.globalData.statusBarHeight,
statusBarHeight:app.globalData.statusBarHeight,
navBarHeight:app.globalData.navBarHeight,
height: app.globalData.navBarHeight + app.globalData.statusBarHeight,
statusBarHeight: app.globalData.statusBarHeight,
navBarHeight: app.globalData.navBarHeight,
navData: [],
sourceData: [],
mockData: [],
@ -18,35 +18,37 @@ Page({
sBrand: '',
daActive: -1,
dbActive: '',
dcActive: ''
dcActive: '',
model: ''
},
onLaunch() {
wx.getSystemInfo({
success: (res) => {
const ratio = 750 / res.windowWidth
const menuInfo = wx.getMenuButtonBoundingClientRect();
this.setData({
top: menuInfo.top * ratio ,
left: menuInfo.left * ratio ,
height: menuInfo.height * ratio ,
const ratio = 750 / res.windowWidth
const menuInfo = wx.getMenuButtonBoundingClientRect();
this.setData({
top: menuInfo.top * ratio,
left: menuInfo.left * ratio,
height: menuInfo.height * ratio,
})
}
})
})
},
onLoad() {
let pages = getCurrentPages();
let currentPage = pages[pages.length-1]
let currentPage = pages[pages.length - 1]
let options = currentPage.options
this.setData({
type: options.type || 2,
sBrand: options.sBrand || ''
type: options.type || 2
})
},
onShow() {
this.getData();
this.createSelectorQuery().select(".nav-top").boundingClientRect(res => {
if (res) {
const { height } = res;
const {
height
} = res;
this.setData({
heightTop: height
})
@ -66,7 +68,7 @@ Page({
const row = e.currentTarget.dataset.row;
let n = this.data.navData.findIndex(ele => row.brandid === ele.brandid);
wx.setStorageSync('sBrand', row.brandname);
if(this.data.type === 1) {
if (this.data.type === 1) {
// wx.switchTab({
// url: "/pages/brandCrisis/index"
// })
@ -79,12 +81,12 @@ Page({
this.getSeries(row.brandname);
},
handlerChoose1(e) {
if(this.data.sBrand) {
if (this.data.sBrand) {
return;
}
const row = e.currentTarget.dataset.row;
wx.setStorageSync('sBrand', row.brandname);
if(this.data.type === 1) {
if (this.data.type === 1) {
// wx.switchTab({
// url: "/pages/brandCrisis/index"
// })
@ -107,9 +109,6 @@ Page({
this.setData({
dcActive: row.name
})
// wx.switchTab({
// url: "/pages/brandCrisis/index"
// })
},
getSeries(brandname) {
let obj = {
@ -141,9 +140,9 @@ Page({
data: []
});
}
for(let i of res){
for(let j of arr){
if(i.firstword == j.name){
for (let i of res) {
for (let j of arr) {
if (i.firstword == j.name) {
j.data.push(i)
}
}
@ -151,26 +150,39 @@ Page({
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
}
if (!obj[res[i].brandid]) {
newArr.push(res[i])
obj[res[i].brandid] = true
}
}
newArr = newArr.filter(ele => ele.brandname === this.data.sBrand)
this.setData({
mockData:arr,
mockData: arr,
navData: newArr,
sourceData: newArr
})
setTimeout(() => {
wx.hideToast();
}, 1000)
})
},
handlerBack() {
wx.navigateBack({
delta: 1
});
},
onChange(event) {
this.setData({
model: event.detail,
});
wx.setStorageSync('sSeries', event.detail);
},
onClick(event) {
const {
name
} = event.currentTarget.dataset;
this.setData({
model: name
});
wx.setStorageSync('sSeries', name);
}
});

@ -1,9 +1,9 @@
<view class="view-page">
<view class="navigation nav-top" style="background: #006BFF;">
<!--手机状态栏的高度-->
<!-- 手机状态栏的高度 -->
<view style="height:{{statusBarHeight}}px;width: 100%;"></view>
<view class="bs-top-title" style="height: {{navBarHeight}}px;width: 100%;">
<van-icon class="bs-top-title-ic" name="arrow-left" bindtap="handlerBack"/>
<van-icon class="bs-top-title-ic" name="arrow-left" bindtap="handlerBack" />
<text>硕为思汽车智能洞察</text>
</view>
<view class="bs-top">
@ -11,7 +11,7 @@
</view>
<view class="bs-tabs">
<scroll-view class="bs-tab-sv" scroll-x="true" enable-flex="true">
<view class="bs-tab-sv-item {{index === daActive ? 'd-active' : ''}}" wx:for="{{navData}}" data-row="{{item}}" wx:key="index" bindtap="handlerChoose">
<view class="bs-tab-sv-item" wx:for="{{navData}}" data-row="{{item}}" wx:key="index" bindtap="handlerChoose">
<image class="userAvatar" src="{{item.img}}" lazy-load="{{true}}" />
<view class="bs-tab-title">{{item.brandname}}</view>
</view>
@ -22,16 +22,19 @@
<van-index-bar class="bs-bar" sticky-offset-top="{{heightTop}}">
<view wx:for="{{mockData}}" wx:key="idx">
<van-index-anchor index="{{item.name}}" />
<view class="bs-item {{item2.brandid === dbActive ? 'd-active' : ''}}" wx:for="{{item.data}}" wx:key="idx" wx:for-item="item2" data-row="{{item2}}" bindtap="handlerChoose1">
<view class="bs-item" wx:for="{{item.data}}" wx:key="idx" wx:for-item="item2" data-row="{{item2}}" bindtap="handlerChoose1">
<image slot="icon" class="bs-item-image" src="{{item2.img}}" lazy-load="{{true}}" />
<text>{{item2.brandname}}</text>
</view>
</view>
</van-index-bar>
<van-popup z-index="2000" show="{{showPop}}" custom-style="height: calc(100% - {{heightTop}}px);width: 68%; top: {{heightTop*2+55}}px;" position="right" bind:close="handlerCloseDialog">
<view class="bs-item {{dcActive === item.name ? 'd-active' : ''}}" wx:for="{{series}}" wx:key="index" wx:for-item="item" data-row="{{item}}" bindtap="handlerChooseS">
<image slot="icon" class="bs-item-image" src="{{item.img}}" lazy-load="{{true}}" />
<text>{{item.name}}</text>
</view>
<van-radio-group value="{{ model }}" bind:change="onChange">
<van-cell-group>
<van-cell wx:for="{{ series }}" wx:key="index" title="{{ item.name }}" clickable data-name="{{item.name}}" bind:click="onClick">
<van-radio slot="right-icon" name="{{item.name}}" />
</van-cell>
</van-cell-group>
</van-radio-group>
</van-popup>
</view>

@ -131,6 +131,10 @@
width: 100%;
overflow: auto;
}
.value-class {
flex: none !important;
}
.d-active {
background: #4A9AFF;
color: #fff;
}
Loading…
Cancel
Save