Showing
8 changed files
with
344 additions
and
235 deletions
| @@ -77,18 +77,32 @@ export class PermissionUtil { | @@ -77,18 +77,32 @@ export class PermissionUtil { | ||
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | 79 | ||
| 80 | - static openPermissionsInSystemSettings(component: Object): void { | ||
| 81 | - let context = getContext(component) as common.UIAbilityContext; | ||
| 82 | - let wantInfo:Want = { | ||
| 83 | - action: 'action.settings.app.info', | 80 | + /**跳转设置页面*/ |
| 81 | + static openPermissionsInSystemSettings(context: Object): void { | ||
| 82 | + let uiContext = getContext(context) as common.UIAbilityContext; | ||
| 83 | + let wantInfo: Want = { | ||
| 84 | + bundleName: 'com.huawei.hmos.settings', | ||
| 85 | + abilityName: 'com.huawei.hmos.settings.MainAbility', | ||
| 86 | + uri: 'application_info_entry', | ||
| 84 | parameters: { | 87 | parameters: { |
| 85 | - settingsParamBundleName: AppUtils.getPackageName(context) // 打开指定应用的详情页面 | 88 | + pushParams: AppUtils.getPackageName(uiContext) // 打开指定应用的设置页面 |
| 86 | } | 89 | } |
| 87 | } | 90 | } |
| 88 | - context.startAbility(wantInfo).then(() => { | ||
| 89 | - // ... | ||
| 90 | - }).catch((err:Error) => { | ||
| 91 | - // ... | ||
| 92 | - }) | 91 | + uiContext.startAbility(wantInfo) |
| 93 | } | 92 | } |
| 93 | + | ||
| 94 | + // static openPermissionsInSystemSettings(component: Object): void { | ||
| 95 | + // let context = getContext(component) as common.UIAbilityContext; | ||
| 96 | + // let wantInfo:Want = { | ||
| 97 | + // action: 'action.settings.app.info', | ||
| 98 | + // parameters: { | ||
| 99 | + // settingsParamBundleName: AppUtils.getPackageName(context) // 打开指定应用的详情页面 | ||
| 100 | + // } | ||
| 101 | + // } | ||
| 102 | + // context.startAbility(wantInfo).then(() => { | ||
| 103 | + // // ... | ||
| 104 | + // }).catch((err:Error) => { | ||
| 105 | + // // ... | ||
| 106 | + // }) | ||
| 107 | + // } | ||
| 94 | } | 108 | } |
| @@ -93,10 +93,12 @@ export struct MultiPictureDetailPageComponent { | @@ -93,10 +93,12 @@ export struct MultiPictureDetailPageComponent { | ||
| 93 | 93 | ||
| 94 | if (this.contentDetailData.rmhPlatform == 1) { | 94 | if (this.contentDetailData.rmhPlatform == 1) { |
| 95 | Row() { | 95 | Row() { |
| 96 | - Row() { | ||
| 97 | - Row({ space: 8 }) { | 96 | + Row({ space: 8 }) { |
| 97 | + Row() { | ||
| 98 | Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl) | 98 | Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl) |
| 99 | - .borderRadius('50%') | 99 | + .borderRadius(24) |
| 100 | + .aspectRatio(1) | ||
| 101 | + .border({ width: 1, color: Color.White, style: BorderStyle.Solid }) | ||
| 100 | .alt($r('app.media.picture_loading')) | 102 | .alt($r('app.media.picture_loading')) |
| 101 | .width(36) | 103 | .width(36) |
| 102 | .height(36) | 104 | .height(36) |
| @@ -109,7 +111,8 @@ export struct MultiPictureDetailPageComponent { | @@ -109,7 +111,8 @@ export struct MultiPictureDetailPageComponent { | ||
| 109 | Row() { | 111 | Row() { |
| 110 | Flex({ | 112 | Flex({ |
| 111 | direction: FlexDirection.Column, | 113 | direction: FlexDirection.Column, |
| 112 | - justifyContent: FlexAlign.Start | 114 | + justifyContent: FlexAlign.SpaceAround, |
| 115 | + alignItems: ItemAlign.Start | ||
| 113 | }) { | 116 | }) { |
| 114 | Text(`${this.contentDetailData?.rmhInfo?.rmhName}`) | 117 | Text(`${this.contentDetailData?.rmhInfo?.rmhName}`) |
| 115 | .fontColor(Color.White) | 118 | .fontColor(Color.White) |
| @@ -118,13 +121,15 @@ export struct MultiPictureDetailPageComponent { | @@ -118,13 +121,15 @@ export struct MultiPictureDetailPageComponent { | ||
| 118 | .fontWeight(500) | 121 | .fontWeight(500) |
| 119 | .lineHeight(17) | 122 | .lineHeight(17) |
| 120 | .margin(0) | 123 | .margin(0) |
| 124 | + .height(17) | ||
| 121 | Text(`${this.contentDetailData?.rmhInfo?.rmhDesc}`) | 125 | Text(`${this.contentDetailData?.rmhInfo?.rmhDesc}`) |
| 122 | .fontColor('#676767') | 126 | .fontColor('#676767') |
| 123 | .fontSize(12) | 127 | .fontSize(12) |
| 124 | .fontFamily('PingFang SC-Regular') | 128 | .fontFamily('PingFang SC-Regular') |
| 125 | .fontWeight(400) | 129 | .fontWeight(400) |
| 126 | .lineHeight(14) | 130 | .lineHeight(14) |
| 127 | - .textOverflow({ overflow: TextOverflow.Clip }) | 131 | + .height(14) |
| 132 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 128 | .margin(0) | 133 | .margin(0) |
| 129 | } | 134 | } |
| 130 | } | 135 | } |
| @@ -142,23 +147,21 @@ export struct MultiPictureDetailPageComponent { | @@ -142,23 +147,21 @@ export struct MultiPictureDetailPageComponent { | ||
| 142 | 147 | ||
| 143 | if (this.followStatus == '0') { | 148 | if (this.followStatus == '0') { |
| 144 | Row() { | 149 | Row() { |
| 145 | - Button('+关注', { type: ButtonType.Normal, stateEffect: true }) | ||
| 146 | - .borderRadius(4) | ||
| 147 | - .backgroundColor('#ED2800') | ||
| 148 | - .width(48) | ||
| 149 | - .height(24) | ||
| 150 | - .onClick(() => { | ||
| 151 | - this.handleAccention() | ||
| 152 | - }) | ||
| 153 | - .margin({ | ||
| 154 | - top: 10, | ||
| 155 | - bottom: 10, | ||
| 156 | - left: 16, | ||
| 157 | - right: 16 | ||
| 158 | - }) | ||
| 159 | - .fontSize(12) | ||
| 160 | - .fontColor(Color.White) | 150 | + Button({ type: ButtonType.Normal, stateEffect: true }) { |
| 151 | + Row() { | ||
| 152 | + Text('+关注').fontSize(12).fontColor(0xffffff) | ||
| 153 | + }.alignItems(VerticalAlign.Center) | ||
| 154 | + } | ||
| 155 | + .borderRadius(4) | ||
| 156 | + .backgroundColor('#ED2800') | ||
| 157 | + .width(48) | ||
| 158 | + .height(24) | ||
| 159 | + .onClick(() => { | ||
| 160 | + this.handleAccention() | ||
| 161 | + }) | ||
| 161 | } | 162 | } |
| 163 | + .justifyContent(FlexAlign.Center) | ||
| 164 | + .alignItems(VerticalAlign.Center) | ||
| 162 | .width('21.6%') | 165 | .width('21.6%') |
| 163 | .height('100%') | 166 | .height('100%') |
| 164 | } | 167 | } |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
| @@ -174,7 +174,7 @@ export struct QualityCommentsComponent { | @@ -174,7 +174,7 @@ export struct QualityCommentsComponent { | ||
| 174 | // ListItemGroup({ header: this.titleHeader() }) | 174 | // ListItemGroup({ header: this.titleHeader() }) |
| 175 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { | 175 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { |
| 176 | ListItem() { | 176 | ListItem() { |
| 177 | - QualityCommentItem({ item: item }).margin({ left: 12, right: 12 }) | 177 | + QualityCommentItem({ item: item, index:index }).margin({ left: 12, right: 12 }) |
| 178 | } | 178 | } |
| 179 | }) | 179 | }) |
| 180 | ListItem() { | 180 | ListItem() { |
| @@ -217,6 +217,7 @@ export struct QualityCommentsComponent { | @@ -217,6 +217,7 @@ export struct QualityCommentsComponent { | ||
| 217 | @Component | 217 | @Component |
| 218 | struct QualityCommentItem { | 218 | struct QualityCommentItem { |
| 219 | @ObjectLink item: commentItemModel | 219 | @ObjectLink item: commentItemModel |
| 220 | + index:number = 0 | ||
| 220 | 221 | ||
| 221 | build() { | 222 | build() { |
| 222 | Column() { | 223 | Column() { |
| @@ -326,6 +327,7 @@ struct QualityCommentItem { | @@ -326,6 +327,7 @@ struct QualityCommentItem { | ||
| 326 | } | 327 | } |
| 327 | }.onClick(() => { | 328 | }.onClick(() => { |
| 328 | this.item.api_status = !this.item.api_status | 329 | this.item.api_status = !this.item.api_status |
| 330 | + | ||
| 329 | // commentViewModel.commnetLikeChange(this.item) | 331 | // commentViewModel.commnetLikeChange(this.item) |
| 330 | commentViewModel.commentLike(this.item).then(() => { | 332 | commentViewModel.commentLike(this.item).then(() => { |
| 331 | 333 |
| 1 | +import dataPreferences from '@ohos.data.preferences'; | ||
| 2 | +import { PermissionUtil } from 'wdKit' | ||
| 3 | +import { SPHelper } from 'wdKit' | ||
| 4 | +import hilog from '@ohos.hilog'; | ||
| 5 | +import { PrivacySettingModel } from '../../model/PrivacySettingModel' | ||
| 6 | +import { Params } from 'wdBean'; | ||
| 7 | +import { WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 8 | + | ||
| 9 | +const TAG = 'PrivacySettingPage'; | ||
| 10 | +const DiyString = '开启个性化推荐' | ||
| 11 | +const DiyCloseTipsString = '关闭后,将不会使用你的偏好进行内容推荐' | ||
| 1 | 12 | ||
| 2 | -import { PrivacySettingComponents } from '../setting/PrivacySettingComponents'; | ||
| 3 | @Entry | 13 | @Entry |
| 4 | @Component | 14 | @Component |
| 5 | -struct PrivacySettingPage { | 15 | +export struct PrivacySettingPage { |
| 16 | + @State listData: Array<PrivacySettingModel> = [new PrivacySettingModel(DiyString, false, 'ohos.permission.READ_MEDIA'), new PrivacySettingModel('相册权限', false, 'ohos.permission.READ_MEDIA'), new PrivacySettingModel('相机权限', false, 'ohos.permission.CAMERA'), new PrivacySettingModel('定位权限', false, 'ohos.permission.APPROXIMATELY_LOCATION'), new PrivacySettingModel('麦克风权限', false, 'ohos.permission.MICROPHONE')]; | ||
| 17 | + tips: string = '设置前可查阅' | ||
| 18 | + privacyTips: string = '《隐私政策》' | ||
| 19 | + tipsEnd = '中相应权限使用规则' | ||
| 20 | + | ||
| 21 | + onPageShow(): void { | ||
| 22 | + this.getPermissionStatus(); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + aboutToAppear() { | ||
| 26 | + // 获取权限= | ||
| 27 | + // SPHelper.default.save('sdf','sdf'); | ||
| 28 | + // this.initListData(); | ||
| 29 | + this.getPermissionStatus(); | ||
| 30 | + // RefreshStatus; | ||
| 31 | + | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + async getPermissionStatus() { | ||
| 35 | + const permissionUtil = new PermissionUtil(); | ||
| 36 | + for (const element of this.listData) { | ||
| 37 | + if (element.privacyName == DiyString) { | ||
| 38 | + element.queryUserDetail(); | ||
| 39 | + // element.permission = true; | ||
| 40 | + continue; | ||
| 41 | + } | ||
| 42 | + const result = await permissionUtil.checkPermissions(element.permissionKey); | ||
| 43 | + element.permission = result; | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 6 | build() { | 47 | build() { |
| 7 | - Column(){ | ||
| 8 | - PrivacySettingComponents() | 48 | + Navigation() { |
| 49 | + //滑动区域 | ||
| 50 | + this.PrivacySettingComponentsUI() | ||
| 51 | + | ||
| 52 | + }.titleMode(NavigationTitleMode.Mini) | ||
| 53 | + .title('隐私设置') | ||
| 54 | + .backgroundColor('#F8F8F8') | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @Builder PrivacySettingComponentsUI() { | ||
| 58 | + Column() { | ||
| 59 | + | ||
| 60 | + List({ space: '23lpx' }) { | ||
| 61 | + ForEach(this.listData, (item: PrivacySettingModel, index:number) => { | ||
| 62 | + ListItem() { | ||
| 63 | + if (index == 0) { | ||
| 64 | + getTuiJianCell({ item:item, index:index }); | ||
| 65 | + } else { | ||
| 66 | + getArrowCell({ item:item, index:index }); | ||
| 67 | + } | ||
| 68 | + }.onClick(() => { | ||
| 69 | + if (index != 0) { | ||
| 70 | + if (!item.permission) { | ||
| 71 | + //跳转权限设置 | ||
| 72 | + const permissionUtil = new PermissionUtil(); | ||
| 73 | + PermissionUtil.reqPermissionsFromUser([item.permissionKey], this).then((res)=>{ | ||
| 74 | + item.permission = res; | ||
| 75 | + }); | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | + }) | ||
| 79 | + }) | ||
| 80 | + } | ||
| 81 | + .padding({ left: '29lpx', right: '29lpx' }) | ||
| 82 | + .margin({ top: '38lpx' }) | ||
| 83 | + | ||
| 84 | + Row() { | ||
| 85 | + Text(this.tips) | ||
| 86 | + .fontSize('25lpx') | ||
| 87 | + .textAlign(TextAlign.Start) | ||
| 88 | + .fontColor($r("app.color.color_666666")) | ||
| 89 | + .margin({ left: '29lpx', top: '46lpx' }) | ||
| 90 | + // .backgroundColor(Color.Orange) | ||
| 91 | + Text(this.privacyTips) | ||
| 92 | + .fontSize('25lpx') | ||
| 93 | + .textAlign(TextAlign.Start) | ||
| 94 | + .fontColor('#ED2800') | ||
| 95 | + .margin({ top: '46lpx' }) | ||
| 96 | + .onClick(() => { | ||
| 97 | + //跳转隐私政策 | ||
| 98 | + let bean={contentID:"2",pageID:""} as Params | ||
| 99 | + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | ||
| 100 | + }) | ||
| 101 | + Text(this.tipsEnd) | ||
| 102 | + .fontSize('25lpx') | ||
| 103 | + .textAlign(TextAlign.Start) | ||
| 104 | + .fontColor($r("app.color.color_666666")) | ||
| 105 | + .margin({ top: '46lpx' }) | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + } | ||
| 109 | + .width('100%') | ||
| 110 | + .height('100%') | ||
| 111 | + .backgroundColor('#F8F8F8') | ||
| 112 | + .alignItems(HorizontalAlign.Start) | ||
| 113 | + } | ||
| 114 | +} | ||
| 115 | + | ||
| 116 | + | ||
| 117 | +@Component | ||
| 118 | +struct getArrowCell { | ||
| 119 | + @ObjectLink item: PrivacySettingModel; | ||
| 120 | + index:number = 0; | ||
| 121 | + // 右文字+箭头cell | ||
| 122 | + // @Builder getArrowCell(item:PrivacySettingModel, index) { | ||
| 123 | + build() { | ||
| 124 | + Row() { | ||
| 125 | + // 左侧标题 | ||
| 126 | + Text(this.item.privacyName) | ||
| 127 | + .fontColor('#666666') | ||
| 128 | + .fontSize('31lpx') | ||
| 129 | + | ||
| 130 | + Row() { | ||
| 131 | + Text(this.item.permission ? '已开启' : '去设置') | ||
| 132 | + .fontColor(this.item.permission ? '#666666' : '#CCCCCC') | ||
| 133 | + .fontSize('31lpx') | ||
| 134 | + .margin({ right: '8lpx' }) | ||
| 135 | + | ||
| 136 | + Image($r('app.media.mine_user_arrow')) | ||
| 137 | + .width('27lpx') | ||
| 138 | + .height('27lpx') | ||
| 139 | + .objectFit(ImageFit.Auto) | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + } | ||
| 143 | + .alignItems(VerticalAlign.Center) | ||
| 144 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 145 | + .height('97lpx') | ||
| 146 | + .width('100%') | ||
| 147 | + .padding({ left: '29lpx', right: '29lpx' }) | ||
| 148 | + .backgroundColor('#FFFFFF') | ||
| 149 | + .borderRadius('8lpx') | ||
| 150 | + } | ||
| 151 | +} | ||
| 152 | + | ||
| 153 | +@Component | ||
| 154 | +struct getTuiJianCell { | ||
| 155 | + @ObjectLink item: PrivacySettingModel; | ||
| 156 | + index:number = 0; | ||
| 157 | + build() { | ||
| 158 | + Column() { | ||
| 159 | + | ||
| 160 | + Row() { | ||
| 161 | + // 左侧标题 | ||
| 162 | + Text(this.item.privacyName) | ||
| 163 | + .fontColor('#666666') | ||
| 164 | + .fontSize('31lpx') | ||
| 165 | + | ||
| 166 | + Row() { | ||
| 167 | + Toggle({ type: ToggleType.Switch, isOn: this.item.permission }) | ||
| 168 | + .height('58lpx') | ||
| 169 | + .width('96lpx') | ||
| 170 | + .selectedColor('#ED2700') | ||
| 171 | + .onChange((isOn: boolean) => { | ||
| 172 | + // this.privacySwitch = isOn; | ||
| 173 | + this.item.editUserDetail(isOn?'1':'0'); | ||
| 174 | + }) | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + } | ||
| 178 | + .alignItems(VerticalAlign.Center) | ||
| 179 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 180 | + .height('97lpx') | ||
| 181 | + .width('100%') | ||
| 182 | + | ||
| 183 | + | ||
| 184 | + Blank() | ||
| 185 | + .backgroundColor('#EDEDED') | ||
| 186 | + .height('1lpx') | ||
| 187 | + | ||
| 188 | + Text(DiyCloseTipsString) | ||
| 189 | + .fontColor('#999999') | ||
| 190 | + .fontSize('23lpx') | ||
| 191 | + .margin({ right: '8lpx' }) | ||
| 192 | + .height('69lpx') | ||
| 193 | + | ||
| 9 | } | 194 | } |
| 195 | + .alignItems(HorizontalAlign.Start) | ||
| 196 | + .backgroundColor('#FFFFFF') | ||
| 197 | + .borderRadius('8lpx') | ||
| 198 | + .padding({ left: '29lpx', right: '29lpx' }) | ||
| 10 | } | 199 | } |
| 11 | -} | ||
| 200 | +} |
| 1 | -import dataPreferences from '@ohos.data.preferences'; | ||
| 2 | -import { PermissionUtil } from 'wdKit' | ||
| 3 | -import { SPHelper } from 'wdKit' | ||
| 4 | -import hilog from '@ohos.hilog'; | ||
| 5 | -import { PrivacySettingModel } from '../../model/PrivacySettingModel' | ||
| 6 | -import { Params } from 'wdBean'; | ||
| 7 | -import { WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 8 | - | ||
| 9 | -const TAG = 'PrivacySettingComponents'; | ||
| 10 | - | ||
| 11 | -@Component | ||
| 12 | -export struct PrivacySettingComponents { | ||
| 13 | - @State listData: Array<PrivacySettingModel> = [new PrivacySettingModel('开启个性推荐', false, 'ohos.permission.READ_MEDIA'), new PrivacySettingModel('相册权限', false, 'ohos.permission.READ_MEDIA'), new PrivacySettingModel('相机权限', false, 'ohos.permission.CAMERA'), new PrivacySettingModel('定位权限', false, 'ohos.permission.APPROXIMATELY_LOCATION'), new PrivacySettingModel('麦克风权限', false, 'ohos.permission.MICROPHONE')]; | ||
| 14 | - @State tips: string = '设置前可查阅' | ||
| 15 | - @State privacyTips: string = '《隐私政策》' | ||
| 16 | - | ||
| 17 | - aboutToAppear() { | ||
| 18 | - // 获取权限= | ||
| 19 | - // SPHelper.default.save('sdf','sdf'); | ||
| 20 | - // this.initListData(); | ||
| 21 | - this.getPermissionStatus(); | ||
| 22 | - // RefreshStatus; | ||
| 23 | - | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | - async getPermissionStatus() { | ||
| 27 | - const permissionUtil = new PermissionUtil(); | ||
| 28 | - for (const element of this.listData) { | ||
| 29 | - if (element.privacyName == '开启个性推荐') { | ||
| 30 | - element.queryUserDetail(); | ||
| 31 | - // element.permission = true; | ||
| 32 | - continue; | ||
| 33 | - } | ||
| 34 | - const result = await permissionUtil.checkPermissions(element.permissionKey); | ||
| 35 | - element.permission = result; | ||
| 36 | - } | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - build() { | ||
| 40 | - Navigation() { | ||
| 41 | - //滑动区域 | ||
| 42 | - this.PrivacySettingComponentsUI() | ||
| 43 | - | ||
| 44 | - }.titleMode(NavigationTitleMode.Mini) | ||
| 45 | - .title('隐私设置') | ||
| 46 | - .backgroundColor('#F8F8F8') | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - @Builder PrivacySettingComponentsUI() { | ||
| 50 | - Column() { | ||
| 51 | - | ||
| 52 | - List({ space: '23lpx' }) { | ||
| 53 | - ForEach(this.listData, (item: PrivacySettingModel, index:number) => { | ||
| 54 | - ListItem() { | ||
| 55 | - if (index == 0) { | ||
| 56 | - getTuiJianCell({ item:item, index:index }); | ||
| 57 | - } else { | ||
| 58 | - getArrowCell({ item:item, index:index }); | ||
| 59 | - } | ||
| 60 | - }.onClick(() => { | ||
| 61 | - if (index != 0) { | ||
| 62 | - if (!item.permission) { | ||
| 63 | - //跳转权限设置 | ||
| 64 | - const permissionUtil = new PermissionUtil(); | ||
| 65 | - PermissionUtil.reqPermissionsFromUser([item.permissionKey], this).then((res)=>{ | ||
| 66 | - item.permission = res; | ||
| 67 | - }); | ||
| 68 | - } | ||
| 69 | - } | ||
| 70 | - }) | ||
| 71 | - }) | ||
| 72 | - } | ||
| 73 | - .padding({ left: '29lpx', right: '29lpx' }) | ||
| 74 | - .margin({ top: '38lpx' }) | ||
| 75 | - | ||
| 76 | - Row() { | ||
| 77 | - Text(this.tips) | ||
| 78 | - .fontSize('25lpx') | ||
| 79 | - .textAlign(TextAlign.Start) | ||
| 80 | - .fontColor($r("app.color.color_666666")) | ||
| 81 | - .margin({ left: '29lpx', top: '46lpx' }) | ||
| 82 | - // .backgroundColor(Color.Orange) | ||
| 83 | - Text(this.privacyTips) | ||
| 84 | - .fontSize('25lpx') | ||
| 85 | - .textAlign(TextAlign.Start) | ||
| 86 | - .fontColor('#ED2800') | ||
| 87 | - .margin({ top: '46lpx' }) | ||
| 88 | - .onClick(() => { | ||
| 89 | - //跳转隐私政策 | ||
| 90 | - let bean={contentId:"2",pageID:""} as Params | ||
| 91 | - WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | ||
| 92 | - }) | ||
| 93 | - } | ||
| 94 | - | ||
| 95 | - } | ||
| 96 | - .width('100%') | ||
| 97 | - .height('100%') | ||
| 98 | - .backgroundColor('#F8F8F8') | ||
| 99 | - .alignItems(HorizontalAlign.Start) | ||
| 100 | - } | ||
| 101 | -} | ||
| 102 | - | ||
| 103 | - | ||
| 104 | -@Component | ||
| 105 | -struct getArrowCell { | ||
| 106 | - @ObjectLink item: PrivacySettingModel; | ||
| 107 | - index:number = 0; | ||
| 108 | - // 右文字+箭头cell | ||
| 109 | - // @Builder getArrowCell(item:PrivacySettingModel, index) { | ||
| 110 | - build() { | ||
| 111 | - Row() { | ||
| 112 | - // 左侧标题 | ||
| 113 | - Text(this.item.privacyName) | ||
| 114 | - .fontColor('#666666') | ||
| 115 | - .fontSize('31lpx') | ||
| 116 | - | ||
| 117 | - Row() { | ||
| 118 | - Text(this.item.permission ? '已开启' : '去设置') | ||
| 119 | - .fontColor(this.item.permission ? '#666666' : '#CCCCCC') | ||
| 120 | - .fontSize('31lpx') | ||
| 121 | - .margin({ right: '8lpx' }) | ||
| 122 | - | ||
| 123 | - Image($r('app.media.mine_user_arrow')) | ||
| 124 | - .width('27lpx') | ||
| 125 | - .height('27lpx') | ||
| 126 | - .objectFit(ImageFit.Auto) | ||
| 127 | - } | ||
| 128 | - | ||
| 129 | - } | ||
| 130 | - .alignItems(VerticalAlign.Center) | ||
| 131 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 132 | - .height('97lpx') | ||
| 133 | - .width('100%') | ||
| 134 | - .padding({ left: '29lpx', right: '29lpx' }) | ||
| 135 | - .backgroundColor('#FFFFFF') | ||
| 136 | - .borderRadius('8lpx') | ||
| 137 | - } | ||
| 138 | -} | ||
| 139 | - | ||
| 140 | -@Component | ||
| 141 | -struct getTuiJianCell { | ||
| 142 | - @ObjectLink item: PrivacySettingModel; | ||
| 143 | - index:number = 0; | ||
| 144 | - build() { | ||
| 145 | - Column() { | ||
| 146 | - | ||
| 147 | - Row() { | ||
| 148 | - // 左侧标题 | ||
| 149 | - Text(this.item.privacyName) | ||
| 150 | - .fontColor('#666666') | ||
| 151 | - .fontSize('31lpx') | ||
| 152 | - | ||
| 153 | - Row() { | ||
| 154 | - Toggle({ type: ToggleType.Switch, isOn: this.item.permission }) | ||
| 155 | - .height('58lpx') | ||
| 156 | - .width('96lpx') | ||
| 157 | - // .selectedColor(Color.Pink) | ||
| 158 | - .onChange((isOn: boolean) => { | ||
| 159 | - // this.privacySwitch = isOn; | ||
| 160 | - this.item.editUserDetail(isOn?'1':'0'); | ||
| 161 | - }) | ||
| 162 | - } | ||
| 163 | - | ||
| 164 | - } | ||
| 165 | - .alignItems(VerticalAlign.Center) | ||
| 166 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 167 | - .height('97lpx') | ||
| 168 | - .width('100%') | ||
| 169 | - | ||
| 170 | - | ||
| 171 | - Blank() | ||
| 172 | - .backgroundColor('#EDEDED') | ||
| 173 | - .height('1lpx') | ||
| 174 | - | ||
| 175 | - Text('关闭后,将无法看到个性化推荐的服务') | ||
| 176 | - .fontColor('#999999') | ||
| 177 | - .fontSize('23lpx') | ||
| 178 | - .margin({ right: '8lpx' }) | ||
| 179 | - .height('69lpx') | ||
| 180 | - | ||
| 181 | - } | ||
| 182 | - .alignItems(HorizontalAlign.Start) | ||
| 183 | - .backgroundColor('#FFFFFF') | ||
| 184 | - .borderRadius('8lpx') | ||
| 185 | - .padding({ left: '29lpx', right: '29lpx' }) | ||
| 186 | - } | ||
| 187 | -} |
| @@ -37,10 +37,6 @@ export const enum WDViewDefaultType { | @@ -37,10 +37,6 @@ export const enum WDViewDefaultType { | ||
| 37 | WDViewDefaultType_NoVisitAccount, | 37 | WDViewDefaultType_NoVisitAccount, |
| 38 | /// 15.暂无关注 | 38 | /// 15.暂无关注 |
| 39 | WDViewDefaultType_NoFollow, | 39 | WDViewDefaultType_NoFollow, |
| 40 | - /// 16.直播结束 | ||
| 41 | - WDViewDefaultType_NoLiveEnd, | ||
| 42 | - /// 17.直播暂停 | ||
| 43 | - WDViewDefaultType_NoLiveSuspend, | ||
| 44 | /// 18.视频加载失败 | 40 | /// 18.视频加载失败 |
| 45 | WDViewDefaultType_NoVideo, | 41 | WDViewDefaultType_NoVideo, |
| 46 | /// 19.暂无内容1 | 42 | /// 19.暂无内容1 |
| @@ -185,10 +181,6 @@ export struct EmptyComponent { | @@ -185,10 +181,6 @@ export struct EmptyComponent { | ||
| 185 | contentString = '前方拥堵,请耐心等待...' // 前方拥堵,请耐心等待... | 181 | contentString = '前方拥堵,请耐心等待...' // 前方拥堵,请耐心等待... |
| 186 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) { | 182 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) { |
| 187 | contentString = '该号主暂时无法访问' // 前方拥堵,请耐心等待 | 183 | contentString = '该号主暂时无法访问' // 前方拥堵,请耐心等待 |
| 188 | - } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) { | ||
| 189 | - contentString = '直播已结束' // 前方拥堵,请耐心等待 | ||
| 190 | - } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveSuspend) { | ||
| 191 | - contentString = '主播暂时离开,马上回来' // 前方拥堵,请耐心等待 | ||
| 192 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) { | 184 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) { |
| 193 | contentString = '获取内容失败请重试' // 前方拥堵,请耐心等待 | 185 | contentString = '获取内容失败请重试' // 前方拥堵,请耐心等待 |
| 194 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent1) { | 186 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent1) { |
| @@ -221,8 +213,6 @@ export struct EmptyComponent { | @@ -221,8 +213,6 @@ export struct EmptyComponent { | ||
| 221 | imageString = $r('app.media.icon_no_limiting') | 213 | imageString = $r('app.media.icon_no_limiting') |
| 222 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) { | 214 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) { |
| 223 | imageString = $r('app.media.icon_no_master1') | 215 | imageString = $r('app.media.icon_no_master1') |
| 224 | - } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) { | ||
| 225 | - imageString = $r('app.media.icon_no_end') | ||
| 226 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) { | 216 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) { |
| 227 | imageString = $r('app.media.icon_no_content') | 217 | imageString = $r('app.media.icon_no_content') |
| 228 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent1) { | 218 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent1) { |
| 1 | +import { CommonConstants } from 'wdConstant'; | ||
| 2 | +import { Logger } from 'wdKit'; | ||
| 3 | + | ||
| 4 | +const TAG = 'LiveEmptyComponent'; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * WDViewDefaultType 缺省页 | ||
| 8 | + */ | ||
| 9 | +export const enum WDViewDefaultType { | ||
| 10 | + /// 1.默认 | ||
| 11 | + WDViewDefaultType_Default, | ||
| 12 | + /// 16.直播结束 | ||
| 13 | + WDViewDefaultType_NoLiveEnd, | ||
| 14 | + /// 17.直播暂停 | ||
| 15 | + WDViewDefaultType_NoLiveSuspend, | ||
| 16 | + | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * 空数据/无数据 | ||
| 21 | + */ | ||
| 22 | +@Preview | ||
| 23 | +@Component | ||
| 24 | +export struct LiveEmptyComponent { | ||
| 25 | + // private emptySize: SizeOptions = {}; | ||
| 26 | + @State emptyWidth: string | number = CommonConstants.FULL_PARENT; | ||
| 27 | + @State emptyHeight: string | number = CommonConstants.FULL_PARENT; | ||
| 28 | + @State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default | ||
| 29 | + /** | ||
| 30 | + * The empty image width percentage setting. | ||
| 31 | + */ | ||
| 32 | + readonly EMPTY_IMAGE_WIDTH: string = '15%'; | ||
| 33 | + /** | ||
| 34 | + * The empty image height percentage setting. | ||
| 35 | + */ | ||
| 36 | + readonly EMPTY_IMAGE_HEIGHT: string = '15%'; | ||
| 37 | + /** | ||
| 38 | + * The empty data text component margin top. | ||
| 39 | + */ | ||
| 40 | + readonly EMPTY_TIP_TEXT_MARGIN_TOP: string = '10'; | ||
| 41 | + /** | ||
| 42 | + * The empty data text opacity. | ||
| 43 | + */ | ||
| 44 | + readonly TEXT_OPACITY: number = 0.4; | ||
| 45 | + | ||
| 46 | + build() { | ||
| 47 | + this.noProgrammeData(); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * 无数据,空白view组件 | ||
| 52 | + */ | ||
| 53 | + @Builder | ||
| 54 | + noProgrammeData() { | ||
| 55 | + Column() { | ||
| 56 | + Image(this.buildNoDataTipImage()) | ||
| 57 | + .width('this.EMPTY_IMAGE_WIDTH') | ||
| 58 | + .height(this.EMPTY_IMAGE_HEIGHT) | ||
| 59 | + .objectFit(ImageFit.Contain) | ||
| 60 | + // .border({ width: 1, color: Color.Red, radius: 6 }) | ||
| 61 | + | ||
| 62 | + Text(this.buildNoDataTip()) | ||
| 63 | + .fontSize($r('app.float.normal_text_size')) | ||
| 64 | + .fontColor('#000000') | ||
| 65 | + .fontWeight(FontWeight.Normal) | ||
| 66 | + .opacity(this.TEXT_OPACITY) | ||
| 67 | + .margin({ top: this.EMPTY_TIP_TEXT_MARGIN_TOP }) | ||
| 68 | + .onClick((event: ClickEvent) => { | ||
| 69 | + Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`); | ||
| 70 | + }) | ||
| 71 | + } | ||
| 72 | + .justifyContent(FlexAlign.Center) | ||
| 73 | + .width(this.emptyWidth) | ||
| 74 | + .height(this.emptyHeight) | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + buildNoDataTip(): string { | ||
| 78 | + Logger.info(TAG, "buildNoDataTip"); | ||
| 79 | + let contentString: string = '暂无内容' | ||
| 80 | + if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) { | ||
| 81 | + contentString = '直播已结束' // 前方拥堵,请耐心等待 | ||
| 82 | + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveSuspend) { | ||
| 83 | + contentString = '主播暂时离开,马上回来' // 前方拥堵,请耐心等待 | ||
| 84 | + } | ||
| 85 | + return contentString | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + buildNoDataTipImage(): Resource | string { | ||
| 89 | + Logger.info(TAG, "buildNoDataTip"); | ||
| 90 | + let imageString: Resource | string = $r('app.media.icon_no_content') | ||
| 91 | + if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) { | ||
| 92 | + imageString = $r('app.media.icon_no_end') | ||
| 93 | + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveSuspend) { | ||
| 94 | + imageString = $r('app.media.icon_no_liver') | ||
| 95 | + } | ||
| 96 | + return imageString | ||
| 97 | + } | ||
| 98 | +} |
| @@ -45,7 +45,7 @@ class MineSettingDatasModel{ | @@ -45,7 +45,7 @@ class MineSettingDatasModel{ | ||
| 45 | this.mainSettingData.push(new MineMainSettingFunctionItem(null, '隐私设罝', null, 0, false)) | 45 | this.mainSettingData.push(new MineMainSettingFunctionItem(null, '隐私设罝', null, 0, false)) |
| 46 | this.mainSettingData.push(new MineMainSettingFunctionItem(null, '仅WiFi网络加载图片', null, 1, false)) | 46 | this.mainSettingData.push(new MineMainSettingFunctionItem(null, '仅WiFi网络加载图片', null, 1, false)) |
| 47 | this.mainSettingData.push(new MineMainSettingFunctionItem(null, 'WiFi网络情况下自动播放视频', null, 1, false)) | 47 | this.mainSettingData.push(new MineMainSettingFunctionItem(null, 'WiFi网络情况下自动播放视频', null, 1, false)) |
| 48 | - this.mainSettingData.push(new MineMainSettingFunctionItem(null, '开户播放器悬浮窗', null, 1, false)) | 48 | + this.mainSettingData.push(new MineMainSettingFunctionItem(null, '开启播放器悬浮窗', null, 1, false)) |
| 49 | this.mainSettingData.push(new MineMainSettingFunctionItem(null, null, null, 2, null)) | 49 | this.mainSettingData.push(new MineMainSettingFunctionItem(null, null, null, 2, null)) |
| 50 | this.mainSettingData.push(new MineMainSettingFunctionItem(null, '清除缓存', '32MB', 0, false)) | 50 | this.mainSettingData.push(new MineMainSettingFunctionItem(null, '清除缓存', '32MB', 0, false)) |
| 51 | this.mainSettingData.push(new MineMainSettingFunctionItem(null, '评价我们', null, 0, false)) | 51 | this.mainSettingData.push(new MineMainSettingFunctionItem(null, '评价我们', null, 0, false)) |
-
Please register or login to post a comment