|
@@ -11,21 +11,22 @@ timeData = timeData.map(function (str) {
|
|
|
});
|
|
|
|
|
|
var app = getApp()
|
|
|
+let chart = null;
|
|
|
+let real=null
|
|
|
+let under=null
|
|
|
+
|
|
|
function initChart(canvas, width, height, dpr, data) {
|
|
|
- const chart = echarts.init(canvas, null, {
|
|
|
+ chart = echarts.init(canvas, null, {
|
|
|
width: width,
|
|
|
height: height,
|
|
|
devicePixelRatio: dpr // new
|
|
|
});
|
|
|
canvas.setChart(chart);
|
|
|
-
|
|
|
- var option = {
|
|
|
+ console.log(data)
|
|
|
+ var option ={
|
|
|
title: {//标题
|
|
|
-
|
|
|
text: '',
|
|
|
-
|
|
|
left: 'center'
|
|
|
-
|
|
|
},
|
|
|
tooltip: {
|
|
|
trigger: 'axis',
|
|
@@ -114,8 +115,8 @@ function initChart(canvas, width, height, dpr, data) {
|
|
|
type: 'slider',
|
|
|
xAxisIndex: 0,
|
|
|
filterMode: 'empty',
|
|
|
- startValue: data.prediction.length -7,
|
|
|
- endValue: data.prediction.length ,
|
|
|
+ // startValue: data.prediction? data.prediction.length -7:0,
|
|
|
+ // endValue: data.prediction?data.prediction.length:3 ,
|
|
|
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
|
|
|
handleSize: '80%',
|
|
|
handleStyle: {
|
|
@@ -289,24 +290,23 @@ Page({
|
|
|
currentTab: 0,
|
|
|
button:"关注",
|
|
|
ec: {
|
|
|
- onInit: initChart
|
|
|
+ // onInit: initChart
|
|
|
},
|
|
|
realchartData:{
|
|
|
- actual:[552,586,3555,4454,552,556,4455],
|
|
|
- prediction:[552,546,3585,4424,542,546,35,44,524,56,355,444,2224,421],
|
|
|
- timeData : [
|
|
|
- '2020/6/1', '2020/6/2', '2020/6/3', '2020/6/4', '2020/6/5', '2020/6/6', '2020/6/7', '2020/6/8', '2020/6/9', '2020/6/10','2020/6/11',
|
|
|
- '2020/6/12','2020/6/13','2020/6/14',
|
|
|
- ],
|
|
|
- color:"crimson"
|
|
|
+ // actual:[572,556,3555,4744,552,576,3555],
|
|
|
+ // prediction:[572,556,3555,4744,552,576,3555],
|
|
|
+ // timeData : [
|
|
|
+ // '2020/6/1', '2020/6/2', '2020/6/3', '2020/6/4', '2020/6/5', '2020/6/6', '2020/6/7'
|
|
|
+ // ],
|
|
|
+ // color:"crimson"
|
|
|
},
|
|
|
nextchartData:{
|
|
|
- actual:[572,556,3555,4744,552,576,3555],
|
|
|
- prediction:[352,246,385,2424,542,546,255],
|
|
|
- timeData : [
|
|
|
- '2020/6/1', '2020/6/2', '2020/6/3', '2020/6/4', '2020/6/5', '2020/6/6', '2020/6/7'
|
|
|
- ],
|
|
|
- color:"crimson"
|
|
|
+ // actual:[572,556,3555,4744,552,576,3555],
|
|
|
+ // prediction:[352,246,385,2424,542,546,255],
|
|
|
+ // timeData : [
|
|
|
+ // '2020/6/1', '2020/6/2', '2020/6/3', '2020/6/4', '2020/6/5', '2020/6/6', '2020/6/7'
|
|
|
+ // ],
|
|
|
+ // color:"crimson"
|
|
|
},
|
|
|
object:{
|
|
|
Name:"appl",
|
|
@@ -318,13 +318,15 @@ Page({
|
|
|
catchTouchMove:function(res){
|
|
|
return false
|
|
|
},
|
|
|
+
|
|
|
// 滑动切换tab
|
|
|
bindChange: function(e) {
|
|
|
var that = this;
|
|
|
that.setData({
|
|
|
currentTab: e.detail.current
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
+
|
|
|
//点击新闻
|
|
|
onFold:function(e){
|
|
|
console.log( e.currentTarget.dataset.id);
|
|
@@ -343,16 +345,18 @@ Page({
|
|
|
currentTab: e.target.dataset.current
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
// console.log(options)
|
|
|
+ var that = this;
|
|
|
var Name = "object.Name"
|
|
|
var value = "object.value"
|
|
|
var color='object.color'
|
|
|
- let realcolor="realchartData.color",nextcolor="nextchartData.color", Values,colors
|
|
|
+ let Values,colors
|
|
|
if(JSON.parse(options.row).industryTag){
|
|
|
Values="+"+JSON.parse(options.row).industryValue.toFixed(2)+"%";
|
|
|
colors="#D81E06";
|
|
@@ -365,39 +369,49 @@ Page({
|
|
|
[Name]:JSON.parse(options.row).industryName,
|
|
|
[value]:Values,
|
|
|
[color]:colors,
|
|
|
- [realcolor]:colors,
|
|
|
- [nextcolor]:colors,
|
|
|
})
|
|
|
- var that = this;
|
|
|
that.posthisfind(JSON.parse(options.row).industryId,)
|
|
|
that.postpredfind(JSON.parse(options.row).industryId,)
|
|
|
},
|
|
|
//获取数据
|
|
|
- posthisfind:function(){
|
|
|
+ posthisfind:function(row){
|
|
|
+ // console.log(row)
|
|
|
var that = this;
|
|
|
- var postbyiid = wxRequest.postRequest(Api.posthisfind(),['880493']);
|
|
|
+ var postbyiid = wxRequest.postRequest(Api.posthisfind(),[row]);
|
|
|
postbyiid.then((res)=>{
|
|
|
console.log(res)
|
|
|
// console.log(that.recursion(res.data))
|
|
|
if(res.statusCode==200){
|
|
|
- that.setData({
|
|
|
- realchartData:that.recursion(res.data.data),
|
|
|
- newsData:res.data.data.news
|
|
|
- })
|
|
|
+ that.setData({
|
|
|
+ realchartData:that.recursion(res.data.data),
|
|
|
+ newsData:res.data.data.news,
|
|
|
+ })
|
|
|
+ initChart(real.detail.canvas, real.detail.width, real.detail.height,real.detail.dpr,that.recursion(res.data.data));
|
|
|
}
|
|
|
+
|
|
|
})
|
|
|
},
|
|
|
+ echartInit(e) {
|
|
|
+ console.log(e);
|
|
|
+ real=e
|
|
|
+ // initChart(e.detail.canvas, e.detail.width, e.detail.height,e.detail.dpr,e.target.dataset.record);
|
|
|
+ },
|
|
|
+ echartInitunder(e){
|
|
|
+ console.log(e);
|
|
|
+ under=e
|
|
|
+ // initChart(e.detail.canvas, e.detail.width, e.detail.height,e.detail.dpr,e.target.dataset.record);
|
|
|
+ },
|
|
|
//获取下周预测数据
|
|
|
- postpredfind:function(){
|
|
|
+ postpredfind:function(row){
|
|
|
var that = this;
|
|
|
- var postbyiid = wxRequest.postRequest(Api.postpredfind(),['880493']);
|
|
|
+ var postbyiid = wxRequest.postRequest(Api.postpredfind(),[row]);
|
|
|
postbyiid.then((res)=>{
|
|
|
console.log(res)
|
|
|
- // console.log(that.recursion(res.data))
|
|
|
if(res.statusCode==200){
|
|
|
that.setData({
|
|
|
nextchartData:that.recursion(res.data.data),
|
|
|
})
|
|
|
+ initChart(under.detail.canvas, under.detail.width, under.detail.height,under.detail.dpr,that.recursion(res.data.data));
|
|
|
}
|
|
|
})
|
|
|
},
|