Kaynağa Gözat

pref: optimize the home page display logic

wangyuan 2 yıl önce
ebeveyn
işleme
2721647d27
3 değiştirilmiş dosya ile 43 ekleme ve 36 silme
  1. 11 33
      pages/index/index.js
  2. 6 2
      pages/index/index.wxml
  3. 26 1
      pages/index/index.wxss

+ 11 - 33
pages/index/index.js

@@ -7,38 +7,7 @@ Page({
   data: {
     locationStr: '定位地址…',
     blanceCount: 0, // 剩余预约次数
-    fileInfoList: [
-      {
-        id: '0',
-        name: '测试用户',
-        data: '2022/09/14'
-      },
-      {
-        id: '0',
-        name: '测试用户',
-        data: '2022/09/14'
-      },
-      {
-        id: '0',
-        name: '测试用户',
-        data: '2022/09/14'
-      },
-      {
-        id: '0',
-        name: '测试用户',
-        data: '2022/09/14'
-      },
-      {
-        id: '0',
-        name: '测试用户',
-        data: '2022/09/14'
-      },
-      {
-        id: '0',
-        name: '测试用户',
-        data: '2022/09/14'
-      }
-    ]
+    fileInfoList: []
   },
 
   /**
@@ -75,7 +44,16 @@ Page({
   // 添加检测人
   handleAddCheck () {
     wx.navigateTo({
-      url: '/pages/createFile/createFile',
+      url: '/pages/createFile/createFile?form=index',
+    })
+  },
+  handleScanCode () {
+    wx.scanCode({
+      onlyFromCamera: true,
+      scanType: ['barCode','qrCode','datamatrix','pdf417'],
+      success (res) {
+        console.log(res);
+      }
     })
   }
 })

+ 6 - 2
pages/index/index.wxml

@@ -3,11 +3,11 @@
   <view class="header">
     <view class="main-header">
       <view class="location">
-        <view class="location-info">
+        <view class="location-info ittflex-jcs">
           <van-icon name="location" size="20px"/>
           <text class="l-text">{{locationStr}}</text>
         </view>
-        <view class="scan">
+        <view class="scan" bindtap="handleScanCode">
           <van-icon name="scan" size="20px"/>
         </view>
       </view>
@@ -35,6 +35,7 @@
     <view class="file-content">
       <block wx:if="{{fileInfoList.length == 0}}">
         <view class="no-data ittflex" >
+          <image class="nodata-img" src="../../imaes/quesheng1@2x.png"></image>
           <text class="none-data-text">暂无档案</text>
         </view>
       </block>
@@ -59,4 +60,7 @@
     </view>
     <view class="add-btn absolute-btn ittflex" bindtap="handleAddCheck">添加检测人</view>
   </view>
+  <view class="index-banner">
+    <image class="index-img" src="../../imaes/index.jpg"></image>
+  </view>
 </view>

+ 26 - 1
pages/index/index.wxss

@@ -16,11 +16,22 @@
 }
 .location {
   width: 100%;
-  height: 90rpx;
+  height: 100%;
   display: flex;
   justify-content: space-between;
   align-items: center;
 }
+.location-info {
+  width: 345rpx;
+  height: 100%;
+}
+.scan {
+  width: 100rpx;
+  height: 100%;
+  display: flex;
+  justify-content: flex-end;
+  align-items: center;
+}
 .l-text {
   font-size: 26rpx;
   font-weight: 400;
@@ -155,10 +166,15 @@
   width: 100%;
   height: 100%;
 }
+.nodata-img {
+  height: 156rpx;
+  width: 184rpx;
+}
 .none-data-text {
   font-size: 26rpx;
   font-weight: 400;
   color: #999999;
+  margin-left: 10rpx;
 }
 .file-item {
   width: 100%;
@@ -194,4 +210,13 @@
   font-weight: 400;
   color: #45A6B5;
   padding: 10px 0;
+}
+.index-banner {
+  width: 690rpx;
+  height: 690rpx;
+  margin: 40rpx auto 0;
+}
+.index-img {
+  width: 100%;
+  height: 100%;
 }