wangyujian_wd

Merge remote-tracking branch 'origin/main'

Showing 28 changed files with 852 additions and 393 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 }
@@ -24,6 +24,7 @@ export class UserDataLocal { @@ -24,6 +24,7 @@ export class UserDataLocal {
24 static USER_HEADER_URL="userHeaderUrl" 24 static USER_HEADER_URL="userHeaderUrl"
25 static USER_LEVEL="userLevel" 25 static USER_LEVEL="userLevel"
26 static USER_LEVEL_HEADER_URL="userLevelHeaderUrl" 26 static USER_LEVEL_HEADER_URL="userLevelHeaderUrl"
  27 + static USER_FOLLOW_OPERATION="user_follow_operation"
27 28
28 //刷新token 用到 29 //刷新token 用到
29 static USER_REFRESH_TOKEN="refreshToken" 30 static USER_REFRESH_TOKEN="refreshToken"
@@ -89,6 +90,10 @@ export class UserDataLocal { @@ -89,6 +90,10 @@ export class UserDataLocal {
89 SPHelper.default.save(UserDataLocal.USER_HEADER_URL, url) 90 SPHelper.default.save(UserDataLocal.USER_HEADER_URL, url)
90 } 91 }
91 92
  93 + public static setUserFollowOperation(timestamp:string) {
  94 + SPHelper.default.saveSync(UserDataLocal.USER_FOLLOW_OPERATION, timestamp)
  95 + }
  96 +
92 97
93 public static getUserLevel() { 98 public static getUserLevel() {
94 if(UserDataLocal.userLevel != -1){ 99 if(UserDataLocal.userLevel != -1){
@@ -19,9 +19,11 @@ export class HttpBizUtil { @@ -19,9 +19,11 @@ export class HttpBizUtil {
19 * @param headers 请求header参数 19 * @param headers 请求header参数
20 * @returns 返回值 20 * @returns 返回值
21 */ 21 */
22 - static get<T = string>(url: string, headers?: HashMap<string, string>): Promise<ResponseDTO<T>> {  
23 - return new Promise<ResponseDTO<T>>((success, debug) => {  
24 - WDHttp.get<ResponseDTO<T>>(url, headers).then((resDTO: ResponseDTO<T>) => { 22 + static get<T = ResponseDTO<string>>(url: string, headers?: HashMap<string, string>): Promise<T> {
  23 + return new Promise<T>((success, debug) => {
  24 + WDHttp.get<T>(url, headers).then((originalRes: T) => {
  25 + try {
  26 + let resDTO = originalRes as ResponseDTO
25 Logger.debug(TAG, 'get: ' + resDTO.code) 27 Logger.debug(TAG, 'get: ' + resDTO.code)
26 Logger.debug(TAG, 'get: ' + resDTO.message) 28 Logger.debug(TAG, 'get: ' + resDTO.message)
27 // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面 29 // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面
@@ -33,16 +35,20 @@ export class HttpBizUtil { @@ -33,16 +35,20 @@ export class HttpBizUtil {
33 } 35 }
34 Logger.debug(TAG, 'get again send: ' + token) 36 Logger.debug(TAG, 'get again send: ' + token)
35 // refreshToken为空场景不处理,直接请求接口。 37 // refreshToken为空场景不处理,直接请求接口。
36 - WDHttp.get<ResponseDTO<T>>(url, headers).then((resDTO: ResponseDTO<T>) => {  
37 - Logger.debug(TAG, 'get again: ' + resDTO.message)  
38 - success(resDTO) 38 + WDHttp.get<T>(url, headers).then((againResDTO: T) => {
  39 + Logger.debug(TAG, 'get again: ' + againResDTO)
  40 + success(againResDTO)
39 }).catch((res: object) => { 41 }).catch((res: object) => {
40 debug(res) 42 debug(res)
41 }) 43 })
42 }); 44 });
43 } else { 45 } else {
44 - success(resDTO) 46 + success(originalRes)
45 } 47 }
  48 + } catch (e) {
  49 + debug(originalRes)
  50 + }
  51 +
46 }).catch((res: object) => { 52 }).catch((res: object) => {
47 debug(res) 53 debug(res)
48 }) 54 })
@@ -56,9 +62,11 @@ export class HttpBizUtil { @@ -56,9 +62,11 @@ export class HttpBizUtil {
56 * @param headers 请求header参数 62 * @param headers 请求header参数
57 * @returns 返回值 63 * @returns 返回值
58 */ 64 */
59 - static post<T = string>(url: string, data?: object, headers?: HashMap<string, string>): Promise<ResponseDTO<T>> {  
60 - return new Promise<ResponseDTO<T>>((success, debug) => {  
61 - WDHttp.post<ResponseDTO<T>>(url, data, headers).then((resDTO: ResponseDTO<T>) => { 65 + static post<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
  66 + return new Promise<T>((success, debug) => {
  67 + WDHttp.post<T>(url, data, headers).then((originalRes: T) => {
  68 + try {
  69 + let resDTO = originalRes as ResponseDTO
62 Logger.debug(TAG, 'post: ' + resDTO.code) 70 Logger.debug(TAG, 'post: ' + resDTO.code)
63 Logger.debug(TAG, 'post: ' + resDTO.message) 71 Logger.debug(TAG, 'post: ' + resDTO.message)
64 // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面 72 // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面
@@ -69,14 +77,17 @@ export class HttpBizUtil { @@ -69,14 +77,17 @@ export class HttpBizUtil {
69 headers.replace('cookie', 'RMRB-X-TOKEN=' + token) 77 headers.replace('cookie', 'RMRB-X-TOKEN=' + token)
70 } 78 }
71 // refreshToken为空场景不处理,直接请求接口。 79 // refreshToken为空场景不处理,直接请求接口。
72 - WDHttp.post<ResponseDTO<T>>(url, headers).then((resDTO: ResponseDTO<T>) => {  
73 - success(resDTO) 80 + WDHttp.post<T>(url, headers).then((againResDTO: T) => {
  81 + success(againResDTO)
74 }).catch((res: object) => { 82 }).catch((res: object) => {
75 debug(res) 83 debug(res)
76 }) 84 })
77 }); 85 });
78 } else { 86 } else {
79 - success(resDTO) 87 + success(originalRes)
  88 + }
  89 + } catch (e) {
  90 + success(originalRes)
80 } 91 }
81 }).catch((res: object) => { 92 }).catch((res: object) => {
82 debug(res) 93 debug(res)
@@ -281,6 +281,11 @@ export class HttpUrlUtils { @@ -281,6 +281,11 @@ export class HttpUrlUtils {
281 * 更新 兴趣偏好 281 * 更新 兴趣偏好
282 */ 282 */
283 static readonly INTERESTS_UPDATETAG_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/updateUserTag"; 283 static readonly INTERESTS_UPDATETAG_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/updateUserTag";
  284 + /**
  285 + * 获取启动页相关数据
  286 + */
  287 + static readonly LAUNCH_PAGE_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/launchPage";
  288 +
284 private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT; 289 private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT;
285 /** 290 /**
286 * 推荐列表 291 * 推荐列表
@@ -714,6 +719,12 @@ export class HttpUrlUtils { @@ -714,6 +719,12 @@ export class HttpUrlUtils {
714 return url; 719 return url;
715 } 720 }
716 721
  722 + static getLaunchPageDataUrl() {
  723 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LAUNCH_PAGE_PATH;
  724 + return url;
  725 +
  726 + }
  727 +
717 static getLiveDetailsUrl() { 728 static getLiveDetailsUrl() {
718 let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH 729 let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH
719 return url 730 return url
1 import { CompDTO } from 'wdBean'; 1 import { CompDTO } from 'wdBean';
2 import { CommonConstants, CompStyle } from 'wdConstant'; 2 import { CommonConstants, CompStyle } from 'wdConstant';
3 -import { BannerComponent } from './view/BannerComponent';  
4 import { LabelComponent } from './view/LabelComponent'; 3 import { LabelComponent } from './view/LabelComponent';
5 import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; 4 import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
6 import { 5 import {
@@ -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,7 +147,11 @@ export struct MultiPictureDetailPageComponent { @@ -142,7 +147,11 @@ 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 }) 150 + Button({ type: ButtonType.Normal, stateEffect: true }) {
  151 + Row() {
  152 + Text('+关注').fontSize(12).fontColor(0xffffff)
  153 + }.alignItems(VerticalAlign.Center)
  154 + }
146 .borderRadius(4) 155 .borderRadius(4)
147 .backgroundColor('#ED2800') 156 .backgroundColor('#ED2800')
148 .width(48) 157 .width(48)
@@ -150,15 +159,9 @@ export struct MultiPictureDetailPageComponent { @@ -150,15 +159,9 @@ export struct MultiPictureDetailPageComponent {
150 .onClick(() => { 159 .onClick(() => {
151 this.handleAccention() 160 this.handleAccention()
152 }) 161 })
153 - .margin({  
154 - top: 10,  
155 - bottom: 10,  
156 - left: 16,  
157 - right: 16  
158 - })  
159 - .fontSize(12)  
160 - .fontColor(Color.White)  
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 }
@@ -71,6 +71,7 @@ export struct AttentionListComponent { @@ -71,6 +71,7 @@ export struct AttentionListComponent {
71 }) 71 })
72 } 72 }
73 .listDirection(Axis.Horizontal) 73 .listDirection(Axis.Horizontal)
  74 + .scrollBar(BarState.Off)
74 .height(74) 75 .height(74)
75 } 76 }
76 .padding({ 77 .padding({
1 import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; 1 import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
2 import { RmhTitle } from '../cardCommon/RmhTitle' 2 import { RmhTitle } from '../cardCommon/RmhTitle'
3 import { ProcessUtils } from '../../utils/ProcessUtils'; 3 import { ProcessUtils } from '../../utils/ProcessUtils';
  4 +import { CommonConstants } from 'wdConstant/Index';
  5 +
4 const TAG = 'Card19Component'; 6 const TAG = 'Card19Component';
5 7
6 /** 8 /**
@@ -83,9 +85,16 @@ export struct Card19Component { @@ -83,9 +85,16 @@ export struct Card19Component {
83 .fontColor($r('app.color.color_222222')) 85 .fontColor($r('app.color.color_222222'))
84 .textOverflowStyle(2) 86 .textOverflowStyle(2)
85 .margin({ bottom: 8 }) 87 .margin({ bottom: 8 })
  88 + .width(CommonConstants.FULL_WIDTH)
  89 + .onClick((event: ClickEvent) => {
  90 + ProcessUtils.processPage(this.contentDTO)
  91 + })
86 } 92 }
87 // 图片-从无图到9图展示 93 // 图片-从无图到9图展示
88 createImg({ fullColumnImgUrls: this.contentDTO.fullColumnImgUrls }) 94 createImg({ fullColumnImgUrls: this.contentDTO.fullColumnImgUrls })
  95 + .onClick((event: ClickEvent) => {
  96 + ProcessUtils.processPage(this.contentDTO)
  97 + })
89 //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 98 //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
90 } 99 }
91 .padding({ 100 .padding({
@@ -94,9 +103,6 @@ export struct Card19Component { @@ -94,9 +103,6 @@ export struct Card19Component {
94 top: $r('app.float.card_comp_pagePadding_tb'), 103 top: $r('app.float.card_comp_pagePadding_tb'),
95 bottom: $r('app.float.card_comp_pagePadding_tb') 104 bottom: $r('app.float.card_comp_pagePadding_tb')
96 }) 105 })
97 - .onClick((event: ClickEvent) => {  
98 - ProcessUtils.processPage(this.contentDTO)  
99 - })  
100 } 106 }
101 } 107 }
102 108
@@ -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
@@ -12,12 +12,10 @@ import { ProcessUtils } from '../../utils/ProcessUtils'; @@ -12,12 +12,10 @@ import { ProcessUtils } from '../../utils/ProcessUtils';
12 export struct ZhSingleRow04 { 12 export struct ZhSingleRow04 {
13 @State compDTO: CompDTO = {} as CompDTO 13 @State compDTO: CompDTO = {} as CompDTO
14 14
15 - aboutToAppear() {}  
16 -  
17 build() { 15 build() {
18 - Column(){ 16 + Column() {
19 //顶部 17 //顶部
20 - Row(){ 18 + Row() {
21 Row() { 19 Row() {
22 Image($r("app.media.local_selection")) 20 Image($r("app.media.local_selection"))
23 .width(24) 21 .width(24)
@@ -28,6 +26,7 @@ export struct ZhSingleRow04 { @@ -28,6 +26,7 @@ export struct ZhSingleRow04 {
28 .fontColor($r("app.color.color_222222")) 26 .fontColor($r("app.color.color_222222"))
29 .fontWeight(600) 27 .fontWeight(600)
30 } 28 }
  29 +
31 Row() { 30 Row() {
32 Text("更多") 31 Text("更多")
33 .fontSize($r("app.float.font_size_14")) 32 .fontSize($r("app.float.font_size_14"))
@@ -41,64 +40,93 @@ export struct ZhSingleRow04 { @@ -41,64 +40,93 @@ export struct ZhSingleRow04 {
41 .justifyContent(FlexAlign.SpaceBetween) 40 .justifyContent(FlexAlign.SpaceBetween)
42 .margin({ top: 8, bottom: 8 }) 41 .margin({ top: 8, bottom: 8 })
43 .width('100%') 42 .width('100%')
  43 +
44 // 列表内容 44 // 列表内容
45 List({ space: 12 }) { 45 List({ space: 12 }) {
46 - ForEach(this.compDTO.operDataList, (item: ContentDTO) => { 46 + ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
47 ListItem() { 47 ListItem() {
48 - Row(){  
49 - if(item.coverUrl) {  
50 - Image(item.coverUrl)  
51 - .width(84)  
52 - .height(56)  
53 - .borderRadius(3)  
54 - .objectFit(ImageFit.Cover)  
55 - .padding({right: 6})  
56 - }  
57 - Column(){  
58 - Text(item.newsTitle)  
59 - .fontSize($r("app.float.font_size_16"))  
60 - .fontColor($r("app.color.color_212228"))  
61 - .fontWeight(400)  
62 - .maxLines(2)  
63 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
64 - .margin({ top: 8 })  
65 -  
66 - Row(){  
67 - Text(item.source)  
68 - .fontSize($r('app.float.font_size_12'))  
69 - .fontColor($r('app.color.color_B0B0B0'))  
70 - .textOverflow({overflow: TextOverflow.Ellipsis})  
71 - .maxLines(1)  
72 - .width(item.source.length > 10 ? '60%' : '')  
73 - Image($r("app.media.point"))  
74 - .width(16)  
75 - .height(16)  
76 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))  
77 - .fontSize($r("app.float.font_size_12"))  
78 - .fontColor($r("app.color.color_B0B0B0")) 48 + localCard(
  49 + {
  50 + operDataListItem: item
79 } 51 }
80 - .width('100%')  
81 - }  
82 - .width(200)  
83 - }  
84 - // .margin({right: 18})  
85 - .onClick(() =>{ 52 + )
  53 + .margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0})
  54 + .onClick(() => {
86 ProcessUtils.processPage(item) 55 ProcessUtils.processPage(item)
87 }) 56 })
88 } 57 }
89 }) 58 })
90 } 59 }
91 .listDirection(Axis.Horizontal) 60 .listDirection(Axis.Horizontal)
92 - .width('100%') 61 + .scrollBar(BarState.Off)
  62 + .width(CommonConstants.FULL_PARENT)
93 } 63 }
94 .width(CommonConstants.FULL_WIDTH) 64 .width(CommonConstants.FULL_WIDTH)
95 .padding({ 65 .padding({
96 - top: 14,  
97 - left: 16,  
98 - right: 16,  
99 - bottom: 14 66 + left: $r('app.float.card_comp_pagePadding_lf'),
  67 + top: $r('app.float.card_comp_pagePadding_tb'),
  68 + bottom: $r('app.float.card_comp_pagePadding_tb')
100 }) 69 })
101 .backgroundColor($r("app.color.white")) 70 .backgroundColor($r("app.color.white"))
102 .margin({ bottom: 8 }) 71 .margin({ bottom: 8 })
103 } 72 }
104 } 73 }
  74 +
  75 +
  76 +@Component
  77 +struct localCard {
  78 + @Prop operDataListItem: ContentDTO
  79 +
  80 + build() {
  81 + Flex({ direction: FlexDirection.Column }) {
  82 + Text(this.operDataListItem.source)
  83 + .fontSize($r('app.float.font_size_12'))
  84 + .fontColor($r('app.color.color_B0B0B0'))
  85 + .width('100%')
  86 + .margin({ bottom: 6 })
  87 + .flexShrink(0)
  88 +
  89 + Text(this.operDataListItem.newsTitle)
  90 + .width(CommonConstants.FULL_PARENT)
  91 + .height(CommonConstants.FULL_PARENT)
  92 + .fontSize($r('app.float.font_size_16'))
  93 + .fontColor('#000000')
  94 + .align(Alignment.TopStart)
  95 + .maxLines(3)
  96 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  97 + Row() {
  98 + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.operDataListItem.publishTime)))
  99 + .fontSize($r("app.float.font_size_12"))
  100 + .fontColor($r("app.color.color_B0B0B0"))
  101 + .margin({ right: 5 })
  102 + // 这里需要外部查询评论接口后,写入字段
  103 + if(this.operDataListItem.interactData?.commentNum) {
  104 + Text(`${this.operDataListItem.interactData?.commentNum}评`)
  105 + .fontSize(12)
  106 + }
  107 + Blank()
  108 + Image($r('app.media.local_content_icon'))
  109 + .width(20)
  110 + .height(20)
  111 + .margin({
  112 + right: -4
  113 + })
  114 + }
  115 + .width('100%')
  116 + .padding({
  117 + top: 17
  118 + })
  119 + .flexShrink(0)
  120 + }
  121 + .width(182)
  122 + .height(146)
  123 + .padding(12)
  124 + .border({
  125 + radius: 2,
  126 + })
  127 + .shadow({ radius: 5, color: '#1A000000', offsetX: 0, offsetY: 2 })
  128 + .margin({
  129 + right: 10
  130 + })
  131 + }
  132 +}
@@ -44,6 +44,7 @@ export struct ZhSingleRow05 { @@ -44,6 +44,7 @@ export struct ZhSingleRow05 {
44 }) 44 })
45 } 45 }
46 .listDirection(Axis.Horizontal) 46 .listDirection(Axis.Horizontal)
  47 + .scrollBar(BarState.Off)
47 } 48 }
48 .width(CommonConstants.FULL_WIDTH) 49 .width(CommonConstants.FULL_WIDTH)
49 .height(170) 50 .height(170)
@@ -125,6 +126,7 @@ struct CreatorItem { @@ -125,6 +126,7 @@ struct CreatorItem {
125 .fontSize($r('app.float.font_size_12')) 126 .fontSize($r('app.float.font_size_12'))
126 .margin({ top: 8, bottom: 14 }) 127 .margin({ top: 8, bottom: 14 })
127 .textOverflowStyle(2) 128 .textOverflowStyle(2)
  129 + .height(34)
128 if (!this.rmhIsAttention) { 130 if (!this.rmhIsAttention) {
129 Text('关注') 131 Text('关注')
130 .width(60) 132 .width(60)
1 -import { StringUtils, ToastUtils } from 'wdKit/Index' 1 +import { DateTimeUtils, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'
2 import { HttpUrlUtils } from 'wdNetwork/Index' 2 import { HttpUrlUtils } from 'wdNetwork/Index'
3 import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' 3 import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
4 import MinePageDatasModel from '../../../model/MinePageDatasModel' 4 import MinePageDatasModel from '../../../model/MinePageDatasModel'
@@ -133,14 +133,17 @@ export struct FollowChildComponent{ @@ -133,14 +133,17 @@ export struct FollowChildComponent{
133 .maxLines(1) 133 .maxLines(1)
134 .margin({bottom:'12lpx'}) 134 .margin({bottom:'12lpx'})
135 Row(){ 135 Row(){
  136 + if(this.data.cnFansNum!="0"){
136 Text(`粉丝${this.data.cnFansNum}`) 137 Text(`粉丝${this.data.cnFansNum}`)
137 .fontColor($r('app.color.color_B0B0B0')) 138 .fontColor($r('app.color.color_B0B0B0'))
138 .fontSize('23lpx') 139 .fontSize('23lpx')
139 - 140 + }
  141 + if(this.data.cnFansNum!="0" && StringUtils.isNotEmpty(this.data.introduction)){
140 Image($r("app.media.point")) 142 Image($r("app.media.point"))
141 .width('31lpx') 143 .width('31lpx')
142 .height('31lpx') 144 .height('31lpx')
143 .objectFit(ImageFit.Auto) 145 .objectFit(ImageFit.Auto)
  146 + }
144 147
145 Text(`${this.data.introduction}`) 148 Text(`${this.data.introduction}`)
146 .fontColor($r('app.color.color_B0B0B0')) 149 .fontColor($r('app.color.color_B0B0B0'))
@@ -222,6 +225,12 @@ export struct FollowChildComponent{ @@ -222,6 +225,12 @@ export struct FollowChildComponent{
222 if(value!=null){ 225 if(value!=null){
223 if (value.code === 0 || value.code.toString() === "0") { 226 if (value.code === 0 || value.code.toString() === "0") {
224 this.data.status = this.data.status ==="0"?"1":"0" 227 this.data.status = this.data.status ==="0"?"1":"0"
  228 +
  229 + if(this.data.status === "1"){
  230 + UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"")
  231 + }else{
  232 + UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId)
  233 + }
225 } 234 }
226 } 235 }
227 }) 236 })
1 -import { LazyDataSource } from 'wdKit'; 1 +import { LazyDataSource, SPHelper, UserDataLocal } from 'wdKit';
2 import MinePageDatasModel from '../../../model/MinePageDatasModel'; 2 import MinePageDatasModel from '../../../model/MinePageDatasModel';
3 import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel'; 3 import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel';
4 import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem'; 4 import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem';
@@ -9,50 +9,55 @@ import { MineFollowListDetailItem } from '../../../viewmodel/MineFollowListDetai @@ -9,50 +9,55 @@ import { MineFollowListDetailItem } from '../../../viewmodel/MineFollowListDetai
9 import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedItem'; 9 import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedItem';
10 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; 10 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
11 import { FollowChildComponent } from './FollowChildComponent'; 11 import { FollowChildComponent } from './FollowChildComponent';
  12 +import dataPreferences from '@ohos.data.preferences';
12 13
13 const TAG = "FollowListDetailUI" 14 const TAG = "FollowListDetailUI"
  15 +
14 @Component 16 @Component
15 -export struct FollowListDetailUI{  
16 - @State creatorDirectoryId:number = -1;  
17 - @State type:number = 0 17 +export struct FollowListDetailUI {
  18 + @State creatorDirectoryId: number = -1;
  19 + @State type: number = 0
18 @State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); 20 @State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource();
19 - @State count:number = 0;  
20 - @State isLoading:boolean = false  
21 - @State hasMore:boolean = true  
22 - curPageNum:number = 1; 21 + @State count: number = 0;
  22 + @State isLoading: boolean = false
  23 + @State hasMore: boolean = true
  24 + curPageNum: number = 1;
  25 + preferences: dataPreferences.Preferences | null = null;
23 26
24 - aboutToAppear(){ 27 + aboutToAppear() {
25 this.getNewPageData() 28 this.getNewPageData()
  29 + this.addFollowStatusObserver()
26 } 30 }
27 31
28 - build(){  
29 - Column(){  
30 - if(this.count === 0){  
31 - ListHasNoMoreDataUI({style:2}) 32 + build() {
  33 + Column() {
  34 + if (this.count === 0) {
  35 + ListHasNoMoreDataUI({ style: 2 })
32 .height('100%') 36 .height('100%')
33 - }else{ 37 + } else {
34 List({ space: 3 }) { 38 List({ space: 3 }) {
35 LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => { 39 LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => {
36 ListItem() { 40 ListItem() {
37 - FollowChildComponent({data: item,type:this.type}) 41 + FollowChildComponent({ data: item, type: this.type })
38 } 42 }
39 .onClick(() => { 43 .onClick(() => {
40 }) 44 })
41 - }, (item: FollowListDetailItem, index: number) => index.toString()) 45 + }, (item: FollowListDetailItem) => item.creatorId)
42 46
43 //没有更多数据 显示提示 47 //没有更多数据 显示提示
44 - if(!this.hasMore){  
45 - ListItem(){ 48 + if (!this.hasMore) {
  49 + ListItem() {
46 ListHasNoMoreDataUI() 50 ListHasNoMoreDataUI()
47 } 51 }
48 } 52 }
49 - }.cachedCount(10)  
50 - .padding({left:'31lpx',right:'31lpx'}) 53 + }
  54 + .cachedCount(10)
  55 + .padding({ left: '31lpx', right: '31lpx' })
51 .layoutWeight(1) 56 .layoutWeight(1)
52 .scrollBar(BarState.Off) 57 .scrollBar(BarState.Off)
53 - .onReachEnd(()=>{  
54 - console.log(TAG,"触底了");  
55 - if(!this.isLoading){ 58 + .onReachEnd(() => {
  59 + console.log(TAG, "触底了");
  60 + if (!this.isLoading) {
56 this.isLoading = true 61 this.isLoading = true
57 //加载分页数据 62 //加载分页数据
58 this.getNewPageData() 63 this.getNewPageData()
@@ -63,79 +68,128 @@ export struct FollowListDetailUI{ @@ -63,79 +68,128 @@ export struct FollowListDetailUI{
63 .width('100%') 68 .width('100%')
64 } 69 }
65 70
66 - getNewPageData(){ 71 + async addFollowStatusObserver() {
  72 + this.preferences = await SPHelper.default.getPreferences();
  73 + let observer = (key: string) => {
  74 + if (key == UserDataLocal.USER_FOLLOW_OPERATION) {
  75 + if (this.creatorDirectoryId === -1) {
  76 + let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string
  77 + let arr = value.split(',')
  78 + if(arr!=null && arr.length === 2){
  79 + this.data.getDataArray().forEach((element,index) => {
  80 + if (element.creatorId === arr[1]) {
  81 + this.data.deleteItem(index)
  82 + }
  83 + });
  84 + }else{
  85 + if(!this.isLoading){
67 this.isLoading = true 86 this.isLoading = true
68 - //我的关注列表  
69 - if (this.creatorDirectoryId === -1){  
70 - if(this.hasMore){  
71 - let object = new FollowListDetailRequestItem(-1,20,this.curPageNum) 87 + this.hasMore = true
  88 + this.curPageNum = 1
  89 + this.data.clear()
  90 + this.data.notifyDataReload()
  91 + this.getMyFollowListDetail()
  92 + }
  93 + }
  94 + }
  95 + }
  96 + }
  97 + this.preferences.on('change', observer);
  98 + }
  99 +
  100 + getMyFollowListDetail() {
  101 + if (this.hasMore) {
  102 + let object = new FollowListDetailRequestItem(-1, 20, this.curPageNum)
72 103
73 - MinePageDatasModel.getMineFollowListData(object,getContext(this)).then((value)=>{  
74 - if (!this.data || value.list.length == 0){ 104 + MinePageDatasModel.getMineFollowListData(object, getContext(this)).then((value) => {
  105 + if (!this.data || value.list.length == 0) {
75 this.hasMore = false 106 this.hasMore = false
76 - }else{  
77 - value.list.forEach((value)=>{  
78 - this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl)) 107 + this.isLoading = false
  108 + } else {
  109 + value.list.forEach((value) => {
  110 + let fansNum:number = value.fansNum
  111 + let fansNumString = ""
  112 + if (fansNum > 10000) {
  113 + let temp = (fansNum / 10000) + ""
  114 + let index = temp.indexOf('.')
  115 + if (index != -1) {
  116 + temp = temp.substring(0, index + 2)
  117 + } else {
  118 + temp = temp
  119 + }
  120 + fansNumString = temp + "万"
  121 + } else {
  122 + fansNumString = fansNum + ""
  123 + }
  124 + this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl, value.attentionUserName, fansNumString, value.introduction, value.attentionCreatorId, "1", value.attentionUserId, value.attentionUserType, value.attentionUserId, value.mainControl, value.banControl))
79 }) 125 })
80 this.data.notifyDataReload() 126 this.data.notifyDataReload()
81 this.count = this.data.totalCount() 127 this.count = this.data.totalCount()
82 if (this.data.totalCount() < value.totalCount) { 128 if (this.data.totalCount() < value.totalCount) {
83 this.curPageNum++ 129 this.curPageNum++
84 - }else { 130 + } else {
85 this.hasMore = false 131 this.hasMore = false
86 } 132 }
87 } 133 }
88 this.isLoading = false 134 this.isLoading = false
89 - }).catch((err:Error)=>{  
90 - console.log(TAG,"请求失败") 135 + }).catch((err: Error) => {
  136 + console.log(TAG, "请求失败")
91 this.isLoading = false 137 this.isLoading = false
92 }) 138 })
  139 + }else {
  140 + this.isLoading = false
  141 + }
93 } 142 }
94 - }else{  
95 - if(this.hasMore){  
96 - let object = new FollowListDetailRequestItem(this.creatorDirectoryId,20,this.curPageNum)  
97 143
98 - MinePageDatasModel.getFollowListDetailData(object,getContext(this)).then((value)=>{  
99 - if (!this.data || value.list.length == 0){ 144 + getNewPageData() {
  145 + //我的关注列表
  146 + if (this.creatorDirectoryId === -1) {
  147 + this.getMyFollowListDetail()
  148 + } else {
  149 + if (this.hasMore) {
  150 + let object = new FollowListDetailRequestItem(this.creatorDirectoryId, 20, this.curPageNum)
  151 +
  152 + MinePageDatasModel.getFollowListDetailData(object, getContext(this)).then((value) => {
  153 + if (!this.data || value.list.length == 0) {
100 this.hasMore = false 154 this.hasMore = false
101 this.isLoading = false 155 this.isLoading = false
102 - }else{ 156 + } else {
103 this.getFollowListStatus(value) 157 this.getFollowListStatus(value)
104 } 158 }
105 - }).catch((err:Error)=>{  
106 - console.log(TAG,"请求失败") 159 + }).catch((err: Error) => {
  160 + console.log(TAG, "请求失败")
107 this.isLoading = false 161 this.isLoading = false
108 }) 162 })
109 } 163 }
110 } 164 }
111 } 165 }
112 166
113 - getFollowListStatus(result:MineFollowListDetailItem){  
114 - let data_temp : FollowListDetailItem[] = []  
115 - result.list.forEach((item)=>{  
116 - data_temp.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,"0",item.attentionUserId,item.cnUserType,item.cnUserId,item.cnMainControl,-1)) 167 + getFollowListStatus(result: MineFollowListDetailItem) {
  168 + let data_temp: FollowListDetailItem[] = []
  169 + result.list.forEach((item) => {
  170 + data_temp.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, "0", item.attentionUserId, item.cnUserType, item.cnUserId, item.cnMainControl, -1))
117 }) 171 })
118 let request = new CreatorDetailRequestItem() 172 let request = new CreatorDetailRequestItem()
119 173
120 - data_temp.forEach((data)=>{ 174 + data_temp.forEach((data) => {
121 request.creatorIdList.push(data.creatorId) 175 request.creatorIdList.push(data.creatorId)
122 }) 176 })
123 - SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{  
124 - if(value!=null && value.length>0){  
125 - data_temp.forEach((data)=>{  
126 - value.forEach((item)=>{  
127 - if(data.creatorId == item.creatorId){ 177 + SearcherAboutDataModel.getCreatorDetailListData(request).then((value) => {
  178 + if (value != null && value.length > 0) {
  179 + data_temp.forEach((data) => {
  180 + value.forEach((item) => {
  181 + if (data.creatorId == item.creatorId) {
128 data.headPhotoUrl = item.headPhotoUrl 182 data.headPhotoUrl = item.headPhotoUrl
129 - if(item.fansNum>10000){  
130 - let temp = (item.fansNum/10000)+"" 183 + if (item.fansNum > 10000) {
  184 + let temp = (item.fansNum / 10000) + ""
131 let index = temp.indexOf('.') 185 let index = temp.indexOf('.')
132 - if(index != -1){  
133 - temp = temp.substring(0,index+2)  
134 - }else{ 186 + if (index != -1) {
  187 + temp = temp.substring(0, index + 2)
  188 + } else {
135 temp = temp 189 temp = temp
136 } 190 }
137 data.cnFansNum = temp + "万" 191 data.cnFansNum = temp + "万"
138 - }else{ 192 + } else {
139 data.cnFansNum = item.fansNum + "" 193 data.cnFansNum = item.fansNum + ""
140 } 194 }
141 data.introduction = item.introduction 195 data.introduction = item.introduction
@@ -144,32 +198,32 @@ export struct FollowListDetailUI{ @@ -144,32 +198,32 @@ export struct FollowListDetailUI{
144 } 198 }
145 }) 199 })
146 }) 200 })
147 - this.getFollowStatus(data_temp,result.totalCount) 201 + this.getFollowStatus(data_temp, result.totalCount)
148 } 202 }
149 - }).catch((err:Error)=>{  
150 - console.log(TAG,JSON.stringify(err)) 203 + }).catch((err: Error) => {
  204 + console.log(TAG, JSON.stringify(err))
151 this.isLoading = false 205 this.isLoading = false
152 - this.count = this.count===-1?0:this.count 206 + this.count = this.count === -1 ? 0 : this.count
153 }) 207 })
154 } 208 }
155 209
156 - getFollowStatus(result : FollowListDetailItem[],totalCount:number){ 210 + getFollowStatus(result: FollowListDetailItem[], totalCount: number) {
157 let status = new FollowListStatusRequestItem() 211 let status = new FollowListStatusRequestItem()
158 - result.forEach((item)=>{ 212 + result.forEach((item) => {
159 status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId)) 213 status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId))
160 }) 214 })
161 215
162 - MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{  
163 - newValue.forEach((item)=>{  
164 - result.forEach((list)=>{ 216 + MinePageDatasModel.getFollowListStatusData(status, getContext(this)).then((newValue) => {
  217 + newValue.forEach((item) => {
  218 + result.forEach((list) => {
165 if (item.creatorId == list.creatorId) { 219 if (item.creatorId == list.creatorId) {
166 list.status = item.status 220 list.status = item.status
167 } 221 }
168 }) 222 })
169 }) 223 })
170 224
171 - result.forEach((item)=>{  
172 - this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId,item.mainControl,item.banControl)) 225 + result.forEach((item) => {
  226 + this.data.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, item.status, item.attentionUserId, item.cnUserType, item.cnUserId, item.mainControl, item.banControl))
173 }) 227 })
174 228
175 this.data.notifyDataReload() 229 this.data.notifyDataReload()
@@ -177,15 +231,14 @@ export struct FollowListDetailUI{ @@ -177,15 +231,14 @@ export struct FollowListDetailUI{
177 this.count = this.data.totalCount() 231 this.count = this.data.totalCount()
178 if (this.data.totalCount() < totalCount) { 232 if (this.data.totalCount() < totalCount) {
179 this.curPageNum++ 233 this.curPageNum++
180 - }else { 234 + } else {
181 this.hasMore = false 235 this.hasMore = false
182 } 236 }
183 237
184 this.isLoading = false 238 this.isLoading = false
185 - }).catch((err:Error)=>{  
186 - console.log(TAG,"请求失败") 239 + }).catch((err: Error) => {
  240 + console.log(TAG, "请求失败")
187 this.isLoading = false 241 this.isLoading = false
188 }) 242 })
189 } 243 }
190 -  
191 } 244 }
1 import { Params } from 'wdBean'; 1 import { Params } from 'wdBean';
2 -import { DateTimeUtils, LazyDataSource,UserDataLocal } from 'wdKit'; 2 +import { DateTimeUtils, LazyDataSource, SPHelper,UserDataLocal } from 'wdKit';
3 import { WDRouterPage, WDRouterRule } from 'wdRouter'; 3 import { WDRouterPage, WDRouterRule } from 'wdRouter';
4 import MinePageDatasModel from '../../../model/MinePageDatasModel'; 4 import MinePageDatasModel from '../../../model/MinePageDatasModel';
5 import { CommentListItem } from '../../../viewmodel/CommentListItem'; 5 import { CommentListItem } from '../../../viewmodel/CommentListItem';
@@ -7,6 +7,7 @@ import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; @@ -7,6 +7,7 @@ import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
7 import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; 7 import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem';
8 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; 8 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
9 import { FollowChildComponent } from '../follow/FollowChildComponent'; 9 import { FollowChildComponent } from '../follow/FollowChildComponent';
  10 +import dataPreferences from '@ohos.data.preferences';
10 11
11 const TAG = "HomePageBottomComponent" 12 const TAG = "HomePageBottomComponent"
12 @Component 13 @Component
@@ -21,9 +22,38 @@ export struct HomePageBottomComponent{ @@ -21,9 +22,38 @@ export struct HomePageBottomComponent{
21 @State isMineAccount:boolean = true; 22 @State isMineAccount:boolean = true;
22 @State userId:string = ""; 23 @State userId:string = "";
23 @Link commentNum:number 24 @Link commentNum:number
  25 + preferences: dataPreferences.Preferences | null = null;
24 26
25 aboutToAppear(){ 27 aboutToAppear(){
26 this.getNewPageData() 28 this.getNewPageData()
  29 + this.addFollowStatusObserver()
  30 + }
  31 +
  32 + async addFollowStatusObserver() {
  33 + this.preferences = await SPHelper.default.getPreferences();
  34 + let observer = (key: string) => {
  35 + if (key == UserDataLocal.USER_FOLLOW_OPERATION) {
  36 + let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string
  37 + let arr = value.split(',')
  38 + if(arr!=null && arr.length === 2){
  39 + this.data_follow.getDataArray().forEach((element,index) => {
  40 + if (element.creatorId === arr[1]) {
  41 + this.data_follow.deleteItem(index)
  42 + }
  43 + });
  44 + }else{
  45 + if(!this.isLoading){
  46 + this.isLoading = true
  47 + this.hasMore = true
  48 + this.curPageNum = 1
  49 + this.data_follow.clear()
  50 + this.data_follow.notifyDataReload()
  51 + this.getMyFollowListDetail()
  52 + }
  53 + }
  54 + }
  55 + }
  56 + this.preferences.on('change', observer);
27 } 57 }
28 58
29 build(){ 59 build(){
@@ -175,10 +205,8 @@ export struct HomePageBottomComponent{ @@ -175,10 +205,8 @@ export struct HomePageBottomComponent{
175 .borderRadius(12) 205 .borderRadius(12)
176 } 206 }
177 207
178 - getNewPageData(){  
179 - this.isLoading = true  
180 - //我的关注列表  
181 - if (this.style === 1){ 208 +
  209 + getMyFollowListDetail(){
182 if(this.hasMore){ 210 if(this.hasMore){
183 let object = new FollowListDetailRequestItem(-1,20,this.curPageNum) 211 let object = new FollowListDetailRequestItem(-1,20,this.curPageNum)
184 212
@@ -187,7 +215,21 @@ export struct HomePageBottomComponent{ @@ -187,7 +215,21 @@ export struct HomePageBottomComponent{
187 this.hasMore = false 215 this.hasMore = false
188 }else{ 216 }else{
189 value.list.forEach((value)=>{ 217 value.list.forEach((value)=>{
190 - this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl)) 218 + let fansNum:number = value.fansNum
  219 + let fansNumString = ""
  220 + if (fansNum > 10000) {
  221 + let temp = (fansNum / 10000) + ""
  222 + let index = temp.indexOf('.')
  223 + if (index != -1) {
  224 + temp = temp.substring(0, index + 2)
  225 + } else {
  226 + temp = temp
  227 + }
  228 + fansNumString = temp + "万"
  229 + } else {
  230 + fansNumString = fansNum + ""
  231 + }
  232 + this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,fansNumString,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl))
191 }) 233 })
192 this.data_follow.notifyDataReload() 234 this.data_follow.notifyDataReload()
193 this.count = this.data_follow.totalCount() 235 this.count = this.data_follow.totalCount()
@@ -202,7 +244,16 @@ export struct HomePageBottomComponent{ @@ -202,7 +244,16 @@ export struct HomePageBottomComponent{
202 console.log(TAG,"请求失败") 244 console.log(TAG,"请求失败")
203 this.isLoading = false 245 this.isLoading = false
204 }) 246 })
  247 + }else{
  248 + this.isLoading = false
  249 + }
205 } 250 }
  251 +
  252 + getNewPageData(){
  253 + this.isLoading = true
  254 + //我的关注列表
  255 + if (this.style === 1){
  256 + this.getMyFollowListDetail()
206 }else if(this.style === 0){ 257 }else if(this.style === 0){
207 if(this.hasMore){ 258 if(this.hasMore){
208 let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) 259 let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
@@ -230,6 +281,8 @@ export struct HomePageBottomComponent{ @@ -230,6 +281,8 @@ export struct HomePageBottomComponent{
230 console.log(TAG,"请求失败") 281 console.log(TAG,"请求失败")
231 this.isLoading = false 282 this.isLoading = false
232 }) 283 })
  284 + }else{
  285 + this.isLoading = false
233 } 286 }
234 } 287 }
235 } 288 }
  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 +
  47 + build() {
  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;
6 build() { 157 build() {
7 - Column(){  
8 - PrivacySettingComponents() 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 -}  
@@ -3,9 +3,17 @@ import { EmptyComponent } from '../view/EmptyComponent' @@ -3,9 +3,17 @@ import { EmptyComponent } from '../view/EmptyComponent'
3 @Entry 3 @Entry
4 @Component 4 @Component
5 export struct DefaultPage { 5 export struct DefaultPage {
  6 + retry() {
  7 + console.log('daj点击了重试')
  8 + }
  9 +
6 build() { 10 build() {
7 Row() { 11 Row() {
8 - EmptyComponent({ emptyType: 8 }) 12 + EmptyComponent({
  13 + emptyType: 8, emptyButton: true, retry: () => {
  14 + this.retry()
  15 + }
  16 + })
9 } 17 }
10 } 18 }
11 } 19 }
@@ -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
@@ -56,7 +52,9 @@ export struct EmptyComponent { @@ -56,7 +52,9 @@ export struct EmptyComponent {
56 // private emptySize: SizeOptions = {}; 52 // private emptySize: SizeOptions = {};
57 @State emptyWidth: string | number = CommonConstants.FULL_PARENT; 53 @State emptyWidth: string | number = CommonConstants.FULL_PARENT;
58 @State emptyHeight: string | number = CommonConstants.FULL_PARENT; 54 @State emptyHeight: string | number = CommonConstants.FULL_PARENT;
59 - @State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default 55 + @State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default;
  56 + @State emptyButton: boolean = false
  57 + @State timeNum: number = 10
60 /** 58 /**
61 * The empty image width percentage setting. 59 * The empty image width percentage setting.
62 */ 60 */
@@ -73,6 +71,42 @@ export struct EmptyComponent { @@ -73,6 +71,42 @@ export struct EmptyComponent {
73 * The empty data text opacity. 71 * The empty data text opacity.
74 */ 72 */
75 readonly TEXT_OPACITY: number = 0.4; 73 readonly TEXT_OPACITY: number = 0.4;
  74 + private timer: number = -1
  75 + retry: () => void = () => {
  76 + }
  77 +
  78 + createTimer() {
  79 + if (this.emptyType === 8) {
  80 + this.timer = setInterval(() => {
  81 + this.timeNum--;
  82 + if (this.timeNum === 0) {
  83 + clearInterval(this.timer);
  84 + }
  85 + }, 1000);
  86 + }
  87 + }
  88 +
  89 + destroyTimer() {
  90 + if (this.emptyType === 8) {
  91 + clearInterval(this.timer);
  92 + }
  93 + }
  94 +
  95 + onPageShow(): void {
  96 + this.createTimer()
  97 + }
  98 +
  99 + aboutToAppear(): void {
  100 + this.createTimer()
  101 + }
  102 +
  103 + onPageHide(): void {
  104 + this.destroyTimer()
  105 + }
  106 +
  107 + aboutToDisappear() {
  108 + this.destroyTimer()
  109 + }
76 110
77 build() { 111 build() {
78 this.noProgrammeData(); 112 this.noProgrammeData();
@@ -90,7 +124,7 @@ export struct EmptyComponent { @@ -90,7 +124,7 @@ export struct EmptyComponent {
90 .objectFit(ImageFit.Contain) 124 .objectFit(ImageFit.Contain)
91 // .border({ width: 1, color: Color.Red, radius: 6 }) 125 // .border({ width: 1, color: Color.Red, radius: 6 })
92 126
93 - Text(this.buildNoDataTip()) 127 + Text(this.emptyType !== 8 ? this.buildNoDataTip() : `${this.buildNoDataTip()}(${this.timeNum}s)`)
94 .fontSize($r('app.float.normal_text_size')) 128 .fontSize($r('app.float.normal_text_size'))
95 .fontColor('#000000') 129 .fontColor('#000000')
96 .fontWeight(FontWeight.Normal) 130 .fontWeight(FontWeight.Normal)
@@ -99,6 +133,23 @@ export struct EmptyComponent { @@ -99,6 +133,23 @@ export struct EmptyComponent {
99 .onClick((event: ClickEvent) => { 133 .onClick((event: ClickEvent) => {
100 Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`); 134 Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`);
101 }) 135 })
  136 +
  137 + if (this.emptyButton) {
  138 + Button('点击重试')
  139 + .type(ButtonType.Normal)
  140 + .width(80)
  141 + .height(28)
  142 + .backgroundColor('#fffffff')
  143 + .fontColor('#FF666666')
  144 + .border({ width: 1 })
  145 + .borderColor('#FFEDEDED')
  146 + .fontSize($r('app.float.font_size_12'))
  147 + .margin({ top: 16 })
  148 + .padding(0)
  149 + .onClick(() => {
  150 + this.retry()
  151 + })
  152 + }
102 } 153 }
103 .justifyContent(FlexAlign.Center) 154 .justifyContent(FlexAlign.Center)
104 .width(this.emptyWidth) 155 .width(this.emptyWidth)
@@ -127,13 +178,9 @@ export struct EmptyComponent { @@ -127,13 +178,9 @@ export struct EmptyComponent {
127 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoBooking) { 178 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoBooking) {
128 contentString = '暂无预约' 179 contentString = '暂无预约'
129 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NetworkFailed) { 180 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NetworkFailed) {
130 - contentString = '' // 前方拥堵,请耐心等待 181 + contentString = '前方拥堵,请耐心等待...' // 前方拥堵,请耐心等待...
131 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) { 182 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) {
132 contentString = '该号主暂时无法访问' // 前方拥堵,请耐心等待 183 contentString = '该号主暂时无法访问' // 前方拥堵,请耐心等待
133 - } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) {  
134 - contentString = '直播已结束' // 前方拥堵,请耐心等待  
135 - } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveSuspend) {  
136 - contentString = '主播暂时离开,马上回来' // 前方拥堵,请耐心等待  
137 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) { 184 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) {
138 contentString = '获取内容失败请重试' // 前方拥堵,请耐心等待 185 contentString = '获取内容失败请重试' // 前方拥堵,请耐心等待
139 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent1) { 186 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent1) {
@@ -163,11 +210,9 @@ export struct EmptyComponent { @@ -163,11 +210,9 @@ export struct EmptyComponent {
163 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoBooking) { 210 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoBooking) {
164 imageString = $r('app.media.icon_no_appointmentMade') 211 imageString = $r('app.media.icon_no_appointmentMade')
165 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NetworkFailed) { 212 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NetworkFailed) {
166 - imageString = $r('app.media.icon_no_net') 213 + imageString = $r('app.media.icon_no_limiting')
167 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) { 214 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) {
168 imageString = $r('app.media.icon_no_master1') 215 imageString = $r('app.media.icon_no_master1')
169 - } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) {  
170 - imageString = $r('app.media.icon_no_end')  
171 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) { 216 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) {
172 imageString = $r('app.media.icon_no_content') 217 imageString = $r('app.media.icon_no_content')
173 } 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 +}
@@ -372,7 +372,7 @@ class MinePageDatasModel{ @@ -372,7 +372,7 @@ class MinePageDatasModel{
372 let url = HttpUrlUtils.getMineUserLevelDataUrl() 372 let url = HttpUrlUtils.getMineUserLevelDataUrl()
373 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 373 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
374 // return WDHttp.get<ResponseDTO<MineUserLevelItem>>(url, headers) 374 // return WDHttp.get<ResponseDTO<MineUserLevelItem>>(url, headers)
375 - return HttpBizUtil.get<MineUserLevelItem>(url, headers) 375 + return HttpBizUtil.get<ResponseDTO<MineUserLevelItem>>(url, headers)
376 }; 376 };
377 377
378 async getMineUserLevelDataLocal(context: Context): Promise<MineUserLevelItem> { 378 async getMineUserLevelDataLocal(context: Context): Promise<MineUserLevelItem> {
@@ -411,7 +411,7 @@ class MinePageDatasModel{ @@ -411,7 +411,7 @@ class MinePageDatasModel{
411 let url = HttpUrlUtils.getMineUserDetailDataUrl() 411 let url = HttpUrlUtils.getMineUserDetailDataUrl()
412 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 412 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
413 // return WDHttp.get<ResponseDTO<MineUserDetailItem>>(url, headers) 413 // return WDHttp.get<ResponseDTO<MineUserDetailItem>>(url, headers)
414 - return HttpBizUtil.get<MineUserDetailItem>(url, headers) 414 + return HttpBizUtil.get<ResponseDTO<MineUserDetailItem>>(url, headers)
415 }; 415 };
416 416
417 async getMineUserDetailDataLocal(context: Context): Promise<MineUserDetailItem> { 417 async getMineUserDetailDataLocal(context: Context): Promise<MineUserDetailItem> {
@@ -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))
@@ -224,7 +224,7 @@ export class LoginModel { @@ -224,7 +224,7 @@ export class LoginModel {
224 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 224 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
225 225
226 return new Promise<string>((success, fail) => { 226 return new Promise<string>((success, fail) => {
227 - HttpBizUtil.post<string>(HttpUrlUtils.getLogoutUrl(), bean, headers).then((data: ResponseDTO<string>)=>{ 227 + HttpBizUtil.post<ResponseDTO<string>>(HttpUrlUtils.getLogoutUrl(), bean, headers).then((data: ResponseDTO<string>)=>{
228 if (!data) { 228 if (!data) {
229 fail("数据为空") 229 fail("数据为空")
230 return 230 return
@@ -12,6 +12,7 @@ struct LaunchAdvertisingPage { @@ -12,6 +12,7 @@ struct LaunchAdvertisingPage {
12 // url:'pages/MainPage' 12 // url:'pages/MainPage'
13 // }) 13 // })
14 WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage) 14 WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage)
  15 + clearInterval(this.timer)
15 } 16 }
16 17
17 onPageShow(){ 18 onPageShow(){
@@ -9,6 +9,7 @@ import { GlobalContext } from '../../utils/GlobalContext' @@ -9,6 +9,7 @@ import { GlobalContext } from '../../utils/GlobalContext'
9 import { WDRouterRule } from 'wdRouter'; 9 import { WDRouterRule } from 'wdRouter';
10 import { WDRouterPage } from 'wdRouter'; 10 import { WDRouterPage } from 'wdRouter';
11 import { LaunchModel } from '../viewModel/LaunchModel' 11 import { LaunchModel } from '../viewModel/LaunchModel'
  12 +import { LaunchPageModel } from '../viewModel/LaunchPageModel'
12 13
13 @Entry 14 @Entry
14 @Component 15 @Component
@@ -44,7 +45,8 @@ struct LaunchPage { @@ -44,7 +45,8 @@ struct LaunchPage {
44 this.saveIsPrivacy(); 45 this.saveIsPrivacy();
45 //跳转引导页 46 //跳转引导页
46 this.jumpToGuidePage(); 47 this.jumpToGuidePage();
47 - 48 + //同意隐私协议后请求启动页相关数据
  49 + this.requestLaunchPageData();
48 } 50 }
49 51
50 jumpToAdvertisingPage() { 52 jumpToAdvertisingPage() {
@@ -90,9 +92,11 @@ struct LaunchPage { @@ -90,9 +92,11 @@ struct LaunchPage {
90 this.dialogController.open(); 92 this.dialogController.open();
91 // } 93 // }
92 } else { 94 } else {
  95 + //需要根据请求数据判断是否需要进入广告页,广告数据为nil则直接跳转到首页
93 //跳转广告页 96 //跳转广告页
94 this.jumpToAdvertisingPage(); 97 this.jumpToAdvertisingPage();
95 - 98 + //同意隐私协议后每次启动app请求启动页相关数据,并更新数据
  99 + this.requestLaunchPageData();
96 } 100 }
97 }); 101 });
98 }); 102 });
@@ -154,4 +158,12 @@ struct LaunchPage { @@ -154,4 +158,12 @@ struct LaunchPage {
154 launchModel.getAgreement() 158 launchModel.getAgreement()
155 } 159 }
156 160
  161 + requestLaunchPageData() {
  162 + //请求启动页相关接口数据并保存
  163 + let launchPageModel = new LaunchPageModel()
  164 + launchPageModel.getLaunchPageData()
  165 +
  166 + }
  167 +
  168 +
157 } 169 }
@@ -46,16 +46,6 @@ export class InterestsHobbiesModel { @@ -46,16 +46,6 @@ export class InterestsHobbiesModel {
46 Logger.debug("InterestsHobbiesModel兴趣偏好数据获取成功:success ", JSON.stringify(data)) 46 Logger.debug("InterestsHobbiesModel兴趣偏好数据获取成功:success ", JSON.stringify(data))
47 success(data.data); 47 success(data.data);
48 48
49 -  
50 - //保存数据  
51 - // for (let i = 0; i < data.data.length; i++) {  
52 - // if (data.data[i].type == 1) {  
53 - // SPHelper.default.save(SpConstants.USER_PROTOCOL, data.data[i].linkUrl)  
54 - // } else if (data.data[i].type == 2) {  
55 - // SPHelper.default.save(SpConstants.PRIVATE_PROTOCOL, data.data[i].linkUrl)  
56 - // }  
57 - // }  
58 -  
59 }, (error: Error) => { 49 }, (error: Error) => {
60 Logger.debug("InterestsHobbiesModel兴趣偏好数据获取失败:error ", error.toString()) 50 Logger.debug("InterestsHobbiesModel兴趣偏好数据获取失败:error ", error.toString())
61 fail(error.message) 51 fail(error.message)
  1 +
  2 +
  3 +export interface NetLayerLaunchOperatModel {
  4 +
  5 + ID : string
  6 + screenName : string //开机屏名称
  7 + objectType : string // WDPublicProgramType 对象类型 0:不跳转,1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,11:图文,12:组图,13:H5新闻,14:频道
  8 + objectId : string //跳转id
  9 + objectLevel : string //频道(1:一级频道,2:二级频道),专题(1:普通专题,2:主题专题,3:作者专题 21:文章专题,22:音频专题,23:直播专题,24:话题专题)
  10 + pageId : string //跳转页面id,objectType=5,14使用页面跳转
  11 + durations : string //展示时长(单位:秒)
  12 + linkUrl : string //转链接地址【objectType=6,13】
  13 + screenType : string // 0, 1 : WDDisplayStyle_Logo 2 : WDDisplayStyle_Full
  14 + bootScreenUrl : string //开机屏封面图/视频地址
  15 + bootVideoScreenUrl : string //视频封面地址
  16 + showType : string //文件类型WDPublicFileType 2: 视频 其他: 图片
  17 + isAd : string //0-非广告,1-是广告
  18 + bottomNavId : string //底部导航ID
  19 + relId : string //频道/专题内容关系id
  20 +
  21 +}
  22 +
  23 +
  24 +export interface NetLayerLauncherADMaterialModel{
  25 +
  26 + matType : string //1 video 其他 image
  27 + startStyle : number // 1 WDDisplayStyle_Full 全屏样式 其他 WDDisplayStyle_Logo 底部logo样式
  28 + advTitle : string
  29 + matImageUrl : string[] //取firstObject
  30 + matVideoUrl : string
  31 +
  32 + openType : string //链接打开方式,0-没链接,不用打开,1-端内打开,2-端外打开
  33 + linkUrl : string
  34 +
  35 +}
  36 +
  37 +export interface NetLayerLauncherADInfoModel{
  38 +
  39 + ID : string
  40 + startTime : number
  41 + endTime : number
  42 + displayDuration : number
  43 + displayRound : number
  44 + matInfo : NetLayerLauncherADMaterialModel
  45 +
  46 +}
  47 +
  48 +export interface NetLayerLauncherH5TemplateInfoModel{
  49 +
  50 + versionRangeMin : string
  51 + versionRangeMax : string
  52 + h5TemplateUrl : string
  53 + version : string
  54 + md5 : string
  55 +
  56 +}
  57 +
  58 +
  59 +export default interface LaunchDataModel{
  60 +
  61 + launchPageInfo : NetLayerLaunchOperatModel
  62 + launchAdInfo : NetLayerLauncherADInfoModel[]
  63 + h5Template : NetLayerLauncherH5TemplateInfoModel[]
  64 +
  65 +}
  1 +
  2 +import LaunchDataModel from '../viewModel/LaunchDataModel'
  3 +
  4 +import HashMap from '@ohos.util.HashMap';
  5 +import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
  6 +import { HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index';
  7 +import { Logger, SPHelper } from 'wdKit/Index';
  8 +import data from '@ohos.telephony.data';
  9 +import { SpConstants } from 'wdConstant/Index';
  10 +
  11 +
  12 +export class LaunchPageModel {
  13 +
  14 + getLaunchPageData() {
  15 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  16 + return new Promise<LaunchDataModel>((success, fail) => {
  17 + HttpRequest.get<ResponseDTO<LaunchDataModel>>(HttpUrlUtils.getLaunchPageDataUrl(), headers).then((data: ResponseDTO<LaunchDataModel>) => {
  18 + if (!data || !data.data) {
  19 + fail("数据为空")
  20 + return
  21 + }
  22 + if (data.code != 0) {
  23 + fail(data.message)
  24 + return
  25 + }
  26 + Logger.debug("LaunchPageModel获取启动相关数据获取成功:success ", JSON.stringify(data))
  27 + success(data.data);
  28 + //存储数据
  29 +
  30 +
  31 +
  32 + }, (error: Error) => {
  33 + Logger.debug("LaunchPageModel获取启动相关数据获取失败:error ", error.toString())
  34 + fail(error.message)
  35 + })
  36 + })
  37 + }
  38 +
  39 +
  40 +
  41 +}