|
@@ -334,6 +334,7 @@ Page({
|
|
|
},
|
|
|
// 点击tab切换
|
|
|
swichNav: function(e) {
|
|
|
+ console.log(e)
|
|
|
var that = this;
|
|
|
if (this.data.currentTab === e.target.dataset.current) {
|
|
|
return false;
|
|
@@ -347,49 +348,64 @@ Page({
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
- // console.log(options)
|
|
|
+ console.log(options)
|
|
|
var Name = "object.Name"
|
|
|
var value = "object.value"
|
|
|
var color='object.color'
|
|
|
let realcolor="realchartData.color",nextcolor="nextchartData.color", Values,colors
|
|
|
- if(JSON.parse(options.row).Tag){
|
|
|
- Values="+"+JSON.parse(options.row).Value.toFixed(2)+"%";
|
|
|
+ if(JSON.parse(options.row).industryTag){
|
|
|
+ Values="+"+JSON.parse(options.row).industryValue.toFixed(2)+"%";
|
|
|
colors="#D81E06";
|
|
|
}else{
|
|
|
- Values="-"+JSON.parse(options.row).Value.toFixed(2)+"%"
|
|
|
+ Values="-"+JSON.parse(options.row).industryValue.toFixed(2)+"%"
|
|
|
colors="#07c160"
|
|
|
|
|
|
}
|
|
|
this.setData({
|
|
|
- [Name]:JSON.parse(options.row).Name,
|
|
|
+ [Name]:JSON.parse(options.row).industryName,
|
|
|
[value]:Values,
|
|
|
[color]:colors,
|
|
|
[realcolor]:colors,
|
|
|
[nextcolor]:colors,
|
|
|
})
|
|
|
var that = this;
|
|
|
- that.postbyiid(JSON.parse(options.row).IID,)
|
|
|
- that.postnewsbyiid(JSON.parse(options.row).IID)
|
|
|
+ that.posthisfind(JSON.parse(options.row).industryId,)
|
|
|
+ that.postpredfind(JSON.parse(options.row).industryId,)
|
|
|
},
|
|
|
//获取数据
|
|
|
- postbyiid:function(){
|
|
|
+ posthisfind:function(){
|
|
|
var that = this;
|
|
|
- var postbyiid = wxRequest.postRequest(Api.postbyiid(),{'iid':'12'});
|
|
|
+ var postbyiid = wxRequest.postRequest(Api.posthisfind(),['880493']);
|
|
|
postbyiid.then((res)=>{
|
|
|
- // console.log(res)
|
|
|
+ console.log(res)
|
|
|
// console.log(that.recursion(res.data))
|
|
|
if(res.statusCode==200){
|
|
|
that.setData({
|
|
|
- realchartData:that.recursion(res.data)
|
|
|
+ realchartData:that.recursion(res.data.data),
|
|
|
+ newsData:res.data.data.news
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ //获取下周预测数据
|
|
|
+ postpredfind:function(){
|
|
|
+ var that = this;
|
|
|
+ var postbyiid = wxRequest.postRequest(Api.postpredfind(),['880493']);
|
|
|
+ postbyiid.then((res)=>{
|
|
|
+ console.log(res)
|
|
|
+ // console.log(that.recursion(res.data))
|
|
|
+ if(res.statusCode==200){
|
|
|
+ that.setData({
|
|
|
+ nextchartData:that.recursion(res.data.data),
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
recursion:function(row,a=[],b=[],c=[],d){
|
|
|
- for(let i in row.data){
|
|
|
- a.push(row.data[i].Date)
|
|
|
- b.push(row.data[i].Close)
|
|
|
- c.push(row.data[i].Pred)
|
|
|
+ for(let i in row.actuals){
|
|
|
+ a.unshift(row.actuals[i].industryDate)
|
|
|
+ b.unshift(row.actuals[i].close)
|
|
|
+ c.unshift(row.actuals[i].pred)
|
|
|
}
|
|
|
if(row.tag){
|
|
|
d="#D81E06"
|
|
@@ -399,27 +415,7 @@ Page({
|
|
|
|
|
|
return {"timeData":a,"actual":b,"prediction":c,"color":d}
|
|
|
},
|
|
|
- //获取新闻
|
|
|
- postnewsbyiid:function(){
|
|
|
- var that = this;
|
|
|
- var postbyiid = wxRequest.postRequest(Api.postnewsbyiid(),{'iid':'12'});
|
|
|
- postbyiid.then((res)=>{
|
|
|
- // console.log(res)
|
|
|
- // NID: "新闻id"
|
|
|
- // Title: "标题"
|
|
|
- // From: "来源"
|
|
|
- // MiniContent: "内容"
|
|
|
- // EID: ""
|
|
|
- // Date: "时间"
|
|
|
- // Tag: "情绪"
|
|
|
- // console.log(that.recursion(res.data))
|
|
|
- if(res.statusCode==200){
|
|
|
- that.setData({
|
|
|
- newsData:res.data.data
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|