diff --git a/app.json b/app.json index 39e367c..8dce5a3 100644 --- a/app.json +++ b/app.json @@ -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" } } \ No newline at end of file diff --git a/pages/brandCrisis/chooseModel/index.js b/pages/brandCrisis/chooseModel/index.js new file mode 100644 index 0000000..ed7a1f4 --- /dev/null +++ b/pages/brandCrisis/chooseModel/index.js @@ -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' + }) + } +}) \ No newline at end of file diff --git a/pages/brandCrisis/chooseModel/index.json b/pages/brandCrisis/chooseModel/index.json new file mode 100644 index 0000000..cdf14a7 --- /dev/null +++ b/pages/brandCrisis/chooseModel/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": { + } +} \ No newline at end of file diff --git a/pages/brandCrisis/chooseModel/index.wxml b/pages/brandCrisis/chooseModel/index.wxml new file mode 100644 index 0000000..4b3d4bc --- /dev/null +++ b/pages/brandCrisis/chooseModel/index.wxml @@ -0,0 +1,24 @@ + + + + + + + + + + 确定 + + \ No newline at end of file diff --git a/pages/brandCrisis/chooseModel/index.wxss b/pages/brandCrisis/chooseModel/index.wxss new file mode 100644 index 0000000..a794150 --- /dev/null +++ b/pages/brandCrisis/chooseModel/index.wxss @@ -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; +} \ No newline at end of file diff --git a/pages/brandCrisis/crisiSet/index.js b/pages/brandCrisis/crisiSet/index.js index dd5556f..34af822 100644 --- a/pages/brandCrisis/crisiSet/index.js +++ b/pages/brandCrisis/crisiSet/index.js @@ -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() { + + } }) \ No newline at end of file diff --git a/pages/brandCrisis/crisiSet/index.wxml b/pages/brandCrisis/crisiSet/index.wxml index a0f5aad..ae7293f 100644 --- a/pages/brandCrisis/crisiSet/index.wxml +++ b/pages/brandCrisis/crisiSet/index.wxml @@ -26,4 +26,7 @@ 详情 + + 保存 + \ No newline at end of file diff --git a/pages/brandCrisis/crisiSet/index.wxss b/pages/brandCrisis/crisiSet/index.wxss index 3029ddb..9c8fa4f 100644 --- a/pages/brandCrisis/crisiSet/index.wxss +++ b/pages/brandCrisis/crisiSet/index.wxss @@ -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; @@ -40,4 +43,23 @@ .cs-vw { 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; } \ No newline at end of file diff --git a/pages/brandCrisis/index.js b/pages/brandCrisis/index.js index 0cc6d0d..a8d45f0 100644 --- a/pages/brandCrisis/index.js +++ b/pages/brandCrisis/index.js @@ -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 => { diff --git a/pages/brandSearch/index.js b/pages/brandSearch/index.js index 8aece6a..62c1843 100644 --- a/pages/brandSearch/index.js +++ b/pages/brandSearch/index.js @@ -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 options = currentPage.options + 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 }) @@ -65,8 +67,8 @@ Page({ handlerChoose(e) { 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) { + wx.setStorageSync('sBrand', row.brandname); + if (this.data.type === 1) { // wx.switchTab({ // url: "/pages/brandCrisis/index" // }) @@ -75,16 +77,16 @@ Page({ this.setData({ showPop: true, daActive: n - }) + }) 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) { + wx.setStorageSync('sBrand', row.brandname); + if (this.data.type === 1) { // wx.switchTab({ // url: "/pages/brandCrisis/index" // }) @@ -93,13 +95,13 @@ Page({ this.setData({ showPop: true, dbActive: row.brandid - }) + }) this.getSeries(row.brandname); }, handlerCloseDialog() { this.setData({ showPop: false - }) + }) }, handlerChooseS(e) { const row = e.currentTarget.dataset.row; @@ -107,9 +109,6 @@ Page({ this.setData({ dcActive: row.name }) - // wx.switchTab({ - // url: "/pages/brandCrisis/index" - // }) }, getSeries(brandname) { let obj = { @@ -129,7 +128,7 @@ Page({ title: '加载中', icon: 'loading', duration: 30000 - }) + }) app.globalData.request({ action: 'getUserBrand', token: 't%2BrswgjvzGM=', @@ -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); } -}); +}); \ No newline at end of file diff --git a/pages/brandSearch/index.wxml b/pages/brandSearch/index.wxml index acc0d80..fc0f786 100644 --- a/pages/brandSearch/index.wxml +++ b/pages/brandSearch/index.wxml @@ -1,9 +1,9 @@ - + - + 硕为思汽车智能洞察 @@ -11,7 +11,7 @@ - + {{item.brandname}} @@ -22,16 +22,19 @@ - + {{item2.brandname}} - - - {{item.name}} - + + + + + + + \ No newline at end of file diff --git a/pages/brandSearch/index.wxss b/pages/brandSearch/index.wxss index 160b720..180457c 100644 --- a/pages/brandSearch/index.wxss +++ b/pages/brandSearch/index.wxss @@ -131,6 +131,10 @@ width: 100%; overflow: auto; } +.value-class { + flex: none !important; +} .d-active { background: #4A9AFF; + color: #fff; } \ No newline at end of file