From 889cd97e64c20c84aaaa1632cd5de76ea7eda473 Mon Sep 17 00:00:00 2001
From: wylyl22 <2373073266@qq.com>
Date: Mon, 25 Jul 2022 09:44:37 +0800
Subject: [PATCH] wyl
---
components/chartdisplay/index.js | 15 +++++-
components/chartdisplay/index.wxml | 2 +-
components/indexCom/rankingChild/index.js | 3 +-
components/option/columnarOption.js | 19 ++++++--
components/option/text.js | 19 ++++++++
.../Salesranking/Vehicletype/Vehicletype.js | 46 ++++++++++++-------
.../Salesranking/Vehicletype/Vehicletype.wxml | 28 +++++++++--
7 files changed, 103 insertions(+), 29 deletions(-)
create mode 100644 components/option/text.js
diff --git a/components/chartdisplay/index.js b/components/chartdisplay/index.js
index 80e3f0e..cf65bd3 100644
--- a/components/chartdisplay/index.js
+++ b/components/chartdisplay/index.js
@@ -27,12 +27,25 @@ Component({
}).then(res => {
let carName = []
let carValue=[]
+ let carName1 = []
+ let carValue1=[]
res.forEach(e =>{
carName.push(e.seriesname),
carValue.push(e.salescount)
})
+ console.log(carValue)
+ console.log(carName)
+ let a=0
+ for(let i=carName.length; i>0;i--){
+ a++
+ carName1.push(carName[i-1])
+ carValue1.push(carValue[i-1])
+ }
+ console.log(carValue1)
+ console.log(carName1)
+ console.log(a)
this.setData({
- brandOption: histogram(carName,carValue,'#0084FF',false)
+ brandOption: histogram(carName1,carValue1,'#0084FF',false)
})
})},
priceSel(e){
diff --git a/components/chartdisplay/index.wxml b/components/chartdisplay/index.wxml
index 976b029..e671443 100644
--- a/components/chartdisplay/index.wxml
+++ b/components/chartdisplay/index.wxml
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/components/indexCom/rankingChild/index.js b/components/indexCom/rankingChild/index.js
index b2bc1ea..e63d26d 100644
--- a/components/indexCom/rankingChild/index.js
+++ b/components/indexCom/rankingChild/index.js
@@ -1,5 +1,4 @@
import histogram from "../../option/columnarOption"
-
const app = getApp()
Component({
data: {
@@ -59,7 +58,7 @@ Component({
carCount.push(e.salescount)
});
this.setData({
- brandOption: histogram(carName, carCount, '#0084FF'),
+ brandOption: histogram(carName, carCount,'#0084FF'),
})
resolve(true)
}).catch(() => {
diff --git a/components/option/columnarOption.js b/components/option/columnarOption.js
index 7b74958..58e587d 100644
--- a/components/option/columnarOption.js
+++ b/components/option/columnarOption.js
@@ -1,4 +1,5 @@
// 单柱状
+import {doStr} from "./text"
export default function histogram(dx = [], ds = [], color1 = '', direction = true) {
// direction true为垂直 false为水平
return {
@@ -13,9 +14,9 @@ export default function histogram(dx = [], ds = [], color1 = '', direction = tru
dataZoom: direction?[{ //添加X轴滚动条
type: 'inside',
show: false,
- start: 10,
- end: 40,
- handleSize: 5
+ start: 0,
+ end:30 ,
+ handleSize: 30
}]:[{
type:"inside",
show:false,
@@ -53,6 +54,10 @@ export default function histogram(dx = [], ds = [], color1 = '', direction = tru
},
axisLabel: {
color: '#999999', //x轴文本颜色
+ formatter:(value)=>{
+ let res=doStr(value,4)
+ return res
+ },
textStyle: {
fontSize: 8
}
@@ -124,7 +129,11 @@ export default function histogram(dx = [], ds = [], color1 = '', direction = tru
show: false, //去除轴线
},
axisLabel: {
- color: '#999999', //x轴文本颜色
+ color: '#999999', //y轴文本颜色
+ formatter:(value)=>{
+ let res=doStr(value,4)
+ return res
+ },
textStyle: {
fontSize: 9
}
@@ -133,7 +142,7 @@ export default function histogram(dx = [], ds = [], color1 = '', direction = tru
series: {
type: 'bar',
data: ds,
- barWidth: 24,
+ barWidth: direction?24:12,
stack: "Search Engine",
emphasis: { //折线图的高亮状态。
focus: "series", //聚焦当前高亮的数据所在的系列的所有图形。
diff --git a/components/option/text.js b/components/option/text.js
new file mode 100644
index 0000000..e97b135
--- /dev/null
+++ b/components/option/text.js
@@ -0,0 +1,19 @@
+export function doStr(str, n) {
+ let totalCount = 0;
+ let txt = "";
+ for (var i = 0; i < str.length; i++) {
+ let c = str.charCodeAt(i);
+ if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
+ totalCount++;
+ } else {
+ totalCount += 2;
+ }
+ if (totalCount <= n) {
+ txt += str[i];
+ } else {
+ txt += '...';
+ return txt
+ }
+ }
+ return txt;
+ }
\ No newline at end of file
diff --git a/pages/index/Salesranking/Vehicletype/Vehicletype.js b/pages/index/Salesranking/Vehicletype/Vehicletype.js
index 8e8f722..51b088e 100644
--- a/pages/index/Salesranking/Vehicletype/Vehicletype.js
+++ b/pages/index/Salesranking/Vehicletype/Vehicletype.js
@@ -23,7 +23,7 @@ Component({
overlay: true,
showChart: true,
//图表
- positiveOption:brokenLine(dName,dValue,dColor,data),
+ // positiveOption:brokenLine(dName,dValue,dColor,data),
imageUrl: getApp().globalData.imageUrl,
date:'2021-01',
accountIndex:0,
@@ -43,9 +43,7 @@ Component({
let sStartTime = wx.getStorageSync("sStartTime") || '';
let sEndTime = wx.getStorageSync("sEndTime") || '';
this.getData(sTimeType, sStartTime, sEndTime);
- this.getTrend();
- }
-
+ }
},
onLoad() {
let pages = getCurrentPages();
@@ -55,14 +53,14 @@ Component({
id: options.id
})
},
- onShow() {
+ onShow() {
this.getData().then(() => {
this.getLikeData()
})
},
//页面上拉触底事件的处理函数
onReachBottom: function () {
- console.log("上拉触底事件")
+ // console.log("上拉触底事件")
let that = this
if (!that.data.loadMore) {
that.setData({
@@ -81,7 +79,7 @@ Component({
wx.showToast({
title: '加载中',
icon: 'loading',
- duration: 300000
+ duration: 3000
})
this.getAmount(sTimeType, sStartTime, sEndTime),
this.getTrend()
@@ -90,7 +88,6 @@ Component({
},500)
},
getTrend(){
-
let obj = {
action: 'getCheZhuCarSeriesRankingHome',
sType:'Marketing',
@@ -122,8 +119,6 @@ Component({
this.setData({
ranking:arr
})
- console.log('22',arr)
-
}).then(res =>{
if (res && res.length > 0) {
iPageIndex++;
@@ -188,7 +183,7 @@ Component({
}
arr.push(obj)
})
- console.log(arr)
+ // console.log(arr)
this.setData({
grades1:arr,
})
@@ -201,8 +196,8 @@ Component({
}else{
this.data.builds = e.detail.val
}
- console.log(this.data.roomLevel)
- console.log(this.data.builds)
+ // console.log(this.data.roomLevel)
+ // console.log(this.data.builds)
},
bindShowMsg(e){
var id=e.currentTarget.id
@@ -245,7 +240,7 @@ Component({
var name=e.currentTarget.dataset.name.name
var value=e.currentTarget.dataset.name.value
wx.setStorageSync('sSpec',value)
- console.log(value)
+ // console.log(value)
this.setData({
grade_name1:name,
select1:false
@@ -320,7 +315,7 @@ Component({
})
},
bindAccountChange(e){
- console.log('切换改变的值', e.detail.value);
+ // console.log('切换改变的值', e.detail.value);
this.setData({
accountIndex: e.detail.value
})
@@ -328,9 +323,28 @@ Component({
//弹出框
popup(e) {
let duration = this.data.duration
+ let models=e.currentTarget.dataset.car
+
+ app.globalData.request({
+ action:"getCheZhuCarSeriesListHome",
+ sType:"Marketing",
+ sSeriesName:models}).then(res => {
+ const dataTime=[]
+ const dataCar=[]
+ for(let i=0;i<6;i++){
+ // console.log((res[i].sourcetime).substring(5,7))
+ if((res[i].sourcetime).substring(5,6)=="0"){
+ console.log((res[i].sourcetime).substring((res[i].sourcetime).length-1,(res[i].sourcetime).length))
+ // dataTime.push()
+ }
+
+ dataCar.push(res[i].carseries)
+ }
+
+ })
this.setData({
show: true,
- duration
+ duration,
})
},
exit() {
diff --git a/pages/index/Salesranking/Vehicletype/Vehicletype.wxml b/pages/index/Salesranking/Vehicletype/Vehicletype.wxml
index 5fbaaba..97ea9fd 100644
--- a/pages/index/Salesranking/Vehicletype/Vehicletype.wxml
+++ b/pages/index/Salesranking/Vehicletype/Vehicletype.wxml
@@ -81,7 +81,7 @@
品牌名称
销量
-
+
@@ -104,7 +104,7 @@
{{item.volume}}
-
+
销量趋势
@@ -116,7 +116,7 @@
正在载入更多...
已加载全部
-
+
+
+
+
+
+ 销量趋势
+
+
+
+
+ 宏光MINIEV销量趋势
+
+
+
+
+