Merge remote-tracking branch 'origin/main'
# Conflicts: # sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
Showing
42 changed files
with
1326 additions
and
532 deletions
| @@ -48,4 +48,8 @@ export class SpConstants{ | @@ -48,4 +48,8 @@ export class SpConstants{ | ||
| 48 | //游客状态下首次评论时间 | 48 | //游客状态下首次评论时间 |
| 49 | static FIRSTCOMMENTTIME = 'firstCommentTime' | 49 | static FIRSTCOMMENTTIME = 'firstCommentTime' |
| 50 | static TOURIST_NICK_NAME = 'touristNickName' | 50 | static TOURIST_NICK_NAME = 'touristNickName' |
| 51 | + | ||
| 52 | + // 个推推送 | ||
| 53 | + static GETUI_PUSH_CID = "cid" | ||
| 54 | + static GETUI_PUSH_DEVICE_TOKEN = "deviceToken" | ||
| 51 | } | 55 | } |
| @@ -133,10 +133,15 @@ export class NetworkManager { | @@ -133,10 +133,15 @@ export class NetworkManager { | ||
| 133 | * 同步获取网络类型,耗时 | 133 | * 同步获取网络类型,耗时 |
| 134 | */ | 134 | */ |
| 135 | public getNetTypeSync(): NetworkType { | 135 | public getNetTypeSync(): NetworkType { |
| 136 | - let netHandle = connection.getDefaultNetSync(); | ||
| 137 | - let netCapabilities = connection.getNetCapabilitiesSync(netHandle) | ||
| 138 | - this.reset(netCapabilities.bearerTypes) | ||
| 139 | - return this.networkType; | 136 | + try { |
| 137 | + let netHandle = connection.getDefaultNetSync(); | ||
| 138 | + let netCapabilities = connection.getNetCapabilitiesSync(netHandle) | ||
| 139 | + this.reset(netCapabilities.bearerTypes) | ||
| 140 | + return this.networkType; | ||
| 141 | + } catch (e) { | ||
| 142 | + Logger.error(TAG, 'getNetTypeSync e: ' + JSON.stringify(e)) | ||
| 143 | + } | ||
| 144 | + return NetworkType.TYPE_UNKNOWN | ||
| 140 | } | 145 | } |
| 141 | 146 | ||
| 142 | private parseData(data: connection.NetCapabilityInfo) { | 147 | private parseData(data: connection.NetCapabilityInfo) { |
| @@ -43,7 +43,7 @@ export class NetworkUtil { | @@ -43,7 +43,7 @@ export class NetworkUtil { | ||
| 43 | */ | 43 | */ |
| 44 | static isNetConnected(): boolean { | 44 | static isNetConnected(): boolean { |
| 45 | let type = NetworkManager.getInstance().getNetType() | 45 | let type = NetworkManager.getInstance().getNetType() |
| 46 | - if (type == NetworkType.TYPE_NONE) { | 46 | + if (type == NetworkType.TYPE_UNKNOWN || type == NetworkType.TYPE_NONE) { |
| 47 | return false | 47 | return false |
| 48 | } | 48 | } |
| 49 | return true | 49 | return true |
| @@ -807,4 +807,9 @@ export class HttpUrlUtils { | @@ -807,4 +807,9 @@ export class HttpUrlUtils { | ||
| 807 | let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push"; | 807 | let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push"; |
| 808 | return url; | 808 | return url; |
| 809 | } | 809 | } |
| 810 | -} | ||
| 810 | + | ||
| 811 | + static getUploadPushInfoUrl() { | ||
| 812 | + let url = HttpUrlUtils.getHost() + "/api/rmrb-contact/contact/zh/c/push/device" | ||
| 813 | + return url | ||
| 814 | + } | ||
| 815 | +} |
| @@ -12,4 +12,6 @@ export { ProcessUtils } from './src/main/ets/utils/ProcessUtils' | @@ -12,4 +12,6 @@ export { ProcessUtils } from './src/main/ets/utils/ProcessUtils' | ||
| 12 | 12 | ||
| 13 | export { AssignChannelParam } from './src/main/ets/utils/HomeChannelUtils'; | 13 | export { AssignChannelParam } from './src/main/ets/utils/HomeChannelUtils'; |
| 14 | 14 | ||
| 15 | -export { RouterJumpInterceptor, JumpInterceptorAction } from './src/main/ets/router/RouterJumpInterceptor' | ||
| 15 | +export { RouterJumpInterceptor, JumpInterceptorAction } from './src/main/ets/router/RouterJumpInterceptor' | ||
| 16 | + | ||
| 17 | +export { AppInnerLink } from './src/main/ets/utils/AppInnerLink' |
| 1 | +import { url } from '@kit.ArkTS' | ||
| 2 | +import App from '@system.app' | ||
| 3 | +import { Logger } from 'wdKit/Index' | ||
| 4 | + | ||
| 5 | +const TAG = "AppInnerLink" | ||
| 6 | + | ||
| 7 | +export class AppInnerLink { | ||
| 8 | + | ||
| 9 | + static readonly INNER_LINK_PROTCOL = "rmrbapp:" | ||
| 10 | + static readonly INNER_LINK_HOSTNAME = "rmrb.app" | ||
| 11 | + static readonly INNER_LINK_PATHNAME = "openwith" | ||
| 12 | + | ||
| 13 | + // 内链跳转 | ||
| 14 | + // 内链地址例如:rmrbapp://rmrb.app/openwith?type=article&subType=h5_template_article&contentId=30000762651&relId=500000038702&skipType=1&relType=1 | ||
| 15 | + static jumpWithLink(innerLink: string) { | ||
| 16 | + | ||
| 17 | + let params = AppInnerLink.parseParams(innerLink) | ||
| 18 | + if (!params) { | ||
| 19 | + Logger.info(TAG, "跳转无效的链接地址 " + innerLink) | ||
| 20 | + return | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + switch (params.skipType) { | ||
| 24 | + case 1: { | ||
| 25 | + AppInnerLink.jumpParams(params) | ||
| 26 | + break | ||
| 27 | + } | ||
| 28 | + case 2: { | ||
| 29 | + AppInnerLink.jumpNoParams(params) | ||
| 30 | + break | ||
| 31 | + } | ||
| 32 | + case 3: { | ||
| 33 | + AppInnerLink.jumpAppH5(params) | ||
| 34 | + break | ||
| 35 | + } | ||
| 36 | + case 4: { | ||
| 37 | + AppInnerLink.jumpOutH5(params) | ||
| 38 | + break | ||
| 39 | + } | ||
| 40 | + case 5: { | ||
| 41 | + AppInnerLink.jumpThirdApp(params) | ||
| 42 | + break | ||
| 43 | + } | ||
| 44 | + default: { | ||
| 45 | + Logger.info(TAG, "跳转无效的链接地址 " + innerLink) | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + private static jumpParams(params: InnerLinkParam) { | ||
| 51 | + | ||
| 52 | + } | ||
| 53 | + private static jumpNoParams(params: InnerLinkParam) { | ||
| 54 | + | ||
| 55 | + } | ||
| 56 | + private static jumpAppH5(params: InnerLinkParam) { | ||
| 57 | + | ||
| 58 | + } | ||
| 59 | + private static jumpOutH5(params: InnerLinkParam) { | ||
| 60 | + | ||
| 61 | + } | ||
| 62 | + private static jumpThirdApp(params: InnerLinkParam) { | ||
| 63 | + | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + static parseParams(link: string) : InnerLinkParam | undefined { | ||
| 67 | + const that = url.URL.parseURL(link) | ||
| 68 | + if (that.protocol !== AppInnerLink.INNER_LINK_PROTCOL) { | ||
| 69 | + return | ||
| 70 | + } | ||
| 71 | + if (that.hostname !== AppInnerLink.INNER_LINK_HOSTNAME) { | ||
| 72 | + return | ||
| 73 | + } | ||
| 74 | + if (that.pathname !== AppInnerLink.INNER_LINK_PATHNAME) { | ||
| 75 | + return | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + let obj = {} as InnerLinkParam | ||
| 79 | + | ||
| 80 | + const params = that.params | ||
| 81 | + obj.type = params.get("type") as string | ||
| 82 | + obj.subType = params.get("subType") as string | ||
| 83 | + obj.contentId = params.get("contentId") as string | ||
| 84 | + obj.relId = params.get("relId") as string | ||
| 85 | + obj.relType = params.get("relType") as string | ||
| 86 | + obj.pageId = params.get("pageId") as string | ||
| 87 | + obj.url = params.get("url") as string | ||
| 88 | + obj.activityId = params.get("activityId") as string | ||
| 89 | + obj.activityType = params.get("activityType") as string | ||
| 90 | + obj.creatorId = params.get("creatorId") as string | ||
| 91 | + obj.firstChannelId = params.get("firstChannelId") as string | ||
| 92 | + obj.skipType = Number(params.get("skipType")) | ||
| 93 | + obj.isLogin = params.get("isLogin") as string | ||
| 94 | + return obj | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +interface InnerLinkParam { | ||
| 101 | + type?: string, | ||
| 102 | + subType?: string, | ||
| 103 | + contentId?: string, | ||
| 104 | + relId?: string, | ||
| 105 | + relType?: string | ||
| 106 | + pageId?: string, | ||
| 107 | + url?: string, | ||
| 108 | + activityId?: string, | ||
| 109 | + activityType?: string, | ||
| 110 | + creatorId?: string, | ||
| 111 | + firstChannelId?: string, | ||
| 112 | + skipType: number, | ||
| 113 | + isLogin?: string, | ||
| 114 | +} |
| @@ -145,6 +145,7 @@ export struct ENewspaperPageComponent { | @@ -145,6 +145,7 @@ export struct ENewspaperPageComponent { | ||
| 145 | .onClick(() => { | 145 | .onClick(() => { |
| 146 | this.calendarDialogShow = !this.calendarDialogShow | 146 | this.calendarDialogShow = !this.calendarDialogShow |
| 147 | if (this.calendarDialogShow) { | 147 | if (this.calendarDialogShow) { |
| 148 | + | ||
| 148 | this.calendarDialogController.open() | 149 | this.calendarDialogController.open() |
| 149 | } else { | 150 | } else { |
| 150 | this.calendarDialogController.close() | 151 | this.calendarDialogController.close() |
| @@ -103,6 +103,10 @@ export struct RMCalendar { | @@ -103,6 +103,10 @@ export struct RMCalendar { | ||
| 103 | nowFontColor: this.nowFontColor, | 103 | nowFontColor: this.nowFontColor, |
| 104 | disableClick: (item: RMCalendarBean) => { | 104 | disableClick: (item: RMCalendarBean) => { |
| 105 | if (this.disableCellClick) { | 105 | if (this.disableCellClick) { |
| 106 | + if (!NetworkUtil.isNetConnected()) { | ||
| 107 | + ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | ||
| 108 | + return | ||
| 109 | + } | ||
| 106 | this.disableCellClick(item) | 110 | this.disableCellClick(item) |
| 107 | } | 111 | } |
| 108 | }, | 112 | }, |
| 1 | import { RMCalendarBean } from './RMCalendarBean'; | 1 | import { RMCalendarBean } from './RMCalendarBean'; |
| 2 | -import font from '@ohos.font'; | 2 | +import { ToastUtils, NetworkUtil } from 'wdKit/Index'; |
| 3 | 3 | ||
| 4 | @Component | 4 | @Component |
| 5 | export struct RMCalenderCell { | 5 | export struct RMCalenderCell { |
| @@ -38,6 +38,12 @@ export struct RMCalenderCell { | @@ -38,6 +38,12 @@ export struct RMCalenderCell { | ||
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | getItemColor() { | 40 | getItemColor() { |
| 41 | + if (!NetworkUtil.isNetConnected()) { | ||
| 42 | + if (this.selectItem && this.selectItem.time == this.item.time) { | ||
| 43 | + return this.selectFontColor | ||
| 44 | + } | ||
| 45 | + return this.disabledFontColor | ||
| 46 | + } | ||
| 41 | if (!this.isShowSelectBg() && this.item.isNow) { | 47 | if (!this.isShowSelectBg() && this.item.isNow) { |
| 42 | return this.nowFontColor | 48 | return this.nowFontColor |
| 43 | } else if (this.item.isPre) { | 49 | } else if (this.item.isPre) { |
| @@ -136,9 +142,11 @@ export struct RMCalenderCell { | @@ -136,9 +142,11 @@ export struct RMCalenderCell { | ||
| 136 | return | 142 | return |
| 137 | // } | 143 | // } |
| 138 | } | 144 | } |
| 139 | - this.selectItem = this.item | ||
| 140 | - if (this.cellClick) { | ||
| 141 | - this.cellClick(this.item) | 145 | + if (NetworkUtil.isNetConnected()) { |
| 146 | + this.selectItem = this.item | ||
| 147 | + if (this.cellClick) { | ||
| 148 | + this.cellClick(this.item) | ||
| 149 | + } | ||
| 142 | } | 150 | } |
| 143 | }) | 151 | }) |
| 144 | } | 152 | } |
| @@ -8,7 +8,7 @@ export struct CardSourceInfo { | @@ -8,7 +8,7 @@ export struct CardSourceInfo { | ||
| 8 | @ObjectLink compDTO: CompDTO | 8 | @ObjectLink compDTO: CompDTO |
| 9 | 9 | ||
| 10 | build() { | 10 | build() { |
| 11 | - Flex() { | 11 | + Flex({ alignItems: ItemAlign.Center }) { |
| 12 | if (this.contentDTO.corner) { | 12 | if (this.contentDTO.corner) { |
| 13 | Text(this.contentDTO.corner) | 13 | Text(this.contentDTO.corner) |
| 14 | .fontSize($r("app.float.font_size_11")) | 14 | .fontSize($r("app.float.font_size_11")) |
| @@ -28,31 +28,45 @@ export struct CardSourceInfo { | @@ -28,31 +28,45 @@ export struct CardSourceInfo { | ||
| 28 | .maxLines(1) | 28 | .maxLines(1) |
| 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 30 | } | 30 | } |
| 31 | - if (((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName && this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) && (this.getContentDtoBean()?.interactData?.commentNum || DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)) != '')) { | 31 | + if (((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName && this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) && (this.getContentDtoBean()?.interactData?.commentNum |
| 32 | + // || DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)) != '' | ||
| 33 | + || (this.contentDTO.isSearch || this.contentDTO.isCollection || | ||
| 34 | + !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | ||
| 35 | + (Number | ||
| 36 | + .parseFloat(this | ||
| 37 | + .contentDTO.publishTime)) | ||
| 38 | + .indexOf | ||
| 39 | + ('-') === -1) | ||
| 40 | + )) { | ||
| 32 | Image($r("app.media.point")) | 41 | Image($r("app.media.point")) |
| 33 | - .width(16) | ||
| 34 | - .height(16) | 42 | + .width(11) |
| 43 | + .height(11) | ||
| 35 | } | 44 | } |
| 36 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 | 45 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 |
| 37 | - if (this.contentDTO.isSearch || this.contentDTO.isCollection || | ||
| 38 | - !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | ||
| 39 | - (Number | ||
| 40 | - .parseFloat(this | ||
| 41 | - .contentDTO.publishTime)) | ||
| 42 | - .indexOf | ||
| 43 | - ('-') === -1) { | 46 | + // if (this.contentDTO.isSearch || this.contentDTO.isCollection || |
| 47 | + // (!this.contentDTO.isSearch && | ||
| 48 | + // DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)).indexOf('-') === -1)) { | ||
| 49 | + // | ||
| 50 | + // Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | ||
| 51 | + // .fontSize($r("app.float.font_size_11")) | ||
| 52 | + // .fontColor($r("app.color.color_B0B0B0")) | ||
| 53 | + // .flexShrink(0); | ||
| 54 | + // } | ||
| 55 | + if (this.contentDTO.source) { | ||
| 44 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | 56 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) |
| 45 | .fontSize($r("app.float.font_size_11")) | 57 | .fontSize($r("app.float.font_size_11")) |
| 46 | .fontColor($r("app.color.color_B0B0B0")) | 58 | .fontColor($r("app.color.color_B0B0B0")) |
| 47 | - .flexShrink(0) | 59 | + .flexShrink(0); |
| 48 | } | 60 | } |
| 49 | - if (this.getContentDtoBean()?.interactData?.commentNum) { | 61 | + |
| 62 | + if (this.getContentDtoBean()?.interactData?.commentNum && this.contentDTO.source) { | ||
| 50 | Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`) | 63 | Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`) |
| 51 | .fontSize($r("app.float.font_size_11")) | 64 | .fontSize($r("app.float.font_size_11")) |
| 52 | .fontColor($r("app.color.color_B0B0B0")) | 65 | .fontColor($r("app.color.color_B0B0B0")) |
| 53 | .flexShrink(0) | 66 | .flexShrink(0) |
| 54 | .margin({ left: 6 }) | 67 | .margin({ left: 6 }) |
| 55 | - .visibility(Number(this.getContentDtoBean()?.interactData?.commentNum) === 0 ? Visibility.None : Visibility.Visible) | 68 | + .visibility(Number(this.getContentDtoBean()?.interactData?.commentNum) === 0 ? Visibility.None : |
| 69 | + Visibility.Visible) | ||
| 56 | } | 70 | } |
| 57 | } | 71 | } |
| 58 | .width(CommonConstants.FULL_WIDTH) | 72 | .width(CommonConstants.FULL_WIDTH) |
| @@ -67,7 +81,7 @@ export struct CardSourceInfo { | @@ -67,7 +81,7 @@ export struct CardSourceInfo { | ||
| 67 | if (this.compDTO == undefined) { | 81 | if (this.compDTO == undefined) { |
| 68 | return this.contentDTO | 82 | return this.contentDTO |
| 69 | } | 83 | } |
| 70 | - if(this.compDTO.operDataList.length == 0){ | 84 | + if (this.compDTO.operDataList.length == 0) { |
| 71 | return this.contentDTO | 85 | return this.contentDTO |
| 72 | } | 86 | } |
| 73 | return this.compDTO.operDataList[0] | 87 | return this.compDTO.operDataList[0] |
| @@ -62,20 +62,7 @@ export struct Card19Component { | @@ -62,20 +62,7 @@ export struct Card19Component { | ||
| 62 | } | 62 | } |
| 63 | // 图片-从无图到9图展示 | 63 | // 图片-从无图到9图展示 |
| 64 | createImg({ fullColumnImgUrls: this.contentDTO.fullColumnImgUrls }) | 64 | createImg({ fullColumnImgUrls: this.contentDTO.fullColumnImgUrls }) |
| 65 | - .onClick(() => { | ||
| 66 | - const photoList: PhotoListBean[] = this.contentDTO.fullColumnImgUrls.map(item => { | ||
| 67 | - const photo: PhotoListBean = { | ||
| 68 | - width: item.weight, | ||
| 69 | - height: item.height, | ||
| 70 | - picPath: item.fullUrl||item.url, | ||
| 71 | - picDesc: '', | ||
| 72 | - itemType:2, | ||
| 73 | - id:0 | ||
| 74 | - } | ||
| 75 | - return photo | ||
| 76 | - }) | ||
| 77 | - ProcessUtils.gotoMultiPictureListPage(photoList, 0) | ||
| 78 | - }) | 65 | + |
| 79 | CarderInteraction({ contentDTO: this.contentDTO }) | 66 | CarderInteraction({ contentDTO: this.contentDTO }) |
| 80 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 67 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 81 | } | 68 | } |
| @@ -107,12 +94,12 @@ struct createImg { | @@ -107,12 +94,12 @@ struct createImg { | ||
| 107 | @State loadImg: boolean = false; | 94 | @State loadImg: boolean = false; |
| 108 | 95 | ||
| 109 | async aboutToAppear(): Promise<void> { | 96 | async aboutToAppear(): Promise<void> { |
| 110 | - this.loadImg = await onlyWifiLoadImg(); | ||
| 111 | if (this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 | 97 | if (this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 |
| 112 | this.fullColumnImgUrls.splice(2, 0, { | 98 | this.fullColumnImgUrls.splice(2, 0, { |
| 113 | fullUrl: '' | 99 | fullUrl: '' |
| 114 | } as FullColumnImgUrlDTO) | 100 | } as FullColumnImgUrlDTO) |
| 115 | } | 101 | } |
| 102 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 116 | console.log('card19-this.fullColumnImgUrls',JSON.stringify(this.fullColumnImgUrls)) | 103 | console.log('card19-this.fullColumnImgUrls',JSON.stringify(this.fullColumnImgUrls)) |
| 117 | } | 104 | } |
| 118 | 105 | ||
| @@ -167,14 +154,14 @@ struct createImg { | @@ -167,14 +154,14 @@ struct createImg { | ||
| 167 | alignContent: Alignment.BottomEnd | 154 | alignContent: Alignment.BottomEnd |
| 168 | }) { | 155 | }) { |
| 169 | if (this.getPicType() === 1) { | 156 | if (this.getPicType() === 1) { |
| 170 | - Image(this.loadImg ? item.fullUrl||item.url : '') | 157 | + Image(this.loadImg ? item.fullUrl || item.url : '') |
| 171 | .backgroundColor(0xf5f5f5) | 158 | .backgroundColor(0xf5f5f5) |
| 172 | .width('100%') | 159 | .width('100%') |
| 173 | .height(172) | 160 | .height(172) |
| 174 | .autoResize(true) | 161 | .autoResize(true) |
| 175 | .borderRadius(this.caclImageRadius(index)) | 162 | .borderRadius(this.caclImageRadius(index)) |
| 176 | } else if (this.getPicType() === 2) { | 163 | } else if (this.getPicType() === 2) { |
| 177 | - Image(this.loadImg ? item.fullUrl||item.url : '') | 164 | + Image(this.loadImg ? item.fullUrl || item.url : '') |
| 178 | .width('100%') | 165 | .width('100%') |
| 179 | .height(305) | 166 | .height(305) |
| 180 | .autoResize(true) | 167 | .autoResize(true) |
| @@ -291,6 +278,20 @@ struct createImg { | @@ -291,6 +278,20 @@ struct createImg { | ||
| 291 | .padding({ bottom: 3 }) | 278 | .padding({ bottom: 3 }) |
| 292 | } | 279 | } |
| 293 | } | 280 | } |
| 281 | + .onClick(() => { | ||
| 282 | + const photoList: PhotoListBean[] = this.fullColumnImgUrls.map(item => { | ||
| 283 | + const photo: PhotoListBean = { | ||
| 284 | + width: item.weight, | ||
| 285 | + height: item.height, | ||
| 286 | + picPath: item.fullUrl||item.url, | ||
| 287 | + picDesc: '', | ||
| 288 | + itemType:2, | ||
| 289 | + id:0 | ||
| 290 | + } | ||
| 291 | + return photo | ||
| 292 | + }) | ||
| 293 | + ProcessUtils.gotoMultiPictureListPage(photoList, index) | ||
| 294 | + }) | ||
| 294 | } | 295 | } |
| 295 | } | 296 | } |
| 296 | }) | 297 | }) |
| @@ -87,12 +87,12 @@ export struct Card5Component { | @@ -87,12 +87,12 @@ export struct Card5Component { | ||
| 87 | } | 87 | } |
| 88 | .alignContent(Alignment.Bottom) | 88 | .alignContent(Alignment.Bottom) |
| 89 | .width(CommonConstants.FULL_WIDTH) | 89 | .width(CommonConstants.FULL_WIDTH) |
| 90 | - // .padding({ | ||
| 91 | - // left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 92 | - // right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 93 | - // top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 94 | - // bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 95 | - // }) | 90 | + .padding({ |
| 91 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 92 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 93 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 94 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 95 | + }) | ||
| 96 | .onClick((event: ClickEvent) => { | 96 | .onClick((event: ClickEvent) => { |
| 97 | this.clicked = true; | 97 | this.clicked = true; |
| 98 | ProcessUtils.processPage(this.contentDTO) | 98 | ProcessUtils.processPage(this.contentDTO) |
| @@ -54,9 +54,9 @@ export struct Card6Component { | @@ -54,9 +54,9 @@ export struct Card6Component { | ||
| 54 | // } | 54 | // } |
| 55 | Stack() { | 55 | Stack() { |
| 56 | if (this.contentDTO.newTags) { | 56 | if (this.contentDTO.newTags) { |
| 57 | - Notes({ newTags: this.contentDTO.newTags }) | 57 | + Notes({ newTags: this.contentDTO.newTags }).height(27).align(Alignment.Center) |
| 58 | } else if (this.contentDTO.objectType == '5') { | 58 | } else if (this.contentDTO.objectType == '5') { |
| 59 | - Notes({ objectType: this.contentDTO.objectType }) | 59 | + Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center) |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | Text() { | 62 | Text() { |
| @@ -114,7 +114,7 @@ export struct Card6Component { | @@ -114,7 +114,7 @@ export struct Card6Component { | ||
| 114 | bottom: $r('app.float.card_comp_pagePadding_tb') | 114 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 115 | }) | 115 | }) |
| 116 | .width(CommonConstants.FULL_WIDTH) | 116 | .width(CommonConstants.FULL_WIDTH) |
| 117 | - .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 107 : 217) | 117 | + // .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 107 : 217) |
| 118 | .justifyContent(FlexAlign.SpaceBetween) | 118 | .justifyContent(FlexAlign.SpaceBetween) |
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| @@ -13,7 +13,7 @@ const TAG: string = 'Card9Component'; | @@ -13,7 +13,7 @@ const TAG: string = 'Card9Component'; | ||
| 13 | @Component | 13 | @Component |
| 14 | export struct Card9Component { | 14 | export struct Card9Component { |
| 15 | @State contentDTO: ContentDTO = new ContentDTO(); | 15 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 16 | - @State loadImg: boolean = true; | 16 | + // @State loadImg: boolean = true; |
| 17 | @State clicked: boolean = false; | 17 | @State clicked: boolean = false; |
| 18 | @State titleMarked: boolean = false; | 18 | @State titleMarked: boolean = false; |
| 19 | @State str01: string = ''; | 19 | @State str01: string = ''; |
| @@ -54,10 +54,11 @@ export struct Card9Component { | @@ -54,10 +54,11 @@ export struct Card9Component { | ||
| 54 | .maxLines(2) | 54 | .maxLines(2) |
| 55 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 55 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 56 | .margin({ top: 10, bottom: 10 }) | 56 | .margin({ top: 10, bottom: 10 }) |
| 57 | + .fontWeight(400) | ||
| 57 | } | 58 | } |
| 58 | // 大图 | 59 | // 大图 |
| 59 | Stack() { | 60 | Stack() { |
| 60 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 61 | + Image(this.contentDTO.coverUrl) |
| 61 | .backgroundColor(0xf5f5f5) | 62 | .backgroundColor(0xf5f5f5) |
| 62 | .width('100%') | 63 | .width('100%') |
| 63 | .height(133) | 64 | .height(133) |
| @@ -21,8 +21,9 @@ export struct Notes { | @@ -21,8 +21,9 @@ export struct Notes { | ||
| 21 | bottom: 3 | 21 | bottom: 3 |
| 22 | }) | 22 | }) |
| 23 | .linearGradient({ angle: 90, colors: [['#FFFF2B00', 0.0], ['#FFFE6A00', 1.0]] }) | 23 | .linearGradient({ angle: 90, colors: [['#FFFF2B00', 0.0], ['#FFFE6A00', 1.0]] }) |
| 24 | - .fontColor(Color.White) | ||
| 25 | - .borderRadius($r('app.float.button_border_radius')) | 24 | + .fontColor(Color.White)// .borderRadius($r('app.float.button_border_radius')) |
| 25 | + .borderRadius(2) | ||
| 26 | + .margin({ top: 1 }) | ||
| 26 | } | 27 | } |
| 27 | } | 28 | } |
| 28 | 29 |
| @@ -17,10 +17,10 @@ export struct ZhSingleRow04 { | @@ -17,10 +17,10 @@ export struct ZhSingleRow04 { | ||
| 17 | //顶部 | 17 | //顶部 |
| 18 | Row() { | 18 | Row() { |
| 19 | Row() { | 19 | Row() { |
| 20 | - Image($r("app.media.local_selection")) | ||
| 21 | - .width(24) | ||
| 22 | - .height(24) | ||
| 23 | - .margin({ right: 4 }) | 20 | + // Image($r("app.media.local_selection")) |
| 21 | + // .width(24) | ||
| 22 | + // .height(24) | ||
| 23 | + // .margin({ right: 4 }) | ||
| 24 | Text(this.compDTO.objectTitle) | 24 | Text(this.compDTO.objectTitle) |
| 25 | .fontSize($r("app.float.font_size_17")) | 25 | .fontSize($r("app.float.font_size_17")) |
| 26 | .fontColor($r("app.color.color_222222")) | 26 | .fontColor($r("app.color.color_222222")) |
| @@ -36,7 +36,8 @@ export struct ZhSingleRow04 { | @@ -36,7 +36,8 @@ export struct ZhSingleRow04 { | ||
| 36 | .width(14) | 36 | .width(14) |
| 37 | .height(14) | 37 | .height(14) |
| 38 | } | 38 | } |
| 39 | - .visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible) | 39 | + .visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : |
| 40 | + Visibility.Visible) | ||
| 40 | .onClick(() => { | 41 | .onClick(() => { |
| 41 | if (this.compDTO?.objectType === '11') { | 42 | if (this.compDTO?.objectType === '11') { |
| 42 | ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle) | 43 | ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle) |
| @@ -64,9 +65,11 @@ export struct ZhSingleRow04 { | @@ -64,9 +65,11 @@ export struct ZhSingleRow04 { | ||
| 64 | operDataListItem: item | 65 | operDataListItem: item |
| 65 | } | 66 | } |
| 66 | ) | 67 | ) |
| 67 | - .margin({right: index === this.compDTO.operDataList.length - 1 ? 26 : 0, left: | ||
| 68 | - index === 0 ? $r('app.float.card_comp_pagePadding_lf') : 0, | ||
| 69 | - top: 6}) | 68 | + .margin({ |
| 69 | + right: index === this.compDTO.operDataList.length - 1 ? 26 : 0, left: | ||
| 70 | + index === 0 ? $r('app.float.card_comp_pagePadding_lf') : 0, | ||
| 71 | + top: 6 | ||
| 72 | + }) | ||
| 70 | .onClick(() => { | 73 | .onClick(() => { |
| 71 | ProcessUtils.processPage(item) | 74 | ProcessUtils.processPage(item) |
| 72 | }) | 75 | }) |
| @@ -106,8 +109,7 @@ struct localCard { | @@ -106,8 +109,7 @@ struct localCard { | ||
| 106 | .align(Alignment.TopStart) | 109 | .align(Alignment.TopStart) |
| 107 | .maxLines(3) | 110 | .maxLines(3) |
| 108 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 111 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 109 | - .lineHeight(20) | ||
| 110 | - .margin({bottom: 17}) | 112 | + .lineHeight(25) |
| 111 | .fontWeight(500) | 113 | .fontWeight(500) |
| 112 | Row() { | 114 | Row() { |
| 113 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.operDataListItem.publishTime))) | 115 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.operDataListItem.publishTime))) |
| @@ -115,7 +117,7 @@ struct localCard { | @@ -115,7 +117,7 @@ struct localCard { | ||
| 115 | .fontColor($r("app.color.color_B0B0B0")) | 117 | .fontColor($r("app.color.color_B0B0B0")) |
| 116 | .margin({ right: 5 }) | 118 | .margin({ right: 5 }) |
| 117 | // 这里需要外部查询评论接口后,写入字段 | 119 | // 这里需要外部查询评论接口后,写入字段 |
| 118 | - if(this.operDataListItem.interactData?.commentNum) { | 120 | + if (this.operDataListItem.interactData?.commentNum) { |
| 119 | Text(`${this.operDataListItem.interactData?.commentNum}评`) | 121 | Text(`${this.operDataListItem.interactData?.commentNum}评`) |
| 120 | .fontSize(12) | 122 | .fontSize(12) |
| 121 | } | 123 | } |
| @@ -139,7 +141,12 @@ struct localCard { | @@ -139,7 +141,12 @@ struct localCard { | ||
| 139 | .border({ | 141 | .border({ |
| 140 | radius: 2, | 142 | radius: 2, |
| 141 | }) | 143 | }) |
| 142 | - .shadow({ radius: 6, color: '#1A000000', offsetX: 3, offsetY: 0 }) | 144 | + .shadow({ |
| 145 | + radius: 6, | ||
| 146 | + color: '#1A000000', | ||
| 147 | + offsetX: 0, | ||
| 148 | + offsetY: 3 | ||
| 149 | + }) // 设置下方阴影 | ||
| 143 | .margin({ | 150 | .margin({ |
| 144 | right: 10 | 151 | right: 10 |
| 145 | }) | 152 | }) |
| @@ -30,6 +30,7 @@ export struct ZhSingleRow06 { | @@ -30,6 +30,7 @@ export struct ZhSingleRow06 { | ||
| 30 | this.loadImg = await onlyWifiLoadImg(); | 30 | this.loadImg = await onlyWifiLoadImg(); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | + | ||
| 33 | /** | 34 | /** |
| 34 | * 点赞、取消点赞 | 35 | * 点赞、取消点赞 |
| 35 | */ | 36 | */ |
| @@ -43,7 +44,7 @@ export struct ZhSingleRow06 { | @@ -43,7 +44,7 @@ export struct ZhSingleRow06 { | ||
| 43 | 44 | ||
| 44 | const commentInfo = this.compDTO.operDataList[0]?.commentInfo as commentInfo; | 45 | const commentInfo = this.compDTO.operDataList[0]?.commentInfo as commentInfo; |
| 45 | // commentLikeChange(this.item) | 46 | // commentLikeChange(this.item) |
| 46 | - this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1'; | 47 | + // this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1'; |
| 47 | const commentLikeParam = { | 48 | const commentLikeParam = { |
| 48 | targetId: commentInfo.newsId || '', | 49 | targetId: commentInfo.newsId || '', |
| 49 | id: commentInfo.commentId, | 50 | id: commentInfo.commentId, |
| @@ -51,8 +52,9 @@ export struct ZhSingleRow06 { | @@ -51,8 +52,9 @@ export struct ZhSingleRow06 { | ||
| 51 | api_status: this.newsStatusOfUser?.likeStatus == '1' ? false : true | 52 | api_status: this.newsStatusOfUser?.likeStatus == '1' ? false : true |
| 52 | } as commentItemModel; | 53 | } as commentItemModel; |
| 53 | commentViewModel.commentLike(commentLikeParam).then(() => { | 54 | commentViewModel.commentLike(commentLikeParam).then(() => { |
| 54 | - }).catch(() => { | ||
| 55 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1'; | 55 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1'; |
| 56 | + }).catch((err: Error) => { | ||
| 57 | + console.log('06-err', JSON.stringify(err)) | ||
| 56 | }) | 58 | }) |
| 57 | } | 59 | } |
| 58 | 60 | ||
| @@ -168,7 +170,7 @@ export struct ZhSingleRow06 { | @@ -168,7 +170,7 @@ export struct ZhSingleRow06 { | ||
| 168 | ? item.operDataList[0]?.commentInfo?.userHeaderUrl | 170 | ? item.operDataList[0]?.commentInfo?.userHeaderUrl |
| 169 | ? item.operDataList[0].commentInfo.userHeaderUrl | 171 | ? item.operDataList[0].commentInfo.userHeaderUrl |
| 170 | : $r('app.media.default_head') | 172 | : $r('app.media.default_head') |
| 171 | - : $r('app.media.comment_rmh_tag')) | 173 | + : $r('app.media.icon_default_head_mater')) |
| 172 | .width(32) | 174 | .width(32) |
| 173 | .height(32) | 175 | .height(32) |
| 174 | .borderRadius(16) | 176 | .borderRadius(16) |
| @@ -34,7 +34,7 @@ export struct ChildCommentComponent { | @@ -34,7 +34,7 @@ export struct ChildCommentComponent { | ||
| 34 | .borderRadius(50) | 34 | .borderRadius(50) |
| 35 | }.width('89lpx') | 35 | }.width('89lpx') |
| 36 | .height('89lpx') | 36 | .height('89lpx') |
| 37 | - .margin({ right: '15lpx' }) | 37 | + .margin({ right: '3lpx' }) |
| 38 | 38 | ||
| 39 | Column() { | 39 | Column() { |
| 40 | Text(this.data.fromUserName) | 40 | Text(this.data.fromUserName) |
| @@ -8,11 +8,16 @@ import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | @@ -8,11 +8,16 @@ import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | ||
| 8 | import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; | 8 | import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; |
| 9 | import { EmptyComponent } from '../view/EmptyComponent'; | 9 | import { EmptyComponent } from '../view/EmptyComponent'; |
| 10 | import { ErrorComponent } from '../view/ErrorComponent'; | 10 | import { ErrorComponent } from '../view/ErrorComponent'; |
| 11 | -import LoadMoreLayout from '../page/LoadMoreLayout' | ||
| 12 | -import { LottieView } from '../../components/lottie/LottieView' | 11 | +import LoadMoreLayout from '../page/LoadMoreLayout'; |
| 12 | +import { LottieView } from '../../components/lottie/LottieView'; | ||
| 13 | +import dataPreferences from '@ohos.data.preferences'; | ||
| 14 | +import { BusinessError } from '@ohos.base'; | ||
| 13 | 15 | ||
| 14 | const TAG: string = 'LiveMorePage'; | 16 | const TAG: string = 'LiveMorePage'; |
| 15 | 17 | ||
| 18 | +const PREFERENCES_NAME = 'rmrLiveMorePage.db' | ||
| 19 | +let preferenceTheme: dataPreferences.Preferences | null = null | ||
| 20 | + | ||
| 16 | /** | 21 | /** |
| 17 | * 直播更多: | 22 | * 直播更多: |
| 18 | * type=1 直播 | 23 | * type=1 直播 |
| @@ -37,7 +42,13 @@ struct LiveMorePage { | @@ -37,7 +42,13 @@ struct LiveMorePage { | ||
| 37 | @State viewType: ViewType = ViewType.LOADING | 42 | @State viewType: ViewType = ViewType.LOADING |
| 38 | private scroller: Scroller = new Scroller() | 43 | private scroller: Scroller = new Scroller() |
| 39 | @State liveRoomList: LiveRoomDataBean[] = [] | 44 | @State liveRoomList: LiveRoomDataBean[] = [] |
| 40 | - aboutToAppear(): void { | 45 | + // 点击过的数据 |
| 46 | + @State clickDatas: Array<string> = [] | ||
| 47 | + | ||
| 48 | + async aboutToAppear() { | ||
| 49 | + await this.getPreferencesFromStorage() | ||
| 50 | + this.getLivMoreClickPreference() | ||
| 51 | + Logger.debug(TAG, '数据:' + JSON.stringify(this.clickDatas)) | ||
| 41 | this.currentPage = 1 | 52 | this.currentPage = 1 |
| 42 | this.getData() | 53 | this.getData() |
| 43 | } | 54 | } |
| @@ -93,10 +104,9 @@ struct LiveMorePage { | @@ -93,10 +104,9 @@ struct LiveMorePage { | ||
| 93 | LoadingLayout() { | 104 | LoadingLayout() { |
| 94 | } | 105 | } |
| 95 | 106 | ||
| 96 | - | ||
| 97 | @Builder | 107 | @Builder |
| 98 | ListLayout() { | 108 | ListLayout() { |
| 99 | - List({scroller: this.scroller}) { | 109 | + List({ scroller: this.scroller }) { |
| 100 | // 下拉刷新 | 110 | // 下拉刷新 |
| 101 | LazyForEach(this.data, (contentDTO: ContentDTO) => { | 111 | LazyForEach(this.data, (contentDTO: ContentDTO) => { |
| 102 | ListItem() { | 112 | ListItem() { |
| @@ -120,7 +130,7 @@ struct LiveMorePage { | @@ -120,7 +130,7 @@ struct LiveMorePage { | ||
| 120 | .height('calc(100% - 44vp)') | 130 | .height('calc(100% - 44vp)') |
| 121 | .onReachEnd(() => { | 131 | .onReachEnd(() => { |
| 122 | Logger.debug(TAG, "触底了"); | 132 | Logger.debug(TAG, "触底了"); |
| 123 | - if(!this.isLoading && this.hasMore){ | 133 | + if (!this.isLoading && this.hasMore) { |
| 124 | //加载分页数据 | 134 | //加载分页数据 |
| 125 | this.currentPage++; | 135 | this.currentPage++; |
| 126 | this.getData() | 136 | this.getData() |
| @@ -137,11 +147,12 @@ struct LiveMorePage { | @@ -137,11 +147,12 @@ struct LiveMorePage { | ||
| 137 | buildItem(item: ContentDTO) { | 147 | buildItem(item: ContentDTO) { |
| 138 | Column() { | 148 | Column() { |
| 139 | Text(item.newsTitle) | 149 | Text(item.newsTitle) |
| 140 | - .fontSize(17) | 150 | + .fontSize(18) |
| 141 | .maxLines(2) | 151 | .maxLines(2) |
| 142 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 152 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 143 | .margin({ top: 16, bottom: 8 }) | 153 | .margin({ top: 16, bottom: 8 }) |
| 144 | .alignSelf(ItemAlign.Start) | 154 | .alignSelf(ItemAlign.Start) |
| 155 | + .fontColor(this.isClicked(item.objectId) ? $r('app.color.color_848484') : $r('app.color.color_222222')) | ||
| 145 | Stack() { | 156 | Stack() { |
| 146 | if (item.fullColumnImgUrls && item.fullColumnImgUrls.length > 0) { | 157 | if (item.fullColumnImgUrls && item.fullColumnImgUrls.length > 0) { |
| 147 | Image(item.fullColumnImgUrls[0].url) | 158 | Image(item.fullColumnImgUrls[0].url) |
| @@ -191,6 +202,7 @@ struct LiveMorePage { | @@ -191,6 +202,7 @@ struct LiveMorePage { | ||
| 191 | } | 202 | } |
| 192 | .width('100%') | 203 | .width('100%') |
| 193 | .onClick(() => { | 204 | .onClick(() => { |
| 205 | + this.clickRowBuildItem(item) | ||
| 194 | ProcessUtils.processPage(item) | 206 | ProcessUtils.processPage(item) |
| 195 | }) | 207 | }) |
| 196 | } | 208 | } |
| @@ -292,14 +304,14 @@ struct LiveMorePage { | @@ -292,14 +304,14 @@ struct LiveMorePage { | ||
| 292 | } | 304 | } |
| 293 | this.data.push(...liveReviewDTO.list) | 305 | this.data.push(...liveReviewDTO.list) |
| 294 | this.getLiveRoomDataInfo(liveReviewDTO.list) | 306 | this.getLiveRoomDataInfo(liveReviewDTO.list) |
| 295 | - } else { | 307 | + } else { |
| 296 | this.hasMore = false; | 308 | this.hasMore = false; |
| 297 | } | 309 | } |
| 298 | this.resolveEnd(true, resolve) | 310 | this.resolveEnd(true, resolve) |
| 299 | if (liveReviewDTO.list.length == 0 && this.currentPage == 1) { | 311 | if (liveReviewDTO.list.length == 0 && this.currentPage == 1) { |
| 300 | this.viewType = ViewType.EMPTY | 312 | this.viewType = ViewType.EMPTY |
| 301 | } | 313 | } |
| 302 | - }catch (exception) { | 314 | + } catch (exception) { |
| 303 | this.resolveEnd(false, resolve) | 315 | this.resolveEnd(false, resolve) |
| 304 | } | 316 | } |
| 305 | // PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => { | 317 | // PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => { |
| @@ -315,7 +327,7 @@ struct LiveMorePage { | @@ -315,7 +327,7 @@ struct LiveMorePage { | ||
| 315 | if (resolve) { | 327 | if (resolve) { |
| 316 | if (this.currentPage == 1 && isTop) { | 328 | if (this.currentPage == 1 && isTop) { |
| 317 | resolve('已更新至最新') | 329 | resolve('已更新至最新') |
| 318 | - }else { | 330 | + } else { |
| 319 | resolve('') | 331 | resolve('') |
| 320 | } | 332 | } |
| 321 | } | 333 | } |
| @@ -334,23 +346,24 @@ struct LiveMorePage { | @@ -334,23 +346,24 @@ struct LiveMorePage { | ||
| 334 | }); | 346 | }); |
| 335 | return idList.join(',') | 347 | return idList.join(',') |
| 336 | } | 348 | } |
| 349 | + | ||
| 337 | // 获取评论数 | 350 | // 获取评论数 |
| 338 | async getLiveRoomDataInfo(list: ContentDTO[]) { | 351 | async getLiveRoomDataInfo(list: ContentDTO[]) { |
| 339 | const reserveIds = this.getLiveDetailIds(list) | 352 | const reserveIds = this.getLiveDetailIds(list) |
| 340 | - Logger.debug(TAG,'是否预约数据:' +` ${reserveIds}`) | 353 | + Logger.debug(TAG, '是否预约数据:' + ` ${reserveIds}`) |
| 341 | PageViewModel.getLiveRoomBatchInfo(reserveIds).then((result) => { | 354 | PageViewModel.getLiveRoomBatchInfo(reserveIds).then((result) => { |
| 342 | - Logger.debug(TAG,'是否预约数据:' +` ${JSON.stringify(result)}`) | 355 | + Logger.debug(TAG, '是否预约数据:' + ` ${JSON.stringify(result)}`) |
| 343 | if (result && result.length > 0) { | 356 | if (result && result.length > 0) { |
| 344 | this.liveRoomList.push(...result) | 357 | this.liveRoomList.push(...result) |
| 345 | this.data.reloadData() | 358 | this.data.reloadData() |
| 346 | } | 359 | } |
| 347 | - }).catch(() =>{ | 360 | + }).catch(() => { |
| 348 | // this.data.push(...list) | 361 | // this.data.push(...list) |
| 349 | }) | 362 | }) |
| 350 | } | 363 | } |
| 351 | 364 | ||
| 352 | // 判断是否预约 | 365 | // 判断是否预约 |
| 353 | - getLiveRoomNumber(item: ContentDTO): string { | 366 | + getLiveRoomNumber(item: ContentDTO): string { |
| 354 | const objc = this.liveRoomList.find((element: LiveRoomDataBean) => { | 367 | const objc = this.liveRoomList.find((element: LiveRoomDataBean) => { |
| 355 | return element.liveId.toString() == item.objectId | 368 | return element.liveId.toString() == item.objectId |
| 356 | }) | 369 | }) |
| @@ -362,14 +375,64 @@ struct LiveMorePage { | @@ -362,14 +375,64 @@ struct LiveMorePage { | ||
| 362 | 375 | ||
| 363 | private computeShowNum(count: number): string { | 376 | private computeShowNum(count: number): string { |
| 364 | if (count >= 10000) { | 377 | if (count >= 10000) { |
| 365 | - let num = ( count / 10000).toFixed(1) | ||
| 366 | - if (Number(num.substring(num.length-1)) == 0) { | ||
| 367 | - num = num.substring(0, num.length-2) | 378 | + let num = (count / 10000).toFixed(1) |
| 379 | + if (Number(num.substring(num.length - 1)) == 0) { | ||
| 380 | + num = num.substring(0, num.length - 2) | ||
| 368 | } | 381 | } |
| 369 | return num + '万人参加' | 382 | return num + '万人参加' |
| 370 | } | 383 | } |
| 371 | return `${count}人参加` | 384 | return `${count}人参加` |
| 372 | } | 385 | } |
| 373 | 386 | ||
| 387 | + isClicked(objectId: string) { | ||
| 388 | + return this.clickDatas.includes(objectId) | ||
| 389 | + } | ||
| 390 | + | ||
| 391 | + clickRowBuildItem(item: ContentDTO) { | ||
| 392 | + if (item.objectId && !this.clickDatas.includes(item.objectId)) { | ||
| 393 | + Logger.debug(TAG, '数据:' + JSON.stringify(this.clickDatas)) | ||
| 394 | + this.clickDatas.push(item.objectId.toString()) | ||
| 395 | + this.putLiveMoreClickPreference() | ||
| 396 | + } | ||
| 397 | + } | ||
| 398 | + | ||
| 399 | + async getPreferencesFromStorage() { | ||
| 400 | + let context = getContext(this) as Context | ||
| 401 | + preferenceTheme = await dataPreferences.getPreferences(context, PREFERENCES_NAME) | ||
| 402 | + } | ||
| 374 | 403 | ||
| 404 | + putLiveMoreClickPreference() { | ||
| 405 | + Logger.info(TAG, `Put begin` + JSON.stringify(this.clickDatas)) | ||
| 406 | + if (preferenceTheme !== null && this.clickDatas.length > 0) { | ||
| 407 | + // await | ||
| 408 | + const arr: Array<string> = [] | ||
| 409 | + arr.push(...this.clickDatas) | ||
| 410 | + preferenceTheme.put('liveMorePage', arr).then(() => { | ||
| 411 | + Logger.debug(TAG,"Succeeded in putting value of 'startup'."); | ||
| 412 | + }).catch((err: BusinessError) => { | ||
| 413 | + Logger.debug(TAG, "Failed to put value of 'startup'. code =" + err.code + ", message =" + err.message); | ||
| 414 | + }) | ||
| 415 | + // await preferenceTheme.flush() | ||
| 416 | + preferenceTheme.flush((err: BusinessError) => { | ||
| 417 | + if (err) { | ||
| 418 | + Logger.debug(TAG, "Failed to flush. code =" + err.code + ", message =" + err.message); | ||
| 419 | + return; | ||
| 420 | + } | ||
| 421 | + }) | ||
| 422 | + | ||
| 423 | + } | ||
| 424 | + } | ||
| 425 | + | ||
| 426 | + getLivMoreClickPreference() { | ||
| 427 | + Logger.info(TAG, `Get begin`) | ||
| 428 | + if (preferenceTheme !== null) { | ||
| 429 | + preferenceTheme.get('liveMorePage', []).then((data: dataPreferences.ValueType) => { | ||
| 430 | + if (data instanceof Array) { | ||
| 431 | + this.clickDatas = data as Array<string> | ||
| 432 | + } | ||
| 433 | + }).catch((err: BusinessError) => { | ||
| 434 | + console.error("Failed to get value of 'startup'. code =" + err.code + ", message =" + err.message); | ||
| 435 | + }) | ||
| 436 | + } | ||
| 437 | + } | ||
| 375 | } | 438 | } |
| @@ -255,7 +255,7 @@ export struct PageComponent { | @@ -255,7 +255,7 @@ export struct PageComponent { | ||
| 255 | this.pageModel.channelId = this.channelId; | 255 | this.pageModel.channelId = this.channelId; |
| 256 | this.pageModel.currentPage = 1; | 256 | this.pageModel.currentPage = 1; |
| 257 | this.pageModel.pageTotalCompSize = 0; | 257 | this.pageModel.pageTotalCompSize = 0; |
| 258 | - // TODO PageHelper.getInitCacheData(this.pageModel, this.pageAdvModel) | 258 | + PageHelper.getInitCacheData(this.pageModel, this.pageAdvModel) |
| 259 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) | 259 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) |
| 260 | }, 100) | 260 | }, 100) |
| 261 | } | 261 | } |
| @@ -74,8 +74,8 @@ export struct PeopleShipRecommendComponent { | @@ -74,8 +74,8 @@ export struct PeopleShipRecommendComponent { | ||
| 74 | } | 74 | } |
| 75 | .columnsTemplate('1fr 1fr 1fr') | 75 | .columnsTemplate('1fr 1fr 1fr') |
| 76 | .columnsGap(20) | 76 | .columnsGap(20) |
| 77 | - .rowsGap(20) | ||
| 78 | - .height(Math.ceil(this.rmhList.length / 3.0) * 136) | 77 | + .rowsGap(16) |
| 78 | + .height(Math.ceil(this.rmhList.length / 3.0) * 132) | ||
| 79 | .backgroundColor(Color.Transparent) | 79 | .backgroundColor(Color.Transparent) |
| 80 | .margin({ | 80 | .margin({ |
| 81 | right: '20vp', | 81 | right: '20vp', |
| @@ -85,7 +85,7 @@ export struct PeopleShipRecommendComponent { | @@ -85,7 +85,7 @@ export struct PeopleShipRecommendComponent { | ||
| 85 | // 为你推荐 | 85 | // 为你推荐 |
| 86 | Button(this.rmhSelectedList.length == 0 ? '一键关注' : `一键关注 (${this.rmhSelectedList.length})`, { type: ButtonType.Normal, stateEffect: this.rmhSelectedList.length != 0 }) | 86 | Button(this.rmhSelectedList.length == 0 ? '一键关注' : `一键关注 (${this.rmhSelectedList.length})`, { type: ButtonType.Normal, stateEffect: this.rmhSelectedList.length != 0 }) |
| 87 | .margin({ | 87 | .margin({ |
| 88 | - top: '24vp', | 88 | + top: '10vp', |
| 89 | bottom: '10vp' | 89 | bottom: '10vp' |
| 90 | }) | 90 | }) |
| 91 | .width('120vp') | 91 | .width('120vp') |
| @@ -104,6 +104,8 @@ export struct PeopleShipRecommendComponent { | @@ -104,6 +104,8 @@ export struct PeopleShipRecommendComponent { | ||
| 104 | }) | 104 | }) |
| 105 | } | 105 | } |
| 106 | .width('100%') | 106 | .width('100%') |
| 107 | + .justifyContent(FlexAlign.Start) | ||
| 108 | + | ||
| 107 | } | 109 | } |
| 108 | 110 | ||
| 109 | // 选中 | 111 | // 选中 |
| @@ -130,7 +130,10 @@ struct ReserveMorePage { | @@ -130,7 +130,10 @@ struct ReserveMorePage { | ||
| 130 | Image(item.fullColumnImgUrls[0]?.url) | 130 | Image(item.fullColumnImgUrls[0]?.url) |
| 131 | .width('100%') | 131 | .width('100%') |
| 132 | .objectFit(ImageFit.Contain) | 132 | .objectFit(ImageFit.Contain) |
| 133 | - .borderRadius(4) | 133 | + .borderRadius({ |
| 134 | + topLeft: '4vp', | ||
| 135 | + topRight: '4vp' | ||
| 136 | + }) | ||
| 134 | this.LiveImage() | 137 | this.LiveImage() |
| 135 | 138 | ||
| 136 | } | 139 | } |
| @@ -110,6 +110,10 @@ export struct SearchComponent { | @@ -110,6 +110,10 @@ export struct SearchComponent { | ||
| 110 | this.searchHistoryData = SearcherAboutDataModel.getSearchHistoryData() | 110 | this.searchHistoryData = SearcherAboutDataModel.getSearchHistoryData() |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | + stopInput(){ | ||
| 114 | + this.controller.stopEditing() | ||
| 115 | + } | ||
| 116 | + | ||
| 113 | build() { | 117 | build() { |
| 114 | Column() { | 118 | Column() { |
| 115 | this.searchInputComponent() | 119 | this.searchInputComponent() |
| @@ -117,7 +121,7 @@ export struct SearchComponent { | @@ -117,7 +121,7 @@ export struct SearchComponent { | ||
| 117 | Scroll(this.scroller) { | 121 | Scroll(this.scroller) { |
| 118 | Column() { | 122 | Column() { |
| 119 | if(this.searchHistoryData!=null && this.searchHistoryData.length>0){ | 123 | if(this.searchHistoryData!=null && this.searchHistoryData.length>0){ |
| 120 | - SearchHistoryComponent({ searchHistoryData: $searchHistoryData, onDelHistory: (): void => this.getSearchHistoryData(),onGetSearchRes: (item,index): void => this.getSearchHistoryResData(item,index) }) | 124 | + SearchHistoryComponent({ searchHistoryData: $searchHistoryData, onDelHistory: (): void => this.getSearchHistoryData(),onGetSearchRes: (item,index): void => this.getSearchHistoryResData(item,index),onCloseInput : (): void => this.stopInput() }) |
| 121 | } | 125 | } |
| 122 | 126 | ||
| 123 | if(this.searchHistoryData.length>0){ | 127 | if(this.searchHistoryData.length>0){ |
| @@ -140,7 +144,13 @@ export struct SearchComponent { | @@ -140,7 +144,13 @@ export struct SearchComponent { | ||
| 140 | } else { | 144 | } else { |
| 141 | if (this.hasChooseSearch) { | 145 | if (this.hasChooseSearch) { |
| 142 | //搜索结果 | 146 | //搜索结果 |
| 143 | - SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest}) | 147 | + SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest,onClickTryAgain: (): void => { |
| 148 | + if(StringUtils.isNotEmpty(this.searchText)){ | ||
| 149 | + SearcherAboutDataModel.putSearchHistoryData(this.searchText) | ||
| 150 | + this.getSearchHistoryData() | ||
| 151 | + this.getSearchInputResData(this.searchText) | ||
| 152 | + } | ||
| 153 | + }}) | ||
| 144 | } else { | 154 | } else { |
| 145 | //联想搜索 | 155 | //联想搜索 |
| 146 | SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText}) | 156 | SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText}) |
| @@ -251,7 +261,6 @@ export struct SearchComponent { | @@ -251,7 +261,6 @@ export struct SearchComponent { | ||
| 251 | .textFont({ size: "27lpx", weight: "400lpx" }) | 261 | .textFont({ size: "27lpx", weight: "400lpx" }) |
| 252 | // .defaultFocus(true) | 262 | // .defaultFocus(true) |
| 253 | .id("searchId") | 263 | .id("searchId") |
| 254 | - .focusable(true) | ||
| 255 | .searchIcon({ | 264 | .searchIcon({ |
| 256 | size:0 | 265 | size:0 |
| 257 | }) | 266 | }) |
| @@ -8,11 +8,14 @@ import { MyCustomDialog } from '../reusable/MyCustomDialog' | @@ -8,11 +8,14 @@ import { MyCustomDialog } from '../reusable/MyCustomDialog' | ||
| 8 | @Component | 8 | @Component |
| 9 | export struct SearchHistoryComponent{ | 9 | export struct SearchHistoryComponent{ |
| 10 | @Link searchHistoryData:SearchHistoryItem[] | 10 | @Link searchHistoryData:SearchHistoryItem[] |
| 11 | + onCloseInput?: () => void; | ||
| 11 | onDelHistory?: () => void; | 12 | onDelHistory?: () => void; |
| 12 | onGetSearchRes?: (item:string,index:number) => void; | 13 | onGetSearchRes?: (item:string,index:number) => void; |
| 13 | dialogController: CustomDialogController = new CustomDialogController({ | 14 | dialogController: CustomDialogController = new CustomDialogController({ |
| 14 | builder: MyCustomDialog({ | 15 | builder: MyCustomDialog({ |
| 15 | - cancel: this.onCancel, | 16 | + cancel: () => { |
| 17 | + this.onCancel() | ||
| 18 | + }, | ||
| 16 | confirm: () => { | 19 | confirm: () => { |
| 17 | this.onAccept() | 20 | this.onAccept() |
| 18 | }, | 21 | }, |
| @@ -33,6 +36,9 @@ export struct SearchHistoryComponent{ | @@ -33,6 +36,9 @@ export struct SearchHistoryComponent{ | ||
| 33 | } | 36 | } |
| 34 | 37 | ||
| 35 | onCancel() { | 38 | onCancel() { |
| 39 | + if (this.onCloseInput !== undefined) { | ||
| 40 | + this.onCloseInput() | ||
| 41 | + } | ||
| 36 | console.info('Callback when the first button is clicked') | 42 | console.info('Callback when the first button is clicked') |
| 37 | } | 43 | } |
| 38 | 44 |
| 1 | import { CompDTO, ContentDTO } from 'wdBean/Index' | 1 | import { CompDTO, ContentDTO } from 'wdBean/Index' |
| 2 | -import { LazyDataSource, UserDataLocal } from 'wdKit/Index' | 2 | +import { LazyDataSource, NetworkUtil, UserDataLocal } from 'wdKit/Index' |
| 3 | import { HttpUtils } from 'wdNetwork/Index' | 3 | import { HttpUtils } from 'wdNetwork/Index' |
| 4 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 4 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| 5 | import { SearchSuggestRequestItem } from '../../viewmodel/SearchSuggestRequestItem' | 5 | import { SearchSuggestRequestItem } from '../../viewmodel/SearchSuggestRequestItem' |
| @@ -26,6 +26,8 @@ export struct SearchResultComponent { | @@ -26,6 +26,8 @@ export struct SearchResultComponent { | ||
| 26 | @State suggest_count: number = 0; | 26 | @State suggest_count: number = 0; |
| 27 | @State isLoading: boolean = false | 27 | @State isLoading: boolean = false |
| 28 | scroller: Scroller = new Scroller() | 28 | scroller: Scroller = new Scroller() |
| 29 | + onClickTryAgain?: () => void; | ||
| 30 | + @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | ||
| 29 | 31 | ||
| 30 | aboutToAppear(): void { | 32 | aboutToAppear(): void { |
| 31 | if (this.count.length === 0 && this.isGetRequest == true) { | 33 | if (this.count.length === 0 && this.isGetRequest == true) { |
| @@ -67,9 +69,22 @@ export struct SearchResultComponent { | @@ -67,9 +69,22 @@ export struct SearchResultComponent { | ||
| 67 | List() { | 69 | List() { |
| 68 | ListItem() { | 70 | ListItem() { |
| 69 | //缺省图 | 71 | //缺省图 |
| 70 | - EmptyComponent({emptyType:4}) | ||
| 71 | - .height('612lpx') | ||
| 72 | - .width('100%') | 72 | + if(this.isConnectNetwork){ |
| 73 | + EmptyComponent({emptyType:4}) | ||
| 74 | + .height('612lpx') | ||
| 75 | + .width('100%') | ||
| 76 | + }else{ | ||
| 77 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 78 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 79 | + if(this.isConnectNetwork){ | ||
| 80 | + if (this.onClickTryAgain !== undefined) { | ||
| 81 | + this.onClickTryAgain() | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + }}) | ||
| 85 | + .height("100%") | ||
| 86 | + .width('100%') | ||
| 87 | + } | ||
| 73 | } | 88 | } |
| 74 | if(this.suggest_count > 0){ | 89 | if(this.suggest_count > 0){ |
| 75 | ListItem() { | 90 | ListItem() { |
| @@ -46,11 +46,11 @@ const TAG = 'OperRowListView'; | @@ -46,11 +46,11 @@ const TAG = 'OperRowListView'; | ||
| 46 | @Preview | 46 | @Preview |
| 47 | @Component | 47 | @Component |
| 48 | export struct OperRowListView { | 48 | export struct OperRowListView { |
| 49 | - private onBack = () => { | 49 | + private onBack: () => void = () => { |
| 50 | } | 50 | } |
| 51 | - private onCommentFocus = () => { | 51 | + private onCommentFocus: () => void = () => { |
| 52 | } | 52 | } |
| 53 | - private onCommentIconClick = () => { | 53 | + private onCommentIconClick: () => void = () => { |
| 54 | } | 54 | } |
| 55 | @Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情 | 55 | @Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情 |
| 56 | /** | 56 | /** |
| @@ -136,11 +136,12 @@ export struct OperRowListView { | @@ -136,11 +136,12 @@ export struct OperRowListView { | ||
| 136 | 136 | ||
| 137 | build() { | 137 | build() { |
| 138 | // 视频详情页 | 138 | // 视频详情页 |
| 139 | + | ||
| 139 | Column() { | 140 | Column() { |
| 140 | Image($r('app.media.ic_news_detail_division')) | 141 | Image($r('app.media.ic_news_detail_division')) |
| 141 | .width('100%') | 142 | .width('100%') |
| 142 | .height($r('app.float.margin_1')) | 143 | .height($r('app.float.margin_1')) |
| 143 | - .margin({ bottom: -2 }) | 144 | + // .margin({bottom: -2}) |
| 144 | 145 | ||
| 145 | Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { | 146 | Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { |
| 146 | // AudioDialog() | 147 | // AudioDialog() |
| 1 | import { RMCalendar } from '../components/calendar/RMCalendar' | 1 | import { RMCalendar } from '../components/calendar/RMCalendar' |
| 2 | import { RMCalendarBean } from '../components/calendar/RMCalendarBean' | 2 | import { RMCalendarBean } from '../components/calendar/RMCalendarBean' |
| 3 | +import { ToastUtils, NetworkUtil } from 'wdKit/Index'; | ||
| 3 | 4 | ||
| 4 | @CustomDialog | 5 | @CustomDialog |
| 5 | export struct ENewspaperCalendarDialog { | 6 | export struct ENewspaperCalendarDialog { |
| @@ -26,4 +27,9 @@ export struct ENewspaperCalendarDialog { | @@ -26,4 +27,9 @@ export struct ENewspaperCalendarDialog { | ||
| 26 | } | 27 | } |
| 27 | }) | 28 | }) |
| 28 | } | 29 | } |
| 30 | + aboutToAppear(): void { | ||
| 31 | + if (!NetworkUtil.isNetConnected()) { | ||
| 32 | + ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | ||
| 33 | + } | ||
| 34 | + } | ||
| 29 | } | 35 | } |
| 1 | import router from '@ohos.router' | 1 | import router from '@ohos.router' |
| 2 | -import { StringUtils } from 'wdKit'; | 2 | +import { NetworkUtil, StringUtils } from 'wdKit'; |
| 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 4 | import { editModelParams } from '../model/EditInfoModel'; | 4 | import { editModelParams } from '../model/EditInfoModel'; |
| 5 | import { HomePageBottomCommentComponent } from '../components/mine/home/HomePageBottomCommentComponent'; | 5 | import { HomePageBottomCommentComponent } from '../components/mine/home/HomePageBottomCommentComponent'; |
| 6 | import { HomePageBottomFollowComponent } from '../components/mine/home/HomePageBottomFollowComponent'; | 6 | import { HomePageBottomFollowComponent } from '../components/mine/home/HomePageBottomFollowComponent'; |
| 7 | import MinePageDatasModel from '../model/MinePageDatasModel'; | 7 | import MinePageDatasModel from '../model/MinePageDatasModel'; |
| 8 | +import { EmptyComponent } from '../components/view/EmptyComponent'; | ||
| 9 | +import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; | ||
| 8 | 10 | ||
| 9 | const TAG = "MineHomePage" | 11 | const TAG = "MineHomePage" |
| 10 | 12 | ||
| @@ -33,6 +35,7 @@ struct MineHomePage { | @@ -33,6 +35,7 @@ struct MineHomePage { | ||
| 33 | scroller: Scroller = new Scroller(); | 35 | scroller: Scroller = new Scroller(); |
| 34 | @State params:Record<string, string> = router.getParams() as Record<string, string>; | 36 | @State params:Record<string, string> = router.getParams() as Record<string, string>; |
| 35 | @State isCommentEnter:string = ""; | 37 | @State isCommentEnter:string = ""; |
| 38 | + @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | ||
| 36 | 39 | ||
| 37 | onPageShow(): void { | 40 | onPageShow(): void { |
| 38 | this.getUserInfo() | 41 | this.getUserInfo() |
| @@ -47,216 +50,235 @@ struct MineHomePage { | @@ -47,216 +50,235 @@ struct MineHomePage { | ||
| 47 | } | 50 | } |
| 48 | 51 | ||
| 49 | build() { | 52 | build() { |
| 50 | - Stack({ alignContent: Alignment.Top }){ | ||
| 51 | - Image($r('app.media.title_bg')) | ||
| 52 | - .width('100%') | ||
| 53 | - .height('355lpx') | ||
| 54 | - .objectFit(ImageFit.Cover) | 53 | + if(this.isConnectNetwork){ |
| 54 | + Stack({ alignContent: Alignment.Top }){ | ||
| 55 | + Image($r('app.media.title_bg')) | ||
| 56 | + .width('100%') | ||
| 57 | + .height('355lpx') | ||
| 58 | + .objectFit(ImageFit.Cover) | ||
| 59 | + | ||
| 60 | + Column(){ | ||
| 61 | + Stack({ alignContent: Alignment.Top }){ | ||
| 62 | + this.MineHomeTitleTransparent() | ||
| 63 | + this.MineHomeTitleWhite() | ||
| 64 | + } | ||
| 55 | 65 | ||
| 56 | - Column(){ | ||
| 57 | - Stack({ alignContent: Alignment.Top }){ | ||
| 58 | - this.MineHomeTitleTransparent() | ||
| 59 | - this.MineHomeTitleWhite() | ||
| 60 | - } | 66 | + Scroll(this.scroller) { |
| 67 | + Column() { | ||
| 68 | + //用户信息区域 | ||
| 69 | + Row() { | ||
| 70 | + Stack(){ | ||
| 71 | + Image(this.headPhotoUrl) | ||
| 72 | + .alt($r('app.media.default_head')) | ||
| 73 | + .width('115lpx') | ||
| 74 | + .height('115lpx') | ||
| 75 | + .objectFit(ImageFit.Auto) | ||
| 76 | + .clip(new Circle({ width: '115lpx', height: '115lpx' })) | ||
| 77 | + Image(this.levelHead) | ||
| 78 | + .width('165lpx') | ||
| 79 | + .height('165lpx') | ||
| 80 | + .objectFit(ImageFit.Auto) | ||
| 81 | + }.onClick(()=>{ | ||
| 82 | + let params = {'headPhotoUrl': this.headPhotoUrl} as Record<string, string>; | ||
| 83 | + WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params) | ||
| 84 | + }).width('165lpx') | ||
| 85 | + .height('165lpx') | ||
| 61 | 86 | ||
| 62 | - Scroll(this.scroller) { | ||
| 63 | - Column() { | ||
| 64 | - //用户信息区域 | ||
| 65 | - Row() { | ||
| 66 | - Stack(){ | ||
| 67 | - Image(this.headPhotoUrl) | ||
| 68 | - .alt($r('app.media.default_head')) | ||
| 69 | - .width('100lpx') | ||
| 70 | - .height('100lpx') | ||
| 71 | - .objectFit(ImageFit.Auto) | ||
| 72 | - .borderRadius(50) | ||
| 73 | - Image(this.levelHead) | ||
| 74 | - .width('130lpx') | ||
| 75 | - .height('130lpx') | ||
| 76 | - .objectFit(ImageFit.Cover) | ||
| 77 | - }.onClick(()=>{ | ||
| 78 | - let params = {'headPhotoUrl': this.headPhotoUrl} as Record<string, string>; | ||
| 79 | - WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params) | ||
| 80 | - }).width('135lpx') | ||
| 81 | - .height('135lpx') | 87 | + Column() { |
| 88 | + Row() { | ||
| 89 | + Text(`${this.userName}`) | ||
| 90 | + .fontColor($r('app.color.white')) | ||
| 91 | + .maxLines(1) | ||
| 92 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 93 | + .fontSize('38lpx') | ||
| 94 | + .lineHeight('50lpx') | ||
| 95 | + .fontWeight('500lpx') | ||
| 96 | + .onClick(()=>{ | ||
| 97 | + let params: editModelParams = { | ||
| 98 | + editContent: this.userName | ||
| 99 | + } | ||
| 100 | + WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage,params) | ||
| 101 | + }) | ||
| 102 | + | ||
| 103 | + if(this.levelId>0){ | ||
| 104 | + Text(`等级${this.levelId}`) | ||
| 105 | + .fontColor($r('app.color.color_ED2800')) | ||
| 106 | + .fontSize('23lpx') | ||
| 107 | + .fontWeight(500) | ||
| 108 | + .margin({ left: '10lpx' }) | ||
| 109 | + .backgroundImage($r("app.media.my_grade_bg")) | ||
| 110 | + .backgroundImageSize(ImageSize.Cover) | ||
| 111 | + .padding({left:"17lpx",right:"8lpx"}) | ||
| 112 | + .height('35lpx') | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + Blank() | ||
| 116 | + }.width('507lpx') | ||
| 82 | 117 | ||
| 118 | + Row() { | ||
| 119 | + Row() { | ||
| 120 | + Text(`${this.browseNum}`) | ||
| 121 | + .textStyle() | ||
| 122 | + Text("阅读") | ||
| 123 | + .textStyle2() | ||
| 124 | + } | ||
| 125 | + .margin({ right: '15lpx' }) | ||
| 126 | + | ||
| 127 | + Divider() | ||
| 128 | + .height('19lpx') | ||
| 129 | + .width('2lpx') | ||
| 130 | + .color($r('app.color.white')) | ||
| 131 | + .vertical(true) | ||
| 132 | + .opacity(0.4) | ||
| 133 | + Row() { | ||
| 134 | + Text(`${this.commentNum}`) | ||
| 135 | + .textStyle() | ||
| 136 | + Text("评论") | ||
| 137 | + .textStyle2() | ||
| 138 | + }.margin({ right: '15lpx', left: '15lpx' }) | ||
| 139 | + | ||
| 140 | + Divider() | ||
| 141 | + .height('19lpx') | ||
| 142 | + .width('2lpx') | ||
| 143 | + .color($r('app.color.white')) | ||
| 144 | + .vertical(true) | ||
| 145 | + .opacity(0.4) | ||
| 146 | + Row() { | ||
| 147 | + Text(`${this.attentionNum}`) | ||
| 148 | + .textStyle() | ||
| 149 | + Text("关注") | ||
| 150 | + .textStyle2() | ||
| 151 | + }.margin({ left: '15lpx' }) | ||
| 152 | + }.margin({ top: '23lpx' }) | ||
| 153 | + }.alignItems(HorizontalAlign.Start) | ||
| 154 | + .margin({ left: StringUtils.isEmpty(this.levelHead)?'32lpx':"3lpx" }) | ||
| 155 | + } | ||
| 156 | + .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 157 | + if (this.firstPositionY === 0) { | ||
| 158 | + this.firstPositionY = newValue.globalPosition.y as number | ||
| 159 | + }else{ | ||
| 160 | + let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3) | ||
| 161 | + if(persent > 1){ | ||
| 162 | + persent = 1 | ||
| 163 | + } | ||
| 164 | + this.tileOpacity = persent | ||
| 165 | + } | ||
| 166 | + }) | ||
| 167 | + .backgroundColor($r('app.color.color_transparent')) | ||
| 168 | + .height('184lpx') | ||
| 169 | + .width('100%') | ||
| 170 | + .padding({ left: '6lpx' }) | ||
| 171 | + | ||
| 172 | + | ||
| 173 | + //用户简介区域 | ||
| 83 | Column() { | 174 | Column() { |
| 84 | Row() { | 175 | Row() { |
| 85 | - Text(`${this.userName}`) | ||
| 86 | - .fontColor($r('app.color.white')) | ||
| 87 | - .maxLines(1) | 176 | + Text(this.isHasIntroduction?"简介:"+this.desc:this.desc) |
| 177 | + .fontSize('27lpx') | ||
| 178 | + .maxLines(3) | ||
| 88 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 179 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 89 | - .fontSize('38lpx') | ||
| 90 | - .lineHeight('50lpx') | ||
| 91 | - .fontWeight('500lpx') | 180 | + .lineHeight('40lpx') |
| 181 | + .fontWeight('400lpx') | ||
| 182 | + .fontColor(this.isHasIntroduction?$r('app.color.color_222222'):$r('app.color.color_999999')) | ||
| 183 | + .textAlign(TextAlign.Start) | ||
| 92 | .onClick(()=>{ | 184 | .onClick(()=>{ |
| 93 | let params: editModelParams = { | 185 | let params: editModelParams = { |
| 94 | - editContent: this.userName | 186 | + editContent: this.isHasIntroduction?this.desc:'' |
| 95 | } | 187 | } |
| 96 | - WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage,params) | 188 | + WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage,params) |
| 97 | }) | 189 | }) |
| 98 | - if(this.levelId>0){ | ||
| 99 | - Text(`等级${this.levelId}`) | ||
| 100 | - .textAlign(TextAlign.Center) | ||
| 101 | - .fontColor($r('app.color.color_ED2800')) | ||
| 102 | - .backgroundColor($r('app.color.white')) | ||
| 103 | - .fontSize('19lpx') | ||
| 104 | - .width('96lpx') | ||
| 105 | - .height('35lpx') | ||
| 106 | - .margin({ left: '10lpx' }) | 190 | + if(!this.isHasIntroduction){ |
| 191 | + Image($r('app.media.user_info_edit_icon')) | ||
| 192 | + .width('27lpx') | ||
| 193 | + .height('27lpx') | ||
| 194 | + .interpolation(ImageInterpolation.High) | ||
| 195 | + .objectFit(ImageFit.Auto) | ||
| 107 | } | 196 | } |
| 197 | + } | ||
| 108 | 198 | ||
| 109 | - Blank() | ||
| 110 | - }.width('507lpx') | ||
| 111 | 199 | ||
| 112 | - Row() { | ||
| 113 | - Row() { | ||
| 114 | - Text(`${this.browseNum}`) | ||
| 115 | - .textStyle() | ||
| 116 | - Text("阅读") | ||
| 117 | - .textStyle2() | ||
| 118 | - } | ||
| 119 | - .margin({ right: '15lpx' }) | ||
| 120 | - | ||
| 121 | - Divider() | ||
| 122 | - .height('19lpx') | ||
| 123 | - .width('2lpx') | ||
| 124 | - .color($r('app.color.white')) | ||
| 125 | - .vertical(true) | ||
| 126 | - .opacity(0.4) | ||
| 127 | - Row() { | ||
| 128 | - Text(`${this.commentNum}`) | ||
| 129 | - .textStyle() | ||
| 130 | - Text("评论") | ||
| 131 | - .textStyle2() | ||
| 132 | - }.margin({ right: '15lpx', left: '15lpx' }) | ||
| 133 | - | ||
| 134 | - Divider() | ||
| 135 | - .height('19lpx') | ||
| 136 | - .width('2lpx') | ||
| 137 | - .color($r('app.color.white')) | ||
| 138 | - .vertical(true) | ||
| 139 | - .opacity(0.4) | ||
| 140 | - Row() { | ||
| 141 | - Text(`${this.attentionNum}`) | ||
| 142 | - .textStyle() | ||
| 143 | - Text("关注") | ||
| 144 | - .textStyle2() | ||
| 145 | - }.margin({ left: '15lpx' }) | ||
| 146 | - }.margin({ top: '23lpx' }) | ||
| 147 | - }.alignItems(HorizontalAlign.Start) | ||
| 148 | - .margin({ left: '32lpx' }) | ||
| 149 | - } | ||
| 150 | - .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 151 | - if (this.firstPositionY === 0) { | ||
| 152 | - this.firstPositionY = newValue.globalPosition.y as number | ||
| 153 | - }else{ | ||
| 154 | - let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3) | ||
| 155 | - if(persent > 1){ | ||
| 156 | - persent = 1 | ||
| 157 | - } | ||
| 158 | - this.tileOpacity = persent | ||
| 159 | - } | ||
| 160 | - }) | ||
| 161 | - .backgroundColor($r('app.color.color_transparent')) | ||
| 162 | - .height('184lpx') | ||
| 163 | - .width('100%') | ||
| 164 | - .padding({ left: '35lpx' }) | ||
| 165 | - //用户简介区域 | ||
| 166 | - Column() { | ||
| 167 | - Row() { | ||
| 168 | - Text(this.isHasIntroduction?"简介:"+this.desc:this.desc) | ||
| 169 | - .fontSize('27lpx') | ||
| 170 | - .maxLines(3) | ||
| 171 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 172 | - .lineHeight('40lpx') | 200 | + Text(`来到人民日报${this.registerTimeForDay}天`) |
| 201 | + .fontSize('23lpx') | ||
| 202 | + .lineHeight('25lpx') | ||
| 173 | .fontWeight('400lpx') | 203 | .fontWeight('400lpx') |
| 174 | - .fontColor(this.isHasIntroduction?$r('app.color.color_222222'):$r('app.color.color_999999')) | 204 | + .fontColor($r('app.color.color_999999')) |
| 175 | .textAlign(TextAlign.Start) | 205 | .textAlign(TextAlign.Start) |
| 176 | - .onClick(()=>{ | ||
| 177 | - let params: editModelParams = { | ||
| 178 | - editContent: this.isHasIntroduction?this.desc:'' | ||
| 179 | - } | ||
| 180 | - WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage,params) | ||
| 181 | - }) | ||
| 182 | - if(!this.isHasIntroduction){ | ||
| 183 | - Image($r('app.media.user_info_edit_icon')) | ||
| 184 | - .width('27lpx') | ||
| 185 | - .height('27lpx') | ||
| 186 | - .interpolation(ImageInterpolation.High) | ||
| 187 | - .objectFit(ImageFit.Auto) | ||
| 188 | - } | ||
| 189 | - } | ||
| 190 | - | 206 | + .margin({ top: '15lpx' }) |
| 191 | 207 | ||
| 192 | - Text(`来到人民日报${this.registerTimeForDay}天`) | ||
| 193 | - .fontSize('23lpx') | ||
| 194 | - .lineHeight('25lpx') | ||
| 195 | - .fontWeight('400lpx') | ||
| 196 | - .fontColor($r('app.color.color_999999')) | ||
| 197 | - .textAlign(TextAlign.Start) | ||
| 198 | - .margin({ top: '15lpx' }) | ||
| 199 | - | ||
| 200 | - }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'}) | ||
| 201 | - .alignItems(HorizontalAlign.Start) | ||
| 202 | - .justifyContent(FlexAlign.Center) | ||
| 203 | - .width('100%') | ||
| 204 | - .backgroundColor($r('app.color.white')) | ||
| 205 | - //间隔符 | ||
| 206 | - | ||
| 207 | - Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') | ||
| 208 | - | ||
| 209 | - //tab 页面 | ||
| 210 | - Stack({ alignContent: Alignment.Top }){ | ||
| 211 | - Tabs({controller: this.controller}) { | ||
| 212 | - TabContent() { | ||
| 213 | - HomePageBottomCommentComponent({commentNum:$commentNum}) | ||
| 214 | - } | ||
| 215 | - TabContent() { | ||
| 216 | - HomePageBottomFollowComponent() | ||
| 217 | - } | ||
| 218 | - } | 208 | + }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'}) |
| 209 | + .alignItems(HorizontalAlign.Start) | ||
| 210 | + .justifyContent(FlexAlign.Center) | ||
| 211 | + .width('100%') | ||
| 219 | .backgroundColor($r('app.color.white')) | 212 | .backgroundColor($r('app.color.white')) |
| 220 | - .animationDuration(0) | ||
| 221 | - .onChange((index: number) => { | ||
| 222 | - this.currentIndex = index | ||
| 223 | - }) | ||
| 224 | - .vertical(false) | ||
| 225 | - .barHeight("77lpx") | 213 | + //间隔符 |
| 226 | 214 | ||
| 227 | - Column() { | ||
| 228 | - // 页签 | ||
| 229 | - Row({ space: 7 }) { | ||
| 230 | - Scroll() { | ||
| 231 | - Row() { | ||
| 232 | - this.TabBuilder(0,"评论") | ||
| 233 | - this.TabBuilder(1,"关注") | 215 | + Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') |
| 216 | + | ||
| 217 | + //tab 页面 | ||
| 218 | + Stack({ alignContent: Alignment.Top }){ | ||
| 219 | + Tabs({controller: this.controller}) { | ||
| 220 | + TabContent() { | ||
| 221 | + HomePageBottomCommentComponent({commentNum:$commentNum}) | ||
| 222 | + } | ||
| 223 | + TabContent() { | ||
| 224 | + HomePageBottomFollowComponent() | ||
| 225 | + } | ||
| 226 | + } | ||
| 227 | + .backgroundColor($r('app.color.white')) | ||
| 228 | + .animationDuration(0) | ||
| 229 | + .onChange((index: number) => { | ||
| 230 | + this.currentIndex = index | ||
| 231 | + }) | ||
| 232 | + .vertical(false) | ||
| 233 | + .barHeight("77lpx") | ||
| 234 | + | ||
| 235 | + Column() { | ||
| 236 | + // 页签 | ||
| 237 | + Row({ space: 7 }) { | ||
| 238 | + Scroll() { | ||
| 239 | + Row() { | ||
| 240 | + this.TabBuilder(0,"评论") | ||
| 241 | + this.TabBuilder(1,"关注") | ||
| 242 | + } | ||
| 243 | + .justifyContent(FlexAlign.Start) | ||
| 234 | } | 244 | } |
| 235 | - .justifyContent(FlexAlign.Start) | 245 | + .align(Alignment.Start) |
| 246 | + .scrollable(ScrollDirection.Horizontal) | ||
| 247 | + .scrollBar(BarState.Off) | ||
| 248 | + .width('100%') | ||
| 249 | + .padding({left:'31lpx'}) | ||
| 236 | } | 250 | } |
| 237 | - .align(Alignment.Start) | ||
| 238 | - .scrollable(ScrollDirection.Horizontal) | ||
| 239 | - .scrollBar(BarState.Off) | 251 | + .alignItems(VerticalAlign.Bottom) |
| 240 | .width('100%') | 252 | .width('100%') |
| 241 | - .padding({left:'31lpx'}) | ||
| 242 | } | 253 | } |
| 243 | - .alignItems(VerticalAlign.Bottom) | 254 | + .backgroundColor($r('app.color.white')) |
| 255 | + .alignItems(HorizontalAlign.Start) | ||
| 244 | .width('100%') | 256 | .width('100%') |
| 257 | + .height('77lpx') | ||
| 245 | } | 258 | } |
| 246 | - .backgroundColor($r('app.color.white')) | ||
| 247 | - .alignItems(HorizontalAlign.Start) | ||
| 248 | - .width('100%') | ||
| 249 | - .height('77lpx') | ||
| 250 | - } | ||
| 251 | - }.width("100%") | 259 | + }.width("100%") |
| 260 | + } | ||
| 261 | + .edgeEffect(EdgeEffect.None) | ||
| 262 | + .scrollBar(BarState.Off) | ||
| 263 | + .width('100%') | ||
| 264 | + .layoutWeight(1) | ||
| 252 | } | 265 | } |
| 253 | - .edgeEffect(EdgeEffect.None) | ||
| 254 | - .scrollBar(BarState.Off) | ||
| 255 | - .width('100%') | ||
| 256 | - .layoutWeight(1) | 266 | + }.width('100%') |
| 267 | + .layoutWeight(1) | ||
| 268 | + }else{ | ||
| 269 | + Column(){ | ||
| 270 | + CustomTitleUI({ titleName: "" }) | ||
| 271 | + | ||
| 272 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 273 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 274 | + if(this.isConnectNetwork){ | ||
| 275 | + this.getUserInfo() | ||
| 276 | + } | ||
| 277 | + },}) | ||
| 278 | + .layoutWeight(1) | ||
| 279 | + .width('100%') | ||
| 257 | } | 280 | } |
| 258 | - }.width('100%') | ||
| 259 | - .layoutWeight(1) | 281 | + } |
| 260 | 282 | ||
| 261 | } | 283 | } |
| 262 | @Builder MineHomeTitleTransparent() { | 284 | @Builder MineHomeTitleTransparent() { |
| 1 | import router from '@ohos.router' | 1 | import router from '@ohos.router' |
| 2 | import { Params } from 'wdBean'; | 2 | import { Params } from 'wdBean'; |
| 3 | -import { StringUtils } from 'wdKit'; | 3 | +import { NetworkUtil, StringUtils } from 'wdKit'; |
| 4 | import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent'; | 4 | import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent'; |
| 5 | import { OtherHomePageBottomFollowComponent } from '../components/mine/home/OtherHomePageBottomFollowComponent'; | 5 | import { OtherHomePageBottomFollowComponent } from '../components/mine/home/OtherHomePageBottomFollowComponent'; |
| 6 | +import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; | ||
| 7 | +import { EmptyComponent } from '../components/view/EmptyComponent'; | ||
| 6 | import MinePageDatasModel from '../model/MinePageDatasModel'; | 8 | import MinePageDatasModel from '../model/MinePageDatasModel'; |
| 7 | import { OtherUserDetailRequestItem } from '../viewmodel/OtherUserDetailRequestItem'; | 9 | import { OtherUserDetailRequestItem } from '../viewmodel/OtherUserDetailRequestItem'; |
| 8 | 10 | ||
| @@ -39,6 +41,7 @@ struct OtherNormalUserHomePage { | @@ -39,6 +41,7 @@ struct OtherNormalUserHomePage { | ||
| 39 | @State attentionNum:number = 0//关注数 | 41 | @State attentionNum:number = 0//关注数 |
| 40 | @State desc:string = "" | 42 | @State desc:string = "" |
| 41 | userType:string = "1" | 43 | userType:string = "1" |
| 44 | + @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | ||
| 42 | 45 | ||
| 43 | aboutToAppear(){ | 46 | aboutToAppear(){ |
| 44 | this.getUserInfo() | 47 | this.getUserInfo() |
| @@ -47,185 +50,202 @@ struct OtherNormalUserHomePage { | @@ -47,185 +50,202 @@ struct OtherNormalUserHomePage { | ||
| 47 | 50 | ||
| 48 | 51 | ||
| 49 | build() { | 52 | build() { |
| 50 | - Stack({ alignContent: Alignment.Top }){ | ||
| 51 | - Image($r('app.media.title_bg')) | ||
| 52 | - .width('100%') | ||
| 53 | - .height('355lpx') | ||
| 54 | - .objectFit(ImageFit.Cover) | ||
| 55 | - | ||
| 56 | - Column(){ | ||
| 57 | - Stack({ alignContent: Alignment.Top }){ | ||
| 58 | - this.MineHomeTitleTransparent() | ||
| 59 | - this.MineHomeTitleWhite() | ||
| 60 | - } | 53 | + if(this.isConnectNetwork){ |
| 54 | + Stack({ alignContent: Alignment.Top }){ | ||
| 55 | + Image($r('app.media.title_bg')) | ||
| 56 | + .width('100%') | ||
| 57 | + .height('355lpx') | ||
| 58 | + .objectFit(ImageFit.Cover) | ||
| 59 | + | ||
| 60 | + Column(){ | ||
| 61 | + Stack({ alignContent: Alignment.Top }){ | ||
| 62 | + this.MineHomeTitleTransparent() | ||
| 63 | + this.MineHomeTitleWhite() | ||
| 64 | + } | ||
| 61 | 65 | ||
| 62 | - Scroll() { | ||
| 63 | - Column() { | ||
| 64 | - //用户信息区域 | ||
| 65 | - Row() { | ||
| 66 | - Stack(){ | ||
| 67 | - Image(this.headPhotoUrl) | ||
| 68 | - .alt($r('app.media.default_head')) | ||
| 69 | - .width('100lpx') | ||
| 70 | - .height('100lpx') | ||
| 71 | - .objectFit(ImageFit.Cover) | ||
| 72 | - .borderRadius(50) | ||
| 73 | - Image(this.levelHead) | ||
| 74 | - .width('130lpx') | ||
| 75 | - .height('130lpx') | ||
| 76 | - .objectFit(ImageFit.Cover) | ||
| 77 | - .borderRadius(50) | ||
| 78 | - } | 66 | + Scroll() { |
| 67 | + Column() { | ||
| 68 | + //用户信息区域 | ||
| 69 | + Row() { | ||
| 70 | + Stack(){ | ||
| 71 | + Image(this.headPhotoUrl) | ||
| 72 | + .alt($r('app.media.default_head')) | ||
| 73 | + .width('115lpx') | ||
| 74 | + .height('115lpx') | ||
| 75 | + .objectFit(ImageFit.Cover) | ||
| 76 | + .clip(new Circle({ width: '115lpx', height: '115lpx' })) | ||
| 77 | + Image(this.levelHead) | ||
| 78 | + .width('165lpx') | ||
| 79 | + .height('165lpx') | ||
| 80 | + .objectFit(ImageFit.Cover) | ||
| 81 | + } | ||
| 79 | 82 | ||
| 80 | - Column() { | ||
| 81 | - Row() { | ||
| 82 | - Text(`${this.userName}`) | ||
| 83 | - .fontColor($r('app.color.white')) | ||
| 84 | - .maxLines(1) | ||
| 85 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 86 | - .fontSize('38lpx') | ||
| 87 | - .lineHeight('50lpx') | ||
| 88 | - .fontWeight('500lpx') | ||
| 89 | - | ||
| 90 | - Text(`等级${this.levelId}`) | ||
| 91 | - .textAlign(TextAlign.Center) | ||
| 92 | - .fontColor($r('app.color.color_ED2800')) | ||
| 93 | - .backgroundColor($r('app.color.white')) | ||
| 94 | - .fontSize('19lpx') | ||
| 95 | - .width('96lpx') | ||
| 96 | - .height('35lpx') | ||
| 97 | - .margin({ left: '10lpx' }) | ||
| 98 | - Blank() | ||
| 99 | - }.width('507lpx') | ||
| 100 | - | ||
| 101 | - Row() { | ||
| 102 | - Row() { | ||
| 103 | - Text(`${this.browseNum}`) | ||
| 104 | - .textStyle() | ||
| 105 | - Text("阅读") | ||
| 106 | - .textStyle2() | ||
| 107 | - } | ||
| 108 | - .margin({ right: '15lpx' }) | ||
| 109 | - | ||
| 110 | - Divider() | ||
| 111 | - .height('19lpx') | ||
| 112 | - .width('2lpx') | ||
| 113 | - .color($r('app.color.white')) | ||
| 114 | - .vertical(true) | ||
| 115 | - .opacity(0.4) | 83 | + Column() { |
| 116 | Row() { | 84 | Row() { |
| 117 | - Text(`${this.commentNum}`) | ||
| 118 | - .textStyle() | ||
| 119 | - Text("评论") | ||
| 120 | - .textStyle2() | ||
| 121 | - }.margin({ right: '15lpx', left: '15lpx' }) | ||
| 122 | - | ||
| 123 | - Divider() | ||
| 124 | - .height('19lpx') | ||
| 125 | - .width('2lpx') | ||
| 126 | - .color($r('app.color.white')) | ||
| 127 | - .vertical(true) | ||
| 128 | - .opacity(0.4) | 85 | + Text(`${this.userName}`) |
| 86 | + .fontColor($r('app.color.white')) | ||
| 87 | + .maxLines(1) | ||
| 88 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 89 | + .fontSize('38lpx') | ||
| 90 | + .lineHeight('50lpx') | ||
| 91 | + .fontWeight('500lpx') | ||
| 92 | + | ||
| 93 | + if(this.levelId>0){ | ||
| 94 | + Text(`等级${this.levelId}`) | ||
| 95 | + .fontColor($r('app.color.color_ED2800')) | ||
| 96 | + .fontSize('23lpx') | ||
| 97 | + .fontWeight(500) | ||
| 98 | + .margin({ left: '10lpx' }) | ||
| 99 | + .backgroundImage($r("app.media.my_grade_bg")) | ||
| 100 | + .backgroundImageSize(ImageSize.Cover) | ||
| 101 | + .padding({left:"17lpx",right:"8lpx"}) | ||
| 102 | + .height('35lpx') | ||
| 103 | + } | ||
| 104 | + Blank() | ||
| 105 | + }.width('507lpx') | ||
| 106 | + | ||
| 129 | Row() { | 107 | Row() { |
| 130 | - Text(`${this.attentionNum}`) | ||
| 131 | - .textStyle() | ||
| 132 | - Text("关注") | ||
| 133 | - .textStyle2() | ||
| 134 | - }.margin({ left: '15lpx' }) | ||
| 135 | - }.margin({ top: '23lpx' }) | ||
| 136 | - }.alignItems(HorizontalAlign.Start) | ||
| 137 | - .margin({ left: '32lpx' }) | ||
| 138 | - } | ||
| 139 | - .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 140 | - if (this.firstPositionY === 0) { | ||
| 141 | - this.firstPositionY = newValue.globalPosition.y as number | ||
| 142 | - }else{ | ||
| 143 | - let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3) | ||
| 144 | - if(persent > 1){ | ||
| 145 | - persent = 1 | ||
| 146 | - } | ||
| 147 | - this.tileOpacity = persent | 108 | + Row() { |
| 109 | + Text(`${this.browseNum}`) | ||
| 110 | + .textStyle() | ||
| 111 | + Text("阅读") | ||
| 112 | + .textStyle2() | ||
| 113 | + } | ||
| 114 | + .margin({ right: '15lpx' }) | ||
| 115 | + | ||
| 116 | + Divider() | ||
| 117 | + .height('19lpx') | ||
| 118 | + .width('2lpx') | ||
| 119 | + .color($r('app.color.white')) | ||
| 120 | + .vertical(true) | ||
| 121 | + .opacity(0.4) | ||
| 122 | + Row() { | ||
| 123 | + Text(`${this.commentNum}`) | ||
| 124 | + .textStyle() | ||
| 125 | + Text("评论") | ||
| 126 | + .textStyle2() | ||
| 127 | + }.margin({ right: '15lpx', left: '15lpx' }) | ||
| 128 | + | ||
| 129 | + Divider() | ||
| 130 | + .height('19lpx') | ||
| 131 | + .width('2lpx') | ||
| 132 | + .color($r('app.color.white')) | ||
| 133 | + .vertical(true) | ||
| 134 | + .opacity(0.4) | ||
| 135 | + Row() { | ||
| 136 | + Text(`${this.attentionNum}`) | ||
| 137 | + .textStyle() | ||
| 138 | + Text("关注") | ||
| 139 | + .textStyle2() | ||
| 140 | + }.margin({ left: '15lpx' }) | ||
| 141 | + }.margin({ top: '23lpx' }) | ||
| 142 | + }.alignItems(HorizontalAlign.Start) | ||
| 143 | + .margin({ left: StringUtils.isEmpty(this.levelHead)?'32lpx':"3lpx" }) | ||
| 148 | } | 144 | } |
| 149 | - }) | ||
| 150 | - .backgroundColor($r('app.color.color_transparent')) | ||
| 151 | - .height('184lpx') | ||
| 152 | - .width('100%') | ||
| 153 | - .padding({ left: '35lpx' }) | ||
| 154 | - | ||
| 155 | - //用户简介区域 | ||
| 156 | - if(StringUtils.isNotEmpty(this.desc)){ | ||
| 157 | - Column() { | ||
| 158 | - Row() { | ||
| 159 | - Text(this.desc) | ||
| 160 | - .fontSize('27lpx') | ||
| 161 | - .maxLines(3) | ||
| 162 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 163 | - .lineHeight('40lpx') | ||
| 164 | - .fontWeight('400lpx') | ||
| 165 | - .fontColor($r('app.color.color_222222')) | ||
| 166 | - .textAlign(TextAlign.Start) | ||
| 167 | - | ||
| 168 | - } | ||
| 169 | - }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'}) | ||
| 170 | - .alignItems(HorizontalAlign.Start) | ||
| 171 | - .justifyContent(FlexAlign.Center) | ||
| 172 | - .width('100%') | ||
| 173 | - .backgroundColor($r('app.color.white')) | ||
| 174 | - } | ||
| 175 | - //间隔符 | ||
| 176 | - Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') | ||
| 177 | - | ||
| 178 | - //tab 页面 | ||
| 179 | - Stack({ alignContent: Alignment.Top }){ | ||
| 180 | - Tabs({controller: this.controller}) { | ||
| 181 | - TabContent() { | ||
| 182 | - OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum}) | ||
| 183 | - } | ||
| 184 | - TabContent() { | ||
| 185 | - OtherHomePageBottomFollowComponent({curUserId:this.curUserId}) | 145 | + .onAreaChange((oldValue: Area, newValue: Area) => { |
| 146 | + if (this.firstPositionY === 0) { | ||
| 147 | + this.firstPositionY = newValue.globalPosition.y as number | ||
| 148 | + }else{ | ||
| 149 | + let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3) | ||
| 150 | + if(persent > 1){ | ||
| 151 | + persent = 1 | ||
| 152 | + } | ||
| 153 | + this.tileOpacity = persent | ||
| 186 | } | 154 | } |
| 187 | - } | ||
| 188 | - .backgroundColor($r('app.color.white')) | ||
| 189 | - .animationDuration(0) | ||
| 190 | - .onChange((index: number) => { | ||
| 191 | - this.currentIndex = index | ||
| 192 | }) | 155 | }) |
| 193 | - .vertical(false) | ||
| 194 | - .barHeight('77lpx') | 156 | + .backgroundColor($r('app.color.color_transparent')) |
| 157 | + .height('184lpx') | ||
| 158 | + .width('100%') | ||
| 159 | + .padding({ left: '6lpx' }) | ||
| 195 | 160 | ||
| 196 | - Column() { | ||
| 197 | - // 页签 | ||
| 198 | - Row({ space: 7 }) { | ||
| 199 | - Scroll() { | ||
| 200 | - Row() { | ||
| 201 | - this.TabBuilder(0,"评论") | ||
| 202 | - this.TabBuilder(1,"关注") | 161 | + //用户简介区域 |
| 162 | + if(StringUtils.isNotEmpty(this.desc)){ | ||
| 163 | + Column() { | ||
| 164 | + Row() { | ||
| 165 | + Text(this.desc) | ||
| 166 | + .fontSize('27lpx') | ||
| 167 | + .maxLines(3) | ||
| 168 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 169 | + .lineHeight('40lpx') | ||
| 170 | + .fontWeight('400lpx') | ||
| 171 | + .fontColor($r('app.color.color_222222')) | ||
| 172 | + .textAlign(TextAlign.Start) | ||
| 173 | + | ||
| 174 | + } | ||
| 175 | + }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'}) | ||
| 176 | + .alignItems(HorizontalAlign.Start) | ||
| 177 | + .justifyContent(FlexAlign.Center) | ||
| 178 | + .width('100%') | ||
| 179 | + .backgroundColor($r('app.color.white')) | ||
| 180 | + } | ||
| 181 | + //间隔符 | ||
| 182 | + Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') | ||
| 183 | + | ||
| 184 | + //tab 页面 | ||
| 185 | + Stack({ alignContent: Alignment.Top }){ | ||
| 186 | + Tabs({controller: this.controller}) { | ||
| 187 | + TabContent() { | ||
| 188 | + OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum}) | ||
| 189 | + } | ||
| 190 | + TabContent() { | ||
| 191 | + OtherHomePageBottomFollowComponent({curUserId:this.curUserId}) | ||
| 192 | + } | ||
| 193 | + } | ||
| 194 | + .backgroundColor($r('app.color.white')) | ||
| 195 | + .animationDuration(0) | ||
| 196 | + .onChange((index: number) => { | ||
| 197 | + this.currentIndex = index | ||
| 198 | + }) | ||
| 199 | + .vertical(false) | ||
| 200 | + .barHeight('77lpx') | ||
| 201 | + | ||
| 202 | + Column() { | ||
| 203 | + // 页签 | ||
| 204 | + Row({ space: 7 }) { | ||
| 205 | + Scroll() { | ||
| 206 | + Row() { | ||
| 207 | + this.TabBuilder(0,"评论") | ||
| 208 | + this.TabBuilder(1,"关注") | ||
| 209 | + } | ||
| 210 | + .justifyContent(FlexAlign.Start) | ||
| 203 | } | 211 | } |
| 204 | - .justifyContent(FlexAlign.Start) | 212 | + .align(Alignment.Start) |
| 213 | + .scrollable(ScrollDirection.Horizontal) | ||
| 214 | + .scrollBar(BarState.Off) | ||
| 215 | + .width('90%') | ||
| 216 | + .padding({left:'31lpx'}) | ||
| 205 | } | 217 | } |
| 206 | - .align(Alignment.Start) | ||
| 207 | - .scrollable(ScrollDirection.Horizontal) | ||
| 208 | - .scrollBar(BarState.Off) | ||
| 209 | - .width('90%') | ||
| 210 | - .padding({left:'31lpx'}) | 218 | + .alignItems(VerticalAlign.Bottom) |
| 219 | + .width('100%') | ||
| 211 | } | 220 | } |
| 212 | - .alignItems(VerticalAlign.Bottom) | 221 | + .backgroundColor($r('app.color.white')) |
| 222 | + .alignItems(HorizontalAlign.Start) | ||
| 213 | .width('100%') | 223 | .width('100%') |
| 224 | + .height('77lpx') | ||
| 214 | } | 225 | } |
| 215 | - .backgroundColor($r('app.color.white')) | ||
| 216 | - .alignItems(HorizontalAlign.Start) | ||
| 217 | - .width('100%') | ||
| 218 | - .height('77lpx') | ||
| 219 | - } | ||
| 220 | - }.width("100%") | 226 | + }.width("100%") |
| 227 | + } | ||
| 228 | + .edgeEffect(EdgeEffect.None) | ||
| 229 | + .scrollBar(BarState.Off) | ||
| 230 | + .width('100%') | ||
| 231 | + .layoutWeight(1) | ||
| 221 | } | 232 | } |
| 222 | - .edgeEffect(EdgeEffect.None) | ||
| 223 | - .scrollBar(BarState.Off) | ||
| 224 | - .width('100%') | ||
| 225 | - .layoutWeight(1) | 233 | + }.width('100%') |
| 234 | + .layoutWeight(1) | ||
| 235 | + }else{ | ||
| 236 | + Column(){ | ||
| 237 | + CustomTitleUI({ titleName: "" }) | ||
| 238 | + | ||
| 239 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 240 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 241 | + if(this.isChangeToUserEdit){ | ||
| 242 | + this.getUserInfo() | ||
| 243 | + } | ||
| 244 | + },}) | ||
| 245 | + .layoutWeight(1) | ||
| 246 | + .width('100%') | ||
| 226 | } | 247 | } |
| 227 | - }.width('100%') | ||
| 228 | - .layoutWeight(1) | 248 | + } |
| 229 | 249 | ||
| 230 | } | 250 | } |
| 231 | @Builder MineHomeTitleTransparent() { | 251 | @Builder MineHomeTitleTransparent() { |
| 1 | import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, LiveRoomDataBean, PageDTO, PageInfoDTO } from 'wdBean'; | 1 | import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, LiveRoomDataBean, PageDTO, PageInfoDTO } from 'wdBean'; |
| 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; | 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; |
| 3 | -import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils } from 'wdKit'; | 3 | +import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils, ToastUtils } from 'wdKit'; |
| 4 | import { closeRefresh } from '../utils/PullDownRefresh'; | 4 | import { closeRefresh } from '../utils/PullDownRefresh'; |
| 5 | import PageModel from './PageModel'; | 5 | import PageModel from './PageModel'; |
| 6 | import PageViewModel from './PageViewModel'; | 6 | import PageViewModel from './PageViewModel'; |
| @@ -33,9 +33,16 @@ export class PageHelper { | @@ -33,9 +33,16 @@ export class PageHelper { | ||
| 33 | * 刷新数据 | 33 | * 刷新数据 |
| 34 | */ | 34 | */ |
| 35 | async refreshUI(pageModel: PageModel, pageAdvModel: PageAdModel) { | 35 | async refreshUI(pageModel: PageModel, pageAdvModel: PageAdModel) { |
| 36 | + let netStatus = NetworkUtil.isNetConnected() | ||
| 37 | + if (!netStatus) { | ||
| 38 | + ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | ||
| 39 | + setTimeout(() => { | ||
| 40 | + closeRefresh(pageModel, false) | ||
| 41 | + }, 500) | ||
| 42 | + return | ||
| 43 | + } | ||
| 36 | pageModel.loadStrategy = 2 | 44 | pageModel.loadStrategy = 2 |
| 37 | pageModel.pageTotalCompSize = 0; | 45 | pageModel.pageTotalCompSize = 0; |
| 38 | - // TODO 下拉刷新,是否加载缓存 | ||
| 39 | this.getPageInfo(pageModel, pageAdvModel) | 46 | this.getPageInfo(pageModel, pageAdvModel) |
| 40 | } | 47 | } |
| 41 | 48 | ||
| @@ -43,6 +50,11 @@ export class PageHelper { | @@ -43,6 +50,11 @@ export class PageHelper { | ||
| 43 | * 分页加载 | 50 | * 分页加载 |
| 44 | */ | 51 | */ |
| 45 | async loadMore(pageModel: PageModel) { | 52 | async loadMore(pageModel: PageModel) { |
| 53 | + let netStatus = NetworkUtil.isNetConnected() | ||
| 54 | + if (!netStatus) { | ||
| 55 | + ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | ||
| 56 | + return | ||
| 57 | + } | ||
| 46 | pageModel.loadStrategy = 3 | 58 | pageModel.loadStrategy = 3 |
| 47 | // 暂只支持comp分页加载,节目分页加载的得完善框架(如直播回看节目数据分页) | 59 | // 暂只支持comp分页加载,节目分页加载的得完善框架(如直播回看节目数据分页) |
| 48 | this.compLoadMore(pageModel) | 60 | this.compLoadMore(pageModel) |
| @@ -52,55 +64,20 @@ export class PageHelper { | @@ -52,55 +64,20 @@ export class PageHelper { | ||
| 52 | * 进页面请求数据 | 64 | * 进页面请求数据 |
| 53 | */ | 65 | */ |
| 54 | async getInitCacheData(pageModel: PageModel, pageAdvModel: PageAdModel) { | 66 | async getInitCacheData(pageModel: PageModel, pageAdvModel: PageAdModel) { |
| 55 | - Logger.error('zzzz', 'getInitCacheData') | 67 | + Logger.debug(TAG, 'getInitCacheData') |
| 56 | PageViewModel.getPageInfoCache(pageModel.pageId).then(pageInfo => { | 68 | PageViewModel.getPageInfoCache(pageModel.pageId).then(pageInfo => { |
| 69 | + Logger.debug(TAG, 'getInitCacheData back: ' + pageInfo) | ||
| 57 | if (pageInfo == null) { | 70 | if (pageInfo == null) { |
| 58 | return; | 71 | return; |
| 59 | } | 72 | } |
| 60 | pageModel.pageInfo = pageInfo; | 73 | pageModel.pageInfo = pageInfo; |
| 74 | + pageModel.cachePageInfoMd5 = pageInfo.md5 | ||
| 61 | //解析页面挂角广告资源 | 75 | //解析页面挂角广告资源 |
| 62 | pageAdvModel.analysisAdvSource(pageInfo); | 76 | pageAdvModel.analysisAdvSource(pageInfo); |
| 63 | - this.parseCacheGroup(pageModel) | 77 | + this.parseGroup(pageModel, true) |
| 64 | }) | 78 | }) |
| 65 | } | 79 | } |
| 66 | 80 | ||
| 67 | - async parseCacheGroup(pageModel: PageModel) { | ||
| 68 | - Logger.error('zzzz', 'parseCacheGroup') | ||
| 69 | - let pageInfo: PageInfoDTO = pageModel.pageInfo | ||
| 70 | - pageModel.groupList = [] | ||
| 71 | - pageInfo.pageAdList = [] | ||
| 72 | - pageInfo.oneRequestPageGroupCompList = new ArrayList() | ||
| 73 | - pageModel.groupList.push(...pageInfo.groups) | ||
| 74 | - for (const group of pageInfo.groups) { | ||
| 75 | - pageModel.groupId = group.id; | ||
| 76 | - pageModel.groupData = group | ||
| 77 | - // await,确保groups接口顺序执行 | ||
| 78 | - let pageDto = await PageViewModel.getPageGroupCacheData(pageModel.bizCopy()) as PageDTO | ||
| 79 | - let index = pageInfo.groups.indexOf(group) | ||
| 80 | - if (index == 0) { | ||
| 81 | - // 清空comp列表 | ||
| 82 | - pageModel.compList.clear() | ||
| 83 | - } | ||
| 84 | - this.analysisPageGroupCompData(pageDto, pageInfo) | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - // 收集页面所有楼层的组件信息,同步完成广告投放计算,异步完成稿件批查, | ||
| 88 | - | ||
| 89 | - pageModel.pageTotalCompSize = pageInfo.oneRequestPageGroupCompList.length + pageModel.pageTotalCompSize | ||
| 90 | - // 处理页面广告数据,投放到页面的位置 | ||
| 91 | - // TODO 缓存数据不加载广告 | ||
| 92 | - // this.handlePageCompAdvPostion(pageInfo.oneRequestPageGroupCompList, pageModel, pageInfo.pageAdList); | ||
| 93 | - | ||
| 94 | - //遍历所有组件和稿件数据 push到页面 | ||
| 95 | - for (let element of pageInfo.oneRequestPageGroupCompList) { | ||
| 96 | - pageModel.compList.push(CompDTO.createNewsBean(element)) | ||
| 97 | - } | ||
| 98 | - pageModel.currentPage++ | ||
| 99 | - pageModel.viewType = ViewType.LOADED | ||
| 100 | - closeRefresh(pageModel, true) | ||
| 101 | - | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | /** | 81 | /** |
| 105 | * 进页面请求数据 | 82 | * 进页面请求数据 |
| 106 | */ | 83 | */ |
| @@ -134,33 +111,51 @@ export class PageHelper { | @@ -134,33 +111,51 @@ export class PageHelper { | ||
| 134 | promptAction.showToast({ message: err }); | 111 | promptAction.showToast({ message: err }); |
| 135 | }) | 112 | }) |
| 136 | } else { | 113 | } else { |
| 114 | + Logger.debug(TAG, 'getPageInfo') | ||
| 137 | PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => { | 115 | PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => { |
| 116 | + Logger.debug(TAG, 'getPageInfo back: ' + JSON.stringify(pageInfo)) | ||
| 138 | if (pageInfo == null) { | 117 | if (pageInfo == null) { |
| 139 | pageModel.viewType = ViewType.EMPTY; | 118 | pageModel.viewType = ViewType.EMPTY; |
| 140 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1; | 119 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1; |
| 141 | return; | 120 | return; |
| 142 | } | 121 | } |
| 143 | pageModel.pageInfo = pageInfo; | 122 | pageModel.pageInfo = pageInfo; |
| 144 | - //解析页面挂角广告资源 | ||
| 145 | - pageAdvModel.analysisAdvSource(pageInfo); | ||
| 146 | - this.parseGroup(pageModel) | ||
| 147 | - // if (pageModel.currentPage == 1) { | ||
| 148 | - // // 保存缓存 | ||
| 149 | - // CacheData.saveCacheData(CacheData.comPageInfoCacheKey + pageModel.pageId, pageInfo, pageInfo.md5) | ||
| 150 | - // } | 123 | + if (pageInfo.md5 == pageModel.cachePageInfoMd5) { |
| 124 | + // 缓存一致,不解析 | ||
| 125 | + Logger.debug(TAG, 'getPageInfo 与缓存一致,不解析广告。。。') | ||
| 126 | + } else { | ||
| 127 | + Logger.debug(TAG, 'getPageInfo 要解析广告') | ||
| 128 | + if (pageModel.currentPage == 1) { | ||
| 129 | + // 保存缓存 | ||
| 130 | + CacheData.saveCacheData(CacheData.comPageInfoCacheKey + pageModel.pageId, pageInfo, pageInfo.md5) | ||
| 131 | + } | ||
| 132 | + //解析页面挂角广告资源 | ||
| 133 | + pageAdvModel.analysisAdvSource(pageInfo); | ||
| 134 | + } | ||
| 135 | + Logger.debug(TAG, 'getPageInfo go on') | ||
| 136 | + this.parseGroup(pageModel, false) | ||
| 151 | }).catch(() => { | 137 | }).catch(() => { |
| 138 | + if (this.isPageLoaded(pageModel)) { | ||
| 139 | + return | ||
| 140 | + } | ||
| 152 | pageModel.viewType = ViewType.EMPTY; | 141 | pageModel.viewType = ViewType.EMPTY; |
| 153 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_ContentFailed; | 142 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_ContentFailed; |
| 154 | }) | 143 | }) |
| 155 | } | 144 | } |
| 156 | } | 145 | } |
| 157 | 146 | ||
| 147 | + private isPageLoaded(pageModel: PageModel) { | ||
| 148 | + if (pageModel.compList.size() > 0) { | ||
| 149 | + return true | ||
| 150 | + } | ||
| 151 | + return false | ||
| 152 | + } | ||
| 158 | 153 | ||
| 159 | /** | 154 | /** |
| 160 | * 解析信息流页面楼层数据 | 155 | * 解析信息流页面楼层数据 |
| 161 | * @param pageModel | 156 | * @param pageModel |
| 162 | */ | 157 | */ |
| 163 | - async parseGroup(pageModel: PageModel) { | 158 | + async parseGroup(pageModel: PageModel, isCache: boolean) { |
| 164 | let pageInfo: PageInfoDTO = pageModel.pageInfo | 159 | let pageInfo: PageInfoDTO = pageModel.pageInfo |
| 165 | pageModel.groupList = [] | 160 | pageModel.groupList = [] |
| 166 | pageInfo.pageAdList = [] | 161 | pageInfo.pageAdList = [] |
| @@ -177,8 +172,26 @@ export class PageHelper { | @@ -177,8 +172,26 @@ export class PageHelper { | ||
| 177 | pageModel.groupData = group | 172 | pageModel.groupData = group |
| 178 | 173 | ||
| 179 | //Logger.error("ZZZXXXXX", '楼层id-start--》' + pageModel.groupId); | 174 | //Logger.error("ZZZXXXXX", '楼层id-start--》' + pageModel.groupId); |
| 175 | + let pageDto: PageDTO | ||
| 176 | + Logger.debug(TAG, 'parseGroup isCache: ' + isCache) | ||
| 177 | + if (isCache) { | ||
| 178 | + pageDto = await PageViewModel.getPageGroupCacheData(pageModel.bizCopy()) as PageDTO | ||
| 179 | + pageModel.cacheGroupInfoMd5 = pageDto.md5 | ||
| 180 | + } else { | ||
| 181 | + pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO | ||
| 182 | + if (pageDto.md5 == pageModel.cacheGroupInfoMd5) { | ||
| 183 | + Logger.debug(TAG, 'parseGroup cache load, return: ' + pageDto.md5) | ||
| 184 | + // 缓存数据一致,不再刷新 | ||
| 185 | + return | ||
| 186 | + } | ||
| 187 | + Logger.debug(TAG, 'parseGroup cache load, save: ') | ||
| 188 | + // 保存缓存 | ||
| 189 | + CacheData.saveCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId, pageDto, | ||
| 190 | + pageDto.md5) | ||
| 191 | + } | ||
| 192 | + Logger.debug(TAG, 'parseGroup go on') | ||
| 180 | // await,确保groups接口顺序执行 | 193 | // await,确保groups接口顺序执行 |
| 181 | - let pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO | 194 | + // let pageDto = page |
| 182 | let index = pageInfo.groups.indexOf(group) | 195 | let index = pageInfo.groups.indexOf(group) |
| 183 | 196 | ||
| 184 | // 解析楼层组件 | 197 | // 解析楼层组件 |
| @@ -197,9 +210,6 @@ export class PageHelper { | @@ -197,9 +210,6 @@ export class PageHelper { | ||
| 197 | } else { | 210 | } else { |
| 198 | pageInfo.lastCompSourceType = 0 | 211 | pageInfo.lastCompSourceType = 0 |
| 199 | } | 212 | } |
| 200 | - // // 保存缓存 | ||
| 201 | - // CacheData.saveCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId, pageDto, | ||
| 202 | - // pageDto.md5) | ||
| 203 | } | 213 | } |
| 204 | } | 214 | } |
| 205 | 215 |
| @@ -63,6 +63,10 @@ export default class PageModel { | @@ -63,6 +63,10 @@ export default class PageModel { | ||
| 63 | pageType: number = 0; | 63 | pageType: number = 0; |
| 64 | 64 | ||
| 65 | extra: string = '' | 65 | extra: string = '' |
| 66 | + // 缓存数据相关 | ||
| 67 | + cachePageInfoMd5: string = '' | ||
| 68 | + cacheGroupInfoMd5: string = '' | ||
| 69 | + | ||
| 66 | /** | 70 | /** |
| 67 | * 简单复制业务数据 | 71 | * 简单复制业务数据 |
| 68 | */ | 72 | */ |
569 Bytes
| @@ -2,4 +2,5 @@ export { add } from "./src/main/ets/utils/Calc" | @@ -2,4 +2,5 @@ export { add } from "./src/main/ets/utils/Calc" | ||
| 2 | 2 | ||
| 3 | export { HWLocationUtils } from './src/main/ets/location/HWLocationUtils' | 3 | export { HWLocationUtils } from './src/main/ets/location/HWLocationUtils' |
| 4 | 4 | ||
| 5 | -export { WDPushNotificationManager } from "./src/main/ets/notification/WDPushNotificationManager" | ||
| 5 | +// export { WDPushNotificationManager } from "./src/main/ets/notification/WDPushNotificationManager" | ||
| 6 | +export { GetuiPush } from "./src/main/ets/getuiPush/GetuiPush" |
| @@ -7,10 +7,12 @@ | @@ -7,10 +7,12 @@ | ||
| 7 | "license": "Apache-2.0", | 7 | "license": "Apache-2.0", |
| 8 | "packageType": "InterfaceHar", | 8 | "packageType": "InterfaceHar", |
| 9 | "dependencies": { | 9 | "dependencies": { |
| 10 | + "library": "file:./src/main/ets/getuiPush/GTSDK-1.0.1.0.har", | ||
| 10 | "wdConstant": "file:../../commons/wdConstant", | 11 | "wdConstant": "file:../../commons/wdConstant", |
| 11 | "wdLogin": "file:../../features/wdLogin", | 12 | "wdLogin": "file:../../features/wdLogin", |
| 12 | "wdKit": "file:../../commons/wdKit", | 13 | "wdKit": "file:../../commons/wdKit", |
| 13 | "wdBean": "file:../../features/wdBean", | 14 | "wdBean": "file:../../features/wdBean", |
| 15 | + "wdRouter": "file:../../commons/wdRouter", | ||
| 14 | "wdNetwork": "file:../../commons/wdNetwork" | 16 | "wdNetwork": "file:../../commons/wdNetwork" |
| 15 | } | 17 | } |
| 16 | } | 18 | } |
No preview for this file type
| 1 | +import { common, Want } from '@kit.AbilityKit'; | ||
| 2 | +import PushManager, { | ||
| 3 | + BindAliasCmdMessage, | ||
| 4 | + GTCmdMessage, GTNotificationMessage, GTTransmitMessage, PushConst, | ||
| 5 | + SetTagCmdMessage, | ||
| 6 | + Tag, | ||
| 7 | + UnBindAliasCmdMessage } from 'library'; | ||
| 8 | +import { AppUtils, DeviceUtil, EmitterEventId, EmitterUtils, Logger, SPHelper } from 'wdKit/Index'; | ||
| 9 | +import { HostEnum, HostManager, HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index'; | ||
| 10 | +import { notificationManager } from '@kit.NotificationKit'; | ||
| 11 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 12 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 13 | +import { PushContentBean, PushContentParser } from './PushContentParser'; | ||
| 14 | + | ||
| 15 | +const TAG = "GetuiPush" | ||
| 16 | + | ||
| 17 | +export class GetuiPush { | ||
| 18 | + | ||
| 19 | + private static GETUI_APPID_ONLINE = "sMkzgp09Ov82nU1MGk7Ae6" | ||
| 20 | + private static GETUI_APPID_TEST = "ZMi5AAXYHE84VN9p55YpW2" | ||
| 21 | + | ||
| 22 | + private readonly ALIAS_SN_USERID = "userID" | ||
| 23 | + private readonly TAG_SN_TAG = "tag1" | ||
| 24 | + private readonly TAG_PD_ZH = "peopledaily_zh" | ||
| 25 | + | ||
| 26 | + private cid: string = "" | ||
| 27 | + private deviceToken: string = "" | ||
| 28 | + private currentUserId = "" | ||
| 29 | + private lastPushContent?: PushContentBean | ||
| 30 | + | ||
| 31 | + private initialed = false | ||
| 32 | + | ||
| 33 | + private constructor() { | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + private static manager: GetuiPush | ||
| 37 | + static sharedInstance() : GetuiPush { | ||
| 38 | + if (!GetuiPush.manager) { | ||
| 39 | + GetuiPush.manager = new GetuiPush() | ||
| 40 | + } | ||
| 41 | + return GetuiPush.manager | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + init(context: common.UIAbilityContext) { | ||
| 45 | + | ||
| 46 | + const isOnlineEnv = HostManager.getHost() === HostEnum.HOST_PRODUCT | ||
| 47 | + | ||
| 48 | + PushManager.initialize({ | ||
| 49 | + appId:isOnlineEnv ? GetuiPush.GETUI_APPID_TEST : GetuiPush.GETUI_APPID_TEST, | ||
| 50 | + context: context, | ||
| 51 | + onSuccess: (cid:string) => { | ||
| 52 | + Logger.debug(TAG, "个推SDK初始化成功,cid = " + cid) | ||
| 53 | + this.initialed = true | ||
| 54 | + this.cid = cid | ||
| 55 | + this.registerEvents() | ||
| 56 | + this.checkSetup() | ||
| 57 | + }, | ||
| 58 | + onFailed: (error:string) => { | ||
| 59 | + Logger.error(TAG, "个推SDK初始化失败,error = " + error) | ||
| 60 | + } | ||
| 61 | + }) | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + async requestEnableNotifications(context: common.UIAbilityContext) : Promise<boolean> { | ||
| 65 | + let enabled = await notificationManager.isNotificationEnabled() | ||
| 66 | + if (!enabled) { | ||
| 67 | + try { | ||
| 68 | + await notificationManager.requestEnableNotification(context) | ||
| 69 | + enabled = true | ||
| 70 | + } catch (err) { | ||
| 71 | + Logger.error(TAG, "请求通知权限报错: " + JSON.stringify(err)) | ||
| 72 | + let error = err as BusinessError | ||
| 73 | + if (error.code == 1600004) { | ||
| 74 | + Logger.error(TAG, "请求通知权限 - 用户已拒绝") | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | + Logger.info(TAG, "推送 enabled " + enabled) | ||
| 79 | + return enabled | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + checkSetup() { | ||
| 83 | + if (!this.initialed) { return } | ||
| 84 | + if (HttpUtils.isLogin()) { | ||
| 85 | + const userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string | ||
| 86 | + this.currentUserId = userId | ||
| 87 | + this.setAlias(true, userId) | ||
| 88 | + } | ||
| 89 | + let tags = [this.TAG_PD_ZH, AppUtils.getAppVersionCode()] | ||
| 90 | + this.setTags(tags) | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + // 默认是开启的 | ||
| 94 | + switchPush(turnOn: boolean) { | ||
| 95 | + turnOn ? PushManager.turnOnPush() : PushManager.turnOffPush() | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + registerEvents() { | ||
| 99 | + | ||
| 100 | + // 登录和退出 | ||
| 101 | + EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => { | ||
| 102 | + const userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string | ||
| 103 | + this.currentUserId = userId | ||
| 104 | + this.setAlias(true, userId) | ||
| 105 | + }) | ||
| 106 | + EmitterUtils.receiveEvent(EmitterEventId.FORCE_USER_LOGIN_OUT, () => { | ||
| 107 | + if (this.currentUserId.length) { | ||
| 108 | + this.setAlias(false, this.currentUserId) | ||
| 109 | + } | ||
| 110 | + }) | ||
| 111 | + | ||
| 112 | + PushManager.setPushCallback({ | ||
| 113 | + // cid | ||
| 114 | + onReceiveClientId: (clientId: string) => { | ||
| 115 | + Logger.debug(TAG, "推送 接收到 clientId = " + clientId) | ||
| 116 | + this.cid = PushManager.getClientId() | ||
| 117 | + SPHelper.default.save(SpConstants.GETUI_PUSH_CID, this.cid) | ||
| 118 | + this.uploadPushInfo(this.cid) | ||
| 119 | + }, | ||
| 120 | + //接收⼚商token | ||
| 121 | + onReceiveDeviceToken: (deviceToken:string) => { | ||
| 122 | + Logger.debug(TAG, "推送 deviceToken = " + deviceToken) | ||
| 123 | + this.deviceToken = deviceToken; | ||
| 124 | + SPHelper.default.save(SpConstants.GETUI_PUSH_DEVICE_TOKEN, this.deviceToken) | ||
| 125 | + }, | ||
| 126 | + // cid 离线上线通知 | ||
| 127 | + onReceiveOnlineState: (onLine:boolean) => { | ||
| 128 | + Logger.debug(TAG, "推送 onLine State = " + onLine) | ||
| 129 | + }, | ||
| 130 | + //命令相应回复 | ||
| 131 | + onReceiveCommandResult: (result: GTCmdMessage) => { | ||
| 132 | + Logger.debug(TAG, "推送 Cmd Message = " + JSON.stringify(result)) | ||
| 133 | + this.dealWithCmdMessage(result) | ||
| 134 | + }, | ||
| 135 | + //sdk 收到透传消息 | ||
| 136 | + onReceiveMessageData: (message: GTTransmitMessage) => { | ||
| 137 | + Logger.debug(TAG, "推送 透传 Message = " + JSON.stringify(message)) | ||
| 138 | + this.dealWithTransmitMessage(message) | ||
| 139 | + }, | ||
| 140 | + //通知到达回调 | ||
| 141 | + onNotificationMessageArrived: (message: GTNotificationMessage) => { | ||
| 142 | + Logger.debug(TAG, "推送 通知到达回调 " + JSON.stringify(message)) | ||
| 143 | + }, | ||
| 144 | + //通知点击回调, 需要配合PushManager.setClickWant(want)使⽤ | ||
| 145 | + onNotificationMessageClicked: (message: GTNotificationMessage) => { | ||
| 146 | + Logger.debug(TAG, "推送 通知 点击 回调 " + JSON.stringify(message)) | ||
| 147 | + }, | ||
| 148 | + }) | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + setAlias(bind: boolean, alias: string, sn: string = this.ALIAS_SN_USERID) { | ||
| 152 | + if (!this.initialed) { return } | ||
| 153 | + if (bind) { | ||
| 154 | + Logger.debug(TAG, "推送 绑定别名 " + alias) | ||
| 155 | + PushManager.bindAlias(alias, sn) | ||
| 156 | + } else { | ||
| 157 | + Logger.debug(TAG, "推送 解绑别名 " + alias) | ||
| 158 | + PushManager.unBindAlias(alias, true, sn) | ||
| 159 | + } | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + setTags(tags: string[], sn: string = this.TAG_SN_TAG) { | ||
| 163 | + if (!this.initialed) { return } | ||
| 164 | + Logger.debug(TAG, "推送 设置标签 " + tags) | ||
| 165 | + PushManager.setTag(tags.map((tag) => { | ||
| 166 | + return new Tag().setName(tag) | ||
| 167 | + }), sn) | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + setBadgeNumber(number: number) { | ||
| 171 | + Logger.debug(TAG, "推送 设置角标 " + number) | ||
| 172 | + PushManager.setBadgeNum(number) | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + // 接收推送数据,包括启动和二次点击拉起 | ||
| 176 | + // 参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/push-dev-0000001727885258 | ||
| 177 | + onWant(want: Want) { | ||
| 178 | + this.onNewWant(want, true) | ||
| 179 | + } | ||
| 180 | + onNewWant(want: Want, startup: boolean = false) { | ||
| 181 | + Logger.debug(TAG, "want: " + JSON.stringify(want)) | ||
| 182 | + | ||
| 183 | + this.lastPushContent = undefined | ||
| 184 | + let pushContent = PushContentParser.getPushLinkFromWant(want) | ||
| 185 | + if (pushContent && pushContent.isPush) { | ||
| 186 | + Logger.debug(TAG, "接收到推送: " + JSON.stringify(want.parameters)) | ||
| 187 | + this.lastPushContent = pushContent | ||
| 188 | + if (this.initialed) { | ||
| 189 | + this.comsumeLastPushContent() | ||
| 190 | + } | ||
| 191 | + } | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + // 首次进入主页,即可解析跳转推送 | ||
| 195 | + onReachMainPage() { | ||
| 196 | + if (this.initialed) { | ||
| 197 | + this.comsumeLastPushContent() | ||
| 198 | + } else { | ||
| 199 | + this.lastPushContent = undefined | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + comsumeLastPushContent() { | ||
| 204 | + if (!this.lastPushContent) { | ||
| 205 | + return | ||
| 206 | + } | ||
| 207 | + if (this.lastPushContent.online) { | ||
| 208 | + if (this.lastPushContent.want) { | ||
| 209 | + Logger.debug(TAG, "推送 回执: " + this.lastPushContent.want) | ||
| 210 | + PushManager.setClickWant(this.lastPushContent.want) | ||
| 211 | + } | ||
| 212 | + } | ||
| 213 | + if (this.lastPushContent.pushLink) { | ||
| 214 | + Logger.debug(TAG, "跳转对应页面: " + this.lastPushContent.pushLink) | ||
| 215 | + PushContentParser.jumpWithPushLink(this.lastPushContent.pushLink) | ||
| 216 | + } | ||
| 217 | + this.lastPushContent = undefined | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + private dealWithCmdMessage(result: GTCmdMessage) { | ||
| 221 | + let action: Number = result.action; | ||
| 222 | + if (action === PushConst.BIND_ALIAS_RESULT) { | ||
| 223 | + let bindAliasCmdMessage = result as BindAliasCmdMessage; | ||
| 224 | + /* code 结果说明 | ||
| 225 | + 0:成功 | ||
| 226 | + 10099:SDK 未初始化成功 | ||
| 227 | + 30001:绑定别名失败,频率过快,两次调⽤的间隔需⼤于 1s | ||
| 228 | + 30002:绑定别名失败,参数错误 | ||
| 229 | + 30003:当前 cid 绑定别名次数超限 | ||
| 230 | + 30004:绑定别名失败,未知异常 | ||
| 231 | + 30005:绑定别名时,cid 未获取到 | ||
| 232 | + 30006:绑定别名时,发⽣⽹络错误 | ||
| 233 | + 30007:别名⽆效 | ||
| 234 | + 30008:sn ⽆效 */ | ||
| 235 | + let code = bindAliasCmdMessage.code | ||
| 236 | + if (code == 0) { | ||
| 237 | + Logger.debug(TAG, "推送 Cmd BindAlias 成功 " + bindAliasCmdMessage.sn) | ||
| 238 | + } else { | ||
| 239 | + Logger.debug(TAG, "推送 Cmd BindAlias 失败 " | ||
| 240 | + + ",sn = "+bindAliasCmdMessage.sn | ||
| 241 | + + ",clinetId = "+bindAliasCmdMessage.clientId | ||
| 242 | + + ",pkgname = "+bindAliasCmdMessage.pkgName | ||
| 243 | + + ",appId = "+bindAliasCmdMessage.appId | ||
| 244 | + + ",action = "+result.action | ||
| 245 | + + ",code ="+bindAliasCmdMessage.code) | ||
| 246 | + } | ||
| 247 | + } else if (action === PushConst.UNBIND_ALIAS_RESULT) { | ||
| 248 | + let unBindAliasCmdMessage = result as UnBindAliasCmdMessage | ||
| 249 | + /* code 结果说明 | ||
| 250 | + 0:成功 | ||
| 251 | + 10099:SDK 未初始化成功 | ||
| 252 | + 30001:解绑别名失败,频率过快,两次调⽤的间隔需⼤于 1s | ||
| 253 | + 30002:解绑别名失败,参数错误 | ||
| 254 | + 30003:当前 cid 解绑别名次数超限 | ||
| 255 | + 30004:解绑别名失败,未知异常 | ||
| 256 | + 30005:解绑别名时,cid 未获取到 | ||
| 257 | + 30006:解绑别名时,发⽣⽹络错误 | ||
| 258 | + 30007:别名⽆效 | ||
| 259 | + 30008:sn ⽆效*/ | ||
| 260 | + let code = unBindAliasCmdMessage.code | ||
| 261 | + if (code == 0) { | ||
| 262 | + Logger.debug(TAG, "推送 Cmd UnBindAlias 成功 " + unBindAliasCmdMessage.sn) | ||
| 263 | + } else { | ||
| 264 | + Logger.debug(TAG, "推送 Cmd UnBindAlias 失败 " | ||
| 265 | + + ",sn = "+unBindAliasCmdMessage.sn | ||
| 266 | + + ",clinetId = "+unBindAliasCmdMessage.clientId | ||
| 267 | + + ",pkgname = "+unBindAliasCmdMessage.pkgName | ||
| 268 | + + ",appId = "+unBindAliasCmdMessage.appId | ||
| 269 | + + ",action = "+result.action | ||
| 270 | + + ",code ="+unBindAliasCmdMessage.code) | ||
| 271 | + } | ||
| 272 | + } else if (action === PushConst.SET_TAG_RESULT) { | ||
| 273 | + let setTagCmdMessage = result as SetTagCmdMessage | ||
| 274 | + /* code 值说明 | ||
| 275 | + 0:成功 | ||
| 276 | + 10099:SDK 未初始化成功 | ||
| 277 | + 20001:tag 数量过⼤(单次设置的 tag 数量不超过 100) | ||
| 278 | + 20002:调⽤次数超限(默认⼀天只能成功设置⼀次) | ||
| 279 | + 20003:标签重复 | ||
| 280 | + 20004:服务初始化失败 | ||
| 281 | + 20005:setTag 异常 | ||
| 282 | + 20006:tag 为空 | ||
| 283 | + 20007:sn 为空 | ||
| 284 | + 20008:离线,还未登陆成功 | ||
| 285 | + 20009:该 appid 已经在⿊名单列表(请联系技术⽀持处理) | ||
| 286 | + 20010:已存 tag 数⽬超限 | ||
| 287 | + 20011:tag 内容格式不正确 */ | ||
| 288 | + let code = setTagCmdMessage.code | ||
| 289 | + if (code == 0) { | ||
| 290 | + Logger.debug(TAG, "推送 Cmd SetTag 成功 " + setTagCmdMessage.sn) | ||
| 291 | + } else { | ||
| 292 | + Logger.debug(TAG, "推送 Cmd SetTag 失败 " | ||
| 293 | + + ",sn = "+setTagCmdMessage.sn | ||
| 294 | + + ",clinetId = "+setTagCmdMessage.clientId | ||
| 295 | + + ",pkgname = "+setTagCmdMessage.pkgName | ||
| 296 | + + ",appId = "+setTagCmdMessage.appId | ||
| 297 | + + ",action = "+result.action | ||
| 298 | + + ",code ="+setTagCmdMessage.code) | ||
| 299 | + } | ||
| 300 | + } | ||
| 301 | + } | ||
| 302 | + | ||
| 303 | + private dealWithTransmitMessage(message: GTTransmitMessage) { | ||
| 304 | + // const taskid = message.taskId | ||
| 305 | + // const messageId = message.messageId | ||
| 306 | + // /* 上报个推透传消息的展示回执。如果透传消息本地创建通知栏消息“展示”了,则调⽤此⽅法上报。 | ||
| 307 | + // */ | ||
| 308 | + // int gtactionid = 60001;//gtactionid传⼊60001表示个推渠道消息展示了 | ||
| 309 | + // boolean result = PushManager.sendFeedbackMessag(taskid, messageid, gtactionid); | ||
| 310 | + // /** | ||
| 311 | + // * 上报个推透传消息的点击回执。如果透传消息本地创建通知栏消息“点击”了,则调⽤此⽅法上报。 | ||
| 312 | + // */ | ||
| 313 | + // int gtactionid = 60002;//gtactionid传⼊60002表示个推渠道消息点击了 | ||
| 314 | + // boolean result = PushManager.sendFeedbackMessage(taskid, messageid, gtactionid); | ||
| 315 | + } | ||
| 316 | + | ||
| 317 | + private uploadPushInfo(cid: string) { | ||
| 318 | + const url = HttpUrlUtils.getUploadPushInfoUrl() | ||
| 319 | + let bean: Record<string, string | number> = {} | ||
| 320 | + bean["deviceId"] = DeviceUtil.clientId() | ||
| 321 | + bean["cid"] = cid | ||
| 322 | + bean["userId"] = SPHelper.default.getSync(SpConstants.USER_ID, "") as string | ||
| 323 | + bean["appVersion"] = AppUtils.getAppVersionName() | ||
| 324 | + bean["platform"] = 3 | ||
| 325 | + HttpBizUtil.post<ResponseDTO<string>>(url, bean).then((data) => { | ||
| 326 | + Logger.debug(TAG, "上传cid成功" + JSON.stringify(data)) | ||
| 327 | + }).catch((e: BusinessError) => { | ||
| 328 | + Logger.debug(TAG, "上传cid失败" + JSON.stringify(e)) | ||
| 329 | + }) | ||
| 330 | + } | ||
| 331 | +} |
| 1 | +import Want from '@ohos.app.ability.Want'; | ||
| 2 | +import { Logger } from 'wdKit/Index'; | ||
| 3 | +import { JSON } from '@kit.ArkTS'; | ||
| 4 | +import { AppInfo } from '@mpaas/framework'; | ||
| 5 | +import { AppInnerLink } from 'wdRouter/Index'; | ||
| 6 | + | ||
| 7 | +export interface PushContentBean { | ||
| 8 | + isPush: boolean // 是否为推送数据 | ||
| 9 | + want?: Want // want参数 (用来在消费时,回执) | ||
| 10 | + online: boolean // 解析want,是否为在线消息(在线走的是个推通道,离线走的是华为厂商通道) | ||
| 11 | + pushLink?: string // 解析want,对应pushLink参数 | ||
| 12 | +} | ||
| 13 | + | ||
| 14 | +/* | ||
| 15 | + | ||
| 16 | + * */ | ||
| 17 | +export class PushContentParser { | ||
| 18 | + | ||
| 19 | + private static LAUNCH_PARAM_GETUI_DATA = "gtdata" | ||
| 20 | + private static LAUNCH_PARAM_GETUI_TASKID = "taskid" | ||
| 21 | + private static LAUNCH_PARAM_GETUI_NOTIFYID = "_push_notifyid" | ||
| 22 | + private static PUSH_PARAM_PUSH_LINK = "pushLink" | ||
| 23 | + | ||
| 24 | + static getPushLinkFromWant(want: Want) : PushContentBean { | ||
| 25 | + // 个推在线消息 | ||
| 26 | + if (want && want.parameters && want.parameters[PushContentParser.LAUNCH_PARAM_GETUI_DATA]) { | ||
| 27 | + /* | ||
| 28 | + { | ||
| 29 | + "age": 12, | ||
| 30 | + "gtdata": { | ||
| 31 | + "actionid": "10010", | ||
| 32 | + "appid": "ZMi5AAXYHE84VN9p55YpW2", | ||
| 33 | + "bigStyle": 0, | ||
| 34 | + "checkpackage": "com.peopledailychina.hosactivity", | ||
| 35 | + "content": "通知内容444", | ||
| 36 | + "feedbackid": "0", | ||
| 37 | + "isFloat": false, | ||
| 38 | + "messageid": "44fd0876c9834214a6b7032b35d9826b", | ||
| 39 | + "notifID": 62288, | ||
| 40 | + "notifyStyle": 0, | ||
| 41 | + "payload": "", | ||
| 42 | + "taskid": "TEST_0516_03a84918e7df6191502497ed2cbef384", | ||
| 43 | + "title": "测试通知444", | ||
| 44 | + "wantUri": "{\"deviceId\":\"\",\"bundleName\":\"com.peopledailychina.hosactivity\",\"abilityName\":\"EntryAbility\",\"uri\":\"rmrbapp://rmrb.app:8080/openwith\",\"action\":\"com.test.pushaction\",\"parameters\":{\"pushLink\":\"Getui\",\"age\":12}}" | ||
| 45 | + }, | ||
| 46 | + "isCallBySCB": false, | ||
| 47 | + "moduleName": "phone", | ||
| 48 | + "pushLink": "Getui", | ||
| 49 | + "ohos.aafwk.param.callerAbilityName": "", | ||
| 50 | + "ohos.aafwk.param.callerBundleName": "com.ohos.sceneboard", | ||
| 51 | + "ohos.aafwk.param.callerPid": 44239, | ||
| 52 | + "ohos.aafwk.param.callerToken": 537702494, | ||
| 53 | + "ohos.aafwk.param.callerUid": 20020018, | ||
| 54 | + "specifyTokenId": 537063794 | ||
| 55 | + } | ||
| 56 | + },*/ | ||
| 57 | + let gtData = want.parameters[PushContentParser.LAUNCH_PARAM_GETUI_DATA] as Record<string, string | number | object> | ||
| 58 | + if (gtData[PushContentParser.LAUNCH_PARAM_GETUI_TASKID] != undefined) { | ||
| 59 | + let json = JSON.parse(gtData["wantUri"] as string) as Record<string, string | number> | ||
| 60 | + if (json && json[PushContentParser.PUSH_PARAM_PUSH_LINK] != null) { | ||
| 61 | + const pushLink = json[PushContentParser.PUSH_PARAM_PUSH_LINK] as string | ||
| 62 | + return { | ||
| 63 | + isPush: true, online: true, pushLink: pushLink, want: want | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + /* | ||
| 70 | + { | ||
| 71 | + "deviceId": "", | ||
| 72 | + "bundleName": "com.peopledailychina.hosactivity", | ||
| 73 | + "abilityName": "EntryAbility", | ||
| 74 | + "moduleName": "phone", | ||
| 75 | + "uri": "rmrbapp://rmrb.app:8080/openwith", | ||
| 76 | + "type": "", | ||
| 77 | + "flags": 0, | ||
| 78 | + "action": "com.test.pushaction", | ||
| 79 | + "parameters": { | ||
| 80 | + "_push_notifyid": 1, | ||
| 81 | + "age": 12, // 自定义 | ||
| 82 | + "debugApp": false, | ||
| 83 | + "isCallBySCB": false, | ||
| 84 | + "moduleName": "phone", | ||
| 85 | + "pushLink": "Getui", // 自定义 | ||
| 86 | + "ohos.aafwk.param.callerAbilityName": "PushServiceInnerAbility", | ||
| 87 | + "ohos.aafwk.param.callerBundleName": "com.huawei.hms.pushservice", | ||
| 88 | + "ohos.aafwk.param.callerPid": 22808, | ||
| 89 | + "ohos.aafwk.param.callerToken": 537908725, | ||
| 90 | + "ohos.aafwk.param.callerUid": 20004, | ||
| 91 | + "ohos.dlp.params.sandbox": false | ||
| 92 | + }, | ||
| 93 | + "entities": [ | ||
| 94 | + | ||
| 95 | + ] | ||
| 96 | + * */ | ||
| 97 | + // 离线消息,华为直接推送 | ||
| 98 | + if (want && want.parameters && want.parameters[PushContentParser.LAUNCH_PARAM_GETUI_NOTIFYID]) { | ||
| 99 | + if (want.parameters[PushContentParser.PUSH_PARAM_PUSH_LINK]) { | ||
| 100 | + let pushLink = want.parameters[PushContentParser.PUSH_PARAM_PUSH_LINK] as string | ||
| 101 | + return { | ||
| 102 | + isPush: true, online: false, pushLink: pushLink, want: want | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + return { | ||
| 108 | + isPush: false, online: false | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + static jumpWithPushLink(pushLink: string) { | ||
| 113 | + AppInnerLink.jumpWithLink(pushLink) | ||
| 114 | + } | ||
| 115 | +} |
| @@ -7,7 +7,6 @@ import window from '@ohos.window'; | @@ -7,7 +7,6 @@ import window from '@ohos.window'; | ||
| 7 | import { BusinessError } from '@ohos.base'; | 7 | import { BusinessError } from '@ohos.base'; |
| 8 | import { DeviceUtil, EmitterEventId, EmitterUtils, WindowModel } from 'wdKit'; | 8 | import { DeviceUtil, EmitterEventId, EmitterUtils, WindowModel } from 'wdKit'; |
| 9 | import { ConfigurationConstant } from '@kit.AbilityKit'; | 9 | import { ConfigurationConstant } from '@kit.AbilityKit'; |
| 10 | -import { WDPushNotificationManager } from 'wdHwAbility/Index'; | ||
| 11 | import { StartupManager } from '../startupmanager/StartupManager'; | 10 | import { StartupManager } from '../startupmanager/StartupManager'; |
| 12 | 11 | ||
| 13 | let floatWindowClass: window.Window | null = null; | 12 | let floatWindowClass: window.Window | null = null; |
| @@ -28,7 +27,7 @@ export default class EntryAbility extends UIAbility { | @@ -28,7 +27,7 @@ export default class EntryAbility extends UIAbility { | ||
| 28 | 27 | ||
| 29 | // App活着情况下,点击推送通知进入 | 28 | // App活着情况下,点击推送通知进入 |
| 30 | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { | 29 | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { |
| 31 | - WDPushNotificationManager.getInstance().onWant(want) | 30 | + StartupManager.sharedInstance().appOnNewWant(want, launchParam) |
| 32 | } | 31 | } |
| 33 | 32 | ||
| 34 | onDestroy(): void { | 33 | onDestroy(): void { |
| 1 | import { BottomNavigationComponent, LogoutViewModel, PermissionDesComponent } from 'wdComponent'; | 1 | import { BottomNavigationComponent, LogoutViewModel, PermissionDesComponent } from 'wdComponent'; |
| 2 | import { BreakpointConstants } from 'wdConstant'; | 2 | import { BreakpointConstants } from 'wdConstant'; |
| 3 | 3 | ||
| 4 | -import { HWLocationUtils, WDPushNotificationManager } from 'wdHwAbility/Index'; | ||
| 5 | import { common } from '@kit.AbilityKit'; | 4 | import { common } from '@kit.AbilityKit'; |
| 6 | import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger, MpaasUpgradeCheck, WindowModel } from 'wdKit'; | 5 | import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger, MpaasUpgradeCheck, WindowModel } from 'wdKit'; |
| 7 | import { promptAction, window } from '@kit.ArkUI'; | 6 | import { promptAction, window } from '@kit.ArkUI'; |
| @@ -33,16 +32,6 @@ struct MainPage { | @@ -33,16 +32,6 @@ struct MainPage { | ||
| 33 | 32 | ||
| 34 | this.breakpointSystem.register() | 33 | this.breakpointSystem.register() |
| 35 | 34 | ||
| 36 | - let context = getContext(this) as common.UIAbilityContext | ||
| 37 | - WDPushNotificationManager.getInstance().requestEnableNotifications(context).then((enabled) => { | ||
| 38 | - if (enabled) { | ||
| 39 | - WDPushNotificationManager.getInstance().fetchTokenAndBindProfileId() | ||
| 40 | - | ||
| 41 | - // WDPushNotificationManager.getInstance().sendLocalNotification() | ||
| 42 | - } | ||
| 43 | - HWLocationUtils.startLocationService() | ||
| 44 | - }) | ||
| 45 | - | ||
| 46 | Logger.info(TAG, `aboutToAppear `); | 35 | Logger.info(TAG, `aboutToAppear `); |
| 47 | EmitterUtils.receiveEvent(EmitterEventId.FORCE_USER_LOGIN_OUT, () => { | 36 | EmitterUtils.receiveEvent(EmitterEventId.FORCE_USER_LOGIN_OUT, () => { |
| 48 | LogoutViewModel.clearLoginInfo() | 37 | LogoutViewModel.clearLoginInfo() |
| 1 | import { AbilityConstant, common, Want } from '@kit.AbilityKit' | 1 | import { AbilityConstant, common, Want } from '@kit.AbilityKit' |
| 2 | -import { WDPushNotificationManager } from 'wdHwAbility/Index' | ||
| 3 | import { DeviceUtil, | 2 | import { DeviceUtil, |
| 4 | EmitterEventId, | 3 | EmitterEventId, |
| 5 | EmitterUtils, | 4 | EmitterUtils, |
| @@ -16,6 +15,8 @@ import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index' | @@ -16,6 +15,8 @@ import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index' | ||
| 16 | import { registerRouter } from 'wdRouter/Index' | 15 | import { registerRouter } from 'wdRouter/Index' |
| 17 | import { TrackingModule } from 'wdTracking/Index' | 16 | import { TrackingModule } from 'wdTracking/Index' |
| 18 | import { JSON } from '@kit.ArkTS' | 17 | import { JSON } from '@kit.ArkTS' |
| 18 | +import app from '@system.app' | ||
| 19 | +import { GetuiPush, HWLocationUtils } from 'wdHwAbility/Index' | ||
| 19 | 20 | ||
| 20 | const TAG = "[StartupManager]" | 21 | const TAG = "[StartupManager]" |
| 21 | 22 | ||
| @@ -24,6 +25,8 @@ export class StartupManager { | @@ -24,6 +25,8 @@ export class StartupManager { | ||
| 24 | 25 | ||
| 25 | private context?: common.UIAbilityContext | 26 | private context?: common.UIAbilityContext |
| 26 | 27 | ||
| 28 | + private constructor() { | ||
| 29 | + } | ||
| 27 | private static _manger?: StartupManager | 30 | private static _manger?: StartupManager |
| 28 | static sharedInstance(): StartupManager { | 31 | static sharedInstance(): StartupManager { |
| 29 | if (!StartupManager._manger) { | 32 | if (!StartupManager._manger) { |
| @@ -36,6 +39,8 @@ export class StartupManager { | @@ -36,6 +39,8 @@ export class StartupManager { | ||
| 36 | appOnCreate(want: Want, launchParam: AbilityConstant.LaunchParam, context: common.UIAbilityContext) { | 39 | appOnCreate(want: Want, launchParam: AbilityConstant.LaunchParam, context: common.UIAbilityContext) { |
| 37 | Logger.debug(TAG, "App onCreate: " + `\nwant: ${want}\nlaunchParam: ${launchParam}`) | 40 | Logger.debug(TAG, "App onCreate: " + `\nwant: ${want}\nlaunchParam: ${launchParam}`) |
| 38 | this.context = context | 41 | this.context = context |
| 42 | + // 设置图片文件数据缓存上限为200MB (200MB=200*1024*1024B=209715200B) | ||
| 43 | + app.setImageFileCacheSize(209715200) | ||
| 39 | 44 | ||
| 40 | // KV存储 | 45 | // KV存储 |
| 41 | SPHelper.init(context); | 46 | SPHelper.init(context); |
| @@ -57,10 +62,14 @@ export class StartupManager { | @@ -57,10 +62,14 @@ export class StartupManager { | ||
| 57 | this.preInitUmentStat() | 62 | this.preInitUmentStat() |
| 58 | 63 | ||
| 59 | // 通知栏点击后启动 | 64 | // 通知栏点击后启动 |
| 60 | - WDPushNotificationManager.getInstance().onWant(want) | 65 | + GetuiPush.sharedInstance().onWant(want) |
| 61 | Logger.debug(TAG, "App onCreate: finised") | 66 | Logger.debug(TAG, "App onCreate: finised") |
| 62 | } | 67 | } |
| 63 | 68 | ||
| 69 | + appOnNewWant(want: Want, launchParam: AbilityConstant.LaunchParam) { | ||
| 70 | + GetuiPush.sharedInstance().onNewWant(want) | ||
| 71 | + } | ||
| 72 | + | ||
| 64 | appOnDestory() { | 73 | appOnDestory() { |
| 65 | Logger.debug(TAG, "App onDestory") | 74 | Logger.debug(TAG, "App onDestory") |
| 66 | NetworkManager.getInstance().release() | 75 | NetworkManager.getInstance().release() |
| @@ -88,13 +97,19 @@ export class StartupManager { | @@ -88,13 +97,19 @@ export class StartupManager { | ||
| 88 | Logger.debug(TAG, "App 必要初始化完成") | 97 | Logger.debug(TAG, "App 必要初始化完成") |
| 89 | } | 98 | } |
| 90 | 99 | ||
| 91 | - // 到达主页后,初始化非必须部分 | 100 | + // 初次到达主页后,初始化非必须部分 |
| 92 | appReachMainPage() : Promise<void> { | 101 | appReachMainPage() : Promise<void> { |
| 93 | return new Promise((resolve) => { | 102 | return new Promise((resolve) => { |
| 94 | - Logger.debug(TAG, "App 进入首页,开始其他任务初始化") | 103 | + Logger.debug(TAG, "App 初次进入首页,开始其他任务初始化") |
| 95 | 104 | ||
| 96 | LoginModule.reportDeviceInfo() | 105 | LoginModule.reportDeviceInfo() |
| 97 | 106 | ||
| 107 | + GetuiPush.sharedInstance().requestEnableNotifications(this.context!).then((enabled) => { | ||
| 108 | + HWLocationUtils.startLocationService() | ||
| 109 | + }) | ||
| 110 | + | ||
| 111 | + GetuiPush.sharedInstance().onReachMainPage() | ||
| 112 | + | ||
| 98 | //TODO: | 113 | //TODO: |
| 99 | 114 | ||
| 100 | resolve() | 115 | resolve() |
| @@ -127,7 +142,8 @@ export class StartupManager { | @@ -127,7 +142,8 @@ export class StartupManager { | ||
| 127 | } | 142 | } |
| 128 | 143 | ||
| 129 | private initGeTuiPush() { | 144 | private initGeTuiPush() { |
| 130 | - // Logger.debug(TAG, "App 初始化") | 145 | + Logger.debug(TAG, "App 个推推送 初始化") |
| 146 | + GetuiPush.sharedInstance().init(this.context!) | ||
| 131 | } | 147 | } |
| 132 | 148 | ||
| 133 | private initLocation() { | 149 | private initLocation() { |
| @@ -167,4 +183,4 @@ export class StartupManager { | @@ -167,4 +183,4 @@ export class StartupManager { | ||
| 167 | private initOthers() { | 183 | private initOthers() { |
| 168 | 184 | ||
| 169 | } | 185 | } |
| 170 | -} | ||
| 186 | +} |
| @@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
| 14 | "pages": "$profile:main_pages", | 14 | "pages": "$profile:main_pages", |
| 15 | "abilities": [ | 15 | "abilities": [ |
| 16 | { | 16 | { |
| 17 | - "name": "EntryAbility", | 17 | + "name": "EntryAbility", // 这里不能改动,和后台推送有绑定 |
| 18 | "srcEntry": "./ets/entryability/EntryAbility.ets", | 18 | "srcEntry": "./ets/entryability/EntryAbility.ets", |
| 19 | "description": "$string:EntryAbility_desc", | 19 | "description": "$string:EntryAbility_desc", |
| 20 | "icon": "$media:app_icon", | 20 | "icon": "$media:app_icon", |
| @@ -28,8 +28,15 @@ | @@ -28,8 +28,15 @@ | ||
| 28 | "entity.system.home" | 28 | "entity.system.home" |
| 29 | ], | 29 | ], |
| 30 | "actions": [ | 30 | "actions": [ |
| 31 | - "action.system.home" | ||
| 32 | - ] | 31 | + "action.system.home", |
| 32 | + "com.test.pushaction" | ||
| 33 | + ], | ||
| 34 | + "uris" : [{ | ||
| 35 | + "scheme": 'rmrbapp', | ||
| 36 | + "host": 'rmrb.app', | ||
| 37 | + 'port': '8080', | ||
| 38 | + "path": 'openwith' | ||
| 39 | + }] | ||
| 33 | } | 40 | } |
| 34 | ] | 41 | ] |
| 35 | } | 42 | } |
-
Please register or login to post a comment