Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
6 changed files
with
66 additions
and
20 deletions
| @@ -117,7 +117,8 @@ export struct ImageAndTextPageComponent { | @@ -117,7 +117,8 @@ export struct ImageAndTextPageComponent { | ||
| 117 | if (this.likeNum > 0) { | 117 | if (this.likeNum > 0) { |
| 118 | Text(NumberFormatterUtils.formatNumberWithWan(this.likeNum)) | 118 | Text(NumberFormatterUtils.formatNumberWithWan(this.likeNum)) |
| 119 | .fontSize(16) | 119 | .fontSize(16) |
| 120 | - .fontColor(this.newsStatusOfUser?.likeStatus == '1' ? '#ED2800' : '#999999') | 120 | + //.fontColor(this.newsStatusOfUser?.likeStatus == '1' ? '#ED2800' : '#999999') |
| 121 | + .fontColor((this.likeNumTextColor())) | ||
| 121 | .fontFamily('PingFang SC-Regular') | 122 | .fontFamily('PingFang SC-Regular') |
| 122 | .fontWeight(400) | 123 | .fontWeight(400) |
| 123 | .margin({ left: 5 }) | 124 | .margin({ left: 5 }) |
| @@ -267,6 +268,14 @@ export struct ImageAndTextPageComponent { | @@ -267,6 +268,14 @@ export struct ImageAndTextPageComponent { | ||
| 267 | .backgroundColor(Color.White) | 268 | .backgroundColor(Color.White) |
| 268 | } | 269 | } |
| 269 | 270 | ||
| 271 | + private likeNumTextColor() { | ||
| 272 | + if(this.newsStatusOfUser?.likeStatus == '1'){ | ||
| 273 | + //已点赞状态 祈福和默哀为黑色 其余为红色 | ||
| 274 | + return (this.contentDetailData?.likesStyle == 2 || this.contentDetailData?.likesStyle == 3) ? '#222222' : '#ED2800' | ||
| 275 | + } | ||
| 276 | + return '#999999' | ||
| 277 | + } | ||
| 278 | + | ||
| 270 | private async getDetail() { | 279 | private async getDetail() { |
| 271 | this.isNetConnected = NetworkUtil.isNetConnected() | 280 | this.isNetConnected = NetworkUtil.isNetConnected() |
| 272 | if (!this.isNetConnected) { | 281 | if (!this.isNetConnected) { |
| @@ -242,7 +242,7 @@ export struct MorningEveningPaperComponent { | @@ -242,7 +242,7 @@ export struct MorningEveningPaperComponent { | ||
| 242 | if (imageSource) { | 242 | if (imageSource) { |
| 243 | const pixelMap: image.PixelMap = await imageNet2PixelMap(imageSource); | 243 | const pixelMap: image.PixelMap = await imageNet2PixelMap(imageSource); |
| 244 | effectKit.createColorPicker(pixelMap, (err, colorPicker) => { | 244 | effectKit.createColorPicker(pixelMap, (err, colorPicker) => { |
| 245 | - let color = colorPicker.getMainColorSync(); | 245 | + let color = colorPicker.getLargestProportionColor(); |
| 246 | console.log(TAG, "compInfoBean compStyle = " + color) | 246 | console.log(TAG, "compInfoBean compStyle = " + color) |
| 247 | // color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha}) | 247 | // color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha}) |
| 248 | // 将取色器选取的color示例转换为十六进制颜色代码 | 248 | // 将取色器选取的color示例转换为十六进制颜色代码 |
| @@ -200,12 +200,13 @@ export struct AppointmentListUI { | @@ -200,12 +200,13 @@ export struct AppointmentListUI { | ||
| 200 | let time = arr[0].split("-"); | 200 | let time = arr[0].split("-"); |
| 201 | if (time.length === 3) { | 201 | if (time.length === 3) { |
| 202 | let month = time[1].indexOf("0") === 0 ? time[1].substring(1) : time[1] | 202 | let month = time[1].indexOf("0") === 0 ? time[1].substring(1) : time[1] |
| 203 | - let day = time[2] | 203 | + // let day = time[2] |
| 204 | + let day = time[2].indexOf("0") === 0 ? time[2].substring(1) : time[2] | ||
| 204 | 205 | ||
| 205 | dealData[0] = `${month}月${day}日` | 206 | dealData[0] = `${month}月${day}日` |
| 206 | let today = `${new Date().getMonth() + 1}月${new Date().getDate()}日` | 207 | let today = `${new Date().getMonth() + 1}月${new Date().getDate()}日` |
| 207 | if (dealData[0] === today) { | 208 | if (dealData[0] === today) { |
| 208 | - dealData[0] = "今日" | 209 | + dealData[0] = "今天" |
| 209 | } | 210 | } |
| 210 | } | 211 | } |
| 211 | } | 212 | } |
| @@ -15,6 +15,7 @@ import { TrackConstants } from 'wdTracking/Index'; | @@ -15,6 +15,7 @@ import { TrackConstants } from 'wdTracking/Index'; | ||
| 15 | import { SPHelper } from 'wdKit/Index'; | 15 | import { SPHelper } from 'wdKit/Index'; |
| 16 | import { SpConstants } from 'wdConstant/Index'; | 16 | import { SpConstants } from 'wdConstant/Index'; |
| 17 | import { photoPickerUtils} from '../../utils/PhotoPickerUtils'; | 17 | import { photoPickerUtils} from '../../utils/PhotoPickerUtils'; |
| 18 | +import { cameraPickerUtils } from '../../utils/CameraPickerUtils'; | ||
| 18 | 19 | ||
| 19 | @Entry | 20 | @Entry |
| 20 | @Component | 21 | @Component |
| @@ -104,7 +105,7 @@ struct EditUserInfoPage { | @@ -104,7 +105,7 @@ struct EditUserInfoPage { | ||
| 104 | } | 105 | } |
| 105 | }) | 106 | }) |
| 106 | }else { | 107 | }else { |
| 107 | - photoPickerUtils.getCamera().then(value => { | 108 | + cameraPickerUtils.getCamera().then(value => { |
| 108 | if (value.length > 0) { | 109 | if (value.length > 0) { |
| 109 | this.headerImg = value | 110 | this.headerImg = value |
| 110 | } | 111 | } |
| 1 | +import { abilityAccessCtrl, common, Permissions } from '@kit.AbilityKit'; | ||
| 2 | +import { camera, cameraPicker as picker } from '@kit.CameraKit'; | ||
| 3 | +let mContext = getContext(this) as common.Context; | ||
| 4 | + | ||
| 5 | +const PERMISSIONS: Array<Permissions> = [ | ||
| 6 | + 'ohos.permission.READ_IMAGEVIDEO', | ||
| 7 | +]; | ||
| 8 | + | ||
| 9 | +export class CameraPickerUtils { | ||
| 10 | + async getCamera(){ | ||
| 11 | + this.pickerPermissions() | ||
| 12 | + | ||
| 13 | + let pickerProfile: picker.PickerProfile = { | ||
| 14 | + cameraPosition: camera.CameraPosition.CAMERA_POSITION_BACK | ||
| 15 | + }; | ||
| 16 | + let pickerResult: picker.PickerResult = await picker.pick(mContext, | ||
| 17 | + [picker.PickerMediaType.PHOTO], pickerProfile); | ||
| 18 | + | ||
| 19 | + return new Promise<string>((success, fail) => { | ||
| 20 | + if (pickerResult['resultCode'] === 0) { | ||
| 21 | + success(pickerResult['resultUri']) | ||
| 22 | + } | ||
| 23 | + }) | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + async pickerPermissions(){ | ||
| 27 | + ///权限查询 | ||
| 28 | + const context = getContext(this) as common.UIAbilityContext; | ||
| 29 | + const atManager = abilityAccessCtrl.createAtManager(); | ||
| 30 | + await atManager.requestPermissionsFromUser(context, PERMISSIONS); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +export const cameraPickerUtils: CameraPickerUtils = new CameraPickerUtils(); |
| @@ -30,21 +30,21 @@ export class PhotoPickerUtils { | @@ -30,21 +30,21 @@ export class PhotoPickerUtils { | ||
| 30 | }) | 30 | }) |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | - async getCamera(){ | ||
| 34 | - this.pickerPermissions() | ||
| 35 | - | ||
| 36 | - let pickerProfile: cameraPicker.PickerProfile = { | ||
| 37 | - cameraPosition: camera.CameraPosition.CAMERA_POSITION_BACK | ||
| 38 | - }; | ||
| 39 | - let pickerResult: cameraPicker.PickerResult = await cameraPicker.pick(mContext, | ||
| 40 | - [cameraPicker.PickerMediaType.PHOTO, cameraPicker.PickerMediaType.VIDEO], pickerProfile); | ||
| 41 | - | ||
| 42 | - return new Promise<string>((success, fail) => { | ||
| 43 | - if (pickerResult['resultCode'] === 0) { | ||
| 44 | - success(pickerResult['resultUri']) | ||
| 45 | - } | ||
| 46 | - }) | ||
| 47 | - } | 33 | + // async getCamera(){ |
| 34 | + // this.pickerPermissions() | ||
| 35 | + // | ||
| 36 | + // let pickerProfile: cameraPicker.PickerProfile = { | ||
| 37 | + // cameraPosition: camera.CameraPosition.CAMERA_POSITION_BACK | ||
| 38 | + // }; | ||
| 39 | + // let pickerResult: cameraPicker.PickerResult = await cameraPicker.pick(mContext, | ||
| 40 | + // [cameraPicker.PickerMediaType.PHOTO, cameraPicker.PickerMediaType.VIDEO], pickerProfile); | ||
| 41 | + // | ||
| 42 | + // return new Promise<string>((success, fail) => { | ||
| 43 | + // if (pickerResult['resultCode'] === 0) { | ||
| 44 | + // success(pickerResult['resultUri']) | ||
| 45 | + // } | ||
| 46 | + // }) | ||
| 47 | + // } | ||
| 48 | 48 | ||
| 49 | async pickerPermissions(){ | 49 | async pickerPermissions(){ |
| 50 | ///权限查询 | 50 | ///权限查询 |
-
Please register or login to post a comment