From 44df516337eabcc842cbe003d69165afd071fe72 Mon Sep 17 00:00:00 2001 From: limqhz Date: Mon, 12 Dec 2022 17:30:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=AA=E5=BF=B5=E6=97=A5=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 3 +- components/countdown/countdown.js | 2 +- pages/anniversary/create/index.js | 89 +++++++++++++++++++++++++++++ pages/anniversary/create/index.json | 10 ++++ pages/anniversary/create/index.wxml | 71 +++++++++++++++++++++++ pages/anniversary/create/index.wxss | 17 ++++++ pages/anniversary/index.js | 21 ++++--- pages/anniversary/index.json | 1 - pages/anniversary/index.wxml | 5 +- pages/anniversary/index.wxss | 5 +- pages/task/index.json | 8 +-- pages/taskDetail/index.json | 10 ++-- project.config.json | 2 +- 13 files changed, 221 insertions(+), 23 deletions(-) create mode 100644 pages/anniversary/create/index.js create mode 100644 pages/anniversary/create/index.json create mode 100644 pages/anniversary/create/index.wxml create mode 100644 pages/anniversary/create/index.wxss diff --git a/app.json b/app.json index 81dff6b..b26ed3d 100644 --- a/app.json +++ b/app.json @@ -5,7 +5,8 @@ "pages/myself/index", "pages/message/index", "pages/taskDetail/index", - "pages/anniversary/index" + "pages/anniversary/index", + "pages/anniversary/create/index" ], "usingComponents": { "t-icon": "/components/icon/icon", diff --git a/components/countdown/countdown.js b/components/countdown/countdown.js index c672fec..e22a40a 100644 --- a/components/countdown/countdown.js +++ b/components/countdown/countdown.js @@ -4,7 +4,7 @@ export default class CountDown{ if(t instanceof Array){ this.time =new Date().getTime()+ (new Date(t[1]).getTime() - new Date(t[0]).getTime()); }else{ - this.time =/\//gi.test(t.toString()) ? (new Date(t).getTime()) : ( new Date().getTime()+parseInt(t)); + this.time =/-/gi.test(t.toString()) ? (new Date(t).getTime()) : ( new Date().getTime()+parseInt(t)); } } timeOut (fn,t) { diff --git a/pages/anniversary/create/index.js b/pages/anniversary/create/index.js new file mode 100644 index 0000000..5f4d5f0 --- /dev/null +++ b/pages/anniversary/create/index.js @@ -0,0 +1,89 @@ +let taskId = ''; +Page({ + data: { + mode: '', + alertVisible: false, + completeVisible: false, + repeatVisible: false, + repeatKey: [ + { label: '每1天', value: '1' }, + { label: '工作日', value: '2' }, + { label: '每1周', value: '3' }, + { label: '每1月', value: '4' }, + { label: '每1年', value: '5' }, + ], + isShowLunarTimePicker: false, + date: new Date('2021-12-23').getTime(), // 支持时间戳传入 + alertText: '', + completeText: '', + repeatText: '', + repeatValue: '', + // 指定选择区间起始值 + start: '2008-01-01 00:00:00', + end: '2040-12-31 23:59:59', + }, + onLoad: function (options) { + taskId = options.id; + }, + + onShow() { + + }, + + showPicker(e) { + const { mode } = e?.currentTarget?.dataset; + this.setData({ + mode, + [`${mode}Visible`]: true, + }); + }, + hidePicker() { + const { mode } = this.data; + this.setData({ + [`${mode}Visible`]: false, + }); + }, + onConfirm(e) { + const { value } = e?.detail; + const { mode } = this.data; + + console.log('confim', value); + + this.setData({ + [mode]: value, + [`${mode}Text`]: value, + }); + + this.hidePicker(); + }, + + onPickerConfirm(e) { + const { label,value } = e?.detail; + this.setData({ + repeatText : label, + repeatValue: value + }); + this.hidePicker(); + }, + + submitTask() { + //TODO 新增或者修改 + console.log('保存成功') + wx.redirectTo({ + url: '../task/index' + }) + }, + + // 点击时间 弹出时间选择器 + onClickTimeBtn: function (event) { + this.setData({ + isShowLunarTimePicker: true + }) + }, + + onLunarConfirm: function (e) { + console.log(e.detail); + } + + +}); diff --git a/pages/anniversary/create/index.json b/pages/anniversary/create/index.json new file mode 100644 index 0000000..fe67fd6 --- /dev/null +++ b/pages/anniversary/create/index.json @@ -0,0 +1,10 @@ +{ + "usingComponents": { + "t-date-time-picker": "/components/date-time-picker/date-time-picker", + "t-picker": "/components/picker/picker", + "t-picker-item": "/components/picker/picker-item", + "jh-lunar-picker": "/components/jh-lunar-picker/index", + "t-switch": "/components/switch/switch", + "t-button": "/components/button/button" + } +} diff --git a/pages/anniversary/create/index.wxml b/pages/anniversary/create/index.wxml new file mode 100644 index 0000000..84e7962 --- /dev/null +++ b/pages/anniversary/create/index.wxml @@ -0,0 +1,71 @@ + + + + + +保存 + + + + + + + diff --git a/pages/anniversary/create/index.wxss b/pages/anniversary/create/index.wxss new file mode 100644 index 0000000..c7c7789 --- /dev/null +++ b/pages/anniversary/create/index.wxss @@ -0,0 +1,17 @@ +.pannel-item { + font-size: 32rpx; +} + +.pannel-item::after { + border: 0; +} + +.sub-text { + color: #000; + opacity: 0.9; +} + +.empty { + color: #000; + opacity: 0.32; +} diff --git a/pages/anniversary/index.js b/pages/anniversary/index.js index 7e15980..bd87469 100644 --- a/pages/anniversary/index.js +++ b/pages/anniversary/index.js @@ -3,13 +3,20 @@ Page({ aIconList: ['check-rectangle','star-filled','notification','circle'], dataEmpty: false, anniversaryList: [ - {'title':'老公的工作纪念日','type':'life','dateType':'农历','date':'2018/12/30','repeat':'3','nextDate':'2022/12/30'}, - {'title':'结婚纪念日','type':'love','dateType':'公历','date':'2017/12/30','repeat':'4','nextDate':'2022/12/30'}, - {'title':'真正的操作的纪念日','type':'life','dateType':'公历','date':'2017/12/30','repeat':'4','nextDate':'2022/12/30'}, - {'title':'宝宝出生日期','type':'baby','dateType':'公历','date':'2017/12/30','repeat':'4','nextDate':'2022/12/30'}, - {'title':'王xx的生日','type':'birthday','dateType':'公历','date':'2017/12/30','repeat':'4','nextDate':'2022/12/30'}, - {'title':'天才的生日','type':'birthday','dateType':'公历','date':'2017/12/30','repeat':'4','nextDate':'2022/12/30'}, - {'title':'大家爱送到家我i的生日','type':'birthday','dateType':'公历','date':'2017/12/30','repeat':'4','nextDate':'2022/12/30'}, + {'title':'老公的工作纪念日','type':'life','dateType':'农历','totalDay':88,'today':false,'date':'2018-12-28','repeat':'3','nextDate':'2022-12-28'}, + {'title':'结婚纪念日','type':'love','dateType':'公历','totalDay':88,'today':true,'date':'2017-12-28','repeat':'4','nextDate':'2022-12-28'}, + {'title':'真正的操作的纪念日','type':'life','dateType':'公历','totalDay':88,'today':true,'date':'2017-12-28','repeat':'4','nextDate':'2022-12-28'}, + {'title':'宝宝出生日期','type':'baby','dateType':'公历','totalDay':88,'today':true,'date':'2017-12-28','repeat':'4','nextDate':'2022-12-28'}, + {'title':'王xx的生日','type':'birthday','dateType':'公历','totalDay':88,'today':false,'date':'2017-12-28','repeat':'4','nextDate':'2022-12-28'}, + {'title':'天才的生日','type':'birthday','dateType':'公历','totalDay':88,'today':false,'date':'2017-12-28','repeat':'4','nextDate':'2022-12-28'}, + {'title':'大家爱送到家我i的生日','type':'birthday','dateType':'公历','totalDay':88,'today':true,'date':'2017-12-28','repeat':'4','nextDate':'2022-12-28'}, ], + }, + + handleClick() { + wx.navigateTo({ + url: '/pages/anniversary/create/index' + }); } + }); diff --git a/pages/anniversary/index.json b/pages/anniversary/index.json index d3183d1..47fc6ae 100644 --- a/pages/anniversary/index.json +++ b/pages/anniversary/index.json @@ -3,7 +3,6 @@ "foot-tab": "../foot-tab/foot-tab", "t-empty": "/components/empty/empty", "t-fab": "/components/fab/fab", - "t-badge": "/components/badge/badge", "t-countdown": "/components/countdown/index", "t-divider": "/components/divider/divider" } diff --git a/pages/anniversary/index.wxml b/pages/anniversary/index.wxml index 7307544..9c8cc72 100644 --- a/pages/anniversary/index.wxml +++ b/pages/anniversary/index.wxml @@ -9,11 +9,12 @@ {{item.title}} - + 距离[{{item.dateType}}{{item.date}}]已经过{{item.totalDay}}天了 + 距离{{item.repeat}}周年 - + 今天{{item.repeat}}周年啦! diff --git a/pages/anniversary/index.wxss b/pages/anniversary/index.wxss index 2f62d78..2368c67 100644 --- a/pages/anniversary/index.wxss +++ b/pages/anniversary/index.wxss @@ -5,7 +5,7 @@ padding-bottom: 50px; } .anniversary{ - height: 300rpx; + height: 340rpx; margin: 10rpx 20rpx; border: 5px ridge #f0a1a8; border-radius: 5px; @@ -25,3 +25,6 @@ image{ line-height: 28rpx; color: #999999; } +.countdown { + margin-top: 5rpx; +} diff --git a/pages/task/index.json b/pages/task/index.json index 79e7229..148c667 100644 --- a/pages/task/index.json +++ b/pages/task/index.json @@ -1,9 +1,9 @@ { "usingComponents": { "foot-tab": "../foot-tab/foot-tab", - "tab": "../../components/tab/index", - "scroll": "../../components/scroll/index", - "t-action-sheet": "../../components/action-sheet/action-sheet", - "t-fab": "../../components/fab/fab" + "tab": "/components/tab/index", + "scroll": "/components/scroll/index", + "t-action-sheet": "/components/action-sheet/action-sheet", + "t-fab": "/components/fab/fab" } } diff --git a/pages/taskDetail/index.json b/pages/taskDetail/index.json index a308912..d0e8daf 100644 --- a/pages/taskDetail/index.json +++ b/pages/taskDetail/index.json @@ -1,9 +1,9 @@ { "usingComponents": { - "t-date-time-picker": "../../components/date-time-picker/date-time-picker", - "t-picker": "../../components/picker/picker", - "t-picker-item": "../../components/picker/picker-item", - "t-switch": "../../components/switch/switch", - "t-button": "../../components/button/button" + "t-date-time-picker": "/components/date-time-picker/date-time-picker", + "t-picker": "/components/picker/picker", + "t-picker-item": "/components/picker/picker-item", + "t-switch": "/components/switch/switch", + "t-button": "/components/button/button" } } diff --git a/project.config.json b/project.config.json index 1a961e1..8eede76 100644 --- a/project.config.json +++ b/project.config.json @@ -39,7 +39,7 @@ "outputPath": "" } }, - "compileType": "quinn", + "compileType": "miniprogram", "libVersion": "2.19.4", "appid": "wxb1f499f0a173865b", "projectname": "quinn-task",