feat: 整体页面优化,删除无用svg
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// pages/garden/add/index.js
|
||||
import { CARE_TASK_ICONS } from '../../../utils/mockData';
|
||||
import { CARE_TASK_ICONS } from '../../../utils/constant';
|
||||
import request from '../../../utils/request';
|
||||
import { requestSubscription, checkSubscriptionSettings } from '../../../utils/subscribe';
|
||||
|
||||
@@ -253,7 +253,8 @@ Page({
|
||||
const carePlans = newCareTasks.map(task => ({
|
||||
name: task.taskName || '未命名事项',
|
||||
period: parseInt(task.frequencyValue) || 1,
|
||||
icon: JSON.stringify(task.taskIcon || {}) // Serialize icon details
|
||||
icon: JSON.stringify(task.taskIcon || {}), // Serialize icon details
|
||||
targetAction: (task.taskIcon && task.taskIcon.targetAction) ? task.taskIcon.targetAction : ''
|
||||
}));
|
||||
|
||||
// Construct Payload
|
||||
|
||||
+24
-3
@@ -12,7 +12,8 @@ Page({
|
||||
pageSize: 6,
|
||||
total: 0,
|
||||
isLastPage: false,
|
||||
isLoading: false
|
||||
isLoading: false,
|
||||
scrollTop: 0
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
@@ -66,9 +67,23 @@ Page({
|
||||
const mappedList = list.map(item => {
|
||||
let imageUrl = '';
|
||||
if (item.imgList && item.imgList.length > 0) {
|
||||
imageUrl = item.imgList[0].url;
|
||||
imageUrl = item.imgList[0].url || '';
|
||||
}
|
||||
return { ...item, images: [imageUrl] };
|
||||
|
||||
// Calculate days
|
||||
let days = 1;
|
||||
if (item.plantTime) {
|
||||
try {
|
||||
const start = new Date(item.plantTime).getTime();
|
||||
const now = Date.now();
|
||||
const diff = now - start;
|
||||
if (diff > 0) {
|
||||
days = Math.ceil(diff / (1000 * 60 * 60 * 24));
|
||||
}
|
||||
} catch (e) { }
|
||||
}
|
||||
|
||||
return { ...item, images: [imageUrl], daysPlanted: days };
|
||||
});
|
||||
|
||||
this.setData({
|
||||
@@ -139,5 +154,11 @@ Page({
|
||||
return {
|
||||
title: '我的植物花园 - Sundynix Plant'
|
||||
};
|
||||
},
|
||||
|
||||
onTabItemTap() {
|
||||
// Reset scroll when switching to this tab
|
||||
// Use random small value to force data change detection
|
||||
this.setData({ scrollTop: Math.random() * 0.01 });
|
||||
}
|
||||
})
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view wx:else scroll-y class="garden-list-container" enhanced show-scrollbar="{{false}}" bindscrolltolower="onScrollLower">
|
||||
<scroll-view wx:else scroll-y class="garden-list-container" enhanced show-scrollbar="{{false}}" bindscrolltolower="onScrollLower" scroll-top="{{scrollTop}}">
|
||||
<view class="plant-grid">
|
||||
<view wx:for="{{plants}}" wx:key="id" class="plant-card" bindtap="navigateToDetail" data-id="{{item.id}}">
|
||||
<view class="plant-image-container">
|
||||
|
||||
Reference in New Issue
Block a user