《伴时匣》app开发技术分享--表单提交准备(4)

鸿蒙小林
• 阅读 5

技术栈

Appgallery connect

开发准备

上一节我们实现了用户登录功能,现在我们进入首页,可以开始准备着手发布我们的日期计划了,在这之前我们先实现信息表的创建。在首页实现一个标题栏,一个悬浮的按钮。

功能分析

我们的信息表要展示的内容很多,首先是我们的事件名称,目标日期选择,公历农历,正数倒数,倒数类目的选择,是否实现置顶效果,是否显示精确时间,事件颜色,事件图标,事件心情,事件天气,跟用户绑定,跟绑定的关系用户绑定等。

功能开发

我们先实现对应的表的创建

{
  "objectTypeName": "push_table_day",
  "fields": [
    {"fieldName": "id", "fieldType": "Integer", "notNull": true, "belongPrimaryKey": true},
    {"fieldName": "user_id", "fieldType": "Integer", "notNull": true, "defaultValue": 0},
    {"fieldName": "title", "fieldType": "String"},
    {"fieldName": "day", "fieldType": "String"},
    {"fieldName": "time_type", "fieldType": "Integer"},
    {"fieldName": "menu_id", "fieldType": "Integer"},
    {"fieldName": "is_show_top", "fieldType": "Boolean"},
    {"fieldName": "is_show_time", "fieldType": "Boolean"},
    {"fieldName": "tab_color_id", "fieldType": "Integer"},
    {"fieldName": "tab_icon_id", "fieldType": "Integer"},
    {"fieldName": "tab_mood_id", "fieldType": "Integer"},
    {"fieldName": "tab_weather_id", "fieldType": "Integer"},
    {"fieldName": "bind_user_id", "fieldType": "Integer"},
    {"fieldName": "bind_type", "fieldType": "Integer"},
    {"fieldName": "table_message_id", "fieldType": "Integer"}


  ],
  "indexes": [
    {"indexName": "field1Index", "indexList": [{"fieldName":"id","sortType":"ASC"}]}
  ],
  "permissions": [
    {"role": "World", "rights": ["Read", "Upsert", "Delete"]},
    {"role": "Authenticated", "rights": ["Read", "Upsert", "Delete"]},
    {"role": "Creator", "rights": ["Read", "Upsert", "Delete"]},
    {"role": "Administrator", "rights": ["Read", "Upsert", "Delete"]}
  ]
}

db类

import { cloudDatabase } from '@kit.CloudFoundationKit';

class push_table_day extends cloudDatabase.DatabaseObject {
  public id: number;
  public user_id = 0;
  public title: string;
  public day: string;
  public time_type: number;
  public menu_id: number;
  public is_show_top: boolean;
  public is_show_time: boolean;
  public tab_color_id: number;
  public tab_icon_id: number;
  public tab_mood_id: number;
  public tab_weather_id: number;
  public bind_user_id: number;
  public bind_type: number;
  public table_message_id: number;

  public naturalbase_ClassName(): string {
    return 'push_table_day';
  }
}

export { push_table_day };

实体类


class PushTableDay {
    id: number;
    user_id: number = 0;
    title: string;
    day: string;
    time_type: number;
    menu_id: number;
    is_show_top: boolean;
    is_show_time: boolean;
    tab_color_id: number;
    tab_icon_id: number;
    tab_mood_id: number;
    tab_weather_id: number;
    bind_user_id: number;
    bind_type: number;
    table_message_id: number;

    constructor() {
    }


    setId(id: number): void {
        this.id = id;
    }

    getId(): number  {
        return this.id;
    }

    setUser_id(user_id: number): void {
        this.user_id = user_id;
    }

    getUser_id(): number  {
        return this.user_id;
    }

    setTitle(title: string): void {
        this.title = title;
    }

    getTitle(): string  {
        return this.title;
    }

    setDay(day: string): void {
        this.day = day;
    }

    getDay(): string  {
        return this.day;
    }

    setTime_type(time_type: number): void {
        this.time_type = time_type;
    }

    getTime_type(): number  {
        return this.time_type;
    }

    setMenu_id(menu_id: number): void {
        this.menu_id = menu_id;
    }

    getMenu_id(): number  {
        return this.menu_id;
    }

    setIs_show_top(is_show_top: boolean): void {
        this.is_show_top = is_show_top;
    }

    getIs_show_top(): boolean  {
        return this.is_show_top;
    }

    setIs_show_time(is_show_time: boolean): void {
        this.is_show_time = is_show_time;
    }

    getIs_show_time(): boolean  {
        return this.is_show_time;
    }

    setTab_color_id(tab_color_id: number): void {
        this.tab_color_id = tab_color_id;
    }

    getTab_color_id(): number  {
        return this.tab_color_id;
    }

    setTab_icon_id(tab_icon_id: number): void {
        this.tab_icon_id = tab_icon_id;
    }

    getTab_icon_id(): number  {
        return this.tab_icon_id;
    }

    setTab_mood_id(tab_mood_id: number): void {
        this.tab_mood_id = tab_mood_id;
    }

    getTab_mood_id(): number  {
        return this.tab_mood_id;
    }

    setTab_weather_id(tab_weather_id: number): void {
        this.tab_weather_id = tab_weather_id;
    }

    getTab_weather_id(): number  {
        return this.tab_weather_id;
    }

    setBind_user_id(bind_user_id: number): void {
        this.bind_user_id = bind_user_id;
    }

    getBind_user_id(): number  {
        return this.bind_user_id;
    }

    setBind_type(bind_type: number): void {
        this.bind_type = bind_type;
    }

    getBind_type(): number  {
        return this.bind_type;
    }

    setTable_message_id(table_message_id: number): void {
        this.table_message_id = table_message_id;
    }

    getTable_message_id(): number  {
        return this.table_message_id;
    }

}

export { PushTableDay };

我们实现首页标题栏和悬浮添加按钮

import { CommonTopBar } from './widget/CommonTopBar'

@Entry
@Component
struct Index {

  build() {
    Column(){
      CommonTopBar({ title: "主页", alpha: 0, titleAlignment: TextAlign.Center ,backButton:false})
      Stack({alignContent:Alignment.BottomEnd}){
        Column(){
          List(){

          }
        }
        .height('100')
        .width('100%')

        Text("+")
          .fontSize(38)
          .width(60)
          .textAlign(TextAlign.Center)
          .backgroundColor("#ff65c8ee")
          .fontWeight(FontWeight.Bold)
          .fontColor(Color.Black)
          .height(60)
          .borderRadius(30)
          .margin({bottom:80,right:40})

      }
      .height('100%')
      .width('100%')
    }
    .height('100%')
    .width('100%')
    .backgroundColor(Color.White)

  }
}

这样我们就完成了表单的创建和标题栏悬浮按钮的实现

点赞
收藏
评论区
推荐文章
鸿蒙小林 鸿蒙小林
13小时前
《仿盒马》app开发技术分享-- 首页地址选择&会员码(8)
技术栈Appgalleryconnect开发准备上一节我们实现了商品流标的创建,数据的填充和展示,并且在商品信息表中添加了许多我们后去需要使用到的参数。让我们的首页功能更加的丰富,截至目前首页板块可以说是完成了百分之五十了,跟展示有关的基本都已完成,接下来
鸿蒙小林 鸿蒙小林
13小时前
《仿盒马》app开发技术分享-- 自定义标题栏&商品详情初探(9)
技术栈Appgalleryconnect开发准备上一节我们实现了顶部toolbar的地址选择,会员码展示,首页的静态页面就先告一段落,这节我们来实现商品列表item的点击传值、自定义标题栏。功能分析1.自定义标题栏当我们进入二级三级页面的时候,就需要向用户
鸿蒙小林 鸿蒙小林
6小时前
《仿盒马》app开发技术分享-- 个人中心页面(19)
技术栈Appgalleryconnect开发准备上一节我们实现了分类页面的所有联动效果,这一节我们要开始完成一个新的页面,这个页面是我们主界面的第四个板块,就是个人中心页面。在这个模块,我们可以显示一些用户信息,以及用户相关的各类功能的入口功能分析要实现个
鸿蒙小林 鸿蒙小林
6小时前
《仿盒马》app开发技术分享-- 旧物回收订单列表(43)
技术栈Appgalleryconnect开发准备上一节我们实现了订单的创建,并且成功吧数据提交到云数据库中,这一节我们实现的内容是展示我们提交的订单列表功能分析要实现订单列表的展示,首先我们要查询对应用户下的订单列表,查询出对应的订单列表后,展示出对应的数
鸿蒙小林 鸿蒙小林
6小时前
《仿盒马》app开发技术分享-- 领取优惠券(56)
技术栈Appgalleryconnect开发准备在之前的功能开发中,我们有些功能只有展示的能力并没有与云端产生任何的交互,后续经过我们的迭代,更多的能力有了交互能力,这一节我们就要开始着手给那些静态展示的模块添加业务逻辑,我们现在要实现的是首页的新人优惠券
鸿蒙小林 鸿蒙小林
6小时前
《仿盒马》app开发技术分享-- 兑换商品数据插入(67)
技术栈Appgalleryconnect开发准备上一节我们实现了积分列表的展示,我们可以更直观的查看当前用户积分的收支情况,但是现在我们只有积分收入并没有消费的地方,所以现在我们开始着手积分兑换相关的内容。这一节我们来实现积分兑换商品的内容功能分析首先我们
鸿蒙小林 鸿蒙小林
6小时前
《仿盒马》app开发技术分享-- 兑换订单提交(73)
技术栈Appgalleryconnect开发准备上一节我们实现了兑换提交前的准备页面,向用户展示了兑换相关的所有信息,这一节我们就可以实现兑换订单的提交了功能分析订单提交我们需要创建对应的兑换商品订单提交信息表,我们需要把地址,商品信息,积分,备注,订单状
鸿蒙小林 鸿蒙小林
6小时前
《仿盒马》app开发技术分享-- 待发货兑换订单列表(76)
技术栈Appgalleryconnect开发准备上一节我们实现了兑换订单展示页面的框架,这一节我们要进行兑换订单的展示,在兑换订单提交后,默认的状态是待发货状态,我们用列表的方式展示出来功能分析进入页面时我们就要通过用户的userid去查询对应的订单,获取
鸿蒙小林 鸿蒙小林
4小时前
《伴时匣》app开发技术分享--用户登录(3)
技术栈Appgalleryconnect开发准备上一节我们实现了用户数据的提交,我们成功的实现了用户的注册,这一节我们就要根据提交的信息进行登陆验证,在登陆之后我们需要保存当前用户的信息,方便我们后续的使用。功能分析要实现登陆,首先我们需要拿到用户输入的内
鸿蒙小林 鸿蒙小林
4小时前
《伴时匣》app开发技术分享--表单提交页(5)
技术栈Appgalleryconnect开发准备上一节我们已经实现了表单信息的创建,完成了首页跳转表单提交页的内容,这一节我们就要实现表单创建前的数据填充的页面。功能分析在表单提交前,我们要实现的静态内容有很多,分别有输入框,开关,时间选择器,表类型,是否