Showing
16 changed files
with
312 additions
and
129 deletions
| @@ -20,14 +20,27 @@ | @@ -20,14 +20,27 @@ | ||
| 20 | "name": "default", | 20 | "name": "default", |
| 21 | "type": "HarmonyOS", | 21 | "type": "HarmonyOS", |
| 22 | "material": { | 22 | "material": { |
| 23 | - "storePassword": "0000001EF28F8A628911F4F52B75E452C814EE4370854DD8DFCE186496B6AD88F8DE5AD3E10F24C1079F2EDD1FFF", | ||
| 24 | "certpath": "./singing_config/manual_com.peopledailychina.hosactivity_sign/鸿蒙中文版客户端证书.cer", | 23 | "certpath": "./singing_config/manual_com.peopledailychina.hosactivity_sign/鸿蒙中文版客户端证书.cer", |
| 24 | + "storePassword": "0000001E857CAD6D7E7172B6C87426344CEF8CC3281AB0461B4FA467DA64A1E11BD35929D150343E5D8E1EEE2740", | ||
| 25 | "keyAlias": "peopledailyhosalias", | 25 | "keyAlias": "peopledailyhosalias", |
| 26 | - "keyPassword": "0000001E2E8A50EFF2E6D2023242B432388B2748F8299D8BB319C0B06CFF7DCEA7482C5E3CDF1398CCE095BDC68B", | 26 | + "keyPassword": "0000001E383EA87F51D8B158D5D1FC9ACC10179A0C93E81FD01B2E24D5B449EF1E50789BCEBC4FA09E3E5445C12A", |
| 27 | "profile": "./singing_config/manual_com.peopledailychina.hosactivity_sign/peopledaiychina-hos-profile-debugDebug.p7b", | 27 | "profile": "./singing_config/manual_com.peopledailychina.hosactivity_sign/peopledaiychina-hos-profile-debugDebug.p7b", |
| 28 | "signAlg": "SHA256withECDSA", | 28 | "signAlg": "SHA256withECDSA", |
| 29 | "storeFile": "./singing_config/manual_com.peopledailychina.hosactivity_sign/keystorefile.p12" | 29 | "storeFile": "./singing_config/manual_com.peopledailychina.hosactivity_sign/keystorefile.p12" |
| 30 | } | 30 | } |
| 31 | + }, | ||
| 32 | + { | ||
| 33 | + "name": "release", | ||
| 34 | + "type": "HarmonyOS", | ||
| 35 | + "material": { | ||
| 36 | + "storePassword": "0000001E423C7B1ED6AA1EC296F8E9D84C03F7D2E2BD770655E9EABA798E457E15B4D993CCA36416B0200E92DED7", | ||
| 37 | + "certpath": "./singing_config/manual_com.peopledailychina.hosactivity_sign/鸿蒙中文版客户端证书正式.cer", | ||
| 38 | + "keyAlias": "peopledailyhosalias", | ||
| 39 | + "keyPassword": "0000001E9C2E794B52FC032F4C6ED037D72ADAAC76F3F0F001342A7D79ABE3A45E01FA86911A0510DB2B532847E2", | ||
| 40 | + "profile": "./singing_config/manual_com.peopledailychina.hosactivity_sign/peopledailychina-hos-profile-releaseRelease.p7b", | ||
| 41 | + "signAlg": "SHA256withECDSA", | ||
| 42 | + "storeFile": "./singing_config/manual_com.peopledailychina.hosactivity_sign/keystorefile.p12" | ||
| 43 | + } | ||
| 31 | } | 44 | } |
| 32 | ], | 45 | ], |
| 33 | "products": [ | 46 | "products": [ |
| @@ -37,6 +50,13 @@ | @@ -37,6 +50,13 @@ | ||
| 37 | "compileSdkVersion": "5.0.0(12)", | 50 | "compileSdkVersion": "5.0.0(12)", |
| 38 | "compatibleSdkVersion": "5.0.0(12)", | 51 | "compatibleSdkVersion": "5.0.0(12)", |
| 39 | "runtimeOS": "HarmonyOS", | 52 | "runtimeOS": "HarmonyOS", |
| 53 | + }, | ||
| 54 | + { | ||
| 55 | + "name": "productRELEASE", | ||
| 56 | + "signingConfig": "release", | ||
| 57 | + "compileSdkVersion": "5.0.0(12)", | ||
| 58 | + "compatibleSdkVersion": "5.0.0(12)", | ||
| 59 | + "runtimeOS": "HarmonyOS", | ||
| 40 | } | 60 | } |
| 41 | ], | 61 | ], |
| 42 | "buildModeSet": [ | 62 | "buildModeSet": [ |
| @@ -56,7 +76,8 @@ | @@ -56,7 +76,8 @@ | ||
| 56 | { | 76 | { |
| 57 | "name": "default", | 77 | "name": "default", |
| 58 | "applyToProducts": [ | 78 | "applyToProducts": [ |
| 59 | - "default" | 79 | + "default", |
| 80 | + "productRELEASE" | ||
| 60 | ] | 81 | ] |
| 61 | } | 82 | } |
| 62 | ] | 83 | ] |
| @@ -68,7 +89,8 @@ | @@ -68,7 +89,8 @@ | ||
| 68 | { | 89 | { |
| 69 | "name": "default", | 90 | "name": "default", |
| 70 | "applyToProducts": [ | 91 | "applyToProducts": [ |
| 71 | - "default" | 92 | + "default", |
| 93 | + "productRELEASE" | ||
| 72 | ] | 94 | ] |
| 73 | } | 95 | } |
| 74 | ] | 96 | ] |
| @@ -80,7 +102,8 @@ | @@ -80,7 +102,8 @@ | ||
| 80 | { | 102 | { |
| 81 | "name": "default", | 103 | "name": "default", |
| 82 | "applyToProducts": [ | 104 | "applyToProducts": [ |
| 83 | - "default" | 105 | + "default", |
| 106 | + "productRELEASE" | ||
| 84 | ] | 107 | ] |
| 85 | } | 108 | } |
| 86 | ] | 109 | ] |
| @@ -92,7 +115,8 @@ | @@ -92,7 +115,8 @@ | ||
| 92 | { | 115 | { |
| 93 | "name": "default", | 116 | "name": "default", |
| 94 | "applyToProducts": [ | 117 | "applyToProducts": [ |
| 95 | - "default" | 118 | + "default", |
| 119 | + "productRELEASE" | ||
| 96 | ] | 120 | ] |
| 97 | } | 121 | } |
| 98 | ] | 122 | ] |
| @@ -104,7 +128,8 @@ | @@ -104,7 +128,8 @@ | ||
| 104 | { | 128 | { |
| 105 | "name": "default", | 129 | "name": "default", |
| 106 | "applyToProducts": [ | 130 | "applyToProducts": [ |
| 107 | - "default" | 131 | + "default", |
| 132 | + "productRELEASE" | ||
| 108 | ] | 133 | ] |
| 109 | } | 134 | } |
| 110 | ] | 135 | ] |
| @@ -116,7 +141,8 @@ | @@ -116,7 +141,8 @@ | ||
| 116 | { | 141 | { |
| 117 | "name": "default", | 142 | "name": "default", |
| 118 | "applyToProducts": [ | 143 | "applyToProducts": [ |
| 119 | - "default" | 144 | + "default", |
| 145 | + "productRELEASE" | ||
| 120 | ] | 146 | ] |
| 121 | } | 147 | } |
| 122 | ] | 148 | ] |
| @@ -128,7 +154,8 @@ | @@ -128,7 +154,8 @@ | ||
| 128 | { | 154 | { |
| 129 | "name": "default", | 155 | "name": "default", |
| 130 | "applyToProducts": [ | 156 | "applyToProducts": [ |
| 131 | - "default" | 157 | + "default", |
| 158 | + "productRELEASE" | ||
| 132 | ] | 159 | ] |
| 133 | } | 160 | } |
| 134 | ] | 161 | ] |
| @@ -144,7 +171,8 @@ | @@ -144,7 +171,8 @@ | ||
| 144 | { | 171 | { |
| 145 | "name": "default", | 172 | "name": "default", |
| 146 | "applyToProducts": [ | 173 | "applyToProducts": [ |
| 147 | - "default" | 174 | + "default", |
| 175 | + "productRELEASE" | ||
| 148 | ] | 176 | ] |
| 149 | } | 177 | } |
| 150 | ] | 178 | ] |
| @@ -168,7 +196,8 @@ | @@ -168,7 +196,8 @@ | ||
| 168 | { | 196 | { |
| 169 | "name": "default", | 197 | "name": "default", |
| 170 | "applyToProducts": [ | 198 | "applyToProducts": [ |
| 171 | - "default" | 199 | + "default", |
| 200 | + "productRELEASE" | ||
| 172 | ] | 201 | ] |
| 173 | } | 202 | } |
| 174 | ] | 203 | ] |
| @@ -180,7 +209,8 @@ | @@ -180,7 +209,8 @@ | ||
| 180 | { | 209 | { |
| 181 | "name": "default", | 210 | "name": "default", |
| 182 | "applyToProducts": [ | 211 | "applyToProducts": [ |
| 183 | - "default" | 212 | + "default", |
| 213 | + "productRELEASE" | ||
| 184 | ] | 214 | ] |
| 185 | } | 215 | } |
| 186 | ] | 216 | ] |
| @@ -192,7 +222,8 @@ | @@ -192,7 +222,8 @@ | ||
| 192 | { | 222 | { |
| 193 | "name": "default", | 223 | "name": "default", |
| 194 | "applyToProducts": [ | 224 | "applyToProducts": [ |
| 195 | - "default" | 225 | + "default", |
| 226 | + "productRELEASE" | ||
| 196 | ] | 227 | ] |
| 197 | } | 228 | } |
| 198 | ] | 229 | ] |
| @@ -204,7 +235,8 @@ | @@ -204,7 +235,8 @@ | ||
| 204 | { | 235 | { |
| 205 | "name": "default", | 236 | "name": "default", |
| 206 | "applyToProducts": [ | 237 | "applyToProducts": [ |
| 207 | - "default" | 238 | + "default", |
| 239 | + "productRELEASE" | ||
| 208 | ] | 240 | ] |
| 209 | } | 241 | } |
| 210 | ] | 242 | ] |
| @@ -216,7 +248,8 @@ | @@ -216,7 +248,8 @@ | ||
| 216 | { | 248 | { |
| 217 | "name": "default", | 249 | "name": "default", |
| 218 | "applyToProducts": [ | 250 | "applyToProducts": [ |
| 219 | - "default" | 251 | + "default", |
| 252 | + "productRELEASE" | ||
| 220 | ] | 253 | ] |
| 221 | } | 254 | } |
| 222 | ] | 255 | ] |
| @@ -228,7 +261,8 @@ | @@ -228,7 +261,8 @@ | ||
| 228 | { | 261 | { |
| 229 | "name": "default", | 262 | "name": "default", |
| 230 | "applyToProducts": [ | 263 | "applyToProducts": [ |
| 231 | - "default" | 264 | + "default", |
| 265 | + "productRELEASE" | ||
| 232 | ] | 266 | ] |
| 233 | } | 267 | } |
| 234 | ] | 268 | ] |
| @@ -240,7 +274,8 @@ | @@ -240,7 +274,8 @@ | ||
| 240 | { | 274 | { |
| 241 | "name": "default", | 275 | "name": "default", |
| 242 | "applyToProducts": [ | 276 | "applyToProducts": [ |
| 243 | - "default" | 277 | + "default", |
| 278 | + "productRELEASE" | ||
| 244 | ] | 279 | ] |
| 245 | } | 280 | } |
| 246 | ] | 281 | ] |
| @@ -252,7 +287,8 @@ | @@ -252,7 +287,8 @@ | ||
| 252 | { | 287 | { |
| 253 | "name": "default", | 288 | "name": "default", |
| 254 | "applyToProducts": [ | 289 | "applyToProducts": [ |
| 255 | - "default" | 290 | + "default", |
| 291 | + "productRELEASE" | ||
| 256 | ] | 292 | ] |
| 257 | } | 293 | } |
| 258 | ] | 294 | ] |
| @@ -264,7 +300,8 @@ | @@ -264,7 +300,8 @@ | ||
| 264 | { | 300 | { |
| 265 | "name": "default", | 301 | "name": "default", |
| 266 | "applyToProducts": [ | 302 | "applyToProducts": [ |
| 267 | - "default" | 303 | + "default", |
| 304 | + "productRELEASE" | ||
| 268 | ] | 305 | ] |
| 269 | } | 306 | } |
| 270 | ] | 307 | ] |
| @@ -276,7 +313,8 @@ | @@ -276,7 +313,8 @@ | ||
| 276 | { | 313 | { |
| 277 | "name": "default", | 314 | "name": "default", |
| 278 | "applyToProducts": [ | 315 | "applyToProducts": [ |
| 279 | - "default" | 316 | + "default", |
| 317 | + "productRELEASE" | ||
| 280 | ] | 318 | ] |
| 281 | } | 319 | } |
| 282 | ] | 320 | ] |
| @@ -5,6 +5,7 @@ export class BridgeUtil { | @@ -5,6 +5,7 @@ export class BridgeUtil { | ||
| 5 | static readonly YY_OVERRIDE_SCHEMA = "yy://"; | 5 | static readonly YY_OVERRIDE_SCHEMA = "yy://"; |
| 6 | static readonly YY_RETURN_DATA = BridgeUtil.YY_OVERRIDE_SCHEMA + "return/"; | 6 | static readonly YY_RETURN_DATA = BridgeUtil.YY_OVERRIDE_SCHEMA + "return/"; |
| 7 | static readonly YY_FETCH_QUEUE = BridgeUtil.YY_RETURN_DATA + "_fetchQueue/"; | 7 | static readonly YY_FETCH_QUEUE = BridgeUtil.YY_RETURN_DATA + "_fetchQueue/"; |
| 8 | + static readonly BRIDGE_LOADED_MSG = "__bridge_loaded__"; | ||
| 8 | static readonly EMPTY_STR = ""; | 9 | static readonly EMPTY_STR = ""; |
| 9 | static readonly UNDERLINE_STR = "_"; | 10 | static readonly UNDERLINE_STR = "_"; |
| 10 | static readonly SPLIT_MARK = "/"; | 11 | static readonly SPLIT_MARK = "/"; |
| @@ -12,6 +12,7 @@ export class H5CallNativeType { | @@ -12,6 +12,7 @@ export class H5CallNativeType { | ||
| 12 | static jsCall_receiveH5Data = 'jsCall_receiveH5Data' | 12 | static jsCall_receiveH5Data = 'jsCall_receiveH5Data' |
| 13 | static jsCall_getAppLoginAuthInfo = 'jsCall_getAppLoginAuthInfo' | 13 | static jsCall_getAppLoginAuthInfo = 'jsCall_getAppLoginAuthInfo' |
| 14 | static jsCall_appNotifyEvent = 'jsCall_appNotifyEvent' | 14 | static jsCall_appNotifyEvent = 'jsCall_appNotifyEvent' |
| 15 | + static jsCall_receiveSubjectData = 'jsCall_receiveSubjectData' | ||
| 15 | 16 | ||
| 16 | // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 | 17 | // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 |
| 17 | 18 | ||
| @@ -24,6 +25,7 @@ export class H5CallNativeType { | @@ -24,6 +25,7 @@ export class H5CallNativeType { | ||
| 24 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveH5Data) | 25 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveH5Data) |
| 25 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppLoginAuthInfo) | 26 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppLoginAuthInfo) |
| 26 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appNotifyEvent) | 27 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appNotifyEvent) |
| 28 | + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveSubjectData) | ||
| 27 | } | 29 | } |
| 28 | } | 30 | } |
| 29 | 31 |
| @@ -17,6 +17,7 @@ export struct WdWebComponent { | @@ -17,6 +17,7 @@ export struct WdWebComponent { | ||
| 17 | @Prop webUrl: string = '' | 17 | @Prop webUrl: string = '' |
| 18 | @Prop @Watch('onReloadStateChanged') reload: number = 0 | 18 | @Prop @Watch('onReloadStateChanged') reload: number = 0 |
| 19 | @Link isPageEnd: boolean | 19 | @Link isPageEnd: boolean |
| 20 | + @State subjectData : string = '' | ||
| 20 | 21 | ||
| 21 | build() { | 22 | build() { |
| 22 | Column() { | 23 | Column() { |
| @@ -36,19 +37,7 @@ export struct WdWebComponent { | @@ -36,19 +37,7 @@ export struct WdWebComponent { | ||
| 36 | }) | 37 | }) |
| 37 | .onLoadIntercept((event) => { | 38 | .onLoadIntercept((event) => { |
| 38 | let url: string = event.data.getRequestUrl().toString() | 39 | let url: string = event.data.getRequestUrl().toString() |
| 39 | - url = url.replace("%(?![0-9a-fA-F]{2})", "%25") | ||
| 40 | - .replace("\\+", "%2B"); | ||
| 41 | - url = decodeURIComponent(url) | ||
| 42 | - if (url.startsWith(BridgeUtil.YY_RETURN_DATA)) { | ||
| 43 | - this.webviewControl.handlerReturnData(url) | ||
| 44 | - return true | ||
| 45 | - } | ||
| 46 | - if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) { | ||
| 47 | - Logger.debug(TAG, 'flushMessageQueue'); | ||
| 48 | - this.webviewControl.flushMessageQueue() | ||
| 49 | - return true | ||
| 50 | - } | ||
| 51 | - return this.onLoadIntercept(event.data.getRequestUrl().toString()); | 40 | + return this.onLoadIntercept(url); |
| 52 | }) | 41 | }) |
| 53 | } | 42 | } |
| 54 | } | 43 | } |
| @@ -60,6 +49,7 @@ export struct WdWebComponent { | @@ -60,6 +49,7 @@ export struct WdWebComponent { | ||
| 60 | let handle = (data: Message, f: Callback) => { | 49 | let handle = (data: Message, f: Callback) => { |
| 61 | Logger.debug('registerHandlers handlerName: ' + JSON.stringify(data)) | 50 | Logger.debug('registerHandlers handlerName: ' + JSON.stringify(data)) |
| 62 | this.defaultPerformJSCallNative(data, f) | 51 | this.defaultPerformJSCallNative(data, f) |
| 52 | + this.defaultGetReceiveSubjectData(data, f) | ||
| 63 | }; | 53 | }; |
| 64 | this.webviewControl.registerHandler(handleName, { handle: handle }); | 54 | this.webviewControl.registerHandler(handleName, { handle: handle }); |
| 65 | } | 55 | } |
| @@ -71,21 +61,42 @@ export struct WdWebComponent { | @@ -71,21 +61,42 @@ export struct WdWebComponent { | ||
| 71 | private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => { | 61 | private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => { |
| 72 | performJSCallNative(data, f) | 62 | performJSCallNative(data, f) |
| 73 | } | 63 | } |
| 64 | + | ||
| 65 | + /** | ||
| 66 | + */ | ||
| 67 | + private defaultGetReceiveSubjectData: (data: Message, f: Callback) => void = (data: Message, f: Callback) => { | ||
| 68 | + if(data.handlerName === H5CallNativeType.jsCall_receiveSubjectData) { | ||
| 69 | + f('') | ||
| 70 | + } | ||
| 71 | + } | ||
| 74 | onPageBegin: (url?: string) => void = () => { | 72 | onPageBegin: (url?: string) => void = () => { |
| 75 | Logger.debug(TAG, 'onPageBegin'); | 73 | Logger.debug(TAG, 'onPageBegin'); |
| 76 | this.registerHandlers(); | 74 | this.registerHandlers(); |
| 77 | - //有时序问题 必须延时执行 | ||
| 78 | - setTimeout(() => { | ||
| 79 | - BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | ||
| 80 | - }, 200) | ||
| 81 | } | 75 | } |
| 82 | onPageEnd: (url?: string) => void = () => { | 76 | onPageEnd: (url?: string) => void = () => { |
| 83 | Logger.debug(TAG, 'onPageEnd'); | 77 | Logger.debug(TAG, 'onPageEnd'); |
| 84 | this.onWebPrepared() | 78 | this.onWebPrepared() |
| 85 | this.isPageEnd = true | 79 | this.isPageEnd = true |
| 86 | } | 80 | } |
| 87 | - onLoadIntercept: (url?: string) => boolean = () => { | ||
| 88 | - Logger.debug(TAG, 'onLoadIntercept return false'); | 81 | + onLoadIntercept: (url: string) => boolean = (url: string) => { |
| 82 | + Logger.debug(TAG, 'onLoadIntercept'); | ||
| 83 | + url = url.replace("%(?![0-9a-fA-F]{2})", "%25") | ||
| 84 | + .replace("\\+", "%2B"); | ||
| 85 | + url = decodeURIComponent(url) | ||
| 86 | + if (url.startsWith(BridgeUtil.YY_RETURN_DATA)) { | ||
| 87 | + this.webviewControl.handlerReturnData(url) | ||
| 88 | + return true | ||
| 89 | + } | ||
| 90 | + if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) { | ||
| 91 | + Logger.debug(TAG, 'flushMessageQueue'); | ||
| 92 | + this.webviewControl.flushMessageQueue() | ||
| 93 | + return true | ||
| 94 | + } | ||
| 95 | + if (url.includes(BridgeUtil.BRIDGE_LOADED_MSG)) { | ||
| 96 | + // jsBridge load通知,注入js | ||
| 97 | + BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | ||
| 98 | + return true | ||
| 99 | + } | ||
| 89 | return false | 100 | return false |
| 90 | } | 101 | } |
| 91 | onReloadStateChanged() { | 102 | onReloadStateChanged() { |
| @@ -22,6 +22,7 @@ export struct SpacialTopicPageComponent { | @@ -22,6 +22,7 @@ export struct SpacialTopicPageComponent { | ||
| 22 | scroller: Scroller = new Scroller(); | 22 | scroller: Scroller = new Scroller(); |
| 23 | action: Action = {} as Action | 23 | action: Action = {} as Action |
| 24 | @State webUrl: string = ''; | 24 | @State webUrl: string = ''; |
| 25 | + @State subjectData: string = ''; | ||
| 25 | @State isPageEnd: boolean = false | 26 | @State isPageEnd: boolean = false |
| 26 | @Prop reload: number = 0; | 27 | @Prop reload: number = 0; |
| 27 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 28 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| @@ -57,6 +58,36 @@ export struct SpacialTopicPageComponent { | @@ -57,6 +58,36 @@ export struct SpacialTopicPageComponent { | ||
| 57 | let context = getContext(this) as common.UIAbilityContext; | 58 | let context = getContext(this) as common.UIAbilityContext; |
| 58 | viewBlogItemInsightIntentShare(context,this.contentDetailData) | 59 | viewBlogItemInsightIntentShare(context,this.contentDetailData) |
| 59 | } | 60 | } |
| 61 | + async getWebviewPageData (){ | ||
| 62 | + let pageId = this.action.params?.extra?.pageId | ||
| 63 | + let relId: string = '' | ||
| 64 | + let relType: string = '' | ||
| 65 | + let contentId: string = '' | ||
| 66 | + if (this.action && this.action.params) { | ||
| 67 | + if (this.action.params.contentID) { | ||
| 68 | + contentId = this.action.params.contentID; | ||
| 69 | + } | ||
| 70 | + if (this.action && this.action.params && this.action.params.extra) { | ||
| 71 | + if (this.action.params.extra.relId) { | ||
| 72 | + relId = this.action.params.extra.relId; | ||
| 73 | + } | ||
| 74 | + if (this.action.params.extra.relType) { | ||
| 75 | + relType = this.action.params.extra.relType | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + if(pageId){ | ||
| 80 | + // let pageInfoMsg = await PageRepository.fetchMorningEveningPageInfo(pageId) | ||
| 81 | + // let pageCompInfoMsg = await PageRepository.fetchMorningEveningCompInfo(Number(pageId), groupId, refreshTime, topicId, 1, 20) | ||
| 82 | + // let res = { | ||
| 83 | + // dataJson: { | ||
| 84 | + // pageInfoResponseMap: pageInfoMsg, | ||
| 85 | + // compInfoResponseMap: pageCompInfoMsg, | ||
| 86 | + // }, | ||
| 87 | + // } | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + | ||
| 60 | 91 | ||
| 61 | private async getDetail() { | 92 | private async getDetail() { |
| 62 | this.isNetConnected = NetworkUtil.isNetConnected() | 93 | this.isNetConnected = NetworkUtil.isNetConnected() |
| @@ -93,12 +124,17 @@ export struct SpacialTopicPageComponent { | @@ -93,12 +124,17 @@ export struct SpacialTopicPageComponent { | ||
| 93 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | 124 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') |
| 94 | this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | 125 | this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') |
| 95 | // } | 126 | // } |
| 96 | - this.trySendData2H5() | 127 | + this.subjectData = 'dasdasdadas' |
| 128 | + | ||
| 129 | + //TODO | ||
| 130 | + // this.trySendData2H5() | ||
| 97 | } | 131 | } |
| 98 | if(pageInfoMsg && pageInfoMsg.data){ | 132 | if(pageInfoMsg && pageInfoMsg.data){ |
| 99 | this.contentDetailData.openComment = Number(pageInfoMsg.data.topicInfo.commentFlag) | 133 | this.contentDetailData.openComment = Number(pageInfoMsg.data.topicInfo.commentFlag) |
| 100 | this.contentDetailData.commentDisplay = Number(pageInfoMsg.data.topicInfo.commentShowFlag) | 134 | this.contentDetailData.commentDisplay = Number(pageInfoMsg.data.topicInfo.commentShowFlag) |
| 101 | } | 135 | } |
| 136 | + | ||
| 137 | + console.log('contentDetailData',this.contentDetailData) | ||
| 102 | } | 138 | } |
| 103 | } | 139 | } |
| 104 | } | 140 | } |
| @@ -115,14 +151,16 @@ export struct SpacialTopicPageComponent { | @@ -115,14 +151,16 @@ export struct SpacialTopicPageComponent { | ||
| 115 | .textAlign(TextAlign.Center) | 151 | .textAlign(TextAlign.Center) |
| 116 | .fontWeight(500) | 152 | .fontWeight(500) |
| 117 | .visibility(this.action?.params?.backVisibility && this.isPageEnd ? Visibility.Visible : Visibility.None) | 153 | .visibility(this.action?.params?.backVisibility && this.isPageEnd ? Visibility.Visible : Visibility.None) |
| 118 | - | ||
| 119 | - WdWebComponent({ | ||
| 120 | - webviewControl: this.webviewControl, | ||
| 121 | - webUrl: this.webUrl, | ||
| 122 | - reload: this.reload, | ||
| 123 | - onWebPrepared: this.onWebPrepared.bind(this), | ||
| 124 | - isPageEnd: $isPageEnd, | ||
| 125 | - }) | 154 | + if(this.subjectData.length > 0){ |
| 155 | + WdWebComponent({ | ||
| 156 | + webviewControl: this.webviewControl, | ||
| 157 | + webUrl: this.webUrl, | ||
| 158 | + reload: this.reload, | ||
| 159 | + onWebPrepared: this.onWebPrepared.bind(this), | ||
| 160 | + isPageEnd: $isPageEnd, | ||
| 161 | + subjectData: this.subjectData | ||
| 162 | + }) | ||
| 163 | + } | ||
| 126 | } | 164 | } |
| 127 | .width(CommonConstants.FULL_WIDTH) | 165 | .width(CommonConstants.FULL_WIDTH) |
| 128 | .height(CommonConstants.FULL_HEIGHT) | 166 | .height(CommonConstants.FULL_HEIGHT) |
| @@ -11,6 +11,7 @@ import font from '@ohos.font'; | @@ -11,6 +11,7 @@ import font from '@ohos.font'; | ||
| 11 | * 视频:点播图标+时长;直播图标+'直播中' | 11 | * 视频:点播图标+时长;直播图标+'直播中' |
| 12 | */ | 12 | */ |
| 13 | @Component | 13 | @Component |
| 14 | +@Reusable | ||
| 14 | export struct CardMediaInfo { | 15 | export struct CardMediaInfo { |
| 15 | 16 | ||
| 16 | @State livePeopleNum :boolean = true | 17 | @State livePeopleNum :boolean = true |
| @@ -33,6 +34,16 @@ export struct CardMediaInfo { | @@ -33,6 +34,16 @@ export struct CardMediaInfo { | ||
| 33 | }) | 34 | }) |
| 34 | } | 35 | } |
| 35 | 36 | ||
| 37 | + aboutToReuse(params: Record<string, object>): void { | ||
| 38 | + this.contentDTO = params.contentDTO as ContentDTO | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + aboutToRecycle(): void { | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + aboutToDisappear(): void { | ||
| 45 | + } | ||
| 46 | + | ||
| 36 | /** | 47 | /** |
| 37 | * 全域数字显示规则 | 48 | * 全域数字显示规则 |
| 38 | * 1、当数量为千位以內时,显示数字,不保留小数点,比如 4585 | 49 | * 1、当数量为千位以內时,显示数字,不保留小数点,比如 4585 |
| 1 | import { CompDTO, ContentDTO } from 'wdBean' | 1 | import { CompDTO, ContentDTO } from 'wdBean' |
| 2 | import { CommonConstants } from 'wdConstant/Index'; | 2 | import { CommonConstants } from 'wdConstant/Index'; |
| 3 | import { DateTimeUtils } from 'wdKit/Index'; | 3 | import { DateTimeUtils } from 'wdKit/Index'; |
| 4 | -import { JSON } from '@kit.ArkTS'; | ||
| 5 | import router from '@ohos.router' | 4 | import router from '@ohos.router' |
| 6 | 5 | ||
| 6 | +@Reusable | ||
| 7 | @Component | 7 | @Component |
| 8 | export struct CardSourceInfo { | 8 | export struct CardSourceInfo { |
| 9 | @State contentDTO: ContentDTO = new ContentDTO(); | 9 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 10 | @ObjectLink compDTO: CompDTO | 10 | @ObjectLink compDTO: CompDTO |
| 11 | 11 | ||
| 12 | aboutToAppear(): void { | 12 | aboutToAppear(): void { |
| 13 | + } | ||
| 14 | + | ||
| 15 | + aboutToReuse(params: Record<string, object>): void { | ||
| 16 | + this.contentDTO = params.contentDTO as ContentDTO | ||
| 17 | + } | ||
| 13 | 18 | ||
| 19 | + aboutToRecycle(): void { | ||
| 14 | } | 20 | } |
| 15 | 21 | ||
| 22 | + aboutToDisappear(): void { | ||
| 23 | + } | ||
| 16 | handleTimeStr() { | 24 | handleTimeStr() { |
| 17 | return DateTimeUtils.getCommentTime( | 25 | return DateTimeUtils.getCommentTime( |
| 18 | this.contentDTO.publishTime.includes(' ') | 26 | this.contentDTO.publishTime.includes(' ') |
| @@ -4,7 +4,7 @@ import PageModel from '../../viewmodel/PageModel'; | @@ -4,7 +4,7 @@ import PageModel from '../../viewmodel/PageModel'; | ||
| 4 | import { CommonConstants, ViewType } from 'wdConstant' | 4 | import { CommonConstants, ViewType } from 'wdConstant' |
| 5 | import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent' | 5 | import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent' |
| 6 | import { ErrorComponent } from '../view/ErrorComponent' | 6 | import { ErrorComponent } from '../view/ErrorComponent' |
| 7 | -import { CompDTO, ContentDTO } from 'wdBean' | 7 | +import { CompDTO, ContentDTO, contentListParams,contentListItem } from 'wdBean' |
| 8 | import NoMoreLayout from './NoMoreLayout' | 8 | import NoMoreLayout from './NoMoreLayout' |
| 9 | import { CustomSelectUI } from '../view/CustomSelectUI'; | 9 | import { CustomSelectUI } from '../view/CustomSelectUI'; |
| 10 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | 10 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; |
| @@ -149,16 +149,13 @@ struct MyCollectionListPage { | @@ -149,16 +149,13 @@ struct MyCollectionListPage { | ||
| 149 | .margin({left:16}) | 149 | .margin({left:16}) |
| 150 | } | 150 | } |
| 151 | Column() { | 151 | Column() { |
| 152 | - BigPicCardComponent({compDTO:new CompDTO,contentDTO:compDTO}) | 152 | + BigPicCardComponent({compDTO:new CompDTO,contentDTO:compDTO,pageId:TrackConstants.PageName.My_Collect,pageName:TrackConstants.PageName.My_Collect}) |
| 153 | } | 153 | } |
| 154 | }.onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => { | 154 | }.onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => { |
| 155 | if (isVisible) { | 155 | if (isVisible) { |
| 156 | TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.My_Collect,TrackConstants.PageName.My_Collect, TrackParamConvert.program(compDTO)) | 156 | TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.My_Collect,TrackConstants.PageName.My_Collect, TrackParamConvert.program(compDTO)) |
| 157 | } | 157 | } |
| 158 | }) | 158 | }) |
| 159 | - // .onClick(()=>{ | ||
| 160 | - // TrackingContent.common(TrackConstants.EventType.Click, TrackConstants.PageName.My_Collect,TrackConstants.PageName.My_Collect, TrackParamConvert.program(compDTO)) | ||
| 161 | - // }) | ||
| 162 | } | 159 | } |
| 163 | 160 | ||
| 164 | 161 | ||
| @@ -262,4 +259,12 @@ struct MyCollectionListPage { | @@ -262,4 +259,12 @@ struct MyCollectionListPage { | ||
| 262 | } | 259 | } |
| 263 | } | 260 | } |
| 264 | 261 | ||
| 262 | + getContentData(){ | ||
| 263 | + for (let index = 0; index < this.allDatas.length; index++) { | ||
| 264 | + const compDTO = this.allDatas[index]; | ||
| 265 | + compDTO.isCollection = true ///用于时间展示 | ||
| 266 | + this.allDatas.push(compDTO) | ||
| 267 | + } | ||
| 268 | + } | ||
| 269 | + | ||
| 265 | } | 270 | } |
| @@ -76,6 +76,7 @@ export struct PageComponent { | @@ -76,6 +76,7 @@ export struct PageComponent { | ||
| 76 | onActionEnd(this.pageModel, this.pageAdvModel) | 76 | onActionEnd(this.pageModel, this.pageAdvModel) |
| 77 | }) | 77 | }) |
| 78 | ) | 78 | ) |
| 79 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) | ||
| 79 | 80 | ||
| 80 | } | 81 | } |
| 81 | 82 |
| @@ -15,6 +15,8 @@ const TAG: string = 'BigPicCardComponent'; | @@ -15,6 +15,8 @@ const TAG: string = 'BigPicCardComponent'; | ||
| 15 | @Component | 15 | @Component |
| 16 | export struct BigPicCardComponent { | 16 | export struct BigPicCardComponent { |
| 17 | @ObjectLink compDTO: CompDTO | 17 | @ObjectLink compDTO: CompDTO |
| 18 | + @State pageId: string = ''; | ||
| 19 | + @State pageName: string = ''; | ||
| 18 | contentDTO: ContentDTO = new ContentDTO(); | 20 | contentDTO: ContentDTO = new ContentDTO(); |
| 19 | 21 | ||
| 20 | aboutToAppear() { | 22 | aboutToAppear() { |
| @@ -110,7 +112,7 @@ export struct BigPicCardComponent { | @@ -110,7 +112,7 @@ export struct BigPicCardComponent { | ||
| 110 | 112 | ||
| 111 | @Builder | 113 | @Builder |
| 112 | cardBuild() { | 114 | cardBuild() { |
| 113 | - CardParser({ compDTO: this.compDTO, contentDTO: this.contentDTO }); | 115 | + CardParser({ compDTO: this.compDTO, contentDTO: this.contentDTO,pageId:this.pageId,pageName:this.pageName}); |
| 114 | } | 116 | } |
| 115 | } | 117 | } |
| 116 | 118 |
| 1 | import { ContentDetailDTO, LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index' | 1 | import { ContentDetailDTO, LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index' |
| 2 | -import { EmptyComponent, ErrorComponent, WDViewDefaultType } from 'wdComponent/Index' | 2 | +import { CustomPullToRefresh, EmptyComponent, ErrorComponent, WDViewDefaultType } from 'wdComponent/Index' |
| 3 | import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout' | 3 | import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout' |
| 4 | import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout' | 4 | import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout' |
| 5 | import { RefreshLayoutBean } from 'wdComponent/src/main/ets/components/page/RefreshLayoutBean' | 5 | import { RefreshLayoutBean } from 'wdComponent/src/main/ets/components/page/RefreshLayoutBean' |
| @@ -7,8 +7,10 @@ import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel' | @@ -7,8 +7,10 @@ import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel' | ||
| 7 | import { ViewType } from 'wdConstant/Index' | 7 | import { ViewType } from 'wdConstant/Index' |
| 8 | import { LiveViewModel } from '../../viewModel/LiveViewModel' | 8 | import { LiveViewModel } from '../../viewModel/LiveViewModel' |
| 9 | import { TabChatItemComponent } from './TabChatItemComponent' | 9 | import { TabChatItemComponent } from './TabChatItemComponent' |
| 10 | -import { EmitterEventId, EmitterUtils, Logger } from 'wdKit'; | 10 | +import { EmitterEventId, EmitterUtils, LazyDataSource, Logger } from 'wdKit'; |
| 11 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel' | 11 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel' |
| 12 | +import { PeopleShipNoMoreData } from 'wdComponent/src/main/ets/components/reusable/PeopleShipNoMoreData' | ||
| 13 | +import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout' | ||
| 12 | 14 | ||
| 13 | const TAG: string = 'TabChatComponent'; | 15 | const TAG: string = 'TabChatComponent'; |
| 14 | 16 | ||
| @@ -20,13 +22,15 @@ const TAG: string = 'TabChatComponent'; | @@ -20,13 +22,15 @@ const TAG: string = 'TabChatComponent'; | ||
| 20 | export struct TabChatComponent { | 22 | export struct TabChatComponent { |
| 21 | @State private pageModel: PageModel = new PageModel() | 23 | @State private pageModel: PageModel = new PageModel() |
| 22 | liveViewModel: LiveViewModel = new LiveViewModel() | 24 | liveViewModel: LiveViewModel = new LiveViewModel() |
| 23 | - @State liveChatList: Array<LiveRoomItemBean> = [] | 25 | + @State liveChatList: LazyDataSource<LiveRoomItemBean> = new LazyDataSource(); |
| 26 | + | ||
| 27 | + // @State liveList: LazyDataSource<LiveRoomItemBean> = new LazyDataSource(); | ||
| 24 | @Consume contentDetailData: ContentDetailDTO | 28 | @Consume contentDetailData: ContentDetailDTO |
| 25 | @Consume publishCommentModel: publishCommentModel | 29 | @Consume publishCommentModel: publishCommentModel |
| 26 | @Prop @Watch("lastInputedCommentChanged") lastInputedComment: LiveRoomItemBean | 30 | @Prop @Watch("lastInputedCommentChanged") lastInputedComment: LiveRoomItemBean |
| 27 | - | 31 | + private scroller: Scroller = new Scroller() |
| 28 | aboutToAppear(): void { | 32 | aboutToAppear(): void { |
| 29 | - this.getLiveChatList() | 33 | + this.getLiveList() |
| 30 | 34 | ||
| 31 | //注册通知 | 35 | //注册通知 |
| 32 | EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, async (targetId?: string) => { | 36 | EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, async (targetId?: string) => { |
| @@ -62,7 +66,20 @@ export struct TabChatComponent { | @@ -62,7 +66,20 @@ export struct TabChatComponent { | ||
| 62 | } else if (this.pageModel.viewType == ViewType.EMPTY) { | 66 | } else if (this.pageModel.viewType == ViewType.EMPTY) { |
| 63 | EmptyComponent({ emptyType: WDViewDefaultType.WDViewDefaultType_NoComment1 }) | 67 | EmptyComponent({ emptyType: WDViewDefaultType.WDViewDefaultType_NoComment1 }) |
| 64 | } else { | 68 | } else { |
| 65 | - this.ListLayout() | 69 | + // this.ListLayout() |
| 70 | + | ||
| 71 | + CustomPullToRefresh({ | ||
| 72 | + alldata: this.liveChatList, | ||
| 73 | + scroller: this.scroller, | ||
| 74 | + hasMore: false, | ||
| 75 | + customList: () => { | ||
| 76 | + this.ListLayout() | ||
| 77 | + }, | ||
| 78 | + onRefresh: (resolve) => { | ||
| 79 | + this.pageModel.currentPage = 1 | ||
| 80 | + this.getLiveList(resolve) | ||
| 81 | + }, | ||
| 82 | + }) | ||
| 66 | } | 83 | } |
| 67 | } | 84 | } |
| 68 | .align(Alignment.Top) | 85 | .align(Alignment.Top) |
| @@ -73,32 +90,33 @@ export struct TabChatComponent { | @@ -73,32 +90,33 @@ export struct TabChatComponent { | ||
| 73 | 90 | ||
| 74 | @Builder | 91 | @Builder |
| 75 | ListLayout() { | 92 | ListLayout() { |
| 76 | - List() { | ||
| 77 | - ListItem() { | ||
| 78 | - // 下拉刷新 TODO 待对接新的下拉刷新组件 | ||
| 79 | - // RefreshLayout({ | ||
| 80 | - // refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage, | ||
| 81 | - // this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) | ||
| 82 | - // }) | ||
| 83 | - } | 93 | + List({ scroller: this.scroller }) { |
| 84 | 94 | ||
| 85 | - ForEach(this.liveChatList, (item: LiveRoomItemBean) => { | 95 | + LazyForEach(this.liveChatList, (item: LiveRoomItemBean) => { |
| 86 | ListItem() { | 96 | ListItem() { |
| 87 | TabChatItemComponent({ item: item }) | 97 | TabChatItemComponent({ item: item }) |
| 88 | } | 98 | } |
| 89 | - }) | 99 | + }, |
| 100 | + (item: LiveRoomItemBean, contentIndex: number) => JSON.stringify(item) | ||
| 101 | + ) | ||
| 90 | // 加载更多 | 102 | // 加载更多 |
| 91 | - // ListItem() { | ||
| 92 | - // if (this.pageModel.hasMore) { | ||
| 93 | - // LoadMoreLayout({ | ||
| 94 | - // refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage, | ||
| 95 | - // this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight) | ||
| 96 | - // }) | ||
| 97 | - // } else { | ||
| 98 | - // ListHasNoMoreDataUI() | ||
| 99 | - // } | ||
| 100 | - // } | ||
| 101 | - } | 103 | + ListItem() { |
| 104 | + if (this.pageModel.hasMore && this.liveChatList && this.liveChatList.totalCount() > 0) { | ||
| 105 | + LoadMoreLayout({ isVisible: this.pageModel.hasMore }) | ||
| 106 | + } else if (!this.pageModel.hasMore && !this.pageModel.isLoading) { | ||
| 107 | + PeopleShipNoMoreData() | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + } .edgeEffect(EdgeEffect.None) | ||
| 111 | + .scrollBar(BarState.Off) | ||
| 112 | + .onReachEnd(() => { | ||
| 113 | + Logger.debug(TAG, "触底了"); | ||
| 114 | + if (!this.pageModel.isLoading && this.pageModel.hasMore) { | ||
| 115 | + //加载分页数据 | ||
| 116 | + //this.currentPage++; | ||
| 117 | + this.getLiveList() | ||
| 118 | + } | ||
| 119 | + }) | ||
| 102 | } | 120 | } |
| 103 | 121 | ||
| 104 | @Builder | 122 | @Builder |
| @@ -109,7 +127,16 @@ export struct TabChatComponent { | @@ -109,7 +127,16 @@ export struct TabChatComponent { | ||
| 109 | }) | 127 | }) |
| 110 | } | 128 | } |
| 111 | 129 | ||
| 112 | - getLiveChatList() { | 130 | + async getLiveList(resolve?: (value: string | PromiseLike<string>) => void) { |
| 131 | + | ||
| 132 | + if (this.pageModel.isLoading) { | ||
| 133 | + | ||
| 134 | + if (resolve) { | ||
| 135 | + resolve('已更新至最新') | ||
| 136 | + } | ||
| 137 | + return | ||
| 138 | + } | ||
| 139 | + this.pageModel.isLoading = true | ||
| 113 | this.pageModel.currentPage = 1 | 140 | this.pageModel.currentPage = 1 |
| 114 | this.liveViewModel.getLiveChatList( | 141 | this.liveViewModel.getLiveChatList( |
| 115 | this.pageModel.currentPage, | 142 | this.pageModel.currentPage, |
| @@ -118,6 +145,17 @@ export struct TabChatComponent { | @@ -118,6 +145,17 @@ export struct TabChatComponent { | ||
| 118 | 20,) | 145 | 20,) |
| 119 | .then( | 146 | .then( |
| 120 | (data) => { | 147 | (data) => { |
| 148 | + this.pageModel.isLoading = false | ||
| 149 | + if (resolve) { | ||
| 150 | + if (this.pageModel.currentPage == 1) { | ||
| 151 | + resolve('已更新至最新') | ||
| 152 | + } else { | ||
| 153 | + resolve('') | ||
| 154 | + } | ||
| 155 | + } | ||
| 156 | + if(this.pageModel.currentPage ===1){ | ||
| 157 | + this.liveChatList.clear() | ||
| 158 | + } | ||
| 121 | Logger.debug(TAG, `${JSON.stringify(data)}`) | 159 | Logger.debug(TAG, `${JSON.stringify(data)}`) |
| 122 | if (data.barrageResponses && data.barrageResponses.length > 0) { | 160 | if (data.barrageResponses && data.barrageResponses.length > 0) { |
| 123 | this.pageModel.viewType = ViewType.LOADED; | 161 | this.pageModel.viewType = ViewType.LOADED; |
| @@ -135,6 +135,9 @@ export struct TabLiveComponent { | @@ -135,6 +135,9 @@ export struct TabLiveComponent { | ||
| 135 | resolve('') | 135 | resolve('') |
| 136 | } | 136 | } |
| 137 | } | 137 | } |
| 138 | + if(this.pageModel.currentPage ===1){ | ||
| 139 | + this.liveList.clear() | ||
| 140 | + } | ||
| 138 | Logger.debug(TAG, '直播间数据:' + `${JSON.stringify(data)}`) | 141 | Logger.debug(TAG, '直播间数据:' + `${JSON.stringify(data)}`) |
| 139 | if (data.barrageResponses && data.barrageResponses.length > 0) { | 142 | if (data.barrageResponses && data.barrageResponses.length > 0) { |
| 140 | /** | 143 | /** |
| @@ -146,9 +149,6 @@ export struct TabLiveComponent { | @@ -146,9 +149,6 @@ export struct TabLiveComponent { | ||
| 146 | 3.内容:详情接口的简介,newIntroduction | 149 | 3.内容:详情接口的简介,newIntroduction |
| 147 | */ | 150 | */ |
| 148 | this.pageModel.viewType = ViewType.LOADED; | 151 | this.pageModel.viewType = ViewType.LOADED; |
| 149 | - if(this.pageModel.currentPage ===1){ | ||
| 150 | - this.liveList.clear() | ||
| 151 | - } | ||
| 152 | 152 | ||
| 153 | this.liveList.push(...data.barrageResponses) | 153 | this.liveList.push(...data.barrageResponses) |
| 154 | if (data.barrageResponses.length === this.pageModel.pageSize) { | 154 | if (data.barrageResponses.length === this.pageModel.pageSize) { |
| 1 | -import { ContentDetailDTO, LiveDetailsBean } from 'wdBean/Index'; | 1 | +import { ContentDetailDTO } from 'wdBean/Index'; |
| 2 | import { Logger, StringUtils } from 'wdKit/Index'; | 2 | import { Logger, StringUtils } from 'wdKit/Index'; |
| 3 | import { PlayerConstants, WDAliPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; | 3 | import { PlayerConstants, WDAliPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; |
| 4 | import { PlayUIComponent } from './PlayUIComponent'; | 4 | import { PlayUIComponent } from './PlayUIComponent'; |
| 5 | import { PictureLoading } from '../../vertical/PictureLoading'; | 5 | import { PictureLoading } from '../../vertical/PictureLoading'; |
| 6 | -import { ParamType, TrackConstants } from 'wdTracking/Index'; | 6 | +import { TrackConstants } from 'wdTracking/Index'; |
| 7 | 7 | ||
| 8 | const TAG: string = 'TopPlayComponent' | 8 | const TAG: string = 'TopPlayComponent' |
| 9 | 9 | ||
| @@ -25,7 +25,7 @@ export struct TopPlayComponent { | @@ -25,7 +25,7 @@ export struct TopPlayComponent { | ||
| 25 | //播放错误 | 25 | //播放错误 |
| 26 | @State isError: boolean = false | 26 | @State isError: boolean = false |
| 27 | // loading 控制字段 | 27 | // loading 控制字段 |
| 28 | - @State isLoading: boolean = false | 28 | + @State isHideLoading: boolean = false |
| 29 | // 获取播放资源能播放了 | 29 | // 获取播放资源能播放了 |
| 30 | @State isCanPlay: boolean = false | 30 | @State isCanPlay: boolean = false |
| 31 | // 当前播放资源的状态 | 31 | // 当前播放资源的状态 |
| @@ -38,7 +38,7 @@ export struct TopPlayComponent { | @@ -38,7 +38,7 @@ export struct TopPlayComponent { | ||
| 38 | 38 | ||
| 39 | this.playerController.onCanplay = () => { | 39 | this.playerController.onCanplay = () => { |
| 40 | this.isCanPlay = true | 40 | this.isCanPlay = true |
| 41 | - this.isLoading = true | 41 | + this.isHideLoading = true |
| 42 | this.playerController?.play() | 42 | this.playerController?.play() |
| 43 | } | 43 | } |
| 44 | 44 | ||
| @@ -48,7 +48,7 @@ export struct TopPlayComponent { | @@ -48,7 +48,7 @@ export struct TopPlayComponent { | ||
| 48 | Logger.debug(TAG, 'status==>' + status) | 48 | Logger.debug(TAG, 'status==>' + status) |
| 49 | if (status === PlayerConstants.STATUS_ERROR) { | 49 | if (status === PlayerConstants.STATUS_ERROR) { |
| 50 | this.isError = true | 50 | this.isError = true |
| 51 | - this.isLoading = true | 51 | + this.isHideLoading = true |
| 52 | this.isCanPlay = false | 52 | this.isCanPlay = false |
| 53 | } else if (status === PlayerConstants.STATUS_COMPLETION) { | 53 | } else if (status === PlayerConstants.STATUS_COMPLETION) { |
| 54 | // 播放完成 | 54 | // 播放完成 |
| @@ -66,8 +66,9 @@ export struct TopPlayComponent { | @@ -66,8 +66,9 @@ export struct TopPlayComponent { | ||
| 66 | * 更新直播播放数据 | 66 | * 更新直播播放数据 |
| 67 | */ | 67 | */ |
| 68 | updateData() { | 68 | updateData() { |
| 69 | - // 检测等待中的直播预告是否视频资源 | 69 | + // 检测直播等待状态的直播预告是否视频资源 |
| 70 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewType === 1 | 70 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewType === 1 |
| 71 | + && this.contentDetailData?.liveInfo?.liveState == 'wait' | ||
| 71 | && this.contentDetailData.liveInfo.previewUrl && | 72 | && this.contentDetailData.liveInfo.previewUrl && |
| 72 | this.contentDetailData.liveInfo.previewUrl.length > 0) { | 73 | this.contentDetailData.liveInfo.previewUrl.length > 0) { |
| 73 | // 预告资源是视频 | 74 | // 预告资源是视频 |
| @@ -78,7 +79,6 @@ export struct TopPlayComponent { | @@ -78,7 +79,6 @@ export struct TopPlayComponent { | ||
| 78 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl && | 79 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl && |
| 79 | this.contentDetailData.liveInfo.previewUrl.length > 0) { | 80 | this.contentDetailData.liveInfo.previewUrl.length > 0) { |
| 80 | this.previewUrl = this.contentDetailData.liveInfo.previewUrl | 81 | this.previewUrl = this.contentDetailData.liveInfo.previewUrl |
| 81 | - | ||
| 82 | } else if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) { | 82 | } else if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) { |
| 83 | this.previewUrl = this.contentDetailData.fullColumnImgUrls[0].url | 83 | this.previewUrl = this.contentDetailData.fullColumnImgUrls[0].url |
| 84 | } | 84 | } |
| @@ -87,18 +87,17 @@ export struct TopPlayComponent { | @@ -87,18 +87,17 @@ export struct TopPlayComponent { | ||
| 87 | 87 | ||
| 88 | if (this.isVideoSource) { | 88 | if (this.isVideoSource) { |
| 89 | this.isWait = false | 89 | this.isWait = false |
| 90 | - this.isLoading = false | 90 | + this.isHideLoading = false |
| 91 | } else { | 91 | } else { |
| 92 | this.isWait = this.contentDetailData?.liveInfo?.liveState == 'wait' | 92 | this.isWait = this.contentDetailData?.liveInfo?.liveState == 'wait' |
| 93 | if (this.isWait) { | 93 | if (this.isWait) { |
| 94 | - this.isLoading = true | 94 | + this.isHideLoading = true |
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | this.isEnd = this.contentDetailData?.liveInfo?.liveState === 'end' && | 98 | this.isEnd = this.contentDetailData?.liveInfo?.liveState === 'end' && |
| 99 | StringUtils.isEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri) | 99 | StringUtils.isEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri) |
| 100 | 100 | ||
| 101 | - // Logger.debug(TAG, `---0------>` + this.isWait + ' ->' + this.isLoading + ' ->' + this.isEnd) | ||
| 102 | if (!this.isWait) { | 101 | if (!this.isWait) { |
| 103 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.vlive.length > 0) { | 102 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.vlive.length > 0) { |
| 104 | let playUrl = '' | 103 | let playUrl = '' |
| @@ -114,31 +113,38 @@ export struct TopPlayComponent { | @@ -114,31 +113,38 @@ export struct TopPlayComponent { | ||
| 114 | } else { | 113 | } else { |
| 115 | Logger.debug(TAG, `---0------>${playUrl}`) | 114 | Logger.debug(TAG, `---0------>${playUrl}`) |
| 116 | if (StringUtils.isNotEmpty(playUrl)) { | 115 | if (StringUtils.isNotEmpty(playUrl)) { |
| 116 | + Logger.debug(TAG, `---isNotEmpty------>`) | ||
| 117 | this.playUrl = playUrl | 117 | this.playUrl = playUrl |
| 118 | this.tryToPlay() | 118 | this.tryToPlay() |
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| 121 | } else { | 121 | } else { |
| 122 | this.isWait = true | 122 | this.isWait = true |
| 123 | - this.isLoading = true | 123 | + this.isHideLoading = true |
| 124 | } | 124 | } |
| 125 | } | 125 | } |
| 126 | + // 直播结束 | ||
| 127 | + if (this.contentDetailData?.liveInfo?.liveState === 'end') { | ||
| 128 | + this.isHideLoading = !StringUtils.isNotEmpty(this.playUrl) | ||
| 129 | + this.isWait = !StringUtils.isNotEmpty(this.playUrl) | ||
| 130 | + } | ||
| 131 | + | ||
| 126 | 132 | ||
| 127 | // 文字直播 running 状态 | 133 | // 文字直播 running 状态 |
| 128 | if (this.contentDetailData?.liveInfo?.liveWay === 1 && this.contentDetailData?.liveInfo?.liveState === 'running') { | 134 | if (this.contentDetailData?.liveInfo?.liveWay === 1 && this.contentDetailData?.liveInfo?.liveState === 'running') { |
| 129 | this.isWait = true | 135 | this.isWait = true |
| 130 | - this.isLoading = true | 136 | + this.isHideLoading = true |
| 131 | if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) { | 137 | if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) { |
| 132 | this.previewUrl = this.contentDetailData.fullColumnImgUrls[0].url | 138 | this.previewUrl = this.contentDetailData.fullColumnImgUrls[0].url |
| 133 | } else { | 139 | } else { |
| 134 | this.previewUrl = '' | 140 | this.previewUrl = '' |
| 135 | } | 141 | } |
| 136 | } | 142 | } |
| 137 | - | 143 | + // Logger.debug(TAG, `---0------>` + this.isWait + ' ->' + this.isHideLoading + ' ->' + this.isEnd+' -->'+this.isVideoSource) |
| 138 | } | 144 | } |
| 139 | 145 | ||
| 140 | tryToPlay() { | 146 | tryToPlay() { |
| 141 | - Logger.debug(TAG, `---1------>`) | 147 | + |
| 142 | if (!this.xComponentIsLoaded) { | 148 | if (!this.xComponentIsLoaded) { |
| 143 | Logger.debug(TAG, "需要xComponent加载完成") | 149 | Logger.debug(TAG, "需要xComponent加载完成") |
| 144 | return | 150 | return |
| @@ -161,11 +167,13 @@ export struct TopPlayComponent { | @@ -161,11 +167,13 @@ export struct TopPlayComponent { | ||
| 161 | WDPlayerRenderLiveView({ | 167 | WDPlayerRenderLiveView({ |
| 162 | playerController: this.playerController, | 168 | playerController: this.playerController, |
| 163 | onLoad: async () => { | 169 | onLoad: async () => { |
| 164 | - this.isLoading = false | ||
| 165 | - this.isError = false | ||
| 166 | - this.xComponentIsLoaded = true | ||
| 167 | - Logger.debug(TAG, `---onLoad------>`) | ||
| 168 | - this.tryToPlay() | 170 | + if (StringUtils.isNotEmpty(this.playUrl)) { |
| 171 | + this.isHideLoading = false | ||
| 172 | + this.isError = false | ||
| 173 | + this.xComponentIsLoaded = true | ||
| 174 | + Logger.debug(TAG, `---onLoad------>`) | ||
| 175 | + this.tryToPlay() | ||
| 176 | + } | ||
| 169 | } | 177 | } |
| 170 | }) | 178 | }) |
| 171 | .height('100%') | 179 | .height('100%') |
| @@ -180,12 +188,13 @@ export struct TopPlayComponent { | @@ -180,12 +188,13 @@ export struct TopPlayComponent { | ||
| 180 | .objectFit(ImageFit.Cover) | 188 | .objectFit(ImageFit.Cover) |
| 181 | .alt($r('app.media.live_room_image_fail')) | 189 | .alt($r('app.media.live_room_image_fail')) |
| 182 | .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None) | 190 | .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None) |
| 183 | - .contrast(this.isEnd ? 0.2 : 1) | 191 | + // .contrast(this.isEnd ? 0.4 : 1) |
| 192 | + .blur(this.isEnd ? 20 : 0) | ||
| 184 | .width('100%') | 193 | .width('100%') |
| 185 | } | 194 | } |
| 186 | 195 | ||
| 187 | // loading | 196 | // loading |
| 188 | - PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible) | 197 | + PictureLoading().visibility(this.isHideLoading ? Visibility.None : Visibility.Visible) |
| 189 | 198 | ||
| 190 | // 视频播放器上的控制面板和信息 | 199 | // 视频播放器上的控制面板和信息 |
| 191 | PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay, liveUrl: this.playUrl }) | 200 | PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay, liveUrl: this.playUrl }) |
| @@ -221,7 +230,7 @@ export struct TopPlayComponent { | @@ -221,7 +230,7 @@ export struct TopPlayComponent { | ||
| 221 | .margin({ top: 16 }) | 230 | .margin({ top: 16 }) |
| 222 | .padding(0) | 231 | .padding(0) |
| 223 | .onClick(() => { | 232 | .onClick(() => { |
| 224 | - this.isLoading = false | 233 | + this.isHideLoading = false |
| 225 | this.isError = false | 234 | this.isError = false |
| 226 | this.xComponentIsLoaded = true | 235 | this.xComponentIsLoaded = true |
| 227 | this.tryToPlay() | 236 | this.tryToPlay() |
| 1 | import { Action } from 'wdBean'; | 1 | import { Action } from 'wdBean'; |
| 2 | import { SpacialTopicPageComponent } from 'wdComponent' | 2 | import { SpacialTopicPageComponent } from 'wdComponent' |
| 3 | -import { CommonConstants } from 'wdConstant' | ||
| 4 | -import { Logger } from 'wdKit' | 3 | +import { CommonConstants, SpConstants } from 'wdConstant' |
| 4 | +import { Logger, SPHelper, StringUtils } from 'wdKit' | ||
| 5 | import router from '@ohos.router'; | 5 | import router from '@ohos.router'; |
| 6 | +import dataPreferences from '@ohos.data.preferences'; | ||
| 6 | import { TrackConstants } from 'wdTracking/Index'; | 7 | import { TrackConstants } from 'wdTracking/Index'; |
| 7 | 8 | ||
| 8 | const TAG = 'SpacialTopicPage'; | 9 | const TAG = 'SpacialTopicPage'; |
| @@ -13,6 +14,18 @@ struct SpacialTopicPage { | @@ -13,6 +14,18 @@ struct SpacialTopicPage { | ||
| 13 | @State action: Action = {} as Action | 14 | @State action: Action = {} as Action |
| 14 | @State reload: number = 0 | 15 | @State reload: number = 0 |
| 15 | @State count: number = 0 | 16 | @State count: number = 0 |
| 17 | + preferences: dataPreferences.Preferences | null = null; | ||
| 18 | + observer = (key: string) => { | ||
| 19 | + if(key == SpConstants.USER_ID){ | ||
| 20 | + if(StringUtils.isEmpty(SPHelper.default.getSync(SpConstants.USER_ID,""))){ | ||
| 21 | + // 未登录 | ||
| 22 | + }else { | ||
| 23 | + // 登录 | ||
| 24 | + this.reload = this.reload + 1 | ||
| 25 | + } | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | + | ||
| 16 | 29 | ||
| 17 | @Provide pageName: string = TrackConstants.PageName.Summary_Detail | 30 | @Provide pageName: string = TrackConstants.PageName.Summary_Detail |
| 18 | @Provide pageId: string = TrackConstants.PageName.Summary_Detail | 31 | @Provide pageId: string = TrackConstants.PageName.Summary_Detail |
| @@ -39,9 +52,16 @@ struct SpacialTopicPage { | @@ -39,9 +52,16 @@ struct SpacialTopicPage { | ||
| 39 | Logger.info(TAG, `aboutToAppearcount:${this.reload}`); | 52 | Logger.info(TAG, `aboutToAppearcount:${this.reload}`); |
| 40 | let action: Action = router.getParams() as Action | 53 | let action: Action = router.getParams() as Action |
| 41 | this.action = action | 54 | this.action = action |
| 55 | + this.addLoginStatusObserver() | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + async addLoginStatusObserver(){ | ||
| 59 | + this.preferences = await SPHelper.default.getPreferences(); | ||
| 60 | + this.preferences.on('change', this.observer); | ||
| 42 | } | 61 | } |
| 43 | onPageShow() { | 62 | onPageShow() { |
| 44 | - this.reload = this.reload + 1 | 63 | + // this.reload = this.reload + 1 |
| 45 | Logger.info(TAG, `onPageShowcount:${this.reload}`); | 64 | Logger.info(TAG, `onPageShowcount:${this.reload}`); |
| 65 | + | ||
| 46 | } | 66 | } |
| 47 | } | 67 | } |
| @@ -74,6 +74,22 @@ struct LaunchAdvertisingPage { | @@ -74,6 +74,22 @@ struct LaunchAdvertisingPage { | ||
| 74 | bottom: 0 | 74 | bottom: 0 |
| 75 | }) | 75 | }) |
| 76 | 76 | ||
| 77 | + if (this.defaultModel.isAd === '1'){ | ||
| 78 | + Stack({alignContent:Alignment.TopStart}){ | ||
| 79 | + Text('广告') | ||
| 80 | + .fontColor(Color.White) | ||
| 81 | + .textAlign(TextAlign.Center) | ||
| 82 | + .fontSize('24lpx') | ||
| 83 | + .width('72lpx') | ||
| 84 | + .height('36lpx') | ||
| 85 | + .borderRadius(2) | ||
| 86 | + .margin({top:'15lpx',left:'19lpx'}) | ||
| 87 | + .backgroundColor('#80000000') | ||
| 88 | + } | ||
| 89 | + .width('100%') | ||
| 90 | + .height('100%') | ||
| 91 | + } | ||
| 92 | + | ||
| 77 | Stack({alignContent:Alignment.TopEnd}){ | 93 | Stack({alignContent:Alignment.TopEnd}){ |
| 78 | Button(){ | 94 | Button(){ |
| 79 | Text(this.time + 's 跳过') | 95 | Text(this.time + 's 跳过') |
| @@ -95,22 +111,6 @@ struct LaunchAdvertisingPage { | @@ -95,22 +111,6 @@ struct LaunchAdvertisingPage { | ||
| 95 | .width('100%') | 111 | .width('100%') |
| 96 | .height('100%') | 112 | .height('100%') |
| 97 | 113 | ||
| 98 | - if (this.defaultModel.isAd === '1'){ | ||
| 99 | - Stack({alignContent:Alignment.TopStart}){ | ||
| 100 | - Text('广告') | ||
| 101 | - .fontColor(Color.White) | ||
| 102 | - .textAlign(TextAlign.Center) | ||
| 103 | - .fontSize('24lpx') | ||
| 104 | - .width('72lpx') | ||
| 105 | - .height('36lpx') | ||
| 106 | - .borderRadius(2) | ||
| 107 | - .margin({top:'15lpx',left:'19lpx'}) | ||
| 108 | - .backgroundColor('#80000000') | ||
| 109 | - } | ||
| 110 | - .width('100%') | ||
| 111 | - .height('100%') | ||
| 112 | - } | ||
| 113 | - | ||
| 114 | if(this.defaultModel.screenType != '2'){ | 114 | if(this.defaultModel.screenType != '2'){ |
| 115 | //底部logo样式 按钮加载在背景展示图上 | 115 | //底部logo样式 按钮加载在背景展示图上 |
| 116 | Button(){ | 116 | Button(){ |
| @@ -126,7 +126,6 @@ export struct VideoChannelPage { | @@ -126,7 +126,6 @@ export struct VideoChannelPage { | ||
| 126 | .width('100%') | 126 | .width('100%') |
| 127 | 127 | ||
| 128 | .justifyContent(FlexAlign.Center) | 128 | .justifyContent(FlexAlign.Center) |
| 129 | - .backgroundColor(this.currentTopNavSelectedIndex === 0 ? Color.Transparent : Color.White) | ||
| 130 | 129 | ||
| 131 | // 搜索按钮 | 130 | // 搜索按钮 |
| 132 | Row() { | 131 | Row() { |
| @@ -180,7 +179,7 @@ export struct VideoChannelPage { | @@ -180,7 +179,7 @@ export struct VideoChannelPage { | ||
| 180 | channelId: item.channelId + '', | 179 | channelId: item.channelId + '', |
| 181 | autoRefresh: this.autoRefresh | 180 | autoRefresh: this.autoRefresh |
| 182 | }) | 181 | }) |
| 183 | - .margin({ top: 40 }) | 182 | + .padding({ top: 55 }) |
| 184 | .backgroundColor(Color.White) | 183 | .backgroundColor(Color.White) |
| 185 | } | 184 | } |
| 186 | }, (item: TopNavDTO) => item.channelId + '') | 185 | }, (item: TopNavDTO) => item.channelId + '') |
-
Please register or login to post a comment