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
9011a521
Commit
9011a521
authored
Jan 18, 2024
by
huangqy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HTTP请求
parent
5c21a35e
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
159 行增加
和
162 行删除
+159
-162
CommonConstants.ets
common/src/main/ets/constants/CommonConstants.ets
+37
-0
HttpUtil.ets
common/src/main/ets/utils/HttpUtil.ets
+47
-0
WzInvPage.ets
entry/src/main/ets/pages/metailmange/WzInvPage.ets
+1
-1
General.ets
entry/src/main/ets/pages/sub_systemMaintenance/General.ets
+74
-161
没有找到文件。
common/src/main/ets/constants/CommonConstants.ets
View file @
9011a521
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default class CommonConstant {
/**
* The host address of the server.
*/
static readonly SERVER: string = 'http://192.168.3.130';
/**
* The request success code.
*/
static readonly SUCCESS_CODE: number = 200;
/**
* Read timeout.
*/
static readonly READ_TIMEOUT: number = 30000;
/**
* Connect timeout.
*/
static readonly CONNECT_TIMEOUT: number = 30000;
}
\ No newline at end of file
common/src/main/ets/utils/HttpUtil.ets
0 → 100644
View file @
9011a521
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import http from '@ohos.net.http';
import CommonConstant from '../constants/CommonConstants';
import promptAction from '@ohos.promptAction'
/**
* Initiates an HTTP request to a given URL.
*
* @param url URL for initiating an HTTP request.
* @returns the result of HTTPS.
*/
export async function httpPost(url: string, extraData) {
if (!url) {
return undefined;
}
let request = http.createHttp();
let options = {
method: http.RequestMethod.POST,
extraData: extraData,
header: { 'Content-Type': 'application/json' },
readTimeout: CommonConstant.READ_TIMEOUT,
connectTimeout: CommonConstant.CONNECT_TIMEOUT
} as http.HttpRequestOptions;
try {
let result = await request.request(url, options);
if (result && result.responseCode === CommonConstant.SUCCESS_CODE) {
return result;
}
} catch (error) {
promptAction.showToast({
message: $r('app.string.http_response_error')
})
}
}
entry/src/main/ets/pages/metailmange/WzInvPage.ets
View file @
9011a521
...
...
@@ -94,7 +94,7 @@ struct WzInvPage{
})
// 列表
Column() {
Demo({itemClick: this.itemClick}).width('
9
0%')
Demo({itemClick: this.itemClick}).width('
10
0%')
}.flexGrow(1).backgroundColor('#fff').alignSelf(ItemAlign.Center)
Row(){
// 底部按钮
...
...
entry/src/main/ets/pages/sub_systemMaintenance/General.ets
View file @
9011a521
...
...
@@ -15,7 +15,20 @@ import { BasicDialog } from '../../view/BasicDialog/BasicDialog'
@Entry
@Component
export struct General {
@State systemTitle: Array<string> = ['直连配置','扫描配置','系统配置'];
getListInfo(index:number):UniListItem[]{
switch (index){
case 0:
return generalInitList
break;
case 1:
return scanInitList
break;
case 2:
return systemList
break;
}
}
scroller: Scroller = new Scroller()
dialogController: CustomDialogController = new CustomDialogController({
builder: BasicDialog({
...
...
@@ -46,178 +59,78 @@ export struct General {
build() {
Column() {
TitleBar({ title: "设备系统信息" })
Column() {
List() {
ListItem() {
Row() {
Divider()
.vertical(true)
.height(14)
.strokeWidth(3)
.color('#19ac88')
.opacity(0.6)
.margin({ left: 8, right: 8 })
Text("直连配置")
.fontSize(16)
}
}.height(46)
}
.backgroundColor('#fff')
.width('100%')
Divider().strokeWidth(1).color('rgb(242,242,242)')
List({ space: 2 }) {
ForEach(generalInitList, (item: UniListItem) => {
Flex({ direction: FlexDirection.Column}) {
Column() {
List({ space: 2}) {
ForEach(this.systemTitle, (item, index) => {
ListItem() {
Row() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center }) {
Text(item.title).fontSize(18).fontColor('#3b4144')
Text(item.description).fontSize(14).fontColor('#999').margin({ top: 3 })
Column() {
Row() {
Divider()
.vertical(true)
.height(14)
.strokeWidth(3)
.color('#19ac88')
.opacity(0.6)
.margin({ left: 8, right: 8 })
Text(item)
.fontSize(16)
}.height(46)
.backgroundColor('#fff')
.width('100%')
Divider().strokeWidth(1).color('rgb(242,242,242)')
List({ space: 2 }) {
ForEach(this.getListInfo(index), (item: UniListItem) => {
ListItem() {
Row() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center }) {
Text(item.title).fontSize(18).fontColor('#3b4144')
Text(item.description).fontSize(14).fontColor('#999').margin({ top: 3 })
}
.width('60%')
Blank()
.layoutWeight(1)
Text(item.targetValue)
.fontSize(16)
.flexGrow(1)
.align(Alignment.End)
.margin({ right: 8 })
.fontColor('#999')
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 12, right: 18 })
}
.height(71)
.onClick(() => {
})
})
}
.width('60%')
Blank()
.layoutWeight(1)
Text(item.targetValue)
.fontSize(16)
.flexGrow(1)
.align(Alignment.End)
.margin({ right: 8 })
.fontColor('#999')
.width('100%')
.backgroundColor('#fff')
.divider({ strokeWidth: 1, color: 'rgb(242,242,242)' }) // 每行之间的分界线
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 12, right: 18 })
}
.height(71)
.onClick(() => {
if (this.dialogController != undefined) {
this.dialogController.open()
}
})
})
}
.width('100%')
.backgroundColor('#fff')
.margin({ bottom: 8 })
.divider({ strokeWidth: 1, color: 'rgb(242,242,242)' }) // 每行之间的分界线
}.flexGrow(1)
List() {
ListItem() {
Row() {
Divider()
.vertical(true)
.height(14)
.strokeWidth(3)
.color('#19ac88')
.opacity(0.6)
.margin({ left: 8, right: 8 })
Text("扫描配置")
.fontSize(16)
}
}.height(46)
}
.backgroundColor('#fff')
.width('100%')
Divider().strokeWidth(1).color('rgb(242,242,242)')
List({ space: 2 }) {
ForEach(scanInitList, (item: UniListItem) => {
ListItem() {
Row() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center }) {
Text(item.title).fontSize(18).fontColor('#3b4144')
Text(item.description).fontSize(14).fontColor('#999').margin({ top: 3 })
}
.width('60%')
Blank()
.layoutWeight(1)
Text(item.targetValue)
.fontSize(16)
.flexGrow(1)
.align(Alignment.End)
.margin({ right: 8 })
.fontColor('#999')
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 12, right: 18 })
}
.height(71)
.onClick(() => {
if (this.dialogController != undefined) {
this.dialogController.open()
}
})
})
Row() {
Flex({ justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) {
Button("保存").CommonButtonStyle()
Button("重置").CommonButtonStyle()
}
.width('100%')
.backgroundColor('#fff')
.margin({ bottom: 8 })
.divider({ strokeWidth: 1, color: 'rgb(242,242,242)' }) // 每行之间的分界线
List() {
ListItem() {
Row() {
Divider()
.vertical(true)
.height(14)
.strokeWidth(3)
.color('#19ac88')
.opacity(0.6)
.margin({ left: 8, right: 8 })
Text("系统配置")
.fontSize(16)
}
}.height(46)
}
.backgroundColor('#fff')
.width('100%')
Divider().strokeWidth(1).color('rgb(242,242,242)')
List({ space: 2 }) {
ForEach(systemList, (item: UniListItem) => {
ListItem() {
Row() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center }) {
Text(item.title).fontSize(18).fontColor('#3b4144')
Text(item.description).fontSize(14).fontColor('#999').margin({ top: 3 })
}
.width('60%')
Blank()
.layoutWeight(1)
Text(item.targetValue)
.fontSize(16)
.flexGrow(1)
.align(Alignment.End)
.margin({ right: 8 })
.fontColor('#999')
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 12, right: 18 })
}
.height(71)
.onClick(() => {
if (this.dialogController != undefined) {
this.dialogController.open()
}
})
})
}
.width('100%')
.backgroundColor('#fff')
.margin({ bottom: 8 })
.divider({ strokeWidth: 1, color: 'rgb(242,242,242)' })
}
Row() {
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button("保存").CommonButtonStyle()
Button("重置").CommonButtonStyle()
}
}.height(70).backgroundColor('#97c6a6')
.height(70)
.flexShrink(0)
.backgroundColor('#97c6a6')
}
}
.linearGradient({
direction: GradientDirection.RightBottom,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论