Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jump_hm_warehouse
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
毛勇泽
jump_hm_warehouse
Commits
87a166c8
Commit
87a166c8
authored
Jan 19, 2024
by
huangqy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FORM表单
parent
70171f25
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
71 行增加
和
41 行删除
+71
-41
General.ets
entry/src/main/ets/pages/sub_systemMaintenance/General.ets
+2
-5
GeneralDialog.ets
entry/src/main/ets/view/GeneralDialog/GeneralDialog.ets
+68
-36
UniInitList.ets
features/SystemMaintenance/src/main/ets/model/UniInitList.ets
+1
-0
没有找到文件。
entry/src/main/ets/pages/sub_systemMaintenance/General.ets
View file @
87a166c8
import { generalInitList, scanInitList, systemList, UniListItem } from '@ohos/system/src/main/ets/model/UniInitList'
import { TitleBar } from '../../view/title/TitleBar'
import { BasicDialog } from '../../view/BasicDialog/BasicDialog'
import promptAction from '@ohos.promptAction'
import { GeneralDialog } from '../../view/GeneralDialog/GeneralDialog'
@Extend(Button) function CommonButtonStyle() {
.borderWidth(2)
...
...
@@ -74,7 +74,7 @@ export struct General {
}
dialogController: CustomDialogController = new CustomDialogController({
builder:
Basic
Dialog({
builder:
General
Dialog({
cancel: this.onCancel,
confirm: this.onSubmit,
clickItem: $clickItem,
...
...
@@ -93,9 +93,6 @@ export struct General {
console.info('------确认------')
}
existApp() {
console.info('Click the callback in the blank area')
}
build() {
Column() {
...
...
entry/src/main/ets/view/GeneralDialog/GeneralDialog.ets
View file @
87a166c8
...
...
@@ -9,38 +9,33 @@ import { UniListItem } from '@ohos/system/src/main/ets/model/UniInitList';
.stateEffect(true)
}
@Observed
class UniList {
title: string; // 标题
showExtraIcon: boolean; // 是否显示额外的图标
showArrow: boolean; // 右边箭头
extraIcon?: Resource; // 图标本体
url?: string; // 跳转的URL
targetValue?: string; // 右侧的值
description?: string; // 描述
constructor(title, showExtraIcon, showArrow, extraIcon, url, targetValue, description) {
this.title = title;
this.showExtraIcon = showExtraIcon;
this.showArrow = showArrow;
this.extraIcon = extraIcon;
this.url = url;
this.targetValue = targetValue;
this.description = description;
}
// 需要提交的表单
interface FormData {
httpURL: string,
httpPORT: string,
scoketURL: string,
scoketPORT: string,
themeName: string,
themeColor: string,
reconnection_mode: boolean,
push_mode: boolean,
transmission_mode: string,
continue_scan_mode: boolean,
scan_read_mode: string,
scanning_mode: string,
broadcastKey: string,
power: string
}
@CustomDialog
@Component
export struct GeneralDialog {
// @ObjectLink uniList: UniList
@Link formData: FormData;
@Link clickItem: UniListItem
controller: CustomDialogController
cancel: () => void
confirm: () => void
@BuilderParam container: () => void
textController: TextInputController = new TextInputController()
build() {
Column() {
...
...
@@ -53,24 +48,60 @@ export struct GeneralDialog {
.color('#19ac88')
.opacity(0.6)
.margin({ left: 8, right: 8 })
Text(
''
).fontSize(20)
Text(
this.clickItem.title
).fontSize(20)
}
.padding({ top: 10, bottom: 10 })
}
Column() {
TextInput({ text: '', controller: this.textController })
.borderRadius(4)
.height(35)
.onChange((value: string) => {
})
if (this.clickItem.key == "transmission_mode") {
Select([{ value: "文件传输" }, { value: "网络传输" }])
.value('请选择数据传输方式')
.borderWidth(1)
.borderRadius(4)
.height(40)
.borderColor("#e5e5e5")
.onSelect((index: number, value?: string) => {
this.formData[this.clickItem?.key] = value
})
} else if (this.clickItem.key == "reconnection_mode") {
Select([{ value: "自动5s重连" }, { value: "手动重连" }])
.value('请选择模式连接方式')
.borderWidth(1)
.borderRadius(4)
.height(40)
.borderColor("#e5e5e5")
.onSelect((index: number, value?: string) => {
this.formData[this.clickItem?.key] = value
})
} else if (this.clickItem.key == "push_mode") {
Select([{ value: "自动推送" }, { value: "手动推送" }])
.value('请选择模式推送方式')
.borderWidth(1)
.borderRadius(4)
.height(40)
.borderColor("#e5e5e5")
.onSelect((index: number, value?: string) => {
this.formData[this.clickItem?.key] = value
})
} else if (this.clickItem.key == "scanning_mode") {
Select([{ value: "手持机终端" }, { value: "手持APP终端" }])
.value('请选择读取类型')
.borderWidth(1)
.borderRadius(4)
.height(40)
.borderColor("#e5e5e5")
.onSelect((index: number, value?: string) => {
this.formData[this.clickItem?.key] = value
})
}
else {
TextInput({ placeholder: '', text: this.formData[this.clickItem?.key] }).height(40).width('90%').borderRadius(4)
.onChange((value: string) => {
this.formData[this.clickItem?.key] = value
})
}
}
.padding({ left: 10, right: 10 })
.width('100%')
.height(35)
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button('确认')
...
...
@@ -80,6 +111,7 @@ export struct GeneralDialog {
}).CommonButtonStyle()
Button('取消')
.onClick(() => {
this.formData[this.clickItem?.key] = ''
this.controller.close()
this.cancel()
}).CommonButtonStyle()
...
...
features/SystemMaintenance/src/main/ets/model/UniInitList.ets
View file @
87a166c8
...
...
@@ -193,6 +193,7 @@ export const generalInitList: UniListItem[] = [
export const scanInitList: UniListItem[] = [
{
title: '扫描模式',
key: 'scanning_mode',
showExtraIcon: true,
showArrow: true,
//extraIcon: '',
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论