ソースを参照

feat: new tab1

lfgldr 2 週間 前
コミット
df6edfd497
4 ファイル変更34 行追加153 行削除
  1. 1 1
      README.MD
  2. 28 147
      docs/schema.md
  3. 1 1
      myapp/src/app/tab4/tab4.page.html
  4. 4 4
      myapp/src/app/tabs/tabs.page.html

+ 1 - 1
README.MD

@@ -8,7 +8,7 @@
 
 # 项目标语
 
-    ## 病虫不识莫要慌,神农百问在身旁。
+    ## 病虫不识莫要慌,种植大夫在身旁。
 
 # 政策调研
 ## 《数字乡村发展行动计划(2022-2025年)》政策适配分析报告

+ 28 - 147
docs/schema.md

@@ -34,173 +34,54 @@ GeoPoint => {latitude: 40.0, longitude: -30.0}
 ```plantuml
 @startuml
 class _User {
-  <<Parse内置类>>
+  + objectId: String [PK]
   + username: String
-  + password: String
-  + email: String
-  + mobilePhone: String
-  + ...其他内置字段
+  + phone: String
+  + farmLevel: Number
+  + createdAt: Date
+  + updatedAt: Date
 }
 
 class Farmland {
-  + objectId: String
-  + createdAt: Date
-  + updatedAt: Date
-  + farmlandName: String
+  + objectId: String [PK]
+  + farmName: String
   + area: Number
-  + cropType: String
-  + geoLocation: {latitude: Number, longitude: Number}
+  + soilType: String
+  + location: GeoPoint
+  + currentCrop: Pointer<Crop>
   + owner: Pointer<_User>
-  + status: String  // 如"播种期","生长期","成熟期"
-  + irrigationSystem: String
+  + createdAt: Date
+  + updatedAt: Date
 }
 
 class FarmingReminder {
-  + objectId: String
-  + createdAt: Date
-  + updatedAt: Date
-  + reminderType: String  // 如"灌溉","施肥","除虫"
-  + content: String
+  + objectId: String [PK]
+  + reminderType: String
   + dueDate: Date
   + isCompleted: bool
   + farmland: Pointer<Farmland>
-  + priority: Number
+  + createdBy: Pointer<_User>
+  + details: Object
+  + createdAt: Date
+  + updatedAt: Date
 }
 
 class GrowthRecord {
-  + objectId: String
-  + createdAt: Date
-  + updatedAt: Date
-  + recordType: String  // 如"文字记录","图片记录"
-  + description: String
+  + objectId: String [PK]
   + recordDate: Date
-  + images: Array<Parse.File>
-  + farmland: Pointer<Farmland>
   + growthStage: String
-  + temperature: Number
-  + humidity: Number
+  + healthStatus: String
+  + images: Array<File>
+  + farmland: Pointer<Farmland>
+  + notes: String
+  + weatherData: Object
+  + createdAt: Date
+  + updatedAt: Date
 }
 
+' 关系定义
 _User "1" -- "n" Farmland : owns
 Farmland "1" -- "n" FarmingReminder : has
 Farmland "1" -- "n" GrowthRecord : contains
 @enduml
-```
-
-# SQL语句
-
-以下是使用小驼峰命名并用双引号包裹字段名的PostgreSQL建表语句和测试数据插入语句:
-
-### 1. 建表语句
-
-```sql
--- 用户表(使用Parse内置的_User表,此处仅创建扩展表)
-CREATE TABLE "User" (
-    "objectId" VARCHAR(36) PRIMARY KEY,
-    "username" VARCHAR(50) NOT NULL UNIQUE,
-    "email" VARCHAR(100),
-    "mobilePhone" VARCHAR(20),
-    "createdAt" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-    "updatedAt" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
-);
-
--- 农田表
-CREATE TABLE "Farmland" (
-    "objectId" VARCHAR(36) PRIMARY KEY,
-    "farmlandName" VARCHAR(100) NOT NULL,
-    "area" NUMERIC(10, 2),
-    "cropType" VARCHAR(50),
-    "latitude" NUMERIC(9, 6),
-    "longitude" NUMERIC(9, 6),
-    "ownerId" VARCHAR(36) REFERENCES "User"("objectId"),
-    "status" VARCHAR(20) CHECK ("status" IN ('播种期', '生长期', '成熟期')),
-    "irrigationSystem" VARCHAR(50),
-    "createdAt" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-    "updatedAt" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
-);
-
--- 农事提醒表
-CREATE TABLE "FarmingReminder" (
-    "objectId" VARCHAR(36) PRIMARY KEY,
-    "reminderType" VARCHAR(20) CHECK ("reminderType" IN ('灌溉', '施肥', '除虫')),
-    "content" TEXT,
-    "dueDate" TIMESTAMP NOT NULL,
-    "isCompleted" BOOLEAN DEFAULT false,
-    "farmlandId" VARCHAR(36) REFERENCES "Farmland"("objectId"),
-    "priority" INTEGER DEFAULT 1,
-    "createdAt" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-    "updatedAt" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
-);
-
--- 生长记录表
-CREATE TABLE "GrowthRecord" (
-    "objectId" VARCHAR(36) PRIMARY KEY,
-    "recordType" VARCHAR(20) CHECK ("recordType" IN ('文字记录', '图片记录')),
-    "description" TEXT,
-    "recordDate" TIMESTAMP NOT NULL,
-    "growthStage" VARCHAR(50),
-    "temperature" NUMERIC(5, 2),
-    "humidity" NUMERIC(5, 2),
-    "farmlandId" VARCHAR(36) REFERENCES "Farmland"("objectId"),
-    "createdAt" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-    "updatedAt" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
-);
-
--- 图片存储关联表
-CREATE TABLE "GrowthRecordImages" (
-    "recordId" VARCHAR(36) REFERENCES "GrowthRecord"("objectId"),
-    "fileUrl" VARCHAR(255) NOT NULL,
-    "uploadTime" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
-    PRIMARY KEY ("recordId", "fileUrl")
-);
-```
-
-### 2. 测试数据插入语句
-
-```sql
--- 插入测试用户
-INSERT INTO "User" ("objectId", "username", "email", "mobilePhone") VALUES
-('usr001', 'farmer_wang', 'wang@example.com', '13800138001'),
-('usr002', 'farmer_li', 'li@example.com', '13900139001');
-
--- 插入测试农田
-INSERT INTO "Farmland" ("objectId", "farmlandName", "area", "cropType", "latitude", "longitude", "ownerId", "status", "irrigationSystem") VALUES
-('fld001', '王家的麦田', 5.2, '小麦', 39.9042, 116.4074, 'usr001', '生长期', '滴灌系统'),
-('fld002', '李家的玉米地', 8.5, '玉米', 34.3416, 108.9398, 'usr002', '播种期', '喷灌系统');
-
--- 插入农事提醒
-INSERT INTO "FarmingReminder" ("objectId", "reminderType", "content", "dueDate", "isCompleted", "farmlandId", "priority") VALUES
-('rem001', '灌溉', '麦田需要浇水', CURRENT_TIMESTAMP + INTERVAL '2 days', false, 'fld001', 1),
-('rem002', '施肥', '玉米地需要追肥', CURRENT_TIMESTAMP + INTERVAL '5 days', false, 'fld002', 2);
-
--- 插入生长记录
-INSERT INTO "GrowthRecord" ("objectId", "recordType", "description", "recordDate", "growthStage", "temperature", "humidity", "farmlandId") VALUES
-('rec001', '文字记录', '小麦抽穗期开始', CURRENT_TIMESTAMP - INTERVAL '3 days', '抽穗期', 22.5, 65.0, 'fld001'),
-('rec002', '图片记录', '玉米幼苗生长情况', CURRENT_TIMESTAMP - INTERVAL '1 day', '幼苗期', 25.0, 70.0, 'fld002');
-
--- 插入生长记录图片
-INSERT INTO "GrowthRecordImages" ("recordId", "fileUrl") VALUES
-('rec002', 'https://example.com/images/corn_seedling_1.jpg'),
-('rec002', 'https://example.com/images/corn_seedling_2.jpg');
-```
-
-### 修改说明:
-
-1. **命名规范**:
-   - 所有字段名使用小驼峰命名并用双引号包裹
-   - 表名使用大驼峰命名并用双引号包裹
-   - 保留Parse Server原始字段名(如objectId/createdAt/updatedAt)
-
-2. **修正问题**:
-   - 修正了农事提醒表中的字段名拼写错误(reminderType)
-   - 确保所有引用字段名都使用小驼峰格式
-
-3. **兼容性**:
-   - 完全兼容PostgreSQL的标识符引用规则
-   - 保留所有原始设计的约束和关系
-
-4. **测试数据**:
-   - 保持与之前相同的测试场景
-   - 所有字段引用都使用新的命名格式
-
-这种格式可以直接在PostgreSQL中执行,且与Parse Server的命名规范完全一致。如需在其它数据库中使用,可能需要根据数据库特性调整引号的使用方式。
+```

+ 1 - 1
myapp/src/app/tab4/tab4.page.html

@@ -51,7 +51,7 @@
   <ng-template #guestTemplate>
     <div class="guest-welcome">
       <ion-icon name="leaf" color="medium"></ion-icon>
-      <h3>欢迎使用神农百问</h3>
+      <h3>欢迎使用禾大夫</h3>
       <p>登录后享受完整服务</p>
       <ion-button expand="block" shape="round" (click)="login()">
         <ion-icon name="log-in" slot="start"></ion-icon>

+ 4 - 4
myapp/src/app/tabs/tabs.page.html

@@ -3,22 +3,22 @@
   <ion-tab-bar slot="bottom">
     <ion-tab-button tab="tab1" href="/tabs/tab1">
       <ion-icon aria-hidden="true" name="home"></ion-icon>
-      <ion-label>Tab 1</ion-label>
+      <ion-label>首页</ion-label>
     </ion-tab-button>
 
     <ion-tab-button tab="tab2" href="/tabs/tab2">
       <ion-icon aria-hidden="true" name="book"></ion-icon>
-      <ion-label>Tab 2</ion-label>
+      <ion-label>咨询</ion-label>
     </ion-tab-button>
 
     <ion-tab-button tab="tab3" href="/tabs/tab3">
       <ion-icon aria-hidden="true" name="leaf"></ion-icon>
-      <ion-label>Tab 3</ion-label>
+      <ion-label>农场</ion-label>
     </ion-tab-button>
 
     <ion-tab-button tab="tab4" href="/tabs/tab4">
       <ion-icon aria-hidden="true" name="person"></ion-icon>
-      <ion-label>Tab 4</ion-label>
+      <ion-label>我的</ion-label>
     </ion-tab-button>
   </ion-tab-bar>