1688网站建设徐州建设工程网

张小明 2026/1/10 5:09:04
1688网站建设,徐州建设工程网,php7.0 wordpress 设置,wordpress 4.6.1 下载欢迎大家加入开源鸿蒙跨平台开发者社区#xff0c;一起共建开源鸿蒙跨平台生态。 换盆管理系统概述 换盆是植物生长过程中的重要环节#xff0c;它为植物提供更多的生长空间和新鲜的土壤。在Cordova框架与OpenHarmony系统的结合下#xff0c;我们需要实现一个完整的换盆记录…欢迎大家加入开源鸿蒙跨平台开发者社区一起共建开源鸿蒙跨平台生态。换盆管理系统概述换盆是植物生长过程中的重要环节它为植物提供更多的生长空间和新鲜的土壤。在Cordova框架与OpenHarmony系统的结合下我们需要实现一个完整的换盆记录系统包括换盆记录的创建、查询、统计和提醒功能。这个系统需要记录换盆的详细信息如盆的大小、土壤类型等。换盆记录数据模型classPotSize{constructor(id,name,diameter,volume){this.idid;this.namename;this.diameterdiameter;// 直径厘米this.volumevolume;// 容积升}}classSoilType{constructor(id,name,composition,ph){this.idid;this.namename;this.compositioncomposition;// 土壤成分this.phph;// pH值}}classRepottingRecord{constructor(plantId,oldPotSize,newPotSize,soilType,notes){this.idrepot_Date.now();this.plantIdplantId;this.oldPotSizeoldPotSize;this.newPotSizenewPotSize;this.soilTypesoilType;this.datenewDate();this.notesnotes;this.reason;// 换盆原因}}classRepottingManager{constructor(){this.records[];this.potSizes[];this.soilTypes[];this.initDefaultData();this.loadFromStorage();}initDefaultData(){this.potSizes[newPotSize(pot_1,小盆,10,0.5),newPotSize(pot_2,中盆,15,1.5),newPotSize(pot_3,大盆,20,3),newPotSize(pot_4,特大盆,25,5)];this.soilTypes[newSoilType(soil_1,通用土壤,泥炭土珍珠岩蛭石,6.5),newSoilType(soil_2,多肉土壤,沙土珍珠岩碎石,7),newSoilType(soil_3,兰花土壤,树皮苔藓珍珠岩,6),newSoilType(soil_4,酸性土壤,泥炭土硫磺,5.5)];}addRepottingRecord(plantId,oldPotSize,newPotSize,soilType,notes){constrecordnewRepottingRecord(plantId,oldPotSize,newPotSize,soilType,notes);this.records.push(record);this.saveToStorage();returnrecord;}}这个换盆记录数据模型定义了PotSize、SoilType、RepottingRecord和RepottingManager类。PotSize类定义了盆的规格SoilType类定义了土壤类型RepottingRecord类记录每次换盆的详细信息。与OpenHarmony数据库的集成functionsaveRepottingRecordToDatabase(record){cordova.exec(function(result){console.log(换盆记录已保存到数据库);},function(error){console.error(保存失败:,error);},DatabasePlugin,saveRepottingRecord,[{id:record.id,plantId:record.plantId,oldPotSize:record.oldPotSize,newPotSize:record.newPotSize,soilType:record.soilType,date:record.date.toISOString(),notes:record.notes,reason:record.reason}]);}functionloadRepottingRecordsFromDatabase(){cordova.exec(function(result){console.log(换盆记录已从数据库加载);repottingManager.recordsresult.map(rec{constrecordnewRepottingRecord(rec.plantId,rec.oldPotSize,rec.newPotSize,rec.soilType,rec.notes);record.idrec.id;record.datenewDate(rec.date);record.reasonrec.reason;returnrecord;});renderRepottingRecords();},function(error){console.error(加载失败:,error);},DatabasePlugin,loadRepottingRecords,[]);}这段代码展示了如何与OpenHarmony的数据库进行交互。saveRepottingRecordToDatabase函数将换盆记录保存到数据库loadRepottingRecordsFromDatabase函数从数据库加载所有换盆记录。换盆记录列表展示functionrenderRepottingRecords(plantId){constplantplants.find(pp.idplantId);if(!plant)return;constrecordsrepottingManager.records.filter(rr.plantIdplantId).sort((a,b)newDate(b.date)-newDate(a.date));constcontainerdocument.getElementById(page-container);container.innerHTMLdiv classrepotting-records-container h2${plant.name}的换盆记录/h2 button classadd-record-btn onclickshowAddRepottingRecordDialog(${plantId}) 添加换盆记录 /button /div;if(records.length0){container.innerHTMLp classempty-message还没有换盆记录/p;return;}constrecordsListdocument.createElement(div);recordsList.classNamerecords-list;records.forEach(record{constoldPotrepottingManager.potSizes.find(pp.idrecord.oldPotSize);constnewPotrepottingManager.potSizes.find(pp.idrecord.newPotSize);constsoilrepottingManager.soilTypes.find(ss.idrecord.soilType);constrecordItemdocument.createElement(div);recordItem.classNamerecord-item;recordItem.innerHTMLdiv classrecord-info p classrecord-date${record.date.toLocaleString(zh-CN)}/p p classpot-change${oldPot?.name||未知}→${newPot?.name||未知}/p p classpot-size盆径:${oldPot?.diameter}cm →${newPot?.diameter}cm/p p classsoil-type土壤:${soil?.name||未知}/p p classsoil-phpH值:${soil?.ph||N/A}/p${record.reason?p classrepotting-reason原因:${record.reason}/p:}${record.notes?p classrecord-notes备注:${record.notes}/p:}/div div classrecord-actions button onclickeditRepottingRecord(${record.id})编辑/button button onclickdeleteRepottingRecord(${record.id})删除/button /div;recordsList.appendChild(recordItem);});container.appendChild(recordsList);}这个函数负责渲染换盆记录列表。它显示了特定植物的所有换盆记录包括日期、盆的变化、土壤类型和pH值。用户可以通过编辑和删除按钮管理记录。添加换盆记录对话框functionshowAddRepottingRecordDialog(plantId){constdialogdocument.createElement(div);dialog.classNamemodal-dialog;letpotOptions;repottingManager.potSizes.forEach(pot{potOptionsoption value${pot.id}${pot.name}(${pot.diameter}cm)/option;});letsoilOptions;repottingManager.soilTypes.forEach(soil{soilOptionsoption value${soil.id}${soil.name}(pH${soil.ph})/option;});dialog.innerHTMLdiv classmodal-content h3添加换盆记录/h3 form idadd-repotting-form div classform-group label原盆大小/label select idold-pot-size required option value请选择原盆大小/option${potOptions}/select /div div classform-group label新盆大小/label select idnew-pot-size required option value请选择新盆大小/option${potOptions}/select /div div classform-group label土壤类型/label select idsoil-type required option value请选择土壤类型/option${soilOptions}/select /div div classform-group label换盆原因/label select idrepotting-reason option value请选择原因/option option value根系拥挤根系拥挤/option option value土壤老化土壤老化/option option value植物生长植物生长/option option value病害防治病害防治/option /select /div div classform-group label换盆日期/label input typedatetime-local idrepotting-date required /div div classform-group label备注/label textarea idrepotting-notes/textarea /div div classform-actions button typesubmit保存/button button typebutton onclickcloseDialog()取消/button /div /form /div;document.getElementById(modal-container).appendChild(dialog);constnownewDate();document.getElementById(repotting-date).valuenow.toISOString().slice(0,16);document.getElementById(add-repotting-form).addEventListener(submit,function(e){e.preventDefault();constoldPotSizedocument.getElementById(old-pot-size).value;constnewPotSizedocument.getElementById(new-pot-size).value;constsoilTypedocument.getElementById(soil-type).value;constreasondocument.getElementById(repotting-reason).value;constdatenewDate(document.getElementById(repotting-date).value);constnotesdocument.getElementById(repotting-notes).value;constrecordnewRepottingRecord(plantId,oldPotSize,newPotSize,soilType,notes);record.datedate;record.reasonreason;repottingManager.records.push(record);repottingManager.saveToStorage();saveRepottingRecordToDatabase(record);closeDialog();renderRepottingRecords(plantId);showToast(换盆记录已添加);});}这个函数创建并显示添加换盆记录的对话框。用户可以选择原盆大小、新盆大小、土壤类型、换盆原因和日期。提交后新记录会被添加到repottingManager中。换盆统计功能classRepottingStatistics{constructor(repottingManager){this.repottingManagerrepottingManager;}getTotalRepottingCount(plantId){returnthis.repottingManager.records.filter(rr.plantIdplantId).length;}getLastRepottingDate(plantId){constrecordsthis.repottingManager.records.filter(rr.plantIdplantId).sort((a,b)newDate(b.date)-newDate(a.date));returnrecords.length0?records[0].date:null;}getRepottingInterval(plantId){constrecordsthis.repottingManager.records.filter(rr.plantIdplantId).sort((a,b)newDate(a.date)-newDate(b.date));if(records.length2)returnnull;constintervals[];for(leti1;irecords.length;i){constintervalMath.floor((newDate(records[i].date)-newDate(records[i-1].date))/(24*60*60*1000));intervals.push(interval);}returnMath.round(intervals.reduce((a,b)ab)/intervals.length);}getMostUsedSoilType(plantId){constrecordsthis.repottingManager.records.filter(rr.plantIdplantId);constsoilCounts{};records.forEach(record{soilCounts[record.soilType](soilCounts[record.soilType]||0)1;});constmostUsedObject.keys(soilCounts).reduce((a,b)soilCounts[a]soilCounts[b]?a:b);returnthis.repottingManager.soilTypes.find(ss.idmostUsed);}}这个RepottingStatistics类提供了换盆的统计功能。getTotalRepottingCount返回换盆总次数getLastRepottingDate返回最后一次换盆的日期getRepottingInterval计算平均换盆间隔getMostUsedSoilType返回最常用的土壤类型。换盆提醒功能functioncheckRepottingReminders(){plants.forEach(plant{constlastRepottingDategetLastRepottingDate(plant.id);constrepottingIntervalplant.repottingInterval||365;// 默认1年if(!lastRepottingDate){sendRepottingReminder(plant.id,plant.name,从未换过盆);return;}constdaysSinceRepottingMath.floor((newDate()-newDate(lastRepottingDate))/(24*60*60*1000));if(daysSinceRepottingrepottingInterval){sendRepottingReminder(plant.id,plant.name,已${daysSinceRepotting}天未换盆);}});}functionsendRepottingReminder(plantId,plantName,message){cordova.exec(function(result){console.log(换盆提醒已发送);},function(error){console.error(提醒发送失败:,error);},NotificationPlugin,sendReminder,[{title:${plantName}需要换盆,message:message,plantId:plantId,type:repotting}]);}functiongetLastRepottingDate(plantId){constrecordsrepottingManager.records.filter(rr.plantIdplantId).sort((a,b)newDate(b.date)-newDate(a.date));returnrecords.length0?records[0].date:null;}setInterval(checkRepottingReminders,60*60*1000);// 每小时检查一次这段代码实现了换盆提醒功能。checkRepottingReminders函数检查所有植物如果某个植物超过设定的换盆间隔就发送提醒。总结换盆记录管理系统是植物养护应用的重要功能。通过合理的数据模型设计、与OpenHarmony系统的集成和各种统计分析功能我们可以创建一个功能完整的换盆管理系统帮助用户科学地管理植物的换盆。
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

扬中本地论坛seo网络推广公司排名

FaceFusion实战:如何用GPU实现毫秒级人脸替换在直播滤镜、虚拟偶像和AI社交应用大行其道的今天,用户对“实时换脸”的期待早已从“能用”转向“丝滑”。你有没有遇到过这样的场景——打开一款换脸App,刚对准镜头,画面就开始卡顿掉…

张小明 2025/12/23 16:57:45 网站建设

ppt成品免费下载的网站企业网站建设费用定金怎么做账

你是不是遇到过这样的问题:明明把某个值放进了state里,但在effect里拿到的还是旧值一个定时器反复启动、停止,代码看起来没毛病埋点数据在测试环境正常,上线就乱套了某个功能在本地好用,用户那边却数据混乱如果是&…

张小明 2025/12/22 6:04:58 网站建设

创建个人网站名字青岛网站设计皆挺青岛

在搭建独立站的过程中,第三方对接是不可或缺的一环。语言、支付、物流、仓库、ERP 等环节的对接,都需要商家精心策划与安排。通过合理的第三方对接,可实现:提高独立站运营效率降低运营成本提升用户体验一、多语言支持对接为吸引全…

张小明 2025/12/21 17:12:55 网站建设

自家电脑做网站广州做网页

SmartDNS导致的OpenWRT重启故障排查与修复指南 【免费下载链接】smartdns A local DNS server to obtain the fastest website IP for the best Internet experience, support DoT, DoH. 一个本地DNS服务器,获取最快的网站IP,获得最佳上网体验&#xff0…

张小明 2026/1/1 2:44:20 网站建设

慧聪网怎样做网站友情链接找个公司做网站需要注意什么

JumpServer会话审计架构剖析与实战指南 【免费下载链接】jumpserver jumpserver/jumpserver: 是一个开源的 Web 服务器和 Web 应用程序代理服务器,可以用于构建安全,高性能和易于使用的 Web 服务器和代理服务器。 项目地址: https://gitcode.com/GitHu…

张小明 2025/12/22 16:53:25 网站建设

桂林建站工商营业执照查询官网

近日,第十届CNABS资产证券化年会揭晓年度“金桂奖”,中和农信集团凭借在资产证券化领域的突出表现,一举斩获两项大奖:集团公司荣获“最受欢迎债券发行机构奖”,同时其旗下重庆市中和农信小额贷款有限公司发行的定向资产…

张小明 2025/12/23 6:46:03 网站建设