Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
78 changed files
with
1941 additions
and
1055 deletions
Too many changes to show.
To preserve performance only 78 of 78+ files are displayed.
| @@ -48,4 +48,8 @@ export class SpConstants{ | @@ -48,4 +48,8 @@ export class SpConstants{ | ||
| 48 | //游客状态下首次评论时间 | 48 | //游客状态下首次评论时间 |
| 49 | static FIRSTCOMMENTTIME = 'firstCommentTime' | 49 | static FIRSTCOMMENTTIME = 'firstCommentTime' |
| 50 | static TOURIST_NICK_NAME = 'touristNickName' | 50 | static TOURIST_NICK_NAME = 'touristNickName' |
| 51 | + | ||
| 52 | + // 个推推送 | ||
| 53 | + static GETUI_PUSH_CID = "cid" | ||
| 54 | + static GETUI_PUSH_DEVICE_TOKEN = "deviceToken" | ||
| 51 | } | 55 | } |
| @@ -39,7 +39,7 @@ export const enum CompStyle { | @@ -39,7 +39,7 @@ export const enum CompStyle { | ||
| 39 | Zh_Single_Column_10 = 'Zh_Single_Column-10', //18 服务组合卡 | 39 | Zh_Single_Column_10 = 'Zh_Single_Column-10', //18 服务组合卡 |
| 40 | Zh_Single_Column_11 = 'Zh_Single_Column-11', //19 问政组合卡 | 40 | Zh_Single_Column_11 = 'Zh_Single_Column-11', //19 问政组合卡 |
| 41 | Zh_Grid_Layout_01 = 'Zh_Grid_Layout-01', //4 信息流组合卡 | 41 | Zh_Grid_Layout_01 = 'Zh_Grid_Layout-01', //4 信息流组合卡 |
| 42 | - Zh_Grid_Layout_02 = 'Zh_Grid_Layout-02', //7 双列流小视频,一行两图卡 | 42 | + Zh_Grid_Layout_02 = 'Zh_Grid_Layout-02', //7 双列流小视频,一行两图卡 ->标题 |
| 43 | Zh_Grid_Layout_03 = 'Zh_Grid_Layout-03', //11 金刚位卡 | 43 | Zh_Grid_Layout_03 = 'Zh_Grid_Layout-03', //11 金刚位卡 |
| 44 | Card_01 = '1', // 小图卡 | 44 | Card_01 = '1', // 小图卡 |
| 45 | Card_02 = '2', // 大图卡 | 45 | Card_02 = '2', // 大图卡 |
| @@ -80,5 +80,7 @@ export const enum CompStyle { | @@ -80,5 +80,7 @@ export const enum CompStyle { | ||
| 80 | /** | 80 | /** |
| 81 | * 本地稿件和组件样式 | 81 | * 本地稿件和组件样式 |
| 82 | */ | 82 | */ |
| 83 | - Card_Comp_Adv = 'card_comp_adv', // | 83 | + Card_Comp_Adv = 'card_comp_adv', // 信息流广告稿件 |
| 84 | + | ||
| 85 | + Card_Comp_Zh_Grid_Layout_02 = 'Card_Comp_Zh_Grid_Layout-02', // 一行两列卡业务内容 | ||
| 84 | } | 86 | } |
| @@ -133,10 +133,15 @@ export class NetworkManager { | @@ -133,10 +133,15 @@ export class NetworkManager { | ||
| 133 | * 同步获取网络类型,耗时 | 133 | * 同步获取网络类型,耗时 |
| 134 | */ | 134 | */ |
| 135 | public getNetTypeSync(): NetworkType { | 135 | public getNetTypeSync(): NetworkType { |
| 136 | - let netHandle = connection.getDefaultNetSync(); | ||
| 137 | - let netCapabilities = connection.getNetCapabilitiesSync(netHandle) | ||
| 138 | - this.reset(netCapabilities.bearerTypes) | ||
| 139 | - return this.networkType; | 136 | + try { |
| 137 | + let netHandle = connection.getDefaultNetSync(); | ||
| 138 | + let netCapabilities = connection.getNetCapabilitiesSync(netHandle) | ||
| 139 | + this.reset(netCapabilities.bearerTypes) | ||
| 140 | + return this.networkType; | ||
| 141 | + } catch (e) { | ||
| 142 | + Logger.error(TAG, 'getNetTypeSync e: ' + JSON.stringify(e)) | ||
| 143 | + } | ||
| 144 | + return NetworkType.TYPE_UNKNOWN | ||
| 140 | } | 145 | } |
| 141 | 146 | ||
| 142 | private parseData(data: connection.NetCapabilityInfo) { | 147 | private parseData(data: connection.NetCapabilityInfo) { |
| @@ -43,7 +43,7 @@ export class NetworkUtil { | @@ -43,7 +43,7 @@ export class NetworkUtil { | ||
| 43 | */ | 43 | */ |
| 44 | static isNetConnected(): boolean { | 44 | static isNetConnected(): boolean { |
| 45 | let type = NetworkManager.getInstance().getNetType() | 45 | let type = NetworkManager.getInstance().getNetType() |
| 46 | - if (type == NetworkType.TYPE_NONE) { | 46 | + if (type == NetworkType.TYPE_UNKNOWN || type == NetworkType.TYPE_NONE) { |
| 47 | return false | 47 | return false |
| 48 | } | 48 | } |
| 49 | return true | 49 | return true |
| @@ -5,6 +5,10 @@ import { HostManager } from './HttpHostManager'; | @@ -5,6 +5,10 @@ import { HostManager } from './HttpHostManager'; | ||
| 5 | */ | 5 | */ |
| 6 | export class HttpUrlUtils { | 6 | export class HttpUrlUtils { |
| 7 | /** | 7 | /** |
| 8 | + * 查询直播参与人数 | ||
| 9 | + */ | ||
| 10 | + static readonly GET_JOIN_PEOPLE_NUM: string = '/api/live-center-message/zh/a/live/room/number/batch/all' | ||
| 11 | + /** | ||
| 8 | * 启动接口(底导接口) | 12 | * 启动接口(底导接口) |
| 9 | */ | 13 | */ |
| 10 | static readonly BOTTOM_NAV_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup"; | 14 | static readonly BOTTOM_NAV_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup"; |
| @@ -135,14 +139,6 @@ export class HttpUrlUtils { | @@ -135,14 +139,6 @@ export class HttpUrlUtils { | ||
| 135 | */ | 139 | */ |
| 136 | static readonly APPOINTMENT_ExecuteCollcet_PATH: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord"; | 140 | static readonly APPOINTMENT_ExecuteCollcet_PATH: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord"; |
| 137 | /** | 141 | /** |
| 138 | - * 个人中心 - 消息 | ||
| 139 | - */ | ||
| 140 | - static readonly APPOINTMENT_MessageList_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private"; | ||
| 141 | - /** | ||
| 142 | - * 个人中心 - 消息 点赞数 | ||
| 143 | - */ | ||
| 144 | - static readonly APPOINTMENT_getMessageLikeCount_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/getLikeCount"; | ||
| 145 | - /** | ||
| 146 | * 个人中心 我的评论列表 | 142 | * 个人中心 我的评论列表 |
| 147 | */ | 143 | */ |
| 148 | static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList"; | 144 | static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList"; |
| @@ -324,10 +320,6 @@ export class HttpUrlUtils { | @@ -324,10 +320,6 @@ export class HttpUrlUtils { | ||
| 324 | */ | 320 | */ |
| 325 | static readonly FEEDBACK_TYPE_PATH: string = "/api/rmrb-interact/interact/c/user/optionClassify/list"; | 321 | static readonly FEEDBACK_TYPE_PATH: string = "/api/rmrb-interact/interact/c/user/optionClassify/list"; |
| 326 | 322 | ||
| 327 | - /** | ||
| 328 | - * 查询点赞、回复我的、系统消息的未读数量以及回复/评论人 | ||
| 329 | - */ | ||
| 330 | - static readonly MESSAGE_UN_READ_DATA_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/polymerizationInfo?createTime="; | ||
| 331 | 323 | ||
| 332 | /** | 324 | /** |
| 333 | * 直播详情-直播人数 | 325 | * 直播详情-直播人数 |
| @@ -515,16 +507,6 @@ export class HttpUrlUtils { | @@ -515,16 +507,6 @@ export class HttpUrlUtils { | ||
| 515 | return url | 507 | return url |
| 516 | } | 508 | } |
| 517 | 509 | ||
| 518 | - static getMessageListDataUrl() { | ||
| 519 | - let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_MessageList_PATH | ||
| 520 | - return url | ||
| 521 | - } | ||
| 522 | - | ||
| 523 | - static getMessageLikeCount() { | ||
| 524 | - let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_getMessageLikeCount_PATH | ||
| 525 | - return url | ||
| 526 | - } | ||
| 527 | - | ||
| 528 | static getExecuteCollcetUrl() { | 510 | static getExecuteCollcetUrl() { |
| 529 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH | 511 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH |
| 530 | return url | 512 | return url |
| @@ -761,14 +743,9 @@ export class HttpUrlUtils { | @@ -761,14 +743,9 @@ export class HttpUrlUtils { | ||
| 761 | return url; | 743 | return url; |
| 762 | } | 744 | } |
| 763 | 745 | ||
| 764 | - //获取消息未读接口 | ||
| 765 | - static getMessageUnReadDataUrl() { | ||
| 766 | - let url = HttpUrlUtils.getHost() + HttpUrlUtils.MESSAGE_UN_READ_DATA_PATH | ||
| 767 | - return url | ||
| 768 | - } | ||
| 769 | - | ||
| 770 | - static reportDeviceInfo() { | ||
| 771 | - let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push"; | 746 | +// 查询节目的参与人数 |
| 747 | + static getJoinPeopleNum() { | ||
| 748 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.GET_JOIN_PEOPLE_NUM; | ||
| 772 | return url; | 749 | return url; |
| 773 | } | 750 | } |
| 774 | 751 | ||
| @@ -796,4 +773,43 @@ export class HttpUrlUtils { | @@ -796,4 +773,43 @@ export class HttpUrlUtils { | ||
| 796 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.ENTER_MESSAGE_PATH | 773 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.ENTER_MESSAGE_PATH |
| 797 | return url | 774 | return url |
| 798 | } | 775 | } |
| 776 | + /** | ||
| 777 | + * 个人中心 - 消息 | ||
| 778 | + */ | ||
| 779 | + static readonly APPOINTMENT_MessageList_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private"; | ||
| 780 | + /** | ||
| 781 | + * 个人中心 - 消息 点赞数 | ||
| 782 | + */ | ||
| 783 | + static readonly APPOINTMENT_getMessageLikeCount_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/getLikeCount"; | ||
| 784 | + | ||
| 785 | + /** | ||
| 786 | + * 查询点赞、回复我的、系统消息的未读数量以及回复/评论人 | ||
| 787 | + */ | ||
| 788 | + static readonly MESSAGE_UN_READ_DATA_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/polymerizationInfo?createTime="; | ||
| 789 | + | ||
| 790 | + static getMessageListDataUrl() { | ||
| 791 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_MessageList_PATH | ||
| 792 | + return url | ||
| 793 | + } | ||
| 794 | + | ||
| 795 | + static getMessageLikeCount() { | ||
| 796 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_getMessageLikeCount_PATH | ||
| 797 | + return url | ||
| 798 | + } | ||
| 799 | + | ||
| 800 | + //获取消息未读接口 | ||
| 801 | + static getMessageUnReadDataUrl() { | ||
| 802 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MESSAGE_UN_READ_DATA_PATH | ||
| 803 | + return url | ||
| 804 | + } | ||
| 805 | + | ||
| 806 | + static reportDeviceInfo() { | ||
| 807 | + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push"; | ||
| 808 | + return url; | ||
| 809 | + } | ||
| 810 | + | ||
| 811 | + static getUploadPushInfoUrl() { | ||
| 812 | + let url = HttpUrlUtils.getHost() + "/api/rmrb-contact/contact/zh/c/push/device" | ||
| 813 | + return url | ||
| 814 | + } | ||
| 799 | } | 815 | } |
| @@ -12,4 +12,6 @@ export { ProcessUtils } from './src/main/ets/utils/ProcessUtils' | @@ -12,4 +12,6 @@ export { ProcessUtils } from './src/main/ets/utils/ProcessUtils' | ||
| 12 | 12 | ||
| 13 | export { AssignChannelParam } from './src/main/ets/utils/HomeChannelUtils'; | 13 | export { AssignChannelParam } from './src/main/ets/utils/HomeChannelUtils'; |
| 14 | 14 | ||
| 15 | -export { RouterJumpInterceptor, JumpInterceptorAction } from './src/main/ets/router/RouterJumpInterceptor' | ||
| 15 | +export { RouterJumpInterceptor, JumpInterceptorAction } from './src/main/ets/router/RouterJumpInterceptor' | ||
| 16 | + | ||
| 17 | +export { AppInnerLink } from './src/main/ets/utils/AppInnerLink' |
| 1 | +import { url } from '@kit.ArkTS' | ||
| 2 | +import App from '@system.app' | ||
| 3 | +import { Logger } from 'wdKit/Index' | ||
| 4 | + | ||
| 5 | +const TAG = "AppInnerLink" | ||
| 6 | + | ||
| 7 | +export class AppInnerLink { | ||
| 8 | + | ||
| 9 | + static readonly INNER_LINK_PROTCOL = "rmrbapp:" | ||
| 10 | + static readonly INNER_LINK_HOSTNAME = "rmrb.app" | ||
| 11 | + static readonly INNER_LINK_PATHNAME = "openwith" | ||
| 12 | + | ||
| 13 | + // 内链跳转 | ||
| 14 | + // 内链地址例如:rmrbapp://rmrb.app/openwith?type=article&subType=h5_template_article&contentId=30000762651&relId=500000038702&skipType=1&relType=1 | ||
| 15 | + static jumpWithLink(innerLink: string) { | ||
| 16 | + | ||
| 17 | + let params = AppInnerLink.parseParams(innerLink) | ||
| 18 | + if (!params) { | ||
| 19 | + Logger.info(TAG, "跳转无效的链接地址 " + innerLink) | ||
| 20 | + return | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + switch (params.skipType) { | ||
| 24 | + case 1: { | ||
| 25 | + AppInnerLink.jumpParams(params) | ||
| 26 | + break | ||
| 27 | + } | ||
| 28 | + case 2: { | ||
| 29 | + AppInnerLink.jumpNoParams(params) | ||
| 30 | + break | ||
| 31 | + } | ||
| 32 | + case 3: { | ||
| 33 | + AppInnerLink.jumpAppH5(params) | ||
| 34 | + break | ||
| 35 | + } | ||
| 36 | + case 4: { | ||
| 37 | + AppInnerLink.jumpOutH5(params) | ||
| 38 | + break | ||
| 39 | + } | ||
| 40 | + case 5: { | ||
| 41 | + AppInnerLink.jumpThirdApp(params) | ||
| 42 | + break | ||
| 43 | + } | ||
| 44 | + default: { | ||
| 45 | + Logger.info(TAG, "跳转无效的链接地址 " + innerLink) | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + private static jumpParams(params: InnerLinkParam) { | ||
| 51 | + | ||
| 52 | + } | ||
| 53 | + private static jumpNoParams(params: InnerLinkParam) { | ||
| 54 | + | ||
| 55 | + } | ||
| 56 | + private static jumpAppH5(params: InnerLinkParam) { | ||
| 57 | + | ||
| 58 | + } | ||
| 59 | + private static jumpOutH5(params: InnerLinkParam) { | ||
| 60 | + | ||
| 61 | + } | ||
| 62 | + private static jumpThirdApp(params: InnerLinkParam) { | ||
| 63 | + | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + static parseParams(link: string) : InnerLinkParam | undefined { | ||
| 67 | + const that = url.URL.parseURL(link) | ||
| 68 | + if (that.protocol !== AppInnerLink.INNER_LINK_PROTCOL) { | ||
| 69 | + return | ||
| 70 | + } | ||
| 71 | + if (that.hostname !== AppInnerLink.INNER_LINK_HOSTNAME) { | ||
| 72 | + return | ||
| 73 | + } | ||
| 74 | + if (that.pathname !== AppInnerLink.INNER_LINK_PATHNAME) { | ||
| 75 | + return | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + let obj = {} as InnerLinkParam | ||
| 79 | + | ||
| 80 | + const params = that.params | ||
| 81 | + obj.type = params.get("type") as string | ||
| 82 | + obj.subType = params.get("subType") as string | ||
| 83 | + obj.contentId = params.get("contentId") as string | ||
| 84 | + obj.relId = params.get("relId") as string | ||
| 85 | + obj.relType = params.get("relType") as string | ||
| 86 | + obj.pageId = params.get("pageId") as string | ||
| 87 | + obj.url = params.get("url") as string | ||
| 88 | + obj.activityId = params.get("activityId") as string | ||
| 89 | + obj.activityType = params.get("activityType") as string | ||
| 90 | + obj.creatorId = params.get("creatorId") as string | ||
| 91 | + obj.firstChannelId = params.get("firstChannelId") as string | ||
| 92 | + obj.skipType = Number(params.get("skipType")) | ||
| 93 | + obj.isLogin = params.get("isLogin") as string | ||
| 94 | + return obj | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +interface InnerLinkParam { | ||
| 101 | + type?: string, | ||
| 102 | + subType?: string, | ||
| 103 | + contentId?: string, | ||
| 104 | + relId?: string, | ||
| 105 | + relType?: string | ||
| 106 | + pageId?: string, | ||
| 107 | + url?: string, | ||
| 108 | + activityId?: string, | ||
| 109 | + activityType?: string, | ||
| 110 | + creatorId?: string, | ||
| 111 | + firstChannelId?: string, | ||
| 112 | + skipType: number, | ||
| 113 | + isLogin?: string, | ||
| 114 | +} |
| @@ -7,10 +7,11 @@ import { VoiceInfoDTO } from '../detail/VoiceInfoDTO'; | @@ -7,10 +7,11 @@ import { VoiceInfoDTO } from '../detail/VoiceInfoDTO'; | ||
| 7 | import { RmhInfoDTO } from '../detail/RmhInfoDTO'; | 7 | import { RmhInfoDTO } from '../detail/RmhInfoDTO'; |
| 8 | import { commentInfo } from './commentInfo'; | 8 | import { commentInfo } from './commentInfo'; |
| 9 | import { BaseDTO } from '../component/BaseDTO'; | 9 | import { BaseDTO } from '../component/BaseDTO'; |
| 10 | +import { LiveRoomDataBean } from '../live/LiveRoomDataBean'; | ||
| 10 | 11 | ||
| 11 | @Observed | 12 | @Observed |
| 12 | export class ContentDTO implements BaseDTO { | 13 | export class ContentDTO implements BaseDTO { |
| 13 | - shareFlag?:string='1'; | 14 | + shareFlag?: string = '1'; |
| 14 | appStyle: string = ''; | 15 | appStyle: string = ''; |
| 15 | cityCode: string = ''; | 16 | cityCode: string = ''; |
| 16 | coverSize: string = ''; | 17 | coverSize: string = ''; |
| @@ -62,8 +63,7 @@ export class ContentDTO implements BaseDTO { | @@ -62,8 +63,7 @@ export class ContentDTO implements BaseDTO { | ||
| 62 | videoInfo: VideoInfoDTO = {} as VideoInfoDTO; // 视频新闻信息【BFF聚合】,视频非原片+清晰度最高的 | 63 | videoInfo: VideoInfoDTO = {} as VideoInfoDTO; // 视频新闻信息【BFF聚合】,视频非原片+清晰度最高的 |
| 63 | 64 | ||
| 64 | newsSummary: string = ''; //appstyle:2 ,新闻详情 | 65 | newsSummary: string = ''; //appstyle:2 ,新闻详情 |
| 65 | - contentText?: string =''; | ||
| 66 | - | 66 | + contentText?: string = ''; |
| 67 | // 二次请求接口,返回的数据,这里组装到content里; | 67 | // 二次请求接口,返回的数据,这里组装到content里; |
| 68 | interactData?: InteractDataDTO; | 68 | interactData?: InteractDataDTO; |
| 69 | hasMore: number = -1; | 69 | hasMore: number = -1; |
| @@ -85,6 +85,10 @@ export class ContentDTO implements BaseDTO { | @@ -85,6 +85,10 @@ export class ContentDTO implements BaseDTO { | ||
| 85 | // 链接类型: 0:无链接;1:内链(文章);2:外链 | 85 | // 链接类型: 0:无链接;1:内链(文章);2:外链 |
| 86 | openType: string = ''; | 86 | openType: string = ''; |
| 87 | extra: string = '' | 87 | extra: string = '' |
| 88 | + /* | ||
| 89 | + 本地辅助字段 | ||
| 90 | + */ | ||
| 91 | + liveRoomDataBean : LiveRoomDataBean = {} as LiveRoomDataBean// 批查获取到的直播观看人数 | ||
| 88 | 92 | ||
| 89 | static clone(old: ContentDTO): ContentDTO { | 93 | static clone(old: ContentDTO): ContentDTO { |
| 90 | let content = new ContentDTO(); | 94 | let content = new ContentDTO(); |
| @@ -42,6 +42,16 @@ export interface PageInfoDTO { | @@ -42,6 +42,16 @@ export interface PageInfoDTO { | ||
| 42 | pageAdList:CompAdvBean[] | 42 | pageAdList:CompAdvBean[] |
| 43 | 43 | ||
| 44 | md5:string | 44 | md5:string |
| 45 | + | ||
| 46 | + /* | ||
| 47 | + 信息流页面,最后一个楼层的最后一个组件的信息源 | ||
| 48 | + lastCompSourceType = 0 从楼层接口获取数据(compinfor) | ||
| 49 | + = 1 表示 直播回看数据源 | ||
| 50 | + */ | ||
| 51 | + lastCompSourceType: number | ||
| 52 | + | ||
| 53 | + | ||
| 54 | + | ||
| 45 | } | 55 | } |
| 46 | 56 | ||
| 47 | export interface ChannelInfoDTO { | 57 | export interface ChannelInfoDTO { |
| @@ -44,7 +44,7 @@ export struct CardParser { | @@ -44,7 +44,7 @@ export struct CardParser { | ||
| 44 | } else if (contentDTO.appStyle === CompStyle.Card_04) { | 44 | } else if (contentDTO.appStyle === CompStyle.Card_04) { |
| 45 | Card4Component({ compDTO: this.compDTO, contentDTO }) | 45 | Card4Component({ compDTO: this.compDTO, contentDTO }) |
| 46 | } else if (contentDTO.appStyle === CompStyle.Card_05) { | 46 | } else if (contentDTO.appStyle === CompStyle.Card_05) { |
| 47 | - Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy, compDTO: this.compDTO }) | 47 | + Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy}) |
| 48 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle | 48 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle |
| 49 | .Card_13) { | 49 | .Card_13) { |
| 50 | Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) | 50 | Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| @@ -7,7 +7,8 @@ import { Card2Component } from './cardview/Card2Component'; | @@ -7,7 +7,8 @@ import { Card2Component } from './cardview/Card2Component'; | ||
| 7 | import { Card5Component } from './cardview/Card5Component'; | 7 | import { Card5Component } from './cardview/Card5Component'; |
| 8 | import { AdvCardParser } from './cardViewAdv/AdvCardParser'; | 8 | import { AdvCardParser } from './cardViewAdv/AdvCardParser'; |
| 9 | import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01'; | 9 | import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01'; |
| 10 | -import { ZhGridLayout02 } from './compview/ZhGridLayout02'; | 10 | +import { CompNormalTitle } from './compview/CompNormalTitle'; |
| 11 | +import { ZhGridLayout02NewsContent } from './compview/ZhGridLayout02NewsContent'; | ||
| 11 | import { ZhGridLayout03 } from './compview/ZhGridLayout03'; | 12 | import { ZhGridLayout03 } from './compview/ZhGridLayout03'; |
| 12 | import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; | 13 | import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; |
| 13 | import { ZhSingleColumn05 } from './compview/ZhSingleColumn05'; | 14 | import { ZhSingleColumn05 } from './compview/ZhSingleColumn05'; |
| @@ -37,10 +38,8 @@ export struct CompParser { | @@ -37,10 +38,8 @@ export struct CompParser { | ||
| 37 | 38 | ||
| 38 | build() { | 39 | build() { |
| 39 | Column() { | 40 | Column() { |
| 40 | - if (this.compDTO.name != "月度排行卡") { | ||
| 41 | 41 | ||
| 42 | - this.componentBuilder(); | ||
| 43 | - } | 42 | + this.componentBuilder(); |
| 44 | } | 43 | } |
| 45 | } | 44 | } |
| 46 | 45 | ||
| @@ -75,9 +74,14 @@ export struct CompParser { | @@ -75,9 +74,14 @@ export struct CompParser { | ||
| 75 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_03) { | 74 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_03) { |
| 76 | ZhSingleRow03({ compDTO: this.compDTO }) | 75 | ZhSingleRow03({ compDTO: this.compDTO }) |
| 77 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 76 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 78 | - } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { | ||
| 79 | - ZhGridLayout02({ compDTO: this.compDTO }) | ||
| 80 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 77 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { //双列流小视频,一行两图卡 ->标题 |
| 78 | + //ZhGridLayout02({ compDTO: this.compDTO }) | ||
| 79 | + CompNormalTitle({ compDTO: this.compDTO }) | ||
| 80 | + // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 81 | + } else if (this.compDTO.compStyle === CompStyle.Card_Comp_Zh_Grid_Layout_02) { //双列流小视频,一行两图卡 | ||
| 82 | + | ||
| 83 | + ZhGridLayout02NewsContent({ compDTO: this.compDTO, operDataList: this.compDTO.operDataList }) | ||
| 84 | + | ||
| 81 | } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { | 85 | } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { |
| 82 | ZhGridLayout03({ compDTO: this.compDTO }) | 86 | ZhGridLayout03({ compDTO: this.compDTO }) |
| 83 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 87 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| @@ -105,7 +109,7 @@ export struct CompParser { | @@ -105,7 +109,7 @@ export struct CompParser { | ||
| 105 | // ZhSingleColumn05({ compDTO: compDTO }) | 109 | // ZhSingleColumn05({ compDTO: compDTO }) |
| 106 | // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 110 | // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 107 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) { | 111 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) { |
| 108 | - Divider().strokeWidth(3).color('#ffffff').padding({ left: 16, right: 16 }).margin({top: -3}) | 112 | + Divider().strokeWidth(3).color('#ffffff').padding({ left: 16, right: 16 }).margin({ top: -3 }) |
| 109 | Divider().strokeWidth(6).color('#f5f5f5') | 113 | Divider().strokeWidth(6).color('#f5f5f5') |
| 110 | ZhSingleColumn09({ compDTO: this.compDTO }) | 114 | ZhSingleColumn09({ compDTO: this.compDTO }) |
| 111 | Divider().strokeWidth(6).color('#f5f5f5') | 115 | Divider().strokeWidth(6).color('#f5f5f5') |
| @@ -41,6 +41,8 @@ import { publishCommentModel } from './comment/model/PublishCommentModel'; | @@ -41,6 +41,8 @@ import { publishCommentModel } from './comment/model/PublishCommentModel'; | ||
| 41 | import { CommentComponent } from './comment/view/CommentComponent'; | 41 | import { CommentComponent } from './comment/view/CommentComponent'; |
| 42 | import { EmptyComponent } from './view/EmptyComponent'; | 42 | import { EmptyComponent } from './view/EmptyComponent'; |
| 43 | import { detailedSkeleton } from './skeleton/detailSkeleton'; | 43 | import { detailedSkeleton } from './skeleton/detailSkeleton'; |
| 44 | +import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | ||
| 45 | +import { common } from '@kit.AbilityKit'; | ||
| 44 | 46 | ||
| 45 | const TAG = 'DynamicDetailComponent' | 47 | const TAG = 'DynamicDetailComponent' |
| 46 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | 48 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; |
| @@ -602,6 +604,7 @@ export struct DynamicDetailComponent { | @@ -602,6 +604,7 @@ export struct DynamicDetailComponent { | ||
| 602 | this.getInteractDataStatus() | 604 | this.getInteractDataStatus() |
| 603 | this.makeJumpInfo() | 605 | this.makeJumpInfo() |
| 604 | this.interactDataV2() | 606 | this.interactDataV2() |
| 607 | + this.viewBlogInsightIntentShare() | ||
| 605 | } | 608 | } |
| 606 | 609 | ||
| 607 | private async interactDataV2() { | 610 | private async interactDataV2() { |
| @@ -761,6 +764,14 @@ export struct DynamicDetailComponent { | @@ -761,6 +764,14 @@ export struct DynamicDetailComponent { | ||
| 761 | console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum) | 764 | console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum) |
| 762 | }) | 765 | }) |
| 763 | } | 766 | } |
| 767 | + | ||
| 768 | + /** | ||
| 769 | + * 意图上报 | ||
| 770 | + */ | ||
| 771 | + private viewBlogInsightIntentShare(){ | ||
| 772 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 773 | + viewBlogItemInsightIntentShare(context,this.contentDetailData, this.interactDataDTO) | ||
| 774 | + } | ||
| 764 | } | 775 | } |
| 765 | 776 | ||
| 766 | interface radiusType { | 777 | interface radiusType { |
| @@ -145,6 +145,7 @@ export struct ENewspaperPageComponent { | @@ -145,6 +145,7 @@ export struct ENewspaperPageComponent { | ||
| 145 | .onClick(() => { | 145 | .onClick(() => { |
| 146 | this.calendarDialogShow = !this.calendarDialogShow | 146 | this.calendarDialogShow = !this.calendarDialogShow |
| 147 | if (this.calendarDialogShow) { | 147 | if (this.calendarDialogShow) { |
| 148 | + | ||
| 148 | this.calendarDialogController.open() | 149 | this.calendarDialogController.open() |
| 149 | } else { | 150 | } else { |
| 150 | this.calendarDialogController.close() | 151 | this.calendarDialogController.close() |
| @@ -210,23 +210,22 @@ export struct FeedBackActivity { | @@ -210,23 +210,22 @@ export struct FeedBackActivity { | ||
| 210 | .padding({ bottom: 44 }) | 210 | .padding({ bottom: 44 }) |
| 211 | Column(){ | 211 | Column(){ |
| 212 | Text($r('app.string.submit')) | 212 | Text($r('app.string.submit')) |
| 213 | - .align(Alignment.Center) | 213 | + .textAlign(TextAlign.Center) |
| 214 | .height(44) | 214 | .height(44) |
| 215 | .width('90%') | 215 | .width('90%') |
| 216 | - .fontColor(this.canSubmit?$r('app.color.color_9E9E9E_40'):$r('app.color.color_fff')) | 216 | + .fontColor(this.canSubmit ? $r('app.color.color_fff') : $r('app.color.color_FFFFFF_40')) |
| 217 | .fontSize($r('app.float.font_size_18')) | 217 | .fontSize($r('app.float.font_size_18')) |
| 218 | - .backgroundColor(this.canSubmit?$r('app.color.color_ED2800_99'):$r('app.color.color_EDEDED')) | 218 | + .backgroundColor(this.canSubmit ? $r('app.color.color_ED2800') : $r('app.color.color_ED2800_99')) |
| 219 | .borderRadius(4) | 219 | .borderRadius(4) |
| 220 | .onClick(async (event: ClickEvent) => { | 220 | .onClick(async (event: ClickEvent) => { |
| 221 | - if(await FastClickUtil.isMinDelayTime()){ | 221 | + if (await FastClickUtil.isMinDelayTime()) { |
| 222 | return | 222 | return |
| 223 | } | 223 | } |
| 224 | this.reportCommit() | 224 | this.reportCommit() |
| 225 | }) | 225 | }) |
| 226 | - Blank().height(15).width('100%') | 226 | + .margin({bottom:20}) |
| 227 | } | 227 | } |
| 228 | - .height(59) | ||
| 229 | - } | 228 | + }.margin({bottom:20}) |
| 230 | } | 229 | } |
| 231 | } | 230 | } |
| 232 | 231 |
| @@ -31,6 +31,8 @@ import { publishCommentModel } from '../components/comment/model/PublishCommentM | @@ -31,6 +31,8 @@ import { publishCommentModel } from '../components/comment/model/PublishCommentM | ||
| 31 | import { EmptyComponent } from '../components/view/EmptyComponent'; | 31 | import { EmptyComponent } from '../components/view/EmptyComponent'; |
| 32 | import { CommentComponent } from '../components/comment/view/CommentComponent' | 32 | import { CommentComponent } from '../components/comment/view/CommentComponent' |
| 33 | import { HttpUtils } from 'wdNetwork/Index'; | 33 | import { HttpUtils } from 'wdNetwork/Index'; |
| 34 | +import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | ||
| 35 | +import { common } from '@kit.AbilityKit'; | ||
| 34 | 36 | ||
| 35 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | 37 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; |
| 36 | 38 | ||
| @@ -56,7 +58,6 @@ export struct ImageAndTextPageComponent { | @@ -56,7 +58,6 @@ export struct ImageAndTextPageComponent { | ||
| 56 | @State likeNum: number = 0 | 58 | @State likeNum: number = 0 |
| 57 | @State reachEndIncreament: number = 0 | 59 | @State reachEndIncreament: number = 0 |
| 58 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 60 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 59 | - | ||
| 60 | build() { | 61 | build() { |
| 61 | Stack({ alignContent: Alignment.Top }) { | 62 | Stack({ alignContent: Alignment.Top }) { |
| 62 | Stack({ alignContent: Alignment.Bottom }) { | 63 | Stack({ alignContent: Alignment.Bottom }) { |
| @@ -189,11 +190,11 @@ export struct ImageAndTextPageComponent { | @@ -189,11 +190,11 @@ export struct ImageAndTextPageComponent { | ||
| 189 | .alignItems(VerticalAlign.Bottom) | 190 | .alignItems(VerticalAlign.Bottom) |
| 190 | 191 | ||
| 191 | Row() { | 192 | Row() { |
| 192 | - Image($r('app.media.line')) | 193 | + Image($r('app.media.ic_news_detail_division')) |
| 193 | .width('100%') | 194 | .width('100%') |
| 194 | .height(6) | 195 | .height(6) |
| 195 | - .objectFit(ImageFit.Cover) | ||
| 196 | .margin({ top: 10 }) | 196 | .margin({ top: 10 }) |
| 197 | + .objectFit(ImageFit.Fill) | ||
| 197 | } | 198 | } |
| 198 | .padding({ left: 15, right: 15 }) | 199 | .padding({ left: 15, right: 15 }) |
| 199 | .backgroundColor(Color.White) | 200 | .backgroundColor(Color.White) |
| @@ -261,10 +262,20 @@ export struct ImageAndTextPageComponent { | @@ -261,10 +262,20 @@ export struct ImageAndTextPageComponent { | ||
| 261 | } else { | 262 | } else { |
| 262 | this.operationButtonList = ['comment', 'collect', 'share'] | 263 | this.operationButtonList = ['comment', 'collect', 'share'] |
| 263 | } | 264 | } |
| 265 | + | ||
| 266 | + //意图上报 | ||
| 267 | + this.viewBlogInsightIntentShare() | ||
| 264 | } | 268 | } |
| 265 | } | 269 | } |
| 266 | } | 270 | } |
| 267 | 271 | ||
| 272 | + //意图上报 | ||
| 273 | + private viewBlogInsightIntentShare(){ | ||
| 274 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 275 | + viewBlogItemInsightIntentShare(context,this.contentDetailData, this.interactData) | ||
| 276 | + } | ||
| 277 | + | ||
| 278 | + | ||
| 268 | private async getRecommend() { | 279 | private async getRecommend() { |
| 269 | let params: postRecommendListParams = { | 280 | let params: postRecommendListParams = { |
| 270 | imei: HttpUtils.getImei(), | 281 | imei: HttpUtils.getImei(), |
| @@ -341,6 +352,7 @@ export struct ImageAndTextPageComponent { | @@ -341,6 +352,7 @@ export struct ImageAndTextPageComponent { | ||
| 341 | } | 352 | } |
| 342 | PageRepository.getContentInteract(params).then(res => { | 353 | PageRepository.getContentInteract(params).then(res => { |
| 343 | if (res.data) { | 354 | if (res.data) { |
| 355 | + this.interactData = res.data[0] | ||
| 344 | this.likeNum = Number(res.data[0]?.likeNum) || 0 | 356 | this.likeNum = Number(res.data[0]?.likeNum) || 0 |
| 345 | } | 357 | } |
| 346 | }) | 358 | }) |
| @@ -73,15 +73,17 @@ export struct InteractMComponent { | @@ -73,15 +73,17 @@ export struct InteractMComponent { | ||
| 73 | .height('12') | 73 | .height('12') |
| 74 | }.margin({top:10,bottom:15}) | 74 | }.margin({top:10,bottom:15}) |
| 75 | }.padding({left:10,right:10}).alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5) | 75 | }.padding({left:10,right:10}).alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5) |
| 76 | - .onClick(()=>{ | ||
| 77 | - let contentDTO :ContentDTO = new ContentDTO(); | ||
| 78 | - contentDTO.objectType = this.messageModel.InteractMsubM.contentType | ||
| 79 | - contentDTO.objectId = this.messageModel.InteractMsubM.contentId | ||
| 80 | - ProcessUtils.processPage(contentDTO) | ||
| 81 | - }) | 76 | + |
| 82 | } | 77 | } |
| 83 | }.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%') | 78 | }.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%') |
| 84 | }.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top) | 79 | }.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top) |
| 80 | + .onClick(()=>{ | ||
| 81 | + if(this.messageModel.contentType === '211') return | ||
| 82 | + let contentDTO :ContentDTO = new ContentDTO(); | ||
| 83 | + contentDTO.objectType = this.messageModel.InteractMsubM.contentType | ||
| 84 | + contentDTO.objectId = this.messageModel.InteractMsubM.contentId | ||
| 85 | + ProcessUtils.processPage(contentDTO) | ||
| 86 | + }) | ||
| 85 | } | 87 | } |
| 86 | 88 | ||
| 87 | buildContentString(): string { | 89 | buildContentString(): string { |
| @@ -22,6 +22,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | @@ -22,6 +22,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 22 | import { PageRepository } from '../repository/PageRepository'; | 22 | import { PageRepository } from '../repository/PageRepository'; |
| 23 | import { SpConstants } from 'wdConstant/Index'; | 23 | import { SpConstants } from 'wdConstant/Index'; |
| 24 | import { router } from '@kit.ArkUI'; | 24 | import { router } from '@kit.ArkUI'; |
| 25 | +import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | ||
| 26 | +import { common } from '@kit.AbilityKit'; | ||
| 25 | 27 | ||
| 26 | const TAG = 'MultiPictureDetailPageComponent'; | 28 | const TAG = 'MultiPictureDetailPageComponent'; |
| 27 | 29 | ||
| @@ -467,6 +469,7 @@ export struct MultiPictureDetailPageComponent { | @@ -467,6 +469,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 467 | this.getInteractBrowsOperate() | 469 | this.getInteractBrowsOperate() |
| 468 | this.getBatchAttentionStatus() | 470 | this.getBatchAttentionStatus() |
| 469 | } | 471 | } |
| 472 | + this.viewBlogInsightIntentShare() | ||
| 470 | }) | 473 | }) |
| 471 | .catch((err: Error) => { | 474 | .catch((err: Error) => { |
| 472 | Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); | 475 | Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); |
| @@ -544,4 +547,12 @@ export struct MultiPictureDetailPageComponent { | @@ -544,4 +547,12 @@ export struct MultiPictureDetailPageComponent { | ||
| 544 | } | 547 | } |
| 545 | }) | 548 | }) |
| 546 | } | 549 | } |
| 550 | + | ||
| 551 | + /** | ||
| 552 | + * 意图上报 | ||
| 553 | + */ | ||
| 554 | + private viewBlogInsightIntentShare(){ | ||
| 555 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 556 | + viewBlogItemInsightIntentShare(context,this.contentDetailData) | ||
| 557 | + } | ||
| 547 | } | 558 | } |
| @@ -10,6 +10,8 @@ import DetailViewModel from '../viewmodel/DetailViewModel'; | @@ -10,6 +10,8 @@ import DetailViewModel from '../viewmodel/DetailViewModel'; | ||
| 10 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; | 10 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; |
| 11 | import { EmptyComponent } from '../components/view/EmptyComponent'; | 11 | import { EmptyComponent } from '../components/view/EmptyComponent'; |
| 12 | import { NetworkUtil, WindowModel } from 'wdKit'; | 12 | import { NetworkUtil, WindowModel } from 'wdKit'; |
| 13 | +import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | ||
| 14 | +import { common } from '@kit.AbilityKit'; | ||
| 13 | 15 | ||
| 14 | const TAG: string = 'SpacialTopicPageComponent' | 16 | const TAG: string = 'SpacialTopicPageComponent' |
| 15 | 17 | ||
| @@ -49,6 +51,12 @@ export struct SpacialTopicPageComponent { | @@ -49,6 +51,12 @@ export struct SpacialTopicPageComponent { | ||
| 49 | }) | 51 | }) |
| 50 | } | 52 | } |
| 51 | 53 | ||
| 54 | + //意图上报 | ||
| 55 | + private viewBlogInsightIntentShare(){ | ||
| 56 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 57 | + viewBlogItemInsightIntentShare(context,this.contentDetailData) | ||
| 58 | + } | ||
| 59 | + | ||
| 52 | private async getDetail() { | 60 | private async getDetail() { |
| 53 | this.isNetConnected = NetworkUtil.isNetConnected() | 61 | this.isNetConnected = NetworkUtil.isNetConnected() |
| 54 | 62 | ||
| @@ -71,6 +79,7 @@ export struct SpacialTopicPageComponent { | @@ -71,6 +79,7 @@ export struct SpacialTopicPageComponent { | ||
| 71 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 79 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 72 | if (detailBeans && detailBeans.length > 0) { | 80 | if (detailBeans && detailBeans.length > 0) { |
| 73 | this.contentDetailData = detailBeans[0]; | 81 | this.contentDetailData = detailBeans[0]; |
| 82 | + this.viewBlogInsightIntentShare() | ||
| 74 | // if (this.contentDetailData[0]?.openComment) { | 83 | // if (this.contentDetailData[0]?.openComment) { |
| 75 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | 84 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') |
| 76 | this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') | 85 | this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') |
| @@ -103,6 +103,10 @@ export struct RMCalendar { | @@ -103,6 +103,10 @@ export struct RMCalendar { | ||
| 103 | nowFontColor: this.nowFontColor, | 103 | nowFontColor: this.nowFontColor, |
| 104 | disableClick: (item: RMCalendarBean) => { | 104 | disableClick: (item: RMCalendarBean) => { |
| 105 | if (this.disableCellClick) { | 105 | if (this.disableCellClick) { |
| 106 | + if (!NetworkUtil.isNetConnected()) { | ||
| 107 | + ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | ||
| 108 | + return | ||
| 109 | + } | ||
| 106 | this.disableCellClick(item) | 110 | this.disableCellClick(item) |
| 107 | } | 111 | } |
| 108 | }, | 112 | }, |
| 1 | import { RMCalendarBean } from './RMCalendarBean'; | 1 | import { RMCalendarBean } from './RMCalendarBean'; |
| 2 | -import font from '@ohos.font'; | 2 | +import { ToastUtils, NetworkUtil } from 'wdKit/Index'; |
| 3 | 3 | ||
| 4 | @Component | 4 | @Component |
| 5 | export struct RMCalenderCell { | 5 | export struct RMCalenderCell { |
| @@ -38,6 +38,12 @@ export struct RMCalenderCell { | @@ -38,6 +38,12 @@ export struct RMCalenderCell { | ||
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | getItemColor() { | 40 | getItemColor() { |
| 41 | + if (!NetworkUtil.isNetConnected()) { | ||
| 42 | + if (this.selectItem && this.selectItem.time == this.item.time) { | ||
| 43 | + return this.selectFontColor | ||
| 44 | + } | ||
| 45 | + return this.disabledFontColor | ||
| 46 | + } | ||
| 41 | if (!this.isShowSelectBg() && this.item.isNow) { | 47 | if (!this.isShowSelectBg() && this.item.isNow) { |
| 42 | return this.nowFontColor | 48 | return this.nowFontColor |
| 43 | } else if (this.item.isPre) { | 49 | } else if (this.item.isPre) { |
| @@ -136,9 +142,11 @@ export struct RMCalenderCell { | @@ -136,9 +142,11 @@ export struct RMCalenderCell { | ||
| 136 | return | 142 | return |
| 137 | // } | 143 | // } |
| 138 | } | 144 | } |
| 139 | - this.selectItem = this.item | ||
| 140 | - if (this.cellClick) { | ||
| 141 | - this.cellClick(this.item) | 145 | + if (NetworkUtil.isNetConnected()) { |
| 146 | + this.selectItem = this.item | ||
| 147 | + if (this.cellClick) { | ||
| 148 | + this.cellClick(this.item) | ||
| 149 | + } | ||
| 142 | } | 150 | } |
| 143 | }) | 151 | }) |
| 144 | } | 152 | } |
| @@ -8,7 +8,7 @@ export struct CardSourceInfo { | @@ -8,7 +8,7 @@ export struct CardSourceInfo { | ||
| 8 | @ObjectLink compDTO: CompDTO | 8 | @ObjectLink compDTO: CompDTO |
| 9 | 9 | ||
| 10 | build() { | 10 | build() { |
| 11 | - Flex() { | 11 | + Flex({ alignItems: ItemAlign.Center }) { |
| 12 | if (this.contentDTO.corner) { | 12 | if (this.contentDTO.corner) { |
| 13 | Text(this.contentDTO.corner) | 13 | Text(this.contentDTO.corner) |
| 14 | .fontSize($r("app.float.font_size_11")) | 14 | .fontSize($r("app.float.font_size_11")) |
| @@ -28,31 +28,45 @@ export struct CardSourceInfo { | @@ -28,31 +28,45 @@ export struct CardSourceInfo { | ||
| 28 | .maxLines(1) | 28 | .maxLines(1) |
| 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 30 | } | 30 | } |
| 31 | - if (((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName && this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) && (this.getContentDtoBean()?.interactData?.commentNum || DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)) != '')) { | 31 | + if (((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName && this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) && (this.getContentDtoBean()?.interactData?.commentNum |
| 32 | + // || DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)) != '' | ||
| 33 | + || (this.contentDTO.isSearch || this.contentDTO.isCollection || | ||
| 34 | + !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | ||
| 35 | + (Number | ||
| 36 | + .parseFloat(this | ||
| 37 | + .contentDTO.publishTime)) | ||
| 38 | + .indexOf | ||
| 39 | + ('-') === -1) | ||
| 40 | + )) { | ||
| 32 | Image($r("app.media.point")) | 41 | Image($r("app.media.point")) |
| 33 | - .width(16) | ||
| 34 | - .height(16) | 42 | + .width(11) |
| 43 | + .height(11) | ||
| 35 | } | 44 | } |
| 36 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 | 45 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 |
| 37 | - if (this.contentDTO.isSearch || this.contentDTO.isCollection || | ||
| 38 | - !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | ||
| 39 | - (Number | ||
| 40 | - .parseFloat(this | ||
| 41 | - .contentDTO.publishTime)) | ||
| 42 | - .indexOf | ||
| 43 | - ('-') === -1) { | 46 | + // if (this.contentDTO.isSearch || this.contentDTO.isCollection || |
| 47 | + // (!this.contentDTO.isSearch && | ||
| 48 | + // DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)).indexOf('-') === -1)) { | ||
| 49 | + // | ||
| 50 | + // Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | ||
| 51 | + // .fontSize($r("app.float.font_size_11")) | ||
| 52 | + // .fontColor($r("app.color.color_B0B0B0")) | ||
| 53 | + // .flexShrink(0); | ||
| 54 | + // } | ||
| 55 | + if (this.contentDTO.source) { | ||
| 44 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | 56 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) |
| 45 | .fontSize($r("app.float.font_size_11")) | 57 | .fontSize($r("app.float.font_size_11")) |
| 46 | .fontColor($r("app.color.color_B0B0B0")) | 58 | .fontColor($r("app.color.color_B0B0B0")) |
| 47 | - .flexShrink(0) | 59 | + .flexShrink(0); |
| 48 | } | 60 | } |
| 49 | - if (this.getContentDtoBean()?.interactData?.commentNum) { | 61 | + |
| 62 | + if (this.getContentDtoBean()?.interactData?.commentNum && this.contentDTO.source) { | ||
| 50 | Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`) | 63 | Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`) |
| 51 | .fontSize($r("app.float.font_size_11")) | 64 | .fontSize($r("app.float.font_size_11")) |
| 52 | .fontColor($r("app.color.color_B0B0B0")) | 65 | .fontColor($r("app.color.color_B0B0B0")) |
| 53 | .flexShrink(0) | 66 | .flexShrink(0) |
| 54 | .margin({ left: 6 }) | 67 | .margin({ left: 6 }) |
| 55 | - .visibility(Number(this.getContentDtoBean()?.interactData?.commentNum) === 0 ? Visibility.None : Visibility.Visible) | 68 | + .visibility(Number(this.getContentDtoBean()?.interactData?.commentNum) === 0 ? Visibility.None : |
| 69 | + Visibility.Visible) | ||
| 56 | } | 70 | } |
| 57 | } | 71 | } |
| 58 | .width(CommonConstants.FULL_WIDTH) | 72 | .width(CommonConstants.FULL_WIDTH) |
| @@ -67,7 +81,7 @@ export struct CardSourceInfo { | @@ -67,7 +81,7 @@ export struct CardSourceInfo { | ||
| 67 | if (this.compDTO == undefined) { | 81 | if (this.compDTO == undefined) { |
| 68 | return this.contentDTO | 82 | return this.contentDTO |
| 69 | } | 83 | } |
| 70 | - if(this.compDTO.operDataList.length == 0){ | 84 | + if (this.compDTO.operDataList.length == 0) { |
| 71 | return this.contentDTO | 85 | return this.contentDTO |
| 72 | } | 86 | } |
| 73 | return this.compDTO.operDataList[0] | 87 | return this.compDTO.operDataList[0] |
| @@ -38,9 +38,9 @@ export struct Card11Component { | @@ -38,9 +38,9 @@ export struct Card11Component { | ||
| 38 | Column() { | 38 | Column() { |
| 39 | Stack() { | 39 | Stack() { |
| 40 | if (this.contentDTO.newTags) { | 40 | if (this.contentDTO.newTags) { |
| 41 | - Notes({ newTags: this.contentDTO.newTags }) | 41 | + Notes({ newTags: this.contentDTO.newTags }).height(27).align(Alignment.Center) |
| 42 | } else if (this.contentDTO.objectType == '5') { | 42 | } else if (this.contentDTO.objectType == '5') { |
| 43 | - Notes({ objectType: this.contentDTO.objectType }) | 43 | + Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center) |
| 44 | } | 44 | } |
| 45 | Text() { | 45 | Text() { |
| 46 | if (this.titleMarked) { | 46 | if (this.titleMarked) { |
| @@ -52,6 +52,7 @@ export struct Card11Component { | @@ -52,6 +52,7 @@ export struct Card11Component { | ||
| 52 | Span(this.contentDTO.newsTitle) | 52 | Span(this.contentDTO.newsTitle) |
| 53 | } | 53 | } |
| 54 | } | 54 | } |
| 55 | + .lineHeight(27) | ||
| 55 | .fontSize($r("app.float.font_size_18")) | 56 | .fontSize($r("app.float.font_size_18")) |
| 56 | .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) | 57 | .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) |
| 57 | .maxLines(3) | 58 | .maxLines(3) |
| @@ -59,7 +60,7 @@ export struct Card11Component { | @@ -59,7 +60,7 @@ export struct Card11Component { | ||
| 59 | .width(CommonConstants.FULL_WIDTH) | 60 | .width(CommonConstants.FULL_WIDTH) |
| 60 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | 61 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : |
| 61 | (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | 62 | (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || |
| 62 | - this.contentDTO.objectType == '5' ? 30 : 0) | 63 | + this.contentDTO.objectType == '5' ? 35 : 0) |
| 63 | 64 | ||
| 64 | }.alignContent(Alignment.TopStart) | 65 | }.alignContent(Alignment.TopStart) |
| 65 | 66 |
| @@ -48,12 +48,12 @@ export struct Card17Component { | @@ -48,12 +48,12 @@ export struct Card17Component { | ||
| 48 | Span(this.contentDTO.newsTitle) | 48 | Span(this.contentDTO.newsTitle) |
| 49 | } | 49 | } |
| 50 | } | 50 | } |
| 51 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 52 | - .fontSize($r('app.float.font_size_18')) | ||
| 53 | - .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | ||
| 54 | - .lineHeight(25) | ||
| 55 | - .maxLines(3) | ||
| 56 | - .width(CommonConstants.FULL_WIDTH) | 51 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 52 | + .fontSize($r('app.float.font_size_17')) | ||
| 53 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | ||
| 54 | + .lineHeight(25) | ||
| 55 | + .maxLines(3) | ||
| 56 | + .width(CommonConstants.FULL_WIDTH) | ||
| 57 | 57 | ||
| 58 | Stack({ alignContent: Alignment.BottomEnd }) { | 58 | Stack({ alignContent: Alignment.BottomEnd }) { |
| 59 | // 三个图, | 59 | // 三个图, |
| @@ -120,7 +120,7 @@ export struct Card17Component { | @@ -120,7 +120,7 @@ export struct Card17Component { | ||
| 120 | }) | 120 | }) |
| 121 | 121 | ||
| 122 | // 评论等信息 | 122 | // 评论等信息 |
| 123 | - CardSourceInfo({compDTO:this.compDTO, contentDTO: this.contentDTO }) | 123 | + CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| 124 | } | 124 | } |
| 125 | .width(CommonConstants.FULL_WIDTH) | 125 | .width(CommonConstants.FULL_WIDTH) |
| 126 | .padding({ | 126 | .padding({ |
| @@ -131,11 +131,3 @@ export struct Card17Component { | @@ -131,11 +131,3 @@ export struct Card17Component { | ||
| 131 | }) | 131 | }) |
| 132 | } | 132 | } |
| 133 | } | 133 | } |
| 134 | - | ||
| 135 | -// 全局公共样式 | ||
| 136 | -@Styles | ||
| 137 | -function ImageSize() { | ||
| 138 | - .padding({ right: 18, left: 18 }) | ||
| 139 | - .width('100%') | ||
| 140 | - .margin({ top: 10 }) | ||
| 141 | -} |
| @@ -62,20 +62,7 @@ export struct Card19Component { | @@ -62,20 +62,7 @@ export struct Card19Component { | ||
| 62 | } | 62 | } |
| 63 | // 图片-从无图到9图展示 | 63 | // 图片-从无图到9图展示 |
| 64 | createImg({ fullColumnImgUrls: this.contentDTO.fullColumnImgUrls }) | 64 | createImg({ fullColumnImgUrls: this.contentDTO.fullColumnImgUrls }) |
| 65 | - .onClick(() => { | ||
| 66 | - const photoList: PhotoListBean[] = this.contentDTO.fullColumnImgUrls.map(item => { | ||
| 67 | - const photo: PhotoListBean = { | ||
| 68 | - width: item.weight, | ||
| 69 | - height: item.height, | ||
| 70 | - picPath: item.fullUrl||item.url, | ||
| 71 | - picDesc: '', | ||
| 72 | - itemType:2, | ||
| 73 | - id:0 | ||
| 74 | - } | ||
| 75 | - return photo | ||
| 76 | - }) | ||
| 77 | - ProcessUtils.gotoMultiPictureListPage(photoList, 0) | ||
| 78 | - }) | 65 | + |
| 79 | CarderInteraction({ contentDTO: this.contentDTO }) | 66 | CarderInteraction({ contentDTO: this.contentDTO }) |
| 80 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 67 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 81 | } | 68 | } |
| @@ -107,12 +94,12 @@ struct createImg { | @@ -107,12 +94,12 @@ struct createImg { | ||
| 107 | @State loadImg: boolean = false; | 94 | @State loadImg: boolean = false; |
| 108 | 95 | ||
| 109 | async aboutToAppear(): Promise<void> { | 96 | async aboutToAppear(): Promise<void> { |
| 110 | - this.loadImg = await onlyWifiLoadImg(); | ||
| 111 | if (this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 | 97 | if (this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 |
| 112 | this.fullColumnImgUrls.splice(2, 0, { | 98 | this.fullColumnImgUrls.splice(2, 0, { |
| 113 | fullUrl: '' | 99 | fullUrl: '' |
| 114 | } as FullColumnImgUrlDTO) | 100 | } as FullColumnImgUrlDTO) |
| 115 | } | 101 | } |
| 102 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 116 | console.log('card19-this.fullColumnImgUrls',JSON.stringify(this.fullColumnImgUrls)) | 103 | console.log('card19-this.fullColumnImgUrls',JSON.stringify(this.fullColumnImgUrls)) |
| 117 | } | 104 | } |
| 118 | 105 | ||
| @@ -167,14 +154,14 @@ struct createImg { | @@ -167,14 +154,14 @@ struct createImg { | ||
| 167 | alignContent: Alignment.BottomEnd | 154 | alignContent: Alignment.BottomEnd |
| 168 | }) { | 155 | }) { |
| 169 | if (this.getPicType() === 1) { | 156 | if (this.getPicType() === 1) { |
| 170 | - Image(this.loadImg ? item.fullUrl||item.url : '') | 157 | + Image(this.loadImg ? item.fullUrl || item.url : '') |
| 171 | .backgroundColor(0xf5f5f5) | 158 | .backgroundColor(0xf5f5f5) |
| 172 | .width('100%') | 159 | .width('100%') |
| 173 | .height(172) | 160 | .height(172) |
| 174 | .autoResize(true) | 161 | .autoResize(true) |
| 175 | .borderRadius(this.caclImageRadius(index)) | 162 | .borderRadius(this.caclImageRadius(index)) |
| 176 | } else if (this.getPicType() === 2) { | 163 | } else if (this.getPicType() === 2) { |
| 177 | - Image(this.loadImg ? item.fullUrl||item.url : '') | 164 | + Image(this.loadImg ? item.fullUrl || item.url : '') |
| 178 | .width('100%') | 165 | .width('100%') |
| 179 | .height(305) | 166 | .height(305) |
| 180 | .autoResize(true) | 167 | .autoResize(true) |
| @@ -291,6 +278,20 @@ struct createImg { | @@ -291,6 +278,20 @@ struct createImg { | ||
| 291 | .padding({ bottom: 3 }) | 278 | .padding({ bottom: 3 }) |
| 292 | } | 279 | } |
| 293 | } | 280 | } |
| 281 | + .onClick(() => { | ||
| 282 | + const photoList: PhotoListBean[] = this.fullColumnImgUrls.map(item => { | ||
| 283 | + const photo: PhotoListBean = { | ||
| 284 | + width: item.weight, | ||
| 285 | + height: item.height, | ||
| 286 | + picPath: item.fullUrl||item.url, | ||
| 287 | + picDesc: '', | ||
| 288 | + itemType:2, | ||
| 289 | + id:0 | ||
| 290 | + } | ||
| 291 | + return photo | ||
| 292 | + }) | ||
| 293 | + ProcessUtils.gotoMultiPictureListPage(photoList, index) | ||
| 294 | + }) | ||
| 294 | } | 295 | } |
| 295 | } | 296 | } |
| 296 | }) | 297 | }) |
| @@ -6,6 +6,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; | @@ -6,6 +6,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; | ||
| 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| 7 | import { Notes } from './notes'; | 7 | import { Notes } from './notes'; |
| 8 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 8 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 9 | + | ||
| 9 | // import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; | 10 | // import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; |
| 10 | const TAG: string = 'Card2Component'; | 11 | const TAG: string = 'Card2Component'; |
| 11 | 12 | ||
| @@ -48,9 +49,9 @@ export struct Card2Component { | @@ -48,9 +49,9 @@ export struct Card2Component { | ||
| 48 | Stack() { | 49 | Stack() { |
| 49 | //新闻标题 | 50 | //新闻标题 |
| 50 | if (this.contentDTO.newTags) { | 51 | if (this.contentDTO.newTags) { |
| 51 | - Notes({ newTags: this.contentDTO.newTags }) | 52 | + Notes({ newTags: this.contentDTO.newTags }) |
| 52 | } else if (this.contentDTO.objectType == '5') { | 53 | } else if (this.contentDTO.objectType == '5') { |
| 53 | - Notes({ objectType: this.contentDTO.objectType }) | 54 | + Notes({ objectType: this.contentDTO.objectType }) |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | Text() { | 57 | Text() { |
| @@ -66,15 +67,16 @@ export struct Card2Component { | @@ -66,15 +67,16 @@ export struct Card2Component { | ||
| 66 | .fontSize($r('app.float.font_size_18')) | 67 | .fontSize($r('app.float.font_size_18')) |
| 67 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 68 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 68 | .maxLines(2) | 69 | .maxLines(2) |
| 69 | - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | 70 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 |
| 70 | .align(Alignment.Start) | 71 | .align(Alignment.Start) |
| 71 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | 72 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : |
| 72 | - (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 73 | - this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 74 | - }.alignContent(Alignment.TopStart) | ||
| 75 | - //.textIndent(this.contentDTO.objectType == '5' ? 35 : 0) | ||
| 76 | - // } | ||
| 77 | - // .alignContent(Alignment.TopStart) | 73 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || |
| 74 | + this.contentDTO.objectType == '5' ? 35 : 0) | ||
| 75 | + }.alignContent(Alignment.TopStart) | ||
| 76 | + | ||
| 77 | + //.textIndent(this.contentDTO.objectType == '5' ? 35 : 0) | ||
| 78 | + // } | ||
| 79 | + // .alignContent(Alignment.TopStart) | ||
| 78 | 80 | ||
| 79 | //大图 | 81 | //大图 |
| 80 | Stack() { | 82 | Stack() { |
| @@ -36,9 +36,9 @@ export struct Card3Component { | @@ -36,9 +36,9 @@ export struct Card3Component { | ||
| 36 | Column() { | 36 | Column() { |
| 37 | Stack() { | 37 | Stack() { |
| 38 | if (this.contentDTO.newTags) { | 38 | if (this.contentDTO.newTags) { |
| 39 | - Notes({ newTags: this.contentDTO.newTags }) | 39 | + Notes({ newTags: this.contentDTO.newTags }).height(27).align(Alignment.Center) |
| 40 | } else if (this.contentDTO.objectType == '5') { | 40 | } else if (this.contentDTO.objectType == '5') { |
| 41 | - Notes({ objectType: this.contentDTO.objectType }) | 41 | + Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center) |
| 42 | } | 42 | } |
| 43 | Text() { | 43 | Text() { |
| 44 | if (this.titleMarked) { | 44 | if (this.titleMarked) { |
| @@ -56,11 +56,11 @@ export struct Card3Component { | @@ -56,11 +56,11 @@ export struct Card3Component { | ||
| 56 | .width(CommonConstants.FULL_WIDTH) | 56 | .width(CommonConstants.FULL_WIDTH) |
| 57 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | 57 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : |
| 58 | (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | 58 | (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || |
| 59 | - this.contentDTO.objectType == '5' ? 30 : 0) | 59 | + this.contentDTO.objectType == '5' ? 35 : 0) |
| 60 | }.alignContent(Alignment.TopStart) | 60 | }.alignContent(Alignment.TopStart) |
| 61 | 61 | ||
| 62 | // 评论等信息 | 62 | // 评论等信息 |
| 63 | - CardSourceInfo({compDTO:this.compDTO, contentDTO: this.contentDTO }) | 63 | + CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| 64 | } | 64 | } |
| 65 | .width(CommonConstants.FULL_WIDTH) | 65 | .width(CommonConstants.FULL_WIDTH) |
| 66 | .padding({ | 66 | .padding({ |
| @@ -3,8 +3,6 @@ import { CommonConstants } from 'wdConstant'; | @@ -3,8 +3,6 @@ import { CommonConstants } from 'wdConstant'; | ||
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 4 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 5 | import { Notes } from './notes'; | 5 | import { Notes } from './notes'; |
| 6 | -import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare' | ||
| 7 | -import { common } from '@kit.AbilityKit'; | ||
| 8 | 6 | ||
| 9 | const TAG: string = 'Card5Component'; | 7 | const TAG: string = 'Card5Component'; |
| 10 | 8 | ||
| @@ -15,7 +13,6 @@ const TAG: string = 'Card5Component'; | @@ -15,7 +13,6 @@ const TAG: string = 'Card5Component'; | ||
| 15 | export struct Card5Component { | 13 | export struct Card5Component { |
| 16 | @State contentDTO: ContentDTO = new ContentDTO(); | 14 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 17 | @Prop titleShowPolicy: number | string | 15 | @Prop titleShowPolicy: number | string |
| 18 | - @Prop compDTO: CompDTO = {} as CompDTO | ||
| 19 | @State loadImg: boolean = false; | 16 | @State loadImg: boolean = false; |
| 20 | @State clicked: boolean = false; | 17 | @State clicked: boolean = false; |
| 21 | @State titleMarked: boolean = false; | 18 | @State titleMarked: boolean = false; |
| @@ -75,13 +72,12 @@ export struct Card5Component { | @@ -75,13 +72,12 @@ export struct Card5Component { | ||
| 75 | .width(CommonConstants.FULL_WIDTH) | 72 | .width(CommonConstants.FULL_WIDTH) |
| 76 | .fontColor(Color.White) | 73 | .fontColor(Color.White) |
| 77 | .fontSize($r('app.float.font_size_18')) | 74 | .fontSize($r('app.float.font_size_18')) |
| 78 | - .fontWeight(FontWeight.Bold) | ||
| 79 | .maxLines(2) | 75 | .maxLines(2) |
| 80 | .align(Alignment.TopStart) | 76 | .align(Alignment.TopStart) |
| 81 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 77 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 |
| 82 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | 78 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : |
| 83 | (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | 79 | (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || |
| 84 | - this.contentDTO.objectType == '5' ? 30 : 0) | 80 | + this.contentDTO.objectType == '5' ? 35 : 0) |
| 85 | }.alignContent(Alignment.TopStart) | 81 | }.alignContent(Alignment.TopStart) |
| 86 | } | 82 | } |
| 87 | .justifyContent(FlexAlign.Start) | 83 | .justifyContent(FlexAlign.Start) |
| @@ -100,8 +96,6 @@ export struct Card5Component { | @@ -100,8 +96,6 @@ export struct Card5Component { | ||
| 100 | .onClick((event: ClickEvent) => { | 96 | .onClick((event: ClickEvent) => { |
| 101 | this.clicked = true; | 97 | this.clicked = true; |
| 102 | ProcessUtils.processPage(this.contentDTO) | 98 | ProcessUtils.processPage(this.contentDTO) |
| 103 | - let context = getContext(this) as common.UIAbilityContext; | ||
| 104 | - viewBlogInsightIntentShare(context, this.contentDTO?.channelId, [this.compDTO], ActionMode.EXECUTED) | ||
| 105 | }) | 99 | }) |
| 106 | 100 | ||
| 107 | } | 101 | } |
| @@ -54,9 +54,9 @@ export struct Card6Component { | @@ -54,9 +54,9 @@ export struct Card6Component { | ||
| 54 | // } | 54 | // } |
| 55 | Stack() { | 55 | Stack() { |
| 56 | if (this.contentDTO.newTags) { | 56 | if (this.contentDTO.newTags) { |
| 57 | - Notes({ newTags: this.contentDTO.newTags }) | 57 | + Notes({ newTags: this.contentDTO.newTags }).height(27).align(Alignment.Center) |
| 58 | } else if (this.contentDTO.objectType == '5') { | 58 | } else if (this.contentDTO.objectType == '5') { |
| 59 | - Notes({ objectType: this.contentDTO.objectType }) | 59 | + Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center) |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | Text() { | 62 | Text() { |
| @@ -69,16 +69,16 @@ export struct Card6Component { | @@ -69,16 +69,16 @@ export struct Card6Component { | ||
| 69 | Span(this.contentDTO.newsTitle) | 69 | Span(this.contentDTO.newsTitle) |
| 70 | } | 70 | } |
| 71 | } | 71 | } |
| 72 | - .fontColor(this.clicked ? 0x848484 : 0x222222) | ||
| 73 | - .fontSize(18) | ||
| 74 | - .lineHeight(27) | ||
| 75 | - .fontWeight(FontWeight.Normal) | ||
| 76 | - .maxLines(3) | ||
| 77 | - .alignSelf(ItemAlign.Start) | ||
| 78 | - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 79 | - .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | ||
| 80 | - (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 81 | - this.contentDTO.objectType == '5' ? 30 : 0) | 72 | + .fontColor(this.clicked ? 0x848484 : 0x222222) |
| 73 | + .fontSize(18) | ||
| 74 | + .lineHeight(27) | ||
| 75 | + .fontWeight(FontWeight.Normal) | ||
| 76 | + .maxLines(3) | ||
| 77 | + .alignSelf(ItemAlign.Start) | ||
| 78 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | ||
| 79 | + .textIndent(this.contentDTO?.newTags?.length < 5 && this.contentDTO?.newTags?.length > 2 ? 58 : | ||
| 80 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 81 | + this.contentDTO.objectType == '5' ? 35 : 0) | ||
| 82 | }.alignContent(Alignment.TopStart) | 82 | }.alignContent(Alignment.TopStart) |
| 83 | 83 | ||
| 84 | } | 84 | } |
| @@ -86,7 +86,7 @@ export struct Card6Component { | @@ -86,7 +86,7 @@ export struct Card6Component { | ||
| 86 | 86 | ||
| 87 | 87 | ||
| 88 | //bottom 评论等信息 | 88 | //bottom 评论等信息 |
| 89 | - CardSourceInfo({ compDTO: this.compDTO,contentDTO:this.contentDTO }) | 89 | + CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| 90 | } | 90 | } |
| 91 | .alignItems(HorizontalAlign.Start) | 91 | .alignItems(HorizontalAlign.Start) |
| 92 | .justifyContent(FlexAlign.Start) | 92 | .justifyContent(FlexAlign.Start) |
| @@ -114,7 +114,7 @@ export struct Card6Component { | @@ -114,7 +114,7 @@ export struct Card6Component { | ||
| 114 | bottom: $r('app.float.card_comp_pagePadding_tb') | 114 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 115 | }) | 115 | }) |
| 116 | .width(CommonConstants.FULL_WIDTH) | 116 | .width(CommonConstants.FULL_WIDTH) |
| 117 | - .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 107 : 217) | 117 | + // .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 107 : 217) |
| 118 | .justifyContent(FlexAlign.SpaceBetween) | 118 | .justifyContent(FlexAlign.SpaceBetween) |
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| @@ -13,7 +13,7 @@ const TAG: string = 'Card9Component'; | @@ -13,7 +13,7 @@ const TAG: string = 'Card9Component'; | ||
| 13 | @Component | 13 | @Component |
| 14 | export struct Card9Component { | 14 | export struct Card9Component { |
| 15 | @State contentDTO: ContentDTO = new ContentDTO(); | 15 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 16 | - @State loadImg: boolean = true; | 16 | + // @State loadImg: boolean = true; |
| 17 | @State clicked: boolean = false; | 17 | @State clicked: boolean = false; |
| 18 | @State titleMarked: boolean = false; | 18 | @State titleMarked: boolean = false; |
| 19 | @State str01: string = ''; | 19 | @State str01: string = ''; |
| @@ -38,11 +38,6 @@ export struct Card9Component { | @@ -38,11 +38,6 @@ export struct Card9Component { | ||
| 38 | Column() { | 38 | Column() { |
| 39 | // 顶部标题,最多两行 | 39 | // 顶部标题,最多两行 |
| 40 | if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { | 40 | if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { |
| 41 | - if (this.contentDTO.newTags) { | ||
| 42 | - Notes({ newTags: this.contentDTO.newTags }) | ||
| 43 | - } else if (this.contentDTO.objectType == '5') { | ||
| 44 | - Notes({ objectType: this.contentDTO.objectType }) | ||
| 45 | - } | ||
| 46 | Text() { | 41 | Text() { |
| 47 | if (this.titleMarked) { | 42 | if (this.titleMarked) { |
| 48 | Span(this.str01) | 43 | Span(this.str01) |
| @@ -56,18 +51,14 @@ export struct Card9Component { | @@ -56,18 +51,14 @@ export struct Card9Component { | ||
| 56 | .fontColor(this.clicked ? 0x848484 : 0x222222) | 51 | .fontColor(this.clicked ? 0x848484 : 0x222222) |
| 57 | .width(CommonConstants.FULL_WIDTH) | 52 | .width(CommonConstants.FULL_WIDTH) |
| 58 | .fontSize($r('app.float.font_size_18')) | 53 | .fontSize($r('app.float.font_size_18')) |
| 59 | - .fontWeight(600) | ||
| 60 | .maxLines(2) | 54 | .maxLines(2) |
| 61 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 55 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 62 | - .margin({ bottom: 19 }) | ||
| 63 | - .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | ||
| 64 | - (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 65 | - this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 66 | - | 56 | + .margin({ top: 10, bottom: 10 }) |
| 57 | + .fontWeight(400) | ||
| 67 | } | 58 | } |
| 68 | // 大图 | 59 | // 大图 |
| 69 | Stack() { | 60 | Stack() { |
| 70 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 61 | + Image(this.contentDTO.coverUrl) |
| 71 | .backgroundColor(0xf5f5f5) | 62 | .backgroundColor(0xf5f5f5) |
| 72 | .width('100%') | 63 | .width('100%') |
| 73 | .height(133) | 64 | .height(133) |
| @@ -21,8 +21,9 @@ export struct Notes { | @@ -21,8 +21,9 @@ export struct Notes { | ||
| 21 | bottom: 3 | 21 | bottom: 3 |
| 22 | }) | 22 | }) |
| 23 | .linearGradient({ angle: 90, colors: [['#FFFF2B00', 0.0], ['#FFFE6A00', 1.0]] }) | 23 | .linearGradient({ angle: 90, colors: [['#FFFF2B00', 0.0], ['#FFFE6A00', 1.0]] }) |
| 24 | - .fontColor(Color.White) | ||
| 25 | - .borderRadius($r('app.float.button_border_radius')) | 24 | + .fontColor(Color.White)// .borderRadius($r('app.float.button_border_radius')) |
| 25 | + .borderRadius(2) | ||
| 26 | + .margin({ top: 1 }) | ||
| 26 | } | 27 | } |
| 27 | } | 28 | } |
| 28 | 29 |
| @@ -19,6 +19,9 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一 | @@ -19,6 +19,9 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一 | ||
| 19 | @Preview | 19 | @Preview |
| 20 | @Component | 20 | @Component |
| 21 | export struct CommentComponent { | 21 | export struct CommentComponent { |
| 22 | + private onCloseClick = () => { | ||
| 23 | + } | ||
| 24 | + @Prop showCloseIcon?: boolean = false | ||
| 22 | @State hasMore: boolean = true; | 25 | @State hasMore: boolean = true; |
| 23 | @State currentPage: number = 1; | 26 | @State currentPage: number = 1; |
| 24 | @State isComments: boolean = true | 27 | @State isComments: boolean = true |
| @@ -29,13 +32,12 @@ export struct CommentComponent { | @@ -29,13 +32,12 @@ export struct CommentComponent { | ||
| 29 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset | 32 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset |
| 30 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); | 33 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); |
| 31 | @State dialogController: CustomDialogController | null = null; | 34 | @State dialogController: CustomDialogController | null = null; |
| 32 | - | ||
| 33 | // @State private browSingModel: commentListModel = new commentListModel() | 35 | // @State private browSingModel: commentListModel = new commentListModel() |
| 34 | 36 | ||
| 35 | // 是否为固定高度模式。true时,里面上拉加载更多生效,外层不能包Scroll。 | 37 | // 是否为固定高度模式。true时,里面上拉加载更多生效,外层不能包Scroll。 |
| 36 | // false时,外层实现加载更多,并通过reachEndIncreament通知开发加载更多,reachEndLoadMoreFinish 通知上层加载更多完成 | 38 | // false时,外层实现加载更多,并通过reachEndIncreament通知开发加载更多,reachEndLoadMoreFinish 通知上层加载更多完成 |
| 37 | fixedHeightMode: boolean = false | 39 | fixedHeightMode: boolean = false |
| 38 | - @Prop @Watch("parentOnReachEnd") reachEndIncreament : number = 0 | 40 | + @Prop @Watch("parentOnReachEnd") reachEndIncreament: number = 0 |
| 39 | reachEndLoadMoreFinish?: () => void | 41 | reachEndLoadMoreFinish?: () => void |
| 40 | 42 | ||
| 41 | // 在自定义组件即将析构销毁时将dialogControlle置空 | 43 | // 在自定义组件即将析构销毁时将dialogControlle置空 |
| @@ -102,6 +104,7 @@ export struct CommentComponent { | @@ -102,6 +104,7 @@ export struct CommentComponent { | ||
| 102 | /*标题:全部评论*/ | 104 | /*标题:全部评论*/ |
| 103 | @Builder | 105 | @Builder |
| 104 | titleHeader() { | 106 | titleHeader() { |
| 107 | + | ||
| 105 | Row() { | 108 | Row() { |
| 106 | Row() { | 109 | Row() { |
| 107 | Image($r('app.media.redLine')) | 110 | Image($r('app.media.redLine')) |
| @@ -112,18 +115,29 @@ export struct CommentComponent { | @@ -112,18 +115,29 @@ export struct CommentComponent { | ||
| 112 | .fontColor($r('app.color.color_222222')) | 115 | .fontColor($r('app.color.color_222222')) |
| 113 | .fontWeight(FontWeight.Medium) | 116 | .fontWeight(FontWeight.Medium) |
| 114 | .margin({ left: 5 }) | 117 | .margin({ left: 5 }) |
| 115 | - | ||
| 116 | } | 118 | } |
| 117 | .margin({ left: 16 }) | 119 | .margin({ left: 16 }) |
| 118 | - .onClick(() => { | ||
| 119 | - // this.allDatas.push(new commentItemModel()) | ||
| 120 | - // this.allDatas.addFirstItem(new commentItemModel()) | ||
| 121 | - // this.allDatas.reloadData(); | ||
| 122 | - }) | ||
| 123 | 120 | ||
| 124 | - }.height(44) | 121 | + |
| 122 | + Image($r('app.media.close_button')) | ||
| 123 | + .height(16) | ||
| 124 | + .width(16) | ||
| 125 | + .margin({ right: 16 }) | ||
| 126 | + .visibility(this.showCloseIcon ? Visibility.Visible : Visibility.Hidden) | ||
| 127 | + .onClick(() => { | ||
| 128 | + this.onCloseClick() | ||
| 129 | + }) | ||
| 130 | + | ||
| 131 | + } | ||
| 132 | + .height(44) | ||
| 125 | .width('100%') | 133 | .width('100%') |
| 126 | - .justifyContent(FlexAlign.SpaceBetween); | 134 | + .justifyContent(FlexAlign.SpaceBetween) |
| 135 | + .onClick(() => { | ||
| 136 | + // this.allDatas.push(new commentItemModel()) | ||
| 137 | + // this.allDatas.addFirstItem(new commentItemModel()) | ||
| 138 | + // this.allDatas.reloadData(); | ||
| 139 | + }) | ||
| 140 | + | ||
| 127 | } | 141 | } |
| 128 | 142 | ||
| 129 | /*1级评论作为titleHeader*/ | 143 | /*1级评论作为titleHeader*/ |
| @@ -200,7 +214,7 @@ export struct CommentComponent { | @@ -200,7 +214,7 @@ export struct CommentComponent { | ||
| 200 | } | 214 | } |
| 201 | } | 215 | } |
| 202 | } | 216 | } |
| 203 | - .margin({bottom: 10}) | 217 | + .margin({ bottom: 10 }) |
| 204 | .onReachEnd(() => { | 218 | .onReachEnd(() => { |
| 205 | if (!this.fixedHeightMode) { | 219 | if (!this.fixedHeightMode) { |
| 206 | return | 220 | return |
| @@ -209,7 +223,8 @@ export struct CommentComponent { | @@ -209,7 +223,8 @@ export struct CommentComponent { | ||
| 209 | this.getData() | 223 | this.getData() |
| 210 | } | 224 | } |
| 211 | }) | 225 | }) |
| 212 | - .enableScrollInteraction(this.fixedHeightMode ? true: false) | 226 | + .enableScrollInteraction(this.fixedHeightMode ? true : false) |
| 227 | + | ||
| 213 | // .nestedScroll({ | 228 | // .nestedScroll({ |
| 214 | // scrollForward: NestedScrollMode.PARENT_FIRST, | 229 | // scrollForward: NestedScrollMode.PARENT_FIRST, |
| 215 | // scrollBackward: NestedScrollMode.SELF_FIRST | 230 | // scrollBackward: NestedScrollMode.SELF_FIRST |
| 1 | +import { CompDTO, ContentDTO, LiveRoomDataBean } from 'wdBean'; | ||
| 2 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 3 | +import { Logger } from 'wdKit/Index'; | ||
| 4 | +import { ProcessUtils } from 'wdRouter'; | ||
| 5 | +import PageViewModel from '../../viewmodel/PageViewModel'; | ||
| 6 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 7 | + | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 通用标题组件 | ||
| 11 | + * | ||
| 12 | + */ | ||
| 13 | +@Component | ||
| 14 | +export struct CompNormalTitle { | ||
| 15 | + @State compDTO: CompDTO = new CompDTO | ||
| 16 | + | ||
| 17 | + aboutToAppear() { | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + build() { | ||
| 21 | + Column() { | ||
| 22 | + Row() { | ||
| 23 | + Image($r("app.media.redLine")) | ||
| 24 | + .width(3) | ||
| 25 | + .height(16) | ||
| 26 | + .margin({ right: 4 }) | ||
| 27 | + Text(this.compDTO.objectTitle) | ||
| 28 | + .fontSize($r("app.float.font_size_17")) | ||
| 29 | + .fontColor($r("app.color.color_222222")) | ||
| 30 | + .fontWeight(600) | ||
| 31 | + } | ||
| 32 | + .justifyContent(FlexAlign.Start) | ||
| 33 | + .margin({ top: 16, bottom: 10 }) | ||
| 34 | + .width(CommonConstants.FULL_WIDTH) | ||
| 35 | + } | ||
| 36 | + .width(CommonConstants.FULL_WIDTH) | ||
| 37 | + .padding({ left: 16, right: 16 }) | ||
| 38 | + | ||
| 39 | + } | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | + |
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhGridLayout02.ets
deleted
100644 → 0
| 1 | -import { CompDTO, ContentDTO, LiveRoomDataBean } from 'wdBean'; | ||
| 2 | -import { CommonConstants } from 'wdConstant/Index'; | ||
| 3 | -import { Logger } from 'wdKit/Index'; | ||
| 4 | -import { ProcessUtils } from 'wdRouter'; | ||
| 5 | -import PageViewModel from '../../viewmodel/PageViewModel'; | ||
| 6 | -import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 7 | - | ||
| 8 | -const TAG = 'Zh_Grid_Layout-02'; | ||
| 9 | -const FULL_PARENT: string = '100%'; | ||
| 10 | -let listSize: number = 2; | ||
| 11 | - | ||
| 12 | -/** | ||
| 13 | - * 双图卡 | ||
| 14 | - * 枚举值Zh_Grid_Layout-02 | ||
| 15 | - * Zh_Grid_Layout-02 | ||
| 16 | - * | ||
| 17 | - */ | ||
| 18 | -@Component | ||
| 19 | -export struct ZhGridLayout02 { | ||
| 20 | - @State compDTO: CompDTO = {} as CompDTO | ||
| 21 | - @State operDataList: ContentDTO[] = [] | ||
| 22 | - @State loadImg: boolean = false; | ||
| 23 | - @State liveRoomList: LiveRoomDataBean[] = [] | ||
| 24 | - currentPage = 1 | ||
| 25 | - pageSize = 12 | ||
| 26 | - | ||
| 27 | - async aboutToAppear(): Promise<void> { | ||
| 28 | - Logger.debug(TAG, 'aboutToAppear ' + this.compDTO.objectTitle) | ||
| 29 | - this.currentPage = 1 | ||
| 30 | - PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => { | ||
| 31 | - this.operDataList = [] | ||
| 32 | - this.operDataList.push(...liveReviewDTO.list) | ||
| 33 | - this.getLiveRoomDataInfo(this.operDataList) | ||
| 34 | - }) | ||
| 35 | - | ||
| 36 | - this.loadImg = await onlyWifiLoadImg(); | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - build() { | ||
| 40 | - Column() { | ||
| 41 | - Scroll() { | ||
| 42 | - Column() { | ||
| 43 | - Row() { | ||
| 44 | - Image($r("app.media.redLine")) | ||
| 45 | - .width(3) | ||
| 46 | - .height(16) | ||
| 47 | - .margin({ right: 4 }) | ||
| 48 | - Text(this.compDTO.objectTitle) | ||
| 49 | - .fontSize($r("app.float.font_size_17")) | ||
| 50 | - .fontColor($r("app.color.color_222222")) | ||
| 51 | - .fontWeight(600) | ||
| 52 | - } | ||
| 53 | - .justifyContent(FlexAlign.Start) | ||
| 54 | - .margin({ top: 16, bottom: 8 }) | ||
| 55 | - .width(CommonConstants.FULL_WIDTH) | ||
| 56 | - | ||
| 57 | - GridRow({ | ||
| 58 | - gutter: { x: 12, y: 13 }, | ||
| 59 | - columns: { sm: listSize, md: 2 }, | ||
| 60 | - breakpoints: { value: ['320vp', '520vp', '840vp'] } | ||
| 61 | - }) { | ||
| 62 | - ForEach(this.operDataList, (item: ContentDTO, index: number) => { | ||
| 63 | - GridCol() { | ||
| 64 | - this.buildItemCard(item); | ||
| 65 | - } | ||
| 66 | - }) | ||
| 67 | - } | ||
| 68 | - } | ||
| 69 | - } | ||
| 70 | - .width("100%") | ||
| 71 | - .height("100%") | ||
| 72 | - // .layoutWeight(1) | ||
| 73 | - .edgeEffect(EdgeEffect.None) | ||
| 74 | - .scrollBar(BarState.Off) | ||
| 75 | - .onReachStart(() => { | ||
| 76 | - Logger.debug(TAG, 'onReachStart') | ||
| 77 | - }) | ||
| 78 | - .onReachEnd(() => { | ||
| 79 | - Logger.debug(TAG, 'onReachEnd') | ||
| 80 | - this.addItems() | ||
| 81 | - }) | ||
| 82 | - .nestedScroll({ | ||
| 83 | - scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 84 | - scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 85 | - }) | ||
| 86 | - } | ||
| 87 | - .width(CommonConstants.FULL_WIDTH) | ||
| 88 | - // .width("100%") | ||
| 89 | - .height("100%") | ||
| 90 | - .padding({ left: 16, right: 16 }) | ||
| 91 | - | ||
| 92 | - // .layoutWeight(1) | ||
| 93 | - | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | - /** | ||
| 97 | - * 组件项 | ||
| 98 | - * | ||
| 99 | - * @param programmeBean item 组件项, 上面icon,下面标题 | ||
| 100 | - */ | ||
| 101 | - @Builder | ||
| 102 | - buildItemCard(item: ContentDTO) { | ||
| 103 | - Column() { | ||
| 104 | - Stack({ alignContent: Alignment.BottomEnd }) { | ||
| 105 | - Image(this.loadImg ? item.fullColumnImgUrls[0].url : '') | ||
| 106 | - .backgroundColor(0xf5f5f5) | ||
| 107 | - .width('100%') | ||
| 108 | - .height(95) | ||
| 109 | - .borderRadius(4) | ||
| 110 | - if (this.getLiveRoomNumber(item).length > 0) { | ||
| 111 | - Text(this.getLiveRoomNumber(item)) | ||
| 112 | - .fontSize('11vp') | ||
| 113 | - .fontWeight(400) | ||
| 114 | - .fontColor(Color.White) | ||
| 115 | - .margin({ | ||
| 116 | - right: '5vp', | ||
| 117 | - bottom: '5vp' | ||
| 118 | - }) | ||
| 119 | - } | ||
| 120 | - } | ||
| 121 | - | ||
| 122 | - Text(item.newsTitle) | ||
| 123 | - .margin({top:'6'}) | ||
| 124 | - .fontSize(13) | ||
| 125 | - .maxLines(2) | ||
| 126 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 127 | - } | ||
| 128 | - .width('100%') | ||
| 129 | - .onClick(() => { | ||
| 130 | - ProcessUtils.processPage(item) | ||
| 131 | - }) | ||
| 132 | - } | ||
| 133 | - | ||
| 134 | - // 获取评论数 | ||
| 135 | - async getLiveRoomDataInfo(list: ContentDTO[]) { | ||
| 136 | - const reserveIds = this.getLiveDetailIds(list) | ||
| 137 | - PageViewModel.getLiveRoomBatchInfo(reserveIds).then((result) => { | ||
| 138 | - if (result && result.length > 0) { | ||
| 139 | - this.liveRoomList.push(...result) | ||
| 140 | - } | ||
| 141 | - }).catch(() => { | ||
| 142 | - }) | ||
| 143 | - } | ||
| 144 | - | ||
| 145 | - // 判断是否预约 | ||
| 146 | - getLiveRoomNumber(item: ContentDTO): string { | ||
| 147 | - const objc = this.liveRoomList.find((element: LiveRoomDataBean) => { | ||
| 148 | - return element.liveId.toString() == item.objectId | ||
| 149 | - }) | ||
| 150 | - if (objc && objc.pv && objc.pv > 0) { | ||
| 151 | - return this.computeShowNum(objc.pv) | ||
| 152 | - } | ||
| 153 | - return '' | ||
| 154 | - } | ||
| 155 | - | ||
| 156 | - addItems() { | ||
| 157 | - Logger.debug(TAG, 'addItems') | ||
| 158 | - this.currentPage++ | ||
| 159 | - PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => { | ||
| 160 | - this.operDataList.push(...liveReviewDTO.list) | ||
| 161 | - this.getLiveRoomDataInfo(this.operDataList) | ||
| 162 | - Logger.debug(TAG, 'addItems after: ' + this.operDataList.length) | ||
| 163 | - }) | ||
| 164 | - } | ||
| 165 | - | ||
| 166 | - private getLiveDetailIds(list: ContentDTO[]): string { | ||
| 167 | - let idList: string[] = [] | ||
| 168 | - list.forEach(item => { | ||
| 169 | - idList.push(item.objectId) | ||
| 170 | - }); | ||
| 171 | - return idList.join(',') | ||
| 172 | - } | ||
| 173 | - | ||
| 174 | - private computeShowNum(count: number): string { | ||
| 175 | - if (count >= 10000) { | ||
| 176 | - let num = (count / 10000).toFixed(1) | ||
| 177 | - if (Number(num.substring(num.length - 1)) == 0) { | ||
| 178 | - num = num.substring(0, num.length - 2) | ||
| 179 | - } | ||
| 180 | - return num + '万人参加' | ||
| 181 | - } | ||
| 182 | - return `${count}人参加` | ||
| 183 | - } | ||
| 184 | -} | ||
| 185 | - | ||
| 186 | - |
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhGridLayout02NewsContent.ets
0 → 100644
| 1 | +import { CompDTO, ContentDTO, LiveRoomDataBean } from 'wdBean'; | ||
| 2 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 3 | +import { Logger } from 'wdKit/Index'; | ||
| 4 | +import { ProcessUtils } from 'wdRouter'; | ||
| 5 | +import PageViewModel from '../../viewmodel/PageViewModel'; | ||
| 6 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 7 | + | ||
| 8 | +let listSize: number = 2; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 双图卡 的标题组件 | ||
| 12 | + * | ||
| 13 | + */ | ||
| 14 | +@Component | ||
| 15 | +export struct ZhGridLayout02NewsContent { | ||
| 16 | + @ObjectLink compDTO: CompDTO | ||
| 17 | + @State operDataList: ContentDTO[] = [] | ||
| 18 | + @State loadImg: boolean = false; | ||
| 19 | + | ||
| 20 | + async aboutToAppear(): Promise<void> { | ||
| 21 | + | ||
| 22 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + build() { | ||
| 26 | + | ||
| 27 | + GridRow({ | ||
| 28 | + gutter: { x: 9, y: 0 }, | ||
| 29 | + columns: { sm: listSize, md: listSize }, | ||
| 30 | + breakpoints: { value: ['320vp', '520vp', '840vp'] } | ||
| 31 | + }) { | ||
| 32 | + ForEach(this.operDataList, (item: ContentDTO, index: number) => { | ||
| 33 | + GridCol() { | ||
| 34 | + this.buildItemCard(item, index); | ||
| 35 | + } | ||
| 36 | + }) | ||
| 37 | + }.width("100%").padding({ left: 16, right: 16 }) | ||
| 38 | + | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + @Builder | ||
| 42 | + buildItemCard(item: ContentDTO, index: number) { | ||
| 43 | + Column() { | ||
| 44 | + Stack({ alignContent: Alignment.BottomEnd }) { | ||
| 45 | + Image(this.loadImg ? item.fullColumnImgUrls[0].url : '') | ||
| 46 | + .backgroundColor(0xf5f5f5) | ||
| 47 | + .width('100%') | ||
| 48 | + .height(95) | ||
| 49 | + .borderWidth(0.5) | ||
| 50 | + .borderColor($r('app.color.color_0D000000')) | ||
| 51 | + .borderRadius(4) | ||
| 52 | + if (this.compDTO.operDataList[index].liveRoomDataBean != undefined | ||
| 53 | + && this.compDTO.operDataList[index].liveRoomDataBean?.pv != undefined) { | ||
| 54 | + Text(this.computeShowNum(this.compDTO.operDataList[index].liveRoomDataBean)) | ||
| 55 | + .fontSize(12) | ||
| 56 | + .fontWeight(400) | ||
| 57 | + .fontColor(Color.White) | ||
| 58 | + .textShadow({ radius: 2, color: 'rgba(0,0,0,0.3)', offsetX: 0, offsetY: 2 }) | ||
| 59 | + .margin({ | ||
| 60 | + right: '5vp', | ||
| 61 | + bottom: '5vp' | ||
| 62 | + }) | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + Text(item.newsTitle) | ||
| 67 | + .margin({ top: 8, bottom: 14 }) | ||
| 68 | + .fontSize(15) | ||
| 69 | + .maxLines(2) | ||
| 70 | + .lineHeight(21) | ||
| 71 | + .width('100%') | ||
| 72 | + .textAlign(TextAlign.Start) | ||
| 73 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 74 | + } | ||
| 75 | + .width('100%') | ||
| 76 | + .onClick(() => { | ||
| 77 | + ProcessUtils.processPage(item) | ||
| 78 | + }) | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + private computeShowNum(bean: LiveRoomDataBean): string { | ||
| 82 | + let count = bean.pv | ||
| 83 | + if (count >= 10000) { | ||
| 84 | + let num = (count / 10000).toFixed(1) | ||
| 85 | + if (Number(num.substring(num.length - 1)) == 0) { | ||
| 86 | + num = num.substring(0, num.length - 2) | ||
| 87 | + } | ||
| 88 | + return num + '万人参加' | ||
| 89 | + } | ||
| 90 | + return `${count}人参加` | ||
| 91 | + } | ||
| 92 | +} | ||
| 93 | + | ||
| 94 | + |
| @@ -17,10 +17,10 @@ export struct ZhSingleRow04 { | @@ -17,10 +17,10 @@ export struct ZhSingleRow04 { | ||
| 17 | //顶部 | 17 | //顶部 |
| 18 | Row() { | 18 | Row() { |
| 19 | Row() { | 19 | Row() { |
| 20 | - Image($r("app.media.local_selection")) | ||
| 21 | - .width(24) | ||
| 22 | - .height(24) | ||
| 23 | - .margin({ right: 4 }) | 20 | + // Image($r("app.media.local_selection")) |
| 21 | + // .width(24) | ||
| 22 | + // .height(24) | ||
| 23 | + // .margin({ right: 4 }) | ||
| 24 | Text(this.compDTO.objectTitle) | 24 | Text(this.compDTO.objectTitle) |
| 25 | .fontSize($r("app.float.font_size_17")) | 25 | .fontSize($r("app.float.font_size_17")) |
| 26 | .fontColor($r("app.color.color_222222")) | 26 | .fontColor($r("app.color.color_222222")) |
| @@ -36,7 +36,8 @@ export struct ZhSingleRow04 { | @@ -36,7 +36,8 @@ export struct ZhSingleRow04 { | ||
| 36 | .width(14) | 36 | .width(14) |
| 37 | .height(14) | 37 | .height(14) |
| 38 | } | 38 | } |
| 39 | - .visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible) | 39 | + .visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : |
| 40 | + Visibility.Visible) | ||
| 40 | .onClick(() => { | 41 | .onClick(() => { |
| 41 | if (this.compDTO?.objectType === '11') { | 42 | if (this.compDTO?.objectType === '11') { |
| 42 | ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle) | 43 | ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle) |
| @@ -64,9 +65,11 @@ export struct ZhSingleRow04 { | @@ -64,9 +65,11 @@ export struct ZhSingleRow04 { | ||
| 64 | operDataListItem: item | 65 | operDataListItem: item |
| 65 | } | 66 | } |
| 66 | ) | 67 | ) |
| 67 | - .margin({right: index === this.compDTO.operDataList.length - 1 ? 26 : 0, left: | ||
| 68 | - index === 0 ? $r('app.float.card_comp_pagePadding_lf') : 0, | ||
| 69 | - top: 6}) | 68 | + .margin({ |
| 69 | + right: index === this.compDTO.operDataList.length - 1 ? 26 : 0, left: | ||
| 70 | + index === 0 ? $r('app.float.card_comp_pagePadding_lf') : 0, | ||
| 71 | + top: 6 | ||
| 72 | + }) | ||
| 70 | .onClick(() => { | 73 | .onClick(() => { |
| 71 | ProcessUtils.processPage(item) | 74 | ProcessUtils.processPage(item) |
| 72 | }) | 75 | }) |
| @@ -106,8 +109,7 @@ struct localCard { | @@ -106,8 +109,7 @@ struct localCard { | ||
| 106 | .align(Alignment.TopStart) | 109 | .align(Alignment.TopStart) |
| 107 | .maxLines(3) | 110 | .maxLines(3) |
| 108 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 111 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 109 | - .lineHeight(20) | ||
| 110 | - .margin({bottom: 17}) | 112 | + .lineHeight(25) |
| 111 | .fontWeight(500) | 113 | .fontWeight(500) |
| 112 | Row() { | 114 | Row() { |
| 113 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.operDataListItem.publishTime))) | 115 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.operDataListItem.publishTime))) |
| @@ -115,7 +117,7 @@ struct localCard { | @@ -115,7 +117,7 @@ struct localCard { | ||
| 115 | .fontColor($r("app.color.color_B0B0B0")) | 117 | .fontColor($r("app.color.color_B0B0B0")) |
| 116 | .margin({ right: 5 }) | 118 | .margin({ right: 5 }) |
| 117 | // 这里需要外部查询评论接口后,写入字段 | 119 | // 这里需要外部查询评论接口后,写入字段 |
| 118 | - if(this.operDataListItem.interactData?.commentNum) { | 120 | + if (this.operDataListItem.interactData?.commentNum) { |
| 119 | Text(`${this.operDataListItem.interactData?.commentNum}评`) | 121 | Text(`${this.operDataListItem.interactData?.commentNum}评`) |
| 120 | .fontSize(12) | 122 | .fontSize(12) |
| 121 | } | 123 | } |
| @@ -139,7 +141,12 @@ struct localCard { | @@ -139,7 +141,12 @@ struct localCard { | ||
| 139 | .border({ | 141 | .border({ |
| 140 | radius: 2, | 142 | radius: 2, |
| 141 | }) | 143 | }) |
| 142 | - .shadow({ radius: 6, color: '#1A000000', offsetX: 3, offsetY: 0 }) | 144 | + .shadow({ |
| 145 | + radius: 6, | ||
| 146 | + color: '#1A000000', | ||
| 147 | + offsetX: 0, | ||
| 148 | + offsetY: 3 | ||
| 149 | + }) // 设置下方阴影 | ||
| 143 | .margin({ | 150 | .margin({ |
| 144 | right: 10 | 151 | right: 10 |
| 145 | }) | 152 | }) |
| @@ -30,6 +30,7 @@ export struct ZhSingleRow06 { | @@ -30,6 +30,7 @@ export struct ZhSingleRow06 { | ||
| 30 | this.loadImg = await onlyWifiLoadImg(); | 30 | this.loadImg = await onlyWifiLoadImg(); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | + | ||
| 33 | /** | 34 | /** |
| 34 | * 点赞、取消点赞 | 35 | * 点赞、取消点赞 |
| 35 | */ | 36 | */ |
| @@ -43,7 +44,7 @@ export struct ZhSingleRow06 { | @@ -43,7 +44,7 @@ export struct ZhSingleRow06 { | ||
| 43 | 44 | ||
| 44 | const commentInfo = this.compDTO.operDataList[0]?.commentInfo as commentInfo; | 45 | const commentInfo = this.compDTO.operDataList[0]?.commentInfo as commentInfo; |
| 45 | // commentLikeChange(this.item) | 46 | // commentLikeChange(this.item) |
| 46 | - this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1'; | 47 | + // this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1'; |
| 47 | const commentLikeParam = { | 48 | const commentLikeParam = { |
| 48 | targetId: commentInfo.newsId || '', | 49 | targetId: commentInfo.newsId || '', |
| 49 | id: commentInfo.commentId, | 50 | id: commentInfo.commentId, |
| @@ -51,8 +52,9 @@ export struct ZhSingleRow06 { | @@ -51,8 +52,9 @@ export struct ZhSingleRow06 { | ||
| 51 | api_status: this.newsStatusOfUser?.likeStatus == '1' ? false : true | 52 | api_status: this.newsStatusOfUser?.likeStatus == '1' ? false : true |
| 52 | } as commentItemModel; | 53 | } as commentItemModel; |
| 53 | commentViewModel.commentLike(commentLikeParam).then(() => { | 54 | commentViewModel.commentLike(commentLikeParam).then(() => { |
| 54 | - }).catch(() => { | ||
| 55 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1'; | 55 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1'; |
| 56 | + }).catch((err: Error) => { | ||
| 57 | + console.log('06-err', JSON.stringify(err)) | ||
| 56 | }) | 58 | }) |
| 57 | } | 59 | } |
| 58 | 60 | ||
| @@ -168,7 +170,7 @@ export struct ZhSingleRow06 { | @@ -168,7 +170,7 @@ export struct ZhSingleRow06 { | ||
| 168 | ? item.operDataList[0]?.commentInfo?.userHeaderUrl | 170 | ? item.operDataList[0]?.commentInfo?.userHeaderUrl |
| 169 | ? item.operDataList[0].commentInfo.userHeaderUrl | 171 | ? item.operDataList[0].commentInfo.userHeaderUrl |
| 170 | : $r('app.media.default_head') | 172 | : $r('app.media.default_head') |
| 171 | - : $r('app.media.comment_rmh_tag')) | 173 | + : $r('app.media.icon_default_head_mater')) |
| 172 | .width(32) | 174 | .width(32) |
| 173 | .height(32) | 175 | .height(32) |
| 174 | .borderRadius(16) | 176 | .borderRadius(16) |
| @@ -5,6 +5,8 @@ import { MineAppointmentItem } from '../../../viewmodel/MineAppointmentItem'; | @@ -5,6 +5,8 @@ import { MineAppointmentItem } from '../../../viewmodel/MineAppointmentItem'; | ||
| 5 | import { LazyDataSource, StringUtils } from 'wdKit'; | 5 | import { LazyDataSource, StringUtils } from 'wdKit'; |
| 6 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 6 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 7 | import { EmptyComponent } from '../../view/EmptyComponent'; | 7 | import { EmptyComponent } from '../../view/EmptyComponent'; |
| 8 | +import { Action } from 'wdBean/Index'; | ||
| 9 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 8 | 10 | ||
| 9 | const TAG = "AppointmentListUI" | 11 | const TAG = "AppointmentListUI" |
| 10 | 12 | ||
| @@ -42,6 +44,17 @@ export struct AppointmentListUI { | @@ -42,6 +44,17 @@ export struct AppointmentListUI { | ||
| 42 | } | 44 | } |
| 43 | .onClick(() => { | 45 | .onClick(() => { |
| 44 | //TODO 跳转 | 46 | //TODO 跳转 |
| 47 | + let action = { | ||
| 48 | + type:"2", | ||
| 49 | + params:{ | ||
| 50 | + extra:{ | ||
| 51 | + relId:item.relId, | ||
| 52 | + relType:item.relType.toString() | ||
| 53 | + }, | ||
| 54 | + contentID:item.liveId.toString() | ||
| 55 | + } | ||
| 56 | + } as Action | ||
| 57 | + WDRouterRule.jumpWithPage(WDRouterPage.detailPlayLiveCommon, action) | ||
| 45 | }) | 58 | }) |
| 46 | }, (item: MineAppointmentItem, index: number) => index.toString()) | 59 | }, (item: MineAppointmentItem, index: number) => index.toString()) |
| 47 | 60 |
| @@ -34,7 +34,7 @@ export struct ChildCommentComponent { | @@ -34,7 +34,7 @@ export struct ChildCommentComponent { | ||
| 34 | .borderRadius(50) | 34 | .borderRadius(50) |
| 35 | }.width('89lpx') | 35 | }.width('89lpx') |
| 36 | .height('89lpx') | 36 | .height('89lpx') |
| 37 | - .margin({ right: '15lpx' }) | 37 | + .margin({ right: '3lpx' }) |
| 38 | 38 | ||
| 39 | Column() { | 39 | Column() { |
| 40 | Text(this.data.fromUserName) | 40 | Text(this.data.fromUserName) |
| @@ -45,10 +45,11 @@ struct EditUserIntroductionPage { | @@ -45,10 +45,11 @@ struct EditUserIntroductionPage { | ||
| 45 | Divider() | 45 | Divider() |
| 46 | .margin(20) | 46 | .margin(20) |
| 47 | 47 | ||
| 48 | - Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多60个字,只能输入中文、数字、英文字母。') | ||
| 49 | - .fontSize(13) | ||
| 50 | - .padding(12) | ||
| 51 | - .fontColor(Color.Gray).lineHeight(25) | 48 | + Row(){ |
| 49 | + Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多16个字,只能输入中文、数字、英文字母。') | ||
| 50 | + .fontSize(13) | ||
| 51 | + .fontColor(Color.Gray).lineHeight(25) | ||
| 52 | + }.padding({left:16}).width('100%') | ||
| 52 | 53 | ||
| 53 | Button('保存') | 54 | Button('保存') |
| 54 | .type(ButtonType.Normal) | 55 | .type(ButtonType.Normal) |
| @@ -47,10 +47,12 @@ struct EditUserNikeNamePage { | @@ -47,10 +47,12 @@ struct EditUserNikeNamePage { | ||
| 47 | Divider() | 47 | Divider() |
| 48 | .margin(20) | 48 | .margin(20) |
| 49 | 49 | ||
| 50 | - Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多16个字,只能输入中文、数字、英文字母。') | ||
| 51 | - .fontSize(13) | ||
| 52 | - .padding(12) | ||
| 53 | - .fontColor(Color.Gray).lineHeight(25) | 50 | + Row(){ |
| 51 | + Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多16个字,只能输入中文、数字、英文字母。') | ||
| 52 | + .fontSize(13) | ||
| 53 | + .fontColor(Color.Gray).lineHeight(25) | ||
| 54 | + }.padding({left:16}).width('100%') | ||
| 55 | + | ||
| 54 | 56 | ||
| 55 | Button('保存') | 57 | Button('保存') |
| 56 | .type(ButtonType.Normal) | 58 | .type(ButtonType.Normal) |
| @@ -69,7 +69,15 @@ struct InteractMessagePage { | @@ -69,7 +69,15 @@ struct InteractMessagePage { | ||
| 69 | // 下拉刷新 | 69 | // 下拉刷新 |
| 70 | ForEach(this.allDatas, (InteractM: InteractMessageModel, compIndex: number) => { | 70 | ForEach(this.allDatas, (InteractM: InteractMessageModel, compIndex: number) => { |
| 71 | ListItem() { | 71 | ListItem() { |
| 72 | - InteractMComponent({messageModel:InteractM}) | 72 | + Column(){ |
| 73 | + InteractMComponent({messageModel:InteractM}) | ||
| 74 | + | ||
| 75 | + Divider() | ||
| 76 | + .color('#f5f5f5') | ||
| 77 | + .width('100%') | ||
| 78 | + .strokeWidth(1) | ||
| 79 | + .padding({left:16,right:16,top:16}) | ||
| 80 | + } | ||
| 73 | } | 81 | } |
| 74 | }) | 82 | }) |
| 75 | // 加载更多 | 83 | // 加载更多 |
| 1 | import { ContentDTO, LiveRoomDataBean } from 'wdBean'; | 1 | import { ContentDTO, LiveRoomDataBean } from 'wdBean'; |
| 2 | import { ProcessUtils } from 'wdRouter'; | 2 | import { ProcessUtils } from 'wdRouter'; |
| 3 | -import { CommonConstants } from 'wdConstant/Index'; | ||
| 4 | import PageViewModel from '../../viewmodel/PageViewModel'; | 3 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 5 | import { DateTimeUtils, LazyDataSource, Logger } from 'wdKit/Index'; | 4 | import { DateTimeUtils, LazyDataSource, Logger } from 'wdKit/Index'; |
| 6 | import { router } from '@kit.ArkUI'; | 5 | import { router } from '@kit.ArkUI'; |
| @@ -9,11 +8,16 @@ import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | @@ -9,11 +8,16 @@ import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | ||
| 9 | import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; | 8 | import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; |
| 10 | import { EmptyComponent } from '../view/EmptyComponent'; | 9 | import { EmptyComponent } from '../view/EmptyComponent'; |
| 11 | import { ErrorComponent } from '../view/ErrorComponent'; | 10 | import { ErrorComponent } from '../view/ErrorComponent'; |
| 12 | -import LoadMoreLayout from '../page/LoadMoreLayout' | ||
| 13 | -import { LottieView } from '../../components/lottie/LottieView' | 11 | +import LoadMoreLayout from '../page/LoadMoreLayout'; |
| 12 | +import { LottieView } from '../../components/lottie/LottieView'; | ||
| 13 | +import dataPreferences from '@ohos.data.preferences'; | ||
| 14 | +import { BusinessError } from '@ohos.base'; | ||
| 14 | 15 | ||
| 15 | const TAG: string = 'LiveMorePage'; | 16 | const TAG: string = 'LiveMorePage'; |
| 16 | 17 | ||
| 18 | +const PREFERENCES_NAME = 'rmrLiveMorePage.db' | ||
| 19 | +let preferenceTheme: dataPreferences.Preferences | null = null | ||
| 20 | + | ||
| 17 | /** | 21 | /** |
| 18 | * 直播更多: | 22 | * 直播更多: |
| 19 | * type=1 直播 | 23 | * type=1 直播 |
| @@ -38,7 +42,13 @@ struct LiveMorePage { | @@ -38,7 +42,13 @@ struct LiveMorePage { | ||
| 38 | @State viewType: ViewType = ViewType.LOADING | 42 | @State viewType: ViewType = ViewType.LOADING |
| 39 | private scroller: Scroller = new Scroller() | 43 | private scroller: Scroller = new Scroller() |
| 40 | @State liveRoomList: LiveRoomDataBean[] = [] | 44 | @State liveRoomList: LiveRoomDataBean[] = [] |
| 41 | - aboutToAppear(): void { | 45 | + // 点击过的数据 |
| 46 | + @State clickDatas: Array<string> = [] | ||
| 47 | + | ||
| 48 | + async aboutToAppear() { | ||
| 49 | + await this.getPreferencesFromStorage() | ||
| 50 | + this.getLivMoreClickPreference() | ||
| 51 | + Logger.debug(TAG, '数据:' + JSON.stringify(this.clickDatas)) | ||
| 42 | this.currentPage = 1 | 52 | this.currentPage = 1 |
| 43 | this.getData() | 53 | this.getData() |
| 44 | } | 54 | } |
| @@ -94,10 +104,9 @@ struct LiveMorePage { | @@ -94,10 +104,9 @@ struct LiveMorePage { | ||
| 94 | LoadingLayout() { | 104 | LoadingLayout() { |
| 95 | } | 105 | } |
| 96 | 106 | ||
| 97 | - | ||
| 98 | @Builder | 107 | @Builder |
| 99 | ListLayout() { | 108 | ListLayout() { |
| 100 | - List({scroller: this.scroller}) { | 109 | + List({ scroller: this.scroller }) { |
| 101 | // 下拉刷新 | 110 | // 下拉刷新 |
| 102 | LazyForEach(this.data, (contentDTO: ContentDTO) => { | 111 | LazyForEach(this.data, (contentDTO: ContentDTO) => { |
| 103 | ListItem() { | 112 | ListItem() { |
| @@ -121,7 +130,7 @@ struct LiveMorePage { | @@ -121,7 +130,7 @@ struct LiveMorePage { | ||
| 121 | .height('calc(100% - 44vp)') | 130 | .height('calc(100% - 44vp)') |
| 122 | .onReachEnd(() => { | 131 | .onReachEnd(() => { |
| 123 | Logger.debug(TAG, "触底了"); | 132 | Logger.debug(TAG, "触底了"); |
| 124 | - if(!this.isLoading && this.hasMore){ | 133 | + if (!this.isLoading && this.hasMore) { |
| 125 | //加载分页数据 | 134 | //加载分页数据 |
| 126 | this.currentPage++; | 135 | this.currentPage++; |
| 127 | this.getData() | 136 | this.getData() |
| @@ -138,11 +147,12 @@ struct LiveMorePage { | @@ -138,11 +147,12 @@ struct LiveMorePage { | ||
| 138 | buildItem(item: ContentDTO) { | 147 | buildItem(item: ContentDTO) { |
| 139 | Column() { | 148 | Column() { |
| 140 | Text(item.newsTitle) | 149 | Text(item.newsTitle) |
| 141 | - .fontSize(17) | 150 | + .fontSize(18) |
| 142 | .maxLines(2) | 151 | .maxLines(2) |
| 143 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 152 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 144 | .margin({ top: 16, bottom: 8 }) | 153 | .margin({ top: 16, bottom: 8 }) |
| 145 | .alignSelf(ItemAlign.Start) | 154 | .alignSelf(ItemAlign.Start) |
| 155 | + .fontColor(this.isClicked(item.objectId) ? $r('app.color.color_848484') : $r('app.color.color_222222')) | ||
| 146 | Stack() { | 156 | Stack() { |
| 147 | if (item.fullColumnImgUrls && item.fullColumnImgUrls.length > 0) { | 157 | if (item.fullColumnImgUrls && item.fullColumnImgUrls.length > 0) { |
| 148 | Image(item.fullColumnImgUrls[0].url) | 158 | Image(item.fullColumnImgUrls[0].url) |
| @@ -192,6 +202,7 @@ struct LiveMorePage { | @@ -192,6 +202,7 @@ struct LiveMorePage { | ||
| 192 | } | 202 | } |
| 193 | .width('100%') | 203 | .width('100%') |
| 194 | .onClick(() => { | 204 | .onClick(() => { |
| 205 | + this.clickRowBuildItem(item) | ||
| 195 | ProcessUtils.processPage(item) | 206 | ProcessUtils.processPage(item) |
| 196 | }) | 207 | }) |
| 197 | } | 208 | } |
| @@ -293,14 +304,14 @@ struct LiveMorePage { | @@ -293,14 +304,14 @@ struct LiveMorePage { | ||
| 293 | } | 304 | } |
| 294 | this.data.push(...liveReviewDTO.list) | 305 | this.data.push(...liveReviewDTO.list) |
| 295 | this.getLiveRoomDataInfo(liveReviewDTO.list) | 306 | this.getLiveRoomDataInfo(liveReviewDTO.list) |
| 296 | - } else { | 307 | + } else { |
| 297 | this.hasMore = false; | 308 | this.hasMore = false; |
| 298 | } | 309 | } |
| 299 | this.resolveEnd(true, resolve) | 310 | this.resolveEnd(true, resolve) |
| 300 | if (liveReviewDTO.list.length == 0 && this.currentPage == 1) { | 311 | if (liveReviewDTO.list.length == 0 && this.currentPage == 1) { |
| 301 | this.viewType = ViewType.EMPTY | 312 | this.viewType = ViewType.EMPTY |
| 302 | } | 313 | } |
| 303 | - }catch (exception) { | 314 | + } catch (exception) { |
| 304 | this.resolveEnd(false, resolve) | 315 | this.resolveEnd(false, resolve) |
| 305 | } | 316 | } |
| 306 | // PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => { | 317 | // PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => { |
| @@ -316,7 +327,7 @@ struct LiveMorePage { | @@ -316,7 +327,7 @@ struct LiveMorePage { | ||
| 316 | if (resolve) { | 327 | if (resolve) { |
| 317 | if (this.currentPage == 1 && isTop) { | 328 | if (this.currentPage == 1 && isTop) { |
| 318 | resolve('已更新至最新') | 329 | resolve('已更新至最新') |
| 319 | - }else { | 330 | + } else { |
| 320 | resolve('') | 331 | resolve('') |
| 321 | } | 332 | } |
| 322 | } | 333 | } |
| @@ -335,23 +346,24 @@ struct LiveMorePage { | @@ -335,23 +346,24 @@ struct LiveMorePage { | ||
| 335 | }); | 346 | }); |
| 336 | return idList.join(',') | 347 | return idList.join(',') |
| 337 | } | 348 | } |
| 349 | + | ||
| 338 | // 获取评论数 | 350 | // 获取评论数 |
| 339 | async getLiveRoomDataInfo(list: ContentDTO[]) { | 351 | async getLiveRoomDataInfo(list: ContentDTO[]) { |
| 340 | const reserveIds = this.getLiveDetailIds(list) | 352 | const reserveIds = this.getLiveDetailIds(list) |
| 341 | - Logger.debug(TAG,'是否预约数据:' +` ${reserveIds}`) | 353 | + Logger.debug(TAG, '是否预约数据:' + ` ${reserveIds}`) |
| 342 | PageViewModel.getLiveRoomBatchInfo(reserveIds).then((result) => { | 354 | PageViewModel.getLiveRoomBatchInfo(reserveIds).then((result) => { |
| 343 | - Logger.debug(TAG,'是否预约数据:' +` ${JSON.stringify(result)}`) | 355 | + Logger.debug(TAG, '是否预约数据:' + ` ${JSON.stringify(result)}`) |
| 344 | if (result && result.length > 0) { | 356 | if (result && result.length > 0) { |
| 345 | this.liveRoomList.push(...result) | 357 | this.liveRoomList.push(...result) |
| 346 | this.data.reloadData() | 358 | this.data.reloadData() |
| 347 | } | 359 | } |
| 348 | - }).catch(() =>{ | 360 | + }).catch(() => { |
| 349 | // this.data.push(...list) | 361 | // this.data.push(...list) |
| 350 | }) | 362 | }) |
| 351 | } | 363 | } |
| 352 | 364 | ||
| 353 | // 判断是否预约 | 365 | // 判断是否预约 |
| 354 | - getLiveRoomNumber(item: ContentDTO): string { | 366 | + getLiveRoomNumber(item: ContentDTO): string { |
| 355 | const objc = this.liveRoomList.find((element: LiveRoomDataBean) => { | 367 | const objc = this.liveRoomList.find((element: LiveRoomDataBean) => { |
| 356 | return element.liveId.toString() == item.objectId | 368 | return element.liveId.toString() == item.objectId |
| 357 | }) | 369 | }) |
| @@ -363,14 +375,64 @@ struct LiveMorePage { | @@ -363,14 +375,64 @@ struct LiveMorePage { | ||
| 363 | 375 | ||
| 364 | private computeShowNum(count: number): string { | 376 | private computeShowNum(count: number): string { |
| 365 | if (count >= 10000) { | 377 | if (count >= 10000) { |
| 366 | - let num = ( count / 10000).toFixed(1) | ||
| 367 | - if (Number(num.substring(num.length-1)) == 0) { | ||
| 368 | - num = num.substring(0, num.length-2) | 378 | + let num = (count / 10000).toFixed(1) |
| 379 | + if (Number(num.substring(num.length - 1)) == 0) { | ||
| 380 | + num = num.substring(0, num.length - 2) | ||
| 369 | } | 381 | } |
| 370 | return num + '万人参加' | 382 | return num + '万人参加' |
| 371 | } | 383 | } |
| 372 | return `${count}人参加` | 384 | return `${count}人参加` |
| 373 | } | 385 | } |
| 374 | 386 | ||
| 387 | + isClicked(objectId: string) { | ||
| 388 | + return this.clickDatas.includes(objectId) | ||
| 389 | + } | ||
| 390 | + | ||
| 391 | + clickRowBuildItem(item: ContentDTO) { | ||
| 392 | + if (item.objectId && !this.clickDatas.includes(item.objectId)) { | ||
| 393 | + Logger.debug(TAG, '数据:' + JSON.stringify(this.clickDatas)) | ||
| 394 | + this.clickDatas.push(item.objectId.toString()) | ||
| 395 | + this.putLiveMoreClickPreference() | ||
| 396 | + } | ||
| 397 | + } | ||
| 398 | + | ||
| 399 | + async getPreferencesFromStorage() { | ||
| 400 | + let context = getContext(this) as Context | ||
| 401 | + preferenceTheme = await dataPreferences.getPreferences(context, PREFERENCES_NAME) | ||
| 402 | + } | ||
| 375 | 403 | ||
| 404 | + putLiveMoreClickPreference() { | ||
| 405 | + Logger.info(TAG, `Put begin` + JSON.stringify(this.clickDatas)) | ||
| 406 | + if (preferenceTheme !== null && this.clickDatas.length > 0) { | ||
| 407 | + // await | ||
| 408 | + const arr: Array<string> = [] | ||
| 409 | + arr.push(...this.clickDatas) | ||
| 410 | + preferenceTheme.put('liveMorePage', arr).then(() => { | ||
| 411 | + Logger.debug(TAG,"Succeeded in putting value of 'startup'."); | ||
| 412 | + }).catch((err: BusinessError) => { | ||
| 413 | + Logger.debug(TAG, "Failed to put value of 'startup'. code =" + err.code + ", message =" + err.message); | ||
| 414 | + }) | ||
| 415 | + // await preferenceTheme.flush() | ||
| 416 | + preferenceTheme.flush((err: BusinessError) => { | ||
| 417 | + if (err) { | ||
| 418 | + Logger.debug(TAG, "Failed to flush. code =" + err.code + ", message =" + err.message); | ||
| 419 | + return; | ||
| 420 | + } | ||
| 421 | + }) | ||
| 422 | + | ||
| 423 | + } | ||
| 424 | + } | ||
| 425 | + | ||
| 426 | + getLivMoreClickPreference() { | ||
| 427 | + Logger.info(TAG, `Get begin`) | ||
| 428 | + if (preferenceTheme !== null) { | ||
| 429 | + preferenceTheme.get('liveMorePage', []).then((data: dataPreferences.ValueType) => { | ||
| 430 | + if (data instanceof Array) { | ||
| 431 | + this.clickDatas = data as Array<string> | ||
| 432 | + } | ||
| 433 | + }).catch((err: BusinessError) => { | ||
| 434 | + console.error("Failed to get value of 'startup'. code =" + err.code + ", message =" + err.message); | ||
| 435 | + }) | ||
| 436 | + } | ||
| 437 | + } | ||
| 376 | } | 438 | } |
| @@ -20,6 +20,7 @@ struct MyCollectionListPage { | @@ -20,6 +20,7 @@ struct MyCollectionListPage { | ||
| 20 | @State private browSingModel: PageModel = new PageModel() | 20 | @State private browSingModel: PageModel = new PageModel() |
| 21 | isloading : boolean = false | 21 | isloading : boolean = false |
| 22 | @Provide isEditState:boolean = false | 22 | @Provide isEditState:boolean = false |
| 23 | + @State isDisplayButton:boolean = false | ||
| 23 | @State allDatas :ContentDTO[] = []; | 24 | @State allDatas :ContentDTO[] = []; |
| 24 | @State selectDatas :ContentDTO[] = []; | 25 | @State selectDatas :ContentDTO[] = []; |
| 25 | @Provide deleteNum :number = 0; | 26 | @Provide deleteNum :number = 0; |
| @@ -48,7 +49,7 @@ struct MyCollectionListPage { | @@ -48,7 +49,7 @@ struct MyCollectionListPage { | ||
| 48 | 49 | ||
| 49 | build() { | 50 | build() { |
| 50 | Column(){ | 51 | Column(){ |
| 51 | - CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:this.browSingModel.viewType == ViewType.ERROR || this.browSingModel.viewType == ViewType.EMPTY?false:true,editCallback:()=>{ | 52 | + CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:this.isDisplayButton,editCallback:()=>{ |
| 52 | this.allSelectDatas(false) | 53 | this.allSelectDatas(false) |
| 53 | this.isAllSelect = false | 54 | this.isAllSelect = false |
| 54 | this.selectDatas = [] | 55 | this.selectDatas = [] |
| @@ -159,16 +160,19 @@ struct MyCollectionListPage { | @@ -159,16 +160,19 @@ struct MyCollectionListPage { | ||
| 159 | } else { | 160 | } else { |
| 160 | this.browSingModel.hasMore = true; | 161 | this.browSingModel.hasMore = true; |
| 161 | } | 162 | } |
| 163 | + this.isDisplayButton = true; | ||
| 162 | } else { | 164 | } else { |
| 163 | if (this.currentPage === 1) { | 165 | if (this.currentPage === 1) { |
| 164 | this.browSingModel.viewType = ViewType.EMPTY; | 166 | this.browSingModel.viewType = ViewType.EMPTY; |
| 165 | this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoCollection | 167 | this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoCollection |
| 168 | + this.isDisplayButton = false; | ||
| 166 | } | 169 | } |
| 167 | } | 170 | } |
| 168 | }) | 171 | }) |
| 169 | } else { | 172 | } else { |
| 170 | this.browSingModel.viewType = ViewType.EMPTY; | 173 | this.browSingModel.viewType = ViewType.EMPTY; |
| 171 | this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork; | 174 | this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork; |
| 175 | + this.isDisplayButton = false; | ||
| 172 | } | 176 | } |
| 173 | } | 177 | } |
| 174 | 178 | ||
| @@ -231,6 +235,7 @@ struct MyCollectionListPage { | @@ -231,6 +235,7 @@ struct MyCollectionListPage { | ||
| 231 | if (this.allDatas.length === 0) { | 235 | if (this.allDatas.length === 0) { |
| 232 | this.browSingModel.viewType = ViewType.EMPTY; | 236 | this.browSingModel.viewType = ViewType.EMPTY; |
| 233 | this.browSingModel.hasMore === true | 237 | this.browSingModel.hasMore === true |
| 238 | + this.isDisplayButton = false; | ||
| 234 | } | 239 | } |
| 235 | } | 240 | } |
| 236 | 241 |
| @@ -255,7 +255,7 @@ export struct PageComponent { | @@ -255,7 +255,7 @@ export struct PageComponent { | ||
| 255 | this.pageModel.channelId = this.channelId; | 255 | this.pageModel.channelId = this.channelId; |
| 256 | this.pageModel.currentPage = 1; | 256 | this.pageModel.currentPage = 1; |
| 257 | this.pageModel.pageTotalCompSize = 0; | 257 | this.pageModel.pageTotalCompSize = 0; |
| 258 | - // TODO PageHelper.getInitCacheData(this.pageModel, this.pageAdvModel) | 258 | + PageHelper.getInitCacheData(this.pageModel, this.pageAdvModel) |
| 259 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) | 259 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) |
| 260 | }, 100) | 260 | }, 100) |
| 261 | } | 261 | } |
| @@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
| 5 | import { BottomNavDTO, TopNavDTO } from 'wdBean/Index' | 5 | import { BottomNavDTO, TopNavDTO } from 'wdBean/Index' |
| 6 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; | 6 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; |
| 7 | import { PageComponent } from './PageComponent'; | 7 | import { PageComponent } from './PageComponent'; |
| 8 | +import { WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 8 | 9 | ||
| 9 | const TAG = 'VideoChannelPage' | 10 | const TAG = 'VideoChannelPage' |
| 10 | 11 | ||
| @@ -67,44 +68,66 @@ export struct VideoChannelPage { | @@ -67,44 +68,66 @@ export struct VideoChannelPage { | ||
| 67 | 68 | ||
| 68 | @Builder | 69 | @Builder |
| 69 | topNavView() { | 70 | topNavView() { |
| 70 | - Row() { | ||
| 71 | - ForEach(this.topNavList, (item: TopNavDTO, index: number) => { | ||
| 72 | - Column() { | ||
| 73 | - Text(item.name) | ||
| 74 | - .fontSize($r('app.float.selected_text_size')) | ||
| 75 | - .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal) | ||
| 76 | - .fontColor(this.getTopNavFontColor(item, index)) | ||
| 77 | - .padding({ | ||
| 78 | - top: $r('app.float.top_tab_item_padding_top'), | ||
| 79 | - bottom: $r('app.float.top_tab_item_padding_bottom') | ||
| 80 | - }) | ||
| 81 | - .maxLines(this.MAX_LINE) | 71 | + Stack({alignContent: Alignment.TopEnd}) { |
| 72 | + Row() { | ||
| 73 | + ForEach(this.topNavList, (item: TopNavDTO, index: number) => { | ||
| 74 | + Column() { | ||
| 75 | + Text(item.name) | ||
| 76 | + .fontSize($r('app.float.selected_text_size')) | ||
| 77 | + .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal) | ||
| 78 | + .fontColor(this.getTopNavFontColor(item, index)) | ||
| 79 | + .padding({ | ||
| 80 | + top: $r('app.float.top_tab_item_padding_top'), | ||
| 81 | + bottom: $r('app.float.top_tab_item_padding_bottom') | ||
| 82 | + }) | ||
| 83 | + .maxLines(this.MAX_LINE) | ||
| 82 | 84 | ||
| 83 | - Row() | ||
| 84 | - .width(20) | ||
| 85 | - .height(3) | ||
| 86 | - .backgroundImage($r('app.media.icon_channel_active'), ImageRepeat.NoRepeat) | ||
| 87 | - .backgroundImageSize(ImageSize.Contain) | ||
| 88 | - .visibility(this.currentTopNavSelectedIndex === index ? Visibility.Visible : Visibility.Hidden) | 85 | + Row() |
| 86 | + .width(20) | ||
| 87 | + .height(3) | ||
| 88 | + .backgroundImage($r('app.media.icon_channel_active'), ImageRepeat.NoRepeat) | ||
| 89 | + .backgroundImageSize(ImageSize.Contain) | ||
| 90 | + .visibility(this.currentTopNavSelectedIndex === index ? Visibility.Visible : Visibility.Hidden) | ||
| 89 | 91 | ||
| 90 | - } | ||
| 91 | - .padding({ | ||
| 92 | - left: $r('app.float.top_tab_item_padding_horizontal'), | ||
| 93 | - right: $r('app.float.top_tab_item_padding_horizontal'), | ||
| 94 | - }) | ||
| 95 | - .onClick(() => { | ||
| 96 | - if (this.currentTopNavSelectedIndex === index) { | ||
| 97 | - this.autoRefresh++ | ||
| 98 | } | 92 | } |
| 99 | - this.currentTopNavSelectedIndex = index | ||
| 100 | - this.swiperController.changeIndex(index, true) | 93 | + .padding({ |
| 94 | + left: $r('app.float.top_tab_item_padding_horizontal'), | ||
| 95 | + right: $r('app.float.top_tab_item_padding_horizontal'), | ||
| 96 | + }) | ||
| 97 | + .onClick(() => { | ||
| 98 | + if (this.currentTopNavSelectedIndex === index) { | ||
| 99 | + this.autoRefresh++ | ||
| 100 | + } | ||
| 101 | + this.currentTopNavSelectedIndex = index | ||
| 102 | + this.swiperController.changeIndex(index, true) | ||
| 103 | + | ||
| 104 | + }) | ||
| 105 | + }, (item: TopNavDTO) => item.channelId + '') | ||
| 106 | + } | ||
| 107 | + .width('100%') | ||
| 108 | + .justifyContent(FlexAlign.Center) | ||
| 109 | + .backgroundColor(this.currentTopNavSelectedIndex === 0 ? Color.Transparent : Color.White) | ||
| 110 | + | ||
| 111 | + // 搜索按钮 | ||
| 112 | + Row() { | ||
| 113 | + Image($r('app.media.icon_search')) | ||
| 114 | + .width('24vp') | ||
| 115 | + .height('24vp') | ||
| 116 | + } | ||
| 117 | + .width('40vp') | ||
| 118 | + .margin({ | ||
| 119 | + right: '10vp', | ||
| 120 | + top: '3vp', | ||
| 121 | + }) | ||
| 122 | + .alignItems(VerticalAlign.Center) | ||
| 123 | + .justifyContent(FlexAlign.Center) | ||
| 124 | + .onClick(() => { | ||
| 125 | + WDRouterRule.jumpWithPage(WDRouterPage.searchPage) | ||
| 126 | + }) | ||
| 127 | + .backgroundColor(Color.Transparent) | ||
| 101 | 128 | ||
| 102 | - }) | ||
| 103 | - }, (item: TopNavDTO) => item.channelId + '') | ||
| 104 | } | 129 | } |
| 105 | - .width('100%') | ||
| 106 | - .justifyContent(FlexAlign.Center) | ||
| 107 | - .backgroundColor(this.currentTopNavSelectedIndex === 0 ? Color.Transparent : Color.White) | 130 | + |
| 108 | } | 131 | } |
| 109 | 132 | ||
| 110 | @Builder | 133 | @Builder |
| 1 | import { PeopleShipRecommendHeadComponent } from './PeopleShipRecommendHeadComponent' | 1 | import { PeopleShipRecommendHeadComponent } from './PeopleShipRecommendHeadComponent' |
| 2 | import { RmhRecommendDTO } from 'wdBean'; | 2 | import { RmhRecommendDTO } from 'wdBean'; |
| 3 | -import { faceDetector } from '@kit.CoreVisionKit'; | ||
| 4 | 3 | ||
| 5 | @Component | 4 | @Component |
| 6 | export struct PeopleShipRecommendComponent { | 5 | export struct PeopleShipRecommendComponent { |
| @@ -75,8 +74,8 @@ export struct PeopleShipRecommendComponent { | @@ -75,8 +74,8 @@ export struct PeopleShipRecommendComponent { | ||
| 75 | } | 74 | } |
| 76 | .columnsTemplate('1fr 1fr 1fr') | 75 | .columnsTemplate('1fr 1fr 1fr') |
| 77 | .columnsGap(20) | 76 | .columnsGap(20) |
| 78 | - .rowsGap(20) | ||
| 79 | - .height(Math.ceil(this.rmhList.length / 3.0) * 136) | 77 | + .rowsGap(16) |
| 78 | + .height(Math.ceil(this.rmhList.length / 3.0) * 132) | ||
| 80 | .backgroundColor(Color.Transparent) | 79 | .backgroundColor(Color.Transparent) |
| 81 | .margin({ | 80 | .margin({ |
| 82 | right: '20vp', | 81 | right: '20vp', |
| @@ -86,7 +85,7 @@ export struct PeopleShipRecommendComponent { | @@ -86,7 +85,7 @@ export struct PeopleShipRecommendComponent { | ||
| 86 | // 为你推荐 | 85 | // 为你推荐 |
| 87 | Button(this.rmhSelectedList.length == 0 ? '一键关注' : `一键关注 (${this.rmhSelectedList.length})`, { type: ButtonType.Normal, stateEffect: this.rmhSelectedList.length != 0 }) | 86 | Button(this.rmhSelectedList.length == 0 ? '一键关注' : `一键关注 (${this.rmhSelectedList.length})`, { type: ButtonType.Normal, stateEffect: this.rmhSelectedList.length != 0 }) |
| 88 | .margin({ | 87 | .margin({ |
| 89 | - top: '24vp', | 88 | + top: '10vp', |
| 90 | bottom: '10vp' | 89 | bottom: '10vp' |
| 91 | }) | 90 | }) |
| 92 | .width('120vp') | 91 | .width('120vp') |
| @@ -105,6 +104,8 @@ export struct PeopleShipRecommendComponent { | @@ -105,6 +104,8 @@ export struct PeopleShipRecommendComponent { | ||
| 105 | }) | 104 | }) |
| 106 | } | 105 | } |
| 107 | .width('100%') | 106 | .width('100%') |
| 107 | + .justifyContent(FlexAlign.Start) | ||
| 108 | + | ||
| 108 | } | 109 | } |
| 109 | 110 | ||
| 110 | // 选中 | 111 | // 选中 |
| @@ -115,6 +115,7 @@ export struct PeopleShipHomeAttentionComponent { | @@ -115,6 +115,7 @@ export struct PeopleShipHomeAttentionComponent { | ||
| 115 | .onClick(() => { | 115 | .onClick(() => { |
| 116 | ToastUtils.showToast('分享为公共方法,待开发', 1000); | 116 | ToastUtils.showToast('分享为公共方法,待开发', 1000); |
| 117 | }) | 117 | }) |
| 118 | + .visibility(Visibility.Hidden) | ||
| 118 | 119 | ||
| 119 | } | 120 | } |
| 120 | 121 |
| @@ -28,7 +28,7 @@ const TAG: string = 'ReserveMorePage'; | @@ -28,7 +28,7 @@ const TAG: string = 'ReserveMorePage'; | ||
| 28 | @Component | 28 | @Component |
| 29 | struct ReserveMorePage { | 29 | struct ReserveMorePage { |
| 30 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); | 30 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); |
| 31 | - @State reserveList: ReserveItemBean[] = [] | 31 | + private reserveList: ReserveItemBean[] = [] |
| 32 | topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; | 32 | topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; |
| 33 | type: number = 2; | 33 | type: number = 2; |
| 34 | pageSize: number = 20; | 34 | pageSize: number = 20; |
| @@ -130,7 +130,10 @@ struct ReserveMorePage { | @@ -130,7 +130,10 @@ struct ReserveMorePage { | ||
| 130 | Image(item.fullColumnImgUrls[0]?.url) | 130 | Image(item.fullColumnImgUrls[0]?.url) |
| 131 | .width('100%') | 131 | .width('100%') |
| 132 | .objectFit(ImageFit.Contain) | 132 | .objectFit(ImageFit.Contain) |
| 133 | - .borderRadius(4) | 133 | + .borderRadius({ |
| 134 | + topLeft: '4vp', | ||
| 135 | + topRight: '4vp' | ||
| 136 | + }) | ||
| 134 | this.LiveImage() | 137 | this.LiveImage() |
| 135 | 138 | ||
| 136 | } | 139 | } |
| @@ -312,8 +315,15 @@ struct ReserveMorePage { | @@ -312,8 +315,15 @@ struct ReserveMorePage { | ||
| 312 | Logger.debug(TAG,'是否关注元数据2:' +` ${JSON.stringify(element.subscribe)}`) | 315 | Logger.debug(TAG,'是否关注元数据2:' +` ${JSON.stringify(element.subscribe)}`) |
| 313 | element.subscribe = !element.subscribe | 316 | element.subscribe = !element.subscribe |
| 314 | Logger.debug(TAG,'是否关注元数据3:' +` ${JSON.stringify(element.subscribe)}`) | 317 | Logger.debug(TAG,'是否关注元数据3:' +` ${JSON.stringify(element.subscribe)}`) |
| 315 | - this.data.reloadData() | ||
| 316 | this.isShow = true | 318 | this.isShow = true |
| 319 | + if (element.subscribe) { | ||
| 320 | + this.reservedIds.push(element.liveId.toString()) | ||
| 321 | + }else { | ||
| 322 | + const num = this.reservedIds.indexOf(element.liveId.toString()) | ||
| 323 | + if (num >= 0 && num < this.reservedIds.length) { | ||
| 324 | + this.reservedIds.splice(num, 1) | ||
| 325 | + } | ||
| 326 | + } | ||
| 317 | } | 327 | } |
| 318 | } | 328 | } |
| 319 | }) | 329 | }) |
| @@ -349,6 +359,7 @@ struct ReserveMorePage { | @@ -349,6 +359,7 @@ struct ReserveMorePage { | ||
| 349 | if (this.currentPage == 1) { | 359 | if (this.currentPage == 1) { |
| 350 | this.data.clear() | 360 | this.data.clear() |
| 351 | this.reserveList = [] | 361 | this.reserveList = [] |
| 362 | + this.reservedIds = [] | ||
| 352 | } | 363 | } |
| 353 | this.data.push(...liveReviewDTO.list) | 364 | this.data.push(...liveReviewDTO.list) |
| 354 | //批量查询关注状态 | 365 | //批量查询关注状态 |
| @@ -396,7 +407,12 @@ struct ReserveMorePage { | @@ -396,7 +407,12 @@ struct ReserveMorePage { | ||
| 396 | Logger.debug(TAG,'是否预约数据:' +` ${JSON.stringify(result)}`) | 407 | Logger.debug(TAG,'是否预约数据:' +` ${JSON.stringify(result)}`) |
| 397 | if (result && result.length > 0) { | 408 | if (result && result.length > 0) { |
| 398 | this.reserveList.push(...result) | 409 | this.reserveList.push(...result) |
| 399 | - this.data.reloadData() | 410 | + // this.reserveStatus = res; |
| 411 | + result.map((item: ReserveItemBean) => { | ||
| 412 | + if (item.subscribe) { | ||
| 413 | + this.reservedIds.push(item.liveId.toString()) | ||
| 414 | + } | ||
| 415 | + }) | ||
| 400 | } | 416 | } |
| 401 | }).catch(() =>{ | 417 | }).catch(() =>{ |
| 402 | // this.data.push(...list) | 418 | // this.data.push(...list) |
| @@ -409,11 +425,7 @@ struct ReserveMorePage { | @@ -409,11 +425,7 @@ struct ReserveMorePage { | ||
| 409 | 425 | ||
| 410 | // 判断是否预约 | 426 | // 判断是否预约 |
| 411 | isReserved(item: ContentDTO) { | 427 | isReserved(item: ContentDTO) { |
| 412 | - const objc = this.getAttentionItem(item) | ||
| 413 | - if (objc) { | ||
| 414 | - return objc.subscribe | ||
| 415 | - } | ||
| 416 | - return false | 428 | + return this.reservedIds.includes(item.objectId) |
| 417 | } | 429 | } |
| 418 | 430 | ||
| 419 | getAttentionItem(item: ContentDTO) { | 431 | getAttentionItem(item: ContentDTO) { |
| @@ -460,9 +472,17 @@ struct ReserveMorePage { | @@ -460,9 +472,17 @@ struct ReserveMorePage { | ||
| 460 | Logger.debug(TAG,'是否关注元数据:' +` ${JSON.stringify(element.subscribe)}`) | 472 | Logger.debug(TAG,'是否关注元数据:' +` ${JSON.stringify(element.subscribe)}`) |
| 461 | element.subscribe = !element.subscribe | 473 | element.subscribe = !element.subscribe |
| 462 | Logger.debug(TAG,'是否关注元数据1:' +` ${JSON.stringify(element.subscribe)}`) | 474 | Logger.debug(TAG,'是否关注元数据1:' +` ${JSON.stringify(element.subscribe)}`) |
| 463 | - this.data.reloadData() | 475 | + if (element.subscribe) { |
| 476 | + this.reservedIds.push(element.liveId.toString()) | ||
| 477 | + }else { | ||
| 478 | + const num = this.reservedIds.indexOf(element.liveId.toString()) | ||
| 479 | + if (num >= 0 && num < this.reservedIds.length) { | ||
| 480 | + this.reservedIds.splice(num, 1) | ||
| 481 | + } | ||
| 482 | + } | ||
| 464 | } | 483 | } |
| 465 | }) | 484 | }) |
| 485 | + | ||
| 466 | } | 486 | } |
| 467 | this.isLoadingAttention = false | 487 | this.isLoadingAttention = false |
| 468 | this.liveId = '' | 488 | this.liveId = '' |
| @@ -487,15 +507,12 @@ struct ReserveMorePage { | @@ -487,15 +507,12 @@ struct ReserveMorePage { | ||
| 487 | const eventMinutes = eventDateTime.getMinutes(); | 507 | const eventMinutes = eventDateTime.getMinutes(); |
| 488 | const eventTimeStr = `${eventHour}:${eventMinutes.toString().padStart(2, '0')}开始`; // 格式化时间,确保分钟是两位数 | 508 | const eventTimeStr = `${eventHour}:${eventMinutes.toString().padStart(2, '0')}开始`; // 格式化时间,确保分钟是两位数 |
| 489 | 509 | ||
| 490 | - // 计算时间差 | ||
| 491 | - const timeDifference = eventDateTime.getTime() - currentDateTime.getTime(); | ||
| 492 | - | ||
| 493 | - // 如果事件在24小时内 | ||
| 494 | if (type === 1) { | 510 | if (type === 1) { |
| 495 | - if (timeDifference > 0 && timeDifference <= 24 * 60 * 60 * 1000) { | 511 | + // 如果是今天 |
| 512 | + if (eventDateTime.setHours(0,0,0,0) === currentDateTime.setHours(0,0,0,0)) { | ||
| 496 | return `今天`; | 513 | return `今天`; |
| 497 | } else { | 514 | } else { |
| 498 | - // 如果事件不在24小时内 | 515 | + // 如果事件不在今天 |
| 499 | const month = eventDateTime.getMonth() + 1; // 月份从0开始 | 516 | const month = eventDateTime.getMonth() + 1; // 月份从0开始 |
| 500 | const date = eventDateTime.getDate(); | 517 | const date = eventDateTime.getDate(); |
| 501 | return `${month}月${date}日`; | 518 | return `${month}月${date}日`; |
| 1 | +import lottie, { AnimationItem } from '@ohos/lottie'; | ||
| 1 | import { PullToRefresh, PullToRefreshConfigurator } from '@ohos/pulltorefresh'; | 2 | import { PullToRefresh, PullToRefreshConfigurator } from '@ohos/pulltorefresh'; |
| 2 | -import { LazyDataSource } from 'wdKit'; | 3 | +import { LazyDataSource, Logger } from 'wdKit/Index'; |
| 3 | 4 | ||
| 4 | @Component | 5 | @Component |
| 5 | -export struct CustomPullToRefresh { | 6 | +export struct CustomPullToRefresh { |
| 6 | @Link alldata: Object[] | LazyDataSource<Object>; | 7 | @Link alldata: Object[] | LazyDataSource<Object>; |
| 7 | scroller: Scroller = new Scroller(); | 8 | scroller: Scroller = new Scroller(); |
| 8 | @BuilderParam customList: () => void; | 9 | @BuilderParam customList: () => void; |
| @@ -12,28 +13,238 @@ export struct CustomPullToRefresh { | @@ -12,28 +13,238 @@ export struct CustomPullToRefresh { | ||
| 12 | } | 13 | } |
| 13 | ///是否存在上拉更多 | 14 | ///是否存在上拉更多 |
| 14 | @Prop @Watch('hasMoreChange') hasMore: boolean = true | 15 | @Prop @Watch('hasMoreChange') hasMore: boolean = true |
| 15 | - refreshConfigurator: PullToRefreshConfigurator = new PullToRefreshConfigurator().setHasLoadMore(this.hasMore); | 16 | + refreshConfigurator: PullToRefreshConfigurator = new PullToRefreshConfigurator() |
| 17 | + .setHasLoadMore(this.hasMore) | ||
| 18 | + .setAnimDuration(500); | ||
| 19 | + private refreshSettings: RenderingContextSettings = new RenderingContextSettings(true) | ||
| 20 | + private refreshContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.refreshSettings) | ||
| 21 | + private loadMoreSettings: RenderingContextSettings = new RenderingContextSettings(true) | ||
| 22 | + private loadMoreContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.loadMoreSettings) | ||
| 23 | + private refreshAnimation: AnimationItem | null = null; | ||
| 24 | + private loadMoreAnimation: AnimationItem | null = null; | ||
| 25 | + private refreshAnimName: string = "refresh"; | ||
| 26 | + private refreshingAnimName: string = "refreshing"; | ||
| 27 | + private loadMoreAnimName: string = "loadMore"; | ||
| 28 | + private refreshAnimationDestroy = true | ||
| 29 | + // refresh-1,refreshing-2,refreshed-3,idle-4 | ||
| 30 | + @State @Watch('stateChange') private refreshState: number = 4; | ||
| 31 | + | ||
| 16 | build() { | 32 | build() { |
| 17 | - Column(){ | 33 | + Column() { |
| 18 | PullToRefresh({ | 34 | PullToRefresh({ |
| 19 | - data:$alldata, | ||
| 20 | - scroller:this.scroller, | ||
| 21 | - refreshConfigurator:this.refreshConfigurator, | ||
| 22 | - customList:()=>{ | ||
| 23 | - this.customList(); | 35 | + data: $alldata, |
| 36 | + scroller: this.scroller, | ||
| 37 | + refreshConfigurator: this.refreshConfigurator, | ||
| 38 | + customList: () => { | ||
| 39 | + this.customList(); | ||
| 24 | }, | 40 | }, |
| 25 | - onRefresh:()=>{ | ||
| 26 | - return new Promise<string>((resolve, reject) => { | ||
| 27 | - this.onRefresh(resolve) | 41 | + onRefresh: () => { |
| 42 | + return new Promise<string>((success, error) => { | ||
| 43 | + new Promise<string>((resolve) => { | ||
| 44 | + this.onRefresh(resolve) | ||
| 45 | + }).then((text) => { | ||
| 46 | + setTimeout(()=>{ | ||
| 47 | + // 延时500,展示第二段动画 TODO 是否去掉? | ||
| 48 | + this.refreshState = 3 | ||
| 49 | + this.refreshDestroy() | ||
| 50 | + setTimeout(() => { | ||
| 51 | + success(text) | ||
| 52 | + }, 500) | ||
| 53 | + setTimeout(() => { | ||
| 54 | + this.refreshState = 4 | ||
| 55 | + // 延时将状态改为空闲,组件closeRefresh做了延时,不能配置,这里配合延时 | ||
| 56 | + }, 1200) | ||
| 57 | + },500) | ||
| 58 | + }) | ||
| 28 | }); | 59 | }); |
| 29 | }, | 60 | }, |
| 30 | - onLoadMore:()=>{ | 61 | + onLoadMore: () => { |
| 31 | return new Promise<string>((resolve, reject) => { | 62 | return new Promise<string>((resolve, reject) => { |
| 32 | - this.onLoadMore(resolve) | 63 | + this.onLoadMore(resolve)// TODO 加层promise处理,延长动画时间 |
| 33 | }); | 64 | }); |
| 34 | }, | 65 | }, |
| 35 | - customLoad: null, | ||
| 36 | - customRefresh: null, | 66 | + customLoad: () => { |
| 67 | + this.customLoadMoreView() | ||
| 68 | + }, | ||
| 69 | + // 可选项,自定义下拉刷新动画布局 | ||
| 70 | + customRefresh: () => { | ||
| 71 | + this.customRefreshView() | ||
| 72 | + }, | ||
| 73 | + // 可选项,下拉中回调 | ||
| 74 | + onAnimPullDown: (value, width, height) => { | ||
| 75 | + this.refreshState = 1 | ||
| 76 | + // Logger.error('zzzz', 'onAnimPullDown, ' + value + ', ' + width + ', ' + height) | ||
| 77 | + this.refreshAnim(value) | ||
| 78 | + }, | ||
| 79 | + // 可选项,刷新中回调 | ||
| 80 | + onAnimRefreshing: (value, width, height) => { | ||
| 81 | + if (this.refreshState < 2) { | ||
| 82 | + this.refreshState = 2 | ||
| 83 | + } | ||
| 84 | + // Logger.error('zzzz', 'onAnimRefreshing, ' + value + ', ' + width + ', ' + height) | ||
| 85 | + this.refreshingAnim() | ||
| 86 | + }, | ||
| 87 | + }) | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * 销毁所有动画 | ||
| 93 | + */ | ||
| 94 | + private refreshDestroy() { | ||
| 95 | + lottie.destroy(this.refreshAnimName); | ||
| 96 | + lottie.destroy(this.refreshingAnimName); | ||
| 97 | + this.refreshAnimation?.removeEventListener('DOMLoaded') | ||
| 98 | + this.refreshAnimation?.removeEventListener('destroy') | ||
| 99 | + this.refreshAnimation = null | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + @Builder | ||
| 103 | + private customRefreshView() { | ||
| 104 | + Stack({ alignContent: Alignment.Center }) { | ||
| 105 | + Canvas(this.refreshContext) | ||
| 106 | + .width(60) | ||
| 107 | + .height(60) | ||
| 108 | + .backgroundColor(Color.Transparent) | ||
| 109 | + .onReady(() => { | ||
| 110 | + // 可在此生命回调周期中加载动画,可以保证动画尺寸正确 | ||
| 111 | + //抗锯齿的设置 | ||
| 112 | + this.refreshContext.imageSmoothingEnabled = true; | ||
| 113 | + this.refreshContext.imageSmoothingQuality = 'medium' | ||
| 114 | + }) | ||
| 115 | + .onDisAppear(() => { | ||
| 116 | + lottie.destroy(this.refreshAnimName); | ||
| 117 | + lottie.destroy(this.refreshingAnimName); | ||
| 118 | + }) | ||
| 119 | + .visibility((this.refreshState == 1 || this.refreshState == 2) ? Visibility.Visible : Visibility.Hidden) | ||
| 120 | + | ||
| 121 | + Text('已更新至最新') | ||
| 122 | + .fontSize(14) | ||
| 123 | + .textAlign(TextAlign.Center) | ||
| 124 | + .fontColor('#676767') | ||
| 125 | + .backgroundColor('#f6f6f6') | ||
| 126 | + .borderRadius(20) | ||
| 127 | + .padding({ | ||
| 128 | + left: 19, | ||
| 129 | + right: 19, | ||
| 130 | + top: 10, | ||
| 131 | + bottom: 10 | ||
| 132 | + }) | ||
| 133 | + .visibility(this.refreshState == 3 ? Visibility.Visible : Visibility.Hidden) | ||
| 134 | + }.padding({ top: 20 }) | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + @Builder | ||
| 138 | + private customLoadMoreView() { | ||
| 139 | + Row() { | ||
| 140 | + Canvas(this.loadMoreContext) | ||
| 141 | + .width(14) | ||
| 142 | + .height(14) | ||
| 143 | + .backgroundColor(Color.Transparent) | ||
| 144 | + .onReady(() => { | ||
| 145 | + // 可在此生命回调周期中加载动画,可以保证动画尺寸正确 | ||
| 146 | + //抗锯齿的设置 | ||
| 147 | + this.loadMoreContext.imageSmoothingEnabled = true; | ||
| 148 | + this.loadMoreContext.imageSmoothingQuality = 'medium' | ||
| 149 | + this.loadMoreAnimate() | ||
| 150 | + }) | ||
| 151 | + .onDisAppear(() => { | ||
| 152 | + // Logger.error('zzzz', 'CustomLoadMoreLayout onDisAppear') | ||
| 153 | + lottie.destroy(this.loadMoreAnimName); | ||
| 154 | + }) | ||
| 155 | + | ||
| 156 | + Text('努力加载中') | ||
| 157 | + .margin({ | ||
| 158 | + left: 7, | ||
| 159 | + bottom: 1 | ||
| 160 | + }) | ||
| 161 | + .fontSize(14) | ||
| 162 | + .fontColor('#888888') | ||
| 163 | + .textAlign(TextAlign.Center) | ||
| 164 | + } | ||
| 165 | + .clip(true) | ||
| 166 | + .width('100%') | ||
| 167 | + .justifyContent(FlexAlign.Center) | ||
| 168 | + .height(60) | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + private refreshAnim(percent: number) { | ||
| 172 | + if (this.refreshAnimation == null || this.refreshAnimation.name != this.refreshAnimName || | ||
| 173 | + this.refreshAnimationDestroy) { | ||
| 174 | + this.refreshAnimation?.destroy(this.refreshAnimName) | ||
| 175 | + this.refreshAnimation?.destroy(this.refreshingAnimName) | ||
| 176 | + this.refreshAnimation = lottie.loadAnimation({ | ||
| 177 | + container: this.refreshContext, | ||
| 178 | + renderer: 'canvas', // canvas 渲染模式 | ||
| 179 | + loop: 1, | ||
| 180 | + autoplay: true, | ||
| 181 | + name: this.refreshAnimName, | ||
| 182 | + path: "lottie/refresh_step1.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径 | ||
| 183 | + }) | ||
| 184 | + this.refreshAnimation?.goToAndStop(1) | ||
| 185 | + this.addRefreshAnimListener() | ||
| 186 | + } | ||
| 187 | + this.refreshAnimation?.goToAndStop(this.getFramesByProgress(percent), true); | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + /** | ||
| 191 | + * 获取动画帧 | ||
| 192 | + * | ||
| 193 | + * @param percent 百分比,如0.76 | ||
| 194 | + * @returns | ||
| 195 | + */ | ||
| 196 | + private getFramesByProgress(percent: number): number { | ||
| 197 | + if (this.refreshAnimation == null) { | ||
| 198 | + return 1; | ||
| 199 | + } | ||
| 200 | + let total = this.refreshAnimation.totalFrames; | ||
| 201 | + let frame = Math.floor(total * percent); | ||
| 202 | + if (frame >= total - 1) { | ||
| 203 | + frame = total - 1 | ||
| 204 | + } | ||
| 205 | + return frame; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + private refreshingAnim() { | ||
| 209 | + // Logger.error('zzzz', 'animate2, 1') | ||
| 210 | + // 先销毁之前的动画 | ||
| 211 | + if (this.refreshAnimation == null || this.refreshAnimation.name != this.refreshingAnimName || | ||
| 212 | + this.refreshAnimationDestroy) { | ||
| 213 | + this.refreshAnimation?.destroy(this.refreshAnimName) | ||
| 214 | + this.refreshAnimation?.destroy(this.refreshingAnimName) | ||
| 215 | + this.refreshAnimation = lottie.loadAnimation({ | ||
| 216 | + container: this.refreshContext, | ||
| 217 | + renderer: 'canvas', // canvas 渲染模式 | ||
| 218 | + loop: 10, | ||
| 219 | + autoplay: true, | ||
| 220 | + name: this.refreshingAnimName, | ||
| 221 | + path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径 | ||
| 222 | + }) | ||
| 223 | + this.addRefreshAnimListener() | ||
| 224 | + } | ||
| 225 | + // Logger.error('zzzz', 'animate2, 2') | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + private addRefreshAnimListener() { | ||
| 229 | + this.refreshAnimation?.addEventListener('DOMLoaded', (args: Object): void => { | ||
| 230 | + // Logger.error('zzzz', "lottie DOMLoaded"); | ||
| 231 | + this.refreshAnimationDestroy = false | ||
| 232 | + }); //动画加载完成,播放之前触发 | ||
| 233 | + this.refreshAnimation?.addEventListener('destroy', (args: Object): void => { | ||
| 234 | + // Logger.error('zzzz', "lottie destroy"); | ||
| 235 | + this.refreshAnimationDestroy = true | ||
| 236 | + }); | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + loadMoreAnimate() { | ||
| 240 | + if (this.loadMoreAnimation == null) { | ||
| 241 | + this.loadMoreAnimation = lottie.loadAnimation({ | ||
| 242 | + container: this.loadMoreContext, | ||
| 243 | + renderer: 'canvas', // canvas 渲染模式 | ||
| 244 | + loop: 50, | ||
| 245 | + autoplay: true, | ||
| 246 | + name: this.loadMoreAnimName, | ||
| 247 | + path: "lottie/loading_more.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径 | ||
| 37 | }) | 248 | }) |
| 38 | } | 249 | } |
| 39 | } | 250 | } |
| @@ -41,4 +252,8 @@ export struct CustomPullToRefresh { | @@ -41,4 +252,8 @@ export struct CustomPullToRefresh { | ||
| 41 | hasMoreChange() { | 252 | hasMoreChange() { |
| 42 | this.refreshConfigurator.setHasLoadMore(this.hasMore) | 253 | this.refreshConfigurator.setHasLoadMore(this.hasMore) |
| 43 | } | 254 | } |
| 255 | + | ||
| 256 | + stateChange() { | ||
| 257 | + // Logger.error('zzzz', 'stateChange ' + this.refreshState) | ||
| 258 | + } | ||
| 44 | } | 259 | } |
| @@ -4,7 +4,7 @@ import router from '@ohos.router' | @@ -4,7 +4,7 @@ import router from '@ohos.router' | ||
| 4 | export struct CustomTitleAndEditUI { | 4 | export struct CustomTitleAndEditUI { |
| 5 | imgBack:boolean = true | 5 | imgBack:boolean = true |
| 6 | titleName:string = "默认标题" | 6 | titleName:string = "默认标题" |
| 7 | - isDisplayButton:boolean = false | 7 | + @Link isDisplayButton:boolean |
| 8 | @Consume isEditState:boolean | 8 | @Consume isEditState:boolean |
| 9 | editCallback: () => void = () => { | 9 | editCallback: () => void = () => { |
| 10 | } | 10 | } |
| @@ -39,6 +39,11 @@ export struct SearchComponent { | @@ -39,6 +39,11 @@ export struct SearchComponent { | ||
| 39 | SearcherAboutDataModel.searchHistoryData = [] | 39 | SearcherAboutDataModel.searchHistoryData = [] |
| 40 | //获取搜索历史 | 40 | //获取搜索历史 |
| 41 | this.getSearchHistoryData() | 41 | this.getSearchHistoryData() |
| 42 | + | ||
| 43 | + let intervalID = setInterval(() => { | ||
| 44 | + sendEventByKey("searchId", 10, "") | ||
| 45 | + clearInterval(intervalID); | ||
| 46 | + }, 1000); | ||
| 42 | } | 47 | } |
| 43 | 48 | ||
| 44 | getRelatedSearchContent() { | 49 | getRelatedSearchContent() { |
| @@ -56,12 +61,18 @@ export struct SearchComponent { | @@ -56,12 +61,18 @@ export struct SearchComponent { | ||
| 56 | while (tempValue.indexOf(this.searchText) != -1){ | 61 | while (tempValue.indexOf(this.searchText) != -1){ |
| 57 | let index = tempValue.indexOf(this.searchText) | 62 | let index = tempValue.indexOf(this.searchText) |
| 58 | if(index === 0){ | 63 | if(index === 0){ |
| 59 | - tempArr.push(this.searchText) | ||
| 60 | - tempValue = tempValue.substring(this.searchText.length,tempValue.length) | 64 | + try { |
| 65 | + tempArr.push(this.searchText) | ||
| 66 | + tempValue = tempValue.substring(this.searchText.length,tempValue.length) | ||
| 67 | + } catch (e) { | ||
| 68 | + } | ||
| 61 | }else { | 69 | }else { |
| 62 | - tempArr.push(tempValue.substring(0,index)) | ||
| 63 | - tempArr.push(this.searchText) | ||
| 64 | - tempValue = tempValue.substring(index+this.searchText.length,tempValue.length) | 70 | + try { |
| 71 | + tempArr.push(tempValue.substring(0,index)) | ||
| 72 | + tempArr.push(this.searchText) | ||
| 73 | + tempValue = tempValue.substring(index+this.searchText.length,tempValue.length) | ||
| 74 | + } catch (e) { | ||
| 75 | + } | ||
| 65 | } | 76 | } |
| 66 | } | 77 | } |
| 67 | if(StringUtils.isNotEmpty(tempValue)){ | 78 | if(StringUtils.isNotEmpty(tempValue)){ |
| @@ -99,6 +110,10 @@ export struct SearchComponent { | @@ -99,6 +110,10 @@ export struct SearchComponent { | ||
| 99 | this.searchHistoryData = SearcherAboutDataModel.getSearchHistoryData() | 110 | this.searchHistoryData = SearcherAboutDataModel.getSearchHistoryData() |
| 100 | } | 111 | } |
| 101 | 112 | ||
| 113 | + stopInput(){ | ||
| 114 | + this.controller.stopEditing() | ||
| 115 | + } | ||
| 116 | + | ||
| 102 | build() { | 117 | build() { |
| 103 | Column() { | 118 | Column() { |
| 104 | this.searchInputComponent() | 119 | this.searchInputComponent() |
| @@ -106,7 +121,7 @@ export struct SearchComponent { | @@ -106,7 +121,7 @@ export struct SearchComponent { | ||
| 106 | Scroll(this.scroller) { | 121 | Scroll(this.scroller) { |
| 107 | Column() { | 122 | Column() { |
| 108 | if(this.searchHistoryData!=null && this.searchHistoryData.length>0){ | 123 | if(this.searchHistoryData!=null && this.searchHistoryData.length>0){ |
| 109 | - SearchHistoryComponent({ searchHistoryData: $searchHistoryData, onDelHistory: (): void => this.getSearchHistoryData(),onGetSearchRes: (item,index): void => this.getSearchHistoryResData(item,index) }) | 124 | + SearchHistoryComponent({ searchHistoryData: $searchHistoryData, onDelHistory: (): void => this.getSearchHistoryData(),onGetSearchRes: (item,index): void => this.getSearchHistoryResData(item,index),onCloseInput : (): void => this.stopInput() }) |
| 110 | } | 125 | } |
| 111 | 126 | ||
| 112 | if(this.searchHistoryData.length>0){ | 127 | if(this.searchHistoryData.length>0){ |
| @@ -129,7 +144,13 @@ export struct SearchComponent { | @@ -129,7 +144,13 @@ export struct SearchComponent { | ||
| 129 | } else { | 144 | } else { |
| 130 | if (this.hasChooseSearch) { | 145 | if (this.hasChooseSearch) { |
| 131 | //搜索结果 | 146 | //搜索结果 |
| 132 | - SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest}) | 147 | + SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest,onClickTryAgain: (): void => { |
| 148 | + if(StringUtils.isNotEmpty(this.searchText)){ | ||
| 149 | + SearcherAboutDataModel.putSearchHistoryData(this.searchText) | ||
| 150 | + this.getSearchHistoryData() | ||
| 151 | + this.getSearchInputResData(this.searchText) | ||
| 152 | + } | ||
| 153 | + }}) | ||
| 133 | } else { | 154 | } else { |
| 134 | //联想搜索 | 155 | //联想搜索 |
| 135 | SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText}) | 156 | SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText}) |
| @@ -218,7 +239,7 @@ export struct SearchComponent { | @@ -218,7 +239,7 @@ export struct SearchComponent { | ||
| 218 | .textAlign(TextAlign.Start) | 239 | .textAlign(TextAlign.Start) |
| 219 | .maxLines(1) | 240 | .maxLines(1) |
| 220 | .textOverflow({ overflow: TextOverflow.Clip }) | 241 | .textOverflow({ overflow: TextOverflow.Clip }) |
| 221 | - .margin({ left: '70lpx' }) | 242 | + .margin({ left: '40lpx' }) |
| 222 | }) | 243 | }) |
| 223 | } | 244 | } |
| 224 | .loop(true) | 245 | .loop(true) |
| @@ -238,7 +259,14 @@ export struct SearchComponent { | @@ -238,7 +259,14 @@ export struct SearchComponent { | ||
| 238 | .height('69lpx') | 259 | .height('69lpx') |
| 239 | .backgroundColor($r('app.color.color_transparent')) | 260 | .backgroundColor($r('app.color.color_transparent')) |
| 240 | .textFont({ size: "27lpx", weight: "400lpx" }) | 261 | .textFont({ size: "27lpx", weight: "400lpx" }) |
| 241 | - .defaultFocus(true) | 262 | + // .defaultFocus(true) |
| 263 | + .id("searchId") | ||
| 264 | + .searchIcon({ | ||
| 265 | + size:0 | ||
| 266 | + }) | ||
| 267 | + .cancelButton({ | ||
| 268 | + style:CancelButtonStyle.INVISIBLE | ||
| 269 | + }) | ||
| 242 | .caretStyle({color:Color.Pink}) | 270 | .caretStyle({color:Color.Pink}) |
| 243 | .onSubmit((value: string) => { | 271 | .onSubmit((value: string) => { |
| 244 | if(StringUtils.isNotEmpty(this.searchText)){ | 272 | if(StringUtils.isNotEmpty(this.searchText)){ |
| @@ -278,9 +306,20 @@ export struct SearchComponent { | @@ -278,9 +306,20 @@ export struct SearchComponent { | ||
| 278 | } | 306 | } |
| 279 | } | 307 | } |
| 280 | }) | 308 | }) |
| 281 | - | ||
| 282 | - }.padding({right:'30lpx'}) | 309 | + }.padding({right:'70lpx'}) |
| 283 | .layoutWeight(1) | 310 | .layoutWeight(1) |
| 311 | + | ||
| 312 | + Image($r('app.media.search_input_del_icon')) | ||
| 313 | + .width("31lpx") | ||
| 314 | + .height("31lpx") | ||
| 315 | + .objectFit(ImageFit.Auto) | ||
| 316 | + .interpolation(ImageInterpolation.Medium) | ||
| 317 | + .margin({left:"495lpx"}) | ||
| 318 | + .onClick(()=>{ | ||
| 319 | + this.searchText = "" | ||
| 320 | + }) | ||
| 321 | + .visibility(StringUtils.isEmpty(this.searchText) ? Visibility.Hidden : Visibility.Visible) | ||
| 322 | + | ||
| 284 | } | 323 | } |
| 285 | .backgroundImage($r('app.media.search_page_input_bg')) | 324 | .backgroundImage($r('app.media.search_page_input_bg')) |
| 286 | .backgroundImageSize(ImageSize.Cover) | 325 | .backgroundImageSize(ImageSize.Cover) |
| @@ -8,11 +8,14 @@ import { MyCustomDialog } from '../reusable/MyCustomDialog' | @@ -8,11 +8,14 @@ import { MyCustomDialog } from '../reusable/MyCustomDialog' | ||
| 8 | @Component | 8 | @Component |
| 9 | export struct SearchHistoryComponent{ | 9 | export struct SearchHistoryComponent{ |
| 10 | @Link searchHistoryData:SearchHistoryItem[] | 10 | @Link searchHistoryData:SearchHistoryItem[] |
| 11 | + onCloseInput?: () => void; | ||
| 11 | onDelHistory?: () => void; | 12 | onDelHistory?: () => void; |
| 12 | onGetSearchRes?: (item:string,index:number) => void; | 13 | onGetSearchRes?: (item:string,index:number) => void; |
| 13 | dialogController: CustomDialogController = new CustomDialogController({ | 14 | dialogController: CustomDialogController = new CustomDialogController({ |
| 14 | builder: MyCustomDialog({ | 15 | builder: MyCustomDialog({ |
| 15 | - cancel: this.onCancel, | 16 | + cancel: () => { |
| 17 | + this.onCancel() | ||
| 18 | + }, | ||
| 16 | confirm: () => { | 19 | confirm: () => { |
| 17 | this.onAccept() | 20 | this.onAccept() |
| 18 | }, | 21 | }, |
| @@ -33,6 +36,9 @@ export struct SearchHistoryComponent{ | @@ -33,6 +36,9 @@ export struct SearchHistoryComponent{ | ||
| 33 | } | 36 | } |
| 34 | 37 | ||
| 35 | onCancel() { | 38 | onCancel() { |
| 39 | + if (this.onCloseInput !== undefined) { | ||
| 40 | + this.onCloseInput() | ||
| 41 | + } | ||
| 36 | console.info('Callback when the first button is clicked') | 42 | console.info('Callback when the first button is clicked') |
| 37 | } | 43 | } |
| 38 | 44 |
| 1 | import { CompDTO, ContentDTO } from 'wdBean/Index' | 1 | import { CompDTO, ContentDTO } from 'wdBean/Index' |
| 2 | -import { LazyDataSource, UserDataLocal } from 'wdKit/Index' | 2 | +import { LazyDataSource, NetworkUtil, UserDataLocal } from 'wdKit/Index' |
| 3 | import { HttpUtils } from 'wdNetwork/Index' | 3 | import { HttpUtils } from 'wdNetwork/Index' |
| 4 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 4 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| 5 | import { SearchSuggestRequestItem } from '../../viewmodel/SearchSuggestRequestItem' | 5 | import { SearchSuggestRequestItem } from '../../viewmodel/SearchSuggestRequestItem' |
| @@ -26,6 +26,8 @@ export struct SearchResultComponent { | @@ -26,6 +26,8 @@ export struct SearchResultComponent { | ||
| 26 | @State suggest_count: number = 0; | 26 | @State suggest_count: number = 0; |
| 27 | @State isLoading: boolean = false | 27 | @State isLoading: boolean = false |
| 28 | scroller: Scroller = new Scroller() | 28 | scroller: Scroller = new Scroller() |
| 29 | + onClickTryAgain?: () => void; | ||
| 30 | + @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | ||
| 29 | 31 | ||
| 30 | aboutToAppear(): void { | 32 | aboutToAppear(): void { |
| 31 | if (this.count.length === 0 && this.isGetRequest == true) { | 33 | if (this.count.length === 0 && this.isGetRequest == true) { |
| @@ -67,9 +69,22 @@ export struct SearchResultComponent { | @@ -67,9 +69,22 @@ export struct SearchResultComponent { | ||
| 67 | List() { | 69 | List() { |
| 68 | ListItem() { | 70 | ListItem() { |
| 69 | //缺省图 | 71 | //缺省图 |
| 70 | - EmptyComponent({emptyType:4}) | ||
| 71 | - .height('612lpx') | ||
| 72 | - .width('100%') | 72 | + if(this.isConnectNetwork){ |
| 73 | + EmptyComponent({emptyType:4}) | ||
| 74 | + .height('612lpx') | ||
| 75 | + .width('100%') | ||
| 76 | + }else{ | ||
| 77 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 78 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 79 | + if(this.isConnectNetwork){ | ||
| 80 | + if (this.onClickTryAgain !== undefined) { | ||
| 81 | + this.onClickTryAgain() | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + }}) | ||
| 85 | + .height("100%") | ||
| 86 | + .width('100%') | ||
| 87 | + } | ||
| 73 | } | 88 | } |
| 74 | if(this.suggest_count > 0){ | 89 | if(this.suggest_count > 0){ |
| 75 | ListItem() { | 90 | ListItem() { |
| @@ -20,7 +20,6 @@ export struct channelSkeleton { | @@ -20,7 +20,6 @@ export struct channelSkeleton { | ||
| 20 | } | 20 | } |
| 21 | .RightStyle() | 21 | .RightStyle() |
| 22 | 22 | ||
| 23 | - | ||
| 24 | Column() { | 23 | Column() { |
| 25 | textArea('35%', 78) | 24 | textArea('35%', 78) |
| 26 | } | 25 | } |
| @@ -70,7 +69,6 @@ function textArea(width: number | Resource | string = '100%', height: number | R | @@ -70,7 +69,6 @@ function textArea(width: number | Resource | string = '100%', height: number | R | ||
| 70 | .height(height) | 69 | .height(height) |
| 71 | .backgroundColor('#FFF2F3F4') | 70 | .backgroundColor('#FFF2F3F4') |
| 72 | .margin({ top: 10 }) | 71 | .margin({ top: 10 }) |
| 73 | - .borderRadius(4) | ||
| 74 | } | 72 | } |
| 75 | 73 | ||
| 76 | // 全局公共样式 | 74 | // 全局公共样式 |
| @@ -18,13 +18,12 @@ export struct detailedSkeleton { | @@ -18,13 +18,12 @@ export struct detailedSkeleton { | ||
| 18 | .alignItems(HorizontalAlign.Start) | 18 | .alignItems(HorizontalAlign.Start) |
| 19 | 19 | ||
| 20 | Column() { | 20 | Column() { |
| 21 | - textArea('40%', 12) | ||
| 22 | - textArea('40%', 12) | 21 | + textArea('30%', 12) |
| 22 | + textArea('30%', 12) | ||
| 23 | } | 23 | } |
| 24 | .SkeletonStyle() | 24 | .SkeletonStyle() |
| 25 | .alignItems(HorizontalAlign.Start) | 25 | .alignItems(HorizontalAlign.Start) |
| 26 | 26 | ||
| 27 | - | ||
| 28 | Column() { | 27 | Column() { |
| 29 | textArea('100%', 12) | 28 | textArea('100%', 12) |
| 30 | textArea('100%', 12) | 29 | textArea('100%', 12) |
| @@ -59,7 +58,7 @@ function textArea(width: number | Resource | string = '100%', height: number | R | @@ -59,7 +58,7 @@ function textArea(width: number | Resource | string = '100%', height: number | R | ||
| 59 | Row() | 58 | Row() |
| 60 | .width(width) | 59 | .width(width) |
| 61 | .height(height) | 60 | .height(height) |
| 62 | - .backgroundColor('#FFF2F3F4') | 61 | + .backgroundColor('#FFF5F5F5') |
| 63 | .margin({ top: 10 }) | 62 | .margin({ top: 10 }) |
| 64 | // .borderRadius(5) | 63 | // .borderRadius(5) |
| 65 | } | 64 | } |
| @@ -131,8 +131,7 @@ export struct EmptyComponent { | @@ -131,8 +131,7 @@ export struct EmptyComponent { | ||
| 131 | // .height(this.EMPTY_IMAGE_HEIGHT) | 131 | // .height(this.EMPTY_IMAGE_HEIGHT) |
| 132 | 132 | ||
| 133 | Text(this.emptyType !== 8 ? this.buildNoDataTip() : `${this.buildNoDataTip()}(${this.timeNum}s)`) | 133 | Text(this.emptyType !== 8 ? this.buildNoDataTip() : `${this.buildNoDataTip()}(${this.timeNum}s)`) |
| 134 | - .fontSize($r('app.float.font_size_14')) | ||
| 135 | - .fontColor('#FF999999') | 134 | + .fontSize($r('app.float.font_size_14'))// .fontColor('#FF999999') |
| 136 | .fontWeight(FontWeight.Normal) | 135 | .fontWeight(FontWeight.Normal) |
| 137 | .opacity(this.TEXT_OPACITY) | 136 | .opacity(this.TEXT_OPACITY) |
| 138 | .margin({ top: this.EMPTY_TIP_TEXT_MARGIN_TOP }) | 137 | .margin({ top: this.EMPTY_TIP_TEXT_MARGIN_TOP }) |
| @@ -230,10 +229,10 @@ export struct EmptyComponent { | @@ -230,10 +229,10 @@ export struct EmptyComponent { | ||
| 230 | this.emptyType === WDViewDefaultType.WDViewDefaultType_NoHistory) { | 229 | this.emptyType === WDViewDefaultType.WDViewDefaultType_NoHistory) { |
| 231 | imageString = $r('app.media.icon_no_collection') | 230 | imageString = $r('app.media.icon_no_collection') |
| 232 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) { | 231 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) { |
| 233 | - imageString = $r('app.media.icon_no_message1') | 232 | + imageString = $r('app.media.icon_no_message') |
| 234 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment || | 233 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment || |
| 235 | this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) { | 234 | this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) { |
| 236 | - imageString = $r('app.media.icon_no_comment') | 235 | + imageString = $r('app.media.icon_no_comment1') |
| 237 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoSearchResult) { | 236 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoSearchResult) { |
| 238 | imageString = $r('app.media.icon_no_result1') | 237 | imageString = $r('app.media.icon_no_result1') |
| 239 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) { | 238 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) { |
| @@ -243,7 +242,7 @@ export struct EmptyComponent { | @@ -243,7 +242,7 @@ export struct EmptyComponent { | ||
| 243 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCreation) { | 242 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCreation) { |
| 244 | imageString = $r('app.media.icon_no_works1') | 243 | imageString = $r('app.media.icon_no_works1') |
| 245 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoBooking) { | 244 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoBooking) { |
| 246 | - imageString = $r('app.media.icon_no_appointmentMade') | 245 | + imageString = $r('app.media.icon_no_appointmentMade1') |
| 247 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NetworkFailed) { | 246 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NetworkFailed) { |
| 248 | imageString = $r('app.media.icon_no_limiting') | 247 | imageString = $r('app.media.icon_no_limiting') |
| 249 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) { | 248 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) { |
| @@ -251,7 +250,8 @@ export struct EmptyComponent { | @@ -251,7 +250,8 @@ export struct EmptyComponent { | ||
| 251 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) { | 250 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) { |
| 252 | imageString = $r('app.media.icon_no_content') | 251 | imageString = $r('app.media.icon_no_content') |
| 253 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent1 || | 252 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent1 || |
| 254 | - this.emptyType === WDViewDefaultType.WDViewDefaultType_NoFollow || this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent2) { | 253 | + this.emptyType === WDViewDefaultType.WDViewDefaultType_NoFollow || |
| 254 | + this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent2) { | ||
| 255 | imageString = $r('app.media.icon_no_appointmentMade1') | 255 | imageString = $r('app.media.icon_no_appointmentMade1') |
| 256 | } | 256 | } |
| 257 | return imageString | 257 | return imageString |
| @@ -65,7 +65,12 @@ export struct OperRowListView { | @@ -65,7 +65,12 @@ export struct OperRowListView { | ||
| 65 | * 7:图集详情页 | 65 | * 7:图集详情页 |
| 66 | */ | 66 | */ |
| 67 | @Prop componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口 | 67 | @Prop componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口 |
| 68 | - @Prop pageComponentType?: number = -1 //1:视频详情页 2:竖屏直播页 3:图集 4: 横屏直播页 | 68 | + /** |
| 69 | + * 用于区分页面类型,在哪个页面嵌套就传相应的值 | ||
| 70 | + * 1:视频详情页 2:竖屏直播页 3:图集 4:横屏直播页 | ||
| 71 | + */ | ||
| 72 | + @Prop pageComponentType?: number = -1 | ||
| 73 | + @Prop showBackIcon?: boolean = true | ||
| 69 | @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 74 | @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 70 | @Prop operationButtonList?: string[] = ['comment', 'collect', 'share'] // 组件展示条件 | 75 | @Prop operationButtonList?: string[] = ['comment', 'collect', 'share'] // 组件展示条件 |
| 71 | @State needLike: boolean = true | 76 | @State needLike: boolean = true |
| @@ -138,7 +143,7 @@ export struct OperRowListView { | @@ -138,7 +143,7 @@ export struct OperRowListView { | ||
| 138 | Image($r('app.media.ic_news_detail_division')) | 143 | Image($r('app.media.ic_news_detail_division')) |
| 139 | .width('100%') | 144 | .width('100%') |
| 140 | .height($r('app.float.margin_1')) | 145 | .height($r('app.float.margin_1')) |
| 141 | - .margin({bottom: -2}) | 146 | + // .margin({bottom: -2}) |
| 142 | 147 | ||
| 143 | Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { | 148 | Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { |
| 144 | // AudioDialog() | 149 | // AudioDialog() |
| @@ -151,14 +156,16 @@ export struct OperRowListView { | @@ -151,14 +156,16 @@ export struct OperRowListView { | ||
| 151 | .aspectRatio(1) | 156 | .aspectRatio(1) |
| 152 | .interpolation(ImageInterpolation.High) | 157 | .interpolation(ImageInterpolation.High) |
| 153 | } | 158 | } |
| 159 | + .width(48) | ||
| 154 | .hoverEffect(HoverEffect.Scale) | 160 | .hoverEffect(HoverEffect.Scale) |
| 161 | + .visibility(this.showBackIcon ? Visibility.Visible : Visibility.None) | ||
| 155 | .onClick(() => { | 162 | .onClick(() => { |
| 156 | if (this.onBack) { | 163 | if (this.onBack) { |
| 157 | this.onBack() | 164 | this.onBack() |
| 158 | } | 165 | } |
| 159 | router.back(); | 166 | router.back(); |
| 160 | }) | 167 | }) |
| 161 | - .width(48) | 168 | + |
| 162 | 169 | ||
| 163 | if (this.contentDetailData?.newsId) { | 170 | if (this.contentDetailData?.newsId) { |
| 164 | ForEach(this.operationButtonList, (item: string, index: number) => { | 171 | ForEach(this.operationButtonList, (item: string, index: number) => { |
| @@ -209,7 +216,8 @@ export struct OperRowListView { | @@ -209,7 +216,8 @@ export struct OperRowListView { | ||
| 209 | } | 216 | } |
| 210 | .layoutWeight(1) | 217 | .layoutWeight(1) |
| 211 | .margin({ | 218 | .margin({ |
| 212 | - right: this.pageComponentType === 1 ? 22 : 0, | 219 | + right: this.pageComponentType === 1 ? 20 : 0, |
| 220 | + left: 16 | ||
| 213 | }) | 221 | }) |
| 214 | 222 | ||
| 215 | if (this.showCommentIcon) { | 223 | if (this.showCommentIcon) { |
| @@ -39,18 +39,18 @@ export struct AreaPickerDialog { | @@ -39,18 +39,18 @@ export struct AreaPickerDialog { | ||
| 39 | this.confirmCallback(this.currentFirst.label,this.currentSecondBean.label,this.currentThirdBean.label,this.currentFirst.label+this.currentSecondBean.label+this.currentThirdBean.label); | 39 | this.confirmCallback(this.currentFirst.label,this.currentSecondBean.label,this.currentThirdBean.label,this.currentFirst.label+this.currentSecondBean.label+this.currentThirdBean.label); |
| 40 | }) | 40 | }) |
| 41 | .backgroundColor(0xffffff) | 41 | .backgroundColor(0xffffff) |
| 42 | - .fontColor(Color.Blue) | 42 | + .fontColor('#ED2800') |
| 43 | .layoutWeight(1) | 43 | .layoutWeight(1) |
| 44 | } | 44 | } |
| 45 | .margin({top:0,bottom:10}) | 45 | .margin({top:0,bottom:10}) |
| 46 | 46 | ||
| 47 | Row(){ | 47 | Row(){ |
| 48 | - FirstLevelComponent().width('30%') | ||
| 49 | - SecondLevelComponent().width('30%') | ||
| 50 | - ThirdLevelComponent().width('30%') | 48 | + FirstLevelComponent().width('33%') |
| 49 | + SecondLevelComponent().width('33%') | ||
| 50 | + ThirdLevelComponent().width('33%') | ||
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | .height('40%') | 53 | .height('40%') |
| 54 | - | 54 | + .width('100%') |
| 55 | } | 55 | } |
| 56 | } | 56 | } |
| 1 | import { RMCalendar } from '../components/calendar/RMCalendar' | 1 | import { RMCalendar } from '../components/calendar/RMCalendar' |
| 2 | import { RMCalendarBean } from '../components/calendar/RMCalendarBean' | 2 | import { RMCalendarBean } from '../components/calendar/RMCalendarBean' |
| 3 | +import { ToastUtils, NetworkUtil } from 'wdKit/Index'; | ||
| 3 | 4 | ||
| 4 | @CustomDialog | 5 | @CustomDialog |
| 5 | export struct ENewspaperCalendarDialog { | 6 | export struct ENewspaperCalendarDialog { |
| @@ -26,4 +27,9 @@ export struct ENewspaperCalendarDialog { | @@ -26,4 +27,9 @@ export struct ENewspaperCalendarDialog { | ||
| 26 | } | 27 | } |
| 27 | }) | 28 | }) |
| 28 | } | 29 | } |
| 30 | + aboutToAppear(): void { | ||
| 31 | + if (!NetworkUtil.isNetConnected()) { | ||
| 32 | + ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | ||
| 33 | + } | ||
| 34 | + } | ||
| 29 | } | 35 | } |
| 1 | import router from '@ohos.router' | 1 | import router from '@ohos.router' |
| 2 | -import { StringUtils } from 'wdKit'; | 2 | +import { NetworkUtil, StringUtils } from 'wdKit'; |
| 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 4 | import { editModelParams } from '../model/EditInfoModel'; | 4 | import { editModelParams } from '../model/EditInfoModel'; |
| 5 | import { HomePageBottomCommentComponent } from '../components/mine/home/HomePageBottomCommentComponent'; | 5 | import { HomePageBottomCommentComponent } from '../components/mine/home/HomePageBottomCommentComponent'; |
| 6 | import { HomePageBottomFollowComponent } from '../components/mine/home/HomePageBottomFollowComponent'; | 6 | import { HomePageBottomFollowComponent } from '../components/mine/home/HomePageBottomFollowComponent'; |
| 7 | import MinePageDatasModel from '../model/MinePageDatasModel'; | 7 | import MinePageDatasModel from '../model/MinePageDatasModel'; |
| 8 | +import { EmptyComponent } from '../components/view/EmptyComponent'; | ||
| 9 | +import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; | ||
| 8 | 10 | ||
| 9 | const TAG = "MineHomePage" | 11 | const TAG = "MineHomePage" |
| 10 | 12 | ||
| @@ -33,6 +35,7 @@ struct MineHomePage { | @@ -33,6 +35,7 @@ struct MineHomePage { | ||
| 33 | scroller: Scroller = new Scroller(); | 35 | scroller: Scroller = new Scroller(); |
| 34 | @State params:Record<string, string> = router.getParams() as Record<string, string>; | 36 | @State params:Record<string, string> = router.getParams() as Record<string, string>; |
| 35 | @State isCommentEnter:string = ""; | 37 | @State isCommentEnter:string = ""; |
| 38 | + @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | ||
| 36 | 39 | ||
| 37 | onPageShow(): void { | 40 | onPageShow(): void { |
| 38 | this.getUserInfo() | 41 | this.getUserInfo() |
| @@ -47,216 +50,235 @@ struct MineHomePage { | @@ -47,216 +50,235 @@ struct MineHomePage { | ||
| 47 | } | 50 | } |
| 48 | 51 | ||
| 49 | build() { | 52 | build() { |
| 50 | - Stack({ alignContent: Alignment.Top }){ | ||
| 51 | - Image($r('app.media.title_bg')) | ||
| 52 | - .width('100%') | ||
| 53 | - .height('355lpx') | ||
| 54 | - .objectFit(ImageFit.Cover) | 53 | + if(this.isConnectNetwork){ |
| 54 | + Stack({ alignContent: Alignment.Top }){ | ||
| 55 | + Image($r('app.media.title_bg')) | ||
| 56 | + .width('100%') | ||
| 57 | + .height('355lpx') | ||
| 58 | + .objectFit(ImageFit.Cover) | ||
| 59 | + | ||
| 60 | + Column(){ | ||
| 61 | + Stack({ alignContent: Alignment.Top }){ | ||
| 62 | + this.MineHomeTitleTransparent() | ||
| 63 | + this.MineHomeTitleWhite() | ||
| 64 | + } | ||
| 55 | 65 | ||
| 56 | - Column(){ | ||
| 57 | - Stack({ alignContent: Alignment.Top }){ | ||
| 58 | - this.MineHomeTitleTransparent() | ||
| 59 | - this.MineHomeTitleWhite() | ||
| 60 | - } | 66 | + Scroll(this.scroller) { |
| 67 | + Column() { | ||
| 68 | + //用户信息区域 | ||
| 69 | + Row() { | ||
| 70 | + Stack(){ | ||
| 71 | + Image(this.headPhotoUrl) | ||
| 72 | + .alt($r('app.media.default_head')) | ||
| 73 | + .width('115lpx') | ||
| 74 | + .height('115lpx') | ||
| 75 | + .objectFit(ImageFit.Auto) | ||
| 76 | + .clip(new Circle({ width: '115lpx', height: '115lpx' })) | ||
| 77 | + Image(this.levelHead) | ||
| 78 | + .width('165lpx') | ||
| 79 | + .height('165lpx') | ||
| 80 | + .objectFit(ImageFit.Auto) | ||
| 81 | + }.onClick(()=>{ | ||
| 82 | + let params = {'headPhotoUrl': this.headPhotoUrl} as Record<string, string>; | ||
| 83 | + WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params) | ||
| 84 | + }).width('165lpx') | ||
| 85 | + .height('165lpx') | ||
| 61 | 86 | ||
| 62 | - Scroll(this.scroller) { | ||
| 63 | - Column() { | ||
| 64 | - //用户信息区域 | ||
| 65 | - Row() { | ||
| 66 | - Stack(){ | ||
| 67 | - Image(this.headPhotoUrl) | ||
| 68 | - .alt($r('app.media.default_head')) | ||
| 69 | - .width('100lpx') | ||
| 70 | - .height('100lpx') | ||
| 71 | - .objectFit(ImageFit.Auto) | ||
| 72 | - .borderRadius(50) | ||
| 73 | - Image(this.levelHead) | ||
| 74 | - .width('130lpx') | ||
| 75 | - .height('130lpx') | ||
| 76 | - .objectFit(ImageFit.Cover) | ||
| 77 | - }.onClick(()=>{ | ||
| 78 | - let params = {'headPhotoUrl': this.headPhotoUrl} as Record<string, string>; | ||
| 79 | - WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params) | ||
| 80 | - }).width('135lpx') | ||
| 81 | - .height('135lpx') | 87 | + Column() { |
| 88 | + Row() { | ||
| 89 | + Text(`${this.userName}`) | ||
| 90 | + .fontColor($r('app.color.white')) | ||
| 91 | + .maxLines(1) | ||
| 92 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 93 | + .fontSize('38lpx') | ||
| 94 | + .lineHeight('50lpx') | ||
| 95 | + .fontWeight('500lpx') | ||
| 96 | + .onClick(()=>{ | ||
| 97 | + let params: editModelParams = { | ||
| 98 | + editContent: this.userName | ||
| 99 | + } | ||
| 100 | + WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage,params) | ||
| 101 | + }) | ||
| 102 | + | ||
| 103 | + if(this.levelId>0){ | ||
| 104 | + Text(`等级${this.levelId}`) | ||
| 105 | + .fontColor($r('app.color.color_ED2800')) | ||
| 106 | + .fontSize('23lpx') | ||
| 107 | + .fontWeight(500) | ||
| 108 | + .margin({ left: '10lpx' }) | ||
| 109 | + .backgroundImage($r("app.media.my_grade_bg")) | ||
| 110 | + .backgroundImageSize(ImageSize.Cover) | ||
| 111 | + .padding({left:"17lpx",right:"8lpx"}) | ||
| 112 | + .height('35lpx') | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + Blank() | ||
| 116 | + }.width('507lpx') | ||
| 82 | 117 | ||
| 118 | + Row() { | ||
| 119 | + Row() { | ||
| 120 | + Text(`${this.browseNum}`) | ||
| 121 | + .textStyle() | ||
| 122 | + Text("阅读") | ||
| 123 | + .textStyle2() | ||
| 124 | + } | ||
| 125 | + .margin({ right: '15lpx' }) | ||
| 126 | + | ||
| 127 | + Divider() | ||
| 128 | + .height('19lpx') | ||
| 129 | + .width('2lpx') | ||
| 130 | + .color($r('app.color.white')) | ||
| 131 | + .vertical(true) | ||
| 132 | + .opacity(0.4) | ||
| 133 | + Row() { | ||
| 134 | + Text(`${this.commentNum}`) | ||
| 135 | + .textStyle() | ||
| 136 | + Text("评论") | ||
| 137 | + .textStyle2() | ||
| 138 | + }.margin({ right: '15lpx', left: '15lpx' }) | ||
| 139 | + | ||
| 140 | + Divider() | ||
| 141 | + .height('19lpx') | ||
| 142 | + .width('2lpx') | ||
| 143 | + .color($r('app.color.white')) | ||
| 144 | + .vertical(true) | ||
| 145 | + .opacity(0.4) | ||
| 146 | + Row() { | ||
| 147 | + Text(`${this.attentionNum}`) | ||
| 148 | + .textStyle() | ||
| 149 | + Text("关注") | ||
| 150 | + .textStyle2() | ||
| 151 | + }.margin({ left: '15lpx' }) | ||
| 152 | + }.margin({ top: '23lpx' }) | ||
| 153 | + }.alignItems(HorizontalAlign.Start) | ||
| 154 | + .margin({ left: StringUtils.isEmpty(this.levelHead)?'32lpx':"3lpx" }) | ||
| 155 | + } | ||
| 156 | + .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 157 | + if (this.firstPositionY === 0) { | ||
| 158 | + this.firstPositionY = newValue.globalPosition.y as number | ||
| 159 | + }else{ | ||
| 160 | + let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3) | ||
| 161 | + if(persent > 1){ | ||
| 162 | + persent = 1 | ||
| 163 | + } | ||
| 164 | + this.tileOpacity = persent | ||
| 165 | + } | ||
| 166 | + }) | ||
| 167 | + .backgroundColor($r('app.color.color_transparent')) | ||
| 168 | + .height('184lpx') | ||
| 169 | + .width('100%') | ||
| 170 | + .padding({ left: '6lpx' }) | ||
| 171 | + | ||
| 172 | + | ||
| 173 | + //用户简介区域 | ||
| 83 | Column() { | 174 | Column() { |
| 84 | Row() { | 175 | Row() { |
| 85 | - Text(`${this.userName}`) | ||
| 86 | - .fontColor($r('app.color.white')) | ||
| 87 | - .maxLines(1) | 176 | + Text(this.isHasIntroduction?"简介:"+this.desc:this.desc) |
| 177 | + .fontSize('27lpx') | ||
| 178 | + .maxLines(3) | ||
| 88 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 179 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 89 | - .fontSize('38lpx') | ||
| 90 | - .lineHeight('50lpx') | ||
| 91 | - .fontWeight('500lpx') | 180 | + .lineHeight('40lpx') |
| 181 | + .fontWeight('400lpx') | ||
| 182 | + .fontColor(this.isHasIntroduction?$r('app.color.color_222222'):$r('app.color.color_999999')) | ||
| 183 | + .textAlign(TextAlign.Start) | ||
| 92 | .onClick(()=>{ | 184 | .onClick(()=>{ |
| 93 | let params: editModelParams = { | 185 | let params: editModelParams = { |
| 94 | - editContent: this.userName | 186 | + editContent: this.isHasIntroduction?this.desc:'' |
| 95 | } | 187 | } |
| 96 | - WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage,params) | 188 | + WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage,params) |
| 97 | }) | 189 | }) |
| 98 | - if(this.levelId>0){ | ||
| 99 | - Text(`等级${this.levelId}`) | ||
| 100 | - .textAlign(TextAlign.Center) | ||
| 101 | - .fontColor($r('app.color.color_ED2800')) | ||
| 102 | - .backgroundColor($r('app.color.white')) | ||
| 103 | - .fontSize('19lpx') | ||
| 104 | - .width('96lpx') | ||
| 105 | - .height('35lpx') | ||
| 106 | - .margin({ left: '10lpx' }) | 190 | + if(!this.isHasIntroduction){ |
| 191 | + Image($r('app.media.user_info_edit_icon')) | ||
| 192 | + .width('27lpx') | ||
| 193 | + .height('27lpx') | ||
| 194 | + .interpolation(ImageInterpolation.High) | ||
| 195 | + .objectFit(ImageFit.Auto) | ||
| 107 | } | 196 | } |
| 197 | + } | ||
| 108 | 198 | ||
| 109 | - Blank() | ||
| 110 | - }.width('507lpx') | ||
| 111 | 199 | ||
| 112 | - Row() { | ||
| 113 | - Row() { | ||
| 114 | - Text(`${this.browseNum}`) | ||
| 115 | - .textStyle() | ||
| 116 | - Text("阅读") | ||
| 117 | - .textStyle2() | ||
| 118 | - } | ||
| 119 | - .margin({ right: '15lpx' }) | ||
| 120 | - | ||
| 121 | - Divider() | ||
| 122 | - .height('19lpx') | ||
| 123 | - .width('2lpx') | ||
| 124 | - .color($r('app.color.white')) | ||
| 125 | - .vertical(true) | ||
| 126 | - .opacity(0.4) | ||
| 127 | - Row() { | ||
| 128 | - Text(`${this.commentNum}`) | ||
| 129 | - .textStyle() | ||
| 130 | - Text("评论") | ||
| 131 | - .textStyle2() | ||
| 132 | - }.margin({ right: '15lpx', left: '15lpx' }) | ||
| 133 | - | ||
| 134 | - Divider() | ||
| 135 | - .height('19lpx') | ||
| 136 | - .width('2lpx') | ||
| 137 | - .color($r('app.color.white')) | ||
| 138 | - .vertical(true) | ||
| 139 | - .opacity(0.4) | ||
| 140 | - Row() { | ||
| 141 | - Text(`${this.attentionNum}`) | ||
| 142 | - .textStyle() | ||
| 143 | - Text("关注") | ||
| 144 | - .textStyle2() | ||
| 145 | - }.margin({ left: '15lpx' }) | ||
| 146 | - }.margin({ top: '23lpx' }) | ||
| 147 | - }.alignItems(HorizontalAlign.Start) | ||
| 148 | - .margin({ left: '32lpx' }) | ||
| 149 | - } | ||
| 150 | - .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 151 | - if (this.firstPositionY === 0) { | ||
| 152 | - this.firstPositionY = newValue.globalPosition.y as number | ||
| 153 | - }else{ | ||
| 154 | - let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3) | ||
| 155 | - if(persent > 1){ | ||
| 156 | - persent = 1 | ||
| 157 | - } | ||
| 158 | - this.tileOpacity = persent | ||
| 159 | - } | ||
| 160 | - }) | ||
| 161 | - .backgroundColor($r('app.color.color_transparent')) | ||
| 162 | - .height('184lpx') | ||
| 163 | - .width('100%') | ||
| 164 | - .padding({ left: '35lpx' }) | ||
| 165 | - //用户简介区域 | ||
| 166 | - Column() { | ||
| 167 | - Row() { | ||
| 168 | - Text(this.desc) | ||
| 169 | - .fontSize('27lpx') | ||
| 170 | - .maxLines(3) | ||
| 171 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 172 | - .lineHeight('40lpx') | 200 | + Text(`来到人民日报${this.registerTimeForDay}天`) |
| 201 | + .fontSize('23lpx') | ||
| 202 | + .lineHeight('25lpx') | ||
| 173 | .fontWeight('400lpx') | 203 | .fontWeight('400lpx') |
| 174 | - .fontColor(this.isHasIntroduction?$r('app.color.color_222222'):$r('app.color.color_999999')) | 204 | + .fontColor($r('app.color.color_999999')) |
| 175 | .textAlign(TextAlign.Start) | 205 | .textAlign(TextAlign.Start) |
| 176 | - .onClick(()=>{ | ||
| 177 | - let params: editModelParams = { | ||
| 178 | - editContent: this.isHasIntroduction?this.desc:'' | ||
| 179 | - } | ||
| 180 | - WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage,params) | ||
| 181 | - }) | ||
| 182 | - if(!this.isHasIntroduction){ | ||
| 183 | - Image($r('app.media.user_info_edit_icon')) | ||
| 184 | - .width('27lpx') | ||
| 185 | - .height('27lpx') | ||
| 186 | - .interpolation(ImageInterpolation.High) | ||
| 187 | - .objectFit(ImageFit.Auto) | ||
| 188 | - } | ||
| 189 | - } | ||
| 190 | - | 206 | + .margin({ top: '15lpx' }) |
| 191 | 207 | ||
| 192 | - Text(`来到人民日报${this.registerTimeForDay}天`) | ||
| 193 | - .fontSize('23lpx') | ||
| 194 | - .lineHeight('25lpx') | ||
| 195 | - .fontWeight('400lpx') | ||
| 196 | - .fontColor($r('app.color.color_999999')) | ||
| 197 | - .textAlign(TextAlign.Start) | ||
| 198 | - .margin({ top: '15lpx' }) | ||
| 199 | - | ||
| 200 | - }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'}) | ||
| 201 | - .alignItems(HorizontalAlign.Start) | ||
| 202 | - .justifyContent(FlexAlign.Center) | ||
| 203 | - .width('100%') | ||
| 204 | - .backgroundColor($r('app.color.white')) | ||
| 205 | - //间隔符 | ||
| 206 | - | ||
| 207 | - Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') | ||
| 208 | - | ||
| 209 | - //tab 页面 | ||
| 210 | - Stack({ alignContent: Alignment.Top }){ | ||
| 211 | - Tabs({controller: this.controller}) { | ||
| 212 | - TabContent() { | ||
| 213 | - HomePageBottomCommentComponent({commentNum:$commentNum}) | ||
| 214 | - } | ||
| 215 | - TabContent() { | ||
| 216 | - HomePageBottomFollowComponent() | ||
| 217 | - } | ||
| 218 | - } | 208 | + }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'}) |
| 209 | + .alignItems(HorizontalAlign.Start) | ||
| 210 | + .justifyContent(FlexAlign.Center) | ||
| 211 | + .width('100%') | ||
| 219 | .backgroundColor($r('app.color.white')) | 212 | .backgroundColor($r('app.color.white')) |
| 220 | - .animationDuration(0) | ||
| 221 | - .onChange((index: number) => { | ||
| 222 | - this.currentIndex = index | ||
| 223 | - }) | ||
| 224 | - .vertical(false) | ||
| 225 | - .barHeight("77lpx") | 213 | + //间隔符 |
| 226 | 214 | ||
| 227 | - Column() { | ||
| 228 | - // 页签 | ||
| 229 | - Row({ space: 7 }) { | ||
| 230 | - Scroll() { | ||
| 231 | - Row() { | ||
| 232 | - this.TabBuilder(0,"评论") | ||
| 233 | - this.TabBuilder(1,"关注") | 215 | + Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') |
| 216 | + | ||
| 217 | + //tab 页面 | ||
| 218 | + Stack({ alignContent: Alignment.Top }){ | ||
| 219 | + Tabs({controller: this.controller}) { | ||
| 220 | + TabContent() { | ||
| 221 | + HomePageBottomCommentComponent({commentNum:$commentNum}) | ||
| 222 | + } | ||
| 223 | + TabContent() { | ||
| 224 | + HomePageBottomFollowComponent() | ||
| 225 | + } | ||
| 226 | + } | ||
| 227 | + .backgroundColor($r('app.color.white')) | ||
| 228 | + .animationDuration(0) | ||
| 229 | + .onChange((index: number) => { | ||
| 230 | + this.currentIndex = index | ||
| 231 | + }) | ||
| 232 | + .vertical(false) | ||
| 233 | + .barHeight("77lpx") | ||
| 234 | + | ||
| 235 | + Column() { | ||
| 236 | + // 页签 | ||
| 237 | + Row({ space: 7 }) { | ||
| 238 | + Scroll() { | ||
| 239 | + Row() { | ||
| 240 | + this.TabBuilder(0,"评论") | ||
| 241 | + this.TabBuilder(1,"关注") | ||
| 242 | + } | ||
| 243 | + .justifyContent(FlexAlign.Start) | ||
| 234 | } | 244 | } |
| 235 | - .justifyContent(FlexAlign.Start) | 245 | + .align(Alignment.Start) |
| 246 | + .scrollable(ScrollDirection.Horizontal) | ||
| 247 | + .scrollBar(BarState.Off) | ||
| 248 | + .width('100%') | ||
| 249 | + .padding({left:'31lpx'}) | ||
| 236 | } | 250 | } |
| 237 | - .align(Alignment.Start) | ||
| 238 | - .scrollable(ScrollDirection.Horizontal) | ||
| 239 | - .scrollBar(BarState.Off) | 251 | + .alignItems(VerticalAlign.Bottom) |
| 240 | .width('100%') | 252 | .width('100%') |
| 241 | - .padding({left:'31lpx'}) | ||
| 242 | } | 253 | } |
| 243 | - .alignItems(VerticalAlign.Bottom) | 254 | + .backgroundColor($r('app.color.white')) |
| 255 | + .alignItems(HorizontalAlign.Start) | ||
| 244 | .width('100%') | 256 | .width('100%') |
| 257 | + .height('77lpx') | ||
| 245 | } | 258 | } |
| 246 | - .backgroundColor($r('app.color.white')) | ||
| 247 | - .alignItems(HorizontalAlign.Start) | ||
| 248 | - .width('100%') | ||
| 249 | - .height('77lpx') | ||
| 250 | - } | ||
| 251 | - }.width("100%") | 259 | + }.width("100%") |
| 260 | + } | ||
| 261 | + .edgeEffect(EdgeEffect.None) | ||
| 262 | + .scrollBar(BarState.Off) | ||
| 263 | + .width('100%') | ||
| 264 | + .layoutWeight(1) | ||
| 252 | } | 265 | } |
| 253 | - .edgeEffect(EdgeEffect.None) | ||
| 254 | - .scrollBar(BarState.Off) | ||
| 255 | - .width('100%') | ||
| 256 | - .layoutWeight(1) | 266 | + }.width('100%') |
| 267 | + .layoutWeight(1) | ||
| 268 | + }else{ | ||
| 269 | + Column(){ | ||
| 270 | + CustomTitleUI({ titleName: "" }) | ||
| 271 | + | ||
| 272 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 273 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 274 | + if(this.isConnectNetwork){ | ||
| 275 | + this.getUserInfo() | ||
| 276 | + } | ||
| 277 | + },}) | ||
| 278 | + .layoutWeight(1) | ||
| 279 | + .width('100%') | ||
| 257 | } | 280 | } |
| 258 | - }.width('100%') | ||
| 259 | - .layoutWeight(1) | 281 | + } |
| 260 | 282 | ||
| 261 | } | 283 | } |
| 262 | @Builder MineHomeTitleTransparent() { | 284 | @Builder MineHomeTitleTransparent() { |
| @@ -417,7 +439,7 @@ struct MineHomePage { | @@ -417,7 +439,7 @@ struct MineHomePage { | ||
| 417 | this.userName = value.userName | 439 | this.userName = value.userName |
| 418 | this.headPhotoUrl = value.headPhotoUrl | 440 | this.headPhotoUrl = value.headPhotoUrl |
| 419 | if(StringUtils.isNotEmpty(value.introduction)){ | 441 | if(StringUtils.isNotEmpty(value.introduction)){ |
| 420 | - this.desc = "简介:" + value.introduction | 442 | + this.desc = value.introduction |
| 421 | this.isHasIntroduction = true | 443 | this.isHasIntroduction = true |
| 422 | }else{ | 444 | }else{ |
| 423 | this.desc = "点击添加简介,让大家认识你" | 445 | this.desc = "点击添加简介,让大家认识你" |
| 1 | import router from '@ohos.router' | 1 | import router from '@ohos.router' |
| 2 | import { Params } from 'wdBean'; | 2 | import { Params } from 'wdBean'; |
| 3 | -import { StringUtils } from 'wdKit'; | 3 | +import { NetworkUtil, StringUtils } from 'wdKit'; |
| 4 | import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent'; | 4 | import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent'; |
| 5 | import { OtherHomePageBottomFollowComponent } from '../components/mine/home/OtherHomePageBottomFollowComponent'; | 5 | import { OtherHomePageBottomFollowComponent } from '../components/mine/home/OtherHomePageBottomFollowComponent'; |
| 6 | +import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; | ||
| 7 | +import { EmptyComponent } from '../components/view/EmptyComponent'; | ||
| 6 | import MinePageDatasModel from '../model/MinePageDatasModel'; | 8 | import MinePageDatasModel from '../model/MinePageDatasModel'; |
| 7 | import { OtherUserDetailRequestItem } from '../viewmodel/OtherUserDetailRequestItem'; | 9 | import { OtherUserDetailRequestItem } from '../viewmodel/OtherUserDetailRequestItem'; |
| 8 | 10 | ||
| @@ -39,6 +41,7 @@ struct OtherNormalUserHomePage { | @@ -39,6 +41,7 @@ struct OtherNormalUserHomePage { | ||
| 39 | @State attentionNum:number = 0//关注数 | 41 | @State attentionNum:number = 0//关注数 |
| 40 | @State desc:string = "" | 42 | @State desc:string = "" |
| 41 | userType:string = "1" | 43 | userType:string = "1" |
| 44 | + @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | ||
| 42 | 45 | ||
| 43 | aboutToAppear(){ | 46 | aboutToAppear(){ |
| 44 | this.getUserInfo() | 47 | this.getUserInfo() |
| @@ -47,185 +50,202 @@ struct OtherNormalUserHomePage { | @@ -47,185 +50,202 @@ struct OtherNormalUserHomePage { | ||
| 47 | 50 | ||
| 48 | 51 | ||
| 49 | build() { | 52 | build() { |
| 50 | - Stack({ alignContent: Alignment.Top }){ | ||
| 51 | - Image($r('app.media.title_bg')) | ||
| 52 | - .width('100%') | ||
| 53 | - .height('355lpx') | ||
| 54 | - .objectFit(ImageFit.Cover) | ||
| 55 | - | ||
| 56 | - Column(){ | ||
| 57 | - Stack({ alignContent: Alignment.Top }){ | ||
| 58 | - this.MineHomeTitleTransparent() | ||
| 59 | - this.MineHomeTitleWhite() | ||
| 60 | - } | 53 | + if(this.isConnectNetwork){ |
| 54 | + Stack({ alignContent: Alignment.Top }){ | ||
| 55 | + Image($r('app.media.title_bg')) | ||
| 56 | + .width('100%') | ||
| 57 | + .height('355lpx') | ||
| 58 | + .objectFit(ImageFit.Cover) | ||
| 59 | + | ||
| 60 | + Column(){ | ||
| 61 | + Stack({ alignContent: Alignment.Top }){ | ||
| 62 | + this.MineHomeTitleTransparent() | ||
| 63 | + this.MineHomeTitleWhite() | ||
| 64 | + } | ||
| 61 | 65 | ||
| 62 | - Scroll() { | ||
| 63 | - Column() { | ||
| 64 | - //用户信息区域 | ||
| 65 | - Row() { | ||
| 66 | - Stack(){ | ||
| 67 | - Image(this.headPhotoUrl) | ||
| 68 | - .alt($r('app.media.default_head')) | ||
| 69 | - .width('100lpx') | ||
| 70 | - .height('100lpx') | ||
| 71 | - .objectFit(ImageFit.Cover) | ||
| 72 | - .borderRadius(50) | ||
| 73 | - Image(this.levelHead) | ||
| 74 | - .width('130lpx') | ||
| 75 | - .height('130lpx') | ||
| 76 | - .objectFit(ImageFit.Cover) | ||
| 77 | - .borderRadius(50) | ||
| 78 | - } | 66 | + Scroll() { |
| 67 | + Column() { | ||
| 68 | + //用户信息区域 | ||
| 69 | + Row() { | ||
| 70 | + Stack(){ | ||
| 71 | + Image(this.headPhotoUrl) | ||
| 72 | + .alt($r('app.media.default_head')) | ||
| 73 | + .width('115lpx') | ||
| 74 | + .height('115lpx') | ||
| 75 | + .objectFit(ImageFit.Cover) | ||
| 76 | + .clip(new Circle({ width: '115lpx', height: '115lpx' })) | ||
| 77 | + Image(this.levelHead) | ||
| 78 | + .width('165lpx') | ||
| 79 | + .height('165lpx') | ||
| 80 | + .objectFit(ImageFit.Cover) | ||
| 81 | + } | ||
| 79 | 82 | ||
| 80 | - Column() { | ||
| 81 | - Row() { | ||
| 82 | - Text(`${this.userName}`) | ||
| 83 | - .fontColor($r('app.color.white')) | ||
| 84 | - .maxLines(1) | ||
| 85 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 86 | - .fontSize('38lpx') | ||
| 87 | - .lineHeight('50lpx') | ||
| 88 | - .fontWeight('500lpx') | ||
| 89 | - | ||
| 90 | - Text(`等级${this.levelId}`) | ||
| 91 | - .textAlign(TextAlign.Center) | ||
| 92 | - .fontColor($r('app.color.color_ED2800')) | ||
| 93 | - .backgroundColor($r('app.color.white')) | ||
| 94 | - .fontSize('19lpx') | ||
| 95 | - .width('96lpx') | ||
| 96 | - .height('35lpx') | ||
| 97 | - .margin({ left: '10lpx' }) | ||
| 98 | - Blank() | ||
| 99 | - }.width('507lpx') | ||
| 100 | - | ||
| 101 | - Row() { | ||
| 102 | - Row() { | ||
| 103 | - Text(`${this.browseNum}`) | ||
| 104 | - .textStyle() | ||
| 105 | - Text("阅读") | ||
| 106 | - .textStyle2() | ||
| 107 | - } | ||
| 108 | - .margin({ right: '15lpx' }) | ||
| 109 | - | ||
| 110 | - Divider() | ||
| 111 | - .height('19lpx') | ||
| 112 | - .width('2lpx') | ||
| 113 | - .color($r('app.color.white')) | ||
| 114 | - .vertical(true) | ||
| 115 | - .opacity(0.4) | 83 | + Column() { |
| 116 | Row() { | 84 | Row() { |
| 117 | - Text(`${this.commentNum}`) | ||
| 118 | - .textStyle() | ||
| 119 | - Text("评论") | ||
| 120 | - .textStyle2() | ||
| 121 | - }.margin({ right: '15lpx', left: '15lpx' }) | ||
| 122 | - | ||
| 123 | - Divider() | ||
| 124 | - .height('19lpx') | ||
| 125 | - .width('2lpx') | ||
| 126 | - .color($r('app.color.white')) | ||
| 127 | - .vertical(true) | ||
| 128 | - .opacity(0.4) | 85 | + Text(`${this.userName}`) |
| 86 | + .fontColor($r('app.color.white')) | ||
| 87 | + .maxLines(1) | ||
| 88 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 89 | + .fontSize('38lpx') | ||
| 90 | + .lineHeight('50lpx') | ||
| 91 | + .fontWeight('500lpx') | ||
| 92 | + | ||
| 93 | + if(this.levelId>0){ | ||
| 94 | + Text(`等级${this.levelId}`) | ||
| 95 | + .fontColor($r('app.color.color_ED2800')) | ||
| 96 | + .fontSize('23lpx') | ||
| 97 | + .fontWeight(500) | ||
| 98 | + .margin({ left: '10lpx' }) | ||
| 99 | + .backgroundImage($r("app.media.my_grade_bg")) | ||
| 100 | + .backgroundImageSize(ImageSize.Cover) | ||
| 101 | + .padding({left:"17lpx",right:"8lpx"}) | ||
| 102 | + .height('35lpx') | ||
| 103 | + } | ||
| 104 | + Blank() | ||
| 105 | + }.width('507lpx') | ||
| 106 | + | ||
| 129 | Row() { | 107 | Row() { |
| 130 | - Text(`${this.attentionNum}`) | ||
| 131 | - .textStyle() | ||
| 132 | - Text("关注") | ||
| 133 | - .textStyle2() | ||
| 134 | - }.margin({ left: '15lpx' }) | ||
| 135 | - }.margin({ top: '23lpx' }) | ||
| 136 | - }.alignItems(HorizontalAlign.Start) | ||
| 137 | - .margin({ left: '32lpx' }) | ||
| 138 | - } | ||
| 139 | - .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 140 | - if (this.firstPositionY === 0) { | ||
| 141 | - this.firstPositionY = newValue.globalPosition.y as number | ||
| 142 | - }else{ | ||
| 143 | - let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3) | ||
| 144 | - if(persent > 1){ | ||
| 145 | - persent = 1 | ||
| 146 | - } | ||
| 147 | - this.tileOpacity = persent | 108 | + Row() { |
| 109 | + Text(`${this.browseNum}`) | ||
| 110 | + .textStyle() | ||
| 111 | + Text("阅读") | ||
| 112 | + .textStyle2() | ||
| 113 | + } | ||
| 114 | + .margin({ right: '15lpx' }) | ||
| 115 | + | ||
| 116 | + Divider() | ||
| 117 | + .height('19lpx') | ||
| 118 | + .width('2lpx') | ||
| 119 | + .color($r('app.color.white')) | ||
| 120 | + .vertical(true) | ||
| 121 | + .opacity(0.4) | ||
| 122 | + Row() { | ||
| 123 | + Text(`${this.commentNum}`) | ||
| 124 | + .textStyle() | ||
| 125 | + Text("评论") | ||
| 126 | + .textStyle2() | ||
| 127 | + }.margin({ right: '15lpx', left: '15lpx' }) | ||
| 128 | + | ||
| 129 | + Divider() | ||
| 130 | + .height('19lpx') | ||
| 131 | + .width('2lpx') | ||
| 132 | + .color($r('app.color.white')) | ||
| 133 | + .vertical(true) | ||
| 134 | + .opacity(0.4) | ||
| 135 | + Row() { | ||
| 136 | + Text(`${this.attentionNum}`) | ||
| 137 | + .textStyle() | ||
| 138 | + Text("关注") | ||
| 139 | + .textStyle2() | ||
| 140 | + }.margin({ left: '15lpx' }) | ||
| 141 | + }.margin({ top: '23lpx' }) | ||
| 142 | + }.alignItems(HorizontalAlign.Start) | ||
| 143 | + .margin({ left: StringUtils.isEmpty(this.levelHead)?'32lpx':"3lpx" }) | ||
| 148 | } | 144 | } |
| 149 | - }) | ||
| 150 | - .backgroundColor($r('app.color.color_transparent')) | ||
| 151 | - .height('184lpx') | ||
| 152 | - .width('100%') | ||
| 153 | - .padding({ left: '35lpx' }) | ||
| 154 | - | ||
| 155 | - //用户简介区域 | ||
| 156 | - if(StringUtils.isNotEmpty(this.desc)){ | ||
| 157 | - Column() { | ||
| 158 | - Row() { | ||
| 159 | - Text(this.desc) | ||
| 160 | - .fontSize('27lpx') | ||
| 161 | - .maxLines(3) | ||
| 162 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 163 | - .lineHeight('40lpx') | ||
| 164 | - .fontWeight('400lpx') | ||
| 165 | - .fontColor($r('app.color.color_222222')) | ||
| 166 | - .textAlign(TextAlign.Start) | ||
| 167 | - | ||
| 168 | - } | ||
| 169 | - }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'}) | ||
| 170 | - .alignItems(HorizontalAlign.Start) | ||
| 171 | - .justifyContent(FlexAlign.Center) | ||
| 172 | - .width('100%') | ||
| 173 | - .backgroundColor($r('app.color.white')) | ||
| 174 | - } | ||
| 175 | - //间隔符 | ||
| 176 | - Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') | ||
| 177 | - | ||
| 178 | - //tab 页面 | ||
| 179 | - Stack({ alignContent: Alignment.Top }){ | ||
| 180 | - Tabs({controller: this.controller}) { | ||
| 181 | - TabContent() { | ||
| 182 | - OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum}) | ||
| 183 | - } | ||
| 184 | - TabContent() { | ||
| 185 | - OtherHomePageBottomFollowComponent({curUserId:this.curUserId}) | 145 | + .onAreaChange((oldValue: Area, newValue: Area) => { |
| 146 | + if (this.firstPositionY === 0) { | ||
| 147 | + this.firstPositionY = newValue.globalPosition.y as number | ||
| 148 | + }else{ | ||
| 149 | + let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3) | ||
| 150 | + if(persent > 1){ | ||
| 151 | + persent = 1 | ||
| 152 | + } | ||
| 153 | + this.tileOpacity = persent | ||
| 186 | } | 154 | } |
| 187 | - } | ||
| 188 | - .backgroundColor($r('app.color.white')) | ||
| 189 | - .animationDuration(0) | ||
| 190 | - .onChange((index: number) => { | ||
| 191 | - this.currentIndex = index | ||
| 192 | }) | 155 | }) |
| 193 | - .vertical(false) | ||
| 194 | - .barHeight('77lpx') | 156 | + .backgroundColor($r('app.color.color_transparent')) |
| 157 | + .height('184lpx') | ||
| 158 | + .width('100%') | ||
| 159 | + .padding({ left: '6lpx' }) | ||
| 195 | 160 | ||
| 196 | - Column() { | ||
| 197 | - // 页签 | ||
| 198 | - Row({ space: 7 }) { | ||
| 199 | - Scroll() { | ||
| 200 | - Row() { | ||
| 201 | - this.TabBuilder(0,"评论") | ||
| 202 | - this.TabBuilder(1,"关注") | 161 | + //用户简介区域 |
| 162 | + if(StringUtils.isNotEmpty(this.desc)){ | ||
| 163 | + Column() { | ||
| 164 | + Row() { | ||
| 165 | + Text(this.desc) | ||
| 166 | + .fontSize('27lpx') | ||
| 167 | + .maxLines(3) | ||
| 168 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 169 | + .lineHeight('40lpx') | ||
| 170 | + .fontWeight('400lpx') | ||
| 171 | + .fontColor($r('app.color.color_222222')) | ||
| 172 | + .textAlign(TextAlign.Start) | ||
| 173 | + | ||
| 174 | + } | ||
| 175 | + }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'}) | ||
| 176 | + .alignItems(HorizontalAlign.Start) | ||
| 177 | + .justifyContent(FlexAlign.Center) | ||
| 178 | + .width('100%') | ||
| 179 | + .backgroundColor($r('app.color.white')) | ||
| 180 | + } | ||
| 181 | + //间隔符 | ||
| 182 | + Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') | ||
| 183 | + | ||
| 184 | + //tab 页面 | ||
| 185 | + Stack({ alignContent: Alignment.Top }){ | ||
| 186 | + Tabs({controller: this.controller}) { | ||
| 187 | + TabContent() { | ||
| 188 | + OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum}) | ||
| 189 | + } | ||
| 190 | + TabContent() { | ||
| 191 | + OtherHomePageBottomFollowComponent({curUserId:this.curUserId}) | ||
| 192 | + } | ||
| 193 | + } | ||
| 194 | + .backgroundColor($r('app.color.white')) | ||
| 195 | + .animationDuration(0) | ||
| 196 | + .onChange((index: number) => { | ||
| 197 | + this.currentIndex = index | ||
| 198 | + }) | ||
| 199 | + .vertical(false) | ||
| 200 | + .barHeight('77lpx') | ||
| 201 | + | ||
| 202 | + Column() { | ||
| 203 | + // 页签 | ||
| 204 | + Row({ space: 7 }) { | ||
| 205 | + Scroll() { | ||
| 206 | + Row() { | ||
| 207 | + this.TabBuilder(0,"评论") | ||
| 208 | + this.TabBuilder(1,"关注") | ||
| 209 | + } | ||
| 210 | + .justifyContent(FlexAlign.Start) | ||
| 203 | } | 211 | } |
| 204 | - .justifyContent(FlexAlign.Start) | 212 | + .align(Alignment.Start) |
| 213 | + .scrollable(ScrollDirection.Horizontal) | ||
| 214 | + .scrollBar(BarState.Off) | ||
| 215 | + .width('90%') | ||
| 216 | + .padding({left:'31lpx'}) | ||
| 205 | } | 217 | } |
| 206 | - .align(Alignment.Start) | ||
| 207 | - .scrollable(ScrollDirection.Horizontal) | ||
| 208 | - .scrollBar(BarState.Off) | ||
| 209 | - .width('90%') | ||
| 210 | - .padding({left:'31lpx'}) | 218 | + .alignItems(VerticalAlign.Bottom) |
| 219 | + .width('100%') | ||
| 211 | } | 220 | } |
| 212 | - .alignItems(VerticalAlign.Bottom) | 221 | + .backgroundColor($r('app.color.white')) |
| 222 | + .alignItems(HorizontalAlign.Start) | ||
| 213 | .width('100%') | 223 | .width('100%') |
| 224 | + .height('77lpx') | ||
| 214 | } | 225 | } |
| 215 | - .backgroundColor($r('app.color.white')) | ||
| 216 | - .alignItems(HorizontalAlign.Start) | ||
| 217 | - .width('100%') | ||
| 218 | - .height('77lpx') | ||
| 219 | - } | ||
| 220 | - }.width("100%") | 226 | + }.width("100%") |
| 227 | + } | ||
| 228 | + .edgeEffect(EdgeEffect.None) | ||
| 229 | + .scrollBar(BarState.Off) | ||
| 230 | + .width('100%') | ||
| 231 | + .layoutWeight(1) | ||
| 221 | } | 232 | } |
| 222 | - .edgeEffect(EdgeEffect.None) | ||
| 223 | - .scrollBar(BarState.Off) | ||
| 224 | - .width('100%') | ||
| 225 | - .layoutWeight(1) | 233 | + }.width('100%') |
| 234 | + .layoutWeight(1) | ||
| 235 | + }else{ | ||
| 236 | + Column(){ | ||
| 237 | + CustomTitleUI({ titleName: "" }) | ||
| 238 | + | ||
| 239 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 240 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 241 | + if(this.isChangeToUserEdit){ | ||
| 242 | + this.getUserInfo() | ||
| 243 | + } | ||
| 244 | + },}) | ||
| 245 | + .layoutWeight(1) | ||
| 246 | + .width('100%') | ||
| 226 | } | 247 | } |
| 227 | - }.width('100%') | ||
| 228 | - .layoutWeight(1) | 248 | + } |
| 229 | 249 | ||
| 230 | } | 250 | } |
| 231 | @Builder MineHomeTitleTransparent() { | 251 | @Builder MineHomeTitleTransparent() { |
| 1 | import { common } from '@kit.AbilityKit'; | 1 | import { common } from '@kit.AbilityKit'; |
| 2 | import { insightIntent } from '@kit.IntentsKit'; | 2 | import { insightIntent } from '@kit.IntentsKit'; |
| 3 | import { BusinessError } from '@kit.BasicServicesKit'; | 3 | import { BusinessError } from '@kit.BasicServicesKit'; |
| 4 | -import { CompDTO, CompList, ContentDTO, PageInfoBean } from 'wdBean'; | 4 | +import { CompDTO, CompList, ContentDTO, PageInfoBean, ContentDetailDTO, InteractDataDTO } from 'wdBean'; |
| 5 | 5 | ||
| 6 | function generateUUID() { | 6 | function generateUUID() { |
| 7 | let dt = new Date().getTime(); // 获取当前时间的时间戳(毫秒) | 7 | let dt = new Date().getTime(); // 获取当前时间的时间戳(毫秒) |
| @@ -82,12 +82,58 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent | @@ -82,12 +82,58 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent | ||
| 82 | } | 82 | } |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | +//ViewBlog意图共享-节目详情 目前单独在详情页上报 | ||
| 86 | +export function viewBlogItemInsightIntentShare(context: common.UIAbilityContext, item: ContentDetailDTO, | ||
| 87 | + interactData?: InteractDataDTO) { | ||
| 88 | + let identifier = generateUUID() | ||
| 89 | + let viewBlogInsightIntentItem: insightIntent.InsightIntent = { | ||
| 90 | + intentName: 'ViewBlog', | ||
| 91 | + intentVersion: '1.0.1', | ||
| 92 | + identifier, | ||
| 93 | + intentActionInfo: { | ||
| 94 | + actionMode: ActionMode.EXECUTED, | ||
| 95 | + currentPercentage: 50, | ||
| 96 | + }, | ||
| 97 | + intentEntityInfo: { | ||
| 98 | + entityName: 'Blog', | ||
| 99 | + entityId: String(item?.newsId), | ||
| 100 | + displayName: item?.newsTitle, | ||
| 101 | + entityGroupId: String(item?.reLInfo?.channelId), //channelId | ||
| 102 | + logoURL: item.fullColumnImgUrls.length > 0 ? item.fullColumnImgUrls[0]?.url : item.firstFrameImageUri, | ||
| 103 | + metadataModificationTime: item?.publishTime, | ||
| 104 | + blogTitle: item?.newsTitle, | ||
| 105 | + blogType: 'Normal', | ||
| 106 | + blogCategory: item, | ||
| 107 | + categoryDisplayName: '', //TODO 分类名称 | ||
| 108 | + blogSubTitle: item?.newsSummary.length > 20 ? | ||
| 109 | + item?.newsSummary.substring(0, 20) : item?.newsSummary, | ||
| 110 | + blogAuthor: item?.newsSourceName, | ||
| 111 | + blogPublishTime: item?.publishTime, | ||
| 112 | + tag: item?.newsTags.split(','), | ||
| 113 | + viewCount: item?.viewCount || 0, | ||
| 114 | + likeCount: interactData?.likeNum || 0, | ||
| 115 | + forwardCount: interactData?.shareNum || 0, | ||
| 116 | + commentCount: interactData?.commentNum || 0, | ||
| 117 | + favorites: interactData?.collectNum || 0, | ||
| 118 | + rankingHint: 99, | ||
| 119 | + isPublicData: true | ||
| 120 | + } | ||
| 121 | + } | ||
| 85 | 122 | ||
| 86 | -//ViewBlog意图共享-早晚报 | 123 | + console.log('yzl', JSON.stringify(viewBlogInsightIntentItem)) |
| 124 | + // 共享数据 | ||
| 125 | + insightIntent.shareIntent(context, [viewBlogInsightIntentItem]).then(() => { | ||
| 126 | + console.log('yzl shareIntent success'); | ||
| 127 | + }).catch((err: BusinessError) => { | ||
| 128 | + console.error(`yzl failed because ${err?.message}`); | ||
| 129 | + }); | ||
| 130 | +} | ||
| 131 | + | ||
| 132 | +//ViewColumn意图共享-早晚报 | ||
| 87 | export function viewColumInsightIntentShare(context: common.UIAbilityContext, entityId: string, | 133 | export function viewColumInsightIntentShare(context: common.UIAbilityContext, entityId: string, |
| 88 | pageInfoBean: PageInfoBean) { | 134 | pageInfoBean: PageInfoBean) { |
| 89 | console.log('viewColumInsightIntentShare') | 135 | console.log('viewColumInsightIntentShare') |
| 90 | - let viewBlogInsightIntentItem: insightIntent.InsightIntent = { | 136 | + let viewColumInsightIntentItem: insightIntent.InsightIntent = { |
| 91 | intentName: 'ViewColumn', | 137 | intentName: 'ViewColumn', |
| 92 | intentVersion: '1.0.1', | 138 | intentVersion: '1.0.1', |
| 93 | identifier: generateUUID(), | 139 | identifier: generateUUID(), |
| @@ -108,10 +154,10 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en | @@ -108,10 +154,10 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en | ||
| 108 | isPublicData: true | 154 | isPublicData: true |
| 109 | } | 155 | } |
| 110 | } | 156 | } |
| 111 | - console.log('yzl viewColumInsightIntentShare', JSON.stringify(viewBlogInsightIntentItem)) | 157 | + console.log('yzl viewColumInsightIntentShare', JSON.stringify(viewColumInsightIntentItem)) |
| 112 | 158 | ||
| 113 | // 共享数据 | 159 | // 共享数据 |
| 114 | - insightIntent.shareIntent(context, [viewBlogInsightIntentItem]).then(() => { | 160 | + insightIntent.shareIntent(context, [viewColumInsightIntentItem]).then(() => { |
| 115 | console.log('yzl shareIntent success'); | 161 | console.log('yzl shareIntent success'); |
| 116 | }).catch((err: BusinessError) => { | 162 | }).catch((err: BusinessError) => { |
| 117 | console.error(`yzl failed because ${err?.message}`); | 163 | console.error(`yzl failed because ${err?.message}`); |
| @@ -84,6 +84,10 @@ export function touchUpPullRefresh(pageModel: PageModel, pageAdvModel: PageAdMod | @@ -84,6 +84,10 @@ export function touchUpPullRefresh(pageModel: PageModel, pageAdvModel: PageAdMod | ||
| 84 | * @param pageAdvModel 广告数据 | 84 | * @param pageAdvModel 广告数据 |
| 85 | */ | 85 | */ |
| 86 | export function autoRefresh(pageModel: PageModel, pageAdvModel: PageAdModel) { | 86 | export function autoRefresh(pageModel: PageModel, pageAdvModel: PageAdModel) { |
| 87 | + if (pageModel.isRefreshing === true) { | ||
| 88 | + // 拦截多次刷新 | ||
| 89 | + return | ||
| 90 | + } | ||
| 87 | pageModel.isVisiblePullDown = true; | 91 | pageModel.isVisiblePullDown = true; |
| 88 | pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight); | 92 | pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight); |
| 89 | pullRefreshState(pageModel, RefreshState.Refreshing); | 93 | pullRefreshState(pageModel, RefreshState.Refreshing); |
| @@ -26,7 +26,7 @@ export function touchUpLoadMore(model: PageModel) { | @@ -26,7 +26,7 @@ export function touchUpLoadMore(model: PageModel) { | ||
| 26 | }, () => { | 26 | }, () => { |
| 27 | self.offsetY = 0; | 27 | self.offsetY = 0; |
| 28 | }) | 28 | }) |
| 29 | - if ((self.isCanLoadMore === true) && (self.hasMore === true)) { | 29 | + if ((self.isCanLoadMore === true) && (self.hasMore === true) && (self.isLoading === false)) { |
| 30 | self.isLoading = true; | 30 | self.isLoading = true; |
| 31 | setTimeout(() => { | 31 | setTimeout(() => { |
| 32 | closeLoadMore(model); | 32 | closeLoadMore(model); |
| @@ -47,7 +47,7 @@ export class RefreshConstants { | @@ -47,7 +47,7 @@ export class RefreshConstants { | ||
| 47 | * The NoMoreLayout constants. | 47 | * The NoMoreLayout constants. |
| 48 | */ | 48 | */ |
| 49 | static readonly NoMoreLayoutConstant_NORMAL_PADDING: number = 8; | 49 | static readonly NoMoreLayoutConstant_NORMAL_PADDING: number = 8; |
| 50 | - static readonly NoMoreLayoutConstant_TITLE_FONT: string = '16vp'; | 50 | + static readonly NoMoreLayoutConstant_TITLE_FONT: string = '12vp'; |
| 51 | static readonly NoMoreLayoutConstant_TITLE_COLOR: string = '#666666'; | 51 | static readonly NoMoreLayoutConstant_TITLE_COLOR: string = '#666666'; |
| 52 | /** | 52 | /** |
| 53 | * The RefreshLayout constants. | 53 | * The RefreshLayout constants. |
| 1 | -import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, PageDTO, PageInfoDTO } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, LiveRoomDataBean, PageDTO, PageInfoDTO } from 'wdBean'; |
| 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; | 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; |
| 3 | -import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils } from 'wdKit'; | 3 | +import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils, ToastUtils } from 'wdKit'; |
| 4 | import { closeRefresh } from '../utils/PullDownRefresh'; | 4 | import { closeRefresh } from '../utils/PullDownRefresh'; |
| 5 | import PageModel from './PageModel'; | 5 | import PageModel from './PageModel'; |
| 6 | import PageViewModel from './PageViewModel'; | 6 | import PageViewModel from './PageViewModel'; |
| @@ -17,6 +17,14 @@ import { CacheData } from 'wdNetwork/Index'; | @@ -17,6 +17,14 @@ import { CacheData } from 'wdNetwork/Index'; | ||
| 17 | 17 | ||
| 18 | const TAG = 'PageHelper'; | 18 | const TAG = 'PageHelper'; |
| 19 | 19 | ||
| 20 | +// 本地的一行两图卡 style值 | ||
| 21 | +const OneRowDoubleColumnStyle = CompStyle.Card_Comp_Zh_Grid_Layout_02 | ||
| 22 | + | ||
| 23 | +const Normal_Page_Size = 20 // 常规每页数量 | ||
| 24 | + | ||
| 25 | +const Rec_Page_Size = 10 // 推荐每页数量 | ||
| 26 | + | ||
| 27 | + | ||
| 20 | /** | 28 | /** |
| 21 | * 处理返回后的数据 | 29 | * 处理返回后的数据 |
| 22 | */ | 30 | */ |
| @@ -25,9 +33,16 @@ export class PageHelper { | @@ -25,9 +33,16 @@ export class PageHelper { | ||
| 25 | * 刷新数据 | 33 | * 刷新数据 |
| 26 | */ | 34 | */ |
| 27 | async refreshUI(pageModel: PageModel, pageAdvModel: PageAdModel) { | 35 | async refreshUI(pageModel: PageModel, pageAdvModel: PageAdModel) { |
| 36 | + let netStatus = NetworkUtil.isNetConnected() | ||
| 37 | + if (!netStatus) { | ||
| 38 | + ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | ||
| 39 | + setTimeout(() => { | ||
| 40 | + closeRefresh(pageModel, false) | ||
| 41 | + }, 500) | ||
| 42 | + return | ||
| 43 | + } | ||
| 28 | pageModel.loadStrategy = 2 | 44 | pageModel.loadStrategy = 2 |
| 29 | pageModel.pageTotalCompSize = 0; | 45 | pageModel.pageTotalCompSize = 0; |
| 30 | - // TODO 下拉刷新,是否加载缓存 | ||
| 31 | this.getPageInfo(pageModel, pageAdvModel) | 46 | this.getPageInfo(pageModel, pageAdvModel) |
| 32 | } | 47 | } |
| 33 | 48 | ||
| @@ -35,6 +50,11 @@ export class PageHelper { | @@ -35,6 +50,11 @@ export class PageHelper { | ||
| 35 | * 分页加载 | 50 | * 分页加载 |
| 36 | */ | 51 | */ |
| 37 | async loadMore(pageModel: PageModel) { | 52 | async loadMore(pageModel: PageModel) { |
| 53 | + let netStatus = NetworkUtil.isNetConnected() | ||
| 54 | + if (!netStatus) { | ||
| 55 | + ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | ||
| 56 | + return | ||
| 57 | + } | ||
| 38 | pageModel.loadStrategy = 3 | 58 | pageModel.loadStrategy = 3 |
| 39 | // 暂只支持comp分页加载,节目分页加载的得完善框架(如直播回看节目数据分页) | 59 | // 暂只支持comp分页加载,节目分页加载的得完善框架(如直播回看节目数据分页) |
| 40 | this.compLoadMore(pageModel) | 60 | this.compLoadMore(pageModel) |
| @@ -44,60 +64,20 @@ export class PageHelper { | @@ -44,60 +64,20 @@ export class PageHelper { | ||
| 44 | * 进页面请求数据 | 64 | * 进页面请求数据 |
| 45 | */ | 65 | */ |
| 46 | async getInitCacheData(pageModel: PageModel, pageAdvModel: PageAdModel) { | 66 | async getInitCacheData(pageModel: PageModel, pageAdvModel: PageAdModel) { |
| 47 | - Logger.error('zzzz','getInitCacheData') | 67 | + Logger.debug(TAG, 'getInitCacheData') |
| 48 | PageViewModel.getPageInfoCache(pageModel.pageId).then(pageInfo => { | 68 | PageViewModel.getPageInfoCache(pageModel.pageId).then(pageInfo => { |
| 69 | + Logger.debug(TAG, 'getInitCacheData back: ' + pageInfo) | ||
| 49 | if (pageInfo == null) { | 70 | if (pageInfo == null) { |
| 50 | return; | 71 | return; |
| 51 | } | 72 | } |
| 52 | pageModel.pageInfo = pageInfo; | 73 | pageModel.pageInfo = pageInfo; |
| 74 | + pageModel.cachePageInfoMd5 = pageInfo.md5 | ||
| 53 | //解析页面挂角广告资源 | 75 | //解析页面挂角广告资源 |
| 54 | pageAdvModel.analysisAdvSource(pageInfo); | 76 | pageAdvModel.analysisAdvSource(pageInfo); |
| 55 | - this.parseCacheGroup(pageModel) | 77 | + this.parseGroup(pageModel, true) |
| 56 | }) | 78 | }) |
| 57 | } | 79 | } |
| 58 | 80 | ||
| 59 | - async parseCacheGroup(pageModel: PageModel) { | ||
| 60 | - Logger.error('zzzz','parseCacheGroup') | ||
| 61 | - let pageInfo: PageInfoDTO = pageModel.pageInfo | ||
| 62 | - pageModel.groupList = [] | ||
| 63 | - pageInfo.pageAdList = [] | ||
| 64 | - pageInfo.oneRequestPageGroupCompList = new ArrayList() | ||
| 65 | - pageModel.groupList.push(...pageInfo.groups) | ||
| 66 | - Logger.error("ZZZXXXXX", 'parseCacheGroup----1-----'); | ||
| 67 | - for (const group of pageInfo.groups) { | ||
| 68 | - pageModel.groupId = group.id; | ||
| 69 | - pageModel.groupData = group | ||
| 70 | - Logger.error("ZZZXXXXX", '楼层id-start--》' + pageModel.groupId); | ||
| 71 | - // await,确保groups接口顺序执行 | ||
| 72 | - let pageDto = await PageViewModel.getPageGroupCacheData(pageModel.bizCopy()) as PageDTO | ||
| 73 | - let index = pageInfo.groups.indexOf(group) | ||
| 74 | - if (index == 0) { | ||
| 75 | - // 清空comp列表 | ||
| 76 | - pageModel.compList.clear() | ||
| 77 | - } | ||
| 78 | - this.analysisPageGroupCompData(pageModel,pageDto, pageInfo, index == pageInfo.groups.length - 1) | ||
| 79 | - Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length); | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - // 收集页面所有楼层的组件信息,同步完成广告投放计算,异步完成稿件批查, | ||
| 83 | - | ||
| 84 | - pageModel.pageTotalCompSize = pageInfo.oneRequestPageGroupCompList.length + pageModel.pageTotalCompSize | ||
| 85 | - // 处理页面广告数据,投放到页面的位置 | ||
| 86 | - // TODO 缓存数据不加载广告 | ||
| 87 | - // this.handlePageCompAdvPostion(pageInfo.oneRequestPageGroupCompList, pageModel, pageInfo.pageAdList); | ||
| 88 | - | ||
| 89 | - //遍历所有组件和稿件数据 push到页面 | ||
| 90 | - for (let element of pageInfo.oneRequestPageGroupCompList) { | ||
| 91 | - pageModel.compList.push(CompDTO.createNewsBean(element)) | ||
| 92 | - } | ||
| 93 | - Logger.error('zzzz', 'parseCacheGroup count: ' + pageModel.compList.totalCount()) | ||
| 94 | - pageModel.currentPage++ | ||
| 95 | - pageModel.viewType = ViewType.LOADED | ||
| 96 | - closeRefresh(pageModel, true) | ||
| 97 | - | ||
| 98 | - Logger.error("ZZZXXXXX", 'parseGroup----3----->' + pageInfo.oneRequestPageGroupCompList.length); | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | /** | 81 | /** |
| 102 | * 进页面请求数据 | 82 | * 进页面请求数据 |
| 103 | */ | 83 | */ |
| @@ -131,62 +111,106 @@ export class PageHelper { | @@ -131,62 +111,106 @@ export class PageHelper { | ||
| 131 | promptAction.showToast({ message: err }); | 111 | promptAction.showToast({ message: err }); |
| 132 | }) | 112 | }) |
| 133 | } else { | 113 | } else { |
| 114 | + Logger.debug(TAG, 'getPageInfo') | ||
| 134 | PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => { | 115 | PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => { |
| 116 | + Logger.debug(TAG, 'getPageInfo back: ' + JSON.stringify(pageInfo)) | ||
| 135 | if (pageInfo == null) { | 117 | if (pageInfo == null) { |
| 136 | pageModel.viewType = ViewType.EMPTY; | 118 | pageModel.viewType = ViewType.EMPTY; |
| 137 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1; | 119 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1; |
| 138 | return; | 120 | return; |
| 139 | } | 121 | } |
| 140 | pageModel.pageInfo = pageInfo; | 122 | pageModel.pageInfo = pageInfo; |
| 141 | - //解析页面挂角广告资源 | ||
| 142 | - pageAdvModel.analysisAdvSource(pageInfo); | ||
| 143 | - this.parseGroup(pageModel) | ||
| 144 | - // if (pageModel.currentPage == 1) { | ||
| 145 | - // // 保存缓存 | ||
| 146 | - // CacheData.saveCacheData(CacheData.comPageInfoCacheKey + pageModel.pageId, pageInfo, pageInfo.md5) | ||
| 147 | - // } | 123 | + if (pageInfo.md5 == pageModel.cachePageInfoMd5) { |
| 124 | + // 缓存一致,不解析 | ||
| 125 | + Logger.debug(TAG, 'getPageInfo 与缓存一致,不解析广告。。。') | ||
| 126 | + } else { | ||
| 127 | + Logger.debug(TAG, 'getPageInfo 要解析广告') | ||
| 128 | + if (pageModel.currentPage == 1) { | ||
| 129 | + // 保存缓存 | ||
| 130 | + CacheData.saveCacheData(CacheData.comPageInfoCacheKey + pageModel.pageId, pageInfo, pageInfo.md5) | ||
| 131 | + } | ||
| 132 | + //解析页面挂角广告资源 | ||
| 133 | + pageAdvModel.analysisAdvSource(pageInfo); | ||
| 134 | + } | ||
| 135 | + Logger.debug(TAG, 'getPageInfo go on') | ||
| 136 | + this.parseGroup(pageModel, false) | ||
| 148 | }).catch(() => { | 137 | }).catch(() => { |
| 138 | + if (this.isPageLoaded(pageModel)) { | ||
| 139 | + return | ||
| 140 | + } | ||
| 149 | pageModel.viewType = ViewType.EMPTY; | 141 | pageModel.viewType = ViewType.EMPTY; |
| 150 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_ContentFailed; | 142 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_ContentFailed; |
| 151 | }) | 143 | }) |
| 152 | } | 144 | } |
| 153 | } | 145 | } |
| 154 | 146 | ||
| 147 | + private isPageLoaded(pageModel: PageModel) { | ||
| 148 | + if (pageModel.compList.size() > 0) { | ||
| 149 | + return true | ||
| 150 | + } | ||
| 151 | + return false | ||
| 152 | + } | ||
| 155 | 153 | ||
| 156 | /** | 154 | /** |
| 157 | * 解析信息流页面楼层数据 | 155 | * 解析信息流页面楼层数据 |
| 158 | * @param pageModel | 156 | * @param pageModel |
| 159 | */ | 157 | */ |
| 160 | - async parseGroup(pageModel: PageModel) { | 158 | + async parseGroup(pageModel: PageModel, isCache: boolean) { |
| 161 | let pageInfo: PageInfoDTO = pageModel.pageInfo | 159 | let pageInfo: PageInfoDTO = pageModel.pageInfo |
| 162 | pageModel.groupList = [] | 160 | pageModel.groupList = [] |
| 163 | pageInfo.pageAdList = [] | 161 | pageInfo.pageAdList = [] |
| 164 | pageInfo.oneRequestPageGroupCompList = new ArrayList() | 162 | pageInfo.oneRequestPageGroupCompList = new ArrayList() |
| 165 | pageModel.groupList.push(...pageInfo.groups) | 163 | pageModel.groupList.push(...pageInfo.groups) |
| 166 | - Logger.error("ZZZXXXXX", 'parseGroup----1-----'); | ||
| 167 | for (const group of pageInfo.groups) { | 164 | for (const group of pageInfo.groups) { |
| 168 | pageModel.isRecGroup = group.groupStrategy === 1; | 165 | pageModel.isRecGroup = group.groupStrategy === 1; |
| 169 | pageModel.groupId = group.id; | 166 | pageModel.groupId = group.id; |
| 170 | if (pageModel.isRecGroup) { | 167 | if (pageModel.isRecGroup) { |
| 171 | - pageModel.pageSize = 10 | 168 | + pageModel.pageSize = Rec_Page_Size |
| 172 | } else { | 169 | } else { |
| 173 | - pageModel.pageSize = 20 | 170 | + pageModel.pageSize = Normal_Page_Size |
| 174 | } | 171 | } |
| 175 | pageModel.groupData = group | 172 | pageModel.groupData = group |
| 176 | 173 | ||
| 177 | - Logger.error("ZZZXXXXX", '楼层id-start--》' + pageModel.groupId); | 174 | + //Logger.error("ZZZXXXXX", '楼层id-start--》' + pageModel.groupId); |
| 175 | + let pageDto: PageDTO | ||
| 176 | + Logger.debug(TAG, 'parseGroup isCache: ' + isCache) | ||
| 177 | + if (isCache) { | ||
| 178 | + pageDto = await PageViewModel.getPageGroupCacheData(pageModel.bizCopy()) as PageDTO | ||
| 179 | + pageModel.cacheGroupInfoMd5 = pageDto.md5 | ||
| 180 | + } else { | ||
| 181 | + pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO | ||
| 182 | + if (pageDto.md5 == pageModel.cacheGroupInfoMd5) { | ||
| 183 | + Logger.debug(TAG, 'parseGroup cache load, return: ' + pageDto.md5) | ||
| 184 | + // 缓存数据一致,不再刷新 | ||
| 185 | + return | ||
| 186 | + } | ||
| 187 | + Logger.debug(TAG, 'parseGroup cache load, save: ') | ||
| 188 | + // 保存缓存 | ||
| 189 | + CacheData.saveCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId, pageDto, | ||
| 190 | + pageDto.md5) | ||
| 191 | + } | ||
| 192 | + Logger.debug(TAG, 'parseGroup go on') | ||
| 178 | // await,确保groups接口顺序执行 | 193 | // await,确保groups接口顺序执行 |
| 179 | - let pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO | 194 | + // let pageDto = page |
| 180 | let index = pageInfo.groups.indexOf(group) | 195 | let index = pageInfo.groups.indexOf(group) |
| 181 | - if (index == 0) { | ||
| 182 | - // 清空comp列表 | ||
| 183 | - pageModel.compList.clear() | ||
| 184 | - // // 保存缓存 | ||
| 185 | - // CacheData.saveCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId, pageDto, | ||
| 186 | - // pageDto.md5) | 196 | + |
| 197 | + // 解析楼层组件 | ||
| 198 | + this.analysisPageGroupCompData(pageDto, pageInfo) | ||
| 199 | + | ||
| 200 | + // 最后一个楼层,特殊处理 | ||
| 201 | + if (index == pageInfo.groups.length - 1) { | ||
| 202 | + // 检测楼层最后一个组件业务数据是否需要通过访问接口获取 | ||
| 203 | + let comp: CompDTO = pageDto.compList[pageDto.compList.length - 1] | ||
| 204 | + // 直播回放,需要二次请求数据 | ||
| 205 | + if (comp.compStyle == CompStyle.Zh_Grid_Layout_02) { | ||
| 206 | + pageInfo.lastCompSourceType = 1 | ||
| 207 | + let listReviewDtoBean = await PageViewModel.getLiveReviewUrl(1, Normal_Page_Size) as LiveReviewDTO | ||
| 208 | + // 创建一行两图卡组件 | ||
| 209 | + this.createDoubleColumComp(listReviewDtoBean, pageInfo) | ||
| 210 | + } else { | ||
| 211 | + pageInfo.lastCompSourceType = 0 | ||
| 212 | + } | ||
| 187 | } | 213 | } |
| 188 | - this.analysisPageGroupCompData(pageModel,pageDto, pageInfo, index == pageInfo.groups.length - 1) | ||
| 189 | - Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length); | ||
| 190 | } | 214 | } |
| 191 | 215 | ||
| 192 | /* | 216 | /* |
| @@ -196,9 +220,11 @@ export class PageHelper { | @@ -196,9 +220,11 @@ export class PageHelper { | ||
| 196 | // 处理页面广告数据,投放到页面的位置 | 220 | // 处理页面广告数据,投放到页面的位置 |
| 197 | this.handlePageCompAdvPostion(pageInfo.oneRequestPageGroupCompList, pageModel, pageInfo.pageAdList); | 221 | this.handlePageCompAdvPostion(pageInfo.oneRequestPageGroupCompList, pageModel, pageInfo.pageAdList); |
| 198 | 222 | ||
| 223 | + // 清空comp列表 | ||
| 224 | + pageModel.compList.clear() | ||
| 199 | //遍历所有组件和稿件数据 push到页面 | 225 | //遍历所有组件和稿件数据 push到页面 |
| 200 | for (let element of pageInfo.oneRequestPageGroupCompList) { | 226 | for (let element of pageInfo.oneRequestPageGroupCompList) { |
| 201 | - pageModel.compList.push(CompDTO.createNewsBean(element)) | 227 | + pageModel.compList.push(element) |
| 202 | } | 228 | } |
| 203 | 229 | ||
| 204 | // 批查互动数据 | 230 | // 批查互动数据 |
| @@ -209,7 +235,6 @@ export class PageHelper { | @@ -209,7 +235,6 @@ export class PageHelper { | ||
| 209 | pageModel.viewType = ViewType.LOADED | 235 | pageModel.viewType = ViewType.LOADED |
| 210 | closeRefresh(pageModel, true) | 236 | closeRefresh(pageModel, true) |
| 211 | 237 | ||
| 212 | - Logger.error("ZZZXXXXX", 'parseGroup----3----->' + pageInfo.oneRequestPageGroupCompList.length); | ||
| 213 | if (pageModel.compList.isEmpty()) { | 238 | if (pageModel.compList.isEmpty()) { |
| 214 | // 没数据,展示空页面 | 239 | // 没数据,展示空页面 |
| 215 | Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.'); | 240 | Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.'); |
| @@ -225,26 +250,11 @@ export class PageHelper { | @@ -225,26 +250,11 @@ export class PageHelper { | ||
| 225 | * @param pageInfo 信息流页面信息 | 250 | * @param pageInfo 信息流页面信息 |
| 226 | * @param isLastGroup pageDto信息是不是最后一个楼层 | 251 | * @param isLastGroup pageDto信息是不是最后一个楼层 |
| 227 | */ | 252 | */ |
| 228 | - private async analysisPageGroupCompData(pageModel: PageModel,pageDto: PageDTO, pageInfo: PageInfoDTO, isLastGroup: boolean) { | 253 | + private async analysisPageGroupCompData(pageDto: PageDTO, pageInfo: PageInfoDTO) { |
| 229 | 254 | ||
| 230 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { | 255 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { |
| 231 | 256 | ||
| 232 | - let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集楼层组件、稿件和本地组件容器 | ||
| 233 | - // 遍历楼层的组件数据 | ||
| 234 | - pageDto.compList.forEach((element: CompDTO) => { | ||
| 235 | - let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0); | ||
| 236 | - //移除音频 和 活动 | ||
| 237 | - if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { | ||
| 238 | - Logger.debug(TAG, 'getGroupData 移除音频 和 活动'); | ||
| 239 | - } else { | ||
| 240 | - // 暂时屏蔽活动和音频详情入口 | ||
| 241 | - if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') { | ||
| 242 | - } else { | ||
| 243 | - pageCompList.add(element) | ||
| 244 | - } | ||
| 245 | - } | ||
| 246 | - }) | ||
| 247 | - | 257 | + let pageCompList = this.factoryCompArray(pageDto.compList) |
| 248 | // pageInfor 记录 | 258 | // pageInfor 记录 |
| 249 | pageCompList.forEach((comp: CompDTO) => { | 259 | pageCompList.forEach((comp: CompDTO) => { |
| 250 | pageInfo.oneRequestPageGroupCompList.add(comp) | 260 | pageInfo.oneRequestPageGroupCompList.add(comp) |
| @@ -255,19 +265,6 @@ export class PageHelper { | @@ -255,19 +265,6 @@ export class PageHelper { | ||
| 255 | pageInfo.pageAdList.push(...pageDto.compAdList) | 265 | pageInfo.pageAdList.push(...pageDto.compAdList) |
| 256 | } | 266 | } |
| 257 | 267 | ||
| 258 | - // 检测最后一个楼层是否有一行两图卡 | ||
| 259 | - if (isLastGroup) { | ||
| 260 | - // 最后一个楼层,特殊处理 | ||
| 261 | - // 检测楼层最后一个组件业务数据是否需要通过访问接口获取 | ||
| 262 | - let comp: CompDTO = pageDto.compList[pageDto.compList.length - 1] | ||
| 263 | - // 直播回放,需要二次请求数据 | ||
| 264 | - if ( comp.compStyle == CompStyle.Zh_Grid_Layout_02) { | ||
| 265 | - // 这个comp,数据自己二次请求,自己分页处理,这里加flag,将page层滑动及loadmore ui去掉 | ||
| 266 | - pageModel.contentNeedScroll = true | ||
| 267 | - | ||
| 268 | - //this.getLiveReviewData(pageInfo,comp) | ||
| 269 | - } | ||
| 270 | - } | ||
| 271 | } | 268 | } |
| 272 | 269 | ||
| 273 | } | 270 | } |
| @@ -295,23 +292,32 @@ export class PageHelper { | @@ -295,23 +292,32 @@ export class PageHelper { | ||
| 295 | promptAction.showToast({ message: err }); | 292 | promptAction.showToast({ message: err }); |
| 296 | }) | 293 | }) |
| 297 | } else { | 294 | } else { |
| 298 | - PageViewModel.getPageGroupCompData(pageModel.bizCopy()) | ||
| 299 | - .then((data: PageDTO) => { | ||
| 300 | - if (data == null || data.compList == null || data.compList.length == 0) { | ||
| 301 | - pageModel.hasMore = false; | ||
| 302 | - } else { | ||
| 303 | - // 直接认为有分页,一直加载分页。直到没有数据,再停止 | ||
| 304 | - pageModel.currentPage++; | ||
| 305 | - pageModel.hasMore = true; | ||
| 306 | - | ||
| 307 | - //移除音频 和 活动 | ||
| 308 | - this.loadMorePageComp(pageModel, data) | ||
| 309 | - // 参与批查 | ||
| 310 | - this.allCompBatchRequest(data.compList, pageModel) | ||
| 311 | - } | ||
| 312 | - }).catch((err: string | Resource) => { | ||
| 313 | - promptAction.showToast({ message: err }); | ||
| 314 | - }) | 295 | + |
| 296 | + if (pageModel.pageInfo.lastCompSourceType == 1) { | ||
| 297 | + // 加载更多 走 直播回看接口 | ||
| 298 | + this.getLiveReviewData(pageModel, pageModel.pageInfo) | ||
| 299 | + | ||
| 300 | + } else { | ||
| 301 | + // 默认加载更多走 楼层接口 | ||
| 302 | + PageViewModel.getPageGroupCompData(pageModel.bizCopy()) | ||
| 303 | + .then((data: PageDTO) => { | ||
| 304 | + | ||
| 305 | + if (data == null || data.compList == null || data.compList.length == 0) { | ||
| 306 | + pageModel.hasMore = false; | ||
| 307 | + } else { | ||
| 308 | + // 直接认为有分页,一直加载分页。直到没有数据,再停止 | ||
| 309 | + pageModel.currentPage++; | ||
| 310 | + pageModel.hasMore = true; | ||
| 311 | + | ||
| 312 | + //移除音频 和 活动 | ||
| 313 | + this.loadMorePageComp(pageModel, data) | ||
| 314 | + // 参与批查 | ||
| 315 | + this.allCompBatchRequest(data.compList, pageModel) | ||
| 316 | + } | ||
| 317 | + }).catch((err: string | Resource) => { | ||
| 318 | + promptAction.showToast({ message: err }); | ||
| 319 | + }) | ||
| 320 | + } | ||
| 315 | } | 321 | } |
| 316 | } | 322 | } |
| 317 | 323 | ||
| @@ -321,9 +327,34 @@ export class PageHelper { | @@ -321,9 +327,34 @@ export class PageHelper { | ||
| 321 | */ | 327 | */ |
| 322 | private loadMorePageComp(pageModel: PageModel, pageDto: PageDTO) { | 328 | private loadMorePageComp(pageModel: PageModel, pageDto: PageDTO) { |
| 323 | 329 | ||
| 324 | - let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器 | 330 | + let pageCompList = this.factoryCompArray(pageDto.compList) // 收集页面组件、稿件和本地组件容器 |
| 325 | 331 | ||
| 326 | - pageDto.compList.forEach((element: CompDTO) => { | 332 | + // pageInfor 记录 |
| 333 | + pageModel.pageInfo.oneRequestPageGroupCompList.clear() | ||
| 334 | + pageCompList.forEach((comp: CompDTO) => { | ||
| 335 | + pageModel.pageInfo.oneRequestPageGroupCompList.add(comp) | ||
| 336 | + }) | ||
| 337 | + | ||
| 338 | + // 记录 | ||
| 339 | + pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize | ||
| 340 | + // 处理页面广告数据,投放到页面的位置 | ||
| 341 | + this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto.compAdList); | ||
| 342 | + | ||
| 343 | + //遍历所有组件和稿件数据 push到页面 | ||
| 344 | + for (let element of pageCompList) { | ||
| 345 | + pageModel.compList.push(element) | ||
| 346 | + } | ||
| 347 | + | ||
| 348 | + } | ||
| 349 | + | ||
| 350 | + /** | ||
| 351 | + * 加工 组件数组信息 | ||
| 352 | + * @param compList | ||
| 353 | + * @returns | ||
| 354 | + */ | ||
| 355 | + private factoryCompArray(compList: CompDTO[]): ArrayList<CompDTO> { | ||
| 356 | + let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器 | ||
| 357 | + compList.forEach((element: CompDTO) => { | ||
| 327 | let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0); | 358 | let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0); |
| 328 | //移除音频 和 活动 | 359 | //移除音频 和 活动 |
| 329 | if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { | 360 | if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { |
| @@ -332,22 +363,17 @@ export class PageHelper { | @@ -332,22 +363,17 @@ export class PageHelper { | ||
| 332 | // 暂时屏蔽活动和音频详情入口 | 363 | // 暂时屏蔽活动和音频详情入口 |
| 333 | if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') { | 364 | if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') { |
| 334 | } else { | 365 | } else { |
| 335 | - pageCompList.add(element) | 366 | + if (element.name == "月度排行卡") { |
| 367 | + | ||
| 368 | + } else { | ||
| 369 | + pageCompList.add(CompDTO.createNewsBean(element)) | ||
| 370 | + } | ||
| 336 | } | 371 | } |
| 337 | } | 372 | } |
| 338 | 373 | ||
| 339 | }) | 374 | }) |
| 340 | 375 | ||
| 341 | - // 记录 | ||
| 342 | - pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize | ||
| 343 | - // 处理页面广告数据,投放到页面的位置 | ||
| 344 | - this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto.compAdList); | ||
| 345 | - | ||
| 346 | - //遍历所有组件和稿件数据 push到页面 | ||
| 347 | - for (let element of pageCompList) { | ||
| 348 | - pageModel.compList.push(CompDTO.createNewsBean(element)) | ||
| 349 | - } | ||
| 350 | - | 376 | + return pageCompList |
| 351 | } | 377 | } |
| 352 | 378 | ||
| 353 | /** | 379 | /** |
| @@ -356,6 +382,8 @@ export class PageHelper { | @@ -356,6 +382,8 @@ export class PageHelper { | ||
| 356 | * @param pageModel | 382 | * @param pageModel |
| 357 | */ | 383 | */ |
| 358 | private allCompBatchRequest(compList: CompDTO[], pageModel: PageModel) { | 384 | private allCompBatchRequest(compList: CompDTO[], pageModel: PageModel) { |
| 385 | + | ||
| 386 | + // 批查人数 | ||
| 359 | PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => { | 387 | PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => { |
| 360 | // 刷新,替换所有数据 | 388 | // 刷新,替换所有数据 |
| 361 | this.resetInteract(data, pageModel.compList) | 389 | this.resetInteract(data, pageModel.compList) |
| @@ -366,6 +394,10 @@ export class PageHelper { | @@ -366,6 +394,10 @@ export class PageHelper { | ||
| 366 | } | 394 | } |
| 367 | }) | 395 | }) |
| 368 | 396 | ||
| 397 | + // 批查直播观看人数 | ||
| 398 | + this.getLiveRoomDataInfo(compList) | ||
| 399 | + | ||
| 400 | + | ||
| 369 | // 测试数据 | 401 | // 测试数据 |
| 370 | // setTimeout(() => { | 402 | // setTimeout(() => { |
| 371 | // let index = 1 | 403 | // let index = 1 |
| @@ -381,6 +413,59 @@ export class PageHelper { | @@ -381,6 +413,59 @@ export class PageHelper { | ||
| 381 | } | 413 | } |
| 382 | 414 | ||
| 383 | /** | 415 | /** |
| 416 | + * 直播回看的批查数据 | ||
| 417 | + * @param list | ||
| 418 | + * @param compList | ||
| 419 | + */ | ||
| 420 | + private getLiveRoomDataInfo(compList: CompDTO[]) { | ||
| 421 | + | ||
| 422 | + let list: ContentDTO[] = [] | ||
| 423 | + compList.forEach((comp: CompDTO) => { | ||
| 424 | + if (comp.compStyle == OneRowDoubleColumnStyle) { | ||
| 425 | + list.push(...comp.operDataList) | ||
| 426 | + } | ||
| 427 | + }) | ||
| 428 | + let time = DateTimeUtils.getTimeStamp().toString() | ||
| 429 | + | ||
| 430 | + let reserveIds = this.getLiveDetailIds(list) | ||
| 431 | + | ||
| 432 | + PageViewModel.getLiveRoomBatchInfo(reserveIds).then((result) => { | ||
| 433 | + if (result && result.length > 0) { | ||
| 434 | + result.forEach((bean: LiveRoomDataBean) => { | ||
| 435 | + for (let item of list) { | ||
| 436 | + if (item.objectId == bean.liveId.toString()) { | ||
| 437 | + item.liveRoomDataBean = bean | ||
| 438 | + outer: for (let compBean of compList) { | ||
| 439 | + for (let contentBean of compBean.operDataList) { | ||
| 440 | + if (contentBean === item) { | ||
| 441 | + compBean.timestamp = time | ||
| 442 | + break outer | ||
| 443 | + } | ||
| 444 | + } | ||
| 445 | + } | ||
| 446 | + break | ||
| 447 | + } | ||
| 448 | + } | ||
| 449 | + }) | ||
| 450 | + } | ||
| 451 | + }).catch(() => { | ||
| 452 | + }) | ||
| 453 | + } | ||
| 454 | + | ||
| 455 | + /** | ||
| 456 | + * 获取直播详情id入参 | ||
| 457 | + * @param list | ||
| 458 | + * @returns | ||
| 459 | + */ | ||
| 460 | + private getLiveDetailIds(list: ContentDTO[]): string { | ||
| 461 | + let idList: string[] = [] | ||
| 462 | + list.forEach(item => { | ||
| 463 | + idList.push(item.objectId) | ||
| 464 | + }); | ||
| 465 | + return idList.join(',') | ||
| 466 | + } | ||
| 467 | + | ||
| 468 | + /** | ||
| 384 | * 刷新互动数据到compList | 469 | * 刷新互动数据到compList |
| 385 | * @param interact 批查互动数据结果 | 470 | * @param interact 批查互动数据结果 |
| 386 | * @param compList comp list | 471 | * @param compList comp list |
| @@ -560,12 +645,98 @@ export class PageHelper { | @@ -560,12 +645,98 @@ export class PageHelper { | ||
| 560 | /** | 645 | /** |
| 561 | * 获取直播回看数据 | 646 | * 获取直播回看数据 |
| 562 | */ | 647 | */ |
| 563 | - private async getLiveReviewData(pageInfo: PageInfoDTO,comp: CompDTO) { | 648 | + private async getLiveReviewData(pageModel: PageModel, pageInfo: PageInfoDTO) { |
| 564 | 649 | ||
| 565 | - let currentPage = 1 | ||
| 566 | - let pageSize = 20 | ||
| 567 | - let listReviewDtoBean = await PageViewModel.getLiveReviewUrl(currentPage, pageSize) as LiveReviewDTO | ||
| 568 | - Logger.error("ZZZXXXXX", 'getLiveReviewData---------'+listReviewDtoBean.list.length); | 650 | + let currentPage = pageModel.currentPage |
| 651 | + let pageSize = Normal_Page_Size | ||
| 652 | + | ||
| 653 | + PageViewModel.getLiveReviewUrl(currentPage, pageSize).then((liveReviewDTO) => { | ||
| 654 | + if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) { | ||
| 655 | + pageModel.hasMore = false; | ||
| 656 | + } else { | ||
| 657 | + | ||
| 658 | + pageInfo.oneRequestPageGroupCompList.clear() | ||
| 659 | + // 直接认为有分页,一直加载分页。直到没有数据,再停止 | ||
| 660 | + pageModel.currentPage++; | ||
| 661 | + pageModel.hasMore = true; | ||
| 662 | + | ||
| 663 | + let haveMoveContent = false | ||
| 664 | + //获取当前页面最后一个组件 | ||
| 665 | + let lastIndex = pageModel.compList.totalCount() - 1 | ||
| 666 | + let lastComp = pageModel.compList.getData(lastIndex) as CompDTO | ||
| 667 | + // 一行两图卡,需要从奇数 补齐成偶数内容 | ||
| 668 | + if (lastComp.compStyle == OneRowDoubleColumnStyle) { | ||
| 669 | + | ||
| 670 | + let operLength = lastComp.operDataList.length | ||
| 671 | + // 页面的最后一个组件的业务数据是奇数,需要从获取更多的业务数据中补一个数据 | ||
| 672 | + if (operLength === 1) { | ||
| 673 | + haveMoveContent = true | ||
| 674 | + lastComp.operDataList.push(liveReviewDTO.list[0]) | ||
| 675 | + // 更新某个组件 | ||
| 676 | + pageModel.compList.updateItem(lastComp, lastIndex) | ||
| 677 | + // 移走新获取的数据中第一条数据 | ||
| 678 | + liveReviewDTO.list.splice(0, 1) | ||
| 679 | + } | ||
| 680 | + } | ||
| 681 | + // 创建本地一行两图卡 | ||
| 682 | + this.createDoubleColumComp(liveReviewDTO, pageInfo) | ||
| 683 | + // 统计页面的总的组件和稿件数量 | ||
| 684 | + pageModel.pageTotalCompSize = pageInfo.oneRequestPageGroupCompList.length + pageModel.pageTotalCompSize | ||
| 685 | + //遍历所有组件和稿件数据 push到页面 | ||
| 686 | + for (let element of pageInfo.oneRequestPageGroupCompList) { | ||
| 687 | + pageModel.compList.push(element) | ||
| 688 | + } | ||
| 689 | + | ||
| 690 | + // 批查直播观看人数 | ||
| 691 | + if (haveMoveContent) { | ||
| 692 | + // 把当前获取到的直播回看数据 | ||
| 693 | + pageInfo.oneRequestPageGroupCompList.add(lastComp) | ||
| 694 | + } | ||
| 695 | + | ||
| 696 | + this.getLiveRoomDataInfo(pageInfo.oneRequestPageGroupCompList.convertToArray()) | ||
| 697 | + | ||
| 698 | + } | ||
| 699 | + | ||
| 700 | + }).catch((err: string | Resource) => { | ||
| 701 | + promptAction.showToast({ message: err }); | ||
| 702 | + }) | ||
| 703 | + } | ||
| 704 | + | ||
| 705 | + /** | ||
| 706 | + * 创建一行两图卡 自定义的业务稿件 | ||
| 707 | + * @param listReviewDtoBean | ||
| 708 | + * @param pageInfo | ||
| 709 | + */ | ||
| 710 | + private createDoubleColumComp(listReviewDtoBean: LiveReviewDTO, pageInfo: PageInfoDTO, test?: boolean) { | ||
| 711 | + /* | ||
| 712 | + 两个业务 内容 配置一个comp | ||
| 713 | + */ | ||
| 714 | + let length = listReviewDtoBean.list.length | ||
| 715 | + | ||
| 716 | + // if (test) { | ||
| 717 | + // // 偶数变成奇数 | ||
| 718 | + // if (length % 2 === 0) { | ||
| 719 | + // listReviewDtoBean.list.splice(length - 1, 1) | ||
| 720 | + // length = listReviewDtoBean.list.length | ||
| 721 | + // } | ||
| 722 | + // } | ||
| 723 | + | ||
| 724 | + for (let i = 0; i < length; i = i + 2) { | ||
| 725 | + let sliceArray: ContentDTO[] | ||
| 726 | + let j = i + 2 | ||
| 727 | + | ||
| 728 | + if (j < length) { | ||
| 729 | + sliceArray = listReviewDtoBean.list.slice(i, j) | ||
| 730 | + } else { | ||
| 731 | + sliceArray = listReviewDtoBean.list.slice(i) | ||
| 732 | + } | ||
| 733 | + // 创建一行两图卡 自定义的业务稿件 | ||
| 734 | + let doubleColumnLiveReviewComp = new CompDTO() | ||
| 735 | + doubleColumnLiveReviewComp.compStyle = OneRowDoubleColumnStyle | ||
| 736 | + let operDataList: ContentDTO[] = sliceArray | ||
| 737 | + doubleColumnLiveReviewComp.operDataList = operDataList | ||
| 738 | + pageInfo.oneRequestPageGroupCompList.add(doubleColumnLiveReviewComp) | ||
| 739 | + } | ||
| 569 | 740 | ||
| 570 | } | 741 | } |
| 571 | } | 742 | } |
| @@ -63,6 +63,10 @@ export default class PageModel { | @@ -63,6 +63,10 @@ export default class PageModel { | ||
| 63 | pageType: number = 0; | 63 | pageType: number = 0; |
| 64 | 64 | ||
| 65 | extra: string = '' | 65 | extra: string = '' |
| 66 | + // 缓存数据相关 | ||
| 67 | + cachePageInfoMd5: string = '' | ||
| 68 | + cacheGroupInfoMd5: string = '' | ||
| 69 | + | ||
| 66 | /** | 70 | /** |
| 67 | * 简单复制业务数据 | 71 | * 简单复制业务数据 |
| 68 | */ | 72 | */ |
| @@ -162,13 +162,21 @@ | @@ -162,13 +162,21 @@ | ||
| 162 | } | 162 | } |
| 163 | , | 163 | , |
| 164 | { | 164 | { |
| 165 | - "name": "color_9E9E9E_40", | 165 | + "name": "color_FFFFFF_40", |
| 166 | "value": "#40FFFFFF" | 166 | "value": "#40FFFFFF" |
| 167 | } | 167 | } |
| 168 | , | 168 | , |
| 169 | { | 169 | { |
| 170 | "name": "color_ED2800_99", | 170 | "name": "color_ED2800_99", |
| 171 | "value": "#99ED2800" | 171 | "value": "#99ED2800" |
| 172 | + }, | ||
| 173 | + { | ||
| 174 | + "name": "color_white_30", | ||
| 175 | + "value": "#4D000000" | ||
| 176 | + }, | ||
| 177 | + { | ||
| 178 | + "name": "color_848484", | ||
| 179 | + "value": "#848484" | ||
| 172 | } | 180 | } |
| 173 | ] | 181 | ] |
| 174 | } | 182 | } |
569 Bytes
| @@ -23,8 +23,8 @@ export struct LiveCountdownComponent { | @@ -23,8 +23,8 @@ export struct LiveCountdownComponent { | ||
| 23 | aboutToAppear(): void { | 23 | aboutToAppear(): void { |
| 24 | //注册字体 | 24 | //注册字体 |
| 25 | font.registerFont({ | 25 | font.registerFont({ |
| 26 | - familyName: 'BebasNeue_Regular', | ||
| 27 | - familySrc: $rawfile('font/BebasNeue_Regular.otf') | 26 | + familyName: 'BebasNeueBold', |
| 27 | + familySrc: $rawfile('font/BebasNeueBold.otf') | ||
| 28 | }) | 28 | }) |
| 29 | setTimeout(() => { | 29 | setTimeout(() => { |
| 30 | this.textTimerController.start() | 30 | this.textTimerController.start() |
| @@ -69,13 +69,16 @@ export struct LiveCountdownComponent { | @@ -69,13 +69,16 @@ export struct LiveCountdownComponent { | ||
| 69 | .showTimeStyleBold() | 69 | .showTimeStyleBold() |
| 70 | Text('月') | 70 | Text('月') |
| 71 | .showTimeStyleNormal() | 71 | .showTimeStyleNormal() |
| 72 | - .margin({ left: 3 }) | 72 | + .margin({ left: 1 }) |
| 73 | + .baselineOffset('-6vp') | ||
| 73 | Text(this.day) | 74 | Text(this.day) |
| 74 | .showTimeStyleBold() | 75 | .showTimeStyleBold() |
| 75 | .margin({ left: 3 }) | 76 | .margin({ left: 3 }) |
| 76 | Text('日') | 77 | Text('日') |
| 77 | .showTimeStyleNormal() | 78 | .showTimeStyleNormal() |
| 78 | - .margin({ left: 3 }) | 79 | + .margin({ left: 1 }) |
| 80 | + .baselineOffset('-6vp') | ||
| 81 | + | ||
| 79 | Text(this.hour) | 82 | Text(this.hour) |
| 80 | .showTimeStyleBold() | 83 | .showTimeStyleBold() |
| 81 | .margin({ left: 10 }) | 84 | .margin({ left: 10 }) |
| @@ -85,15 +88,15 @@ export struct LiveCountdownComponent { | @@ -85,15 +88,15 @@ export struct LiveCountdownComponent { | ||
| 85 | .showTimeStyleBold() | 88 | .showTimeStyleBold() |
| 86 | } | 89 | } |
| 87 | .margin({ top: 10 }) | 90 | .margin({ top: 10 }) |
| 88 | - .visibility(this.isCountDownStart ? Visibility.None : Visibility.Visible | ||
| 89 | - ) | 91 | + .visibility(this.isCountDownStart ? Visibility.None : Visibility.Visible) |
| 90 | 92 | ||
| 93 | + // 倒计时 | ||
| 91 | TextTimer({ isCountDown: true, count: this.differenceTimeStamp, controller: this.textTimerController }) | 94 | TextTimer({ isCountDown: true, count: this.differenceTimeStamp, controller: this.textTimerController }) |
| 92 | .format(this.format) | 95 | .format(this.format) |
| 93 | - .fontSize('40fp') | 96 | + .fontSize('40vp') |
| 94 | .fontWeight(FontWeight.Bold) | 97 | .fontWeight(FontWeight.Bold) |
| 95 | .fontColor('#222222') | 98 | .fontColor('#222222') |
| 96 | - .fontFamily('BebasNeue_Regular') | 99 | + .fontFamily('BebasNeueBold') |
| 97 | .onTimer((utc: number, elapsedTime: number) => { | 100 | .onTimer((utc: number, elapsedTime: number) => { |
| 98 | console.info('textTimer notCountDown utc is:' + utc + ', elapsedTime: ' + elapsedTime) | 101 | console.info('textTimer notCountDown utc is:' + utc + ', elapsedTime: ' + elapsedTime) |
| 99 | }) | 102 | }) |
| @@ -139,7 +142,7 @@ export struct LiveCountdownComponent { | @@ -139,7 +142,7 @@ export struct LiveCountdownComponent { | ||
| 139 | //2024-04-01 19:44:00-trim->2024-04-0119:44:00 | 142 | //2024-04-01 19:44:00-trim->2024-04-0119:44:00 |
| 140 | if (StringUtils.isNotEmpty(this.liveDetailsBean.liveInfo?.planStartTime)) { | 143 | if (StringUtils.isNotEmpty(this.liveDetailsBean.liveInfo?.planStartTime)) { |
| 141 | let playStartTimeTmp = this.liveDetailsBean.liveInfo?.planStartTime?.trim() | 144 | let playStartTimeTmp = this.liveDetailsBean.liveInfo?.planStartTime?.trim() |
| 142 | - this.month = playStartTimeTmp.substring(5, 7) | 145 | + this.month = Number(playStartTimeTmp.substring(5, 7)).toString() |
| 143 | this.day = playStartTimeTmp.substring(8, 10) | 146 | this.day = playStartTimeTmp.substring(8, 10) |
| 144 | this.hour = playStartTimeTmp.substring(11, 13) | 147 | this.hour = playStartTimeTmp.substring(11, 13) |
| 145 | this.minute = playStartTimeTmp.substring(14, 16) | 148 | this.minute = playStartTimeTmp.substring(14, 16) |
| @@ -182,7 +185,7 @@ export struct LiveCountdownComponent { | @@ -182,7 +185,7 @@ export struct LiveCountdownComponent { | ||
| 182 | 185 | ||
| 183 | @Extend(Text) | 186 | @Extend(Text) |
| 184 | function showTimeStyleNormal() { | 187 | function showTimeStyleNormal() { |
| 185 | - .fontSize('16fp') | 188 | + .fontSize('16vp') |
| 186 | .fontWeight(500) | 189 | .fontWeight(500) |
| 187 | .fontColor('#222222') | 190 | .fontColor('#222222') |
| 188 | } | 191 | } |
| @@ -190,7 +193,7 @@ function showTimeStyleNormal() { | @@ -190,7 +193,7 @@ function showTimeStyleNormal() { | ||
| 190 | @Extend(Text) | 193 | @Extend(Text) |
| 191 | function showTimeStyleBold() { | 194 | function showTimeStyleBold() { |
| 192 | .fontSize('40fp') | 195 | .fontSize('40fp') |
| 193 | - .fontFamily('BebasNeue_Regular') | 196 | + .fontFamily('BebasNeueBold') |
| 194 | .fontWeight(FontWeight.Bold) | 197 | .fontWeight(FontWeight.Bold) |
| 195 | .fontColor('#222222') | 198 | .fontColor('#222222') |
| 196 | } | 199 | } |
| @@ -30,7 +30,8 @@ export struct TabInfoComponent { | @@ -30,7 +30,8 @@ export struct TabInfoComponent { | ||
| 30 | Text(this.liveDetailsBean.newsTitle) | 30 | Text(this.liveDetailsBean.newsTitle) |
| 31 | .maxLines(2) | 31 | .maxLines(2) |
| 32 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 32 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 33 | - .fontSize('18fp') | 33 | + .fontSize('18vp') |
| 34 | + .lineHeight('26vp') | ||
| 34 | .fontWeight(500) | 35 | .fontWeight(500) |
| 35 | .fontColor('#222222') | 36 | .fontColor('#222222') |
| 36 | } | 37 | } |
| @@ -40,9 +41,10 @@ export struct TabInfoComponent { | @@ -40,9 +41,10 @@ export struct TabInfoComponent { | ||
| 40 | Text(this.liveDetailsBean.newIntroduction) | 41 | Text(this.liveDetailsBean.newIntroduction) |
| 41 | .maxLines(5) | 42 | .maxLines(5) |
| 42 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 43 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 43 | - .fontSize('14fp') | 44 | + .fontSize('14vp') |
| 44 | .fontWeight(400) | 45 | .fontWeight(400) |
| 45 | .fontColor('#666666') | 46 | .fontColor('#666666') |
| 47 | + .lineHeight('22vp') | ||
| 46 | .margin({ top: 8 }) | 48 | .margin({ top: 8 }) |
| 47 | } | 49 | } |
| 48 | } | 50 | } |
| @@ -25,13 +25,13 @@ export struct TabLiveItemComponent { | @@ -25,13 +25,13 @@ export struct TabLiveItemComponent { | ||
| 25 | Text(this.item.senderUserName) | 25 | Text(this.item.senderUserName) |
| 26 | .maxLines(1) | 26 | .maxLines(1) |
| 27 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 27 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 28 | - .fontSize('14fp') | 28 | + .fontSize('14vp') |
| 29 | .fontWeight(400) | 29 | .fontWeight(400) |
| 30 | .fontColor('#222222') | 30 | .fontColor('#222222') |
| 31 | Text(this.item.role === 'host' ? '主持人' : '嘉宾') | 31 | Text(this.item.role === 'host' ? '主持人' : '嘉宾') |
| 32 | .maxLines(1) | 32 | .maxLines(1) |
| 33 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 33 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 34 | - .fontSize('11fp') | 34 | + .fontSize('11vp') |
| 35 | .fontWeight(400) | 35 | .fontWeight(400) |
| 36 | .fontColor('#968562') | 36 | .fontColor('#968562') |
| 37 | .backgroundColor('#F1EFEB') | 37 | .backgroundColor('#F1EFEB') |
| @@ -44,17 +44,18 @@ export struct TabLiveItemComponent { | @@ -44,17 +44,18 @@ export struct TabLiveItemComponent { | ||
| 44 | .borderRadius(2) | 44 | .borderRadius(2) |
| 45 | .margin({ left: 8 }) | 45 | .margin({ left: 8 }) |
| 46 | .visibility(StringUtils.isNotEmpty(this.item.role) ? Visibility.Visible : Visibility.None) | 46 | .visibility(StringUtils.isNotEmpty(this.item.role) ? Visibility.Visible : Visibility.None) |
| 47 | + | ||
| 47 | Text(DateTimeUtils.getCommentTime(new Date(this.item.time).getTime())) | 48 | Text(DateTimeUtils.getCommentTime(new Date(this.item.time).getTime())) |
| 48 | .maxLines(1) | 49 | .maxLines(1) |
| 49 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 50 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 50 | - .fontSize('12fp') | 51 | + .fontSize('12vp') |
| 51 | .fontWeight(400) | 52 | .fontWeight(400) |
| 52 | .fontColor('#999999') | 53 | .fontColor('#999999') |
| 53 | .margin({ left: 8 }) | 54 | .margin({ left: 8 }) |
| 54 | .visibility(StringUtils.isNotEmpty(this.item.time) ? Visibility.Visible : Visibility.None) | 55 | .visibility(StringUtils.isNotEmpty(this.item.time) ? Visibility.Visible : Visibility.None) |
| 55 | 56 | ||
| 56 | Text('置顶') | 57 | Text('置顶') |
| 57 | - .fontSize('11fp') | 58 | + .fontSize('11vp') |
| 58 | .fontWeight(400) | 59 | .fontWeight(400) |
| 59 | .fontColor('#ED2800') | 60 | .fontColor('#ED2800') |
| 60 | .backgroundColor('#F1EFEB') | 61 | .backgroundColor('#F1EFEB') |
| @@ -71,9 +72,10 @@ export struct TabLiveItemComponent { | @@ -71,9 +72,10 @@ export struct TabLiveItemComponent { | ||
| 71 | } | 72 | } |
| 72 | 73 | ||
| 73 | Text(this.item.text) | 74 | Text(this.item.text) |
| 74 | - .fontSize('14fp') | 75 | + .fontSize('14vp') |
| 75 | .fontWeight(400) | 76 | .fontWeight(400) |
| 76 | .fontColor('#222222') | 77 | .fontColor('#222222') |
| 78 | + .lineHeight('20vp') | ||
| 77 | .margin({ | 79 | .margin({ |
| 78 | top: 6 | 80 | top: 6 |
| 79 | }) | 81 | }) |
| @@ -89,8 +89,8 @@ export struct PlayUIComponent { | @@ -89,8 +89,8 @@ export struct PlayUIComponent { | ||
| 89 | Text(this.liveDetailsBean.newsTitle) | 89 | Text(this.liveDetailsBean.newsTitle) |
| 90 | .maxLines(1) | 90 | .maxLines(1) |
| 91 | .textOverflow({ overflow: TextOverflow.MARQUEE }) | 91 | .textOverflow({ overflow: TextOverflow.MARQUEE }) |
| 92 | - .fontSize('16fp') | ||
| 93 | - .fontWeight(500) | 92 | + .fontSize(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '18vp' : '16vp') |
| 93 | + .fontWeight(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? 600 : 500) | ||
| 94 | .fontColor(Color.White) | 94 | .fontColor(Color.White) |
| 95 | .textAlign(TextAlign.Start) | 95 | .textAlign(TextAlign.Start) |
| 96 | .layoutWeight(1) | 96 | .layoutWeight(1) |
| @@ -200,7 +200,7 @@ export struct PlayUIComponent { | @@ -200,7 +200,7 @@ export struct PlayUIComponent { | ||
| 200 | else if (this.liveDetailsBean.liveInfo?.liveState == 'end') { | 200 | else if (this.liveDetailsBean.liveInfo?.liveState == 'end') { |
| 201 | Row() { | 201 | Row() { |
| 202 | Text('回看') | 202 | Text('回看') |
| 203 | - .fontSize('11fp') | 203 | + .fontSize('11vp') |
| 204 | .fontWeight(400) | 204 | .fontWeight(400) |
| 205 | .fontColor(Color.White) | 205 | .fontColor(Color.White) |
| 206 | 206 | ||
| @@ -209,7 +209,7 @@ export struct PlayUIComponent { | @@ -209,7 +209,7 @@ export struct PlayUIComponent { | ||
| 209 | .width(12) | 209 | .width(12) |
| 210 | .height(12) | 210 | .height(12) |
| 211 | Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`) | 211 | Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`) |
| 212 | - .fontSize('11fp') | 212 | + .fontSize('11vp') |
| 213 | .fontWeight(400) | 213 | .fontWeight(400) |
| 214 | .fontColor(Color.White) | 214 | .fontColor(Color.White) |
| 215 | } | 215 | } |
| @@ -221,6 +221,8 @@ export struct PlayUIComponent { | @@ -221,6 +221,8 @@ export struct PlayUIComponent { | ||
| 221 | top: 1, | 221 | top: 1, |
| 222 | right: 4, | 222 | right: 4, |
| 223 | bottom: 1 | 223 | bottom: 1 |
| 224 | + }).margin({ | ||
| 225 | + left: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '34vp' : 0 | ||
| 224 | }) | 226 | }) |
| 225 | } | 227 | } |
| 226 | } | 228 | } |
sight_harmony/features/wdDetailPlayLive/src/main/resources/rawfile/font/BebasNeueBold.otf
0 → 100644
No preview for this file type
| @@ -15,8 +15,7 @@ import { HttpUtils } from 'wdNetwork/Index'; | @@ -15,8 +15,7 @@ import { HttpUtils } from 'wdNetwork/Index'; | ||
| 15 | import { DateTimeUtils, WindowModel } from 'wdKit/Index'; | 15 | import { DateTimeUtils, WindowModel } from 'wdKit/Index'; |
| 16 | import { PlayerBottomView } from '../view/PlayerBottomView'; | 16 | import { PlayerBottomView } from '../view/PlayerBottomView'; |
| 17 | import { PlayerRightView } from '../view/PlayerRightView'; | 17 | import { PlayerRightView } from '../view/PlayerRightView'; |
| 18 | -import { CommentComponentPage } from '../view/CommentComponentPage'; | ||
| 19 | -import { window } from '@kit.ArkUI'; | 18 | +import { CommentDialogView } from '../view/CommentDialogView'; |
| 20 | import { DisplayDirection } from 'wdConstant/Index'; | 19 | import { DisplayDirection } from 'wdConstant/Index'; |
| 21 | 20 | ||
| 22 | const TAG = 'DetailPlayShortVideoPage'; | 21 | const TAG = 'DetailPlayShortVideoPage'; |
| @@ -39,7 +38,7 @@ export struct DetailPlayShortVideoPage { | @@ -39,7 +38,7 @@ export struct DetailPlayShortVideoPage { | ||
| 39 | @Provide followStatus: string = '0' // 关注状态 | 38 | @Provide followStatus: string = '0' // 关注状态 |
| 40 | @Provide isOpenDetail: boolean = false // 查看详情按钮点击 | 39 | @Provide isOpenDetail: boolean = false // 查看详情按钮点击 |
| 41 | @Provide isDragging: boolean = false // 拖动时间进度条 | 40 | @Provide isDragging: boolean = false // 拖动时间进度条 |
| 42 | - @Provide showCommentList: boolean = false | 41 | + @Consume showCommentList: boolean |
| 43 | @Consume displayDirection: DisplayDirection | 42 | @Consume displayDirection: DisplayDirection |
| 44 | @Consume @Watch('videoStatusChange') switchVideoStatus: boolean | 43 | @Consume @Watch('videoStatusChange') switchVideoStatus: boolean |
| 45 | @Consume @Watch('pageShowChange') pageShow: number | 44 | @Consume @Watch('pageShowChange') pageShow: number |
| @@ -225,15 +224,7 @@ export struct DetailPlayShortVideoPage { | @@ -225,15 +224,7 @@ export struct DetailPlayShortVideoPage { | ||
| 225 | .height('100%') | 224 | .height('100%') |
| 226 | .width('100%') | 225 | .width('100%') |
| 227 | 226 | ||
| 228 | - // .padding({ | ||
| 229 | - // top: this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ? 0 : this.topSafeHeight + 'px' | ||
| 230 | - // }) | ||
| 231 | - | ||
| 232 | - if (this.showCommentList) { | ||
| 233 | - CommentComponentPage({}) | ||
| 234 | - .position({ y: '100%' }) | ||
| 235 | - .markAnchor({ y: '100%' }) | ||
| 236 | - } | 227 | + CommentDialogView({ publishCommentModel: this.publishCommentModel }) |
| 237 | } | 228 | } |
| 238 | .height('100%') | 229 | .height('100%') |
| 239 | .width('100%') | 230 | .width('100%') |
| @@ -294,13 +285,14 @@ export struct DetailPlayShortVideoPage { | @@ -294,13 +285,14 @@ export struct DetailPlayShortVideoPage { | ||
| 294 | .margin({ left: 8, right: 4 }) | 285 | .margin({ left: 8, right: 4 }) |
| 295 | Text("全屏观看") | 286 | Text("全屏观看") |
| 296 | .fontColor(Color.White) | 287 | .fontColor(Color.White) |
| 288 | + .fontWeight(400) | ||
| 297 | .fontSize(12) | 289 | .fontSize(12) |
| 298 | .layoutWeight(1) | 290 | .layoutWeight(1) |
| 299 | } | 291 | } |
| 300 | .width(84) | 292 | .width(84) |
| 301 | .height(28) | 293 | .height(28) |
| 302 | - .backgroundColor('#0d0d0d') | ||
| 303 | - .border({ width: 1, color: '#4DFFFFFF', radius: 2 }) | 294 | + .backgroundColor('#0DFFFFFF') |
| 295 | + .border({ width: 1, color: '#4DFFFFFF', radius: 4 }) | ||
| 304 | .alignItems(VerticalAlign.Center) | 296 | .alignItems(VerticalAlign.Center) |
| 305 | .justifyContent(FlexAlign.Center) | 297 | .justifyContent(FlexAlign.Center) |
| 306 | .align(Alignment.Bottom) | 298 | .align(Alignment.Bottom) |
| @@ -28,6 +28,7 @@ export struct DetailVideoListPage { | @@ -28,6 +28,7 @@ export struct DetailVideoListPage { | ||
| 28 | @Provide pageHide: number = -1 | 28 | @Provide pageHide: number = -1 |
| 29 | @Provide switchVideoStatus: boolean = true | 29 | @Provide switchVideoStatus: boolean = true |
| 30 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL | 30 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL |
| 31 | + @Provide showCommentList: boolean = false | ||
| 31 | @State data: ContentDetailDTO[] = [] | 32 | @State data: ContentDetailDTO[] = [] |
| 32 | @State currentIndex: number = 0 | 33 | @State currentIndex: number = 0 |
| 33 | @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 | 34 | @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 |
| @@ -185,7 +186,6 @@ export struct DetailVideoListPage { | @@ -185,7 +186,6 @@ export struct DetailVideoListPage { | ||
| 185 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 186 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 186 | }) | 187 | }) |
| 187 | } else { | 188 | } else { |
| 188 | - | ||
| 189 | Column() { | 189 | Column() { |
| 190 | Swiper(this.swiperController) { | 190 | Swiper(this.swiperController) { |
| 191 | ForEach(this.data, (item: ContentDetailDTO, index: number) => { | 191 | ForEach(this.data, (item: ContentDetailDTO, index: number) => { |
| @@ -197,7 +197,8 @@ export struct DetailVideoListPage { | @@ -197,7 +197,8 @@ export struct DetailVideoListPage { | ||
| 197 | }) | 197 | }) |
| 198 | }, (item: ContentDetailDTO) => item.newsId + '') | 198 | }, (item: ContentDetailDTO) => item.newsId + '') |
| 199 | } | 199 | } |
| 200 | - .disableSwipe(this.displayDirection === DisplayDirection.VERTICAL || !this.showComment ? false : true) | 200 | + .disableSwipe(this.displayDirection === DisplayDirection.VERTICAL || this.showCommentList ? |
| 201 | + false : true) | ||
| 201 | .indicator(false) | 202 | .indicator(false) |
| 202 | .vertical(true) | 203 | .vertical(true) |
| 203 | .loop(false) | 204 | .loop(false) |
| @@ -221,5 +222,6 @@ export struct DetailVideoListPage { | @@ -221,5 +222,6 @@ export struct DetailVideoListPage { | ||
| 221 | // bottom: this.bottomSafeHeight + 'px' | 222 | // bottom: this.bottomSafeHeight + 'px' |
| 222 | // }) | 223 | // }) |
| 223 | } | 224 | } |
| 225 | + | ||
| 224 | } | 226 | } |
| 225 | } | 227 | } |
| @@ -45,13 +45,15 @@ export struct VideoChannelDetail { | @@ -45,13 +45,15 @@ export struct VideoChannelDetail { | ||
| 45 | @Consume barBackgroundColor: Color | 45 | @Consume barBackgroundColor: Color |
| 46 | private swiperController: SwiperController = new SwiperController() | 46 | private swiperController: SwiperController = new SwiperController() |
| 47 | @Provide showComment: boolean = false | 47 | @Provide showComment: boolean = false |
| 48 | - @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | ||
| 49 | @Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0 | 48 | @Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0 |
| 50 | @Provide windowHeight: number = AppStorage.get<number>('windowHeight') || 0 | 49 | @Provide windowHeight: number = AppStorage.get<number>('windowHeight') || 0 |
| 50 | + @Provide bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | ||
| 51 | + @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | ||
| 51 | @Consume @Watch('pageShowChange') pageShow: number | 52 | @Consume @Watch('pageShowChange') pageShow: number |
| 52 | @Consume @Watch('pageHideChange') pageHide: number | 53 | @Consume @Watch('pageHideChange') pageHide: number |
| 53 | @Provide switchVideoStatus: boolean = true | 54 | @Provide switchVideoStatus: boolean = true |
| 54 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL | 55 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL |
| 56 | + @Provide showCommentList: boolean = false | ||
| 55 | @State data: ContentDetailDTO[] = [] | 57 | @State data: ContentDetailDTO[] = [] |
| 56 | @State currentIndex: number = 0 | 58 | @State currentIndex: number = 0 |
| 57 | @State interactDataList: InteractDataDTO[] = [] | 59 | @State interactDataList: InteractDataDTO[] = [] |
| @@ -267,8 +269,8 @@ export struct VideoChannelDetail { | @@ -267,8 +269,8 @@ export struct VideoChannelDetail { | ||
| 267 | }, (item: ContentDetailDTO) => item.newsId + '') | 269 | }, (item: ContentDetailDTO) => item.newsId + '') |
| 268 | } | 270 | } |
| 269 | .displayCount(1, true) | 271 | .displayCount(1, true) |
| 270 | - .disableSwipe(this.displayDirection === DisplayDirection.VERTICAL || !this.showComment ? false : true) | ||
| 271 | - .visibility(this.isMouted ? Visibility.Visible : Visibility.None) | 272 | + .disableSwipe(this.displayDirection === DisplayDirection.VERTICAL || this.showCommentList ? false : true) |
| 273 | + .visibility(this.isMouted ? Visibility.Visible : Visibility.Hidden) | ||
| 272 | .indicator(false) | 274 | .indicator(false) |
| 273 | .vertical(true) | 275 | .vertical(true) |
| 274 | .loop(false) | 276 | .loop(false) |
-
Please register or login to post a comment