wangliang_wd

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

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  fix: 19085 一多适配--折叠屏,人民号>关注:号主动态,单图卡样式标题折行不正确
  图集删除冗余代码
  fix:1)搜索 输入wuhuhuan,全部tab未显示,看图
  fix: 默认生产环境
  fix: 19146 UI还原问题-【uat】进入直播详情页,直播中状态和距离和android不一致
  feat:1)Logger.debug日志中添加一个动态的prefix参数据,方便打印完整的日志信息
  fix: 18088 UI还原问题-【uat】进入视频频道,点击全屏观看后,进度条线比android粗
  fix: 18085 UI还原问题-【uat】进入视频频道,点击全屏观看后,分享按钮和android 显示不一致
  fix: 17578 功能缺陷-【uat】进入沉浸式视频页,标题和昵称字体和android不一致
  fix: 17107 UI还原问题-进入视频全屏,回看间距和字体问题
  fix(18643): UI还原问题-【生产】进入直播频道,进入预告直播间,日期显示效果和ios 不一致,多了个0
  fix: 17007 UI还原问题--视频直播,标题、图标、字体大小,字体和android不一致
  图集删除冗余代码
  fix(18689):UI还原问题-【生产】进入直播预告页,预约日期和iOS不一致,看图
  图集请求网络图片方法修改
... ... @@ -40,10 +40,15 @@ export class Logger {
Logger.domain = domain;
}
static debug(...args: string[]) {
static debug(prefixStr?:string,...args: string[]) {
if (!Logger.isDebug) {
return
}
if(prefixStr){
Logger.prefix = prefixStr
}else {
Logger.prefix = 'SightApp';
}
Logger.logContent(LogLevel.DEBUG, ...args)
}
... ... @@ -150,4 +155,4 @@ export class Logger {
}
}
export default new Logger('SightApp', 0xFF00)
\ No newline at end of file
// export default new Logger('SightApp', 0xFF00)
\ No newline at end of file
... ...
... ... @@ -87,6 +87,7 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r
// return Promise.reject(new Error(message))
// }
// const data: ResponseBean<any> = response.data
Logger.debug('HttpRequest', 'response ==============start=================')
Logger.debug('HttpRequest', 'response: ' + JSON.stringify(response.data))
Logger.debug('HttpRequest', 'response ==============end=================')
... ...
... ... @@ -62,25 +62,52 @@ export struct ImageDownloadComponent {
* 通过http的request方法从网络下载图片资源
*/
async getPicture() {
console.info(`cj2024 getPicture`)
http.createHttp()
.request(this.url,
(error: BusinessError, data: http.HttpResponse) => {
// 每一个httpRequest对应一个HTTP请求任务,不可复用
let httpRequest = http.createHttp();
// 用于订阅HTTP响应头事件
httpRequest.on('headersReceive', (header: Object) => {
console.info('header: ' + JSON.stringify(header));
});
// 用于订阅HTTP流式响应数据接收事件
let res = new ArrayBuffer(0);
httpRequest.on('dataReceive', (data: ArrayBuffer) => {
const newRes = new ArrayBuffer(res.byteLength + data.byteLength);
const resView = new Uint8Array(newRes);
resView.set(new Uint8Array(res));
resView.set(new Uint8Array(data), res.byteLength);
res = newRes;
// console.info('dataReceive res length: ' + res.byteLength);
});
// 用于订阅HTTP流式响应数据接收完毕事件
httpRequest.on('dataEnd', () => {
this.transcodePixelMap(res);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`dataEnd getPicture ${res}`)
if (res instanceof ArrayBuffer) {
console.info(`dataEnd getPicture`)
this.imageBuffer = res as ArrayBuffer;
}
console.info('No more data in response, data receive end');
});
httpRequest.requestInStream(this.url,
(error: BusinessError, data: number) => {
if (error) {
// 下载失败时弹窗提示检查网络,不执行后续逻辑
promptAction.showToast({
message: $r('app.string.image_request_fail'),
duration: 2000
})
console.error(`http reqeust failed with. Code: ${error.code}, message: ${error.message}`);
return;
}
this.transcodePixelMap(data);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`cj2024 getPicture ${data.result}`)
if (data.result instanceof ArrayBuffer) {
console.info(`cj2024 getPicture 222`)
this.imageBuffer = data.result as ArrayBuffer;
}
// 取消订阅HTTP响应头事件
httpRequest.off('headersReceive');
// 取消订阅HTTP流式响应数据接收事件
httpRequest.off('dataReceive');
// 取消订阅HTTP流式响应数据接收完毕事件
httpRequest.off('dataEnd');
// 当该请求使用完毕时,调用destroy方法主动销毁
httpRequest.destroy();
}
)
}
... ... @@ -89,10 +116,8 @@ export struct ImageDownloadComponent {
* 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型
* @param data:网络获取到的资源
*/
transcodePixelMap(data: http.HttpResponse) {
console.info(`cj2024 transcodePixelMap ${data.responseCode}`)
if (http.ResponseCode.OK === data.responseCode) {
const imageData: ArrayBuffer = data.result as ArrayBuffer;
transcodePixelMap(data: ArrayBuffer) {
const imageData: ArrayBuffer = data;
// 通过ArrayBuffer创建图片源实例。
const imageSource: image.ImageSource = image.createImageSource(imageData);
const options: image.InitializationOptions = {
... ... @@ -108,7 +133,6 @@ export struct ImageDownloadComponent {
this.image = pixelMap;
});
}
}
/**
* 保存ArrayBuffer到图库
... ...
... ... @@ -38,25 +38,52 @@ export struct MultiPictureDetailItemComponent {
* 通过http的request方法从网络下载图片资源
*/
async getPicture() {
console.info(`cj2024 getPicture`)
http.createHttp()
.request(this.imageUri,
(error: BusinessError, data: http.HttpResponse) => {
// 每一个httpRequest对应一个HTTP请求任务,不可复用
let httpRequest = http.createHttp();
// 用于订阅HTTP响应头事件
httpRequest.on('headersReceive', (header: Object) => {
console.info('header: ' + JSON.stringify(header));
});
// 用于订阅HTTP流式响应数据接收事件
let res = new ArrayBuffer(0);
httpRequest.on('dataReceive', (data: ArrayBuffer) => {
const newRes = new ArrayBuffer(res.byteLength + data.byteLength);
const resView = new Uint8Array(newRes);
resView.set(new Uint8Array(res));
resView.set(new Uint8Array(data), res.byteLength);
res = newRes;
// console.info('dataReceive res length: ' + res.byteLength);
});
// 用于订阅HTTP流式响应数据接收完毕事件
httpRequest.on('dataEnd', () => {
this.transcodePixelMap(res);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`dataEnd getPicture ${res}`)
if (res instanceof ArrayBuffer) {
console.info(`dataEnd getPicture`)
this.imageBuffer = res as ArrayBuffer;
}
console.info('No more data in response, data receive end');
});
httpRequest.requestInStream(this.imageUri,
(error: BusinessError, data: number) => {
if (error) {
// 下载失败时弹窗提示检查网络,不执行后续逻辑
promptAction.showToast({
message: $r('app.string.image_request_fail'),
duration: 2000
})
console.error(`http reqeust failed with. Code: ${error.code}, message: ${error.message}`);
return;
}
this.transcodePixelMap(data);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`cj2024 getPicture ${data.result}`)
if (data.result instanceof ArrayBuffer) {
console.info(`cj2024 getPicture 222`)
this.imageBuffer = data.result as ArrayBuffer;
}
// 取消订阅HTTP响应头事件
httpRequest.off('headersReceive');
// 取消订阅HTTP流式响应数据接收事件
httpRequest.off('dataReceive');
// 取消订阅HTTP流式响应数据接收完毕事件
httpRequest.off('dataEnd');
// 当该请求使用完毕时,调用destroy方法主动销毁
httpRequest.destroy();
}
)
}
... ... @@ -65,15 +92,12 @@ export struct MultiPictureDetailItemComponent {
* 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型
* @param data:网络获取到的资源
*/
transcodePixelMap(data: http.HttpResponse) {
console.info(`cj2024 transcodePixelMap ${data.responseCode}`)
if (http.ResponseCode.OK === data.responseCode) {
const imageData: ArrayBuffer = data.result as ArrayBuffer;
transcodePixelMap(data: ArrayBuffer) {
const imageData: ArrayBuffer = data;
// 通过ArrayBuffer创建图片源实例。
const imageSource: image.ImageSource = image.createImageSource(imageData);
this.initCurrentImageInfo(imageSource);
}
}
/**
* 设置当前图片的相关信息:uri、whRatio、pixelMap、fitWH、defaultSize、maxScaleValue
... ... @@ -196,7 +220,6 @@ export struct MultiPictureDetailItemComponent {
})
.height('100%')
.width('100%')
.backgroundColor(Color.Black)
.justifyContent(FlexAlign.Center)
.gesture(
GestureGroup(
... ...
... ... @@ -55,7 +55,7 @@ export struct Card14Component {
)
}
// 左标题,右图
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Start }) {
Text() {
if (this.titleMarked) {
... ... @@ -77,16 +77,14 @@ export struct Card14Component {
.lineHeight(25)
.fontFamily('PingFang SC-Regular')
.textAlign(TextAlign.Start)
// .flexBasis('auto')
.margin({right: 12})
.flexBasis(214)
.width('64%')
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor(0xf5f5f5)
.flexBasis(117)
.aspectRatio(3 / 2)
.height(78)
.borderRadius($r('app.float.image_border_radius'))
// .flexBasis(160)
.backgroundImageSize(ImageSize.Auto)
}
... ...
... ... @@ -216,8 +216,12 @@ export struct LiveBigImage01Component {
} else {
const month = eventDateTime.getMonth() + 1;
const date = eventDateTime.getDate();
if(date < 10){
return `${month}月${'0'+date}日`;
}else{
return `${month}月${date}日`;
}
}
} else {
return `${eventTimeStr}`;
}
... ...
... ... @@ -29,24 +29,22 @@ export struct SearchComponent {
@State searchHistoryData: SearchHistoryItem[] = []
@State relatedSearchContentsData: SearchRelatedItem[] = []
scroller: Scroller = new Scroller()
@State count:string[] = []
@State isGetRequest:boolean = false
@State count: string[] = []
@State isGetRequest: boolean = false
@Link fromTabName: string
@State sameSearch:number = 0 //再次搜索
@StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm';
@State sameSearch: number = 0 //再次搜索
@StorageProp('currentBreakpoint') @Watch("currentChanged") currentBreakpoint: string = 'sm';
private breakpointSystem = new BreakpointSystem();
@State percent:number = 1
@State percent: number = 1
currentChanged(){
if(this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"){
currentChanged() {
if (this.currentBreakpoint == "md" || this.currentBreakpoint == "lg") {
this.percent = 0.7
}else {
} else {
this.percent = 1
}
}
aboutToAppear() {
this.breakpointSystem.register();
this.currentChanged()
... ... @@ -68,43 +66,42 @@ export struct SearchComponent {
this.breakpointSystem.unregister();
}
getRelatedSearchContent() {
if(StringUtils.isNotEmpty(this.searchText)){
SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(this.searchText),getContext(this)).then((value) => {
if (StringUtils.isNotEmpty(this.searchText)) {
SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(this.searchText), getContext(this)).then((value) => {
if (value != null && value.length > 0) {
this.relatedSearchContentsData = []
value.forEach(item=>{
let tempValue:string = item
value.forEach(item => {
let tempValue: string = item
let tempArr: string[] = []
if (tempValue.indexOf(this.searchText) === -1) {
tempArr.push(item)
this.relatedSearchContentsData.push(new SearchRelatedItem(item,tempArr))
}else {
while (tempValue.indexOf(this.searchText) != -1){
this.relatedSearchContentsData.push(new SearchRelatedItem(item, tempArr))
} else {
while (tempValue.indexOf(this.searchText) != -1) {
let index = tempValue.indexOf(this.searchText)
if(index === 0){
if (index === 0) {
try {
tempArr.push(this.searchText)
tempValue = tempValue.substring(this.searchText.length,tempValue.length)
tempValue = tempValue.substring(this.searchText.length, tempValue.length)
} catch (e) {
}
}else {
} else {
try {
tempArr.push(tempValue.substring(0,index))
tempArr.push(tempValue.substring(0, index))
tempArr.push(this.searchText)
tempValue = tempValue.substring(index+this.searchText.length,tempValue.length)
tempValue = tempValue.substring(index + this.searchText.length, tempValue.length)
} catch (e) {
}
}
}
if(StringUtils.isNotEmpty(tempValue)){
if (StringUtils.isNotEmpty(tempValue)) {
tempArr.push(tempValue)
}
this.relatedSearchContentsData.push(new SearchRelatedItem(item,tempArr))
this.relatedSearchContentsData.push(new SearchRelatedItem(item, tempArr))
}
})
}else{
} else {
this.hasInputContent = false
this.relatedSearchContentsData = []
}
... ... @@ -125,8 +122,9 @@ export struct SearchComponent {
this.setDefaultHitData()
})
}
setDefaultHitData(){
if(this.searchTextData.length === 0){
setDefaultHitData() {
if (this.searchTextData.length === 0) {
this.hasNoSearchTextData = true
this.searchTextData.push("搜索感兴趣的内容")
}
... ... @@ -136,7 +134,7 @@ export struct SearchComponent {
this.searchHistoryData = SearcherAboutDataModel.getSearchHistoryData()
}
stopInput(){
stopInput() {
this.controller.stopEditing()
}
... ... @@ -146,11 +144,17 @@ export struct SearchComponent {
if (!this.hasInputContent) {
Scroll(this.scroller) {
Column() {
if(this.searchHistoryData!=null && this.searchHistoryData.length>0){
SearchHistoryComponent({ searchHistoryData: $searchHistoryData, onDelHistory: (): void => this.getSearchHistoryData(),onGetSearchRes: (item,index): void => this.getSearchHistoryResData(item,index),onCloseInput : (): void => this.stopInput(),percent:this.percent })
if (this.searchHistoryData != null && this.searchHistoryData.length > 0) {
SearchHistoryComponent({
searchHistoryData: $searchHistoryData,
onDelHistory: (): void => this.getSearchHistoryData(),
onGetSearchRes: (item, index): void => this.getSearchHistoryResData(item, index),
onCloseInput: (): void => this.stopInput(),
percent: this.percent
})
}
if(this.searchHistoryData.length>0){
if (this.searchHistoryData.length > 0) {
//分隔符
Divider()
.width('100%')
... ... @@ -159,7 +163,10 @@ export struct SearchComponent {
.strokeWidth(`${this.calcHeight(1)}lpx`)
}
SearchHotsComponent({onGetSearchRes: (item): void => this.getSearchHotResData(item),percent:this.percent})
SearchHotsComponent({
onGetSearchRes: (item): void => this.getSearchHotResData(item),
percent: this.percent
})
}
}
.scrollable(ScrollDirection.Vertical)
... ... @@ -170,16 +177,28 @@ export struct SearchComponent {
} else {
if (this.hasChooseSearch) {
//搜索结果
SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest,onClickTryAgain: (): void => {
if(StringUtils.isNotEmpty(this.searchText)){
SearchResultComponent({
count: this.count,
searchText: this.searchText,
isGetRequest: this.isGetRequest,
onClickTryAgain: (): void => {
if (StringUtils.isNotEmpty(this.searchText)) {
SearcherAboutDataModel.putSearchHistoryData(this.searchText)
this.getSearchHistoryData()
this.getSearchInputResData(this.searchText)
}
},percent:this.percent,sameSearch:this.sameSearch})
},
percent: this.percent,
sameSearch: this.sameSearch
})
} else {
//联想搜索
SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText,percent:this.percent})
SearchRelatedComponent({
relatedSearchContentData: $relatedSearchContentsData,
onGetSearchRes: (item): void => this.getSearchRelatedResData(item),
searchText: this.searchText,
percent: this.percent
})
}
}
}.height('100%')
... ... @@ -190,19 +209,19 @@ export struct SearchComponent {
* 点击搜索记录列表回调
* @param content
*/
getSearchHistoryResData(content:string,index:number){
getSearchHistoryResData(content: string, index: number) {
//删除单条记录
SearcherAboutDataModel.delSearchSingleHistoryData(index)
this.isClickedHistorySearch = true
this.searchResData(content)
}
searchResData(content:string){
trackSearchClick(this.fromTabName,content)
searchResData(content: string) {
trackSearchClick(this.fromTabName, content)
//赋值
this.searchText = content
if(StringUtils.isNotEmpty(this.searchText)){
if (StringUtils.isNotEmpty(this.searchText)) {
this.hasInputContent = true
}
... ... @@ -223,7 +242,7 @@ export struct SearchComponent {
* 点击hint搜索列表回调
* @param content
*/
getSearchHintResData(content:string){
getSearchHintResData(content: string) {
this.isClickedHintSearch = true
this.searchResData(content)
}
... ... @@ -232,7 +251,7 @@ export struct SearchComponent {
* 点击联想搜索列表回调
* @param content
*/
getSearchRelatedResData(content:string){
getSearchRelatedResData(content: string) {
this.isClickedRelatedSearch = true
this.searchResData(content)
}
... ... @@ -241,7 +260,7 @@ export struct SearchComponent {
* 点击热词搜索列表回调
* @param content
*/
getSearchHotResData(content:string){
getSearchHotResData(content: string) {
this.isClickedHotSearch = true
this.searchResData(content)
}
... ... @@ -250,17 +269,19 @@ export struct SearchComponent {
* 点击输入法搜索搜索列表回调
* @param content
*/
getSearchInputResData(content:string){
getSearchInputResData(content: string) {
this.isClickedInputSearch = true
this.searchResData(content)
}
//搜索框
@Builder searchInputComponent() {
@Builder
searchInputComponent() {
Row() {
//左
Stack({ alignContent: Alignment.Start }) {
if (this.searchTextData != null && this.searchTextData.length > 0 && !this.hasInputContent && StringUtils.isEmpty(this.searchText)) {
if (this.searchTextData != null && this.searchTextData.length > 0 && !this.hasInputContent &&
StringUtils.isEmpty(this.searchText)) {
Swiper(this.swiperController) {
ForEach(this.searchTextData, (item: string, index: number) => {
Text(item)
... ... @@ -285,42 +306,42 @@ export struct SearchComponent {
this.curHintSearchData = this.searchTextData[index]
})
}
Row(){
Search({ value: this.searchText, placeholder: '', controller: this.controller})
Row() {
Search({ value: this.searchText, placeholder: '', controller: this.controller })
.layoutWeight(1)
.height(`${this.calcHeight(69)}lpx`)
.backgroundColor($r('app.color.color_transparent'))
.textFont({ size: `${this.calcHeight(27)}lpx`, weight: 400 })
// .defaultFocus(true)
.textFont({ size: `${this.calcHeight(27)}lpx`, weight: 400 })// .defaultFocus(true)
.id("searchId")
.searchIcon({
size:0
size: 0
})
.cancelButton({
style:CancelButtonStyle.INVISIBLE
style: CancelButtonStyle.INVISIBLE
})
.caretStyle({color:Color.Pink})
.caretStyle({ color: Color.Pink })
.onSubmit((value: string) => {
if(StringUtils.isNotEmpty(this.searchText)){
if (StringUtils.isNotEmpty(this.searchText)) {
SearcherAboutDataModel.putSearchHistoryData(this.searchText)
this.getSearchHistoryData()
this.getSearchInputResData(this.searchText)
}else{
if(!this.hasNoSearchTextData){
if(StringUtils.isEmpty(this.curHintSearchData)){
} else {
if (!this.hasNoSearchTextData) {
if (StringUtils.isEmpty(this.curHintSearchData)) {
this.curHintSearchData = this.searchTextData[0]
}
this.getSearchHintResData(this.curHintSearchData)
}else{
} else {
ToastUtils.shortToast("请输入搜索关键词")
}
}
})
.onChange((value: string) => {
this.searchText = value
if(this.isClickedHistorySearch || this.isClickedHotSearch || this.isClickedRelatedSearch || this.isClickedInputSearch|| this.isClickedHintSearch){
if (this.isClickedHistorySearch || this.isClickedHotSearch || this.isClickedRelatedSearch ||
this.isClickedInputSearch || this.isClickedHintSearch) {
this.hasChooseSearch = true
}else{
} else {
this.hasChooseSearch = false
}
... ... @@ -330,10 +351,11 @@ export struct SearchComponent {
this.hasInputContent = false
}
if(this.isClickedHistorySearch || this.isClickedHotSearch || this.isClickedRelatedSearch || this.isClickedInputSearch|| this.isClickedHintSearch){
if (this.isClickedHistorySearch || this.isClickedHotSearch || this.isClickedRelatedSearch ||
this.isClickedInputSearch || this.isClickedHintSearch) {
this.resetSearch()
}else{
if(this.hasInputContent){
} else {
if (this.hasInputContent) {
this.getRelatedSearchContent()
}
}
... ... @@ -344,14 +366,14 @@ export struct SearchComponent {
.height(`${this.calcHeight(31)}lpx`)
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.Medium)
.onClick(()=>{
.onClick(() => {
this.searchText = ""
})
.offset({x:10})
.offset({ x: 10 })
.enabled(true)
.visibility(StringUtils.isEmpty(this.searchText) ? Visibility.Hidden : Visibility.Visible)
}.padding({right:`${this.calcHeight(70)}lpx`})
}.padding({ right: `${this.calcHeight(70)}lpx` })
.layoutWeight(1)
.justifyContent(FlexAlign.SpaceBetween)
}
... ... @@ -379,21 +401,29 @@ export struct SearchComponent {
.alignItems(VerticalAlign.Center)
}
getSearchResultCountData() {
SearcherAboutDataModel.getSearchResultCountData(encodeURI(this.searchText),getContext(this)).then((value) => {
SearcherAboutDataModel.getSearchResultCountData(encodeURI(this.searchText), getContext(this)).then((value) => {
if (value != null) {
this.count = []
if(value.allTotal!=0){
/*
全部 tab, allTotal> 0 或其它的tab有一个出现
*/
let haveAll = false
if (value.cmsTotal != 0 || value.rmhTotal != 0 || value.videoTotal != 0 || value.activityTotal != 0) {
haveAll = true
}
if (value.allTotal != 0 || haveAll) {
this.count.push("全部")
}
if(value.cmsTotal!=0){
if (value.cmsTotal != 0) {
this.count.push("精选")
}
if(value.rmhTotal!=0){
if (value.rmhTotal != 0) {
this.count.push("人民号")
}
if(value.videoTotal!=0){
if (value.videoTotal != 0) {
this.count.push("视频")
}
//屏蔽活动
... ... @@ -411,7 +441,7 @@ export struct SearchComponent {
})
}
resetSearch(){
resetSearch() {
this.isClickedHistorySearch = false
this.isClickedHotSearch = false
this.isClickedRelatedSearch = false
... ... @@ -419,12 +449,12 @@ export struct SearchComponent {
this.isClickedHintSearch = false
}
calcHeight(value:number): number{
calcHeight(value: number): number {
return value * this.percent
}
}
function trackSearchClick(upOneLevelPageName: string,keyword:string){
function trackSearchClick(upOneLevelPageName: string, keyword: string) {
let params: ParamType = {}
params["keyword"] = keyword
... ...
... ... @@ -38,25 +38,53 @@ export struct ImageItemView {
* 通过http的request方法从网络下载图片资源
*/
async getPicture() {
console.info(`cj2024 getPicture`)
http.createHttp()
.request(this.imageUri,
(error: BusinessError, data: http.HttpResponse) => {
// 每一个httpRequest对应一个HTTP请求任务,不可复用
let httpRequest = http.createHttp();
// 用于订阅HTTP响应头事件
httpRequest.on('headersReceive', (header: Object) => {
console.info('header: ' + JSON.stringify(header));
});
// 用于订阅HTTP流式响应数据接收事件
let res = new ArrayBuffer(0);
httpRequest.on('dataReceive', (data: ArrayBuffer) => {
const newRes = new ArrayBuffer(res.byteLength + data.byteLength);
const resView = new Uint8Array(newRes);
resView.set(new Uint8Array(res));
resView.set(new Uint8Array(data), res.byteLength);
res = newRes;
// console.info('dataReceive res length: ' + res.byteLength);
});
// 用于订阅HTTP流式响应数据接收完毕事件
httpRequest.on('dataEnd', () => {
this.transcodePixelMap(res);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`dataEnd getPicture ${res}`)
if (res instanceof ArrayBuffer) {
console.info(`dataEnd getPicture`)
this.imageBuffer = res as ArrayBuffer;
}
console.info('No more data in response, data receive end');
});
httpRequest.requestInStream(this.imageUri,
(error: BusinessError, data: number) => {
if (error) {
// 下载失败时弹窗提示检查网络,不执行后续逻辑
promptAction.showToast({
message: $r('app.string.image_request_fail'),
duration: 2000
})
this.getPicture()
console.error(`http reqeust failed with. Code: ${error.code}, message: ${error.message}`);
return;
}
this.transcodePixelMap(data);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`cj2024 getPicture ${data.result}`)
if (data.result instanceof ArrayBuffer) {
console.info(`cj2024 getPicture 222`)
this.imageBuffer = data.result as ArrayBuffer;
}
// 取消订阅HTTP响应头事件
httpRequest.off('headersReceive');
// 取消订阅HTTP流式响应数据接收事件
httpRequest.off('dataReceive');
// 取消订阅HTTP流式响应数据接收完毕事件
httpRequest.off('dataEnd');
// 当该请求使用完毕时,调用destroy方法主动销毁
httpRequest.destroy();
}
)
}
... ... @@ -65,15 +93,12 @@ export struct ImageItemView {
* 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型
* @param data:网络获取到的资源
*/
transcodePixelMap(data: http.HttpResponse) {
console.info(`cj2024 transcodePixelMap ${data.responseCode}`)
if (http.ResponseCode.OK === data.responseCode) {
const imageData: ArrayBuffer = data.result as ArrayBuffer;
transcodePixelMap(data: ArrayBuffer) {
const imageData: ArrayBuffer = data;
// 通过ArrayBuffer创建图片源实例。
const imageSource: image.ImageSource = image.createImageSource(imageData);
this.initCurrentImageInfo(imageSource);
}
}
/**
* 根据图片宽高比及窗口大小计算图片的默认宽高,即,图片最适配屏幕的大小
... ...
... ... @@ -154,7 +154,12 @@ export struct LiveCountdownComponent {
if (StringUtils.isNotEmpty(this.liveDetailsBean.liveInfo?.planStartTime)) {
let playStartTimeTmp = this.liveDetailsBean.liveInfo?.planStartTime + ''
this.month = Number(playStartTimeTmp.substring(5, 7)).toString()
this.day = playStartTimeTmp.substring(8, 10)
let tempDay = playStartTimeTmp.substring(8, 10)
if(tempDay.startsWith('0')){
this.day = playStartTimeTmp.substring(9, 10)
}else{
this.day = tempDay
}
this.hour = playStartTimeTmp.substring(11, 13)
this.minute = playStartTimeTmp.substring(14, 16)
}
... ...
... ... @@ -223,6 +223,7 @@ export struct PlayUIComponent {
right: 4,
bottom: 1
})
// .margin({left: this.contentDetailData?.rmhInfo ? 0 : 34})
}
//回看
else if (this.contentDetailData.liveInfo?.liveState == 'end') {
... ...
... ... @@ -154,6 +154,7 @@ export struct PlayerTitleComponent {
top: 0,
bottom: 0
} : 4)
.margin({left: this.contentDetailData.rmhInfo?.rmhName ? 0 : 34})
}
}
}
... ...
... ... @@ -37,6 +37,7 @@ export struct PlayerProgressFullScreenView {
type: SliderBlockType.IMAGE,
image: $r('app.media.ic_player_block')
})
.trackThickness(1)
.blockSize({ width: 18, height: 12 })
.width('100%')
.height(19)
... ...
... ... @@ -107,7 +107,7 @@ export struct PlayerTitleView {
Row() {
Text("@" + this.getName())
.fontColor(Color.White)
.fontSize(17)
.fontSize(14)
.maxLines(1)
.lineHeight(25)
.fontWeight(600)
... ... @@ -115,7 +115,7 @@ export struct PlayerTitleView {
.textOverflow({ overflow: TextOverflow.Ellipsis })
if (this.getIcon()) {
Image(this.getIcon()).height(10).margin({ left: 4 })
Image(this.getIcon()).height(11).margin({ left: 4, top: 3 })
}
}.margin({ bottom: 8 })
... ... @@ -126,7 +126,7 @@ export struct PlayerTitleView {
.fontSize(15)
.maxLines(3)
.lineHeight(20)
.fontWeight(400)
.fontWeight(600)
.fontFamily('PingFang SC-Regular')
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: 8 })
... ...
... ... @@ -35,9 +35,6 @@ export struct MultiPictureDetailPageComponent {
private relId: string = ''
private contentId: string = ''
private relType: string = ''
private displayTool = display.getDefaultDisplaySync()
@State nShowDownloadTitleHeight: number = 0
@State titleHeight: number = 0
@State index: number = 0
@State currentIndex: number = 0
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
... ... @@ -51,7 +48,6 @@ export struct MultiPictureDetailPageComponent {
@State swiperIndex: number = 0;
@Provide followStatus: string | undefined = undefined // 关注状态
@Provide showCommentList: boolean = false
private subScroller: Scroller = new Scroller()
private scroller: Scroller = new Scroller()
private listScroller: ListScroller = new ListScroller()
@State contentStartOffset: number = 0;
... ... @@ -80,9 +76,6 @@ export struct MultiPictureDetailPageComponent {
}
async aboutToAppear() {
//获取宽高尺寸
this.titleHeight = this.displayTool.width * 227 / 375
this.nShowDownloadTitleHeight = this.displayTool.width * 311 / 375
//注册字体
// font.registerFont({
// familyName: 'BebasNeueBold',
... ...