Showing
18 changed files
with
378 additions
and
115 deletions
| @@ -42,6 +42,7 @@ export class CompDTO implements BaseDTO { | @@ -42,6 +42,7 @@ export class CompDTO implements BaseDTO { | ||
| 42 | imageScale: number = -1; // 封面图比例 1-4:3, 2-16:9, 3-3:2 | 42 | imageScale: number = -1; // 封面图比例 1-4:3, 2-16:9, 3-3:2 |
| 43 | audioDataList: AudioDTO[] = []; | 43 | audioDataList: AudioDTO[] = []; |
| 44 | titleShowPolicy: string | number = ''; | 44 | titleShowPolicy: string | number = ''; |
| 45 | + titleShow: string | number = ''; | ||
| 45 | /** | 46 | /** |
| 46 | * 组件内容源类型 (LIVE_HORIZONTAL_CARD\LIVE_RESERVATION\LIVE_LARGE_CARD\LIVE_END\LIVE_MONTHLY_RANKING ) | 47 | * 组件内容源类型 (LIVE_HORIZONTAL_CARD\LIVE_RESERVATION\LIVE_LARGE_CARD\LIVE_END\LIVE_MONTHLY_RANKING ) |
| 47 | */ | 48 | */ |
| @@ -105,6 +106,7 @@ export class CompDTO implements BaseDTO { | @@ -105,6 +106,7 @@ export class CompDTO implements BaseDTO { | ||
| 105 | comp.imageScale = old.imageScale | 106 | comp.imageScale = old.imageScale |
| 106 | comp.audioDataList = old.audioDataList | 107 | comp.audioDataList = old.audioDataList |
| 107 | comp.titleShowPolicy = old.titleShowPolicy | 108 | comp.titleShowPolicy = old.titleShowPolicy |
| 109 | + comp.titleShow = old.titleShow | ||
| 108 | comp.pageId = old.pageId | 110 | comp.pageId = old.pageId |
| 109 | comp.extraData = old.extraData | 111 | comp.extraData = old.extraData |
| 110 | comp.dataSourceType = old.dataSourceType | 112 | comp.dataSourceType = old.dataSourceType |
| @@ -91,6 +91,8 @@ export { OperRowListView } from './src/main/ets/components/view/OperRowListView' | @@ -91,6 +91,8 @@ export { OperRowListView } from './src/main/ets/components/view/OperRowListView' | ||
| 91 | 91 | ||
| 92 | export { LiveOperRowListView } from './src/main/ets/components/view/LiveOperRowListView'; | 92 | export { LiveOperRowListView } from './src/main/ets/components/view/LiveOperRowListView'; |
| 93 | 93 | ||
| 94 | +export { SaveNetWorkPictures } from './src/main/ets/components/SaveNetWorkPictures'; | ||
| 95 | + | ||
| 94 | export { ImageDownloadComponent } from './src/main/ets/components/ImageDownloadComponent'; | 96 | export { ImageDownloadComponent } from './src/main/ets/components/ImageDownloadComponent'; |
| 95 | 97 | ||
| 96 | export { PageRepository } from './src/main/ets/repository/PageRepository'; | 98 | export { PageRepository } from './src/main/ets/repository/PageRepository'; |
| @@ -107,6 +109,6 @@ export { MorningEveningViewModel } from './src/main/ets/viewmodel/MorningEvening | @@ -107,6 +109,6 @@ export { MorningEveningViewModel } from './src/main/ets/viewmodel/MorningEvening | ||
| 107 | 109 | ||
| 108 | export { GrayManageModel } from './src/main/ets/viewmodel/GrayManageModel' | 110 | export { GrayManageModel } from './src/main/ets/viewmodel/GrayManageModel' |
| 109 | 111 | ||
| 110 | -export { VoiceInputView } from './src/main/ets/components/comment/view/VoiceInputView' | 112 | +export { VoiceInputView } from './src/main/ets/components/comment/view/VoiceInputView' |
| 111 | 113 | ||
| 112 | // export {voicese} | 114 | // export {voicese} |
| @@ -50,10 +50,7 @@ export struct ENewspaperItemComponent { | @@ -50,10 +50,7 @@ export struct ENewspaperItemComponent { | ||
| 50 | }) | 50 | }) |
| 51 | .objectFit(ImageFit.Contain) | 51 | .objectFit(ImageFit.Contain) |
| 52 | .zIndex(10) | 52 | .zIndex(10) |
| 53 | - newsSkeleton({showBottom: false}) | ||
| 54 | - .visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None) | ||
| 55 | - .width('100%') | ||
| 56 | - .zIndex(1) | 53 | + |
| 57 | if (this.contentWidth !== 0) { | 54 | if (this.contentWidth !== 0) { |
| 58 | Canvas(this.context) | 55 | Canvas(this.context) |
| 59 | .width(px2vp(this.contentWidth)) | 56 | .width(px2vp(this.contentWidth)) |
| @@ -155,8 +155,8 @@ export struct MultiPictureDetailItemComponent { | @@ -155,8 +155,8 @@ export struct MultiPictureDetailItemComponent { | ||
| 155 | build() { | 155 | build() { |
| 156 | Swiper(this.swiperControllerItem){ | 156 | Swiper(this.swiperControllerItem){ |
| 157 | Row(){ // 居中显示 | 157 | Row(){ // 居中显示 |
| 158 | - List(){ | ||
| 159 | - ListItem(){ | 158 | + // List(){ |
| 159 | + // ListItem(){ | ||
| 160 | if(this.imageUri != null && (this.imageUri.includes('.gif') || this.imageUri.includes('.GIF'))){ | 160 | if(this.imageUri != null && (this.imageUri.includes('.gif') || this.imageUri.includes('.GIF'))){ |
| 161 | Image(this.imageUri)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 | 161 | Image(this.imageUri)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 |
| 162 | .alt($r('app.media.datail_imageLoading_w')) | 162 | .alt($r('app.media.datail_imageLoading_w')) |
| @@ -179,7 +179,7 @@ export struct MultiPictureDetailItemComponent { | @@ -179,7 +179,7 @@ export struct MultiPictureDetailItemComponent { | ||
| 179 | Image(this.imagePixelMap || 'app.media.datail_imageLoading_w')// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 | 179 | Image(this.imagePixelMap || 'app.media.datail_imageLoading_w')// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 |
| 180 | .alt($r('app.media.datail_imageLoading_w')) | 180 | .alt($r('app.media.datail_imageLoading_w')) |
| 181 | .width(this.imageWidth) | 181 | .width(this.imageWidth) |
| 182 | - .objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 | 182 | + .objectFit(ImageFit.Cover)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 |
| 183 | .interpolation(ImageInterpolation.High) | 183 | .interpolation(ImageInterpolation.High) |
| 184 | .autoResize(false) | 184 | .autoResize(false) |
| 185 | .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 | 185 | .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 |
| @@ -189,14 +189,15 @@ export struct MultiPictureDetailItemComponent { | @@ -189,14 +189,15 @@ export struct MultiPictureDetailItemComponent { | ||
| 189 | x: this.imageOffsetInfo.currentX, | 189 | x: this.imageOffsetInfo.currentX, |
| 190 | y: this.imageOffsetInfo.currentY | 190 | y: this.imageOffsetInfo.currentY |
| 191 | }) | 191 | }) |
| 192 | + | ||
| 192 | .onComplete(event => { | 193 | .onComplete(event => { |
| 193 | this.imageWidth = '100%' | 194 | this.imageWidth = '100%' |
| 194 | }) | 195 | }) |
| 195 | } | 196 | } |
| 196 | - } | ||
| 197 | - } | ||
| 198 | - .alignListItem(ListItemAlign.Center) | ||
| 199 | - .scrollBarWidth(0) | 197 | + // } |
| 198 | + // } | ||
| 199 | + // .alignListItem(ListItemAlign.Center) | ||
| 200 | + // .scrollBarWidth(0) | ||
| 200 | } | 201 | } |
| 201 | .justifyContent(FlexAlign.Center) | 202 | .justifyContent(FlexAlign.Center) |
| 202 | } | 203 | } |
| 1 | +/* | ||
| 2 | + * Copyright (c) 2024 Huawei Device Co., Ltd. | ||
| 3 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | + * you may not use this file except in compliance with the License. | ||
| 5 | + * You may obtain a copy of the License at | ||
| 6 | + * | ||
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | + * | ||
| 9 | + * Unless required by applicable law or agreed to in writing, software | ||
| 10 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | + * See the License for the specific language governing permissions and | ||
| 13 | + * limitations under the License. | ||
| 14 | + */ | ||
| 15 | + | ||
| 16 | +import http from '@ohos.net.http'; | ||
| 17 | +import ResponseCode from '@ohos.net.http'; | ||
| 18 | +import { image } from '@kit.ImageKit'; | ||
| 19 | +import { BusinessError } from '@ohos.base'; | ||
| 20 | +import common from '@ohos.app.ability.common'; | ||
| 21 | +import photoAccessHelper from '@ohos.file.photoAccessHelper'; | ||
| 22 | +import fs from '@ohos.file.fs'; | ||
| 23 | +import promptAction from '@ohos.promptAction'; | ||
| 24 | +import picker from '@ohos.file.picker'; | ||
| 25 | +import { taskpool } from '@kit.ArkTS'; | ||
| 26 | +import { httpRequest } from '../utils/httpRequest'; | ||
| 27 | + | ||
| 28 | + | ||
| 29 | +/** | ||
| 30 | + * 实现步骤: | ||
| 31 | + * 点击上部“下载”按钮进入”下载网络图片到手机相册”场景示例;点击下部“下载到指定路径”按钮进入”下载文件到指定用户目录”场景示例, | ||
| 32 | + * 从而实现手机相册并进行网络图片的下载和保存。 | ||
| 33 | + * photoAccessHelper参考文档: | ||
| 34 | + * https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-photoaccesshelper | ||
| 35 | + * saveButton参考文档 | ||
| 36 | + * https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/savebutton-0000001820999677 | ||
| 37 | + */ | ||
| 38 | +@Concurrent | ||
| 39 | +async function getPicture(imageUrl: string): Promise<ArrayBuffer> { | ||
| 40 | + let ret: ArrayBuffer = await new Promise((resolve, reject) => { | ||
| 41 | + httpRequest.httpRequestInStream(imageUrl, (res: ArrayBuffer) => { | ||
| 42 | + resolve(res); // 成功时解析Promise | ||
| 43 | + }, () => { | ||
| 44 | + // 下载失败时弹窗提示检查网络 | ||
| 45 | + promptAction.showToast({ | ||
| 46 | + message: $r('app.string.image_request_fail'), | ||
| 47 | + duration: 2000 | ||
| 48 | + }); | ||
| 49 | + reject(new Error('Image download failed')); // 失败时拒绝Promise | ||
| 50 | + }); | ||
| 51 | + }); | ||
| 52 | + return ret | ||
| 53 | +} | ||
| 54 | + | ||
| 55 | +@Component | ||
| 56 | +export struct SaveNetWorkPictures { | ||
| 57 | + @State image: PixelMap | undefined = undefined; | ||
| 58 | + @State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; // 相册模块管理实例 | ||
| 59 | + @State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer | ||
| 60 | + // @Prop @Watch('onChangeUrl') url: string = '' | ||
| 61 | + @Prop @Watch('onChangeUrl') url: string = '' | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * 通过http的request方法从网络下载图片资源 | ||
| 65 | + */ | ||
| 66 | + async getPicture() { | ||
| 67 | + http.createHttp()// 显示网络图片的地址 | ||
| 68 | + // .request('https://gitee.com/harmonyos-cases/cases/raw/master/CommonAppDevelopment/feature/variablewatch/src/main/resources/base/media/variablewatch_grape.png', | ||
| 69 | + // .request('https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240830/image/content/4d61839662044ac796ec7331a90da5d8.jpg', | ||
| 70 | + .request(this.url, | ||
| 71 | + (error: BusinessError, data: http.HttpResponse) => { | ||
| 72 | + if (error) { | ||
| 73 | + // 下载失败时弹窗提示检查网络,不执行后续逻辑 | ||
| 74 | + promptAction.showToast({ | ||
| 75 | + message: '下载失败', | ||
| 76 | + duration: 2000 | ||
| 77 | + }) | ||
| 78 | + return; | ||
| 79 | + } | ||
| 80 | + this.transcodePixelMap(data); | ||
| 81 | + // 判断网络获取到的资源是否为ArrayBuffer类型 | ||
| 82 | + if (data.result instanceof ArrayBuffer) { | ||
| 83 | + this.imageBuffer = data.result as ArrayBuffer; | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + ) | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型 | ||
| 91 | + * @param data:网络获取到的资源 | ||
| 92 | + */ | ||
| 93 | + transcodePixelMap(data: http.HttpResponse) { | ||
| 94 | + if (ResponseCode.ResponseCode.OK === data.responseCode) { | ||
| 95 | + const imageData: ArrayBuffer = data.result as ArrayBuffer; | ||
| 96 | + // 通过ArrayBuffer创建图片源实例。 | ||
| 97 | + const imageSource: image.ImageSource = image.createImageSource(imageData); | ||
| 98 | + const options: image.InitializationOptions = { | ||
| 99 | + 'alphaType': 0, // 透明度 | ||
| 100 | + 'editable': false, // 是否可编辑 | ||
| 101 | + 'pixelFormat': 3, // 像素格式 | ||
| 102 | + 'scaleMode': 1, // 缩略值 | ||
| 103 | + 'size': { height: 50, width: 50 } | ||
| 104 | + }; // 创建图片大小 | ||
| 105 | + | ||
| 106 | + // 通过属性创建PixelMap | ||
| 107 | + imageSource.createPixelMap(options).then((pixelMap: PixelMap) => { | ||
| 108 | + this.image = pixelMap; | ||
| 109 | + }); | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * 保存ArrayBuffer到图库 | ||
| 115 | + * @param buffer:图片ArrayBuffer | ||
| 116 | + * @returns | ||
| 117 | + */ | ||
| 118 | + async saveImage(buffer: ArrayBuffer | string): Promise<void> { | ||
| 119 | + const context = getContext(this) as common.UIAbilityContext; // 获取getPhotoAccessHelper需要的context | ||
| 120 | + const helper = photoAccessHelper.getPhotoAccessHelper(context); // 获取相册管理模块的实例 | ||
| 121 | + const uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'jpg'); // 指定待创建的文件类型、后缀和创建选项,创建图片或视频资源 | ||
| 122 | + const file = await fs.open(uri, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); | ||
| 123 | + await fs.write(file.fd, buffer); | ||
| 124 | + await fs.close(file.fd); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + /** | ||
| 128 | + * 保存ArrayBuffer到用户选择的路径 | ||
| 129 | + * @param buffer:图片ArrayBuffer | ||
| 130 | + * @returns | ||
| 131 | + */ | ||
| 132 | + async pickerSave(buffer: ArrayBuffer | string): Promise<void> { | ||
| 133 | + const photoSaveOptions = new picker.PhotoSaveOptions(); // 创建文件管理器保存选项实例 | ||
| 134 | + photoSaveOptions.newFileNames = ['PhotoViewPicker ' + new Date().getTime() + '.jpg']; // 保存文件名(可选) | ||
| 135 | + const photoViewPicker = new picker.PhotoViewPicker; | ||
| 136 | + photoViewPicker.save(photoSaveOptions) | ||
| 137 | + .then(async (photoSvaeResult) => { | ||
| 138 | + const uri = photoSvaeResult[0]; | ||
| 139 | + const file = await fs.open(uri, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); | ||
| 140 | + await fs.write(file.fd, buffer); | ||
| 141 | + await fs.close(file.fd); | ||
| 142 | + promptAction.showToast({ | ||
| 143 | + message: '保存成功', | ||
| 144 | + duration: 2000 | ||
| 145 | + }) | ||
| 146 | + }); | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + async aboutToAppear(): Promise<void> { | ||
| 150 | + // this.getPicture(); | ||
| 151 | + this.onChangeUrl() | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + build() { | ||
| 155 | + Stack({ alignContent: Alignment.Center }) { | ||
| 156 | + // Column() { | ||
| 157 | + // Text('下载') | ||
| 158 | + // .fontWeight(FontWeight.Medium) | ||
| 159 | + // } | ||
| 160 | + | ||
| 161 | + Image(this.image) | ||
| 162 | + .objectFit(ImageFit.Contain) | ||
| 163 | + .width('50%') | ||
| 164 | + .height(28) | ||
| 165 | + | ||
| 166 | + SaveButton({ icon: SaveIconStyle.FULL_FILLED, buttonType: ButtonType.Capsule }) | ||
| 167 | + .iconSize(24) | ||
| 168 | + .backgroundColor(Color.Transparent) | ||
| 169 | + .iconColor(Color.White)// .markAnchor({ x: '100%' }) | ||
| 170 | + .position({ x: '25%' }) | ||
| 171 | + .onClick(async () => { | ||
| 172 | + if (this.imageBuffer !== undefined) { | ||
| 173 | + await this.saveImage(this.imageBuffer); | ||
| 174 | + promptAction.showToast({ | ||
| 175 | + message: '保存成功', | ||
| 176 | + duration: 2000 | ||
| 177 | + }) | ||
| 178 | + } | ||
| 179 | + }) | ||
| 180 | + | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + // .alignSelf(ItemAlign.Center) | ||
| 184 | + // .align(Alignment.Center) | ||
| 185 | + // .backgroundColor(Color.Red) | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + async onChangeUrl(): Promise<void> { | ||
| 189 | + console.info(`cj2024 图片下载 ${this.url}`) | ||
| 190 | + // const context = getContext(this) as common.UIAbilityContext; | ||
| 191 | + // const atManager = abilityAccessCtrl.createAtManager(); | ||
| 192 | + // await atManager.requestPermissionsFromUser(context, PERMISSIONS); | ||
| 193 | + // 通过任务池(taskpool)从网络下载图片资源 | ||
| 194 | + taskpool.execute(getPicture, this.url).then((res) => { | ||
| 195 | + const imgBuffer = res as ArrayBuffer | ||
| 196 | + this.imageBuffer = imgBuffer; | ||
| 197 | + }) | ||
| 198 | + } | ||
| 199 | +} |
| @@ -155,24 +155,26 @@ export struct SpacialTopicPageComponent { | @@ -155,24 +155,26 @@ export struct SpacialTopicPageComponent { | ||
| 155 | // .fontWeight(500) | 155 | // .fontWeight(500) |
| 156 | // .visibility(this.action?.params?.backVisibility && this.isPageEnd ? Visibility.Visible : Visibility.None) | 156 | // .visibility(this.action?.params?.backVisibility && this.isPageEnd ? Visibility.Visible : Visibility.None) |
| 157 | 157 | ||
| 158 | - WdWebComponent({ | ||
| 159 | - webviewControl: this.webviewControl, | ||
| 160 | - webUrl: this.webUrl, | ||
| 161 | - reload: this.reload, | ||
| 162 | - onWebPrepared: this.onWebPrepared.bind(this), | ||
| 163 | - isPageEnd: $isPageEnd, | ||
| 164 | - receiveH5SendToNativeData: this.receiveH5SendToNativeData.bind(this) | ||
| 165 | - }) | 158 | + RelativeContainer() { |
| 159 | + | ||
| 160 | + WdWebComponent({ | ||
| 161 | + webviewControl: this.webviewControl, | ||
| 162 | + webUrl: this.webUrl, | ||
| 163 | + reload: this.reload, | ||
| 164 | + onWebPrepared: this.onWebPrepared.bind(this), | ||
| 165 | + isPageEnd: $isPageEnd, | ||
| 166 | + receiveH5SendToNativeData: this.receiveH5SendToNativeData.bind(this) | ||
| 167 | + }) | ||
| 168 | + .id('web_page') | ||
| 169 | + | ||
| 170 | + // 挂角广告 | ||
| 171 | + this.pageHornAd() | ||
| 172 | + } | ||
| 166 | } | 173 | } |
| 167 | .width(CommonConstants.FULL_WIDTH) | 174 | .width(CommonConstants.FULL_WIDTH) |
| 168 | .height(CommonConstants.FULL_HEIGHT) | 175 | .height(CommonConstants.FULL_HEIGHT) |
| 169 | .padding({ bottom: this.action?.params?.backVisibility ? 115 : 75 }) | 176 | .padding({ bottom: this.action?.params?.backVisibility ? 115 : 75 }) |
| 170 | 177 | ||
| 171 | - // RelativeContainer() { | ||
| 172 | - // // 挂角广告 | ||
| 173 | - // this.pageHornAd() | ||
| 174 | - // } | ||
| 175 | - | ||
| 176 | if (!this.isNetConnected) { | 178 | if (!this.isNetConnected) { |
| 177 | Column() { | 179 | Column() { |
| 178 | Image($r('app.media.line')) | 180 | Image($r('app.media.line')) |
| @@ -29,24 +29,14 @@ export struct LiveFollowComponent { | @@ -29,24 +29,14 @@ export struct LiveFollowComponent { | ||
| 29 | @State followStatus: String = '0'; | 29 | @State followStatus: String = '0'; |
| 30 | 30 | ||
| 31 | build() { | 31 | build() { |
| 32 | - Stack() { | ||
| 33 | - Stack() | ||
| 34 | - .height(22) | ||
| 35 | - .width(150) | ||
| 36 | - .backgroundColor('#000000') | ||
| 37 | - .opacity(0.3) | ||
| 38 | - .borderRadius({ | ||
| 39 | - topLeft: 90, | ||
| 40 | - bottomLeft: 90 | ||
| 41 | - }) | ||
| 42 | Row() { | 32 | Row() { |
| 43 | - Stack({alignContent: Alignment.Bottom}){ | 33 | + Stack({ alignContent: Alignment.Bottom }) { |
| 44 | //号主头像 | 34 | //号主头像 |
| 45 | Image(this.rmhInfo.rmhHeadUrl) | 35 | Image(this.rmhInfo.rmhHeadUrl) |
| 46 | .alt($r('app.media.icon_default_head_mater')) | 36 | .alt($r('app.media.icon_default_head_mater')) |
| 47 | .width(24) | 37 | .width(24) |
| 48 | .height(24) | 38 | .height(24) |
| 49 | - .borderRadius(90) | 39 | + .borderRadius(12) |
| 50 | .onClick(() => { | 40 | .onClick(() => { |
| 51 | // 跳转到号主页 | 41 | // 跳转到号主页 |
| 52 | if (this.contentDetailData.rmhInfo?.cnMainControl === 1) { | 42 | if (this.contentDetailData.rmhInfo?.cnMainControl === 1) { |
| @@ -57,8 +47,8 @@ export struct LiveFollowComponent { | @@ -57,8 +47,8 @@ export struct LiveFollowComponent { | ||
| 57 | WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) | 47 | WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) |
| 58 | } | 48 | } |
| 59 | }) | 49 | }) |
| 60 | - if(this.contentDetailData.rmhInfo?.authIcon){ | ||
| 61 | - Row(){ | 50 | + if (this.contentDetailData.rmhInfo?.authIcon) { |
| 51 | + Row() { | ||
| 62 | Image(this.contentDetailData.rmhInfo?.authIcon) | 52 | Image(this.contentDetailData.rmhInfo?.authIcon) |
| 63 | .width(10) | 53 | .width(10) |
| 64 | .height(10) | 54 | .height(10) |
| @@ -67,20 +57,22 @@ export struct LiveFollowComponent { | @@ -67,20 +57,22 @@ export struct LiveFollowComponent { | ||
| 67 | .justifyContent(FlexAlign.End) | 57 | .justifyContent(FlexAlign.End) |
| 68 | } | 58 | } |
| 69 | }.width(24).height(24) | 59 | }.width(24).height(24) |
| 70 | - | 60 | + .margin({ |
| 61 | + left: 0, | ||
| 62 | + top: 0, | ||
| 63 | + bottom: 0, | ||
| 64 | + }) | ||
| 71 | //号主名称 | 65 | //号主名称 |
| 72 | Text(this.rmhInfo.rmhName) | 66 | Text(this.rmhInfo.rmhName) |
| 73 | .fontColor(Color.White) | 67 | .fontColor(Color.White) |
| 74 | - .textOverflow({overflow:TextOverflow.Ellipsis}) | 68 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 75 | .maxLines(1) | 69 | .maxLines(1) |
| 76 | .fontWeight(500) | 70 | .fontWeight(500) |
| 77 | .fontSize('12fp') | 71 | .fontSize('12fp') |
| 78 | - .layoutWeight(1) | ||
| 79 | .margin({ | 72 | .margin({ |
| 80 | left: 4, | 73 | left: 4, |
| 81 | right: 6 | 74 | right: 6 |
| 82 | }) | 75 | }) |
| 83 | - Blank() | ||
| 84 | //关注状态 | 76 | //关注状态 |
| 85 | Text(this.followStatus === '0' ? '关注' : '已关注') | 77 | Text(this.followStatus === '0' ? '关注' : '已关注') |
| 86 | .fontColor(Color.White) | 78 | .fontColor(Color.White) |
| @@ -93,16 +85,21 @@ export struct LiveFollowComponent { | @@ -93,16 +85,21 @@ export struct LiveFollowComponent { | ||
| 93 | bottom: 3 | 85 | bottom: 3 |
| 94 | }) | 86 | }) |
| 95 | .borderRadius(2) | 87 | .borderRadius(2) |
| 96 | - .margin({ right: 2 }) | 88 | + .width(36) |
| 89 | + .margin({right:2}) | ||
| 97 | .backgroundColor(this.followStatus === '0' ? $r('app.color.color_ED2800') : $r('app.color.color_CCCCCC')) | 90 | .backgroundColor(this.followStatus === '0' ? $r('app.color.color_ED2800') : $r('app.color.color_CCCCCC')) |
| 98 | .visibility(this.followStatus === '0' ? Visibility.Visible : Visibility.None) | 91 | .visibility(this.followStatus === '0' ? Visibility.Visible : Visibility.None) |
| 99 | .onClick(() => { | 92 | .onClick(() => { |
| 100 | this.handleAccention() | 93 | this.handleAccention() |
| 101 | }) | 94 | }) |
| 102 | } | 95 | } |
| 103 | - .height(22) | ||
| 104 | - .width(150) | ||
| 105 | - } | 96 | + .backgroundColor("#30000000") |
| 97 | + .borderRadius({ | ||
| 98 | + topLeft: 12, | ||
| 99 | + bottomLeft: 12, | ||
| 100 | + topRight: 2, | ||
| 101 | + bottomRight: 2 | ||
| 102 | + }) | ||
| 106 | } | 103 | } |
| 107 | 104 | ||
| 108 | /** | 105 | /** |
| @@ -28,7 +28,7 @@ export struct Card5Component { | @@ -28,7 +28,7 @@ export struct Card5Component { | ||
| 28 | @State textArr: textItem[] = [] | 28 | @State textArr: textItem[] = [] |
| 29 | 29 | ||
| 30 | async aboutToAppear(): Promise<void> { | 30 | async aboutToAppear(): Promise<void> { |
| 31 | - console.log('Card2Component', JSON.stringify(this.compDTO)) | 31 | + console.log('Card2Component', JSON.stringify(this.compDTO),this.contentDTO.titleShow) |
| 32 | const curRouter = router.getState().name; | 32 | const curRouter = router.getState().name; |
| 33 | this.clicked = hasClicked(this.contentDTO.objectId, curRouter) | 33 | this.clicked = hasClicked(this.contentDTO.objectId, curRouter) |
| 34 | this.loadImg = await onlyWifiLoadImg(); | 34 | this.loadImg = await onlyWifiLoadImg(); |
| @@ -66,7 +66,7 @@ export struct Card5Component { | @@ -66,7 +66,7 @@ export struct Card5Component { | ||
| 66 | ) | 66 | ) |
| 67 | .height(this.loadImg ? '' : 114) | 67 | .height(this.loadImg ? '' : 114) |
| 68 | .autoResize(true) | 68 | .autoResize(true) |
| 69 | - if (!!this.titleShowPolicy || this.titleShowPolicy === null) { | 69 | + if (this.contentDTO.titleShow == 1 || this.contentDTO.titleShow == null) { |
| 70 | Row() | 70 | Row() |
| 71 | .borderRadius( | 71 | .borderRadius( |
| 72 | { | 72 | { |
| @@ -13,7 +13,10 @@ const DiyCloseTipsString = '关闭后,将不会使用你的偏好进行内容 | @@ -13,7 +13,10 @@ const DiyCloseTipsString = '关闭后,将不会使用你的偏好进行内容 | ||
| 13 | @Entry | 13 | @Entry |
| 14 | @Component | 14 | @Component |
| 15 | export struct PrivacySettingPage { | 15 | export struct PrivacySettingPage { |
| 16 | - @State listData: Array<PrivacySettingModel> = [new PrivacySettingModel(DiyString, false, 'ohos.permission.READ_IMAGEVIDEO'), new PrivacySettingModel('相册权限', false, 'ohos.permission.READ_IMAGEVIDEO'), new PrivacySettingModel('相机权限', false, 'ohos.permission.CAMERA'), new PrivacySettingModel('定位权限', false, 'ohos.permission.APPROXIMATELY_LOCATION'), new PrivacySettingModel('麦克风权限', false, 'ohos.permission.MICROPHONE')]; | 16 | + // @State listData: Array<PrivacySettingModel> = [new PrivacySettingModel(DiyString, false, 'ohos.permission.READ_IMAGEVIDEO'), new PrivacySettingModel('相册权限', false, 'ohos.permission.READ_IMAGEVIDEO'), new PrivacySettingModel('相机权限', false, 'ohos.permission.CAMERA'), new PrivacySettingModel('定位权限', false, 'ohos.permission.APPROXIMATELY_LOCATION'), new PrivacySettingModel('麦克风权限', false, 'ohos.permission.MICROPHONE')]; |
| 17 | + | ||
| 18 | + @State listData: Array<PrivacySettingModel> = [new PrivacySettingModel(DiyString, false, 'ohos.permission.READ_IMAGEVIDEO'), new PrivacySettingModel('定位权限', false, 'ohos.permission.APPROXIMATELY_LOCATION'), new PrivacySettingModel('麦克风权限', false, 'ohos.permission.MICROPHONE')]; | ||
| 19 | + | ||
| 17 | tips: string = '设置前可查阅' | 20 | tips: string = '设置前可查阅' |
| 18 | privacyTips: string = '《隐私政策》' | 21 | privacyTips: string = '《隐私政策》' |
| 19 | tipsEnd = '中相应权限使用规则' | 22 | tipsEnd = '中相应权限使用规则' |
| @@ -79,7 +82,7 @@ export struct PrivacySettingPage { | @@ -79,7 +82,7 @@ export struct PrivacySettingPage { | ||
| 79 | build() { | 82 | build() { |
| 80 | Column(){ | 83 | Column(){ |
| 81 | Column(){ | 84 | Column(){ |
| 82 | - TitleBackComponent({title:"隐私设置"}) | 85 | + TitleBackComponent({title:"隐私设置"}).backgroundColor(Color.White) |
| 83 | 86 | ||
| 84 | //滑动区域 | 87 | //滑动区域 |
| 85 | this.PrivacySettingComponentsUI() | 88 | this.PrivacySettingComponentsUI() |
| @@ -388,7 +388,10 @@ export struct TopNavigationComponentNew { | @@ -388,7 +388,10 @@ export struct TopNavigationComponentNew { | ||
| 388 | .fontColor(this.tabSelectedColor(this.currentTopNavSelectedIndex === index)) | 388 | .fontColor(this.tabSelectedColor(this.currentTopNavSelectedIndex === index)) |
| 389 | .padding({ | 389 | .padding({ |
| 390 | top: $r('app.float.top_tab_item_padding_top'), | 390 | top: $r('app.float.top_tab_item_padding_top'), |
| 391 | - bottom: $r('app.float.top_tab_item_padding_bottom') | 391 | + bottom: $r('app.float.top_tab_item_padding_bottom'), |
| 392 | + left:2, | ||
| 393 | + right:2 | ||
| 394 | + | ||
| 392 | }) | 395 | }) |
| 393 | .maxLines(this.MAX_LINE) | 396 | .maxLines(this.MAX_LINE) |
| 394 | .id(index.toString()) | 397 | .id(index.toString()) |
| 1 | import { PhotoListBean } from 'wdBean/Index'; | 1 | import { PhotoListBean } from 'wdBean/Index'; |
| 2 | import { display, router } from '@kit.ArkUI'; | 2 | import { display, router } from '@kit.ArkUI'; |
| 3 | -import { ImageDownloadComponent } from '../components/ImageDownloadComponent'; | ||
| 4 | import { MultiPictureDetailItemComponent } from '../components/MultiPictureDetailItemComponent'; | 3 | import { MultiPictureDetailItemComponent } from '../components/MultiPictureDetailItemComponent'; |
| 5 | 4 | ||
| 6 | import { Action } from 'wdBean'; | 5 | import { Action } from 'wdBean'; |
| 7 | import { WindowModel } from 'wdKit/Index'; | 6 | import { WindowModel } from 'wdKit/Index'; |
| 7 | +import { SaveNetWorkPictures } from '../components/SaveNetWorkPictures'; | ||
| 8 | 8 | ||
| 9 | const TAG = 'MultiPictureListPage'; | 9 | const TAG = 'MultiPictureListPage'; |
| 10 | 10 | ||
| @@ -28,10 +28,9 @@ export struct MultiPictureListPage { | @@ -28,10 +28,9 @@ export struct MultiPictureListPage { | ||
| 28 | 28 | ||
| 29 | pageTransition() { | 29 | pageTransition() { |
| 30 | // PageTransitionEnter({ duration: this.noAnimation ? 0 : 300 }) | 30 | // PageTransitionEnter({ duration: this.noAnimation ? 0 : 300 }) |
| 31 | - PageTransitionExit({ duration: !this.noAnimation ? 0 : 300 }) | 31 | + PageTransitionExit({ duration: !this.noAnimation ? 0 : 300 }) |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | - | ||
| 35 | aboutToAppear(): void { | 34 | aboutToAppear(): void { |
| 36 | //获取宽高尺寸 | 35 | //获取宽高尺寸 |
| 37 | this.screenWidth = this.displayTool.width | 36 | this.screenWidth = this.displayTool.width |
| @@ -47,17 +46,17 @@ export struct MultiPictureListPage { | @@ -47,17 +46,17 @@ export struct MultiPictureListPage { | ||
| 47 | 46 | ||
| 48 | onPageShow(): void { | 47 | onPageShow(): void { |
| 49 | console.log(TAG, 'onPageShow') | 48 | console.log(TAG, 'onPageShow') |
| 50 | - WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff'}) | 49 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff' }) |
| 51 | } | 50 | } |
| 52 | 51 | ||
| 53 | onPageHide(): void { | 52 | onPageHide(): void { |
| 54 | console.log(TAG, 'onPageHide') | 53 | console.log(TAG, 'onPageHide') |
| 55 | - WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000'}) | 54 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000' }) |
| 56 | } | 55 | } |
| 57 | 56 | ||
| 58 | build() { | 57 | build() { |
| 59 | RelativeContainer() { | 58 | RelativeContainer() { |
| 60 | - Row(){ | 59 | + Row() { |
| 61 | Image($r('app.media.icon_arrow_left_white')) | 60 | Image($r('app.media.icon_arrow_left_white')) |
| 62 | .width(24) | 61 | .width(24) |
| 63 | .height(24) | 62 | .height(24) |
| @@ -121,7 +120,9 @@ export struct MultiPictureListPage { | @@ -121,7 +120,9 @@ export struct MultiPictureListPage { | ||
| 121 | } | 120 | } |
| 122 | .alignSelf(ItemAlign.Center) | 121 | .alignSelf(ItemAlign.Center) |
| 123 | .fontColor(Color.White) | 122 | .fontColor(Color.White) |
| 124 | - ImageDownloadComponent({ url: this.currentUrl }) | 123 | + |
| 124 | + // ImageDownloadComponent({ url: this.currentUrl }) | ||
| 125 | + SaveNetWorkPictures({ url: this.currentUrl }) | ||
| 125 | } | 126 | } |
| 126 | .margin({ | 127 | .margin({ |
| 127 | top: 14, | 128 | top: 14, |
| @@ -129,6 +130,7 @@ export struct MultiPictureListPage { | @@ -129,6 +130,7 @@ export struct MultiPictureListPage { | ||
| 129 | bottom: 14, | 130 | bottom: 14, |
| 130 | right: 0 | 131 | right: 0 |
| 131 | }) | 132 | }) |
| 133 | + // .backgroundColor(Color.Blue) | ||
| 132 | .id('e_swiper_titles') | 134 | .id('e_swiper_titles') |
| 133 | .alignRules({ | 135 | .alignRules({ |
| 134 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | 136 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, |
| @@ -55,7 +55,7 @@ export struct TabLiveItemComponent { | @@ -55,7 +55,7 @@ export struct TabLiveItemComponent { | ||
| 55 | .fontColor('#999999') | 55 | .fontColor('#999999') |
| 56 | .margin({ left: 8 }) | 56 | .margin({ left: 8 }) |
| 57 | .visibility(StringUtils.isNotEmpty(this.item.time) ? Visibility.Visible : Visibility.None) | 57 | .visibility(StringUtils.isNotEmpty(this.item.time) ? Visibility.Visible : Visibility.None) |
| 58 | - | 58 | + Blank() |
| 59 | Text('置顶') | 59 | Text('置顶') |
| 60 | .fontSize('11vp') | 60 | .fontSize('11vp') |
| 61 | .fontWeight(400) | 61 | .fontWeight(400) |
| @@ -126,6 +126,7 @@ export struct TabLiveItemComponent { | @@ -126,6 +126,7 @@ export struct TabLiveItemComponent { | ||
| 126 | else if (this.item.dataType === LiveMessageOptType.ZH_VIDEO_MSG) { | 126 | else if (this.item.dataType === LiveMessageOptType.ZH_VIDEO_MSG) { |
| 127 | RelativeContainer() { | 127 | RelativeContainer() { |
| 128 | Image(this.item.transcodeImageUrl) | 128 | Image(this.item.transcodeImageUrl) |
| 129 | + .alt($r('app.media.cover_place_holder')) | ||
| 129 | .width('100%') | 130 | .width('100%') |
| 130 | .objectFit(ImageFit.Cover) | 131 | .objectFit(ImageFit.Cover) |
| 131 | .borderRadius(4) | 132 | .borderRadius(4) |
| @@ -271,7 +272,7 @@ export struct TabLiveItemComponent { | @@ -271,7 +272,7 @@ export struct TabLiveItemComponent { | ||
| 271 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 272 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 272 | .fontSize(11) | 273 | .fontSize(11) |
| 273 | .fontWeight(400) | 274 | .fontWeight(400) |
| 274 | - .fontColor("#CB0000") | 275 | + .fontColor("#ED2800") |
| 275 | .backgroundColor('#F1EFEB') | 276 | .backgroundColor('#F1EFEB') |
| 276 | .padding({ | 277 | .padding({ |
| 277 | left: 4, | 278 | left: 4, |
| @@ -173,7 +173,7 @@ export struct PlayUIComponent { | @@ -173,7 +173,7 @@ export struct PlayUIComponent { | ||
| 173 | .width('100%') | 173 | .width('100%') |
| 174 | // .width(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? 'calc(100% - 80vp)' : 'calc(100% - 32vp)') | 174 | // .width(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? 'calc(100% - 80vp)' : 'calc(100% - 32vp)') |
| 175 | .padding({ | 175 | .padding({ |
| 176 | - top: 11, | 176 | + top: 13, |
| 177 | bottom: 6, | 177 | bottom: 6, |
| 178 | left: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp', | 178 | left: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp', |
| 179 | right: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp' | 179 | right: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp' |
| @@ -189,21 +189,19 @@ export struct PlayUIComponent { | @@ -189,21 +189,19 @@ export struct PlayUIComponent { | ||
| 189 | // 预约 | 189 | // 预约 |
| 190 | if (this.contentDetailData.liveInfo?.liveState == 'wait') { | 190 | if (this.contentDetailData.liveInfo?.liveState == 'wait') { |
| 191 | Row() { | 191 | Row() { |
| 192 | - | ||
| 193 | Image($r('app.media.icon_live_status_wait')) | 192 | Image($r('app.media.icon_live_status_wait')) |
| 194 | .width(22) | 193 | .width(22) |
| 195 | .height(18) | 194 | .height(18) |
| 196 | Text('预约') | 195 | Text('预约') |
| 197 | - .fontSize('11fp') | 196 | + .fontSize('11vp') |
| 198 | .fontWeight(400) | 197 | .fontWeight(400) |
| 199 | .fontColor(Color.White) | 198 | .fontColor(Color.White) |
| 200 | } | 199 | } |
| 201 | .backgroundColor('#4D000000') | 200 | .backgroundColor('#4D000000') |
| 202 | .padding({ | 201 | .padding({ |
| 203 | - top: 1, | ||
| 204 | - right: 4, | ||
| 205 | - bottom: 1 | 202 | + right: 4 |
| 206 | }) | 203 | }) |
| 204 | + .borderRadius(2) | ||
| 207 | } | 205 | } |
| 208 | // 直播中 | 206 | // 直播中 |
| 209 | else if (this.contentDetailData.liveInfo?.liveState == 'running') { | 207 | else if (this.contentDetailData.liveInfo?.liveState == 'running') { |
| @@ -224,7 +222,7 @@ export struct PlayUIComponent { | @@ -224,7 +222,7 @@ export struct PlayUIComponent { | ||
| 224 | } | 222 | } |
| 225 | 223 | ||
| 226 | Text('直播中') | 224 | Text('直播中') |
| 227 | - .fontSize('11fp') | 225 | + .fontSize('11vp') |
| 228 | .fontWeight(400) | 226 | .fontWeight(400) |
| 229 | .fontColor(Color.White) | 227 | .fontColor(Color.White) |
| 230 | 228 | ||
| @@ -233,7 +231,7 @@ export struct PlayUIComponent { | @@ -233,7 +231,7 @@ export struct PlayUIComponent { | ||
| 233 | .width(12) | 231 | .width(12) |
| 234 | .height(12) | 232 | .height(12) |
| 235 | Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`) | 233 | Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`) |
| 236 | - .fontSize('11fp') | 234 | + .fontSize('11vp') |
| 237 | .fontWeight(400) | 235 | .fontWeight(400) |
| 238 | .fontColor(Color.White) | 236 | .fontColor(Color.White) |
| 239 | } | 237 | } |
| @@ -241,9 +239,7 @@ export struct PlayUIComponent { | @@ -241,9 +239,7 @@ export struct PlayUIComponent { | ||
| 241 | } | 239 | } |
| 242 | .backgroundColor('#4D000000') | 240 | .backgroundColor('#4D000000') |
| 243 | .padding({ | 241 | .padding({ |
| 244 | - top: 1, | ||
| 245 | right: 4, | 242 | right: 4, |
| 246 | - bottom: 1, | ||
| 247 | }) | 243 | }) |
| 248 | .margin( | 244 | .margin( |
| 249 | { | 245 | { |
| @@ -252,6 +248,7 @@ export struct PlayUIComponent { | @@ -252,6 +248,7 @@ export struct PlayUIComponent { | ||
| 252 | : this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ? 34 : 0 | 248 | : this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ? 34 : 0 |
| 253 | } | 249 | } |
| 254 | ) | 250 | ) |
| 251 | + .borderRadius(2) | ||
| 255 | } | 252 | } |
| 256 | //回看 | 253 | //回看 |
| 257 | else if (this.contentDetailData.liveInfo?.liveState == 'end') { | 254 | else if (this.contentDetailData.liveInfo?.liveState == 'end') { |
| @@ -272,15 +269,15 @@ export struct PlayUIComponent { | @@ -272,15 +269,15 @@ export struct PlayUIComponent { | ||
| 272 | } | 269 | } |
| 273 | 270 | ||
| 274 | } | 271 | } |
| 272 | + .height(18) | ||
| 275 | .backgroundColor('#4D000000') | 273 | .backgroundColor('#4D000000') |
| 276 | .padding({ | 274 | .padding({ |
| 277 | left: 4, | 275 | left: 4, |
| 278 | - top: 1, | ||
| 279 | right: 4, | 276 | right: 4, |
| 280 | - bottom: 1 | ||
| 281 | }).margin({ | 277 | }).margin({ |
| 282 | left: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '34vp' : 0 | 278 | left: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '34vp' : 0 |
| 283 | }) | 279 | }) |
| 280 | + .borderRadius(2) | ||
| 284 | } | 281 | } |
| 285 | } | 282 | } |
| 286 | 283 |
| @@ -144,7 +144,7 @@ export struct PlayerTitleComponent { | @@ -144,7 +144,7 @@ export struct PlayerTitleComponent { | ||
| 144 | .width(12) | 144 | .width(12) |
| 145 | .height(12) | 145 | .height(12) |
| 146 | Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`) | 146 | Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`) |
| 147 | - .fontSize('11fp') | 147 | + .fontSize('11vp') |
| 148 | .fontWeight(400) | 148 | .fontWeight(400) |
| 149 | .fontColor(Color.White) | 149 | .fontColor(Color.White) |
| 150 | } | 150 | } |
sight_harmony/features/wdDetailPlayLive/src/main/resources/base/media/cover_place_holder.png
0 → 100644
5.84 KB
| 1 | import { CompInfoBean, ContentDTO, PageInfoBean } from 'wdBean/Index'; | 1 | import { CompInfoBean, ContentDTO, PageInfoBean } from 'wdBean/Index'; |
| 2 | -import { MorningEveningViewModel } from 'wdComponent/Index'; | 2 | +// import { MorningEveningViewModel } from 'wdComponent/Index'; |
| 3 | import { CrptoUtils, FileUtils, Logger } from 'wdKit/Index'; | 3 | import { CrptoUtils, FileUtils, Logger } from 'wdKit/Index'; |
| 4 | import { FormNewspaperPaperType, FormNewspaperPaperContent, | 4 | import { FormNewspaperPaperType, FormNewspaperPaperContent, |
| 5 | FormNewspaperData } from "../dailynewspaperwidget/common/NewspaperWidgetData" | 5 | FormNewspaperData } from "../dailynewspaperwidget/common/NewspaperWidgetData" |
| @@ -8,6 +8,7 @@ import fs from '@ohos.file.fs'; | @@ -8,6 +8,7 @@ import fs from '@ohos.file.fs'; | ||
| 8 | import { BusinessError } from '@kit.BasicServicesKit'; | 8 | import { BusinessError } from '@kit.BasicServicesKit'; |
| 9 | import { JSON } from '@kit.ArkTS'; | 9 | import { JSON } from '@kit.ArkTS'; |
| 10 | import { AppInnerLinkGenerator } from 'wdRouter'; | 10 | import { AppInnerLinkGenerator } from 'wdRouter'; |
| 11 | +import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | ||
| 11 | 12 | ||
| 12 | const TAG = "NewspaperDataFetcher" | 13 | const TAG = "NewspaperDataFetcher" |
| 13 | 14 | ||
| @@ -22,11 +23,11 @@ export class NewspaperDataFetcher { | @@ -22,11 +23,11 @@ export class NewspaperDataFetcher { | ||
| 22 | data.paperInfo = { showLeftImage: false } | 23 | data.paperInfo = { showLeftImage: false } |
| 23 | 24 | ||
| 24 | try { | 25 | try { |
| 25 | - let page: PageInfoBean = await MorningEveningViewModel.getDailyPaperTopic() | 26 | + let page: PageInfoBean = await NewspaperDataFetcher.getDailyPaperTopic() |
| 26 | data.paperType = page.topicInfo?.topicPattern || FormNewspaperPaperType.unknown | 27 | data.paperType = page.topicInfo?.topicPattern || FormNewspaperPaperType.unknown |
| 27 | 28 | ||
| 28 | let currentTime = new Date().getTime() | 29 | let currentTime = new Date().getTime() |
| 29 | - let compInfo = await MorningEveningViewModel.getMorningEveningCompInfo( | 30 | + let compInfo = await NewspaperDataFetcher.getMorningEveningCompInfo( |
| 30 | page.id, | 31 | page.id, |
| 31 | page.groups[0]?.id, | 32 | page.groups[0]?.id, |
| 32 | currentTime + "", | 33 | currentTime + "", |
| @@ -208,5 +209,62 @@ export class NewspaperDataFetcher { | @@ -208,5 +209,62 @@ export class NewspaperDataFetcher { | ||
| 208 | }) | 209 | }) |
| 209 | } | 210 | } |
| 210 | 211 | ||
| 212 | + static async getDailyPaperTopic(): Promise<PageInfoBean> { | ||
| 213 | + return new Promise<PageInfoBean>((success, error) => { | ||
| 214 | + Logger.info(TAG, `getDailyPaperTopic pageInfo start`); | ||
| 215 | + | ||
| 216 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.DAILY_PAPER_TOPIC; | ||
| 217 | + WDHttp.get<ResponseDTO<PageInfoBean>>(url).then((resDTO: ResponseDTO<PageInfoBean>) => { | ||
| 218 | + if (!resDTO || !resDTO.data) { | ||
| 219 | + Logger.error(TAG, 'getDailyPaperTopic then navResDTO is empty'); | ||
| 220 | + error('resDTO is empty'); | ||
| 221 | + return | ||
| 222 | + } | ||
| 223 | + if (resDTO.code != 0) { | ||
| 224 | + Logger.error(TAG, `getDailyPaperTopic then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 225 | + error('resDTO Response Code is failure'); | ||
| 226 | + return | ||
| 227 | + } | ||
| 228 | + // let navResStr = JSON.stringify(navResDTO); | ||
| 229 | + Logger.info(TAG, "getDailyPaperTopic then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 230 | + success(resDTO.data); | ||
| 231 | + }) | ||
| 232 | + .catch((err: Error) => { | ||
| 233 | + Logger.error(TAG, `getDailyPaperTopic catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 234 | + error(err); | ||
| 235 | + }) | ||
| 236 | + }) | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + static async getMorningEveningCompInfo(pageId: number, groupId: number, refreshTime: string, topicId: string, pageNum: number = 1, pageSize: number = 20): Promise<CompInfoBean> { | ||
| 240 | + return new Promise<CompInfoBean>((success, error) => { | ||
| 241 | + Logger.info(TAG, `getMorningEveningCompInfo pageInfo start`); | ||
| 242 | + | ||
| 243 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMP_PATH; | ||
| 244 | + url = url + "?loadStrategy=first_load&pageNum=" + pageNum + "&refreshTime=" + refreshTime + "&pageId=" | ||
| 245 | + + pageId + "&channelStrategy=2&groupId=" + groupId + "&topicId=" + topicId + "&pageSize=" + pageSize; | ||
| 246 | + | ||
| 247 | + WDHttp.get<ResponseDTO<CompInfoBean>>(url).then((resDTO: ResponseDTO<CompInfoBean>) => { | ||
| 248 | + if (!resDTO || !resDTO.data) { | ||
| 249 | + Logger.error(TAG, 'getMorningEveningCompInfo then navResDTO is empty'); | ||
| 250 | + error('resDTO is empty'); | ||
| 251 | + return | ||
| 252 | + } | ||
| 253 | + if (resDTO.code != 0) { | ||
| 254 | + Logger.error(TAG, `getMorningEveningCompInfo then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 255 | + error('resDTO Response Code is failure'); | ||
| 256 | + return | ||
| 257 | + } | ||
| 258 | + // let navResStr = JSON.stringify(navResDTO); | ||
| 259 | + Logger.info(TAG, "getMorningEveningCompInfo then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 260 | + success(resDTO.data); | ||
| 261 | + }) | ||
| 262 | + .catch((err: Error) => { | ||
| 263 | + Logger.error(TAG, `getMorningEveningCompInfo catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 264 | + error(err); | ||
| 265 | + }) | ||
| 266 | + }) | ||
| 267 | + } | ||
| 268 | + | ||
| 211 | 269 | ||
| 212 | } | 270 | } |
| 1 | -import { NetworkUtil, Logger, SPHelper, StringUtils } from 'wdKit'; | 1 | +import { Logger, NetworkUtil, SPHelper, StringUtils } from 'wdKit'; |
| 2 | import { ResponseDTO } from 'wdNetwork'; | 2 | import { ResponseDTO } from 'wdNetwork'; |
| 3 | import { | 3 | import { |
| 4 | ContentDetailDTO, | 4 | ContentDetailDTO, |
| 5 | + InteractDataDTO, | ||
| 6 | + Params, | ||
| 5 | PhotoListBean, | 7 | PhotoListBean, |
| 6 | - postInteractBrowsOperateParams, | ||
| 7 | postBatchAttentionStatusParams, | 8 | postBatchAttentionStatusParams, |
| 8 | postInteractAccentionOperateParams, | 9 | postInteractAccentionOperateParams, |
| 9 | - Params, | ||
| 10 | - InteractDataDTO | 10 | + postInteractBrowsOperateParams |
| 11 | } from 'wdBean'; | 11 | } from 'wdBean'; |
| 12 | import { DateTimeUtils } from 'wdKit/Index'; | 12 | import { DateTimeUtils } from 'wdKit/Index'; |
| 13 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 13 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 14 | import { SpConstants } from 'wdConstant/Index'; | 14 | import { SpConstants } from 'wdConstant/Index'; |
| 15 | import { common } from '@kit.AbilityKit'; | 15 | import { common } from '@kit.AbilityKit'; |
| 16 | import { CommentDialogView } from 'wdDetailPlayShortVideo/Index'; | 16 | import { CommentDialogView } from 'wdDetailPlayShortVideo/Index'; |
| 17 | -import { EmptyComponent, | ||
| 18 | - ImageDownloadComponent, | 17 | +import { |
| 18 | + EmptyComponent, | ||
| 19 | MultiPictureDetailItemComponent, | 19 | MultiPictureDetailItemComponent, |
| 20 | MultiPictureDetailViewModel, | 20 | MultiPictureDetailViewModel, |
| 21 | OperRowListView, | 21 | OperRowListView, |
| 22 | PageRepository, | 22 | PageRepository, |
| 23 | publishCommentModel, | 23 | publishCommentModel, |
| 24 | - viewBlogItemInsightIntentShare} from 'wdComponent/Index'; | ||
| 25 | -import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index'; | 24 | + SaveNetWorkPictures, |
| 25 | + viewBlogItemInsightIntentShare | ||
| 26 | +} from 'wdComponent/Index'; | ||
| 27 | +import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index'; | ||
| 26 | 28 | ||
| 27 | const TAG = 'MultiPictureDetailPageComponent'; | 29 | const TAG = 'MultiPictureDetailPageComponent'; |
| 30 | + | ||
| 28 | /** | 31 | /** |
| 29 | * 多图(图集详情页)UI | 32 | * 多图(图集详情页)UI |
| 30 | */ | 33 | */ |
| @@ -96,7 +99,7 @@ export struct MultiPictureDetailPageComponent { | @@ -96,7 +99,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 96 | this.contentTrackingDict() | 99 | this.contentTrackingDict() |
| 97 | } | 100 | } |
| 98 | 101 | ||
| 99 | - contentTrackingDict(){ | 102 | + contentTrackingDict() { |
| 100 | this.pageParam = { | 103 | this.pageParam = { |
| 101 | 'contentType': `${this.contentDetailData.newsType}`, | 104 | 'contentType': `${this.contentDetailData.newsType}`, |
| 102 | 'contentId': `${this.contentDetailData.newsId}`, | 105 | 'contentId': `${this.contentDetailData.newsId}`, |
| @@ -138,6 +141,7 @@ export struct MultiPictureDetailPageComponent { | @@ -138,6 +141,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 138 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | 141 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, |
| 139 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 142 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 140 | }) | 143 | }) |
| 144 | + | ||
| 141 | CommentDialogView({ | 145 | CommentDialogView({ |
| 142 | index: $index, | 146 | index: $index, |
| 143 | currentIndex: $currentIndex, | 147 | currentIndex: $currentIndex, |
| @@ -156,7 +160,7 @@ export struct MultiPictureDetailPageComponent { | @@ -156,7 +160,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 156 | @Builder | 160 | @Builder |
| 157 | rmh() { | 161 | rmh() { |
| 158 | if (!this.showDownload) { | 162 | if (!this.showDownload) { |
| 159 | - Row(){ | 163 | + Row() { |
| 160 | Row() { | 164 | Row() { |
| 161 | Row({ space: 8 }) { | 165 | Row({ space: 8 }) { |
| 162 | if (this.getImgUrl()) { | 166 | if (this.getImgUrl()) { |
| @@ -257,7 +261,7 @@ export struct MultiPictureDetailPageComponent { | @@ -257,7 +261,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 257 | Image($r('app.media.add')) | 261 | Image($r('app.media.add')) |
| 258 | .width(12) | 262 | .width(12) |
| 259 | .height(12) | 263 | .height(12) |
| 260 | - .margin({right: 3}) | 264 | + .margin({ right: 3 }) |
| 261 | 265 | ||
| 262 | Text('关注').fontSize(12).fontColor(0xffffff) | 266 | Text('关注').fontSize(12).fontColor(0xffffff) |
| 263 | }.alignItems(VerticalAlign.Center) | 267 | }.alignItems(VerticalAlign.Center) |
| @@ -268,7 +272,8 @@ export struct MultiPictureDetailPageComponent { | @@ -268,7 +272,8 @@ export struct MultiPictureDetailPageComponent { | ||
| 268 | .height(24) | 272 | .height(24) |
| 269 | .onClick(() => { | 273 | .onClick(() => { |
| 270 | this.handleAccention() | 274 | this.handleAccention() |
| 271 | - }).visibility(this.isShowButton ? Visibility.Visible : Visibility.None) | 275 | + }) |
| 276 | + .visibility(this.isShowButton ? Visibility.Visible : Visibility.None) | ||
| 272 | } else { | 277 | } else { |
| 273 | Button({ type: ButtonType.Normal, stateEffect: true }) { | 278 | Button({ type: ButtonType.Normal, stateEffect: true }) { |
| 274 | Row() { | 279 | Row() { |
| @@ -281,7 +286,8 @@ export struct MultiPictureDetailPageComponent { | @@ -281,7 +286,8 @@ export struct MultiPictureDetailPageComponent { | ||
| 281 | .height(24) | 286 | .height(24) |
| 282 | .onClick(() => { | 287 | .onClick(() => { |
| 283 | this.handleAccention() | 288 | this.handleAccention() |
| 284 | - }).visibility(this.isShowButton ? Visibility.Visible : Visibility.None) | 289 | + }) |
| 290 | + .visibility(this.isShowButton ? Visibility.Visible : Visibility.None) | ||
| 285 | } | 291 | } |
| 286 | 292 | ||
| 287 | } | 293 | } |
| @@ -429,6 +435,7 @@ export struct MultiPictureDetailPageComponent { | @@ -429,6 +435,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 429 | ListItem() { | 435 | ListItem() { |
| 430 | this.ListItemTitle() | 436 | this.ListItemTitle() |
| 431 | } | 437 | } |
| 438 | + | ||
| 432 | ListItem() { | 439 | ListItem() { |
| 433 | this.ListItemDescription() | 440 | this.ListItemDescription() |
| 434 | } | 441 | } |
| @@ -499,11 +506,18 @@ export struct MultiPictureDetailPageComponent { | @@ -499,11 +506,18 @@ export struct MultiPictureDetailPageComponent { | ||
| 499 | } | 506 | } |
| 500 | 507 | ||
| 501 | if (this.contentDetailData.photoList?.[this.swiperIndex].picPath) { | 508 | if (this.contentDetailData.photoList?.[this.swiperIndex].picPath) { |
| 502 | - ImageDownloadComponent({ url: this.contentDetailData.photoList?.[this.swiperIndex].picPath }) | 509 | + // ImageDownloadComponent({ url: this.contentDetailData.photoList?.[this.swiperIndex].picPath }) |
| 510 | + // .parallelGesture( | ||
| 511 | + // TapGesture() | ||
| 512 | + // .onAction((event: GestureEvent) => { | ||
| 513 | + // TrackingContent.download(1,TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,this.pageParam) | ||
| 514 | + // })) | ||
| 515 | + SaveNetWorkPictures({ url: this.contentDetailData.photoList?.[this.swiperIndex].picPath }) | ||
| 503 | .parallelGesture( | 516 | .parallelGesture( |
| 504 | TapGesture() | 517 | TapGesture() |
| 505 | .onAction((event: GestureEvent) => { | 518 | .onAction((event: GestureEvent) => { |
| 506 | - TrackingContent.download(1,TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,this.pageParam) | 519 | + TrackingContent.download(1, TrackConstants.PageName.Atlas_Detail, TrackConstants.PageName.Atlas_Detail, |
| 520 | + this.pageParam) | ||
| 507 | })) | 521 | })) |
| 508 | } | 522 | } |
| 509 | } | 523 | } |
| @@ -521,7 +535,10 @@ export struct MultiPictureDetailPageComponent { | @@ -521,7 +535,10 @@ export struct MultiPictureDetailPageComponent { | ||
| 521 | @Builder | 535 | @Builder |
| 522 | noNet() { | 536 | noNet() { |
| 523 | EmptyComponent({ | 537 | EmptyComponent({ |
| 524 | - emptyType: 1, emptyButton: true, isBlack: true, retry: () => { | 538 | + emptyType: 1, |
| 539 | + emptyButton: true, | ||
| 540 | + isBlack: true, | ||
| 541 | + retry: () => { | ||
| 525 | this.getDetail() | 542 | this.getDetail() |
| 526 | } | 543 | } |
| 527 | }) | 544 | }) |
| @@ -659,10 +676,12 @@ export struct MultiPictureDetailPageComponent { | @@ -659,10 +676,12 @@ export struct MultiPictureDetailPageComponent { | ||
| 659 | // console.log(TAG, '关注号主==', JSON.stringify(res.data)) | 676 | // console.log(TAG, '关注号主==', JSON.stringify(res.data)) |
| 660 | if (this.followStatus == '1') { | 677 | if (this.followStatus == '1') { |
| 661 | this.followStatus = '0' | 678 | this.followStatus = '0' |
| 662 | - TrackingContent.follow(true,this.followUserId,this.followUserName,TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,this.pageParam) | 679 | + TrackingContent.follow(true, this.followUserId, this.followUserName, TrackConstants.PageName.Atlas_Detail, |
| 680 | + TrackConstants.PageName.Atlas_Detail, this.pageParam) | ||
| 663 | } else { | 681 | } else { |
| 664 | this.followStatus = '1' | 682 | this.followStatus = '1' |
| 665 | - TrackingContent.follow(false,this.followUserId,this.followUserName,TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,this.pageParam) | 683 | + TrackingContent.follow(false, this.followUserId, this.followUserName, TrackConstants.PageName.Atlas_Detail, |
| 684 | + TrackConstants.PageName.Atlas_Detail, this.pageParam) | ||
| 666 | } | 685 | } |
| 667 | }) | 686 | }) |
| 668 | } | 687 | } |
| @@ -184,26 +184,6 @@ | @@ -184,26 +184,6 @@ | ||
| 184 | ], | 184 | ], |
| 185 | "requestPermissions": [ | 185 | "requestPermissions": [ |
| 186 | { | 186 | { |
| 187 | - "name": "ohos.permission.READ_MEDIA", | ||
| 188 | - "reason": "$string:permission_photo_tip", | ||
| 189 | - "usedScene": { | ||
| 190 | - "abilities": [ | ||
| 191 | - "FormAbility" | ||
| 192 | - ], | ||
| 193 | - "when": "inuse" | ||
| 194 | - } | ||
| 195 | - }, | ||
| 196 | - { | ||
| 197 | - "name": "ohos.permission.WRITE_MEDIA", | ||
| 198 | - "reason": "$string:permission_photo_tip", | ||
| 199 | - "usedScene": { | ||
| 200 | - "abilities": [ | ||
| 201 | - "FormAbility" | ||
| 202 | - ], | ||
| 203 | - "when": "inuse" | ||
| 204 | - } | ||
| 205 | - }, | ||
| 206 | - { | ||
| 207 | "name": "ohos.permission.APPROXIMATELY_LOCATION", | 187 | "name": "ohos.permission.APPROXIMATELY_LOCATION", |
| 208 | "reason": "$string:permission_location_tip", | 188 | "reason": "$string:permission_location_tip", |
| 209 | "usedScene": { | 189 | "usedScene": { |
-
Please register or login to post a comment