Showing
58 changed files
with
1037 additions
and
458 deletions
| @@ -7,6 +7,7 @@ const TAG = 'KVStoreHelper' | @@ -7,6 +7,7 @@ const TAG = 'KVStoreHelper' | ||
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| 9 | * 键值型数据库管理类,类似sp,存储变大,单条数据,value<4M | 9 | * 键值型数据库管理类,类似sp,存储变大,单条数据,value<4M |
| 10 | + * TODO 是否需要开线程 | ||
| 10 | */ | 11 | */ |
| 11 | export class KVStoreHelper { | 12 | export class KVStoreHelper { |
| 12 | private static _context: Context; | 13 | private static _context: Context; |
| @@ -16,7 +17,6 @@ export class KVStoreHelper { | @@ -16,7 +17,6 @@ export class KVStoreHelper { | ||
| 16 | private kvStore: distributedKVStore.SingleKVStore | undefined = undefined; | 17 | private kvStore: distributedKVStore.SingleKVStore | undefined = undefined; |
| 17 | 18 | ||
| 18 | private constructor() { | 19 | private constructor() { |
| 19 | - Logger.error(TAG, 'constructor') | ||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | static init(context: Context) { | 22 | static init(context: Context) { |
| @@ -7,6 +7,7 @@ import { HostEnum, HostManager } from './HttpHostManager'; | @@ -7,6 +7,7 @@ import { HostEnum, HostManager } from './HttpHostManager'; | ||
| 7 | * 网络请求参数工具类,TODO 不对外暴露,收缩权限 | 7 | * 网络请求参数工具类,TODO 不对外暴露,收缩权限 |
| 8 | */ | 8 | */ |
| 9 | export class HttpParams { | 9 | export class HttpParams { |
| 10 | + | ||
| 10 | static buildHeaders(): Record<string, string> { | 11 | static buildHeaders(): Record<string, string> { |
| 11 | let headers: Record<string, string> = {}; | 12 | let headers: Record<string, string> = {}; |
| 12 | // 通用请求头 | 13 | // 通用请求头 |
| @@ -90,8 +91,17 @@ export class HttpParams { | @@ -90,8 +91,17 @@ export class HttpParams { | ||
| 90 | return '10000'; | 91 | return '10000'; |
| 91 | } | 92 | } |
| 92 | 93 | ||
| 93 | - private static getVersionName() { | 94 | + public static getVersionName() { |
| 94 | // TODO 读取配置 | 95 | // TODO 读取配置 |
| 95 | return '1.0.0'; | 96 | return '1.0.0'; |
| 96 | } | 97 | } |
| 98 | + | ||
| 99 | + //获取机型 | ||
| 100 | + static getPhoneModel() { | ||
| 101 | + return 'getPhoneModel' | ||
| 102 | + } | ||
| 103 | + //获取当前手机系统版本号 | ||
| 104 | + static getSystemVersion() { | ||
| 105 | + return 'getSystemVersion' | ||
| 106 | + } | ||
| 97 | } | 107 | } |
| @@ -349,6 +349,11 @@ export class HttpUrlUtils { | @@ -349,6 +349,11 @@ export class HttpUrlUtils { | ||
| 349 | */ | 349 | */ |
| 350 | static readonly HISTORY_PUSH_MESSAGE_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/push"; | 350 | static readonly HISTORY_PUSH_MESSAGE_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/push"; |
| 351 | 351 | ||
| 352 | + /** | ||
| 353 | + * 意见反馈-提交 | ||
| 354 | + */ | ||
| 355 | + static readonly FEEDBACK_COMMIT_PATH: string = "/api/rmrb-interact/interact/zh/c/user/feedBack"; | ||
| 356 | + | ||
| 352 | static getHost(): string { | 357 | static getHost(): string { |
| 353 | return HostManager.getHost(); | 358 | return HostManager.getHost(); |
| 354 | } | 359 | } |
| 1 | -/** | ||
| 2 | - * 接口数据存储封装类 | ||
| 3 | - */ | ||
| 4 | import { DateTimeUtils, StringUtils } from 'wdKit/Index'; | 1 | import { DateTimeUtils, StringUtils } from 'wdKit/Index'; |
| 5 | import { CacheDataSaveUtil } from './CacheDataSaveUtil'; | 2 | import { CacheDataSaveUtil } from './CacheDataSaveUtil'; |
| 3 | +import { JSON } from '@kit.ArkTS'; | ||
| 6 | 4 | ||
| 5 | +/** | ||
| 6 | + * 接口数据存储封装类 | ||
| 7 | + */ | ||
| 7 | export class CacheData { | 8 | export class CacheData { |
| 9 | + /** | ||
| 10 | + * 底部导航栏缓存的数据key | ||
| 11 | + */ | ||
| 12 | + static bottomCacheKey = 'bottom_cache_data_key' | ||
| 13 | + /** | ||
| 14 | + * 头部频道缓存的数据key | ||
| 15 | + */ | ||
| 16 | + static channelCacheDataKey = 'channel_data_cache_id_' | ||
| 17 | + /** | ||
| 18 | + * 页面page组件的数据key | ||
| 19 | + */ | ||
| 20 | + static comPageInfoCacheKey = 'com_pageInfo_cache_id_' | ||
| 21 | + /** | ||
| 22 | + * 页面组件的数据key | ||
| 23 | + */ | ||
| 24 | + static compGroupInfoDataCacheKey = 'com_data_info_cache_id_' | ||
| 8 | // 接口返回数据 | 25 | // 接口返回数据 |
| 9 | networkData?: object; | 26 | networkData?: object; |
| 10 | // 数据更新时间戳 | 27 | // 数据更新时间戳 |
| @@ -48,16 +65,20 @@ export class CacheData { | @@ -48,16 +65,20 @@ export class CacheData { | ||
| 48 | success(null) | 65 | success(null) |
| 49 | return | 66 | return |
| 50 | } | 67 | } |
| 51 | - let ll = CacheDataSaveUtil.get(key) | ||
| 52 | - if (ll instanceof Promise) { | ||
| 53 | - ll.then((data) => { | ||
| 54 | - let str = data as string | ||
| 55 | - let cache = JSON.parse(str) as CacheData | ||
| 56 | - success(cache) | ||
| 57 | - }) | ||
| 58 | - } else { | 68 | + CacheDataSaveUtil.get(key).then((data) => { |
| 69 | + let str = data as string | ||
| 70 | + let cache = JSON.parse(str) as CacheData | ||
| 71 | + success(cache) | ||
| 72 | + }).catch(() => { | ||
| 59 | success(null) | 73 | success(null) |
| 60 | - } | 74 | + }) |
| 61 | }) | 75 | }) |
| 62 | } | 76 | } |
| 77 | + | ||
| 78 | + static getNetworkData(data: CacheData): string { | ||
| 79 | + if (data.networkData) { | ||
| 80 | + return JSON.stringify(data.networkData); | ||
| 81 | + } | ||
| 82 | + return ""; | ||
| 83 | + } | ||
| 63 | } | 84 | } |
| @@ -11,10 +11,18 @@ export class CacheDataSaveUtil { | @@ -11,10 +11,18 @@ export class CacheDataSaveUtil { | ||
| 11 | KVStoreHelper.default.put(key, value) | 11 | KVStoreHelper.default.put(key, value) |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | - static get(key: string) { | ||
| 15 | - if (StringUtils.isEmpty(key)) { | ||
| 16 | - return '' | ||
| 17 | - } | ||
| 18 | - return KVStoreHelper.default.get(key, '') | 14 | + static get(key: string): Promise<string> { |
| 15 | + return new Promise<string>((success) => { | ||
| 16 | + if (StringUtils.isEmpty(key)) { | ||
| 17 | + success('') | ||
| 18 | + } else { | ||
| 19 | + KVStoreHelper.default.get(key, '').then((data) => { | ||
| 20 | + let str = data as string | ||
| 21 | + success(str) | ||
| 22 | + }).catch(() => { | ||
| 23 | + success('') | ||
| 24 | + }) | ||
| 25 | + } | ||
| 26 | + }) | ||
| 19 | } | 27 | } |
| 20 | } | 28 | } |
| 1 | +import HomeChannelUtils from './src/main/ets/utils/HomeChannelUtils'; | ||
| 2 | + | ||
| 3 | +export default HomeChannelUtils; | ||
| 4 | + | ||
| 1 | export { WDRouterRule } from './src/main/ets/router/WDRouterRule' | 5 | export { WDRouterRule } from './src/main/ets/router/WDRouterRule' |
| 2 | 6 | ||
| 3 | export { WDRouterPage } from './src/main/ets/router/WDRouterPage' | 7 | export { WDRouterPage } from './src/main/ets/router/WDRouterPage' |
| @@ -6,4 +10,6 @@ export { registerRouter } from './src/main/ets/router/Action2Page' | @@ -6,4 +10,6 @@ export { registerRouter } from './src/main/ets/router/Action2Page' | ||
| 6 | 10 | ||
| 7 | export { ProcessUtils } from './src/main/ets/utils/ProcessUtils' | 11 | export { ProcessUtils } from './src/main/ets/utils/ProcessUtils' |
| 8 | 12 | ||
| 13 | +export { AssignChannelParam } from './src/main/ets/utils/HomeChannelUtils'; | ||
| 14 | + | ||
| 9 | export { RouterJumpInterceptor, JumpInterceptorAction } from './src/main/ets/router/RouterJumpInterceptor' | 15 | export { RouterJumpInterceptor, JumpInterceptorAction } from './src/main/ets/router/RouterJumpInterceptor' |
| @@ -2,7 +2,6 @@ import { BottomNavDTO, NavigationBodyDTO, TopNavDTO } from 'wdBean/Index'; | @@ -2,7 +2,6 @@ import { BottomNavDTO, NavigationBodyDTO, TopNavDTO } from 'wdBean/Index'; | ||
| 2 | import { EmitterEventId, EmitterUtils, StringUtils } from 'wdKit/Index'; | 2 | import { EmitterEventId, EmitterUtils, StringUtils } from 'wdKit/Index'; |
| 3 | import { WDRouterPage } from '../router/WDRouterPage'; | 3 | import { WDRouterPage } from '../router/WDRouterPage'; |
| 4 | import { WDRouterRule } from '../router/WDRouterRule'; | 4 | import { WDRouterRule } from '../router/WDRouterRule'; |
| 5 | -import { HashMap } from '@kit.ArkTS'; | ||
| 6 | 5 | ||
| 7 | /** | 6 | /** |
| 8 | * 首页、频道相关跳转、处理 | 7 | * 首页、频道相关跳转、处理 |
| 1 | import { Action, ContentDTO, Params, PhotoListBean, commentInfo } from 'wdBean'; | 1 | import { Action, ContentDTO, Params, PhotoListBean, commentInfo } from 'wdBean'; |
| 2 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; | 2 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; |
| 3 | -import { Logger } from 'wdKit'; | 3 | +import { Logger, SPHelper } from 'wdKit'; |
| 4 | import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; | 4 | import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; |
| 5 | import { WDRouterRule, WDRouterPage } from '../../../../Index'; | 5 | import { WDRouterRule, WDRouterPage } from '../../../../Index'; |
| 6 | -import { ContentConstants } from 'wdConstant'; | 6 | +import { ContentConstants, SpConstants } from 'wdConstant'; |
| 7 | import { common, Want } from '@kit.AbilityKit'; | 7 | import { common, Want } from '@kit.AbilityKit'; |
| 8 | import { BusinessError } from '@kit.BasicServicesKit'; | 8 | import { BusinessError } from '@kit.BasicServicesKit'; |
| 9 | import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; | 9 | import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; |
| @@ -462,7 +462,13 @@ export class ProcessUtils { | @@ -462,7 +462,13 @@ export class ProcessUtils { | ||
| 462 | /** | 462 | /** |
| 463 | * 意见反馈 | 463 | * 意见反馈 |
| 464 | */ | 464 | */ |
| 465 | - public static gotoFeedBackActivity() { | 465 | + public static async gotoFeedBackActivity() { |
| 466 | + // 未登录,跳转登录 | ||
| 467 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 468 | + if (!user_id) { | ||
| 469 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 470 | + return | ||
| 471 | + } | ||
| 466 | let taskAction: Action = { | 472 | let taskAction: Action = { |
| 467 | type: 'JUMP_INNER_NEW_PAGE', | 473 | type: 'JUMP_INNER_NEW_PAGE', |
| 468 | params: { | 474 | params: { |
| @@ -122,7 +122,9 @@ function handleJsCallReceiveH5Data(data: Message) { | @@ -122,7 +122,9 @@ function handleJsCallReceiveH5Data(data: Message) { | ||
| 122 | width: item.width, | 122 | width: item.width, |
| 123 | height: item.height, | 123 | height: item.height, |
| 124 | picPath: item.pic, | 124 | picPath: item.pic, |
| 125 | - picDesc: '' | 125 | + picDesc: '', |
| 126 | + itemType:2, | ||
| 127 | + id:0 | ||
| 126 | } | 128 | } |
| 127 | return photo | 129 | return photo |
| 128 | }) | 130 | }) |
| @@ -174,4 +174,4 @@ export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean'; | @@ -174,4 +174,4 @@ export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean'; | ||
| 174 | 174 | ||
| 175 | 175 | ||
| 176 | 176 | ||
| 177 | -export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean'; | ||
| 177 | +export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean'; |
| @@ -4,10 +4,13 @@ | @@ -4,10 +4,13 @@ | ||
| 4 | 4 | ||
| 5 | // 【图文、图集稿件正文图片】图片信息数组 | 5 | // 【图文、图集稿件正文图片】图片信息数组 |
| 6 | export interface PhotoListBean { | 6 | export interface PhotoListBean { |
| 7 | + id: number; | ||
| 7 | height: number; | 8 | height: number; |
| 8 | width: number; | 9 | width: number; |
| 9 | picPath: string; | 10 | picPath: string; |
| 10 | picDesc: string; | 11 | picDesc: string; |
| 12 | + //1添加图片,2图片 | ||
| 13 | + itemType: number; | ||
| 11 | } | 14 | } |
| 12 | 15 | ||
| 13 | export interface InputMethodProperty { | 16 | export interface InputMethodProperty { |
| @@ -4,17 +4,20 @@ import { TopNavDTO } from './TopNavDTO'; | @@ -4,17 +4,20 @@ import { TopNavDTO } from './TopNavDTO'; | ||
| 4 | /** | 4 | /** |
| 5 | * 导航Body数据 | 5 | * 导航Body数据 |
| 6 | */ | 6 | */ |
| 7 | -export interface NavigationBodyDTO { | ||
| 8 | - backgroundColor: string; // 迭代二新增-底部导航背景色(信息流频道) | ||
| 9 | - bottomNavList: BottomNavDTO[]; | ||
| 10 | - | 7 | +export class NavigationBodyDTO { |
| 8 | + backgroundColor: string = ''; // 迭代二新增-底部导航背景色(信息流频道) | ||
| 9 | + bottomNavList: BottomNavDTO[] = []; | ||
| 11 | // greyBottomNav: GreyBottomNav; // 灰度皮肤 | 10 | // greyBottomNav: GreyBottomNav; // 灰度皮肤 |
| 12 | - immersiveBackgroundColor: string; // 迭代二新增-底部导航背景色(沉浸式频道) | ||
| 13 | - nightBackgroundColor: string; // 迭代三新增-底部导航背景色(夜间模式) | 11 | + immersiveBackgroundColor: string = ''; // 迭代二新增-底部导航背景色(沉浸式频道) |
| 12 | + nightBackgroundColor: string = ''; // 迭代三新增-底部导航背景色(夜间模式) | ||
| 13 | + | ||
| 14 | + md5: string = '' | ||
| 14 | } | 15 | } |
| 15 | 16 | ||
| 16 | -export interface NavigationDetailDTO { | ||
| 17 | - id: string; // 迭代二新增-底部导航背景色(信息流频道) | ||
| 18 | - bottomNavCompList: BottomNavCompDTO[]; | ||
| 19 | - topNavChannelList: TopNavDTO[]; | 17 | +export class NavigationDetailDTO { |
| 18 | + id: string = ''; // 迭代二新增-底部导航背景色(信息流频道) | ||
| 19 | + bottomNavCompList: BottomNavCompDTO[] = []; | ||
| 20 | + topNavChannelList: TopNavDTO[] = []; | ||
| 21 | + | ||
| 22 | + md5: string = '' | ||
| 20 | } | 23 | } |
| 1 | /** | 1 | /** |
| 2 | * 顶导 | 2 | * 顶导 |
| 3 | */ | 3 | */ |
| 4 | -export interface TopNavDTO { | ||
| 5 | - channelId: number; | ||
| 6 | - channelStyle: number; | ||
| 7 | - channelType: number; // 频道样式;1-沉浸式;2-信息流;3-特殊频道(跳转指定页面的,如版面) | ||
| 8 | - defaultPermitted: number; | ||
| 9 | - delPermitted: number; | ||
| 10 | - fontCColor: string; // 频道展示样式颜色(选中状态) | ||
| 11 | - fontColor: string; // 频道展示样式颜色(未选中状态) | ||
| 12 | - headlinesOn: number; | ||
| 13 | - homeChannel: string; | ||
| 14 | - iconUrlSize: string; | ||
| 15 | - iconCUrlSize: string; | ||
| 16 | - iconUrl: string; // 频道图片展示样式图片相对地址(未选中状态) | ||
| 17 | - iconCUrl: string; //频道图片展示样式图片相对地址(选中状态 | ||
| 18 | - localChannel: string; | ||
| 19 | - moreChannel: string; | ||
| 20 | - movePermitted: number; | ||
| 21 | - myChannel: string; | ||
| 22 | - name: string; | ||
| 23 | - num: number; | ||
| 24 | - pageId: number; | ||
| 25 | - pageType: string; | ||
| 26 | - underlineCColor: string; // 选中下划线颜色 | 4 | +export class TopNavDTO { |
| 5 | + channelId: number = 0; | ||
| 6 | + channelStyle: number = 0; | ||
| 7 | + channelType: number = 0; // 频道样式;1-沉浸式;2-信息流;3-特殊频道(跳转指定页面的,如版面) | ||
| 8 | + defaultPermitted: number = 0; | ||
| 9 | + delPermitted: number = 0; | ||
| 10 | + fontCColor: string = ''; // 频道展示样式颜色(选中状态) | ||
| 11 | + fontColor: string = ''; // 频道展示样式颜色(未选中状态) | ||
| 12 | + headlinesOn: number = 0; | ||
| 13 | + homeChannel: string = ''; | ||
| 14 | + iconUrlSize: string = ''; | ||
| 15 | + iconCUrlSize: string = ''; | ||
| 16 | + iconUrl: string = ''; // 频道图片展示样式图片相对地址(未选中状态) | ||
| 17 | + iconCUrl: string = ''; //频道图片展示样式图片相对地址(选中状态 | ||
| 18 | + localChannel: string = ''; | ||
| 19 | + moreChannel: string = ''; | ||
| 20 | + movePermitted: number = 0; | ||
| 21 | + myChannel: string = ''; | ||
| 22 | + name: string = ''; | ||
| 23 | + num: number = 0; | ||
| 24 | + pageId: number = 0; | ||
| 25 | + pageType: string = ''; | ||
| 26 | + underlineCColor: string = ''; // 选中下划线颜色 | ||
| 27 | } | 27 | } |
| @@ -44,7 +44,7 @@ export struct CardParser { | @@ -44,7 +44,7 @@ export struct CardParser { | ||
| 44 | } else if (contentDTO.appStyle === CompStyle.Card_04) { | 44 | } else if (contentDTO.appStyle === CompStyle.Card_04) { |
| 45 | Card4Component({ compDTO: this.compDTO, contentDTO }) | 45 | Card4Component({ compDTO: this.compDTO, contentDTO }) |
| 46 | } else if (contentDTO.appStyle === CompStyle.Card_05) { | 46 | } else if (contentDTO.appStyle === CompStyle.Card_05) { |
| 47 | - Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy }) | 47 | + Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy, compDTO: this.compDTO }) |
| 48 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle | 48 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle |
| 49 | .Card_13) { | 49 | .Card_13) { |
| 50 | Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) | 50 | Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| @@ -45,6 +45,10 @@ import { detailedSkeleton } from './skeleton/detailSkeleton'; | @@ -45,6 +45,10 @@ import { detailedSkeleton } from './skeleton/detailSkeleton'; | ||
| 45 | const TAG = 'DynamicDetailComponent' | 45 | const TAG = 'DynamicDetailComponent' |
| 46 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | 46 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; |
| 47 | 47 | ||
| 48 | + | ||
| 49 | +/** | ||
| 50 | + * @author wd-zsz | ||
| 51 | + * */ | ||
| 48 | // @Preview | 52 | // @Preview |
| 49 | @Component | 53 | @Component |
| 50 | export struct DynamicDetailComponent { | 54 | export struct DynamicDetailComponent { |
| 1 | -import { FeedbackTypeBean } from 'wdBean/Index'; | ||
| 2 | -import { NetworkUtil } from 'wdKit/Index'; | 1 | +import { FeedbackTypeBean, PhotoListBean } from 'wdBean/Index'; |
| 2 | +import { FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'; | ||
| 3 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 3 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 4 | import { CustomTitleUI } from './reusable/CustomTitleUI' | 4 | import { CustomTitleUI } from './reusable/CustomTitleUI' |
| 5 | -import { ArrayList } from '@kit.ArkTS'; | 5 | +import { picker } from '@kit.CoreFileKit'; |
| 6 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 7 | +import { router } from '@kit.ArkUI'; | ||
| 8 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 9 | +import { ProcessUtils } from 'wdRouter/Index'; | ||
| 10 | +import { HashMap } from '@kit.ArkTS'; | ||
| 11 | +import { HttpParams } from 'wdNetwork/src/main/ets/http/HttpCommonParams'; | ||
| 6 | 12 | ||
| 7 | const TAG = 'FeedBackActivity' | 13 | const TAG = 'FeedBackActivity' |
| 8 | -// 意见反馈页面 | 14 | + |
| 15 | +/** | ||
| 16 | + * 意见反馈页面 | ||
| 17 | + * @author wd-zsz | ||
| 18 | + * */ | ||
| 9 | @Entry | 19 | @Entry |
| 10 | @Component | 20 | @Component |
| 11 | export struct FeedBackActivity { | 21 | export struct FeedBackActivity { |
| 22 | + @State canSubmit: boolean = false; | ||
| 23 | + @State textNumLabel: string = '0/500'; | ||
| 24 | + contact: string = ""; | ||
| 25 | + email: string = ""; | ||
| 12 | //UI | 26 | //UI |
| 13 | scroller: Scroller = new Scroller(); | 27 | scroller: Scroller = new Scroller(); |
| 14 | 28 | ||
| 15 | @State isNetConnected: boolean = true | 29 | @State isNetConnected: boolean = true |
| 16 | 30 | ||
| 17 | @State feedbackTypeBeans: FeedbackTypeBean[] = [] as FeedbackTypeBean[] | 31 | @State feedbackTypeBeans: FeedbackTypeBean[] = [] as FeedbackTypeBean[] |
| 32 | + //添加图片 | ||
| 33 | + addPic: PhotoListBean = {itemType:1} as PhotoListBean | ||
| 34 | + @State pics: PhotoListBean[] = [this.addPic] as PhotoListBean[] | ||
| 35 | + // 选择媒体文件的最大数目 | ||
| 36 | + selectNum = 3; | ||
| 18 | 37 | ||
| 19 | async aboutToAppear() { | 38 | async aboutToAppear() { |
| 20 | await this.getContentDetailData() | 39 | await this.getContentDetailData() |
| @@ -23,97 +42,209 @@ export struct FeedBackActivity { | @@ -23,97 +42,209 @@ export struct FeedBackActivity { | ||
| 23 | build() { | 42 | build() { |
| 24 | Column() { | 43 | Column() { |
| 25 | //标题栏目 | 44 | //标题栏目 |
| 26 | - CustomTitleUI({ titleName: "意见反馈" }) | 45 | + CustomTitleUI({ titleName: $r('app.string.feedback') }) |
| 27 | Stack({ alignContent: Alignment.Bottom }) { | 46 | Stack({ alignContent: Alignment.Bottom }) { |
| 28 | Scroll(this.scroller) { | 47 | Scroll(this.scroller) { |
| 29 | Column() { | 48 | Column() { |
| 30 | - Text('请选择问题类型') | 49 | + Text($r('app.string.feedback_opinion_type')) |
| 31 | .fontColor($r('app.color.color_222222')) | 50 | .fontColor($r('app.color.color_222222')) |
| 32 | .fontSize($r('app.float.font_size_16')) | 51 | .fontSize($r('app.float.font_size_16')) |
| 33 | .fontWeight(FontWeight.Bold) | 52 | .fontWeight(FontWeight.Bold) |
| 53 | + .width('100%') | ||
| 34 | .margin({ left: $r('app.float.vp_15'), top: $r('app.float.vp_14') }) | 54 | .margin({ left: $r('app.float.vp_15'), top: $r('app.float.vp_14') }) |
| 35 | GridRow({ | 55 | GridRow({ |
| 36 | - gutter: { x: 2, y: 2 } | 56 | + columns:3, |
| 37 | }) { | 57 | }) { |
| 38 | - ForEach(this.feedbackTypeBeans, (item: FeedbackTypeBean, index: number) => { | 58 | + ForEach(this.feedbackTypeBeans, (feedbackTypeBean: FeedbackTypeBean, index: number) => { |
| 39 | GridCol({ | 59 | GridCol({ |
| 40 | - span: 12 | ||
| 41 | }) { | 60 | }) { |
| 42 | Row(){ | 61 | Row(){ |
| 43 | Toggle({ type: ToggleType.Checkbox, isOn: false }) | 62 | Toggle({ type: ToggleType.Checkbox, isOn: false }) |
| 44 | - Text(item.classifyName) | 63 | + .onChange((select) => { |
| 64 | + feedbackTypeBean.isselect = select | ||
| 65 | + this.canSubmit = this.checkSubmit() | ||
| 66 | + }) | ||
| 67 | + Text(feedbackTypeBean.classifyName) | ||
| 45 | .fontColor($r('app.color.color_222222')) | 68 | .fontColor($r('app.color.color_222222')) |
| 46 | .fontSize($r('app.float.font_size_14')) | 69 | .fontSize($r('app.float.font_size_14')) |
| 47 | - .fontWeight(FontWeight.Bold) | ||
| 48 | .margin({ left: $r('app.float.vp_4') }) | 70 | .margin({ left: $r('app.float.vp_4') }) |
| 49 | } | 71 | } |
| 50 | - .width(115) | ||
| 51 | - .height(22) | 72 | + .width($r('app.float.margin_115')) |
| 73 | + .height($r('app.float.vp_22')) | ||
| 74 | + .margin({bottom:$r('app.float.margin_16')}) | ||
| 52 | .backgroundColor($r('app.color.color_fff')) | 75 | .backgroundColor($r('app.color.color_fff')) |
| 53 | } | 76 | } |
| 54 | }) | 77 | }) |
| 55 | } | 78 | } |
| 56 | - | 79 | + .width('100%') |
| 80 | + .margin({top:$r('app.float.vp_16')}) | ||
| 57 | Blank() | 81 | Blank() |
| 58 | - .height(0.5) | ||
| 59 | - .margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12'), right: $r('app.float.vp_16') }) | ||
| 60 | - .backgroundColor($r('app.color.color_EDEDED')) | ||
| 61 | - Text('描述您的问题') | 82 | + .height($r('app.float.margin_5')) |
| 83 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 84 | + Text($r('app.string.feedback_opinion_tv')) | ||
| 62 | .fontColor($r('app.color.color_222222')) | 85 | .fontColor($r('app.color.color_222222')) |
| 63 | .fontSize($r('app.float.font_size_16')) | 86 | .fontSize($r('app.float.font_size_16')) |
| 64 | .fontWeight(FontWeight.Bold) | 87 | .fontWeight(FontWeight.Bold) |
| 88 | + .width(CommonConstants.FULL_WIDTH) | ||
| 65 | .margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12') }) | 89 | .margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12') }) |
| 66 | - Stack() { | ||
| 67 | - TextInput({ placeholder: '您的宝贵意见是我们前行的动力' }) | ||
| 68 | - GridRow({ | ||
| 69 | - gutter: { x: 2, y: 2 } | ||
| 70 | - }) { | ||
| 71 | - ForEach(this.feedbackTypeBeans, (item: FeedbackTypeBean, index: number) => { | ||
| 72 | - GridCol({ | ||
| 73 | - span: 12 | ||
| 74 | - }) { | ||
| 75 | - } | ||
| 76 | - }) | 90 | + Stack({ alignContent: Alignment.BottomEnd }) { |
| 91 | + TextArea({ placeholder: $r('app.string.feedback_comments') }) | ||
| 92 | + .width(CommonConstants.FULL_WIDTH) | ||
| 93 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 94 | + .padding({bottom:96}) | ||
| 95 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 96 | + .align(Alignment.TopStart) | ||
| 97 | + .maxLength(500) | ||
| 98 | + .onChange((value) => { | ||
| 99 | + // Logger.debug(TAG, "onChange" + value + "/" + this.passwordContent) | ||
| 100 | + this.contact = value | ||
| 101 | + this.textNumLabel = value.length+"/500" | ||
| 102 | + this.canSubmit = this.checkSubmit() | ||
| 103 | + }) | ||
| 104 | + GridRow({ | ||
| 105 | + columns:5, | ||
| 106 | + }) { | ||
| 107 | + | ||
| 108 | + ForEach(this.pics, (feedbackImageItem: PhotoListBean, index: number) => { | ||
| 109 | + GridCol({ | ||
| 110 | + }) { | ||
| 111 | + if(1 == feedbackImageItem.itemType){ | ||
| 112 | + Image($r('app.media.feekback_add')) | ||
| 113 | + .width(60) | ||
| 114 | + .height(60) | ||
| 115 | + .onClick(async (event: ClickEvent) => { | ||
| 116 | + if(await FastClickUtil.isMinDelayTime()){ | ||
| 117 | + return | ||
| 118 | + } | ||
| 119 | + this.callFilePickerSelectImage(); | ||
| 120 | + }) | ||
| 121 | + }else{ | ||
| 122 | + Stack({alignContent: Alignment.TopEnd}) { | ||
| 123 | + Image(feedbackImageItem.picPath) | ||
| 124 | + .width(60) | ||
| 125 | + .height(60) | ||
| 126 | + .borderRadius($r('app.float.margin_1')) | ||
| 127 | + .onClick(async (event: ClickEvent) => { | ||
| 128 | + if(await FastClickUtil.isMinDelayTime()){ | ||
| 129 | + return | ||
| 130 | + } | ||
| 131 | + //查看图片 fixme 去除添加按钮 | ||
| 132 | + ProcessUtils.gotoMultiPictureListPage(this.pics, index) | ||
| 133 | + }) | ||
| 134 | + Image($r('app.media.icon_feekback_delete')) | ||
| 135 | + .width(24) | ||
| 136 | + .height(24) | ||
| 137 | + .borderRadius($r('app.float.margin_1')) | ||
| 138 | + .onClick(async (event: ClickEvent) => { | ||
| 139 | + if(await FastClickUtil.isMinDelayTime()){ | ||
| 140 | + return | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + let temp: PhotoListBean[] = [] as PhotoListBean[] | ||
| 144 | + temp.length = this.pics.length - 1; | ||
| 145 | + let tempIndex = 0; | ||
| 146 | + for (let index = 0; index < this.pics.length; index++) { | ||
| 147 | + const element = this.pics[index]; | ||
| 148 | + if(!StringUtils.isEmpty(element.picPath) && element.id != feedbackImageItem.id){ | ||
| 149 | + temp[tempIndex] = element; | ||
| 150 | + tempIndex = tempIndex+1 | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + if(tempIndex < 3){ | ||
| 154 | + temp[tempIndex] = this.addPic | ||
| 155 | + } | ||
| 156 | + this.pics = temp | ||
| 157 | + }) | ||
| 158 | + } | ||
| 159 | + .width(60) | ||
| 160 | + .height(60) | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | + }) | ||
| 164 | + } | ||
| 165 | + .margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_12'),left: $r('app.float.vp_12')}) | ||
| 166 | + Text(this.textNumLabel) | ||
| 167 | + .margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_11')}) | ||
| 77 | } | 168 | } |
| 169 | + .height(200) | ||
| 170 | + .width('90%') | ||
| 171 | + .margin({ top: $r('app.float.vp_12') }) | ||
| 172 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 173 | + .borderRadius(4) | ||
| 174 | + | ||
| 175 | + | ||
| 78 | 176 | ||
| 79 | - Text('0/500') | ||
| 80 | - } | ||
| 81 | - .height(200) | ||
| 82 | - .width('100%') | ||
| 83 | - .margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12'), right: $r('app.float.vp_16') }) | ||
| 84 | - .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 85 | - .borderRadius(4) | ||
| 86 | 177 | ||
| 87 | - Text('期待您留下联系方式,我们将提供更好的服务') | 178 | + Text($r('app.string.feedback_email')) |
| 88 | .fontColor($r('app.color.color_222222')) | 179 | .fontColor($r('app.color.color_222222')) |
| 89 | .fontSize($r('app.float.font_size_14')) | 180 | .fontSize($r('app.float.font_size_14')) |
| 90 | .fontWeight(FontWeight.Bold) | 181 | .fontWeight(FontWeight.Bold) |
| 182 | + .width('100%') | ||
| 91 | .margin({ left: $r('app.float.vp_16'), top: $r('app.float.margin_24') }) | 183 | .margin({ left: $r('app.float.vp_16'), top: $r('app.float.margin_24') }) |
| 92 | Row() { | 184 | Row() { |
| 93 | - Text('电话或者邮箱') | 185 | + Text($r('app.string.feedback_mail')) |
| 94 | .fontColor($r('app.color.color_222222')) | 186 | .fontColor($r('app.color.color_222222')) |
| 95 | .fontSize($r('app.float.font_size_14')) | 187 | .fontSize($r('app.float.font_size_14')) |
| 96 | .fontWeight(FontWeight.Bold) | 188 | .fontWeight(FontWeight.Bold) |
| 97 | - .margin({ left: $r('app.float.vp_12') }) | ||
| 98 | - TextInput({ placeholder: '请输入电话或者邮箱' }) | 189 | + TextInput({ placeholder: $r('app.string.feedback_hideemail') }) |
| 190 | + .width(CommonConstants.FULL_WIDTH) | ||
| 191 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 192 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 193 | + .onChange((value) => { | ||
| 194 | + // Logger.debug(TAG, "onChange" + value + "/" + this.passwordContent) | ||
| 195 | + this.email = value | ||
| 196 | + }) | ||
| 99 | } | 197 | } |
| 100 | .height(44) | 198 | .height(44) |
| 101 | - .margin({ left: $r('app.float.vp_16'), right: $r('app.float.vp_12'), top: $r('app.float.margin_16') }) | 199 | + .width('90%') |
| 102 | .backgroundColor($r('app.color.color_F5F5F5')) | 200 | .backgroundColor($r('app.color.color_F5F5F5')) |
| 201 | + .margin({top: $r('app.float.margin_16') }) | ||
| 103 | .borderRadius(4) | 202 | .borderRadius(4) |
| 203 | + Blank().layoutWeight(1) | ||
| 104 | } | 204 | } |
| 105 | } | 205 | } |
| 106 | - | ||
| 107 | - Text($r('app.string.submit')) | ||
| 108 | - .height(44) | ||
| 109 | - .fontColor($r('app.color.color_9E9E9E_40')) | ||
| 110 | - .fontSize($r('app.float.font_size_18')) | ||
| 111 | - .margin({ left: $r('app.float.vp_16'), right: $r('app.float.vp_16'), top: $r('app.float.vp_15') }) | ||
| 112 | - .backgroundColor($r('app.color.color_ED2800_99')) | ||
| 113 | - .borderRadius(4) | 206 | + .width(CommonConstants.FULL_WIDTH) |
| 207 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 208 | + .scrollBar(BarState.Off) | ||
| 209 | + .alignSelf(ItemAlign.Start) | ||
| 210 | + .padding({ bottom: 44 }) | ||
| 211 | + Column(){ | ||
| 212 | + Text($r('app.string.submit')) | ||
| 213 | + .align(Alignment.Center) | ||
| 214 | + .height(44) | ||
| 215 | + .width('90%') | ||
| 216 | + .fontColor(this.canSubmit?$r('app.color.color_9E9E9E_40'):$r('app.color.color_fff')) | ||
| 217 | + .fontSize($r('app.float.font_size_18')) | ||
| 218 | + .backgroundColor(this.canSubmit?$r('app.color.color_ED2800_99'):$r('app.color.color_EDEDED')) | ||
| 219 | + .borderRadius(4) | ||
| 220 | + .onClick(async (event: ClickEvent) => { | ||
| 221 | + if(await FastClickUtil.isMinDelayTime()){ | ||
| 222 | + return | ||
| 223 | + } | ||
| 224 | + this.reportCommit() | ||
| 225 | + }) | ||
| 226 | + Blank().height(15).width('100%') | ||
| 227 | + } | ||
| 228 | + .height(59) | ||
| 114 | } | 229 | } |
| 115 | } | 230 | } |
| 116 | } | 231 | } |
| 232 | + | ||
| 233 | + /** | ||
| 234 | + * 校验可提交状态 | ||
| 235 | + * */ | ||
| 236 | + checkSubmit(): boolean { | ||
| 237 | + | ||
| 238 | + if(StringUtils.isEmpty(this.contact) || this.contact.length < 10){ | ||
| 239 | + return false | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + if(this.feedbackTypeBeans == null || this.feedbackTypeBeans.length == 0){ | ||
| 243 | + return false | ||
| 244 | + } | ||
| 245 | + return true | ||
| 246 | + } | ||
| 247 | + | ||
| 117 | /** | 248 | /** |
| 118 | * 请求接口数据 | 249 | * 请求接口数据 |
| 119 | * */ | 250 | * */ |
| @@ -126,4 +257,117 @@ export struct FeedBackActivity { | @@ -126,4 +257,117 @@ export struct FeedBackActivity { | ||
| 126 | console.log('请求失败',JSON.stringify(exception)) | 257 | console.log('请求失败',JSON.stringify(exception)) |
| 127 | } | 258 | } |
| 128 | } | 259 | } |
| 260 | + | ||
| 261 | + /** | ||
| 262 | + * 拉起picker选择图片/视频 | ||
| 263 | + */ | ||
| 264 | + async callFilePickerSelectImage(): Promise<void> { // async 用于申明一个 function 是异步的 | ||
| 265 | + let array: string[]; | ||
| 266 | + try { | ||
| 267 | + // 设置photoPicker的参数 | ||
| 268 | + let PhotoSelectOptions = new picker.PhotoSelectOptions(); | ||
| 269 | + PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型 | ||
| 270 | + PhotoSelectOptions.maxSelectNumber = this.selectNum; // 选择媒体文件的最大数目 | ||
| 271 | + let mediaFlag = false; | ||
| 272 | + let photoPicker = new picker.PhotoViewPicker(); // 使用图库选择器对象前,需要先创建PhotoViewPicker实例 | ||
| 273 | + photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => { | ||
| 274 | + Logger.info(TAG, 'PhotoViewPicker.select successfully, PhotoSelectResult uri: ' + JSON.stringify(PhotoSelectResult)); // 日志中记录成功信息 | ||
| 275 | + if (PhotoSelectResult !== null && PhotoSelectResult !== undefined) { // 接口采用callback异步返回形式,返回PhotoSelectResult对象,故进行下一步操作前要先判断是否已经成功返回PhotoSelectResult对象了 | ||
| 276 | + | ||
| 277 | + // PhotoSelectResult为返回的结果集。 | ||
| 278 | + // 其中包含Array<string>类型的photoUris,为返回图库选择后的媒体文件的uri数组;还包含boolean类型的isOriginalPhoto,指示返回图库选择后的媒体文件是否为原图。 | ||
| 279 | + // 声明变量array,其取值为PhotoSelectResult中的数组。 | ||
| 280 | + array = PhotoSelectResult['photoUris']; | ||
| 281 | + let startIndex = this.pics.length-1; | ||
| 282 | + let totalLen = this.pics.length+array.length; | ||
| 283 | + if(totalLen > 3){ | ||
| 284 | + totalLen = 3 | ||
| 285 | + } | ||
| 286 | + this.pics.length = totalLen; | ||
| 287 | + | ||
| 288 | + array.forEach((value) => { | ||
| 289 | + let pic: PhotoListBean = {itemType:2,picPath:value} as PhotoListBean | ||
| 290 | + pic.id = startIndex | ||
| 291 | + this.pics[startIndex] = pic | ||
| 292 | + startIndex = startIndex+1; | ||
| 293 | + mediaFlag = true; | ||
| 294 | + Logger.info(TAG, `select image/video uri: ${value}`); | ||
| 295 | + }) | ||
| 296 | + if(this.pics.length<3){ | ||
| 297 | + this.addPic.id = startIndex | ||
| 298 | + this.pics[this.pics.length-1]=this.addPic; | ||
| 299 | + } | ||
| 300 | + } | ||
| 301 | + if (mediaFlag) { | ||
| 302 | + this.getFilenameByUriForMedia(array); | ||
| 303 | + } | ||
| 304 | + }) | ||
| 305 | + .catch((err: BusinessError) => { | ||
| 306 | + Logger.error(TAG, 'PhotoViewPicker.select failed with err: ' + JSON.stringify(err)); | ||
| 307 | + }); | ||
| 308 | + } catch (err) { | ||
| 309 | + Logger.error(TAG, 'PhotoViewPicker failed with err: ' + err); | ||
| 310 | + } | ||
| 311 | + } | ||
| 312 | + | ||
| 313 | + async getFilenameByUriForMedia(myUris: string[]) { | ||
| 314 | + router.pushUrl({ | ||
| 315 | + url: 'pages/ViewMedia', | ||
| 316 | + params: { | ||
| 317 | + uris: myUris | ||
| 318 | + } | ||
| 319 | + }, router.RouterMode.Standard); | ||
| 320 | + } | ||
| 321 | + | ||
| 322 | + //提交 | ||
| 323 | + async reportCommit(){ | ||
| 324 | + //问题类型必选 | ||
| 325 | + let selectType = "" | ||
| 326 | + this.feedbackTypeBeans.forEach((value) => { | ||
| 327 | + if(value.isselect){ | ||
| 328 | + selectType = selectType+"," | ||
| 329 | + } | ||
| 330 | + }) | ||
| 331 | + if(!StringUtils.isEmpty(selectType)){ | ||
| 332 | + selectType = selectType.substring(0,selectType.length-1) | ||
| 333 | + }else{ | ||
| 334 | + // | ||
| 335 | + ToastUtils.shortToast($r('app.string.feedback_opinion_type')) | ||
| 336 | + return | ||
| 337 | + } | ||
| 338 | + //内容必填 | ||
| 339 | + if(StringUtils.isEmpty(this.contact) || this.contact.length < 10 || this.contact.length>500){ | ||
| 340 | + ToastUtils.shortToast($r('app.string.res_feedback_commentsFail')) | ||
| 341 | + return | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + try { | ||
| 345 | + let map: HashMap<String,String> = {} as HashMap<String,String> | ||
| 346 | + //反馈内容 | ||
| 347 | + map.set("content", this.contact); | ||
| 348 | + //投诉类型 id | ||
| 349 | + map.set("classifyFlagIds", selectType); | ||
| 350 | + if(!StringUtils.isEmpty(this.email)){ | ||
| 351 | + //邮箱 | ||
| 352 | + map.set("userContact", this.email); | ||
| 353 | + } | ||
| 354 | + //用户名称 | ||
| 355 | + if (!StringUtils.isEmpty(UserDataLocal.getUserName())) { | ||
| 356 | + map.set("userName", UserDataLocal.getUserName()); | ||
| 357 | + } | ||
| 358 | + //设备 | ||
| 359 | + map.set("appVersion", "V" + HttpParams.getVersionName()); | ||
| 360 | + map.set("appDevice", "harmony" + HttpParams.getSystemVersion() + " " + HttpParams.getPhoneModel()); | ||
| 361 | + // //投诉图片 | ||
| 362 | + // if (imageUrl.size() > 0) { | ||
| 363 | + // String[] str = imageUrl.toArray(new String[imageUrl.size()]); | ||
| 364 | + // map.set("imageUrls", str); | ||
| 365 | + // } | ||
| 366 | + await MultiPictureDetailViewModel.feedBackCommit(map) | ||
| 367 | + | ||
| 368 | + } catch (exception) { | ||
| 369 | + console.log('请求失败',JSON.stringify(exception)) | ||
| 370 | + } | ||
| 371 | + } | ||
| 372 | + | ||
| 129 | } | 373 | } |
| @@ -50,6 +50,8 @@ export struct ImageAndTextPageComponent { | @@ -50,6 +50,8 @@ export struct ImageAndTextPageComponent { | ||
| 50 | // @State operationButtonList: string[] = ['comment', 'collect', 'share'] | 50 | // @State operationButtonList: string[] = ['comment', 'collect', 'share'] |
| 51 | @State operationButtonList: string[] = [] | 51 | @State operationButtonList: string[] = [] |
| 52 | @State isNetConnected: boolean = true | 52 | @State isNetConnected: boolean = true |
| 53 | + @State emptyType: number = 1 // 缺省图类型 | ||
| 54 | + @State detailContentEmpty: boolean = false | ||
| 53 | @State info: Area | null = null | 55 | @State info: Area | null = null |
| 54 | @State likeNum: number = 0 | 56 | @State likeNum: number = 0 |
| 55 | @State reachEndIncreament: number = 0 | 57 | @State reachEndIncreament: number = 0 |
| @@ -141,10 +143,10 @@ export struct ImageAndTextPageComponent { | @@ -141,10 +143,10 @@ export struct ImageAndTextPageComponent { | ||
| 141 | this.reachEndIncreament += 1 | 143 | this.reachEndIncreament += 1 |
| 142 | }) | 144 | }) |
| 143 | 145 | ||
| 144 | - if (!this.isNetConnected) { | 146 | + if (!this.isNetConnected || this.detailContentEmpty) { |
| 145 | EmptyComponent({ | 147 | EmptyComponent({ |
| 146 | - emptyType: 1, | ||
| 147 | - emptyButton: true, | 148 | + emptyType: this.emptyType, |
| 149 | + emptyButton: this.emptyType === 1 ? true : false, | ||
| 148 | retry: () => { | 150 | retry: () => { |
| 149 | this.getDetail() | 151 | this.getDetail() |
| 150 | } | 152 | } |
| @@ -171,12 +173,14 @@ export struct ImageAndTextPageComponent { | @@ -171,12 +173,14 @@ export struct ImageAndTextPageComponent { | ||
| 171 | // 发布时间 | 173 | // 发布时间 |
| 172 | Column() { | 174 | Column() { |
| 173 | Row() { | 175 | Row() { |
| 174 | - Image(this.contentDetailData?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb')) | ||
| 175 | - .width(80) | ||
| 176 | - .height(28) | ||
| 177 | - Text(this.publishTime) | ||
| 178 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 179 | - .fontSize(13) | 176 | + if(this.isNetConnected && !this.detailContentEmpty) { |
| 177 | + Image(this.contentDetailData?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb')) | ||
| 178 | + .width(80) | ||
| 179 | + .height(28) | ||
| 180 | + Text(this.publishTime) | ||
| 181 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 182 | + .fontSize(13) | ||
| 183 | + } | ||
| 180 | } | 184 | } |
| 181 | .width(CommonConstants.FULL_WIDTH) | 185 | .width(CommonConstants.FULL_WIDTH) |
| 182 | .height(32) | 186 | .height(32) |
| @@ -202,6 +206,9 @@ export struct ImageAndTextPageComponent { | @@ -202,6 +206,9 @@ export struct ImageAndTextPageComponent { | ||
| 202 | 206 | ||
| 203 | private async getDetail() { | 207 | private async getDetail() { |
| 204 | this.isNetConnected = NetworkUtil.isNetConnected() | 208 | this.isNetConnected = NetworkUtil.isNetConnected() |
| 209 | + if(!this.isNetConnected) { | ||
| 210 | + this.emptyType = 1 | ||
| 211 | + } | ||
| 205 | let contentId: string = '' | 212 | let contentId: string = '' |
| 206 | let relId: string = '' | 213 | let relId: string = '' |
| 207 | let relType: string = '' | 214 | let relType: string = '' |
| @@ -219,6 +226,12 @@ export struct ImageAndTextPageComponent { | @@ -219,6 +226,12 @@ export struct ImageAndTextPageComponent { | ||
| 219 | 226 | ||
| 220 | } | 227 | } |
| 221 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 228 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 229 | + // 判断内容是否已下线,空数组表示下线 | ||
| 230 | + this.detailContentEmpty = detailBeans.length === 0 ? true : false | ||
| 231 | + if(this.detailContentEmpty) { | ||
| 232 | + this.emptyType = 18 | ||
| 233 | + } | ||
| 234 | + console.log(TAG, JSON.stringify(detailBeans)) | ||
| 222 | if (detailBeans && detailBeans.length > 0) { | 235 | if (detailBeans && detailBeans.length > 0) { |
| 223 | this.contentDetailData = detailBeans[0]; | 236 | this.contentDetailData = detailBeans[0]; |
| 224 | let dateTime = | 237 | let dateTime = |
| @@ -42,7 +42,7 @@ export struct InteractMComponent { | @@ -42,7 +42,7 @@ export struct InteractMComponent { | ||
| 42 | .constraintSize({maxHeight:500}) | 42 | .constraintSize({maxHeight:500}) |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | - if(this.messageModel.contentType != '211' && this.messageModel.contentType != '210'){ | 45 | + if(this.messageModel.contentType != '211'){ |
| 46 | Column(){ | 46 | Column(){ |
| 47 | if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){ | 47 | if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){ |
| 48 | Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500}) | 48 | Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500}) |
| @@ -20,7 +20,7 @@ export struct SpacialTopicPageComponent { | @@ -20,7 +20,7 @@ export struct SpacialTopicPageComponent { | ||
| 20 | action: Action = {} as Action | 20 | action: Action = {} as Action |
| 21 | @State webUrl: string = ''; | 21 | @State webUrl: string = ''; |
| 22 | @State isPageEnd: boolean = false | 22 | @State isPageEnd: boolean = false |
| 23 | - @State reload: number = 0; | 23 | + @Prop reload: number = 0; |
| 24 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 24 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 25 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | 25 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean |
| 26 | private webPrepared = false; | 26 | private webPrepared = false; |
| @@ -134,13 +134,6 @@ export struct SpacialTopicPageComponent { | @@ -134,13 +134,6 @@ export struct SpacialTopicPageComponent { | ||
| 134 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 134 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | - onPageShow() { | ||
| 138 | - if (!this.action?.params?.backVisibility) { | ||
| 139 | - WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 140 | - } | ||
| 141 | - this.reload++ | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | aboutToAppear() { | 137 | aboutToAppear() { |
| 145 | if (!this.action?.params?.backVisibility) { | 138 | if (!this.action?.params?.backVisibility) { |
| 146 | WindowModel.shared.setWindowLayoutFullScreen(true) | 139 | WindowModel.shared.setWindowLayoutFullScreen(true) |
| @@ -149,12 +142,6 @@ export struct SpacialTopicPageComponent { | @@ -149,12 +142,6 @@ export struct SpacialTopicPageComponent { | ||
| 149 | this.getDetail() | 142 | this.getDetail() |
| 150 | } | 143 | } |
| 151 | 144 | ||
| 152 | - onPageHide() { | ||
| 153 | - if (!this.action?.params?.backVisibility) { | ||
| 154 | - WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 155 | - } | ||
| 156 | - } | ||
| 157 | - | ||
| 158 | aboutToDisappear() { | 145 | aboutToDisappear() { |
| 159 | if (!this.action?.params?.backVisibility) { | 146 | if (!this.action?.params?.backVisibility) { |
| 160 | WindowModel.shared.setWindowLayoutFullScreen(false) | 147 | WindowModel.shared.setWindowLayoutFullScreen(false) |
| @@ -28,6 +28,11 @@ export struct CardSourceInfo { | @@ -28,6 +28,11 @@ export struct CardSourceInfo { | ||
| 28 | .maxLines(1) | 28 | .maxLines(1) |
| 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 30 | } | 30 | } |
| 31 | + if (((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName && this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) && (this.getContentDtoBean()?.interactData?.commentNum || DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)) != '')) { | ||
| 32 | + Image($r("app.media.point")) | ||
| 33 | + .width(16) | ||
| 34 | + .height(16) | ||
| 35 | + } | ||
| 31 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 | 36 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 |
| 32 | if (this.contentDTO.isSearch || this.contentDTO.isCollection || | 37 | if (this.contentDTO.isSearch || this.contentDTO.isCollection || |
| 33 | !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | 38 | !this.contentDTO.isSearch && DateTimeUtils.getCommentTime |
| @@ -36,12 +41,6 @@ export struct CardSourceInfo { | @@ -36,12 +41,6 @@ export struct CardSourceInfo { | ||
| 36 | .contentDTO.publishTime)) | 41 | .contentDTO.publishTime)) |
| 37 | .indexOf | 42 | .indexOf |
| 38 | ('-') === -1) { | 43 | ('-') === -1) { |
| 39 | - if (this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName || this | ||
| 40 | - .contentDTO.rmhPlatform !== 1 && this.contentDTO.source) { | ||
| 41 | - Image($r("app.media.point")) | ||
| 42 | - .width(16) | ||
| 43 | - .height(16) | ||
| 44 | - } | ||
| 45 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | 44 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) |
| 46 | .fontSize($r("app.float.font_size_11")) | 45 | .fontSize($r("app.float.font_size_11")) |
| 47 | .fontColor($r("app.color.color_B0B0B0")) | 46 | .fontColor($r("app.color.color_B0B0B0")) |
| @@ -68,7 +68,9 @@ export struct Card19Component { | @@ -68,7 +68,9 @@ export struct Card19Component { | ||
| 68 | width: item.weight, | 68 | width: item.weight, |
| 69 | height: item.height, | 69 | height: item.height, |
| 70 | picPath: item.fullUrl||item.url, | 70 | picPath: item.fullUrl||item.url, |
| 71 | - picDesc: '' | 71 | + picDesc: '', |
| 72 | + itemType:2, | ||
| 73 | + id:0 | ||
| 72 | } | 74 | } |
| 73 | return photo | 75 | return photo |
| 74 | }) | 76 | }) |
| @@ -7,8 +7,6 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | @@ -7,8 +7,6 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | ||
| 7 | import { Notes } from './notes'; | 7 | import { Notes } from './notes'; |
| 8 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 8 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 9 | // import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; | 9 | // import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; |
| 10 | -import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare' | ||
| 11 | -import { common } from '@kit.AbilityKit'; | ||
| 12 | const TAG: string = 'Card2Component'; | 10 | const TAG: string = 'Card2Component'; |
| 13 | 11 | ||
| 14 | /** | 12 | /** |
| @@ -111,11 +109,6 @@ export struct Card2Component { | @@ -111,11 +109,6 @@ export struct Card2Component { | ||
| 111 | this.clicked = true; | 109 | this.clicked = true; |
| 112 | // persistentStorage(this.contentDTO.objectId); | 110 | // persistentStorage(this.contentDTO.objectId); |
| 113 | ProcessUtils.processPage(this.contentDTO) | 111 | ProcessUtils.processPage(this.contentDTO) |
| 114 | - | ||
| 115 | - if (this.contentDTO?.channelId === '2001' || this.contentDTO?.channelId === '2002') { | ||
| 116 | - let context = getContext(this) as common.UIAbilityContext; | ||
| 117 | - viewBlogInsightIntentShare(context, this.contentDTO?.channelId, [this.compDTO], ActionMode.EXECUTED) | ||
| 118 | - } | ||
| 119 | }) | 112 | }) |
| 120 | } | 113 | } |
| 121 | } | 114 | } |
| @@ -62,9 +62,10 @@ export struct Card4Component { | @@ -62,9 +62,10 @@ export struct Card4Component { | ||
| 62 | .fontSize($r('app.float.font_size_18')) | 62 | .fontSize($r('app.float.font_size_18')) |
| 63 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 63 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 64 | .maxLines(3) | 64 | .maxLines(3) |
| 65 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | ||
| 66 | - | ||
| 67 | - | 65 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 66 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | ||
| 67 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 68 | + this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 68 | //三图 | 69 | //三图 |
| 69 | Stack(){ | 70 | Stack(){ |
| 70 | Row() { | 71 | Row() { |
| 1 | -import { ContentDTO } from 'wdBean'; | 1 | +import { ContentDTO, CompDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant'; | 2 | import { CommonConstants } from 'wdConstant'; |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 4 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 5 | import { Notes } from './notes'; | 5 | import { Notes } from './notes'; |
| 6 | +import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare' | ||
| 7 | +import { common } from '@kit.AbilityKit'; | ||
| 6 | 8 | ||
| 7 | const TAG: string = 'Card5Component'; | 9 | const TAG: string = 'Card5Component'; |
| 8 | 10 | ||
| @@ -13,6 +15,7 @@ const TAG: string = 'Card5Component'; | @@ -13,6 +15,7 @@ const TAG: string = 'Card5Component'; | ||
| 13 | export struct Card5Component { | 15 | export struct Card5Component { |
| 14 | @State contentDTO: ContentDTO = new ContentDTO(); | 16 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 15 | @Prop titleShowPolicy: number | string | 17 | @Prop titleShowPolicy: number | string |
| 18 | + @Prop compDTO: CompDTO = {} as CompDTO | ||
| 16 | @State loadImg: boolean = false; | 19 | @State loadImg: boolean = false; |
| 17 | @State clicked: boolean = false; | 20 | @State clicked: boolean = false; |
| 18 | @State titleMarked: boolean = false; | 21 | @State titleMarked: boolean = false; |
| @@ -97,6 +100,8 @@ export struct Card5Component { | @@ -97,6 +100,8 @@ export struct Card5Component { | ||
| 97 | .onClick((event: ClickEvent) => { | 100 | .onClick((event: ClickEvent) => { |
| 98 | this.clicked = true; | 101 | this.clicked = true; |
| 99 | ProcessUtils.processPage(this.contentDTO) | 102 | ProcessUtils.processPage(this.contentDTO) |
| 103 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 104 | + viewBlogInsightIntentShare(context, this.contentDTO?.channelId, [this.compDTO], ActionMode.EXECUTED) | ||
| 100 | }) | 105 | }) |
| 101 | 106 | ||
| 102 | } | 107 | } |
| @@ -38,6 +38,11 @@ export struct Card9Component { | @@ -38,6 +38,11 @@ export struct Card9Component { | ||
| 38 | Column() { | 38 | Column() { |
| 39 | // 顶部标题,最多两行 | 39 | // 顶部标题,最多两行 |
| 40 | if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { | 40 | if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { |
| 41 | + if (this.contentDTO.newTags) { | ||
| 42 | + Notes({ newTags: this.contentDTO.newTags }) | ||
| 43 | + } else if (this.contentDTO.objectType == '5') { | ||
| 44 | + Notes({ objectType: this.contentDTO.objectType }) | ||
| 45 | + } | ||
| 41 | Text() { | 46 | Text() { |
| 42 | if (this.titleMarked) { | 47 | if (this.titleMarked) { |
| 43 | Span(this.str01) | 48 | Span(this.str01) |
| @@ -48,13 +53,17 @@ export struct Card9Component { | @@ -48,13 +53,17 @@ export struct Card9Component { | ||
| 48 | Span(this.contentDTO.newsTitle) | 53 | Span(this.contentDTO.newsTitle) |
| 49 | } | 54 | } |
| 50 | } | 55 | } |
| 51 | - .fontColor(this.clicked ? 0x848484 : 0x222222) | ||
| 52 | - .width(CommonConstants.FULL_WIDTH) | ||
| 53 | - .fontSize($r('app.float.font_size_18')) | ||
| 54 | - .fontWeight(600) | ||
| 55 | - .maxLines(2) | ||
| 56 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 57 | - .margin({ bottom: 19 }) | 56 | + .fontColor(this.clicked ? 0x848484 : 0x222222) |
| 57 | + .width(CommonConstants.FULL_WIDTH) | ||
| 58 | + .fontSize($r('app.float.font_size_18')) | ||
| 59 | + .fontWeight(600) | ||
| 60 | + .maxLines(2) | ||
| 61 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 62 | + .margin({ bottom: 19 }) | ||
| 63 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | ||
| 64 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 65 | + this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 66 | + | ||
| 58 | } | 67 | } |
| 59 | // 大图 | 68 | // 大图 |
| 60 | Stack() { | 69 | Stack() { |
| @@ -102,7 +111,7 @@ export struct Card9Component { | @@ -102,7 +111,7 @@ export struct Card9Component { | ||
| 102 | } | 111 | } |
| 103 | .width(CommonConstants.FULL_WIDTH) | 112 | .width(CommonConstants.FULL_WIDTH) |
| 104 | .padding({ | 113 | .padding({ |
| 105 | - top: 14, | 114 | + top: 5, |
| 106 | left: 16, | 115 | left: 16, |
| 107 | right: 16, | 116 | right: 16, |
| 108 | bottom: 14 | 117 | bottom: 14 |
| @@ -7,6 +7,8 @@ import { CustomTitleUI } from '../../../reusable/CustomTitleUI'; | @@ -7,6 +7,8 @@ import { CustomTitleUI } from '../../../reusable/CustomTitleUI'; | ||
| 7 | import { ListHasNoMoreDataUI } from '../../../reusable/ListHasNoMoreDataUI'; | 7 | import { ListHasNoMoreDataUI } from '../../../reusable/ListHasNoMoreDataUI'; |
| 8 | import { EmptyComponent } from '../../../view/EmptyComponent'; | 8 | import { EmptyComponent } from '../../../view/EmptyComponent'; |
| 9 | import { SubscribeListChildComponent } from './SubscribeListChildComponent'; | 9 | import { SubscribeListChildComponent } from './SubscribeListChildComponent'; |
| 10 | +import { Action } from 'wdBean/Index'; | ||
| 11 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 10 | 12 | ||
| 11 | const TAG = "SubscribeMessageComponent" | 13 | const TAG = "SubscribeMessageComponent" |
| 12 | 14 | ||
| @@ -71,6 +73,19 @@ export struct SubscribeMessageComponent{ | @@ -71,6 +73,19 @@ export struct SubscribeMessageComponent{ | ||
| 71 | ListItem() { | 73 | ListItem() { |
| 72 | SubscribeListChildComponent({ item: item }) | 74 | SubscribeListChildComponent({ item: item }) |
| 73 | }.width('100%') | 75 | }.width('100%') |
| 76 | + .onClick(()=>{ | ||
| 77 | + let action = { | ||
| 78 | + type:item.contentType, | ||
| 79 | + params:{ | ||
| 80 | + extra:{ | ||
| 81 | + relId:item.relId, | ||
| 82 | + relType:item.relType | ||
| 83 | + }, | ||
| 84 | + contentID:item.contentId | ||
| 85 | + } | ||
| 86 | + } as Action | ||
| 87 | + WDRouterRule.jumpWithPage(WDRouterPage.detailPlayLiveCommon, action) | ||
| 88 | + }) | ||
| 74 | }) | 89 | }) |
| 75 | //没有更多数据 显示提示 | 90 | //没有更多数据 显示提示 |
| 76 | if (!this.hasMore) { | 91 | if (!this.hasMore) { |
| @@ -97,7 +112,11 @@ export struct SubscribeMessageComponent{ | @@ -97,7 +112,11 @@ export struct SubscribeMessageComponent{ | ||
| 97 | 112 | ||
| 98 | let remark = JSON.parse(value.remark) as Remark | 113 | let remark = JSON.parse(value.remark) as Remark |
| 99 | 114 | ||
| 100 | - this.data.push(new SubscribeMessageModel(dealTime,value.message,remark.coverImageUrl,value.title,dealTime2,value.contentId)) | 115 | + let bean = new SubscribeMessageModel(dealTime,value.message,remark.coverImageUrl,value.title,dealTime2,value.contentId) |
| 116 | + bean.relId = remark.relationId | ||
| 117 | + bean.relType = remark.relationType | ||
| 118 | + bean.contentType = value.contentType | ||
| 119 | + this.data.push(bean) | ||
| 101 | }) | 120 | }) |
| 102 | this.data.notifyDataReload() | 121 | this.data.notifyDataReload() |
| 103 | this.count = this.data.totalCount() | 122 | this.count = this.data.totalCount() |
| 1 | import { BottomNavi, CommonConstants } from 'wdConstant'; | 1 | import { BottomNavi, CommonConstants } from 'wdConstant'; |
| 2 | -import { BottomNavDTO, TopNavDTO } from 'wdBean'; | ||
| 3 | -import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger } from 'wdKit'; | 2 | +import { BottomNavDTO, NavigationBodyDTO, TopNavDTO } from 'wdBean'; |
| 3 | +import { 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'; |
| 7 | -import PageViewModel from '../../viewmodel/PageViewModel'; | ||
| 8 | -import HomeChannelUtils, { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; | ||
| 9 | -import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 7 | +import ChannelViewModel from '../../viewmodel/ChannelViewModel'; |
| 8 | +import HomeChannelUtils, { AssignChannelParam } from 'wdRouter'; | ||
| 10 | import { VideoChannelPage } from './VideoChannelPage'; | 9 | import { VideoChannelPage } from './VideoChannelPage'; |
| 11 | 10 | ||
| 12 | const TAG = 'BottomNavigationComponent'; | 11 | const TAG = 'BottomNavigationComponent'; |
| @@ -46,18 +45,12 @@ export struct BottomNavigationComponent { | @@ -46,18 +45,12 @@ export struct BottomNavigationComponent { | ||
| 46 | @State assignChannel: AssignChannelParam = new AssignChannelParam() | 45 | @State assignChannel: AssignChannelParam = new AssignChannelParam() |
| 47 | // 自动刷新触发(双击tab自动刷新) | 46 | // 自动刷新触发(双击tab自动刷新) |
| 48 | @State autoRefresh: number = 0 | 47 | @State autoRefresh: number = 0 |
| 48 | + // 顶导数据,从接口获取 TODO 顶导业务逻辑没看懂,暂时不替换顶导list。频道管理数据待梳理 | ||
| 49 | + @State topNavMap: Record<string, TopNavDTO[]> = {} | ||
| 49 | 50 | ||
| 50 | async aboutToAppear() { | 51 | async aboutToAppear() { |
| 51 | Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`); | 52 | Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`); |
| 52 | - let bottomNav = await PageViewModel.getBottomNavData(getContext(this)) | ||
| 53 | - if (bottomNav && bottomNav.bottomNavList != null) { | ||
| 54 | - Logger.info(TAG, `aboutToAppear, bottomNav.length: ${bottomNav.bottomNavList.length}`); | ||
| 55 | - // 使用filter方法移除name为'服务'的项 | ||
| 56 | - bottomNav.bottomNavList = bottomNav.bottomNavList.filter(item => item.name !== '服务'); | ||
| 57 | - this.bottomNavList = bottomNav.bottomNavList | ||
| 58 | - } | ||
| 59 | - this.getTopNavList(this.bottomNavList[0]?.id) | ||
| 60 | - HomeChannelUtils.setBottomNavData(bottomNav) | 53 | + this.getBottomData() |
| 61 | 54 | ||
| 62 | EmitterUtils.receiveEvent(EmitterEventId.JUMP_HOME_CHANNEL, (str?: string) => { | 55 | EmitterUtils.receiveEvent(EmitterEventId.JUMP_HOME_CHANNEL, (str?: string) => { |
| 63 | Logger.debug(TAG, 'receiveEvent JUMP_HOME_CHANNEL: ' + str) | 56 | Logger.debug(TAG, 'receiveEvent JUMP_HOME_CHANNEL: ' + str) |
| @@ -170,7 +163,7 @@ export struct BottomNavigationComponent { | @@ -170,7 +163,7 @@ export struct BottomNavigationComponent { | ||
| 170 | 163 | ||
| 171 | //请求顶导数据 | 164 | //请求顶导数据 |
| 172 | async getTopNavList(id: number) { | 165 | async getTopNavList(id: number) { |
| 173 | - let bottomNavDetail = await PageViewModel.getBottomNavDetailData(id) | 166 | + let bottomNavDetail = await ChannelViewModel.getBottomNavDetailData(id) |
| 174 | this.topNavList = bottomNavDetail?.topNavChannelList || [] | 167 | this.topNavList = bottomNavDetail?.topNavChannelList || [] |
| 175 | } | 168 | } |
| 176 | 169 | ||
| @@ -203,4 +196,62 @@ export struct BottomNavigationComponent { | @@ -203,4 +196,62 @@ export struct BottomNavigationComponent { | ||
| 203 | this.assignChannel.bottomNavId = assignChannel.bottomNavId | 196 | this.assignChannel.bottomNavId = assignChannel.bottomNavId |
| 204 | }, 20) | 197 | }, 20) |
| 205 | } | 198 | } |
| 199 | + | ||
| 200 | + private async getBottomData() { | ||
| 201 | + Logger.debug(TAG, 'getBottomData') | ||
| 202 | + // 1、缓存底导数据 | ||
| 203 | + let bottomCache = await ChannelViewModel.getBottomNavCacheData() | ||
| 204 | + if (bottomCache && bottomCache.bottomNavList != null) { | ||
| 205 | + Logger.debug(TAG, 'getBottomData cache success') | ||
| 206 | + this.setData(bottomCache) | ||
| 207 | + this.getBottomDetail() | ||
| 208 | + } | ||
| 209 | + // TODO 2、预置底导数据 | ||
| 210 | + // 3、接口底导数据 | ||
| 211 | + let bottomNav = await ChannelViewModel.getBottomNavData() | ||
| 212 | + if (bottomNav && bottomNav.bottomNavList != null) { | ||
| 213 | + Logger.debug(TAG, 'getBottomNavData') | ||
| 214 | + HomeChannelUtils.setBottomNavData(bottomNav) | ||
| 215 | + if (this.bottomNavList == null || this.bottomNavList.length <= 0) { | ||
| 216 | + // 底导没展示,则用接口数据(接口数据回来,不去覆盖缓存数据,没有缓存才加载) | ||
| 217 | + this.setData(bottomNav) | ||
| 218 | + this.getBottomDetail() | ||
| 219 | + } | ||
| 220 | + // 将数据保存本地 | ||
| 221 | + ChannelViewModel.saveBottomData(bottomNav) | ||
| 222 | + } | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + private getBottomDetail() { | ||
| 226 | + // 1、获取顶导缓存数据 | ||
| 227 | + // this.bottomNavList.forEach((value) => { | ||
| 228 | + // // 先用底导带回的list初始化 | ||
| 229 | + // this.topNavMap[value.id] = value.topNavChannelList | ||
| 230 | + // ChannelViewModel.getBottomNavDetailData(value?.id).then((bottomNavDetail) => { | ||
| 231 | + // let list = bottomNavDetail?.topNavChannelList || [] | ||
| 232 | + // // 将顶导数据,单独存储 | ||
| 233 | + // this.topNavMap[value.id] = list | ||
| 234 | + // }) | ||
| 235 | + // }) | ||
| 236 | + // // 2、获取顶导接口数据,返回后需要覆盖缓存数据 | ||
| 237 | + // this.bottomNavList.forEach((value) => { | ||
| 238 | + // ChannelViewModel.getBottomNavDetailData(value?.id).then((bottomNavDetail) => { | ||
| 239 | + // let list = bottomNavDetail?.topNavChannelList || [] | ||
| 240 | + // // 将顶导数据,单独存储 | ||
| 241 | + // this.topNavMap[value.id] = list | ||
| 242 | + // // 存储缓存 | ||
| 243 | + // ChannelViewModel.saveBottomDetailData(bottomNavDetail) | ||
| 244 | + // }) | ||
| 245 | + // }) | ||
| 246 | + } | ||
| 247 | + | ||
| 248 | + private setData(data: NavigationBodyDTO) { | ||
| 249 | + Logger.debug(TAG, 'setData') | ||
| 250 | + if (data && data.bottomNavList != null) { | ||
| 251 | + Logger.info(TAG, `setData, bottomNav.length: ${data.bottomNavList.length}`); | ||
| 252 | + // 使用filter方法移除name为'服务'的项 | ||
| 253 | + data.bottomNavList = data.bottomNavList.filter(item => item.name !== '服务'); | ||
| 254 | + this.bottomNavList = data.bottomNavList | ||
| 255 | + } | ||
| 256 | + } | ||
| 206 | } | 257 | } |
| @@ -27,7 +27,7 @@ struct EditUserInfoPage { | @@ -27,7 +27,7 @@ struct EditUserInfoPage { | ||
| 27 | } | 27 | } |
| 28 | }), | 28 | }), |
| 29 | alignment: DialogAlignment.Bottom, | 29 | alignment: DialogAlignment.Bottom, |
| 30 | - offset:{dx:0,dy:-20}, | 30 | + offset:{dx:0,dy:0}, |
| 31 | }) | 31 | }) |
| 32 | 32 | ||
| 33 | aboutToAppear() { | 33 | aboutToAppear() { |
| @@ -104,7 +104,7 @@ struct EditUserInfoPage { | @@ -104,7 +104,7 @@ struct EditUserInfoPage { | ||
| 104 | .textOverflow({overflow:TextOverflow.Ellipsis}) | 104 | .textOverflow({overflow:TextOverflow.Ellipsis}) |
| 105 | .maxLines(1) | 105 | .maxLines(1) |
| 106 | .fontSize(14) | 106 | .fontSize(14) |
| 107 | - .fontColor(r.subTitle === '待完善'?'#999999':'#666666') | 107 | + .fontColor(r.subTitle === '待完善'?'#cccccc':'#666666') |
| 108 | .padding({right:10}) | 108 | .padding({right:10}) |
| 109 | .width('70%') | 109 | .width('70%') |
| 110 | .textAlign(TextAlign.End) | 110 | .textAlign(TextAlign.End) |
| @@ -8,6 +8,7 @@ import { CustomTitleUI } from '../reusable/CustomTitleUI'; | @@ -8,6 +8,7 @@ import { CustomTitleUI } from '../reusable/CustomTitleUI'; | ||
| 8 | import { InteractMComponent } from '../InteractMessage/InteractMComponent'; | 8 | import { InteractMComponent } from '../InteractMessage/InteractMComponent'; |
| 9 | import { InteractMessageModel, WDMessageCenterMessageType } from '../../model/InteractMessageModel'; | 9 | import { InteractMessageModel, WDMessageCenterMessageType } from '../../model/InteractMessageModel'; |
| 10 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | 10 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; |
| 11 | +import { NetworkUtil } from 'wdKit/Index'; | ||
| 11 | 12 | ||
| 12 | @Entry | 13 | @Entry |
| 13 | @Component | 14 | @Component |
| @@ -28,10 +29,9 @@ struct InteractMessagePage { | @@ -28,10 +29,9 @@ struct InteractMessagePage { | ||
| 28 | build() { | 29 | build() { |
| 29 | Column(){ | 30 | Column(){ |
| 30 | CustomTitleUI({titleName:'互动消息'}) | 31 | CustomTitleUI({titleName:'互动消息'}) |
| 31 | - if(this.browSingModel.viewType == ViewType.ERROR){ | ||
| 32 | - EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed}) | ||
| 33 | - }else if(this.browSingModel.viewType == ViewType.EMPTY){ | ||
| 34 | - EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoMessage}) | 32 | + |
| 33 | + if(this.browSingModel.viewType == ViewType.EMPTY){ | ||
| 34 | + EmptyComponent({emptyType:this.browSingModel.emptyType}) | ||
| 35 | }else { | 35 | }else { |
| 36 | CustomPullToRefresh({ | 36 | CustomPullToRefresh({ |
| 37 | alldata:this.allDatas, | 37 | alldata:this.allDatas, |
| @@ -114,32 +114,40 @@ struct InteractMessagePage { | @@ -114,32 +114,40 @@ struct InteractMessagePage { | ||
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | async getData(resolve?: (value: string | PromiseLike<string>) => void){ | 116 | async getData(resolve?: (value: string | PromiseLike<string>) => void){ |
| 117 | - InteractMessageViewModel.fetchMessageList(WDMessageCenterMessageType.WDMessageCenterMessageType_Interact,this.currentPage).then(InteractMessageMItem => { | ||
| 118 | - if(resolve) resolve('刷新成功') | ||
| 119 | - if (InteractMessageMItem && InteractMessageMItem.list && InteractMessageMItem.list.length > 0) { | ||
| 120 | - this.browSingModel.viewType = ViewType.LOADED; | ||
| 121 | 117 | ||
| 122 | - if (this.currentPage === 1) { | ||
| 123 | - this.allDatas = [] | ||
| 124 | - } | 118 | + let netStatus = NetworkUtil.isNetConnected() |
| 119 | + if (netStatus) { | ||
| 120 | + InteractMessageViewModel.fetchMessageList(WDMessageCenterMessageType.WDMessageCenterMessageType_Interact,this.currentPage).then(InteractMessageMItem => { | ||
| 121 | + if(resolve) resolve('刷新成功') | ||
| 122 | + if (InteractMessageMItem && InteractMessageMItem.list && InteractMessageMItem.list.length > 0) { | ||
| 123 | + this.browSingModel.viewType = ViewType.LOADED; | ||
| 125 | 124 | ||
| 126 | - for (let index = 0; index < InteractMessageMItem.list.length; index++) { | ||
| 127 | - const element = InteractMessageMItem.list[index]; | ||
| 128 | - element.InteractMsubM = JSON.parse(element.remark) | ||
| 129 | - this.allDatas.push(element) | ||
| 130 | - } | 125 | + if (this.currentPage === 1) { |
| 126 | + this.allDatas = [] | ||
| 127 | + } | ||
| 131 | 128 | ||
| 132 | - if (InteractMessageMItem.hasNext === 0) { | ||
| 133 | - this.browSingModel.hasMore = false; | 129 | + for (let index = 0; index < InteractMessageMItem.list.length; index++) { |
| 130 | + const element = InteractMessageMItem.list[index]; | ||
| 131 | + element.InteractMsubM = JSON.parse(element.remark) | ||
| 132 | + this.allDatas.push(element) | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + if (InteractMessageMItem.hasNext === 0) { | ||
| 136 | + this.browSingModel.hasMore = false; | ||
| 137 | + } else { | ||
| 138 | + this.browSingModel.hasMore = true; | ||
| 139 | + } | ||
| 134 | } else { | 140 | } else { |
| 135 | - this.browSingModel.hasMore = true; | ||
| 136 | - } | ||
| 137 | - } else { | ||
| 138 | - if (this.currentPage === 1) { | ||
| 139 | - this.browSingModel.viewType = ViewType.EMPTY; | 141 | + if (this.currentPage === 1) { |
| 142 | + this.browSingModel.viewType = ViewType.EMPTY; | ||
| 143 | + this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoMessage; | ||
| 144 | + } | ||
| 140 | } | 145 | } |
| 141 | - } | ||
| 142 | - }) | 146 | + }) |
| 147 | + }else { | ||
| 148 | + this.browSingModel.viewType = ViewType.EMPTY; | ||
| 149 | + this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork; | ||
| 150 | + } | ||
| 143 | } | 151 | } |
| 144 | 152 | ||
| 145 | async getMessageLikeCount(){ | 153 | async getMessageLikeCount(){ |
| @@ -51,6 +51,11 @@ export struct MinePageComponent { | @@ -51,6 +51,11 @@ export struct MinePageComponent { | ||
| 51 | alignment: DialogAlignment.Center, | 51 | alignment: DialogAlignment.Center, |
| 52 | autoCancel: false | 52 | autoCancel: false |
| 53 | }) | 53 | }) |
| 54 | + @Consume @Watch('pageShowForUpdateData') pageShow :number | ||
| 55 | + | ||
| 56 | + pageShowForUpdateData(): void { | ||
| 57 | + this.getMessageData() | ||
| 58 | + } | ||
| 54 | 59 | ||
| 55 | aboutToAppear(){ | 60 | aboutToAppear(){ |
| 56 | this.getUserLogin() | 61 | this.getUserLogin() |
| @@ -67,6 +72,11 @@ export struct MinePageComponent { | @@ -67,6 +72,11 @@ export struct MinePageComponent { | ||
| 67 | if(value.msg == "消息") | 72 | if(value.msg == "消息") |
| 68 | value.isShowRedPoint = true | 73 | value.isShowRedPoint = true |
| 69 | }) | 74 | }) |
| 75 | + }else { | ||
| 76 | + this.personalData.forEach((value) => { | ||
| 77 | + if(value.msg == "消息") | ||
| 78 | + value.isShowRedPoint = false | ||
| 79 | + }) | ||
| 70 | } | 80 | } |
| 71 | } | 81 | } |
| 72 | }).catch((err: Error) => { | 82 | }).catch((err: Error) => { |
| @@ -12,6 +12,7 @@ import { BigPicCardComponent } from '../view/BigPicCardComponent'; | @@ -12,6 +12,7 @@ import { BigPicCardComponent } from '../view/BigPicCardComponent'; | ||
| 12 | import { contentListItemParams } from '../../model/MyCollectionModel'; | 12 | import { contentListItemParams } from '../../model/MyCollectionModel'; |
| 13 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | 13 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; |
| 14 | import { MyCustomDialog } from '../reusable/MyCustomDialog' | 14 | import { MyCustomDialog } from '../reusable/MyCustomDialog' |
| 15 | +import { NetworkUtil } from 'wdKit/Index'; | ||
| 15 | 16 | ||
| 16 | @Entry | 17 | @Entry |
| 17 | @Component | 18 | @Component |
| @@ -26,6 +27,7 @@ struct MyCollectionListPage { | @@ -26,6 +27,7 @@ struct MyCollectionListPage { | ||
| 26 | 27 | ||
| 27 | @State currentPage: number = 1; | 28 | @State currentPage: number = 1; |
| 28 | private scroller: Scroller = new Scroller(); | 29 | private scroller: Scroller = new Scroller(); |
| 30 | + emptyType: WDViewDefaultType = WDViewDefaultType.WDViewDefaultType_Default | ||
| 29 | 31 | ||
| 30 | dialogController: CustomDialogController = new CustomDialogController({ | 32 | dialogController: CustomDialogController = new CustomDialogController({ |
| 31 | builder: MyCustomDialog({ | 33 | builder: MyCustomDialog({ |
| @@ -53,10 +55,8 @@ struct MyCollectionListPage { | @@ -53,10 +55,8 @@ struct MyCollectionListPage { | ||
| 53 | this.deleteNum = 0 | 55 | this.deleteNum = 0 |
| 54 | }}) | 56 | }}) |
| 55 | 57 | ||
| 56 | - if(this.browSingModel.viewType == ViewType.ERROR){ | ||
| 57 | - ErrorComponent() | ||
| 58 | - }else if(this.browSingModel.viewType == ViewType.EMPTY){ | ||
| 59 | - EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoCollection}) | 58 | + if(this.browSingModel.viewType == ViewType.EMPTY){ |
| 59 | + EmptyComponent({emptyType:this.browSingModel.emptyType}) | ||
| 60 | }else { | 60 | }else { |
| 61 | CustomPullToRefresh({ | 61 | CustomPullToRefresh({ |
| 62 | alldata:this.allDatas, | 62 | alldata:this.allDatas, |
| @@ -137,31 +137,39 @@ struct MyCollectionListPage { | @@ -137,31 +137,39 @@ struct MyCollectionListPage { | ||
| 137 | } | 137 | } |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | + | ||
| 140 | async getData(resolve?: (value: string | PromiseLike<string>) => void) { | 141 | async getData(resolve?: (value: string | PromiseLike<string>) => void) { |
| 141 | - MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => { | ||
| 142 | - if(resolve) resolve('刷新成功') | ||
| 143 | - if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | ||
| 144 | - if (this.currentPage === 1) { | ||
| 145 | - this.allDatas = [] | ||
| 146 | - } | 142 | + let netStatus = NetworkUtil.isNetConnected() |
| 143 | + if (netStatus) { | ||
| 144 | + MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => { | ||
| 145 | + if(resolve) resolve('刷新成功') | ||
| 146 | + if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | ||
| 147 | + if (this.currentPage === 1) { | ||
| 148 | + this.allDatas = [] | ||
| 149 | + } | ||
| 147 | 150 | ||
| 148 | - for (let index = 0; index < collectionItem.list.length; index++) { | ||
| 149 | - const compDTO = collectionItem.list[index]; | ||
| 150 | - compDTO.isCollection = true ///用于时间展示 | ||
| 151 | - this.allDatas.push(compDTO) | ||
| 152 | - } | 151 | + for (let index = 0; index < collectionItem.list.length; index++) { |
| 152 | + const compDTO = collectionItem.list[index]; | ||
| 153 | + compDTO.isCollection = true ///用于时间展示 | ||
| 154 | + this.allDatas.push(compDTO) | ||
| 155 | + } | ||
| 153 | 156 | ||
| 154 | - if (collectionItem.hasNext === 0) { | ||
| 155 | - this.browSingModel.hasMore = false; | 157 | + if (collectionItem.hasNext === 0) { |
| 158 | + this.browSingModel.hasMore = false; | ||
| 159 | + } else { | ||
| 160 | + this.browSingModel.hasMore = true; | ||
| 161 | + } | ||
| 156 | } else { | 162 | } else { |
| 157 | - this.browSingModel.hasMore = true; | ||
| 158 | - } | ||
| 159 | - } else { | ||
| 160 | - if (this.currentPage === 1) { | ||
| 161 | - this.browSingModel.viewType = ViewType.EMPTY; | 163 | + if (this.currentPage === 1) { |
| 164 | + this.browSingModel.viewType = ViewType.EMPTY; | ||
| 165 | + this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoCollection | ||
| 166 | + } | ||
| 162 | } | 167 | } |
| 163 | - } | ||
| 164 | - }) | 168 | + }) |
| 169 | + } else { | ||
| 170 | + this.browSingModel.viewType = ViewType.EMPTY; | ||
| 171 | + this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork; | ||
| 172 | + } | ||
| 165 | } | 173 | } |
| 166 | 174 | ||
| 167 | //数据处理 | 175 | //数据处理 |
| @@ -255,6 +255,7 @@ export struct PageComponent { | @@ -255,6 +255,7 @@ export struct PageComponent { | ||
| 255 | this.pageModel.channelId = this.channelId; | 255 | this.pageModel.channelId = this.channelId; |
| 256 | this.pageModel.currentPage = 1; | 256 | this.pageModel.currentPage = 1; |
| 257 | this.pageModel.pageTotalCompSize = 0; | 257 | this.pageModel.pageTotalCompSize = 0; |
| 258 | + // TODO PageHelper.getInitCacheData(this.pageModel, this.pageAdvModel) | ||
| 258 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) | 259 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) |
| 259 | }, 100) | 260 | }, 100) |
| 260 | } | 261 | } |
| @@ -13,8 +13,9 @@ export struct PeopleShipHomePageHeadComponent { | @@ -13,8 +13,9 @@ export struct PeopleShipHomePageHeadComponent { | ||
| 13 | .width(this.diameter) | 13 | .width(this.diameter) |
| 14 | .height(this.diameter) | 14 | .height(this.diameter) |
| 15 | .borderRadius(this.diameter/2) | 15 | .borderRadius(this.diameter/2) |
| 16 | - .borderWidth('1vp') | 16 | + .borderWidth('0.5vp') |
| 17 | .borderStyle(BorderStyle.Solid) | 17 | .borderStyle(BorderStyle.Solid) |
| 18 | + .shadow({radius: 10, color: '#222226bd'}) | ||
| 18 | .borderColor(Color.White) | 19 | .borderColor(Color.White) |
| 19 | .objectFit(ImageFit.Cover) | 20 | .objectFit(ImageFit.Cover) |
| 20 | .backgroundColor(Color.White) | 21 | .backgroundColor(Color.White) |
| @@ -3,7 +3,7 @@ import router from '@ohos.router' | @@ -3,7 +3,7 @@ import router from '@ohos.router' | ||
| 3 | @Component | 3 | @Component |
| 4 | export struct CustomTitleUI { | 4 | export struct CustomTitleUI { |
| 5 | imgBack:boolean = true | 5 | imgBack:boolean = true |
| 6 | - titleName:string = "默认标题" | 6 | + titleName:ResourceStr = "默认标题" |
| 7 | 7 | ||
| 8 | build() { | 8 | build() { |
| 9 | RelativeContainer() { | 9 | RelativeContainer() { |
| @@ -42,7 +42,9 @@ export const enum WDViewDefaultType { | @@ -42,7 +42,9 @@ export const enum WDViewDefaultType { | ||
| 42 | /// 16.暂无内容1 | 42 | /// 16.暂无内容1 |
| 43 | WDViewDefaultType_NoContent1, | 43 | WDViewDefaultType_NoContent1, |
| 44 | // 17. 暂无评论快来抢沙发 | 44 | // 17. 暂无评论快来抢沙发 |
| 45 | - WDViewDefaultType_NoComment1 | 45 | + WDViewDefaultType_NoComment1, |
| 46 | + // 18. 内容找不到了 | ||
| 47 | + WDViewDefaultType_NoContent2 | ||
| 46 | } | 48 | } |
| 47 | 49 | ||
| 48 | /** | 50 | /** |
| @@ -214,6 +216,8 @@ export struct EmptyComponent { | @@ -214,6 +216,8 @@ export struct EmptyComponent { | ||
| 214 | contentString = '暂无关注' | 216 | contentString = '暂无关注' |
| 215 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) { | 217 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) { |
| 216 | contentString = '暂无评论,快来抢沙发' | 218 | contentString = '暂无评论,快来抢沙发' |
| 219 | + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) { | ||
| 220 | + contentString = '内容找不到了' | ||
| 217 | } | 221 | } |
| 218 | 222 | ||
| 219 | return contentString | 223 | return contentString |
| @@ -247,7 +251,7 @@ export struct EmptyComponent { | @@ -247,7 +251,7 @@ export struct EmptyComponent { | ||
| 247 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) { | 251 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) { |
| 248 | imageString = $r('app.media.icon_no_content') | 252 | imageString = $r('app.media.icon_no_content') |
| 249 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent1 || | 253 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent1 || |
| 250 | - this.emptyType === WDViewDefaultType.WDViewDefaultType_NoFollow) { | 254 | + this.emptyType === WDViewDefaultType.WDViewDefaultType_NoFollow || this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent2) { |
| 251 | imageString = $r('app.media.icon_no_appointmentMade1') | 255 | imageString = $r('app.media.icon_no_appointmentMade1') |
| 252 | } | 256 | } |
| 253 | return imageString | 257 | return imageString |
| @@ -90,6 +90,9 @@ export class SubscribeMessageModel{ | @@ -90,6 +90,9 @@ export class SubscribeMessageModel{ | ||
| 90 | desc:string = "" | 90 | desc:string = "" |
| 91 | time:string = "" | 91 | time:string = "" |
| 92 | contentId:string = "" | 92 | contentId:string = "" |
| 93 | + contentType:string = "" | ||
| 94 | + relId :string = "" | ||
| 95 | + relType:string = "" | ||
| 93 | 96 | ||
| 94 | constructor(dealTime: string, title: string, imgUrl: string, desc: string , time: string, contentId: string) { | 97 | constructor(dealTime: string, title: string, imgUrl: string, desc: string , time: string, contentId: string) { |
| 95 | this.dealTime = dealTime | 98 | this.dealTime = dealTime |
| @@ -183,6 +183,7 @@ struct MineHomePage { | @@ -183,6 +183,7 @@ struct MineHomePage { | ||
| 183 | Image($r('app.media.user_info_edit_icon')) | 183 | Image($r('app.media.user_info_edit_icon')) |
| 184 | .width('27lpx') | 184 | .width('27lpx') |
| 185 | .height('27lpx') | 185 | .height('27lpx') |
| 186 | + .interpolation(ImageInterpolation.High) | ||
| 186 | .objectFit(ImageFit.Auto) | 187 | .objectFit(ImageFit.Auto) |
| 187 | } | 188 | } |
| 188 | } | 189 | } |
| 1 | import { common } from '@kit.AbilityKit'; | 1 | import { common } from '@kit.AbilityKit'; |
| 2 | import { insightIntent } from '@kit.IntentsKit'; | 2 | import { insightIntent } from '@kit.IntentsKit'; |
| 3 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 3 | import { CompDTO, CompList, ContentDTO, PageInfoBean } from 'wdBean'; | 4 | import { CompDTO, CompList, ContentDTO, PageInfoBean } from 'wdBean'; |
| 4 | 5 | ||
| 5 | -function generateUniqueId() { | ||
| 6 | - // 生成当前时间戳 | ||
| 7 | - let timestamp = new Date().getTime(); | ||
| 8 | - | ||
| 9 | - // 将时间戳转换成16进制字符串 | ||
| 10 | - let hexString = timestamp.toString(16); | ||
| 11 | - | ||
| 12 | - // 确保字符串长度为16位,不足的话在前面补0 | ||
| 13 | - while (hexString.length < 16) { | ||
| 14 | - hexString = '0' + hexString; | ||
| 15 | - } | ||
| 16 | - | ||
| 17 | - // 格式化为UUID样式 | ||
| 18 | - let uuid = hexString.substring(0, 8) + '-' + | ||
| 19 | - hexString.substring(8, 12) + '-' + | ||
| 20 | - hexString.substring(12, 16) + '-' + | ||
| 21 | - hexString.substring(16, 20) + '-' + | ||
| 22 | - hexString.substring(20); | ||
| 23 | - | 6 | +function generateUUID() { |
| 7 | + let dt = new Date().getTime(); // 获取当前时间的时间戳(毫秒) | ||
| 8 | + let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { | ||
| 9 | + let r = (dt + Math.random() * 16) % 16 | 0; | ||
| 10 | + dt = Math.floor(dt / 16); | ||
| 11 | + return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); | ||
| 12 | + }); | ||
| 24 | return uuid; | 13 | return uuid; |
| 25 | } | 14 | } |
| 26 | 15 | ||
| @@ -34,15 +23,16 @@ export const enum ActionMode { | @@ -34,15 +23,16 @@ export const enum ActionMode { | ||
| 34 | //ViewBlog意图共享-频道列表 | 23 | //ViewBlog意图共享-频道列表 |
| 35 | export function viewBlogInsightIntentShare(context: common.UIAbilityContext, entityGroupId: string, | 24 | export function viewBlogInsightIntentShare(context: common.UIAbilityContext, entityGroupId: string, |
| 36 | compList: CompDTO[] | CompList[], actionMode: ActionMode) { | 25 | compList: CompDTO[] | CompList[], actionMode: ActionMode) { |
| 37 | - console.log('viewBlogInsightIntentShare',actionMode) | 26 | + console.log('viewBlogInsightIntentShare', actionMode) |
| 38 | let insightIntentArray: insightIntent.InsightIntent [] = [] | 27 | let insightIntentArray: insightIntent.InsightIntent [] = [] |
| 28 | + let identifier = generateUUID() | ||
| 39 | if (compList?.length > 0) { | 29 | if (compList?.length > 0) { |
| 40 | compList?.forEach((item: CompDTO | CompList) => { | 30 | compList?.forEach((item: CompDTO | CompList) => { |
| 41 | item.operDataList.forEach((_item: ContentDTO) => { | 31 | item.operDataList.forEach((_item: ContentDTO) => { |
| 42 | let viewBlogInsightIntentItem: insightIntent.InsightIntent = { | 32 | let viewBlogInsightIntentItem: insightIntent.InsightIntent = { |
| 43 | intentName: 'ViewBlog', | 33 | intentName: 'ViewBlog', |
| 44 | intentVersion: '1.0.1', | 34 | intentVersion: '1.0.1', |
| 45 | - identifier: generateUniqueId(), | 35 | + identifier, |
| 46 | intentActionInfo: { | 36 | intentActionInfo: { |
| 47 | actionMode, | 37 | actionMode, |
| 48 | currentPercentage: 50, | 38 | currentPercentage: 50, |
| @@ -67,7 +57,7 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent | @@ -67,7 +57,7 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent | ||
| 67 | _item?.newsSummary.substring(0, 20) : _item?.newsSummary, | 57 | _item?.newsSummary.substring(0, 20) : _item?.newsSummary, |
| 68 | blogAuthor: _item?.source, | 58 | blogAuthor: _item?.source, |
| 69 | blogPublishTime: _item?.publishTimestamp, | 59 | blogPublishTime: _item?.publishTimestamp, |
| 70 | - tag: _item?.newTags, | 60 | + tag: _item?.newTags.split(','), |
| 71 | likeCount: _item?.interactData?.likeNum || 0, | 61 | likeCount: _item?.interactData?.likeNum || 0, |
| 72 | forwardCount: _item?.interactData?.shareNum || 0, | 62 | forwardCount: _item?.interactData?.shareNum || 0, |
| 73 | commentCount: _item?.interactData?.commentNum || 0, | 63 | commentCount: _item?.interactData?.commentNum || 0, |
| @@ -82,21 +72,13 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent | @@ -82,21 +72,13 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent | ||
| 82 | 72 | ||
| 83 | }) | 73 | }) |
| 84 | console.log('yzl', JSON.stringify(insightIntentArray[0])) | 74 | console.log('yzl', JSON.stringify(insightIntentArray[0])) |
| 85 | - try { | ||
| 86 | - // 共享数据 | ||
| 87 | - insightIntent.shareIntent(context, insightIntentArray, (error) => { | ||
| 88 | - if (error?.code) { | ||
| 89 | - // 处理业务逻辑错误 | ||
| 90 | - console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 91 | - return; | ||
| 92 | - } | ||
| 93 | - // 执行正常业务 | ||
| 94 | - console.log('shareIntent succeed'); | ||
| 95 | - }); | ||
| 96 | - } catch (error) { | ||
| 97 | - // 处理异常 | ||
| 98 | - console.error(`error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 99 | - } | 75 | + // 共享数据 |
| 76 | + insightIntent.shareIntent(context, insightIntentArray).then(() => { | ||
| 77 | + console.log('yzl shareIntent success'); | ||
| 78 | + }).catch((err: BusinessError) => { | ||
| 79 | + console.error(`yzl failed because ${err?.message}`); | ||
| 80 | + }); | ||
| 81 | + | ||
| 100 | } | 82 | } |
| 101 | } | 83 | } |
| 102 | 84 | ||
| @@ -108,7 +90,7 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en | @@ -108,7 +90,7 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en | ||
| 108 | let viewBlogInsightIntentItem: insightIntent.InsightIntent = { | 90 | let viewBlogInsightIntentItem: insightIntent.InsightIntent = { |
| 109 | intentName: 'ViewColumn', | 91 | intentName: 'ViewColumn', |
| 110 | intentVersion: '1.0.1', | 92 | intentVersion: '1.0.1', |
| 111 | - identifier: generateUniqueId(), | 93 | + identifier: generateUUID(), |
| 112 | intentActionInfo: { | 94 | intentActionInfo: { |
| 113 | actionMode: ActionMode.EXECUTED, | 95 | actionMode: ActionMode.EXECUTED, |
| 114 | currentPercentage: 50, | 96 | currentPercentage: 50, |
| @@ -116,30 +98,22 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en | @@ -116,30 +98,22 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en | ||
| 116 | intentEntityInfo: { | 98 | intentEntityInfo: { |
| 117 | entityName: 'Column', | 99 | entityName: 'Column', |
| 118 | entityId, | 100 | entityId, |
| 119 | - displayName:pageInfoBean?.topicInfo?.title, | 101 | + displayName: pageInfoBean?.topicInfo?.title, |
| 120 | description: pageInfoBean?.shareSummary, | 102 | description: pageInfoBean?.shareSummary, |
| 121 | - logoURL:pageInfoBean?.shareCoverUrl, | ||
| 122 | - activityType:['RecentViews'], | 103 | + logoURL: pageInfoBean?.shareCoverUrl, |
| 104 | + activityType: ['RecentViews'], | ||
| 123 | columnTitle: pageInfoBean?.topicInfo?.title, | 105 | columnTitle: pageInfoBean?.topicInfo?.title, |
| 124 | columnSubTitle: pageInfoBean?.shareSummary, | 106 | columnSubTitle: pageInfoBean?.shareSummary, |
| 125 | rankingHint: 99, | 107 | rankingHint: 99, |
| 126 | isPublicData: true | 108 | isPublicData: true |
| 127 | } | 109 | } |
| 128 | } | 110 | } |
| 111 | + console.log('yzl viewColumInsightIntentShare', JSON.stringify(viewBlogInsightIntentItem)) | ||
| 129 | 112 | ||
| 130 | - try { | ||
| 131 | - // 共享数据 | ||
| 132 | - insightIntent.shareIntent(context, [viewBlogInsightIntentItem], (error) => { | ||
| 133 | - if (error?.code) { | ||
| 134 | - // 处理业务逻辑错误 | ||
| 135 | - console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 136 | - return; | ||
| 137 | - } | ||
| 138 | - // 执行正常业务 | ||
| 139 | - console.log('shareIntent succeed'); | ||
| 140 | - }); | ||
| 141 | - } catch (error) { | ||
| 142 | - // 处理异常 | ||
| 143 | - console.error(`error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 144 | - } | 113 | + // 共享数据 |
| 114 | + insightIntent.shareIntent(context, [viewBlogInsightIntentItem]).then(() => { | ||
| 115 | + console.log('yzl shareIntent success'); | ||
| 116 | + }).catch((err: BusinessError) => { | ||
| 117 | + console.error(`yzl failed because ${err?.message}`); | ||
| 118 | + }); | ||
| 145 | } | 119 | } |
| 1 | +import { NavigationBodyDTO, NavigationDetailDTO, } from 'wdBean'; | ||
| 2 | + | ||
| 3 | +import { Logger } from 'wdKit'; | ||
| 4 | +import { CacheData, ResponseDTO } from 'wdNetwork'; | ||
| 5 | +import { PageRepository } from '../repository/PageRepository'; | ||
| 6 | + | ||
| 7 | +const TAG = 'ChannelViewModel'; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 首页底导、顶导相关 | ||
| 11 | + */ | ||
| 12 | +export class ChannelViewModel { | ||
| 13 | + /** | ||
| 14 | + * 获取底导缓存数据 | ||
| 15 | + */ | ||
| 16 | + async getBottomNavCacheData(): Promise<NavigationBodyDTO | null> { | ||
| 17 | + Logger.info(TAG, `getBottomNavCacheData start`); | ||
| 18 | + return new Promise<NavigationBodyDTO | null>((success) => { | ||
| 19 | + CacheData.getLocalCacheData(CacheData.bottomCacheKey).then((data) => { | ||
| 20 | + // Logger.debug(TAG, 'getBottomNavCacheData 333 ' + JSON.stringify(data)); | ||
| 21 | + if (data) { | ||
| 22 | + let navBean = JSON.parse(CacheData.getNetworkData(data)) as NavigationBodyDTO | ||
| 23 | + success(navBean) | ||
| 24 | + } else { | ||
| 25 | + success(null) | ||
| 26 | + } | ||
| 27 | + }).catch((err: object) => { | ||
| 28 | + Logger.error(TAG, 'getBottomNavCacheData catch err: ' + JSON.stringify(err)); | ||
| 29 | + success(null) | ||
| 30 | + }) | ||
| 31 | + }); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 保存底导数据到缓存 | ||
| 36 | + */ | ||
| 37 | + saveBottomData(data: NavigationBodyDTO) { | ||
| 38 | + CacheData.saveCacheData(CacheData.bottomCacheKey, data, data.md5) | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 获取底导详情(顶导)缓存数据 | ||
| 43 | + */ | ||
| 44 | + getBottomNavDetailCacheData(id: number): Promise<NavigationDetailDTO | null> { | ||
| 45 | + return new Promise<NavigationDetailDTO | null>((success) => { | ||
| 46 | + CacheData.getLocalCacheData(CacheData.channelCacheDataKey + id).then((data) => { | ||
| 47 | + if (data) { | ||
| 48 | + let navBean = JSON.parse(CacheData.getNetworkData(data)) as NavigationDetailDTO | ||
| 49 | + success(navBean) | ||
| 50 | + } else { | ||
| 51 | + success(null) | ||
| 52 | + } | ||
| 53 | + }).catch((err: object) => { | ||
| 54 | + Logger.error(TAG, 'getBottomNavDetailCacheData catch err: ' + JSON.stringify(err)); | ||
| 55 | + success(null) | ||
| 56 | + }) | ||
| 57 | + }) | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 保存底导详情数据到缓存 | ||
| 62 | + */ | ||
| 63 | + saveBottomDetailData(data: NavigationDetailDTO) { | ||
| 64 | + CacheData.saveCacheData(CacheData.channelCacheDataKey + data?.id, data, data.md5) | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 获取底导接口数据 | ||
| 69 | + */ | ||
| 70 | + async getBottomNavData(): Promise<NavigationBodyDTO> { | ||
| 71 | + Logger.info(TAG, `getBottomNavData start`); | ||
| 72 | + return this.getNavData(); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 获取底导详情(顶导)接口数据 | ||
| 77 | + */ | ||
| 78 | + async getBottomNavDetailData(id: number): Promise<NavigationDetailDTO> { | ||
| 79 | + Logger.info(TAG, `getBottomNavDetailData start`); | ||
| 80 | + return this.getNavDetailData(id); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + private getNavData(): Promise<NavigationBodyDTO> { | ||
| 84 | + return new Promise<NavigationBodyDTO>((success, error) => { | ||
| 85 | + Logger.info(TAG, `getNavData start`); | ||
| 86 | + PageRepository.fetchNavigationDataApi().then((navResDTO: ResponseDTO<NavigationBodyDTO>) => { | ||
| 87 | + if (!navResDTO || !navResDTO.data) { | ||
| 88 | + Logger.error(TAG, 'getNavData then navResDTO is empty'); | ||
| 89 | + error('navResDTO is empty'); | ||
| 90 | + return | ||
| 91 | + } | ||
| 92 | + if (navResDTO.code != 0) { | ||
| 93 | + Logger.error(TAG, `getNavData then code:${navResDTO.code}, message:${navResDTO.message}`); | ||
| 94 | + error('navResDTO Response Code is failure'); | ||
| 95 | + return | ||
| 96 | + } | ||
| 97 | + // let navResStr = JSON.stringify(navResDTO); | ||
| 98 | + Logger.info(TAG, "getNavData then,navResDTO.timestamp:" + navResDTO.timestamp); | ||
| 99 | + navResDTO.data.md5 = navResDTO.meta?.md5 || '' | ||
| 100 | + success(navResDTO.data); | ||
| 101 | + }).catch((err: Error) => { | ||
| 102 | + Logger.error(TAG, `fetchNavigationDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 103 | + error(err); | ||
| 104 | + }) | ||
| 105 | + }) | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + private getNavDetailData(id: number): Promise<NavigationDetailDTO> { | ||
| 109 | + return new Promise<NavigationDetailDTO>((success, error) => { | ||
| 110 | + Logger.info(TAG, `getNavData start`); | ||
| 111 | + PageRepository.fetchNavigationDetailDataApi(id).then((navResDTO: ResponseDTO<NavigationDetailDTO>) => { | ||
| 112 | + if (!navResDTO || !navResDTO.data) { | ||
| 113 | + Logger.error(TAG, 'getNavData then navResDTO is empty'); | ||
| 114 | + error('navResDTO is empty'); | ||
| 115 | + return | ||
| 116 | + } | ||
| 117 | + if (navResDTO.code != 0) { | ||
| 118 | + Logger.error(TAG, `getNavData then code:${navResDTO.code}, message:${navResDTO.message}`); | ||
| 119 | + error('navResDTO Response Code is failure'); | ||
| 120 | + return | ||
| 121 | + } | ||
| 122 | + // let navResStr = JSON.stringify(navResDTO); | ||
| 123 | + Logger.info(TAG, "getNavData then,navResDTO.timestamp:" + navResDTO.timestamp); | ||
| 124 | + navResDTO.data.md5 = navResDTO.meta?.md5 || '' | ||
| 125 | + success(navResDTO.data); | ||
| 126 | + }).catch((err: Error) => { | ||
| 127 | + Logger.error(TAG, `fetchNavigationDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 128 | + error(err); | ||
| 129 | + }) | ||
| 130 | + }) | ||
| 131 | + } | ||
| 132 | +} | ||
| 133 | + | ||
| 134 | + | ||
| 135 | +let channelViewModel = new ChannelViewModel(); | ||
| 136 | + | ||
| 137 | +export default channelViewModel as ChannelViewModel; |
| @@ -23,18 +23,11 @@ export class DetailViewModel extends BaseViewModel { | @@ -23,18 +23,11 @@ export class DetailViewModel extends BaseViewModel { | ||
| 23 | Logger.debug(TAG, 'getDetailPageData contentId: ' + contentId); | 23 | Logger.debug(TAG, 'getDetailPageData contentId: ' + contentId); |
| 24 | return new Promise<ContentDetailDTO[]>((success, error) => { | 24 | return new Promise<ContentDetailDTO[]>((success, error) => { |
| 25 | PageRepository.fetchDetailData(relId, contentId, relType).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => { | 25 | PageRepository.fetchDetailData(relId, contentId, relType).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => { |
| 26 | - if (!resDTO || !resDTO.data) { | ||
| 27 | - Logger.error(TAG, 'getDetailPageData then resDTO is empty'); | ||
| 28 | - error('resDTO is empty'); | ||
| 29 | - return | ||
| 30 | - } | ||
| 31 | - if (resDTO.code != 0) { | ||
| 32 | - Logger.error(TAG, `getDetailPageData then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 33 | - error('resDTO Response Code is failure'); | ||
| 34 | - return | ||
| 35 | - } | ||
| 36 | - Logger.info(TAG, "getDetailPageData then,resDTO.timeStamp:" + resDTO.timestamp); | ||
| 37 | - success(resDTO.data); | 26 | + if(resDTO.data) { |
| 27 | + success(resDTO.data) | ||
| 28 | + } else { | ||
| 29 | + success([] as ContentDetailDTO[]) | ||
| 30 | + }; | ||
| 38 | }).catch((err: Error) => { | 31 | }).catch((err: Error) => { |
| 39 | Logger.error(TAG, `getDetailPageData catch, error.name : ${err.name}, error.message:${err.message}`); | 32 | Logger.error(TAG, `getDetailPageData catch, error.name : ${err.name}, error.message:${err.message}`); |
| 40 | error(err); | 33 | error(err); |
| @@ -52,11 +52,11 @@ class EditInfoViewModel { | @@ -52,11 +52,11 @@ class EditInfoViewModel { | ||
| 52 | if (editDTO.code == 0) { | 52 | if (editDTO.code == 0) { |
| 53 | success(editDTO.data) | 53 | success(editDTO.data) |
| 54 | }else { | 54 | }else { |
| 55 | - success(this.GetqueryAccountOwnerLocal(context)) | 55 | + // success(this.GetqueryAccountOwnerLocal(context)) |
| 56 | } | 56 | } |
| 57 | }).catch((error: Error) => { | 57 | }).catch((error: Error) => { |
| 58 | Logger.info(TAG,'queryAccountOwnerInfo','EditInfoViewModel') | 58 | Logger.info(TAG,'queryAccountOwnerInfo','EditInfoViewModel') |
| 59 | - success(this.GetqueryAccountOwnerLocal(context)) | 59 | + // success(this.GetqueryAccountOwnerLocal(context)) |
| 60 | }) | 60 | }) |
| 61 | })) | 61 | })) |
| 62 | } | 62 | } |
| 1 | import { Logger } from 'wdKit'; | 1 | import { Logger } from 'wdKit'; |
| 2 | -import { ResponseDTO } from 'wdNetwork'; | 2 | +import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 3 | +import { HashMap } from '@kit.ArkTS'; | ||
| 3 | import { ContentDetailDTO, | 4 | import { ContentDetailDTO, |
| 4 | batchLikeAndCollectParams, | 5 | batchLikeAndCollectParams, |
| 5 | batchLikeAndCollectResult, | 6 | batchLikeAndCollectResult, |
| @@ -156,4 +157,17 @@ export class MultiPictureDetailViewModel { | @@ -156,4 +157,17 @@ export class MultiPictureDetailViewModel { | ||
| 156 | }) | 157 | }) |
| 157 | }) | 158 | }) |
| 158 | } | 159 | } |
| 160 | + | ||
| 161 | + static async feedBackCommit(params:HashMap<String,String>): Promise<ResponseDTO> { | ||
| 162 | + return new Promise<ResponseDTO>((success, error) => { | ||
| 163 | + Logger.info(TAG, `fetchDetailData start`); | ||
| 164 | + WDHttp.post(HttpUrlUtils.getHost() + HttpUrlUtils.FEEDBACK_COMMIT_PATH,params).then((resDTO: ResponseDTO) => { | ||
| 165 | + | ||
| 166 | + success(resDTO); | ||
| 167 | + }).catch((err: Error) => { | ||
| 168 | + Logger.error(TAG, `fetchDetailData catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 169 | + error(err); | ||
| 170 | + }) | ||
| 171 | + }) | ||
| 172 | + } | ||
| 159 | } | 173 | } |
| @@ -13,6 +13,7 @@ import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean | @@ -13,6 +13,7 @@ import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean | ||
| 13 | import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO'; | 13 | import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO'; |
| 14 | import { viewBlogInsightIntentShare, ActionMode } from '../utils/InsightIntentShare' | 14 | import { viewBlogInsightIntentShare, ActionMode } from '../utils/InsightIntentShare' |
| 15 | import { common } from '@kit.AbilityKit'; | 15 | import { common } from '@kit.AbilityKit'; |
| 16 | +import { CacheData } from 'wdNetwork/Index'; | ||
| 16 | 17 | ||
| 17 | const TAG = 'PageHelper'; | 18 | const TAG = 'PageHelper'; |
| 18 | 19 | ||
| @@ -26,6 +27,7 @@ export class PageHelper { | @@ -26,6 +27,7 @@ export class PageHelper { | ||
| 26 | async refreshUI(pageModel: PageModel, pageAdvModel: PageAdModel) { | 27 | async refreshUI(pageModel: PageModel, pageAdvModel: PageAdModel) { |
| 27 | pageModel.loadStrategy = 2 | 28 | pageModel.loadStrategy = 2 |
| 28 | pageModel.pageTotalCompSize = 0; | 29 | pageModel.pageTotalCompSize = 0; |
| 30 | + // TODO 下拉刷新,是否加载缓存 | ||
| 29 | this.getPageInfo(pageModel, pageAdvModel) | 31 | this.getPageInfo(pageModel, pageAdvModel) |
| 30 | } | 32 | } |
| 31 | 33 | ||
| @@ -41,11 +43,71 @@ export class PageHelper { | @@ -41,11 +43,71 @@ export class PageHelper { | ||
| 41 | /** | 43 | /** |
| 42 | * 进页面请求数据 | 44 | * 进页面请求数据 |
| 43 | */ | 45 | */ |
| 46 | + async getInitCacheData(pageModel: PageModel, pageAdvModel: PageAdModel) { | ||
| 47 | + Logger.error('zzzz','getInitCacheData') | ||
| 48 | + PageViewModel.getPageInfoCache(pageModel.pageId).then(pageInfo => { | ||
| 49 | + if (pageInfo == null) { | ||
| 50 | + return; | ||
| 51 | + } | ||
| 52 | + pageModel.pageInfo = pageInfo; | ||
| 53 | + //解析页面挂角广告资源 | ||
| 54 | + pageAdvModel.analysisAdvSource(pageInfo); | ||
| 55 | + this.parseCacheGroup(pageModel) | ||
| 56 | + }) | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + async parseCacheGroup(pageModel: PageModel) { | ||
| 60 | + Logger.error('zzzz','parseCacheGroup') | ||
| 61 | + let pageInfo: PageInfoDTO = pageModel.pageInfo | ||
| 62 | + pageModel.groupList = [] | ||
| 63 | + pageInfo.pageAdList = [] | ||
| 64 | + pageInfo.oneRequestPageGroupCompList = new ArrayList() | ||
| 65 | + pageModel.groupList.push(...pageInfo.groups) | ||
| 66 | + Logger.error("ZZZXXXXX", 'parseCacheGroup----1-----'); | ||
| 67 | + for (const group of pageInfo.groups) { | ||
| 68 | + pageModel.groupId = group.id; | ||
| 69 | + pageModel.groupData = group | ||
| 70 | + Logger.error("ZZZXXXXX", '楼层id-start--》' + pageModel.groupId); | ||
| 71 | + // await,确保groups接口顺序执行 | ||
| 72 | + let pageDto = await PageViewModel.getPageGroupCacheData(pageModel.bizCopy()) as PageDTO | ||
| 73 | + let index = pageInfo.groups.indexOf(group) | ||
| 74 | + if (index == 0) { | ||
| 75 | + // 清空comp列表 | ||
| 76 | + pageModel.compList.clear() | ||
| 77 | + } | ||
| 78 | + this.analysisPageGroupCompData(pageModel,pageDto, pageInfo, index == pageInfo.groups.length - 1) | ||
| 79 | + Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + // 收集页面所有楼层的组件信息,同步完成广告投放计算,异步完成稿件批查, | ||
| 83 | + | ||
| 84 | + pageModel.pageTotalCompSize = pageInfo.oneRequestPageGroupCompList.length + pageModel.pageTotalCompSize | ||
| 85 | + // 处理页面广告数据,投放到页面的位置 | ||
| 86 | + // TODO 缓存数据不加载广告 | ||
| 87 | + // this.handlePageCompAdvPostion(pageInfo.oneRequestPageGroupCompList, pageModel, pageInfo.pageAdList); | ||
| 88 | + | ||
| 89 | + //遍历所有组件和稿件数据 push到页面 | ||
| 90 | + for (let element of pageInfo.oneRequestPageGroupCompList) { | ||
| 91 | + pageModel.compList.push(CompDTO.createNewsBean(element)) | ||
| 92 | + } | ||
| 93 | + Logger.error('zzzz', 'parseCacheGroup count: ' + pageModel.compList.totalCount()) | ||
| 94 | + pageModel.currentPage++ | ||
| 95 | + pageModel.viewType = ViewType.LOADED | ||
| 96 | + closeRefresh(pageModel, true) | ||
| 97 | + | ||
| 98 | + Logger.error("ZZZXXXXX", 'parseGroup----3----->' + pageInfo.oneRequestPageGroupCompList.length); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * 进页面请求数据 | ||
| 103 | + */ | ||
| 44 | async getInitData(pageModel: PageModel, pageAdvModel: PageAdModel) { | 104 | async getInitData(pageModel: PageModel, pageAdvModel: PageAdModel) { |
| 45 | pageModel.loadStrategy = 1 | 105 | pageModel.loadStrategy = 1 |
| 46 | let netStatus = NetworkUtil.isNetConnected() | 106 | let netStatus = NetworkUtil.isNetConnected() |
| 47 | if (netStatus) { | 107 | if (netStatus) { |
| 48 | this.getPageInfo(pageModel, pageAdvModel) | 108 | this.getPageInfo(pageModel, pageAdvModel) |
| 109 | + } else if (pageModel.compList.size() > 0) { | ||
| 110 | + // 加载缓存数据了,不用无网络提示 | ||
| 49 | } else { | 111 | } else { |
| 50 | pageModel.viewType = ViewType.EMPTY; | 112 | pageModel.viewType = ViewType.EMPTY; |
| 51 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork; | 113 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork; |
| @@ -79,6 +141,10 @@ export class PageHelper { | @@ -79,6 +141,10 @@ export class PageHelper { | ||
| 79 | //解析页面挂角广告资源 | 141 | //解析页面挂角广告资源 |
| 80 | pageAdvModel.analysisAdvSource(pageInfo); | 142 | pageAdvModel.analysisAdvSource(pageInfo); |
| 81 | this.parseGroup(pageModel) | 143 | this.parseGroup(pageModel) |
| 144 | + // if (pageModel.currentPage == 1) { | ||
| 145 | + // // 保存缓存 | ||
| 146 | + // CacheData.saveCacheData(CacheData.comPageInfoCacheKey + pageModel.pageId, pageInfo, pageInfo.md5) | ||
| 147 | + // } | ||
| 82 | }).catch(() => { | 148 | }).catch(() => { |
| 83 | pageModel.viewType = ViewType.EMPTY; | 149 | pageModel.viewType = ViewType.EMPTY; |
| 84 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_ContentFailed; | 150 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_ContentFailed; |
| @@ -115,6 +181,9 @@ export class PageHelper { | @@ -115,6 +181,9 @@ export class PageHelper { | ||
| 115 | if (index == 0) { | 181 | if (index == 0) { |
| 116 | // 清空comp列表 | 182 | // 清空comp列表 |
| 117 | pageModel.compList.clear() | 183 | pageModel.compList.clear() |
| 184 | + // // 保存缓存 | ||
| 185 | + // CacheData.saveCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId, pageDto, | ||
| 186 | + // pageDto.md5) | ||
| 118 | } | 187 | } |
| 119 | this.analysisPageGroupCompData(pageModel,pageDto, pageInfo, index == pageInfo.groups.length - 1) | 188 | this.analysisPageGroupCompData(pageModel,pageDto, pageInfo, index == pageInfo.groups.length - 1) |
| 120 | Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length); | 189 | Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length); |
| @@ -16,17 +16,12 @@ import { | @@ -16,17 +16,12 @@ import { | ||
| 16 | import { CompStyle } from 'wdConstant/Index'; | 16 | import { CompStyle } from 'wdConstant/Index'; |
| 17 | 17 | ||
| 18 | import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; | 18 | import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; |
| 19 | -import { ResponseDTO, } from 'wdNetwork'; | 19 | +import { CacheData, ResponseDTO, } from 'wdNetwork'; |
| 20 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; | 20 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; |
| 21 | import { PageRepository } from '../repository/PageRepository'; | 21 | import { PageRepository } from '../repository/PageRepository'; |
| 22 | import { BaseViewModel } from './BaseViewModel'; | 22 | import { BaseViewModel } from './BaseViewModel'; |
| 23 | 23 | ||
| 24 | const TAG = 'PageViewModel'; | 24 | const TAG = 'PageViewModel'; |
| 25 | -/** | ||
| 26 | - * mock数据开关,默认关。 | ||
| 27 | - * mock数据是本地json数据,可自行修改内容(‘entry\src\main\resources\rawfile\’目录) | ||
| 28 | - */ | ||
| 29 | -const mock_switch = false; | ||
| 30 | 25 | ||
| 31 | /** | 26 | /** |
| 32 | * 处理返回后的数据 | 27 | * 处理返回后的数据 |
| @@ -37,111 +32,10 @@ export class PageViewModel extends BaseViewModel { | @@ -37,111 +32,10 @@ export class PageViewModel extends BaseViewModel { | ||
| 37 | } | 32 | } |
| 38 | 33 | ||
| 39 | /** | 34 | /** |
| 40 | - * get Nav Data from Resource . | ||
| 41 | - * | ||
| 42 | - * @return BottomNavBean[] Nav Data List | ||
| 43 | - */ | ||
| 44 | - async getBottomNavData(context: Context): Promise<NavigationBodyDTO> { | ||
| 45 | - Logger.info(TAG, `getBottomNavData start`); | ||
| 46 | - if (mock_switch) { | ||
| 47 | - return this.getBottomNavDataMock(context); | ||
| 48 | - } | ||
| 49 | - return this.getNavData(); | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - async getBottomNavDetailData(id: number): Promise<NavigationDetailDTO> { | ||
| 53 | - Logger.info(TAG, `getBottomNavDetailData start`); | ||
| 54 | - return this.getNavDetailData(id); | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - async getBottomNavDataMock(context: Context): Promise<NavigationBodyDTO> { | ||
| 58 | - Logger.info(TAG, `getBottomNavDataMock start`); | ||
| 59 | - let compRes: ResponseDTO<NavigationBodyDTO> | null = | ||
| 60 | - await ResourcesUtils.getResourcesJson<ResponseDTO<NavigationBodyDTO>>(context, 'bottom_nav.json'); | ||
| 61 | - if (!compRes || !compRes.data) { | ||
| 62 | - Logger.info(TAG, `getBottomNavDataMock compRes bottomNavList is empty`); | ||
| 63 | - return {} as NavigationBodyDTO | ||
| 64 | - } | ||
| 65 | - Logger.info(TAG, `getBottomNavDataMock getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 66 | - return compRes.data | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | - private getNavData(): Promise<NavigationBodyDTO> { | ||
| 70 | - return new Promise<NavigationBodyDTO>((success, error) => { | ||
| 71 | - Logger.info(TAG, `getNavData start`); | ||
| 72 | - PageRepository.fetchNavigationDataApi().then((navResDTO: ResponseDTO<NavigationBodyDTO>) => { | ||
| 73 | - if (!navResDTO || !navResDTO.data) { | ||
| 74 | - Logger.error(TAG, 'getNavData then navResDTO is empty'); | ||
| 75 | - error('navResDTO is empty'); | ||
| 76 | - return | ||
| 77 | - } | ||
| 78 | - if (navResDTO.code != 0) { | ||
| 79 | - Logger.error(TAG, `getNavData then code:${navResDTO.code}, message:${navResDTO.message}`); | ||
| 80 | - error('navResDTO Response Code is failure'); | ||
| 81 | - return | ||
| 82 | - } | ||
| 83 | - // let navResStr = JSON.stringify(navResDTO); | ||
| 84 | - Logger.info(TAG, "getNavData then,navResDTO.timestamp:" + navResDTO.timestamp); | ||
| 85 | - success(navResDTO.data); | ||
| 86 | - }).catch((err: Error) => { | ||
| 87 | - Logger.error(TAG, `fetchNavigationDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 88 | - error(err); | ||
| 89 | - }) | ||
| 90 | - }) | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - private getNavDetailData(id: number): Promise<NavigationDetailDTO> { | ||
| 94 | - return new Promise<NavigationDetailDTO>((success, error) => { | ||
| 95 | - Logger.info(TAG, `getNavData start`); | ||
| 96 | - PageRepository.fetchNavigationDetailDataApi(id).then((navResDTO: ResponseDTO<NavigationDetailDTO>) => { | ||
| 97 | - if (!navResDTO || !navResDTO.data) { | ||
| 98 | - Logger.error(TAG, 'getNavData then navResDTO is empty'); | ||
| 99 | - error('navResDTO is empty'); | ||
| 100 | - return | ||
| 101 | - } | ||
| 102 | - if (navResDTO.code != 0) { | ||
| 103 | - Logger.error(TAG, `getNavData then code:${navResDTO.code}, message:${navResDTO.message}`); | ||
| 104 | - error('navResDTO Response Code is failure'); | ||
| 105 | - return | ||
| 106 | - } | ||
| 107 | - // let navResStr = JSON.stringify(navResDTO); | ||
| 108 | - Logger.info(TAG, "getNavData then,navResDTO.timestamp:" + navResDTO.timestamp); | ||
| 109 | - success(navResDTO.data); | ||
| 110 | - }).catch((err: Error) => { | ||
| 111 | - Logger.error(TAG, `fetchNavigationDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 112 | - error(err); | ||
| 113 | - }) | ||
| 114 | - }) | ||
| 115 | - } | ||
| 116 | - | ||
| 117 | - /** | ||
| 118 | - * Get PageDTO data. | ||
| 119 | - * | ||
| 120 | - * @return {GroupDTO} compRes.data | ||
| 121 | - */ | ||
| 122 | - private async getPageData1(currentPage: number, context: Context): Promise<PageDTO> { | ||
| 123 | - if (currentPage > 1) { | ||
| 124 | - // 加载更多,返回无数据 | ||
| 125 | - return {} as PageDTO | ||
| 126 | - } | ||
| 127 | - let compRes: ResponseDTO<PageDTO> | null = | ||
| 128 | - await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list0.json'); | ||
| 129 | - if (!compRes || !compRes.data) { | ||
| 130 | - Logger.info(TAG, `getCompList compRes is empty`); | ||
| 131 | - return {} as PageDTO | ||
| 132 | - } | ||
| 133 | - Logger.info(TAG, `getCompList getResourcesJson compRes : ${JSON.stringify(compRes)}`); | ||
| 134 | - return compRes.data | ||
| 135 | - } | ||
| 136 | - | ||
| 137 | - /** | ||
| 138 | * 获取【早晚报】数据 | 35 | * 获取【早晚报】数据 |
| 139 | */ | 36 | */ |
| 140 | async getMorningEveningPaperData(pageId: string): Promise<MorningEveningPaperDTO> { | 37 | async getMorningEveningPaperData(pageId: string): Promise<MorningEveningPaperDTO> { |
| 141 | Logger.debug(TAG, 'getPageData pageId: ' + pageId); | 38 | Logger.debug(TAG, 'getPageData pageId: ' + pageId); |
| 142 | - // if (mock_switch) { | ||
| 143 | - // return this.getPageData3(currentPage, context); | ||
| 144 | - // } | ||
| 145 | 39 | ||
| 146 | return new Promise<MorningEveningPaperDTO>((success, error) => { | 40 | return new Promise<MorningEveningPaperDTO>((success, error) => { |
| 147 | PageRepository.fetchMorningEveningPaperData(pageId) | 41 | PageRepository.fetchMorningEveningPaperData(pageId) |
| @@ -166,18 +60,6 @@ export class PageViewModel extends BaseViewModel { | @@ -166,18 +60,6 @@ export class PageViewModel extends BaseViewModel { | ||
| 166 | }) | 60 | }) |
| 167 | } | 61 | } |
| 168 | 62 | ||
| 169 | - private async getPageData2(context: Context): Promise<PageDTO> { | ||
| 170 | - let compRes: ResponseDTO<PageDTO> | null = | ||
| 171 | - await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list2.json'); | ||
| 172 | - if (!compRes || !compRes.data) { | ||
| 173 | - Logger.info(TAG, `getCompList compRes is empty`); | ||
| 174 | - return {} as PageDTO | ||
| 175 | - } | ||
| 176 | - // router.push('') | ||
| 177 | - Logger.info(TAG, `getCompList getResourcesJson compRes : ${JSON.stringify(compRes)}`); | ||
| 178 | - return compRes.data | ||
| 179 | - } | ||
| 180 | - | ||
| 181 | /** | 63 | /** |
| 182 | * 获取页面楼层的组件信息 | 64 | * 获取页面楼层的组件信息 |
| 183 | * @param pageModel | 65 | * @param pageModel |
| @@ -207,6 +89,7 @@ export class PageViewModel extends BaseViewModel { | @@ -207,6 +89,7 @@ export class PageViewModel extends BaseViewModel { | ||
| 207 | return | 89 | return |
| 208 | } | 90 | } |
| 209 | Logger.info(TAG, "getNavData then,resDTO.timestamp:" + resDTO.timestamp); | 91 | Logger.info(TAG, "getNavData then,resDTO.timestamp:" + resDTO.timestamp); |
| 92 | + resDTO.data.md5 = resDTO.meta?.md5 || '' | ||
| 210 | success(resDTO.data); | 93 | success(resDTO.data); |
| 211 | }) | 94 | }) |
| 212 | .catch((err: Error) => { | 95 | .catch((err: Error) => { |
| @@ -309,36 +192,6 @@ export class PageViewModel extends BaseViewModel { | @@ -309,36 +192,6 @@ export class PageViewModel extends BaseViewModel { | ||
| 309 | }); | 192 | }); |
| 310 | } | 193 | } |
| 311 | 194 | ||
| 312 | - /** | ||
| 313 | - * @deprecated | ||
| 314 | - */ | ||
| 315 | - private resetInteract(interact: InteractDataDTO[], compList: CompDTO[]) { | ||
| 316 | - if (interact == null || interact.length == 0) { | ||
| 317 | - return | ||
| 318 | - } | ||
| 319 | - interact.forEach((interactData) => { | ||
| 320 | - let id = interactData.contentId; | ||
| 321 | - outer: for (let i = 0; i < compList.length; i++) { | ||
| 322 | - let comp = compList[i]; | ||
| 323 | - if (comp == null || comp.operDataList == null || comp.operDataList.length == 0) { | ||
| 324 | - continue; | ||
| 325 | - } | ||
| 326 | - for (let j = 0; j < comp.operDataList.length; j++) { | ||
| 327 | - let content = comp.operDataList[j]; | ||
| 328 | - if (content == null) { | ||
| 329 | - continue; | ||
| 330 | - } | ||
| 331 | - if (id == content.objectId) { | ||
| 332 | - content.interactData = interactData; | ||
| 333 | - // TODO 测试代码,待删除 | ||
| 334 | - // content.interactData.likeNum = Math.floor(Math.random() * Math.floor(999));; | ||
| 335 | - break outer; | ||
| 336 | - } | ||
| 337 | - } | ||
| 338 | - } | ||
| 339 | - }) | ||
| 340 | - } | ||
| 341 | - | ||
| 342 | private getInteractParams(compList: CompDTO[]): InteractParam { | 195 | private getInteractParams(compList: CompDTO[]): InteractParam { |
| 343 | if (compList == null || compList.length == 0) { | 196 | if (compList == null || compList.length == 0) { |
| 344 | return {} as InteractParam; | 197 | return {} as InteractParam; |
| @@ -374,11 +227,13 @@ export class PageViewModel extends BaseViewModel { | @@ -374,11 +227,13 @@ export class PageViewModel extends BaseViewModel { | ||
| 374 | async getPageInfo(pageId: string): Promise<PageInfoDTO> { | 227 | async getPageInfo(pageId: string): Promise<PageInfoDTO> { |
| 375 | return new Promise<PageInfoDTO>((success, error) => { | 228 | return new Promise<PageInfoDTO>((success, error) => { |
| 376 | PageRepository.fetchPageData(pageId).then((resDTO: ResponseDTO<PageInfoDTO>) => { | 229 | PageRepository.fetchPageData(pageId).then((resDTO: ResponseDTO<PageInfoDTO>) => { |
| 377 | - if (this.isRespondsInvalid(resDTO, 'getPageInfo')) { | ||
| 378 | - error("getPageInfo data invalid"); | 230 | + if (!resDTO || !resDTO.data) { |
| 231 | + Logger.error(TAG, 'getPageInfo then navResDTO is empty'); | ||
| 232 | + error('navResDTO is empty'); | ||
| 379 | return | 233 | return |
| 380 | } | 234 | } |
| 381 | Logger.info(TAG, "getPageInfo then,resDTO.timeStamp:" + resDTO.timestamp); | 235 | Logger.info(TAG, "getPageInfo then,resDTO.timeStamp:" + resDTO.timestamp); |
| 236 | + resDTO.data.md5 = resDTO.meta?.md5 || '' | ||
| 382 | success(resDTO.data as PageInfoDTO); | 237 | success(resDTO.data as PageInfoDTO); |
| 383 | }); | 238 | }); |
| 384 | }); | 239 | }); |
| @@ -483,6 +338,46 @@ export class PageViewModel extends BaseViewModel { | @@ -483,6 +338,46 @@ export class PageViewModel extends BaseViewModel { | ||
| 483 | }) | 338 | }) |
| 484 | } | 339 | } |
| 485 | 340 | ||
| 341 | + async getPageInfoCache(pageId: string): Promise<PageInfoDTO | null> { | ||
| 342 | + return new Promise<PageInfoDTO | null>((success) => { | ||
| 343 | + CacheData.getLocalCacheData(CacheData.comPageInfoCacheKey + pageId).then((data) => { | ||
| 344 | + // Logger.debug(TAG, 'getPageInfoCache 333 ' + JSON.stringify(data)); | ||
| 345 | + if (data) { | ||
| 346 | + let navBean = JSON.parse(CacheData.getNetworkData(data)) as PageInfoDTO | ||
| 347 | + success(navBean) | ||
| 348 | + } else { | ||
| 349 | + success(null) | ||
| 350 | + } | ||
| 351 | + }).catch((err: object) => { | ||
| 352 | + Logger.error(TAG, 'getPageInfoCache catch err: ' + JSON.stringify(err)); | ||
| 353 | + success(null) | ||
| 354 | + }) | ||
| 355 | + }); | ||
| 356 | + } | ||
| 357 | + | ||
| 358 | + /** | ||
| 359 | + * 获取页面楼层的组件信息 | ||
| 360 | + * @param pageModel | ||
| 361 | + * @returns | ||
| 362 | + */ | ||
| 363 | + async getPageGroupCacheData(pageModel: PageUIReqBean): Promise<PageDTO | null> { | ||
| 364 | + Logger.debug(TAG, 'getPageData pageId: ' + pageModel.pageId); | ||
| 365 | + return new Promise<PageDTO | null>((success) => { | ||
| 366 | + CacheData.getLocalCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId).then((data) => { | ||
| 367 | + // Logger.debug(TAG, 'getPageGroupCacheData 333 ' + JSON.stringify(data)); | ||
| 368 | + if (data) { | ||
| 369 | + let navBean = JSON.parse(CacheData.getNetworkData(data)) as PageDTO | ||
| 370 | + success(navBean) | ||
| 371 | + } else { | ||
| 372 | + success(null) | ||
| 373 | + } | ||
| 374 | + }).catch((err: object) => { | ||
| 375 | + Logger.error(TAG, 'getPageGroupCacheData catch err: ' + JSON.stringify(err)); | ||
| 376 | + success(null) | ||
| 377 | + }) | ||
| 378 | + }); | ||
| 379 | + } | ||
| 380 | + | ||
| 486 | } | 381 | } |
| 487 | 382 | ||
| 488 | 383 |
| @@ -67,5 +67,40 @@ | @@ -67,5 +67,40 @@ | ||
| 67 | "name": "feedback", | 67 | "name": "feedback", |
| 68 | "value": "意见反馈" | 68 | "value": "意见反馈" |
| 69 | } | 69 | } |
| 70 | + , | ||
| 71 | + { | ||
| 72 | + "name": "res_feedback_commentsFail", | ||
| 73 | + "value": "请输入 10-500 个字以内" | ||
| 74 | + } | ||
| 75 | + , | ||
| 76 | + { | ||
| 77 | + "name": "feedback_opinion_type", | ||
| 78 | + "value": "请选择问题类型" | ||
| 79 | + } | ||
| 80 | + , | ||
| 81 | + { | ||
| 82 | + "name": "feedback_comments", | ||
| 83 | + "value": "您的宝贵意见是我们前行的动力" | ||
| 84 | + } | ||
| 85 | + , | ||
| 86 | + { | ||
| 87 | + "name": "feedback_opinion_tv", | ||
| 88 | + "value": "描述您的问题" | ||
| 89 | + } | ||
| 90 | + , | ||
| 91 | + { | ||
| 92 | + "name": "feedback_email", | ||
| 93 | + "value": "期待您留下联系方式,我们将提供更好的服务" | ||
| 94 | + } | ||
| 95 | + , | ||
| 96 | + { | ||
| 97 | + "name": "feedback_mail", | ||
| 98 | + "value": "电话或者邮箱" | ||
| 99 | + } | ||
| 100 | + , | ||
| 101 | + { | ||
| 102 | + "name": "feedback_hideemail", | ||
| 103 | + "value": "请输入电话或者邮箱" | ||
| 104 | + } | ||
| 70 | ] | 105 | ] |
| 71 | } | 106 | } |
1.95 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/icon_feekback_delete.png
0 → 100644
1000 Bytes
| @@ -71,7 +71,9 @@ export struct TabChatItemComponent { | @@ -71,7 +71,9 @@ export struct TabChatItemComponent { | ||
| 71 | width: 0, | 71 | width: 0, |
| 72 | height: 0, | 72 | height: 0, |
| 73 | picPath: imgUrl, | 73 | picPath: imgUrl, |
| 74 | - picDesc: '' | 74 | + picDesc: '', |
| 75 | + itemType:2, | ||
| 76 | + id:0 | ||
| 75 | }) | 77 | }) |
| 76 | let taskAction: Action = { | 78 | let taskAction: Action = { |
| 77 | type: 'JUMP_DETAIL_PAGE', | 79 | type: 'JUMP_DETAIL_PAGE', |
| @@ -194,7 +194,9 @@ export struct TabLiveItemComponent { | @@ -194,7 +194,9 @@ export struct TabLiveItemComponent { | ||
| 194 | width: 0, | 194 | width: 0, |
| 195 | height: 0, | 195 | height: 0, |
| 196 | picPath: item, | 196 | picPath: item, |
| 197 | - picDesc: '' | 197 | + picDesc: '', |
| 198 | + itemType:2, | ||
| 199 | + id:0 | ||
| 198 | }) | 200 | }) |
| 199 | } | 201 | } |
| 200 | let taskAction: Action = { | 202 | let taskAction: Action = { |
| @@ -441,6 +441,20 @@ struct LoginPage { | @@ -441,6 +441,20 @@ struct LoginPage { | ||
| 441 | cancelProtocol(): void { | 441 | cancelProtocol(): void { |
| 442 | this.isProtocol = false | 442 | this.isProtocol = false |
| 443 | } | 443 | } |
| 444 | + | ||
| 445 | + pageTransition() { | ||
| 446 | + // 为目标页面时,进入:从右边侧滑入,退出:是右侧划出;跳转别的页面:左侧划出,返回:左侧划入。 | ||
| 447 | + PageTransitionEnter({ type: RouteType.Push, duration: 300 }) | ||
| 448 | + .slide(SlideEffect.Right) | ||
| 449 | + PageTransitionEnter({ type: RouteType.Pop, duration: 300 }) | ||
| 450 | + .slide(SlideEffect.Left) | ||
| 451 | + PageTransitionExit({ type: RouteType.Push, duration: 300 }) | ||
| 452 | + .slide(SlideEffect.Left) | ||
| 453 | + PageTransitionExit({ type: RouteType.Pop, duration: 300 }) | ||
| 454 | + .slide(SlideEffect.Right) | ||
| 455 | + } | ||
| 456 | + | ||
| 457 | + | ||
| 444 | } | 458 | } |
| 445 | 459 | ||
| 446 | 460 |
| @@ -9,11 +9,12 @@ const TAG = 'SpacialTopicPage'; | @@ -9,11 +9,12 @@ const TAG = 'SpacialTopicPage'; | ||
| 9 | @Entry | 9 | @Entry |
| 10 | @Component | 10 | @Component |
| 11 | struct SpacialTopicPage { | 11 | struct SpacialTopicPage { |
| 12 | - action: Action = {} as Action | ||
| 13 | - | 12 | + @State action: Action = {} as Action |
| 13 | + @State reload: number = 0 | ||
| 14 | + @State count: number = 0 | ||
| 14 | build() { | 15 | build() { |
| 15 | Column() { | 16 | Column() { |
| 16 | - SpacialTopicPageComponent({ action: this.action }) | 17 | + SpacialTopicPageComponent({ action: this.action ,reload:this.reload }) |
| 17 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 18 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| 18 | } | 19 | } |
| 19 | 20 | ||
| @@ -30,8 +31,12 @@ struct SpacialTopicPage { | @@ -30,8 +31,12 @@ struct SpacialTopicPage { | ||
| 30 | } | 31 | } |
| 31 | 32 | ||
| 32 | aboutToAppear() { | 33 | aboutToAppear() { |
| 33 | - Logger.info(TAG, 'aboutToAppear'); | 34 | + Logger.info(TAG, `aboutToAppearcount:${this.reload}`); |
| 34 | let action: Action = router.getParams() as Action | 35 | let action: Action = router.getParams() as Action |
| 35 | this.action = action | 36 | this.action = action |
| 36 | } | 37 | } |
| 38 | + onPageShow() { | ||
| 39 | + this.reload = this.reload + 1 | ||
| 40 | + Logger.info(TAG, `onPageShowcount:${this.reload}`); | ||
| 41 | + } | ||
| 37 | } | 42 | } |
| @@ -3,6 +3,7 @@ import { WDPushNotificationManager } from 'wdHwAbility/Index' | @@ -3,6 +3,7 @@ import { WDPushNotificationManager } from 'wdHwAbility/Index' | ||
| 3 | import { DeviceUtil, | 3 | import { DeviceUtil, |
| 4 | EmitterEventId, | 4 | EmitterEventId, |
| 5 | EmitterUtils, | 5 | EmitterUtils, |
| 6 | + KVStoreHelper, | ||
| 6 | Logger, | 7 | Logger, |
| 7 | MpaasUtils, NetworkManager, | 8 | MpaasUtils, NetworkManager, |
| 8 | NetworkType, | 9 | NetworkType, |
| @@ -38,7 +39,8 @@ export class StartupManager { | @@ -38,7 +39,8 @@ export class StartupManager { | ||
| 38 | 39 | ||
| 39 | // KV存储 | 40 | // KV存储 |
| 40 | SPHelper.init(context); | 41 | SPHelper.init(context); |
| 41 | - | 42 | + // KV存储(较大数据,value<4M)(首页接口数据缓存用到) |
| 43 | + KVStoreHelper.init(context) | ||
| 42 | // 路由注册 | 44 | // 路由注册 |
| 43 | registerRouter(); | 45 | registerRouter(); |
| 44 | 46 |
-
Please register or login to post a comment