From 16297019d087ad18d1c921a480bd8acc9e7f39cc Mon Sep 17 00:00:00 2001 From: 边少东 <2879594283@qq.com> Date: Tue, 25 Oct 2022 16:59:01 +0800 Subject: [PATCH] 修复问题 --- app.js | 2 +- pages/index/achievement/achievement.js | 44 ++++++++++++++++++++++++++++++++++---------- pages/index/index.wxml | 8 ++++---- pages/index/punchDetail/punchDetail.js | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------- pages/index/punchDetail/punchDetail.wxml | 4 ++-- pages/mine/record/record.json | 3 ++- pages/mine/record/record.wxml | 8 ++++---- 7 files changed, 115 insertions(+), 48 deletions(-) diff --git a/app.js b/app.js index 059aec5..9ed73bb 100644 --- a/app.js +++ b/app.js @@ -45,7 +45,7 @@ App({ //你的分享配置 return { title: name + '推荐您 一起开始自主学习之旅', - path: '/pages/index/index', + path: '/pages/login/loginNew/loginNew', // imageUrl: 'https://proxy.shunzhi.net:51315/mp_share2.jpg', imageUrl: 'https://szyundisk.oss-cn-hangzhou.aliyuncs.com/AdmissionsManageSys/37317060-9e67-41e1-9731-b722c83cff8a.jpg', }; diff --git a/pages/index/achievement/achievement.js b/pages/index/achievement/achievement.js index 3bf6d8f..c3c5e9e 100644 --- a/pages/index/achievement/achievement.js +++ b/pages/index/achievement/achievement.js @@ -21,6 +21,10 @@ Page({ hideHeader: true, // 隐藏日历头部操作栏 autoChoosedWhenJump: true, // 设置默认日期及跳转到指定日期后是否需要自动选中 defaultDate: moment(new Date().getTime()).format('YYYY-MM-DD'), // 默认选中指定某天,如需选中需配置 autoChoosedWhenJump: true + disableMode: { // 禁用某一天之前/之后的所有日期 + type: 'after', // [‘before’, 'after'] + // 无该属性或该属性值为假,则默认为当天 + }, }, isDisplay: false, calendar: {}, //日历 @@ -57,6 +61,7 @@ Page({ let date = e.detail.date // let month = e.detail.month // let year = e.detail.year + this.resetV2(e.detail.year,e.detail.month,date ) let recordVo = this.data.resData.eventDetails[date - 1].recordVo if (recordVo != null) { console.log('复制', recordVo) @@ -72,8 +77,8 @@ Page({ }) } }, - //获取信息 - getInfo(doday, isOne = 0) { + //获取信息(第一次进来,模拟点击渲染) + getInfo(doday, isOne = 0,e) { request({ url: `/wx/task/getSignRecord`, method: 'get', @@ -89,13 +94,6 @@ Page({ }) this.getV2(res.data) if (isOne == 1) { - let e = { - detail: { - date: moment().date(), - month: moment().month() + 1, - year: moment().year() - } - } this.afterTapDate(e) } } else { @@ -113,6 +111,24 @@ Page({ 'calendar': this.selectComponent('#calendar').calendar }) }, + //重置日历 + resetV2(year,month,date) { + console.log(year,month,date) + if(this.data.dayMoment == month) { + }else { + let e = { + detail: { + date: date, + month: month, + year: year + } + } + this.setData({ + dayMoment:month + }) + this.getInfo(moment(year + '-' + month +'-' + date).format('YYYY-MM-DD'),1,e) + } + }, //显示日历 getV2(resData) { this.setData({ @@ -127,6 +143,7 @@ Page({ showLabelAlways: true, // 点击时是否显示待办事项(圆点/文字),在 circle 为 true 及当日历配置 showLunar 为 true 时,此配置失效 dates: resData.eventDetails }) + this.data.calendar.enableArea([this.data.taskVo.startDate, moment(new Date().getTime()).format('YYYY-MM-DD')]) }, /** * 生命周期函数--监听页面加载 @@ -145,6 +162,13 @@ Page({ */ onReady() { this.initialize() - this.getInfo(moment(new Date().getTime()).format('YYYY-MM-DD'), 1) + let e = { + detail: { + date: moment().date(), + month: moment().month() + 1, + year: moment().year() + } + } + this.getInfo(moment(new Date().getTime()).format('YYYY-MM-DD'), 1,e) }, }) \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 37f32a0..e5c48ca 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -24,11 +24,11 @@ {{value.taskDesc}} - + 打卡已进行 + {{value.signDayNum}} 天 + - + 打卡频次: diff --git a/pages/index/punchDetail/punchDetail.js b/pages/index/punchDetail/punchDetail.js index 4f5617e..56146b3 100644 --- a/pages/index/punchDetail/punchDetail.js +++ b/pages/index/punchDetail/punchDetail.js @@ -3,11 +3,13 @@ import plugin from '../../../component/v2/plugins/index' import week from '../../../component/v2/plugins/week' import todo from '../../../component/v2/plugins/todo' +import selectable from '../../../component/v2/plugins/selectable' import request from '../../../api/request.js' import moment from 'moment'; plugin .use(week) .use(todo) + .use(selectable) Page({ /** @@ -19,6 +21,10 @@ Page({ weekMode: true, // 周视图模式 highlightToday: true, // 是否高亮显示当天 hideHeader: true, // 隐藏日历头部操作栏 + disableMode: { // 禁用某一天之前/之后的所有日期 + type: 'after', // [‘before’, 'after'] + // 无该属性或该属性值为假,则默认为当天 + }, }, isDisplay: false, clockShow: false, @@ -57,28 +63,29 @@ Page({ taskStatisticsParam: "" }, //成果数据当天 recordVoShow: false, - isToday:true,//是否是今天 - isLarge:false, //是否大于今天 - repairText: '' + isToday: true, //是否是今天 + isLarge: false, //是否大于今天 + repairText: '', + dayMoment: '' }, - /** + /** * 选择日期后执行的事件 */ afterTapDate(e) { let date = e.detail.date + this.resetV2(e.detail.year, e.detail.month, date) this.setData({ - isToday:e.detail.isToday + isToday: e.detail.isToday }) //选择的年月日 - let checkDay = e.detail.year +'-' + e.detail.month +'-' + e.detail.date - let checktimeDate= new Date(moment(checkDay).format('YYYY-MM-DD')).getTime() + let checkDay = e.detail.year + '-' + e.detail.month + '-' + e.detail.date + let checktimeDate = new Date(moment(checkDay).format('YYYY-MM-DD')).getTime() //选择的日期是否大于今天 - if(checktimeDate > new Date().getTime()) { - console.log('ff') + if (checktimeDate > new Date().getTime()) { this.setData({ isLarge: true }) - }else { + } else { this.setData({ isLarge: false }) @@ -89,21 +96,21 @@ Page({ let recordVo = this.data.resData.eventDetails[date - 1].recordVo //匹配数据 if (recordVo != null) { - console.log('复制',recordVo) + console.log('复制', recordVo) this.setData({ recordVo: recordVo }) this.setData({ recordVoShow: true }) - }else { + } else { this.setData({ recordVoShow: false }) } }, - //获取信息 - getInfo(doday) { + //获取信息(第一次进来,模拟点击渲染) + getInfo(doday, isOne = 0, e) { request({ url: `/wx/task/getSignRecord`, method: 'get', @@ -118,6 +125,9 @@ Page({ resData: res.data }) this.getV2(res.data) + if (isOne == 1) { + this.afterTapDate(e) + } } else { wx.showToast({ title: res.msg, @@ -134,6 +144,23 @@ Page({ }) }, + //重置日历 + resetV2(year, month, date) { + console.log(year, month, date) + if (this.data.dayMoment == month) {} else { + let e = { + detail: { + date: date, + month: month, + year: year + } + } + this.setData({ + dayMoment: month + }) + this.getInfo(moment(year + '-' + month + '-' + date).format('YYYY-MM-DD'), 1, e) + } + }, //显示日历 getV2(resData) { this.setData({ @@ -146,13 +173,14 @@ Page({ dotColor: 'purple', // 待办点标记颜色 circle: false, // 待办圆圈标记设置(如圆圈标记已签到日期),该设置与点标记设置互斥 showLabelAlways: true, // 点击时是否显示待办事项(圆点/文字),在 circle 为 true 及当日历配置 showLunar 为 true 时,此配置失效 - dates: resData.eventDetails + dates: resData.eventDetails, }) + this.data.calendar.enableArea([this.data.taskVo.startDate, moment(new Date().getTime()).format('YYYY-MM-DD')]) }, //成果 toAchieve(e) { wx.navigateTo({ - url: '../achievement/achievement?valueId='+this.data.valueId, + url: '../achievement/achievement?valueId=' + this.data.valueId, }) }, //唤起 打卡 @@ -166,12 +194,12 @@ Page({ let selectData = this.data.calendar.getSelectedDates() let doday = selectData[0].year + '-' + selectData[0].month + '-' + selectData[0].date console.log(doday) - let repairDate= moment(doday).format('YYYY-MM-DD') + let repairDate = moment(doday).format('YYYY-MM-DD') this.setData({ - 'form.isRepair':2 + 'form.isRepair': 2 }) this.setData({ - 'form.repairDate':repairDate + 'form.repairDate': repairDate }) this.setData({ clockShow: true @@ -185,9 +213,9 @@ Page({ this.setData({ 'form.userId': wx.getStorageSync('userInfo_id') }) - if(this.data.taskVo.submitCondition=='图片') { - if(this.data.form.taskFileUrl.length == 0) { - return wx.showToast({ + if (this.data.taskVo.submitCondition == '图片') { + if (this.data.form.taskFileUrl.length == 0) { + return wx.showToast({ title: '请上传图片', icon: 'none' }) @@ -203,11 +231,18 @@ Page({ title: '打卡成功', icon: 'none' }) + let e = { + detail: { + date: moment(this.data.form.repairDate).format('DD'), + month: moment(this.data.form.repairDate).format('MM'), + year: moment(this.data.form.repairDate).format('YYYY') + } + } + this.getInfo(moment(this.data.form.repairDate).format('YYYY-MM-DD'), 1, e) this.closeClockShow() - this.getInfo(moment(new Date().getTime()).format('YYYY-MM-DD')) } else { wx.showToast({ - title: res.msg, + title: res.msg + res.data, icon: 'none' }) } @@ -226,7 +261,14 @@ Page({ */ onReady() { this.initialize() - this.getInfo(moment(new Date().getTime()).format('YYYY-MM-DD')) + let e = { + detail: { + date: moment().date(), + month: moment().month() + 1, + year: moment().year() + } + } + this.getInfo(moment(new Date().getTime()).format('YYYY-MM-DD'), 1, e) }, // 统一返回 handleBack() { @@ -299,7 +341,7 @@ Page({ this.setData({ clockShow: false }) - let form = { + let form = { id: '', //任务ID isRepair: 1, //是否补卡1立即打卡2补卡 repairDate: '', //补卡日期,当isRepair=2时必传,格式:YYYY-MM-dd diff --git a/pages/index/punchDetail/punchDetail.wxml b/pages/index/punchDetail/punchDetail.wxml index dadfbda..ab9e23c 100644 --- a/pages/index/punchDetail/punchDetail.wxml +++ b/pages/index/punchDetail/punchDetail.wxml @@ -19,7 +19,7 @@ 我 的 成 果 立 即 打 卡 - 补 卡 + 补 卡 @@ -36,7 +36,7 @@ {{taskVo.statisticsUnit}} - + diff --git a/pages/mine/record/record.json b/pages/mine/record/record.json index 5dda6e4..5c047d5 100644 --- a/pages/mine/record/record.json +++ b/pages/mine/record/record.json @@ -3,7 +3,8 @@ "van-icon": "@vant/weapp/icon/index", "van-tab": "@vant/weapp/tab/index", "van-tabs": "@vant/weapp/tabs/index", - "van-popup": "@vant/weapp/popup/index" + "van-popup": "@vant/weapp/popup/index", + "van-progress": "@vant/weapp/progress/index" }, "navigationBarTitleText":"打卡记录" } \ No newline at end of file diff --git a/pages/mine/record/record.wxml b/pages/mine/record/record.wxml index 9d3678d..79ca068 100644 --- a/pages/mine/record/record.wxml +++ b/pages/mine/record/record.wxml @@ -19,11 +19,11 @@ {{value.taskDesc}} - + 打卡已进行 + {{value.signDayNum}} 天 + - + 打卡频次: -- libgit2 0.21.0