fix
This commit is contained in:
parent
d72bc9ccd8
commit
5ee3e89e0a
2
app.json
2
app.json
@ -25,7 +25,7 @@
|
||||
"selectedIconPath": "static/img/home1.png",
|
||||
"pagePath": "pages/index/index",
|
||||
"iconSize": 48,
|
||||
"text": "首页"
|
||||
"text": "我的花园"
|
||||
},
|
||||
{
|
||||
"iconPath": "static/img/home.png",
|
||||
|
||||
@ -50,7 +50,6 @@ Page({
|
||||
if(res.errMsg.indexOf("uploadFile:ok") > -1){
|
||||
const data = JSON.parse(res.data)
|
||||
const id = data.data.file.id
|
||||
console.log(id);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -75,7 +75,7 @@ Page({
|
||||
libraryId: this.data.info.id,
|
||||
userId: user.id
|
||||
}
|
||||
api('/plant/plantByLibrary', 'POST', data, 'json').then(res => {
|
||||
api('/plant/plantByLibrary', 'GET', data).then(res => {
|
||||
if (res.code === 200) {
|
||||
wx.navigateTo({
|
||||
url: '../about/index?type=1',
|
||||
|
||||
@ -8,9 +8,11 @@
|
||||
|
||||
|
||||
<!-- back -->
|
||||
<view style="z-index: 99;position: absolute; top: 110rpx; left: -20rpx; padding: 0 32rpx; " bind:tap="goBack">
|
||||
<t-icon name="chevron-left" size="58rpx" style="color: white;"></t-icon>
|
||||
<view style="z-index: 999;position: fixed; top: 110rpx; left: 32rpx; background-color: #34343482 ; width: 60rpx ; height: 60rpx; border-radius: 30rpx; " bind:tap="goBack">
|
||||
<view class="flex flex-center" style="width: 100%;height: 100%;">
|
||||
<t-icon name="chevron-left" size="48rpx" style="color: white;"></t-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- info -->
|
||||
<view style="background-color:white;margin-top: -130rpx;z-index: 99;position: absolute; width: 100vw; border-top-right-radius: 50rpx; border-top-left-radius: 50rpx;">
|
||||
|
||||
@ -27,8 +27,10 @@ Page({
|
||||
if (res.code === 200){
|
||||
const tmp = res.data
|
||||
tmp.farms.suitableFertilizer = tmp.farms.suitableFertilizer.split(',')
|
||||
if (tmp.ossList.length >0 ){
|
||||
tmp.pic = tmp.ossList[0].url
|
||||
}
|
||||
this.setData({info:res.data})
|
||||
console.log(tmp);
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -88,6 +90,7 @@ Page({
|
||||
icon:'success',
|
||||
title: res.msg,
|
||||
})
|
||||
this.fetchInfo()
|
||||
}else {
|
||||
wx.showModal({
|
||||
content: res.msg
|
||||
|
||||
@ -6,7 +6,8 @@
|
||||
<view class="flex flex-center flex-justify-start">
|
||||
<view >
|
||||
<view class="container">
|
||||
<image src="https://res.catter.cn/pub/2025/09/30/20250930143920286.png" mode="aspectFill" class="bg"></image>
|
||||
<image wx:if="{{info.pic}}" src="{{info.pic}}" mode="aspectFill" class="bg"></image>
|
||||
<image wx:else src="https://res.catter.cn/pub/2025/09/30/20250930143920286.png" mode="aspectFill" class="bg"></image>
|
||||
<view class="tips ">
|
||||
<view style="background-color: #34343442;height: 100%; width: 100%" class="flex flex-center" bind:tap="upload">
|
||||
<t-icon name="camera" style="color: white;" size="48rpx"></t-icon>
|
||||
|
||||
@ -6,7 +6,9 @@ Page({
|
||||
list:[]
|
||||
},
|
||||
onLoad(options) {
|
||||
|
||||
wx.setNavigationBarTitle({
|
||||
title: '我的花园',
|
||||
})
|
||||
},
|
||||
onShow(){
|
||||
this.fetchList()
|
||||
@ -22,7 +24,12 @@ Page({
|
||||
const data = {userId: user.id,current:1,pageSize:20}
|
||||
api('/plant/getList','POST',data,'json').then(res => {
|
||||
if (res.code === 200){
|
||||
const tmps = res.data.list
|
||||
const tmps = res.data.list.map(e => {
|
||||
if (e.ossList.length >0){
|
||||
e.pic = e.ossList[0].url
|
||||
}
|
||||
return e
|
||||
})
|
||||
this.setData({list:tmps})
|
||||
}
|
||||
})
|
||||
|
||||
@ -17,7 +17,8 @@
|
||||
<view class="padding">
|
||||
<view wx:for="{{list}}" class="row padding mb-32" data-id="{{item.id}}" bind:tap="goInfo">
|
||||
<view class="flex flex-center flex-justify-start">
|
||||
<image class="pic" src="https://res.catter.cn/pub/2025/09/30/20250930143920286.png"></image>
|
||||
<image class="pic" mode="aspectFill" wx:if="{{item.pic}}" src="{{item.pic}}"></image>
|
||||
<image class="pic" mode="aspectFill" wx:else src="https://res.catter.cn/pub/2025/09/30/20250930143920286.png"></image>
|
||||
<view style="margin-left:16rpx">
|
||||
<view class="font-16 bold">{{item.name}}</view>
|
||||
<view class="font-14 grey">{{item.latinName}}</view>
|
||||
|
||||
@ -7,7 +7,8 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
id:''
|
||||
id:'',
|
||||
farms:[]
|
||||
},
|
||||
|
||||
/**
|
||||
@ -24,13 +25,31 @@ Page({
|
||||
if (res.code === 200){
|
||||
const tmp = res.data
|
||||
tmp.farms.suitableFertilizer = tmp.farms.suitableFertilizer.split(',')
|
||||
this.setData({info:res.data})
|
||||
if (tmp.ossList.length >0 ){
|
||||
tmp.pic = tmp.ossList[0].url
|
||||
tmp.picList = tmp.ossList.map(sub => sub.url)
|
||||
}
|
||||
console.log(tmp);
|
||||
this.setData({info:res.data})
|
||||
}
|
||||
})
|
||||
api('/plant/todayFarm',data).then(res => {
|
||||
api('/plant/todayFarm','GET',data).then(res => {
|
||||
if (res.code === 200){
|
||||
console.log(res);
|
||||
this.setData({farms:res.data})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
addFarmLog(e){
|
||||
const item = e.currentTarget.dataset.item
|
||||
const data = {id:item.id,plantId:item.plantId, title:item.title,remark:'测试',status:2}
|
||||
api('/plant/addRecord','POST',data,'json').then(res => {
|
||||
if (res.code === 200){
|
||||
wx.showToast({
|
||||
icon:'success',
|
||||
title: res.msg,
|
||||
})
|
||||
this.fetchInfo()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
{
|
||||
"navigationStyle": "custom",
|
||||
"usingComponents": {}
|
||||
"usingComponents": {
|
||||
"t-swiper": "tdesign-miniprogram/swiper/swiper",
|
||||
"t-swiper-nav": "tdesign-miniprogram/swiper-nav/swiper-nav"
|
||||
}
|
||||
}
|
||||
@ -2,13 +2,19 @@
|
||||
<view>
|
||||
<!-- top -->
|
||||
<view class="top" style="position: relative; z-index: 2;">
|
||||
<image src="https://res.catter.cn/pub/2025/09/30/20250930150006852.png" style="width: 100vw; height: 680rpx;" mode="aspectFill"></image>
|
||||
<t-swiper style="width: 100vw;" height="640rpx" wx:if="{{info.pic}}" list="{{info.picList}}" >
|
||||
|
||||
</t-swiper>
|
||||
|
||||
<image wx:else="" src="https://res.catter.cn/pub/2025/09/30/20250930150006852.png" style="width: 100vw; height: 680rpx;" mode="aspectFill"></image>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- back -->
|
||||
<view style="z-index: 99;position: absolute; top: 110rpx; left: -20rpx; padding: 0 32rpx; " bind:tap="goBack">
|
||||
<t-icon name="chevron-left" size="58rpx" style="color: white;"></t-icon>
|
||||
<view style="z-index: 999;position: fixed; top: 110rpx; left: 32rpx; background-color: #34343482 ; width: 60rpx ; height: 60rpx; border-radius: 30rpx; " bind:tap="goBack">
|
||||
<view class="flex flex-center" style="width: 100%;height: 100%;">
|
||||
<t-icon name="chevron-left" size="48rpx" style="color: white;"></t-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- info -->
|
||||
@ -37,43 +43,18 @@
|
||||
<view>
|
||||
<view class="row padding mt-32">
|
||||
<view>今日任务</view>
|
||||
<view class="flex flex-center flex-justify-between mt-16">
|
||||
<view class="flex flex-center flex-justify-between mt-16" wx:for="{{farms}}">
|
||||
<view class="flex flex-justify-start flex-aligin-center mt-16">
|
||||
<t-avatar icon="color-invert" />
|
||||
<view class="ml-16">
|
||||
<view class="font-14 bold">浇水</view>
|
||||
<view class="font-14 bold">{{item.title}}</view>
|
||||
<view class="font-12 grey">每{{info.farms.wateringCycle}}天一次</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<t-button theme="primary" shape="round" size="small">完成</t-button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex flex-center flex-justify-between mt-16">
|
||||
<view class="flex flex-justify-start flex-aligin-center mt-16">
|
||||
<t-avatar icon="color-invert" />
|
||||
|
||||
<view class="ml-16">
|
||||
<view class="font-14 bold">施肥</view>
|
||||
<view class="font-12 grey">每{{info.farms.liquidFertilizerCycle}}天一次</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<t-button shape="round" size="small">未完成</t-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="flex flex-center flex-justify-between mt-16">
|
||||
<view class="flex flex-justify-start flex-aligin-center mt-16">
|
||||
<t-avatar icon="color-invert" />
|
||||
|
||||
<view class="ml-16">
|
||||
<view class="font-14 bold">旋转</view>
|
||||
<view class="font-12 grey">每{{info.farms.rotationCycle}}天一次</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<t-button shape="round" size="small">未完成</t-button>
|
||||
<t-button wx:if="{{item.status == 1}}" theme="danger" variant="outline" shape="round" size="small" data-item="{{item}}" bind:tap="addFarmLog">未完成</t-button>
|
||||
<t-button wx:if="{{item.status == 2}}" theme="primary" shape="round" size="small" data-item="{{item}}" bind:tap="addFarmLog">完成</t-button>
|
||||
<t-button wx:if="{{item.status == 3}}" theme="primary" shape="round" size="small" data-item="{{item}}" bind:tap="addFarmLog">逾期</t-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -16,6 +16,9 @@ Page({
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.init()
|
||||
wx.setNavigationBarTitle({
|
||||
title: '今日农事',
|
||||
})
|
||||
},
|
||||
|
||||
init(){
|
||||
@ -42,11 +45,31 @@ Page({
|
||||
if (res.code === 200){
|
||||
const data = res.data
|
||||
if (data !== null){
|
||||
this.setData({list:data})
|
||||
const tmps = data.map(e => {
|
||||
if (e.ossList.length > 0){
|
||||
e.pic = e.ossList[0].url
|
||||
}
|
||||
return e
|
||||
})
|
||||
this.setData({list:tmps})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
addFarmLog(e){
|
||||
const item = e.currentTarget.dataset.item
|
||||
const data = {id:item.id,plantId:item.plantId, title:item.title,remark:'测试',status:2}
|
||||
api('/plant/addRecord','POST',data,'json').then(res => {
|
||||
if (res.code === 200){
|
||||
wx.showToast({
|
||||
icon:'success',
|
||||
title: res.msg,
|
||||
})
|
||||
this.fetchInfo()
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
|
||||
@ -1,13 +1,41 @@
|
||||
<!--pages/today/index.wxml-->
|
||||
<view>
|
||||
<view>
|
||||
<view wx:if="{{list.length === 0}}" class="flex flex-center flex-col " style="margin-top: 268rpx;" >
|
||||
<view wx:if="{{list.length === 0}}" class="flex flex-center flex-col " style="margin-top: 268rpx;">
|
||||
<view class="empty flex flex-center flex-col">
|
||||
</view>
|
||||
<view class="mt-16 flex flex-center flex-col">
|
||||
<view class="font-16 bold" >已完成所有任务</view>
|
||||
<view class="font-16 bold">已完成所有任务</view>
|
||||
<view class="font-12 grey mt-16">今天暂无农事需要完成</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:else class="padding">
|
||||
<view>
|
||||
今日任务
|
||||
</view>
|
||||
<view class="mt-32">
|
||||
<view wx:for="{{list}}">
|
||||
<view class="">
|
||||
<view wx:for="{{item.FarmRecord}}" wx:for-item="sub" class=" row padding mt-32">
|
||||
<view>
|
||||
<view class="action font-16 bold">{{sub.title}}</view>
|
||||
<view class="flex flex-center flex-justify-between">
|
||||
<view class="flex flex-center flex-justify-start mt-16">
|
||||
<image src="{{item.pic}}" class="pic"></image>
|
||||
<view class="ml-16">{{item.name}}</view>
|
||||
</view>
|
||||
<view>
|
||||
<t-button wx:if="{{sub.status == 1}}" theme="danger" variant="outline" shape="round" size="small" data-item="{{sub}}" bind:tap="addFarmLog">未完成</t-button>
|
||||
<t-button wx:if="{{sub.status == 2}}" theme="primary" shape="round" size="small" data-item="{{sub}}" bind:tap="addFarmLog">完成</t-button>
|
||||
<t-button wx:if="{{sub.status == 3}}" theme="primary" shape="round" size="small" data-item="{{sub}}" bind:tap="addFarmLog">逾期</t-button>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -1,4 +1,8 @@
|
||||
/* pages/today/index.wxss */
|
||||
page {
|
||||
background-color: #F6F6F6;
|
||||
}
|
||||
|
||||
.empty {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
@ -6,4 +10,15 @@
|
||||
border-radius: 140rpx;
|
||||
background-image: url("https://res.catter.cn/pub/2025/09/30/20250930143142508.png");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.pic{
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.action {
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user