|
@@ -9,6 +9,7 @@ Page({
|
|
|
url:'../../images/timg.jpg',
|
|
|
motto: '',
|
|
|
currentTab: 0,
|
|
|
+ winheight:0,
|
|
|
userInfo: {},
|
|
|
hasUserInfo: false,
|
|
|
canIUse: wx.canIUse('button.open-type.getUserInfo'),
|
|
@@ -16,145 +17,21 @@ Page({
|
|
|
pages:0,//每页条数
|
|
|
total:0,//总条数
|
|
|
aa:[],//列表
|
|
|
-
|
|
|
+ loading: false,
|
|
|
imagewidth: 0,//缩放后的宽
|
|
|
imageheight: 0,//缩放后的高
|
|
|
chartData:{
|
|
|
- // 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',
|
|
|
- // ]
|
|
|
+
|
|
|
},
|
|
|
chartDatas:{
|
|
|
- // 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'
|
|
|
- // ]
|
|
|
+
|
|
|
},
|
|
|
ec: {
|
|
|
onInit: true,
|
|
|
// lazyLoad: true // 延迟加载
|
|
|
},
|
|
|
- // ec: {
|
|
|
- // onInit: function (canvas, width, height) {
|
|
|
- // chart = echarts.init(canvas, null, {
|
|
|
- // width: width,
|
|
|
- // height: height
|
|
|
- // });
|
|
|
- // canvas.setChart(chart);
|
|
|
- // return chart;
|
|
|
- // },
|
|
|
- // lazyLoad: true // 延迟加载
|
|
|
- // },
|
|
|
+
|
|
|
aa:[
|
|
|
- // {
|
|
|
- // id:'0',
|
|
|
- // from:"Investing.com 中文",
|
|
|
- // nickName:"买入波音(BA.US)好时机?两个问题没解决之前劝你住手",
|
|
|
- // reward:"今年迄今,美股航空板块受到公共卫生事件的冲击.....",
|
|
|
- // time:"6天前"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id:'1',
|
|
|
- // from:"chinese.aljazeera.net",
|
|
|
- // nickName: "波音裁员超1.2万人与警惕最坏时刻尚未到来",
|
|
|
- // reward: "波音公司当地时间27日宣布,将在美国裁减超1...",
|
|
|
- // time:"6天前"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id:'2',
|
|
|
- // from:"Investing.com 中文",
|
|
|
- // nickName: "美股异动|波音737MAX客机恢复生产,盘前涨逾5%",
|
|
|
- // reward: "Reuters.美股异动|波音(BA.US)737MAX客...",
|
|
|
- // time:"5天前"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id:'3',
|
|
|
- // from:"Investing.com 中文",
|
|
|
- // nickName:"买入波音(BA.US)好时机?两个问题没解决之前劝你住手",
|
|
|
- // reward:"今年迄今,美股航空板块受到公共卫生事件的冲击.....",
|
|
|
- // time:"6天前"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id:'4',
|
|
|
- // from:"chinese.aljazeera.net",
|
|
|
- // nickName: "波音裁员超1.2万人与警惕最坏时刻尚未到来",
|
|
|
- // reward: "波音公司当地时间27日宣布,将在美国裁减超1...",
|
|
|
- // time:"6天前"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id:'5',
|
|
|
- // from:"Investing.com 中文",
|
|
|
- // nickName: "美股异动|波音737MAX客机恢复生产,盘前涨逾5%",
|
|
|
- // reward: "Reuters.美股异动|波音(BA.US)737MAX客...",
|
|
|
- // time:"5天前"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id:'6',
|
|
|
- // from:"Investing.com 中文",
|
|
|
- // nickName:"买入波音(BA.US)好时机?两个问题没解决之前劝你住手",
|
|
|
- // reward:"今年迄今,美股航空板块受到公共卫生事件的冲击.....",
|
|
|
- // time:"6天前"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id:'7',
|
|
|
- // from:"chinese.aljazeera.net",
|
|
|
- // nickName: "波音裁员超1.2万人与警惕最坏时刻尚未到来",
|
|
|
- // reward: "波音公司当地时间27日宣布,将在美国裁减超1...",
|
|
|
- // time:"6天前"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id:'8',
|
|
|
- // from:"Investing.com 中文",
|
|
|
- // nickName: "美股异动|波音737MAX客机恢复生产,盘前涨逾5%",
|
|
|
- // reward: "Reuters.美股异动|波音(BA.US)737MAX客...",
|
|
|
- // time:"5天前"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id:'9',
|
|
|
- // from:"Investing.com 中文",
|
|
|
- // nickName:"买入波音(BA.US)好时机?两个问题没解决之前劝你住手",
|
|
|
- // reward:"今年迄今,美股航空板块受到公共卫生事件的冲击.....",
|
|
|
- // time:"6天前"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id:'10',
|
|
|
- // from:"chinese.aljazeera.net",
|
|
|
- // nickName: "波音裁员超1.2万人与警惕最坏时刻尚未到来",
|
|
|
- // reward: "波音公司当地时间27日宣布,将在美国裁减超1...",
|
|
|
- // time:"6天前"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id:'11',
|
|
|
- // from:"Investing.com 中文",
|
|
|
- // nickName: "美股异动|波音737MAX客机恢复生产,盘前涨逾5%",
|
|
|
- // reward: "Reuters.美股异动|波音(BA.US)737MAX客...",
|
|
|
- // time:"5天前"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id:'12',
|
|
|
- // from:"Investing.com 中文",
|
|
|
- // nickName:"买入波音(BA.US)好时机?两个问题没解决之前劝你住手",
|
|
|
- // reward:"今年迄今,美股航空板块受到公共卫生事件的冲击.....",
|
|
|
- // time:"6天前"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id:'13',
|
|
|
- // from:"chinese.aljazeera.net",
|
|
|
- // nickName: "波音裁员超1.2万人与警惕最坏时刻尚未到来",
|
|
|
- // reward: "波音公司当地时间27日宣布,将在美国裁减超1...",
|
|
|
- // time:"6天前"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id:'14',
|
|
|
- // from:"Investing.com 中文",
|
|
|
- // nickName: "美股异动|波音737MAX客机恢复生产,盘前涨逾5%",
|
|
|
- // reward: "Reuters.美股异动|波音(BA.US)737MAX客...",
|
|
|
- // time:"5天前"
|
|
|
- // },
|
|
|
],
|
|
|
},
|
|
|
|
|
@@ -168,7 +45,9 @@ Page({
|
|
|
getHz:function(){
|
|
|
apiServer.getHz().then((res) =>{
|
|
|
if(res.statusCode == 200){
|
|
|
-
|
|
|
+ this.setData({
|
|
|
+ loading:false
|
|
|
+ })
|
|
|
this.onComponent.init((canvas, width, height,dpr) => {
|
|
|
// 初始化图表
|
|
|
const Chart = echarts.init(canvas, null, {
|
|
@@ -187,6 +66,9 @@ Page({
|
|
|
apiServer.getSz().then((res) =>{
|
|
|
if(res.statusCode == 200){
|
|
|
console.log(res);
|
|
|
+ this.setData({
|
|
|
+ loading:false
|
|
|
+ })
|
|
|
this.deppComponnet.init((canvas, width, height,dpr) => {
|
|
|
// 初始化图表
|
|
|
const Chart = echarts.init(canvas, null, {
|
|
@@ -472,6 +354,16 @@ Page({
|
|
|
// console.log(res.top);
|
|
|
// }).exec();
|
|
|
},
|
|
|
+ //下拉刷新
|
|
|
+ onRefresh: function(e) {
|
|
|
+ this.setData({
|
|
|
+ currentPage: 1,
|
|
|
+ loading:true
|
|
|
+ })
|
|
|
+ this.getHz();
|
|
|
+ this.getSz();
|
|
|
+ getNewsList(this);
|
|
|
+},
|
|
|
onLoad: function (options) {
|
|
|
this.onComponent = this.selectComponent('#mychart-dom-line-on');
|
|
|
this.deppComponnet = this.selectComponent('#mychart-dom-line-depp');
|
|
@@ -490,44 +382,9 @@ Page({
|
|
|
}
|
|
|
let height = windowHeight-statusHeight-navHeight;
|
|
|
this.setData({
|
|
|
- height:height
|
|
|
+ winheight:height
|
|
|
})
|
|
|
- // this.echartsComponnet = this.selectComponent('#mychart');
|
|
|
- // console.log(this.echartsComponnet);
|
|
|
- // //如果是第一次绘制
|
|
|
- // if (!Chart) {
|
|
|
- // this.init_echarts(); //初始化图表
|
|
|
- // } else {
|
|
|
- // this.setOption(Chart); //更新数据
|
|
|
- // }
|
|
|
|
|
|
- // this.computeScrollViewHeight();
|
|
|
- // if (app.globalData.userInfo) {
|
|
|
- // this.setData({
|
|
|
- // userInfo: app.globalData.userInfo,
|
|
|
- // hasUserInfo: true
|
|
|
- // })
|
|
|
- // } else if (this.data.canIUse){
|
|
|
- // // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|
|
- // // 所以此处加入 callback 以防止这种情况
|
|
|
- // app.userInfoReadyCallback = res => {
|
|
|
- // this.setData({
|
|
|
- // userInfo: res.userInfo,
|
|
|
- // hasUserInfo: true
|
|
|
- // })
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // // 在没有 open-type=getUserInfo 版本的兼容处理
|
|
|
- // wx.getUserInfo({
|
|
|
- // success: res => {
|
|
|
- // app.globalData.userInfo = res.userInfo
|
|
|
- // this.setData({
|
|
|
- // userInfo: res.userInfo,
|
|
|
- // hasUserInfo: true
|
|
|
- // })
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
},
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
@@ -563,22 +420,22 @@ Page({
|
|
|
|
|
|
},
|
|
|
computeScrollViewHeight() {
|
|
|
- var that = this
|
|
|
- let query = wx.createSelectorQuery().in(that)
|
|
|
- query.select('.swiper-tab').boundingClientRect()
|
|
|
- query.select('.chart').boundingClientRect()
|
|
|
- query.select('.news').boundingClientRect()
|
|
|
- query.exec(res => {
|
|
|
- let topHeight = res[0].height
|
|
|
- let searchHeight = res[1].height
|
|
|
- let titleHeight = res[2].height
|
|
|
- let windowHeight = wx.getSystemInfoSync().windowHeight
|
|
|
- let windowWidth = wx.getSystemInfoSync().windowWidth
|
|
|
- let height = windowHeight - topHeight - searchHeight - titleHeight
|
|
|
- let ratio = 750 / windowWidth
|
|
|
- let scrollHeight = height * ratio
|
|
|
- that.setData({ scrollHeight: scrollHeight})
|
|
|
- })
|
|
|
+ // var that = this
|
|
|
+ // let query = wx.createSelectorQuery().in(that)
|
|
|
+ // query.select('.swiper-tab').boundingClientRect()
|
|
|
+ // query.select('.chart').boundingClientRect()
|
|
|
+ // query.select('.news').boundingClientRect()
|
|
|
+ // query.exec(res => {
|
|
|
+ // let topHeight = res[0].height
|
|
|
+ // let searchHeight = res[1].height
|
|
|
+ // let titleHeight = res[2].height
|
|
|
+ // let windowHeight = wx.getSystemInfoSync().windowHeight
|
|
|
+ // let windowWidth = wx.getSystemInfoSync().windowWidth
|
|
|
+ // let height = windowHeight - topHeight - searchHeight - titleHeight
|
|
|
+ // let ratio = 750 / windowWidth
|
|
|
+ // let scrollHeight = height * ratio
|
|
|
+ // that.setData({ scrollHeight: scrollHeight})
|
|
|
+ // })
|
|
|
},
|
|
|
imageLoad: function (e) {
|
|
|
var imageSize = imageUtil.imageUtil(e)
|
|
@@ -689,7 +546,8 @@ if(!isMerge){
|
|
|
aa,
|
|
|
currPage:res.data.data.current,
|
|
|
pages: res.data.data.pages,
|
|
|
- total: res.data.data.total
|
|
|
+ total: res.data.data.total,
|
|
|
+ loading:false
|
|
|
})
|
|
|
}
|
|
|
// that.isLoading = false
|