feat: 调整样式
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// pages/plant-detail/index.js
|
||||
import request from '../../utils/request';
|
||||
import { calculateDaysSince, getPlantAgeBadge } from '../../utils/dateUtil';
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -53,14 +54,9 @@ Page({
|
||||
|
||||
// Calculate days planted and format date
|
||||
let adoptionDate = '未知';
|
||||
let daysPlanted = 0;
|
||||
const daysPlanted = calculateDaysSince(plant.plantTime);
|
||||
const ageBadge = getPlantAgeBadge(daysPlanted);
|
||||
if (plant.plantTime) {
|
||||
const start = new Date(plant.plantTime);
|
||||
const now = new Date();
|
||||
const diffTime = now - start;
|
||||
if (diffTime > 0) {
|
||||
daysPlanted = Math.floor(diffTime / (1000 * 60 * 60 * 24));
|
||||
}
|
||||
adoptionDate = plant.plantTime.split('T')[0];
|
||||
}
|
||||
|
||||
@@ -70,6 +66,7 @@ Page({
|
||||
location: plant.placement || '',
|
||||
adoptionDate: adoptionDate,
|
||||
daysPlanted: daysPlanted,
|
||||
ageBadge: ageBadge,
|
||||
careSchedule: carePlans
|
||||
},
|
||||
swiperImages: swiperImages,
|
||||
|
||||
Reference in New Issue
Block a user