瀏覽代碼

跌幅页

xulihua 5 年之前
父節點
當前提交
b2505e0eff
共有 4 個文件被更改,包括 100 次插入7 次删除
  1. 38 3
      pages/drop/drop.js
  2. 19 2
      pages/drop/drop.wxml
  3. 42 1
      pages/drop/drop.wxss
  4. 1 1
      project.config.json

+ 38 - 3
pages/drop/drop.js

@@ -5,14 +5,30 @@ Page({
    * 页面的初始数据
    */
   data: {
-
+    winWidth: 0,
+    winHeight: 0,
+    currentTab: 0,    
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    var that = this;
+
+        /**
+         * 获取当前设备的宽高
+         */
+        wx.getSystemInfo( {
+
+            success: function( res ) {
+                that.setData( {
+                    winWidth: res.windowWidth,
+                    winHeight: res.windowHeight
+                });
+            }
 
+        });
   },
 
   /**
@@ -62,5 +78,24 @@ Page({
    */
   onShareAppMessage: function () {
 
-  }
-})
+  },
+      swichNav: function( e ) {
+
+        var that = this;
+
+        if( this.data.currentTab === e.target.dataset.current ) {
+            return false;
+        } else {
+            that.setData( {
+                currentTab: e.target.dataset.current
+            })
+        }
+    },
+
+    bindChange: function( e ) {
+
+        var that = this;
+        that.setData( { currentTab: e.detail.current });
+
+    },
+})

+ 19 - 2
pages/drop/drop.wxml

@@ -1,2 +1,19 @@
-<!--pages/drop/drop.wxml-->
-<text></text>
+<view class="bground">
+  <!-- <view class="dropTop">跌幅榜</view> -->
+  <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>
+
+<swiper current="{{currentTab}}" class="swiper-box" duration="300" style="height:{{winHeight - 31}}px" bindchange="bindChange">
+    <swiper-item>
+        <view>上周实际数据</view>
+    </swiper-item>
+    <swiper-item>
+        <view>上周预测数据</view>
+    </swiper-item>
+    
+</swiper>
+
+</view>

+ 42 - 1
pages/drop/drop.wxss

@@ -1 +1,42 @@
-/* pages/drop/drop.wxss */
+/* pages/drop/drop.wxss */
+.bground{
+  background:#000;
+  color:white;
+  height:100%;
+  width:100%;
+}
+.dropTop{
+  font-size:1.8rem;
+  position:relative;
+  color:red;
+  top:0;
+  left:0;
+  height:58px;
+  line-height:58px;
+  border-bottom:1px solid #fff;
+}
+.swiper-tab{
+  width: 100%;
+  text-align: center;
+  line-height: 80rpx;
+}
+.swiper-tab-list{ 
+   font-size: 30rpx;
+   display: inline-block;
+   width: 33.33%;
+   color: #777777;
+}
+.on{ 
+  color:#D81E06;
+  border-bottom: 3rpx solid #D81E06;
+}
+.swiper-box{ 
+  display: block; 
+  height: 100%;
+  width: 100%; 
+  overflow: hidden; 
+}
+.swiper-box view{
+
+  text-align: center;
+}

+ 1 - 1
project.config.json

@@ -10,8 +10,8 @@
 		"preloadBackgroundData": false,
 		"minified": true,
 		"newFeature": true,
-		"autoAudits": false,
 		"coverView": true,
+		"autoAudits": false,
 		"showShadowRootInWxmlPanel": true,
 		"scopeDataCheck": false,
 		"checkInvalidKey": true,