diff --git a/pages/add/index.js b/pages/add/index.js index cd17303..11f62a7 100644 --- a/pages/add/index.js +++ b/pages/add/index.js @@ -17,7 +17,7 @@ Page({ pic: '', form: { name:'', - plantDate:'', + plantTime:'', ossIds:[], "carePlans": [{ "name": "浇水", @@ -72,14 +72,16 @@ Page({ onLoad(options) { const date = dayjs(new Date().getTime()).format('YYYY-MM-DD') const tmps = this.data.form - tmps.plantDate = date + tmps.plantTime = date this.setData({form: tmps}) }, handleConfirm(e) { const value = e.detail.value const date = dayjs(value).format('YYYY-MM-DD') - this.data.form.plantDate = date + const tmps = this.data.form + tmps.plantTime = date + this.setData({form:tmps}) }, showDatePicker(){ diff --git a/pages/add/index.wxml b/pages/add/index.wxml index 5db2d9f..209525b 100644 --- a/pages/add/index.wxml +++ b/pages/add/index.wxml @@ -31,7 +31,7 @@ 种植日期 - + diff --git a/pages/index/index.js b/pages/index/index.js index a720e9b..ab90cd5 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -27,7 +27,7 @@ Page({ const tmps = res.data.map(e => { if (e.imgList.length >0){ e.pic = e.imgList[0].url - e.expireDay = 2 + } return e }) diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 8d6de85..df99f04 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -22,14 +22,14 @@ {{item.name}} - 今日 - 已逾期{{item.expireDay}}天 + 今日 + 已逾期{{item.expiredDays}}天 - 种植于:{{item.plantDate}} + 种植于:{{item.plantTimeStr}} 需要养护: - + diff --git a/pages/index/info.js b/pages/index/info.js index c991678..fc5266f 100644 --- a/pages/index/info.js +++ b/pages/index/info.js @@ -23,20 +23,16 @@ Page({ api('/plant/detail','GET',data).then(res => { if (res.code === 200){ const tmp = res.data - tmp.farms.suitableFertilizer = tmp.pestsDiseases.split(',') - if (tmp.ossList.length >0 ){ - tmp.pic = tmp.ossList[0].url - tmp.picList = tmp.ossList.map(sub => sub.url) + if (tmp.imgList.length >0 ){ + tmp.pic = tmp.imgList[0].url + tmp.picList = tmp.imgList.map(sub => sub.url) } - console.log(tmp); + tmp.todayCares.map(e => e.period = tmp.carePlans.find(sub => sub.name === e.name).period) this.setData({info:res.data}) + console.log(this.data.info.todayCares); } }) - api('/plant/todayFarm','GET',data).then(res => { - if (res.code === 200){ - this.setData({farms:res.data}) - } - }) + }, goPreview(e){ @@ -46,10 +42,16 @@ Page({ }) }, - addFarmLog(e){ + make(e){ const item = e.currentTarget.dataset.item + if (item.status === 2){ + wx.showModal({ + content: '已完成', + }) + return + } const data = {id:item.id,plantId:item.plantId, name:item.name,remark:'测试',status:2} - api('/plant/addRecord','POST',data,'json').then(res => { + api('/plant/makeCare','POST',data,'json').then(res => { if (res.code === 200){ wx.showToast({ icon:'success', diff --git a/pages/index/info.wxml b/pages/index/info.wxml index 57a2121..eaf43c7 100644 --- a/pages/index/info.wxml +++ b/pages/index/info.wxml @@ -2,10 +2,8 @@ - - + - @@ -18,99 +16,74 @@ - - + + {{info.name}} - {{info.genus}} + 种植于 {{info.plantTimeStr}} 已种植 {{info.plantDays}} 天 - - 常用名: - {{info.aliases}} - - - 植物学名: - {{info.latinName}} - - 今日任务 - - - - - - 暂无任务 - - - - - - - {{item.name}} - - - - 未完成 - 完成 - 已跳过 - 逾期 - - - - - - - 当前状态 - - - - 当前:健康 - 健康状态 - - - - AI 病害诊断 - - - - - 养护提示 + 养护事项 {{info.growthHabit}} - {{item}} - - - - - 花期 - - - {{info.floweringPeriod}} + + + + + + + + {{item.name}} + 每{{item.period}}天一次 + + 已完成 + + + 已逾期{{item.expireDays}}天 + 今天 + + + + - 其他 + 养护记录 - - {{info.lifeCycle}} - {{info.lightIntensity}} - {{info.lightType}} - {{info.foliageType}} + + + + + + + + + + + + {{item.name}} + {{item.careTimeStr}} + 今天 + {{item.remark}} + + + + diff --git a/pages/index/info.wxss b/pages/index/info.wxss index 6f6cc23..8cf5fe9 100644 --- a/pages/index/info.wxss +++ b/pages/index/info.wxss @@ -1,4 +1,24 @@ /* pages/index/info.wxss */ page { background-color: #F6F6F6; +} + +.grid { + display: grid; + grid-template-columns: 50% 50%; + grid-row-gap: 16px; + grid-column-gap: 16px; +} +.camera{ + background-color: #4fab5e3d; + width: 100rpx; + height: 100rpx; + border-radius: 50rpx; +} + +.dot{ + background-color: #4fab5e3d; + width: 60rpx; + height: 60rpx; + border-radius: 60rpx; } \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json index 5457c27..0c9a4af 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -20,17 +20,5 @@ "bigPackageSizeSupport": false }, "libVersion": "3.10.1", - "condition": { - "miniprogram": { - "list": [ - { - "name": "pages/add/index", - "pathName": "pages/add/index", - "query": "", - "scene": null, - "launchMode": "default" - } - ] - } - } + "condition": {} } \ No newline at end of file diff --git a/utils/api.js b/utils/api.js index 4069c5d..68ec4dd 100644 --- a/utils/api.js +++ b/utils/api.js @@ -38,7 +38,7 @@ export const api = (url, method = 'GET', params = {}, type = 'data') => { wx.showModal({ content: result.data.msg }) - reject(err) + } },