From d42a8230b4e31a177931c56031e4ccc717ac764c Mon Sep 17 00:00:00 2001 From: wylyl22 <2373073266@qq.com> Date: Fri, 22 Jul 2022 10:19:06 +0800 Subject: [PATCH] wyl --- app.json | 4 +- components/c-echars/index.js | 4 ++ components/c-echars/index.wxml | 2 +- components/chartdisplay/index.js | 38 ++++++++--- components/option/columnarOption.js | 5 +- components/option/singleLineOption.js | 4 +- components/option/stackingLineOption.js | 4 +- {pages/index => index}/home/home.js | 2 +- index/home/home.json | 3 + index/home/home.wxml | 2 + index/home/home.wxss | 1 + .../Salesranking/Vehicletype/Vehicletype.js | 15 +++-- .../Salesranking/Vehicletype/Vehicletype.wxml | 47 +++++++------ pages/index/home/home.wxml | 2 - pages/pages/home/home.js | 66 +++++++++++++++++++ pages/pages/home/home.wxml | 2 + project.private.config.json | 14 ++++ 17 files changed, 166 insertions(+), 49 deletions(-) rename {pages/index => index}/home/home.js (96%) create mode 100644 index/home/home.json create mode 100644 index/home/home.wxml create mode 100644 index/home/home.wxss delete mode 100644 pages/index/home/home.wxml create mode 100644 pages/pages/home/home.js create mode 100644 pages/pages/home/home.wxml diff --git a/app.json b/app.json index 39e367c..3e3dafb 100644 --- a/app.json +++ b/app.json @@ -6,6 +6,7 @@ "pages/index/detailedvolume/detailedvolume", "pages/index/Brandsales/Brandsales", "pages/index/Salesranking/Salesranking", + "index/home/home", "pages/index/Salesranking/Vehicletype/Vehicletype", "pages/index/Salesranking/Brandranking/Brandranking", "pages/index/Salesranking/Allbrands/Allbrands", @@ -25,7 +26,8 @@ "pages/varComm/pages/brandRatio/index", "pages/brandCrisis/index", "pages/detail/index", - "pages/brandCrisis/crisiSet/index" + "pages/brandCrisis/crisiSet/index", + "pages/pages/home/home" ], "window": { "backgroundTextStyle": "light", diff --git a/components/c-echars/index.js b/components/c-echars/index.js index 7fd4762..efa35ff 100644 --- a/components/c-echars/index.js +++ b/components/c-echars/index.js @@ -13,6 +13,10 @@ Component({ showChart: { // 控制图表的显示时机 type: Boolean }, + flocShow:{ + type:Boolean, + value:false + }, chartOption: { // 图表option对象 type: Object, observer: function () { // 监听图表option的变化,实现动态渲染 diff --git a/components/c-echars/index.wxml b/components/c-echars/index.wxml index 30e7fda..b2bd266 100644 --- a/components/c-echars/index.wxml +++ b/components/c-echars/index.wxml @@ -1,4 +1,4 @@ - + diff --git a/components/chartdisplay/index.js b/components/chartdisplay/index.js index 1a1935e..80e3f0e 100644 --- a/components/chartdisplay/index.js +++ b/components/chartdisplay/index.js @@ -1,18 +1,40 @@ import histogram from "../option/columnarOption" -const data=['智骏', '国机', '小虎', '华晨', '朋克美美','华晨新日','百智大熊','朋克多多','YOUNG光小新','易至EV3','雷丁芒果','风光MINIEV','宝骏KiWiEV','思皓E10X','零跑T03','科莱威CLEVER','奔奔E-Star','QQ冰激凌','小蚂蚁','宏光MINIEV',] -const data2= [600,700,800,900,1000,1200,1300,1400,1500,1600,1700,1900,2000,2100,2200,2300,2400,2500,2600,2700,] - +const app = getApp() Component({ data: { showChart: true, - brandOption: histogram(data,data2,[],'#0084FF',false), - }, - onShow() { - this.getTabBar().init(); + // onShow() { + // this.getTabBar().init(); + // }, + lifetimes:{ + attached(){ + this.getTrend() + } }, - methods: { + getTrend(){ + app.globalData.request({ + action: 'getCheZhuCarSeriesRankingHome', + sType:'Marketing', + sStartTime: "2021-10", + sEndTime:"2021-10", + iPageIndex: "iPageIndex", + iPageSize: "iPageSize", + // sSpec:wx.getStorageSync('sSpec') || '', + // sPriceType:wx.getStorageSync('sPriceType') || '', + // sEnergyType:wx.getStorageSync('sEnergyType') || '' + }).then(res => { + let carName = [] + let carValue=[] + res.forEach(e =>{ + carName.push(e.seriesname), + carValue.push(e.salescount) + }) + this.setData({ + brandOption: histogram(carName,carValue,'#0084FF',false) + }) + })}, priceSel(e){ this.setData({ intervalSel: e.currentTarget.dataset.index diff --git a/components/option/columnarOption.js b/components/option/columnarOption.js index 3155823..58c44ba 100644 --- a/components/option/columnarOption.js +++ b/components/option/columnarOption.js @@ -9,13 +9,14 @@ export default function histogram(dx = [], ds = [], color1 = '', direction = tru }, confine: true }, - dataZoom: [{ //添加X轴滚动条 + + dataZoom: direction?[{ //添加X轴滚动条 type: 'inside', show: false, start: 50, end: 10, handleSize: 10 - }], + }]:[], // legend: { // x:'15', // icon: 'rectangle',//data图标样式 diff --git a/components/option/singleLineOption.js b/components/option/singleLineOption.js index b922abb..29e427a 100644 --- a/components/option/singleLineOption.js +++ b/components/option/singleLineOption.js @@ -1,5 +1,5 @@ -// 折线 -export default function brokenLine(dName = [], dValue = [], dColor = [], dx = []) { +// 单折线 +export default function brokenLine(dValue = [], dx = []) { return { grid: { left: 30, diff --git a/components/option/stackingLineOption.js b/components/option/stackingLineOption.js index 92f7e73..d1dc25c 100644 --- a/components/option/stackingLineOption.js +++ b/components/option/stackingLineOption.js @@ -1,5 +1,5 @@ -// 折线 -export default function brokenLine(dName = [], dValue = [], dColor = [], dx = []) { +// 多折线 +export default function brokenLines(dName = [], dValue = [], dColor = [], dx = []) { return { tooltip: { trigger: 'axis', diff --git a/pages/index/home/home.js b/index/home/home.js similarity index 96% rename from pages/index/home/home.js rename to index/home/home.js index 404d879..a884a25 100644 --- a/pages/index/home/home.js +++ b/index/home/home.js @@ -1,4 +1,4 @@ -// pages/index/home/home.js +// index/home/home.js Page({ /** diff --git a/index/home/home.json b/index/home/home.json new file mode 100644 index 0000000..3928faa --- /dev/null +++ b/index/home/home.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/index/home/home.wxml b/index/home/home.wxml new file mode 100644 index 0000000..831c588 --- /dev/null +++ b/index/home/home.wxml @@ -0,0 +1,2 @@ + +index/home/home.wxml diff --git a/index/home/home.wxss b/index/home/home.wxss new file mode 100644 index 0000000..18a707d --- /dev/null +++ b/index/home/home.wxss @@ -0,0 +1 @@ +/* index/home/home.wxss */ \ No newline at end of file diff --git a/pages/index/Salesranking/Vehicletype/Vehicletype.js b/pages/index/Salesranking/Vehicletype/Vehicletype.js index 1589a01..cffb493 100644 --- a/pages/index/Salesranking/Vehicletype/Vehicletype.js +++ b/pages/index/Salesranking/Vehicletype/Vehicletype.js @@ -14,6 +14,7 @@ Component({ grade_name3:'按能源', grade_name4:'列表展示', grades4:['列表展示','图表展示'], + positiveOption:brokenLine(dValue,data), //弹出框 show: false, duration: 300, @@ -21,20 +22,22 @@ Component({ round: true, overlay: true, showChart: true, - positiveOption:brokenLine(dName,dValue,dColor,data), imageUrl: getApp().globalData.imageUrl, date:'2021-01', accountIndex:0, - + // + ec: { + lazyLoad:true // 设置图表懒加载 + } }, lifetimes: { - attached() { + attached() { + let sTimeType = wx.getStorageSync("sTimeType") || 34; let sStartTime = wx.getStorageSync("sStartTime") || ''; let sEndTime = wx.getStorageSync("sEndTime") || ''; this.getData(sTimeType, sStartTime, sEndTime); this.getTrend(); - } }, @@ -52,7 +55,6 @@ Component({ },500) }, getTrend(){ - app.globalData.request({ action: 'getCheZhuCarSeriesRankingHome', sType:'Marketing', @@ -213,7 +215,7 @@ Component({ duration: 300000 }) console.log(e) - var name=e.currentTarget.dataset.name + var name=e.currentTarget.dataset.name.name var value=e.currentTarget.dataset.name.value wx.setStorageSync('sEnergyType',value) this.setData({ @@ -263,6 +265,7 @@ Component({ popup(e) { let duration = this.data.duration this.setData({ + show: true, duration }) diff --git a/pages/index/Salesranking/Vehicletype/Vehicletype.wxml b/pages/index/Salesranking/Vehicletype/Vehicletype.wxml index b75bed3..7ebc95d 100644 --- a/pages/index/Salesranking/Vehicletype/Vehicletype.wxml +++ b/pages/index/Salesranking/Vehicletype/Vehicletype.wxml @@ -1,42 +1,42 @@ + - 全部 - - - - - {{date}} - - - - + + + + + {{date}} + + + + - - {{grade_name1}} + + {{grade_name1}} - - + + {{item.name}} - + {{grade_name2}} - + {{item.name}} @@ -49,7 +49,7 @@ - + {{item.name}} @@ -62,7 +62,7 @@ - + {{item}} @@ -104,7 +104,7 @@ {{item.volume}} - + 销量趋势 @@ -115,18 +115,17 @@ - + 销量趋势 - + - 宏光MINIEV销量趋势 - + - \ No newline at end of file + diff --git a/pages/index/home/home.wxml b/pages/index/home/home.wxml deleted file mode 100644 index b69d977..0000000 --- a/pages/index/home/home.wxml +++ /dev/null @@ -1,2 +0,0 @@ - -pages/index/home/home.wxml diff --git a/pages/pages/home/home.js b/pages/pages/home/home.js new file mode 100644 index 0000000..e9682f9 --- /dev/null +++ b/pages/pages/home/home.js @@ -0,0 +1,66 @@ +// pages/pages/home/home.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/pages/home/home.wxml b/pages/pages/home/home.wxml new file mode 100644 index 0000000..e8ad897 --- /dev/null +++ b/pages/pages/home/home.wxml @@ -0,0 +1,2 @@ + +pages/pages/home/home.wxml diff --git a/project.private.config.json b/project.private.config.json index 5f777b4..c7817c4 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -49,6 +49,20 @@ "query": "", "launchMode": "default", "scene": null + }, + { + "name": "", + "pathName": "pages/index/home/home", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/home/home", + "query": "", + "launchMode": "default", + "scene": null } ] }