zjh 5 年之前
父节点
当前提交
6195a53bd6

+ 6 - 0
api/request.js

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

+ 1 - 0
api/urls.js

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

+ 8 - 1
app.json

@@ -12,7 +12,8 @@
     "pages/item/item",
     "pages/auth/auth",
     "pages/search/search",
-    "pages/attention/attention"
+    "pages/attention/attention",
+    "pages/login/login"
   ],
   "window": {
     "backgroundTextStyle": "light",
@@ -49,6 +50,12 @@
         "iconPath": "images/tabBar004.png",
         "pagePath": "pages/me/me",
         "text": "我的"
+      },
+      {
+        "selectedIconPath": "images/tabBar014.png",
+        "iconPath": "images/tabBar004.png",
+        "pagePath": "pages/login/login",
+        "text": "login"
       }
     ]
   },

+ 3 - 3
pages/drop/drop.wxml

@@ -21,7 +21,7 @@
             </view> -->
             <view class="swiper-box-button">
               <!-- <view>{{item.digital}}</view> -->
-              <button  class="mini-btn" type="warn" size="mini" >+{{commom.Intercept(item.industryValue)}}%</button>
+              <button  class="mini-btn" type="warn" size="mini" >{{commom.Intercept(item.industryValue)}}%</button>
             </view>
           </view>
         </view>
@@ -42,7 +42,7 @@
             </view> -->
             <view class="swiper-box-button">
               <!-- <view>{{item.digital}}</view> -->
-              <button class="mini-btn" type="warn" size="mini">+{{commom.Intercept(item.industryValue)}}%</button>
+              <button class="mini-btn" type="warn" size="mini">{{commom.Intercept(item.industryValue)}}%</button>
             </view>
           </view>
         </view>
@@ -63,7 +63,7 @@
             </view> -->
             <view class="swiper-box-button">
               <!-- <view>{{item.digital}}</view> -->
-              <button class="mini-btn" type="warn" size="mini">+{{commom.Intercept(item.industryValue)}}%</button>
+              <button class="mini-btn" type="warn" size="mini">{{commom.Intercept(item.industryValue)}}%</button>
             </view>
           </view>
         </view>

+ 36 - 11
pages/index/index.js

@@ -161,16 +161,17 @@ Page({
     userInfo: {},
     hasUserInfo: false,
     canIUse: wx.canIUse('button.open-type.getUserInfo'),
+
     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],
@@ -179,7 +180,8 @@ Page({
         ]
       },
       ec: {
-        onInit: initChart
+        onInit: initChart,
+        // lazyLoad: true // 延迟加载
       },
     // ec: {
     //   onInit: function (canvas, width, height) {
@@ -316,6 +318,30 @@ Page({
       url: '../logs/logs'
     })
   },
+  //沪深
+  getHushen:function(){
+    apiServer.getHushen().then((res) =>{
+      if(res.statusCode == 200){
+        console.log(res);
+          this.setData({
+            chartDatas:this.recursion(res.data.data),
+        })
+      }
+    })
+  },
+  recursion:function(row,a=[],b=[],c=[],d){
+    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"
+    }else{
+      d="#07c160"
+    }
+  return {"timeData":a,"actual":b,"prediction":c,"color":d}
+  },
   onReady: function (e) {
     this.computeScrollViewHeight();
     // var query = wx.createSelectorQuery()
@@ -325,6 +351,7 @@ Page({
  },
   onLoad: function () {
     this.getNewsList();
+    this.getHushen();
     let sysinfo = wx.getSystemInfoSync(),
     windowHeight = sysinfo.windowHeight,
     statusHeight = sysinfo.statusBarHeight, 
@@ -433,8 +460,6 @@ Page({
     catchTouchMove:function(res){
       return false
     },
-
-
   //初始化图表
   init_echarts: function () {
     this.echartsComponnet.init((canvas, width, height) => {

+ 6 - 5
pages/index/index.wxml

@@ -5,9 +5,10 @@
 <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>
-    <image class="image" src="./images/001.png" bindtap='choose'></image>
+    <!-- <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">
     <button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
@@ -42,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>

+ 4 - 2
pages/index/index.wxss

@@ -43,16 +43,18 @@ ec-canvas {
 }
 .swiper-tab {
   width: 100%;
-  text-align: center;
+  margin-left: 80rpx;
+  /* text-align: center; */
   line-height: 80rpx;
   position: relative;
+  color: #fff;
 }
 
 .swiper-tab-list {
   font-size: 30rpx;
   display: inline-block;
   width: 20%;
-  color: #777;
+  /* color: #777; */
 }
 .on {
   color: #D81E06;

+ 1 - 1
pages/item/item.js

@@ -361,7 +361,7 @@ Page({
        Values="+"+JSON.parse(options.row).industryValue.toFixed(2)+"%";
        colors="#D81E06";
     }else{
-      Values="-"+JSON.parse(options.row).industryValue.toFixed(2)+"%"
+      Values=JSON.parse(options.row).industryValue.toFixed(2)+"%"
       colors="#07c160"
 
     }

+ 68 - 0
pages/login/login.js

@@ -0,0 +1,68 @@
+// pages/login/login.js
+const app = getApp()
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+   
+    
+  },
+ 
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onLoad: function () {
+  
+    },
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 3 - 0
pages/login/login.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 7 - 0
pages/login/login.wxml

@@ -0,0 +1,7 @@
+<view class="container">
+  <view class='content'>
+    <view>申请获取以下权限</view>
+    <text>获得你的公开信息(昵称,头像等)</text>
+  </view>
+  <button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">授权登录(获取手机号)</button>
+</view>

+ 1 - 0
pages/login/login.wxss

@@ -0,0 +1 @@
+/* pages/login/login.wxss */

+ 7 - 0
project.config.json

@@ -26,9 +26,16 @@
 			"disablePlugins": [],
 			"outputPath": ""
 		},
+<<<<<<< HEAD
 		"useIsolateContext": true,
 		"useCompilerModule": false,
 		"userConfirmedUseCompilerModuleSwitch": false
+=======
+		"useCompilerModule": true,
+		"userConfirmedUseCompilerModuleSwitch": false,
+		"compileHotReLoad": false,
+		"useIsolateContext": true
+>>>>>>> 76272386d7c64b0315ecebaf5fac3f49a65ad141
 	},
 	"compileType": "miniprogram",
 	"libVersion": "2.11.1",