王士厅

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool

# Conflicts:
#	sight_harmony/features/wdComponent/src/main/ets/components/mine/home/HomePageBottomFollowComponent.ets
#	sight_harmony/features/wdComponent/src/main/ets/components/setting/AccountAndSecurityLayout.ets
Showing 90 changed files with 2241 additions and 507 deletions
... ... @@ -888,4 +888,11 @@ export class HttpUrlUtils {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.VISITOR_COMMENT_LIST_DATA_PATH
return url
}
///获取语音识别授权token
static getVoiceRecognizerSDKAuthToken() {
let url = HttpUrlUtils.getHost() + "/api/rmrb-search-api/zh/c/display/search/token"
return url
}
}
... ...
... ... @@ -25,6 +25,7 @@ export struct WdWebComponent {
@State subjectData : string = ''
@StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm';
@State userAgent:string = 'Mozilla/5.0 (Phone; OpenHarmony 5.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 ArkWeb/4.1.6.1 Mobile automobile/792 Android'
currentChanged(){
///折叠屏转换
... ... @@ -54,6 +55,9 @@ export struct WdWebComponent {
let url: string = event.data.getRequestUrl().toString()
return this.onLoadIntercept(url);
})
.onControllerAttached(() => {
this.webviewControl.setCustomUserAgent(this.userAgent);
})
}
}
... ...
... ... @@ -181,4 +181,6 @@ export { TopicDetailData,GroupItem } from './src/main/ets/bean/content/TopicDeta
export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean';
export { FeedBackParams } from './src/main/ets/bean/content/FeedBackParams';
export { NetLayerVoiceRecoginizerToken } from './src/main/ets/bean/voicerecoginizer/NetLayerVoiceRecoginizerToken';
... ...
export interface NetLayerVoiceRecoginizerToken {
accessToken: string
///过期时间,到毫秒
expireTime: number
}
\ No newline at end of file
... ...
... ... @@ -105,4 +105,8 @@ export { CustomPullToRefresh } from './src/main/ets/components/reusable/CustomPu
export { MorningEveningViewModel } from './src/main/ets/viewmodel/MorningEveningViewModel'
export { GrayManageModel } from './src/main/ets/viewmodel/GrayManageModel'
\ No newline at end of file
export { GrayManageModel } from './src/main/ets/viewmodel/GrayManageModel'
export { VoiceInputView } from './src/main/ets/components/comment/view/VoiceInputView'
// export {voicese}
\ No newline at end of file
... ...
... ... @@ -83,8 +83,69 @@ export struct CompParser {
})
}
// @Builder
// beforeDevider() {
// if (
// this.compDTO.compStyle === CompStyle.Card_09 ||
// this.compDTO.compStyle === CompStyle.Zh_Single_Column_09 ||
// this.compDTO.compStyle === CompStyle.Zh_Single_Row_04 ||
// this.compDTO.compStyle === CompStyle.Zh_Single_Row_06
// ) {
// if (this.compDTO.compStyle === this.nextCompDTO.compStyle) {
// Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 })
// } else {
// Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6})
// }
// }
// }
@Builder
behindDevider() {
if (
this.compDTO.compStyle === CompStyle.Card_09 ||
this.compDTO.compStyle === CompStyle.Zh_Single_Column_09 ||
this.compDTO.compStyle === CompStyle.Zh_Single_Row_04 ||
this.compDTO.compStyle === CompStyle.Zh_Single_Row_06
) {
if (this.compDTO.compStyle === this.nextCompDTO.compStyle) {
Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 })
} else {
Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6})
}
} else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
if (this.compIndex === 0) {
Divider().strokeWidth(1).color('#f5f5f5').width('120%').margin({left: -6})
} else {
Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6})
}
} else if (this.compDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10) {
// 大专题
if (this.nextCompDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10) {
Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 })
} else {
Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6})
}
} else if (this.compDTO.compType === 'appStyle' || this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 || this.compDTO.compStyle === CompStyle.Zh_Single_Row_03 || this.compDTO.compStyle === CompStyle.Card_Comp_Adv || this.compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
if (
this.nextCompDTO.compStyle === CompStyle.Card_09 ||
this.nextCompDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10 ||
this.nextCompDTO.compStyle === CompStyle.Zh_Single_Column_09 ||
this.nextCompDTO.compStyle === CompStyle.Zh_Single_Row_04 ||
this.nextCompDTO.compStyle === CompStyle.Zh_Single_Row_06 ||
this.nextCompDTO.compStyle === CompStyle.Zh_Single_Column_12
) {
Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6})
} else {
Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 })
}
} else {
// Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
}
}
@Builder
componentBuilder() {
// this.beforeDevider();
if (this.compDTO.operDataList[0]?.objectType !== '3' &&
this.compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
... ... @@ -208,42 +269,7 @@ export struct CompParser {
// })
}
if (
this.compDTO.compStyle === CompStyle.Card_09 ||
this.compDTO.compStyle === CompStyle.Zh_Single_Column_09 ||
this.compDTO.compStyle === CompStyle.Zh_Single_Row_04 ||
this.compDTO.compStyle === CompStyle.Zh_Single_Row_06
) {
if (this.compDTO.compStyle === this.nextCompDTO.compStyle) {
Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 })
} else {
Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6})
}
} else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
Divider().strokeWidth(1).color('#f5f5f5').width('120%').margin({left: -6})
} else if (this.compDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10) {
// 大专题
if (this.nextCompDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10) {
Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 })
} else {
Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6})
}
} else if (this.compDTO.compType === 'appStyle' || this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 || this.compDTO.compStyle === CompStyle.Zh_Single_Row_03 || this.compDTO.compStyle === CompStyle.Card_Comp_Adv || this.compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
if (
this.nextCompDTO.compStyle === CompStyle.Card_09 ||
this.nextCompDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10 ||
this.nextCompDTO.compStyle === CompStyle.Zh_Single_Column_09 ||
this.nextCompDTO.compStyle === CompStyle.Zh_Single_Row_04 ||
this.nextCompDTO.compStyle === CompStyle.Zh_Single_Row_06 ||
this.nextCompDTO.compStyle === CompStyle.Zh_Single_Column_12
) {
Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6})
} else {
Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 })
}
} else {
// Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
}
this.behindDevider()
}
... ...
... ... @@ -45,7 +45,8 @@ export struct ENewspaperItemComponent {
this.contentWidth = event?.contentWidth
this.contentHeight = event?.contentHeight
}
this.isShowSkeleton = false
// this.isShowSkeleton = false
})
.objectFit(ImageFit.Contain)
.zIndex(10)
... ...
... ... @@ -9,7 +9,7 @@ import font from '@ohos.font';
import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog';
import { RMCalendarBean } from './calendar/RMCalendarBean';
import { newsSkeleton } from './skeleton/newsSkeleton';
import { Logger, ToastUtils, NetworkUtil, CustomToast } from 'wdKit/Index';
import { Logger, ToastUtils, NetworkUtil, CustomToast, DisplayUtils } from 'wdKit/Index';
import { TrackingContent, TrackConstants, TrackingButton } from 'wdTracking/Index';
import { WDShare } from 'wdShare/Index';
import { window } from '@kit.ArkUI';
... ... @@ -25,6 +25,9 @@ export struct ENewspaperPageComponent {
@State picHeight: number = 0
@Provide itemPicWidth: number = 0
@Provide itemPicHeight: number = 0
@Provide topMargin: number = DisplayUtils.getDeviceHeight()
@State newspaperListBean: NewspaperListBean = {} as NewspaperListBean
@Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'
@State pageDialogShow: boolean = false
... ... @@ -404,6 +407,14 @@ export struct ENewspaperPageComponent {
}
if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
this.isOpenListDialog = true
animateTo({
duration: 300,
onFinish: () => {
}
}, () => {
this.topMargin = 0;
})
//电子报--读报纸点击
TrackingContent.clickWithEvent('read_newspaper_click', TrackConstants.PageName.NewsPaperPage,
TrackConstants.PageName.NewsPaperPage
... ... @@ -429,7 +440,15 @@ export struct ENewspaperPageComponent {
newspaperListBean: this.newspaperListBean,
scrollIndex: this.swiperIndex,
closeDialog: () => {
this.isOpenListDialog = false
animateTo({
duration: 300,
onFinish: () => {
this.isOpenListDialog = false
}
}, () => {
this.topMargin = DisplayUtils.getDeviceHeight();
})
}
})
}
... ... @@ -451,6 +470,7 @@ export struct ENewspaperPageComponent {
// 计算图片的内容宽高
this.itemPicWidth = this.picWidth - vp2px(20)
this.itemPicHeight = this.picHeight - vp2px(28)
try {
if (NetworkUtil.isNetConnected()) {
let listBean =
... ...
... ... @@ -248,34 +248,36 @@ export struct ImageAndTextPageComponent {
console.log(TAG, "点击滑动页面", JSON.stringify(info))
//评论区当前位置
let currentCommonentOffSetY = this.info?.globalPosition.y as number
let offSetY = 0
if (currentCommonentOffSetY >= (this.screenHeight-this.bottomHeight) ) {
offSetY = currentCommonentOffSetY-200
this.showMainText = true
}else {
this.showMainText = false
}
this.scroller.scrollTo({
yOffset: offSetY,
xOffset: 0,
animation: { duration: 1000, curve: Curve.Ease }
})
// if (!this.offsetY) {
// this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y
// }
// // 定位到评论区域
// if (this.isScrollTop) {
// this.scroller.scrollTo({
// xOffset: 0,
// yOffset: this.offsetY,
// animation: true
// })
// } else {
// this.scroller.scrollEdge(Edge.Top)
// let currentCommonentOffSetY = this.info?.globalPosition.y as number
// let offSetY = 0
// if (currentCommonentOffSetY >= (this.screenHeight-this.bottomHeight) ) {
// offSetY = currentCommonentOffSetY-200
// this.showMainText = true
// }else {
// this.showMainText = false
// }
// this.isScrollTop = !this.isScrollTop
// this.scroller.scrollTo({
// yOffset: offSetY,
// xOffset: 0,
// animation: { duration: 1000, curve: Curve.Ease }
// })
if (!this.offsetY) {
this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y
}
// 定位到评论区域
if (this.isScrollTop) {
this.scroller.scrollTo({
xOffset: 0,
yOffset: this.offsetY,
animation: { duration: 1000, curve: Curve.Ease }
})
// this.showMainText = true
} else {
this.scroller.scrollEdge(Edge.Top)
// this.showMainText = false
}
this.isScrollTop = !this.isScrollTop
}
})
}
... ... @@ -357,7 +359,6 @@ export struct ImageAndTextPageComponent {
if (this.detailContentEmpty) {
this.emptyType = 18
}
console.log(TAG, "dl1111111111", JSON.stringify(detailBeans[0]))
if (detailBeans && detailBeans.length > 0) {
this.contentDetailData = detailBeans[0];
let dateTime =
... ... @@ -560,21 +561,22 @@ export struct ImageAndTextPageComponent {
// 需要评论区位置,调用前 请确保它有值
return
}
let offSetY = this.info?.globalPosition.y as number -60
Logger.debug(TAG, "即将滚动至yOffset: " + offSetY)
if (offSetY >= (this.screenHeight-this.bottomHeight) ) {
this.showMainText = false
}else {
this.showMainText = true
}
if (this.action.params?.targetLayout && this.action.params.targetLayout == "comment") {
if (this.lastTimeoutId) {
clearTimeout(this.lastTimeoutId)
}
this.lastTimeoutId = setTimeout(() => {
let offSetY = this.info?.globalPosition.y as number
Logger.debug(TAG, "即将滚动至yOffset: " + (offSetY - 100))
if (offSetY >= (this.screenHeight-this.bottomHeight) ) {
this.showMainText = true
}else {
this.showMainText = false
}
//头部距离48
this.scroller.scrollTo({
yOffset: offSetY - 100,
yOffset: offSetY,
xOffset: 0,
animation: { duration: 1000, curve: Curve.Ease }
})
... ...
... ... @@ -102,6 +102,7 @@ export struct ImageAndTextWebComponent {
onWebPrepared: this.onWebPrepared.bind(this),
isPageEnd: $isPageEnd
})
.padding({top:10})
}
}
... ...
... ... @@ -5,11 +5,11 @@ import { promptAction } from '@kit.ArkUI';
import { image } from '@kit.ImageKit';
import { photoAccessHelper } from '@kit.MediaLibraryKit';
import fs from '@ohos.file.fs';
import { DateTimeUtils, NetworkUtil, PermissionUtil } from 'wdKit';
import { DateTimeUtils, NetworkUtil, PermissionUtil, PermissionUtils } from 'wdKit';
import { PrivacySettingModel } from '../model/PrivacySettingModel';
import { TrackConstants, TrackingButton } from 'wdTracking';
import { faceDetector } from '@kit.CoreVisionKit';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
// import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import fileIo from '@ohos.file.fs';
import { httpRequest } from '../utils/httpRequest';
import { taskpool } from '@kit.ArkTS';
... ... @@ -61,6 +61,15 @@ export struct ImageDownloadComponent {
.iconColor(Color.White)
.onClick(async () => {
//console.info(`cj2024 onClick ${this.imageBuffer}`)
// let readGrant = await PermissionUtils.checkPermissions(PERMISSIONS[0])
// let writeGrant = await PermissionUtils.checkPermissions(PERMISSIONS[1])
// console.info(`cj2024 onClick readGrant ${readGrant} writeGrant ${writeGrant}`)
// if (!readGrant && !writeGrant) {
// const context = getContext(this) as common.UIAbilityContext;
// let requestGrant = await PermissionUtils.reqPermissionsFromUser(PERMISSIONS, context);
// } else {
//
// }
if (this.imageBuffer !== undefined) {
try {
await this.saveImage(this.imageBuffer);
... ... @@ -134,7 +143,7 @@ export struct ImageDownloadComponent {
* @returns
*/
async saveImage(buffer: ArrayBuffer | string): Promise<void> {
//console.info(`cj2024 saveImage buffer ${buffer} isGranted = ${this.isGranted}`)
console.info(`cj2024 saveImage buffer ${buffer} isGranted = ${this.isGranted}`)
if (!this.isGranted) {
//跳转权限设置
// const permissionUtil = new PermissionUtil();
... ... @@ -154,23 +163,23 @@ export struct ImageDownloadComponent {
// const file = await fs.open(uri, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
// await fs.write(file.fd, buffer);
// await fs.close(file.fd);
let media = mediaLibrary.getMediaLibrary(context);
let publicPath = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE);
let picName = DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_DEFAULT) + '.jpg'
// //console.info(`cj2024 saveImage time ${picName}`)
let asset = await media.createAsset(mediaLibrary.MediaType.IMAGE, picName, publicPath);
if (asset) {
let fd = await asset.open('rw');
await fileIo.write(fd, buffer);
await asset.close(fd);
promptAction.showToast({ message: '已保存至相册!' });
} else {
if (this.isGranted) {
promptAction.showToast({ message: '保存图片失败!' });
}
throw new Error('Failed to create asset');
}
// let media = mediaLibrary.getMediaLibrary(context);
// let publicPath = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE);
// let picName = DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_DEFAULT) + '.jpg'
// // //console.info(`cj2024 saveImage time ${picName}`)
// let asset = await media.createAsset(mediaLibrary.MediaType.IMAGE, picName, publicPath);
//
// if (asset) {
// let fd = await asset.open('rw');
// await fileIo.write(fd, buffer);
// await asset.close(fd);
// promptAction.showToast({ message: '已保存至相册!' });
// } else {
// if (this.isGranted) {
// promptAction.showToast({ message: '保存图片失败!' });
// }
//
// throw new Error('Failed to create asset');
// }
}
}
\ No newline at end of file
... ...
import { ImageKnifeComponent } from '@ohos/imageknife';
import { ContentDTO, FrontLinkObject } from 'wdBean';
import { Logger } from 'wdKit/Index';
import { ProcessUtils } from 'wdRouter/Index';
... ... @@ -28,9 +29,12 @@ export struct topicInfoView {
build() {
RelativeContainer() {
Stack(){
Image(this.frontLinkObject?.coverUrl)
.width("100%")
.height("100%")
ImageKnifeComponent({imageKnifeOption:{loadSrc:this.frontLinkObject?.coverUrl,isCacheable:true}})
.width('100%')
.height('100%')
// Image(this.frontLinkObject?.coverUrl)
// .width("100%")
// .height("100%")
Stack(){
Image('')
.width("100%")
... ...
... ... @@ -52,8 +52,8 @@ export struct CardAdvBigImageComponent {
}
.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
left: 10,
right: 10,
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
... ...
... ... @@ -54,8 +54,8 @@ export struct CardAdvLongImageComponent {
}
.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
left: 10,
right: 10,
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
... ...
... ... @@ -87,8 +87,8 @@ export struct CardAdvSmallImageComponent {
.width("100%")
.height(this.isBigThreeLine ? 127 : 106)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
left: 10,
right: 10,
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
... ...
... ... @@ -78,8 +78,8 @@ export struct CardAdvThreeImageComponent {
}
.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
left: 10,
right: 10,
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
... ...
... ... @@ -62,8 +62,8 @@ export struct CardAdvVideoComponent {
}
.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
left: 10,
right: 10,
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
... ...
... ... @@ -85,8 +85,8 @@ export struct CardAdvVideoExComponent {
}
.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
left: 10,
right: 10,
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
... ...
... ... @@ -111,7 +111,7 @@ export struct Card10Component {
}
// 大图
Stack() {
Image(this.loadImg ? this.contentDTO?.coverUrl : '')
Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.borderRadius({
... ... @@ -165,10 +165,9 @@ export struct Card10Component {
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: 14
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r("app.color.white"))
.margin({ bottom: 8 })
}
@Builder
... ...
... ... @@ -80,7 +80,7 @@ export struct Card14Component {
.margin({right: 12})
.width('64%')
Image(this.loadImg ? this.contentDTO.coverUrl : '')
Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '')
.backgroundColor(0xf5f5f5)
.aspectRatio(3 / 2)
.height(78)
... ...
... ... @@ -80,7 +80,7 @@ export struct Card15Component {
}
//大图
Stack() {
Image(this.loadImg ? this.contentDTO.coverUrl : '')
Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '')
.backgroundColor(0xf5f5f5)
.borderRadius($r('app.float.image_border_radius'))
//播放状态+时长
... ...
... ... @@ -173,6 +173,8 @@ struct createImg {
if (picWidth && picHeight) {
if (picWidth / picHeight > 2/1) {
return 1; //横长图
} else if (picWidth/picHeight > 1/2 && picWidth/picHeight < 3/4) { //截取图片
return 4;
} else if (picWidth/picHeight < 1/2) {
return 2; //竖长图
} else {
... ... @@ -197,14 +199,14 @@ struct createImg {
alignContent: Alignment.BottomEnd
}) {
if (this.getPicType(item.weight, item.height) === 1) {
Image(this.loadImg ? item.fullUrl || item.url : '')
Image(this.loadImg ? item.url || item.fullUrl : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.height(198)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
} else if (this.getPicType(item.weight, item.height) === 2) {
Image(this.loadImg ? item.fullUrl || item.url : '')
Image(this.loadImg ? item.url || item.fullUrl : '')
.width('100%')
.height(305)
.autoResize(true)
... ... @@ -236,11 +238,30 @@ struct createImg {
}
}
} else if (this.getPicType(item.weight, item.height) === 4) {
GridCol({
span: this.onePicW > this.onePicH ? 12 : 8
}) {
Image(this.loadImg ? item.url || item.fullUrl : '')
.backgroundColor(0xf5f5f5)
// .aspectRatio(this.onePicW > this.onePicH ? 343 / 198 : 228 / 305)
.width('100%')
.autoResize(true)
.objectFit(ImageFit.Cover)
.autoResize(true)
.aspectRatio(3/4)
.borderRadius(this.caclImageRadius(index))
.opacity(!item.weight && !item.height ? 0 : 1)
.onComplete((event?) => {
this.onePicW = event?.width || 0;
this.onePicH = event?.height || 0;
})
}
} else {
GridCol({
span: this.onePicW > this.onePicH ? 12 : 8
}) {
Image(this.loadImg ? item.fullUrl : '')
Image(this.loadImg ? item.url || item.fullUrl : '')
.backgroundColor(0xf5f5f5)
// .aspectRatio(this.onePicW > this.onePicH ? 343 / 198 : 228 / 305)
.width('100%')
... ... @@ -262,7 +283,7 @@ struct createImg {
span: { xs: 4 }
}) {
Stack({alignContent: Alignment.BottomEnd}) {
Image(this.loadImg ? item.fullUrl : '')
Image(this.loadImg ? item.url || item.fullUrl : '')
.backgroundColor(index === 2 ? 0xffffff : 0xf5f5f5)
.aspectRatio(1)
.width('226lvp')
... ... @@ -301,7 +322,7 @@ struct createImg {
span: { sm: 4, lg: 3 }
}) {
Stack({ alignContent: Alignment.BottomEnd }) {
Image(this.loadImg ? item.fullUrl : '')
Image(this.loadImg ? item.url || item.fullUrl : '')
.backgroundColor(0xf5f5f5)
.aspectRatio(1)
.borderRadius(this.caclImageRadius(index))
... ... @@ -339,7 +360,7 @@ struct createImg {
const photo: PhotoListBean = {
width: item.weight,
height: item.height,
picPath: item.fullUrl||item.url,
picPath: item.url || item.fullUrl,
picDesc: '',
itemType:2,
id:0
... ...
... ... @@ -153,7 +153,7 @@ struct createImg {
span: { xs: 12 }
}) {
Stack() {
Image(this.loadImg ? this.contentDTO.coverUrl : '')
Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '')
.backgroundColor(0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
... ... @@ -176,7 +176,7 @@ struct createImg {
span: { xs: 6 }
}) {
Stack() {
Image(this.loadImg ? this.contentDTO.coverUrl : '')
Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '')
.backgroundColor(0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.borderRadius($r('app.float.image_border_radius'))
... ...
... ... @@ -79,7 +79,7 @@ export struct Card21Component {
GridItem() {
Stack() {
Image(this.loadImg ? this.contentDTO.coverUrl : '')
Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '')
.backgroundColor(0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.borderRadius($r('app.float.image_border_radius'))
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { CommonConstants, CompStyle } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
... ... @@ -44,6 +44,14 @@ export struct Card2Component {
this.textArr = titleInitRes.textArr;
}
getCover() {
if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
return this.contentDTO.coverUrl
} else if (this.contentDTO.appStyle === CompStyle.Card_02) {
return this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl
}
return ''
}
build() {
Column() {
... ... @@ -96,7 +104,7 @@ export struct Card2Component {
//大图
Stack() {
Image(this.loadImg ? this.contentDTO.coverUrl : '')
Image(this.loadImg ? this.getCover() : '')
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius($r('app.float.image_border_radius'))
... ...
import { ContentDTO, CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Notes } from './notes';
... ... @@ -7,7 +6,8 @@ import { getNotesContentWidth } from '../../utils/FuncUtils'
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
import router from '@ohos.router'
import router from '@ohos.router';
import { CommonConstants, CompStyle } from 'wdConstant/Index';
const TAG: string = 'Card5Component';
... ... @@ -42,9 +42,18 @@ export struct Card5Component {
this.textArr = titleInitRes.textArr;
}
getCover() {
if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
return this.contentDTO.coverUrl
} else if (this.contentDTO.appStyle === CompStyle.Card_05) {
return this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl
}
return ''
}
build() {
Stack() {
Image(this.loadImg ? this.contentDTO.coverUrl : '')
Image(this.loadImg ? this.getCover() : '')
.backgroundColor(0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.borderRadius(
... ...
... ... @@ -35,12 +35,22 @@ export struct Card6Component {
const curRouter = router.getState().name;
this.clicked = hasClicked(this.contentDTO.objectId, curRouter)
}
titleInit() {
const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
this.titleMarked = titleInitRes.titleMarked;
this.textArr = titleInitRes.textArr;
}
getCover() {
if (this.compDTO.compStyle === CompStyle.Card_13) {
return this.contentDTO.coverUrl
} else if (this.contentDTO.appStyle === CompStyle.Card_06) {
return this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl
}
return ''
}
build() {
Row() {
Column() {
... ... @@ -109,7 +119,7 @@ export struct Card6Component {
Stack({alignContent: Alignment.BottomEnd}) {
Image(this.loadImg ? this.contentDTO.coverUrl || this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '')
Image(this.loadImg ? this.getCover() : '')
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.borderRadius(5)
.aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4)
... ...
... ... @@ -235,7 +235,7 @@ export struct Card9Component {
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.alignSelf(ItemAlign.Start)
.padding({ bottom: 20, left: 10 })
.padding({ bottom: 16, left: 10 })
.border({ width: { left: isLastOne ? 0 : 1 }, color: 0xededed})
.margin({ left: 4 })
}
... ...
... ... @@ -35,6 +35,8 @@ export class commentListModel extends PageModel {
totalCommentNum: string = '0'
hasNext: number = 0
list: commentItemModel[] = []
hotList: commentItemModel[] = [] // 仅第一页存在
hotIds: string[] = [] // 仅第一页存在
// constructor(pageNum:number, pageSize:number, totalCount: number, hasNext: number, list: commentItemModel[]) {
// super()
// this.pageNum = pageNum
... ... @@ -45,9 +47,16 @@ export class commentListModel extends PageModel {
// }
}
export enum CommentItemCustomType {
comment = 0,
newTitle = 1, // 最新评论标题
hotTitle = 2, // 热门评论标题
hotComment = 3,
}
@Observed
export class commentItemModel {
api_customType: CommentItemCustomType = CommentItemCustomType.comment
authorLike: string = ''
avatarFrame: string = ''
checkStatus: string = ''
... ...
import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource,
PublicDialogManager,
StringUtils } from 'wdKit/Index';
import { commentItemModel, WDPublicUserType } from '../model/CommentModel';
import { CommentItemCustomType, commentItemModel, WDPublicUserType } from '../model/CommentModel';
import commentViewModel from '../viewmodel/CommentViewModel';
import { CommentText } from './CommentText';
import { CommentCustomDialog } from './CommentCustomDialog';
... ... @@ -37,6 +37,7 @@ export struct CommentComponent {
listScroller: ListScroller = new ListScroller(); // scroller控制器
historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
firstPageHotIds: string = ''
@State dialogController: CustomDialogController | null = null;
// @State private browSingModel: commentListModel = new commentListModel()
... ... @@ -49,6 +50,7 @@ export struct CommentComponent {
// 是否在弹框中
@Provide inDialog: boolean = false
private dialogBeforeJumpOtherPageAction: () => void = () => {}
private dialogUpdateTitle: (title: string) => void = () => {}
// 在自定义组件即将析构销毁时将dialogControlle置空
aboutToDisappear() {
... ... @@ -99,7 +101,16 @@ export struct CommentComponent {
/*一级评论*/
// if (this.publishCommentModel.lastCommentModel)
if (this.publishCommentModel.lastCommentModel.parentId == '-1') {
this.allDatas.addFirstItem(model)
let newCommentHeaderIndex = this.indexOfNewCommentHeaderTitle()
if (newCommentHeaderIndex === -1) {
let newCommentTitle = new commentItemModel()
newCommentTitle.api_customType = CommentItemCustomType.newTitle
this.allDatas.addItems([newCommentTitle, model])
} else {
this.allDatas.addItem(model, newCommentHeaderIndex + 1)
}
} else {
//二级评论
this.allDatas.getDataArray().forEach(element => {
... ... @@ -116,41 +127,41 @@ export struct CommentComponent {
/*标题:全部评论*/
@Builder
titleHeader() {
titleHeader(title: string = "最新评论", showGapLine: boolean = false) {
Row() {
Row() {
Image($r('app.media.redLine'))
.height(16)
.width(3)
Text('全部评论')
.fontSize(16)// .fontColor('#222222')
.fontColor($r('app.color.color_222222'))
.fontWeight(FontWeight.Medium)
.margin({ left: 5 })
Column() {
if (showGapLine) {
Divider().strokeWidth(6).color('#f5f5f5')
}
.margin({ left: 16 })
Row() {
Row() {
Image($r('app.media.redLine'))
.height(16)
.width(3)
Text(title)
.fontSize(16)// .fontColor('#222222')
.fontColor($r('app.color.color_222222'))
.fontWeight(FontWeight.Medium)
.margin({ left: 5 })
}
.margin({ left: 16 })
Image($r('app.media.comment_close'))
.height(18)
.width(18)
.margin({ right: 16 })
.visibility(this.showCloseIcon ? Visibility.Visible : Visibility.Hidden)
.onClick(() => {
this.onCloseClick()
})
}
.height(44)
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.onClick(() => {
// this.allDatas.push(new commentItemModel())
// this.allDatas.addFirstItem(new commentItemModel())
// this.allDatas.reloadData();
})
Image($r('app.media.comment_close'))
.height(18)
.width(18)
.margin({ right: 16 })
.visibility(this.showCloseIcon ? Visibility.Visible : Visibility.Hidden)
.onClick(() => {
this.onCloseClick()
})
}
.height(44)
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
}
}
/*1级评论作为titleHeader*/
... ... @@ -177,16 +188,29 @@ export struct CommentComponent {
build() {
Column() {
List({ scroller: this.listScroller }) {
if (this.showTitleComponent) {
ListItemGroup({ header: this.titleHeader() })
}
if (!this.isComments) {
if (this.showTitleComponent) {
ListItemGroup({ header: this.titleHeader() })
}
EmptyComponent({ emptyType: 17 })
.height(300)
} else {
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
if (item.hasMore) {
if (item.api_customType === CommentItemCustomType.newTitle) {
if (this.inDialog && index === 0) {
ListItemGroup()
} else {
ListItemGroup({ header: this.titleHeader("最新评论", index !== 0) })
}
}
else if (item.api_customType === CommentItemCustomType.hotTitle) {
if (this.inDialog && index === 0) {
ListItemGroup()
} else {
ListItemGroup({ header: this.titleHeader("热门评论") })
}
}
else if (item.hasMore) {
ListItemGroup({
header: this.CommentHeaderItem(item, index),
footer: this.GroupFooterView(item, index)
... ... @@ -234,6 +258,9 @@ export struct CommentComponent {
}
.scrollBar(BarState.Off)
.margin({ bottom: 10 })
.onScrollIndex((start) => {
this.updateDialogTitleWithStartIndex(start)
})
.onReachEnd(() => {
if (!this.fixedHeightMode) {
return
... ... @@ -252,6 +279,30 @@ export struct CommentComponent {
}
updateDialogTitleWithStartIndex(start: number) {
if (!this.inDialog) {
return
}
if (this.allDatas.size() === 0) {
this.dialogUpdateTitle("评论")
return
}
if (this.allDatas.getFirst().api_customType !== CommentItemCustomType.hotTitle) {
this.dialogUpdateTitle("最新评论")
return
}
let newCommentHeaderIndex = this.indexOfNewCommentHeaderTitle()
if (newCommentHeaderIndex == -1) {
this.dialogUpdateTitle("热门评论")
return
}
if (start < newCommentHeaderIndex + 1) {
this.dialogUpdateTitle("热门评论")
} else {
this.dialogUpdateTitle("最新评论")
}
}
parentOnReachEnd() {
if (this.fixedHeightMode) {
return
... ... @@ -268,11 +319,41 @@ export struct CommentComponent {
//获取数据
async getData() {
let pageIndex = this.currentPage
commentViewModel.fetchContentCommentList(pageIndex + '', this.publishCommentModel.targetId,
this.publishCommentModel.targetType)
commentViewModel.fetchContentCommentList(pageIndex + ''
,this.publishCommentModel.targetId
,this.publishCommentModel.targetType
,this.firstPageHotIds)
.then(commentListModel => {
console.log('评论:', JSON.stringify(commentListModel.list))
if (pageIndex == 1) {
// 保存第一页热门评论ids
if (commentListModel.hotIds.length > 0) {
this.firstPageHotIds = commentListModel.hotIds.join(",")
}
if (commentListModel.list.length > 0) { // 热门评论增加头部
let newCommentTitle = new commentItemModel()
newCommentTitle.api_customType = CommentItemCustomType.newTitle
let newArray = [newCommentTitle]
commentListModel.list = newArray.concat(commentListModel.list)
}
if (commentListModel.hotList.length > 0) { // 最新评论增加头部
let hotCommentTitle = new commentItemModel()
hotCommentTitle.api_customType = CommentItemCustomType.hotTitle
let newArray = [hotCommentTitle]
commentListModel.hotList = newArray.concat(commentListModel.hotList)
commentListModel.list = commentListModel.hotList.concat(commentListModel.list)
}
} else { // 非首页数据
if (commentListModel.list.length > 0 && !this.hasNewCommentHeaderTitle()) { // 如果之前仅存在热门评论,这里需要补下数据
let newCommentTitle = new commentItemModel()
newCommentTitle.api_customType = CommentItemCustomType.newTitle
let newArray = [newCommentTitle]
commentListModel.list = newArray.concat(commentListModel.list)
}
}
// 这里需要先赋值,否则下次UI刷新可能重复进入第1页两次
this.currentPage = pageIndex + 1
... ... @@ -313,6 +394,29 @@ export struct CommentComponent {
}
})
}
hasNewCommentHeaderTitle() {
let hasNewCommentHeader = false
this.allDatas.getDataArray().forEach((comment) => {
if (comment.api_customType === CommentItemCustomType.newTitle) {
hasNewCommentHeader = true
}
})
return hasNewCommentHeader
}
indexOfNewCommentHeaderTitle() {
let resultIndex = -1;
const array = this.allDatas.getDataArray()
for (let index = 0; index < array.length; index++) {
if (array[index].api_customType === CommentItemCustomType.newTitle) {
resultIndex = index;
break
}
}
return resultIndex
}
}
... ... @@ -610,7 +714,7 @@ struct commentHeaderView {
dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction
}).margin({ left: 60, right: 16 })
}.alignItems(HorizontalAlign.Start)
.padding({bottom: 8})
.padding({bottom: 0})
}
@Builder headerView() {
... ... @@ -738,6 +842,7 @@ struct commentFooterView {
})
}
}
// .alignItems(VerticalAlign.Bottom)
.justifyContent(FlexAlign.SpaceBetween)
.width('100%')
.height(30)
... ...
import { inputMethodEngine } from '@kit.IMEKit'
import { commentInfo } from 'wdBean/Index'
import { VoiceRecoginizer } from 'wdHwAbility'
import { ToastUtils } from 'wdKit/Index'
import { HttpUtils } from 'wdNetwork/Index'
import { commentItemModel } from '../model/CommentModel'
import { publishCommentModel } from '../model/PublishCommentModel'
import commentViewModel from '../viewmodel/CommentViewModel'
import { VoiceInputView } from './VoiceInputView'
import { common, UIAbility } from '@kit.AbilityKit'
export interface CommentDialogInputContent {
comment?: string
... ... @@ -27,6 +30,7 @@ export struct CommentCustomDialog {
onPublishBtnClickTrack?: () => void // 和confirm配套使用。当设置了onPublishBtnClick 则无效
@State private emojiSwitch: boolean = false
@State private voiceSwitch: boolean = false
textInputController: TextAreaController = new TextAreaController()
@State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 }
@State publishButtonOpacity: number = 0.5
... ... @@ -105,6 +109,9 @@ export struct CommentCustomDialog {
if (this.emojiSwitch) {
this.emojiSwitch = false
}
if (this.voiceSwitch) {
this.voiceSwitch = false
}
})
}
.backgroundColor('#F9F9F9')
... ... @@ -117,8 +124,21 @@ export struct CommentCustomDialog {
Row() {
Row({ space: 12 }) {
//语音暂时不做,隐藏
// Image($r('app.media.WDInput_voice')).width(30).height(30)
Image($r(this.voiceSwitch ? 'app.media.WDInput_keyboardImage' : 'app.media.WDInput_voice'))
.width(30)
.height(30)
.onClick(() => {
VoiceRecoginizer.checkPemmission(getContext(this) as common.UIAbilityContext)
this.positionInfo = this.textInputController.getCaretOffset()
this.voiceSwitch = !this.voiceSwitch
this.emojiSwitch = false
if (this.voiceSwitch) {
this.textInputController.stopEditing()
} else {
focusControl.requestFocus("textAreaId") // 弹起键盘
// this.textInputController.caretPosition(this.textInputController.getTextContentRect().x)
}
})
Image($r(this.emojiSwitch ? 'app.media.WDInput_keyboardImage' : 'app.media.WDInput_emojiImage'))
.width(30)
.height(30)
... ... @@ -127,6 +147,7 @@ export struct CommentCustomDialog {
this.positionInfo = this.textInputController.getCaretOffset()
this.emojiSwitch = !this.emojiSwitch
this.voiceSwitch = false
if (this.emojiSwitch) {
this.textInputController.stopEditing()
} else {
... ... @@ -137,6 +158,7 @@ export struct CommentCustomDialog {
})
}
// Blank()
Row() {
... ... @@ -172,6 +194,12 @@ export struct CommentCustomDialog {
if (this.emojiSwitch) {
emojiView({ publishCommentModel: this.publishCommentModel }).height(150)
}
if (this.voiceSwitch) {
VoiceInputView({voiceRecoginizerResult:(result: string) => {
this.publishCommentModel.commentContent = result;
}}).height(150)
}
}.backgroundColor(Color.White)
.width('100%')
... ...
... ... @@ -74,6 +74,7 @@ struct CommentListDialog {
/// 内部使用
@Link publishCommentModel: publishCommentModel
@State private operationButtonList: string[] = []
@State title: string = "评论"
/// 外部初始化
@Link contentDetailData: ContentDetailDTO // 详情页传
... ... @@ -122,6 +123,9 @@ struct CommentListDialog {
if (this.onClose) {
this.onClose()
}
},
dialogUpdateTitle: (title) => {
this.title = title
}
}).layoutWeight(1)
... ... @@ -153,7 +157,7 @@ struct CommentListDialog {
Image($r('app.media.redLine'))
.height(16)
.width(3)
Text('全部评论')
Text(this.title)
.fontSize(16)// .fontColor('#222222')
.fontColor($r('app.color.color_222222'))
.fontWeight(FontWeight.Medium)
... ...
... ... @@ -110,9 +110,12 @@ export struct CommentText {
// this.maxLineMesssage = this.maxLineMesssage.slice(0, this.maxLineMesssage.length - 1)
// }
// console.log(`XXXXXXXXXXGY:${thisTextWidth - maxLineTextWidth}`)
///早晚报三行显示 展开功能显示末尾
if (this.isMorningEveningPaper) {
this.maxLineMesssage = this.maxLineMesssage.substring(0,this.maxLineMesssage.length - 7)
} else if (thisTextWidth > maxLineTextWidth + 5) {
this.maxLineMesssage = this.maxLineMesssage.substring(0,this.maxLineMesssage.length - 1)
}
break
}
... ...
import Lottie from '@ohos/lottie'
import { LottieView } from '../../lottie/LottieView'
import lottie from '@ohos/lottie';
import { CommonConstants } from 'wdConstant';
import { common} from '@kit.AbilityKit';
import { VoiceRecoginizer } from 'wdHwAbility/src/main/ets/voiceRecognizer/VoiceRecoginizer';
@Component
export struct VoiceInputView {
@State private playAnimationOne: boolean = false
// @State private playAnimationTwo: boolean = false
@State private tips:string = "长按开始语音输入"
voiceRe: VoiceRecoginizer = VoiceRecoginizer.sharedManager()
voiceRecoginizerResult?:(result: string) => void
aboutToAppear(): void {
this.initVoiceRecoigzer()
}
aboutToDisappear(): void {
this.voiceRe.stop()
this.voiceRe.voiceRecoginizerResult = undefined
}
build() {
Column() {
Stack() {
Row() {
if (this.playAnimationOne) {
LottieView({
name: 'voice_input_one',
path: "lottie/search_animation_two.json",
lottieWidth: 100,
lottieHeight: 100,
autoplay: true,
loop: true,
// onComplete:() => {
// this.playAnimationOne = false
// }
})
}
}.height(100)
Button()
.type(ButtonType.Circle)
.backgroundImage($r('app.media.WDInput_voice_longPress_icon'))
.backgroundColor(Color.White)
.width(60)
.height(60)
.gesture(
LongPressGesture()
.onAction((event: GestureEvent) => {
// this
this.playAnimationOne = true
this.tips = ""
this.voiceRe.startDialog()
})
.onActionEnd((event: GestureEvent) => {
this.tips = "长按开始语音输入"
this.playAnimationOne = false
this.voiceRe.stop()
// this.voiceRe.voiceRecoginizerResult = undefined
})
)
}
Blank()
Text(this.tips)
.fontSize(13)
.fontColor("#222222")
}
}
initVoiceRecoigzer() {
let context = getContext(this) as common.UIAbilityContext
let resoureDir = context.resourceDir
this.voiceRe.AsrInit(context.resourceDir, context.filesDir)
this.voiceRe.voiceRecoginizerResult = (result: string) => {
if (this.voiceRecoginizerResult) {
this.voiceRecoginizerResult(result)
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -8,6 +8,7 @@ import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { TrackConstants, TrackingContent } from 'wdTracking/Index';
import {
CommentItemCustomType,
commentItemModel,
commentListModel,
commentStatusListModel,
... ... @@ -33,9 +34,13 @@ class CommentViewModel {
}
/*获取所有评论*/
fetchContentCommentList(pageNum: string, contentId: string, contentType: string): Promise<commentListModel> {
fetchContentCommentList(pageNum: string, contentId: string, contentType: string, firstPageHotIds: string = ''): Promise<commentListModel> {
let url = HttpUrlUtils.getContentCommentListDataUrl() + `?&pageSize=${10}&pageNum=${pageNum}&contentId=${contentId}&contentType=${contentType}&deviceId=${HttpUtils.getDeviceId()}&userId=${HttpUtils.getUserId()}&userType=${HttpUtils.getUserType()}&time=${DateTimeUtils.getCurTime(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)}`
url = url + "&hotComment=1"
if (pageNum !== "1" && firstPageHotIds.length > 0) {
url = url + `&hotIds=` + firstPageHotIds
}
url = url.replace(' ', '%20')
return new Promise<commentListModel>((success, fail) => {
... ... @@ -49,9 +54,23 @@ class CommentViewModel {
return
}
let listData = data.data as commentListModel
this.fetchCommentStatusAndConfigAuthIcon(listData).then((commentListModel) => {
this.fetchCommentStatusAndConfigAuthIcon(listData, false).then((commentListModel) => {
console.log(TAG, 'fetchCommentStatusAndConfigAuthIcon完成')
success(commentListModel)
if (pageNum !== "1") {
success(commentListModel)
return
}
// 热门评论批查
this.fetchCommentStatusAndConfigAuthIcon(listData, true).then((commentListModel) => {
console.log(TAG, 'hot comment fetchCommentStatusAndConfigAuthIcon完成')
listData.hotList.forEach((item) => {
item.api_customType = CommentItemCustomType.hotComment
})
success(commentListModel)
})
})
}, (error: Error) => {
... ... @@ -213,7 +232,7 @@ class CommentViewModel {
}
/*多接口批查*/
fetchCommentStatusAndConfigAuthIcon(model: commentListModel): Promise<commentListModel> {
fetchCommentStatusAndConfigAuthIcon(model: commentListModel, hot: boolean = false): Promise<commentListModel> {
let commentIDs: string[] = [];
... ... @@ -222,7 +241,7 @@ class CommentViewModel {
let creatorIDs: string[] = [];
//主评论
for (const element of model.list) {
for (const element of (hot ? model.hotList : model.list)) {
if ((element.id + '').length > 0) {
commentIDs.push(element.id + '')
}
... ... @@ -277,7 +296,7 @@ class CommentViewModel {
let listData = data.data as commentStatusModel[]
//点赞
for (const element of listData) {
for (const commentModel of model.list) {
for (const commentModel of (hot ? model.hotList : model.list)) {
if (element.commentId == commentModel.id) {
commentModel.api_status = element.status
}
... ... @@ -319,7 +338,7 @@ class CommentViewModel {
let listData = data.data as commentStatusModel[]
for (const element of listData) {
for (const commentModel of model.list) {
for (const commentModel of (hot ? model.hotList : model.list)) {
if (element.userId == commentModel.fromUserId) {
commentModel.api_levelHead = element.levelHead
}
... ... @@ -364,7 +383,7 @@ class CommentViewModel {
let listData = data.data as commentStatusModel[]
for (const element of listData) {
for (const commentModel of model.list) {
for (const commentModel of (hot ? model.hotList : model.list)) {
if (element.creatorId == commentModel.fromCreatorId) {
commentModel.api_authIcon = element.authIcon
}
... ... @@ -400,6 +419,7 @@ class CommentViewModel {
deepCopyCommentItemModel(model: commentItemModel) {
let newModel = new commentItemModel()
newModel.api_customType = model.api_customType
newModel.authorLike = model.authorLike
newModel.avatarFrame = model.avatarFrame
newModel.checkStatus = model.checkStatus
... ...
... ... @@ -60,17 +60,19 @@ export struct ZhSingleRow02 {
toMore() {
if (this.moreWidth > this.initMoreWidth * 2) {
if (this.compDTO?.objectType === '11') {
ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle)
} else {
const contentDTO: ContentDTO = {
objectId: this.compDTO.objectId,
objectType: this.compDTO.objectType,
linkUrl: this.compDTO.linkUrl,
pageId: this.compDTO.pageId
} as ContentDTO
ProcessUtils.processPage(contentDTO)
}
ProcessUtils.compJumpPage(this.compDTO)
// if (this.compDTO?.objectType === '11') {
// ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle)
// } else {
// const contentDTO: ContentDTO = {
// objectId: this.compDTO.objectId,
// objectType: this.compDTO.objectType,
// linkUrl: this.compDTO.linkUrl,
// pageId: this.compDTO.pageId
// } as ContentDTO
// ProcessUtils.processPage(contentDTO)
// }
}
}
... ... @@ -94,7 +96,7 @@ export struct ZhSingleRow02 {
pageId: this.pageId,
pageName: this.pageName
})
.margin({ right: 8 })
.margin({ right: 8, left: index === 0 ? 16 : 0 })
})
}
if (this.compDTO.operDataList.length > 2 && this.showMore()) {
... ... @@ -123,6 +125,7 @@ export struct ZhSingleRow02 {
.margin({left: 1.5 * (this.moreWidth - this.initMoreWidth)})
}
}
.padding({right: 10})
}
.width(CommonConstants.FULL_WIDTH)
.height(208)
... ... @@ -151,14 +154,14 @@ export struct ZhSingleRow02 {
})
}
.padding({
left: 10,
// left: 10,
// right: 10,
top: 14,
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor(0xffffff)
.width('100%')
.margin({ bottom: 8 })
.width('102%')
.margin({ bottom: 8, left: -6 })
}
@Builder
... ... @@ -204,6 +207,7 @@ export struct ZhSingleRow02 {
}
.justifyContent(FlexAlign.SpaceBetween)
.margin({ bottom: 10 })
.padding({left: 16})
.width('100%')
}
}
... ...
... ... @@ -475,17 +475,19 @@ export struct ZhSingleRow03 {
}
private jumpToMore() {
if (this.compDTO.linkUrl) {
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
params: {
url: this.compDTO.linkUrl
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
} else {
this.jumpToLiveMorePage()
}
ProcessUtils.compJumpPage(this.compDTO)
return;
// if (this.compDTO.linkUrl) {
// let taskAction: Action = {
// type: 'JUMP_H5_BY_WEB_VIEW',
// params: {
// url: this.compDTO.linkUrl
// } as Params,
// };
// WDRouterRule.jumpWithAction(taskAction)
// } else {
// this.jumpToLiveMorePage()
// }
}
}
... ...
... ... @@ -130,7 +130,6 @@ export struct HomePageBottomCommentComponent {
let object = new FollowListDetailRequestItem(-1, 20, this.curPageNum)
MinePageDatasModel.getMineCommentListData(time, object, getContext(this)).then((value) => {
if (this.curPageNum === 1) this.data_comment.clear()
if (!this.data_comment || value.list.length == 0) {
this.hasMore = false
this.isLoading = false
... ... @@ -176,6 +175,9 @@ export struct HomePageBottomCommentComponent {
})
if (status.commentIdList.length === 0) {
if (this.curPageNum === 1) this.data_comment.clear()
data.forEach((item) => {
let publishTime =
DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(item.createTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
... ... @@ -201,6 +203,9 @@ export struct HomePageBottomCommentComponent {
}
MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => {
if (this.curPageNum === 1) this.data_comment.clear()
newValue.forEach((item) => {
data.forEach((list) => {
if (item.commentId == list.id) {
... ...
... ... @@ -256,6 +256,8 @@ export struct HomePageBottomFollowComponent {
}
this.bottomCompH = DisplayUtils.getDeviceHeight() - this.data_follow.totalCount()*100
// console.log(TAG, `${this.bottomCompH}`);
this.bottomCompH = DisplayUtils.getDeviceHeight() - this.data_follow.totalCount()*101
console.log(TAG, `${this.bottomCompH}`);
this.isLoading = false
this.isGetRequest = true
}).catch((err: Error) => {
... ...
... ... @@ -9,7 +9,7 @@ import NoMoreLayout from './NoMoreLayout'
import { CustomSelectUI } from '../view/CustomSelectUI';
import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI';
import { BigPicCardComponent } from '../view/BigPicCardComponent';
import { contentListItemParams } from '../../model/MyCollectionModel';
import { contentListItemParams, MyCollectionItem } from '../../model/MyCollectionModel';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { MyCustomDialog } from '../reusable/MyCustomDialog'
import { NetworkUtil } from 'wdKit/Index';
... ... @@ -180,18 +180,9 @@ struct MyCollectionListPage {
MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => {
if(resolve) resolve('刷新成功')
if (collectionItem && collectionItem.list && collectionItem.list.length > 0) {
if (this.currentPage === 1) {
this.allDatas = []
}
for (let index = 0; index < collectionItem.list.length; index++) {
const compDTO = collectionItem.list[index];
compDTO.isCollection = true ///用于时间展示
this.allDatas.push(compDTO)
}
if (this.allDatas.length > 0){
this.getContentData()
if (collectionItem.list.length > 0){
this.getContentData(collectionItem)
}
if (collectionItem.hasNext === 0) {
... ... @@ -279,13 +270,13 @@ struct MyCollectionListPage {
}
}
async getContentData(){
async getContentData(item:MyCollectionItem){
try {
// 获取列表数据
const params: contentListParams = {
contentList: []
}
this.allDatas.forEach((item: ContentDTO) => {
item.list.forEach((item: ContentDTO) => {
params.contentList.push({
contentId: item.objectId,
contentType: Number(item.objectType ?? '1')
... ... @@ -293,15 +284,26 @@ struct MyCollectionListPage {
})
this.commentList = await PeopleShipMainViewModel.getContentInteractInfo(params)
let datas: ContentDTO[] = [];
for (let index = 0; index < this.allDatas.length; index++) {
const compDTO = this.allDatas[index];
if (this.currentPage === 1) {
this.allDatas = []
}
for (let index = 0; index < item.list.length; index++) {
const compDTO = item.list[index];
compDTO.isCollection = true ///用于时间展示
compDTO.interactData = this.commentList[index]
datas.push(compDTO)
this.allDatas.push(compDTO)
}
this.allDatas = []
this.allDatas.push(...datas)
} catch (exception) {
if (this.currentPage === 1) {
this.allDatas = []
}
for (let index = 0; index < item.list.length; index++) {
const compDTO = item.list[index];
compDTO.isCollection = true ///用于时间展示
this.allDatas.push(compDTO)
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -34,7 +34,7 @@ export struct PeopleShipAttentionContentListTopComponent {
.width('100%')
.height('102vp')
Divider().strokeWidth(1).color($r('app.color.color_F5F5F5'))
Divider().strokeWidth(1).color($r('app.color.color_F5F5F5')).padding({ left: 10, right: 10 })
}
}
... ...
import router from '@ohos.router'
import { VoiceRecoginizer } from 'wdHwAbility'
import { BreakpointSystem, DateTimeUtils, NetworkUtil, StringUtils, ToastUtils } from 'wdKit'
import { ParamType, TrackConstants, Tracking } from 'wdTracking/Index'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
... ... @@ -8,6 +9,8 @@ import { SearchHistoryComponent } from './SearchHistoryComponent'
import { SearchHotsComponent } from './SearchHotsComponent'
import { SearchRelatedComponent } from './SearchRelatedComponent'
import { SearchResultComponent } from './SearchResultComponent'
import { VoiceSearchCustomDialog } from './VoiceSearchCustomDialog'
import { common } from '@kit.AbilityKit'
const TAG = "SearchComponent"
... ... @@ -37,6 +40,7 @@ export struct SearchComponent {
@StorageProp('currentBreakpoint') @Watch("currentChanged") currentBreakpoint: string = 'sm';
private breakpointSystem = new BreakpointSystem();
@State percent: number = 1
private voiceInputDialogController?: CustomDialogController
currentChanged() {
if (this.currentBreakpoint == "md" || this.currentBreakpoint == "lg") {
... ... @@ -366,17 +370,22 @@ export struct SearchComponent {
}
})
Image($r('app.media.search_input_del_icon'))
Image($r(StringUtils.isEmpty(this.searchText) ? 'app.media.search_voice_icon' : 'app.media.search_input_del_icon'))
.width(`${this.calcHeight(31)}lpx`)
.height(`${this.calcHeight(31)}lpx`)
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.Medium)
.onClick(() => {
this.searchText = ""
if (StringUtils.isEmpty(this.searchText)) { ///唤起语音搜索
this.stopInput()
this.voiceSearchDialog()
}else { ///清除输入内容
this.searchText = ""
}
})
.offset({ x: 10 })
.enabled(true)
.visibility(StringUtils.isEmpty(this.searchText) ? Visibility.Hidden : Visibility.Visible)
// .visibility(StringUtils.isEmpty(this.searchText) ? Visibility.Hidden : Visibility.Visible)
}.padding({ right: `${this.calcHeight(70)}lpx` })
.layoutWeight(1)
... ... @@ -406,6 +415,31 @@ export struct SearchComponent {
.alignItems(VerticalAlign.Center)
}
private voiceSearchDialog() {
VoiceRecoginizer.checkPemmission(getContext(this) as common.UIAbilityContext)
this.voiceInputDialogController = new CustomDialogController({
builder: VoiceSearchCustomDialog (
{ onSearchBtnClick:((content:string) => {
this.searchText = content
if (StringUtils.isNotEmpty(this.searchText)) {
SearcherAboutDataModel.putSearchHistoryData(this.searchText)
this.getSearchHistoryData()
this.getSearchInputResData(this.searchText)
}
this.voiceInputDialogController?.close()
})
}
),
autoCancel: true,
alignment: DialogAlignment.Bottom,
customStyle: true,
backgroundColor: "#50000000",
})
this.voiceInputDialogController.open()
}
getSearchResultCountData() {
SearcherAboutDataModel.getSearchResultCountData(encodeURI(this.searchText), getContext(this)).then((value) => {
if (value != null) {
... ...
import { VoiceRecoginizer } from 'wdHwAbility'
import { common, UIAbility } from '@kit.AbilityKit'
import { VoiceInputView } from '../comment/view/VoiceInputView'
@Preview
@CustomDialog
export struct VoiceSearchCustomDialog {
controller?: CustomDialogController
onSearchBtnClick?: (content: string) => void
@State voiceContent: string = ""
build() {
Column() {
Row() {
TextArea({
placeholder: '我来说两句',
text: this.voiceContent
})
.placeholderColor("#999999")
.id("textAreaId")
.defaultFocus(false) // 获取默认焦点
.enableKeyboardOnFocus(true)
.height('100%')
.width('100%')
.backgroundColor($r('app.color.color_transparent'))
.caretColor("#ED2800")
.onFocus(() => {
this.controller?.close()
})
}
.backgroundColor('#F9F9F9')
.margin({ top: 12, right: 12, left: 12, bottom:10})
.height(80)
.borderRadius(4)
Row() {
Image($r('app.media.WDInput_keyboardImage'))
.width(30)
.height(30)
.onClick(() => {
this.controller?.close()
})
Text('搜索')
.backgroundColor("#ED2800")
.width(80)
.height(30)
.fontSize(15)
.fontColor(Color.White)
.textAlign(TextAlign.Center)
.borderRadius(4)
.opacity(this.voiceContent.length > 0 ? 1.0 : 0.5)
.enabled(this.voiceContent.length > 0)
.onClick(() => {
if (this.onSearchBtnClick) {
this.onSearchBtnClick(this.voiceContent)
}
})
}
.padding({ left: 12, right: 12 })
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
VoiceInputView({voiceRecoginizerResult:(result: string) => {
this.voiceContent = result
}}).height(150)
}.backgroundColor(Color.White)
.width('100%')
}
}
\ No newline at end of file
... ...
... ... @@ -14,6 +14,9 @@ import { ConfirmLogoutDialog } from './ConfirmLogoutDialog';
import { TrackingButton, TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
import { TitleBackComponent } from './TitleBackComponent';
import { AccountCenterItem } from '../../viewmodel/AccountCenterItem'
import { it } from '@ohos/hypium';
export { SettingPasswordParams } from "wdLogin"
@Component
... ... @@ -44,6 +47,11 @@ export struct AccountAndSecurityLayout {
maskColor:"#00000000"
})
accountCenterItem?: AccountCenterItem
@State logOffWaitTime: string = "7"
@State logOffMsg: string = ""
@State userType: number = 0
//注销账户 浏览埋点
logoutLayoutHide(){
this.logoutLayoutHideTime = DateTimeUtils.getTimeStamp()
... ... @@ -70,6 +78,9 @@ export struct AccountAndSecurityLayout {
logoutViewModel = new LogoutViewModel()
dialogController: CustomDialogController = new CustomDialogController({
builder: CustomLogoutDialog({
logOffWaitTime: this.logOffWaitTime,
logOffMsg: this.logOffMsg,
userType: this.userType,
cancel: () => {
},
... ... @@ -100,6 +111,7 @@ export struct AccountAndSecurityLayout {
aboutToAppear() {
this.pageShowAccountTime = DateTimeUtils.getTimeStamp()
this.userType = Number(SPHelper.default.getSync(SpConstants.USER_Type, ''))
// 获取设置页面数据
this.getAccountAndSecurityData()
this.addEmitEvent()
... ... @@ -129,6 +141,11 @@ export struct AccountAndSecurityLayout {
}
this.listData = oldList
MineSettingDatasModel.fetchSecurityBindInfo().then((item) => {
this.accountCenterItem = item
this.logOffWaitTime = item.logOffWaitTime > 0 ? item.logOffWaitTime + "" : "7"
this.logOffMsg = item.logOffMsg
})
}
addEmitEvent(){
... ... @@ -338,6 +355,14 @@ export struct AccountAndSecurityLayout {
.padding({ top: 24, left: 16 })
.width('100%')
if (this.userType === 1 && this.logOffWaitTime.length > 0) {
Text(`请注意:注销后${this.logOffWaitTime}天内不能再次注册人民日报客户端,需要等到账号冷静期结束才能再次登录注册`)
.fontColor('#FFED2800')
.fontSize(14)
.fontWeight(400)
.padding({ top: 32, left: "31lpx", right: "31lpx" })
.width('100%')
}
Text('请注意:注销后7天内不能再次注册人民日报客户端,需要等到账号冷静期结束才能再次登录注册')
.fontColor('#ED2800')
.fontSize(14)
... ...
import { router } from '@kit.ArkUI'
@CustomDialog
export struct CustomLogoutDialog {
controller: CustomDialogController
... ... @@ -5,25 +7,27 @@ export struct CustomLogoutDialog {
}
confirm: () => void = () => {
}
@Prop logOffWaitTime: string = "7"
@Prop logOffMsg: string = ""
@Prop userType: number = 0
build() {
Column() {
Text("温馨提示")
Text(this.userType !== 1 ? "温馨提醒" : "注销账号")
.fontColor("#222222")
.fontSize(18)
.width("100%")
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Center)
.margin({ top: 20 })
Text('注销后7天内无法重新登录注册人民日报app,是否确认注销?') {
}.margin({ top: 12, left: 16, right: 16 })
Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp')
Row() {
Text('放弃')
if (this.userType !== 1) {
Text(this.logOffMsg.length > 0 ? this.logOffMsg : "您确认要注销账号吗? 请联系rmh@pdnews.cn邮箱") {
}.margin({ top: 12, left: 16, right: 16 })
.fontColor("#999999")
Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp')
Text('知道了')
.fontSize(16)
.fontColor("#999999")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
... ... @@ -32,30 +36,52 @@ export struct CustomLogoutDialog {
if (this.cancel) {
this.cancel()
}
router.back()
})
.height('100%')
// Divider().color("#999999").height('100%').width('0.5vp')
Text('同意注销')
.fontSize(16)
.fontColor("#ED2800")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.border({
width: { left: 1 },
color: "#999999",
style: { left: BorderStyle.Solid }
})
.onClick(() => {
this.controller.close()
if (this.confirm) {
this.confirm()
}
})
.height('100%')
}.layoutWeight(1).justifyContent(FlexAlign.Center)
} else {
Text(`注销后${this.logOffWaitTime}天内无法重新登录注册人民日报app,是否确认注销?`) {
}.margin({ top: 12, left: 16, right: 16 })
Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp')
Row() {
Text('放弃')
.fontSize(16)
.fontColor("#999999")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.onClick(() => {
this.controller.close()
if (this.cancel) {
this.cancel()
}
})
.height('100%')
// Divider().color("#999999").height('100%').width('0.5vp')
Text('同意注销')
.fontSize(16)
.fontColor("#ED2800")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.border({
width: { left: 1 },
color: "#999999",
style: { left: BorderStyle.Solid }
})
.onClick(() => {
this.controller.close()
if (this.confirm) {
this.confirm()
}
})
.height('100%')
}.layoutWeight(1).justifyContent(FlexAlign.Center)
}
}.height(161).backgroundColor(Color.White).borderRadius(6).width('74%')
}
}
\ No newline at end of file
... ...
... ... @@ -7,7 +7,7 @@
export struct newsSkeleton {
@State quantity: Array<number> = [1, 2, 3,]
@State showBottom: boolean = true
@Consume itemPicHeight: number
build() {
Row() {
Column() {
... ... @@ -17,12 +17,12 @@ export struct newsSkeleton {
Column() {
Image($r('app.media.peopleSeleton'))
.width('100%')
.height(47)// 后缀名不能省略
.height(this.getCompHeight(47))// 后缀名不能省略
.interpolation(ImageInterpolation.High)
.margin({
bottom: 6
})
textArea('100%', 8)
textArea('100%', this.getCompHeight(8),this.getCompHeight(5))
}
.margin({
right: '2%'
... ... @@ -33,20 +33,17 @@ export struct newsSkeleton {
Column() {
Row()
.width(`100%`)
.height(25)
.height(this.getCompHeight(25))
.backgroundColor('#FFF5F5F5')
Row()
.width(`100%`)
.height(4)
.height(this.getCompHeight(4))
.backgroundColor('#FFF5F5F5')
.margin({ top: 3, bottom: 3 })
.margin({ top: this.getCompHeight(3), bottom: this.getCompHeight(3) })
Row()
.width(`100%`)
.height(20)
.height(this.getCompHeight(20))
.backgroundColor('#FFF5F5F5')
// textArea(27, 25)
// textArea(27, 4)
// textArea(27, 20)
}
.width(`22%`)
.border({ width: 1 })
... ... @@ -63,59 +60,59 @@ export struct newsSkeleton {
.width('100%')
BoxAndLine().width('100%')
BoxAndBox({ firstBoxNumber: '65%', boxHeight: 100 })
BoxAndBox({ firstBoxNumber: '65%', boxHeight: this.getCompHeight(100) })
Column() {
textArea('100%', 79)
textArea('100%', this.getCompHeight(79),this.getCompHeight(5))
}
BoxAndBox({ firstBoxNumber: '30%', boxHeight: 51 })
BoxAndBox({ firstBoxNumber: '30%', boxHeight: this.getCompHeight(48) })
}
.width('50%')
.width('49%')
.margin({ right: 5 })
Column() {
Column() {
textArea('100%', 13)
textArea('100%', this.getCompHeight(13),this.getCompHeight(0))
}.width('100%')
Column() {
textArea('100%', 136)
textArea('100%', 13)
textArea('80%', 13)
textArea('100%', this.getCompHeight(136),this.getCompHeight(5))
textArea('100%', this.getCompHeight(13),this.getCompHeight(5))
textArea('80%', this.getCompHeight(13),this.getCompHeight(5))
}.width('100%').alignItems(HorizontalAlign.Start)
Column() {
textArea('100%', 126)
textArea('100%', this.getCompHeight(126),this.getCompHeight(5))
}
Column() {
textArea('100%', 13)
textArea('100%', this.getCompHeight(13),this.getCompHeight(5))
}
Row() {
Column() {
textArea('100%', 30)
textArea('100%', this.getCompHeight(30),this.getCompHeight(5))
}.width('50%').margin({ right: 5 })
Column() {
textArea('100%', 30)
textArea('100%', this.getCompHeight(30),this.getCompHeight(5))
}.layoutWeight(1)
}.width('100%').justifyContent(FlexAlign.SpaceBetween)
Column() {
textArea('100%', 100)
textArea('100%', this.getCompHeight(100),this.getCompHeight(5))
}
}
.width('50%')
.width('49%')
}
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)
.padding({
top: 15,
bottom: 15,
right: 15,
left: 15
top: 14,
right: 10,
bottom: 14,
left: 10
})
if (this.showBottom) {
// Column().backgroundColor('#CBCBCB').height(5).width(339)
... ... @@ -133,17 +130,31 @@ export struct newsSkeleton {
.width('100%')
}
getCompHeight(height: number): number{
//设计图高度 478
let compH:number = height*px2vp(this.itemPicHeight)/478
return compH;
}
}
@Component
struct BoxAndLine {
@Consume itemPicHeight: number
build() {
Column() {
textArea('100%', 130)
textArea('100%', 13)
textArea('80%', 13)
textArea('100%', this.getCompHeight(130),this.getCompHeight(5))
textArea('100%', this.getCompHeight(13),this.getCompHeight(5))
textArea('80%', this.getCompHeight(13),this.getCompHeight(5))
}.alignItems(HorizontalAlign.Start)
}
getCompHeight(height: number): number{
//设计图高度 478
let compH:number = height*px2vp(this.itemPicHeight)/478
return compH;
}
}
... ... @@ -151,29 +162,37 @@ struct BoxAndLine {
struct BoxAndBox {
@Prop firstBoxNumber: number | Resource | string
@Prop boxHeight: number | Resource | string
@Consume itemPicHeight: number
build() {
Row() {
Column() {
textArea('100%', this.boxHeight)
textArea('100%', this.boxHeight,this.getCompHeight(5))
}.width(this.firstBoxNumber).margin({ right: 5 })
Column() {
textArea('100%', this.boxHeight)
textArea('100%', this.boxHeight,this.getCompHeight(5))
}.layoutWeight(1)
}.width('100%').justifyContent(FlexAlign.SpaceBetween)
}
getCompHeight(height: number): number{
//设计图高度 478
let compH:number = height*px2vp(this.itemPicHeight)/478
return compH;
}
}
@Builder
function textArea(width: number | Resource | string = '100%', height: number | Resource | string = '100%') {
function textArea(width: number | Resource | string = '100%', height: number | Resource | string = '100%',topM:number) {
Row()
.width(width)
.height(height)
.backgroundColor('#FFF5F5F5')
.margin({ top: 5 })
.backgroundColor(height === 13?Color.Red:'#FFF5F5F5')
.margin({ top: topM })
// .borderRadius(5)
}
... ...
... ... @@ -65,11 +65,9 @@ export struct LiveHorizontalCardComponent {
}
liveToMore() {
ProcessUtils.compJumpPage(this.compDTO)
return;
if (!!this.compDTO.dataSourceType) {
// if (this.compDTO.dataSourceType === 'OBJECT_POS') {
// ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle)
// return;
// }
if (this.compDTO.linkUrl) {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
... ... @@ -84,14 +82,8 @@ export struct LiveHorizontalCardComponent {
}
} as Params,
};
// this.compDTO.operDataList = []
// console.log('LiveHorizontalCardComponent', JSON.stringify(this.compDTO))
// console.log('LiveHorizontalCardComponent', this.compDTO.relId)
// console.log('LiveHorizontalCardComponent', this.compDTO.relType)
// console.log('LiveHorizontalCardComponent', JSON.stringify(taskAction))
WDRouterRule.jumpWithAction(taskAction)
} else {
// console.log('LiveHorizontalCardComponent', 'jumpToLiveMorePage')
this.jumpToLiveMorePage()
}
} else {
... ... @@ -103,7 +95,6 @@ export struct LiveHorizontalCardComponent {
linkUrl: this.compDTO.linkUrl,
pageId: this.compDTO.pageId
} as ContentDTO
// console.log('LiveHorizontalCardComponent', 'ProcessUtils.processPage')
ProcessUtils.processPage(contentDTO)
}
}
... ... @@ -146,7 +137,8 @@ export struct LiveHorizontalCardComponent {
this.liveToMore();
})
}
}.justifyContent(FlexAlign.SpaceBetween)
}
.justifyContent(FlexAlign.SpaceBetween)
// .padding({ left: 16, right: 16 })
.margin({ bottom: 10 })
.width(CommonConstants.FULL_WIDTH)
... ... @@ -184,7 +176,7 @@ export struct LiveHorizontalCardComponent {
.width(this.compDTO.operDataList.length == 2 ? 210 : 150)
.lineHeight(21)
}
.height(this.compDTO.operDataList.length == 2 ? 180 : 148)
.height(this.compDTO.operDataList.length == 2 ? 167 : 134)
.padding({ right: 8 })
.onClick(() => {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
... ... @@ -246,7 +238,7 @@ export struct LiveHorizontalCardComponent {
}
})
.width(CommonConstants.FULL_WIDTH)
.height(this.compDTO.operDataList.length == 2 ? 180 : 148)
.height(this.compDTO.operDataList.length == 2 ? 167 : 134)
} else if (this.compDTO.operDataList.length) {
// 一个
LiveHorizontalCardForOneComponent({ contentDTO: this.compDTO.operDataList[0] })
... ...
... ... @@ -19,7 +19,7 @@ export struct FirstLevelComponent {
Column(){
Column(){
if (this.labelList.length === 0){
Text('暂无数据').fontSize(20)
Text('').fontSize(20)
}else {
TextPicker({range:this.labelList,selected:this.select})
.canLoop(false)
... ...
... ... @@ -2,7 +2,7 @@ import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel
import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel';
@Component
export struct SecondLevelComponent {
@State mTip: string = '暂无数据'
@State mTip: string = ''
@State labelList: string[] = [];
@State select: number = 0;
@Consume @Watch('onFirstChange') currentFirst: AreaListManageModel;
... ... @@ -43,14 +43,19 @@ export struct SecondLevelComponent {
}
if (!this.currentFirst) {
this.mTip = '暂无数据';
this.mTip = '';
} else {
this.labelList = []
for (let index = 0; index < this.currentFirst.children.length; index++) {
const element = this.currentFirst.children[index];
this.labelList.push(element.label)
}
this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[this.select])
if (this.currentFirst.children.length > 0) {
this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[this.select])
}else {
this.currentSecondBean = new AreaListManageModel('0','0','0',[])
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -2,7 +2,7 @@ import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel
import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel';
@Component
export struct ThirdLevelComponent {
@State mTip: string = '暂无数据'
@State mTip: string = ''
@State labelList: string[] = [];
@State select: number = 0;
@Consume @Watch('onFirstChange') currentFirst: AreaListManageModel;
... ... @@ -52,14 +52,19 @@ export struct ThirdLevelComponent {
this.select = 0
}
if (!this.currentSecondBean) {
this.mTip = '暂无数据';
this.mTip = '';
} else {
this.labelList = []
for (let index = 0; index < this.currentSecondBean.children.length; index++) {
const element = this.currentSecondBean.children[index];
this.labelList.push(element.label)
}
this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[this.select])
if (this.currentSecondBean.children.length > 0) {
this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[this.select])
}else {
this.currentThirdBean = new AreaListManageModel('0','0','0',[])
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -21,6 +21,7 @@ export struct ENewspaperListDialog {
@State scrollOffset: number = 0
@State isCurrentViewOpen: boolean = false
@Consume bottomSafeHeight: number
@Consume topMargin:number
//文字版选择弹框
pageListDialogController: CustomDialogController = new CustomDialogController({
builder: ENewspaperPageDialog({
... ... @@ -292,7 +293,7 @@ export struct ENewspaperListDialog {
left: 15,
right: 15,
// top: 16,
// bottom: 16
bottom: 25
})
.margin({
bottom: 85
... ... @@ -317,15 +318,13 @@ export struct ENewspaperListDialog {
})
}
.margin({ top: this.topHeight })
.margin({ top: this.topHeight + this.topMargin})
.width('100%')
.backgroundColor(Color.White)
}
.width('100%')
.height('100%')
.backgroundColor('#80000000')
.margin({ bottom: 50 })
.onClick(() => {
if (this.closeDialog) {
this.closeDialog()
... ...
... ... @@ -5,7 +5,7 @@ import { Logger, SPHelper } from 'wdKit';
import { MineMainSettingFunctionItem } from '../viewmodel/MineMainSettingFunctionItem';
import { SpConstants } from 'wdConstant/Index';
import { CheckSetPasswordItem } from '../viewmodel/CheckSetPasswordItem';
import { AccountCenterItem } from '../viewmodel/AccountCenterItem';
const TAG = "MineSettingDatasModel"
... ... @@ -111,4 +111,22 @@ export class MineSettingDatasModel {
return WDHttp.get<ResponseDTO<CheckSetPasswordItem>>(url)
};
static fetchSecurityBindInfo() {
return new Promise<AccountCenterItem>((success, error) => {
Logger.info(TAG, `AccountCenterItem start`);
WDHttp.get<ResponseDTO<AccountCenterItem>>(HttpUrlUtils.querySecurity()).then((navResDTO: ResponseDTO<AccountCenterItem>) => {
if (!navResDTO || navResDTO.code != 0) {
error(navResDTO.message)
return
}
Logger.info(TAG, "AccountCenterItem then,checkSetPasswordResDTO.timeStamp:" + navResDTO.timestamp);
let navigationBean = navResDTO.data as AccountCenterItem
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `AccountCenterItem catch, error.name : ${err.name}, error.message:${err.message}`);
error(err)
})
})
}
}
... ...
export class AccountCenterItem {
id: string = "" // 用户id
phone: string = "" //手机号,脱敏处理中间用****代替
qqBinding: string = ""
wechatBinding: string = ""
weiboBinding: string = ""
appIdBinding: string = ""
///注销冷静期
logOffWaitTime: number = 0
logOffMsg: string = ""
}
\ No newline at end of file
... ...
import { AuthorListDTO, FullColumnImgUrlDTO, ReLInfoDTO, RmhInfoDTO, ShareInfoDTO,
UserInfoDTO,
VideoInfoDTO } from 'wdBean';
@Observed
export class ContentDetailModel{
newsId: number = 0;
newsTitle: string = "";
newsShortTitle: string= "";
newsDownTitle: string= "";
newsBodyTitle: string= "";
publishTime: string= "";
appstyle: number= 0;
newsType: number= 0;
newsSummary: string= "";
newsSource: string= "";
newsSourceName: string= "";
newsContent: string= "";
newsContentBak: string= "";
newsLinkUrl: string="";
bestNoticer: number= 0;
// newLinkObject?: any = null;
newIntroduction: string= "";
authorList: AuthorListDTO[]=[];
editorName: string="";
openAudio: number= 0;
// audioList: any[];
// hasPopUp?: any;
// popUps?: any[];
firstFrameImageUri: string= "";
reLInfo?: ReLInfoDTO | null = null;
fullColumnImgUrls: FullColumnImgUrlDTO[]=[];
shareInfo?: ShareInfoDTO | null = null;
// photoList: any[];
videoInfo: VideoInfoDTO[]=[];
// liveInfo?: any ;
// voteInfo?: any;
rmhInfo?: RmhInfoDTO | null = null;
userInfo?: UserInfoDTO | null = null;
openLikes: number= 0;
openComment: number= 0;
likesStyle: number= 0;
preCommentFlag: number= 0;
commentDisplay: number= 0;
keyArticle: number= 0;
rmhPlatform: number= 0;
readFlag?: number= 0;
// topicInfo?: any;
traceId: string= "";
itemId: string= "";
sceneId: string= "";
subSceneId: string= "";
// activityInfos: any[]=[];
recommendShow: number= 0;
visitorComment: number= 0;
itemTypeCode: string= "";
menuShow: number= 0;
newsTags: string= "";
// specialColumnId?: any;
specialColumnName: string= "";
// timeline?: any;
constructor(newsId: number, newsTitle: string, newsShortTitle: string, newsDownTitle: string, newsBodyTitle: string,
publishTime: string, appstyle: number, newsType: number, newsSummary: string, newsSource: string,
newsSourceName: string, newsContent: string, newsContentBak: string, newsLinkUrl: string, bestNoticer: number,
newIntroduction: string, authorList: AuthorListDTO[], editorName: string, openAudio: number,
firstFrameImageUri: string,fullColumnImgUrls: FullColumnImgUrlDTO[], videoInfo: VideoInfoDTO[],
openLikes: number, openComment: number, likesStyle: number, preCommentFlag: number,
commentDisplay: number, keyArticle: number, rmhPlatform: number, readFlag: number, traceId: string,
itemId: string, sceneId: string, subSceneId: string, recommendShow: number,
visitorComment: number, itemTypeCode: string, menuShow: number, newsTags: string,
specialColumnName: string, traceInfo: string, viewCount: number, isNewspaper: boolean, oldNewsId: string,
showTime: boolean, isLogin: string) {
this.newsId = newsId;
this.newsTitle = newsTitle;
this.newsShortTitle = newsShortTitle;
this.newsDownTitle = newsDownTitle;
this.newsBodyTitle = newsBodyTitle;
this.publishTime = publishTime;
this.appstyle = appstyle;
this.newsType = newsType;
this.newsSummary = newsSummary;
this.newsSource = newsSource;
this.newsSourceName = newsSourceName;
this.newsContent = newsContent;
this.newsContentBak = newsContentBak;
this.newsLinkUrl = newsLinkUrl;
this.bestNoticer = bestNoticer;
this.newIntroduction = newIntroduction;
this.authorList = authorList;
this.editorName = editorName;
this.openAudio = openAudio;
this.firstFrameImageUri = firstFrameImageUri;
this.fullColumnImgUrls = fullColumnImgUrls;
this.videoInfo = videoInfo;
this.openLikes = openLikes;
this.openComment = openComment;
this.likesStyle = likesStyle;
this.preCommentFlag = preCommentFlag;
this.commentDisplay = commentDisplay;
this.keyArticle = keyArticle;
this.rmhPlatform = rmhPlatform;
this.readFlag = readFlag;
this.traceId = traceId;
this.itemId = itemId;
this.sceneId = sceneId;
this.subSceneId = subSceneId;
this.recommendShow = recommendShow;
this.visitorComment = visitorComment;
this.itemTypeCode = itemTypeCode;
this.menuShow = menuShow;
this.newsTags = newsTags;
this.specialColumnName = specialColumnName;
this.traceInfo = traceInfo;
this.viewCount = viewCount;
this.isNewspaper = isNewspaper;
this.oldNewsId = oldNewsId;
this.showTime = showTime;
this.isLogin = isLogin;
}
traceInfo: string= "";
viewCount: number= 0;
isNewspaper: boolean = false;
oldNewsId: string= "";
// 本地字段
showTime:boolean = false;
isLogin?:string = ""
}
\ No newline at end of file
... ...
... ... @@ -17,6 +17,6 @@
"wdRouter": "file:../../commons/wdRouter",
"wdTracking": "file:../../features/wdTracking",
"wdShare": "file:../../features/wdShare",
"@rongcloud/imlib": "file:./src/main/libs/RongIMLib.har"
"@rongcloud/imlib": "file:./src/main/libs/RongIMLib-HarmonyOS-signed-V1.1.0.har"
}
}
... ...
... ... @@ -14,7 +14,7 @@ import { LiveMessageIsHistoryMessage, LiveMessageOptType } from 'wdBean/src/main
const TAG = "LiveRoomManager"
export class LiveRoom extends ChatroomStatusListener {
export class LiveRoom implements ChatroomStatusListener {
connectRoomBaseInfo?: LiveRoomBaseInfo
... ... @@ -28,7 +28,6 @@ export class LiveRoom extends ChatroomStatusListener {
onLiveMessage?: (liveRoomItemBean: LiveRoomItemBean) => void
constructor(baseInfo?: LiveRoomBaseInfo) {
super()
this.connectRoomBaseInfo = baseInfo
}
... ...
... ... @@ -184,9 +184,11 @@ export class LiveRoomManager {
if (data.data) {
success(data.data)
} else {
Logger.error(TAG, "接口没返回im token")
fail(data.message)
}
}).catch((error: Error) => {
Logger.error(TAG, "error " + JSON.stringify(error))
fail(error.message)
})
})
... ...
... ... @@ -9,13 +9,14 @@ import {
contentListParams,
getRecCompInfoParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { NetworkUtil, Logger, WindowModel, DateTimeUtils } from 'wdKit/Index';
import { NetworkUtil, Logger, WindowModel, DateTimeUtils, LazyDataSource } from 'wdKit/Index';
import { PictureLoading } from './PictureLoading';
import { DisplayDirection } from 'wdConstant/Index';
import { window } from '@kit.ArkUI';
import { EmptyComponent, WDViewDefaultType } from 'wdComponent/Index';
import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
import { LottieView } from 'wdComponent/Index'
import lottie from '@ohos/lottie';
interface loadMoreData {
pageNum: number;
... ... @@ -57,6 +58,7 @@ export struct VideoChannelDetail {
@Consume displayDirection: DisplayDirection
@Provide showCommentList: boolean = false
@State data: ContentDetailDTO[] = []
@State dataContentDetail: LazyDataSource<ContentDetailDTO> = new LazyDataSource();
@State currentIndex: number = 0
@State interactDataList: InteractDataDTO[] = []
@State totalCount: number = 0
... ... @@ -256,6 +258,7 @@ export struct VideoChannelDetail {
if (res.data) {
await this.getContentInteract(list2)
this.data = this.data.concat(res.data)
this.dataContentDetail.addItems(res.data)
}
console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data))
}).finally(() => {
... ... @@ -304,7 +307,8 @@ export struct VideoChannelDetail {
.visibility(this.isMouted ? Visibility.None : Visibility.Visible)
Swiper(this.swiperController) {
ForEach(this.data, (item: ContentDetailDTO, index: number) => {
// LazyForEach(this.data, (item: ContentDetailDTO, index: number) => {
LazyForEach(this.dataContentDetail, (item: ContentDetailDTO, index: number) => {
DetailPlayShortVideoPage({
contentDetailData: item,
currentIndex: this.currentIndex,
... ... @@ -314,6 +318,7 @@ export struct VideoChannelDetail {
}, (item: ContentDetailDTO) => item.newsId + '')
}
.displayCount(1, true)
.cachedCount(3)
.disableSwipe(this.displayDirection === DisplayDirection.VERTICAL || this.showCommentList ? false : true)
.visibility(this.isMouted ? Visibility.Visible : Visibility.Hidden)
.indicator(false)
... ... @@ -352,9 +357,10 @@ export struct VideoChannelDetail {
autoplay: true,
loop: true
})
.visibility(this.isMouted && this.GestureLoadStrategy == 0 ? Visibility.Visible : Visibility.Hidden)
.visibility(this.isMouted && this.GestureLoadStrategy == 0 ? Visibility.Visible : Visibility.None)
.onTouch(() => {
this.GestureLoadStrategy = 1
lottie.destroy('slider_up_view_more')
})
}
... ...
... ... @@ -51,6 +51,7 @@ export struct DetailDialog {
.margin({ top: 8, bottom: 8 })
}
.alignItems(HorizontalAlign.Start)
.margin({right:4})
}
.height(200)
... ... @@ -79,7 +80,7 @@ export struct DetailDialog {
top: 20,
bottom: 30,
left: 16,
right: 16
right: 12 //给滚动条预留4像素
})
}
... ...
... ... @@ -29,7 +29,7 @@ export struct PlayerBottomView {
.markAnchor({ y: '100%' })
.linearGradient({
colors: [
['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.4)', 1.0]
['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.5)', 1.0]
]
})
.visibility(this.displayDirection === DisplayDirection.VERTICAL ?
... ...
... ... @@ -94,8 +94,7 @@ export struct PlayerTitleView {
}
clipStr += strArr[i]
}
clipStr += this.isOverLines ? '...' : '';
console.log(TAG, 'clipStr2:', clipStr)
console.log(TAG, 'clipStr:', clipStr)
return clipStr
}
... ... @@ -131,8 +130,7 @@ export struct PlayerTitleView {
}
clipStr += strArr[i]
}
console.log(TAG, 'clipTitleText clipStr1:', clipStr)
clipStr += this.isTitleOverLines ? '...' : '';
console.log(TAG, 'clipTitleText clipStr:', clipStr)
return clipStr
}
... ... @@ -219,54 +217,7 @@ export struct PlayerTitleView {
// })
// }
// } else {
this.detailDesc()
// }
Text(DateTimeUtils.formatDate(new Date(this.contentDetailData?.publishTime).getTime(),
DateTimeUtils.PATTERN_DATE_TIME_HYPHEN_MM))
.fontSize(12)
.fontColor(Color.White)
.opacity(0.7)
.lineHeight(16)
.fontWeight(400)
.fontFamily('PingFang SC-Regular')
.margin({ top: 8, bottom: 8 })
}
.width(this.windowWidth - 150 + 'px')
.padding({ left: 16, right: 22 })
.alignItems(HorizontalAlign.Start)
.visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible)
}
@Builder
detailDesc() {
/**
* 标题大于三行或存在简介显示查看详情按钮
*/
// if (this.rmhPlatform == 1) {
// if (this.titleHeight > 200 || this.summary) {
// Text('查看详情 > ')
// .padding({
// left: 6,
// right: 6,
// top: 4,
// bottom: 4
// })
// .borderRadius(2)
// .backgroundColor('#99636363')
// .fontFamily('PingFang SC-Regular')
// .fontColor(Color.White)
// .fontSize(12)
// .lineHeight(14)
// .fontWeight(400)
// .onClick(() => {
// this.isOpenDetail = true
// this.dialogController?.open()
// })
// }
// } else {
if (this.summary && this.titleLines < 4) {
Stack({ alignContent: Alignment.TopStart }) {
if (this.summary && this.titleLines < 4) {
Text() {
Span(this.clipText(this.summary, 14, this.summaryLines, this.windowWidth - 150 - vp2px(50)))
.fontSize(14)
... ... @@ -278,17 +229,8 @@ export struct PlayerTitleView {
this.isOpenDetail = true
this.dialogController?.open()
})
}
// .position({ x: 0, y: 0 })
.padding({
left: 0,
right: 6,
top: 0,
bottom: 8
})
if (this.isOverLines) {
Text() {
Span('全文')
if (this.isOverLines) {
Span('... 全文')
.fontColor('#99FFFFFF')
.fontWeight(400)
.fontFamily('PingFang SC-Regular')
... ... @@ -309,94 +251,80 @@ export struct PlayerTitleView {
this.isOpenDetail = true
this.dialogController?.open()
})
}
.textAlign(TextAlign.Center)
// .width('100%')
.position({ x: '100%', y: this.summaryLines*23 }) //行高+margin
.translate({ x: '-100%', y: '-100%' })
// .markAnchor({ x: '100%', y: '100%' })
.padding({
left: 0,
right: 6,
top: 0,
bottom: 6
})
}
.padding({
left: 0, //6
right: 6,
top: 0, //4
bottom: 8
})
}
.width('100%')
// }
Text(DateTimeUtils.formatDate(new Date(this.contentDetailData?.publishTime).getTime(),
DateTimeUtils.PATTERN_DATE_TIME_HYPHEN_MM))
.fontSize(12)
.fontColor(Color.White)
.opacity(0.7)
.lineHeight(16)
.fontWeight(400)
.fontFamily('PingFang SC-Regular')
.margin({ top: 8, bottom: 8 })
}
.width(this.windowWidth - 150 + 'px')
.padding({ left: 16, right: 22 })
.alignItems(HorizontalAlign.Start)
.visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible)
}
/**
* 标题
* */
@Builder
titleBuilder() {
// Stack({ alignContent: this.isTitleOverLines ? Alignment.BottomEnd : Alignment.Start }) {
Stack({ alignContent: Alignment.TopStart }) {
Text() {
Span(this.clipTitleText(this.getTitle(), 16, 4, this.windowWidth - 234 - vp2px(50)))
.fontSize(16)
.fontColor(Color.White)
.lineHeight(22)
Text() {
Span(this.clipTitleText(this.getTitle(), 16, 4, this.windowWidth - 234 - vp2px(50)))
.fontSize(16)
.fontColor(Color.White)
.lineHeight(22)
.fontWeight(600)
.fontFamily('PingFang SC-Regular')
if (this.isTitleOverLines) {
Span('... 全文')
.fontColor('#99FFFFFF')
.fontWeight(600)
.fontFamily('PingFang SC-Regular')
.fontSize(12)
.onClick(() => {
this.isOpenDetail = true
this.dialogController?.open()
})
ImageSpan($r('app.media.comment_unfold_svg'))
.width(14)
.height(14)
.objectFit(ImageFit.Fill)
.verticalAlign(ImageSpanAlignment.BOTTOM)
.margin({ bottom: 1 })// .padding({
// bottom: 4
// })
.onClick(() => {
this.isOpenDetail = true
this.dialogController?.open()
})
}
// .position({ x: 0, y: 0 })
.onAreaChange((oldArea: Area, newArea: Area) => {
//console.info(`cj2024 titleLines = ${newArea.height as number} line = ${(newArea.height as number) / 20}`)
this.titleLines = Math.floor((newArea.height as number) / 22) // 22是行高
//console.info(`cj2024 titleLines = ${this.titleLines}`)
this.updateSummaryLines()
})
.maxLines(4)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.padding({
left: 0, //6
right: 6,
top: 0, //4
bottom: 8
})
Text() {
if (this.isTitleOverLines) {
Span('全文')
.fontColor('#99FFFFFF')
.fontWeight(600)
.fontFamily('PingFang SC-Regular')
.fontSize(12)
.onClick(() => {
this.isOpenDetail = true
this.dialogController?.open()
})
ImageSpan($r('app.media.comment_unfold_svg'))
.width(14)
.height(14)
.objectFit(ImageFit.Fill)
.verticalAlign(ImageSpanAlignment.BOTTOM)
.margin({ bottom: 1 })// .padding({
// bottom: 4
// })
.onClick(() => {
this.isOpenDetail = true
this.dialogController?.open()
})
}
}
.textAlign(TextAlign.Center)
// .width('100%')
.position({ x: '100%', y: this.titleLines*23 }) //行高+margin
.translate({ x: '-100%', y: '-100%' })
// .position({ x: '100%', y: '100%' })
// .markAnchor({ x: '100%', y: '100%' })
.padding({
left: 0, //6
right: 6,
top: 0, //4
bottom: 8
})
}
.width('100%')
.onAreaChange((oldArea: Area, newArea: Area) => {
//console.info(`cj2024 titleLines = ${newArea.height as number} line = ${(newArea.height as number) / 20}`)
this.titleLines = Math.floor((newArea.height as number) / 22) // 22是行高
//console.info(`cj2024 titleLines = ${this.titleLines}`)
this.updateSummaryLines()
})
.padding({
left: 0, //6
right: 6,
top: 0, //4
bottom: 8
})
}
}
... ...
... ... @@ -3,4 +3,6 @@ export { add } from "./src/main/ets/utils/Calc"
export { HWLocationUtils } from './src/main/ets/location/HWLocationUtils'
// export { WDPushNotificationManager } from "./src/main/ets/notification/WDPushNotificationManager"
export { GetuiPush } from "./src/main/ets/getuiPush/GetuiPush"
\ No newline at end of file
export { GetuiPush } from "./src/main/ets/getuiPush/GetuiPush"
export {VoiceRecoginizer} from './src/main/ets/voiceRecognizer/VoiceRecoginizer'
\ No newline at end of file
... ...
... ... @@ -8,6 +8,7 @@
"packageType": "InterfaceHar",
"dependencies": {
"library": "file:./src/main/ets/getuiPush/GT-HM-1.0.4.har",
"neonui":"file:./src/main/ets/voiceRecognizer/neonui.har",
"wdConstant": "file:../../commons/wdConstant",
"wdLogin": "file:../../features/wdLogin",
"wdKit": "file:../../commons/wdKit",
... ...
import { audio } from '@kit.AudioKit'
import { ArkTSUtils } from '@kit.ArkTS'
import {getVoicebufferDataLengthByte} from 'neonui'
import process from '@ohos.process'
import { NativeNui } from 'neonui'
let TAG:string = "AudioCapturer"
//音频采集器类,主要用于采集音频,写入文件
export default class AudioCapturer{
static lock_:ArkTSUtils.locks.AsyncLock = new ArkTSUtils.locks.AsyncLock()
//static voiceBuffer2:Int16Array=new Int16Array(0);
static voiceBuffer1:ArrayBuffer[] = [];
//static voiceBuffer:ArrayBuffer[] =[];
static async clearVoiceArrayBuffer(){
await AudioCapturer.lock_.lockAsync( ()=>{
if (AudioCapturer.voiceBuffer1!==undefined){
AudioCapturer.voiceBuffer1= []
}
console.info(`AudioCapturer clearVoiceArrayBuffer, then voiceBuffer1 size ${AudioCapturer.voiceBuffer1.length}`);
})
}
static async setVoiceArrayBuffer(voice:ArrayBuffer){
console.info(`AudioCapturer setVoiceArrayBuffer, 1 voiceBuffer1 size ${AudioCapturer.voiceBuffer1.length}`);
AudioCapturer.lock_.lockAsync( ()=>{
if (AudioCapturer.voiceBuffer1==undefined){
AudioCapturer.voiceBuffer1= []
}
AudioCapturer.voiceBuffer1.push(voice)
console.info(`AudioCapturer setVoiceArrayBuffer, 3 voiceBuffer1 size ${AudioCapturer.voiceBuffer1.length}`);
})
console.info(`AudioCapturer setVoiceArrayBuffer, 2 voiceBuffer1 size ${AudioCapturer.voiceBuffer1.length}`);
}
static async getVoiceArrayBuffer(buffer:ArrayBuffer):Promise<number>{
let ret:number;
let outbuferleng=buffer.byteLength;
let buffer_out_typedarray = new Int8Array(buffer)
let offset = 0
console.log("AudioCapturer enter getVoiceArrayBuffer");
return await AudioCapturer.lock_.lockAsync( ()=>{
console.info(`AudioCapturer womx getVoiceArrayBuffer, outbuferleng ${buffer.byteLength}.with length ${AudioCapturer.voiceBuffer1.length}`);
// while(AudioRenderer.voiceBuffer1.length <= 0){
// if(AudioRenderer.flagVoiceEnd==true) {
// }
// }
if (AudioCapturer.voiceBuffer1.length > 0) {
let voice_length = getVoicebufferDataLengthByte(AudioCapturer.voiceBuffer1)
if (voice_length>=outbuferleng) {
let bytes_need = outbuferleng
while(bytes_need>0){
let voice1st = AudioCapturer.voiceBuffer1.shift()
if (voice1st==undefined ){
} else {
let out_typedbuffer:Int8Array;
console.info(`AudioCapturer womx voice1st.byteLength=${voice1st.byteLength} vs bytes_need=${bytes_need}`);
if (voice1st.byteLength > bytes_need) {
let out_buffer = voice1st.slice(0,bytes_need)
out_typedbuffer = new Int8Array(out_buffer)
let save_buffer = voice1st.slice(bytes_need)
AudioCapturer.voiceBuffer1.unshift(save_buffer)
} else {
out_typedbuffer = new Int8Array(voice1st)
}
for (let i = 0; i < out_typedbuffer.byteLength; i++) {
buffer_out_typedarray[offset + i] = out_typedbuffer[i]
}
bytes_need -= out_typedbuffer.byteLength
offset += out_typedbuffer.byteLength
console.info(`AudioCapturer womx bytes_need=${bytes_need}`);
}
}
} else {
ret = 0
console.error(`AudioCapturer error getVoiceArrayBuffer, outbuferleng 0.with ringbuffer voicebytes length ${voice_length}`);
}
} else {
ret = 0;
console.error(`AudioCapturer error getVoiceArrayBuffer, outbuferleng 0.with ringbuffer.length ${AudioCapturer.voiceBuffer1.length}<=0`);
}
return ret
})
}
static getVoiceArrayBuffer1(buffer:ArrayBuffer):number{
let ret:number=0;
let outbuferleng=buffer.byteLength;
let buffer_out_typedarray = new Int8Array(buffer)
let offset = 0
console.log("AudioCapturer enter getVoiceArrayBuffer");
console.info(`AudioCapturer womx getVoiceArrayBuffer, outbuferleng ${buffer.byteLength}.with length ${AudioCapturer.voiceBuffer1.length}`);
// while(AudioRenderer.voiceBuffer1.length <= 0){
// if(AudioRenderer.flagVoiceEnd==true) {
// }
// }
if (AudioCapturer.voiceBuffer1.length > 0) {
let voice_length = getVoicebufferDataLengthByte(AudioCapturer.voiceBuffer1)
if (voice_length>=outbuferleng) {
let bytes_need = outbuferleng
while(bytes_need>0){
let voice1st = AudioCapturer.voiceBuffer1.shift()
if (voice1st==undefined ){
break
} else {
let out_typedbuffer:Int8Array;
console.info(`AudioCapturer womx voice1st.byteLength=${voice1st.byteLength} vs bytes_need=${bytes_need}`);
if (voice1st.byteLength > bytes_need) {
let out_buffer = voice1st.slice(0,bytes_need)
out_typedbuffer = new Int8Array(out_buffer)
let save_buffer = voice1st.slice(bytes_need)
AudioCapturer.voiceBuffer1.unshift(save_buffer)
} else {
out_typedbuffer = new Int8Array(voice1st)
}
for (let i = 0; i < out_typedbuffer.byteLength; i++) {
buffer_out_typedarray[offset + i] = out_typedbuffer[i]
}
bytes_need -= out_typedbuffer.byteLength
offset += out_typedbuffer.byteLength
console.info(`AudioCapturer womx bytes_need=${bytes_need}`);
}
}
ret = outbuferleng - bytes_need
} else {
ret = 0
console.error(`AudioCapturer error getVoiceArrayBuffer, outbuferleng 0.with ringbuffer voicebytes length ${voice_length}`);
}
} else {
ret = 0;
console.error(`AudioCapturer error getVoiceArrayBuffer, outbuferleng 0.with ringbuffer.length ${AudioCapturer.voiceBuffer1.length}<=0`);
}
return ret;
}
//定义音频流信息
static audioStreamInfo:audio.AudioStreamInfo = {
//彩样率
samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_16000,
//通道数
channels:audio.AudioChannel.CHANNEL_1,
//采样格式
sampleFormat:audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
//编码格式
encodingType:audio.AudioEncodingType.ENCODING_TYPE_RAW
}
//定义音频采集器信息
static audioCapturerInfo:audio.AudioCapturerInfo={
//音源类型
source:audio.SourceType.SOURCE_TYPE_MIC,
//音频采集器标志
capturerFlags:0
}
//定义音频采集器
static audioCapturer:audio.AudioCapturer
static g_asrinstance:NativeNui
//初始化音频采集器
static async init(asrinstance:NativeNui){
AudioCapturer.g_asrinstance = asrinstance
AudioCapturer.audioCapturer = await audio.createAudioCapturer({
//需要音频流信息和音频采集器信息
streamInfo:AudioCapturer.audioStreamInfo,
capturerInfo:AudioCapturer.audioCapturerInfo
})
if (AudioCapturer.audioCapturer !== undefined) {
await AudioCapturer.audioCapturer.on('readData', AudioCapturer.readDataCallback);
}
}
static readDataCallback = (buffer: ArrayBuffer) => {
console.log(`${TAG} read data bytelength is ${buffer.byteLength}. uid[${process.uid}] pid[${process.pid}] tid[${process.tid}]`);
//AudioCapturer.setVoiceArrayBuffer(buffer)
AudioCapturer.g_asrinstance.updateAudio(buffer,false)
}
//开始采集音频
static async start(){
await AudioCapturer.clearVoiceArrayBuffer()
if (AudioCapturer.audioCapturer) {
let stateGroup = [audio.AudioState.STATE_PREPARED,
audio.AudioState.STATE_PAUSED,
audio.AudioState.STATE_STOPPED];
if (stateGroup.indexOf(AudioCapturer.audioCapturer.state.valueOf()) === -1) {
// 当且仅当状态为STATE_PREPARED、STATE_PAUSED和STATE_STOPPED之一时才能启动采集
console.error(`${TAG}: start failed`);
console.error('Capturer is not STATE_PREPARED or STATE_PAUSED or STATE_STOPPED');
return;
}
//开始录音
await AudioCapturer.audioCapturer.start()
console.log(`${TAG} start done`);
} else {
console.log(`${TAG} start with AudioCapturer.audioCapturer is null`);
return
}
}
//停止采集音频
static async stop(){
if (AudioCapturer.audioCapturer) {
// 只有采集器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止
if (AudioCapturer.audioCapturer.state === audio.AudioState.STATE_RUNNING ||
AudioCapturer.audioCapturer.state === audio.AudioState.STATE_PAUSED
) {
console.error(`Capturer state is ${AudioCapturer.audioCapturer.state}`);
await AudioCapturer.audioCapturer.stop()/*.then( (value)=>{
console.log("result of Capturer stop is " + value);
}); // 停止采集*/
console.error('Capturer stop done');
} else {
console.error('Capturer is not running or paused');
return;
}
} else {
console.log(`${TAG} stop with AudioCapturer.audioCapturer is null`);
return
}
await AudioCapturer.clearVoiceArrayBuffer()
}
// 释放资源
static async release() {
if (AudioCapturer.audioCapturer) {
// 采集器状态不是STATE_RELEASED或STATE_NEW状态,才能release
if (AudioCapturer.audioCapturer.state === audio.AudioState.STATE_RELEASED ||
AudioCapturer.audioCapturer.state === audio.AudioState.STATE_NEW) {
console.info('Capturer already released');
return;
}
await AudioCapturer.audioCapturer.release()
}
}
}
... ...
import {NativeNui,Constants,MapToJson,INativeNuiCallback, AsrResult, KwsResult} from 'neonui'
import { PermissionUtils,DeviceUtil, Logger, DateTimeUtils } from 'wdKit';
import AudioCapturer from './AudioCapture';
import { common, Permissions } from '@kit.AbilityKit';
import { NetLayerVoiceRecoginizerToken } from 'wdBean';
import { HttpUrlUtils,ResponseDTO } from 'wdNetwork'
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'
class NativeNuiCallbackHandle implements INativeNuiCallback {
asrspeechrealtimeResultOld:string=""
asrmessage:string;
message:string;
nuiCallback?:(result: string) => void
constructor() {
this.asrmessage=""
this.message=""
}
onNuiEventCallback(event:Constants.NuiEvent, resultCode:number, arg2:number, kwsResult:KwsResult,
asrResult:AsrResult):void {
let asrinfo:string = ""
// console.log("onUsrNuiEventCallback last this.asrmessage is " + this.asrmessage)
// console.log("onUsrNuiEventCallback this is " + JSON.stringify(this))
// console.log("onUsrNuiEventCallback event is " + event)
if (event === Constants.NuiEvent.EVENT_ASR_RESULT){
this.message = "EVENT_ASR_RESULT"
this.asrspeechrealtimeResultOld=""
} else if (event === Constants.NuiEvent.EVENT_ASR_PARTIAL_RESULT || event === Constants.NuiEvent.EVENT_SENTENCE_END){
if (event === Constants.NuiEvent.EVENT_ASR_PARTIAL_RESULT ) {
this.message = "EVENT_ASR_PARTIAL_RESULT"
} else if(event === Constants.NuiEvent.EVENT_SENTENCE_END){
this.message = "EVENT_SENTENCE_END"
}
} else if (event === Constants.NuiEvent.EVENT_ASR_ERROR){
this.message = "EVENT_ASR_ERROR"
} else if (event === Constants.NuiEvent.EVENT_MIC_ERROR){
this.message = "EVENT_MIC_ERROR"
} else if (event === Constants.NuiEvent.EVENT_DIALOG_EX){
this.message = "EVENT_DIALOG_EX"
}
if (asrResult) {
asrinfo = asrResult.asrResult
//console.log(`asrinfo string is ${asrinfo}`)
if (asrinfo) {
try {
let asrresult_json:object|null = JSON.parse(asrResult.asrResult)
//console.log(JSON.stringify(asrresult_json))
if (asrresult_json) {
let payload:object|null = asrresult_json["payload"];
if (payload) {
//console.log(JSON.stringify(payload))
this.asrmessage = this.asrspeechrealtimeResultOld + payload["result"];
if(event === Constants.NuiEvent.EVENT_SENTENCE_END){
// console.info("onUsrNuiEventCallback EVENT_SENTENCE_END")
this.asrspeechrealtimeResultOld = this.asrmessage
}
if (this.nuiCallback) {
this.nuiCallback(this.asrmessage)
}
}
}
} catch (e){
// console.error("got asrinfo not json, so donot fresh asrinfo." + JSON.stringify(e))
}
}
}
// console.info(`womx onUsrNuiEventCallback(${event}, ${resultCode},${arg2}, kwsResult:${kwsResult},asrResult:"${this.asrmessage}") done`)
}
onNuiNeedAudioData(buffer:ArrayBuffer):number {
// console.info(`womx onUsrNuiNeedAudioData(buffer length = ${buffer.byteLength})`)
// console.log(`womx onUsrNuiNeedAudioData uid[${process.uid}] pid[${process.pid}] tid[${process.tid}]`);
let num:number = 0;
if (true){
if (true){
//由于录音回调是异步的,所以此处获取共享数据需要加锁/并保持同步 是较难的,需要修改asr回调为用户主动推送方式
num = AudioCapturer.getVoiceArrayBuffer1(buffer)
} else {
let flag_returned:boolean = false
try {
AudioCapturer.getVoiceArrayBuffer(buffer).then( (result:number)=>{
console.log("womx onUsrNuiNeedAudioData getVoiceArrayBuffer done, result="+result)
num = result
flag_returned=true
})
} catch(e ){
flag_returned=true
}
while(flag_returned==false){
console.log("womx onUsrNuiNeedAudioData waiting ... num="+num)
}
}
}
// console.info(`womx onUsrNuiNeedAudioData(buffer length = ${buffer.byteLength}) return ${num}}`)
return num;//buffer.byteLength;
}
onNuiAudioStateChanged(state:Constants.AudioState):void {
// console.info(`womx onUsrNuiAudioStateChanged(${state})`)
if (state === Constants.AudioState.STATE_OPEN){
// console.info(`womx onUsrNuiAudioStateChanged(${state}) audio recorder start`)
//AudioCapturer.init(g_asrinstance)
AudioCapturer.start()
// console.info(`womx onUsrNuiAudioStateChanged(${state}) audio recorder start done`)
} else if (state === Constants.AudioState.STATE_CLOSE){
// console.info(`womx onUsrNuiAudioStateChanged(${state}) audio recorder close`)
AudioCapturer.stop()
//AudioCapturer.release()
// console.info(`womx onUsrNuiAudioStateChanged(${state}) audio recorder close done`)
} else if (state === Constants.AudioState.STATE_PAUSE){
// console.info(`womx onUsrNuiAudioStateChanged(${state}) audio recorder pause`)
AudioCapturer.stop()
//AudioCapturer.release()
// console.info(`womx onUsrNuiAudioStateChanged(${state}) audio recorder pause done`)
}
}
onNuiAudioRMSChanged(val:number):number{
// console.info(`womx onNuiAudioRMSChanged(${val})`)
return 0;
}
clearAsrInfo(){
this.asrmessage = ""
}
}
const TAG = 'VoiceRecoginizer'
export class VoiceRecoginizer {
private static MICROPHONEMISSION: Permissions = 'ohos.permission.MICROPHONE'
private static READMEDIA: Permissions = 'ohos.permission.READ_IMAGEVIDEO'
private static INTENT: Permissions = "ohos.permission.INTERNET"
private static WRITE_MEDIA: Permissions = "ohos.permission.WRITE_IMAGEVIDEO"
private static appKey = "EospGmM6mdPljjjm"
private static url = "wss://nls-gateway.cn-shanghai.aliyuncs.com:443/ws/v1"
private authToken?: NetLayerVoiceRecoginizerToken
private vadMode: boolean = false
private cbhandle: NativeNuiCallbackHandle = new NativeNuiCallbackHandle()
private g_asrinstance: NativeNui = new NativeNui(Constants.ModeType.MODE_DIALOG, "asr1")
private static manager: VoiceRecoginizer
public static sharedManager(): VoiceRecoginizer {
if (!VoiceRecoginizer.manager) {
VoiceRecoginizer.manager = new VoiceRecoginizer()
}
return VoiceRecoginizer.manager
}
voiceRecoginizerResult?:(result: string) => void
// public voiceRecoginzerResult:(result: string) => void
genParams():string {
let params:string = "";
let nls_config:Map<string, string|number|boolean|object> = new Map();
nls_config.set("enable_intermediate_result", true);
//参数可根据实际业务进行配置
//接口说明可见: https://help.aliyun.com/document_detail/173298.html
//查看 2.开始识别
//由于对外的SDK不带有本地VAD模块(仅带有唤醒功能的SDK具有VAD模块),
//若要使用VAD模式,则需要设置nls_config参数启动在线VAD模式(见genParams())
if (this.vadMode) {
nls_config.set("enable_voice_detection", true);
nls_config.set("max_start_silence", 10000);
nls_config.set("max_end_silence", 800);
} else {
nls_config.set("enable_voice_detection", false);
}
nls_config.set("enable_punctuation_prediction", true);
nls_config.set("enable_inverse_text_normalization", true);
// nls_config.set("customization_id", "test_id");
// nls_config.set("vocabulary_id", "test_id");
// nls_config.set("sample_rate", 16000);
// nls_config.set("sr_format", "opus");
let parameters:Map<string, string|number|boolean|object> = new Map();
parameters.set("nls_config", Object( JSON.parse(MapToJson(nls_config)) ) );
//一句话识别
// console.log("start asr for 一句话识别")
parameters.set("service_type", Constants.kServiceTypeASR); // 必填
//如果有HttpDns则可进行设置
//parameters.put("direct_ip", Utils.getDirectIp());
params = MapToJson(parameters);//parameters.toString();
console.log("configinfo genParams" + params)
return params;
}
genInitParams(workpath:string, debugpath:string):string {
let str:string = "";
//获取token方式:
let object:Map<string, string|number|boolean|object> = new Map();
//账号和项目创建
// ak_id ak_secret app_key如何获得,请查看https://help.aliyun.com/document_detail/72138.html
object.set("app_key",VoiceRecoginizer.appKey); // 必填
//方法1:
// 首先ak_id ak_secret app_key如何获得,请查看https://help.aliyun.com/document_detail/72138.html
// 然后请看 https://help.aliyun.com/document_detail/466615.html 使用其中方案一获取临时凭证
// 此方案简介: 远端服务器生成具有有效时限的临时凭证, 下发给移动端进行使用, 保证账号信息ak_id和ak_secret不被泄露
// 获得Token方法(运行在APP服务端): https://help.aliyun.com/document_detail/450255.html?spm=a2c4g.72153.0.0.79176297EyBj4k
if (this.authToken) {
object.set("token", this.authToken.accessToken)
}
//方法2:
// STS获取临时凭证方法暂不支持
//方法3:(强烈不推荐,存在阿里云账号泄露风险)
// 参考Auth类的实现在端上访问阿里云Token服务获取SDK进行获取。请勿将ak/sk存在本地或端侧环境。
// 此方法优点: 端侧获得Token, 无需搭建APP服务器。
// 此方法缺点: 端侧获得ak/sk账号信息, 极易泄露。
// JSONObject object = Auth.getAliYunTicket();
object.set("device_id", DeviceUtil.clientId()/*Utils.getDeviceId()*/); // 必填, 推荐填入具有唯一性的id, 方便定位问题
object.set("url", VoiceRecoginizer.url); // 默认
object.set("workspace", workpath); // 必填, 且需要有读写权限
// object.set("sample_rate", "16000");
// object.set("format", "pcm");
//当初始化SDK时的save_log参数取值为true时,该参数生效。表示是否保存音频debug,该数据保存在debug目录中,需要确保debug_path有效可写。
// object.put("save_wav", "true");
//debug目录,当初始化SDK时的save_log参数取值为true时,该目录用于保存中间音频文件。
object.set("debug_path", debugpath);
// FullMix = 0 // 选用此模式开启本地功能并需要进行鉴权注册
// FullCloud = 1
// FullLocal = 2 // 选用此模式开启本地功能并需要进行鉴权注册
// AsrMix = 3 // 选用此模式开启本地功能并需要进行鉴权注册
// AsrCloud = 4
// AsrLocal = 5 // 选用此模式开启本地功能并需要进行鉴权注册
//一句话识别
// console.log("init asr for 一句话识别")
object.set("service_mode", Constants.ModeAsrCloud); // 必填
str = MapToJson(object)
// console.info("configinfo genInitParams:" + str);
return str;
}
async AsrInit(path:string, filePath:string): Promise<number> {
//console.log("AsrInit this is " + JSON.stringify(this))
// console.info("AsrInit path: " + path);
//获取工作路径, 这里获得当前nuisdk.aar中assets路径
let asset_path:string = path+"/resources_cloud"
// fs.stat(asset_path).catch((error: BusinessError) => {
// if (error.code = 13900002) {
// fs.mkdirSync(asset_path)
// }
// })
// fs.mkdirSync(asset_path)
// try {
// await this.checkPath(asset_path)
this.cbhandle.nuiCallback = (result: string) => {
if (this.voiceRecoginizerResult) {
this.voiceRecoginizerResult(result)
}
}
let parameters: string = ""
// this.genInitParams(asset_path,filePath)
// .then(parameters) {
//
// }
await this.getToken()
let ret:number = this.g_asrinstance.initialize(this.cbhandle, this.genInitParams(asset_path,filePath), Constants.LogLevel.LOG_LEVEL_NONE, false);
// console.info("result = " + ret);
if (ret == Constants.NuiResultCode.SUCCESS) {
} else {
// Logger.debug(TAG,"语音识别初始化失败")
//final String msg_text = Utils.getMsgWithErrorCode(ret, "init");
//抛出错误异常信息。
/*
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(SpeechRecognizerActivity.this, msg_text, Toast.LENGTH_LONG).show();
}
});
*/
}
// return ret
// }
// catch {
// return -1;
// }
//初始化SDK,注意用户需要在Auth.getAliYunTicket中填入相关ID信息才可以使用。
return ret
}
// checkPath(asset_path:string):Promise<void> {
// return new Promise<void> ((success,fail) => {
// fs.stat(asset_path).catch((error: BusinessError) => {
// if (error.code = 13900002) {
// fs.mkdirSync(asset_path)
// success()
// return
// }
// success()
// })
// })
// }
startDialog():number {
// console.log(`womx startDialog uid[${process.uid}] pid[${process.pid}] tid[${process.tid}]`);
this.cbhandle.clearAsrInfo()
//由于对外的SDK不带有本地VAD模块(仅带有唤醒功能的SDK具有VAD模块),
//若要使用VAD模式,则需要设置nls_config参数启动在线VAD模式(见genParams())
let vad_mode:Constants.VadMode = Constants.VadMode.TYPE_P2T;
if (this.vadMode) {
//TYPE_VAD: SDK自动判断句尾结束识别。(此功能仅存在于<029>带唤醒功能的SDK)
//vad_mode = Constants.VadMode.TYPE_VAD;
// console.info("使用Voice Active Detection模式");
} else {
//TYPE_P2T: 有用户主动stop()以告知识别完成
//vad_mode = Constants.VadMode.TYPE_P2T;
// console.info("使用Push To Talk模式");
}
//设置相关识别参数,具体参考API文档
// initialize()之后startDialog之前调用
this.g_asrinstance.setParams(this.genParams());
AudioCapturer.init(this.g_asrinstance)
let ret:number = this.g_asrinstance.startDialog(vad_mode, "");
// console.info("start done . ret = ", ret);
if (ret != 0) {
// console.info("call startDialog return error. ", ret);
}
return ret
}
stop() {
this.cbhandle.clearAsrInfo()
AudioCapturer.stop()
}
static async checkPemmission (context: common.UIAbilityContext) {
let grant = await PermissionUtils.checkPermissions(VoiceRecoginizer.WRITE_MEDIA)
if (grant) {
///初始化SDK
// Logger.debug("已申请过权限")
return
}
// let context = getContext()
let requestGrant = await PermissionUtils.reqPermissionsFromUser([VoiceRecoginizer.MICROPHONEMISSION
,VoiceRecoginizer.READMEDIA
,VoiceRecoginizer.WRITE_MEDIA
,VoiceRecoginizer.INTENT],context)
if (requestGrant) {
///初始化SDK
}
// return false
}
private async getToken():Promise<NetLayerVoiceRecoginizerToken | undefined> {
return new Promise<NetLayerVoiceRecoginizerToken|undefined>((success,fail) => {
if (this.authToken && this.authToken.accessToken.length > 0) {
if (Date.now() < this.authToken.expireTime - 60 * 1000) {
success(this.authToken)
return
}
}
HttpRequest.get<ResponseDTO<NetLayerVoiceRecoginizerToken>>(
HttpUrlUtils.getVoiceRecognizerSDKAuthToken()
).then((res: ResponseDTO<NetLayerVoiceRecoginizerToken>) => {
if (res.code != 0) {
fail(res.message)
return
}
this.authToken = res.data
success(res.data)
})
})
}
}
\ No newline at end of file
... ...
{
"cei":{
"cei_param_version":"2.2.0",
"cei_param_device_type":"car",
"cei_param_reco_mode":0,
"cei_param_log_level":2,
"cei_param_debug_path":"asr_debug",
"cei_param_is_debug_enable":false,
"cei_param_resource_path":"",
"cei_param_resource_is_multi_language":false,
"cei_param_audio_format_str":"16k16bitmono",
"cei_param_mcs_mode":0,
"cei_param_work_mode":0,
"cei_param_max_cache_frames":1000,
"cei_param_is_aec_bf_active":false,
"cei_param_is_agc_active":false,
"cei_param_is_vad_active":true,
"cei_param_is_kws_active":true,
"cei_param_is_sr_active":true
},
"asp":{
"asp_param_is_process_parallel":false,
"asp_param_is_input_debug_enable":false,
"asp_param_is_output_debug_enable":false,
"asp_param_debug_path":"asr_debug",
"asp_param_is_callback_enable":false,
"asp_param_callback_period_frames":5
},
"vad":{
"vad_param_is_input_debug_enable":false,
"vad_param_is_output_debug_enable":false,
"vad_param_debug_path":"asr_debug",
"vad_param_asleep_speech_noise_thres":-0.8,
"vad_param_awake_speech_noise_thres":-0.5,
"vad_param_asleep_max_speech_segment_time":300000,
"vad_param_awake_max_speech_segment_time":60000,
"vad_param_asleep_block_size":3,
"vad_param_awake_block_size":3,
"vad_param_front_timeout_interval":8000,
"vad_param_tail_timeout_interval":800,
"vad_param_is_detect_start":true,
"vad_param_is_detect_end":true
},
"kws":{
"kws_param_is_input_debug_enable":false,
"kws_param_is_output_debug_enable":false,
"kws_param_debug_path":"asr_debug",
"kws_param_is_process_parallel":false,
"kws_param_front_extend_frames":10,
"kws_param_tail_extend_frames":5,
"kws_param_encoder_type_str":"opu",
"kws_param_encoder_bitrate":16000,
"kws_param_encoder_complexity":2,
"kws_param_callback_period_ms":100,
"kws_param_max_frames_per_callback":25,
"kws_param_max_bytes_per_callback":16000
},
"sr":{
"sr_param_is_input_debug_enable":false,
"sr_param_is_output_debug_enable":false,
"sr_param_debug_path":"asr_debug",
"sr_param_is_itn_enable":true,
"sr_param_is_do_conf_filter":false,
"sr_param_is_process_parallel":true,
"sr_param_is_need_result":false,
"sr_param_is_need_voice":true,
"sr_param_ngram_conf_thres":65.0,
"sr_param_jsgf_conf_thres":65.0,
"sr_param_encoder_type_str":"opu",
"sr_param_encoder_bitrate":16000,
"sr_param_encoder_complexity":2,
"sr_param_callback_period_ms":100,
"sr_param_max_frames_per_callback":25,
"sr_param_max_bytes_per_callback":16000
},
"ou":{
"oss_upload_param_is_enable":false,
"oss_upload_param_asp_in":false,
"oss_upload_param_asp_out":false,
"oss_upload_param_vad_in":false,
"oss_upload_param_vad_out":false,
"oss_upload_param_kws_in":false,
"oss_upload_param_kws_susp_in":false,
"oss_upload_param_kws_out":false,
"oss_upload_param_kws_susp_out":false,
"oss_upload_param_sr_in":false
}
}
... ...
{
"device_type":"phone",
"assets_version":"1.1.20190902",
"nui_config":{
"service_mode":"kModeFullCloud",
"log_level":"kLogLevelVerbose",
"enable_recorder_by_user":true,
"enable_callback_recording":false,
"enable_dialog":false
},
"nls_config":{
"debug_level":4,
"sr_format":"opus",
"sample_rate":16000,
"dns_timeout":5000,
"vocab_default_weight":2
},
"audio_config":{
"debug":"none",
"16k_audio":{
"name":"16kmono16bit",
"id":0,
"mic":{
"name":"16kmono16bit",
"debug_heap_pollution":false,
"read_cnt":0,
"sample_rate":16000,
"bits_per_sample":16,
"channels":1,
"recording_interval":10,
"cei_frame_time_len":20,
"channel_mask":"kAMChannalMaskNone",
"format_type":"kAMDataFormatPcmInterleaved",
"endianness":"kAMByteOrderLittleEndian"
}
},
"8k_audio":{
"name":"8kmono16bit",
"id":0,
"mic":{
"name":"8kmono16bit",
"debug_heap_pollution":false,
"read_cnt":0,
"sample_rate":8000,
"bits_per_sample":16,
"channels":1,
"recording_interval":10,
"cei_frame_time_len":20,
"channel_mask":"kAMChannalMaskNone",
"format_type":"kAMDataFormatPcmInterleaved",
"endianness":"kAMByteOrderLittleEndian"
}
}
}
}
... ...
{
"device_type":"car",
"mode_type":2,
"smart_engine":3,
"encode_type":"pcm",
"debug_info":{
"debug_level":0,
"debug_path":"/sdcard/tmp"
},
"common_info":{
"pitch_level":0,
"speed_level":1.0,
"volume":1.0,
"play_audio":0,
"callback_raw_data":1,
"sample_rate":16000,
"font_name":"xiaoyun",
"wait_time":2000
},
"cache":{
"on":true,
"max_cache_size":2000000,
"save_path":"/sdcard/mit/"
},
"font":{
"on":false,
"mode":"cmd",
"save_path":"/sdcard/mit"
}
}
... ...
... ... @@ -35,5 +35,6 @@ export enum Events {
STATE_CHANGE = 'stateChange',
VIDEO_SIZE_CHANGE = "videoSizeChange",
TIME_UPDATE = 'timeUpdate',
ERROR = 'error'
ERROR = 'error',
AUDIOINTERRUPT = 'audioInterrupt'
}
\ No newline at end of file
... ...
... ... @@ -85,6 +85,7 @@ export class WDPlayerController {
*/
private bindState() {
this.avPlayer?.on(Events.STATE_CHANGE, async (state) => {
//console.info(TAG,`cj2024 state = ${state}`)
if (this.avPlayer == null) {
return
}
... ... @@ -179,6 +180,49 @@ export class WDPlayerController {
this.videoWidth = width
this.videoHeight = height
})
this.avPlayer?.on(Events.AUDIOINTERRUPT, async(interruptEvent: audio.InterruptEvent) => {
//https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/media/audio/audio-playback-concurrency.md#%E5%A4%84%E7%90%86%E9%9F%B3%E9%A2%91%E7%84%A6%E7%82%B9%E4%BA%8B%E4%BB%B6
if (interruptEvent.forceType === audio.InterruptForceType.INTERRUPT_FORCE) {
switch (interruptEvent.hintType) {
case audio.InterruptHint.INTERRUPT_HINT_RESUME:
await this.play()
break;
case audio.InterruptHint.INTERRUPT_HINT_PAUSE:
// 此分支表示系统已将音频流暂停(临时失去焦点),为保持状态一致,应用需切换至音频暂停状态
// 临时失去焦点:待其他音频流释放音频焦点后,本音频流会收到resume对应的音频打断事件,到时可自行继续播放
case audio.InterruptHint.INTERRUPT_HINT_STOP:
// 此分支表示系统已将音频流停止(永久失去焦点),为保持状态一致,应用需切换至音频暂停状态
// 永久失去焦点:后续不会再收到任何音频打断事件,若想恢复播放,需要用户主动触发。
// this.avPlayer?.play()
await this.pause()
break;
}
}else if (interruptEvent.forceType === audio.InterruptForceType.INTERRUPT_SHARE) {
// 共享打断类型(INTERRUPT_SHARE):应用可自主选择执行相关操作或忽略音频打断事件
switch (interruptEvent.hintType) {
case audio.InterruptHint.INTERRUPT_HINT_PAUSE:
case audio.InterruptHint.INTERRUPT_HINT_RESUME:
// 此分支表示临时失去焦点后被暂停的音频流此时可以继续播放,建议应用继续播放,切换至音频播放状态
// 若应用此时不想继续播放,可以忽略此音频打断事件,不进行处理即可
// 继续播放,此处主动执行start(),以标识符变量started记录start()的执行结果
// await audioRenderer.start().then(() => {
// started = true; // start()执行成功
// }).catch((err: BusinessError) => {
// started = false; // start()执行失败
// });
// // 若start()执行成功,则切换至音频播放状态
// if (started) {
// isPlay = true; // 此句为简化处理,代表应用切换至音频播放状态的若干操作
// } else {
// // 音频继续播放执行失败
// }
this.avPlayer?.play()
break;
default:
break;
}
}
})
}
public setXComponentController(controller: XComponentController) {
... ... @@ -271,10 +315,12 @@ export class WDPlayerController {
// if (this.avPlayer == null) {
// return
// }
//Logger.debug(TAG, "start play")
this.avPlayer?.prepare().then(() => {
this.avPlayer?.play()
}, (err: BusinessError) => {
console.error('Failed to prepare,error message is :' + err.message)
console.error(TAG,'Failed to prepare,error message is :' + err.message)
//this.avPlayer?.stop()
})
}
... ...
{"v":"5.6.10","fr":60,"ip":0,"op":90,"w":560,"h":560,"nm":"波纹","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"语音","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[12.98,14.416,0],"ix":1},"s":{"a":0,"k":[300,300,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.122,-0.519],[0,0],[-4.764,-0.045],[0,0],[-1.197,4.408],[0,0],[0,0],[-0.519,-0.123],[0,0],[0.123,-0.519],[0,0],[5.457,-0.527],[0,0],[0.008,-0.042],[0.016,-0.039],[0.023,-0.035],[0.03,-0.03],[0.035,-0.023],[0.039,-0.016],[0.041,-0.009],[0.042,0],[0,0],[0.041,0.008],[0.039,0.016],[0.036,0.024],[0.03,0.03],[0.023,0.035],[0.017,0.039],[0.008,0.041],[0,0.042],[0,0],[1.37,5.161],[0,0],[0,0],[-0.52,0.122],[0,0]],"o":[[0,0],[1.08,4.582],[0,0],[4.646,-0.044],[0,0],[0,0],[0.124,-0.519],[0,0],[0.519,0.123],[0,0],[-1.272,5.357],[0,0],[0,0.042],[-0.009,0.041],[-0.016,0.039],[-0.024,0.035],[-0.029,0.03],[-0.035,0.024],[-0.039,0.016],[-0.042,0.008],[0,0],[-0.042,0],[-0.042,-0.009],[-0.039,-0.016],[-0.035,-0.023],[-0.03,-0.03],[-0.024,-0.035],[-0.016,-0.04],[-0.009,-0.042],[0,0],[-5.308,-0.547],[0,0],[0,0],[-0.122,-0.519],[0,0],[0.52,-0.122]],"v":[[-10.101,0.773],[-10.027,1.085],[-0.095,9.016],[0.098,9.016],[9.945,1.421],[10.026,1.102],[10.1,0.79],[11.263,0.072],[11.89,0.221],[12.607,1.385],[12.532,1.697],[1.248,11.531],[1.248,13.523],[1.236,13.648],[1.199,13.768],[1.14,13.88],[1.059,13.977],[0.962,14.057],[0.851,14.118],[0.73,14.154],[0.604,14.167],[-0.684,14.167],[-0.809,14.154],[-0.93,14.118],[-1.042,14.057],[-1.139,13.977],[-1.219,13.88],[-1.279,13.77],[-1.315,13.648],[-1.328,13.523],[-1.328,11.523],[-12.446,2.027],[-12.534,1.676],[-12.608,1.363],[-11.889,0.202],[-11.263,0.053]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[0,0],[2.845,0],[0,-2.845],[0,0],[-2.846,0],[0,2.845]],"o":[[0,-2.845],[-2.846,0],[0,0],[0,2.845],[2.845,0],[0,0]],"v":[[5.112,-6.439],[-0.039,-11.59],[-5.191,-6.439],[-5.191,-1.288],[-0.039,3.865],[5.112,-1.288]],"c":true},"ix":2},"nm":"路径 2","mn":"ADBE Vector Shape - Group","hd":false},{"ind":2,"ty":"sh","ix":3,"ks":{"a":0,"k":{"i":[[0,0],[-4.268,0],[0,-4.268],[0,0],[4.268,0],[0,4.267]],"o":[[0,-4.268],[4.268,0],[0,0],[0,4.267],[-4.268,0],[0,0]],"v":[[-7.767,-6.439],[-0.04,-14.167],[7.687,-6.439],[7.687,-1.288],[-0.04,6.439],[-7.767,-1.288]],"c":true},"ix":2},"nm":"路径 3","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"合并路径 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[12.98,14.416],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"组 1","np":5,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"按钮","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":0,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":10,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":20,"s":[210,210]},{"t":30,"s":[210,210]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.929411764706,0.156862745098,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"按钮 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":0,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":10,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":20,"s":[210,210]},{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":30,"s":[210,210]},{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":90,"s":[210,210]},{"t":130,"s":[300,300]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0.929411764706,0.156862745098,0,1]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":90,"s":[1,0.683882236481,0.597104787827,1]},{"t":130,"s":[1,0.800000011921,0.745098054409,1]}],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"扩散圈","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.908],"y":[0]},"t":234,"s":[100]},{"t":240,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.59,0.59],"y":[1.003,1.003]},"o":{"x":[0.543,0.543],"y":[0,0]},"t":15,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":90,"s":[300,300]},{"t":130,"s":[390,390]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":90,"s":[1,0.798773705959,0.745113372803,1]},{"t":130,"s":[0.992156863213,0.882352948189,0.858823537827,1]}],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"扩散圈 2","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.908],"y":[0]},"t":234,"s":[100]},{"t":240,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.566,0.566],"y":[0.957,0.957]},"o":{"x":[0.511,0.511],"y":[0.032,0.032]},"t":30,"s":[214.752,214.752]},{"i":{"x":[0.833,0.833],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":90,"s":[390,390]},{"t":130,"s":[480,480]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":90,"s":[0.992432598039,0.884142348346,0.860077861711,1]},{"t":130,"s":[1,0.945098042488,0.933333337307,1]}],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":30,"op":90,"st":-30,"bm":0},{"ddd":0,"ind":6,"ty":4,"nm":"扩散圈 3","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.566],"y":[1]},"o":{"x":[0.198],"y":[0]},"t":90,"s":[100]},{"i":{"x":[0.847],"y":[1]},"o":{"x":[0.362],"y":[0]},"t":130,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.908],"y":[0]},"t":235,"s":[100]},{"t":241,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.587,0.587],"y":[0.981,0.981]},"o":{"x":[0.526,0.526],"y":[0.103,0.103]},"t":46,"s":[233.126,233.126]},{"i":{"x":[0.833,0.833],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":90,"s":[480,480]},{"t":130,"s":[570,570]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.946208160999,0.934681372549,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":46,"op":90,"st":-14,"bm":0}],"markers":[]}
\ No newline at end of file
... ...
{"v":"5.6.10","fr":60,"ip":0,"op":42,"w":560,"h":560,"nm":"波纹","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"语音","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[12.98,14.416,0],"ix":1},"s":{"a":0,"k":[300,300,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.122,-0.519],[0,0],[-4.764,-0.045],[0,0],[-1.197,4.408],[0,0],[0,0],[-0.519,-0.123],[0,0],[0.123,-0.519],[0,0],[5.457,-0.527],[0,0],[0.008,-0.042],[0.016,-0.039],[0.023,-0.035],[0.03,-0.03],[0.035,-0.023],[0.039,-0.016],[0.041,-0.009],[0.042,0],[0,0],[0.041,0.008],[0.039,0.016],[0.036,0.024],[0.03,0.03],[0.023,0.035],[0.017,0.039],[0.008,0.041],[0,0.042],[0,0],[1.37,5.161],[0,0],[0,0],[-0.52,0.122],[0,0]],"o":[[0,0],[1.08,4.582],[0,0],[4.646,-0.044],[0,0],[0,0],[0.124,-0.519],[0,0],[0.519,0.123],[0,0],[-1.272,5.357],[0,0],[0,0.042],[-0.009,0.041],[-0.016,0.039],[-0.024,0.035],[-0.029,0.03],[-0.035,0.024],[-0.039,0.016],[-0.042,0.008],[0,0],[-0.042,0],[-0.042,-0.009],[-0.039,-0.016],[-0.035,-0.023],[-0.03,-0.03],[-0.024,-0.035],[-0.016,-0.04],[-0.009,-0.042],[0,0],[-5.308,-0.547],[0,0],[0,0],[-0.122,-0.519],[0,0],[0.52,-0.122]],"v":[[-10.101,0.773],[-10.027,1.085],[-0.095,9.016],[0.098,9.016],[9.945,1.421],[10.026,1.102],[10.1,0.79],[11.263,0.072],[11.89,0.221],[12.607,1.385],[12.532,1.697],[1.248,11.531],[1.248,13.523],[1.236,13.648],[1.199,13.768],[1.14,13.88],[1.059,13.977],[0.962,14.057],[0.851,14.118],[0.73,14.154],[0.604,14.167],[-0.684,14.167],[-0.809,14.154],[-0.93,14.118],[-1.042,14.057],[-1.139,13.977],[-1.219,13.88],[-1.279,13.77],[-1.315,13.648],[-1.328,13.523],[-1.328,11.523],[-12.446,2.027],[-12.534,1.676],[-12.608,1.363],[-11.889,0.202],[-11.263,0.053]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[0,0],[2.845,0],[0,-2.845],[0,0],[-2.846,0],[0,2.845]],"o":[[0,-2.845],[-2.846,0],[0,0],[0,2.845],[2.845,0],[0,0]],"v":[[5.112,-6.439],[-0.039,-11.59],[-5.191,-6.439],[-5.191,-1.288],[-0.039,3.865],[5.112,-1.288]],"c":true},"ix":2},"nm":"路径 2","mn":"ADBE Vector Shape - Group","hd":false},{"ind":2,"ty":"sh","ix":3,"ks":{"a":0,"k":{"i":[[0,0],[-4.268,0],[0,-4.268],[0,0],[4.268,0],[0,4.267]],"o":[[0,-4.268],[4.268,0],[0,0],[0,4.267],[-4.268,0],[0,0]],"v":[[-7.767,-6.439],[-0.04,-14.167],[7.687,-6.439],[7.687,-1.288],[-0.04,6.439],[-7.767,-1.288]],"c":true},"ix":2},"nm":"路径 3","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"合并路径 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[12.98,14.416],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"组 1","np":5,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":42,"st":-90,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"按钮","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":-90,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":-80,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":-70,"s":[210,210]},{"t":-60,"s":[210,210]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.929411764706,0.156862745098,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":42,"st":-90,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"按钮 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":-90,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":-80,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":-70,"s":[210,210]},{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":-60,"s":[210,210]},{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":0,"s":[210,210]},{"t":40,"s":[300,300]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":-90,"s":[0.929411764706,0.156862745098,0,1]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[1,0.683882236481,0.597104787827,1]},{"t":40,"s":[1,0.800000011921,0.745098054409,1]}],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":42,"st":-90,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"扩散圈","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.908],"y":[0]},"t":144,"s":[100]},{"t":150,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.59,0.59],"y":[1.003,1.003]},"o":{"x":[0.543,0.543],"y":[0,0]},"t":-75,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":0,"s":[300,300]},{"t":40,"s":[390,390]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[1,0.798773705959,0.745113372803,1]},{"t":40,"s":[0.992156863213,0.882352948189,0.858823537827,1]}],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":42,"st":-90,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"扩散圈 2","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.908],"y":[0]},"t":144,"s":[100]},{"t":150,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.566,0.566],"y":[0.957,0.957]},"o":{"x":[0.511,0.511],"y":[0.032,0.032]},"t":-60,"s":[214.752,214.752]},{"i":{"x":[0.833,0.833],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":0,"s":[390,390]},{"t":40,"s":[480,480]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0.992432598039,0.884142348346,0.860077861711,1]},{"t":40,"s":[1,0.945098042488,0.933333337307,1]}],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":42,"st":-120,"bm":0},{"ddd":0,"ind":6,"ty":4,"nm":"扩散圈 3","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.566],"y":[1]},"o":{"x":[0.198],"y":[0]},"t":0,"s":[100]},{"i":{"x":[0.847],"y":[1]},"o":{"x":[0.362],"y":[0]},"t":40,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.908],"y":[0]},"t":145,"s":[100]},{"t":151,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.587,0.587],"y":[0.981,0.981]},"o":{"x":[0.526,0.526],"y":[0.103,0.103]},"t":-44,"s":[233.126,233.126]},{"i":{"x":[0.833,0.833],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":0,"s":[480,480]},{"t":40,"s":[570,570]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.946208160999,0.934681372549,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":42,"st":-104,"bm":0}],"markers":[]}
\ No newline at end of file
... ...
... ... @@ -3,6 +3,7 @@ import { DateTimeUtils, Logger } from 'wdKit';
import common from '@ohos.app.ability.common';
import window from '@ohos.window';
import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index';
import { router } from '@kit.ArkUI';
const TAG = 'ENewspaper';
... ... @@ -64,6 +65,7 @@ struct ENewspaper {
onBackPress() {
Logger.info(TAG, 'onBackPress');
router.back()
return true
}
}
\ No newline at end of file
... ...
... ... @@ -13,6 +13,7 @@ import { BusinessError } from '@kit.BasicServicesKit';
import { BottomNavigationComponent } from './view/BottomNavigationComponent';
import LaunchDataModel from './viewModel/LaunchDataModel';
import { LaunchPageModel } from './viewModel/LaunchPageModel';
import { JSON } from '@kit.ArkTS';
const TAG = 'MainPage';
... ... @@ -46,14 +47,19 @@ struct MainPage {
LogoutViewModel.clearLoginInfo()
})
let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_MOURNS_INFO_DATA_MODEL,'') as string
let dataModel : LaunchDataModel = JSON.parse(dataModelStr)
// console.log(dataModelStr)
// 处理国殇模式数据
let mourns: mournsInfoModel = dataModel.mourns as mournsInfoModel
let GrayManage = new GrayManageModel()
GrayManage.setMourning(mourns)
AppStorage.setOrCreate('GrayManage', GrayManage)
let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_MOURNS_INFO_DATA_MODEL,'') as string
try {
if (dataModelStr && dataModelStr.length > 0) {
let dataModel : LaunchDataModel = JSON.parse(dataModelStr) as LaunchDataModel
// 处理国殇模式数据
let mourns: mournsInfoModel = dataModel.mourns as mournsInfoModel
GrayManage.setMourning(mourns)
}
AppStorage.setOrCreate('GrayManage', GrayManage)
} catch (e) {
Logger.error(TAG, `Unexpected Text in JSON ??` + JSON.stringify(e) +" " + dataModelStr);
}
}
pageTransition() {
... ...
... ... @@ -20,7 +20,7 @@ struct MorningEveningPaperPage {
pageTransition() {
// 定义页面进入时的效果,从底侧滑入
PageTransitionEnter({ type: RouteType.Push, duration: 200 })
PageTransitionEnter({ type: RouteType.Push, duration: 300 })
.slide(SlideEffect.Bottom).onEnter((type: RouteType, progress: number) => {
if (progress >= 0.99) {
// WindowModel.shared.setWindowLayoutFullScreen(true)
... ...
... ... @@ -207,7 +207,11 @@ export struct VideoChannelPage {
top: px2vp(this.topSafeHeight)
})
.visibility(this.displayDirection === DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
.linearGradient({
colors: [
['rgba(18, 18, 18, 0.5)', 0.0], ['rgba(18, 18, 18, 0.0)', 1.0]
]
})
}
/**
... ...
... ... @@ -19,15 +19,6 @@ struct DefaultWebPage {
build() {
Column() {
Column() {
WdWebComponent({
webviewControl: this.webviewControl,
webUrl: this.webUrl,
isPageEnd: $isPageEnd
})
}.layoutWeight(1)
Row() {
Button({ type: ButtonType.Normal }) {
Image($r("app.media.back_icon_black"))
... ... @@ -42,6 +33,14 @@ struct DefaultWebPage {
}.width("100%").height(44)
.alignItems(VerticalAlign.Center)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
Column() {
WdWebComponent({
webviewControl: this.webviewControl,
webUrl: this.webUrl,
isPageEnd: $isPageEnd
})
}.layoutWeight(1)
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT).padding({
... ...
... ... @@ -184,17 +184,7 @@
],
"requestPermissions": [
{
"name": "ohos.permission.CAMERA",
"reason": "$string:permission_camera_tip",
"usedScene": {
"abilities": [
"FormAbility"
],
"when": "inuse"
}
},
{
"name": "ohos.permission.READ_MEDIA",
"name": "ohos.permission.READ_IMAGEVIDEO",
"reason": "$string:permission_photo_tip",
"usedScene": {
"abilities": [
... ... @@ -204,7 +194,7 @@
}
},
{
"name": "ohos.permission.WRITE_MEDIA",
"name": "ohos.permission.WRITE_IMAGEVIDEO",
"reason": "$string:permission_photo_tip",
"usedScene": {
"abilities": [
... ...
{
"cei":{
"cei_param_version":"2.2.0",
"cei_param_device_type":"car",
"cei_param_reco_mode":0,
"cei_param_log_level":2,
"cei_param_debug_path":"asr_debug",
"cei_param_is_debug_enable":false,
"cei_param_resource_path":"",
"cei_param_resource_is_multi_language":false,
"cei_param_audio_format_str":"16k16bitmono",
"cei_param_mcs_mode":0,
"cei_param_work_mode":0,
"cei_param_max_cache_frames":1000,
"cei_param_is_aec_bf_active":false,
"cei_param_is_agc_active":false,
"cei_param_is_vad_active":true,
"cei_param_is_kws_active":true,
"cei_param_is_sr_active":true
},
"asp":{
"asp_param_is_process_parallel":false,
"asp_param_is_input_debug_enable":false,
"asp_param_is_output_debug_enable":false,
"asp_param_debug_path":"asr_debug",
"asp_param_is_callback_enable":false,
"asp_param_callback_period_frames":5
},
"vad":{
"vad_param_is_input_debug_enable":false,
"vad_param_is_output_debug_enable":false,
"vad_param_debug_path":"asr_debug",
"vad_param_asleep_speech_noise_thres":-0.8,
"vad_param_awake_speech_noise_thres":-0.5,
"vad_param_asleep_max_speech_segment_time":300000,
"vad_param_awake_max_speech_segment_time":60000,
"vad_param_asleep_block_size":3,
"vad_param_awake_block_size":3,
"vad_param_front_timeout_interval":8000,
"vad_param_tail_timeout_interval":800,
"vad_param_is_detect_start":true,
"vad_param_is_detect_end":true
},
"kws":{
"kws_param_is_input_debug_enable":false,
"kws_param_is_output_debug_enable":false,
"kws_param_debug_path":"asr_debug",
"kws_param_is_process_parallel":false,
"kws_param_front_extend_frames":10,
"kws_param_tail_extend_frames":5,
"kws_param_encoder_type_str":"opu",
"kws_param_encoder_bitrate":16000,
"kws_param_encoder_complexity":2,
"kws_param_callback_period_ms":100,
"kws_param_max_frames_per_callback":25,
"kws_param_max_bytes_per_callback":16000
},
"sr":{
"sr_param_is_input_debug_enable":false,
"sr_param_is_output_debug_enable":false,
"sr_param_debug_path":"asr_debug",
"sr_param_is_itn_enable":true,
"sr_param_is_do_conf_filter":false,
"sr_param_is_process_parallel":true,
"sr_param_is_need_result":false,
"sr_param_is_need_voice":true,
"sr_param_ngram_conf_thres":65.0,
"sr_param_jsgf_conf_thres":65.0,
"sr_param_encoder_type_str":"opu",
"sr_param_encoder_bitrate":16000,
"sr_param_encoder_complexity":2,
"sr_param_callback_period_ms":100,
"sr_param_max_frames_per_callback":25,
"sr_param_max_bytes_per_callback":16000
},
"ou":{
"oss_upload_param_is_enable":false,
"oss_upload_param_asp_in":false,
"oss_upload_param_asp_out":false,
"oss_upload_param_vad_in":false,
"oss_upload_param_vad_out":false,
"oss_upload_param_kws_in":false,
"oss_upload_param_kws_susp_in":false,
"oss_upload_param_kws_out":false,
"oss_upload_param_kws_susp_out":false,
"oss_upload_param_sr_in":false
}
}
... ...
{
"device_type":"phone",
"assets_version":"1.1.20190902",
"nui_config":{
"service_mode":"kModeFullCloud",
"log_level":"kLogLevelVerbose",
"enable_recorder_by_user":true,
"enable_callback_recording":false,
"enable_dialog":false
},
"nls_config":{
"debug_level":4,
"sr_format":"opus",
"sample_rate":16000,
"dns_timeout":5000,
"vocab_default_weight":2
},
"audio_config":{
"debug":"none",
"16k_audio":{
"name":"16kmono16bit",
"id":0,
"mic":{
"name":"16kmono16bit",
"debug_heap_pollution":false,
"read_cnt":0,
"sample_rate":16000,
"bits_per_sample":16,
"channels":1,
"recording_interval":10,
"cei_frame_time_len":20,
"channel_mask":"kAMChannalMaskNone",
"format_type":"kAMDataFormatPcmInterleaved",
"endianness":"kAMByteOrderLittleEndian"
}
},
"8k_audio":{
"name":"8kmono16bit",
"id":0,
"mic":{
"name":"8kmono16bit",
"debug_heap_pollution":false,
"read_cnt":0,
"sample_rate":8000,
"bits_per_sample":16,
"channels":1,
"recording_interval":10,
"cei_frame_time_len":20,
"channel_mask":"kAMChannalMaskNone",
"format_type":"kAMDataFormatPcmInterleaved",
"endianness":"kAMByteOrderLittleEndian"
}
}
}
}
... ...
{
"device_type":"car",
"mode_type":2,
"smart_engine":3,
"encode_type":"pcm",
"debug_info":{
"debug_level":0,
"debug_path":"/sdcard/tmp"
},
"common_info":{
"pitch_level":0,
"speed_level":1.0,
"volume":1.0,
"play_audio":0,
"callback_raw_data":1,
"sample_rate":16000,
"font_name":"xiaoyun",
"wait_time":2000
},
"cache":{
"on":true,
"max_cache_size":2000000,
"save_path":"/sdcard/mit/"
},
"font":{
"on":false,
"mode":"cmd",
"save_path":"/sdcard/mit"
}
}
... ...