团队先容作家:徐庆 团队:坚果派[1] 公众号:“大前端之旅”[2] 润开鸿生态技能众人,华为HDE,CSDN博客众人,CSDN超等个体,CSDN特邀嘉宾,InfoQ签约作家,OpenHarmony布谈师,电子发热友众人博客,51CTO博客众人,擅长HarmonyOS/OpenHarmony诈欺树立、持重处事卡片树立。接待和洽。 序论: 诸位同学有段时候莫得碰头 因为一直很忙是以就莫得去更新博客。最近有在学习这个鸿蒙的ark ui树立 因为鸿蒙不是发布了一个鸿蒙next的测试版块 来岁会运转纯血...
团队:坚果派[1]
公众号:“大前端之旅”[2]
润开鸿生态技能众人,华为HDE,CSDN博客众人,CSDN超等个体,CSDN特邀嘉宾,InfoQ签约作家,OpenHarmony布谈师,电子发热友众人博客,51CTO博客众人,擅长HarmonyOS/OpenHarmony诈欺树立、持重处事卡片树立。接待和洽。
序论:诸位同学有段时候莫得碰头 因为一直很忙是以就莫得去更新博客。最近有在学习这个鸿蒙的ark ui树立 因为鸿蒙不是发布了一个鸿蒙next的测试版块 来岁会运转纯血鸿蒙诈欺 是以我就念念提前给大家写一些博客著作
遵循图图片武术
image-20231206202427615图片
image-20231206202438894反应数据遵循图片
image-20231206202449876使用土产货网罗处事图片
image-20231206202459875接口讲明:接口是我土产货使用springboot 框架配合 hibernate 配合jpa写的一个后台处事 :
客户端具体罢了:"requestPermissions": [ { "name": "ohos.permission.INTERNET" }]如图
图片
image.png网罗苦求 器用类罢了import http from '@ohos.net.http';import Constants, { ContentType } from '../constant/Constants';import Logger from './Logger';import { NewsData } from '../viewmodel/NewsData';export function httpRequestGet(url: string) { return httpRequest(url, http.RequestMethod.GET);}export function httpRequestPost(url: string, params?: NewsData) { return httpRequest(url, 浙江省衢州华安文教用品有限公司 http.RequestMethod.POST, 首页-湖西东机场有限公司 params);}function httpRequest(url: string,于田县名欧净水器有限公司 method: http.RequestMethod,params?: NewsData){ let httpRequest = http.createHttp(); let responseResult = httpRequest.request(url, { method: method, readTimeout: Constants.HTTP_READ_TIMEOUT,//读取超经常间 可选,默许为60000ms header: { 'Content-Type': ContentType.JSON }, connectTimeout: Constants.HTTP_READ_TIMEOUT,武术//邻接超经常间 可选,默许为60000ms extraData: params // 苦求参数 }); return responseResult.then((value: http.HttpResponse)=>{ Logger.error("苦求情状 --> "+value.responseCode) if(value.responseCode===200){ Logger.error("苦求生效"); let getresult = value.result; Logger.error('苦求复返数据', JSON.stringify(getresult)); return getresult; } }).catch((err)=>{ return ""; });}打印日记器用类罢了 :
import hilog from '@ohos.hilog';class Logger { private domain: number; private prefix: string; private format: string = '%{public}s, %{public}s'; /** * constructor. * * @param Prefix Identifies the log tag. * @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF. */ constructor(prefix: string = 'MyApp', domain: number = 0xFF00) { this.prefix = prefix; this.domain = domain; } debug(...args: string[]): void { hilog.debug(this.domain, this.prefix, this.format, args); } info(...args: string[]): void { hilog.info(this.domain, this.prefix, this.format, args); } warn(...args: string[]): void { hilog.warn(this.domain, this.prefix, this.format, args); } error(...args: string[]): void { hilog.error(this.domain, this.prefix, this.format, args); }}export default new Logger('HTTPS', 0xFF00)登录界面罢了 :
/** * 创建东谈主:xuqing * 创建时候:2023年8月2日08:38:50 * 类讲明: * * */import prompt from '@ohos.promptAction';import router from '@ohos.router';import CommonConstants from '../common/constant/CommonConstants';import StyleConstant from '../common/constant/StyleConstant';import { httpRequestGet } from '../common/utils/OKhttpUtil';import CommonConstant from '../common/constant/CommonConstants';import Logger from '../common/utils/Logger';@Extend(TextInput) function inputStyle () { .placeholderColor($r('app.color.placeholder_color')) .height($r('app.float.login_input_height')) .fontSize($r('app.float.big_text_size')) .backgroundColor($r('app.color.background')) .width(CommonConstants.FULL_PARENT) .padding({ left: CommonConstants.INPUT_PADDING_LEFT }) .margin({ top: $r('app.float.input_margin_top') })}@Extend(Line) function lineStyle () { .width(CommonConstants.FULL_PARENT) .height($r('app.float.line_height')) .backgroundColor($r('app.color.line_color'))}@Extend(Text) function blueTextStyle () { .fontColor($r('app.color.login_blue_text_color')) .fontSize($r('app.float.small_text_size')) .fontWeight(FontWeight.Medium)}@Extend(Text) function blackTextStyle () { .fontColor($r('app.color.black_text_color')) .fontSize($r('app.float.big_text_size')) .fontWeight(FontWeight.Medium)}/** * Login page */@Entry@Componentstruct LoginPage { @State account: string = ''; @State password: string = ''; @State isShowProgress: boolean = false; private timeOutId = null; @Builder imageButton(src: Resource) { Button({ type: ButtonType.Circle, stateEffect: true }) { Image(src) } .height($r('app.float.other_login_image_size')) .width($r('app.float.other_login_image_size')) .backgroundColor($r('app.color.background')) } async login() { if (this.account === ''