Showing
5 changed files
with
37 additions
and
4 deletions
| @@ -89,6 +89,15 @@ export class KVStoreHelper { | @@ -89,6 +89,15 @@ export class KVStoreHelper { | ||
| 89 | } | 89 | } |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | + deleteAll() { | ||
| 93 | + this.kvManager?.deleteKVStore(AppUtils.getPackageName(getContext()), KVStoreHelper._default_store_id) | ||
| 94 | + .then(() => { | ||
| 95 | + Logger.error(TAG, 'deleteAll success') | ||
| 96 | + }).catch((e: object) => { | ||
| 97 | + Logger.error(TAG, 'deleteAll error: ' + JSON.stringify(e)) | ||
| 98 | + }) | ||
| 99 | + } | ||
| 100 | + | ||
| 92 | private checkStoreCreated() { | 101 | private checkStoreCreated() { |
| 93 | if (!this.kvManager) { | 102 | if (!this.kvManager) { |
| 94 | this.createKVManager() | 103 | this.createKVManager() |
| @@ -53,7 +53,7 @@ export struct CardSourceInfo { | @@ -53,7 +53,7 @@ export struct CardSourceInfo { | ||
| 53 | // .flexShrink(0); | 53 | // .flexShrink(0); |
| 54 | // } | 54 | // } |
| 55 | if (this.contentDTO.source) { | 55 | if (this.contentDTO.source) { |
| 56 | - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | 56 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(new Date(this.contentDTO.publishTime).getTime().toString()))) |
| 57 | .fontSize($r("app.float.font_size_11")) | 57 | .fontSize($r("app.float.font_size_11")) |
| 58 | .fontColor($r("app.color.color_B0B0B0")) | 58 | .fontColor($r("app.color.color_B0B0B0")) |
| 59 | .flexShrink(0); | 59 | .flexShrink(0); |
| @@ -143,7 +143,7 @@ export struct Card9Component { | @@ -143,7 +143,7 @@ export struct Card9Component { | ||
| 143 | // 标题 | 143 | // 标题 |
| 144 | Image($r("app.media.timeAxis")) | 144 | Image($r("app.media.timeAxis")) |
| 145 | .width(9) | 145 | .width(9) |
| 146 | - .height(9) | 146 | + .height(6) |
| 147 | .margin({ right: 5 }) | 147 | .margin({ right: 5 }) |
| 148 | .fillColor(item.newsTitleColor) | 148 | .fillColor(item.newsTitleColor) |
| 149 | 149 |
| 1 | -import { LazyDataSource, StringUtils } from 'wdKit/Index'; | 1 | +import { LazyDataSource, NetworkUtil, StringUtils } from 'wdKit/Index'; |
| 2 | import { Remark, SubscribeMessageModel, | 2 | import { Remark, SubscribeMessageModel, |
| 3 | WDMessageCenterMessageType } from '../../../../model/InteractMessageModel'; | 3 | WDMessageCenterMessageType } from '../../../../model/InteractMessageModel'; |
| 4 | import MinePageDatasModel from '../../../../model/MinePageDatasModel'; | 4 | import MinePageDatasModel from '../../../../model/MinePageDatasModel'; |
| @@ -22,6 +22,7 @@ export struct SubscribeMessageComponent{ | @@ -22,6 +22,7 @@ export struct SubscribeMessageComponent{ | ||
| 22 | @State isGetRequest: boolean = false | 22 | @State isGetRequest: boolean = false |
| 23 | private scroller: Scroller = new Scroller(); | 23 | private scroller: Scroller = new Scroller(); |
| 24 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 24 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 25 | + @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | ||
| 25 | 26 | ||
| 26 | aboutToAppear() { | 27 | aboutToAppear() { |
| 27 | this.getNewPageData() | 28 | this.getNewPageData() |
| @@ -33,9 +34,27 @@ export struct SubscribeMessageComponent{ | @@ -33,9 +34,27 @@ export struct SubscribeMessageComponent{ | ||
| 33 | CustomTitleUI({ titleName: "预约消息" }) | 34 | CustomTitleUI({ titleName: "预约消息" }) |
| 34 | if (this.count == 0) { | 35 | if (this.count == 0) { |
| 35 | if (this.isGetRequest == true) { | 36 | if (this.isGetRequest == true) { |
| 37 | + if(this.isConnectNetwork){ | ||
| 36 | EmptyComponent({ emptyType: 5 }) | 38 | EmptyComponent({ emptyType: 5 }) |
| 37 | .height('100%') | 39 | .height('100%') |
| 38 | .width('100%') | 40 | .width('100%') |
| 41 | + }else{ | ||
| 42 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 43 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 44 | + if(this.isConnectNetwork){ | ||
| 45 | + this.curPageNum = 1; | ||
| 46 | + this.hasMore = true | ||
| 47 | + this.isGetRequest = false | ||
| 48 | + this.data.clear() | ||
| 49 | + | ||
| 50 | + if (!this.isLoading) { | ||
| 51 | + this.getNewPageData() | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + },}) | ||
| 55 | + .layoutWeight(1) | ||
| 56 | + .width('100%') | ||
| 57 | + } | ||
| 39 | } | 58 | } |
| 40 | } else { | 59 | } else { |
| 41 | CustomPullToRefresh({ | 60 | CustomPullToRefresh({ |
| 1 | -import { SPHelper } from 'wdKit/Index'; | 1 | +import { KVStoreHelper, SPHelper } from 'wdKit/Index'; |
| 2 | import { HostEnum, HostManager, HttpUrlUtils } from 'wdNetwork/Index'; | 2 | import { HostEnum, HostManager, HttpUrlUtils } from 'wdNetwork/Index'; |
| 3 | 3 | ||
| 4 | @CustomDialog | 4 | @CustomDialog |
| @@ -86,11 +86,16 @@ export struct EnvironmentCustomDialog { | @@ -86,11 +86,16 @@ export struct EnvironmentCustomDialog { | ||
| 86 | Button('确认') | 86 | Button('确认') |
| 87 | .margin({ top: 20 }) | 87 | .margin({ top: 20 }) |
| 88 | .onClick(() => { | 88 | .onClick(() => { |
| 89 | + new Promise<void>(() => { | ||
| 89 | // HttpUrlUtils.hostUrl = this.currentEnvironment | 90 | // HttpUrlUtils.hostUrl = this.currentEnvironment |
| 90 | SPHelper.default.saveSync('hostUrl', this.currentEnvironment); | 91 | SPHelper.default.saveSync('hostUrl', this.currentEnvironment); |
| 92 | + // 清首页缓存 | ||
| 93 | + KVStoreHelper.default.deleteAll() | ||
| 94 | + // TODO 清sp相关 | ||
| 91 | this.controller.close() | 95 | this.controller.close() |
| 92 | this.confirm() | 96 | this.confirm() |
| 93 | }) | 97 | }) |
| 98 | + }) | ||
| 94 | }.height(261).backgroundColor(Color.White).borderRadius(6).width('74%') | 99 | }.height(261).backgroundColor(Color.White).borderRadius(6).width('74%') |
| 95 | 100 | ||
| 96 | } | 101 | } |
-
Please register or login to post a comment