Bläddra i källkod

颜色细节处理

yangyongyong 4 år sedan
förälder
incheckning
b3c3e8f87d

+ 3 - 0
client/pages/servant/taskreminder/taskreminder.acss

@@ -42,6 +42,9 @@
   font-weight: normal;
   text-align: right;
 }
+.homecssname{
+  color: #09AFFF;
+}
 .tasks-line{
   background-color: #F3F3F3;
   border-top-right-radius: 28rpx;

+ 5 - 1
client/pages/servant/taskreminder/taskreminder.axml

@@ -4,7 +4,11 @@
  <view class="tasks-head">
       <view class="cell-title">
         <label>{{servantName}}</label>
-        <view class="cell-right" onTap="switchList">
+        <view class="cell-right" onTap="switchList" a:if="{{homecssname}}">
+          <image mode="scaleToFill" src="/image/switch-blue.png"/>
+          <label class="homecssname">切换到其他家庭</label>
+        </view>
+        <view class="cell-right" onTap="switchList" a:if="{{!homecssname}}">
           <image mode="scaleToFill" src="/image/switch-grey.png"/>
           <label>切换到其他家庭</label>
         </view>

+ 25 - 1
client/pages/servant/taskreminder/taskreminder.js

@@ -1,6 +1,7 @@
 var util = require('../../../util/util.js')
 import request from '../../../util/http'
 import apiUrl1 from '../../../util/apiUrl1'
+import apiUrl from '../../../util/apiUrl'
 var app = getApp();
 Page({
   data: {
@@ -25,6 +26,7 @@ Page({
     that.setnowweek();
     this.selectDayTaskItem();
     //this.selectDayTaskCost();
+    this.homelist();//计算家庭数量
   },
   setnowweek(){
     let data = this.data.datelist;
@@ -236,5 +238,27 @@ switchList(){
         }
       });
     });
-  }
+  },
+  //计算家庭数量
+  homelist(){
+    let params={
+        "servantId":app.globalData.userInfo.id,
+        "pageNo": 1,
+        "pageSize": 100,
+    }
+     request.httpServicePost(apiUrl.findByServantIdListPath,params).then(data=>{
+        console.log('多个家庭:'+data);
+        if(data.dataList.length>1){
+            this.setData({
+              homecssname:true
+            });
+        }else{
+          this.setData({
+              homecssname:false
+            });
+        }
+        }).catch(e=>{
+          console.log(e);
+      })
+  },
 });