|
|
@@ -1,8 +1,126 @@
|
|
|
+const _Http = getApp().globalData.http,
|
|
|
+ getHeight = require("../../utils/getRheRemainingHeight");
|
|
|
+
|
|
|
+
|
|
|
Page({
|
|
|
- data: {
|
|
|
+ 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;
|
|
|
+
|
|
|
+ this.checkIn({
|
|
|
+ year,
|
|
|
+ month
|
|
|
+ });
|
|
|
|
|
|
- },
|
|
|
- onLoad(options) {
|
|
|
+ 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
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
})
|