国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁(yè) > news >正文

網(wǎng)站開發(fā)知識(shí)體系推廣普通話的意義簡(jiǎn)短

網(wǎng)站開發(fā)知識(shí)體系,推廣普通話的意義簡(jiǎn)短,dedecms 營(yíng)銷網(wǎng)站模板,怎樣才能建一個(gè)網(wǎng)站鴻蒙開發(fā)融云demo消息未讀數(shù) 跟著我一步步搭建帶界面的融云demo,這次是要顯示未讀數(shù),未讀數(shù)有兩個(gè),一個(gè)是消息列表的未讀數(shù),一個(gè)是主頁(yè)消息tab上的未讀數(shù)。 一、消息列表的未讀數(shù) 先看下效果圖: 關(guān)鍵代碼如下&#…
鴻蒙開發(fā)融云demo消息未讀數(shù)

跟著我一步步搭建帶界面的融云demo,這次是要顯示未讀數(shù),未讀數(shù)有兩個(gè),一個(gè)是消息列表的未讀數(shù),一個(gè)是主頁(yè)消息tab上的未讀數(shù)。

一、消息列表的未讀數(shù)

先看下效果圖:

在這里插入圖片描述
關(guān)鍵代碼如下:

if (this.chatItem.unreadMessageCount > 0 || this.customUnReadCount > 0) { // 紅點(diǎn)消息大于0條時(shí)渲染紅點(diǎn)Row() {Text(this.chatItem.unreadMessageCount > 0?`${this.chatItem.unreadMessageCount}`:`${this.customUnReadCount}`).borderRadius($r('app.integer.layout_8')).constraintSize({minWidth: $r('app.integer.opt_layout_chat_view_red_dot_width')}).height($r('app.integer.opt_layout_chat_view_red_dot_height')).backgroundColor($r('app.color.color_red')).fontSize($r('app.integer.text_font_10')).textAlign(TextAlign.Center).fontColor(Color.White)}.alignItems(VerticalAlign.Center).justifyContent(FlexAlign.Center).borderRadius($r('app.integer.layout_10')).margin({ top: $r('app.integer.layout_minus_8'), left: $r('app.integer.layout_24') }).constraintSize({minWidth: $r('app.integer.opt_layout_chat_view_red_dot_container_width')}).height($r('app.integer.opt_layout_chat_view_red_dot_container_height')).backgroundColor(Color.White).alignRules({top: { anchor: '__container__', align: VerticalAlign.Top },left: { anchor: '__container__', align: HorizontalAlign.Start }}).opacity((this.chatItem.unreadMessageCount > 0 || this.customUnReadCount > 0) ? 1 : 0).id('badge')}
二、主頁(yè)消息tab的未讀數(shù):

先看下效果圖:
在這里插入圖片描述
關(guān)鍵代碼如下:

public static getPrivateUnReadCount(unreadCountCallback: (unreadCount: number) => void) {let unreadCount = 0let conTypeList = new List<ConversationType>();conTypeList.add(ConversationType.Private);let isContainBlocked = false;IMEngine.getInstance().getUnreadCountByTypes(conTypeList, isContainBlocked).then(result => {if (EngineError.Success !== result.code) {// 獲取未讀數(shù)失敗return;}if (!result.data) {// 未讀數(shù)為 nullreturn;}unreadCount = result.data as number;unreadCountCallback(unreadCount )});}
@BuilderTabBottom(item: TabItem, index: number) {Column() {// 發(fā)現(xiàn)在TabBottom傳值改變不了,就用要顯示未讀數(shù)加上位置判斷,用if else顯示組件,這樣不用算badge的size// 規(guī)則:字符串’-1‘代表的是紅點(diǎn),其他字符串?dāng)?shù)字為數(shù)字紅點(diǎn)if ((isNotEmptyString(this.unreadNumHome) && index === 0) ||(isNotEmptyString(this.unreadNumMsg) && index === 1) ||(isNotEmptyString(this.unreadNumMine) && index === 2)) {Badge({value: index === 0 ? (this.unreadNumHome === '-1' ? '' : this.unreadNumHome) :index === 1 ? (this.unreadNumMsg === '-1' ? '' : this.unreadNumMsg) :(this.unreadNumMine === '-1' ? '' : this.unreadNumMine), // 設(shè)置 badge 的顯示文本position: BadgePosition.RightTop, // 設(shè)置 badge 顯示在右上角style: index === 0 || index === 1 ? { badgeColor: $r('app.color.color_red') } :{ badgeSize: 9, badgeColor: $r('app.color.color_red') }// 設(shè)置 badge 的顯示樣式,首頁(yè)和消息不用限制大小,讓它自適應(yīng)}) {Column() {Image(this.selectedIndex === index ? item.imageActivated : item.imageOriginal).height($r('app.float.tab_image_size')).width($r('app.float.tab_image_size'))}.padding({ left: 10, right: 10, })}.margin({ top: 5, bottom: 5 })} else {Column() {Image(this.selectedIndex === index ? item.imageActivated : item.imageOriginal).height($r('app.float.tab_image_size')).width($r('app.float.tab_image_size'))}.padding({ left: 10, right: 10, }).margin({ top: 5, bottom: 5 })}Text(item.title).fontSize($r('app.float.tab_text_font_size')).fontWeight(500).fontColor(this.selectedIndex === index ? $r('app.color.color_main') : Color.White).textAlign(TextAlign.Center).margin({bottom: $r('app.float.tab_text_margin_bottom')})}.justifyContent(FlexAlign.Center).height('100%').width('100%').backgroundColor($r("app.color.color_black")).onClick(() => {this.selectedIndex = index})}
整個(gè)鴻蒙融云demo項(xiàng)目結(jié)構(gòu)圖:

在這里插入圖片描述
有問題或者需要完整源碼的私信我

http://aloenet.com.cn/news/47010.html

相關(guān)文章:

  • 尋花問柳專注做一家男人愛的網(wǎng)站百度云網(wǎng)盤資源搜索
  • 網(wǎng)絡(luò)營(yíng)銷做私活網(wǎng)站智慧軟文發(fā)稿平臺(tái)官網(wǎng)
  • asp.net 網(wǎng)站備份免費(fèi)域名注冊(cè)網(wǎng)站
  • 做網(wǎng)站抄代碼免費(fèi)seo軟件
  • 建設(shè)網(wǎng)站制作網(wǎng)站營(yíng)銷方案模板
  • 大連今天最新通知電商運(yùn)營(yíng)seo
  • 哈爾濱網(wǎng)站設(shè)計(jì)有哪些步驟寧波網(wǎng)站推廣聯(lián)系方式
  • 企業(yè)網(wǎng)站基本信息早教優(yōu)化深圳seo
  • 福建省做鞋批發(fā)網(wǎng)站百度開放云平臺(tái)
  • 官方網(wǎng)站首頁(yè)在線seo推廣軟件
  • php怎么做多個(gè)網(wǎng)站網(wǎng)站關(guān)鍵詞快速排名技術(shù)
  • 河北建設(shè)集團(tuán)官網(wǎng)如何做好seo基礎(chǔ)優(yōu)化
  • 一級(jí)a做片性視頻.網(wǎng)站在線觀看鄭州seo排名第一
  • 寵物寄養(yǎng)網(wǎng)站畢業(yè)設(shè)計(jì)重慶百度關(guān)鍵詞優(yōu)化軟件
  • 網(wǎng)站建設(shè)公司排名搜索大全
  • 鄂州做網(wǎng)站報(bào)價(jià)谷歌搜索引擎免費(fèi)入口鏡像
  • 廈門企業(yè)網(wǎng)站建設(shè)補(bǔ)貼百度官網(wǎng)首頁(yè)網(wǎng)址
  • 團(tuán)購(gòu)網(wǎng)站app制作seo網(wǎng)站的優(yōu)化方案
  • 微信公眾號(hào)搭建網(wǎng)站seo外推軟件
  • 網(wǎng)站建設(shè)代碼上傳廣州seo服務(wù)公司
  • c 做的web網(wǎng)站怎么發(fā)布網(wǎng)站推廣排名服務(wù)
  • 適合小學(xué)生的最新新聞湖北seo服務(wù)
  • 稅務(wù)網(wǎng)站建設(shè)建議深圳高端網(wǎng)站建設(shè)公司
  • 華夏名網(wǎng)修改網(wǎng)站信息網(wǎng)絡(luò)推廣員的前景
  • 上海網(wǎng)站建設(shè)怎么列舉五種網(wǎng)絡(luò)營(yíng)銷模式
  • thinkphp 網(wǎng)站開發(fā)衡陽(yáng)有實(shí)力seo優(yōu)化
  • 做公司網(wǎng)站聯(lián)系公司培訓(xùn)課程
  • 網(wǎng)站建設(shè)外包名詞解釋在線優(yōu)化工具
  • 大型網(wǎng)站制作建網(wǎng)站專業(yè)
  • 武漢網(wǎng)站開發(fā)建設(shè)湖北seo