Quellcode durchsuchen

我的2.0版本

xulihua vor 5 Jahren
Ursprung
Commit
a844de8227
5 geänderte Dateien mit 215 neuen und 62 gelöschten Zeilen
  1. 111 58
      pages/attention/attention.js
  2. 43 2
      pages/attention/attention.wxml
  3. 59 1
      pages/attention/attention.wxss
  4. 1 0
      pages/me/me.wxss
  5. 1 1
      project.config.json

+ 111 - 58
pages/attention/attention.js

@@ -1,66 +1,119 @@
-// pages/attention/attention.js
+import * as echarts from '../../ec-canvas/echarts';
+
+var app = getApp()
+function initChart(canvas, width, height, dpr, data) {
+  const chart = echarts.init(canvas, null, {
+    width: width,
+    height: height,
+    devicePixelRatio: dpr // new
+  });
+  canvas.setChart(chart);
+
+  var option = {
+    xAxis : {
+          type : 'category',
+          splitNumber: 2,
+          scale: true,
+          show:false,
+          splitLine:{
+      show:false
+        }
+      },
+  yAxis : {
+          type : 'value',
+          splitNumber: 2,
+          scale: true,
+          show:false,
+          splitLine:{
+      show:false
+       }
+      },
+    
+    series: [{
+      type: 'line',
+      smooth: true,
+      symbol: 'none',
+      lineStyle: {
+        color: '#D81E06',
+    },
+      data:data,
+      areaStyle: {
+        color: '#D81E06',
+      },
+    }]
+  };
+
+  chart.setOption(option);
+  return chart;
+}
+
 Page({
 
-  /**
-   * 页面的初始数据
-   */
   data: {
+    // 页面配置  
+    winWidth: 0,
+    winHeight: 0,
+    // tab切换 
+    currentTab: 0,
+    ec: {
+      onInit: initChart
+    },
+    array:[
+      {
+        title:'AppL',
+        subtitle:"APPL INC",
+        Increase:"1.22",
+        digital:"33",
+        data:[52,56,355,444]
+      },
+      {
+        title:'AppL',
+        subtitle:"APPL INC",
+        Increase:"1.22",
+        digital:"33",
+        data:[52,56,355,444,52,56,355,444,52,56,355,444,2]
+      },
+      {
+        title:'AppL',
+        subtitle:"APPL INC",
+        Increase:"1.22",
+        digital:"33",
+        data:[52,56,355,44554]
+      },
+      {
+        title:'AppL',
+        subtitle:"APPL INC",
+        Increase:"1.22",
+        digital:"33",
+        data:[52,56,355,444]
+      },
+      {
+        title:'AppL',
+        subtitle:"APPL INC",
+        Increase:"1.22",
+        digital:"33",
+        data:[52,56,355,444]
+      }
+    ],
 
   },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
+  onLoad: function() {
+    var that = this;
+    // 获取系统信息 
+    wx.getSystemInfo({
+      success: function(res) {
+        
+        that.setData({
+          winWidth: res.windowWidth,
+          winHeight: res.windowHeight
+        });
+      }
+    });
   },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
+  open: function (e) {
+    console.log(e)
+    wx.navigateTo({
+      url: '../item/item'
+    });
   }
 })

+ 43 - 2
pages/attention/attention.wxml

@@ -1,2 +1,43 @@
-<!--pages/attention/attention.wxml-->
-<text>关注</text>
+
+
+<swiper current="{{currentTab}}" class="swiper-box" duration="300"  style="height:{{winHeight - 48}}px" bindchange="bindChange">
+  <swiper-item>
+    <scroll-view scroll-y style="height: 100%;">
+      <view wx:for="{{array}}"class="swiper-box-view" wx:key="index" bindtap="open" data-index="{{index}}">
+        <view class="swiper-box-left">
+          <view>{{item.title}}</view>
+          <view class="swiper-box-subtitle">{{item.subtitle}}</view>
+        </view>
+        <view class="swiper-box-right">
+          <view class="swiper-box-canvas">
+            <ec-canvas  id="mychart-dom-line" canvas-id="mychart-line" tuData="{{ item.data }}" ec="{{ ec }}"></ec-canvas>
+          </view>
+          <view class="swiper-box-button">
+            <view>{{item.digital}}</view>
+            <button  class="mini-btn" type="warn" size="mini" >+{{item.Increase}}</button>
+          </view>
+        </view>
+      </view>
+    </scroll-view>
+  </swiper-item>
+  <swiper-item>
+    <scroll-view scroll-y style="height: 100%;">
+      <view wx:for="{{array}}"class="swiper-box-view" wx:key="index" bindtap="open" data-index="{{index}}">
+        <view class="swiper-box-left">
+          <view>{{item.title}}</view>
+          <view class="swiper-box-subtitle">{{item.subtitle}}</view>
+        </view>
+        <view class="swiper-box-right">
+          <view class="swiper-box-canvas">
+            <ec-canvas  id="mychart-dom-line" canvas-id="mychart-line" tuData="{{ item.data }}" ec="{{ ec }}"></ec-canvas>
+          </view>
+          <view class="swiper-box-button">
+            <view>{{item.digital}}</view>
+            <button class="mini-btn" type="warn" size="mini">+{{item.Increase}}</button>
+          </view>
+        </view>
+      </view>
+    </scroll-view>
+  </swiper-item>
+</swiper>
+

+ 59 - 1
pages/attention/attention.wxss

@@ -1 +1,59 @@
-/* pages/attention/attention.wxss */
+page {
+  background: #000;
+}  
+.swiper-tab {
+  width: 100%;
+  text-align: center;
+  line-height: 80rpx;
+}
+
+.swiper-tab-list {
+  font-size: 30rpx;
+  display: inline-block;
+  width: 30%;
+  color: #777;
+}
+
+.on {
+  color: #D81E06;
+  border-bottom: 5rpx solid #D81E06;
+}
+
+.swiper-box {
+  display: block;
+  height: 100%;
+  width: 100%;
+  overflow: hidden;
+  color: #fff;
+}
+
+.swiper-box .swiper-box-view {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+  margin: 10rpx;
+ border-bottom: 1rpx slategray solid;
+}
+ec-canvas {
+  width: 100%;
+  height: 100%;
+
+  }
+  .swiper-box .swiper-box-view .swiper-box-left .swiper-box-subtitle{
+    color: slategray;
+  }
+  .swiper-box .swiper-box-view .swiper-box-right{
+    display: flex;
+    align-items: center;
+  }
+.swiper-box .swiper-box-view .swiper-box-right .swiper-box-canvas {
+  height: 120rpx;
+  width: 300rpx;
+}
+.swiper-box .swiper-box-view .swiper-box-right .swiper-box-button{
+  text-align: right;
+}
+.swiper-box .swiper-box-view .swiper-box-right .swiper-box-button button{
+  color: #fff;
+  background: #D81E06;
+}

+ 1 - 0
pages/me/me.wxss

@@ -41,6 +41,7 @@
 .seasonRight,.yearRight{
   float:right;
   margin-top:5%;
+  margin-right:5%;
 }
 .seasonOpen,.yearOpen{
   margin-top:10px;

+ 1 - 1
project.config.json

@@ -25,7 +25,7 @@
 			"disablePlugins": [],
 			"outputPath": ""
 		},
-		"useCompilerModule": true,
+		"useCompilerModule": false,
 		"userConfirmedUseCompilerModuleSwitch": false,
 		"compileHotReLoad": false,
 		"useIsolateContext": true