当前位置: 首页 > news >正文

网站排版的优点中信国际建设公司网站

网站排版的优点,中信国际建设公司网站,电商网站大全,查询网站服务器一、介绍 基于鸿蒙Next模拟一个ai对话过程二、场景需求 客户服务、数据分析、个性化推荐、图像和视频处理、智能家居、交通管理、教育行业、制造等等。 三、业务步骤 第一步#xff1a;输入框提出问题#xff0c;发送问题#xff0c; 第二部#xff1a;下次发送#xff0…一、介绍 基于鸿蒙Next模拟一个ai对话过程二、场景需求 客户服务、数据分析、个性化推荐、图像和视频处理、智能家居、交通管理、教育行业、制造等等。 三、业务步骤 第一步输入框提出问题发送问题 第二部下次发送先清除之前提问避免重复提问 第三步获取ai反馈相关问题答案目前虚拟数据可自行设置答案结果四、效果展示 五代码展示 import { MsgRoleEnum } from ‘…/common/CommonConstant’ import { MsgP, textShow } from ‘…/common/MsgPassageway’ import { HidingHeadVerseData } from ‘…/database/HidingHeadVerse’Entry Component struct Index02{ State textShowArr: MsgP[] textShow State textMsg: string ‘’ State inputValue: string ‘’//获取输入文本数据 State inputText: string ‘’ // 输入框展示文本数据 State btnMsg: string “发送” State btnInputShow: boolean true // 清除/发送build(){ Column(){ List(){ ForEach(this.textShowArr,(item:MsgP,index:number){ if (item.role MsgRoleEnum.Mine) { ListItem(){ Row(){ //用户消息 Row(){ Text(item.msg) .fontSize(16) .textAlign(TextAlign.End) .padding(6) .backgroundColor(0xffcbebff) .borderRadius(4) }.width(“67%”) .justifyContent(FlexAlign.End) //用户头像 Image($r(‘app.media.ic_user_portrait’)).width(30).height(30).margin({left:10,right:10})}.width(100%).padding({top:4,bottom:4}).justifyContent(FlexAlign.End).alignItems(VerticalAlign.Top)}}else {ListItem(){Row(){//AI头像Image($r(app.media.ic_gallery_ai_photography_on)).width(30).height(30).margin({left:10,right:10})//AI返回消息Row(){Text(item.msg this.textMsg).fontSize(16).textAlign(TextAlign.Start).padding(6).backgroundColor(0xffffff).borderRadius(4)}.width(67%).justifyContent(FlexAlign.Start)}.width(100%).padding({top:4,bottom:4}).justifyContent(FlexAlign.Start).alignItems(VerticalAlign.Top)}}},(item:string)item)}Blank()//填充容器组件//底部输入框if (this.btnInputShow){//底部输入框Row(){//输入框TextInput({text:this.inputText,placeholder:请输入您的关键词~}).width(80%).backgroundColor(0x999999).height(40).margin({left:12,right:12}).borderRadius(4).backgroundColor(0xeeeeee).onChange((value:string){this.inputValue valuethis.inputText value})//发送图标Text(this.btnMsg).margin({right:12}).fontColor(0x0091FF).onClick((){if (this.btnMsg 清除){this.textShowArr []this.btnMsg 发送}else {this.textMsg this.HidingHeadVerseFun()}})}.width(100%).height(70).backgroundColor(0xffffff).alignItems(VerticalAlign.Center).justifyContent(FlexAlign.Start)}} .width(100%) .height(100%) .borderRadius({ bottomLeft:12,bottomRight:12 }) .backgroundColor(0xeeeeee) .justifyContent(FlexAlign.Start) }HidingHeadVerseFun(){ if (this.inputValue ! “”) { this.textShowArr.push({ role:0, msg:this.inputText }) this.inputText “” this.btnMsg “清除” this.Search_HidingHeadVerseFun() }else { console.info(“输入文本数据为空”) } } //打字机效果 HidingHeadVerseTypewriter(v_idx:number){ if (v_idx 999) { let strLen “我还在成长中,试试以下关键词时间的片段、陌生的信…” let idx 0 let timer setInterval((){ if (idx strLen.length) { this.textMsg strLen[idx]; } else { clearInterval(timer); } },100) }else { let strLen HidingHeadVerseData[v_idx].title as string HidingHeadVerseData[v_idx].content as string let idx 0 let timer setInterval((){ if (idx strLen.length) { this.textMsg strLen[idx]; } else { clearInterval(timer); } },100) } }Search_HidingHeadVerseFun(){ let searchStr this.inputValue.includes(“时间的片段”) || this.inputValue.includes(“时间”) let searchStr2 this.inputValue.includes(“陌生的信”) || this.inputValue.includes(“陌生的信”) if (searchStr) { this.textShowArr.push({ role: 1, msg: “” }) this.HidingHeadVerseTypewriter(0) }if (searchStr2){ this.textShowArr.push({ role: MsgRoleEnum.Other, msg: “” }) this.HidingHeadVerseTypewriter(2) 六、代码结构及原理1.整体结构 使用了ArkTS的装饰器语法如Entry和Component组件。使用了ArkTS的渲染语法if/else等2.状态管理 组件使用State装饰器定义了几个响应式状态变量,如btnInputShow这些变量的变化会自动触发UI的更新。3.UI结构 界面使用嵌套的Column和Row组件构建。使用了ForEach遍历循环数据信息。4.数据传递 当点击发送按钮时,会调用HidingHeadVerseFun回调函数,先获取用户问题数据然后在数据库中对比调用Search_HidingHeadVerseFun回调函数获取答案数据信息。 总的来说,这段代码展示了如何使用ArkTS和ArkUI框架创建一个交互式的ai问答界面。它利用了声明式UI、响应式编程和组件化的概念,使得代码结构清晰,易于理解和维护。
http://www.hkea.cn/news/14357911/

相关文章:

  • 为什么建设长虹网站建设一个视频教学网站
  • wordpress能做多大的站wordpress 查看密码
  • 网站源码调试做网站多少流量可以做广告
  • 苏州网站推广软件那些网站可以做团购
  • 公司网站建设内容建议搜狗推广管家
  • 失信人被执行人查询沈阳seo优化排名公司
  • 苏州吴江建设局招标网站备案不关闭网站怎么样
  • 贵阳网站设计与开发怎么做东莞市网络seo推广企业
  • 网站建设 博采百度广告费一般多少钱
  • 网站建设个人网站推荐好的简历制作网站
  • 哈尔滨网站建设的公司哪家好深圳网站设计南京
  • 怎么建设网站广饶县住房和城乡建设局网站
  • 神州网站制作html怎么写
  • 商业网站是什么青岛网站商城设计
  • 怎么建设自己的论坛网站马鞍山天立建设网站
  • 网站框架地图怎么自己制作图片
  • 17zwd一起做业网站建设部网站首页
  • 大庆城市投资建设网站进广州最新政策
  • 科技企业网站制作最有创意的广告语30条
  • 注册好了域名怎么开始做网站网站改备案
  • 什么网站能免费做推广最大郑州网站建设公司
  • 如何上传到网站根目录闵行网站制作设计公司
  • 做网站技术人员百度关键词价格计算
  • 新办公司网上核名在哪个网站做安平谁做网站好
  • 古装摄影网站建设方案深圳互助资金盘网站开发
  • 网站支付怎么做的昆明做凡科网站
  • 哪个网站有免费的模板什么是主页
  • 合作制作网站避免视觉效果混淆。
  • 移动网站不备案吗html企业网站模板免费下载
  • 学院网站建设 好处网站建设丶金手指下拉12