dev
xiaowen 3 years ago
parent 7348d51134
commit 8f57b19873

@ -25,7 +25,8 @@
"pages/varComm/pages/brandRatio/index", "pages/varComm/pages/brandRatio/index",
"pages/brandCrisis/index", "pages/brandCrisis/index",
"pages/detail/index", "pages/detail/index",
"pages/brandCrisis/crisiSet/index" "pages/brandCrisis/crisiSet/index",
"pages/brandCrisis/chooseModel/index"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
@ -97,7 +98,9 @@
"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", "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() { onShow() {
let sSeriesName = wx.getStorageSync("sSeriesName") || ''; let sSeriesName = wx.getStorageSync("sSeriesArr") || '';
let sCrisis = wx.getStorageSync("sCrisis") || '1,2,3'; let sCrisis = wx.getStorageSync("sCrisis") || '1,2,3';
this.setData({ this.setData({
sSeriesName: sSeriesName, sSeriesName: sSeriesName,
@ -33,9 +33,11 @@ Page({
token: wx.getStorageSync('token') || 't%2BrswgjvzGM=' token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
}).then(res => { }).then(res => {
wx.navigateTo({ wx.navigateTo({
url: '/pages/brandSearch/index?sBrand=' + res url: '/pages/brandCrisis/chooseModel/index?brand=' + res
}) })
}) })
}, },
save() {
}
}) })

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

@ -1,5 +1,7 @@
.cs-container { .cs-container {
width: calc(100% - 32px);
padding: 0px 16px; padding: 0px 16px;
} }
.cs-dc { .cs-dc {
display: flex; display: flex;
@ -8,6 +10,7 @@
.cs-dc-s1 { .cs-dc-s1 {
font-size: 14px; font-size: 14px;
color: #333333; color: #333333;
width: 64%;
} }
.cs-dc-s2 { .cs-dc-s2 {
font-size: 12px; font-size: 12px;
@ -40,4 +43,23 @@
.cs-vw { .cs-vw {
color: #D0D0D0; color: #D0D0D0;
font-size: 13px; 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, sBrand: this.data.sBrand,
sStartTime: sStartTime, sStartTime: sStartTime,
sEndTime: sEndTime, sEndTime: sEndTime,
sSeriesName: sSeriesName, // sSeriesName: sSeriesName,
token: wx.getStorageSync('token') || 't%2BrswgjvzGM=', token: wx.getStorageSync('token') || 't%2BrswgjvzGM=',
} }
app.globalData.request(obj, (val) => { app.globalData.request(obj, (val) => {
@ -138,7 +138,7 @@ Page({
sType: "BrandData", sType: "BrandData",
sCrisis: sCrisis, sCrisis: sCrisis,
sBrand: this.data.sBrand, sBrand: this.data.sBrand,
sSeriesName: sSeriesName, // sSeriesName: sSeriesName,
token: wx.getStorageSync('token') || 't%2BrswgjvzGM=' token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
} }
app.globalData.request(obj, (val) => { app.globalData.request(obj, (val) => {
@ -190,7 +190,7 @@ Page({
sStartTime: sStartTime, sStartTime: sStartTime,
sEndTime: sEndTime, sEndTime: sEndTime,
sBrand: this.data.sBrand, sBrand: this.data.sBrand,
sSeriesName: sSeriesName, // sSeriesName: sSeriesName,
token: wx.getStorageSync('token') || 't%2BrswgjvzGM=' token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
} }
app.globalData.request(obj).then(res => { app.globalData.request(obj).then(res => {

@ -5,9 +5,9 @@ Page({
value: "", value: "",
tabActive: 0, tabActive: 0,
active: 1, active: 1,
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: [], sourceData: [],
mockData: [], mockData: [],
@ -18,35 +18,37 @@ Page({
sBrand: '', sBrand: '',
daActive: -1, daActive: -1,
dbActive: '', dbActive: '',
dcActive: '' dcActive: '',
model: ''
}, },
onLaunch() { onLaunch() {
wx.getSystemInfo({ wx.getSystemInfo({
success: (res) => { success: (res) => {
const ratio = 750 / res.windowWidth const ratio = 750 / res.windowWidth
const menuInfo = wx.getMenuButtonBoundingClientRect(); const menuInfo = wx.getMenuButtonBoundingClientRect();
this.setData({ this.setData({
top: menuInfo.top * ratio , top: menuInfo.top * ratio,
left: menuInfo.left * ratio , left: menuInfo.left * ratio,
height: menuInfo.height * ratio , height: menuInfo.height * ratio,
}) })
} }
}) })
}, },
onLoad() { onLoad() {
let pages = getCurrentPages(); let pages = getCurrentPages();
let currentPage = pages[pages.length-1] let currentPage = pages[pages.length - 1]
let options = currentPage.options let options = currentPage.options
this.setData({ this.setData({
type: options.type || 2, type: options.type || 2
sBrand: options.sBrand || ''
}) })
}, },
onShow() { onShow() {
this.getData(); this.getData();
this.createSelectorQuery().select(".nav-top").boundingClientRect(res => { this.createSelectorQuery().select(".nav-top").boundingClientRect(res => {
if (res) { if (res) {
const { height } = res; const {
height
} = res;
this.setData({ this.setData({
heightTop: height heightTop: height
}) })
@ -65,8 +67,8 @@ Page({
handlerChoose(e) { handlerChoose(e) {
const row = e.currentTarget.dataset.row; const row = e.currentTarget.dataset.row;
let n = this.data.navData.findIndex(ele => row.brandid === ele.brandid); let n = this.data.navData.findIndex(ele => row.brandid === ele.brandid);
wx.setStorageSync('sBrand', row.brandname); wx.setStorageSync('sBrand', row.brandname);
if(this.data.type === 1) { if (this.data.type === 1) {
// wx.switchTab({ // wx.switchTab({
// url: "/pages/brandCrisis/index" // url: "/pages/brandCrisis/index"
// }) // })
@ -75,16 +77,16 @@ Page({
this.setData({ this.setData({
showPop: true, showPop: true,
daActive: n daActive: n
}) })
this.getSeries(row.brandname); this.getSeries(row.brandname);
}, },
handlerChoose1(e) { handlerChoose1(e) {
if(this.data.sBrand) { if (this.data.sBrand) {
return; return;
} }
const row = e.currentTarget.dataset.row; const row = e.currentTarget.dataset.row;
wx.setStorageSync('sBrand', row.brandname); wx.setStorageSync('sBrand', row.brandname);
if(this.data.type === 1) { if (this.data.type === 1) {
// wx.switchTab({ // wx.switchTab({
// url: "/pages/brandCrisis/index" // url: "/pages/brandCrisis/index"
// }) // })
@ -93,13 +95,13 @@ Page({
this.setData({ this.setData({
showPop: true, showPop: true,
dbActive: row.brandid dbActive: row.brandid
}) })
this.getSeries(row.brandname); this.getSeries(row.brandname);
}, },
handlerCloseDialog() { handlerCloseDialog() {
this.setData({ this.setData({
showPop: false showPop: false
}) })
}, },
handlerChooseS(e) { handlerChooseS(e) {
const row = e.currentTarget.dataset.row; const row = e.currentTarget.dataset.row;
@ -107,9 +109,6 @@ Page({
this.setData({ this.setData({
dcActive: row.name dcActive: row.name
}) })
// wx.switchTab({
// url: "/pages/brandCrisis/index"
// })
}, },
getSeries(brandname) { getSeries(brandname) {
let obj = { let obj = {
@ -129,7 +128,7 @@ Page({
title: '加载中', title: '加载中',
icon: 'loading', icon: 'loading',
duration: 30000 duration: 30000
}) })
app.globalData.request({ app.globalData.request({
action: 'getUserBrand', action: 'getUserBrand',
token: 't%2BrswgjvzGM=', token: 't%2BrswgjvzGM=',
@ -141,9 +140,9 @@ Page({
data: [] data: []
}); });
} }
for(let i of res){ for (let i of res) {
for(let j of arr){ for (let j of arr) {
if(i.firstword == j.name){ if (i.firstword == j.name) {
j.data.push(i) j.data.push(i)
} }
} }
@ -151,26 +150,39 @@ Page({
let newArr = []; let newArr = [];
let obj = {}; let obj = {};
for (var i = 0; i < res.length; i++) { for (var i = 0; i < res.length; i++) {
if (!obj[res[i].brandid]) { if (!obj[res[i].brandid]) {
newArr.push(res[i]) newArr.push(res[i])
obj[res[i].brandid] = true obj[res[i].brandid] = true
} }
} }
newArr = newArr.filter(ele => ele.brandname === this.data.sBrand)
this.setData({ this.setData({
mockData:arr, mockData: arr,
navData: newArr, navData: newArr,
sourceData: newArr sourceData: newArr
}) })
setTimeout(() => { setTimeout(() => {
wx.hideToast(); wx.hideToast();
}, 1000) }, 1000)
}) })
}, },
handlerBack() { handlerBack() {
wx.navigateBack({ wx.navigateBack({
delta: 1 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="view-page">
<view class="navigation nav-top" style="background: #006BFF;"> <view class="navigation nav-top" style="background: #006BFF;">
<!--手机状态栏的高度--> <!-- 手机状态栏的高度 -->
<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 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> <text>硕为思汽车智能洞察</text>
</view> </view>
<view class="bs-top"> <view class="bs-top">
@ -11,7 +11,7 @@
</view> </view>
<view class="bs-tabs"> <view class="bs-tabs">
<scroll-view class="bs-tab-sv" scroll-x="true" enable-flex="true"> <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}}" /> <image class="userAvatar" src="{{item.img}}" lazy-load="{{true}}" />
<view class="bs-tab-title">{{item.brandname}}</view> <view class="bs-tab-title">{{item.brandname}}</view>
</view> </view>
@ -22,16 +22,19 @@
<van-index-bar class="bs-bar" sticky-offset-top="{{heightTop}}"> <van-index-bar class="bs-bar" sticky-offset-top="{{heightTop}}">
<view wx:for="{{mockData}}" wx:key="idx"> <view wx:for="{{mockData}}" wx:key="idx">
<van-index-anchor index="{{item.name}}" /> <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}}" /> <image slot="icon" class="bs-item-image" src="{{item2.img}}" lazy-load="{{true}}" />
<text>{{item2.brandname}}</text> <text>{{item2.brandname}}</text>
</view> </view>
</view> </view>
</van-index-bar> </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"> <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"> <van-radio-group value="{{ model }}" bind:change="onChange">
<image slot="icon" class="bs-item-image" src="{{item.img}}" lazy-load="{{true}}" /> <van-cell-group>
<text>{{item.name}}</text> <van-cell wx:for="{{ series }}" wx:key="index" title="{{ item.name }}" clickable data-name="{{item.name}}" bind:click="onClick">
</view> <van-radio slot="right-icon" name="{{item.name}}" />
</van-cell>
</van-cell-group>
</van-radio-group>
</van-popup> </van-popup>
</view> </view>

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