lx 5 år sedan
förälder
incheckning
2681308ffe
6 ändrade filer med 46 tillägg och 24 borttagningar
  1. 10 3
      api/request.js
  2. 2 1
      api/urls.js
  3. 26 12
      pages/index/index.js
  4. 5 5
      pages/index/index.wxml
  5. 2 2
      pages/index/index.wxss
  6. 1 1
      project.config.json

+ 10 - 3
api/request.js

@@ -40,12 +40,19 @@ const service = {
   }
 }
 module.exports = {
-  //沪深
-  getHushen:(data) =>{
+  //上证
+  getHz:(data) =>{
     return new Promise((resolve,reject)=> {
-      resolve(service.get(urls.hushen,data))
+      resolve(service.get(urls.hz,data))
     })
   },
+ //深证
+ getSz:(data) =>{
+  return new Promise((resolve,reject)=> {
+    resolve(service.get(urls.sz,data))
+  })
+},
+
   // 获取新闻列表
   getNewsList: (data) => {
     return new Promise((resolve,reject)=> {

+ 2 - 1
api/urls.js

@@ -1,7 +1,8 @@
 const host = 'http://192.168.1.73:28002';
 
 const urls ={
-    hushen:host + '/api/his/hushen',
+    hz:host + '/api/his/hz',
+    sz:host+ '/api/his/sz',
     newsList:host + '/api/news/list',
     detail:host +'/api/news/details',
     search: host + '/api/news/search',

+ 26 - 12
pages/index/index.js

@@ -169,14 +169,14 @@ Page({
 
     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',
-    //   ]
-    // },
+    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],
@@ -314,9 +314,9 @@ Page({
       url: '../logs/logs'
     })
   },
-  //沪深
-  getHushen:function(){
-    apiServer.getHushen().then((res) =>{
+  //上证
+  getHz:function(){
+    apiServer.getHz().then((res) =>{
       if(res.statusCode == 200){
         console.log(res);
           this.setData({
@@ -325,6 +325,17 @@ Page({
       }
     })
   },
+  //深证
+  getSz:function(){
+    apiServer.getSz().then((res) =>{
+      if(res.statusCode == 200){
+        console.log(res);
+          this.setData({
+            chartData:this.recursion(res.data.data),
+        })
+      }
+    })
+  },
   recursion:function(row,a=[],b=[],c=[],d){
     for(let i in row.actuals){
     a.unshift(row.actuals[i].industryDate)
@@ -346,8 +357,9 @@ Page({
     // }).exec();
  },
   onLoad: function (options) {
+    this.getHz();
+    this.getSz();
     getNewsList(this);
-    this.getHushen();
     let sysinfo = wx.getSystemInfoSync(),
     windowHeight = sysinfo.windowHeight,
     statusHeight = sysinfo.statusBarHeight, 
@@ -404,12 +416,14 @@ Page({
      */
     onPullDownRefresh: function () {
       //下拉刷新,重新初始化,isMerge = false
+      console.log("1312432");
       getNewsList(this);
   },
   /**
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
+    console.log("触发")
       setPage(this);
   },
   computeScrollViewHeight() {

+ 5 - 5
pages/index/index.wxml

@@ -5,9 +5,9 @@
 <navBar></navBar>
 <view class="container" style="height:{{height}}px" >
   <view class="swiper-tab">
-    <!-- <view class="swiper-tab-list {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">沪深</view>
-    <view class="swiper-tab-list {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">港股</view> -->
-    <view class="swiper-tab-list">沪深</view>
+    <view class="swiper-tab-list {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">上证</view>
+    <view class="swiper-tab-list {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">深证</view>
+    <!-- <view class="swiper-tab-list">沪深</view> -->
     <!-- <image class="image" src="./images/001.png" bindtap='choose'></image> -->
   </view>
   <!-- <view class="userinfo">
@@ -43,9 +43,9 @@
        <ec-canvas  id="mychart-dom-line" canvas-id="mychart-line" tuData="{{ chartDatas }}" ec="{{ ec }}"></ec-canvas>
      </view>
     </swiper-item>
-    <!-- <swiper-item catchtouchmove='catchTouchMove'>
+    <swiper-item catchtouchmove='catchTouchMove'>
       <ec-canvas  id="mychart-dom-line" canvas-id="mychart-line" tuData="{{ chartData }}" ec="{{ ec }}"></ec-canvas>
-    </swiper-item> -->
+    </swiper-item>
    </swiper>
         <!-- <view class="middleCharts">
           <ec-canvas id="mychart-dom-line" canvas-id="mychart-line" tuData=" {{ chartData }}" ec="{{ ec }}"></ec-canvas>

+ 2 - 2
pages/index/index.wxss

@@ -43,8 +43,8 @@ ec-canvas {
 }
 .swiper-tab {
   width: 100%;
-  margin-left: 80rpx;
-  /* text-align: center; */
+  /* margin-left: 80rpx; */
+  text-align: center;
   line-height: 80rpx;
   position: relative;
   color: #fff;

+ 1 - 1
project.config.json

@@ -20,7 +20,6 @@
 		"checkInvalidKey": true,
 		"checkSiteMap": true,
 		"uploadWithSourceMap": true,
-		"compileHotReLoad": false,
 		"babelSetting": {
 			"ignore": [],
 			"disablePlugins": [],
@@ -28,6 +27,7 @@
 		},
 		"useCompilerModule": true,
 		"userConfirmedUseCompilerModuleSwitch": false,
+		"compileHotReLoad": false,
 		"useIsolateContext": true
 	},
 	"compileType": "miniprogram",