zhaoxiaohai преди 3 години
родител
ревизия
29534ed9be
променени са 4 файла, в които са добавени 270 реда и са изтрити 184 реда
  1. 138 119
      packageA/clockIn/index.js
  2. 96 46
      packageA/clockIn/index.scss
  3. 34 17
      packageA/clockIn/index.wxml
  4. 2 2
      utils/Http.js

+ 138 - 119
packageA/clockIn/index.js

@@ -1,126 +1,145 @@
 const _Http = getApp().globalData.http,
-	getHeight = require("../../utils/getRheRemainingHeight");
-
+  getHeight = require("../../utils/getRheRemainingHeight");
 
 Page({
-	data: {
-		list: [],
-	},
-	onLoad(options) {},
-	/* 日历加载完成 */
-	handleCalendarLoad({
-		detail
-	}) {
-		console.log("日历加载完成", detail)
-		/* let {
-			year,
-			month,
-			day
-		} = detail.date;
-		month = month < 10 ? "0" + month : month;
-		day = day < 10 ? "0" + day : day;
-		this.querySignIn(year + '-' + month + '-' + day) */
-	},
-	/* 日期发生变化 */
-	handleCalendarDateChange({
-		detail
-	}) {
-		console.log("日期发生变化", detail)
-		this.setData({
-			list: []
-		})
-		if (detail.date.marker) {
-			let {
-				year,
-				month,
-				day
-			} = detail.date;
-			month = month < 10 ? "0" + month : month;
-			day = day < 10 ? "0" + day : day;
-			this.querySignIn(year + '-' + month + '-' + day)
-		}
-	},
-	/* 查询签到日 */
-	checkIn(content) {
-		_Http.basic({
-			"accesstoken": "3614131fa126be7f41ea07d99b5d9fe6",
-			"id": 20221229150001,
-			content
-		}).then(res => {
-			console.log("查询签到日", content, res)
-			if (res.data.length) {
-				this.selectComponent("#calendar").setMarkers(res.data.map(v => {
-					let date = v.split("-");
-					return {
-						year: date[0],
-						month: date[1],
-						day: date[2],
-						type: "schedule",
-						mark: '签到',
-						color: '#2a97ff',
-						bgColor: '#cce6ff'
-					}
-				}))
-			}
-		})
-	},
-	/* 查询签到记录 */
-	querySignIn(signindate) {
-		_Http.basic({
-			"id": 20221229150101,
-			"content": {
-				signindate,
-				pageSize: 999
-			}
-		}).then(res => {
-			console.log('查询签到记录', res)
-			this.setData({
-				list: res.data
-			})
-		})
-	},
-	/* 日期范围发生变化 */
-	handleCalendarRangeChange({
-		detail
-	}) {
-		console.log("日期范围变化", detail)
-		let {
-			year,
-			month,
-			day
-		} = detail.curr;
+  data: {
+    list: [],
+    querysubhr: false
+  },
+  /* 切换查看列表 */
+  onChange() {
+    this.setData({
+      querysubhr: !this.data.querysubhr
+    });
+    this.querySignIn(this.data.signindate)
+  },
+  onLoad(options) {},
+  /* 日历加载完成 */
+  handleCalendarLoad({
+    detail
+  }) {
+    console.log("日历加载完成", detail)
+    /* let {
+    	year,
+    	month,
+    	day
+    } = detail.date;
+    month = month < 10 ? "0" + month : month;
+    day = day < 10 ? "0" + day : day;
+    this.querySignIn(year + '-' + month + '-' + day) */
+  },
+  /* 日期发生变化 */
+  handleCalendarDateChange({
+    detail
+  }) {
+    console.log("日期发生变化", detail)
+    this.setData({
+      list: []
+    })
+    if (detail.date.marker) {
+      let {
+        year,
+        month,
+        day
+      } = detail.date;
+      month = month < 10 ? "0" + month : month;
+      day = day < 10 ? "0" + day : day;
+      this.querySignIn(year + '-' + month + '-' + day)
+    }
+  },
+  /* 查询签到日 */
+  checkIn(content) {
+    _Http.basic({
+      "accesstoken": "3614131fa126be7f41ea07d99b5d9fe6",
+      "id": 20221229150001,
+      content
+    }).then(res => {
+      console.log("查询签到日", content, res)
+      if (res.data.length) {
+        this.selectComponent("#calendar").setMarkers(res.data.map(v => {
+          let date = v.split("-");
+          return {
+            year: date[0],
+            month: date[1],
+            day: date[2],
+            type: "schedule",
+            mark: '签到',
+            color: '#2a97ff',
+            bgColor: '#cce6ff'
+          }
+        }))
+      }
+    })
+  },
+  /* 查询签到记录 */
+  querySignIn(signindate) {
+    _Http.basic({
+      "id": 20221229150101,
+      "content": {
+        signindate,
+        pageSize: 999,
+        querysubhr: this.data.querysubhr ? 1 : 0
+      }
+    }).then(res => {
+      console.log('查询签到记录', res)
+      if (res.msg != '成功') return wx.showToast({
+        title: res.msg,
+        icon: "none"
+      })
+      this.setData({
+        list: res.data,
+        signindate
+      })
+    })
+  },
+  /* 日期范围发生变化 */
+  handleCalendarRangeChange({
+    detail
+  }) {
+    console.log("日期范围变化", detail)
+    let {
+      year,
+      month,
+      day
+    } = detail.curr;
 
-		this.checkIn({
-			year,
-			month
-		});
+    this.checkIn({
+      year,
+      month
+    });
 
-		this.setData({
-			list: []
-		})
+    this.setData({
+      list: []
+    })
 
-		month = month < 10 ? "0" + month : month;
-		day = day < 10 ? "0" + day : day;
-		this.querySignIn(year + '-' + month + '-' + day)
-	},
-	/* 更新日期数据 */
-	toDate(date) {
-		this.selectComponent("#calendar").toDate(date)
-	},
-	toSignIn() {
-		wx.navigateTo({
-			url: '/packageA/clockIn/signIn',
-		})
-	},
-	onReady() {
-		this.setListHeight();
-	},
-	setListHeight() {
-		getHeight.getHeight('.head', this).then(res => {
-			if (this.data.listHeight != res)
-				this.setData({
-					listHeight: res
-				})
-		});
-	},
+    month = month < 10 ? "0" + month : month;
+    day = day < 10 ? "0" + day : day;
+    this.querySignIn(year + '-' + month + '-' + day)
+  },
+  /* 更新日期数据 */
+  toDate(date) {
+    this.selectComponent("#calendar").toDate(date);
+    this.querySignIn(date);
+    let a1 = date.split("-");
+    this.checkIn({
+      year: a1[0],
+      month: a1[1]
+    });
+  },
+  toSignIn() {
+    wx.navigateTo({
+      url: '/packageA/clockIn/signIn',
+    })
+  },
+  onReady() {
+    this.setListHeight();
+  },
+  setListHeight() {
+    getHeight.getHeight('.head', this).then(res => {
+      if (this.data.listHeight != res)
+        this.setData({
+          listHeight: res
+        })
+    });
+  },
 })

+ 96 - 46
packageA/clockIn/index.scss

@@ -1,54 +1,104 @@
 page {
-	height: 100vh;
-	overflow: hidden;
+  height: 100vh;
+  overflow: hidden;
 }
 
 .float-but {
-	display: flex;
-	align-items: center;
-	justify-content: center;
-	width: 120rpx;
-	height: 120rpx;
-	background-color: var(--assist);
-	border-radius: 50%;
-	color: #ffffff;
-	transform: translate(-50%, -50%);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  width: 120rpx;
+  height: 120rpx;
+  background-color: var(--assist);
+  border-radius: 50%;
+  color: #ffffff;
+  transform: translate(-50%, -50%);
 }
 
 .history {
-	background-color: #F4F5F7;
-
-	.item {
-		width: 100vw;
-		padding: 20rpx 30rpx;
-		box-sizing: border-box;
-		background-color: #ffffff;
-		margin: 10rpx 0;
-
-		.time {
-			height: 40rpx;
-			line-height: 40rpx;
-			font-size: 28rpx;
-			color: #333333;
-		}
-
-		.location {
-			margin-top: 10rpx;
-
-			.iconfont {
-				margin-right: 4rpx;
-			}
-
-			line-height: 34rpx;
-			font-size: 24rpx;
-			color: #666666;
-		}
-
-		.exp {
-			line-height: 34rpx;
-			font-size: 24rpx;
-			color: #999999;
-			margin-top: 10rpx;
-		}
-	}
+  background-color: #F4F5F7;
+
+  .item {
+    width: 100vw;
+    padding: 20rpx 30rpx;
+    box-sizing: border-box;
+    background-color: #ffffff;
+    margin: 10rpx 0;
+
+    .time {
+      height: 40rpx;
+      line-height: 40rpx;
+      font-size: 28rpx;
+      color: #333333;
+    }
+
+    .location {
+      margin-top: 10rpx;
+
+      .iconfont {
+        margin-right: 4rpx;
+      }
+
+      line-height: 34rpx;
+      font-size: 24rpx;
+      color: #666666;
+    }
+
+    .exp {
+      line-height: 34rpx;
+      font-size: 24rpx;
+      color: #999999;
+      margin-top: 10rpx;
+    }
+
+    .user {
+      height: 64rpx;
+      margin-top: 12rpx;
+      display: flex;
+
+      .portrait {
+        width: 64rpx;
+        height: 64rpx;
+        font-size: 0;
+        border-radius: 50rpx;
+        margin-right: 10rpx;
+        overflow: hidden;
+
+        image {
+          width: 100%;
+          height: 100%;
+        }
+
+        .text {
+          width: 100%;
+          height: 100%;
+          line-height: 64rpx;
+          text-align: center;
+          background: #F0F3FF;
+          font-size: 24rpx;
+          font-family: PingFang SC-Regular, PingFang SC;
+          color: #3874F6;
+        }
+      }
+
+      .main {
+        flex: 1;
+
+        .name {
+          height: 34rpx;
+          line-height: 34rpx;
+          font-size: 24rpx;
+          color: #333333;
+        }
+
+        .text {
+          height: 28rpx;
+          line-height: 28rpx;
+          font-size: 20rpx;
+          color: #999999;
+          margin-top: 2rpx;
+        }
+      }
+    }
+  }
 }

+ 34 - 17
packageA/clockIn/index.wxml

@@ -1,23 +1,40 @@
 <view class="head" />
 <My_listBox id='ListBox' pullDown='{{false}}' height="{{listHeight}}">
-	<view class="container">
-		<calendar id="calendar" bindload="handleCalendarLoad" binddatechange="handleCalendarDateChange" bindrangechange="handleCalendarRangeChange" bindviewchange="handleCalendarPanelViewChange" _position="absolute" _top="0">
-			<view class="history">
-				<view class="item" wx:for="{{list}}" wx:key="item.rowindex">
-					<view class="time">{{item.signintime}}</view>
-					<view class="location">
-						<text class="iconfont icon-a-wodemendianxinxidizhi" />{{item.address}}
-					</view>
-					<view class="exp">说明:{{item.remarks|| ' --'}}</view>
-				</view>
-				<view style="height: 40rpx;" />
-			</view>
-		</calendar>
-	</view>
+  <view class="container">
+    <calendar id="calendar" bindload="handleCalendarLoad" binddatechange="handleCalendarDateChange" bindrangechange="handleCalendarRangeChange" bindviewchange="handleCalendarPanelViewChange" _position="absolute" _top="0">
+
+      <view class="history">
+        <view style="margin: 10rpx 0;">
+          <Yl_Headline title='{{querysubhr?"下属签到记录":"签到记录"}}' type='switch' switchLabel='查看下属签到记录' switch='{{querysubhr}}' bind:callBack='onChange' />
+        </view>
+        <view class="item" wx:for="{{list}}" wx:key="item.rowindex">
+          <view class="time">{{item.signintime}}</view>
+          <view class="location">
+            <text class="iconfont icon-a-wodemendianxinxidizhi" />{{item.address}}
+          </view>
+          <view class="exp">说明:{{item.remarks|| ' --'}}</view>
+          <view class="user">
+            <view class="portrait">
+              <image wx:if="{{item.headpic}}" src="{{item.headpic}}" mode="aspectFill" />
+              <view wx:else class="text">
+                {{item.name[0]}}
+              </view>
+            </view>
+            <view class="main">
+              <view class="name">{{item.name}}</view>
+              <view class="text">{{item.depname}} {{item.position}}</view>
+            </view>
+          </view>
+        </view>
+        <My_empty wx:if="{{list.length==0}}" />
+        <view style="height: 40rpx;" />
+      </view>
+    </calendar>
+  </view>
 </My_listBox>
 
 <Yl_FloatingButton useSlot zIndex='99999999999' bindtap="toSignIn">
-	<view class="float-but">
-		签到
-	</view>
+  <view class="float-but">
+    签到
+  </view>
 </Yl_FloatingButton>

+ 2 - 2
utils/Http.js

@@ -1,6 +1,6 @@
 // const baseUrl = "https://meida.cnyunl.com/yos/rest/index";
-const baseUrl = "http://61.164.207.46:8000/yos/rest/index";
-// const baseUrl = "http://122.226.136.204:8082/yos/rest/index";
+// const baseUrl = "http://61.164.207.46:8000/yos/rest/index";
+const baseUrl = "http://122.226.136.204:8082/yos/rest/index";
 
 
 let count = null;