Showing
74 changed files
with
1324 additions
and
1070 deletions
Too many changes to show.
To preserve performance only 74 of 74+ files are displayed.
| @@ -34,6 +34,7 @@ export class SpConstants{ | @@ -34,6 +34,7 @@ export class SpConstants{ | ||
| 34 | //定位相关 | 34 | //定位相关 |
| 35 | static LOCATION_CITY_NAME = "location_city_name" //定位 | 35 | static LOCATION_CITY_NAME = "location_city_name" //定位 |
| 36 | static LOCATION_CITY_CODE = "location_city_code" //定位 | 36 | static LOCATION_CITY_CODE = "location_city_code" //定位 |
| 37 | + static LOCATION_PERMISSION_REFUSE = "location_permission_refuse" //定位 | ||
| 37 | 38 | ||
| 38 | //启动页数据存储key | 39 | //启动页数据存储key |
| 39 | static APP_LAUNCH_PAGE_DATA_MODEL = 'app_launch_page_data_model' | 40 | static APP_LAUNCH_PAGE_DATA_MODEL = 'app_launch_page_data_model' |
| 1 | import { Action } from './Action'; | 1 | import { Action } from './Action'; |
| 2 | + | ||
| 2 | interface dataObject { | 3 | interface dataObject { |
| 3 | // dataSource: | 4 | // dataSource: |
| 4 | // 1、图文详情数据 | 5 | // 1、图文详情数据 |
| @@ -17,7 +18,11 @@ interface dataObject { | @@ -17,7 +18,11 @@ interface dataObject { | ||
| 17 | webViewHeight?: string | 18 | webViewHeight?: string |
| 18 | dataJson?: string | 19 | dataJson?: string |
| 19 | appInnerLink?: string | 20 | appInnerLink?: string |
| 21 | + method?: string | ||
| 22 | + url?: string | ||
| 23 | + parameters?: object | ||
| 20 | } | 24 | } |
| 25 | + | ||
| 21 | /** | 26 | /** |
| 22 | * 消息Message | 27 | * 消息Message |
| 23 | */ | 28 | */ |
| @@ -746,7 +746,7 @@ export class HttpUrlUtils { | @@ -746,7 +746,7 @@ export class HttpUrlUtils { | ||
| 746 | } | 746 | } |
| 747 | 747 | ||
| 748 | static getSearchHotsDataUrl() { | 748 | static getSearchHotsDataUrl() { |
| 749 | - let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.SEARCH_HOTS_DATA_PATH | 749 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_HOTS_DATA_PATH |
| 750 | return url | 750 | return url |
| 751 | } | 751 | } |
| 752 | 752 | ||
| @@ -847,6 +847,13 @@ export class HttpUrlUtils { | @@ -847,6 +847,13 @@ export class HttpUrlUtils { | ||
| 847 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/like/executeLike"; | 847 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/like/executeLike"; |
| 848 | return url; | 848 | return url; |
| 849 | } | 849 | } |
| 850 | + | ||
| 851 | + //获取点赞状态 | ||
| 852 | + static getLikeStatus() { | ||
| 853 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/batchLikeAndCollect/status"; | ||
| 854 | + return url; | ||
| 855 | + } | ||
| 856 | + | ||
| 850 | //搜索推荐 | 857 | //搜索推荐 |
| 851 | static getSearchSuggestDataUrl() { | 858 | static getSearchSuggestDataUrl() { |
| 852 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_SUGGEST_DATA_PATH | 859 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_SUGGEST_DATA_PATH |
| @@ -171,6 +171,17 @@ export class ProcessUtils { | @@ -171,6 +171,17 @@ export class ProcessUtils { | ||
| 171 | Logger.debug(TAG, `gotoMultiPictureListPage`); | 171 | Logger.debug(TAG, `gotoMultiPictureListPage`); |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | + public static _gotoSpecialTopic(linkUrl: string) { | ||
| 175 | + let taskAction: Action = { | ||
| 176 | + type: 'JUMP_INNER_NEW_PAGE', | ||
| 177 | + params: { | ||
| 178 | + url: linkUrl, | ||
| 179 | + pageID: 'SPACIAL_TOPIC_PAGE', | ||
| 180 | + } as Params, | ||
| 181 | + }; | ||
| 182 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 183 | + } | ||
| 184 | + | ||
| 174 | public static gotoSpecialTopic(content: ContentDTO) { | 185 | public static gotoSpecialTopic(content: ContentDTO) { |
| 175 | let taskAction: Action = { | 186 | let taskAction: Action = { |
| 176 | type: 'JUMP_INNER_NEW_PAGE', | 187 | type: 'JUMP_INNER_NEW_PAGE', |
| @@ -182,6 +193,16 @@ export class ProcessUtils { | @@ -182,6 +193,16 @@ export class ProcessUtils { | ||
| 182 | WDRouterRule.jumpWithAction(taskAction) | 193 | WDRouterRule.jumpWithAction(taskAction) |
| 183 | } | 194 | } |
| 184 | 195 | ||
| 196 | + public static _gotoDefaultWeb(linkUrl: string) { | ||
| 197 | + let taskAction: Action = { | ||
| 198 | + type: 'JUMP_H5_BY_WEB_VIEW', | ||
| 199 | + params: { | ||
| 200 | + url: linkUrl, | ||
| 201 | + } as Params, | ||
| 202 | + }; | ||
| 203 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 204 | + } | ||
| 205 | + | ||
| 185 | public static gotoDefaultWeb(content: ContentDTO) { | 206 | public static gotoDefaultWeb(content: ContentDTO) { |
| 186 | let taskAction: Action = { | 207 | let taskAction: Action = { |
| 187 | type: 'JUMP_H5_BY_WEB_VIEW', | 208 | type: 'JUMP_H5_BY_WEB_VIEW', |
| @@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
| 11 | "wdKit": "file:../wdKit", | 11 | "wdKit": "file:../wdKit", |
| 12 | "wdJsBridge": "file:../wdJsBridge", | 12 | "wdJsBridge": "file:../wdJsBridge", |
| 13 | "wdBean": "file:../../features/wdBean", | 13 | "wdBean": "file:../../features/wdBean", |
| 14 | - "wdRouter": "file:../wdRouter" | 14 | + "wdRouter": "file:../wdRouter", |
| 15 | + "wdNetwork": "file:../wdNetwork" | ||
| 15 | } | 16 | } |
| 16 | } | 17 | } |
| @@ -10,6 +10,9 @@ export class H5CallNativeType { | @@ -10,6 +10,9 @@ export class H5CallNativeType { | ||
| 10 | static jsCall_callAppService = 'jsCall_callAppService' | 10 | static jsCall_callAppService = 'jsCall_callAppService' |
| 11 | static jsCall_appInnerLinkMethod = 'jsCall_appInnerLinkMethod' | 11 | static jsCall_appInnerLinkMethod = 'jsCall_appInnerLinkMethod' |
| 12 | static jsCall_receiveH5Data = 'jsCall_receiveH5Data' | 12 | static jsCall_receiveH5Data = 'jsCall_receiveH5Data' |
| 13 | + static jsCall_getAppLoginAuthInfo = 'jsCall_getAppLoginAuthInfo' | ||
| 14 | + static jsCall_appNotifyEvent = 'jsCall_appNotifyEvent' | ||
| 15 | + | ||
| 13 | // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 | 16 | // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 |
| 14 | 17 | ||
| 15 | static { | 18 | static { |
| @@ -19,6 +22,8 @@ export class H5CallNativeType { | @@ -19,6 +22,8 @@ export class H5CallNativeType { | ||
| 19 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_callAppService) | 22 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_callAppService) |
| 20 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appInnerLinkMethod) | 23 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appInnerLinkMethod) |
| 21 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveH5Data) | 24 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveH5Data) |
| 25 | + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppLoginAuthInfo) | ||
| 26 | + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appNotifyEvent) | ||
| 22 | } | 27 | } |
| 23 | } | 28 | } |
| 24 | 29 |
| 1 | +import HashMap from '@ohos.util.HashMap'; | ||
| 1 | import { Callback } from 'wdJsBridge'; | 2 | import { Callback } from 'wdJsBridge'; |
| 2 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 3 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 3 | import { Logger } from 'wdKit'; | 4 | import { Logger } from 'wdKit'; |
| @@ -8,6 +9,7 @@ import { ProcessUtils } from 'wdRouter'; | @@ -8,6 +9,7 @@ import { ProcessUtils } from 'wdRouter'; | ||
| 8 | import router from '@ohos.router'; | 9 | import router from '@ohos.router'; |
| 9 | import Url from '@ohos.url' | 10 | import Url from '@ohos.url' |
| 10 | import { ContentDTO } from 'wdBean/Index'; | 11 | import { ContentDTO } from 'wdBean/Index'; |
| 12 | +import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork'; | ||
| 11 | 13 | ||
| 12 | const TAG = 'JsBridgeBiz' | 14 | const TAG = 'JsBridgeBiz' |
| 13 | 15 | ||
| @@ -37,7 +39,9 @@ export function performJSCallNative(data: Message, call: Callback) { | @@ -37,7 +39,9 @@ export function performJSCallNative(data: Message, call: Callback) { | ||
| 37 | case H5CallNativeType.jsCall_getArticleDetailBussinessData: | 39 | case H5CallNativeType.jsCall_getArticleDetailBussinessData: |
| 38 | break; | 40 | break; |
| 39 | case H5CallNativeType.jsCall_callAppService: | 41 | case H5CallNativeType.jsCall_callAppService: |
| 40 | - handleJsCallCallAppService(data) | 42 | + handleJsCallCallAppService(data, (res: string) => { |
| 43 | + call(res) | ||
| 44 | + }) | ||
| 41 | break; | 45 | break; |
| 42 | case H5CallNativeType.jsCall_receiveH5Data: | 46 | case H5CallNativeType.jsCall_receiveH5Data: |
| 43 | handleJsCallReceiveH5Data(data) | 47 | handleJsCallReceiveH5Data(data) |
| @@ -60,6 +64,21 @@ function handleJsCallCurrentPageOperate(data: Message) { | @@ -60,6 +64,21 @@ function handleJsCallCurrentPageOperate(data: Message) { | ||
| 60 | } | 64 | } |
| 61 | } | 65 | } |
| 62 | 66 | ||
| 67 | +function handleJsCallCallAppService(data: Message, callback: (res: string) => void) { | ||
| 68 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 69 | + let url: string = HttpUrlUtils.getHost() + data?.data?.url | ||
| 70 | + if (data?.data?.method === 'get') { | ||
| 71 | + WDHttp.get<ResponseDTO<string>>(url, headers).then((res: ResponseDTO<string>) => { | ||
| 72 | + callback(JSON.stringify(res)) | ||
| 73 | + }) | ||
| 74 | + } | ||
| 75 | + if (data?.data?.method === 'post') { | ||
| 76 | + WDHttp.post<ResponseDTO<string>>(url, data?.data?.parameters, headers).then(res => { | ||
| 77 | + callback(JSON.stringify(res)) | ||
| 78 | + }) | ||
| 79 | + } | ||
| 80 | +} | ||
| 81 | + | ||
| 63 | /** | 82 | /** |
| 64 | * 获取App公共信息 | 83 | * 获取App公共信息 |
| 65 | */ | 84 | */ |
| @@ -87,19 +106,14 @@ function handleJsCallReceiveH5Data(data: Message) { | @@ -87,19 +106,14 @@ function handleJsCallReceiveH5Data(data: Message) { | ||
| 87 | } | 106 | } |
| 88 | } | 107 | } |
| 89 | 108 | ||
| 90 | -function handleJsCallCallAppService(data: Message) { | ||
| 91 | - | ||
| 92 | -} | ||
| 93 | - | ||
| 94 | function handleJsCallAppInnerLinkMethod(data: Message) { | 109 | function handleJsCallAppInnerLinkMethod(data: Message) { |
| 95 | let urlObject = Url.URL.parseURL(data?.data?.appInnerLink); | 110 | let urlObject = Url.URL.parseURL(data?.data?.appInnerLink); |
| 96 | let urlParams = new Url.URLParams(urlObject.search); | 111 | let urlParams = new Url.URLParams(urlObject.search); |
| 97 | - console.log('urlObject:', `${JSON.stringify(urlParams)}`) | ||
| 98 | let content: ContentDTO = { | 112 | let content: ContentDTO = { |
| 99 | objectId: urlParams.get('contentId') || '', | 113 | objectId: urlParams.get('contentId') || '', |
| 100 | relId: urlParams.get('relId') || '', | 114 | relId: urlParams.get('relId') || '', |
| 101 | relType: urlParams.get('relType') || '', | 115 | relType: urlParams.get('relType') || '', |
| 102 | - pageId:urlParams.get('pageId') || '', | 116 | + pageId: urlParams.get('pageId') || '', |
| 103 | objectType: '' | 117 | objectType: '' |
| 104 | } as ContentDTO | 118 | } as ContentDTO |
| 105 | if (urlParams.get('skipType') === '1') { | 119 | if (urlParams.get('skipType') === '1') { |
| @@ -130,14 +144,14 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | @@ -130,14 +144,14 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | ||
| 130 | ProcessUtils.processPage(content) | 144 | ProcessUtils.processPage(content) |
| 131 | break; | 145 | break; |
| 132 | case 'topic': | 146 | case 'topic': |
| 133 | - if(urlParams.get('subType') === 'h5'){ | 147 | + if (urlParams.get('subType') === 'h5') { |
| 134 | content.objectType = ContentConstants.TYPE_SPECIAL_TOPIC | 148 | content.objectType = ContentConstants.TYPE_SPECIAL_TOPIC |
| 135 | ProcessUtils.processPage(content) | 149 | ProcessUtils.processPage(content) |
| 136 | } | 150 | } |
| 137 | - if(urlParams.get('subType') === 'moring_evening_news'){ | 151 | + if (urlParams.get('subType') === 'moring_evening_news') { |
| 138 | ProcessUtils.gotoMorningEveningPaper() | 152 | ProcessUtils.gotoMorningEveningPaper() |
| 139 | } | 153 | } |
| 140 | - if(urlParams.get('subType') === 'electronic_newspapers'){ | 154 | + if (urlParams.get('subType') === 'electronic_newspapers') { |
| 141 | ProcessUtils.gotoENewsPaper() | 155 | ProcessUtils.gotoENewsPaper() |
| 142 | } | 156 | } |
| 143 | break; | 157 | break; |
| @@ -148,7 +162,7 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | @@ -148,7 +162,7 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | ||
| 148 | case 'owner_page': | 162 | case 'owner_page': |
| 149 | let creatorId = urlParams.get('creatorId') || '' | 163 | let creatorId = urlParams.get('creatorId') || '' |
| 150 | ProcessUtils.gotoPeopleShipHomePage(creatorId) | 164 | ProcessUtils.gotoPeopleShipHomePage(creatorId) |
| 151 | - break; | 165 | + break; |
| 152 | default: | 166 | default: |
| 153 | break; | 167 | break; |
| 154 | } | 168 | } |
| @@ -7,6 +7,7 @@ export interface CompDTO { | @@ -7,6 +7,7 @@ export interface CompDTO { | ||
| 7 | cityCode: string; | 7 | cityCode: string; |
| 8 | compStyle: string; | 8 | compStyle: string; |
| 9 | compType: string; | 9 | compType: string; |
| 10 | + | ||
| 10 | // dataSourceRequest: any[]; | 11 | // dataSourceRequest: any[]; |
| 11 | districtCode: string; | 12 | districtCode: string; |
| 12 | extraData?: string; | 13 | extraData?: string; |
| @@ -15,6 +16,7 @@ export interface CompDTO { | @@ -15,6 +16,7 @@ export interface CompDTO { | ||
| 15 | imgSize: string; | 16 | imgSize: string; |
| 16 | innerUrl: string; | 17 | innerUrl: string; |
| 17 | linkUrl: string; | 18 | linkUrl: string; |
| 19 | + | ||
| 18 | // meddleDataList: any[]; | 20 | // meddleDataList: any[]; |
| 19 | name: string; | 21 | name: string; |
| 20 | objectId: string; // 跳转页面id? | 22 | objectId: string; // 跳转页面id? |
| @@ -29,9 +31,13 @@ export interface CompDTO { | @@ -29,9 +31,13 @@ export interface CompDTO { | ||
| 29 | subType: string; | 31 | subType: string; |
| 30 | imageScale: number; // 封面图比例 1-4:3, 2-16:9, 3-3:2 | 32 | imageScale: number; // 封面图比例 1-4:3, 2-16:9, 3-3:2 |
| 31 | audioDataList: AudioDTO[]; | 33 | audioDataList: AudioDTO[]; |
| 34 | + titleShowPolicy: string | number; | ||
| 32 | 35 | ||
| 33 | /** | 36 | /** |
| 34 | * 组件内容源类型 (LIVE_HORIZONTAL_CARD\LIVE_RESERVATION\LIVE_LARGE_CARD\LIVE_END\LIVE_MONTHLY_RANKING ) | 37 | * 组件内容源类型 (LIVE_HORIZONTAL_CARD\LIVE_RESERVATION\LIVE_LARGE_CARD\LIVE_END\LIVE_MONTHLY_RANKING ) |
| 35 | */ | 38 | */ |
| 36 | dataSourceType: string; | 39 | dataSourceType: string; |
| 40 | + | ||
| 41 | + pageId?: string; | ||
| 42 | + objectType?: string; | ||
| 37 | } | 43 | } |
| 1 | +import { RmhInfoDTO } from '../detail/RmhInfoDTO' | ||
| 2 | + | ||
| 1 | export interface LiveDetailsBean { | 3 | export interface LiveDetailsBean { |
| 2 | /** | 4 | /** |
| 3 | * { | 5 | * { |
| @@ -164,14 +166,16 @@ export interface LiveDetailsBean { | @@ -164,14 +166,16 @@ export interface LiveDetailsBean { | ||
| 164 | //迁移id | 166 | //迁移id |
| 165 | oldNewsId: string | 167 | oldNewsId: string |
| 166 | reLInfo: ReLInfo | 168 | reLInfo: ReLInfo |
| 167 | - rmhInfo: RmhInfo | 169 | + rmhInfo: RmhInfoDTO |
| 168 | } | 170 | } |
| 169 | 171 | ||
| 170 | export interface LiveInfo { | 172 | export interface LiveInfo { |
| 171 | //直播新闻-直播状态 wait 待开播 running 直播中 end 已结束cancel已取消paused暂停 | 173 | //直播新闻-直播状态 wait 待开播 running 直播中 end 已结束cancel已取消paused暂停 |
| 172 | liveState: string | 174 | liveState: string |
| 175 | + | ||
| 173 | //2024-04-12 15:00:00 直播开始时间 | 176 | //2024-04-12 15:00:00 直播开始时间 |
| 174 | planStartTime: string | 177 | planStartTime: string |
| 178 | + //直播样式 0-正常模式 , 1-隐藏直播间,2-隐藏大家聊 【人民号发布是竖屏的,为空】 | ||
| 175 | liveStyle: number; | 179 | liveStyle: number; |
| 176 | vlive: Array<Vlive> | 180 | vlive: Array<Vlive> |
| 177 | mlive: MLive | 181 | mlive: MLive |
| @@ -197,11 +201,3 @@ export interface Vlive { | @@ -197,11 +201,3 @@ export interface Vlive { | ||
| 197 | export interface ReLInfo { | 201 | export interface ReLInfo { |
| 198 | relId: string | 202 | relId: string |
| 199 | } | 203 | } |
| 200 | - | ||
| 201 | -export interface RmhInfo { | ||
| 202 | - rmhName: string; | ||
| 203 | - rmhHeadUrl: string; | ||
| 204 | - rmhId: string; | ||
| 205 | - userId: string; | ||
| 206 | - userType: string; | ||
| 207 | -} |
| @@ -9,6 +9,7 @@ export interface PageInfoDTO { | @@ -9,6 +9,7 @@ export interface PageInfoDTO { | ||
| 9 | name: string; // 名称 | 9 | name: string; // 名称 |
| 10 | hasPopUp: number; | 10 | hasPopUp: number; |
| 11 | baselineShow: number; | 11 | baselineShow: number; |
| 12 | + baselineCopywriting: string; | ||
| 12 | groups: GroupInfoDTO[]; | 13 | groups: GroupInfoDTO[]; |
| 13 | channelInfo: ChannelInfoDTO; | 14 | channelInfo: ChannelInfoDTO; |
| 14 | 15 | ||
| @@ -20,11 +21,11 @@ export interface PageInfoDTO { | @@ -20,11 +21,11 @@ export interface PageInfoDTO { | ||
| 20 | /** | 21 | /** |
| 21 | * 挂角广告数据 | 22 | * 挂角广告数据 |
| 22 | */ | 23 | */ |
| 23 | - cornersAdv:AdvRuleBean | 24 | + cornersAdv: AdvRuleBean |
| 24 | /** | 25 | /** |
| 25 | * 广告中心-挂角广告信息 | 26 | * 广告中心-挂角广告信息 |
| 26 | */ | 27 | */ |
| 27 | - cornersAdv2:CompAdvBean[] | 28 | + cornersAdv2: CompAdvBean[] |
| 28 | 29 | ||
| 29 | } | 30 | } |
| 30 | 31 |
| @@ -14,6 +14,8 @@ export { PageComponent } from "./src/main/ets/components/page/PageComponent" | @@ -14,6 +14,8 @@ export { PageComponent } from "./src/main/ets/components/page/PageComponent" | ||
| 14 | 14 | ||
| 15 | export { BottomNavigationComponent } from "./src/main/ets/components/page/BottomNavigationComponent" | 15 | export { BottomNavigationComponent } from "./src/main/ets/components/page/BottomNavigationComponent" |
| 16 | 16 | ||
| 17 | +export { LikeComponent } from "./src/main/ets/components/view/LikeComponent" | ||
| 18 | + | ||
| 17 | export { TopNavigationComponent } from "./src/main/ets/components/page/TopNavigationComponent" | 19 | export { TopNavigationComponent } from "./src/main/ets/components/page/TopNavigationComponent" |
| 18 | 20 | ||
| 19 | export { LabelComponent } from "./src/main/ets/components/view/LabelComponent" | 21 | export { LabelComponent } from "./src/main/ets/components/view/LabelComponent" |
| @@ -77,7 +79,11 @@ export { LiveCommentComponent } from "./src/main/ets/components/comment/view/Liv | @@ -77,7 +79,11 @@ export { LiveCommentComponent } from "./src/main/ets/components/comment/view/Liv | ||
| 77 | 79 | ||
| 78 | export { WDViewDefaultType } from "./src/main/ets/components/view/EmptyComponent" | 80 | export { WDViewDefaultType } from "./src/main/ets/components/view/EmptyComponent" |
| 79 | 81 | ||
| 82 | +export { PermissionDesComponent } from "./src/main/ets/components/view/PermissionDesComponent" | ||
| 83 | + | ||
| 80 | export { AudioRowComponent } from "./src/main/ets/components/live/AudioRowComponent" | 84 | export { AudioRowComponent } from "./src/main/ets/components/live/AudioRowComponent" |
| 81 | 85 | ||
| 82 | export { WDLiveViewDefaultType } from "./src/main/ets/components/view/LiveEmptyComponent" | 86 | export { WDLiveViewDefaultType } from "./src/main/ets/components/view/LiveEmptyComponent" |
| 83 | 87 | ||
| 88 | +export { LiveFollowComponent } from "./src/main/ets/components/cardCommon/LiveFollowComponent" | ||
| 89 | + |
| @@ -20,8 +20,8 @@ import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01'; | @@ -20,8 +20,8 @@ import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01'; | ||
| 20 | import { CardParser } from './CardParser'; | 20 | import { CardParser } from './CardParser'; |
| 21 | import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent'; | 21 | import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent'; |
| 22 | import { ZhGridLayout02 } from './compview/ZhGridLayout02'; | 22 | import { ZhGridLayout02 } from './compview/ZhGridLayout02'; |
| 23 | -import { Card5Component } from './cardview/Card5Component'; | ||
| 24 | import { Card2Component } from './cardview/Card2Component'; | 23 | import { Card2Component } from './cardview/Card2Component'; |
| 24 | +import { Card5Component } from './cardview/Card5Component'; | ||
| 25 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 25 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 26 | 26 | ||
| 27 | /** | 27 | /** |
| @@ -71,7 +71,7 @@ export struct CompParser { | @@ -71,7 +71,7 @@ export struct CompParser { | ||
| 71 | ZhSingleRow06({ compDTO }) | 71 | ZhSingleRow06({ compDTO }) |
| 72 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { | 72 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { |
| 73 | //头图卡 和comStyle 2相同, | 73 | //头图卡 和comStyle 2相同, |
| 74 | - Card5Component({ contentDTO: compDTO.operDataList[0] }) | 74 | + Card5Component({ contentDTO: compDTO.operDataList[0], titleShowPolicy: compDTO.titleShowPolicy }) |
| 75 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) { | 75 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) { |
| 76 | // 大图卡 | 76 | // 大图卡 |
| 77 | Card2Component({ contentDTO: compDTO.operDataList[0] }) | 77 | Card2Component({ contentDTO: compDTO.operDataList[0] }) |
| @@ -12,7 +12,7 @@ import { | @@ -12,7 +12,7 @@ import { | ||
| 12 | } from 'wdBean'; | 12 | } from 'wdBean'; |
| 13 | import DetailViewModel from '../viewmodel/DetailViewModel'; | 13 | import DetailViewModel from '../viewmodel/DetailViewModel'; |
| 14 | import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; | 14 | import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; |
| 15 | -import router from '@ohos.router'; | 15 | +import { OperRowListView } from './view/OperRowListView'; |
| 16 | import { RecommendList } from '../components/view/RecommendList' | 16 | import { RecommendList } from '../components/view/RecommendList' |
| 17 | import { CommonConstants } from 'wdConstant'; | 17 | import { CommonConstants } from 'wdConstant'; |
| 18 | import { HttpUrlUtils } from 'wdNetwork/Index'; | 18 | import { HttpUrlUtils } from 'wdNetwork/Index'; |
| @@ -74,6 +74,45 @@ export struct ImageAndTextPageComponent { | @@ -74,6 +74,45 @@ export struct ImageAndTextPageComponent { | ||
| 74 | isPageEnd: $isPageEnd | 74 | isPageEnd: $isPageEnd |
| 75 | }) | 75 | }) |
| 76 | Column() { | 76 | Column() { |
| 77 | + // 点赞 | ||
| 78 | + if (this.contentDetailData[0]?.openLikes) { | ||
| 79 | + // 点赞 | ||
| 80 | + Row() { | ||
| 81 | + Row() { | ||
| 82 | + if (this.newsStatusOfUser?.likeStatus === '1') { | ||
| 83 | + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active'))) | ||
| 84 | + .width(24) | ||
| 85 | + .height(24) | ||
| 86 | + .margin({ right: 5 }) | ||
| 87 | + } else { | ||
| 88 | + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle'))) | ||
| 89 | + .width(24) | ||
| 90 | + .height(24) | ||
| 91 | + .margin({ right: 5 }) | ||
| 92 | + } | ||
| 93 | + Text(`${this.interactData?.likeNum || 0}`) | ||
| 94 | + .fontSize(16) | ||
| 95 | + .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999') | ||
| 96 | + .fontWeight(500) | ||
| 97 | + } | ||
| 98 | + .width(140) | ||
| 99 | + .height(36) | ||
| 100 | + .justifyContent(FlexAlign.Center) | ||
| 101 | + .alignItems(VerticalAlign.Center) | ||
| 102 | + .borderRadius(20) | ||
| 103 | + .border({ | ||
| 104 | + width: 1, | ||
| 105 | + color: '#EDEDED', | ||
| 106 | + }) | ||
| 107 | + .onClick(() => { | ||
| 108 | + this.toggleLikeStatus() | ||
| 109 | + }) | ||
| 110 | + | ||
| 111 | + }.width(CommonConstants.FULL_WIDTH).height(80) | ||
| 112 | + .justifyContent(FlexAlign.Center) | ||
| 113 | + | ||
| 114 | + Divider().strokeWidth(6).color('#f5f5f5') | ||
| 115 | + } | ||
| 77 | if (this.recommendList.length > 0) { | 116 | if (this.recommendList.length > 0) { |
| 78 | RecommendList({ recommendList: this.recommendList }) | 117 | RecommendList({ recommendList: this.recommendList }) |
| 79 | } | 118 | } |
| @@ -91,42 +130,7 @@ export struct ImageAndTextPageComponent { | @@ -91,42 +130,7 @@ export struct ImageAndTextPageComponent { | ||
| 91 | } | 130 | } |
| 92 | 131 | ||
| 93 | //底部交互区 | 132 | //底部交互区 |
| 94 | - Row() { | ||
| 95 | - Image($r('app.media.icon_arrow_left')) | ||
| 96 | - .width(24) | ||
| 97 | - .height(24) | ||
| 98 | - .onClick((event: ClickEvent) => { | ||
| 99 | - router.back() | ||
| 100 | - }) | ||
| 101 | - | ||
| 102 | - Row() { | ||
| 103 | - Image($r('app.media.icon_comment')) | ||
| 104 | - .width(24) | ||
| 105 | - .height(24) | ||
| 106 | - .margin({ right: 24 }) | ||
| 107 | - .id('comment') | ||
| 108 | - | ||
| 109 | - Image($r('app.media.icon_star')) | ||
| 110 | - .width(24) | ||
| 111 | - .height(24) | ||
| 112 | - .margin({ right: 24 }) | ||
| 113 | - | ||
| 114 | - Image($r('app.media.icon_listen')) | ||
| 115 | - .width(24) | ||
| 116 | - .height(24) | ||
| 117 | - .margin({ right: 24 }) | ||
| 118 | - | ||
| 119 | - Image($r('app.media.icon_forward')) | ||
| 120 | - .width(24) | ||
| 121 | - .height(24) | ||
| 122 | - | ||
| 123 | - } | ||
| 124 | - } | ||
| 125 | - .width(CommonConstants.FULL_WIDTH) | ||
| 126 | - .height(56) | ||
| 127 | - .padding({ left: 15, right: 15, bottom: 50, top: 20 }) | ||
| 128 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 129 | - .backgroundColor(Color.White) | 133 | + OperRowListView({ contentDetailData: this.contentDetailData[0] }) |
| 130 | } | 134 | } |
| 131 | 135 | ||
| 132 | } | 136 | } |
| @@ -6,7 +6,8 @@ import { | @@ -6,7 +6,8 @@ import { | ||
| 6 | H5ReceiveDetailBean, | 6 | H5ReceiveDetailBean, |
| 7 | ResponseBean | 7 | ResponseBean |
| 8 | } from 'wdBean'; | 8 | } from 'wdBean'; |
| 9 | -import { Logger } from 'wdKit'; | 9 | +import { Logger, SPHelper, NetworkUtil } from 'wdKit'; |
| 10 | +import { SpConstants } from 'wdConstant'; | ||
| 10 | import { WdWebLocalComponent } from 'wdWebComponent'; | 11 | import { WdWebLocalComponent } from 'wdWebComponent'; |
| 11 | import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; | 12 | import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; |
| 12 | import { BridgeWebViewControl } from 'wdJsBridge/Index'; | 13 | import { BridgeWebViewControl } from 'wdJsBridge/Index'; |
| @@ -22,7 +23,7 @@ export struct ImageAndTextWebComponent { | @@ -22,7 +23,7 @@ export struct ImageAndTextWebComponent { | ||
| 22 | private webPrepared = false; | 23 | private webPrepared = false; |
| 23 | private dataPrepared = false; | 24 | private dataPrepared = false; |
| 24 | 25 | ||
| 25 | - onDetailDataUpdated() { | 26 | + async onDetailDataUpdated() { |
| 26 | if (this.action) { | 27 | if (this.action) { |
| 27 | let contentId: string = '' | 28 | let contentId: string = '' |
| 28 | let contentType: string = '' | 29 | let contentType: string = '' |
| @@ -30,6 +31,8 @@ export struct ImageAndTextWebComponent { | @@ -30,6 +31,8 @@ export struct ImageAndTextWebComponent { | ||
| 30 | let channelId: string = '' | 31 | let channelId: string = '' |
| 31 | let compId: string = '' | 32 | let compId: string = '' |
| 32 | let sourcePage: string = '5' | 33 | let sourcePage: string = '5' |
| 34 | + let creatorId = await SPHelper.default.get(SpConstants.USER_CREATOR_ID, '') || '' | ||
| 35 | + let isLogin = await SPHelper.default.get(SpConstants.USER_STATUS, '') || '0' | ||
| 33 | if (this.action.params) { | 36 | if (this.action.params) { |
| 34 | if (this.action.params.contentID) { | 37 | if (this.action.params.contentID) { |
| 35 | contentId = this.action.params?.contentID | 38 | contentId = this.action.params?.contentID |
| @@ -56,9 +59,9 @@ export struct ImageAndTextWebComponent { | @@ -56,9 +59,9 @@ export struct ImageAndTextWebComponent { | ||
| 56 | 59 | ||
| 57 | // TODO 对接user信息、登录情况 | 60 | // TODO 对接user信息、登录情况 |
| 58 | let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { | 61 | let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { |
| 59 | - creatorId: '', | ||
| 60 | - isLogin: '0', | ||
| 61 | - networkStatus: 1, | 62 | + creatorId: creatorId, |
| 63 | + isLogin: isLogin, | ||
| 64 | + networkStatus: Number(NetworkUtil.isNetConnected()), | ||
| 62 | loadImageOnlyWifiSwitch: '2', | 65 | loadImageOnlyWifiSwitch: '2', |
| 63 | 66 | ||
| 64 | } as H5ReceiveDataExtraBean | 67 | } as H5ReceiveDataExtraBean |
sight_harmony/features/wdComponent/src/main/ets/components/cardCommon/LiveFollowComponent.ets
0 → 100644
| 1 | +/** | ||
| 2 | + * 直播详情 关注相关信息 | ||
| 3 | + */ | ||
| 4 | +import { | ||
| 5 | + ContentDetailRequest, | ||
| 6 | + postInteractAccentionOperateParams | ||
| 7 | +} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | ||
| 8 | +import { postBatchAttentionStatusParams, RmhInfoDTO } from 'wdBean/Index'; | ||
| 9 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 10 | +import { Logger, SPHelper } from 'wdKit/Index'; | ||
| 11 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 12 | +import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; | ||
| 13 | + | ||
| 14 | +const TAG = 'LiveFollowComponent' | ||
| 15 | + | ||
| 16 | +@Component | ||
| 17 | +export struct LiveFollowComponent { | ||
| 18 | + @Prop rmhInfo: RmhInfoDTO | ||
| 19 | + | ||
| 20 | + aboutToAppear(): void { | ||
| 21 | + this.getBatchAttentionStatus() | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 默认未关注 点击去关注 | ||
| 26 | + */ | ||
| 27 | + @State followStatus: String = '0'; | ||
| 28 | + | ||
| 29 | + build() { | ||
| 30 | + Stack() { | ||
| 31 | + Stack() | ||
| 32 | + .height(22) | ||
| 33 | + .width(130) | ||
| 34 | + .backgroundColor('#000000') | ||
| 35 | + .opacity(0.3) | ||
| 36 | + .borderRadius({ | ||
| 37 | + topLeft: 90, | ||
| 38 | + bottomLeft: 90 | ||
| 39 | + }) | ||
| 40 | + Row() { | ||
| 41 | + Image(this.rmhInfo.rmhHeadUrl) | ||
| 42 | + .width(24) | ||
| 43 | + .height(24) | ||
| 44 | + .borderRadius(90) | ||
| 45 | + Text(this.rmhInfo.rmhName) | ||
| 46 | + .fontColor(Color.White) | ||
| 47 | + .maxLines(1) | ||
| 48 | + .fontWeight(500) | ||
| 49 | + .fontSize('12fp') | ||
| 50 | + .layoutWeight(1) | ||
| 51 | + .margin({ | ||
| 52 | + left: 4, | ||
| 53 | + right: 6 | ||
| 54 | + }) | ||
| 55 | + Blank() | ||
| 56 | + Text(this.followStatus === '0' ? '关注' : '已关注') | ||
| 57 | + .fontColor(Color.White) | ||
| 58 | + .fontWeight(500) | ||
| 59 | + .fontSize('10fp') | ||
| 60 | + .padding({ | ||
| 61 | + left: 8, | ||
| 62 | + right: 8, | ||
| 63 | + top: 3, | ||
| 64 | + bottom: 3 | ||
| 65 | + }) | ||
| 66 | + .borderRadius(2) | ||
| 67 | + .margin({ right: 2 }) | ||
| 68 | + .backgroundColor(this.followStatus === '0' ? $r('app.color.color_ED2800') : $r('app.color.color_CCCCCC')) | ||
| 69 | + .onClick(() => { | ||
| 70 | + this.handleAccention() | ||
| 71 | + }) | ||
| 72 | + } | ||
| 73 | + .height(22) | ||
| 74 | + .width(130) | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 查询当前登录用户是否关注作品号主 | ||
| 80 | + * */ | ||
| 81 | + private async getBatchAttentionStatus() { | ||
| 82 | + try { | ||
| 83 | + const params: postBatchAttentionStatusParams = { | ||
| 84 | + creatorIds: [{ creatorId: this.rmhInfo?.rmhId ?? '' }] | ||
| 85 | + } | ||
| 86 | + let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params) | ||
| 87 | + this.followStatus = data[0]?.status; | ||
| 88 | + Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`) | ||
| 89 | + } catch (exception) { | ||
| 90 | + | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * 关注号主 | ||
| 96 | + */ | ||
| 97 | + async handleAccention() { | ||
| 98 | + // 未登录,跳转登录 | ||
| 99 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 100 | + if (!user_id) { | ||
| 101 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 102 | + return | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + const params2: postInteractAccentionOperateParams = { | ||
| 106 | + attentionUserType: this.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号) | ||
| 107 | + attentionUserId: this.rmhInfo?.userId || '', // 被关注用户号主id | ||
| 108 | + attentionCreatorId: this.rmhInfo?.rmhId || '', // 被关注用户号主id | ||
| 109 | + status: this.followStatus == '0' ? 1 : 0, | ||
| 110 | + } | ||
| 111 | + ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { | ||
| 112 | + console.log('关注号主==', JSON.stringify(res.data)) | ||
| 113 | + if (this.followStatus == '1') { | ||
| 114 | + this.followStatus = '0' | ||
| 115 | + } else { | ||
| 116 | + this.followStatus = '1' | ||
| 117 | + } | ||
| 118 | + }) | ||
| 119 | + } | ||
| 120 | +} |
| @@ -20,6 +20,7 @@ export struct Card5Component { | @@ -20,6 +20,7 @@ export struct Card5Component { | ||
| 20 | // newsTitle: '今天是周日,天气阴天,明天是周一。', | 20 | // newsTitle: '今天是周日,天气阴天,明天是周一。', |
| 21 | // objectType: '6' | 21 | // objectType: '6' |
| 22 | } as ContentDTO; | 22 | } as ContentDTO; |
| 23 | + @State titleShowPolicy: number | string = 1 | ||
| 23 | 24 | ||
| 24 | build() { | 25 | build() { |
| 25 | Stack() { | 26 | Stack() { |
| @@ -27,7 +28,7 @@ export struct Card5Component { | @@ -27,7 +28,7 @@ export struct Card5Component { | ||
| 27 | .width(CommonConstants.FULL_WIDTH) | 28 | .width(CommonConstants.FULL_WIDTH) |
| 28 | .autoResize(true) | 29 | .autoResize(true) |
| 29 | .borderRadius($r('app.float.image_border_radius')) | 30 | .borderRadius($r('app.float.image_border_radius')) |
| 30 | - if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { | 31 | + if (this.titleShowPolicy === 1 && this.contentDTO.newsTitle) { |
| 31 | Row() | 32 | Row() |
| 32 | .width(CommonConstants.FULL_WIDTH) | 33 | .width(CommonConstants.FULL_WIDTH) |
| 33 | .height(59) | 34 | .height(59) |
| @@ -87,6 +87,10 @@ export class commentItemModel { | @@ -87,6 +87,10 @@ export class commentItemModel { | ||
| 87 | maxLine: number = 3 | 87 | maxLine: number = 3 |
| 88 | /*是否有展示更多*/ | 88 | /*是否有展示更多*/ |
| 89 | hasMore: boolean = false | 89 | hasMore: boolean = false |
| 90 | + /*展开子评论的状态下是否有展开更多*/ | ||
| 91 | + childsHasMore: boolean = false | ||
| 92 | + /*子评论pageNum*/ | ||
| 93 | + pageNum:number = 1 | ||
| 90 | /*当有展示更多的时候,当前的状态是展开还是收起*/ | 94 | /*当有展示更多的时候,当前的状态是展开还是收起*/ |
| 91 | expanded: boolean = false | 95 | expanded: boolean = false |
| 92 | /*是否正在加载子评论*/ | 96 | /*是否正在加载子评论*/ |
| 1 | @Observed | 1 | @Observed |
| 2 | export class publishCommentModel { | 2 | export class publishCommentModel { |
| 3 | - /*被评论的内容id*/ | 3 | + |
| 4 | + //页面必传 | ||
| 5 | + /*被评论的内容id 页面必传*/ | ||
| 4 | targetId: string = "" | 6 | targetId: string = "" |
| 5 | - /*被评论的内容关系id*/ | 7 | + /*被评论的内容关系id 页面必传*/ |
| 6 | targetRelId: string = "" | 8 | targetRelId: string = "" |
| 7 | - /*1.文字 2.文字+表情 3.定制表情(客户端写死) 4.图片*/ | ||
| 8 | - commentType: string = '1' | ||
| 9 | - /*根评论id,如果是一级评论,传-1;否则,传当前评论所属的根评论id*/ | ||
| 10 | - rootCommentId: string = "-1" | ||
| 11 | - /*【迭代二新增】内容的标题,取bff内容详情接口中newsTitle字段*/ | 9 | + /*【迭代二新增】内容的标题,取bff内容详情接口中newsTitle字段 页面必传*/ |
| 12 | targetTitle: string = "" | 10 | targetTitle: string = "" |
| 13 | - /*被评论的内容关系类型,1.频道关系;2.专题关系;【人民号内容为空】默认0*/ | 11 | + /*被评论的内容关系类型,1.频道关系;2.专题关系;【人民号内容为空】默认0 页面必传*/ |
| 14 | targetRelType: string = '' | 12 | targetRelType: string = '' |
| 15 | - /*【迭代二新增】关联的频道id/专题id;*/ | 13 | + /*【迭代二新增】关联的频道id/专题id; 页面必传*/ |
| 16 | targetRelObjectId: string = "" | 14 | targetRelObjectId: string = "" |
| 15 | + /*【迭代二新增】是否是重点稿件 1是 0否 页面必传*/ | ||
| 16 | + keyArticle: string = '' | ||
| 17 | + /*内容类别, 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14:动态(13和14为中文版新增) 页面必传*/ | ||
| 18 | + targetType: string = '' | ||
| 19 | + /*评论总数*/ | ||
| 20 | + totalCommentNumer: string = '' | ||
| 21 | + | ||
| 22 | + //评论传参 | ||
| 17 | /*评论图片url,多个逗号隔开*/ | 23 | /*评论图片url,多个逗号隔开*/ |
| 18 | commentPics: string = "" | 24 | commentPics: string = "" |
| 19 | /*评论内容*/ | 25 | /*评论内容*/ |
| 20 | commentContent: string = "" | 26 | commentContent: string = "" |
| 21 | - /*【迭代二新增】是否是重点稿件 1是 0否*/ | ||
| 22 | - keyArticle: string = '' | ||
| 23 | - /*内容类别, 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14:动态(13和14为中文版新增)*/ | ||
| 24 | - targetType: string = '' | 27 | + /*1.文字 2.文字+表情 3.定制表情(客户端写死) 4.图片*/ |
| 28 | + commentType: string = '1' | ||
| 29 | + /*根评论id,如果是一级评论,传-1;否则,传当前评论所属的根评论id*/ | ||
| 30 | + rootCommentId: string = "-1" | ||
| 25 | /*父评论id,如果是其它评论的回复,该字段必填*/ | 31 | /*父评论id,如果是其它评论的回复,该字段必填*/ |
| 26 | parentId: string = "-1" | 32 | parentId: string = "-1" |
| 27 | 33 | ||
| 28 | 34 | ||
| 35 | + //可选 | ||
| 29 | placeHolderText: string = "优质评论会获得最佳评论人的称号" | 36 | placeHolderText: string = "优质评论会获得最佳评论人的称号" |
| 30 | 37 | ||
| 31 | } | 38 | } |
| @@ -12,45 +12,23 @@ import { ifaa } from '@kit.OnlineAuthenticationKit'; | @@ -12,45 +12,23 @@ import { ifaa } from '@kit.OnlineAuthenticationKit'; | ||
| 12 | 12 | ||
| 13 | const TAG = 'CommentComponent'; | 13 | const TAG = 'CommentComponent'; |
| 14 | 14 | ||
| 15 | +const testString = '因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸' | ||
| 15 | 16 | ||
| 16 | // @Entry | 17 | // @Entry |
| 17 | @Preview | 18 | @Preview |
| 18 | @Component | 19 | @Component |
| 19 | export struct CommentComponent { | 20 | export struct CommentComponent { |
| 20 | - @State contentId: string = '30004266013' | ||
| 21 | - /*内容类别, 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14:动态(13和14为中文版新增)*/ | ||
| 22 | - @State contentType: string = '8' | ||
| 23 | - /*内容的标题,取bff内容详情接口中newsTitle字段*/ | ||
| 24 | - @State targetTitle: string = '北约同意向乌克兰提供防空系统在内的更多军事支持' | ||
| 25 | - /*被评论的内容关系id*/ | ||
| 26 | - @State targetRelId: string = "500002849023" | ||
| 27 | - /*关联的频道id/专题id*/ | ||
| 28 | - @State targetRelObjectId: string = "2002" | ||
| 29 | - /*是否是重点稿件 1是 0否*/ | ||
| 30 | - @State keyArticle: string = "0" | ||
| 31 | - /*被评论的内容关系类型,1.频道关系;2.专题关系;【人民号内容为空】默认0*/ | ||
| 32 | - @State targetRelType: string = "1" | 21 | + |
| 33 | // @State private browSingModel: commentListModel = new commentListModel() | 22 | // @State private browSingModel: commentListModel = new commentListModel() |
| 23 | + /*必传*/ | ||
| 24 | + @ObjectLink publishCommentModel: publishCommentModel | ||
| 25 | + | ||
| 34 | isloading: boolean = false | 26 | isloading: boolean = false |
| 27 | + | ||
| 35 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); | 28 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); |
| 36 | - @State publishCommentModel: publishCommentModel = new publishCommentModel() | ||
| 37 | - @State dialogController: CustomDialogController | null = new CustomDialogController({ | ||
| 38 | 29 | ||
| 39 | - builder: CommentCustomDialog({ | ||
| 40 | - confirm: (value: Record<string, string>) => { | ||
| 41 | - this.publishComment(value) | ||
| 42 | - }, | ||
| 43 | - commentText: this.publishCommentModel.commentContent, | ||
| 44 | - placeHolderText: this.publishCommentModel.placeHolderText, | ||
| 45 | - }), | ||
| 46 | - autoCancel: true, | ||
| 47 | - alignment: DialogAlignment.Bottom, | ||
| 48 | - customStyle: true, | ||
| 49 | - offset: { | ||
| 50 | - dx: 0, | ||
| 51 | - dy: -20 | ||
| 52 | - }, | ||
| 53 | - }) | 30 | + @State dialogController: CustomDialogController | null = null; |
| 31 | + | ||
| 54 | 32 | ||
| 55 | // 在自定义组件即将析构销毁时将dialogControlle置空 | 33 | // 在自定义组件即将析构销毁时将dialogControlle置空 |
| 56 | aboutToDisappear() { | 34 | aboutToDisappear() { |
| @@ -58,13 +36,22 @@ export struct CommentComponent { | @@ -58,13 +36,22 @@ export struct CommentComponent { | ||
| 58 | } | 36 | } |
| 59 | 37 | ||
| 60 | aboutToAppear() { | 38 | aboutToAppear() { |
| 61 | - this.publishCommentModel.targetTitle = this.targetTitle | ||
| 62 | - this.publishCommentModel.targetId = this.contentId | ||
| 63 | - this.publishCommentModel.targetType = this.contentType | ||
| 64 | - this.publishCommentModel.targetRelId = this.targetRelId | ||
| 65 | - this.publishCommentModel.targetRelType = this.targetRelType | ||
| 66 | - this.publishCommentModel.targetRelObjectId = this.targetRelObjectId | ||
| 67 | - this.publishCommentModel.keyArticle = this.keyArticle | 39 | + |
| 40 | + this.dialogController = new CustomDialogController({ | ||
| 41 | + builder: CommentCustomDialog({ | ||
| 42 | + confirm: (value: Record<string, string>) => { | ||
| 43 | + | ||
| 44 | + }, | ||
| 45 | + publishCommentModel:this.publishCommentModel | ||
| 46 | + }), | ||
| 47 | + autoCancel: true, | ||
| 48 | + alignment: DialogAlignment.Bottom, | ||
| 49 | + customStyle: true, | ||
| 50 | + offset: { | ||
| 51 | + dx: 0, | ||
| 52 | + dy: -20 | ||
| 53 | + }, | ||
| 54 | + }) | ||
| 68 | 55 | ||
| 69 | this.getData(); | 56 | this.getData(); |
| 70 | 57 | ||
| @@ -105,7 +92,7 @@ export struct CommentComponent { | @@ -105,7 +92,7 @@ export struct CommentComponent { | ||
| 105 | /*查看更多和收起*/ | 92 | /*查看更多和收起*/ |
| 106 | @Builder | 93 | @Builder |
| 107 | GroupFooterView(item: commentItemModel, index: number) { | 94 | GroupFooterView(item: commentItemModel, index: number) { |
| 108 | - footerExpandedView({ item: item, contentId: this.contentId, contentType: this.contentType }) | 95 | + footerExpandedView({ item: item, contentId: this.publishCommentModel.targetId, contentType: this.publishCommentModel.targetType }) |
| 109 | } | 96 | } |
| 110 | 97 | ||
| 111 | build() { | 98 | build() { |
| @@ -152,13 +139,13 @@ export struct CommentComponent { | @@ -152,13 +139,13 @@ export struct CommentComponent { | ||
| 152 | 139 | ||
| 153 | //获取数据 | 140 | //获取数据 |
| 154 | async getData() { | 141 | async getData() { |
| 155 | - commentViewModel.fetchContentCommentList('1', this.contentId, this.contentType).then(commentListModel => { | 142 | + commentViewModel.fetchContentCommentList('1', this.publishCommentModel.targetId, this.publishCommentModel.targetType).then(commentListModel => { |
| 156 | if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { | 143 | if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { |
| 157 | commentListModel.list.forEach(element => { | 144 | commentListModel.list.forEach(element => { |
| 158 | element.hasMore = Number.parseInt(element.childCommentNum) ? true : false | 145 | element.hasMore = Number.parseInt(element.childCommentNum) ? true : false |
| 159 | let newModel = commentViewModel.deepCopyCommentItemModel(element) | 146 | let newModel = commentViewModel.deepCopyCommentItemModel(element) |
| 160 | - newModel.targetId = this.contentId | ||
| 161 | - newModel.targetType = this.contentType | 147 | + // newModel.targetId = this.publishCommentModel.targetId |
| 148 | + // newModel.targetType = this.publishCommentModel.targetType | ||
| 162 | this.allDatas.push(newModel) | 149 | this.allDatas.push(newModel) |
| 163 | }); | 150 | }); |
| 164 | 151 | ||
| @@ -167,20 +154,6 @@ export struct CommentComponent { | @@ -167,20 +154,6 @@ export struct CommentComponent { | ||
| 167 | }) | 154 | }) |
| 168 | 155 | ||
| 169 | } | 156 | } |
| 170 | - | ||
| 171 | - /*回复评论*/ | ||
| 172 | - publishComment(value: Record<string, string>) { | ||
| 173 | - | ||
| 174 | - this.publishCommentModel.commentContent = value['commentContent'] | ||
| 175 | - this.publishCommentModel.commentType = value['commentType'] | ||
| 176 | - | ||
| 177 | - commentViewModel.publishComment(this.publishCommentModel).then(() => { | ||
| 178 | - this.publishCommentModel.commentContent = '' | ||
| 179 | - }).catch(() => { | ||
| 180 | - | ||
| 181 | - }) | ||
| 182 | - | ||
| 183 | - } | ||
| 184 | } | 157 | } |
| 185 | 158 | ||
| 186 | 159 | ||
| @@ -230,7 +203,7 @@ struct ChildCommentItem { | @@ -230,7 +203,7 @@ struct ChildCommentItem { | ||
| 230 | .fontSize(14) | 203 | .fontSize(14) |
| 231 | .fontColor($r('app.color.color_222222')) | 204 | .fontColor($r('app.color.color_222222')) |
| 232 | .fontWeight(FontWeight.Medium) | 205 | .fontWeight(FontWeight.Medium) |
| 233 | - .margin({ left: 0 , right:0}) | 206 | + .margin({ left: 0, right: 0 }) |
| 234 | 207 | ||
| 235 | 208 | ||
| 236 | /// 暂时不显示 “我” 的标签了 | 209 | /// 暂时不显示 “我” 的标签了 |
| @@ -257,10 +230,12 @@ struct ChildCommentItem { | @@ -257,10 +230,12 @@ struct ChildCommentItem { | ||
| 257 | .margin({ left: 5 }); | 230 | .margin({ left: 5 }); |
| 258 | } | 231 | } |
| 259 | }.margin({ left: 0, right: 16 }) | 232 | }.margin({ left: 0, right: 16 }) |
| 233 | + | ||
| 260 | // .backgroundColor(Color.Red) | 234 | // .backgroundColor(Color.Red) |
| 261 | 235 | ||
| 262 | CommentText({ | 236 | CommentText({ |
| 263 | longMessage: this.item.commentContent, | 237 | longMessage: this.item.commentContent, |
| 238 | + // longMessage:testString, | ||
| 264 | maxline: 3, | 239 | maxline: 3, |
| 265 | fontSize: 14, | 240 | fontSize: 14, |
| 266 | fontWeight: FontWeight.Regular, | 241 | fontWeight: FontWeight.Regular, |
| @@ -297,12 +272,27 @@ struct footerExpandedView { | @@ -297,12 +272,27 @@ struct footerExpandedView { | ||
| 297 | build() { | 272 | build() { |
| 298 | Row() { | 273 | Row() { |
| 299 | if (this.item.expanded) { | 274 | if (this.item.expanded) { |
| 275 | + if (this.item.childsHasMore) { | ||
| 276 | + Row() { | ||
| 277 | + Text().backgroundColor($r('app.color.color_EDEDED')).width(24).height(1) | ||
| 278 | + Text('查看更多回复').fontColor($r('app.color.color_222222')).fontSize(14).margin({ left: 6 }) | ||
| 279 | + Image($r('app.media.comment_unfold')).width(12).height(12) | ||
| 280 | + }.margin({ left: 53 }) | ||
| 281 | + .onClick(() => { | ||
| 282 | + if (this.item.isLoading) { | ||
| 283 | + return | ||
| 284 | + } | ||
| 285 | + this.item.isLoading = true | ||
| 286 | + fetchChildContentCommentList(this.contentId, this.contentType, this.item) | ||
| 287 | + }) | ||
| 288 | + } | ||
| 300 | Row() { | 289 | Row() { |
| 301 | Text('收起').fontColor($r('app.color.color_222222')).fontSize(14) | 290 | Text('收起').fontColor($r('app.color.color_222222')).fontSize(14) |
| 302 | Image($r('app.media.comment_pickUp')).width(12).height(12) | 291 | Image($r('app.media.comment_pickUp')).width(12).height(12) |
| 303 | - }.margin({ left: 213 }) | 292 | + }.margin({ left: this.item.childsHasMore ? 32 : 213 }) |
| 304 | .onClick(() => { | 293 | .onClick(() => { |
| 305 | - this.item.expanded = !this.item.expanded | 294 | + this.item.pageNum = 1 |
| 295 | + this.item.expanded = false | ||
| 306 | this.item.childComments = [] | 296 | this.item.childComments = [] |
| 307 | this.item.childCommentsLazyDataSource.clear() | 297 | this.item.childCommentsLazyDataSource.clear() |
| 308 | }) | 298 | }) |
| @@ -317,28 +307,35 @@ struct footerExpandedView { | @@ -317,28 +307,35 @@ struct footerExpandedView { | ||
| 317 | return | 307 | return |
| 318 | } | 308 | } |
| 319 | this.item.isLoading = true | 309 | this.item.isLoading = true |
| 320 | - //load child | ||
| 321 | - commentViewModel.fetchChildContentCommentList('1', this.contentId, this.contentType, this.item.id) | ||
| 322 | - .then((commentListModel) => { | ||
| 323 | - this.item.isLoading = false | ||
| 324 | - this.item.expanded = !this.item.expanded | ||
| 325 | - commentListModel.list.forEach(element => { | ||
| 326 | - this.item.childComments.push(element) | ||
| 327 | - let newModel = commentViewModel.deepCopyCommentItemModel(element) | ||
| 328 | - newModel.targetId = this.contentId | ||
| 329 | - newModel.targetType = this.contentType | ||
| 330 | - | ||
| 331 | - this.item.childCommentsLazyDataSource.push(newModel) | ||
| 332 | - }) | ||
| 333 | - }).catch(() => { | ||
| 334 | - this.item.isLoading = false | ||
| 335 | - }) | 310 | + fetchChildContentCommentList(this.contentId, this.contentType, this.item) |
| 336 | }) | 311 | }) |
| 337 | } | 312 | } |
| 338 | }.height(30) | 313 | }.height(30) |
| 339 | } | 314 | } |
| 340 | } | 315 | } |
| 341 | 316 | ||
| 317 | +function fetchChildContentCommentList(contentId: string, contentType: string, item: commentItemModel) { | ||
| 318 | + | ||
| 319 | + commentViewModel.fetchChildContentCommentList(item.pageNum + '', contentId, contentType, item.id) | ||
| 320 | + .then((commentListModel) => { | ||
| 321 | + item.pageNum = item.pageNum + 1 | ||
| 322 | + item.childsHasMore = commentListModel.hasNext > 0 ? true : false | ||
| 323 | + item.isLoading = false | ||
| 324 | + item.expanded = true | ||
| 325 | + commentListModel.list.forEach(element => { | ||
| 326 | + item.childComments.push(element) | ||
| 327 | + let newModel = commentViewModel.deepCopyCommentItemModel(element) | ||
| 328 | + newModel.targetId = contentId | ||
| 329 | + newModel.targetType = contentType | ||
| 330 | + | ||
| 331 | + item.childCommentsLazyDataSource.push(newModel) | ||
| 332 | + }) | ||
| 333 | + }).catch(() => { | ||
| 334 | + item.isLoading = false | ||
| 335 | + }) | ||
| 336 | +} | ||
| 337 | + | ||
| 338 | + | ||
| 342 | @Component | 339 | @Component |
| 343 | struct commentHeaderView { | 340 | struct commentHeaderView { |
| 344 | @Link publishCommentModel: publishCommentModel | 341 | @Link publishCommentModel: publishCommentModel |
| @@ -411,7 +408,14 @@ struct commentHeaderView { | @@ -411,7 +408,14 @@ struct commentHeaderView { | ||
| 411 | marginWidth: (59 + 16) | 408 | marginWidth: (59 + 16) |
| 412 | }) | 409 | }) |
| 413 | .margin({ left: 59, right: 16, top: -5 }) | 410 | .margin({ left: 59, right: 16, top: -5 }) |
| 414 | - | 411 | + .onClick(() => { |
| 412 | + this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 413 | + this.publishCommentModel.parentId = this.item.id | ||
| 414 | + this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':' | ||
| 415 | + if (this.dialogController != null) { | ||
| 416 | + this.dialogController.open() | ||
| 417 | + } | ||
| 418 | + }) | ||
| 415 | 419 | ||
| 416 | commentFooterView({ | 420 | commentFooterView({ |
| 417 | item: this.item, | 421 | item: this.item, |
| @@ -456,7 +460,12 @@ struct commentFooterView { | @@ -456,7 +460,12 @@ struct commentFooterView { | ||
| 456 | .fontColor($r('app.color.color_222222')) | 460 | .fontColor($r('app.color.color_222222')) |
| 457 | .fontSize(12) | 461 | .fontSize(12) |
| 458 | .onClick(() => { | 462 | .onClick(() => { |
| 459 | - //TODO: 回复 | 463 | + this.publishCommentModel.rootCommentId = this.item.rootCommentId |
| 464 | + this.publishCommentModel.parentId = this.item.id | ||
| 465 | + this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':' | ||
| 466 | + if (this.dialogController != null) { | ||
| 467 | + this.dialogController.open() | ||
| 468 | + } | ||
| 460 | }) | 469 | }) |
| 461 | } | 470 | } |
| 462 | 471 |
| @@ -5,27 +5,51 @@ import commentViewModel from '../viewmodel/CommentViewModel' | @@ -5,27 +5,51 @@ import commentViewModel from '../viewmodel/CommentViewModel' | ||
| 5 | @Preview | 5 | @Preview |
| 6 | @CustomDialog | 6 | @CustomDialog |
| 7 | export struct CommentCustomDialog { | 7 | export struct CommentCustomDialog { |
| 8 | - commentText: string = '' | ||
| 9 | - placeHolderText: string = '优质评论会获得最佳评论人的称号' | 8 | + |
| 9 | + @ObjectLink publishCommentModel: publishCommentModel | ||
| 10 | controller?: CustomDialogController | 10 | controller?: CustomDialogController |
| 11 | confirm: (value: Record<string, string>) => void = () => { | 11 | confirm: (value: Record<string, string>) => void = () => { |
| 12 | } | 12 | } |
| 13 | @State private emojiSwitch: boolean = false | 13 | @State private emojiSwitch: boolean = false |
| 14 | textInputController: TextAreaController = new TextAreaController() | 14 | textInputController: TextAreaController = new TextAreaController() |
| 15 | 15 | ||
| 16 | + aboutToAppear(): void { | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + publishCommentRequest() { | ||
| 22 | + let bean: Record<string, string> = {}; | ||
| 23 | + // this.publishCommentModel.commentContent = this.commentText | ||
| 24 | + //TODO 判断类型 | ||
| 25 | + this.publishCommentModel.commentType = '1' | ||
| 26 | + commentViewModel.publishComment(this.publishCommentModel).then(() => { | ||
| 27 | + this.publishCommentModel.commentContent = '' | ||
| 28 | + // this.commentText = '' | ||
| 29 | + if (this.controller != null) { | ||
| 30 | + this.controller.close() | ||
| 31 | + } | ||
| 32 | + this.confirm(bean) | ||
| 33 | + }).catch(() => { | ||
| 34 | + if (this.controller != null) { | ||
| 35 | + this.controller.close() | ||
| 36 | + } | ||
| 37 | + }) | ||
| 38 | + } | ||
| 39 | + | ||
| 16 | build() { | 40 | build() { |
| 17 | Column() { | 41 | Column() { |
| 18 | Row() { | 42 | Row() { |
| 19 | TextArea({ | 43 | TextArea({ |
| 20 | - placeholder: this.placeHolderText, | 44 | + placeholder: this.publishCommentModel.placeHolderText, |
| 21 | controller: this.textInputController, | 45 | controller: this.textInputController, |
| 22 | - text: this.commentText | 46 | + text: this.publishCommentModel.commentContent |
| 23 | }) | 47 | }) |
| 24 | .height('100%') | 48 | .height('100%') |
| 25 | .width('100%') | 49 | .width('100%') |
| 26 | .backgroundColor($r('app.color.color_transparent')) | 50 | .backgroundColor($r('app.color.color_transparent')) |
| 27 | .onChange(value => { | 51 | .onChange(value => { |
| 28 | - this.commentText = value; | 52 | + this.publishCommentModel.commentContent = value; |
| 29 | }) | 53 | }) |
| 30 | } | 54 | } |
| 31 | .backgroundColor('#F9F9F9') | 55 | .backgroundColor('#F9F9F9') |
| @@ -68,18 +92,11 @@ export struct CommentCustomDialog { | @@ -68,18 +92,11 @@ export struct CommentCustomDialog { | ||
| 68 | .textAlign(TextAlign.Center) | 92 | .textAlign(TextAlign.Center) |
| 69 | .borderRadius(4) | 93 | .borderRadius(4) |
| 70 | .onClick(() => { | 94 | .onClick(() => { |
| 71 | - if (this.commentText.length > 0) { | 95 | + if (this.publishCommentModel.commentContent.length > 0) { |
| 72 | //请求评论接口 | 96 | //请求评论接口 |
| 73 | //commentType | 97 | //commentType |
| 74 | //commentContent | 98 | //commentContent |
| 75 | - let bean: Record<string, string> = {}; | ||
| 76 | - bean['commentContent'] = this.commentText | ||
| 77 | - //TODO 判断类型 | ||
| 78 | - bean['commentType'] = '1' | ||
| 79 | - this.confirm(bean) | ||
| 80 | - if (this.controller != null) { | ||
| 81 | - this.controller.close() | ||
| 82 | - } | 99 | + this.publishCommentRequest() |
| 83 | } | 100 | } |
| 84 | }) | 101 | }) |
| 85 | } | 102 | } |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
| @@ -8,6 +8,10 @@ import { MyCommentDataSource } from '../model/MyCommentDataSource' | @@ -8,6 +8,10 @@ import { MyCommentDataSource } from '../model/MyCommentDataSource' | ||
| 8 | import { HttpUtils } from 'wdNetwork/src/main/ets/utils/HttpUtils' | 8 | import { HttpUtils } from 'wdNetwork/src/main/ets/utils/HttpUtils' |
| 9 | import { HttpUrlUtils } from 'wdNetwork/Index' | 9 | import { HttpUrlUtils } from 'wdNetwork/Index' |
| 10 | import PageModel from '../../../viewmodel/PageModel' | 10 | import PageModel from '../../../viewmodel/PageModel' |
| 11 | +import { ErrorComponent } from '../../view/ErrorComponent' | ||
| 12 | +import { EmptyComponent , WDViewDefaultType} from '../../view/EmptyComponent' | ||
| 13 | +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh' | ||
| 14 | +import NoMoreLayout from '../../page/NoMoreLayout' | ||
| 11 | 15 | ||
| 12 | const TAG = 'QualityCommentsComponent'; | 16 | const TAG = 'QualityCommentsComponent'; |
| 13 | 17 | ||
| @@ -16,8 +20,13 @@ const TAG = 'QualityCommentsComponent'; | @@ -16,8 +20,13 @@ const TAG = 'QualityCommentsComponent'; | ||
| 16 | @Component | 20 | @Component |
| 17 | export struct QualityCommentsComponent { | 21 | export struct QualityCommentsComponent { |
| 18 | 22 | ||
| 19 | - @State private browSingModel: PageModel = new PageModel() | ||
| 20 | - isloading : boolean = false | 23 | + //刷新 |
| 24 | + @State viewType:number = ViewType.LOADING; | ||
| 25 | + @State hasMore: boolean = true; | ||
| 26 | + @State currentPage: number = 1; | ||
| 27 | + private scroller: Scroller = new Scroller(); | ||
| 28 | + | ||
| 29 | + | ||
| 21 | 30 | ||
| 22 | @State tileOpacity: number = 0; | 31 | @State tileOpacity: number = 0; |
| 23 | firstPositionY: number = 0; | 32 | firstPositionY: number = 0; |
| @@ -25,7 +34,7 @@ export struct QualityCommentsComponent { | @@ -25,7 +34,7 @@ export struct QualityCommentsComponent { | ||
| 25 | topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; | 34 | topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; |
| 26 | lastWindowColor: string = '#ffffff' | 35 | lastWindowColor: string = '#ffffff' |
| 27 | currentWindowColor: string = '#FF4202' | 36 | currentWindowColor: string = '#FF4202' |
| 28 | - @State allDatas: MyCommentDataSource = new MyCommentDataSource(); | 37 | + @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); |
| 29 | 38 | ||
| 30 | aboutToDisappear(): void { | 39 | aboutToDisappear(): void { |
| 31 | 40 | ||
| @@ -40,14 +49,31 @@ export struct QualityCommentsComponent { | @@ -40,14 +49,31 @@ export struct QualityCommentsComponent { | ||
| 40 | aboutToAppear(): void { | 49 | aboutToAppear(): void { |
| 41 | 50 | ||
| 42 | this.fullScreen(); | 51 | this.fullScreen(); |
| 52 | + this.getData(); | ||
| 53 | + | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + getData(resolve?: (value: string | PromiseLike<string>) => void){ | ||
| 57 | + commentViewModel.fetchQualityCommentList(this.currentPage + '').then((commentListModel) => { | ||
| 58 | + if(resolve) resolve('刷新成功') | ||
| 43 | 59 | ||
| 44 | - commentViewModel.fetchQualityCommentList('1').then((commentListModel) => { | ||
| 45 | if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { | 60 | if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { |
| 61 | + if (this.currentPage === 1) { | ||
| 62 | + this.allDatas.clear() | ||
| 63 | + } | ||
| 46 | commentListModel.list.forEach(element => { | 64 | commentListModel.list.forEach(element => { |
| 47 | - this.allDatas.pushData(commentViewModel.deepCopyCommentItemModel(element)) | 65 | + this.allDatas.push(commentViewModel.deepCopyCommentItemModel(element)) |
| 48 | }); | 66 | }); |
| 49 | - } else { | ||
| 50 | 67 | ||
| 68 | + if (commentListModel.hasNext === 0) { | ||
| 69 | + this.hasMore = false; | ||
| 70 | + } else { | ||
| 71 | + this.hasMore = true; | ||
| 72 | + } | ||
| 73 | + } else { | ||
| 74 | + if (this.currentPage === 1) { | ||
| 75 | + this.viewType = ViewType.EMPTY; | ||
| 76 | + } | ||
| 51 | } | 77 | } |
| 52 | }) | 78 | }) |
| 53 | } | 79 | } |
| @@ -151,36 +177,46 @@ export struct QualityCommentsComponent { | @@ -151,36 +177,46 @@ export struct QualityCommentsComponent { | ||
| 151 | 177 | ||
| 152 | build() { | 178 | build() { |
| 153 | Column() { | 179 | Column() { |
| 180 | + | ||
| 181 | + | ||
| 154 | Stack({ alignContent: Alignment.Top }) { | 182 | Stack({ alignContent: Alignment.Top }) { |
| 155 | 183 | ||
| 156 | Scroll() { | 184 | Scroll() { |
| 157 | Column() { | 185 | Column() { |
| 158 | Stack() { | 186 | Stack() { |
| 159 | this.titleHeader() | 187 | this.titleHeader() |
| 188 | + this.listLayout() | ||
| 189 | + | ||
| 190 | + // if(this.viewType == ViewType.ERROR){ | ||
| 191 | + // ErrorComponent() | ||
| 192 | + // }else if(this.viewType == ViewType.EMPTY){ | ||
| 193 | + // EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoComment}) | ||
| 194 | + // }else { | ||
| 195 | + // CustomPullToRefresh({ | ||
| 196 | + // alldata:[], | ||
| 197 | + // scroller:this.scroller, | ||
| 198 | + // customList:()=>{ | ||
| 199 | + // // this.listLayout() | ||
| 200 | + // this.testLayout() | ||
| 201 | + // }, | ||
| 202 | + // onRefresh:(resolve)=>{ | ||
| 203 | + // this.currentPage = 1 | ||
| 204 | + // this.getData(resolve) | ||
| 205 | + // }, | ||
| 206 | + // onLoadMore:(resolve)=> { | ||
| 207 | + // if (this.hasMore === false) { | ||
| 208 | + // if(resolve) resolve('') | ||
| 209 | + // return | ||
| 210 | + // } | ||
| 211 | + // this.currentPage++ | ||
| 212 | + // this.getData(resolve) | ||
| 213 | + // } | ||
| 214 | + // }) | ||
| 215 | + // } | ||
| 160 | 216 | ||
| 161 | - List({ space: 12 }) { | ||
| 162 | - // ListItemGroup({ header: this.titleHeader() }) | ||
| 163 | - LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { | ||
| 164 | - ListItem() { | ||
| 165 | - QualityCommentItem({ item: item, index: index }).margin({ left: 12, right: 12 }) | ||
| 166 | - } | ||
| 167 | - }) | ||
| 168 | - ListItem() { | ||
| 169 | 217 | ||
| 170 | - }.height(this.bottomSafeHeight) | ||
| 171 | - } | ||
| 172 | - .margin({ top: 196 }) | ||
| 173 | - .height("100%") | ||
| 174 | - .width("100%") | ||
| 175 | - .edgeEffect(EdgeEffect.Spring) | ||
| 176 | - .nestedScroll({ | ||
| 177 | - scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 178 | - scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 179 | - }) | ||
| 180 | 218 | ||
| 181 | - // .margin({ bottom: this.bottomSafeHeight }) | ||
| 182 | 219 | ||
| 183 | - // .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) | ||
| 184 | }.alignContent(Alignment.Top) | 220 | }.alignContent(Alignment.Top) |
| 185 | }.backgroundColor(this.currentWindowColor).width('100%') | 221 | }.backgroundColor(this.currentWindowColor).width('100%') |
| 186 | } | 222 | } |
| @@ -193,15 +229,57 @@ export struct QualityCommentsComponent { | @@ -193,15 +229,57 @@ export struct QualityCommentsComponent { | ||
| 193 | this.TabbarTransparent() | 229 | this.TabbarTransparent() |
| 194 | this.TabbarNormal() | 230 | this.TabbarNormal() |
| 195 | 231 | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + } | ||
| 196 | 237 | ||
| 238 | + @Builder | ||
| 239 | + listLayout(){ | ||
| 240 | + List({ space: 12, scroller:this.scroller }) { | ||
| 241 | + // ListItemGroup({ header: this.titleHeader() }) | ||
| 242 | + LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { | ||
| 243 | + ListItem() { | ||
| 244 | + QualityCommentItem({ item: item, index: index }).margin({ left: 12, right: 12 }) | ||
| 245 | + } | ||
| 246 | + }) | ||
| 247 | + // 加载更多 | ||
| 248 | + ListItem() { | ||
| 249 | + if (this.hasMore === false) NoMoreLayout() | ||
| 197 | } | 250 | } |
| 251 | + ListItem() { | ||
| 198 | 252 | ||
| 253 | + }.height(this.bottomSafeHeight) | ||
| 199 | } | 254 | } |
| 255 | + .margin({ top: 196 }) | ||
| 256 | + .height("100%") | ||
| 257 | + .width("100%") | ||
| 258 | + .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 | ||
| 259 | + // .edgeEffect(EdgeEffect.Spring) | ||
| 260 | + .nestedScroll({ | ||
| 261 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 262 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 263 | + }) | ||
| 264 | + } | ||
| 200 | 265 | ||
| 266 | + | ||
| 267 | + @Builder | ||
| 268 | + testLayout(){ | ||
| 269 | + List({ space: 12, scroller:this.scroller }){ | ||
| 270 | + LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { | ||
| 271 | + ListItem() { | ||
| 272 | + // QualityCommentItem({ item: item, index: index }).margin({ left: 12, right: 12 }) | ||
| 273 | + } | ||
| 274 | + }) | ||
| 275 | + } | ||
| 201 | } | 276 | } |
| 277 | + | ||
| 202 | } | 278 | } |
| 203 | 279 | ||
| 204 | 280 | ||
| 281 | + | ||
| 282 | + | ||
| 205 | @Component | 283 | @Component |
| 206 | struct QualityCommentItem { | 284 | struct QualityCommentItem { |
| 207 | @ObjectLink item: commentItemModel | 285 | @ObjectLink item: commentItemModel |
| @@ -316,10 +394,10 @@ struct QualityCommentItem { | @@ -316,10 +394,10 @@ struct QualityCommentItem { | ||
| 316 | .margin({ left: 3 }) | 394 | .margin({ left: 3 }) |
| 317 | } | 395 | } |
| 318 | }.onClick(() => { | 396 | }.onClick(() => { |
| 319 | - commentViewModel.commnetLikeChange(this.item) | 397 | + commentLikeChange(this.item) |
| 320 | commentViewModel.commentLike(this.item).then(() => { | 398 | commentViewModel.commentLike(this.item).then(() => { |
| 321 | }).catch(() => { | 399 | }).catch(() => { |
| 322 | - commentViewModel.commnetLikeChange(this.item) | 400 | + commentLikeChange(this.item) |
| 323 | }) | 401 | }) |
| 324 | }) | 402 | }) |
| 325 | } | 403 | } |
| @@ -331,5 +409,24 @@ struct QualityCommentItem { | @@ -331,5 +409,24 @@ struct QualityCommentItem { | ||
| 331 | } | 409 | } |
| 332 | } | 410 | } |
| 333 | 411 | ||
| 412 | +function commentLikeChange(item: commentItemModel) { | ||
| 413 | + item.api_status = !item.api_status | ||
| 414 | + //点赞 | ||
| 415 | + if (item.api_status) { | ||
| 416 | + if (item.likeNum.length > 0) { | ||
| 417 | + item.likeNum = (Number.parseInt(item.likeNum) + 1) + '' | ||
| 418 | + } else { | ||
| 419 | + item.likeNum = '1' | ||
| 420 | + } | ||
| 421 | + } | ||
| 422 | + //取消点赞 | ||
| 423 | + if (!item.api_status) { | ||
| 424 | + item.likeNum = (Number.parseInt(item.likeNum) - 1) + '' | ||
| 425 | + if (Number.parseInt(item.likeNum) <= 0) { | ||
| 426 | + item.likeNum = '' | ||
| 427 | + } | ||
| 428 | + } | ||
| 429 | +} | ||
| 430 | + | ||
| 334 | 431 | ||
| 335 | 432 |
| @@ -239,52 +239,53 @@ class CommentViewModel { | @@ -239,52 +239,53 @@ class CommentViewModel { | ||
| 239 | 239 | ||
| 240 | let promiseArray: Promise<commentStatusListModel | void>[] = []; | 240 | let promiseArray: Promise<commentStatusListModel | void>[] = []; |
| 241 | 241 | ||
| 242 | - //TODO 未登录不用批查 | ||
| 243 | - if (commentIDs.length > 0) { | ||
| 244 | - let promise1 = new Promise<void>((success) => { | ||
| 245 | - // HttpRequest HttpBizUtil | ||
| 246 | - let url = HttpUrlUtils.getBatchCommentStatusUrl(); | ||
| 247 | - let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 248 | - let bean: Record<string, string[]> = {}; | ||
| 249 | - bean['commentIdList'] = commentIDs; | ||
| 250 | - HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => { | ||
| 251 | - if (!data || !data.data) { | ||
| 252 | - success() | ||
| 253 | - return | ||
| 254 | - } | ||
| 255 | - if (data.code != 0) { | ||
| 256 | - success() | ||
| 257 | - return | ||
| 258 | - } | ||
| 259 | - if (data.data.length == 0) { | ||
| 260 | - success() | ||
| 261 | - return | ||
| 262 | - } | ||
| 263 | - let listData = data.data as commentStatusModel[] | ||
| 264 | - //点赞 | ||
| 265 | - for (const element of listData) { | ||
| 266 | - for (const commentModel of model.list) { | ||
| 267 | - if (element.commentId == commentModel.id) { | ||
| 268 | - commentModel.api_status = element.status | ||
| 269 | - } | ||
| 270 | - if (commentModel.childComments) { | ||
| 271 | - for (const childCommentModel of commentModel.childComments) { | ||
| 272 | - if (element.commentId == childCommentModel.id) { | ||
| 273 | - childCommentModel.api_status = element.status | 242 | + //未登录不用批查 |
| 243 | + if (HttpUrlUtils.getUserId()){ | ||
| 244 | + if (commentIDs.length > 0) { | ||
| 245 | + let promise1 = new Promise<void>((success) => { | ||
| 246 | + // HttpRequest HttpBizUtil | ||
| 247 | + let url = HttpUrlUtils.getBatchCommentStatusUrl(); | ||
| 248 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 249 | + let bean: Record<string, string[]> = {}; | ||
| 250 | + bean['commentIdList'] = commentIDs; | ||
| 251 | + HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => { | ||
| 252 | + if (!data || !data.data) { | ||
| 253 | + success() | ||
| 254 | + return | ||
| 255 | + } | ||
| 256 | + if (data.code != 0) { | ||
| 257 | + success() | ||
| 258 | + return | ||
| 259 | + } | ||
| 260 | + if (data.data.length == 0) { | ||
| 261 | + success() | ||
| 262 | + return | ||
| 263 | + } | ||
| 264 | + let listData = data.data as commentStatusModel[] | ||
| 265 | + //点赞 | ||
| 266 | + for (const element of listData) { | ||
| 267 | + for (const commentModel of model.list) { | ||
| 268 | + if (element.commentId == commentModel.id) { | ||
| 269 | + commentModel.api_status = element.status | ||
| 270 | + } | ||
| 271 | + if (commentModel.childComments) { | ||
| 272 | + for (const childCommentModel of commentModel.childComments) { | ||
| 273 | + if (element.commentId == childCommentModel.id) { | ||
| 274 | + childCommentModel.api_status = element.status | ||
| 275 | + } | ||
| 274 | } | 276 | } |
| 275 | } | 277 | } |
| 276 | } | 278 | } |
| 277 | } | 279 | } |
| 278 | - } | ||
| 279 | - success() | ||
| 280 | - }, (error: Error) => { | ||
| 281 | - success() | ||
| 282 | - Logger.debug(TAG, error.toString()) | 280 | + success() |
| 281 | + }, (error: Error) => { | ||
| 282 | + success() | ||
| 283 | + Logger.debug(TAG, error.toString()) | ||
| 284 | + }) | ||
| 283 | }) | 285 | }) |
| 284 | - }) | ||
| 285 | - promiseArray.push(promise1); | ||
| 286 | - } | ||
| 287 | - | 286 | + promiseArray.push(promise1); |
| 287 | + } | ||
| 288 | + } | ||
| 288 | if (fromUserIDs.length > 0) { | 289 | if (fromUserIDs.length > 0) { |
| 289 | let promise2 = new Promise<void>((success) => { | 290 | let promise2 = new Promise<void>((success) => { |
| 290 | let url = HttpUrlUtils.getBatchUserUrl(); | 291 | let url = HttpUrlUtils.getBatchUserUrl(); |
| @@ -385,21 +386,7 @@ class CommentViewModel { | @@ -385,21 +386,7 @@ class CommentViewModel { | ||
| 385 | 386 | ||
| 386 | } | 387 | } |
| 387 | 388 | ||
| 388 | - commnetLikeChange(model: commentItemModel) { | ||
| 389 | - model.api_status = !model.api_status | ||
| 390 | - //点赞 | ||
| 391 | - if (model.api_status) { | ||
| 392 | - model.likeNum = (Number.parseInt(model.likeNum) + 1) + '' | ||
| 393 | - } | ||
| 394 | - //取消点赞 | ||
| 395 | - if (!model.api_status) { | ||
| 396 | - model.likeNum = (Number.parseInt(model.likeNum) - 1) + '' | ||
| 397 | - if (Number.parseInt(model.likeNum) < 0) { | ||
| 398 | - model.likeNum = '0' | ||
| 399 | - } | ||
| 400 | - } | ||
| 401 | - // return model | ||
| 402 | - } | 389 | + |
| 403 | 390 | ||
| 404 | deepCopyCommentItemModel(model: commentItemModel) { | 391 | deepCopyCommentItemModel(model: commentItemModel) { |
| 405 | let newModel = new commentItemModel() | 392 | let newModel = new commentItemModel() |
| @@ -65,7 +65,11 @@ export struct ZhGridLayout03 { | @@ -65,7 +65,11 @@ export struct ZhGridLayout03 { | ||
| 65 | } | 65 | } |
| 66 | .width('100%') | 66 | .width('100%') |
| 67 | .onClick((event: ClickEvent) => { | 67 | .onClick((event: ClickEvent) => { |
| 68 | - ProcessUtils.processPage(item) | 68 | + if (item.objectType === '11') { |
| 69 | + ProcessUtils.jumpChannelTab(item.objectId, item.pageId) | ||
| 70 | + } else { | ||
| 71 | + ProcessUtils.processPage(item) | ||
| 72 | + } | ||
| 69 | }) | 73 | }) |
| 70 | } | 74 | } |
| 71 | } | 75 | } |
| @@ -15,8 +15,14 @@ const TAG = 'Zh_Single_Column-09' | @@ -15,8 +15,14 @@ const TAG = 'Zh_Single_Column-09' | ||
| 15 | @Component | 15 | @Component |
| 16 | export struct ZhSingleColumn09 { | 16 | export struct ZhSingleColumn09 { |
| 17 | @State compDTO: CompDTO = {} as CompDTO | 17 | @State compDTO: CompDTO = {} as CompDTO |
| 18 | - @State list: Array<string> = ['社会', '三个字', '是四个字', '时事', '社会', '三个字', '是四个字', '时事'] | ||
| 19 | @State activeIndexs: Array<number> = [] | 18 | @State activeIndexs: Array<number> = [] |
| 19 | + @State operDataList: ContentDTO[] = this.compDTO?.operDataList || [] | ||
| 20 | + @State selfClosed: Boolean = false; | ||
| 21 | + | ||
| 22 | + aboutToAppear(): void { | ||
| 23 | + this.operDataList = this.shuffleArray(this.compDTO?.operDataList) | ||
| 24 | + } | ||
| 25 | + | ||
| 20 | 26 | ||
| 21 | getItemWidth(index: number) { | 27 | getItemWidth(index: number) { |
| 22 | if (index % 4 === 0 || index % 4 === 3) { | 28 | if (index % 4 === 0 || index % 4 === 3) { |
| @@ -26,12 +32,56 @@ export struct ZhSingleColumn09 { | @@ -26,12 +32,56 @@ export struct ZhSingleColumn09 { | ||
| 26 | } | 32 | } |
| 27 | } | 33 | } |
| 28 | 34 | ||
| 35 | + shuffleArray(array: ContentDTO[]) { | ||
| 36 | + for(let i = array.length - 1; i > 0; i--) { | ||
| 37 | + const j = Math.floor(Math.random() * (i + 1)); | ||
| 38 | + const tempArray = array[i]; | ||
| 39 | + array[i] = array[j]; | ||
| 40 | + array[j] = tempArray | ||
| 41 | + } | ||
| 42 | + return array | ||
| 43 | + } | ||
| 44 | + | ||
| 29 | build() { | 45 | build() { |
| 30 | Column() { | 46 | Column() { |
| 31 | //顶部 | 47 | //顶部 |
| 32 | - this.CompHeader(this.compDTO) | 48 | + Row() { |
| 49 | + Column() { | ||
| 50 | + Text('以下是否有您感兴趣?') | ||
| 51 | + .fontSize(18) | ||
| 52 | + .fontColor(0x000000) | ||
| 53 | + .fontWeight(600) | ||
| 54 | + .width('70%') | ||
| 55 | + .margin({bottom: 4}) | ||
| 56 | + | ||
| 57 | + Text('选中标签,为您推荐更多您感兴趣的内容') | ||
| 58 | + .fontSize(12) | ||
| 59 | + .fontColor(0xB0B0B0) | ||
| 60 | + .margin({bottom: 10}) | ||
| 61 | + .width('70%') | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + Button('选好了', { type: ButtonType.Normal, stateEffect: false }) | ||
| 65 | + .fontColor(this.activeIndexs.length > 0 ? 0xed2800 : 0xB0B0B0) | ||
| 66 | + .fontSize(14) | ||
| 67 | + .width(62) | ||
| 68 | + .height(26) | ||
| 69 | + .backgroundColor(this.activeIndexs.length > 0 ? 0xfdf0ed : 0xf5f5f5) | ||
| 70 | + // .lineHeight(26) | ||
| 71 | + .borderRadius(4) | ||
| 72 | + .margin({top: -10}) | ||
| 73 | + .padding({top: 0, bottom: 0, left: 0, right: 0}) | ||
| 74 | + .onClick(() => { | ||
| 75 | + if (this.activeIndexs.length > 0) { | ||
| 76 | + this.selfClosed = true; | ||
| 77 | + } | ||
| 78 | + }) | ||
| 79 | + } | ||
| 80 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 81 | + .width('100%') | ||
| 82 | + | ||
| 33 | Grid() { | 83 | Grid() { |
| 34 | - ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => { | 84 | + ForEach(this.operDataList, (item: ContentDTO, index: number) => { |
| 35 | GridItem() { | 85 | GridItem() { |
| 36 | Stack({alignContent: Alignment.TopEnd}) { | 86 | Stack({alignContent: Alignment.TopEnd}) { |
| 37 | Image(item.coverUrl) | 87 | Image(item.coverUrl) |
| @@ -73,17 +123,24 @@ export struct ZhSingleColumn09 { | @@ -73,17 +123,24 @@ export struct ZhSingleColumn09 { | ||
| 73 | Row() { | 123 | Row() { |
| 74 | Text('换一换') | 124 | Text('换一换') |
| 75 | .fontSize(14) | 125 | .fontSize(14) |
| 76 | - .fontColor(0xed2800) | 126 | + .fontColor(this.compDTO?.operDataList.length > 8 ? 0xed2800 : 0xB0B0B0) |
| 77 | .margin({right: 4}) | 127 | .margin({right: 4}) |
| 78 | - Image($r('app.media.icon_refresh')) | 128 | + Image(this.compDTO?.operDataList.length > 8 ? $r('app.media.icon_refresh') : $r('app.media.ic_refresh')) |
| 79 | .width(14) | 129 | .width(14) |
| 80 | .height(14) | 130 | .height(14) |
| 81 | } | 131 | } |
| 132 | + .onClick(() => { | ||
| 133 | + if (this.compDTO?.operDataList.length > 8) { | ||
| 134 | + this.operDataList = this.shuffleArray(this.operDataList) | ||
| 135 | + this.activeIndexs = []; | ||
| 136 | + } | ||
| 137 | + }) | ||
| 82 | 138 | ||
| 83 | Image($r("app.media.close_button")) | 139 | Image($r("app.media.close_button")) |
| 84 | .width(14) | 140 | .width(14) |
| 85 | .height(14) | 141 | .height(14) |
| 86 | .onClick(() => { | 142 | .onClick(() => { |
| 143 | + this.selfClosed = true; | ||
| 87 | }) | 144 | }) |
| 88 | } | 145 | } |
| 89 | .height(40) | 146 | .height(40) |
| @@ -98,42 +155,7 @@ export struct ZhSingleColumn09 { | @@ -98,42 +155,7 @@ export struct ZhSingleColumn09 { | ||
| 98 | bottom: $r('app.float.card_comp_pagePadding_tb') | 155 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 99 | }) | 156 | }) |
| 100 | .backgroundColor($r('app.color.white')) | 157 | .backgroundColor($r('app.color.white')) |
| 101 | - .margin({ bottom: 8 }) | ||
| 102 | - | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - @Builder | ||
| 106 | - CompHeader(item: CompDTO) { | ||
| 107 | - Row() { | ||
| 108 | - Column() { | ||
| 109 | - Text('以下是否有您感兴趣?') | ||
| 110 | - .fontSize(18) | ||
| 111 | - .fontColor(0x000000) | ||
| 112 | - .fontWeight(600) | ||
| 113 | - .width('70%') | ||
| 114 | - .margin({bottom: 4}) | ||
| 115 | - | ||
| 116 | - Text('选中标签,为您推荐更多您感兴趣的内容') | ||
| 117 | - .fontSize(12) | ||
| 118 | - .fontColor(0xB0B0B0) | ||
| 119 | - .margin({bottom: 10}) | ||
| 120 | - .width('70%') | ||
| 121 | - } | ||
| 122 | - | ||
| 123 | - Text('选好了') | ||
| 124 | - .fontColor(0xed2800) | ||
| 125 | - .fontSize(14) | ||
| 126 | - .width(62) | ||
| 127 | - .height(26) | ||
| 128 | - .backgroundColor(0xfdf0ed) | ||
| 129 | - .textAlign(TextAlign.Center) | ||
| 130 | - // .lineHeight(26) | ||
| 131 | - .borderRadius(4) | ||
| 132 | - .margin({top: -10}) | ||
| 133 | - | ||
| 134 | - } | ||
| 135 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 136 | - .width('100%') | 158 | + .visibility(this.selfClosed ? Visibility.None : Visibility.Visible) |
| 137 | } | 159 | } |
| 138 | } | 160 | } |
| 139 | 161 |
| @@ -70,9 +70,7 @@ export struct ZhSingleRow02 { | @@ -70,9 +70,7 @@ export struct ZhSingleRow02 { | ||
| 70 | .height(14) | 70 | .height(14) |
| 71 | .onClick(() => { | 71 | .onClick(() => { |
| 72 | // TODO 跳转的页面,定义的入参可能不合理。推荐id: 41 | 72 | // TODO 跳转的页面,定义的入参可能不合理。推荐id: 41 |
| 73 | - let params: Params = { | ||
| 74 | - pageID: "1" | ||
| 75 | - } | 73 | + let params = {'index': "1"} as Record<string, string> |
| 76 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) | 74 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) |
| 77 | }) | 75 | }) |
| 78 | } | 76 | } |
| @@ -80,10 +78,13 @@ export struct ZhSingleRow02 { | @@ -80,10 +78,13 @@ export struct ZhSingleRow02 { | ||
| 80 | right: $r('app.float.card_comp_pagePadding_lf'), | 78 | right: $r('app.float.card_comp_pagePadding_lf'), |
| 81 | }) | 79 | }) |
| 82 | .onClick(() => { | 80 | .onClick(() => { |
| 83 | - let params: Params = { | ||
| 84 | - pageID: "1" | 81 | + if (this.compDTO?.objectType === '11') { |
| 82 | + ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string) | ||
| 83 | + } else if (this.compDTO?.objectType === '5') { | ||
| 84 | + ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl) | ||
| 85 | + } else if (this.compDTO?.objectType === '6') { | ||
| 86 | + ProcessUtils._gotoDefaultWeb(this.compDTO.linkUrl) | ||
| 85 | } | 87 | } |
| 86 | - WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) | ||
| 87 | }) | 88 | }) |
| 88 | } | 89 | } |
| 89 | .justifyContent(FlexAlign.SpaceBetween) | 90 | .justifyContent(FlexAlign.SpaceBetween) |
| @@ -36,6 +36,15 @@ export struct ZhSingleRow04 { | @@ -36,6 +36,15 @@ export struct ZhSingleRow04 { | ||
| 36 | .width(14) | 36 | .width(14) |
| 37 | .height(14) | 37 | .height(14) |
| 38 | } | 38 | } |
| 39 | + .onClick(() => { | ||
| 40 | + if (this.compDTO?.objectType === '11') { | ||
| 41 | + ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string) | ||
| 42 | + } else if (this.compDTO?.objectType === '5') { | ||
| 43 | + ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl) | ||
| 44 | + } else if (this.compDTO?.objectType === '6') { | ||
| 45 | + ProcessUtils._gotoDefaultWeb(this.compDTO.linkUrl) | ||
| 46 | + } | ||
| 47 | + }) | ||
| 39 | } | 48 | } |
| 40 | .justifyContent(FlexAlign.SpaceBetween) | 49 | .justifyContent(FlexAlign.SpaceBetween) |
| 41 | .margin({ top: 8, bottom: 8 }) | 50 | .margin({ top: 8, bottom: 8 }) |
| @@ -83,9 +83,7 @@ export struct ZhSingleRow05 { | @@ -83,9 +83,7 @@ export struct ZhSingleRow05 { | ||
| 83 | .height(14) | 83 | .height(14) |
| 84 | .onClick(() => { | 84 | .onClick(() => { |
| 85 | // TODO 跳转的页面,定义的入参可能不合理。推荐id: 41 | 85 | // TODO 跳转的页面,定义的入参可能不合理。推荐id: 41 |
| 86 | - let params: Params = { | ||
| 87 | - pageID: "1" | ||
| 88 | - } | 86 | + let params = {'index': "1"} as Record<string, string>; |
| 89 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) | 87 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) |
| 90 | }) | 88 | }) |
| 91 | } | 89 | } |
| 1 | -import { Logger, StringUtils, UserDataLocal } from 'wdKit' | 1 | +import { StringUtils, UserDataLocal } from 'wdKit' |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter' | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter' |
| 3 | import MinePageDatasModel from '../../model/MinePageDatasModel' | 3 | import MinePageDatasModel from '../../model/MinePageDatasModel' |
| 4 | const TAG = "MinePageUserSimpleInfoUI" | 4 | const TAG = "MinePageUserSimpleInfoUI" |
| @@ -4,6 +4,8 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | @@ -4,6 +4,8 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | ||
| 4 | import { MineAppointmentItem } from '../../../viewmodel/MineAppointmentItem'; | 4 | 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'; | ||
| 8 | + | ||
| 7 | const TAG = "AppointmentListUI" | 9 | const TAG = "AppointmentListUI" |
| 8 | 10 | ||
| 9 | @Component | 11 | @Component |
| @@ -23,7 +25,9 @@ export struct AppointmentListUI{ | @@ -23,7 +25,9 @@ export struct AppointmentListUI{ | ||
| 23 | //标题栏目 | 25 | //标题栏目 |
| 24 | CustomTitleUI({titleName:"预约列表"}) | 26 | CustomTitleUI({titleName:"预约列表"}) |
| 25 | if(this.count == 0){ | 27 | if(this.count == 0){ |
| 26 | - ListHasNoMoreDataUI({style:2}) | 28 | + EmptyComponent({emptyType:10}) |
| 29 | + .height('100%') | ||
| 30 | + .width('100%') | ||
| 27 | }else{ | 31 | }else{ |
| 28 | //刷新控件 TODO | 32 | //刷新控件 TODO |
| 29 | //List | 33 | //List |
| @@ -84,6 +88,8 @@ export struct AppointmentListUI{ | @@ -84,6 +88,8 @@ export struct AppointmentListUI{ | ||
| 84 | this.hasMore = false | 88 | this.hasMore = false |
| 85 | } | 89 | } |
| 86 | } | 90 | } |
| 91 | + }).catch((err:Error)=>{ | ||
| 92 | + console.log(TAG,JSON.stringify(err)) | ||
| 87 | }) | 93 | }) |
| 88 | } | 94 | } |
| 89 | this.isLoading = false | 95 | this.isLoading = false |
| @@ -89,9 +89,7 @@ export struct HomePageBottomComponent{ | @@ -89,9 +89,7 @@ export struct HomePageBottomComponent{ | ||
| 89 | .backgroundColor($r('app.color.color_F5F5F5')) | 89 | .backgroundColor($r('app.color.color_F5F5F5')) |
| 90 | .margin({top:'31lpx',bottom:'4lpx'}) | 90 | .margin({top:'31lpx',bottom:'4lpx'}) |
| 91 | .onClick(()=>{ | 91 | .onClick(()=>{ |
| 92 | - let params: Params = { | ||
| 93 | - pageID: "1" | ||
| 94 | - } | 92 | + let params = {'index': "1"} as Record<string, string> |
| 95 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) | 93 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) |
| 96 | }) | 94 | }) |
| 97 | 95 | ||
| @@ -128,9 +126,7 @@ export struct HomePageBottomComponent{ | @@ -128,9 +126,7 @@ export struct HomePageBottomComponent{ | ||
| 128 | .backgroundColor($r('app.color.color_F5F5F5')) | 126 | .backgroundColor($r('app.color.color_F5F5F5')) |
| 129 | .margin({top:'31lpx',bottom:'4lpx'}) | 127 | .margin({top:'31lpx',bottom:'4lpx'}) |
| 130 | }.onClick(()=>{ | 128 | }.onClick(()=>{ |
| 131 | - let params: Params = { | ||
| 132 | - pageID: "1" | ||
| 133 | - } | 129 | + let params = {'index': "1"} as Record<string, string> |
| 134 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) | 130 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) |
| 135 | }) | 131 | }) |
| 136 | 132 |
| @@ -51,9 +51,7 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -51,9 +51,7 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 51 | .backgroundColor($r('app.color.color_F5F5F5')) | 51 | .backgroundColor($r('app.color.color_F5F5F5')) |
| 52 | .margin({top:'31lpx',bottom:'4lpx'}) | 52 | .margin({top:'31lpx',bottom:'4lpx'}) |
| 53 | .onClick(()=>{ | 53 | .onClick(()=>{ |
| 54 | - let params: Params = { | ||
| 55 | - pageID: "1" | ||
| 56 | - } | 54 | + let params = {'index': "1"} as Record<string, string> |
| 57 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) | 55 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) |
| 58 | }) | 56 | }) |
| 59 | 57 | ||
| @@ -85,9 +83,7 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -85,9 +83,7 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 85 | .backgroundColor($r('app.color.color_F5F5F5')) | 83 | .backgroundColor($r('app.color.color_F5F5F5')) |
| 86 | .margin({top:'31lpx',bottom:'4lpx'}) | 84 | .margin({top:'31lpx',bottom:'4lpx'}) |
| 87 | }.onClick(()=>{ | 85 | }.onClick(()=>{ |
| 88 | - let params: Params = { | ||
| 89 | - pageID: "1" | ||
| 90 | - } | 86 | + let params = {'index': "1"} as Record<string, string>; |
| 91 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) | 87 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) |
| 92 | }) | 88 | }) |
| 93 | 89 |
| 1 | import { BottomNavi, CommonConstants } from 'wdConstant'; | 1 | import { BottomNavi, CommonConstants } from 'wdConstant'; |
| 2 | import { BottomNavDTO } from 'wdBean'; | 2 | import { BottomNavDTO } from 'wdBean'; |
| 3 | -import { EmitterEventId, EmitterUtils, Logger } from 'wdKit'; | 3 | +import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger } from 'wdKit'; |
| 4 | import { TopNavigationComponent } from './TopNavigationComponent'; | 4 | import { TopNavigationComponent } from './TopNavigationComponent'; |
| 5 | import { MinePageComponent } from './MinePageComponent'; | 5 | import { MinePageComponent } from './MinePageComponent'; |
| 6 | import { CompUtils } from '../../utils/CompUtils'; | 6 | import { CompUtils } from '../../utils/CompUtils'; |
| @@ -40,11 +40,10 @@ export struct BottomNavigationComponent { | @@ -40,11 +40,10 @@ export struct BottomNavigationComponent { | ||
| 40 | * Component opacity value: 0.6. | 40 | * Component opacity value: 0.6. |
| 41 | */ | 41 | */ |
| 42 | readonly SIXTY_OPACITY: number = 0.6; | 42 | readonly SIXTY_OPACITY: number = 0.6; |
| 43 | - // 接收指定频道跳转的参数 | ||
| 44 | - @State assignChannel: AssignChannelParam = new AssignChannelParam() | ||
| 45 | // 用于传参到顶导组件,【不用channelParam,主要是时序问题,需要先底导处理完,再延时触发顶导处理】 | 43 | // 用于传参到顶导组件,【不用channelParam,主要是时序问题,需要先底导处理完,再延时触发顶导处理】 |
| 46 | - @State assignChannel1: AssignChannelParam = new AssignChannelParam() | ||
| 47 | - | 44 | + @State assignChannel: AssignChannelParam = new AssignChannelParam() |
| 45 | + // 自动刷新触发(双击tab自动刷新) | ||
| 46 | + @State autoRefresh: number = 0 | ||
| 48 | async aboutToAppear() { | 47 | async aboutToAppear() { |
| 49 | Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`); | 48 | Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`); |
| 50 | let bottomNav = await PageViewModel.getBottomNavData(getContext(this)) | 49 | let bottomNav = await PageViewModel.getBottomNavData(getContext(this)) |
| @@ -60,8 +59,8 @@ export struct BottomNavigationComponent { | @@ -60,8 +59,8 @@ export struct BottomNavigationComponent { | ||
| 60 | Logger.debug(TAG, 'receiveEvent JUMP_HOME_CHANNEL: ' + str) | 59 | Logger.debug(TAG, 'receiveEvent JUMP_HOME_CHANNEL: ' + str) |
| 61 | if (str) { | 60 | if (str) { |
| 62 | // 跳转指定频道场景,传参底导id、频道id | 61 | // 跳转指定频道场景,传参底导id、频道id |
| 63 | - this.assignChannel = JSON.parse(str) as AssignChannelParam | ||
| 64 | - this.changeBottomNav() | 62 | + let assignChannel = JSON.parse(str) as AssignChannelParam |
| 63 | + this.changeBottomNav(assignChannel) | ||
| 65 | } | 64 | } |
| 66 | }) | 65 | }) |
| 67 | } | 66 | } |
| @@ -83,9 +82,11 @@ export struct BottomNavigationComponent { | @@ -83,9 +82,11 @@ export struct BottomNavigationComponent { | ||
| 83 | groupId: navItem.id, | 82 | groupId: navItem.id, |
| 84 | topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), | 83 | topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), |
| 85 | _currentNavIndex: $currentNavIndex, | 84 | _currentNavIndex: $currentNavIndex, |
| 85 | + navIndex: index, | ||
| 86 | currentBottomNavName: navItem.name, | 86 | currentBottomNavName: navItem.name, |
| 87 | barBackgroundColor: $barBackgroundColor, | 87 | barBackgroundColor: $barBackgroundColor, |
| 88 | - assignChannel: this.assignChannel1 | 88 | + assignChannel: this.assignChannel, |
| 89 | + autoRefresh: this.autoRefresh | ||
| 89 | }) | 90 | }) |
| 90 | } | 91 | } |
| 91 | 92 | ||
| @@ -100,11 +101,6 @@ export struct BottomNavigationComponent { | @@ -100,11 +101,6 @@ export struct BottomNavigationComponent { | ||
| 100 | .barMode(BarMode.Fixed) | 101 | .barMode(BarMode.Fixed) |
| 101 | // TODO:更详细的判断是视频频道 | 102 | // TODO:更详细的判断是视频频道 |
| 102 | .barBackgroundColor(this.barBackgroundColor) | 103 | .barBackgroundColor(this.barBackgroundColor) |
| 103 | - .onChange((index: number) => { | ||
| 104 | - Logger.info(TAG, `onChange, index: ${index}`); | ||
| 105 | - this.currentNavIndex = index; | ||
| 106 | - // this.onBottomNavigationIndexChange() | ||
| 107 | - }) | ||
| 108 | .backgroundColor(this.barBackgroundColor) | 104 | .backgroundColor(this.barBackgroundColor) |
| 109 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | 105 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) |
| 110 | 106 | ||
| @@ -141,6 +137,19 @@ export struct BottomNavigationComponent { | @@ -141,6 +137,19 @@ export struct BottomNavigationComponent { | ||
| 141 | } | 137 | } |
| 142 | .height($r('app.float.bottom_navigation_barHeight')) | 138 | .height($r('app.float.bottom_navigation_barHeight')) |
| 143 | .hoverEffect(HoverEffect.Highlight) | 139 | .hoverEffect(HoverEffect.Highlight) |
| 140 | + .onClick(() => { | ||
| 141 | + if (this.currentNavIndex === index) { | ||
| 142 | + // 当前tab,双击事件 | ||
| 143 | + this.doubleClick(() => { | ||
| 144 | + Logger.info(TAG, 'tab double click ') | ||
| 145 | + this.autoRefresh++ | ||
| 146 | + }) | ||
| 147 | + } else { | ||
| 148 | + // 切换tab | ||
| 149 | + this.currentNavIndex = index; | ||
| 150 | + Logger.info(TAG, `onChange, index: ${index}`); | ||
| 151 | + } | ||
| 152 | + }) | ||
| 144 | 153 | ||
| 145 | // .justifyContent(FlexAlign.Center) | 154 | // .justifyContent(FlexAlign.Center) |
| 146 | // .onClick(() => { | 155 | // .onClick(() => { |
| @@ -164,11 +173,11 @@ export struct BottomNavigationComponent { | @@ -164,11 +173,11 @@ export struct BottomNavigationComponent { | ||
| 164 | /** | 173 | /** |
| 165 | * 底导id变化,即指定频道跳转场景 | 174 | * 底导id变化,即指定频道跳转场景 |
| 166 | */ | 175 | */ |
| 167 | - changeBottomNav() { | 176 | + changeBottomNav(assignChannel: AssignChannelParam) { |
| 168 | let index = -1 | 177 | let index = -1 |
| 169 | for (let i = 0; i < this.bottomNavList.length; i++) { | 178 | for (let i = 0; i < this.bottomNavList.length; i++) { |
| 170 | let bottomNavDTO: BottomNavDTO = this.bottomNavList[i] | 179 | let bottomNavDTO: BottomNavDTO = this.bottomNavList[i] |
| 171 | - if (bottomNavDTO.id.toString() === this.assignChannel.bottomNavId) { | 180 | + if (bottomNavDTO.id.toString() === assignChannel.bottomNavId) { |
| 172 | index = i | 181 | index = i |
| 173 | break | 182 | break |
| 174 | } | 183 | } |
| @@ -180,10 +189,27 @@ export struct BottomNavigationComponent { | @@ -180,10 +189,27 @@ export struct BottomNavigationComponent { | ||
| 180 | 189 | ||
| 181 | setTimeout(() => { | 190 | setTimeout(() => { |
| 182 | // 底导切换后,触发顶导切换 | 191 | // 底导切换后,触发顶导切换 |
| 183 | - this.assignChannel1 = new AssignChannelParam() | ||
| 184 | - this.assignChannel1.pageId = this.assignChannel.pageId | ||
| 185 | - this.assignChannel1.channelId = this.assignChannel.channelId | ||
| 186 | - this.assignChannel1.bottomNavId = this.assignChannel.bottomNavId | 192 | + this.assignChannel = new AssignChannelParam() |
| 193 | + this.assignChannel.pageId = assignChannel.pageId | ||
| 194 | + this.assignChannel.channelId = assignChannel.channelId | ||
| 195 | + this.assignChannel.bottomNavId = assignChannel.bottomNavId | ||
| 187 | }, 20) | 196 | }, 20) |
| 188 | } | 197 | } |
| 198 | + | ||
| 199 | + /** | ||
| 200 | + * 双击实现 | ||
| 201 | + */ | ||
| 202 | + doubleClickTime: number = 0 | ||
| 203 | + | ||
| 204 | + /** | ||
| 205 | + * 双击实现 | ||
| 206 | + */ | ||
| 207 | + private doubleClick(fun: () => void) { | ||
| 208 | + let now = DateTimeUtils.getTimeStamp() | ||
| 209 | + if (now - this.doubleClickTime < 200) { | ||
| 210 | + fun() | ||
| 211 | + } else { | ||
| 212 | + this.doubleClickTime = now | ||
| 213 | + } | ||
| 214 | + } | ||
| 189 | } | 215 | } |
| @@ -5,11 +5,11 @@ import router from '@ohos.router'; | @@ -5,11 +5,11 @@ import router from '@ohos.router'; | ||
| 5 | @Entry | 5 | @Entry |
| 6 | @Component | 6 | @Component |
| 7 | struct FollowListPage { | 7 | struct FollowListPage { |
| 8 | - @State params:Params = router.getParams() as Params; | 8 | + @State params:Record<string, string> = router.getParams() as Record<string, string>; |
| 9 | @State curIndex: string = '0'; | 9 | @State curIndex: string = '0'; |
| 10 | 10 | ||
| 11 | onPageShow() { | 11 | onPageShow() { |
| 12 | - this.curIndex = this.params?.pageID; | 12 | + this.curIndex = this.params?.['index']; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | build() { | 15 | build() { |
| @@ -50,7 +50,7 @@ export struct MinePageComponent { | @@ -50,7 +50,7 @@ export struct MinePageComponent { | ||
| 50 | //个人功能数据 | 50 | //个人功能数据 |
| 51 | this.personalData = MinePageDatasModel.getPersonalFunctionsData() | 51 | this.personalData = MinePageDatasModel.getPersonalFunctionsData() |
| 52 | //创作者功能数据 | 52 | //创作者功能数据 |
| 53 | - this.creatorData = MinePageDatasModel.getCreatorFunctionsData() | 53 | + // this.creatorData = MinePageDatasModel.getCreatorFunctionsData() |
| 54 | //更多功能数据 | 54 | //更多功能数据 |
| 55 | this.moreData = MinePageDatasModel.getMoreFunctionsData() | 55 | this.moreData = MinePageDatasModel.getMoreFunctionsData() |
| 56 | } | 56 | } |
| 1 | import { CommonConstants, ViewType } from 'wdConstant'; | 1 | import { CommonConstants, ViewType } from 'wdConstant'; |
| 2 | import { Logger } from 'wdKit'; | 2 | import { Logger } from 'wdKit'; |
| 3 | -import PageViewModel from '../../viewmodel/PageViewModel'; | ||
| 4 | import { EmptyComponent } from '../view/EmptyComponent'; | 3 | import { EmptyComponent } from '../view/EmptyComponent'; |
| 5 | -import { ErrorComponent } from '../view/ErrorComponent'; | ||
| 6 | import PageModel from '../../viewmodel/PageModel'; | 4 | import PageModel from '../../viewmodel/PageModel'; |
| 7 | -import { listTouchEvent } from '../../utils/PullDownRefresh'; | 5 | +import { autoRefresh, listTouchEvent } from '../../utils/PullDownRefresh'; |
| 8 | import RefreshLayout from './RefreshLayout'; | 6 | import RefreshLayout from './RefreshLayout'; |
| 9 | import { RefreshLayoutBean } from './RefreshLayoutBean'; | 7 | import { RefreshLayoutBean } from './RefreshLayoutBean'; |
| 10 | -import NoMoreLayout from './NoMoreLayout'; | ||
| 11 | import LoadMoreLayout from './LoadMoreLayout'; | 8 | import LoadMoreLayout from './LoadMoreLayout'; |
| 12 | -import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | ||
| 13 | import { CompParser } from '../CompParser'; | 9 | import { CompParser } from '../CompParser'; |
| 14 | import { CompDTO } from 'wdBean'; | 10 | import { CompDTO } from 'wdBean'; |
| 15 | import PageHelper from '../../viewmodel/PageHelper'; | 11 | import PageHelper from '../../viewmodel/PageHelper'; |
| 16 | import { channelSkeleton } from '../skeleton/channelSkeleton' | 12 | import { channelSkeleton } from '../skeleton/channelSkeleton' |
| 17 | import { ProcessUtils } from 'wdRouter/Index'; | 13 | import { ProcessUtils } from 'wdRouter/Index'; |
| 18 | import PageAdModel from '../../viewmodel/PageAdvModel'; | 14 | import PageAdModel from '../../viewmodel/PageAdvModel'; |
| 15 | +import PageNoMoreLayout from './PageNoMoreLayout'; | ||
| 16 | +import { NoMoreBean } from './NoMoreBean'; | ||
| 19 | 17 | ||
| 20 | const TAG = 'PageComponent'; | 18 | const TAG = 'PageComponent'; |
| 21 | 19 | ||
| @@ -27,18 +25,24 @@ export struct PageComponent { | @@ -27,18 +25,24 @@ export struct PageComponent { | ||
| 27 | pageId: string = ""; | 25 | pageId: string = ""; |
| 28 | channelId: string = ""; | 26 | channelId: string = ""; |
| 29 | @Link @Watch('onChange') currentTopNavSelectedIndex: number | 27 | @Link @Watch('onChange') currentTopNavSelectedIndex: number |
| 28 | + // 自动刷新通知 | ||
| 29 | + @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 | ||
| 30 | 30 | ||
| 31 | build() { | 31 | build() { |
| 32 | Column() { | 32 | Column() { |
| 33 | if (this.pageModel.viewType == ViewType.LOADING) { | 33 | if (this.pageModel.viewType == ViewType.LOADING) { |
| 34 | - // LoadingComponent() | ||
| 35 | this.LoadingLayout() | 34 | this.LoadingLayout() |
| 36 | - } else if (this.pageModel.viewType == ViewType.ERROR) { | ||
| 37 | - ErrorComponent() | ||
| 38 | - } else if (this.pageModel.viewType == ViewType.EMPTY) { | ||
| 39 | - EmptyComponent() | ||
| 40 | - } else { | 35 | + } else if (this.pageModel.viewType == ViewType.LOADED) { |
| 41 | this.ListLayout() | 36 | this.ListLayout() |
| 37 | + } else if (this.pageModel.viewType == ViewType.EMPTY) { | ||
| 38 | + //缺省页 | ||
| 39 | + EmptyComponent({ | ||
| 40 | + emptyType: this.pageModel.emptyType, | ||
| 41 | + emptyButton: true, | ||
| 42 | + retry: () => { | ||
| 43 | + this.getData() | ||
| 44 | + } | ||
| 45 | + }) | ||
| 42 | } | 46 | } |
| 43 | } | 47 | } |
| 44 | .width(CommonConstants.FULL_PARENT) | 48 | .width(CommonConstants.FULL_PARENT) |
| @@ -65,6 +69,7 @@ export struct PageComponent { | @@ -65,6 +69,7 @@ export struct PageComponent { | ||
| 65 | this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) | 69 | this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) |
| 66 | }) | 70 | }) |
| 67 | } | 71 | } |
| 72 | + | ||
| 68 | LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { | 73 | LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { |
| 69 | ListItem() { | 74 | ListItem() { |
| 70 | Column() { | 75 | Column() { |
| @@ -83,7 +88,7 @@ export struct PageComponent { | @@ -83,7 +88,7 @@ export struct PageComponent { | ||
| 83 | this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight) | 88 | this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight) |
| 84 | }) | 89 | }) |
| 85 | } else if (!this.pageModel.contentNeedScroll) { | 90 | } else if (!this.pageModel.contentNeedScroll) { |
| 86 | - NoMoreLayout() | 91 | + PageNoMoreLayout({ noMoreBean: new NoMoreBean(this.pageModel.pageInfo.baselineCopywriting) }) |
| 87 | } | 92 | } |
| 88 | } | 93 | } |
| 89 | } | 94 | } |
| @@ -224,6 +229,15 @@ export struct PageComponent { | @@ -224,6 +229,15 @@ export struct PageComponent { | ||
| 224 | } | 229 | } |
| 225 | } | 230 | } |
| 226 | 231 | ||
| 232 | + onAutoRefresh() { | ||
| 233 | + if (this.navIndex != this.currentTopNavSelectedIndex) { | ||
| 234 | + return | ||
| 235 | + } | ||
| 236 | + // 当前页面,自动刷新数据 | ||
| 237 | + Logger.debug(TAG, 'page onAutoRefresh ' + this.autoRefresh) | ||
| 238 | + autoRefresh(this.pageModel, this.pageAdvModel) | ||
| 239 | + } | ||
| 240 | + | ||
| 227 | async getData() { | 241 | async getData() { |
| 228 | Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`); | 242 | Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`); |
| 229 | this.pageModel.pageId = this.pageId; | 243 | this.pageModel.pageId = this.pageId; |
| @@ -231,14 +245,6 @@ export struct PageComponent { | @@ -231,14 +245,6 @@ export struct PageComponent { | ||
| 231 | this.pageModel.channelId = this.channelId; | 245 | this.pageModel.channelId = this.channelId; |
| 232 | this.pageModel.currentPage = 1; | 246 | this.pageModel.currentPage = 1; |
| 233 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) | 247 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) |
| 234 | - // let pageInfo = await PageViewModel.getPageInfo(this.pageModel.pageId); | ||
| 235 | - // if (pageInfo == null) { | ||
| 236 | - // this.pageModel.viewType = ViewType.EMPTY; | ||
| 237 | - // return; | ||
| 238 | - // } | ||
| 239 | - // this.pageModel.pageInfo = pageInfo; | ||
| 240 | - // this.pageModel.loadStrategy = 1 | ||
| 241 | - // PageHelper.parseGroup(this.pageModel) | ||
| 242 | } | 248 | } |
| 243 | } | 249 | } |
| 244 | 250 |
| 1 | +import { RefreshConstants } from '../../utils/RefreshConstants' | ||
| 2 | +import { NoMoreBean } from './NoMoreBean'; | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * The No more data layout component. | ||
| 6 | + */ | ||
| 7 | +@Component | ||
| 8 | +export default struct PageNoMoreLayout { | ||
| 9 | + @ObjectLink noMoreBean: NoMoreBean; | ||
| 10 | + text: string | Resource = $r('app.string.footer_text') | ||
| 11 | + | ||
| 12 | + aboutToAppear(): void { | ||
| 13 | + if (this.noMoreBean && this.noMoreBean.text.length > 0) { | ||
| 14 | + this.text = this.noMoreBean.text | ||
| 15 | + } | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + build() { | ||
| 19 | + Row() { | ||
| 20 | + Text(this.text) | ||
| 21 | + .margin({ left: RefreshConstants.NoMoreLayoutConstant_NORMAL_PADDING }) | ||
| 22 | + .fontSize(RefreshConstants.NoMoreLayoutConstant_TITLE_FONT) | ||
| 23 | + .textAlign(TextAlign.Center) | ||
| 24 | + } | ||
| 25 | + .width(RefreshConstants.FULL_WIDTH) | ||
| 26 | + .justifyContent(FlexAlign.Center) | ||
| 27 | + .height(RefreshConstants.CUSTOM_LAYOUT_HEIGHT) | ||
| 28 | + } | ||
| 29 | +} |
| 1 | -import { Action, CompDTO, Params, TopNavDTO } from 'wdBean'; | ||
| 2 | -import { LazyDataSource, Logger, StringUtils } from 'wdKit'; | 1 | +import { CompDTO, TopNavDTO } from 'wdBean'; |
| 2 | +import { LazyDataSource, Logger } from 'wdKit'; | ||
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { PageComponent } from './PageComponent'; | 4 | import { PageComponent } from './PageComponent'; |
| 5 | import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; | 5 | import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; |
| 6 | import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; | 6 | import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; |
| 7 | -import window from '@ohos.window'; | ||
| 8 | -import { WindowModel } from 'wdKit'; | ||
| 9 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; | 7 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; |
| 10 | import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; | 8 | import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; |
| 11 | 9 | ||
| @@ -51,6 +49,12 @@ export struct TopNavigationComponent { | @@ -51,6 +49,12 @@ export struct TopNavigationComponent { | ||
| 51 | @State localChannelList: TopNavDTO[] = [] | 49 | @State localChannelList: TopNavDTO[] = [] |
| 52 | readonly MAX_LINE: number = 1; | 50 | readonly MAX_LINE: number = 1; |
| 53 | @ObjectLink @Watch('onAssignChannelChange') assignChannel: AssignChannelParam | 51 | @ObjectLink @Watch('onAssignChannelChange') assignChannel: AssignChannelParam |
| 52 | + // 底导传递过来的自动刷新通知 | ||
| 53 | + @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 | ||
| 54 | + // 传递给page的自动刷新通知 | ||
| 55 | + @State autoRefresh2Page: number = 0 | ||
| 56 | + // 当前底导index | ||
| 57 | + @State navIndex: number = 0 | ||
| 54 | 58 | ||
| 55 | //处理新闻tab顶导频道数据 | 59 | //处理新闻tab顶导频道数据 |
| 56 | topNavListHandle() { | 60 | topNavListHandle() { |
| @@ -201,6 +205,7 @@ export struct TopNavigationComponent { | @@ -201,6 +205,7 @@ export struct TopNavigationComponent { | ||
| 201 | navIndex: index, | 205 | navIndex: index, |
| 202 | pageId: navItem.pageId + '', | 206 | pageId: navItem.pageId + '', |
| 203 | channelId: navItem.channelId + '', | 207 | channelId: navItem.channelId + '', |
| 208 | + autoRefresh: this.autoRefresh2Page | ||
| 204 | }) | 209 | }) |
| 205 | } | 210 | } |
| 206 | } | 211 | } |
| @@ -311,6 +316,14 @@ export struct TopNavigationComponent { | @@ -311,6 +316,14 @@ export struct TopNavigationComponent { | ||
| 311 | Logger.info(TAG, `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); | 316 | Logger.info(TAG, `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); |
| 312 | } | 317 | } |
| 313 | 318 | ||
| 319 | + onAutoRefresh() { | ||
| 320 | + if (this.navIndex != this._currentNavIndex) { | ||
| 321 | + return | ||
| 322 | + } | ||
| 323 | + // 通知page刷新 | ||
| 324 | + this.autoRefresh2Page++ | ||
| 325 | + } | ||
| 326 | + | ||
| 314 | /** | 327 | /** |
| 315 | * 频道id变化,即指定频道跳转场景 | 328 | * 频道id变化,即指定频道跳转场景 |
| 316 | */ | 329 | */ |
| @@ -23,6 +23,9 @@ export struct SearchHotsComponent{ | @@ -23,6 +23,9 @@ export struct SearchHotsComponent{ | ||
| 23 | } | 23 | } |
| 24 | }).catch((err:Error)=>{ | 24 | }).catch((err:Error)=>{ |
| 25 | console.log(TAG,JSON.stringify(err)) | 25 | console.log(TAG,JSON.stringify(err)) |
| 26 | + if(this.searchHotsData.length === 0){ | ||
| 27 | + this.searchHotsData.push(new SearchHotContentItem("二十大",0,1)) | ||
| 28 | + } | ||
| 26 | }) | 29 | }) |
| 27 | } | 30 | } |
| 28 | 31 |
| @@ -29,6 +29,17 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | @@ -29,6 +29,17 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | ||
| 29 | .width(14) | 29 | .width(14) |
| 30 | .height(14) | 30 | .height(14) |
| 31 | } | 31 | } |
| 32 | + .visibility(this.compDTO?.objectType === '0' ? Visibility.None : Visibility.Visible) | ||
| 33 | + .onClick(() => { | ||
| 34 | + if (this.compDTO?.objectType === '11') { | ||
| 35 | + ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string) | ||
| 36 | + } else if (this.compDTO?.objectType === '5') { | ||
| 37 | + ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl) | ||
| 38 | + } else if (this.compDTO?.objectType === '6') { | ||
| 39 | + ProcessUtils._gotoDefaultWeb(this.compDTO.linkUrl) | ||
| 40 | + } | ||
| 41 | + }) | ||
| 42 | + | ||
| 32 | }.justifyContent(FlexAlign.SpaceBetween) | 43 | }.justifyContent(FlexAlign.SpaceBetween) |
| 33 | .padding({ left: 16, right: 16 }) | 44 | .padding({ left: 16, right: 16 }) |
| 34 | .margin({ top: 8, bottom: 8 }) | 45 | .margin({ top: 8, bottom: 8 }) |
| 1 | import { Logger } from 'wdKit/Index' | 1 | import { Logger } from 'wdKit/Index' |
| 2 | import { LikeViewModel } from '../../viewmodel/LikeViewModel' | 2 | import { LikeViewModel } from '../../viewmodel/LikeViewModel' |
| 3 | 3 | ||
| 4 | +const TAG = 'LikeComponent'; | ||
| 5 | + | ||
| 4 | @Component | 6 | @Component |
| 5 | export struct LikeComponent { | 7 | export struct LikeComponent { |
| 6 | @State likeStatus: boolean = false | 8 | @State likeStatus: boolean = false |
| @@ -15,17 +17,12 @@ export struct LikeComponent { | @@ -15,17 +17,12 @@ export struct LikeComponent { | ||
| 15 | // this.data['title'] = '开创两校交流先河!克罗地亚教育代表团访问同济大学' | 17 | // this.data['title'] = '开创两校交流先河!克罗地亚教育代表团访问同济大学' |
| 16 | // this.data['userHeaderUrl'] = "" | 18 | // this.data['userHeaderUrl'] = "" |
| 17 | // this.data['channelId'] = "2059" //必须 | 19 | // this.data['channelId'] = "2059" //必须 |
| 18 | - // this.data['status'] = "1" //必须 | 20 | + // this.data['status'] = "1" |
| 19 | 21 | ||
| 20 | aboutToAppear(): void { | 22 | aboutToAppear(): void { |
| 21 | if (this.data) { | 23 | if (this.data) { |
| 22 | - Logger.debug("ddd: " + this.data['status']) | ||
| 23 | - if (this.data['status'] == '1') { | ||
| 24 | - this.likeStatus = true | ||
| 25 | - } else { | ||
| 26 | - this.likeStatus = false | ||
| 27 | - } | ||
| 28 | - | 24 | + //获取点赞状态 |
| 25 | + this.getLikeStatus() | ||
| 29 | } | 26 | } |
| 30 | 27 | ||
| 31 | } | 28 | } |
| @@ -41,10 +38,10 @@ export struct LikeComponent { | @@ -41,10 +38,10 @@ export struct LikeComponent { | ||
| 41 | } | 38 | } |
| 42 | if (this.likeStatus) { | 39 | if (this.likeStatus) { |
| 43 | //1 | 40 | //1 |
| 44 | - this.executeLike('1') | 41 | + this.executeLike('0') |
| 45 | } else { | 42 | } else { |
| 46 | //0 | 43 | //0 |
| 47 | - this.executeLike('0') | 44 | + this.executeLike('1') |
| 48 | } | 45 | } |
| 49 | }) | 46 | }) |
| 50 | }.width(24).height(24) | 47 | }.width(24).height(24) |
| @@ -59,4 +56,18 @@ export struct LikeComponent { | @@ -59,4 +56,18 @@ export struct LikeComponent { | ||
| 59 | this.enableBtn = true | 56 | this.enableBtn = true |
| 60 | }) | 57 | }) |
| 61 | } | 58 | } |
| 59 | + | ||
| 60 | + getLikeStatus() { | ||
| 61 | + this.viewModel.getLikeStatus(this.data).then((data) => { | ||
| 62 | + if (data && data['data'].length && data['data'][0]['likeStatus']) { | ||
| 63 | + this.likeStatus = data['data'][0]['likeStatus'] | ||
| 64 | + }else { | ||
| 65 | + this.likeStatus = false | ||
| 66 | + } | ||
| 67 | + }).catch(() => { | ||
| 68 | + this.likeStatus = false | ||
| 69 | + }) | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + | ||
| 62 | } | 73 | } |
| @@ -12,6 +12,7 @@ import { | @@ -12,6 +12,7 @@ import { | ||
| 12 | import router from '@ohos.router'; | 12 | import router from '@ohos.router'; |
| 13 | import inputMethod from '@ohos.inputMethod'; | 13 | import inputMethod from '@ohos.inputMethod'; |
| 14 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; | 14 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; |
| 15 | +import { LikeComponent } from './LikeComponent'; | ||
| 15 | import { HttpUrlUtils } from 'wdNetwork/Index'; | 16 | import { HttpUrlUtils } from 'wdNetwork/Index'; |
| 16 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 17 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 17 | import { PageRepository } from '../../repository/PageRepository'; | 18 | import { PageRepository } from '../../repository/PageRepository'; |
| @@ -29,9 +30,11 @@ const TAG = 'OperRowListView'; | @@ -29,9 +30,11 @@ const TAG = 'OperRowListView'; | ||
| 29 | @Preview | 30 | @Preview |
| 30 | @Component | 31 | @Component |
| 31 | export struct OperRowListView { | 32 | export struct OperRowListView { |
| 32 | - private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 33 | + // private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 34 | + @Prop contentDetailData: ContentDetailDTO | ||
| 33 | @State interactData: InteractDataDTO = {} as InteractDataDTO | 35 | @State interactData: InteractDataDTO = {} as InteractDataDTO |
| 34 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 36 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 37 | + @State likeBean: Record<string, string> = {} | ||
| 35 | 38 | ||
| 36 | @State operationList: OperationItem[] = [ | 39 | @State operationList: OperationItem[] = [ |
| 37 | { | 40 | { |
| @@ -60,6 +63,20 @@ export struct OperRowListView { | @@ -60,6 +63,20 @@ export struct OperRowListView { | ||
| 60 | this.getInteractDataStatus() | 63 | this.getInteractDataStatus() |
| 61 | } | 64 | } |
| 62 | this.queryContentInteractCount() | 65 | this.queryContentInteractCount() |
| 66 | + // 点赞需要数据 | ||
| 67 | + // this.data['userName'] = '人民日报网友2kD2xW' | ||
| 68 | + // this.data['contentType'] = '8' //必须 | ||
| 69 | + // this.data['title'] = '开创两校交流先河!克罗地亚教育代表团访问同济大学' | ||
| 70 | + // this.data['userHeaderUrl'] = "" | ||
| 71 | + // this.data['channelId'] = "2059" //必须 | ||
| 72 | + // this.data['status'] = "1" //必须 | ||
| 73 | + this.likeBean['contentId'] = this.contentDetailData.newsId + '' | ||
| 74 | + this.likeBean['userName'] = this.contentDetailData.editorName + '' | ||
| 75 | + this.likeBean['contentType'] = this.contentDetailData.newsType + '' | ||
| 76 | + this.likeBean['title'] = this.contentDetailData.newsTitle + '' | ||
| 77 | + this.likeBean['userHeaderUrl'] = '' | ||
| 78 | + this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' | ||
| 79 | + this.likeBean['status'] = '' | ||
| 63 | } | 80 | } |
| 64 | 81 | ||
| 65 | build() { | 82 | build() { |
| @@ -83,7 +100,7 @@ export struct OperRowListView { | @@ -83,7 +100,7 @@ export struct OperRowListView { | ||
| 83 | .onClick(() => { | 100 | .onClick(() => { |
| 84 | router.back(); | 101 | router.back(); |
| 85 | }) | 102 | }) |
| 86 | - TextInput({placeholder:'说两句...'}) | 103 | + TextInput({placeholder:'说两句11...'}) |
| 87 | .placeholderColor('#999999') | 104 | .placeholderColor('#999999') |
| 88 | .placeholderFont( | 105 | .placeholderFont( |
| 89 | { | 106 | { |
| @@ -112,10 +129,9 @@ export struct OperRowListView { | @@ -112,10 +129,9 @@ export struct OperRowListView { | ||
| 112 | .width('54.5%') | 129 | .width('54.5%') |
| 113 | } | 130 | } |
| 114 | .width('100%') | 131 | .width('100%') |
| 115 | - .height(56) | 132 | + .height(126) |
| 116 | .backgroundColor(Color.Black) | 133 | .backgroundColor(Color.Black) |
| 117 | } | 134 | } |
| 118 | - | ||
| 119 | /** | 135 | /** |
| 120 | * 组件项 | 136 | * 组件项 |
| 121 | * | 137 | * |
| @@ -125,7 +141,11 @@ export struct OperRowListView { | @@ -125,7 +141,11 @@ export struct OperRowListView { | ||
| 125 | buildOperationItem(item: OperationItem, index: number) { | 141 | buildOperationItem(item: OperationItem, index: number) { |
| 126 | Column() { | 142 | Column() { |
| 127 | if (item.text === '点赞') { | 143 | if (item.text === '点赞') { |
| 128 | - RelativeContainer() { | 144 | + LikeComponent({ |
| 145 | + data: this.likeBean | ||
| 146 | + }) | ||
| 147 | + | ||
| 148 | + /* RelativeContainer() { | ||
| 129 | Row() { | 149 | Row() { |
| 130 | Image(this.newsStatusOfUser?.likeStatus == '1' ? item.icon_check : item.icon) | 150 | Image(this.newsStatusOfUser?.likeStatus == '1' ? item.icon_check : item.icon) |
| 131 | .width(24) | 151 | .width(24) |
| @@ -134,6 +154,7 @@ export struct OperRowListView { | @@ -134,6 +154,7 @@ export struct OperRowListView { | ||
| 134 | .interpolation(ImageInterpolation.High) | 154 | .interpolation(ImageInterpolation.High) |
| 135 | .onClick(() => { | 155 | .onClick(() => { |
| 136 | this.toggleLikeStatus() | 156 | this.toggleLikeStatus() |
| 157 | + console.log('点赞_111', JSON.stringify(this.contentDetailData)) | ||
| 137 | }) | 158 | }) |
| 138 | } | 159 | } |
| 139 | .alignRules({ | 160 | .alignRules({ |
| @@ -168,7 +189,7 @@ export struct OperRowListView { | @@ -168,7 +189,7 @@ export struct OperRowListView { | ||
| 168 | .id(`e_row3_${index}`) | 189 | .id(`e_row3_${index}`) |
| 169 | } | 190 | } |
| 170 | } | 191 | } |
| 171 | - .id(`e_icon_${index}`) | 192 | + .id(`e_icon_${index}`)*/ |
| 172 | } else if (item.text === '收藏') { | 193 | } else if (item.text === '收藏') { |
| 173 | RelativeContainer() { | 194 | RelativeContainer() { |
| 174 | Row() { | 195 | Row() { |
sight_harmony/features/wdComponent/src/main/ets/components/view/PermissionDesComponent.ets
0 → 100644
| 1 | +@Component | ||
| 2 | +export struct PermissionDesComponent { | ||
| 3 | + @State translateY: number = 0 | ||
| 4 | + | ||
| 5 | + aboutToAppear(): void { | ||
| 6 | + this.startDismiss() | ||
| 7 | + } | ||
| 8 | + | ||
| 9 | + build() { | ||
| 10 | + Column() { | ||
| 11 | + Row() { | ||
| 12 | + Image($r('app.media.tips')).width(20).height(20) | ||
| 13 | + Text("权限使用说明").fontColor('#FF222222').fontSize(14) | ||
| 14 | + .fontWeight(FontWeight.Bold) | ||
| 15 | + .margin({left:4}) | ||
| 16 | + }.height(26) | ||
| 17 | + | ||
| 18 | + Text("用于为你推荐你可能感兴趣的资讯内容及附近的相关信息,以提升浏览体验。不授权该权限不影响App正常使用。") | ||
| 19 | + .fontSize(14) | ||
| 20 | + .fontColor('#666666') | ||
| 21 | + } | ||
| 22 | + .translate({ y: this.translateY }) | ||
| 23 | + .animation({ | ||
| 24 | + duration: 400, | ||
| 25 | + curve: Curve.Linear, | ||
| 26 | + }) | ||
| 27 | + .alignItems(HorizontalAlign.Start) | ||
| 28 | + .width('90%') | ||
| 29 | + // .height(60) | ||
| 30 | + .backgroundColor('#FFFFFF') | ||
| 31 | + .border({ radius: 5 }) | ||
| 32 | + .margin({ top: 12 }) | ||
| 33 | + .padding(12) | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + startDismiss() { | ||
| 37 | + setTimeout(() => { | ||
| 38 | + this.translateY = -250 | ||
| 39 | + }, 4000) | ||
| 40 | + } | ||
| 41 | +} |
| 1 | import { HashMap } from '@kit.ArkTS'; | 1 | import { HashMap } from '@kit.ArkTS'; |
| 2 | import { Logger } from 'wdKit/Index'; | 2 | import { Logger } from 'wdKit/Index'; |
| 3 | -import { HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index'; | 3 | +import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index'; |
| 4 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | 4 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; |
| 5 | 5 | ||
| 6 | export class LikeModel { | 6 | export class LikeModel { |
| @@ -8,7 +8,7 @@ export class LikeModel { | @@ -8,7 +8,7 @@ export class LikeModel { | ||
| 8 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 8 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| 9 | 9 | ||
| 10 | return new Promise<object>((success, fail) => { | 10 | return new Promise<object>((success, fail) => { |
| 11 | - HttpRequest.post<ResponseDTO<object>>(HttpUrlUtils.executeLike(), data, headers).then((data: ResponseDTO<object>) => { | 11 | + HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.executeLike(), data, headers).then((data: ResponseDTO<object>) => { |
| 12 | if (data.code != 0) { | 12 | if (data.code != 0) { |
| 13 | fail(data.message) | 13 | fail(data.message) |
| 14 | return | 14 | return |
| @@ -20,4 +20,28 @@ export class LikeModel { | @@ -20,4 +20,28 @@ export class LikeModel { | ||
| 20 | }) | 20 | }) |
| 21 | }) | 21 | }) |
| 22 | } | 22 | } |
| 23 | + | ||
| 24 | + | ||
| 25 | + getLikeStatus(data: Record<string, string>) { | ||
| 26 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 27 | + let model : Record<string,Record<string,string>[]> = {} | ||
| 28 | + model['contentList'] = [data] | ||
| 29 | + | ||
| 30 | + return new Promise<object>((success, fail) => { | ||
| 31 | + HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.getLikeStatus(), model, headers).then((data: ResponseDTO<object>) => { | ||
| 32 | + if (data.code != 0) { | ||
| 33 | + fail(data.message) | ||
| 34 | + return | ||
| 35 | + } | ||
| 36 | + success(data) | ||
| 37 | + }, (error: Error) => { | ||
| 38 | + fail(error.message) | ||
| 39 | + Logger.debug("LoginViewModel:error ", error.toString()) | ||
| 40 | + }) | ||
| 41 | + }) | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + | ||
| 45 | + | ||
| 46 | + | ||
| 23 | } | 47 | } |
| @@ -118,7 +118,7 @@ class MinePageDatasModel{ | @@ -118,7 +118,7 @@ class MinePageDatasModel{ | ||
| 118 | Logger.info(TAG, `getAppointmentList start`); | 118 | Logger.info(TAG, `getAppointmentList start`); |
| 119 | this.fetchAppointmentListData(pageSize,pageNum).then((navResDTO: ResponseDTO<MineAppointmentListItem>) => { | 119 | this.fetchAppointmentListData(pageSize,pageNum).then((navResDTO: ResponseDTO<MineAppointmentListItem>) => { |
| 120 | if (!navResDTO || navResDTO.code != 0) { | 120 | if (!navResDTO || navResDTO.code != 0) { |
| 121 | - success(this.getAppointmentListDataLocal(context)) | 121 | + error(null) |
| 122 | return | 122 | return |
| 123 | } | 123 | } |
| 124 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 124 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -126,22 +126,11 @@ class MinePageDatasModel{ | @@ -126,22 +126,11 @@ class MinePageDatasModel{ | ||
| 126 | success(navigationBean); | 126 | success(navigationBean); |
| 127 | }).catch((err: Error) => { | 127 | }).catch((err: Error) => { |
| 128 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 128 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); |
| 129 | - success(this.getAppointmentListDataLocal(context)) | 129 | + error(null) |
| 130 | }) | 130 | }) |
| 131 | }) | 131 | }) |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | - async getAppointmentListDataLocal(context: Context): Promise<MineAppointmentListItem> { | ||
| 135 | - Logger.info(TAG, `getBottomNavDataMock start`); | ||
| 136 | - let compRes: ResponseDTO<MineAppointmentListItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineAppointmentListItem>>(context,'appointment_list_data.json' ); | ||
| 137 | - if (!compRes || !compRes.data) { | ||
| 138 | - Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`); | ||
| 139 | - return new MineAppointmentListItem() | ||
| 140 | - } | ||
| 141 | - Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 142 | - return compRes.data | ||
| 143 | - } | ||
| 144 | - | ||
| 145 | /** | 134 | /** |
| 146 | * 关注频道详情 | 135 | * 关注频道详情 |
| 147 | * @param pageSize | 136 | * @param pageSize |
| @@ -154,7 +143,7 @@ class MinePageDatasModel{ | @@ -154,7 +143,7 @@ class MinePageDatasModel{ | ||
| 154 | Logger.info(TAG, `getAppointmentList start`); | 143 | Logger.info(TAG, `getAppointmentList start`); |
| 155 | this.fetchFollowListDetailData(params).then((navResDTO: ResponseDTO<MineFollowListDetailItem>) => { | 144 | this.fetchFollowListDetailData(params).then((navResDTO: ResponseDTO<MineFollowListDetailItem>) => { |
| 156 | if (!navResDTO || navResDTO.code != 0) { | 145 | if (!navResDTO || navResDTO.code != 0) { |
| 157 | - success(this.getFollowListDetailDataLocal(context)) | 146 | + error(null) |
| 158 | return | 147 | return |
| 159 | } | 148 | } |
| 160 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 149 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -162,22 +151,11 @@ class MinePageDatasModel{ | @@ -162,22 +151,11 @@ class MinePageDatasModel{ | ||
| 162 | success(navigationBean); | 151 | success(navigationBean); |
| 163 | }).catch((err: Error) => { | 152 | }).catch((err: Error) => { |
| 164 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 153 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); |
| 165 | - success(this.getFollowListDetailDataLocal(context)) | 154 | + error(null) |
| 166 | }) | 155 | }) |
| 167 | }) | 156 | }) |
| 168 | } | 157 | } |
| 169 | 158 | ||
| 170 | - async getFollowListDetailDataLocal(context: Context): Promise<MineFollowListDetailItem> { | ||
| 171 | - Logger.info(TAG, `getBottomNavDataMock start`); | ||
| 172 | - let compRes: ResponseDTO<MineFollowListDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineFollowListDetailItem>>(context,'follow_list_detail_data_id120.json' ); | ||
| 173 | - if (!compRes || !compRes.data) { | ||
| 174 | - Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`); | ||
| 175 | - return new MineFollowListDetailItem() | ||
| 176 | - } | ||
| 177 | - Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 178 | - return compRes.data | ||
| 179 | - } | ||
| 180 | - | ||
| 181 | fetchFollowListDetailData(object:FollowListDetailRequestItem) { | 159 | fetchFollowListDetailData(object:FollowListDetailRequestItem) { |
| 182 | let url = HttpUrlUtils.getFollowListDetailDataUrl() | 160 | let url = HttpUrlUtils.getFollowListDetailDataUrl() |
| 183 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 161 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| @@ -199,7 +177,7 @@ class MinePageDatasModel{ | @@ -199,7 +177,7 @@ class MinePageDatasModel{ | ||
| 199 | Logger.info(TAG, `getAppointmentList start`); | 177 | Logger.info(TAG, `getAppointmentList start`); |
| 200 | this.fetchFollowListData().then((navResDTO: ResponseDTO<FollowListItem[]>) => { | 178 | this.fetchFollowListData().then((navResDTO: ResponseDTO<FollowListItem[]>) => { |
| 201 | if (!navResDTO || navResDTO.code != 0) { | 179 | if (!navResDTO || navResDTO.code != 0) { |
| 202 | - success(this.getFollowListDataLocal(context)) | 180 | + error(null) |
| 203 | return | 181 | return |
| 204 | } | 182 | } |
| 205 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 183 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -207,21 +185,11 @@ class MinePageDatasModel{ | @@ -207,21 +185,11 @@ class MinePageDatasModel{ | ||
| 207 | success(navigationBean); | 185 | success(navigationBean); |
| 208 | }).catch((err: Error) => { | 186 | }).catch((err: Error) => { |
| 209 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 187 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); |
| 210 | - success(this.getFollowListDataLocal(context)) | 188 | + error(null) |
| 211 | }) | 189 | }) |
| 212 | }) | 190 | }) |
| 213 | } | 191 | } |
| 214 | 192 | ||
| 215 | - async getFollowListDataLocal(context: Context): Promise<FollowListItem[]> { | ||
| 216 | - Logger.info(TAG, `getFollowListDataLocal start`); | ||
| 217 | - let compRes: ResponseDTO<FollowListItem[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<FollowListItem[]>>(context,'follow_list_data.json' ); | ||
| 218 | - if (!compRes || !compRes.data) { | ||
| 219 | - Logger.info(TAG, `getFollowListDataLocal compRes is empty`); | ||
| 220 | - return [] | ||
| 221 | - } | ||
| 222 | - Logger.info(TAG, `getFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 223 | - return compRes.data | ||
| 224 | - } | ||
| 225 | 193 | ||
| 226 | /** | 194 | /** |
| 227 | * 我的关注列表 | 195 | * 我的关注列表 |
| @@ -234,7 +202,7 @@ class MinePageDatasModel{ | @@ -234,7 +202,7 @@ class MinePageDatasModel{ | ||
| 234 | Logger.info(TAG, `getAppointmentList start`); | 202 | Logger.info(TAG, `getAppointmentList start`); |
| 235 | this.fetchMineDetailFollowListData(params).then((navResDTO: ResponseDTO<MineFollowListItem>) => { | 203 | this.fetchMineDetailFollowListData(params).then((navResDTO: ResponseDTO<MineFollowListItem>) => { |
| 236 | if (!navResDTO || navResDTO.code != 0) { | 204 | if (!navResDTO || navResDTO.code != 0) { |
| 237 | - success(this.getMineFollowListDataLocal(context)) | 205 | + error(null) |
| 238 | return | 206 | return |
| 239 | } | 207 | } |
| 240 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 208 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -242,7 +210,7 @@ class MinePageDatasModel{ | @@ -242,7 +210,7 @@ class MinePageDatasModel{ | ||
| 242 | success(navigationBean); | 210 | success(navigationBean); |
| 243 | }).catch((err: Error) => { | 211 | }).catch((err: Error) => { |
| 244 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 212 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); |
| 245 | - success(this.getMineFollowListDataLocal(context)) | 213 | + error(null) |
| 246 | }) | 214 | }) |
| 247 | }) | 215 | }) |
| 248 | } | 216 | } |
| @@ -253,17 +221,6 @@ class MinePageDatasModel{ | @@ -253,17 +221,6 @@ class MinePageDatasModel{ | ||
| 253 | return WDHttp.get<ResponseDTO<MineFollowListItem>>(url, headers) | 221 | return WDHttp.get<ResponseDTO<MineFollowListItem>>(url, headers) |
| 254 | }; | 222 | }; |
| 255 | 223 | ||
| 256 | - async getMineFollowListDataLocal(context: Context): Promise<MineFollowListItem> { | ||
| 257 | - Logger.info(TAG, `getMineFollowListDataLocal start`); | ||
| 258 | - let compRes: ResponseDTO<MineFollowListItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineFollowListItem>>(context,'mine_follow_list_data.json' ); | ||
| 259 | - if (!compRes || !compRes.data) { | ||
| 260 | - Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`); | ||
| 261 | - return new MineFollowListItem() | ||
| 262 | - } | ||
| 263 | - Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 264 | - return compRes.data | ||
| 265 | - } | ||
| 266 | - | ||
| 267 | /** | 224 | /** |
| 268 | * 查询是否被关注 列表 | 225 | * 查询是否被关注 列表 |
| 269 | * @param params | 226 | * @param params |
| @@ -275,7 +232,7 @@ class MinePageDatasModel{ | @@ -275,7 +232,7 @@ class MinePageDatasModel{ | ||
| 275 | Logger.info(TAG, `getAppointmentList start`); | 232 | Logger.info(TAG, `getAppointmentList start`); |
| 276 | this.fetchFollowListStatusData(params).then((navResDTO: ResponseDTO<QueryListIsFollowedItem[]>) => { | 233 | this.fetchFollowListStatusData(params).then((navResDTO: ResponseDTO<QueryListIsFollowedItem[]>) => { |
| 277 | if (!navResDTO || navResDTO.code != 0) { | 234 | if (!navResDTO || navResDTO.code != 0) { |
| 278 | - success(this.getFollowListStatusDataLocal(context)) | 235 | + error(null) |
| 279 | return | 236 | return |
| 280 | } | 237 | } |
| 281 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 238 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -283,7 +240,7 @@ class MinePageDatasModel{ | @@ -283,7 +240,7 @@ class MinePageDatasModel{ | ||
| 283 | success(navigationBean); | 240 | success(navigationBean); |
| 284 | }).catch((err: Error) => { | 241 | }).catch((err: Error) => { |
| 285 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 242 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); |
| 286 | - success(this.getFollowListStatusDataLocal(context)) | 243 | + error(null) |
| 287 | }) | 244 | }) |
| 288 | }) | 245 | }) |
| 289 | } | 246 | } |
| @@ -294,18 +251,6 @@ class MinePageDatasModel{ | @@ -294,18 +251,6 @@ class MinePageDatasModel{ | ||
| 294 | return WDHttp.post<ResponseDTO<QueryListIsFollowedItem[]>>(url,object, headers) | 251 | return WDHttp.post<ResponseDTO<QueryListIsFollowedItem[]>>(url,object, headers) |
| 295 | }; | 252 | }; |
| 296 | 253 | ||
| 297 | - async getFollowListStatusDataLocal(context: Context): Promise<QueryListIsFollowedItem[]> { | ||
| 298 | - Logger.info(TAG, `getMineFollowListDataLocal start`); | ||
| 299 | - let compRes: ResponseDTO<QueryListIsFollowedItem[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<QueryListIsFollowedItem[]>>(context,'follow_list_id120_isfocus_data.json' ); | ||
| 300 | - if (!compRes || !compRes.data) { | ||
| 301 | - Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`); | ||
| 302 | - return [] | ||
| 303 | - } | ||
| 304 | - Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 305 | - return compRes.data | ||
| 306 | - } | ||
| 307 | - | ||
| 308 | - | ||
| 309 | /** | 254 | /** |
| 310 | * 我的评论列表 | 255 | * 我的评论列表 |
| 311 | * @param params | 256 | * @param params |
| @@ -317,16 +262,15 @@ class MinePageDatasModel{ | @@ -317,16 +262,15 @@ class MinePageDatasModel{ | ||
| 317 | Logger.info(TAG, `getAppointmentList start`); | 262 | Logger.info(TAG, `getAppointmentList start`); |
| 318 | this.fetchMineCommentListData(time,params).then((navResDTO: ResponseDTO<MineCommentListDetailItem>) => { | 263 | this.fetchMineCommentListData(time,params).then((navResDTO: ResponseDTO<MineCommentListDetailItem>) => { |
| 319 | if (!navResDTO || navResDTO.code != 0) { | 264 | if (!navResDTO || navResDTO.code != 0) { |
| 320 | - success(this.getMineCommentListDataLocal(context)) | 265 | + error(null) |
| 321 | return | 266 | return |
| 322 | } | 267 | } |
| 323 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 268 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| 324 | let navigationBean = navResDTO.data as MineCommentListDetailItem | 269 | let navigationBean = navResDTO.data as MineCommentListDetailItem |
| 325 | success(navigationBean); | 270 | success(navigationBean); |
| 326 | - // success(this.getMineCommentListDataLocal(context)) | ||
| 327 | }).catch((err: Error) => { | 271 | }).catch((err: Error) => { |
| 328 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 272 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); |
| 329 | - success(this.getMineCommentListDataLocal(context)) | 273 | + error(null) |
| 330 | }) | 274 | }) |
| 331 | }) | 275 | }) |
| 332 | } | 276 | } |
| @@ -337,16 +281,6 @@ class MinePageDatasModel{ | @@ -337,16 +281,6 @@ class MinePageDatasModel{ | ||
| 337 | return WDHttp.get<ResponseDTO<MineCommentListDetailItem>>(url, headers) | 281 | return WDHttp.get<ResponseDTO<MineCommentListDetailItem>>(url, headers) |
| 338 | }; | 282 | }; |
| 339 | 283 | ||
| 340 | - async getMineCommentListDataLocal(context: Context): Promise<MineCommentListDetailItem> { | ||
| 341 | - Logger.info(TAG, `getMineFollowListDataLocal start`); | ||
| 342 | - let compRes: ResponseDTO<MineCommentListDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineCommentListDetailItem>>(context,'mine_comment_list_data2.json' ); | ||
| 343 | - if (!compRes || !compRes.data) { | ||
| 344 | - Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`); | ||
| 345 | - return new MineCommentListDetailItem() | ||
| 346 | - } | ||
| 347 | - Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 348 | - return compRes.data | ||
| 349 | - } | ||
| 350 | 284 | ||
| 351 | /** | 285 | /** |
| 352 | * 个人中心 获取用户等级 | 286 | * 个人中心 获取用户等级 |
| @@ -356,7 +290,7 @@ class MinePageDatasModel{ | @@ -356,7 +290,7 @@ class MinePageDatasModel{ | ||
| 356 | Logger.info(TAG, `getAppointmentList start`); | 290 | Logger.info(TAG, `getAppointmentList start`); |
| 357 | this.fetchMineUserLevelData().then((navResDTO: ResponseDTO<MineUserLevelItem>) => { | 291 | this.fetchMineUserLevelData().then((navResDTO: ResponseDTO<MineUserLevelItem>) => { |
| 358 | if (!navResDTO || navResDTO.code != 0) { | 292 | if (!navResDTO || navResDTO.code != 0) { |
| 359 | - success(this.getMineUserLevelDataLocal(context)) | 293 | + error(null) |
| 360 | return | 294 | return |
| 361 | } | 295 | } |
| 362 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 296 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -364,7 +298,7 @@ class MinePageDatasModel{ | @@ -364,7 +298,7 @@ class MinePageDatasModel{ | ||
| 364 | success(navigationBean); | 298 | success(navigationBean); |
| 365 | }).catch((err: Error) => { | 299 | }).catch((err: Error) => { |
| 366 | Logger.error(TAG, `fetchMineUserLevelData catch, error.name : ${err.name}, error.message:${err.message}`); | 300 | Logger.error(TAG, `fetchMineUserLevelData catch, error.name : ${err.name}, error.message:${err.message}`); |
| 367 | - success(this.getMineUserLevelDataLocal(context)) | 301 | + error(null) |
| 368 | }) | 302 | }) |
| 369 | }) | 303 | }) |
| 370 | } | 304 | } |
| @@ -376,17 +310,6 @@ class MinePageDatasModel{ | @@ -376,17 +310,6 @@ class MinePageDatasModel{ | ||
| 376 | return HttpBizUtil.get<ResponseDTO<MineUserLevelItem>>(url, headers) | 310 | return HttpBizUtil.get<ResponseDTO<MineUserLevelItem>>(url, headers) |
| 377 | }; | 311 | }; |
| 378 | 312 | ||
| 379 | - async getMineUserLevelDataLocal(context: Context): Promise<MineUserLevelItem> { | ||
| 380 | - Logger.info(TAG, `getMineUserLevelDataLocal start`); | ||
| 381 | - let compRes: ResponseDTO<MineUserLevelItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineUserLevelItem>>(context,'mine_user_level.json' ); | ||
| 382 | - if (!compRes || !compRes.data) { | ||
| 383 | - Logger.info(TAG, `getMineUserLevelDataLocal compRes is empty`); | ||
| 384 | - return new MineUserLevelItem() | ||
| 385 | - } | ||
| 386 | - Logger.info(TAG, `getMineUserLevelDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 387 | - return compRes.data | ||
| 388 | - } | ||
| 389 | - | ||
| 390 | /** | 313 | /** |
| 391 | * 个人中心 获取用户详细信息 | 314 | * 个人中心 获取用户详细信息 |
| 392 | */ | 315 | */ |
| @@ -395,7 +318,7 @@ class MinePageDatasModel{ | @@ -395,7 +318,7 @@ class MinePageDatasModel{ | ||
| 395 | Logger.info(TAG, `getAppointmentList start`); | 318 | Logger.info(TAG, `getAppointmentList start`); |
| 396 | this.fetchMineUserDetailData().then((navResDTO: ResponseDTO<MineUserDetailItem>) => { | 319 | this.fetchMineUserDetailData().then((navResDTO: ResponseDTO<MineUserDetailItem>) => { |
| 397 | if (!navResDTO || navResDTO.code != 0) { | 320 | if (!navResDTO || navResDTO.code != 0) { |
| 398 | - success(this.getMineUserDetailDataLocal(context)) | 321 | + error(null) |
| 399 | return | 322 | return |
| 400 | } | 323 | } |
| 401 | Logger.info(TAG, "getUserDetailData then,timeStamp:" + navResDTO.timestamp); | 324 | Logger.info(TAG, "getUserDetailData then,timeStamp:" + navResDTO.timestamp); |
| @@ -403,7 +326,7 @@ class MinePageDatasModel{ | @@ -403,7 +326,7 @@ class MinePageDatasModel{ | ||
| 403 | success(navigationBean); | 326 | success(navigationBean); |
| 404 | }).catch((err: Error) => { | 327 | }).catch((err: Error) => { |
| 405 | Logger.error(TAG, `fetchMineUserDetailData catch, error.name : ${err.name}, error.message:${err.message}`); | 328 | Logger.error(TAG, `fetchMineUserDetailData catch, error.name : ${err.name}, error.message:${err.message}`); |
| 406 | - success(this.getMineUserDetailDataLocal(context)) | 329 | + error(null) |
| 407 | }) | 330 | }) |
| 408 | }) | 331 | }) |
| 409 | } | 332 | } |
| @@ -415,16 +338,7 @@ class MinePageDatasModel{ | @@ -415,16 +338,7 @@ class MinePageDatasModel{ | ||
| 415 | return HttpBizUtil.get<ResponseDTO<MineUserDetailItem>>(url, headers) | 338 | return HttpBizUtil.get<ResponseDTO<MineUserDetailItem>>(url, headers) |
| 416 | }; | 339 | }; |
| 417 | 340 | ||
| 418 | - async getMineUserDetailDataLocal(context: Context): Promise<MineUserDetailItem> { | ||
| 419 | - Logger.info(TAG, `getMineUserLevelDataLocal start`); | ||
| 420 | - let compRes: ResponseDTO<MineUserDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineUserDetailItem>>(context,'mine_user_detail.json' ); | ||
| 421 | - if (!compRes || !compRes.data) { | ||
| 422 | - Logger.info(TAG, `getMineUserDetailDataLocal compRes is empty`); | ||
| 423 | - return new MineUserDetailItem() | ||
| 424 | - } | ||
| 425 | - Logger.info(TAG, `getMineUserDetailDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 426 | - return compRes.data | ||
| 427 | - } | 341 | + |
| 428 | /** | 342 | /** |
| 429 | * 个人中心 获取其他用户详细信息 | 343 | * 个人中心 获取其他用户详细信息 |
| 430 | */ | 344 | */ |
| @@ -433,7 +347,7 @@ class MinePageDatasModel{ | @@ -433,7 +347,7 @@ class MinePageDatasModel{ | ||
| 433 | Logger.info(TAG, `getAppointmentList start`); | 347 | Logger.info(TAG, `getAppointmentList start`); |
| 434 | this.fetchOtherUserDetailData(item).then((navResDTO: ResponseDTO<MineUserDetailItem>) => { | 348 | this.fetchOtherUserDetailData(item).then((navResDTO: ResponseDTO<MineUserDetailItem>) => { |
| 435 | if (!navResDTO || navResDTO.code != 0) { | 349 | if (!navResDTO || navResDTO.code != 0) { |
| 436 | - success(this.getOtherUserDetailDataLocal(context)) | 350 | + error(null) |
| 437 | return | 351 | return |
| 438 | } | 352 | } |
| 439 | Logger.info(TAG, "getUserDetailData then,timeStamp:" + navResDTO.timestamp); | 353 | Logger.info(TAG, "getUserDetailData then,timeStamp:" + navResDTO.timestamp); |
| @@ -441,7 +355,7 @@ class MinePageDatasModel{ | @@ -441,7 +355,7 @@ class MinePageDatasModel{ | ||
| 441 | success(navigationBean); | 355 | success(navigationBean); |
| 442 | }).catch((err: Error) => { | 356 | }).catch((err: Error) => { |
| 443 | Logger.error(TAG, `fetchMineUserDetailData catch, error.name : ${err.name}, error.message:${err.message}`); | 357 | Logger.error(TAG, `fetchMineUserDetailData catch, error.name : ${err.name}, error.message:${err.message}`); |
| 444 | - success(this.getOtherUserDetailDataLocal(context)) | 358 | + error(null) |
| 445 | }) | 359 | }) |
| 446 | }) | 360 | }) |
| 447 | } | 361 | } |
| @@ -452,17 +366,6 @@ class MinePageDatasModel{ | @@ -452,17 +366,6 @@ class MinePageDatasModel{ | ||
| 452 | return WDHttp.post<ResponseDTO<MineUserDetailItem>>(url, item,headers) | 366 | return WDHttp.post<ResponseDTO<MineUserDetailItem>>(url, item,headers) |
| 453 | }; | 367 | }; |
| 454 | 368 | ||
| 455 | - async getOtherUserDetailDataLocal(context: Context): Promise<MineUserDetailItem> { | ||
| 456 | - Logger.info(TAG, `getMineUserLevelDataLocal start`); | ||
| 457 | - let compRes: ResponseDTO<MineUserDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineUserDetailItem>>(context,'other_user512157124138245_detail.json' ); | ||
| 458 | - if (!compRes || !compRes.data) { | ||
| 459 | - Logger.info(TAG, `getMineUserDetailDataLocal compRes is empty`); | ||
| 460 | - return new MineUserDetailItem() | ||
| 461 | - } | ||
| 462 | - Logger.info(TAG, `getMineUserDetailDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 463 | - return compRes.data | ||
| 464 | - } | ||
| 465 | - | ||
| 466 | /** | 369 | /** |
| 467 | * 个人中心 获取其他用户等级 | 370 | * 个人中心 获取其他用户等级 |
| 468 | */ | 371 | */ |
| @@ -471,7 +374,7 @@ class MinePageDatasModel{ | @@ -471,7 +374,7 @@ class MinePageDatasModel{ | ||
| 471 | Logger.info(TAG, `getAppointmentList start`); | 374 | Logger.info(TAG, `getAppointmentList start`); |
| 472 | this.fetchOtherUserLevelData(item).then((navResDTO: ResponseDTO<MineUserLevelItem[]>) => { | 375 | this.fetchOtherUserLevelData(item).then((navResDTO: ResponseDTO<MineUserLevelItem[]>) => { |
| 473 | if (!navResDTO || navResDTO.code != 0) { | 376 | if (!navResDTO || navResDTO.code != 0) { |
| 474 | - success(this.getOtherUserLevelDataLocal(context)) | 377 | + error(null) |
| 475 | return | 378 | return |
| 476 | } | 379 | } |
| 477 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 380 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -479,11 +382,11 @@ class MinePageDatasModel{ | @@ -479,11 +382,11 @@ class MinePageDatasModel{ | ||
| 479 | if(navigationBean.length>0 && StringUtils.isNotEmpty(navigationBean[0].levelHead)){ | 382 | if(navigationBean.length>0 && StringUtils.isNotEmpty(navigationBean[0].levelHead)){ |
| 480 | success(navigationBean); | 383 | success(navigationBean); |
| 481 | }else{ | 384 | }else{ |
| 482 | - success(this.getOtherUserLevelDataLocal(context)) | 385 | + error(null) |
| 483 | } | 386 | } |
| 484 | }).catch((err: Error) => { | 387 | }).catch((err: Error) => { |
| 485 | Logger.error(TAG, `fetchMineUserLevelData catch, error.name : ${err.name}, error.message:${err.message}`); | 388 | Logger.error(TAG, `fetchMineUserLevelData catch, error.name : ${err.name}, error.message:${err.message}`); |
| 486 | - success(this.getOtherUserLevelDataLocal(context)) | 389 | + error(null) |
| 487 | }) | 390 | }) |
| 488 | }) | 391 | }) |
| 489 | } | 392 | } |
| @@ -494,17 +397,6 @@ class MinePageDatasModel{ | @@ -494,17 +397,6 @@ class MinePageDatasModel{ | ||
| 494 | return WDHttp.post<ResponseDTO<MineUserLevelItem[]>>(url,item, headers) | 397 | return WDHttp.post<ResponseDTO<MineUserLevelItem[]>>(url,item, headers) |
| 495 | }; | 398 | }; |
| 496 | 399 | ||
| 497 | - async getOtherUserLevelDataLocal(context: Context): Promise<MineUserLevelItem[]> { | ||
| 498 | - Logger.info(TAG, `getMineUserLevelDataLocal start`); | ||
| 499 | - let compRes: ResponseDTO<MineUserLevelItem[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineUserLevelItem[]>>(context,'other_user512157124138245_level.json' ); | ||
| 500 | - if (!compRes || !compRes.data) { | ||
| 501 | - Logger.info(TAG, `getMineUserLevelDataLocal compRes is empty`); | ||
| 502 | - return [] | ||
| 503 | - } | ||
| 504 | - Logger.info(TAG, `getMineUserLevelDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 505 | - return compRes.data | ||
| 506 | - } | ||
| 507 | - | ||
| 508 | /** | 400 | /** |
| 509 | * 其他用户的评论列表 | 401 | * 其他用户的评论列表 |
| 510 | * @param params | 402 | * @param params |
| @@ -516,7 +408,7 @@ class MinePageDatasModel{ | @@ -516,7 +408,7 @@ class MinePageDatasModel{ | ||
| 516 | Logger.info(TAG, `getAppointmentList start`); | 408 | Logger.info(TAG, `getAppointmentList start`); |
| 517 | this.fetchOtherCommentListData(params).then((navResDTO: ResponseDTO<MineCommentListDetailItem>) => { | 409 | this.fetchOtherCommentListData(params).then((navResDTO: ResponseDTO<MineCommentListDetailItem>) => { |
| 518 | if (!navResDTO || navResDTO.code != 0) { | 410 | if (!navResDTO || navResDTO.code != 0) { |
| 519 | - success(this.getOtherCommentListDataLocal(context)) | 411 | + error(null) |
| 520 | return | 412 | return |
| 521 | } | 413 | } |
| 522 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 414 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -524,7 +416,7 @@ class MinePageDatasModel{ | @@ -524,7 +416,7 @@ class MinePageDatasModel{ | ||
| 524 | success(navigationBean); | 416 | success(navigationBean); |
| 525 | }).catch((err: Error) => { | 417 | }).catch((err: Error) => { |
| 526 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 418 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); |
| 527 | - success(this.getOtherCommentListDataLocal(context)) | 419 | + error(null) |
| 528 | }) | 420 | }) |
| 529 | }) | 421 | }) |
| 530 | } | 422 | } |
| @@ -535,16 +427,6 @@ class MinePageDatasModel{ | @@ -535,16 +427,6 @@ class MinePageDatasModel{ | ||
| 535 | return WDHttp.get<ResponseDTO<MineCommentListDetailItem>>(url, headers) | 427 | return WDHttp.get<ResponseDTO<MineCommentListDetailItem>>(url, headers) |
| 536 | }; | 428 | }; |
| 537 | 429 | ||
| 538 | - async getOtherCommentListDataLocal(context: Context): Promise<MineCommentListDetailItem> { | ||
| 539 | - Logger.info(TAG, `getMineFollowListDataLocal start`); | ||
| 540 | - let compRes: ResponseDTO<MineCommentListDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineCommentListDetailItem>>(context,'other_user512157124138245_comment_list_data.json' ); | ||
| 541 | - if (!compRes || !compRes.data) { | ||
| 542 | - Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`); | ||
| 543 | - return new MineCommentListDetailItem() | ||
| 544 | - } | ||
| 545 | - Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 546 | - return compRes.data | ||
| 547 | - } | ||
| 548 | 430 | ||
| 549 | /** | 431 | /** |
| 550 | * 查询是否点赞了这条评论 | 432 | * 查询是否点赞了这条评论 |
| @@ -557,7 +439,7 @@ class MinePageDatasModel{ | @@ -557,7 +439,7 @@ class MinePageDatasModel{ | ||
| 557 | Logger.info(TAG, `getAppointmentList start`); | 439 | Logger.info(TAG, `getAppointmentList start`); |
| 558 | this.fetchOtherUserCommentLikeStatusData(params).then((navResDTO: ResponseDTO<QueryCommentListIsLikedItem[]>) => { | 440 | this.fetchOtherUserCommentLikeStatusData(params).then((navResDTO: ResponseDTO<QueryCommentListIsLikedItem[]>) => { |
| 559 | if (!navResDTO || navResDTO.code != 0) { | 441 | if (!navResDTO || navResDTO.code != 0) { |
| 560 | - success(this.getOtherUserCommentLikeStatusDataLocal(context)) | 442 | + error(null) |
| 561 | return | 443 | return |
| 562 | } | 444 | } |
| 563 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 445 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -565,7 +447,7 @@ class MinePageDatasModel{ | @@ -565,7 +447,7 @@ class MinePageDatasModel{ | ||
| 565 | success(navigationBean); | 447 | success(navigationBean); |
| 566 | }).catch((err: Error) => { | 448 | }).catch((err: Error) => { |
| 567 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 449 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); |
| 568 | - success(this.getOtherUserCommentLikeStatusDataLocal(context)) | 450 | + error(null) |
| 569 | }) | 451 | }) |
| 570 | }) | 452 | }) |
| 571 | } | 453 | } |
| @@ -576,17 +458,6 @@ class MinePageDatasModel{ | @@ -576,17 +458,6 @@ class MinePageDatasModel{ | ||
| 576 | return WDHttp.post<ResponseDTO<QueryCommentListIsLikedItem[]>>(url,object, headers) | 458 | return WDHttp.post<ResponseDTO<QueryCommentListIsLikedItem[]>>(url,object, headers) |
| 577 | }; | 459 | }; |
| 578 | 460 | ||
| 579 | - async getOtherUserCommentLikeStatusDataLocal(context: Context): Promise<QueryCommentListIsLikedItem[]> { | ||
| 580 | - Logger.info(TAG, `getMineFollowListDataLocal start`); | ||
| 581 | - let compRes: ResponseDTO<QueryCommentListIsLikedItem[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<QueryCommentListIsLikedItem[]>>(context,'other_user512157124138245_comment_list_liked_data.json' ); | ||
| 582 | - if (!compRes || !compRes.data) { | ||
| 583 | - Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`); | ||
| 584 | - return [] | ||
| 585 | - } | ||
| 586 | - Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 587 | - return compRes.data | ||
| 588 | - } | ||
| 589 | - | ||
| 590 | /** | 461 | /** |
| 591 | * 其他用户的关注列表 | 462 | * 其他用户的关注列表 |
| 592 | * @param params | 463 | * @param params |
| @@ -598,7 +469,7 @@ class MinePageDatasModel{ | @@ -598,7 +469,7 @@ class MinePageDatasModel{ | ||
| 598 | Logger.info(TAG, `getAppointmentList start`); | 469 | Logger.info(TAG, `getAppointmentList start`); |
| 599 | this.fetchOtherUserFollowListData(params).then((navResDTO: ResponseDTO<MineFollowListItem>) => { | 470 | this.fetchOtherUserFollowListData(params).then((navResDTO: ResponseDTO<MineFollowListItem>) => { |
| 600 | if (!navResDTO || navResDTO.code != 0) { | 471 | if (!navResDTO || navResDTO.code != 0) { |
| 601 | - success(this.getOtherUserFollowListDataLocal(context)) | 472 | + error(null) |
| 602 | return | 473 | return |
| 603 | } | 474 | } |
| 604 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 475 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -606,7 +477,7 @@ class MinePageDatasModel{ | @@ -606,7 +477,7 @@ class MinePageDatasModel{ | ||
| 606 | success(navigationBean); | 477 | success(navigationBean); |
| 607 | }).catch((err: Error) => { | 478 | }).catch((err: Error) => { |
| 608 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 479 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); |
| 609 | - success(this.getOtherUserFollowListDataLocal(context)) | 480 | + error(null) |
| 610 | }) | 481 | }) |
| 611 | }) | 482 | }) |
| 612 | } | 483 | } |
| @@ -617,17 +488,6 @@ class MinePageDatasModel{ | @@ -617,17 +488,6 @@ class MinePageDatasModel{ | ||
| 617 | return WDHttp.get<ResponseDTO<MineFollowListItem>>(url, headers) | 488 | return WDHttp.get<ResponseDTO<MineFollowListItem>>(url, headers) |
| 618 | }; | 489 | }; |
| 619 | 490 | ||
| 620 | - async getOtherUserFollowListDataLocal(context: Context): Promise<MineFollowListItem> { | ||
| 621 | - Logger.info(TAG, `getMineFollowListDataLocal start`); | ||
| 622 | - let compRes: ResponseDTO<MineFollowListItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineFollowListItem>>(context,'other_user_follow_list_data.json' ); | ||
| 623 | - if (!compRes || !compRes.data) { | ||
| 624 | - Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`); | ||
| 625 | - return new MineFollowListItem() | ||
| 626 | - } | ||
| 627 | - Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 628 | - return compRes.data | ||
| 629 | - } | ||
| 630 | - | ||
| 631 | /** | 491 | /** |
| 632 | * 预约 和取消预约操作 | 492 | * 预约 和取消预约操作 |
| 633 | * @param params | 493 | * @param params |
| @@ -639,14 +499,14 @@ class MinePageDatasModel{ | @@ -639,14 +499,14 @@ class MinePageDatasModel{ | ||
| 639 | Logger.info(TAG, `getAppointmentList start`); | 499 | Logger.info(TAG, `getAppointmentList start`); |
| 640 | this.fetchAppointmentOperation(params).then((navResDTO: ResponseDTO) => { | 500 | this.fetchAppointmentOperation(params).then((navResDTO: ResponseDTO) => { |
| 641 | if (!navResDTO || navResDTO.code != 0) { | 501 | if (!navResDTO || navResDTO.code != 0) { |
| 642 | - success(this.getAppointmentOperationLocal(context)) | 502 | + error(null) |
| 643 | return | 503 | return |
| 644 | } | 504 | } |
| 645 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 505 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| 646 | success(navResDTO); | 506 | success(navResDTO); |
| 647 | }).catch((err: Error) => { | 507 | }).catch((err: Error) => { |
| 648 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 508 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); |
| 649 | - success(this.getAppointmentOperationLocal(context)) | 509 | + error(null) |
| 650 | }) | 510 | }) |
| 651 | }) | 511 | }) |
| 652 | } | 512 | } |
| @@ -657,18 +517,6 @@ class MinePageDatasModel{ | @@ -657,18 +517,6 @@ class MinePageDatasModel{ | ||
| 657 | return WDHttp.post<ResponseDTO>(url,object, headers) | 517 | return WDHttp.post<ResponseDTO>(url,object, headers) |
| 658 | }; | 518 | }; |
| 659 | 519 | ||
| 660 | - async getAppointmentOperationLocal(context: Context): Promise<ResponseDTO> { | ||
| 661 | - Logger.info(TAG, `getMineFollowListDataLocal start`); | ||
| 662 | - let compRes: ResponseDTO | null = await ResourcesUtils.getResourcesJson<ResponseDTO>(context,'appointment_operation_data.json'); | ||
| 663 | - if (!compRes ) { | ||
| 664 | - Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`); | ||
| 665 | - return compRes | ||
| 666 | - } | ||
| 667 | - Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 668 | - return compRes | ||
| 669 | - } | ||
| 670 | - | ||
| 671 | - | ||
| 672 | /** | 520 | /** |
| 673 | * 评论点赞操作 | 521 | * 评论点赞操作 |
| 674 | * @param params | 522 | * @param params |
| @@ -680,14 +528,14 @@ class MinePageDatasModel{ | @@ -680,14 +528,14 @@ class MinePageDatasModel{ | ||
| 680 | Logger.info(TAG, `getAppointmentList start`); | 528 | Logger.info(TAG, `getAppointmentList start`); |
| 681 | this.fetchCommentLikeOperation(params).then((navResDTO: ResponseDTO) => { | 529 | this.fetchCommentLikeOperation(params).then((navResDTO: ResponseDTO) => { |
| 682 | if (!navResDTO || navResDTO.code != 0) { | 530 | if (!navResDTO || navResDTO.code != 0) { |
| 683 | - success(this.getCommentLikeOperationLocal(context)) | 531 | + error(null) |
| 684 | return | 532 | return |
| 685 | } | 533 | } |
| 686 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 534 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| 687 | success(navResDTO); | 535 | success(navResDTO); |
| 688 | }).catch((err: Error) => { | 536 | }).catch((err: Error) => { |
| 689 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 537 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); |
| 690 | - success(this.getCommentLikeOperationLocal(context)) | 538 | + error(null) |
| 691 | }) | 539 | }) |
| 692 | }) | 540 | }) |
| 693 | } | 541 | } |
| @@ -698,17 +546,6 @@ class MinePageDatasModel{ | @@ -698,17 +546,6 @@ class MinePageDatasModel{ | ||
| 698 | return WDHttp.post<ResponseDTO>(url,object, headers) | 546 | return WDHttp.post<ResponseDTO>(url,object, headers) |
| 699 | }; | 547 | }; |
| 700 | 548 | ||
| 701 | - async getCommentLikeOperationLocal(context: Context): Promise<ResponseDTO> { | ||
| 702 | - Logger.info(TAG, `getMineFollowListDataLocal start`); | ||
| 703 | - let compRes: ResponseDTO | null = await ResourcesUtils.getResourcesJson<ResponseDTO>(context,'comment_like_operation_data.json'); | ||
| 704 | - if (!compRes ) { | ||
| 705 | - Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`); | ||
| 706 | - return compRes | ||
| 707 | - } | ||
| 708 | - Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 709 | - return compRes | ||
| 710 | - } | ||
| 711 | - | ||
| 712 | /** | 549 | /** |
| 713 | * 关注 取消关注 操作 | 550 | * 关注 取消关注 操作 |
| 714 | * @param params | 551 | * @param params |
| @@ -720,14 +557,14 @@ class MinePageDatasModel{ | @@ -720,14 +557,14 @@ class MinePageDatasModel{ | ||
| 720 | Logger.info(TAG, `getAppointmentList start`); | 557 | Logger.info(TAG, `getAppointmentList start`); |
| 721 | this.fetchFollowOperation(params).then((navResDTO: ResponseDTO) => { | 558 | this.fetchFollowOperation(params).then((navResDTO: ResponseDTO) => { |
| 722 | if (!navResDTO || navResDTO.code != 0) { | 559 | if (!navResDTO || navResDTO.code != 0) { |
| 723 | - success(this.getFollowOperationLocal(context)) | 560 | + error(null) |
| 724 | return | 561 | return |
| 725 | } | 562 | } |
| 726 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 563 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| 727 | success(navResDTO); | 564 | success(navResDTO); |
| 728 | }).catch((err: Error) => { | 565 | }).catch((err: Error) => { |
| 729 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 566 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); |
| 730 | - success(this.getFollowOperationLocal(context)) | 567 | + error(null) |
| 731 | }) | 568 | }) |
| 732 | }) | 569 | }) |
| 733 | } | 570 | } |
| @@ -738,17 +575,6 @@ class MinePageDatasModel{ | @@ -738,17 +575,6 @@ class MinePageDatasModel{ | ||
| 738 | return WDHttp.post<ResponseDTO>(url,object, headers) | 575 | return WDHttp.post<ResponseDTO>(url,object, headers) |
| 739 | }; | 576 | }; |
| 740 | 577 | ||
| 741 | - async getFollowOperationLocal(context: Context): Promise<ResponseDTO> { | ||
| 742 | - Logger.info(TAG, `getMineFollowListDataLocal start`); | ||
| 743 | - let compRes: ResponseDTO | null = await ResourcesUtils.getResourcesJson<ResponseDTO>(context,'follow_operation_data.json'); | ||
| 744 | - if (!compRes ) { | ||
| 745 | - Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`); | ||
| 746 | - return compRes | ||
| 747 | - } | ||
| 748 | - Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 749 | - return compRes | ||
| 750 | - } | ||
| 751 | - | ||
| 752 | 578 | ||
| 753 | } | 579 | } |
| 754 | 580 |
| @@ -100,7 +100,7 @@ class SearcherAboutDataModel{ | @@ -100,7 +100,7 @@ class SearcherAboutDataModel{ | ||
| 100 | Logger.info(TAG, `getSearchHintData start`); | 100 | Logger.info(TAG, `getSearchHintData start`); |
| 101 | this.fetchSearchHintData().then((navResDTO: ResponseDTO<string[]>) => { | 101 | this.fetchSearchHintData().then((navResDTO: ResponseDTO<string[]>) => { |
| 102 | if (!navResDTO || navResDTO.code != 0) { | 102 | if (!navResDTO || navResDTO.code != 0) { |
| 103 | - success(this.getSearchHintDataLocal(context)) | 103 | + error(null) |
| 104 | return | 104 | return |
| 105 | } | 105 | } |
| 106 | Logger.info(TAG, "getSearchHintData then,SearchHintDataResDTO.timeStamp:" + navResDTO.timestamp); | 106 | Logger.info(TAG, "getSearchHintData then,SearchHintDataResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -108,7 +108,7 @@ class SearcherAboutDataModel{ | @@ -108,7 +108,7 @@ class SearcherAboutDataModel{ | ||
| 108 | success(navigationBean); | 108 | success(navigationBean); |
| 109 | }).catch((err: Error) => { | 109 | }).catch((err: Error) => { |
| 110 | Logger.error(TAG, `fetchSearchHintData catch, error.name : ${err.name}, error.message:${err.message}`); | 110 | Logger.error(TAG, `fetchSearchHintData catch, error.name : ${err.name}, error.message:${err.message}`); |
| 111 | - success(this.getSearchHintDataLocal(context)) | 111 | + error(null) |
| 112 | }) | 112 | }) |
| 113 | }) | 113 | }) |
| 114 | } | 114 | } |
| @@ -119,17 +119,6 @@ class SearcherAboutDataModel{ | @@ -119,17 +119,6 @@ class SearcherAboutDataModel{ | ||
| 119 | return WDHttp.get<ResponseDTO<string[]>>(url, headers) | 119 | return WDHttp.get<ResponseDTO<string[]>>(url, headers) |
| 120 | }; | 120 | }; |
| 121 | 121 | ||
| 122 | - async getSearchHintDataLocal(context: Context): Promise<string[]> { | ||
| 123 | - Logger.info(TAG, `getSearchHintDataLocal start`); | ||
| 124 | - let compRes: ResponseDTO<string[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<string[]>>(context,'search_hint_data.json' ); | ||
| 125 | - if (!compRes || !compRes.data) { | ||
| 126 | - Logger.info(TAG, `getSearchHintDataLocal compRes is empty`); | ||
| 127 | - return [] | ||
| 128 | - } | ||
| 129 | - Logger.info(TAG, `getSearchHintDataLocal compRes : ${JSON.stringify(compRes)}`); | ||
| 130 | - return compRes.data | ||
| 131 | - } | ||
| 132 | - | ||
| 133 | 122 | ||
| 134 | /** | 123 | /** |
| 135 | * 搜索主页 热词 | 124 | * 搜索主页 热词 |
| @@ -139,7 +128,7 @@ class SearcherAboutDataModel{ | @@ -139,7 +128,7 @@ class SearcherAboutDataModel{ | ||
| 139 | Logger.info(TAG, `getSearchHintData start`); | 128 | Logger.info(TAG, `getSearchHintData start`); |
| 140 | this.fetchSearchHotsData().then((navResDTO: ResponseDTO<SearchHotContentItem[]>) => { | 129 | this.fetchSearchHotsData().then((navResDTO: ResponseDTO<SearchHotContentItem[]>) => { |
| 141 | if (!navResDTO || navResDTO.code != 0) { | 130 | if (!navResDTO || navResDTO.code != 0) { |
| 142 | - success(this.getSearchHotsDataLocal(context)) | 131 | + error(null) |
| 143 | return | 132 | return |
| 144 | } | 133 | } |
| 145 | Logger.info(TAG, "getSearchHotsData then,getSearchHotsData.timeStamp:" + navResDTO.timestamp); | 134 | Logger.info(TAG, "getSearchHotsData then,getSearchHotsData.timeStamp:" + navResDTO.timestamp); |
| @@ -147,7 +136,7 @@ class SearcherAboutDataModel{ | @@ -147,7 +136,7 @@ class SearcherAboutDataModel{ | ||
| 147 | success(navigationBean); | 136 | success(navigationBean); |
| 148 | }).catch((err: Error) => { | 137 | }).catch((err: Error) => { |
| 149 | Logger.error(TAG, `getSearchHotsData catch, error.name : ${err.name}, error.message:${err.message}`); | 138 | Logger.error(TAG, `getSearchHotsData catch, error.name : ${err.name}, error.message:${err.message}`); |
| 150 | - success(this.getSearchHotsDataLocal(context)) | 139 | + error(null) |
| 151 | }) | 140 | }) |
| 152 | }) | 141 | }) |
| 153 | } | 142 | } |
| @@ -158,18 +147,6 @@ class SearcherAboutDataModel{ | @@ -158,18 +147,6 @@ class SearcherAboutDataModel{ | ||
| 158 | return WDHttp.get<ResponseDTO<SearchHotContentItem[]>>(url, headers) | 147 | return WDHttp.get<ResponseDTO<SearchHotContentItem[]>>(url, headers) |
| 159 | }; | 148 | }; |
| 160 | 149 | ||
| 161 | - async getSearchHotsDataLocal(context: Context): Promise<SearchHotContentItem[]> { | ||
| 162 | - Logger.info(TAG, `getSearchHotsDataLocal start`); | ||
| 163 | - let compRes: ResponseDTO<SearchHotContentItem[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<SearchHotContentItem[]>>(context,'search_hots_data.json' ,); | ||
| 164 | - if (!compRes || !compRes.data) { | ||
| 165 | - Logger.info(TAG, `getSearchHotsDataLocal compRes is empty`); | ||
| 166 | - return [] | ||
| 167 | - } | ||
| 168 | - Logger.info(TAG, `getSearchHotsDataLocal compRes : ${JSON.stringify(compRes)}`); | ||
| 169 | - return compRes.data | ||
| 170 | - } | ||
| 171 | - | ||
| 172 | - | ||
| 173 | /** | 150 | /** |
| 174 | * 搜索 联想词 | 151 | * 搜索 联想词 |
| 175 | */ | 152 | */ |
| @@ -178,7 +155,7 @@ class SearcherAboutDataModel{ | @@ -178,7 +155,7 @@ class SearcherAboutDataModel{ | ||
| 178 | Logger.info(TAG, `getSearchHintData start`); | 155 | Logger.info(TAG, `getSearchHintData start`); |
| 179 | this.fetchRelatedSearchContentData(keyword).then((navResDTO: ResponseDTO<string[]>) => { | 156 | this.fetchRelatedSearchContentData(keyword).then((navResDTO: ResponseDTO<string[]>) => { |
| 180 | if (!navResDTO || navResDTO.code != 0) { | 157 | if (!navResDTO || navResDTO.code != 0) { |
| 181 | - success(this.getRelatedSearchContentDataLocal(context)) | 158 | + error(null) |
| 182 | return | 159 | return |
| 183 | } | 160 | } |
| 184 | Logger.info(TAG, "getSearchHintData then,SearchHintDataResDTO.timeStamp:" + navResDTO.timestamp); | 161 | Logger.info(TAG, "getSearchHintData then,SearchHintDataResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -186,7 +163,7 @@ class SearcherAboutDataModel{ | @@ -186,7 +163,7 @@ class SearcherAboutDataModel{ | ||
| 186 | success(navigationBean); | 163 | success(navigationBean); |
| 187 | }).catch((err: Error) => { | 164 | }).catch((err: Error) => { |
| 188 | Logger.error(TAG, `fetchSearchHintData catch, error.name : ${err.name}, error.message:${err.message}`); | 165 | Logger.error(TAG, `fetchSearchHintData catch, error.name : ${err.name}, error.message:${err.message}`); |
| 189 | - success(this.getRelatedSearchContentDataLocal(context)) | 166 | + error(null) |
| 190 | }) | 167 | }) |
| 191 | }) | 168 | }) |
| 192 | } | 169 | } |
| @@ -197,17 +174,6 @@ class SearcherAboutDataModel{ | @@ -197,17 +174,6 @@ class SearcherAboutDataModel{ | ||
| 197 | return WDHttp.get<ResponseDTO<string[]>>(url, headers) | 174 | return WDHttp.get<ResponseDTO<string[]>>(url, headers) |
| 198 | }; | 175 | }; |
| 199 | 176 | ||
| 200 | - async getRelatedSearchContentDataLocal(context: Context): Promise<string[]> { | ||
| 201 | - Logger.info(TAG, `getSearchHintDataLocal start`); | ||
| 202 | - let compRes: ResponseDTO<string[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<string[]>>(context,'search_related_data_nimen.json' ); | ||
| 203 | - if (!compRes || !compRes.data) { | ||
| 204 | - Logger.info(TAG, `getSearchHintDataLocal compRes is empty`); | ||
| 205 | - return [] | ||
| 206 | - } | ||
| 207 | - Logger.info(TAG, `getSearchHintDataLocal compRes : ${JSON.stringify(compRes)}`); | ||
| 208 | - return compRes.data | ||
| 209 | - } | ||
| 210 | - | ||
| 211 | /** | 177 | /** |
| 212 | * 搜索结果 展示tab数量 | 178 | * 搜索结果 展示tab数量 |
| 213 | */ | 179 | */ |
| @@ -216,7 +182,7 @@ class SearcherAboutDataModel{ | @@ -216,7 +182,7 @@ class SearcherAboutDataModel{ | ||
| 216 | Logger.info(TAG, `getSearchResultCountData start`); | 182 | Logger.info(TAG, `getSearchResultCountData start`); |
| 217 | this.fetchSearchResultCountData(keyword).then((navResDTO: ResponseDTO<SearchResultCountItem>) => { | 183 | this.fetchSearchResultCountData(keyword).then((navResDTO: ResponseDTO<SearchResultCountItem>) => { |
| 218 | if (!navResDTO || navResDTO.code != 0) { | 184 | if (!navResDTO || navResDTO.code != 0) { |
| 219 | - success(this.getSearchResultCountDataLocal(context)) | 185 | + error(null) |
| 220 | return | 186 | return |
| 221 | } | 187 | } |
| 222 | Logger.info(TAG, "getSearchResultCountData then,SearchHintDataResDTO.timeStamp:" + navResDTO.timestamp); | 188 | Logger.info(TAG, "getSearchResultCountData then,SearchHintDataResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -224,7 +190,7 @@ class SearcherAboutDataModel{ | @@ -224,7 +190,7 @@ class SearcherAboutDataModel{ | ||
| 224 | success(navigationBean); | 190 | success(navigationBean); |
| 225 | }).catch((err: Error) => { | 191 | }).catch((err: Error) => { |
| 226 | Logger.error(TAG, `getSearchResultCountData catch, error.name : ${err.name}, error.message:${err.message}`); | 192 | Logger.error(TAG, `getSearchResultCountData catch, error.name : ${err.name}, error.message:${err.message}`); |
| 227 | - success(this.getSearchResultCountDataLocal(context)) | 193 | + error(null) |
| 228 | }) | 194 | }) |
| 229 | }) | 195 | }) |
| 230 | } | 196 | } |
| @@ -235,17 +201,6 @@ class SearcherAboutDataModel{ | @@ -235,17 +201,6 @@ class SearcherAboutDataModel{ | ||
| 235 | return WDHttp.get<ResponseDTO<SearchResultCountItem>>(url, headers) | 201 | return WDHttp.get<ResponseDTO<SearchResultCountItem>>(url, headers) |
| 236 | }; | 202 | }; |
| 237 | 203 | ||
| 238 | - async getSearchResultCountDataLocal(context: Context): Promise<SearchResultCountItem> { | ||
| 239 | - Logger.info(TAG, `getSearchResultCountDataLocal start`); | ||
| 240 | - let compRes: ResponseDTO<SearchResultCountItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<SearchResultCountItem>>(context,'search_result_count_data.json' ); | ||
| 241 | - if (!compRes || !compRes.data) { | ||
| 242 | - Logger.info(TAG, `getSearchResultCountDataLocal compRes is empty`); | ||
| 243 | - return new SearchResultCountItem() | ||
| 244 | - } | ||
| 245 | - Logger.info(TAG, `getSearchResultCountDataLocal compRes : ${JSON.stringify(compRes)}`); | ||
| 246 | - return compRes.data | ||
| 247 | - } | ||
| 248 | - | ||
| 249 | /** | 204 | /** |
| 250 | * 搜索结果 展示列表 | 205 | * 搜索结果 展示列表 |
| 251 | */ | 206 | */ |
| @@ -254,7 +209,7 @@ class SearcherAboutDataModel{ | @@ -254,7 +209,7 @@ class SearcherAboutDataModel{ | ||
| 254 | Logger.info(TAG, `getSearchResultListData start`); | 209 | Logger.info(TAG, `getSearchResultListData start`); |
| 255 | this.fetchSearchResultListData(pageSize,pageNum,searchType,keyword).then((navResDTO: ResponseDTO<SearchResultContentData>) => { | 210 | this.fetchSearchResultListData(pageSize,pageNum,searchType,keyword).then((navResDTO: ResponseDTO<SearchResultContentData>) => { |
| 256 | if (!navResDTO || navResDTO.code != 0) { | 211 | if (!navResDTO || navResDTO.code != 0) { |
| 257 | - success(this.getSearchResultListDataLocal(context)) | 212 | + error(null) |
| 258 | return | 213 | return |
| 259 | } | 214 | } |
| 260 | Logger.info(TAG, "getSearchResultListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp); | 215 | Logger.info(TAG, "getSearchResultListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -262,7 +217,7 @@ class SearcherAboutDataModel{ | @@ -262,7 +217,7 @@ class SearcherAboutDataModel{ | ||
| 262 | success(navigationBean); | 217 | success(navigationBean); |
| 263 | }).catch((err: Error) => { | 218 | }).catch((err: Error) => { |
| 264 | Logger.error(TAG, `getSearchResultListData catch, error.name : ${err.name}, error.message:${err.message}`); | 219 | Logger.error(TAG, `getSearchResultListData catch, error.name : ${err.name}, error.message:${err.message}`); |
| 265 | - success(this.getSearchResultListDataLocal(context)) | 220 | + error(null) |
| 266 | }) | 221 | }) |
| 267 | }) | 222 | }) |
| 268 | } | 223 | } |
| @@ -273,17 +228,6 @@ class SearcherAboutDataModel{ | @@ -273,17 +228,6 @@ class SearcherAboutDataModel{ | ||
| 273 | return WDHttp.get<ResponseDTO<SearchResultContentData>>(url, headers) | 228 | return WDHttp.get<ResponseDTO<SearchResultContentData>>(url, headers) |
| 274 | }; | 229 | }; |
| 275 | 230 | ||
| 276 | - async getSearchResultListDataLocal(context: Context): Promise<SearchResultContentData> { | ||
| 277 | - Logger.info(TAG, `getSearchResultListDataLocal start`); | ||
| 278 | - let compRes: ResponseDTO<SearchResultContentData> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<SearchResultContentData>>(context,'search_result_list_data.json' ); | ||
| 279 | - if (!compRes || !compRes.data) { | ||
| 280 | - Logger.info(TAG, `getSearchResultListDataLocal compRes is empty`); | ||
| 281 | - return new SearchResultContentData() | ||
| 282 | - } | ||
| 283 | - Logger.info(TAG, `getSearchResultListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 284 | - return compRes.data | ||
| 285 | - } | ||
| 286 | - | ||
| 287 | /** | 231 | /** |
| 288 | * 搜索结果 展示列表(交互详情 评论收藏点赞分享数量) | 232 | * 搜索结果 展示列表(交互详情 评论收藏点赞分享数量) |
| 289 | */ | 233 | */ |
| @@ -292,7 +236,7 @@ class SearcherAboutDataModel{ | @@ -292,7 +236,7 @@ class SearcherAboutDataModel{ | ||
| 292 | Logger.info(TAG, `getInteractListData start`); | 236 | Logger.info(TAG, `getInteractListData start`); |
| 293 | this.fetchInteractListData(data).then((navResDTO: ResponseDTO<InteractDataDTO[]>) => { | 237 | this.fetchInteractListData(data).then((navResDTO: ResponseDTO<InteractDataDTO[]>) => { |
| 294 | if (!navResDTO || navResDTO.code != 0) { | 238 | if (!navResDTO || navResDTO.code != 0) { |
| 295 | - success(this.getInteractListDataLocal(context)) | 239 | + error(null) |
| 296 | return | 240 | return |
| 297 | } | 241 | } |
| 298 | Logger.info(TAG, "getInteractListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp); | 242 | Logger.info(TAG, "getInteractListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -300,7 +244,7 @@ class SearcherAboutDataModel{ | @@ -300,7 +244,7 @@ class SearcherAboutDataModel{ | ||
| 300 | success(navigationBean); | 244 | success(navigationBean); |
| 301 | }).catch((err: Error) => { | 245 | }).catch((err: Error) => { |
| 302 | Logger.error(TAG, `getInteractListData catch, error.name : ${err.name}, error.message:${err.message}`); | 246 | Logger.error(TAG, `getInteractListData catch, error.name : ${err.name}, error.message:${err.message}`); |
| 303 | - success(this.getInteractListDataLocal(context)) | 247 | + error(null) |
| 304 | }) | 248 | }) |
| 305 | }) | 249 | }) |
| 306 | } | 250 | } |
| @@ -311,18 +255,6 @@ class SearcherAboutDataModel{ | @@ -311,18 +255,6 @@ class SearcherAboutDataModel{ | ||
| 311 | return WDHttp.post<ResponseDTO<InteractDataDTO[]>>(url,data, headers) | 255 | return WDHttp.post<ResponseDTO<InteractDataDTO[]>>(url,data, headers) |
| 312 | }; | 256 | }; |
| 313 | 257 | ||
| 314 | - async getInteractListDataLocal(context: Context): Promise<InteractDataDTO[]> { | ||
| 315 | - Logger.info(TAG, `getInteractListDataLocal start`); | ||
| 316 | - let compRes: ResponseDTO<InteractDataDTO[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<InteractDataDTO[]>>(context,'search_result_interact_list_data.json' ); | ||
| 317 | - if (!compRes || !compRes.data) { | ||
| 318 | - Logger.info(TAG, `getInteractListDataLocal compRes is empty`); | ||
| 319 | - return [] | ||
| 320 | - } | ||
| 321 | - Logger.info(TAG, `getInteractListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 322 | - return compRes.data | ||
| 323 | - } | ||
| 324 | - | ||
| 325 | - | ||
| 326 | /** | 258 | /** |
| 327 | * 获取关注详情 列表 | 259 | * 获取关注详情 列表 |
| 328 | */ | 260 | */ |
| @@ -331,7 +263,7 @@ class SearcherAboutDataModel{ | @@ -331,7 +263,7 @@ class SearcherAboutDataModel{ | ||
| 331 | Logger.info(TAG, `getCreatorDetailListData start`); | 263 | Logger.info(TAG, `getCreatorDetailListData start`); |
| 332 | this.fetchCreatorDetailListData(object).then((navResDTO: ResponseDTO<CreatorDetailResponseItem[]>) => { | 264 | this.fetchCreatorDetailListData(object).then((navResDTO: ResponseDTO<CreatorDetailResponseItem[]>) => { |
| 333 | if (!navResDTO || navResDTO.code != 0) { | 265 | if (!navResDTO || navResDTO.code != 0) { |
| 334 | - success([]) | 266 | + error(null) |
| 335 | return | 267 | return |
| 336 | } | 268 | } |
| 337 | Logger.info(TAG, "getCreatorDetailListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp); | 269 | Logger.info(TAG, "getCreatorDetailListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -339,7 +271,7 @@ class SearcherAboutDataModel{ | @@ -339,7 +271,7 @@ class SearcherAboutDataModel{ | ||
| 339 | success(navigationBean); | 271 | success(navigationBean); |
| 340 | }).catch((err: Error) => { | 272 | }).catch((err: Error) => { |
| 341 | Logger.error(TAG, `getCreatorDetailListData catch, error.name : ${err.name}, error.message:${err.message}`); | 273 | Logger.error(TAG, `getCreatorDetailListData catch, error.name : ${err.name}, error.message:${err.message}`); |
| 342 | - success([]) | 274 | + error(null) |
| 343 | }) | 275 | }) |
| 344 | }) | 276 | }) |
| 345 | } | 277 | } |
| @@ -357,9 +289,8 @@ class SearcherAboutDataModel{ | @@ -357,9 +289,8 @@ class SearcherAboutDataModel{ | ||
| 357 | return new Promise<ContentDTO[]>((success, error) => { | 289 | return new Promise<ContentDTO[]>((success, error) => { |
| 358 | Logger.info(TAG, `getSearchSuggestData start`); | 290 | Logger.info(TAG, `getSearchSuggestData start`); |
| 359 | this.fetchSearchSuggestData(object).then((navResDTO: ResponseDTO<ContentDTO[]>) => { | 291 | this.fetchSearchSuggestData(object).then((navResDTO: ResponseDTO<ContentDTO[]>) => { |
| 360 | - if (!navResDTO || navResDTO.code != 0 /*|| navResDTO.data == null*/) { | ||
| 361 | - // success(this.getSearchSuggestDataLocal(context)) | ||
| 362 | - success([]) | 292 | + if (!navResDTO || navResDTO.code != 0 ) { |
| 293 | + error(null) | ||
| 363 | return | 294 | return |
| 364 | } | 295 | } |
| 365 | Logger.info(TAG, "getSearchSuggestData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp); | 296 | Logger.info(TAG, "getSearchSuggestData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -367,8 +298,7 @@ class SearcherAboutDataModel{ | @@ -367,8 +298,7 @@ class SearcherAboutDataModel{ | ||
| 367 | success(navigationBean); | 298 | success(navigationBean); |
| 368 | }).catch((err: Error) => { | 299 | }).catch((err: Error) => { |
| 369 | Logger.error(TAG, `getSearchSuggestData catch, error.name : ${err.name}, error.message:${err.message}`); | 300 | Logger.error(TAG, `getSearchSuggestData catch, error.name : ${err.name}, error.message:${err.message}`); |
| 370 | - // success(this.getSearchSuggestDataLocal(context)) | ||
| 371 | - success([]) | 301 | + error(null) |
| 372 | }) | 302 | }) |
| 373 | }) | 303 | }) |
| 374 | } | 304 | } |
| @@ -379,20 +309,6 @@ class SearcherAboutDataModel{ | @@ -379,20 +309,6 @@ class SearcherAboutDataModel{ | ||
| 379 | return WDHttp.post<ResponseDTO<ContentDTO[]>>(url,object, headers) | 309 | return WDHttp.post<ResponseDTO<ContentDTO[]>>(url,object, headers) |
| 380 | }; | 310 | }; |
| 381 | 311 | ||
| 382 | - async getSearchSuggestDataLocal(context: Context): Promise<ContentDTO[]> { | ||
| 383 | - Logger.info(TAG, `getInteractListDataLocal start`); | ||
| 384 | - let compRes: ResponseDTO<ContentDTO[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<ContentDTO[]>>(context,'search_suggest_data.json' ); | ||
| 385 | - if (!compRes || !compRes.data) { | ||
| 386 | - Logger.info(TAG, `getInteractListDataLocal compRes is empty`); | ||
| 387 | - return [] | ||
| 388 | - } | ||
| 389 | - Logger.info(TAG, `getInteractListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 390 | - return compRes.data | ||
| 391 | - } | ||
| 392 | - | ||
| 393 | - | ||
| 394 | - | ||
| 395 | - | ||
| 396 | } | 312 | } |
| 397 | 313 | ||
| 398 | const searcherAboutDataModel = SearcherAboutDataModel.getInstance() | 314 | const searcherAboutDataModel = SearcherAboutDataModel.getInstance() |
| @@ -65,9 +65,8 @@ struct MineHomePage { | @@ -65,9 +65,8 @@ struct MineHomePage { | ||
| 65 | .height('130lpx') | 65 | .height('130lpx') |
| 66 | .objectFit(ImageFit.Cover) | 66 | .objectFit(ImageFit.Cover) |
| 67 | }.onClick(()=>{ | 67 | }.onClick(()=>{ |
| 68 | - let params: Params = { | ||
| 69 | - pageID: "531267787833221"//sit 测试用 512157124138245 | ||
| 70 | - } | 68 | + //TODO 显示头像 |
| 69 | + let params = {'userId': "531267787833221"} as Record<string, string>; | ||
| 71 | WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) | 70 | WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) |
| 72 | }).width('135lpx') | 71 | }).width('135lpx') |
| 73 | .height('135lpx') | 72 | .height('135lpx') |
| @@ -11,11 +11,11 @@ const TAG = "OtherNormalUserHomePage" | @@ -11,11 +11,11 @@ const TAG = "OtherNormalUserHomePage" | ||
| 11 | @Entry | 11 | @Entry |
| 12 | @Component | 12 | @Component |
| 13 | struct OtherNormalUserHomePage { | 13 | struct OtherNormalUserHomePage { |
| 14 | - @State params:Params = router.getParams() as Params; | 14 | + @State params:Record<string, string> = router.getParams() as Record<string, string>; |
| 15 | @Watch('change') @State curUserId: string = '-1'; | 15 | @Watch('change') @State curUserId: string = '-1'; |
| 16 | 16 | ||
| 17 | onPageShow() { | 17 | onPageShow() { |
| 18 | - this.curUserId = this.params?.pageID; | 18 | + this.curUserId = this.params?.['userId']; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | change(){ | 21 | change(){ |
| 1 | -import promptAction from '@ohos.promptAction'; | ||
| 2 | import { RefreshConstants as Const, RefreshState } from './RefreshConstants'; | 1 | import { RefreshConstants as Const, RefreshState } from './RefreshConstants'; |
| 3 | import { touchMoveLoadMore, touchUpLoadMore } from './PullUpLoadMore'; | 2 | import { touchMoveLoadMore, touchUpLoadMore } from './PullUpLoadMore'; |
| 4 | -import { PageDTO, CompDTO } from 'wdBean'; | ||
| 5 | import PageModel from '../viewmodel/PageModel'; | 3 | import PageModel from '../viewmodel/PageModel'; |
| 6 | -import PageViewModel from '../viewmodel/PageViewModel'; | ||
| 7 | -import { DateTimeUtils } from 'wdKit'; | ||
| 8 | import PageHelper from '../viewmodel/PageHelper'; | 4 | import PageHelper from '../viewmodel/PageHelper'; |
| 9 | import PageAdModel from '../viewmodel/PageAdvModel'; | 5 | import PageAdModel from '../viewmodel/PageAdvModel'; |
| 10 | 6 | ||
| 11 | -export function listTouchEvent(pageModel: PageModel,pageAdvModel:PageAdModel, event: TouchEvent) { | 7 | +export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, event: TouchEvent) { |
| 12 | switch (event.type) { | 8 | switch (event.type) { |
| 13 | case TouchType.Down: | 9 | case TouchType.Down: |
| 14 | pageModel.downY = event.touches[0].y; | 10 | pageModel.downY = event.touches[0].y; |
| @@ -36,7 +32,7 @@ export function listTouchEvent(pageModel: PageModel,pageAdvModel:PageAdModel, ev | @@ -36,7 +32,7 @@ export function listTouchEvent(pageModel: PageModel,pageAdvModel:PageAdModel, ev | ||
| 36 | } | 32 | } |
| 37 | if ((pageModel.isPullRefreshOperation === true)) { | 33 | if ((pageModel.isPullRefreshOperation === true)) { |
| 38 | // Lift your finger and pull down to refresh. | 34 | // Lift your finger and pull down to refresh. |
| 39 | - touchUpPullRefresh(pageModel,pageAdvModel); | 35 | + touchUpPullRefresh(pageModel, pageAdvModel); |
| 40 | } else { | 36 | } else { |
| 41 | // Fingers up, handle loading more. | 37 | // Fingers up, handle loading more. |
| 42 | touchUpLoadMore(pageModel); | 38 | touchUpLoadMore(pageModel); |
| @@ -66,7 +62,7 @@ export function touchMovePullRefresh(pageModel: PageModel, event: TouchEvent) { | @@ -66,7 +62,7 @@ export function touchMovePullRefresh(pageModel: PageModel, event: TouchEvent) { | ||
| 66 | } | 62 | } |
| 67 | } | 63 | } |
| 68 | 64 | ||
| 69 | -export function touchUpPullRefresh(pageModel: PageModel,pageAdvModel:PageAdModel) { | 65 | +export function touchUpPullRefresh(pageModel: PageModel, pageAdvModel: PageAdModel) { |
| 70 | if (pageModel.isCanRefresh === true) { | 66 | if (pageModel.isCanRefresh === true) { |
| 71 | pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight); | 67 | pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight); |
| 72 | pullRefreshState(pageModel, RefreshState.Refreshing); | 68 | pullRefreshState(pageModel, RefreshState.Refreshing); |
| @@ -74,38 +70,26 @@ export function touchUpPullRefresh(pageModel: PageModel,pageAdvModel:PageAdModel | @@ -74,38 +70,26 @@ export function touchUpPullRefresh(pageModel: PageModel,pageAdvModel:PageAdModel | ||
| 74 | setTimeout(() => { | 70 | setTimeout(() => { |
| 75 | let self: PageModel = pageModel; | 71 | let self: PageModel = pageModel; |
| 76 | let advSelf: PageAdModel = pageAdvModel; | 72 | let advSelf: PageAdModel = pageAdvModel; |
| 77 | - PageHelper.refreshUI(self,advSelf) | ||
| 78 | - // PageViewModel.getPageData(self.bizCopy(2)) | ||
| 79 | - // .then((data: PageDTO) => { | ||
| 80 | - // self.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 81 | - // if (data == null || data.compList == null || data.compList.length == 0) { | ||
| 82 | - // self.hasMore = false; | ||
| 83 | - // } else { | ||
| 84 | - // if (data.compList.length == self.pageSize) { | ||
| 85 | - // self.currentPage++; | ||
| 86 | - // self.hasMore = true; | ||
| 87 | - // } else { | ||
| 88 | - // self.hasMore = false; | ||
| 89 | - // } | ||
| 90 | - // // 刷新,替换所有数据 | ||
| 91 | - // self.compList.replaceAll(...data.compList) | ||
| 92 | - // PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => { | ||
| 93 | - // // 刷新,替换所有数据 | ||
| 94 | - // self.compList.replaceAll(...data) | ||
| 95 | - // self.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 96 | - // }) | ||
| 97 | - // } | ||
| 98 | - // closeRefresh(self, true); | ||
| 99 | - // }).catch((err: string | Resource) => { | ||
| 100 | - // promptAction.showToast({ message: err }); | ||
| 101 | - // closeRefresh(self, false); | ||
| 102 | - // }); | 73 | + PageHelper.refreshUI(self, advSelf) |
| 103 | }, Const.DELAY_TIME); | 74 | }, Const.DELAY_TIME); |
| 104 | } else { | 75 | } else { |
| 105 | closeRefresh(pageModel, false); | 76 | closeRefresh(pageModel, false); |
| 106 | } | 77 | } |
| 107 | } | 78 | } |
| 108 | 79 | ||
| 80 | +/** | ||
| 81 | + * 自动刷新接口,如首页底导,双击按钮自动刷新 | ||
| 82 | + * @param pageModel 页面数据 | ||
| 83 | + * @param pageAdvModel 广告数据 | ||
| 84 | + */ | ||
| 85 | +export function autoRefresh(pageModel: PageModel, pageAdvModel: PageAdModel) { | ||
| 86 | + pageModel.isVisiblePullDown = true; | ||
| 87 | + pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight); | ||
| 88 | + pullRefreshState(pageModel, RefreshState.Refreshing); | ||
| 89 | + pageModel.currentPage = 1; | ||
| 90 | + PageHelper.refreshUI(pageModel, pageAdvModel) | ||
| 91 | +} | ||
| 92 | + | ||
| 109 | export function pullRefreshState(pageModel: PageModel, state: number) { | 93 | export function pullRefreshState(pageModel: PageModel, state: number) { |
| 110 | switch (state) { | 94 | switch (state) { |
| 111 | case RefreshState.DropDown: | 95 | case RefreshState.DropDown: |
| 1 | -import promptAction from '@ohos.promptAction'; | ||
| 2 | import PageModel from '../viewmodel/PageModel'; | 1 | import PageModel from '../viewmodel/PageModel'; |
| 3 | import { RefreshConstants as Const } from './RefreshConstants'; | 2 | import { RefreshConstants as Const } from './RefreshConstants'; |
| 4 | -import PageViewModel from '../viewmodel/PageViewModel'; | ||
| 5 | -import { PageDTO, CompDTO } from 'wdBean'; | ||
| 6 | -import { DateTimeUtils } from 'wdKit'; | ||
| 7 | import PageHelper from '../viewmodel/PageHelper'; | 3 | import PageHelper from '../viewmodel/PageHelper'; |
| 8 | 4 | ||
| 9 | export function touchMoveLoadMore(model: PageModel, event: TouchEvent) { | 5 | export function touchMoveLoadMore(model: PageModel, event: TouchEvent) { |
| @@ -30,29 +26,6 @@ export function touchUpLoadMore(model: PageModel) { | @@ -30,29 +26,6 @@ export function touchUpLoadMore(model: PageModel) { | ||
| 30 | setTimeout(() => { | 26 | setTimeout(() => { |
| 31 | closeLoadMore(model); | 27 | closeLoadMore(model); |
| 32 | PageHelper.loadMore(self) | 28 | PageHelper.loadMore(self) |
| 33 | - // PageViewModel.getPageData(self.bizCopy()) | ||
| 34 | - // .then((data: PageDTO) => { | ||
| 35 | - // self.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 36 | - // if (data == null || data.compList == null || data.compList.length == 0) { | ||
| 37 | - // self.hasMore = false; | ||
| 38 | - // } else { | ||
| 39 | - // if (data.compList.length == self.pageSize) { | ||
| 40 | - // self.currentPage++; | ||
| 41 | - // self.hasMore = true; | ||
| 42 | - // } else { | ||
| 43 | - // self.hasMore = false; | ||
| 44 | - // } | ||
| 45 | - // let sizeBefore: number = self.compList.size(); | ||
| 46 | - // self.compList.push(...data.compList) | ||
| 47 | - // PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => { | ||
| 48 | - // // 刷新,替换所有数据 | ||
| 49 | - // self.compList.updateItems(sizeBefore, data) | ||
| 50 | - // self.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 51 | - // }) | ||
| 52 | - // } | ||
| 53 | - // }).catch((err: string | Resource) => { | ||
| 54 | - // promptAction.showToast({ message: err }); | ||
| 55 | - // }) | ||
| 56 | }, Const.DELAY_TIME); | 29 | }, Const.DELAY_TIME); |
| 57 | } else { | 30 | } else { |
| 58 | closeLoadMore(self); | 31 | closeLoadMore(self); |
| @@ -21,6 +21,7 @@ export class LikeViewModel { | @@ -21,6 +21,7 @@ export class LikeViewModel { | ||
| 21 | this.likeModel.executeLike(bean) | 21 | this.likeModel.executeLike(bean) |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | + //点赞 | ||
| 24 | executeLike2(bean: Record<string, string>) { | 25 | executeLike2(bean: Record<string, string>) { |
| 25 | 26 | ||
| 26 | return new Promise<object>((success, fail) => { | 27 | return new Promise<object>((success, fail) => { |
| @@ -32,4 +33,20 @@ export class LikeViewModel { | @@ -32,4 +33,20 @@ export class LikeViewModel { | ||
| 32 | }) | 33 | }) |
| 33 | 34 | ||
| 34 | } | 35 | } |
| 36 | + | ||
| 37 | + //点赞状态 | ||
| 38 | + getLikeStatus(bean: Record<string, string>) { | ||
| 39 | + | ||
| 40 | + return new Promise<object>((success, fail) => { | ||
| 41 | + this.likeModel.getLikeStatus(bean).then((data) => { | ||
| 42 | + success(data) | ||
| 43 | + }).catch((error: string) => { | ||
| 44 | + fail(error) | ||
| 45 | + }) | ||
| 46 | + }) | ||
| 47 | + | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + | ||
| 35 | } | 52 | } |
| 1 | import { PageDTO, CompDTO, PageInfoDTO, ContentDTO } from 'wdBean'; | 1 | import { PageDTO, CompDTO, PageInfoDTO, ContentDTO } from 'wdBean'; |
| 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; | 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; |
| 3 | -import { CollectionUtils, DateTimeUtils, Logger } from 'wdKit'; | 3 | +import { CollectionUtils, DateTimeUtils, Logger, NetworkUtil } 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'; |
| 7 | import { promptAction } from '@kit.ArkUI'; | 7 | import { promptAction } from '@kit.ArkUI'; |
| 8 | import { AdvRuleBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; | 8 | import { AdvRuleBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; |
| 9 | import PageAdModel from './PageAdvModel'; | 9 | import PageAdModel from './PageAdvModel'; |
| 10 | +import { WDViewDefaultType } from '../components/view/EmptyComponent'; | ||
| 10 | 11 | ||
| 11 | const TAG = 'PageHelper'; | 12 | const TAG = 'PageHelper'; |
| 12 | 13 | ||
| @@ -14,14 +15,12 @@ const TAG = 'PageHelper'; | @@ -14,14 +15,12 @@ const TAG = 'PageHelper'; | ||
| 14 | * 处理返回后的数据 | 15 | * 处理返回后的数据 |
| 15 | */ | 16 | */ |
| 16 | export class PageHelper { | 17 | export class PageHelper { |
| 17 | - | ||
| 18 | - | ||
| 19 | /** | 18 | /** |
| 20 | * 刷新数据 | 19 | * 刷新数据 |
| 21 | */ | 20 | */ |
| 22 | - async refreshUI(pageModel: PageModel,pageAdvModel:PageAdModel) { | 21 | + async refreshUI(pageModel: PageModel, pageAdvModel: PageAdModel) { |
| 23 | pageModel.loadStrategy = 2 | 22 | pageModel.loadStrategy = 2 |
| 24 | - this.getPageInfo(pageModel,pageAdvModel) | 23 | + this.getPageInfo(pageModel, pageAdvModel) |
| 25 | } | 24 | } |
| 26 | 25 | ||
| 27 | /** | 26 | /** |
| @@ -36,28 +35,36 @@ export class PageHelper { | @@ -36,28 +35,36 @@ export class PageHelper { | ||
| 36 | /** | 35 | /** |
| 37 | * 进页面请求数据 | 36 | * 进页面请求数据 |
| 38 | */ | 37 | */ |
| 39 | - async getInitData(pageModel: PageModel,pageAdvModel:PageAdModel) { | 38 | + async getInitData(pageModel: PageModel, pageAdvModel: PageAdModel) { |
| 40 | pageModel.loadStrategy = 1 | 39 | pageModel.loadStrategy = 1 |
| 41 | - this.getPageInfo(pageModel,pageAdvModel) | 40 | + let netStatus = NetworkUtil.isNetConnected() |
| 41 | + if (netStatus) { | ||
| 42 | + this.getPageInfo(pageModel, pageAdvModel) | ||
| 43 | + } else { | ||
| 44 | + pageModel.viewType = ViewType.EMPTY; | ||
| 45 | + pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork; | ||
| 46 | + } | ||
| 42 | } | 47 | } |
| 43 | 48 | ||
| 44 | - async getPageInfo(pageModel: PageModel,pageAdvModel:PageAdModel) { | 49 | + getPageInfo(pageModel: PageModel, pageAdvModel: PageAdModel) { |
| 45 | pageModel.currentPage = 1; | 50 | pageModel.currentPage = 1; |
| 46 | - let pageInfo = await PageViewModel.getPageInfo(pageModel.pageId); | ||
| 47 | - if (pageInfo == null) { | 51 | + PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => { |
| 52 | + if (pageInfo == null) { | ||
| 53 | + pageModel.viewType = ViewType.EMPTY; | ||
| 54 | + pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent; | ||
| 55 | + return; | ||
| 56 | + } | ||
| 57 | + pageModel.pageInfo = pageInfo; | ||
| 58 | + //解析广告资源 | ||
| 59 | + pageAdvModel.analysisAdvSource(pageInfo); | ||
| 60 | + this.parseGroup(pageModel) | ||
| 61 | + }).catch(() => { | ||
| 48 | pageModel.viewType = ViewType.EMPTY; | 62 | pageModel.viewType = ViewType.EMPTY; |
| 49 | - return; | ||
| 50 | - } | ||
| 51 | - pageModel.pageInfo = pageInfo; | ||
| 52 | - //解析广告资源 | ||
| 53 | - pageAdvModel.analysisAdvSource(pageInfo) | ||
| 54 | - | ||
| 55 | - this.parseGroup(pageModel) | ||
| 56 | - | 63 | + pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_ContentFailed; |
| 64 | + }) | ||
| 57 | } | 65 | } |
| 58 | 66 | ||
| 59 | 67 | ||
| 60 | - | ||
| 61 | async parseGroup(pageModel: PageModel) { | 68 | async parseGroup(pageModel: PageModel) { |
| 62 | let pageInfo: PageInfoDTO = pageModel.pageInfo | 69 | let pageInfo: PageInfoDTO = pageModel.pageInfo |
| 63 | pageModel.groupList = [] | 70 | pageModel.groupList = [] |
| @@ -84,6 +91,8 @@ export class PageHelper { | @@ -84,6 +91,8 @@ export class PageHelper { | ||
| 84 | // 没数据,展示空页面 | 91 | // 没数据,展示空页面 |
| 85 | Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.'); | 92 | Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.'); |
| 86 | pageModel.viewType = ViewType.EMPTY; | 93 | pageModel.viewType = ViewType.EMPTY; |
| 94 | + pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent; | ||
| 95 | + | ||
| 87 | } | 96 | } |
| 88 | } | 97 | } |
| 89 | 98 |
| @@ -5,6 +5,7 @@ import { RefreshConstants as Const } from '../utils/RefreshConstants'; | @@ -5,6 +5,7 @@ import { RefreshConstants as Const } from '../utils/RefreshConstants'; | ||
| 5 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; | 5 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; |
| 6 | import { GroupInfoDTO, PageInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO'; | 6 | import { GroupInfoDTO, PageInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO'; |
| 7 | import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; | 7 | import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; |
| 8 | +import { WDViewDefaultType } from '../components/view/EmptyComponent'; | ||
| 8 | 9 | ||
| 9 | /** | 10 | /** |
| 10 | * 页面下拉刷新、上拉加载数据bean。 | 11 | * 页面下拉刷新、上拉加载数据bean。 |
| @@ -38,6 +39,7 @@ export default class PageModel { | @@ -38,6 +39,7 @@ export default class PageModel { | ||
| 38 | isVisiblePullUpLoad: boolean = false; | 39 | isVisiblePullUpLoad: boolean = false; |
| 39 | offsetY: number = 0; | 40 | offsetY: number = 0; |
| 40 | viewType: number = ViewType.LOADING; | 41 | viewType: number = ViewType.LOADING; |
| 42 | + emptyType: WDViewDefaultType = WDViewDefaultType.WDViewDefaultType_Default | ||
| 41 | hasMore: boolean = true; | 43 | hasMore: boolean = true; |
| 42 | startIndex = 0; | 44 | startIndex = 0; |
| 43 | endIndex = 0; | 45 | endIndex = 0; |
No preview for this file type
| @@ -98,7 +98,14 @@ export struct DetailPlayLivePage { | @@ -98,7 +98,14 @@ export struct DetailPlayLivePage { | ||
| 98 | (data) => { | 98 | (data) => { |
| 99 | if (data.length > 0) { | 99 | if (data.length > 0) { |
| 100 | if (data[0].liveInfo?.liveState == 'wait') { | 100 | if (data[0].liveInfo?.liveState == 'wait') { |
| 101 | - this.tabs = ['简介', '直播间', '大家聊'] | 101 | + //直播样式 0-正常模式 , 1-隐藏直播间,2-隐藏大家聊 【人民号发布是竖屏的,为空】 |
| 102 | + if (data[0].liveInfo?.liveStyle == 1) { | ||
| 103 | + this.tabs = ['简介', '大家聊'] | ||
| 104 | + } else if (data[0].liveInfo?.liveStyle == 2) { | ||
| 105 | + this.tabs = ['简介', '直播间',] | ||
| 106 | + } else { | ||
| 107 | + this.tabs = ['简介', '直播间', '大家聊'] | ||
| 108 | + } | ||
| 102 | } else { | 109 | } else { |
| 103 | this.tabs = ['直播间', '大家聊'] | 110 | this.tabs = ['直播间', '大家聊'] |
| 104 | } | 111 | } |
| @@ -4,6 +4,7 @@ import { devicePLSensorManager } from 'wdDetailPlayApi/Index' | @@ -4,6 +4,7 @@ import { devicePLSensorManager } from 'wdDetailPlayApi/Index' | ||
| 4 | import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index' | 4 | import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index' |
| 5 | import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' | 5 | import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' |
| 6 | import { DisplayDirection } from 'wdConstant/Index' | 6 | import { DisplayDirection } from 'wdConstant/Index' |
| 7 | +import { LiveFollowComponent } from 'wdComponent/Index' | ||
| 7 | 8 | ||
| 8 | @Component | 9 | @Component |
| 9 | export struct PlayUIComponent { | 10 | export struct PlayUIComponent { |
| @@ -95,7 +96,17 @@ export struct PlayUIComponent { | @@ -95,7 +96,17 @@ export struct PlayUIComponent { | ||
| 95 | bottom: 10 | 96 | bottom: 10 |
| 96 | }) | 97 | }) |
| 97 | 98 | ||
| 98 | - this.getLiveStatusView() | 99 | + Row() { |
| 100 | + if (this.liveDetailsBean?.rmhInfo) { | ||
| 101 | + LiveFollowComponent({ | ||
| 102 | + rmhInfo: this.liveDetailsBean.rmhInfo | ||
| 103 | + }) | ||
| 104 | + .margin({ | ||
| 105 | + right: 10 | ||
| 106 | + }) | ||
| 107 | + } | ||
| 108 | + this.getLiveStatusView() | ||
| 109 | + } | ||
| 99 | }.width('100%') | 110 | }.width('100%') |
| 100 | .padding({ | 111 | .padding({ |
| 101 | top: 20, | 112 | top: 20, |
| @@ -23,12 +23,12 @@ export struct DetailPlayShortVideoPage { | @@ -23,12 +23,12 @@ export struct DetailPlayShortVideoPage { | ||
| 23 | @Prop index: number = 0 | 23 | @Prop index: number = 0 |
| 24 | @Prop @Watch('currentIndexChange') currentIndex: number = 0 | 24 | @Prop @Watch('currentIndexChange') currentIndex: number = 0 |
| 25 | @State playerController: WDPlayerController = new WDPlayerController(); | 25 | @State playerController: WDPlayerController = new WDPlayerController(); |
| 26 | - @Provide contentDetailData: ContentDetailDTO | undefined = undefined | ||
| 27 | - @Provide interactData: InteractDataDTO | undefined = undefined | 26 | + @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 27 | + @Provide interactData: InteractDataDTO = {} as InteractDataDTO | ||
| 28 | @Provide isFullScreen: boolean = false; | 28 | @Provide isFullScreen: boolean = false; |
| 29 | @Provide progressVal: number = 0; | 29 | @Provide progressVal: number = 0; |
| 30 | @Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2 | 30 | @Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2 |
| 31 | - @Provide newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 31 | + @Provide newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态 |
| 32 | @Provide followStatus: string = '0' // 关注状态 | 32 | @Provide followStatus: string = '0' // 关注状态 |
| 33 | @Provide isOpenDetail: boolean = false // 查看详情按钮点击 | 33 | @Provide isOpenDetail: boolean = false // 查看详情按钮点击 |
| 34 | @Provide isDragging: boolean = false // 拖动时间进度条 | 34 | @Provide isDragging: boolean = false // 拖动时间进度条 |
| @@ -24,10 +24,8 @@ export struct DetailVideoListPage { | @@ -24,10 +24,8 @@ export struct DetailVideoListPage { | ||
| 24 | @Provide pageHide: number = -1 | 24 | @Provide pageHide: number = -1 |
| 25 | @Provide switchVideoStatus: boolean = false | 25 | @Provide switchVideoStatus: boolean = false |
| 26 | @State data: ContentDetailDTO[] = [] | 26 | @State data: ContentDetailDTO[] = [] |
| 27 | - @State testData: string[] = ['111', '222', '333'] | ||
| 28 | @State currentIndex: number = 0 | 27 | @State currentIndex: number = 0 |
| 29 | @State interactDataList: InteractDataDTO[] = [] | 28 | @State interactDataList: InteractDataDTO[] = [] |
| 30 | - @State isFullScreen: boolean = false | ||
| 31 | 29 | ||
| 32 | async aboutToAppear(): Promise<void> { | 30 | async aboutToAppear(): Promise<void> { |
| 33 | this.openFullScreen() | 31 | this.openFullScreen() |
| @@ -41,10 +39,7 @@ export struct DetailVideoListPage { | @@ -41,10 +39,7 @@ export struct DetailVideoListPage { | ||
| 41 | } | 39 | } |
| 42 | await this.getContentDetail(this.contentId, this.relId, this.relType) | 40 | await this.getContentDetail(this.contentId, this.relId, this.relType) |
| 43 | } | 41 | } |
| 44 | - | ||
| 45 | await this.queryVideoList() | 42 | await this.queryVideoList() |
| 46 | - this.getContentInteract() | ||
| 47 | - | ||
| 48 | console.log(TAG, 'aboutToAppear', JSON.stringify(action.params)) | 43 | console.log(TAG, 'aboutToAppear', JSON.stringify(action.params)) |
| 49 | } | 44 | } |
| 50 | 45 | ||
| @@ -93,9 +88,22 @@ export struct DetailVideoListPage { | @@ -93,9 +88,22 @@ export struct DetailVideoListPage { | ||
| 93 | contentId: contentId, | 88 | contentId: contentId, |
| 94 | relId: relId, | 89 | relId: relId, |
| 95 | relType: relType | 90 | relType: relType |
| 96 | - }).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => { | ||
| 97 | - console.error('getContentDetail==', JSON.stringify(resDTO.data)) | 91 | + }).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => { |
| 92 | + console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data)) | ||
| 98 | if (resDTO.data) { | 93 | if (resDTO.data) { |
| 94 | + const params: contentListParams = { | ||
| 95 | + contentList: [{ | ||
| 96 | + contentId: resDTO.data[0].newsId + '', | ||
| 97 | + contentType: resDTO.data[0].newsType | ||
| 98 | + }] | ||
| 99 | + } | ||
| 100 | + // 批量查询内容当前用户点赞、收藏状态 | ||
| 101 | + await ContentDetailRequest.getContentInteract(params).then(res => { | ||
| 102 | + if (res.data) { | ||
| 103 | + this.interactDataList = this.interactDataList.concat(res.data) | ||
| 104 | + } | ||
| 105 | + console.log('获取互动点赞等数据===', JSON.stringify(res)) | ||
| 106 | + }) | ||
| 99 | this.data.push(resDTO.data[0]) | 107 | this.data.push(resDTO.data[0]) |
| 100 | } | 108 | } |
| 101 | }) | 109 | }) |
| @@ -108,8 +116,9 @@ export struct DetailVideoListPage { | @@ -108,8 +116,9 @@ export struct DetailVideoListPage { | ||
| 108 | await ContentDetailRequest.postRecommendVideoList({ | 116 | await ContentDetailRequest.postRecommendVideoList({ |
| 109 | pageSize: 5, | 117 | pageSize: 5, |
| 110 | refreshCnt: 1 | 118 | refreshCnt: 1 |
| 111 | - }).then(res => { | 119 | + }).then(async res => { |
| 112 | if (res.data) { | 120 | if (res.data) { |
| 121 | + await this.getContentInteract(res.data) | ||
| 113 | this.data = this.data.concat(res.data) | 122 | this.data = this.data.concat(res.data) |
| 114 | console.log('视频列表===', JSON.stringify(res.data)) | 123 | console.log('视频列表===', JSON.stringify(res.data)) |
| 115 | } | 124 | } |
| @@ -119,21 +128,21 @@ export struct DetailVideoListPage { | @@ -119,21 +128,21 @@ export struct DetailVideoListPage { | ||
| 119 | /** | 128 | /** |
| 120 | * 批量查询内容当前用户点赞、收藏状态 | 129 | * 批量查询内容当前用户点赞、收藏状态 |
| 121 | */ | 130 | */ |
| 122 | - getContentInteract() { | ||
| 123 | - if (this.data.length > 0) { | 131 | + async getContentInteract(data: ContentDetailDTO[]) { |
| 132 | + if (data.length > 0) { | ||
| 124 | const params: contentListParams = { | 133 | const params: contentListParams = { |
| 125 | contentList: [] | 134 | contentList: [] |
| 126 | } | 135 | } |
| 127 | - this.data.map(item => { | 136 | + data.map(item => { |
| 128 | params.contentList.push({ | 137 | params.contentList.push({ |
| 129 | contentId: item.newsId + '', | 138 | contentId: item.newsId + '', |
| 130 | contentType: item.newsType | 139 | contentType: item.newsType |
| 131 | }) | 140 | }) |
| 132 | }) | 141 | }) |
| 133 | // 批量查询内容当前用户点赞、收藏状态 | 142 | // 批量查询内容当前用户点赞、收藏状态 |
| 134 | - ContentDetailRequest.getContentInteract(params).then(res => { | 143 | + await ContentDetailRequest.getContentInteract(params).then(res => { |
| 135 | if (res.data) { | 144 | if (res.data) { |
| 136 | - this.interactDataList = res.data || [] | 145 | + this.interactDataList = this.interactDataList.concat(res.data) |
| 137 | } | 146 | } |
| 138 | console.log('获取互动点赞等数据===', JSON.stringify(res)) | 147 | console.log('获取互动点赞等数据===', JSON.stringify(res)) |
| 139 | }) | 148 | }) |
| @@ -145,7 +145,7 @@ export struct VideoChannelDetail { | @@ -145,7 +145,7 @@ export struct VideoChannelDetail { | ||
| 145 | refreshTime: this.refreshTime, | 145 | refreshTime: this.refreshTime, |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | - await ContentDetailRequest.getRecCompInfo(params).then(res => { | 148 | + await ContentDetailRequest.getRecCompInfo(params).then(async res => { |
| 149 | this.isRequestError = false | 149 | this.isRequestError = false |
| 150 | console.log('根据视频频道传参查询视频楼层信息totalCount', res.data?.totalCount + '') | 150 | console.log('根据视频频道传参查询视频楼层信息totalCount', res.data?.totalCount + '') |
| 151 | 151 | ||
| @@ -174,8 +174,8 @@ export struct VideoChannelDetail { | @@ -174,8 +174,8 @@ export struct VideoChannelDetail { | ||
| 174 | }) | 174 | }) |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | - this.batchContentDetail(list1) | ||
| 178 | - this.getContentInteract(list2) | 177 | + await this.batchContentDetail(list1, list2) |
| 178 | + | ||
| 179 | setTimeout(() => { | 179 | setTimeout(() => { |
| 180 | this.isMouted = true | 180 | this.isMouted = true |
| 181 | }, 500) | 181 | }, 500) |
| @@ -189,11 +189,14 @@ export struct VideoChannelDetail { | @@ -189,11 +189,14 @@ export struct VideoChannelDetail { | ||
| 189 | /** | 189 | /** |
| 190 | * 根据视频楼层信息批量查询视频列表 | 190 | * 根据视频楼层信息批量查询视频列表 |
| 191 | */ | 191 | */ |
| 192 | - async batchContentDetail(list: batchContentDetailParams) { | 192 | + async batchContentDetail(list: batchContentDetailParams, list2: contentListParams) { |
| 193 | if (list.contents.length > 0) { | 193 | if (list.contents.length > 0) { |
| 194 | - await ContentDetailRequest.batchContentDetail(list).then(res => { | 194 | + await ContentDetailRequest.batchContentDetail(list).then(async res => { |
| 195 | + if (res.data) { | ||
| 196 | + await this.getContentInteract(list2) | ||
| 197 | + this.data = this.data.concat(res.data) | ||
| 198 | + } | ||
| 195 | console.log('根据视频楼层信息批量查询视频列表', res.data) | 199 | console.log('根据视频楼层信息批量查询视频列表', res.data) |
| 196 | - this.data = this.data.concat(res.data as []) | ||
| 197 | }) | 200 | }) |
| 198 | } | 201 | } |
| 199 | } | 202 | } |
| @@ -204,7 +207,9 @@ export struct VideoChannelDetail { | @@ -204,7 +207,9 @@ export struct VideoChannelDetail { | ||
| 204 | async getContentInteract(list: contentListParams) { | 207 | async getContentInteract(list: contentListParams) { |
| 205 | if (list.contentList.length > 0) { | 208 | if (list.contentList.length > 0) { |
| 206 | await ContentDetailRequest.getContentInteract(list).then(res => { | 209 | await ContentDetailRequest.getContentInteract(list).then(res => { |
| 207 | - this.interactDataList = res.data || [] | 210 | + if (res.data) { |
| 211 | + this.interactDataList = this.interactDataList.concat(res.data) | ||
| 212 | + } | ||
| 208 | console.log('根据视频信息批量查询点赞、收藏状态', res.data) | 213 | console.log('根据视频信息批量查询点赞、收藏状态', res.data) |
| 209 | }) | 214 | }) |
| 210 | } | 215 | } |
| 1 | -import { ContentDetailDTO, InteractDataDTO, Params, RmhInfoDTO, UserInfoDTO } from 'wdBean/Index'; | 1 | +import { ContentDetailDTO, InteractDataDTO, Params, } from 'wdBean/Index'; |
| 2 | import { | 2 | import { |
| 3 | - batchLikeAndCollectParams, | ||
| 4 | batchLikeAndCollectResult, | 3 | batchLikeAndCollectResult, |
| 5 | ContentDetailRequest, | 4 | ContentDetailRequest, |
| 6 | contentListParams, | 5 | contentListParams, |
| @@ -8,23 +7,15 @@ import { | @@ -8,23 +7,15 @@ import { | ||
| 8 | postExecuteLikeParams, | 7 | postExecuteLikeParams, |
| 9 | postInteractAccentionOperateParams | 8 | postInteractAccentionOperateParams |
| 10 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | 9 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; |
| 11 | -import { SPHelper, ToastUtils } from 'wdKit'; | ||
| 12 | -import { HttpUrlUtils } from 'wdNetwork/Index'; | 10 | +import { SPHelper, ToastUtils, NumberFormatterUtils } from 'wdKit'; |
| 13 | import { WDPlayerController } from 'wdPlayer/Index'; | 11 | import { WDPlayerController } from 'wdPlayer/Index'; |
| 14 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 12 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 15 | import { SpConstants } from 'wdConstant/Index' | 13 | import { SpConstants } from 'wdConstant/Index' |
| 16 | -//视频点播页右侧操作栏:点赞/收藏/评论/分享 竖着排列 | ||
| 17 | -export interface OperationItem { | ||
| 18 | - icon: Resource; | ||
| 19 | - icon_check?: Resource; | ||
| 20 | 14 | ||
| 21 | - // icon_selected: Resource; | ||
| 22 | - text: string | Resource; | ||
| 23 | - num?: number; // 个数 | ||
| 24 | -} | ||
| 25 | 15 | ||
| 26 | const TAG = 'PlayerRightView'; | 16 | const TAG = 'PlayerRightView'; |
| 27 | 17 | ||
| 18 | +//视频点播页右侧操作栏:点赞/收藏/评论/分享 竖着排列 | ||
| 28 | @Component | 19 | @Component |
| 29 | export struct PlayerRightView { | 20 | export struct PlayerRightView { |
| 30 | private playerController?: WDPlayerController; | 21 | private playerController?: WDPlayerController; |
| @@ -34,31 +25,10 @@ export struct PlayerRightView { | @@ -34,31 +25,10 @@ export struct PlayerRightView { | ||
| 34 | @Consume followStatus: string | 25 | @Consume followStatus: string |
| 35 | @Consume isOpenDetail: boolean | 26 | @Consume isOpenDetail: boolean |
| 36 | @Consume isDragging: boolean | 27 | @Consume isDragging: boolean |
| 37 | - @State operationList: OperationItem[] = [ | ||
| 38 | - { | ||
| 39 | - icon: $r('app.media.ic_like_uncheck'), | ||
| 40 | - icon_check: $r('app.media.ic_like_check'), | ||
| 41 | - text: "赞", | ||
| 42 | - // num: 6622 | ||
| 43 | - }, | ||
| 44 | - { | ||
| 45 | - icon: $r('app.media.ic_collect_uncheck'), | ||
| 46 | - icon_check: $r('app.media.ic_collect_check'), | ||
| 47 | - text: "收藏", | ||
| 48 | - // num: 662, | ||
| 49 | - }, | ||
| 50 | - { | ||
| 51 | - icon: $r('app.media.ic_comment'), | ||
| 52 | - text: "抢首评", | ||
| 53 | - // num: 500, | ||
| 54 | - }, | ||
| 55 | - { | ||
| 56 | - icon: $r('app.media.ic_share'), | ||
| 57 | - text: "分享" | ||
| 58 | - } | ||
| 59 | - ] | 28 | + @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 60 | 29 | ||
| 61 | aboutToAppear() { | 30 | aboutToAppear() { |
| 31 | + | ||
| 62 | } | 32 | } |
| 63 | 33 | ||
| 64 | /** | 34 | /** |
| @@ -82,11 +52,11 @@ export struct PlayerRightView { | @@ -82,11 +52,11 @@ export struct PlayerRightView { | ||
| 82 | if (this.newsStatusOfUser) { | 52 | if (this.newsStatusOfUser) { |
| 83 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1' | 53 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1' |
| 84 | if (this.newsStatusOfUser.likeStatus === '1') { | 54 | if (this.newsStatusOfUser.likeStatus === '1') { |
| 85 | - this.interactData.likeNum = Number(this.interactData.likeNum) + 1 | 55 | + this.interactData.likeNum = Number(this.interactData.likeNum || 0) + 1 |
| 86 | } else { | 56 | } else { |
| 87 | - this.interactData.likeNum = Number(this.interactData.likeNum) - 1 | 57 | + this.interactData.likeNum = Number(this.interactData.likeNum || 0) - 1 |
| 88 | } | 58 | } |
| 89 | - console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum) | 59 | + console.log(TAG, '点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum) |
| 90 | // this.queryContentInteractCount() | 60 | // this.queryContentInteractCount() |
| 91 | } | 61 | } |
| 92 | 62 | ||
| @@ -116,11 +86,11 @@ export struct PlayerRightView { | @@ -116,11 +86,11 @@ export struct PlayerRightView { | ||
| 116 | this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 | 86 | this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 |
| 117 | // this.queryContentInteractCount() | 87 | // this.queryContentInteractCount() |
| 118 | if (this.newsStatusOfUser.collectStatus === 1) { | 88 | if (this.newsStatusOfUser.collectStatus === 1) { |
| 119 | - this.interactData.collectNum = Number(this.interactData.collectNum) + 1 | 89 | + this.interactData.collectNum = Number(this.interactData.collectNum || 0) + 1 |
| 120 | } else { | 90 | } else { |
| 121 | - this.interactData.collectNum = Number(this.interactData.collectNum) - 1 | 91 | + this.interactData.collectNum = Number(this.interactData.collectNum || 0) - 1 |
| 122 | } | 92 | } |
| 123 | - console.log('收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum) | 93 | + console.log(TAG, '收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum) |
| 124 | } | 94 | } |
| 125 | }) | 95 | }) |
| 126 | 96 | ||
| @@ -138,15 +108,15 @@ export struct PlayerRightView { | @@ -138,15 +108,15 @@ export struct PlayerRightView { | ||
| 138 | } | 108 | } |
| 139 | ContentDetailRequest.getContentInteract(params).then(res => { | 109 | ContentDetailRequest.getContentInteract(params).then(res => { |
| 140 | if (res.data && this.interactData) { | 110 | if (res.data && this.interactData) { |
| 141 | - this.interactData.likeNum = res.data[0]?.likeNum | ||
| 142 | - this.interactData.collectNum = res.data[0]?.collectNum | ||
| 143 | - this.interactData.commentNum = res.data[0]?.commentNum | 111 | + this.interactData.likeNum = res.data[0]?.likeNum || 0 |
| 112 | + this.interactData.collectNum = res.data[0]?.collectNum || 0 | ||
| 113 | + this.interactData.commentNum = res.data[0]?.commentNum || 0 | ||
| 144 | } | 114 | } |
| 145 | console.log('获取互动点赞等数据===', JSON.stringify(res)) | 115 | console.log('获取互动点赞等数据===', JSON.stringify(res)) |
| 146 | }) | 116 | }) |
| 147 | } | 117 | } |
| 148 | 118 | ||
| 149 | - getImgUrl() { | 119 | + getHeadUrl() { |
| 150 | return this.contentDetailData?.rmhInfo?.rmhHeadUrl || this.contentDetailData?.userInfo?.userHeadUrl | 120 | return this.contentDetailData?.rmhInfo?.rmhHeadUrl || this.contentDetailData?.userInfo?.userHeadUrl |
| 151 | } | 121 | } |
| 152 | 122 | ||
| @@ -170,7 +140,7 @@ export struct PlayerRightView { | @@ -170,7 +140,7 @@ export struct PlayerRightView { | ||
| 170 | status: 1, | 140 | status: 1, |
| 171 | } | 141 | } |
| 172 | ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { | 142 | ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { |
| 173 | - console.log('关注号主==', JSON.stringify(res.data)) | 143 | + console.log(TAG, '关注号主==', JSON.stringify(res.data)) |
| 174 | if (this.followStatus == '1') { | 144 | if (this.followStatus == '1') { |
| 175 | this.followStatus = '0' | 145 | this.followStatus = '0' |
| 176 | } else { | 146 | } else { |
| @@ -179,137 +149,184 @@ export struct PlayerRightView { | @@ -179,137 +149,184 @@ export struct PlayerRightView { | ||
| 179 | }) | 149 | }) |
| 180 | } | 150 | } |
| 181 | 151 | ||
| 182 | - @Builder | ||
| 183 | - buildUserComp() { | 152 | + build() { |
| 184 | Column() { | 153 | Column() { |
| 185 | - if (this.getImgUrl()) { | ||
| 186 | - RelativeContainer() { | ||
| 187 | - Image(this.getImgUrl()) | ||
| 188 | - .width('100%') | ||
| 189 | - .borderRadius(24) | ||
| 190 | - .aspectRatio(1) | ||
| 191 | - .border({ width: 1, color: Color.White, style: BorderStyle.Solid }) | ||
| 192 | - .alignRules({ | ||
| 193 | - top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 194 | - left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 195 | - }) | ||
| 196 | - .id("row1") | ||
| 197 | - .onClick(() => { | ||
| 198 | - if (this.contentDetailData.rmhInfo?.cnMainControl === 1) { | ||
| 199 | - // 号主页 | ||
| 200 | - const params: Params = { | ||
| 201 | - creatorId: this.contentDetailData.rmhInfo.rmhId, | ||
| 202 | - pageID: '' | ||
| 203 | - } | ||
| 204 | - WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) | ||
| 205 | - } | ||
| 206 | 154 | ||
| 207 | - }) | ||
| 208 | - if (this.followStatus == '0') { | ||
| 209 | - Image($r('app.media.ic_add')) | ||
| 210 | - .width(24) | ||
| 211 | - .borderRadius(12) | ||
| 212 | - .alignRules({ | ||
| 213 | - left: { anchor: "__container__", align: HorizontalAlign.Center }, | ||
| 214 | - bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | ||
| 215 | - }) | ||
| 216 | - .margin({ left: -12 }) | ||
| 217 | - .id("row2") | ||
| 218 | - .onClick(() => { | ||
| 219 | - // 关注 | ||
| 220 | - this.handleAccention() | ||
| 221 | - }) | 155 | + this.userBuilderView() |
| 156 | + this.likeBuilderView() | ||
| 157 | + this.collectBuilderView() | ||
| 158 | + this.commentBuilderView() | ||
| 159 | + this.shareBuilderView() | ||
| 160 | + | ||
| 161 | + } | ||
| 162 | + // .backgroundColor(Color.Blue) | ||
| 163 | + // .height('100%') | ||
| 164 | + .width(58) | ||
| 165 | + .position({ x: '100%', y: '100%' }) | ||
| 166 | + .markAnchor({ x: '100%', y: '100%' }) | ||
| 167 | + .padding({ bottom: 72, right: 10 }) | ||
| 168 | + .visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible) | ||
| 169 | + | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + /** | ||
| 173 | + * 用户关注、号主页 | ||
| 174 | + */ | ||
| 175 | + @Builder | ||
| 176 | + userBuilderView() { | ||
| 177 | + Stack() { | ||
| 178 | + Image(this.getHeadUrl()) | ||
| 179 | + .width('100%') | ||
| 180 | + .borderRadius(24) | ||
| 181 | + .aspectRatio(1) | ||
| 182 | + .border({ width: 1, color: Color.White, style: BorderStyle.Solid }) | ||
| 183 | + .onClick(() => { | ||
| 184 | + // 跳转到号主页 | ||
| 185 | + if (this.contentDetailData.rmhInfo?.cnMainControl === 1) { | ||
| 186 | + const params: Params = { | ||
| 187 | + creatorId: this.contentDetailData.rmhInfo.rmhId, | ||
| 188 | + pageID: '' | ||
| 189 | + } | ||
| 190 | + WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) | ||
| 222 | } | 191 | } |
| 192 | + }) | ||
| 223 | 193 | ||
| 224 | - }.height(60) | ||
| 225 | - } | ||
| 226 | - }.margin({ bottom: 18 }) | 194 | + Image($r('app.media.ic_add')) |
| 195 | + .width(24) | ||
| 196 | + .borderRadius(12) | ||
| 197 | + .position({ x: '50%', y: '100%' }) | ||
| 198 | + .markAnchor({ x: '50%', y: '50%' }) | ||
| 199 | + .onClick(() => { | ||
| 200 | + // TODO:关注动画 | ||
| 201 | + this.handleAccention() | ||
| 202 | + }) | ||
| 203 | + } | ||
| 204 | + .height(48) | ||
| 205 | + .width('100%') | ||
| 206 | + .margin({ bottom: 30 }) | ||
| 207 | + .visibility(this.getHeadUrl() ? Visibility.Visible : Visibility.None) | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + /** | ||
| 211 | + * 将点赞样式转换为icon | ||
| 212 | + */ | ||
| 213 | + transLikeStyle2Icon(): Resource { | ||
| 214 | + if (this.likesStyle === 1) { | ||
| 215 | + return this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_like_check`) : $r(`app.media.ic_like_uncheck`) | ||
| 216 | + } else if (this.likesStyle === 2) { | ||
| 217 | + return this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_thub_check`) : $r(`app.media.ic_thub_uncheck`) | ||
| 218 | + } else if (this.likesStyle === 3) { | ||
| 219 | + return this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_candle_check`) : $r(`app.media.ic_candle_uncheck`) | ||
| 220 | + } | ||
| 221 | + return $r(`app.media.icon_like_ckeck`) | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + transNum2String(name: 'likeNum' | 'collectNum' | 'commentNum') { | ||
| 225 | + console.log(TAG, 'transNum2String', this.interactData.likeNum, this.interactData.collectNum, this.interactData.commentNum) | ||
| 226 | + if (name === 'likeNum') { | ||
| 227 | + return this.interactData.likeNum != 0 ? NumberFormatterUtils.formatNumberWithWan(this.interactData.likeNum || '') : '' | ||
| 228 | + } else if (name === 'collectNum') { | ||
| 229 | + return this.interactData.collectNum != 0 ? NumberFormatterUtils.formatNumberWithWan(this.interactData.collectNum || '') : '' | ||
| 230 | + } else { | ||
| 231 | + return this.interactData.commentNum != 0 ? NumberFormatterUtils.formatNumberWithWan(this.interactData.commentNum || '') : '' | ||
| 232 | + } | ||
| 227 | } | 233 | } |
| 228 | 234 | ||
| 235 | + /** | ||
| 236 | + * 点赞、默哀、祈福 | ||
| 237 | + */ | ||
| 229 | @Builder | 238 | @Builder |
| 230 | - buildOperationItem(item: OperationItem, index: number) { | 239 | + likeBuilderView() { |
| 231 | Column() { | 240 | Column() { |
| 232 | - if (item.text === '赞') { | ||
| 233 | - Image(this.newsStatusOfUser?.likeStatus == '1' ? item.icon_check : item.icon) | ||
| 234 | - .width(32) | ||
| 235 | - .aspectRatio(1) | ||
| 236 | - .onClick(() => { | ||
| 237 | - this.toggleLikeStatus() | ||
| 238 | - }) | ||
| 239 | - Text(this.interactData?.likeNum ? (this.interactData.likeNum + '') : item.text) | ||
| 240 | - .width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown) | ||
| 241 | - .fontWeight(500) | ||
| 242 | - .textAlign(TextAlign.Center) | ||
| 243 | - .fontSize(13) | ||
| 244 | - .fontColor('#FFFFFF') | ||
| 245 | - .maxLines(1) | ||
| 246 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 247 | - } else if (item.text === '收藏') { | ||
| 248 | - Image(this.newsStatusOfUser?.collectStatus == 1 ? item.icon_check : item.icon) | ||
| 249 | - .width(32) | ||
| 250 | - .aspectRatio(1) | ||
| 251 | - .onClick(() => { | ||
| 252 | - this.toggleCollectStatus() | ||
| 253 | - }) | ||
| 254 | - Text(this.interactData?.collectNum ? (this.interactData.collectNum + '') : item.text) | ||
| 255 | - .width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown) | ||
| 256 | - .fontWeight(500) | ||
| 257 | - .textAlign(TextAlign.Center) | ||
| 258 | - .fontSize(13) | ||
| 259 | - .fontColor('#FFFFFF') | ||
| 260 | - .maxLines(1) | ||
| 261 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 262 | - } else if (item.text === '抢首评') { | ||
| 263 | - Image(item.icon) | ||
| 264 | - .width(32) | ||
| 265 | - .aspectRatio(1) | ||
| 266 | - .onClick((event: ClickEvent) => { | ||
| 267 | - ToastUtils.showToast('评论为公共方法,待开发', 1000); | ||
| 268 | - }) | ||
| 269 | - Text(this.interactData?.commentNum ? (this.interactData.commentNum + '') : item.text) | ||
| 270 | - .width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown) | ||
| 271 | - .fontWeight(500) | ||
| 272 | - .textAlign(TextAlign.Center) | ||
| 273 | - .fontSize(13) | ||
| 274 | - .fontColor('#FFFFFF') | ||
| 275 | - .maxLines(1) | ||
| 276 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 277 | - } else { | ||
| 278 | - Image(item.icon) | ||
| 279 | - .width(32) | ||
| 280 | - .aspectRatio(1) | ||
| 281 | - .onClick((event: ClickEvent) => { | ||
| 282 | - ToastUtils.showToast('分享为公共方法,待开发', 1000); | ||
| 283 | - }) | ||
| 284 | - Text(item.text) | ||
| 285 | - .width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown) | ||
| 286 | - .fontWeight(500) | ||
| 287 | - .textAlign(TextAlign.Center) | ||
| 288 | - .fontSize(13) | ||
| 289 | - .fontColor('#FFFFFF') | ||
| 290 | - .maxLines(1) | ||
| 291 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 292 | - } | 241 | + Image(this.transLikeStyle2Icon()) |
| 242 | + .width(32) | ||
| 243 | + .aspectRatio(1) | ||
| 244 | + .onClick(() => { | ||
| 245 | + // TODO:点赞动画 | ||
| 246 | + this.toggleLikeStatus() | ||
| 247 | + }) | ||
| 248 | + Text(this.transNum2String('likeNum') || '赞') | ||
| 249 | + .width('100%') | ||
| 250 | + .fontWeight(500) | ||
| 251 | + .textAlign(TextAlign.Center) | ||
| 252 | + .fontSize(13) | ||
| 253 | + .fontColor('#FFFFFF') | ||
| 254 | + .maxLines(1) | ||
| 255 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 256 | + } | ||
| 257 | + .margin({ bottom: 20 }) | ||
| 258 | + .visibility(this.likesStyle !== 4 ? Visibility.Visible : Visibility.None) | ||
| 259 | + } | ||
| 293 | 260 | ||
| 261 | + /** | ||
| 262 | + * 收藏、取消收藏、收藏文件夹 | ||
| 263 | + */ | ||
| 264 | + @Builder | ||
| 265 | + collectBuilderView() { | ||
| 266 | + Column() { | ||
| 267 | + Image(this.newsStatusOfUser.collectStatus == 1 ? $r(`app.media.ic_collect_check`) : $r(`app.media.ic_collect_uncheck`)) | ||
| 268 | + .width(32) | ||
| 269 | + .aspectRatio(1) | ||
| 270 | + .onClick(() => { | ||
| 271 | + this.toggleCollectStatus() | ||
| 272 | + }) | ||
| 273 | + Text(this.transNum2String('collectNum') || '收藏') | ||
| 274 | + .width('100%') | ||
| 275 | + .fontWeight(500) | ||
| 276 | + .textAlign(TextAlign.Center) | ||
| 277 | + .fontSize(13) | ||
| 278 | + .fontColor('#FFFFFF') | ||
| 279 | + .maxLines(1) | ||
| 280 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 294 | } | 281 | } |
| 295 | - // .width(48) | ||
| 296 | .margin({ bottom: 20 }) | 282 | .margin({ bottom: 20 }) |
| 297 | - .alignItems(HorizontalAlign.Center) | ||
| 298 | - .hoverEffect(HoverEffect.Scale) | 283 | + } |
| 299 | 284 | ||
| 285 | + /** | ||
| 286 | + * 评论 | ||
| 287 | + */ | ||
| 288 | + @Builder | ||
| 289 | + commentBuilderView() { | ||
| 290 | + Column() { | ||
| 291 | + Image($r(`app.media.ic_comment`)) | ||
| 292 | + .width(32) | ||
| 293 | + .aspectRatio(1) | ||
| 294 | + .onClick((event: ClickEvent) => { | ||
| 295 | + ToastUtils.showToast('评论为公共方法,待开发', 1000); | ||
| 296 | + }) | ||
| 297 | + Text(this.transNum2String('commentNum') || '抢首评') | ||
| 298 | + .width('100%') | ||
| 299 | + .fontWeight(500) | ||
| 300 | + .textAlign(TextAlign.Center) | ||
| 301 | + .fontSize(13) | ||
| 302 | + .fontColor('#FFFFFF') | ||
| 303 | + .maxLines(1) | ||
| 304 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 305 | + } | ||
| 306 | + .margin({ bottom: 20 }) | ||
| 300 | } | 307 | } |
| 301 | 308 | ||
| 302 | - build() { | 309 | + /** |
| 310 | + * 分享 | ||
| 311 | + */ | ||
| 312 | + @Builder | ||
| 313 | + shareBuilderView() { | ||
| 303 | Column() { | 314 | Column() { |
| 304 | - this.buildUserComp() | ||
| 305 | - ForEach(this.operationList, (item: OperationItem, index: number) => { | ||
| 306 | - this.buildOperationItem(item, index) | ||
| 307 | - }, (item: OperationItem, index: number) => JSON.stringify(item)) | 315 | + Image($r(`app.media.ic_share`)) |
| 316 | + .width(32) | ||
| 317 | + .aspectRatio(1) | ||
| 318 | + .onClick((event: ClickEvent) => { | ||
| 319 | + ToastUtils.showToast('分享为公共方法,待开发', 1000); | ||
| 320 | + }) | ||
| 321 | + Text('分享') | ||
| 322 | + .width('100%') | ||
| 323 | + .fontWeight(500) | ||
| 324 | + .textAlign(TextAlign.Center) | ||
| 325 | + .fontSize(13) | ||
| 326 | + .fontColor('#FFFFFF') | ||
| 327 | + .maxLines(1) | ||
| 328 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 308 | } | 329 | } |
| 309 | - .width(48) | ||
| 310 | - .position({ x: '100%', y: '100%' }) | ||
| 311 | - .markAnchor({ x: '100%', y: '100%' }) | ||
| 312 | - .padding({ bottom: 72 }) | ||
| 313 | - .visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible) | 330 | + .margin({ bottom: 20 }) |
| 314 | } | 331 | } |
| 315 | } | 332 | } |
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_candle_check.png
0 → 100644
2.15 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_candle_uncheck.png
0 → 100644
711 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_thub_check.png
0 → 100644
5.22 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_thub_uncheck.png
0 → 100644
1.7 KB
| @@ -2,7 +2,7 @@ import { abilityAccessCtrl, bundleManager, Permissions } from '@kit.AbilityKit'; | @@ -2,7 +2,7 @@ import { abilityAccessCtrl, bundleManager, Permissions } from '@kit.AbilityKit'; | ||
| 2 | import { BusinessError } from '@kit.BasicServicesKit'; | 2 | import { BusinessError } from '@kit.BasicServicesKit'; |
| 3 | import { geoLocationManager } from '@kit.LocationKit'; | 3 | import { geoLocationManager } from '@kit.LocationKit'; |
| 4 | import { SpConstants } from 'wdConstant/Index'; | 4 | import { SpConstants } from 'wdConstant/Index'; |
| 5 | -import { Logger, PermissionUtils, ResourcesUtils, SPHelper } from 'wdKit/Index'; | 5 | +import { EmitterEventId, EmitterUtils, Logger, PermissionUtils, ResourcesUtils, SPHelper } from 'wdKit/Index'; |
| 6 | import { ResponseDTO } from 'wdNetwork/Index'; | 6 | import { ResponseDTO } from 'wdNetwork/Index'; |
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| @@ -54,6 +54,11 @@ export class HWLocationUtils { | @@ -54,6 +54,11 @@ export class HWLocationUtils { | ||
| 54 | return | 54 | return |
| 55 | } | 55 | } |
| 56 | let context = getContext(); | 56 | let context = getContext(); |
| 57 | + let per=SPHelper.default.getSync(SpConstants.LOCATION_PERMISSION_REFUSE,false) | ||
| 58 | + if(!per){ | ||
| 59 | + EmitterUtils.sendEmptyEvent(EmitterEventId.LOCATION) | ||
| 60 | + SPHelper.default.save(SpConstants.LOCATION_PERMISSION_REFUSE,true) | ||
| 61 | + } | ||
| 57 | let requestGrant = await PermissionUtils.reqPermissionsFromUser([HWLocationUtils.APPROXIMATELY_LOCATION], context); | 62 | let requestGrant = await PermissionUtils.reqPermissionsFromUser([HWLocationUtils.APPROXIMATELY_LOCATION], context); |
| 58 | Logger.debug('location2 :' + requestGrant) | 63 | Logger.debug('location2 :' + requestGrant) |
| 59 | if (requestGrant) { | 64 | if (requestGrant) { |
| 1 | -import { BottomNavigationComponent, LogoutViewModel } from 'wdComponent'; | 1 | +import { BottomNavigationComponent, LogoutViewModel, PermissionDesComponent } from 'wdComponent'; |
| 2 | import { BreakpointConstants } from 'wdConstant'; | 2 | import { BreakpointConstants } from 'wdConstant'; |
| 3 | 3 | ||
| 4 | import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger } from 'wdKit'; | 4 | import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger } from 'wdKit'; |
| @@ -16,7 +16,7 @@ struct MainPage { | @@ -16,7 +16,7 @@ struct MainPage { | ||
| 16 | @Provide pageHide: number = -1 | 16 | @Provide pageHide: number = -1 |
| 17 | private breakpointSystem: BreakpointSystem = new BreakpointSystem() | 17 | private breakpointSystem: BreakpointSystem = new BreakpointSystem() |
| 18 | @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS; | 18 | @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS; |
| 19 | - | 19 | + @State isPermission: boolean = false |
| 20 | watchCurrentBreakpoint() { | 20 | watchCurrentBreakpoint() { |
| 21 | Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`); | 21 | Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`); |
| 22 | } | 22 | } |
| @@ -28,6 +28,9 @@ struct MainPage { | @@ -28,6 +28,9 @@ struct MainPage { | ||
| 28 | EmitterUtils.receiveEvent(EmitterEventId.FORCE_USER_LOGIN_OUT, () => { | 28 | EmitterUtils.receiveEvent(EmitterEventId.FORCE_USER_LOGIN_OUT, () => { |
| 29 | LogoutViewModel.clearLoginInfo() | 29 | LogoutViewModel.clearLoginInfo() |
| 30 | }) | 30 | }) |
| 31 | + EmitterUtils.receiveEvent(EmitterEventId.LOCATION, () => { | ||
| 32 | + this.isPermission=true | ||
| 33 | + }) | ||
| 31 | } | 34 | } |
| 32 | 35 | ||
| 33 | aboutToDisappear() { | 36 | aboutToDisappear() { |
| @@ -50,8 +53,11 @@ struct MainPage { | @@ -50,8 +53,11 @@ struct MainPage { | ||
| 50 | } | 53 | } |
| 51 | 54 | ||
| 52 | build() { | 55 | build() { |
| 53 | - Column() { | 56 | + Stack({alignContent:Alignment.Top}) { |
| 54 | BottomNavigationComponent() | 57 | BottomNavigationComponent() |
| 58 | + if(this.isPermission){ | ||
| 59 | + PermissionDesComponent() | ||
| 60 | + } | ||
| 55 | } | 61 | } |
| 56 | } | 62 | } |
| 57 | } | 63 | } |
| @@ -60,7 +60,7 @@ struct LaunchAdvertisingPage { | @@ -60,7 +60,7 @@ struct LaunchAdvertisingPage { | ||
| 60 | 60 | ||
| 61 | Stack({alignContent:Alignment.Bottom}){ | 61 | Stack({alignContent:Alignment.Bottom}){ |
| 62 | Column(){ | 62 | Column(){ |
| 63 | - if(!(this.model.launchAdInfo[0].matInfo.matType == '1')){ | 63 | + if(this.model.launchAdInfo.length && !(this.model.launchAdInfo[0].matInfo.matType == '1')){ |
| 64 | //显示图片 | 64 | //显示图片 |
| 65 | Image(this.model.launchAdInfo[0].matInfo.matImageUrl[0]) | 65 | Image(this.model.launchAdInfo[0].matInfo.matImageUrl[0]) |
| 66 | .width('100%') | 66 | .width('100%') |
| @@ -100,7 +100,7 @@ struct LaunchAdvertisingPage { | @@ -100,7 +100,7 @@ struct LaunchAdvertisingPage { | ||
| 100 | } | 100 | } |
| 101 | .width('100%') | 101 | .width('100%') |
| 102 | .height('100%') | 102 | .height('100%') |
| 103 | - if(!(this.model.launchAdInfo[0].matInfo.startStyle == 1)){ | 103 | + if(this.model.launchAdInfo.length && !(this.model.launchAdInfo[0].matInfo.startStyle == 1)){ |
| 104 | //底部logo样式 按钮加载在背景展示图上 | 104 | //底部logo样式 按钮加载在背景展示图上 |
| 105 | Button(){ | 105 | Button(){ |
| 106 | Row(){ | 106 | Row(){ |
| @@ -133,7 +133,7 @@ struct LaunchAdvertisingPage { | @@ -133,7 +133,7 @@ struct LaunchAdvertisingPage { | ||
| 133 | .height('84%') | 133 | .height('84%') |
| 134 | .margin({top:'0'}) | 134 | .margin({top:'0'}) |
| 135 | 135 | ||
| 136 | - if(this.model.launchAdInfo[0].matInfo.startStyle == 1){ | 136 | + if(this.model.launchAdInfo.length && this.model.launchAdInfo[0].matInfo.startStyle == 1){ |
| 137 | //全屏样式,底部无logo 按钮放在原底部logo位置 | 137 | //全屏样式,底部无logo 按钮放在原底部logo位置 |
| 138 | Button(){ | 138 | Button(){ |
| 139 | Row(){ | 139 | Row(){ |
| @@ -176,17 +176,19 @@ struct LaunchAdvertisingPage { | @@ -176,17 +176,19 @@ struct LaunchAdvertisingPage { | ||
| 176 | action(){ | 176 | action(){ |
| 177 | //跳转 url linkUrl https://news.bjd.com.cn/2024/03/19/10724331.shtml | 177 | //跳转 url linkUrl https://news.bjd.com.cn/2024/03/19/10724331.shtml |
| 178 | // openType 端外 端内 打开 | 178 | // openType 端外 端内 打开 |
| 179 | - if (this.model.launchAdInfo[0].matInfo.openType == '2') { | ||
| 180 | - //端外打开 | 179 | + if(this.model.launchAdInfo.length){ |
| 180 | + if (this.model.launchAdInfo[0].matInfo.openType == '2') { | ||
| 181 | + //端外打开 | ||
| 181 | 182 | ||
| 182 | - ProcessUtils.jumpExternalWebPage(this.model.launchAdInfo[0].matInfo.linkUrl) | ||
| 183 | - clearInterval(this.timer) | 183 | + ProcessUtils.jumpExternalWebPage(this.model.launchAdInfo[0].matInfo.linkUrl) |
| 184 | + clearInterval(this.timer) | ||
| 184 | 185 | ||
| 185 | - }else { | ||
| 186 | - //端内打开 | ||
| 187 | - ProcessUtils.gotoDefaultWebPage(this.model.launchAdInfo[0].matInfo.linkUrl) | ||
| 188 | - clearInterval(this.timer) | 186 | + }else { |
| 187 | + //端内打开 | ||
| 188 | + ProcessUtils.gotoDefaultWebPage(this.model.launchAdInfo[0].matInfo.linkUrl) | ||
| 189 | + clearInterval(this.timer) | ||
| 189 | 190 | ||
| 191 | + } | ||
| 190 | } | 192 | } |
| 191 | } | 193 | } |
| 192 | 194 |
| @@ -118,6 +118,7 @@ struct LaunchInterestsHobbiesPage { | @@ -118,6 +118,7 @@ struct LaunchInterestsHobbiesPage { | ||
| 118 | // .rowsTemplate('1fr 1fr 1fr 1fr') | 118 | // .rowsTemplate('1fr 1fr 1fr 1fr') |
| 119 | .columnsGap('23lpx') | 119 | .columnsGap('23lpx') |
| 120 | .rowsGap('23lpx') | 120 | .rowsGap('23lpx') |
| 121 | + .scrollBar(BarState.Off) | ||
| 121 | 122 | ||
| 122 | Stack({alignContent:Alignment.Center}){ | 123 | Stack({alignContent:Alignment.Center}){ |
| 123 | Button(this.selectCount == 0?'选好了':'选好了(' + this.selectCount + ')') | 124 | Button(this.selectCount == 0?'选好了':'选好了(' + this.selectCount + ')') |
sight_harmony/products/phone/src/main/resources/rawfile/appointment_list_data.json
deleted
100644 → 0
| 1 | -{ | ||
| 2 | - "code": "0", | ||
| 3 | - "data": { | ||
| 4 | - "list": [{ | ||
| 5 | - "appStyle": "15", | ||
| 6 | - "imageUrl": ["https://sitcontentjdcdn.aikan.pdnews.cn/sjbj-20231204/image/live/563cc8ce1ecc43b288f6cf60da66579c.jpeg?x-oss-process=image/resize,l_550,m_fill,h_450,w_800/quality,q_90/format,jpg"], | ||
| 7 | - "liveId": 20000007348, | ||
| 8 | - "planStartTime": "2023-12-05 15:26:10", | ||
| 9 | - "relId": "500000017021", | ||
| 10 | - "relType": 1, | ||
| 11 | - "startTime": "", | ||
| 12 | - "status": "wait", | ||
| 13 | - "title": "视界运营位加权-加权中删除" | ||
| 14 | - }, { | ||
| 15 | - "appStyle": "null", | ||
| 16 | - "imageUrl": ["https://sitcontentjdcdn.aikan.pdnews.cn/sjbj-20230914/image/display/9af825a00abf490d8a8698f4fc079447.jpg?x-oss-process=image/resize,l_550,m_fill,h_450,w_800/quality,q_90/format,jpg"], | ||
| 17 | - "liveId": 20000007492, | ||
| 18 | - "planStartTime": "2024-01-12 20:00:00", | ||
| 19 | - "relId": "500000020284", | ||
| 20 | - "relType": 1, | ||
| 21 | - "startTime": "", | ||
| 22 | - "status": "wait", | ||
| 23 | - "title": "QA|汉阴县凤堰古梯田" | ||
| 24 | - }, { | ||
| 25 | - "appStyle": "null", | ||
| 26 | - "imageUrl": ["https://sitcontentjdcdn.aikan.pdnews.cn/sjbj-20230915/image/display/e908748c62a44109bbb7214f3fed458c.jpg?x-oss-process=image/resize,l_550,m_fill,h_450,w_800/quality,q_90/format,jpg"], | ||
| 27 | - "liveId": 20000007493, | ||
| 28 | - "planStartTime": "2024-01-12 20:00:00", | ||
| 29 | - "relId": "500000020286", | ||
| 30 | - "relType": 1, | ||
| 31 | - "startTime": "", | ||
| 32 | - "status": "wait", | ||
| 33 | - "title": "二十四节气-夏至" | ||
| 34 | - }, { | ||
| 35 | - "appStyle": "null", | ||
| 36 | - "imageUrl": ["https://sitcontentjdcdn.aikan.pdnews.cn/sjbj-20240118/image/display/732d6166103d4d2f9fbf512b128a3486.jpeg?x-oss-process=image/resize,l_550,m_fill,h_450,w_800/quality,q_90/format,jpg"], | ||
| 37 | - "liveId": 20000007495, | ||
| 38 | - "planStartTime": "2024-01-18 10:51:33", | ||
| 39 | - "relId": "500000030122", | ||
| 40 | - "relType": 1, | ||
| 41 | - "startTime": "", | ||
| 42 | - "status": "wait", | ||
| 43 | - "title": "01181050文字直播没有预告片" | ||
| 44 | - }, { | ||
| 45 | - "appStyle": "null", | ||
| 46 | - "imageUrl": ["https://sitcontentjdcdn.aikan.pdnews.cn/sjbj-20240127/image/live/6359d000bba24812b7ca1765bb106a49.png?x-oss-process=image/resize,l_550,m_fill,h_450,w_800/quality,q_90/format,jpg"], | ||
| 47 | - "liveId": 20000007519, | ||
| 48 | - "planStartTime": "2024-02-27 18:18:16", | ||
| 49 | - "relId": "500000034054", | ||
| 50 | - "relType": 1, | ||
| 51 | - "startTime": "", | ||
| 52 | - "status": "wait", | ||
| 53 | - "title": "错搞民宿33" | ||
| 54 | - }, { | ||
| 55 | - "appStyle": "15", | ||
| 56 | - "imageUrl": ["https://sitcontentjdcdn.aikan.pdnews.cn/sjbj-20240228/image/live/e6998ab547af472dbc19ba2fd68959b9.jpeg?x-oss-process=image/resize,l_550,m_fill,h_450,w_800/quality,q_90/format,jpg"], | ||
| 57 | - "liveId": 20000007521, | ||
| 58 | - "planStartTime": "2024-02-28 19:01:50", | ||
| 59 | - "relId": "500000034162", | ||
| 60 | - "relType": 1, | ||
| 61 | - "startTime": "", | ||
| 62 | - "status": "wait", | ||
| 63 | - "title": "保存编辑弹幕开关" | ||
| 64 | - }], | ||
| 65 | - "pageNum": 1, | ||
| 66 | - "pageSize": 20, | ||
| 67 | - "totalCount": 6 | ||
| 68 | - }, | ||
| 69 | - "message": "Success", | ||
| 70 | - "requestId": "65289f1217934cffb7587ff4d6ce4689", | ||
| 71 | - "success": true, | ||
| 72 | - "timestamp": 1710555152344 | ||
| 73 | -} |
-
Please register or login to post a comment