feat: 调整样式
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
const calculateDaysSince = (dateStr) => {
|
||||
if (!dateStr) return 1; // Default to 1 day if date missing
|
||||
|
||||
// Use timestamps to calculate difference
|
||||
const start = new Date(dateStr).getTime();
|
||||
const now = new Date().getTime();
|
||||
|
||||
if (isNaN(start)) return 1;
|
||||
|
||||
const diffTime = Math.abs(now - start);
|
||||
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
||||
|
||||
return diffDays || 1; // Return 1 even if diffDays is 0 (just joined)
|
||||
};
|
||||
|
||||
const getPlantAgeBadge = (days) => {
|
||||
if (days <= 15) return { icon: '🌱', title: '职场萌新', desc: '还在适应新家的光照和水土,随时可能“离职”。' };
|
||||
if (days <= 60) return { icon: '🌿', title: '正式员工', desc: '已经度过了缓苗期,冒出了第一片新叶。' };
|
||||
if (days <= 180) return { icon: '🪴', title: '资深住户', desc: '经历了季节交替的考验,已经完全融入了你的家居环境。' };
|
||||
if (days <= 365) return { icon: '🌳', title: '元老级导师', desc: '跨越了冬夏两季,生命力顽强,建议作为传家宝培养。' };
|
||||
if (days <= 1095) return { icon: '🏅', title: '荣誉守护神', desc: '它已经不是植物了,是这个家的“不动产”和家庭成员。' };
|
||||
return { icon: '🧚♀️', title: '植物成精', desc: '建议尊称它一声“绿植大仙”,它可能比你更了解阳台的风水。' };
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
calculateDaysSince,
|
||||
getPlantAgeBadge
|
||||
};
|
||||
+2
-2
@@ -270,8 +270,8 @@ class WxRequest {
|
||||
|
||||
// Initialize with default instance
|
||||
const request = new WxRequest({
|
||||
//baseUrl: 'http://192.168.0.184:8889',
|
||||
baseUrl: 'https://go.sundynix.cn/api',
|
||||
baseUrl: 'http://192.168.0.184:8889',
|
||||
//baseUrl: 'https://go.sundynix.cn/api',
|
||||
header: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user