Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: (67 commits) feat:直播频道的tab背景色高度不够 feat:直播间背景图 高斯模糊 feat:进入横屏多路直播-置空-评论预显示禁止直播间,大家聊不支持下拉刷新 feat:直播详情直播间组件刷新清理页面数据 漏提 专题web,修改 组件复用,待调 ref |> 工程target依赖 productRelease ref |> 增加工程配置 productRelease + 发布证书 + 发布profile 视频栏目下视频与直播进行滑动切换时存在一个很明显的黑色背景的骨架图加载残留 -fix bug修复 feat: 17543 功能缺陷-页面加载-信息流图片加载,手机打开仅wifi加载图片控制,进入教育频道,长图图片未显示 -fix bug修复 fix:somobug fix:somobug fix:轮播图卡修改底部样式 feat: 18425 人民号小视频卡展现样式鸿蒙与安卓不一致标题显示的行数未能显示4行 feat: 18453 小视频横滑卡-选择不跳转右滑至卡片结尾不该展示查看更多按钮 feat: 滑动卡片样式 ref |> 增加直播预约更多列表页面的埋点事件 ...
Showing
89 changed files
with
1351 additions
and
668 deletions
Too many changes to show.
To preserve performance only 89 of 89+ files are displayed.
| @@ -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 = "/"; |
| @@ -3,10 +3,13 @@ export struct CustomToast { | @@ -3,10 +3,13 @@ export struct CustomToast { | ||
| 3 | public static LENGTH_LONG = 4000; | 3 | public static LENGTH_LONG = 4000; |
| 4 | public static LENGTH_SHORT = 2000; | 4 | public static LENGTH_SHORT = 2000; |
| 5 | 5 | ||
| 6 | - @State msg: string = "" | 6 | + @State msg: ResourceStr = "" |
| 7 | @State duration: number = CustomToast.LENGTH_SHORT | 7 | @State duration: number = CustomToast.LENGTH_SHORT |
| 8 | @State bgBorderRadius: number = 10 | 8 | @State bgBorderRadius: number = 10 |
| 9 | - | 9 | + opacityValue: number = 0.7 |
| 10 | + bgColor: ResourceColor = $r("app.color.black") | ||
| 11 | + fontSizeValue :number | string | Resource = "27lpx" | ||
| 12 | + lineHeightValue :number | string | Resource = "38lpx" | ||
| 10 | controller: CustomDialogController | 13 | controller: CustomDialogController |
| 11 | 14 | ||
| 12 | dismiss: () => void = () => { | 15 | dismiss: () => void = () => { |
| @@ -27,13 +30,13 @@ export struct CustomToast { | @@ -27,13 +30,13 @@ export struct CustomToast { | ||
| 27 | Text(this.msg) | 30 | Text(this.msg) |
| 28 | .fontWeight(FontWeight.Regular) | 31 | .fontWeight(FontWeight.Regular) |
| 29 | .fontColor($r('app.color.white')) | 32 | .fontColor($r('app.color.white')) |
| 30 | - .fontSize("27lpx") | ||
| 31 | - .lineHeight("38lpx") | 33 | + .fontSize(this.fontSizeValue) |
| 34 | + .lineHeight(this.lineHeightValue) | ||
| 32 | .textAlign(TextAlign.Center) | 35 | .textAlign(TextAlign.Center) |
| 33 | }.borderRadius(`${this.bgBorderRadius}lpx`) | 36 | }.borderRadius(`${this.bgBorderRadius}lpx`) |
| 34 | .constraintSize({maxWidth:"86%"}) | 37 | .constraintSize({maxWidth:"86%"}) |
| 35 | .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"}) | 38 | .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"}) |
| 36 | - .backgroundColor($r("app.color.black")) | ||
| 37 | - .opacity(0.7) | 39 | + .backgroundColor(this.bgColor) |
| 40 | + .opacity(this.opacityValue) | ||
| 38 | } | 41 | } |
| 39 | } | 42 | } |
| @@ -32,8 +32,8 @@ export class HttpBizUtil { | @@ -32,8 +32,8 @@ export class HttpBizUtil { | ||
| 32 | if (!headers) { | 32 | if (!headers) { |
| 33 | headers = new HashMap() | 33 | headers = new HashMap() |
| 34 | } | 34 | } |
| 35 | - headers?.replace('RMRB-X-TOKEN', token) | ||
| 36 | - headers?.replace('cookie', 'RMRB-X-TOKEN=' + token) | 35 | + headers?.set('RMRB-X-TOKEN', token) |
| 36 | + headers?.set('cookie', 'RMRB-X-TOKEN=' + token) | ||
| 37 | Logger.debug(TAG, 'get again send: ' + token) | 37 | Logger.debug(TAG, 'get again send: ' + token) |
| 38 | // refreshToken为空场景不处理,直接请求接口。 | 38 | // refreshToken为空场景不处理,直接请求接口。 |
| 39 | WDHttp.get<T>(url, headers).then((againResDTO: T) => { | 39 | WDHttp.get<T>(url, headers).then((againResDTO: T) => { |
| @@ -71,8 +71,8 @@ export class HttpBizUtil { | @@ -71,8 +71,8 @@ export class HttpBizUtil { | ||
| 71 | if (!headers) { | 71 | if (!headers) { |
| 72 | headers = new HashMap() | 72 | headers = new HashMap() |
| 73 | } | 73 | } |
| 74 | - headers?.replace('RMRB-X-TOKEN', token) | ||
| 75 | - headers?.replace('cookie', 'RMRB-X-TOKEN=' + token) | 74 | + headers?.set('RMRB-X-TOKEN', token) |
| 75 | + headers?.set('cookie', 'RMRB-X-TOKEN=' + token) | ||
| 76 | Logger.debug(TAG, 'post again send: ' + token) | 76 | Logger.debug(TAG, 'post again send: ' + token) |
| 77 | // refreshToken为空场景不处理,直接请求接口。 | 77 | // refreshToken为空场景不处理,直接请求接口。 |
| 78 | WDHttp.post<T>(url, data, headers).then((againResDTO: T) => { | 78 | WDHttp.post<T>(url, data, headers).then((againResDTO: T) => { |
| @@ -166,6 +166,25 @@ export class ProcessUtils { | @@ -166,6 +166,25 @@ export class ProcessUtils { | ||
| 166 | * @param content | 166 | * @param content |
| 167 | * */ | 167 | * */ |
| 168 | public static gotoMultiPictureListPage(photoList: PhotoListBean[], swiperIndex?: number) { | 168 | public static gotoMultiPictureListPage(photoList: PhotoListBean[], swiperIndex?: number) { |
| 169 | + let tempP = [] as PhotoListBean[] | ||
| 170 | + let relIndex = 0; | ||
| 171 | + for (let index = 0; index < photoList.length; index++) { | ||
| 172 | + const element = photoList[index]; | ||
| 173 | + if(!StringUtils.isEmpty(element.picPath)){ | ||
| 174 | + relIndex = relIndex+1 | ||
| 175 | + } | ||
| 176 | + } | ||
| 177 | + tempP.length = relIndex | ||
| 178 | + relIndex = 0 | ||
| 179 | + for (let index = 0; index < photoList.length; index++) { | ||
| 180 | + const element = photoList[index]; | ||
| 181 | + if(!StringUtils.isEmpty(element.picPath)){ | ||
| 182 | + tempP[relIndex] = element | ||
| 183 | + relIndex = relIndex+1 | ||
| 184 | + } | ||
| 185 | + } | ||
| 186 | + photoList.length = tempP.length | ||
| 187 | + photoList = tempP | ||
| 169 | let taskAction: Action = { | 188 | let taskAction: Action = { |
| 170 | type: 'JUMP_DETAIL_PAGE', | 189 | type: 'JUMP_DETAIL_PAGE', |
| 171 | params: { | 190 | params: { |
| @@ -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() { |
| @@ -173,6 +173,7 @@ export { CreatorsBean } from './src/main/ets/bean/content/CreatorsBean'; | @@ -173,6 +173,7 @@ export { CreatorsBean } from './src/main/ets/bean/content/CreatorsBean'; | ||
| 173 | export { MasterDetailRes } from './src/main/ets/bean/user/MasterDetailRes'; | 173 | export { MasterDetailRes } from './src/main/ets/bean/user/MasterDetailRes'; |
| 174 | 174 | ||
| 175 | export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean'; | 175 | export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean'; |
| 176 | +export { PageTrackBean } from './src/main/ets/bean/component/PageTrackBean'; | ||
| 176 | 177 | ||
| 177 | 178 | ||
| 178 | 179 |
| @@ -7,6 +7,7 @@ import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailView | @@ -7,6 +7,7 @@ import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailView | ||
| 7 | import { SpConstants } from 'wdConstant/Index'; | 7 | import { SpConstants } from 'wdConstant/Index'; |
| 8 | import { WDShare } from 'wdShare/Index'; | 8 | import { WDShare } from 'wdShare/Index'; |
| 9 | import { LikeComponent } from './view/LikeComponent' | 9 | import { LikeComponent } from './view/LikeComponent' |
| 10 | +import { TrackConstants } from 'wdTracking/Index'; | ||
| 10 | 11 | ||
| 11 | const TAG = 'CarderInteraction' | 12 | const TAG = 'CarderInteraction' |
| 12 | 13 | ||
| @@ -22,6 +23,8 @@ export struct CarderInteraction { | @@ -22,6 +23,8 @@ export struct CarderInteraction { | ||
| 22 | @State likeBean: Record<string, string> = {} | 23 | @State likeBean: Record<string, string> = {} |
| 23 | @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 24 | @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 24 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 | 25 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 |
| 26 | + @Provide pageName: string = TrackConstants.PageName.DynamicDetail | ||
| 27 | + @Provide pageId: string = TrackConstants.PageName.DynamicDetail | ||
| 25 | 28 | ||
| 26 | async aboutToAppear() { | 29 | async aboutToAppear() { |
| 27 | await this.getContentDetailData() | 30 | await this.getContentDetailData() |
| @@ -46,6 +46,7 @@ export struct CompParser { | @@ -46,6 +46,7 @@ export struct CompParser { | ||
| 46 | 46 | ||
| 47 | 47 | ||
| 48 | console.log('CompParser-compDTO', JSON.stringify(this.compDTO)) | 48 | console.log('CompParser-compDTO', JSON.stringify(this.compDTO)) |
| 49 | + this.pageName = this.pageModel.pageInfo.name | ||
| 49 | // 轮播图屏蔽音频类型稿件 | 50 | // 轮播图屏蔽音频类型稿件 |
| 50 | if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { | 51 | if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { |
| 51 | this.audioItems = this.compDTO.operDataList.filter(item => { | 52 | this.audioItems = this.compDTO.operDataList.filter(item => { |
| @@ -88,7 +89,7 @@ export struct CompParser { | @@ -88,7 +89,7 @@ export struct CompParser { | ||
| 88 | } else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { | 89 | } else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { |
| 89 | if (this.compDTO.operDataList.length > this.audioItems.length) { | 90 | if (this.compDTO.operDataList.length > this.audioItems.length) { |
| 90 | ZhCarouselLayout01({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 91 | ZhCarouselLayout01({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) |
| 91 | - Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) | 92 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 92 | } | 93 | } |
| 93 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && | 94 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && |
| 94 | this.compDTO.imageScale === 2) { // && compDTO.name ==="横划卡" | 95 | this.compDTO.imageScale === 2) { // && compDTO.name ==="横划卡" |
| @@ -37,7 +37,7 @@ export struct ENewspaperItemComponent { | @@ -37,7 +37,7 @@ export struct ENewspaperItemComponent { | ||
| 37 | .onComplete(() => { | 37 | .onComplete(() => { |
| 38 | this.isShowSkeleton = false | 38 | this.isShowSkeleton = false |
| 39 | }) | 39 | }) |
| 40 | - .objectFit(ImageFit.Fill) | 40 | + .objectFit(ImageFit.Contain) |
| 41 | .visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible) | 41 | .visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible) |
| 42 | 42 | ||
| 43 | Canvas(this.context) | 43 | Canvas(this.context) |
| @@ -9,12 +9,16 @@ import font from '@ohos.font'; | @@ -9,12 +9,16 @@ import font from '@ohos.font'; | ||
| 9 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'; | 9 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'; |
| 10 | import { RMCalendarBean } from './calendar/RMCalendarBean'; | 10 | import { RMCalendarBean } from './calendar/RMCalendarBean'; |
| 11 | import { newsSkeleton } from './skeleton/newsSkeleton'; | 11 | import { newsSkeleton } from './skeleton/newsSkeleton'; |
| 12 | -import { Logger, ToastUtils, NetworkUtil } from 'wdKit/Index'; | 12 | +import { Logger, ToastUtils, NetworkUtil, CustomToast } from 'wdKit/Index'; |
| 13 | import { TrackingContent,TrackConstants, TrackingButton } from 'wdTracking/Index'; | 13 | import { TrackingContent,TrackConstants, TrackingButton } from 'wdTracking/Index'; |
| 14 | import { WDShare } from 'wdShare/Index'; | 14 | import { WDShare } from 'wdShare/Index'; |
| 15 | +import { window } from '@kit.ArkUI'; | ||
| 16 | +import { WindowModel } from 'wdKit'; | ||
| 17 | + | ||
| 15 | //电子报UI | 18 | //电子报UI |
| 16 | @Component | 19 | @Component |
| 17 | export struct ENewspaperPageComponent { | 20 | export struct ENewspaperPageComponent { |
| 21 | + private windowClass?: window.Window; | ||
| 18 | private displayTool = display.getDefaultDisplaySync() | 22 | private displayTool = display.getDefaultDisplaySync() |
| 19 | private screenWidth: number = 0 | 23 | private screenWidth: number = 0 |
| 20 | private picWidth: number = 0 | 24 | private picWidth: number = 0 |
| @@ -30,7 +34,27 @@ export struct ENewspaperPageComponent { | @@ -30,7 +34,27 @@ export struct ENewspaperPageComponent { | ||
| 30 | @State selectDate: Date = new Date() | 34 | @State selectDate: Date = new Date() |
| 31 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 35 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 32 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 36 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 37 | + @State ratio: string = '100%' | ||
| 38 | + | ||
| 39 | + @State toastText:ResourceStr = "" | ||
| 40 | + dialogToast: CustomDialogController = new CustomDialogController({ | ||
| 41 | + builder: CustomToast({ | ||
| 42 | + bgColor:$r("app.color.color_B3000000"), | ||
| 43 | + opacityValue:1, | ||
| 44 | + fontSizeValue:"25lpx", | ||
| 45 | + lineHeightValue:"36lpx", | ||
| 46 | + msg: this.toastText, | ||
| 47 | + }), | ||
| 48 | + autoCancel: false, | ||
| 49 | + alignment: DialogAlignment.Center, | ||
| 50 | + customStyle: true, | ||
| 51 | + maskColor:"#00000000" | ||
| 52 | + }) | ||
| 33 | 53 | ||
| 54 | + showToastTip(msg:ResourceStr){ | ||
| 55 | + this.toastText = msg | ||
| 56 | + this.dialogToast.open() | ||
| 57 | + } | ||
| 34 | //watch监听报纸页码回调 | 58 | //watch监听报纸页码回调 |
| 35 | onCurrentPageNumUpdated(): void { | 59 | onCurrentPageNumUpdated(): void { |
| 36 | console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) | 60 | console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) |
| @@ -101,8 +125,12 @@ export struct ENewspaperPageComponent { | @@ -101,8 +125,12 @@ export struct ENewspaperPageComponent { | ||
| 101 | // }) | 125 | // }) |
| 102 | 126 | ||
| 103 | async aboutToAppear() { | 127 | async aboutToAppear() { |
| 128 | + this.windowClass = WindowModel.shared.getWindowClass(); // 获取应用主窗口 | ||
| 129 | + this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width | ||
| 130 | + console.log('ENewspaperPageComponent this.screenWidth', this.screenWidth) | ||
| 131 | + // 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件 | ||
| 132 | + this.ratio = this.screenWidth > 2000 ? '60%' : '100%' | ||
| 104 | //获取宽高尺寸 | 133 | //获取宽高尺寸 |
| 105 | - this.screenWidth = this.displayTool.width | ||
| 106 | this.picWidth = this.screenWidth - vp2px(52) | 134 | this.picWidth = this.screenWidth - vp2px(52) |
| 107 | let screenHeight = this.displayTool.height; | 135 | let screenHeight = this.displayTool.height; |
| 108 | // bottomSafeHeight 底导高度 topSafeHeight 顶导高度 44 顶部高度 60 底部高度 | 136 | // bottomSafeHeight 底导高度 topSafeHeight 顶导高度 44 顶部高度 60 底部高度 |
| @@ -121,6 +149,7 @@ export struct ENewspaperPageComponent { | @@ -121,6 +149,7 @@ export struct ENewspaperPageComponent { | ||
| 121 | }) | 149 | }) |
| 122 | this.getNewspaperTime() | 150 | this.getNewspaperTime() |
| 123 | this.getNewspaperList() | 151 | this.getNewspaperList() |
| 152 | + this.resizeWindow() | ||
| 124 | } | 153 | } |
| 125 | 154 | ||
| 126 | aboutToDisappear() { | 155 | aboutToDisappear() { |
| @@ -130,6 +159,15 @@ export struct ENewspaperPageComponent { | @@ -130,6 +159,15 @@ export struct ENewspaperPageComponent { | ||
| 130 | // if (this.listDialogController) { | 159 | // if (this.listDialogController) { |
| 131 | // this.listDialogController = null | 160 | // this.listDialogController = null |
| 132 | // } | 161 | // } |
| 162 | + this.windowClass?.off('windowSizeChange'); | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + resizeWindow() { | ||
| 166 | + this.windowClass?.on('windowSizeChange', () => { | ||
| 167 | + this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width || this.displayTool.width | ||
| 168 | + // 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件 | ||
| 169 | + this.ratio = this.screenWidth > 2000 ? '60%' : '100%' | ||
| 170 | + }); | ||
| 133 | } | 171 | } |
| 134 | 172 | ||
| 135 | build() { | 173 | build() { |
| @@ -216,8 +254,9 @@ export struct ENewspaperPageComponent { | @@ -216,8 +254,9 @@ export struct ENewspaperPageComponent { | ||
| 216 | ENewspaperItemComponent({ newspaperListItemBean: item}) | 254 | ENewspaperItemComponent({ newspaperListItemBean: item}) |
| 217 | }) | 255 | }) |
| 218 | } | 256 | } |
| 257 | + .itemSpace(10) | ||
| 219 | .index(this.swiperIndex) | 258 | .index(this.swiperIndex) |
| 220 | - .width('100%') | 259 | + .width(this.ratio) |
| 221 | // newspaper_shadow 44 高度 e_newspaper_content 35 margin top | 260 | // newspaper_shadow 44 高度 e_newspaper_content 35 margin top |
| 222 | .height(px2vp(this.picHeight) - 44 - 35) | 261 | .height(px2vp(this.picHeight) - 44 - 35) |
| 223 | .vertical(true) | 262 | .vertical(true) |
| @@ -303,7 +342,7 @@ export struct ENewspaperPageComponent { | @@ -303,7 +342,7 @@ export struct ENewspaperPageComponent { | ||
| 303 | .id('e_newspaper_page_num') | 342 | .id('e_newspaper_page_num') |
| 304 | .onClick((event: ClickEvent) => { | 343 | .onClick((event: ClickEvent) => { |
| 305 | if(!NetworkUtil.isNetConnected()){ | 344 | if(!NetworkUtil.isNetConnected()){ |
| 306 | - ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | 345 | + this.showToastTip('网络出小差了,请检查网络后重试') |
| 307 | return | 346 | return |
| 308 | } | 347 | } |
| 309 | if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { | 348 | if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { |
| @@ -314,7 +353,7 @@ export struct ENewspaperPageComponent { | @@ -314,7 +353,7 @@ export struct ENewspaperPageComponent { | ||
| 314 | this.pageDialogController.close() | 353 | this.pageDialogController.close() |
| 315 | } | 354 | } |
| 316 | }else { | 355 | }else { |
| 317 | - ToastUtils.showToast('暂无数据', 1000) | 356 | + this.showToastTip('暂无数据') |
| 318 | } | 357 | } |
| 319 | }) | 358 | }) |
| 320 | 359 | ||
| @@ -342,7 +381,7 @@ export struct ENewspaperPageComponent { | @@ -342,7 +381,7 @@ export struct ENewspaperPageComponent { | ||
| 342 | .id('e_newspaper_read') | 381 | .id('e_newspaper_read') |
| 343 | .onClick((event: ClickEvent) => { | 382 | .onClick((event: ClickEvent) => { |
| 344 | if(!NetworkUtil.isNetConnected()){ | 383 | if(!NetworkUtil.isNetConnected()){ |
| 345 | - ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | 384 | + this.showToastTip('网络出小差了,请检查网络后重试') |
| 346 | return | 385 | return |
| 347 | } | 386 | } |
| 348 | if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { | 387 | if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { |
| @@ -356,7 +395,7 @@ export struct ENewspaperPageComponent { | @@ -356,7 +395,7 @@ export struct ENewspaperPageComponent { | ||
| 356 | 'currentNumber':this.swiperIndex, | 395 | 'currentNumber':this.swiperIndex, |
| 357 | }) | 396 | }) |
| 358 | }else { | 397 | }else { |
| 359 | - ToastUtils.showToast('暂无数据', 1000) | 398 | + this.showToastTip('暂无数据') |
| 360 | } | 399 | } |
| 361 | }) | 400 | }) |
| 362 | } | 401 | } |
| @@ -394,7 +433,7 @@ export struct ENewspaperPageComponent { | @@ -394,7 +433,7 @@ export struct ENewspaperPageComponent { | ||
| 394 | let listBean = await NewspaperViewModel.getNewspaperList(this.calendarDate, this.picWidth + 'x' + this.picHeight) | 433 | let listBean = await NewspaperViewModel.getNewspaperList(this.calendarDate, this.picWidth + 'x' + this.picHeight) |
| 395 | this.newspaperListBean = listBean; | 434 | this.newspaperListBean = listBean; |
| 396 | } else { | 435 | } else { |
| 397 | - ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | 436 | + this.showToastTip('网络出小差了,请检查网络后重试') |
| 398 | } | 437 | } |
| 399 | } catch (exception) { | 438 | } catch (exception) { |
| 400 | 439 |
| 1 | import { FeedBackParams, FeedbackTypeBean, PhotoListBean } from 'wdBean/Index'; | 1 | import { FeedBackParams, FeedbackTypeBean, PhotoListBean } from 'wdBean/Index'; |
| 2 | import { AppUtils, | 2 | import { AppUtils, |
| 3 | + CustomToast, | ||
| 3 | DateTimeUtils, | 4 | DateTimeUtils, |
| 4 | DeviceUtil, | 5 | DeviceUtil, |
| 5 | - FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'; | 6 | + FastClickUtil, Logger, NetworkUtil, StringUtils, UserDataLocal } from 'wdKit/Index'; |
| 6 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 7 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 7 | import { CustomTitleUI } from './reusable/CustomTitleUI' | 8 | import { CustomTitleUI } from './reusable/CustomTitleUI' |
| 8 | import { picker } from '@kit.CoreFileKit'; | 9 | import { picker } from '@kit.CoreFileKit'; |
| @@ -38,6 +39,21 @@ export struct FeedBackActivity { | @@ -38,6 +39,21 @@ export struct FeedBackActivity { | ||
| 38 | addPic: PhotoListBean = {itemType:1} as PhotoListBean | 39 | addPic: PhotoListBean = {itemType:1} as PhotoListBean |
| 39 | @State pics: PhotoListBean[] = [this.addPic] as PhotoListBean[] | 40 | @State pics: PhotoListBean[] = [this.addPic] as PhotoListBean[] |
| 40 | 41 | ||
| 42 | + @State toastText:ResourceStr = "" | ||
| 43 | + dialogToast: CustomDialogController = new CustomDialogController({ | ||
| 44 | + builder: CustomToast({ | ||
| 45 | + bgColor:$r("app.color.color_B3000000"), | ||
| 46 | + opacityValue:1, | ||
| 47 | + fontSizeValue:"25lpx", | ||
| 48 | + lineHeightValue:"36lpx", | ||
| 49 | + msg: this.toastText, | ||
| 50 | + }), | ||
| 51 | + autoCancel: false, | ||
| 52 | + alignment: DialogAlignment.Center, | ||
| 53 | + customStyle: true, | ||
| 54 | + maskColor:"#00000000" | ||
| 55 | + }) | ||
| 56 | + | ||
| 41 | async aboutToAppear() { | 57 | async aboutToAppear() { |
| 42 | await this.getContentDetailData() | 58 | await this.getContentDetailData() |
| 43 | } | 59 | } |
| @@ -124,7 +140,7 @@ export struct FeedBackActivity { | @@ -124,7 +140,7 @@ export struct FeedBackActivity { | ||
| 124 | if(value.length> 500){ | 140 | if(value.length> 500){ |
| 125 | //隐藏键盘 | 141 | //隐藏键盘 |
| 126 | inputMethod.getController().stopInputSession(); | 142 | inputMethod.getController().stopInputSession(); |
| 127 | - ToastUtils.shortToast($r('app.string.res_feedback_commentsFail')) | 143 | + this.showToastTip($r('app.string.res_feedback_commentsFail')) |
| 128 | // Logger.debug(TAG, "onChange > 500 " + value) | 144 | // Logger.debug(TAG, "onChange > 500 " + value) |
| 129 | this.editValue = {classifyName:value.substring(0,500)} as FeedbackTypeBean | 145 | this.editValue = {classifyName:value.substring(0,500)} as FeedbackTypeBean |
| 130 | }else{ | 146 | }else{ |
| @@ -285,9 +301,10 @@ export struct FeedBackActivity { | @@ -285,9 +301,10 @@ export struct FeedBackActivity { | ||
| 285 | } | 301 | } |
| 286 | this.reportCommit() | 302 | this.reportCommit() |
| 287 | }) | 303 | }) |
| 288 | - .margin({bottom:20}) | 304 | + .margin({bottom:64}) |
| 305 | + } | ||
| 289 | } | 306 | } |
| 290 | - }.margin({bottom:20}) | 307 | + // .margin({bottom:64}) |
| 291 | } | 308 | } |
| 292 | .backgroundColor($r('app.color.color_fff')) | 309 | .backgroundColor($r('app.color.color_fff')) |
| 293 | } | 310 | } |
| @@ -408,13 +425,13 @@ export struct FeedBackActivity { | @@ -408,13 +425,13 @@ export struct FeedBackActivity { | ||
| 408 | }) | 425 | }) |
| 409 | }else{ | 426 | }else{ |
| 410 | // | 427 | // |
| 411 | - ToastUtils.shortToast($r('app.string.feedback_opinion_type')) | 428 | + this.showToastTip($r('app.string.feedback_opinion_type')) |
| 412 | TrackingButton.click('feedbackPageSubmitFeedback',TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage) | 429 | TrackingButton.click('feedbackPageSubmitFeedback',TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage) |
| 413 | return | 430 | return |
| 414 | } | 431 | } |
| 415 | //内容必填 | 432 | //内容必填 |
| 416 | if(StringUtils.isEmpty(this.editValue.classifyName) || this.editValue.classifyName.length < 10 || this.editValue.classifyName.length>500){ | 433 | if(StringUtils.isEmpty(this.editValue.classifyName) || this.editValue.classifyName.length < 10 || this.editValue.classifyName.length>500){ |
| 417 | - ToastUtils.shortToast($r('app.string.res_feedback_commentsFail')) | 434 | + this.showToastTip($r('app.string.res_feedback_commentsFail')) |
| 418 | return | 435 | return |
| 419 | } | 436 | } |
| 420 | 437 | ||
| @@ -457,4 +474,9 @@ export struct FeedBackActivity { | @@ -457,4 +474,9 @@ export struct FeedBackActivity { | ||
| 457 | TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000)) | 474 | TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000)) |
| 458 | 475 | ||
| 459 | } | 476 | } |
| 477 | + | ||
| 478 | + showToastTip(msg:ResourceStr){ | ||
| 479 | + this.toastText = msg | ||
| 480 | + this.dialogToast.open() | ||
| 481 | + } | ||
| 460 | } | 482 | } |
| @@ -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,15 +151,17 @@ export struct SpacialTopicPageComponent { | @@ -115,15 +151,17 @@ 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 | - | 154 | + if(this.subjectData.length > 0){ |
| 119 | WdWebComponent({ | 155 | WdWebComponent({ |
| 120 | webviewControl: this.webviewControl, | 156 | webviewControl: this.webviewControl, |
| 121 | webUrl: this.webUrl, | 157 | webUrl: this.webUrl, |
| 122 | reload: this.reload, | 158 | reload: this.reload, |
| 123 | onWebPrepared: this.onWebPrepared.bind(this), | 159 | onWebPrepared: this.onWebPrepared.bind(this), |
| 124 | isPageEnd: $isPageEnd, | 160 | isPageEnd: $isPageEnd, |
| 161 | + subjectData: this.subjectData | ||
| 125 | }) | 162 | }) |
| 126 | } | 163 | } |
| 164 | + } | ||
| 127 | .width(CommonConstants.FULL_WIDTH) | 165 | .width(CommonConstants.FULL_WIDTH) |
| 128 | .height(CommonConstants.FULL_HEIGHT) | 166 | .height(CommonConstants.FULL_HEIGHT) |
| 129 | .padding({ bottom: this.action?.params?.backVisibility ? 115 : 75 }) | 167 | .padding({ bottom: this.action?.params?.backVisibility ? 115 : 75 }) |
| @@ -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(' ') |
| @@ -219,7 +219,8 @@ struct createImg { | @@ -219,7 +219,8 @@ struct createImg { | ||
| 219 | }) { | 219 | }) { |
| 220 | Image(this.loadImg ? item.fullUrl : '') | 220 | Image(this.loadImg ? item.fullUrl : '') |
| 221 | .backgroundColor(0xf5f5f5) | 221 | .backgroundColor(0xf5f5f5) |
| 222 | - .width('100%') | 222 | + .width(113) |
| 223 | + .height(113) | ||
| 223 | .autoResize(true) | 224 | .autoResize(true) |
| 224 | .borderRadius(this.caclImageRadius(index)) | 225 | .borderRadius(this.caclImageRadius(index)) |
| 225 | .opacity(!item.weight && !item.height ? 0 : 1) | 226 | .opacity(!item.weight && !item.height ? 0 : 1) |
| @@ -233,6 +234,8 @@ struct createImg { | @@ -233,6 +234,8 @@ struct createImg { | ||
| 233 | Image(this.loadImg ? item.fullUrl : '') | 234 | Image(this.loadImg ? item.fullUrl : '') |
| 234 | .backgroundColor(0xf5f5f5) | 235 | .backgroundColor(0xf5f5f5) |
| 235 | .aspectRatio(1) | 236 | .aspectRatio(1) |
| 237 | + .width(113) | ||
| 238 | + .height(113) | ||
| 236 | .borderRadius(this.caclImageRadius(index)) | 239 | .borderRadius(this.caclImageRadius(index)) |
| 237 | if(this.getPicType(item.weight, item.height) !== 3){ | 240 | if(this.getPicType(item.weight, item.height) !== 3){ |
| 238 | Flex({ direction: FlexDirection.Row }) { | 241 | Flex({ direction: FlexDirection.Row }) { |
| @@ -88,7 +88,7 @@ export struct Card6Component { | @@ -88,7 +88,7 @@ export struct Card6Component { | ||
| 88 | .fontSize(18) | 88 | .fontSize(18) |
| 89 | .lineHeight(27) | 89 | .lineHeight(27) |
| 90 | .fontWeight(FontWeight.Normal) | 90 | .fontWeight(FontWeight.Normal) |
| 91 | - .maxLines(2) | 91 | + .maxLines(this.contentDTO.appStyle === '6' ? 5 : 2) |
| 92 | .alignSelf(ItemAlign.Start) | 92 | .alignSelf(ItemAlign.Start) |
| 93 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 93 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 |
| 94 | .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && | 94 | .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && |
| @@ -107,7 +107,7 @@ export struct Card6Component { | @@ -107,7 +107,7 @@ export struct Card6Component { | ||
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | .alignItems(HorizontalAlign.Start) | 109 | .alignItems(HorizontalAlign.Start) |
| 110 | - .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78: 156) | 110 | + .height(78) |
| 111 | 111 | ||
| 112 | 112 | ||
| 113 | .justifyContent(FlexAlign.SpaceBetween) | 113 | .justifyContent(FlexAlign.SpaceBetween) |
| @@ -119,7 +119,7 @@ export struct Card6Component { | @@ -119,7 +119,7 @@ export struct Card6Component { | ||
| 119 | .backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5) | 119 | .backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5) |
| 120 | .borderRadius(5) | 120 | .borderRadius(5) |
| 121 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) | 121 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) |
| 122 | - .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156) | 122 | + .height(78) |
| 123 | CardMediaInfo({ contentDTO: this.contentDTO }) | 123 | CardMediaInfo({ contentDTO: this.contentDTO }) |
| 124 | } | 124 | } |
| 125 | 125 | ||
| @@ -138,7 +138,7 @@ export struct Card6Component { | @@ -138,7 +138,7 @@ export struct Card6Component { | ||
| 138 | }) | 138 | }) |
| 139 | 139 | ||
| 140 | .width(CommonConstants.FULL_WIDTH) | 140 | .width(CommonConstants.FULL_WIDTH) |
| 141 | - // .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 107 : 217) | 141 | + .height(106) |
| 142 | .justifyContent(FlexAlign.SpaceBetween) | 142 | .justifyContent(FlexAlign.SpaceBetween) |
| 143 | .alignItems(VerticalAlign.Top) | 143 | .alignItems(VerticalAlign.Top) |
| 144 | } | 144 | } |
| @@ -11,6 +11,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | @@ -11,6 +11,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 11 | import NoMoreLayout from '../../page/NoMoreLayout'; | 11 | import NoMoreLayout from '../../page/NoMoreLayout'; |
| 12 | import { EmptyComponent } from '../../view/EmptyComponent'; | 12 | import { EmptyComponent } from '../../view/EmptyComponent'; |
| 13 | import { ContentDetailDTO, Params } from 'wdBean/Index'; | 13 | import { ContentDetailDTO, Params } from 'wdBean/Index'; |
| 14 | +import { TrackingContent, TrackParamConvert } from 'wdTracking/Index'; | ||
| 14 | 15 | ||
| 15 | const TAG = 'CommentComponent'; | 16 | const TAG = 'CommentComponent'; |
| 16 | 17 | ||
| @@ -31,6 +32,8 @@ export struct CommentComponent { | @@ -31,6 +32,8 @@ export struct CommentComponent { | ||
| 31 | /*必传*/ | 32 | /*必传*/ |
| 32 | @ObjectLink publishCommentModel: publishCommentModel | 33 | @ObjectLink publishCommentModel: publishCommentModel |
| 33 | @Consume contentDetailData: ContentDetailDTO | 34 | @Consume contentDetailData: ContentDetailDTO |
| 35 | + @Consume pageId: string | ||
| 36 | + @Consume pageName: string | ||
| 34 | listScroller: ListScroller = new ListScroller(); // scroller控制器 | 37 | listScroller: ListScroller = new ListScroller(); // scroller控制器 |
| 35 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset | 38 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset |
| 36 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); | 39 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); |
| @@ -66,6 +69,9 @@ export struct CommentComponent { | @@ -66,6 +69,9 @@ export struct CommentComponent { | ||
| 66 | 69 | ||
| 67 | this.dialogController = new CustomDialogController({ | 70 | this.dialogController = new CustomDialogController({ |
| 68 | builder: CommentCustomDialog({ | 71 | builder: CommentCustomDialog({ |
| 72 | + onPublishBtnClickTrack: () => { | ||
| 73 | + TrackingContent.commentClick(this.pageId, this.pageName, TrackParamConvert.contentDetail(this.contentDetailData)) | ||
| 74 | + }, | ||
| 69 | confirm: (value: Record<string, string>) => { | 75 | confirm: (value: Record<string, string>) => { |
| 70 | this.addCommentLocal() | 76 | this.addCommentLocal() |
| 71 | }, | 77 | }, |
| @@ -222,6 +228,7 @@ export struct CommentComponent { | @@ -222,6 +228,7 @@ export struct CommentComponent { | ||
| 222 | } | 228 | } |
| 223 | } | 229 | } |
| 224 | } | 230 | } |
| 231 | + .scrollBar(BarState.Off) | ||
| 225 | .margin({ bottom: 10 }) | 232 | .margin({ bottom: 10 }) |
| 226 | .onReachEnd(() => { | 233 | .onReachEnd(() => { |
| 227 | if (!this.fixedHeightMode) { | 234 | if (!this.fixedHeightMode) { |
| @@ -22,6 +22,7 @@ export struct CommentCustomDialog { | @@ -22,6 +22,7 @@ export struct CommentCustomDialog { | ||
| 22 | 22 | ||
| 23 | // confirm 表示内部处理调用 内容评论接口 发布了评论并成功,上层只需要 通过 publishCommentModel.lastCommentModel 即可获取最新已提交的评论 | 23 | // confirm 表示内部处理调用 内容评论接口 发布了评论并成功,上层只需要 通过 publishCommentModel.lastCommentModel 即可获取最新已提交的评论 |
| 24 | confirm?: (value: Record<string, string>) => void | 24 | confirm?: (value: Record<string, string>) => void |
| 25 | + onPublishBtnClickTrack?: () => void // 和confirm配套使用。当设置了onPublishBtnClick 则无效 | ||
| 25 | 26 | ||
| 26 | @State private emojiSwitch: boolean = false | 27 | @State private emojiSwitch: boolean = false |
| 27 | textInputController: TextAreaController = new TextAreaController() | 28 | textInputController: TextAreaController = new TextAreaController() |
| @@ -39,6 +40,11 @@ export struct CommentCustomDialog { | @@ -39,6 +40,11 @@ export struct CommentCustomDialog { | ||
| 39 | } | 40 | } |
| 40 | } | 41 | } |
| 41 | 42 | ||
| 43 | + // 点击时 即可埋点 | ||
| 44 | + if (this.onPublishBtnClickTrack) { | ||
| 45 | + this.onPublishBtnClickTrack() | ||
| 46 | + } | ||
| 47 | + | ||
| 42 | let bean: Record<string, string> = {}; | 48 | let bean: Record<string, string> = {}; |
| 43 | // this.publishCommentModel.commentContent = this.commentText | 49 | // this.publishCommentModel.commentContent = this.commentText |
| 44 | //TODO 判断类型 | 50 | //TODO 判断类型 |
| @@ -5,6 +5,7 @@ import measure from '@ohos.measure' | @@ -5,6 +5,7 @@ import measure from '@ohos.measure' | ||
| 5 | import { ContentDetailDTO } from 'wdBean/Index' | 5 | import { ContentDetailDTO } from 'wdBean/Index' |
| 6 | import { HttpUtils } from 'wdNetwork/Index' | 6 | import { HttpUtils } from 'wdNetwork/Index' |
| 7 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | 7 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' |
| 8 | +import { TrackingContent, TrackParamConvert } from 'wdTracking/Index' | ||
| 8 | 9 | ||
| 9 | @Preview | 10 | @Preview |
| 10 | @Component | 11 | @Component |
| @@ -20,6 +21,8 @@ export struct CommentTabComponent { | @@ -20,6 +21,8 @@ export struct CommentTabComponent { | ||
| 20 | @State type: number = 1 | 21 | @State type: number = 1 |
| 21 | @State placeHolder: string = '说两句...' | 22 | @State placeHolder: string = '说两句...' |
| 22 | @State dialogController: CustomDialogController | null = null; | 23 | @State dialogController: CustomDialogController | null = null; |
| 24 | + @Consume pageId: string | ||
| 25 | + @Consume pageName: string | ||
| 23 | styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) | 26 | styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) |
| 24 | /*回调方法*/ | 27 | /*回调方法*/ |
| 25 | dialogControllerConfirm: () => void = () => { | 28 | dialogControllerConfirm: () => void = () => { |
| @@ -29,6 +32,9 @@ export struct CommentTabComponent { | @@ -29,6 +32,9 @@ export struct CommentTabComponent { | ||
| 29 | 32 | ||
| 30 | this.dialogController = new CustomDialogController({ | 33 | this.dialogController = new CustomDialogController({ |
| 31 | builder: CommentCustomDialog({ | 34 | builder: CommentCustomDialog({ |
| 35 | + onPublishBtnClickTrack: () => { | ||
| 36 | + TrackingContent.commentClick(this.pageId, this.pageName, TrackParamConvert.contentDetail(this.contentDetail)) | ||
| 37 | + }, | ||
| 32 | confirm: (value: Record<string, string>) => { | 38 | confirm: (value: Record<string, string>) => { |
| 33 | this.dialogControllerConfirm(); | 39 | this.dialogControllerConfirm(); |
| 34 | EmitterUtils.sendEvent(EmitterEventId.COMMENT_PUBLISH, this.publishCommentModel.targetId) | 40 | EmitterUtils.sendEvent(EmitterEventId.COMMENT_PUBLISH, this.publishCommentModel.targetId) |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
| @@ -11,6 +11,7 @@ import { CommentCustomDialog } from './CommentCustomDialog' | @@ -11,6 +11,7 @@ import { CommentCustomDialog } from './CommentCustomDialog' | ||
| 11 | import { publishCommentModel } from '../model/PublishCommentModel' | 11 | import { publishCommentModel } from '../model/PublishCommentModel' |
| 12 | import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index' | 12 | import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index' |
| 13 | import { ContentDTO, MasterDetailRes } from 'wdBean/Index' | 13 | import { ContentDTO, MasterDetailRes } from 'wdBean/Index' |
| 14 | +import { TrackConstants, TrackingContent } from 'wdTracking/Index' | ||
| 14 | 15 | ||
| 15 | const TAG = 'QualityCommentsComponent'; | 16 | const TAG = 'QualityCommentsComponent'; |
| 16 | 17 | ||
| @@ -34,6 +35,8 @@ export struct QualityCommentsComponent { | @@ -34,6 +35,8 @@ export struct QualityCommentsComponent { | ||
| 34 | /*必传*/ | 35 | /*必传*/ |
| 35 | @State publishCommentModel: publishCommentModel = new publishCommentModel() | 36 | @State publishCommentModel: publishCommentModel = new publishCommentModel() |
| 36 | 37 | ||
| 38 | + // @Consume pageName: string | ||
| 39 | + | ||
| 37 | aboutToDisappear(): void { | 40 | aboutToDisappear(): void { |
| 38 | // windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' }) | 41 | // windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' }) |
| 39 | this.dialogController = null // 将dialogController置空 | 42 | this.dialogController = null // 将dialogController置空 |
| @@ -57,6 +60,9 @@ export struct QualityCommentsComponent { | @@ -57,6 +60,9 @@ export struct QualityCommentsComponent { | ||
| 57 | showAlert() { | 60 | showAlert() { |
| 58 | this.dialogController = new CustomDialogController({ | 61 | this.dialogController = new CustomDialogController({ |
| 59 | builder: CommentCustomDialog({ | 62 | builder: CommentCustomDialog({ |
| 63 | + onPublishBtnClickTrack: () => { | ||
| 64 | + //TrackingContent.commentClick(this.pageName, this.pageName,{}) | ||
| 65 | + }, | ||
| 60 | confirm: (value: Record<string, string>) => { | 66 | confirm: (value: Record<string, string>) => { |
| 61 | 67 | ||
| 62 | }, | 68 | }, |
| @@ -189,11 +189,6 @@ class CommentViewModel { | @@ -189,11 +189,6 @@ class CommentViewModel { | ||
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => { | 191 | HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => { |
| 192 | - // fixme 埋点 评论发布点击 | ||
| 193 | - TrackingContent.commentClick(pageId,pageName | ||
| 194 | - ,{ | ||
| 195 | - 'duration':0, | ||
| 196 | - }) | ||
| 197 | if (data.code != 0) { | 192 | if (data.code != 0) { |
| 198 | ToastUtils.showToast(data.message, 1000); | 193 | ToastUtils.showToast(data.message, 1000); |
| 199 | fail() | 194 | fail() |
| @@ -289,9 +289,9 @@ struct indicatorAnimations { | @@ -289,9 +289,9 @@ struct indicatorAnimations { | ||
| 289 | build() { | 289 | build() { |
| 290 | Flex({ alignItems: ItemAlign.End }) { | 290 | Flex({ alignItems: ItemAlign.End }) { |
| 291 | Stack() { | 291 | Stack() { |
| 292 | - Image($r('app.media.swiper_indicator_gray')) | ||
| 293 | - .width('100%') | ||
| 294 | - .height(2) | 292 | + // Image($r('app.media.swiper_indicator_gray')) |
| 293 | + // .width('100%') | ||
| 294 | + // .height(2) | ||
| 295 | Image($r('app.media.swiper_indicator_white')) | 295 | Image($r('app.media.swiper_indicator_white')) |
| 296 | .width(this.leftW) | 296 | .width(this.leftW) |
| 297 | .height(2) | 297 | .height(2) |
| @@ -312,6 +312,7 @@ struct indicatorAnimations { | @@ -312,6 +312,7 @@ struct indicatorAnimations { | ||
| 312 | .margin({ | 312 | .margin({ |
| 313 | bottom: -2 | 313 | bottom: -2 |
| 314 | }) | 314 | }) |
| 315 | + .fontFamily('BebasNeue') | ||
| 315 | .flexShrink(0) | 316 | .flexShrink(0) |
| 316 | .animation({ | 317 | .animation({ |
| 317 | duration: 300, | 318 | duration: 300, |
| @@ -319,9 +320,9 @@ struct indicatorAnimations { | @@ -319,9 +320,9 @@ struct indicatorAnimations { | ||
| 319 | playMode: PlayMode.Normal | 320 | playMode: PlayMode.Normal |
| 320 | }) | 321 | }) |
| 321 | Stack() { | 322 | Stack() { |
| 322 | - Image($r('app.media.swiper_indicator_gray')) | ||
| 323 | - .width('100%') | ||
| 324 | - .height(2) | 323 | + // Image($r('app.media.swiper_indicator_gray')) |
| 324 | + // .width('100%') | ||
| 325 | + // .height(2) | ||
| 325 | Image($r('app.media.swiper_indicator_white')) | 326 | Image($r('app.media.swiper_indicator_white')) |
| 326 | .width(this.rightW) | 327 | .width(this.rightW) |
| 327 | .height(2) | 328 | .height(2) |
| @@ -46,7 +46,7 @@ export struct ZhGridLayout03 { | @@ -46,7 +46,7 @@ export struct ZhGridLayout03 { | ||
| 46 | left: $r('app.float.card_comp_pagePadding_lf'), | 46 | left: $r('app.float.card_comp_pagePadding_lf'), |
| 47 | right: $r('app.float.card_comp_pagePadding_lf'), | 47 | right: $r('app.float.card_comp_pagePadding_lf'), |
| 48 | top: $r('app.float.card_comp_pagePadding_tb'), | 48 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 49 | - bottom: $r('app.float.card_comp_pagePadding_tb') | 49 | + bottom: '0vp' |
| 50 | }) | 50 | }) |
| 51 | } | 51 | } |
| 52 | 52 |
| @@ -34,7 +34,7 @@ export struct ZhSingleRow02 { | @@ -34,7 +34,7 @@ export struct ZhSingleRow02 { | ||
| 34 | edgeAnimation() { | 34 | edgeAnimation() { |
| 35 | if (this.moreWidth < this.initMoreWidth * 3) { | 35 | if (this.moreWidth < this.initMoreWidth * 3) { |
| 36 | if (!this.moreTips) { | 36 | if (!this.moreTips) { |
| 37 | - this.moreTips = '查看更多'; | 37 | + this.moreTips = '查看 '; |
| 38 | } | 38 | } |
| 39 | this.moreWidth = this.moreWidth + 2 | 39 | this.moreWidth = this.moreWidth + 2 |
| 40 | } | 40 | } |
| @@ -54,8 +54,7 @@ export struct ZhSingleRow02 { | @@ -54,8 +54,7 @@ export struct ZhSingleRow02 { | ||
| 54 | 54 | ||
| 55 | resetEdgeAnimation() { | 55 | resetEdgeAnimation() { |
| 56 | if (this.moreWidth > this.initMoreWidth) { | 56 | if (this.moreWidth > this.initMoreWidth) { |
| 57 | - this.moreWidth = this.moreWidth - 1 | ||
| 58 | - this.resetEdgeAnimation(); | 57 | + this.moreWidth = 16 |
| 59 | } | 58 | } |
| 60 | this.resetMoreTips() | 59 | this.resetMoreTips() |
| 61 | } | 60 | } |
| @@ -91,7 +90,14 @@ export struct ZhSingleRow02 { | @@ -91,7 +90,14 @@ export struct ZhSingleRow02 { | ||
| 91 | .margin({ right: 8 }) | 90 | .margin({ right: 8 }) |
| 92 | }) | 91 | }) |
| 93 | } | 92 | } |
| 94 | - if (this.compDTO.operDataList.length >= 2) { | 93 | + if (this.compDTO.operDataList.length >= 2 && (this.compDTO?.objectType === '0' || this.compDTO?.objectType === '')) { |
| 94 | + Row() { | ||
| 95 | + Ellipse() | ||
| 96 | + .width(2* (this.moreWidth - this.initMoreWidth - 1)) | ||
| 97 | + .height('100%') | ||
| 98 | + .fill(0xe9e9e9) | ||
| 99 | + .position({ left: -(this.moreWidth - this.initMoreWidth - 3) * 0.8 , top: 0 }) | ||
| 100 | + | ||
| 95 | Column() { | 101 | Column() { |
| 96 | if (this.moreWidth > this.initMoreWidth + 2) { | 102 | if (this.moreWidth > this.initMoreWidth + 2) { |
| 97 | Text(this.moreTips) | 103 | Text(this.moreTips) |
| @@ -103,10 +109,12 @@ export struct ZhSingleRow02 { | @@ -103,10 +109,12 @@ export struct ZhSingleRow02 { | ||
| 103 | .justifyContent(FlexAlign.Center) | 109 | .justifyContent(FlexAlign.Center) |
| 104 | .align(Alignment.Center) | 110 | .align(Alignment.Center) |
| 105 | .height('100%') | 111 | .height('100%') |
| 106 | - .width(this.moreWidth) | 112 | + .width(this.initMoreWidth) |
| 107 | .backgroundColor(0xe9e9e9) | 113 | .backgroundColor(0xe9e9e9) |
| 108 | .borderRadius({ topLeft: 5, bottomLeft: 5 }) | 114 | .borderRadius({ topLeft: 5, bottomLeft: 5 }) |
| 109 | } | 115 | } |
| 116 | + .margin({left: 1.5 * (this.moreWidth - this.initMoreWidth)}) | ||
| 117 | + } | ||
| 110 | } | 118 | } |
| 111 | } | 119 | } |
| 112 | .width(CommonConstants.FULL_WIDTH) | 120 | .width(CommonConstants.FULL_WIDTH) |
| @@ -233,6 +241,8 @@ struct CreatorItem { | @@ -233,6 +241,8 @@ struct CreatorItem { | ||
| 233 | .textOverflow({overflow: TextOverflow.Ellipsis}) | 241 | .textOverflow({overflow: TextOverflow.Ellipsis}) |
| 234 | .width(140) | 242 | .width(140) |
| 235 | .margin({bottom: 8}) | 243 | .margin({bottom: 8}) |
| 244 | + .height(42) | ||
| 245 | + .lineHeight(21) | ||
| 236 | } | 246 | } |
| 237 | } | 247 | } |
| 238 | .width(156) | 248 | .width(156) |
| 1 | -import { CompDTO, ContentDTO, Params, Action, ReserveItemBean} from 'wdBean'; | 1 | +import { CompDTO, ContentDTO, Params, Action, ReserveItemBean, PageTrackBean} from 'wdBean'; |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 3 | import { postInteractAccentionOperateParams } from 'wdBean'; | 3 | import { postInteractAccentionOperateParams } from 'wdBean'; |
| 4 | import { PageRepository } from '../../repository/PageRepository'; | 4 | import { PageRepository } from '../../repository/PageRepository'; |
| @@ -10,6 +10,7 @@ import { Logger, ToastUtils } from 'wdKit'; | @@ -10,6 +10,7 @@ import { Logger, ToastUtils } from 'wdKit'; | ||
| 10 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 10 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 11 | import { SpConstants } from 'wdConstant/Index' | 11 | import { SpConstants } from 'wdConstant/Index' |
| 12 | import { InfomationCardClick } from '../../utils/infomationCardClick'; | 12 | import { InfomationCardClick } from '../../utils/infomationCardClick'; |
| 13 | +import { ParamType, Tracking } from 'wdTracking/Index'; | ||
| 13 | 14 | ||
| 14 | /** | 15 | /** |
| 15 | * 直播预约卡 | 16 | * 直播预约卡 |
| @@ -17,7 +18,17 @@ import { InfomationCardClick } from '../../utils/infomationCardClick'; | @@ -17,7 +18,17 @@ import { InfomationCardClick } from '../../utils/infomationCardClick'; | ||
| 17 | */ | 18 | */ |
| 18 | const TAG = 'Zh_Single_Row-03' | 19 | const TAG = 'Zh_Single_Row-03' |
| 19 | 20 | ||
| 20 | - | 21 | +function getLiveState(contentDTO: ContentDTO) { |
| 22 | + if (contentDTO?.liveInfo?.liveState === 'wait') { | ||
| 23 | + return 'liveSubscribe' | ||
| 24 | + } else if (contentDTO?.liveInfo?.liveState === 'running') { | ||
| 25 | + return 'livePlaying' | ||
| 26 | + } else if (contentDTO?.liveInfo?.liveState === 'end') { | ||
| 27 | + return 'liveEnd' | ||
| 28 | + } else { | ||
| 29 | + return '' | ||
| 30 | + } | ||
| 31 | +} | ||
| 21 | interface reserveReqItem { | 32 | interface reserveReqItem { |
| 22 | liveId: string, | 33 | liveId: string, |
| 23 | relationId: string, | 34 | relationId: string, |
| @@ -67,8 +78,7 @@ export struct ZhSingleRow03 { | @@ -67,8 +78,7 @@ export struct ZhSingleRow03 { | ||
| 67 | 78 | ||
| 68 | resetEdgeAnimation() { | 79 | resetEdgeAnimation() { |
| 69 | if (this.moreWidth > this.initMoreWidth) { | 80 | if (this.moreWidth > this.initMoreWidth) { |
| 70 | - this.moreWidth = this.moreWidth - 1 | ||
| 71 | - this.resetEdgeAnimation(); | 81 | + this.moreWidth = 16 |
| 72 | } | 82 | } |
| 73 | this.resetMoreTips() | 83 | this.resetMoreTips() |
| 74 | } | 84 | } |
| @@ -155,7 +165,14 @@ export struct ZhSingleRow03 { | @@ -155,7 +165,14 @@ export struct ZhSingleRow03 { | ||
| 155 | this.ItemCard(item) | 165 | this.ItemCard(item) |
| 156 | }) | 166 | }) |
| 157 | } | 167 | } |
| 158 | - if (this.compDTO.operDataList.length >= 2) { | 168 | + if (this.compDTO.operDataList.length >= 2 && (this.compDTO?.objectType === '0' || this.compDTO?.objectType === '')) { |
| 169 | + Row() { | ||
| 170 | + Ellipse() | ||
| 171 | + .width(2* (this.moreWidth - this.initMoreWidth - 1)) | ||
| 172 | + .height(116) | ||
| 173 | + .fill(0xf9f9f9) | ||
| 174 | + .position({ left: -(this.moreWidth - this.initMoreWidth - 3) * 0.8 , top: 0 }) | ||
| 175 | + | ||
| 159 | Column() { | 176 | Column() { |
| 160 | if (this.moreWidth > this.initMoreWidth + 2) { | 177 | if (this.moreWidth > this.initMoreWidth + 2) { |
| 161 | Text(this.moreTips) | 178 | Text(this.moreTips) |
| @@ -166,10 +183,12 @@ export struct ZhSingleRow03 { | @@ -166,10 +183,12 @@ export struct ZhSingleRow03 { | ||
| 166 | } | 183 | } |
| 167 | .justifyContent(FlexAlign.Center) | 184 | .justifyContent(FlexAlign.Center) |
| 168 | .align(Alignment.Center) | 185 | .align(Alignment.Center) |
| 169 | - .width(this.moreWidth) | 186 | + .height(116) |
| 187 | + .width(this.initMoreWidth) | ||
| 170 | .backgroundColor(0xf9f9f9) | 188 | .backgroundColor(0xf9f9f9) |
| 171 | .borderRadius({ topLeft: 5, bottomLeft: 5 }) | 189 | .borderRadius({ topLeft: 5, bottomLeft: 5 }) |
| 172 | - .height(116) | 190 | + } |
| 191 | + .margin({left: 1.5 * (this.moreWidth - this.initMoreWidth)}) | ||
| 173 | } | 192 | } |
| 174 | } | 193 | } |
| 175 | } | 194 | } |
| @@ -208,6 +227,7 @@ export struct ZhSingleRow03 { | @@ -208,6 +227,7 @@ export struct ZhSingleRow03 { | ||
| 208 | 227 | ||
| 209 | @Builder | 228 | @Builder |
| 210 | ItemCard(item: ContentDTO) { | 229 | ItemCard(item: ContentDTO) { |
| 230 | + if (this.compDTO.operDataList.length >= 2) { | ||
| 211 | Column() { | 231 | Column() { |
| 212 | Row() { | 232 | Row() { |
| 213 | Image(this.loadImg ? item.coverUrl : '') | 233 | Image(this.loadImg ? item.coverUrl : '') |
| @@ -215,6 +235,7 @@ export struct ZhSingleRow03 { | @@ -215,6 +235,7 @@ export struct ZhSingleRow03 { | ||
| 215 | .height(60) | 235 | .height(60) |
| 216 | .margin({right: 12}) | 236 | .margin({right: 12}) |
| 217 | .backgroundColor(0xf5f5f5) | 237 | .backgroundColor(0xf5f5f5) |
| 238 | + .margin({right: 12}) | ||
| 218 | 239 | ||
| 219 | Text(item.newsTitle) | 240 | Text(item.newsTitle) |
| 220 | .width(154) | 241 | .width(154) |
| @@ -255,7 +276,29 @@ export struct ZhSingleRow03 { | @@ -255,7 +276,29 @@ export struct ZhSingleRow03 { | ||
| 255 | .textAlign(TextAlign.Center) | 276 | .textAlign(TextAlign.Center) |
| 256 | .borderRadius(3) | 277 | .borderRadius(3) |
| 257 | .onClick(() => { | 278 | .onClick(() => { |
| 258 | - this.bookAndCancel(item.relId, item.objectId, !this.isReserved(Number(item.objectId))) | 279 | + |
| 280 | + const isSubscribe = !this.isReserved(Number(item.objectId)) | ||
| 281 | + | ||
| 282 | + // 直播预约埋点 | ||
| 283 | + const params: ParamType = { | ||
| 284 | + 'contentName': item.newsTitle, | ||
| 285 | + 'contentType': item.objectType, | ||
| 286 | + "liveStreamType": item?.liveInfo.vrType === 0 ? 1 : 2, | ||
| 287 | + "vliveId": item.objectId, | ||
| 288 | + "vliveName": item.newsTitle, | ||
| 289 | + "contentId": item.objectId, | ||
| 290 | + "compId": item.relId, | ||
| 291 | + "contentStyle": item.appStyle, | ||
| 292 | + "liveType": getLiveState(item), | ||
| 293 | + 'contentShowChannelId': item.channelId, | ||
| 294 | + 'linkUrl': item.linkUrl, | ||
| 295 | + "pageId": this.pageId, | ||
| 296 | + "pageName": this.pageName, | ||
| 297 | + } | ||
| 298 | + Logger.info(TAG, `直播预约埋点: ${JSON.stringify(params)}`); | ||
| 299 | + Tracking.event(isSubscribe? "live_subscribe_click": "cancel_live_subscribe_click", params) | ||
| 300 | + | ||
| 301 | + this.bookAndCancel(item.relId, item.objectId, isSubscribe) | ||
| 259 | }) | 302 | }) |
| 260 | 303 | ||
| 261 | } | 304 | } |
| @@ -273,6 +316,74 @@ export struct ZhSingleRow03 { | @@ -273,6 +316,74 @@ export struct ZhSingleRow03 { | ||
| 273 | InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName) | 316 | InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName) |
| 274 | ProcessUtils.processPage(item) | 317 | ProcessUtils.processPage(item) |
| 275 | }) | 318 | }) |
| 319 | + } else { | ||
| 320 | + Column() { | ||
| 321 | + Row() { | ||
| 322 | + Image(this.loadImg ? item.coverUrl : '') | ||
| 323 | + .width(106) | ||
| 324 | + .height(60) | ||
| 325 | + .backgroundColor(0xf5f5f5) | ||
| 326 | + .margin({right: 12}) | ||
| 327 | + | ||
| 328 | + Text(item.newsTitle) | ||
| 329 | + .width(201) | ||
| 330 | + .height(60) | ||
| 331 | + .maxLines(3) | ||
| 332 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 333 | + } | ||
| 334 | + .margin({bottom: 16}) | ||
| 335 | + .justifyContent(FlexAlign.Start) | ||
| 336 | + | ||
| 337 | + Row() { | ||
| 338 | + Flex({justifyContent: FlexAlign.SpaceBetween}){ | ||
| 339 | + Row() { | ||
| 340 | + Text(this.format(new Date(item.liveInfo.liveStartTime).getTime())) | ||
| 341 | + .margin({right: 6}) | ||
| 342 | + .fontColor(0x000000) | ||
| 343 | + .fontSize(13) | ||
| 344 | + .textAlign(TextAlign.Start) | ||
| 345 | + Image($r('app.media.timeline_rect')) | ||
| 346 | + .width(4) | ||
| 347 | + .height(3) | ||
| 348 | + .margin({right: 6}) | ||
| 349 | + Text(item.liveInfo.liveStartTime.split(' ')[1].slice(0, 5)) | ||
| 350 | + .margin({right: 6}) | ||
| 351 | + .fontColor(0x000000) | ||
| 352 | + .fontSize(13) | ||
| 353 | + Text('开始直播') | ||
| 354 | + .fontColor(0xC8C8C8) | ||
| 355 | + .fontSize(13) | ||
| 356 | + } | ||
| 357 | + | ||
| 358 | + Row() { | ||
| 359 | + Text(this.isReserved(Number(item.objectId)) ? '已预约' : '预约') | ||
| 360 | + .width(48) | ||
| 361 | + .height(24) | ||
| 362 | + .backgroundColor(this.isReserved(Number(item.objectId)) ? 0xffffff : 0xED2800) | ||
| 363 | + .fontColor(this.isReserved(Number(item.objectId)) ? 0xC8C8C8 : 0xffffff) | ||
| 364 | + .fontSize(12) | ||
| 365 | + .textAlign(TextAlign.Center) | ||
| 366 | + .borderRadius(3) | ||
| 367 | + .onClick(() => { | ||
| 368 | + this.bookAndCancel(item.relId, item.objectId, !this.isReserved(Number(item.objectId))) | ||
| 369 | + }) | ||
| 370 | + | ||
| 371 | + } | ||
| 372 | + .margin({top: -5}) | ||
| 373 | + } | ||
| 374 | + | ||
| 375 | + } | ||
| 376 | + } | ||
| 377 | + .width('100%') | ||
| 378 | + .height(116) | ||
| 379 | + .padding({top: 12, bottom: 12, left: 12, right: 12}) | ||
| 380 | + .backgroundColor(0xf9f9f9) | ||
| 381 | + .margin({right: 8}) | ||
| 382 | + .onClick(() => { | ||
| 383 | + InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName) | ||
| 384 | + ProcessUtils.processPage(item) | ||
| 385 | + }) | ||
| 386 | + } | ||
| 276 | } | 387 | } |
| 277 | 388 | ||
| 278 | 389 | ||
| @@ -290,6 +401,7 @@ export struct ZhSingleRow03 { | @@ -290,6 +401,7 @@ export struct ZhSingleRow03 { | ||
| 290 | .fontWeight(600) | 401 | .fontWeight(600) |
| 291 | } | 402 | } |
| 292 | 403 | ||
| 404 | + if (this.compDTO?.objectType === '0' || this.compDTO?.objectType === '') { | ||
| 293 | Row() { | 405 | Row() { |
| 294 | Text("更多") | 406 | Text("更多") |
| 295 | .fontSize($r("app.float.font_size_14")) | 407 | .fontSize($r("app.float.font_size_14")) |
| @@ -299,13 +411,11 @@ export struct ZhSingleRow03 { | @@ -299,13 +411,11 @@ export struct ZhSingleRow03 { | ||
| 299 | .width(14) | 411 | .width(14) |
| 300 | .height(14) | 412 | .height(14) |
| 301 | } | 413 | } |
| 302 | - .padding({ | ||
| 303 | - right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 304 | - }) | ||
| 305 | .onClick(() => { | 414 | .onClick(() => { |
| 306 | this.jumpToMore(); | 415 | this.jumpToMore(); |
| 307 | }) | 416 | }) |
| 308 | } | 417 | } |
| 418 | + } | ||
| 309 | .justifyContent(FlexAlign.SpaceBetween) | 419 | .justifyContent(FlexAlign.SpaceBetween) |
| 310 | .margin({ top: 8, bottom: 8 }) | 420 | .margin({ top: 8, bottom: 8 }) |
| 311 | .width('100%') | 421 | .width('100%') |
| @@ -331,85 +441,4 @@ export struct ZhSingleRow03 { | @@ -331,85 +441,4 @@ export struct ZhSingleRow03 { | ||
| 331 | 441 | ||
| 332 | } | 442 | } |
| 333 | 443 | ||
| 334 | -@Extend(Text) | ||
| 335 | -function textOverflowStyle(maxLine: number) { | ||
| 336 | - .maxLines(maxLine) | ||
| 337 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 338 | -} | ||
| 339 | 444 | ||
| 340 | -@Component | ||
| 341 | -struct CreatorItem { | ||
| 342 | - @Prop item: ContentDTO | ||
| 343 | - @State rmhIsAttention: number = 0 | ||
| 344 | - @State loadImg: boolean = false; | ||
| 345 | - | ||
| 346 | - async aboutToAppear(): Promise<void> { | ||
| 347 | - this.loadImg = await onlyWifiLoadImg(); | ||
| 348 | - } | ||
| 349 | - build() { | ||
| 350 | - ListItem() { | ||
| 351 | - Column() { | ||
| 352 | - Stack({ alignContent: Alignment.Bottom }) { | ||
| 353 | - Image(this.loadImg ? this.item.coverUrl : '') | ||
| 354 | - .backgroundColor(0xf5f5f5) | ||
| 355 | - .width(156) | ||
| 356 | - .height(208) | ||
| 357 | - .border({width: 1}) | ||
| 358 | - .borderRadius(3) | ||
| 359 | - Row() | ||
| 360 | - .width(156) | ||
| 361 | - .height(80) | ||
| 362 | - .linearGradient({ | ||
| 363 | - direction: GradientDirection.Bottom, | ||
| 364 | - colors: [['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]] | ||
| 365 | - }) | ||
| 366 | - Text(this.item.newsTitle) | ||
| 367 | - .fontColor(0xffffff) | ||
| 368 | - .fontSize(14) | ||
| 369 | - .maxLines(2) | ||
| 370 | - .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 371 | - .width(140) | ||
| 372 | - .margin({bottom: 8}) | ||
| 373 | - } | ||
| 374 | - } | ||
| 375 | - .width(156) | ||
| 376 | - .height(208) | ||
| 377 | - .margin({ right: 11 }) | ||
| 378 | - .borderColor($r('app.color.color_EDEDED')) | ||
| 379 | - .borderRadius($r('app.float.image_border_radius')) | ||
| 380 | - } | ||
| 381 | - .onClick((event: ClickEvent) => { | ||
| 382 | - ProcessUtils.processPage(this.item) | ||
| 383 | - }) | ||
| 384 | - } | ||
| 385 | - | ||
| 386 | - /** | ||
| 387 | - * 关注号主 TODO 这里后面需要抽离 | ||
| 388 | - */ | ||
| 389 | - handleAccention(item: ContentDTO, status: number) { | ||
| 390 | - this.rmhIsAttention = this.rmhIsAttention ? 0 : 1 | ||
| 391 | - return | ||
| 392 | - // 未登录,跳转登录 | ||
| 393 | - if (!HttpUtils.getUserId()) { | ||
| 394 | - WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 395 | - return | ||
| 396 | - } | ||
| 397 | - | ||
| 398 | - const params: postInteractAccentionOperateParams = { | ||
| 399 | - attentionUserType: item.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号) | ||
| 400 | - attentionUserId: item.rmhInfo?.userId || '', // 被关注用户号主id | ||
| 401 | - attentionCreatorId: item.rmhInfo?.rmhId || '', // 被关注用户号主id | ||
| 402 | - // userType: 1, | ||
| 403 | - // userId: '1', // TODO 用户id需要从本地获取 | ||
| 404 | - status: status, | ||
| 405 | - } | ||
| 406 | - PageRepository.postInteractAccentionOperate(params).then(res => { | ||
| 407 | - console.log(TAG, '关注号主==', JSON.stringify(res.data)) | ||
| 408 | - if (status === 1) { | ||
| 409 | - this.rmhIsAttention = 0 | ||
| 410 | - } else { | ||
| 411 | - this.rmhIsAttention = 1 | ||
| 412 | - } | ||
| 413 | - }) | ||
| 414 | - } | ||
| 415 | -} |
| @@ -231,13 +231,10 @@ export struct FollowListDetailUI { | @@ -231,13 +231,10 @@ export struct FollowListDetailUI { | ||
| 231 | value.forEach((item) => { | 231 | value.forEach((item) => { |
| 232 | if (data.creatorId == item.creatorId) { | 232 | if (data.creatorId == item.creatorId) { |
| 233 | data.headPhotoUrl = item.headPhotoUrl | 233 | data.headPhotoUrl = item.headPhotoUrl |
| 234 | - if (item.fansNum > 10000) { | ||
| 235 | - let temp = (item.fansNum / 10000) + "" | ||
| 236 | - let index = temp.indexOf('.') | ||
| 237 | - if (index != -1) { | ||
| 238 | - temp = temp.substring(0, index + 2) | ||
| 239 | - } else { | ||
| 240 | - temp = temp | 234 | + if (item.fansNum >= 10000) { |
| 235 | + let temp = (item.fansNum / 10000) .toFixed(1) | ||
| 236 | + if (Number(temp.substring(temp.length-1)) == 0) { | ||
| 237 | + temp = temp.substring(0, temp.length-2) | ||
| 241 | } | 238 | } |
| 242 | data.cnFansNum = temp + "万" | 239 | data.cnFansNum = temp + "万" |
| 243 | } else { | 240 | } else { |
| @@ -207,13 +207,10 @@ export struct HomePageBottomFollowComponent { | @@ -207,13 +207,10 @@ export struct HomePageBottomFollowComponent { | ||
| 207 | value.list.forEach((value) => { | 207 | value.list.forEach((value) => { |
| 208 | let fansNum: number = value.fansNum | 208 | let fansNum: number = value.fansNum |
| 209 | let fansNumString = "" | 209 | let fansNumString = "" |
| 210 | - if (fansNum > 10000) { | ||
| 211 | - let temp = (fansNum / 10000) + "" | ||
| 212 | - let index = temp.indexOf('.') | ||
| 213 | - if (index != -1) { | ||
| 214 | - temp = temp.substring(0, index + 2) | ||
| 215 | - } else { | ||
| 216 | - temp = temp | 210 | + if (fansNum >= 10000) { |
| 211 | + let temp = (fansNum / 10000) .toFixed(1) | ||
| 212 | + if (Number(temp.substring(temp.length-1)) == 0) { | ||
| 213 | + temp = temp.substring(0, temp.length-2) | ||
| 217 | } | 214 | } |
| 218 | fansNumString = temp + "万" | 215 | fansNumString = temp + "万" |
| 219 | } else { | 216 | } else { |
| @@ -168,7 +168,18 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -168,7 +168,18 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 168 | this.hasMore = false | 168 | this.hasMore = false |
| 169 | }else{ | 169 | }else{ |
| 170 | value.list.forEach((value)=>{ | 170 | value.list.forEach((value)=>{ |
| 171 | - this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.cnUserType,value.cnUserId,value.mainControl,value.banControl,value.authIcon)) | 171 | + let fansNum: number = value.fansNum |
| 172 | + let fansNumString = "" | ||
| 173 | + if (fansNum >= 10000) { | ||
| 174 | + let temp = (fansNum / 10000) .toFixed(1) | ||
| 175 | + if (Number(temp.substring(temp.length-1)) == 0) { | ||
| 176 | + temp = temp.substring(0, temp.length-2) | ||
| 177 | + } | ||
| 178 | + fansNumString = temp + "万" | ||
| 179 | + } else { | ||
| 180 | + fansNumString = fansNum + "" | ||
| 181 | + } | ||
| 182 | + this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,fansNumString,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.cnUserType,value.cnUserId,value.mainControl,value.banControl,value.authIcon)) | ||
| 172 | }) | 183 | }) |
| 173 | this.data_follow.notifyDataReload() | 184 | this.data_follow.notifyDataReload() |
| 174 | this.count = this.data_follow.totalCount() | 185 | this.count = this.data_follow.totalCount() |
| @@ -5,7 +5,7 @@ import PageModel from '../../viewmodel/PageModel'; | @@ -5,7 +5,7 @@ import PageModel from '../../viewmodel/PageModel'; | ||
| 5 | import { autoRefresh, onActionEnd, onActionStart, onActionUpdate } from '../../utils/PullDownRefresh'; | 5 | import { autoRefresh, onActionEnd, onActionStart, onActionUpdate } from '../../utils/PullDownRefresh'; |
| 6 | import LoadMoreLayout from './LoadMoreLayout'; | 6 | import LoadMoreLayout from './LoadMoreLayout'; |
| 7 | import { CompParser } from '../CompParser'; | 7 | import { CompParser } from '../CompParser'; |
| 8 | -import { CompDTO } from 'wdBean'; | 8 | +import { CompDTO, PageTrackBean } from 'wdBean'; |
| 9 | import PageHelper from '../../viewmodel/PageHelper'; | 9 | import PageHelper from '../../viewmodel/PageHelper'; |
| 10 | import { channelSkeleton } from '../skeleton/channelSkeleton' | 10 | import { channelSkeleton } from '../skeleton/channelSkeleton' |
| 11 | import { ProcessUtils } from 'wdRouter/Index'; | 11 | import { ProcessUtils } from 'wdRouter/Index'; |
| @@ -30,6 +30,13 @@ export struct PageComponent { | @@ -30,6 +30,13 @@ export struct PageComponent { | ||
| 30 | private listScroller: Scroller = new Scroller(); | 30 | private listScroller: Scroller = new Scroller(); |
| 31 | private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down }) | 31 | private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down }) |
| 32 | needload: boolean = true; | 32 | needload: boolean = true; |
| 33 | + // page相关埋点数据,各组件需要,自行取用 | ||
| 34 | + // @Provide 暂不能用Provide、Consume,(别的用到组件样式的页面,都需要加provide,否则会crash,暂不用这种方案。待优化) | ||
| 35 | + /** | ||
| 36 | + * @deprecated | ||
| 37 | + */ | ||
| 38 | + private pageTrackBean: PageTrackBean = new PageTrackBean() | ||
| 39 | + | ||
| 33 | build() { | 40 | build() { |
| 34 | Column() { | 41 | Column() { |
| 35 | if (this.pageModel.viewType == ViewType.LOADING) { | 42 | if (this.pageModel.viewType == ViewType.LOADING) { |
| @@ -69,6 +76,7 @@ export struct PageComponent { | @@ -69,6 +76,7 @@ export struct PageComponent { | ||
| 69 | onActionEnd(this.pageModel, this.pageAdvModel) | 76 | onActionEnd(this.pageModel, this.pageAdvModel) |
| 70 | }) | 77 | }) |
| 71 | ) | 78 | ) |
| 79 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) | ||
| 72 | 80 | ||
| 73 | } | 81 | } |
| 74 | 82 | ||
| @@ -88,7 +96,7 @@ export struct PageComponent { | @@ -88,7 +96,7 @@ export struct PageComponent { | ||
| 88 | LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { | 96 | LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { |
| 89 | ListItem() { | 97 | ListItem() { |
| 90 | Column() { | 98 | Column() { |
| 91 | - CompParser({ pageModel: this.pageModel, compDTO: compDTO, compIndex: compIndex }); | 99 | + CompParser({ pageModel: this.pageModel, compDTO: compDTO, compIndex: compIndex, pageId: this.pageId }); |
| 92 | } | 100 | } |
| 93 | } | 101 | } |
| 94 | }, | 102 | }, |
| @@ -265,8 +273,14 @@ export struct PageComponent { | @@ -265,8 +273,14 @@ export struct PageComponent { | ||
| 265 | this.pageModel.channelId = this.channelId; | 273 | this.pageModel.channelId = this.channelId; |
| 266 | this.pageModel.currentPage = 1; | 274 | this.pageModel.currentPage = 1; |
| 267 | this.pageModel.pageTotalCompSize = 0; | 275 | this.pageModel.pageTotalCompSize = 0; |
| 268 | - PageHelper.getInitCacheData(this.pageModel, this.pageAdvModel) | ||
| 269 | - PageHelper.getInitData(this.pageModel, this.pageAdvModel) | 276 | + PageHelper.getInitCacheData(this.pageModel, this.pageAdvModel).then(() => { |
| 277 | + this.pageTrackBean.pageId = this.pageId | ||
| 278 | + this.pageTrackBean.pageName = this.pageModel.pageInfo.name | ||
| 279 | + }) | ||
| 280 | + PageHelper.getInitData(this.pageModel, this.pageAdvModel).then(() => { | ||
| 281 | + this.pageTrackBean.pageId = this.pageId | ||
| 282 | + this.pageTrackBean.pageName = this.pageModel.pageInfo.name | ||
| 283 | + }) | ||
| 270 | }, 100) | 284 | }, 100) |
| 271 | } | 285 | } |
| 272 | } | 286 | } |
| 1 | -import { DateTimeUtils, PermissionUtil } from 'wdKit' | 1 | +import { BreakpointSystem, DateTimeUtils, PermissionUtil } from 'wdKit' |
| 2 | import { PrivacySettingModel } from '../../model/PrivacySettingModel' | 2 | import { PrivacySettingModel } from '../../model/PrivacySettingModel' |
| 3 | import { Params } from 'wdBean'; | 3 | import { Params } from 'wdBean'; |
| 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 5 | import { HttpUtils } from 'wdNetwork/Index'; | 5 | import { HttpUtils } from 'wdNetwork/Index'; |
| 6 | import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index'; | 6 | import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index'; |
| 7 | +import { TitleBackComponent } from '../setting/TitleBackComponent'; | ||
| 7 | 8 | ||
| 8 | const TAG = 'PrivacySettingPage'; | 9 | const TAG = 'PrivacySettingPage'; |
| 9 | const DiyString = '开启个性化推荐' | 10 | const DiyString = '开启个性化推荐' |
| @@ -18,6 +19,17 @@ export struct PrivacySettingPage { | @@ -18,6 +19,17 @@ export struct PrivacySettingPage { | ||
| 18 | tipsEnd = '中相应权限使用规则' | 19 | tipsEnd = '中相应权限使用规则' |
| 19 | pageShowTime:number = 0; | 20 | pageShowTime:number = 0; |
| 20 | pageHideTime:number = 0; | 21 | pageHideTime:number = 0; |
| 22 | + @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; | ||
| 23 | + private breakpointSystem = new BreakpointSystem(); | ||
| 24 | + @State percent:number = 1 | ||
| 25 | + | ||
| 26 | + currentChanged(){ | ||
| 27 | + if(this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"){ | ||
| 28 | + this.percent = 0.7 | ||
| 29 | + }else { | ||
| 30 | + this.percent = 1 | ||
| 31 | + } | ||
| 32 | + } | ||
| 21 | 33 | ||
| 22 | onPageShow(): void { | 34 | onPageShow(): void { |
| 23 | this.getPermissionStatus(); | 35 | this.getPermissionStatus(); |
| @@ -32,6 +44,8 @@ export struct PrivacySettingPage { | @@ -32,6 +44,8 @@ export struct PrivacySettingPage { | ||
| 32 | } | 44 | } |
| 33 | 45 | ||
| 34 | aboutToAppear() { | 46 | aboutToAppear() { |
| 47 | + this.breakpointSystem.register(); | ||
| 48 | + this.currentChanged() | ||
| 35 | if (!HttpUtils.getUserId()) { | 49 | if (!HttpUtils.getUserId()) { |
| 36 | this.listData.splice(0, 1); | 50 | this.listData.splice(0, 1); |
| 37 | } | 51 | } |
| @@ -43,6 +57,10 @@ export struct PrivacySettingPage { | @@ -43,6 +57,10 @@ export struct PrivacySettingPage { | ||
| 43 | 57 | ||
| 44 | } | 58 | } |
| 45 | 59 | ||
| 60 | + aboutToDisappear(): void { | ||
| 61 | + this.breakpointSystem.unregister(); | ||
| 62 | + } | ||
| 63 | + | ||
| 46 | async getPermissionStatus() { | 64 | async getPermissionStatus() { |
| 47 | const permissionUtil = new PermissionUtil(); | 65 | const permissionUtil = new PermissionUtil(); |
| 48 | for (const element of this.listData) { | 66 | for (const element of this.listData) { |
| @@ -57,25 +75,27 @@ export struct PrivacySettingPage { | @@ -57,25 +75,27 @@ export struct PrivacySettingPage { | ||
| 57 | } | 75 | } |
| 58 | 76 | ||
| 59 | build() { | 77 | build() { |
| 60 | - Navigation() { | 78 | + Column(){ |
| 79 | + TitleBackComponent({title:"隐私设置"}) | ||
| 80 | + | ||
| 61 | //滑动区域 | 81 | //滑动区域 |
| 62 | this.PrivacySettingComponentsUI() | 82 | this.PrivacySettingComponentsUI() |
| 83 | + }.backgroundColor('#F8F8F8') | ||
| 84 | + .width("100%") | ||
| 85 | + .height("100%") | ||
| 63 | 86 | ||
| 64 | - }.titleMode(NavigationTitleMode.Mini) | ||
| 65 | - .title('隐私设置') | ||
| 66 | - .backgroundColor('#F8F8F8') | ||
| 67 | } | 87 | } |
| 68 | 88 | ||
| 69 | @Builder PrivacySettingComponentsUI() { | 89 | @Builder PrivacySettingComponentsUI() { |
| 70 | Column() { | 90 | Column() { |
| 71 | 91 | ||
| 72 | - List({ space: '23lpx' }) { | 92 | + List({ space: `${this.calcHeight(23)}lpx` }) { |
| 73 | ForEach(this.listData, (item: PrivacySettingModel, index:number) => { | 93 | ForEach(this.listData, (item: PrivacySettingModel, index:number) => { |
| 74 | ListItem() { | 94 | ListItem() { |
| 75 | if (item.privacyName == DiyString) { | 95 | if (item.privacyName == DiyString) { |
| 76 | - getTuiJianCell({ item:item, index:index }); | 96 | + getTuiJianCell({ item:item, index:index ,percent:$percent}); |
| 77 | } else { | 97 | } else { |
| 78 | - getArrowCell({ item:item, index:index }); | 98 | + getArrowCell({ item:item, index:index ,percent:$percent}); |
| 79 | } | 99 | } |
| 80 | }.onClick(() => { | 100 | }.onClick(() => { |
| 81 | if (item.privacyName == DiyString) { | 101 | if (item.privacyName == DiyString) { |
| @@ -103,32 +123,33 @@ export struct PrivacySettingPage { | @@ -103,32 +123,33 @@ export struct PrivacySettingPage { | ||
| 103 | } | 123 | } |
| 104 | }) | 124 | }) |
| 105 | }) | 125 | }) |
| 106 | - } | ||
| 107 | - .padding({ left: '29lpx', right: '29lpx' }) | ||
| 108 | - .margin({ top: '38lpx' }) | 126 | + }.width('100%') |
| 127 | + .padding({ left: `${this.calcHeight(29)}lpx`, right: `${this.calcHeight(29)}lpx` }) | ||
| 128 | + .margin({ top: `${this.calcHeight(38)}lpx` }) | ||
| 129 | + | ||
| 109 | 130 | ||
| 110 | Row() { | 131 | Row() { |
| 111 | Text(this.tips) | 132 | Text(this.tips) |
| 112 | - .fontSize('25lpx') | 133 | + .fontSize(`${this.calcHeight(25)}lpx`) |
| 113 | .textAlign(TextAlign.Start) | 134 | .textAlign(TextAlign.Start) |
| 114 | .fontColor($r("app.color.color_666666")) | 135 | .fontColor($r("app.color.color_666666")) |
| 115 | - .margin({ left: '29lpx', top: '46lpx' }) | 136 | + .margin({ left: `${this.calcHeight(29)}lpx`, top: `${this.calcHeight(46)}lpx` }) |
| 116 | // .backgroundColor(Color.Orange) | 137 | // .backgroundColor(Color.Orange) |
| 117 | Text(this.privacyTips) | 138 | Text(this.privacyTips) |
| 118 | - .fontSize('25lpx') | 139 | + .fontSize(`${this.calcHeight(25)}lpx`) |
| 119 | .textAlign(TextAlign.Start) | 140 | .textAlign(TextAlign.Start) |
| 120 | .fontColor('#ED2800') | 141 | .fontColor('#ED2800') |
| 121 | - .margin({ top: '46lpx' }) | 142 | + .margin({ top: `${this.calcHeight(46)}lpx` }) |
| 122 | .onClick(() => { | 143 | .onClick(() => { |
| 123 | //跳转隐私政策 | 144 | //跳转隐私政策 |
| 124 | let bean={contentID:"2",pageID:""} as Params | 145 | let bean={contentID:"2",pageID:""} as Params |
| 125 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | 146 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) |
| 126 | }) | 147 | }) |
| 127 | Text(this.tipsEnd) | 148 | Text(this.tipsEnd) |
| 128 | - .fontSize('25lpx') | 149 | + .fontSize(`${this.calcHeight(25)}lpx`) |
| 129 | .textAlign(TextAlign.Start) | 150 | .textAlign(TextAlign.Start) |
| 130 | .fontColor($r("app.color.color_666666")) | 151 | .fontColor($r("app.color.color_666666")) |
| 131 | - .margin({ top: '46lpx' }) | 152 | + .margin({ top: `${this.calcHeight(46)}lpx` }) |
| 132 | } | 153 | } |
| 133 | 154 | ||
| 134 | } | 155 | } |
| @@ -137,6 +158,10 @@ export struct PrivacySettingPage { | @@ -137,6 +158,10 @@ export struct PrivacySettingPage { | ||
| 137 | .backgroundColor('#F8F8F8') | 158 | .backgroundColor('#F8F8F8') |
| 138 | .alignItems(HorizontalAlign.Start) | 159 | .alignItems(HorizontalAlign.Start) |
| 139 | } | 160 | } |
| 161 | + | ||
| 162 | + calcHeight(value:number): number{ | ||
| 163 | + return value * this.percent | ||
| 164 | + } | ||
| 140 | } | 165 | } |
| 141 | 166 | ||
| 142 | 167 | ||
| @@ -144,6 +169,7 @@ export struct PrivacySettingPage { | @@ -144,6 +169,7 @@ export struct PrivacySettingPage { | ||
| 144 | struct getArrowCell { | 169 | struct getArrowCell { |
| 145 | @ObjectLink item: PrivacySettingModel; | 170 | @ObjectLink item: PrivacySettingModel; |
| 146 | index:number = 0; | 171 | index:number = 0; |
| 172 | + @Link percent:number | ||
| 147 | // 右文字+箭头cell | 173 | // 右文字+箭头cell |
| 148 | // @Builder getArrowCell(item:PrivacySettingModel, index) { | 174 | // @Builder getArrowCell(item:PrivacySettingModel, index) { |
| 149 | build() { | 175 | build() { |
| @@ -151,28 +177,32 @@ struct getArrowCell { | @@ -151,28 +177,32 @@ struct getArrowCell { | ||
| 151 | // 左侧标题 | 177 | // 左侧标题 |
| 152 | Text(this.item.privacyName) | 178 | Text(this.item.privacyName) |
| 153 | .fontColor('#666666') | 179 | .fontColor('#666666') |
| 154 | - .fontSize('31lpx') | 180 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 155 | 181 | ||
| 156 | Row() { | 182 | Row() { |
| 157 | Text(this.item.permission ? '已开启' : '去设置') | 183 | Text(this.item.permission ? '已开启' : '去设置') |
| 158 | .fontColor(this.item.permission ? '#666666' : '#CCCCCC') | 184 | .fontColor(this.item.permission ? '#666666' : '#CCCCCC') |
| 159 | - .fontSize('31lpx') | ||
| 160 | - .margin({ right: '8lpx' }) | 185 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 186 | + .margin({ right: `${this.calcHeight(8)}lpx` }) | ||
| 161 | 187 | ||
| 162 | Image($r('app.media.mine_user_arrow')) | 188 | Image($r('app.media.mine_user_arrow')) |
| 163 | - .width('27lpx') | ||
| 164 | - .height('27lpx') | 189 | + .width(`${this.calcHeight(27)}lpx`) |
| 190 | + .height(`${this.calcHeight(27)}lpx`) | ||
| 165 | .objectFit(ImageFit.Auto) | 191 | .objectFit(ImageFit.Auto) |
| 166 | } | 192 | } |
| 167 | 193 | ||
| 168 | } | 194 | } |
| 169 | .alignItems(VerticalAlign.Center) | 195 | .alignItems(VerticalAlign.Center) |
| 170 | .justifyContent(FlexAlign.SpaceBetween) | 196 | .justifyContent(FlexAlign.SpaceBetween) |
| 171 | - .height('97lpx') | 197 | + .height(`${this.calcHeight(97)}lpx`) |
| 172 | .width('100%') | 198 | .width('100%') |
| 173 | - .padding({ left: '29lpx', right: '29lpx' }) | 199 | + .padding({ left: `${this.calcHeight(29)}lpx`, right: `${this.calcHeight(29)}lpx` }) |
| 174 | .backgroundColor('#FFFFFF') | 200 | .backgroundColor('#FFFFFF') |
| 175 | - .borderRadius('8lpx') | 201 | + .borderRadius(`${this.calcHeight(8)}lpx`) |
| 202 | + } | ||
| 203 | + | ||
| 204 | + calcHeight(value:number): number{ | ||
| 205 | + return value * this.percent | ||
| 176 | } | 206 | } |
| 177 | } | 207 | } |
| 178 | 208 | ||
| @@ -180,6 +210,7 @@ struct getArrowCell { | @@ -180,6 +210,7 @@ struct getArrowCell { | ||
| 180 | struct getTuiJianCell { | 210 | struct getTuiJianCell { |
| 181 | @ObjectLink item: PrivacySettingModel; | 211 | @ObjectLink item: PrivacySettingModel; |
| 182 | index:number = 0; | 212 | index:number = 0; |
| 213 | + @Link percent:number | ||
| 183 | build() { | 214 | build() { |
| 184 | Column() { | 215 | Column() { |
| 185 | 216 | ||
| @@ -187,12 +218,12 @@ struct getTuiJianCell { | @@ -187,12 +218,12 @@ struct getTuiJianCell { | ||
| 187 | // 左侧标题 | 218 | // 左侧标题 |
| 188 | Text(this.item.privacyName) | 219 | Text(this.item.privacyName) |
| 189 | .fontColor('#666666') | 220 | .fontColor('#666666') |
| 190 | - .fontSize('31lpx') | 221 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 191 | 222 | ||
| 192 | Row() { | 223 | Row() { |
| 193 | Toggle({ type: ToggleType.Switch, isOn: this.item.permission }) | 224 | Toggle({ type: ToggleType.Switch, isOn: this.item.permission }) |
| 194 | - .height('58lpx') | ||
| 195 | - .width('96lpx') | 225 | + .height(`${this.calcHeight(58)}lpx`) |
| 226 | + .width(`${this.calcHeight(96)}lpx`) | ||
| 196 | .selectedColor('#ED2700') | 227 | .selectedColor('#ED2700') |
| 197 | .onChange((isOn: boolean) => { | 228 | .onChange((isOn: boolean) => { |
| 198 | // this.privacySwitch = isOn; | 229 | // this.privacySwitch = isOn; |
| @@ -203,25 +234,29 @@ struct getTuiJianCell { | @@ -203,25 +234,29 @@ struct getTuiJianCell { | ||
| 203 | } | 234 | } |
| 204 | .alignItems(VerticalAlign.Center) | 235 | .alignItems(VerticalAlign.Center) |
| 205 | .justifyContent(FlexAlign.SpaceBetween) | 236 | .justifyContent(FlexAlign.SpaceBetween) |
| 206 | - .height('97lpx') | 237 | + .height(`${this.calcHeight(97)}lpx`) |
| 207 | .width('100%') | 238 | .width('100%') |
| 208 | 239 | ||
| 209 | 240 | ||
| 210 | Blank() | 241 | Blank() |
| 211 | .backgroundColor('#EDEDED') | 242 | .backgroundColor('#EDEDED') |
| 212 | - .height('1lpx') | 243 | + .height(`${this.calcHeight(1)}lpx`) |
| 213 | 244 | ||
| 214 | Text(DiyCloseTipsString) | 245 | Text(DiyCloseTipsString) |
| 215 | .fontColor('#999999') | 246 | .fontColor('#999999') |
| 216 | - .fontSize('23lpx') | ||
| 217 | - .margin({ right: '8lpx' }) | ||
| 218 | - .height('69lpx') | 247 | + .fontSize(`${this.calcHeight(23)}lpx`) |
| 248 | + .margin({ right: `${this.calcHeight(8)}lpx` }) | ||
| 249 | + .height(`${this.calcHeight(69)}lpx`) | ||
| 219 | 250 | ||
| 220 | - } | 251 | + }.width('100%') |
| 221 | .alignItems(HorizontalAlign.Start) | 252 | .alignItems(HorizontalAlign.Start) |
| 222 | .backgroundColor('#FFFFFF') | 253 | .backgroundColor('#FFFFFF') |
| 223 | - .borderRadius('8lpx') | ||
| 224 | - .padding({ left: '29lpx', right: '29lpx' }) | 254 | + .borderRadius(`${this.calcHeight(8)}lpx`) |
| 255 | + .padding({ left: `${this.calcHeight(29)}lpx`, right: `${this.calcHeight(29)}lpx` }) | ||
| 256 | + } | ||
| 257 | + | ||
| 258 | + calcHeight(value:number): number{ | ||
| 259 | + return value * this.percent | ||
| 225 | } | 260 | } |
| 226 | } | 261 | } |
| 227 | 262 |
| 1 | import { WindowModel } from 'wdKit/Index'; | 1 | import { WindowModel } from 'wdKit/Index'; |
| 2 | +import { TrackConstants } from 'wdTracking/Index'; | ||
| 2 | import { QualityCommentsComponent } from '../comment/view/QualityCommentsComponent'; | 3 | import { QualityCommentsComponent } from '../comment/view/QualityCommentsComponent'; |
| 3 | 4 | ||
| 4 | @Entry | 5 | @Entry |
| 5 | @Component | 6 | @Component |
| 6 | struct QualityCommentsPage { | 7 | struct QualityCommentsPage { |
| 8 | + @Provide pageName: string = TrackConstants.PageName.Best_Comment | ||
| 9 | + @Provide pageId: string = TrackConstants.PageName.Best_Comment | ||
| 10 | + | ||
| 7 | onPageShow(): void { | 11 | onPageShow(): void { |
| 8 | // WindowModel.shared.setWindowLayoutFullScreen(true) | 12 | // WindowModel.shared.setWindowLayoutFullScreen(true) |
| 9 | } | 13 | } |
| @@ -2,7 +2,7 @@ import { MineSettingComponent } from '../setting/MineSettingComponent'; | @@ -2,7 +2,7 @@ import { MineSettingComponent } from '../setting/MineSettingComponent'; | ||
| 2 | import { AccountAndSecurityLayout } from '../setting/AccountAndSecurityLayout'; | 2 | import { AccountAndSecurityLayout } from '../setting/AccountAndSecurityLayout'; |
| 3 | import router from '@ohos.router'; | 3 | import router from '@ohos.router'; |
| 4 | import { Params } from 'wdBean'; | 4 | import { Params } from 'wdBean'; |
| 5 | -import { DateTimeUtils } from 'wdKit/Index'; | 5 | +import { BreakpointSystem, DateTimeUtils } from 'wdKit/Index'; |
| 6 | import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; | 6 | import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; |
| 7 | 7 | ||
| 8 | @Entry | 8 | @Entry |
| @@ -51,6 +51,7 @@ struct SettingPage { | @@ -51,6 +51,7 @@ struct SettingPage { | ||
| 51 | AccountAndSecurityLayout({enterActivityTime:this.enterActivityTime}) | 51 | AccountAndSecurityLayout({enterActivityTime:this.enterActivityTime}) |
| 52 | } | 52 | } |
| 53 | }.setFullWidth() | 53 | }.setFullWidth() |
| 54 | + .backgroundColor($r("app.color.white")) | ||
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | // 私有方法 | 57 | // 私有方法 |
| @@ -45,7 +45,7 @@ export struct TopNavigationComponentNew { | @@ -45,7 +45,7 @@ export struct TopNavigationComponentNew { | ||
| 45 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 45 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 46 | @Link _currentNavIndex?: number; | 46 | @Link _currentNavIndex?: number; |
| 47 | // 顶导当前选中/焦点下标 | 47 | // 顶导当前选中/焦点下标 |
| 48 | - @State currentTopNavSelectedIndex: number = 0; | 48 | + @State @Watch('updateCurrentTopNavSelectedIndex') currentTopNavSelectedIndex: number = 0; |
| 49 | // 顶导数据 | 49 | // 顶导数据 |
| 50 | @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] | 50 | @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] |
| 51 | @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002 | 51 | @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002 |
| @@ -114,20 +114,6 @@ export struct TopNavigationComponentNew { | @@ -114,20 +114,6 @@ export struct TopNavigationComponentNew { | ||
| 114 | .onChange((index) => { | 114 | .onChange((index) => { |
| 115 | Logger.info(TAG, `onChange index : ${index}`); | 115 | Logger.info(TAG, `onChange index : ${index}`); |
| 116 | 116 | ||
| 117 | - // 顶部tab埋点 | ||
| 118 | - if(this.currentBottomNavName === '新闻') { | ||
| 119 | - const tab = this.myChannelList[index] | ||
| 120 | - Logger.info(TAG, `顶部tab : ${JSON.stringify(tab)}`); | ||
| 121 | - | ||
| 122 | - const params: ParamType = { | ||
| 123 | - "pageName": tab.name, | ||
| 124 | - "tabName": tab.name, | ||
| 125 | - "pageId": tab.pageId, | ||
| 126 | - } | ||
| 127 | - Tracking.event("home_page_tab_click ", params) | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - | ||
| 131 | if (this.isBroadcastByIndex(index)) { | 117 | if (this.isBroadcastByIndex(index)) { |
| 132 | // 跳转到播报页面 | 118 | // 跳转到播报页面 |
| 133 | ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId) | 119 | ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId) |
| @@ -217,6 +203,7 @@ export struct TopNavigationComponentNew { | @@ -217,6 +203,7 @@ export struct TopNavigationComponentNew { | ||
| 217 | moreChannelList: $moreChannelList, | 203 | moreChannelList: $moreChannelList, |
| 218 | localChannelList: $localChannelList, | 204 | localChannelList: $localChannelList, |
| 219 | changeTab: (index) => { | 205 | changeTab: (index) => { |
| 206 | + | ||
| 220 | this.changePage(index) | 207 | this.changePage(index) |
| 221 | } | 208 | } |
| 222 | }) | 209 | }) |
| @@ -496,6 +483,32 @@ export struct TopNavigationComponentNew { | @@ -496,6 +483,32 @@ export struct TopNavigationComponentNew { | ||
| 496 | `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); | 483 | `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); |
| 497 | } | 484 | } |
| 498 | 485 | ||
| 486 | + updateCurrentTopNavSelectedIndex() { | ||
| 487 | + Logger.info(TAG, `currentTopNavSelectedIndex : ${this.currentTopNavSelectedIndex}、${this.currentBottomNavName}`); | ||
| 488 | + | ||
| 489 | + // 顶部tab埋点 | ||
| 490 | + if(this.currentBottomNavName === '新闻') { | ||
| 491 | + const tab = this.myChannelList[this.currentTopNavSelectedIndex] | ||
| 492 | + Logger.info(TAG, `新闻tab埋点: ${JSON.stringify(tab)}`); | ||
| 493 | + | ||
| 494 | + const params: ParamType = { | ||
| 495 | + "pageName": tab.name, | ||
| 496 | + "tabName": tab.name, | ||
| 497 | + "pageId": tab.pageId, | ||
| 498 | + } | ||
| 499 | + Tracking.event("home_page_tab_click ", params) | ||
| 500 | + } else if(this.currentBottomNavName === '人民号') { | ||
| 501 | + const tab = this.topNavList[this.currentTopNavSelectedIndex] | ||
| 502 | + Logger.info(TAG, `人民号tab埋点: ${JSON.stringify(tab)}`); | ||
| 503 | + | ||
| 504 | + const params: ParamType = { | ||
| 505 | + "pageName": tab.name, | ||
| 506 | + "tabName": tab.name, | ||
| 507 | + "pageId": tab.pageId, | ||
| 508 | + } | ||
| 509 | + Tracking.event("People_account_page_tab_click", params) | ||
| 510 | + } | ||
| 511 | + } | ||
| 499 | onAutoRefresh() { | 512 | onAutoRefresh() { |
| 500 | if (this.bottomNavIndex != this._currentNavIndex) { | 513 | if (this.bottomNavIndex != this._currentNavIndex) { |
| 501 | return | 514 | return |
| @@ -14,6 +14,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter' | @@ -14,6 +14,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter' | ||
| 14 | import { LazyDataSource } from 'wdKit/Index'; | 14 | import { LazyDataSource } from 'wdKit/Index'; |
| 15 | import LoadMoreLayout from '../page/LoadMoreLayout' | 15 | import LoadMoreLayout from '../page/LoadMoreLayout' |
| 16 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 16 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 17 | +import { TrackConstants, Tracking, TrackingContent, TrackingPageBrowse, TrackParamConvert } from 'wdTracking/Index'; | ||
| 17 | 18 | ||
| 18 | const TAG: string = 'ReserveMorePage'; | 19 | const TAG: string = 'ReserveMorePage'; |
| 19 | 20 | ||
| @@ -47,6 +48,9 @@ struct ReserveMorePage { | @@ -47,6 +48,9 @@ struct ReserveMorePage { | ||
| 47 | @State private liveId: string = '' | 48 | @State private liveId: string = '' |
| 48 | @State isLoadingAttention: boolean = false | 49 | @State isLoadingAttention: boolean = false |
| 49 | @State loadImg: boolean = false; | 50 | @State loadImg: boolean = false; |
| 51 | + private pageId: string = TrackConstants.PageName.Live_Appointment_List | ||
| 52 | + private pageName: string = TrackConstants.PageName.Live_Appointment_List | ||
| 53 | + private pageShowStartTime: number = 0 | ||
| 50 | 54 | ||
| 51 | build() { | 55 | build() { |
| 52 | Column() { | 56 | Column() { |
| @@ -249,8 +253,24 @@ struct ReserveMorePage { | @@ -249,8 +253,24 @@ struct ReserveMorePage { | ||
| 249 | top: index == 0 ? '12vp' : '8vp' | 253 | top: index == 0 ? '12vp' : '8vp' |
| 250 | }) | 254 | }) |
| 251 | .onClick(() => { | 255 | .onClick(() => { |
| 256 | + | ||
| 257 | + // 内容点击埋点 | ||
| 258 | + TrackingContent.common(TrackConstants.EventType.Click, | ||
| 259 | + item.pageId, | ||
| 260 | + item.pageId, | ||
| 261 | + TrackParamConvert.program(item)) | ||
| 262 | + | ||
| 252 | ProcessUtils.processPage(item) | 263 | ProcessUtils.processPage(item) |
| 253 | }) | 264 | }) |
| 265 | + .onVisibleAreaChange([0, 1], (isVisiable: boolean, ratio: number) => { | ||
| 266 | + if (isVisiable) { | ||
| 267 | + // 内容曝光埋点 | ||
| 268 | + TrackingContent.common(TrackConstants.EventType.Show, | ||
| 269 | + item.pageId, | ||
| 270 | + item.pageId, | ||
| 271 | + TrackParamConvert.program(item)) | ||
| 272 | + } | ||
| 273 | + }) | ||
| 254 | } | 274 | } |
| 255 | 275 | ||
| 256 | /*导航栏*/ | 276 | /*导航栏*/ |
| @@ -358,12 +378,18 @@ struct ReserveMorePage { | @@ -358,12 +378,18 @@ struct ReserveMorePage { | ||
| 358 | } | 378 | } |
| 359 | 379 | ||
| 360 | onPageShow(): void { | 380 | onPageShow(): void { |
| 381 | + this.pageShowStartTime = Date.now() | ||
| 361 | if (this.isShow) { | 382 | if (this.isShow) { |
| 362 | this.data.reloadData() | 383 | this.data.reloadData() |
| 363 | this.isShow = false | 384 | this.isShow = false |
| 364 | } | 385 | } |
| 365 | } | 386 | } |
| 366 | 387 | ||
| 388 | + onPageHide(): void { | ||
| 389 | + const duration = Date.now() - this.pageShowStartTime | ||
| 390 | + TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId, this.pageName, duration) | ||
| 391 | + } | ||
| 392 | + | ||
| 367 | private async getData(resolve?: (value: string | PromiseLike<string>) => void) { | 393 | private async getData(resolve?: (value: string | PromiseLike<string>) => void) { |
| 368 | if (this.isLoading) { | 394 | if (this.isLoading) { |
| 369 | if (resolve) { | 395 | if (resolve) { |
| @@ -386,6 +412,8 @@ struct ReserveMorePage { | @@ -386,6 +412,8 @@ struct ReserveMorePage { | ||
| 386 | this.reserveList = [] | 412 | this.reserveList = [] |
| 387 | this.reservedIds = [] | 413 | this.reservedIds = [] |
| 388 | } | 414 | } |
| 415 | + | ||
| 416 | + liveReviewDTO.list.forEach((content) => { content.pageId = this.pageId }) | ||
| 389 | this.data.push(...liveReviewDTO.list) | 417 | this.data.push(...liveReviewDTO.list) |
| 390 | //批量查询关注状态 | 418 | //批量查询关注状态 |
| 391 | this.getAppointmentInfo(liveReviewDTO.list) | 419 | this.getAppointmentInfo(liveReviewDTO.list) |
| @@ -488,6 +516,11 @@ struct ReserveMorePage { | @@ -488,6 +516,11 @@ struct ReserveMorePage { | ||
| 488 | this.isLoadingAttention = true | 516 | this.isLoadingAttention = true |
| 489 | this.liveId = reserveItem.liveId.toString() | 517 | this.liveId = reserveItem.liveId.toString() |
| 490 | try { | 518 | try { |
| 519 | + | ||
| 520 | + // 埋点 | ||
| 521 | + Tracking.event(!reserveItem.subscribe ? "live_subscribe_click":"cancel_live_subscribe_click", | ||
| 522 | + TrackParamConvert.program(item)) | ||
| 523 | + | ||
| 491 | const res = await LiveModel.liveAppointment(reserveItem.relationId, reserveItem.liveId.toString(), | 524 | const res = await LiveModel.liveAppointment(reserveItem.relationId, reserveItem.liveId.toString(), |
| 492 | !reserveItem.subscribe); | 525 | !reserveItem.subscribe); |
| 493 | if (res.code == 0) { | 526 | if (res.code == 0) { |
| @@ -4,14 +4,15 @@ import router from '@ohos.router' | @@ -4,14 +4,15 @@ import router from '@ohos.router' | ||
| 4 | export struct CustomTitleUI { | 4 | export struct CustomTitleUI { |
| 5 | imgBack:boolean = true | 5 | imgBack:boolean = true |
| 6 | titleName:ResourceStr = "默认标题" | 6 | titleName:ResourceStr = "默认标题" |
| 7 | + @Prop percent:number = 1 | ||
| 7 | 8 | ||
| 8 | build() { | 9 | build() { |
| 9 | RelativeContainer() { | 10 | RelativeContainer() { |
| 10 | //标题栏目 | 11 | //标题栏目 |
| 11 | if(this.imgBack){ | 12 | if(this.imgBack){ |
| 12 | Image($r('app.media.back_icon')) | 13 | Image($r('app.media.back_icon')) |
| 13 | - .width('46lpx') | ||
| 14 | - .height('46lpx') | 14 | + .width(`${this.calcHeight(46)}lpx`) |
| 15 | + .height(`${this.calcHeight(46)}lpx`) | ||
| 15 | .objectFit(ImageFit.Auto) | 16 | .objectFit(ImageFit.Auto) |
| 16 | .interpolation(ImageInterpolation.High) | 17 | .interpolation(ImageInterpolation.High) |
| 17 | .id("back_icon") | 18 | .id("back_icon") |
| @@ -19,7 +20,7 @@ export struct CustomTitleUI { | @@ -19,7 +20,7 @@ export struct CustomTitleUI { | ||
| 19 | center: {anchor: "__container__", align: VerticalAlign.Center}, | 20 | center: {anchor: "__container__", align: VerticalAlign.Center}, |
| 20 | left: {anchor: "__container__", align: HorizontalAlign.Start} | 21 | left: {anchor: "__container__", align: HorizontalAlign.Start} |
| 21 | }) | 22 | }) |
| 22 | - .margin({left:'31lpx'}) | 23 | + .margin({left:`${this.calcHeight(31)}lpx`}) |
| 23 | .onClick(()=>{ | 24 | .onClick(()=>{ |
| 24 | router.back() | 25 | router.back() |
| 25 | }) | 26 | }) |
| @@ -28,18 +29,22 @@ export struct CustomTitleUI { | @@ -28,18 +29,22 @@ export struct CustomTitleUI { | ||
| 28 | Text(this.titleName) | 29 | Text(this.titleName) |
| 29 | .maxLines(1) | 30 | .maxLines(1) |
| 30 | .id("title") | 31 | .id("title") |
| 31 | - .fontSize('30lpx') | 32 | + .fontSize(`${this.calcHeight(30)}lpx`) |
| 32 | .fontWeight(400) | 33 | .fontWeight(400) |
| 33 | .fontColor($r('app.color.color_222222')) | 34 | .fontColor($r('app.color.color_222222')) |
| 34 | - .lineHeight('43lpx') | 35 | + .lineHeight(`${this.calcHeight(43)}lpx`) |
| 35 | .alignRules({ | 36 | .alignRules({ |
| 36 | center: {anchor: "__container__", align: VerticalAlign.Center}, | 37 | center: {anchor: "__container__", align: VerticalAlign.Center}, |
| 37 | middle: {anchor: "__container__", align: HorizontalAlign.Center} | 38 | middle: {anchor: "__container__", align: HorizontalAlign.Center} |
| 38 | }) | 39 | }) |
| 39 | 40 | ||
| 40 | } | 41 | } |
| 41 | - .height('84lpx') | 42 | + .height(`${this.calcHeight(84)}lpx`) |
| 42 | .width('100%') | 43 | .width('100%') |
| 43 | .backgroundColor($r('app.color.white')) | 44 | .backgroundColor($r('app.color.white')) |
| 44 | } | 45 | } |
| 46 | + | ||
| 47 | + calcHeight(value:number): number{ | ||
| 48 | + return value * this.percent | ||
| 49 | + } | ||
| 45 | } | 50 | } |
| 1 | import router from '@ohos.router' | 1 | import router from '@ohos.router' |
| 2 | -import { NetworkUtil, StringUtils, ToastUtils } from 'wdKit' | 2 | +import { BreakpointSystem, NetworkUtil, StringUtils, ToastUtils } from 'wdKit' |
| 3 | import { ParamType, TrackConstants, Tracking } from 'wdTracking/Index' | 3 | import { ParamType, TrackConstants, Tracking } from 'wdTracking/Index' |
| 4 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 4 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| 5 | import { SearchHistoryItem } from '../../viewmodel/SearchHistoryItem' | 5 | import { SearchHistoryItem } from '../../viewmodel/SearchHistoryItem' |
| 6 | import { SearchRelatedItem } from '../../viewmodel/SearchRelatedItem' | 6 | import { SearchRelatedItem } from '../../viewmodel/SearchRelatedItem' |
| 7 | -import { EmptyComponent } from '../view/EmptyComponent' | ||
| 8 | import { SearchHistoryComponent } from './SearchHistoryComponent' | 7 | import { SearchHistoryComponent } from './SearchHistoryComponent' |
| 9 | import { SearchHotsComponent } from './SearchHotsComponent' | 8 | import { SearchHotsComponent } from './SearchHotsComponent' |
| 10 | import { SearchRelatedComponent } from './SearchRelatedComponent' | 9 | import { SearchRelatedComponent } from './SearchRelatedComponent' |
| @@ -34,7 +33,22 @@ export struct SearchComponent { | @@ -34,7 +33,22 @@ export struct SearchComponent { | ||
| 34 | @State isGetRequest:boolean = false | 33 | @State isGetRequest:boolean = false |
| 35 | @Link fromTabName: string | 34 | @Link fromTabName: string |
| 36 | 35 | ||
| 36 | + @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; | ||
| 37 | + private breakpointSystem = new BreakpointSystem(); | ||
| 38 | + @State percent:number = 1 | ||
| 39 | + | ||
| 40 | + currentChanged(){ | ||
| 41 | + if(this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"){ | ||
| 42 | + this.percent = 0.7 | ||
| 43 | + }else { | ||
| 44 | + this.percent = 1 | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + | ||
| 37 | aboutToAppear() { | 49 | aboutToAppear() { |
| 50 | + this.breakpointSystem.register(); | ||
| 51 | + this.currentChanged() | ||
| 38 | //获取提示滚动 | 52 | //获取提示滚动 |
| 39 | this.getSearchHint() | 53 | this.getSearchHint() |
| 40 | //清除缓存 | 54 | //清除缓存 |
| @@ -49,6 +63,11 @@ export struct SearchComponent { | @@ -49,6 +63,11 @@ export struct SearchComponent { | ||
| 49 | }, 1000); | 63 | }, 1000); |
| 50 | } | 64 | } |
| 51 | 65 | ||
| 66 | + aboutToDisappear(): void { | ||
| 67 | + this.breakpointSystem.unregister(); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + | ||
| 52 | getRelatedSearchContent() { | 71 | getRelatedSearchContent() { |
| 53 | if(StringUtils.isNotEmpty(this.searchText)){ | 72 | if(StringUtils.isNotEmpty(this.searchText)){ |
| 54 | SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(this.searchText),getContext(this)).then((value) => { | 73 | SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(this.searchText),getContext(this)).then((value) => { |
| @@ -127,26 +146,26 @@ export struct SearchComponent { | @@ -127,26 +146,26 @@ export struct SearchComponent { | ||
| 127 | Scroll(this.scroller) { | 146 | Scroll(this.scroller) { |
| 128 | Column() { | 147 | Column() { |
| 129 | if(this.searchHistoryData!=null && this.searchHistoryData.length>0){ | 148 | if(this.searchHistoryData!=null && this.searchHistoryData.length>0){ |
| 130 | - SearchHistoryComponent({ searchHistoryData: $searchHistoryData, onDelHistory: (): void => this.getSearchHistoryData(),onGetSearchRes: (item,index): void => this.getSearchHistoryResData(item,index),onCloseInput : (): void => this.stopInput() }) | 149 | + SearchHistoryComponent({ searchHistoryData: $searchHistoryData, onDelHistory: (): void => this.getSearchHistoryData(),onGetSearchRes: (item,index): void => this.getSearchHistoryResData(item,index),onCloseInput : (): void => this.stopInput(),percent:this.percent }) |
| 131 | } | 150 | } |
| 132 | 151 | ||
| 133 | if(this.searchHistoryData.length>0){ | 152 | if(this.searchHistoryData.length>0){ |
| 134 | //分隔符 | 153 | //分隔符 |
| 135 | Divider() | 154 | Divider() |
| 136 | .width('100%') | 155 | .width('100%') |
| 137 | - .height('1lpx') | 156 | + .height(`${this.calcHeight(1)}lpx`) |
| 138 | .color($r('app.color.color_EDEDED')) | 157 | .color($r('app.color.color_EDEDED')) |
| 139 | - .strokeWidth('1lpx') | 158 | + .strokeWidth(`${this.calcHeight(1)}lpx`) |
| 140 | } | 159 | } |
| 141 | 160 | ||
| 142 | - SearchHotsComponent({onGetSearchRes: (item): void => this.getSearchHotResData(item)}) | 161 | + SearchHotsComponent({onGetSearchRes: (item): void => this.getSearchHotResData(item),percent:this.percent}) |
| 143 | } | 162 | } |
| 144 | } | 163 | } |
| 145 | .scrollable(ScrollDirection.Vertical) | 164 | .scrollable(ScrollDirection.Vertical) |
| 146 | .scrollBar(BarState.Off) | 165 | .scrollBar(BarState.Off) |
| 147 | .width('100%') | 166 | .width('100%') |
| 148 | .height('100%') | 167 | .height('100%') |
| 149 | - .padding({ left: '31lpx', right: '31lpx' }) | 168 | + .padding({ left: `${this.calcHeight(31)}lpx`, right: `${this.calcHeight(31)}lpx` }) |
| 150 | } else { | 169 | } else { |
| 151 | if (this.hasChooseSearch) { | 170 | if (this.hasChooseSearch) { |
| 152 | //搜索结果 | 171 | //搜索结果 |
| @@ -156,10 +175,10 @@ export struct SearchComponent { | @@ -156,10 +175,10 @@ export struct SearchComponent { | ||
| 156 | this.getSearchHistoryData() | 175 | this.getSearchHistoryData() |
| 157 | this.getSearchInputResData(this.searchText) | 176 | this.getSearchInputResData(this.searchText) |
| 158 | } | 177 | } |
| 159 | - }}) | 178 | + },percent:this.percent}) |
| 160 | } else { | 179 | } else { |
| 161 | //联想搜索 | 180 | //联想搜索 |
| 162 | - SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText}) | 181 | + SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText,percent:this.percent}) |
| 163 | } | 182 | } |
| 164 | } | 183 | } |
| 165 | }.height('100%') | 184 | }.height('100%') |
| @@ -244,14 +263,14 @@ export struct SearchComponent { | @@ -244,14 +263,14 @@ export struct SearchComponent { | ||
| 244 | Swiper(this.swiperController) { | 263 | Swiper(this.swiperController) { |
| 245 | ForEach(this.searchTextData, (item: string, index: number) => { | 264 | ForEach(this.searchTextData, (item: string, index: number) => { |
| 246 | Text(item) | 265 | Text(item) |
| 247 | - .fontWeight('400lpx') | ||
| 248 | - .fontSize('25lpx') | 266 | + .fontWeight(400) |
| 267 | + .fontSize(`${this.calcHeight(25)}lpx`) | ||
| 249 | .fontColor($r('app.color.color_666666')) | 268 | .fontColor($r('app.color.color_666666')) |
| 250 | - .lineHeight('35lpx') | 269 | + .lineHeight(`${this.calcHeight(35)}lpx`) |
| 251 | .textAlign(TextAlign.Start) | 270 | .textAlign(TextAlign.Start) |
| 252 | .maxLines(1) | 271 | .maxLines(1) |
| 253 | .textOverflow({ overflow: TextOverflow.Clip }) | 272 | .textOverflow({ overflow: TextOverflow.Clip }) |
| 254 | - .margin({ left: '40lpx' }) | 273 | + .margin({ left: `${this.calcHeight(40)}lpx` }) |
| 255 | }) | 274 | }) |
| 256 | } | 275 | } |
| 257 | .loop(true) | 276 | .loop(true) |
| @@ -268,9 +287,9 @@ export struct SearchComponent { | @@ -268,9 +287,9 @@ export struct SearchComponent { | ||
| 268 | Row(){ | 287 | Row(){ |
| 269 | Search({ value: this.searchText, placeholder: '', controller: this.controller}) | 288 | Search({ value: this.searchText, placeholder: '', controller: this.controller}) |
| 270 | .layoutWeight(1) | 289 | .layoutWeight(1) |
| 271 | - .height('69lpx') | 290 | + .height(`${this.calcHeight(69)}lpx`) |
| 272 | .backgroundColor($r('app.color.color_transparent')) | 291 | .backgroundColor($r('app.color.color_transparent')) |
| 273 | - .textFont({ size: "27lpx", weight: "400lpx" }) | 292 | + .textFont({ size: `${this.calcHeight(27)}lpx`, weight: 400 }) |
| 274 | // .defaultFocus(true) | 293 | // .defaultFocus(true) |
| 275 | .id("searchId") | 294 | .id("searchId") |
| 276 | .searchIcon({ | 295 | .searchIcon({ |
| @@ -318,42 +337,44 @@ export struct SearchComponent { | @@ -318,42 +337,44 @@ export struct SearchComponent { | ||
| 318 | } | 337 | } |
| 319 | } | 338 | } |
| 320 | }) | 339 | }) |
| 321 | - }.padding({right:'70lpx'}) | ||
| 322 | - .layoutWeight(1) | ||
| 323 | 340 | ||
| 324 | Image($r('app.media.search_input_del_icon')) | 341 | Image($r('app.media.search_input_del_icon')) |
| 325 | - .width("31lpx") | ||
| 326 | - .height("31lpx") | 342 | + .width(`${this.calcHeight(31)}lpx`) |
| 343 | + .height(`${this.calcHeight(31)}lpx`) | ||
| 327 | .objectFit(ImageFit.Auto) | 344 | .objectFit(ImageFit.Auto) |
| 328 | .interpolation(ImageInterpolation.Medium) | 345 | .interpolation(ImageInterpolation.Medium) |
| 329 | - .margin({left:"495lpx"}) | ||
| 330 | .onClick(()=>{ | 346 | .onClick(()=>{ |
| 331 | this.searchText = "" | 347 | this.searchText = "" |
| 332 | }) | 348 | }) |
| 349 | + .offset({x:10}) | ||
| 350 | + .enabled(true) | ||
| 333 | .visibility(StringUtils.isEmpty(this.searchText) ? Visibility.Hidden : Visibility.Visible) | 351 | .visibility(StringUtils.isEmpty(this.searchText) ? Visibility.Hidden : Visibility.Visible) |
| 334 | 352 | ||
| 353 | + }.padding({right:`${this.calcHeight(70)}lpx`}) | ||
| 354 | + .layoutWeight(1) | ||
| 355 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 335 | } | 356 | } |
| 336 | .backgroundImage($r('app.media.search_page_input_bg')) | 357 | .backgroundImage($r('app.media.search_page_input_bg')) |
| 337 | .backgroundImageSize(ImageSize.Cover) | 358 | .backgroundImageSize(ImageSize.Cover) |
| 338 | .layoutWeight(1) | 359 | .layoutWeight(1) |
| 339 | - .height('69lpx') | 360 | + .height(`${this.calcHeight(69)}lpx`) |
| 340 | 361 | ||
| 341 | //TODO 需要修改输入法 换行 | 362 | //TODO 需要修改输入法 换行 |
| 342 | //右 | 363 | //右 |
| 343 | Text("取消") | 364 | Text("取消") |
| 344 | .textAlign(TextAlign.Center) | 365 | .textAlign(TextAlign.Center) |
| 345 | - .fontWeight('400lpx') | ||
| 346 | - .fontSize('31lpx') | ||
| 347 | - .lineHeight('58lpx') | 366 | + .fontWeight(400) |
| 367 | + .fontSize(`${this.calcHeight(31)}lpx`) | ||
| 368 | + .lineHeight(`${this.calcHeight(58)}lpx`) | ||
| 348 | .fontColor($r('app.color.color_222222')) | 369 | .fontColor($r('app.color.color_222222')) |
| 349 | - .width('125lpx') | ||
| 350 | - .height('58lpx') | 370 | + .width(`${this.calcHeight(125)}lpx`) |
| 371 | + .height(`${this.calcHeight(58)}lpx`) | ||
| 351 | .onClick(() => { | 372 | .onClick(() => { |
| 352 | router.back() | 373 | router.back() |
| 353 | }) | 374 | }) |
| 354 | } | 375 | } |
| 355 | - .height('85lpx') | ||
| 356 | - .padding({ left: '31lpx' }) | 376 | + .height(`${this.calcHeight(85)}lpx`) |
| 377 | + .padding({ left: `${this.calcHeight(31)}lpx` }) | ||
| 357 | .alignItems(VerticalAlign.Center) | 378 | .alignItems(VerticalAlign.Center) |
| 358 | } | 379 | } |
| 359 | 380 | ||
| @@ -395,6 +416,10 @@ export struct SearchComponent { | @@ -395,6 +416,10 @@ export struct SearchComponent { | ||
| 395 | this.isClickedInputSearch = false | 416 | this.isClickedInputSearch = false |
| 396 | this.isClickedHintSearch = false | 417 | this.isClickedHintSearch = false |
| 397 | } | 418 | } |
| 419 | + | ||
| 420 | + calcHeight(value:number): number{ | ||
| 421 | + return value * this.percent | ||
| 422 | + } | ||
| 398 | } | 423 | } |
| 399 | 424 | ||
| 400 | function trackSearchClick(upOneLevelPageName: string,keyword:string){ | 425 | function trackSearchClick(upOneLevelPageName: string,keyword:string){ |
| @@ -27,6 +27,7 @@ export struct SearchHistoryComponent{ | @@ -27,6 +27,7 @@ export struct SearchHistoryComponent{ | ||
| 27 | alignment: DialogAlignment.Center, | 27 | alignment: DialogAlignment.Center, |
| 28 | customStyle: true | 28 | customStyle: true |
| 29 | }) | 29 | }) |
| 30 | + @Prop percent:number = 1 | ||
| 30 | 31 | ||
| 31 | onAccept(){ | 32 | onAccept(){ |
| 32 | console.info('Callback when the second button is clicked') | 33 | console.info('Callback when the second button is clicked') |
| @@ -48,14 +49,14 @@ export struct SearchHistoryComponent{ | @@ -48,14 +49,14 @@ export struct SearchHistoryComponent{ | ||
| 48 | Text("搜索历史") | 49 | Text("搜索历史") |
| 49 | .textAlign(TextAlign.Center) | 50 | .textAlign(TextAlign.Center) |
| 50 | .fontWeight(FontWeight.Regular) | 51 | .fontWeight(FontWeight.Regular) |
| 51 | - .fontSize('27lpx') | ||
| 52 | - .lineHeight('38lpx') | 52 | + .fontSize(`${this.calcHeight(27)}lpx`) |
| 53 | + .lineHeight(`${this.calcHeight(38)}lpx`) | ||
| 53 | .fontColor($r('app.color.color_999999')) | 54 | .fontColor($r('app.color.color_999999')) |
| 54 | - .height('38lpx') | 55 | + .height(`${this.calcHeight(38)}lpx`) |
| 55 | 56 | ||
| 56 | Image($r('app.media.search_delete_icon')) | 57 | Image($r('app.media.search_delete_icon')) |
| 57 | - .height('31lpx') | ||
| 58 | - .width('31lpx') | 58 | + .height(`${this.calcHeight(31)}lpx`) |
| 59 | + .width(`${this.calcHeight(31)}lpx`) | ||
| 59 | .interpolation(ImageInterpolation.High) | 60 | .interpolation(ImageInterpolation.High) |
| 60 | .objectFit(ImageFit.Auto) | 61 | .objectFit(ImageFit.Auto) |
| 61 | .onClick(()=>{ | 62 | .onClick(()=>{ |
| @@ -63,7 +64,7 @@ export struct SearchHistoryComponent{ | @@ -63,7 +64,7 @@ export struct SearchHistoryComponent{ | ||
| 63 | this.dialogController.open() | 64 | this.dialogController.open() |
| 64 | }) | 65 | }) |
| 65 | }.justifyContent(FlexAlign.SpaceBetween) | 66 | }.justifyContent(FlexAlign.SpaceBetween) |
| 66 | - .margin({bottom:'17lpx'}) | 67 | + .margin({bottom:`${this.calcHeight(17)}lpx`}) |
| 67 | .width('100%') | 68 | .width('100%') |
| 68 | 69 | ||
| 69 | Grid(){ | 70 | Grid(){ |
| @@ -72,14 +73,14 @@ export struct SearchHistoryComponent{ | @@ -72,14 +73,14 @@ export struct SearchHistoryComponent{ | ||
| 72 | Row(){ | 73 | Row(){ |
| 73 | Text(`${item.searchContent}`) | 74 | Text(`${item.searchContent}`) |
| 74 | .fontColor($r('app.color.color_222222')) | 75 | .fontColor($r('app.color.color_222222')) |
| 75 | - .fontSize('31lpx') | 76 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 76 | .fontWeight(FontWeight.Regular) | 77 | .fontWeight(FontWeight.Regular) |
| 77 | - .lineHeight('46lpx') | 78 | + .lineHeight(`${this.calcHeight(46)}lpx`) |
| 78 | .maxLines(1) | 79 | .maxLines(1) |
| 79 | - .constraintSize({maxWidth:index%2 === 0?'270lpx':'230lpx'}) | 80 | + .constraintSize({maxWidth:index%2 === 0?`${this.calcHeight(270)}lpx`:`${this.calcHeight(230)}lpx`}) |
| 80 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 81 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 81 | .textAlign(TextAlign.Start) | 82 | .textAlign(TextAlign.Start) |
| 82 | - .margin({left:index%2 === 0?'0lpx':'23lpx'}) | 83 | + .margin({left:index%2 === 0?'0lpx':`${this.calcHeight(23)}lpx`}) |
| 83 | .onClick(()=>{ | 84 | .onClick(()=>{ |
| 84 | if (this.onGetSearchRes !== undefined) { | 85 | if (this.onGetSearchRes !== undefined) { |
| 85 | this.onGetSearchRes(item.searchContent,index) | 86 | this.onGetSearchRes(item.searchContent,index) |
| @@ -87,9 +88,9 @@ export struct SearchHistoryComponent{ | @@ -87,9 +88,9 @@ export struct SearchHistoryComponent{ | ||
| 87 | }) | 88 | }) |
| 88 | 89 | ||
| 89 | Image($r('app.media.search_item_delete_icon')) | 90 | Image($r('app.media.search_item_delete_icon')) |
| 90 | - .width('23lpx') | ||
| 91 | - .height('23lpx') | ||
| 92 | - .margin({left:'4lpx'}) | 91 | + .width(`${this.calcHeight(23)}lpx`) |
| 92 | + .height(`${this.calcHeight(23)}lpx`) | ||
| 93 | + .margin({left:`${this.calcHeight(4)}lpx`}) | ||
| 93 | .interpolation(ImageInterpolation.Medium) | 94 | .interpolation(ImageInterpolation.Medium) |
| 94 | .objectFit(ImageFit.Auto) | 95 | .objectFit(ImageFit.Auto) |
| 95 | .onClick(()=>{ | 96 | .onClick(()=>{ |
| @@ -103,19 +104,19 @@ export struct SearchHistoryComponent{ | @@ -103,19 +104,19 @@ export struct SearchHistoryComponent{ | ||
| 103 | 104 | ||
| 104 | if(index%2 === 0 && index != this.searchHistoryData.length-1 ){ | 105 | if(index%2 === 0 && index != this.searchHistoryData.length-1 ){ |
| 105 | Divider() | 106 | Divider() |
| 106 | - .width('2lpx') | ||
| 107 | - .height('23lpx') | 107 | + .width(`${this.calcHeight(2)}lpx`) |
| 108 | + .height(`${this.calcHeight(23)}lpx`) | ||
| 108 | .color($r('app.color.color_CCCCCC')) | 109 | .color($r('app.color.color_CCCCCC')) |
| 109 | - .strokeWidth('2lpx') | 110 | + .strokeWidth(`${this.calcHeight(2)}lpx`) |
| 110 | .vertical(true) | 111 | .vertical(true) |
| 111 | } | 112 | } |
| 112 | }.height('100%') | 113 | }.height('100%') |
| 113 | .alignItems(VerticalAlign.Center) | 114 | .alignItems(VerticalAlign.Center) |
| 114 | .width('100%') | 115 | .width('100%') |
| 115 | - .margin({left:index%2 === 1?'23lpx':'0lpx'}) | 116 | + .margin({left:index%2 === 1?`${this.calcHeight(23)}lpx`:'0lpx'}) |
| 116 | 117 | ||
| 117 | } | 118 | } |
| 118 | - .height('46lpx') | 119 | + .height(`${this.calcHeight(46)}lpx`) |
| 119 | .alignSelf(ItemAlign.Center) | 120 | .alignSelf(ItemAlign.Center) |
| 120 | 121 | ||
| 121 | }) | 122 | }) |
| @@ -123,9 +124,9 @@ export struct SearchHistoryComponent{ | @@ -123,9 +124,9 @@ export struct SearchHistoryComponent{ | ||
| 123 | .height(this.getCategoryViewHeight()) | 124 | .height(this.getCategoryViewHeight()) |
| 124 | .rowsTemplate(this.getCategoryRowTmpl()) | 125 | .rowsTemplate(this.getCategoryRowTmpl()) |
| 125 | .columnsTemplate('1fr 1fr') | 126 | .columnsTemplate('1fr 1fr') |
| 126 | - .rowsGap('23lpx') | 127 | + .rowsGap(`${this.calcHeight(23)}lpx`) |
| 127 | } | 128 | } |
| 128 | - .margin({top:"36lpx",bottom:'46lpx'}) | 129 | + .margin({top:`${this.calcHeight(36)}lpx`,bottom:`${this.calcHeight(46)}lpx`}) |
| 129 | } | 130 | } |
| 130 | 131 | ||
| 131 | getCategoryRowCount() { | 132 | getCategoryRowCount() { |
| @@ -140,6 +141,10 @@ export struct SearchHistoryComponent{ | @@ -140,6 +141,10 @@ export struct SearchHistoryComponent{ | ||
| 140 | } | 141 | } |
| 141 | 142 | ||
| 142 | getCategoryViewHeight() { | 143 | getCategoryViewHeight() { |
| 143 | - return `${50 * this.getCategoryRowCount()}lpx`; | 144 | + return `${50 * this.percent * this.getCategoryRowCount()}lpx`; |
| 145 | + } | ||
| 146 | + | ||
| 147 | + calcHeight(value:number): number{ | ||
| 148 | + return value * this.percent | ||
| 144 | } | 149 | } |
| 145 | } | 150 | } |
| @@ -10,6 +10,7 @@ const TAG = "SearchHotsComponent" | @@ -10,6 +10,7 @@ const TAG = "SearchHotsComponent" | ||
| 10 | export struct SearchHotsComponent{ | 10 | export struct SearchHotsComponent{ |
| 11 | @State searchHotsData:SearchHotContentItem[] = [] | 11 | @State searchHotsData:SearchHotContentItem[] = [] |
| 12 | onGetSearchRes?: (item:string) => void; | 12 | onGetSearchRes?: (item:string) => void; |
| 13 | + @Prop percent:number = 1 | ||
| 13 | 14 | ||
| 14 | aboutToAppear(){ | 15 | aboutToAppear(){ |
| 15 | //获取搜索热词 | 16 | //获取搜索热词 |
| @@ -34,22 +35,22 @@ export struct SearchHotsComponent{ | @@ -34,22 +35,22 @@ export struct SearchHotsComponent{ | ||
| 34 | if(this.searchHotsData.length>0){ | 35 | if(this.searchHotsData.length>0){ |
| 35 | Row() { | 36 | Row() { |
| 36 | Image($r('app.media.search_hot_icon')) | 37 | Image($r('app.media.search_hot_icon')) |
| 37 | - .width('46lpx') | ||
| 38 | - .height('46lpx') | 38 | + .width(`${this.calcHeight(46)}lpx`) |
| 39 | + .height(`${this.calcHeight(46)}lpx`) | ||
| 39 | .objectFit(ImageFit.Auto) | 40 | .objectFit(ImageFit.Auto) |
| 40 | - .margin({right:'8lpx'}) | 41 | + .margin({right:`${this.calcHeight(8)}lpx`}) |
| 41 | .interpolation(ImageInterpolation.Medium) | 42 | .interpolation(ImageInterpolation.Medium) |
| 42 | 43 | ||
| 43 | Text("热门搜索") | 44 | Text("热门搜索") |
| 44 | .textAlign(TextAlign.Center) | 45 | .textAlign(TextAlign.Center) |
| 45 | .fontWeight(FontWeight.Bold) | 46 | .fontWeight(FontWeight.Bold) |
| 46 | - .fontSize('33lpx') | ||
| 47 | - .lineHeight('46lpx') | 47 | + .fontSize(`${this.calcHeight(33)}lpx`) |
| 48 | + .lineHeight(`${this.calcHeight(46)}lpx`) | ||
| 48 | .fontColor($r('app.color.color_222222')) | 49 | .fontColor($r('app.color.color_222222')) |
| 49 | - .height('46lpx') | 50 | + .height(`${this.calcHeight(46)}lpx`) |
| 50 | } | 51 | } |
| 51 | .width('100%') | 52 | .width('100%') |
| 52 | - .margin({bottom:"15lpx"}) | 53 | + .margin({bottom:`${this.calcHeight(15)}lpx`}) |
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | List(){ | 56 | List(){ |
| @@ -60,49 +61,49 @@ export struct SearchHotsComponent{ | @@ -60,49 +61,49 @@ export struct SearchHotsComponent{ | ||
| 60 | Row(){ | 61 | Row(){ |
| 61 | if(item.sequence <=3){ | 62 | if(item.sequence <=3){ |
| 62 | Image(item.sequence===1?$r('app.media.search_hot_num1'):item.sequence===2?$r('app.media.search_hot_num2'):$r('app.media.search_hot_num3')) | 63 | Image(item.sequence===1?$r('app.media.search_hot_num1'):item.sequence===2?$r('app.media.search_hot_num2'):$r('app.media.search_hot_num3')) |
| 63 | - .width('27lpx') | ||
| 64 | - .height('35lpx') | 64 | + .width(`${this.calcHeight(27)}lpx`) |
| 65 | + .height(`${this.calcHeight(35)}lpx`) | ||
| 65 | .objectFit(ImageFit.Auto) | 66 | .objectFit(ImageFit.Auto) |
| 66 | - .margin({right:'12lpx'}) | 67 | + .margin({right:`${this.calcHeight(12)}lpx`}) |
| 67 | .interpolation(ImageInterpolation.High) | 68 | .interpolation(ImageInterpolation.High) |
| 68 | }else { | 69 | }else { |
| 69 | Text(`${item.sequence}`) | 70 | Text(`${item.sequence}`) |
| 70 | - .height('31lpx') | 71 | + .height(`${this.calcHeight(31)}lpx`) |
| 71 | .fontColor($r('app.color.color_666666')) | 72 | .fontColor($r('app.color.color_666666')) |
| 72 | - .fontSize('27lpx') | 73 | + .fontSize(`${this.calcHeight(27)}lpx`) |
| 73 | .fontWeight(FontWeight.Regular) | 74 | .fontWeight(FontWeight.Regular) |
| 74 | - .lineHeight('31lpx') | ||
| 75 | - .margin({right:'12lpx'}) | 75 | + .lineHeight(`${this.calcHeight(31)}lpx`) |
| 76 | + .margin({right:`${this.calcHeight(12)}lpx`}) | ||
| 76 | } | 77 | } |
| 77 | Text(`${item.hotEntry}`) | 78 | Text(`${item.hotEntry}`) |
| 78 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 79 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 79 | .fontColor($r('app.color.color_222222')) | 80 | .fontColor($r('app.color.color_222222')) |
| 80 | - .fontSize('31lpx') | 81 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 81 | .maxLines(1) | 82 | .maxLines(1) |
| 82 | .fontWeight(FontWeight.Regular) | 83 | .fontWeight(FontWeight.Regular) |
| 83 | - .lineHeight('42lpx') | 84 | + .lineHeight(`${this.calcHeight(42)}lpx`) |
| 84 | }.layoutWeight(1) | 85 | }.layoutWeight(1) |
| 85 | 86 | ||
| 86 | if(item.mark===1 || item.mark===2){ | 87 | if(item.mark===1 || item.mark===2){ |
| 87 | Image(item.mark===1?$r('app.media.search_hots_mark1'):$r('app.media.search_hots_mark2')) | 88 | Image(item.mark===1?$r('app.media.search_hots_mark1'):$r('app.media.search_hots_mark2')) |
| 88 | - .width('42lpx') | ||
| 89 | - .height('31lpx') | 89 | + .width(`${this.calcHeight(42)}lpx`) |
| 90 | + .height(`${this.calcHeight(31)}lpx`) | ||
| 90 | .objectFit(ImageFit.Auto) | 91 | .objectFit(ImageFit.Auto) |
| 91 | .interpolation(ImageInterpolation.High) | 92 | .interpolation(ImageInterpolation.High) |
| 92 | } | 93 | } |
| 93 | }.alignItems(VerticalAlign.Center) | 94 | }.alignItems(VerticalAlign.Center) |
| 94 | - .height('84lpx') | 95 | + .height(`${this.calcHeight(84)}lpx`) |
| 95 | .width('100%') | 96 | .width('100%') |
| 96 | .justifyContent(FlexAlign.SpaceBetween) | 97 | .justifyContent(FlexAlign.SpaceBetween) |
| 97 | 98 | ||
| 98 | if(index != this.searchHotsData.length-1 ){ | 99 | if(index != this.searchHotsData.length-1 ){ |
| 99 | Divider() | 100 | Divider() |
| 100 | .width('100%') | 101 | .width('100%') |
| 101 | - .height('1lpx') | 102 | + .height(`${this.calcHeight(1)}lpx`) |
| 102 | .color($r('app.color.color_F5F5F5')) | 103 | .color($r('app.color.color_F5F5F5')) |
| 103 | - .strokeWidth('1lpx') | 104 | + .strokeWidth(`${this.calcHeight(1)}lpx`) |
| 104 | } | 105 | } |
| 105 | - }.height('85lpx') | 106 | + }.height(`${this.calcHeight(85)}lpx`) |
| 106 | .width('100%') | 107 | .width('100%') |
| 107 | .alignItems(HorizontalAlign.Start) | 108 | .alignItems(HorizontalAlign.Start) |
| 108 | } | 109 | } |
| @@ -117,6 +118,10 @@ export struct SearchHotsComponent{ | @@ -117,6 +118,10 @@ export struct SearchHotsComponent{ | ||
| 117 | }).layoutWeight(1) | 118 | }).layoutWeight(1) |
| 118 | }.width('100%') | 119 | }.width('100%') |
| 119 | .height('100%') | 120 | .height('100%') |
| 120 | - .margin({top:'46lpx'}) | 121 | + .margin({top:`${this.calcHeight(46)}lpx`}) |
| 122 | + } | ||
| 123 | + | ||
| 124 | + calcHeight(value:number): number{ | ||
| 125 | + return value * this.percent | ||
| 121 | } | 126 | } |
| 122 | } | 127 | } |
| @@ -10,6 +10,7 @@ export struct SearchRelatedComponent { | @@ -10,6 +10,7 @@ export struct SearchRelatedComponent { | ||
| 10 | @Link relatedSearchContentData: SearchRelatedItem[] | 10 | @Link relatedSearchContentData: SearchRelatedItem[] |
| 11 | onGetSearchRes?: (item:string) => void; | 11 | onGetSearchRes?: (item:string) => void; |
| 12 | @Prop searchText: string | 12 | @Prop searchText: string |
| 13 | + @Prop percent:number = 1 | ||
| 13 | 14 | ||
| 14 | build() { | 15 | build() { |
| 15 | Column() { | 16 | Column() { |
| @@ -19,19 +20,19 @@ export struct SearchRelatedComponent { | @@ -19,19 +20,19 @@ export struct SearchRelatedComponent { | ||
| 19 | Column(){ | 20 | Column(){ |
| 20 | Row() { | 21 | Row() { |
| 21 | Image($r('app.media.search_related_item_icon')) | 22 | Image($r('app.media.search_related_item_icon')) |
| 22 | - .width('31lpx') | ||
| 23 | - .height('31lpx') | 23 | + .width(`${this.calcHeight(31)}lpx`) |
| 24 | + .height(`${this.calcHeight(31)}lpx`) | ||
| 24 | .objectFit(ImageFit.Auto) | 25 | .objectFit(ImageFit.Auto) |
| 25 | - .margin({ right: '10lpx' }) | 26 | + .margin({ right:`${this.calcHeight(10)}lpx` }) |
| 26 | .interpolation(ImageInterpolation.High) | 27 | .interpolation(ImageInterpolation.High) |
| 27 | 28 | ||
| 28 | Text(){ | 29 | Text(){ |
| 29 | ForEach(item.data_arr,(item:string)=>{ | 30 | ForEach(item.data_arr,(item:string)=>{ |
| 30 | Span(item) | 31 | Span(item) |
| 31 | .fontColor(item===this.searchText?$r('app.color.color_ED2800'):$r('app.color.color_000000')) | 32 | .fontColor(item===this.searchText?$r('app.color.color_ED2800'):$r('app.color.color_000000')) |
| 32 | - .fontSize('31lpx') | ||
| 33 | - .fontWeight('400lpx') | ||
| 34 | - .lineHeight('50lpx') | 33 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 34 | + .fontWeight(400) | ||
| 35 | + .lineHeight(`${this.calcHeight(50)}lpx`) | ||
| 35 | }) | 36 | }) |
| 36 | } | 37 | } |
| 37 | .maxLines(1) | 38 | .maxLines(1) |
| @@ -40,14 +41,14 @@ export struct SearchRelatedComponent { | @@ -40,14 +41,14 @@ export struct SearchRelatedComponent { | ||
| 40 | 41 | ||
| 41 | }.alignItems(VerticalAlign.Center) | 42 | }.alignItems(VerticalAlign.Center) |
| 42 | .justifyContent(FlexAlign.Start) | 43 | .justifyContent(FlexAlign.Start) |
| 43 | - .height('95lpx') | 44 | + .height(`${this.calcHeight(95)}lpx`) |
| 44 | 45 | ||
| 45 | if (index != this.relatedSearchContentData.length - 1) { | 46 | if (index != this.relatedSearchContentData.length - 1) { |
| 46 | Divider() | 47 | Divider() |
| 47 | .width('100%') | 48 | .width('100%') |
| 48 | - .height('1lpx') | 49 | + .height(`${this.calcHeight(1)}lpx`) |
| 49 | .color($r('app.color.color_F5F5F5')) | 50 | .color($r('app.color.color_F5F5F5')) |
| 50 | - .strokeWidth('1lpx') | 51 | + .strokeWidth(`${this.calcHeight(1)}lpx`) |
| 51 | } | 52 | } |
| 52 | } | 53 | } |
| 53 | }.width('100%') | 54 | }.width('100%') |
| @@ -59,8 +60,11 @@ export struct SearchRelatedComponent { | @@ -59,8 +60,11 @@ export struct SearchRelatedComponent { | ||
| 59 | }) | 60 | }) |
| 60 | }.width('100%') | 61 | }.width('100%') |
| 61 | }.width('100%') | 62 | }.width('100%') |
| 62 | - .margin({ top: '8lpx' }) | ||
| 63 | - .padding({ left: '31lpx', right: '31lpx' }) | 63 | + .margin({ top: `${this.calcHeight(8)}lpx` }) |
| 64 | + .padding({ left: `${this.calcHeight(31)}lpx`, right: `${this.calcHeight(31)}lpx` }) | ||
| 64 | } | 65 | } |
| 65 | 66 | ||
| 67 | + calcHeight(value:number): number{ | ||
| 68 | + return value * this.percent | ||
| 69 | + } | ||
| 66 | } | 70 | } |
| @@ -28,6 +28,7 @@ export struct SearchResultComponent { | @@ -28,6 +28,7 @@ export struct SearchResultComponent { | ||
| 28 | scroller: Scroller = new Scroller() | 28 | scroller: Scroller = new Scroller() |
| 29 | onClickTryAgain?: () => void; | 29 | onClickTryAgain?: () => void; |
| 30 | @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | 30 | @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() |
| 31 | + @Prop percent:number = 1 | ||
| 31 | 32 | ||
| 32 | aboutToAppear(): void { | 33 | aboutToAppear(): void { |
| 33 | if (this.count.length === 0 && this.isGetRequest == true) { | 34 | if (this.count.length === 0 && this.isGetRequest == true) { |
| @@ -71,7 +72,7 @@ export struct SearchResultComponent { | @@ -71,7 +72,7 @@ export struct SearchResultComponent { | ||
| 71 | //缺省图 | 72 | //缺省图 |
| 72 | if(this.isConnectNetwork){ | 73 | if(this.isConnectNetwork){ |
| 73 | EmptyComponent({emptyType:4}) | 74 | EmptyComponent({emptyType:4}) |
| 74 | - .height('612lpx') | 75 | + .height(`${this.calcHeight(612)}lpx`) |
| 75 | .width('100%') | 76 | .width('100%') |
| 76 | }else{ | 77 | }else{ |
| 77 | EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | 78 | EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { |
| @@ -90,19 +91,19 @@ export struct SearchResultComponent { | @@ -90,19 +91,19 @@ export struct SearchResultComponent { | ||
| 90 | ListItem() { | 91 | ListItem() { |
| 91 | Row() { | 92 | Row() { |
| 92 | Image($r('app.media.search_suggest_icon')) | 93 | Image($r('app.media.search_suggest_icon')) |
| 93 | - .width('6lpx') | ||
| 94 | - .height('31lpx') | 94 | + .width(`${this.calcHeight(6)}lpx`) |
| 95 | + .height(`${this.calcHeight(31)}lpx`) | ||
| 95 | .objectFit(ImageFit.Cover) | 96 | .objectFit(ImageFit.Cover) |
| 96 | .interpolation(ImageInterpolation.High) | 97 | .interpolation(ImageInterpolation.High) |
| 97 | - .margin({ right: '10lpx' }) | 98 | + .margin({ right: `${this.calcHeight(10)}lpx` }) |
| 98 | Text("为你推荐") | 99 | Text("为你推荐") |
| 99 | .textAlign(TextAlign.Start) | 100 | .textAlign(TextAlign.Start) |
| 100 | .fontWeight(600) | 101 | .fontWeight(600) |
| 101 | - .fontSize('33lpx') | ||
| 102 | - .lineHeight('46lpx') | 102 | + .fontSize(`${this.calcHeight(33)}lpx`) |
| 103 | + .lineHeight(`${this.calcHeight(46)}lpx`) | ||
| 103 | .fontColor($r('app.color.color_222222')) | 104 | .fontColor($r('app.color.color_222222')) |
| 104 | - }.height('84lpx') | ||
| 105 | - .padding({ left: '31lpx', right: '31lpx' }) | 105 | + }.height(`${this.calcHeight(84)}lpx`) |
| 106 | + .padding({ left: `${this.calcHeight(31)}lpx`, right: `${this.calcHeight(31)}lpx` }) | ||
| 106 | .width('100%') | 107 | .width('100%') |
| 107 | .alignItems(VerticalAlign.Center) | 108 | .alignItems(VerticalAlign.Center) |
| 108 | } | 109 | } |
| @@ -115,9 +116,9 @@ export struct SearchResultComponent { | @@ -115,9 +116,9 @@ export struct SearchResultComponent { | ||
| 115 | if (index != this.data.totalCount() - 1) { | 116 | if (index != this.data.totalCount() - 1) { |
| 116 | Divider() | 117 | Divider() |
| 117 | .width('100%') | 118 | .width('100%') |
| 118 | - .height('1lpx') | 119 | + .height(`${this.calcHeight(1)}lpx`) |
| 119 | .color($r('app.color.color_F5F5F5')) | 120 | .color($r('app.color.color_F5F5F5')) |
| 120 | - .strokeWidth('1lpx') | 121 | + .strokeWidth(`${this.calcHeight(1)}lpx`) |
| 121 | } | 122 | } |
| 122 | } | 123 | } |
| 123 | } | 124 | } |
| @@ -144,7 +145,7 @@ export struct SearchResultComponent { | @@ -144,7 +145,7 @@ export struct SearchResultComponent { | ||
| 144 | .vertical(false) | 145 | .vertical(false) |
| 145 | .barMode(BarMode.Fixed) | 146 | .barMode(BarMode.Fixed) |
| 146 | .barWidth('100%') | 147 | .barWidth('100%') |
| 147 | - .barHeight('84lpx') | 148 | + .barHeight(`${this.calcHeight(84)}lpx`) |
| 148 | .animationDuration(0) | 149 | .animationDuration(0) |
| 149 | .width('100%') | 150 | .width('100%') |
| 150 | .scrollable(false) | 151 | .scrollable(false) |
| @@ -152,26 +153,26 @@ export struct SearchResultComponent { | @@ -152,26 +153,26 @@ export struct SearchResultComponent { | ||
| 152 | } | 153 | } |
| 153 | }.width('100%') | 154 | }.width('100%') |
| 154 | .layoutWeight(1) | 155 | .layoutWeight(1) |
| 155 | - .margin({ top: '12lpx' }) | 156 | + .margin({ top: `${this.calcHeight(12)}lpx` }) |
| 156 | } | 157 | } |
| 157 | 158 | ||
| 158 | @Builder | 159 | @Builder |
| 159 | TabBuilder(index: number, item: string) { | 160 | TabBuilder(index: number, item: string) { |
| 160 | Stack() { | 161 | Stack() { |
| 161 | Text(item) | 162 | Text(item) |
| 162 | - .height('38lpx') | ||
| 163 | - .fontSize('33lpx') | 163 | + .height(`${this.calcHeight(38)}lpx`) |
| 164 | + .fontSize(`${this.calcHeight(33)}lpx`) | ||
| 164 | .fontWeight(this.currentIndex === index ? 600 : 400) | 165 | .fontWeight(this.currentIndex === index ? 600 : 400) |
| 165 | .fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor) | 166 | .fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor) |
| 166 | - .lineHeight('38lpx') | 167 | + .lineHeight(`${this.calcHeight(38)}lpx`) |
| 167 | 168 | ||
| 168 | if (this.currentIndex === index) { | 169 | if (this.currentIndex === index) { |
| 169 | Divider() | 170 | Divider() |
| 170 | - .width('31lpx') | ||
| 171 | - .height('4lpx') | 171 | + .width(`${this.calcHeight(31)}lpx`) |
| 172 | + .height(`${this.calcHeight(4)}lpx`) | ||
| 172 | .color('#ED2800') | 173 | .color('#ED2800') |
| 173 | - .strokeWidth('4lpx') | ||
| 174 | - .margin({ top: '50lpx' }) | 174 | + .strokeWidth(`${this.calcHeight(4)}lpx`) |
| 175 | + .margin({ top: `${this.calcHeight(50)}lpx` }) | ||
| 175 | .id("divTag") | 176 | .id("divTag") |
| 176 | } | 177 | } |
| 177 | }.onClick(() => { | 178 | }.onClick(() => { |
| @@ -179,7 +180,11 @@ export struct SearchResultComponent { | @@ -179,7 +180,11 @@ export struct SearchResultComponent { | ||
| 179 | this.controller.changeIndex(this.currentIndex) | 180 | this.controller.changeIndex(this.currentIndex) |
| 180 | }) | 181 | }) |
| 181 | .height('100%') | 182 | .height('100%') |
| 182 | - .margin({ right: '9lpx' }) | ||
| 183 | - .padding({ left: '31lpx', right: index === this.count.length - 1 ? "31lpx" : "0lpx" }) | 183 | + .margin({ right: `${this.calcHeight(9)}lpx` }) |
| 184 | + .padding({ left: `${this.calcHeight(31)}lpx`, right: index === this.count.length - 1 ? `${this.calcHeight(31)}lpx` : "0lpx" }) | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + calcHeight(value:number): number{ | ||
| 188 | + return value * this.percent | ||
| 184 | } | 189 | } |
| 185 | } | 190 | } |
| 1 | import { Params } from 'wdBean'; | 1 | import { Params } from 'wdBean'; |
| 2 | -import { AppUtils, StringUtils } from 'wdKit/Index'; | 2 | +import { AppUtils, BreakpointSystem, StringUtils } from 'wdKit/Index'; |
| 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 4 | import { TrackingButton, TrackConstants } from 'wdTracking/Index'; | 4 | import { TrackingButton, TrackConstants } from 'wdTracking/Index'; |
| 5 | import { CustomTitleUI } from '../reusable/CustomTitleUI'; | 5 | import { CustomTitleUI } from '../reusable/CustomTitleUI'; |
| @@ -24,11 +24,25 @@ export struct AboutPageUI { | @@ -24,11 +24,25 @@ export struct AboutPageUI { | ||
| 24 | alignment: DialogAlignment.Center | 24 | alignment: DialogAlignment.Center |
| 25 | }) | 25 | }) |
| 26 | 26 | ||
| 27 | + @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; | ||
| 28 | + private breakpointSystem = new BreakpointSystem(); | ||
| 29 | + @State percent:number = 1 | ||
| 30 | + | ||
| 31 | + currentChanged(){ | ||
| 32 | + if(this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"){ | ||
| 33 | + this.percent = 0.7 | ||
| 34 | + }else { | ||
| 35 | + this.percent = 1 | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + | ||
| 27 | build() { | 39 | build() { |
| 28 | this.aboutUi() | 40 | this.aboutUi() |
| 29 | } | 41 | } |
| 30 | 42 | ||
| 31 | aboutToAppear() { | 43 | aboutToAppear() { |
| 44 | + this.breakpointSystem.register(); | ||
| 45 | + this.currentChanged() | ||
| 32 | let context = getContext(); | 46 | let context = getContext(); |
| 33 | context.getApplicationContext(); | 47 | context.getApplicationContext(); |
| 34 | let appVerion = AppUtils.getAppVersionName() | 48 | let appVerion = AppUtils.getAppVersionName() |
| @@ -37,15 +51,19 @@ export struct AboutPageUI { | @@ -37,15 +51,19 @@ export struct AboutPageUI { | ||
| 37 | } | 51 | } |
| 38 | } | 52 | } |
| 39 | 53 | ||
| 54 | + aboutToDisappear(): void { | ||
| 55 | + this.breakpointSystem.unregister(); | ||
| 56 | + } | ||
| 57 | + | ||
| 40 | @Builder | 58 | @Builder |
| 41 | aboutUi() { | 59 | aboutUi() { |
| 42 | Column() { | 60 | Column() { |
| 43 | - CustomTitleUI({titleName:'关于'}) | 61 | + CustomTitleUI({titleName:'关于',percent:this.percent}) |
| 44 | 62 | ||
| 45 | Image($r('app.media.setting_about_logo')) | 63 | Image($r('app.media.setting_about_logo')) |
| 46 | - .width('278lpx') | ||
| 47 | - .height('154lpx') | ||
| 48 | - .margin({ top: '173lpx', bottom: '154lpx' }) | 64 | + .width(`${this.calcHeight(278)}lpx`) |
| 65 | + .height(`${this.calcHeight(154)}lpx`) | ||
| 66 | + .margin({ top: `${this.calcHeight2(173)}lpx`, bottom: `${this.calcHeight2(154)}lpx` }) | ||
| 49 | .gesture( | 67 | .gesture( |
| 50 | TapGesture({ count: 2 }) | 68 | TapGesture({ count: 2 }) |
| 51 | .onAction((event: GestureEvent) => { | 69 | .onAction((event: GestureEvent) => { |
| @@ -77,28 +95,28 @@ export struct AboutPageUI { | @@ -77,28 +95,28 @@ export struct AboutPageUI { | ||
| 77 | }) | 95 | }) |
| 78 | }.divider({ | 96 | }.divider({ |
| 79 | strokeWidth: 1, | 97 | strokeWidth: 1, |
| 80 | - startMargin: '29lpx', | ||
| 81 | - endMargin: '29lpx', | 98 | + startMargin: `${this.calcHeight(29)}lpx`, |
| 99 | + endMargin: `${this.calcHeight(29)}lpx`, | ||
| 82 | color: '#EDEDED' | 100 | color: '#EDEDED' |
| 83 | }) | 101 | }) |
| 84 | 102 | ||
| 85 | Blank() | 103 | Blank() |
| 86 | 104 | ||
| 87 | Image($r('app.media.about_us_code')) | 105 | Image($r('app.media.about_us_code')) |
| 88 | - .width('192lpx') | ||
| 89 | - .height('192lpx') | 106 | + .width(`${this.calcHeight(192)}lpx`) |
| 107 | + .height(`${this.calcHeight(192)}lpx`) | ||
| 90 | 108 | ||
| 91 | Text(this.version) | 109 | Text(this.version) |
| 92 | - .fontSize('25lpx') | 110 | + .fontSize(`${this.calcHeight(25)}lpx`) |
| 93 | .textAlign(TextAlign.Center) | 111 | .textAlign(TextAlign.Center) |
| 94 | .fontColor($r("app.color.color_666666")) | 112 | .fontColor($r("app.color.color_666666")) |
| 95 | - .margin({ bottom: '31lpx' }) | 113 | + .margin({ bottom: `${this.calcHeight(31)}lpx` }) |
| 96 | 114 | ||
| 97 | Text(this.message) | 115 | Text(this.message) |
| 98 | - .fontSize('19lpx') | 116 | + .fontSize(`${this.calcHeight(19)}lpx`) |
| 99 | .textAlign(TextAlign.Center) | 117 | .textAlign(TextAlign.Center) |
| 100 | .fontColor($r("app.color.color_999999")) | 118 | .fontColor($r("app.color.color_999999")) |
| 101 | - .margin({ bottom: '35lpx' }) | 119 | + .margin({ bottom: `${this.calcHeight(35)}lpx` }) |
| 102 | } | 120 | } |
| 103 | .width('100%') | 121 | .width('100%') |
| 104 | .height('100%') | 122 | .height('100%') |
| @@ -112,18 +130,30 @@ export struct AboutPageUI { | @@ -112,18 +130,30 @@ export struct AboutPageUI { | ||
| 112 | // 左侧标题 | 130 | // 左侧标题 |
| 113 | Text(`${item}`) | 131 | Text(`${item}`) |
| 114 | .fontColor('#666666') | 132 | .fontColor('#666666') |
| 115 | - .fontSize('31lpx') | 133 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 116 | 134 | ||
| 117 | Image($r('app.media.mine_user_arrow')) | 135 | Image($r('app.media.mine_user_arrow')) |
| 118 | - .width('27lpx') | ||
| 119 | - .height('27lpx') | 136 | + .width(`${this.calcHeight(27)}lpx`) |
| 137 | + .height(`${this.calcHeight(27)}lpx`) | ||
| 120 | .objectFit(ImageFit.Auto) | 138 | .objectFit(ImageFit.Auto) |
| 121 | } | 139 | } |
| 122 | .alignItems(VerticalAlign.Center) | 140 | .alignItems(VerticalAlign.Center) |
| 123 | .justifyContent(FlexAlign.SpaceBetween) | 141 | .justifyContent(FlexAlign.SpaceBetween) |
| 124 | - .height('97lpx') | 142 | + .height(`${this.calcHeight(97)}lpx`) |
| 125 | .width('100%') | 143 | .width('100%') |
| 126 | - .padding({ left: '29lpx', right: '29lpx' }) | 144 | + .padding({ left:`${this.calcHeight(29)}lpx`, right: `${this.calcHeight(29)}lpx` }) |
| 145 | + } | ||
| 146 | + | ||
| 147 | + calcHeight(value:number): number{ | ||
| 148 | + return value * this.percent | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + calcHeight2(value:number): number{ | ||
| 152 | + if(this.percent < 1){ | ||
| 153 | + return value * 0.3 | ||
| 154 | + }else{ | ||
| 155 | + return value * 1 | ||
| 156 | + } | ||
| 127 | } | 157 | } |
| 128 | } | 158 | } |
| 129 | 159 |
| 1 | import { BottomNavi, CommonConstants, SpConstants } from 'wdConstant'; | 1 | import { BottomNavi, CommonConstants, SpConstants } from 'wdConstant'; |
| 2 | -import { Logger, SPHelper, StringUtils } from 'wdKit'; | 2 | +import { BreakpointSystem, Logger, SPHelper, StringUtils } from 'wdKit'; |
| 3 | import PageViewModel from '../../viewmodel/PageViewModel'; | 3 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 4 | import storageStatistics from "@ohos.file.storageStatistics"; | 4 | import storageStatistics from "@ohos.file.storageStatistics"; |
| 5 | import { BusinessError } from '@ohos.base'; | 5 | import { BusinessError } from '@ohos.base'; |
| @@ -25,6 +25,17 @@ export struct MineSettingComponent { | @@ -25,6 +25,17 @@ export struct MineSettingComponent { | ||
| 25 | @State cacheSize: number = 0 | 25 | @State cacheSize: number = 0 |
| 26 | @State accountState:boolean=false | 26 | @State accountState:boolean=false |
| 27 | preferences: dataPreferences.Preferences | null = null; | 27 | preferences: dataPreferences.Preferences | null = null; |
| 28 | + @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; | ||
| 29 | + private breakpointSystem = new BreakpointSystem(); | ||
| 30 | + @State percent:number = 1 | ||
| 31 | + | ||
| 32 | + currentChanged(){ | ||
| 33 | + if(this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"){ | ||
| 34 | + this.percent = 0.7 | ||
| 35 | + }else { | ||
| 36 | + this.percent = 1 | ||
| 37 | + } | ||
| 38 | + } | ||
| 28 | 39 | ||
| 29 | dialogController: CustomDialogController = new CustomDialogController({ | 40 | dialogController: CustomDialogController = new CustomDialogController({ |
| 30 | builder: MyCustomDialog({ | 41 | builder: MyCustomDialog({ |
| @@ -43,6 +54,8 @@ export struct MineSettingComponent { | @@ -43,6 +54,8 @@ export struct MineSettingComponent { | ||
| 43 | customStyle: true | 54 | customStyle: true |
| 44 | }) | 55 | }) |
| 45 | aboutToAppear() { | 56 | aboutToAppear() { |
| 57 | + this.breakpointSystem.register(); | ||
| 58 | + this.currentChanged() | ||
| 46 | // 获取设置页面数据 | 59 | // 获取设置页面数据 |
| 47 | this.getSettingPageData() | 60 | this.getSettingPageData() |
| 48 | 61 | ||
| @@ -54,6 +67,10 @@ export struct MineSettingComponent { | @@ -54,6 +67,10 @@ export struct MineSettingComponent { | ||
| 54 | 67 | ||
| 55 | } | 68 | } |
| 56 | 69 | ||
| 70 | + aboutToDisappear(): void { | ||
| 71 | + this.breakpointSystem.unregister(); | ||
| 72 | + } | ||
| 73 | + | ||
| 57 | async getAccountState(){ | 74 | async getAccountState(){ |
| 58 | let userId=await SPHelper.default.get(SpConstants.USER_ID,'') as string | 75 | let userId=await SPHelper.default.get(SpConstants.USER_ID,'') as string |
| 59 | if(userId==''){ | 76 | if(userId==''){ |
| @@ -91,13 +108,13 @@ export struct MineSettingComponent { | @@ -91,13 +108,13 @@ export struct MineSettingComponent { | ||
| 91 | if (item.type == 0) { | 108 | if (item.type == 0) { |
| 92 | Column() { | 109 | Column() { |
| 93 | this.getArrowCell(item,index) | 110 | this.getArrowCell(item,index) |
| 94 | - }.padding({ left: '27lpx' }).height('117lpx').justifyContent(FlexAlign.Center) | 111 | + }.padding({ left: `${this.calcHeight(27)}lpx` }).height(`${this.calcHeight(117)}lpx`).justifyContent(FlexAlign.Center) |
| 95 | } else if (item.type == 1) { | 112 | } else if (item.type == 1) { |
| 96 | Column() { | 113 | Column() { |
| 97 | this.getSwitchCell(item,index) | 114 | this.getSwitchCell(item,index) |
| 98 | - }.padding({ left: '27lpx' }).height('117lpx').justifyContent(FlexAlign.Center) | 115 | + }.padding({ left: `${this.calcHeight(27)}lpx` }).height(`${this.calcHeight(117)}lpx`).justifyContent(FlexAlign.Center) |
| 99 | } else { | 116 | } else { |
| 100 | - Column().width('100%').height('15lpx').backgroundColor(0xf0f0f0) | 117 | + Column().width('100%').height(`${this.calcHeight(15)}lpx`).backgroundColor(0xf0f0f0) |
| 101 | } | 118 | } |
| 102 | } | 119 | } |
| 103 | }) | 120 | }) |
| @@ -112,7 +129,7 @@ export struct MineSettingComponent { | @@ -112,7 +129,7 @@ export struct MineSettingComponent { | ||
| 112 | @Builder itemHead(text: string) { | 129 | @Builder itemHead(text: string) { |
| 113 | // 列表分组的头部组件,对应联系人分组A、B等位置的组件 | 130 | // 列表分组的头部组件,对应联系人分组A、B等位置的组件 |
| 114 | if (text.length > 0) { | 131 | if (text.length > 0) { |
| 115 | - Row().width('100%').height('20lpx').backgroundColor(0xf0f0f0) | 132 | + Row().width('100%').height(`${this.calcHeight(20)}lpx`).backgroundColor(0xf0f0f0) |
| 116 | } | 133 | } |
| 117 | } | 134 | } |
| 118 | 135 | ||
| @@ -125,28 +142,29 @@ export struct MineSettingComponent { | @@ -125,28 +142,29 @@ export struct MineSettingComponent { | ||
| 125 | // 判断有没有图片 | 142 | // 判断有没有图片 |
| 126 | if (0) { | 143 | if (0) { |
| 127 | Image('https://pic.rmb.bdstatic.com/e182cf67c341d1128d2a6cc05886bf62.jpeg@s_0,h_2000') | 144 | Image('https://pic.rmb.bdstatic.com/e182cf67c341d1128d2a6cc05886bf62.jpeg@s_0,h_2000') |
| 128 | - .height('38lpx') | ||
| 129 | - .margin({ right: '5lpx' }) | 145 | + .height(`${this.calcHeight(38)}lpx`) |
| 146 | + .margin({ right: `${this.calcHeight(5)}lpx` }) | ||
| 130 | 147 | ||
| 131 | Text(`${item.title}`) | 148 | Text(`${item.title}`) |
| 132 | - .margin({ top: '8lpx' }) | ||
| 133 | - .height('38lpx') | 149 | + .margin({ top: `${this.calcHeight(8)}lpx` }) |
| 150 | + .height(`${this.calcHeight(38)}lpx`) | ||
| 134 | .fontColor('#333333') | 151 | .fontColor('#333333') |
| 135 | - .fontSize('29lpx') | 152 | + .fontSize(`${this.calcHeight(29)}lpx`) |
| 136 | } else { | 153 | } else { |
| 137 | Text(`${item.title}`) | 154 | Text(`${item.title}`) |
| 138 | - .margin({ top: '8lpx' }) | ||
| 139 | - .height('38lpx') | 155 | + .margin({ top: `${this.calcHeight(8)}lpx` }) |
| 156 | + .height(`${this.calcHeight(38)}lpx`) | ||
| 140 | .fontColor('#333333') | 157 | .fontColor('#333333') |
| 141 | - .fontSize('29lpx') | 158 | + .fontSize(`${this.calcHeight(29)}lpx`) |
| 142 | } | 159 | } |
| 143 | }.width('60%') | 160 | }.width('60%') |
| 144 | 161 | ||
| 145 | // 右侧文案和右箭头 | 162 | // 右侧文案和右箭头 |
| 146 | Row() { | 163 | Row() { |
| 147 | Toggle({ type: ToggleType.Switch, isOn: item.switchState }) | 164 | Toggle({ type: ToggleType.Switch, isOn: item.switchState }) |
| 148 | - .height('50lpx') | ||
| 149 | - .margin({ left: '81lpx', right: '29lpx' }) | 165 | + .height(`${this.calcHeight(50)}lpx`) |
| 166 | + .width(`${this.calcHeight(96)}lpx`) | ||
| 167 | + .margin({ left: `${this.calcHeight(81)}lpx`, right: `${this.calcHeight(29)}lpx` }) | ||
| 150 | .selectedColor("#ED2800") | 168 | .selectedColor("#ED2800") |
| 151 | .onChange((isOn: boolean) => { | 169 | .onChange((isOn: boolean) => { |
| 152 | if(item.itemType=='push_switch'){ | 170 | if(item.itemType=='push_switch'){ |
| @@ -168,13 +186,13 @@ export struct MineSettingComponent { | @@ -168,13 +186,13 @@ export struct MineSettingComponent { | ||
| 168 | } | 186 | } |
| 169 | }) | 187 | }) |
| 170 | }.width('40%') | 188 | }.width('40%') |
| 171 | - .margin({ right: '29lpx' }) | 189 | + .margin({ right: `${this.calcHeight(29)}lpx` }) |
| 172 | .justifyContent(FlexAlign.End) | 190 | .justifyContent(FlexAlign.End) |
| 173 | 191 | ||
| 174 | } | 192 | } |
| 175 | .alignItems(VerticalAlign.Center) | 193 | .alignItems(VerticalAlign.Center) |
| 176 | .justifyContent(FlexAlign.SpaceBetween) | 194 | .justifyContent(FlexAlign.SpaceBetween) |
| 177 | - }.height('54lpx') | 195 | + }.height(`${this.calcHeight(54)}lpx`) |
| 178 | } | 196 | } |
| 179 | 197 | ||
| 180 | // 右文字+箭头cell | 198 | // 右文字+箭头cell |
| @@ -185,10 +203,10 @@ export struct MineSettingComponent { | @@ -185,10 +203,10 @@ export struct MineSettingComponent { | ||
| 185 | // 左侧logo和标题 | 203 | // 左侧logo和标题 |
| 186 | Row() { | 204 | Row() { |
| 187 | Text(`${item.title}`) | 205 | Text(`${item.title}`) |
| 188 | - .margin({ top: '8lpx' }) | ||
| 189 | - .height('38lpx') | 206 | + .margin({ top: `${this.calcHeight(8)}lpx` }) |
| 207 | + .height(`${this.calcHeight(38)}lpx`) | ||
| 190 | .fontColor('#333333') | 208 | .fontColor('#333333') |
| 191 | - .fontSize('29lpx') | 209 | + .fontSize(`${this.calcHeight(29)}lpx`) |
| 192 | }.width('60%') | 210 | }.width('60%') |
| 193 | 211 | ||
| 194 | // 右侧文案和右箭头 | 212 | // 右侧文案和右箭头 |
| @@ -197,13 +215,13 @@ export struct MineSettingComponent { | @@ -197,13 +215,13 @@ export struct MineSettingComponent { | ||
| 197 | .fontColor('#999999') | 215 | .fontColor('#999999') |
| 198 | .maxLines(1) | 216 | .maxLines(1) |
| 199 | Image($r('app.media.mine_user_arrow_2')) | 217 | Image($r('app.media.mine_user_arrow_2')) |
| 200 | - .width('27lpx') | ||
| 201 | - .height('27lpx') | 218 | + .width(`${this.calcHeight(27)}lpx`) |
| 219 | + .height(`${this.calcHeight(27)}lpx`) | ||
| 202 | .objectFit(ImageFit.Auto) | 220 | .objectFit(ImageFit.Auto) |
| 203 | .interpolation(ImageInterpolation.High) | 221 | .interpolation(ImageInterpolation.High) |
| 204 | - Column().width('29lpx') | 222 | + Column().width(`${this.calcHeight(29)}lpx`) |
| 205 | }.width('40%') | 223 | }.width('40%') |
| 206 | - .margin({ right: '29lpx' }) | 224 | + .margin({ right: `${this.calcHeight(29)}lpx` }) |
| 207 | .justifyContent(FlexAlign.End) | 225 | .justifyContent(FlexAlign.End) |
| 208 | 226 | ||
| 209 | } | 227 | } |
| @@ -211,7 +229,7 @@ export struct MineSettingComponent { | @@ -211,7 +229,7 @@ export struct MineSettingComponent { | ||
| 211 | .justifyContent(FlexAlign.SpaceBetween) | 229 | .justifyContent(FlexAlign.SpaceBetween) |
| 212 | 230 | ||
| 213 | } | 231 | } |
| 214 | - .height('54lpx') | 232 | + .height(`${this.calcHeight(54)}lpx`) |
| 215 | .onClick(() => { | 233 | .onClick(() => { |
| 216 | if (item.itemType == 'account') { | 234 | if (item.itemType == 'account') { |
| 217 | trackButtonClick("settingPageAccountManagement") | 235 | trackButtonClick("settingPageAccountManagement") |
| @@ -266,6 +284,10 @@ export struct MineSettingComponent { | @@ -266,6 +284,10 @@ export struct MineSettingComponent { | ||
| 266 | } | 284 | } |
| 267 | this.preferences.on('change', observer); | 285 | this.preferences.on('change', observer); |
| 268 | } | 286 | } |
| 287 | + | ||
| 288 | + calcHeight(value:number): number{ | ||
| 289 | + return value * this.percent | ||
| 290 | + } | ||
| 269 | } | 291 | } |
| 270 | 292 | ||
| 271 | function trackButtonClick(buttonName: string){ | 293 | function trackButtonClick(buttonName: string){ |
| @@ -43,8 +43,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | @@ -43,8 +43,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | ||
| 43 | 43 | ||
| 44 | resetEdgeAnimation() { | 44 | resetEdgeAnimation() { |
| 45 | if (this.moreWidth > this.initMoreWidth) { | 45 | if (this.moreWidth > this.initMoreWidth) { |
| 46 | - this.moreWidth = this.moreWidth - 1 | ||
| 47 | - this.resetEdgeAnimation(); | 46 | + this.moreWidth = 16 |
| 48 | } | 47 | } |
| 49 | this.resetMoreTips() | 48 | this.resetMoreTips() |
| 50 | } | 49 | } |
| @@ -130,6 +129,8 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | @@ -130,6 +129,8 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | ||
| 130 | .margin({ top: 8 }) | 129 | .margin({ top: 8 }) |
| 131 | .width(150) | 130 | .width(150) |
| 132 | .lineHeight(19) | 131 | .lineHeight(19) |
| 132 | + .height(42) | ||
| 133 | + .lineHeight(21) | ||
| 133 | } | 134 | } |
| 134 | .padding({ right: 16 }) | 135 | .padding({ right: 16 }) |
| 135 | // .offset({x:16}) | 136 | // .offset({x:16}) |
| @@ -139,7 +140,15 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | @@ -139,7 +140,15 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | ||
| 139 | }) | 140 | }) |
| 140 | }) | 141 | }) |
| 141 | } | 142 | } |
| 142 | - if (this.compDTO.operDataList.length > 2) { | 143 | + |
| 144 | + if (this.compDTO.operDataList.length >= 2 && (this.compDTO?.objectType === '0' || this.compDTO?.objectType === '')) { | ||
| 145 | + Row() { | ||
| 146 | + Ellipse() | ||
| 147 | + .width(2* (this.moreWidth - this.initMoreWidth - 1)) | ||
| 148 | + .height(this.compDTO.operDataList.length == 2 ? 180 : 146) | ||
| 149 | + .fill(0xf1f3f4) | ||
| 150 | + .position({ left: -(this.moreWidth - this.initMoreWidth - 3) * 0.8 }) | ||
| 151 | + | ||
| 143 | Column() { | 152 | Column() { |
| 144 | if (this.moreWidth > this.initMoreWidth + 2) { | 153 | if (this.moreWidth > this.initMoreWidth + 2) { |
| 145 | Text(this.moreTips) | 154 | Text(this.moreTips) |
| @@ -150,10 +159,12 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | @@ -150,10 +159,12 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | ||
| 150 | } | 159 | } |
| 151 | .justifyContent(FlexAlign.Center) | 160 | .justifyContent(FlexAlign.Center) |
| 152 | .align(Alignment.Center) | 161 | .align(Alignment.Center) |
| 153 | - .width(this.moreWidth) | 162 | + .height(this.compDTO.operDataList.length == 2 ? 180 : 146) |
| 163 | + .width(this.initMoreWidth) | ||
| 154 | .backgroundColor(0xf1f3f4) | 164 | .backgroundColor(0xf1f3f4) |
| 155 | .borderRadius({ topLeft: 5, bottomLeft: 5 }) | 165 | .borderRadius({ topLeft: 5, bottomLeft: 5 }) |
| 156 | - .height(this.compDTO.operDataList.length == 2 ? 180 : 146) | 166 | + } |
| 167 | + .margin({left: 1.5 * (this.moreWidth - this.initMoreWidth)}) | ||
| 157 | } | 168 | } |
| 158 | } | 169 | } |
| 159 | } | 170 | } |
| @@ -33,7 +33,8 @@ export struct LikeComponent { | @@ -33,7 +33,8 @@ export struct LikeComponent { | ||
| 33 | styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 3 透明背景 | 33 | styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 3 透明背景 |
| 34 | @State likeCount: number = 0 //点赞数 | 34 | @State likeCount: number = 0 //点赞数 |
| 35 | pageParam: ParamType = {} | 35 | pageParam: ParamType = {} |
| 36 | - PageName: string = '' | 36 | + @Consume pageName: string |
| 37 | + @Consume pageId: string | ||
| 37 | 38 | ||
| 38 | //上层传值 样例 | 39 | //上层传值 样例 |
| 39 | // this.data['contentId'] = '30035444649' //必须 | 40 | // this.data['contentId'] = '30035444649' //必须 |
| @@ -81,19 +82,6 @@ export struct LikeComponent { | @@ -81,19 +82,6 @@ export struct LikeComponent { | ||
| 81 | 'contentId': `${this.contentDetailData.newsId}`, | 82 | 'contentId': `${this.contentDetailData.newsId}`, |
| 82 | 'contentName': `${this.contentDetailData.newsTitle || ''}`, | 83 | 'contentName': `${this.contentDetailData.newsTitle || ''}`, |
| 83 | } | 84 | } |
| 84 | - if(this.contentDetailData.newsType == 1) { | ||
| 85 | - this.PageName = TrackConstants.PageName.VideoDetail // 点播 | ||
| 86 | - } else if(this.contentDetailData.newsType == 2) { | ||
| 87 | - this.PageName = TrackConstants.PageName.Live_Detail // 直播 | ||
| 88 | - } else if(this.contentDetailData.newsType == 5) { | ||
| 89 | - this.PageName = TrackConstants.PageName.Summary_Detail // 专题详情页 | ||
| 90 | - } else if(this.contentDetailData.newsType == 8) { | ||
| 91 | - this.PageName = TrackConstants.PageName.Article_Detail // 图文详情页 | ||
| 92 | - } else if(this.contentDetailData.newsType == 9) { | ||
| 93 | - this.PageName = TrackConstants.PageName.Atlas_Detail // 图集详情页 | ||
| 94 | - } else if(this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) { | ||
| 95 | - this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频 | ||
| 96 | - } | ||
| 97 | } | 85 | } |
| 98 | 86 | ||
| 99 | build() { | 87 | build() { |
| @@ -378,16 +366,16 @@ export struct LikeComponent { | @@ -378,16 +366,16 @@ export struct LikeComponent { | ||
| 378 | if (this.contentDetailData.liveInfo) { | 366 | if (this.contentDetailData.liveInfo) { |
| 379 | this.likeStatus = true | 367 | this.likeStatus = true |
| 380 | this.likeCount++ | 368 | this.likeCount++ |
| 381 | - TrackingContent.like(true,this.PageName,this.PageName,this.pageParam) | 369 | + TrackingContent.like(true,this.pageId,this.pageName,this.pageParam) |
| 382 | } else { | 370 | } else { |
| 383 | this.likeStatus = !this.likeStatus | 371 | this.likeStatus = !this.likeStatus |
| 384 | //点赞和取消点赞成功后更新点赞数 | 372 | //点赞和取消点赞成功后更新点赞数 |
| 385 | if (this.likeStatus) { | 373 | if (this.likeStatus) { |
| 386 | this.likeCount++ | 374 | this.likeCount++ |
| 387 | - TrackingContent.like(true,this.PageName,this.PageName,this.pageParam) | 375 | + TrackingContent.like(true,this.pageId,this.pageName,this.pageParam) |
| 388 | } else { | 376 | } else { |
| 389 | this.likeCount-- | 377 | this.likeCount-- |
| 390 | - TrackingContent.like(false,this.PageName,this.PageName,this.pageParam) | 378 | + TrackingContent.like(false,this.pageId,this.pageName,this.pageParam) |
| 391 | } | 379 | } |
| 392 | } | 380 | } |
| 393 | 381 |
| @@ -152,6 +152,8 @@ export struct LiveHorizontalCardComponent { | @@ -152,6 +152,8 @@ export struct LiveHorizontalCardComponent { | ||
| 152 | .textAlign(TextAlign.Start) | 152 | .textAlign(TextAlign.Start) |
| 153 | .margin({ top: 8 }) | 153 | .margin({ top: 8 }) |
| 154 | .width(this.compDTO.operDataList.length == 2 ? 210 : 150) | 154 | .width(this.compDTO.operDataList.length == 2 ? 210 : 150) |
| 155 | + .height(42) | ||
| 156 | + .lineHeight(21) | ||
| 155 | } | 157 | } |
| 156 | .padding({ right: 16 }) | 158 | .padding({ right: 16 }) |
| 157 | .onClick(() => { | 159 | .onClick(() => { |
| @@ -4,9 +4,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | @@ -4,9 +4,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 4 | import { SpConstants } from 'wdConstant/Index'; | 4 | import { SpConstants } from 'wdConstant/Index'; |
| 5 | import measure from '@ohos.measure' | 5 | import measure from '@ohos.measure' |
| 6 | import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index'; | 6 | import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index'; |
| 7 | -import { | ||
| 8 | - ContentDetailDTO, | ||
| 9 | -} from 'wdBean'; | 7 | +import { ContentDetailDTO, } from 'wdBean'; |
| 10 | import { LiveModel } from '../../viewmodel/LiveModel'; | 8 | import { LiveModel } from '../../viewmodel/LiveModel'; |
| 11 | import { HttpUtils } from 'wdNetwork/Index'; | 9 | import { HttpUtils } from 'wdNetwork/Index'; |
| 12 | import vibrator from '@ohos.vibrator'; | 10 | import vibrator from '@ohos.vibrator'; |
| @@ -31,7 +29,6 @@ export struct LiveLikeComponent { | @@ -31,7 +29,6 @@ export struct LiveLikeComponent { | ||
| 31 | @State likeCount: number = 0 //点赞数 | 29 | @State likeCount: number = 0 //点赞数 |
| 32 | @State likeBean: Record<string, string> = {} | 30 | @State likeBean: Record<string, string> = {} |
| 33 | pageParam: ParamType = {} | 31 | pageParam: ParamType = {} |
| 34 | - PageName: string = '' | ||
| 35 | 32 | ||
| 36 | //上层传值 样例 | 33 | //上层传值 样例 |
| 37 | // this.data['contentId'] = '30035444649' //必须 | 34 | // this.data['contentId'] = '30035444649' //必须 |
| @@ -47,6 +44,7 @@ export struct LiveLikeComponent { | @@ -47,6 +44,7 @@ export struct LiveLikeComponent { | ||
| 47 | this.onDetailUpdated() | 44 | this.onDetailUpdated() |
| 48 | this.contentTrackingDict() | 45 | this.contentTrackingDict() |
| 49 | } | 46 | } |
| 47 | + | ||
| 50 | async onDetailUpdated() { | 48 | async onDetailUpdated() { |
| 51 | // 2:竖屏直播页 4:横屏直播页 | 49 | // 2:竖屏直播页 4:横屏直播页 |
| 52 | // 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福 | 50 | // 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福 |
| @@ -61,15 +59,12 @@ export struct LiveLikeComponent { | @@ -61,15 +59,12 @@ export struct LiveLikeComponent { | ||
| 61 | this.getLikeCount() | 59 | this.getLikeCount() |
| 62 | } | 60 | } |
| 63 | 61 | ||
| 64 | - contentTrackingDict(){ | 62 | + contentTrackingDict() { |
| 65 | this.pageParam = { | 63 | this.pageParam = { |
| 66 | 'contentType': `${this.contentDetailData.newsType}`, | 64 | 'contentType': `${this.contentDetailData.newsType}`, |
| 67 | 'contentId': `${this.contentDetailData.newsId}`, | 65 | 'contentId': `${this.contentDetailData.newsId}`, |
| 68 | 'contentName': `${this.contentDetailData.newsTitle || ''}`, | 66 | 'contentName': `${this.contentDetailData.newsTitle || ''}`, |
| 69 | } | 67 | } |
| 70 | - if(this.contentDetailData.newsType == 2) { | ||
| 71 | - this.PageName = TrackConstants.PageName.Live_Detail // 直播 | ||
| 72 | - } | ||
| 73 | } | 68 | } |
| 74 | 69 | ||
| 75 | build() { | 70 | build() { |
| @@ -118,7 +113,9 @@ export struct LiveLikeComponent { | @@ -118,7 +113,9 @@ export struct LiveLikeComponent { | ||
| 118 | .width(36) | 113 | .width(36) |
| 119 | .height(36) | 114 | .height(36) |
| 120 | .borderRadius(18) | 115 | .borderRadius(18) |
| 121 | - .backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5') | 116 | + .backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : |
| 117 | + this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5') | ||
| 118 | + | ||
| 122 | if (this.likeCount != 0) { | 119 | if (this.likeCount != 0) { |
| 123 | RelativeContainer() { | 120 | RelativeContainer() { |
| 124 | Image(this.styleType == 1 ? $r('app.media.comment_icon_number_bg') : $r('app.media.ic_like_back_Select')) | 121 | Image(this.styleType == 1 ? $r('app.media.comment_icon_number_bg') : $r('app.media.ic_like_back_Select')) |
| @@ -211,6 +208,16 @@ export struct LiveLikeComponent { | @@ -211,6 +208,16 @@ export struct LiveLikeComponent { | ||
| 211 | console.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`); | 208 | console.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`); |
| 212 | } | 209 | } |
| 213 | this.likeCount++ | 210 | this.likeCount++ |
| 211 | + this.likeStatus = true | ||
| 212 | + | ||
| 213 | + //内容点赞、取消点赞Tracking 1点赞 0取消点赞 | ||
| 214 | + TrackingContent.like(true, TrackConstants.PageName.DynamicDetail, TrackConstants.PageName.DynamicDetail, | ||
| 215 | + { | ||
| 216 | + 'contentType': `${this.contentDetailData.newsType}`, | ||
| 217 | + 'contentId': `${this.contentDetailData.newsId}`, | ||
| 218 | + 'contentName': `${this.contentDetailData.newsTitle || ''}`, | ||
| 219 | + }) | ||
| 220 | + | ||
| 214 | 221 | ||
| 215 | }).catch(() => { | 222 | }).catch(() => { |
| 216 | }) | 223 | }) |
| @@ -245,6 +252,7 @@ export struct LiveLikeComponent { | @@ -245,6 +252,7 @@ export struct LiveLikeComponent { | ||
| 245 | this.likeCount = 0 | 252 | this.likeCount = 0 |
| 246 | }) | 253 | }) |
| 247 | } | 254 | } |
| 255 | + | ||
| 248 | private getMeasureText(text: string) { | 256 | private getMeasureText(text: string) { |
| 249 | let width = measure.measureText({ | 257 | let width = measure.measureText({ |
| 250 | textContent: text, | 258 | textContent: text, |
| @@ -11,7 +11,6 @@ import { | @@ -11,7 +11,6 @@ import { | ||
| 11 | import router from '@ohos.router'; | 11 | import router from '@ohos.router'; |
| 12 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; | 12 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; |
| 13 | import { LiveLikeComponent } from './LiveLikeComponent'; | 13 | import { LiveLikeComponent } from './LiveLikeComponent'; |
| 14 | -import { CommentTabComponent, CommentIconComponent, } from '../comment/view/CommentTabComponent'; | ||
| 15 | import { publishCommentModel } from '../comment/model/PublishCommentModel' | 14 | import { publishCommentModel } from '../comment/model/PublishCommentModel' |
| 16 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 15 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 17 | import { PageRepository } from '../../repository/PageRepository'; | 16 | import { PageRepository } from '../../repository/PageRepository'; |
| @@ -65,7 +64,8 @@ export struct LiveOperRowListView { | @@ -65,7 +64,8 @@ export struct LiveOperRowListView { | ||
| 65 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 64 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 66 | @State dialogController: CustomDialogController | null = null; | 65 | @State dialogController: CustomDialogController | null = null; |
| 67 | pageParam: ParamType = {} | 66 | pageParam: ParamType = {} |
| 68 | - PageName: string = '' | 67 | + @Consume pageName: string |
| 68 | + @Consume pageId: string | ||
| 69 | @State likesStyle: number | string = "love" // 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福 | 69 | @State likesStyle: number | string = "love" // 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福 |
| 70 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 | 70 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 |
| 71 | 71 | ||
| @@ -89,9 +89,6 @@ export struct LiveOperRowListView { | @@ -89,9 +89,6 @@ export struct LiveOperRowListView { | ||
| 89 | 'contentId': `${this.contentDetailData.newsId}`, | 89 | 'contentId': `${this.contentDetailData.newsId}`, |
| 90 | 'contentName': `${this.contentDetailData.newsTitle || ''}`, | 90 | 'contentName': `${this.contentDetailData.newsTitle || ''}`, |
| 91 | } | 91 | } |
| 92 | - if(this.contentDetailData.newsType == 2) { | ||
| 93 | - this.PageName = TrackConstants.PageName.Live_Detail // 直播 | ||
| 94 | - } | ||
| 95 | } | 92 | } |
| 96 | 93 | ||
| 97 | async onDetailUpdated() { | 94 | async onDetailUpdated() { |
| @@ -426,9 +423,9 @@ export struct LiveOperRowListView { | @@ -426,9 +423,9 @@ export struct LiveOperRowListView { | ||
| 426 | this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 | 423 | this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 |
| 427 | if (this.newsStatusOfUser.collectStatus === 1) { | 424 | if (this.newsStatusOfUser.collectStatus === 1) { |
| 428 | promptAction.showToast({ message: '收藏成功' }) | 425 | promptAction.showToast({ message: '收藏成功' }) |
| 429 | - TrackingContent.collect(true,this.PageName,this.PageName,this.pageParam) | 426 | + TrackingContent.collect(true,this.pageId,this.pageName,this.pageParam) |
| 430 | } else { | 427 | } else { |
| 431 | - TrackingContent.collect(false,this.PageName,this.PageName,this.pageParam) | 428 | + TrackingContent.collect(false,this.pageId,this.pageName,this.pageParam) |
| 432 | } | 429 | } |
| 433 | this.queryContentInteractCount() | 430 | this.queryContentInteractCount() |
| 434 | } | 431 | } |
| @@ -89,7 +89,8 @@ export struct OperRowListView { | @@ -89,7 +89,8 @@ export struct OperRowListView { | ||
| 89 | @State name: string = 'audio_recommend_status_wait' | 89 | @State name: string = 'audio_recommend_status_wait' |
| 90 | @State dialogController: CustomDialogController | null = null; | 90 | @State dialogController: CustomDialogController | null = null; |
| 91 | pageParam: ParamType = {} | 91 | pageParam: ParamType = {} |
| 92 | - PageName: string = '' | 92 | + @Consume pageName: string |
| 93 | + @Consume pageId: string | ||
| 93 | @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 94 | @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 94 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 | 95 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 |
| 95 | 96 | ||
| @@ -119,19 +120,6 @@ export struct OperRowListView { | @@ -119,19 +120,6 @@ export struct OperRowListView { | ||
| 119 | 'contentId': `${this.contentDetailData.newsId}`, | 120 | 'contentId': `${this.contentDetailData.newsId}`, |
| 120 | 'contentName': `${this.contentDetailData.newsTitle || ''}`, | 121 | 'contentName': `${this.contentDetailData.newsTitle || ''}`, |
| 121 | } | 122 | } |
| 122 | - if(this.contentDetailData.newsType == 1) { | ||
| 123 | - this.PageName = TrackConstants.PageName.VideoDetail // 点播 | ||
| 124 | - } else if(this.contentDetailData.newsType == 2) { | ||
| 125 | - this.PageName = TrackConstants.PageName.Live_Detail // 直播 | ||
| 126 | - } else if(this.contentDetailData.newsType == 5) { | ||
| 127 | - this.PageName = TrackConstants.PageName.Summary_Detail // 专题详情页 | ||
| 128 | - } else if(this.contentDetailData.newsType == 8) { | ||
| 129 | - this.PageName = TrackConstants.PageName.Article_Detail // 图文详情页 | ||
| 130 | - } else if(this.contentDetailData.newsType == 9) { | ||
| 131 | - this.PageName = TrackConstants.PageName.Atlas_Detail // 图集详情页 | ||
| 132 | - } else if(this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) { | ||
| 133 | - this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频 | ||
| 134 | - } | ||
| 135 | } | 123 | } |
| 136 | 124 | ||
| 137 | async onDetailUpdated() { | 125 | async onDetailUpdated() { |
| @@ -376,7 +364,7 @@ export struct OperRowListView { | @@ -376,7 +364,7 @@ export struct OperRowListView { | ||
| 376 | TapGesture() | 364 | TapGesture() |
| 377 | .onAction((event: GestureEvent) => { | 365 | .onAction((event: GestureEvent) => { |
| 378 | this.AudioSuspension.setPlayerUrl(this.audioUrl, this.audioTitle) | 366 | this.AudioSuspension.setPlayerUrl(this.audioUrl, this.audioTitle) |
| 379 | - TrackingButton.click('suspendedWindow',this.PageName,this.PageName) | 367 | + TrackingButton.click('suspendedWindow',this.pageId,this.pageName) |
| 380 | })) | 368 | })) |
| 381 | } | 369 | } |
| 382 | .height(36) | 370 | .height(36) |
| @@ -473,9 +461,9 @@ export struct OperRowListView { | @@ -473,9 +461,9 @@ export struct OperRowListView { | ||
| 473 | this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 | 461 | this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 |
| 474 | if (this.newsStatusOfUser.collectStatus === 1) { | 462 | if (this.newsStatusOfUser.collectStatus === 1) { |
| 475 | promptAction.showToast({ message: '收藏成功' }) | 463 | promptAction.showToast({ message: '收藏成功' }) |
| 476 | - TrackingContent.collect(true,this.PageName,this.PageName,this.pageParam) | 464 | + TrackingContent.collect(true,this.pageId,this.pageName,this.pageParam) |
| 477 | } else { | 465 | } else { |
| 478 | - TrackingContent.collect(false,this.PageName,this.PageName,this.pageParam) | 466 | + TrackingContent.collect(false,this.pageId,this.pageName,this.pageParam) |
| 479 | } | 467 | } |
| 480 | this.queryContentInteractCount() | 468 | this.queryContentInteractCount() |
| 481 | } | 469 | } |
| @@ -300,6 +300,7 @@ export struct ENewspaperListDialog { | @@ -300,6 +300,7 @@ export struct ENewspaperListDialog { | ||
| 300 | }.width('100%') | 300 | }.width('100%') |
| 301 | .height('100%') | 301 | .height('100%') |
| 302 | .backgroundColor('#80000000') | 302 | .backgroundColor('#80000000') |
| 303 | + .margin({bottom:44}) | ||
| 303 | .onClick(() => { | 304 | .onClick(() => { |
| 304 | if (this.closeDialog) { | 305 | if (this.closeDialog) { |
| 305 | this.closeDialog() | 306 | this.closeDialog() |
| @@ -157,6 +157,10 @@ | @@ -157,6 +157,10 @@ | ||
| 157 | "value": "#0D000000" | 157 | "value": "#0D000000" |
| 158 | }, | 158 | }, |
| 159 | { | 159 | { |
| 160 | + "name": "color_B3000000", | ||
| 161 | + "value": "#B3000000" | ||
| 162 | + }, | ||
| 163 | + { | ||
| 160 | "name": "res_color_general_000000_30", | 164 | "name": "res_color_general_000000_30", |
| 161 | "value": "#4D000000" | 165 | "value": "#4D000000" |
| 162 | } | 166 | } |
| @@ -23,7 +23,7 @@ const TAG = 'DetailPlayLiveCommon' | @@ -23,7 +23,7 @@ const TAG = 'DetailPlayLiveCommon' | ||
| 23 | @Component | 23 | @Component |
| 24 | export struct DetailPlayLiveCommon { | 24 | export struct DetailPlayLiveCommon { |
| 25 | private liveViewModel: LiveViewModel = new LiveViewModel() | 25 | private liveViewModel: LiveViewModel = new LiveViewModel() |
| 26 | - pageShowTime:number = 0; | 26 | + pageShowTime: number = 0; |
| 27 | @Provide relId: string = '' | 27 | @Provide relId: string = '' |
| 28 | @Provide contentId: string = '' | 28 | @Provide contentId: string = '' |
| 29 | @Provide relType: string = '' | 29 | @Provide relType: string = '' |
| @@ -36,9 +36,10 @@ export struct DetailPlayLiveCommon { | @@ -36,9 +36,10 @@ export struct DetailPlayLiveCommon { | ||
| 36 | @Provide pageBackPress: number = -1 | 36 | @Provide pageBackPress: number = -1 |
| 37 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 37 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 38 | @Provide publishCommentModel: publishCommentModel = new publishCommentModel() | 38 | @Provide publishCommentModel: publishCommentModel = new publishCommentModel() |
| 39 | + @Provide pageId: string = TrackConstants.PageName.Live_Detail | ||
| 40 | + @Provide pageName: string = TrackConstants.PageName.Live_Detail | ||
| 39 | // 横屏或竖屏 general-竖屏,news-横屏 | 41 | // 横屏或竖屏 general-竖屏,news-横屏 |
| 40 | @State liveLandscape: string = '' | 42 | @State liveLandscape: string = '' |
| 41 | - | ||
| 42 | @State isLoading: boolean = false | 43 | @State isLoading: boolean = false |
| 43 | 44 | ||
| 44 | async aboutToAppear(): Promise<void> { | 45 | async aboutToAppear(): Promise<void> { |
| @@ -51,12 +52,6 @@ export struct DetailPlayLiveCommon { | @@ -51,12 +52,6 @@ export struct DetailPlayLiveCommon { | ||
| 51 | 52 | ||
| 52 | } | 53 | } |
| 53 | 54 | ||
| 54 | - aboutToDisappear(): void { | ||
| 55 | - console.error("XXXXZZZZ", '---aboutToDisappear------------') | ||
| 56 | - | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - | ||
| 60 | build() { | 55 | build() { |
| 61 | Column() { | 56 | Column() { |
| 62 | // 直播预约或横屏直播统一进横屏直播 | 57 | // 直播预约或横屏直播统一进横屏直播 |
| @@ -66,7 +61,7 @@ export struct DetailPlayLiveCommon { | @@ -66,7 +61,7 @@ export struct DetailPlayLiveCommon { | ||
| 66 | } else if (this.liveLandscape === 'general') { | 61 | } else if (this.liveLandscape === 'general') { |
| 67 | // 沉浸式直播 | 62 | // 沉浸式直播 |
| 68 | DetailPlayVLivePage() | 63 | DetailPlayVLivePage() |
| 69 | - }else { | 64 | + } else { |
| 70 | PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible) | 65 | PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible) |
| 71 | } | 66 | } |
| 72 | } | 67 | } |
| @@ -86,20 +81,16 @@ export struct DetailPlayLiveCommon { | @@ -86,20 +81,16 @@ export struct DetailPlayLiveCommon { | ||
| 86 | if (data) { | 81 | if (data) { |
| 87 | let detailData = data[0] | 82 | let detailData = data[0] |
| 88 | //人民号类型单独获取直播地址 | 83 | //人民号类型单独获取直播地址 |
| 89 | - if (detailData.rmhPlatform === 1) { | ||
| 90 | - | 84 | + if (detailData.rmhPlatform === 1 && detailData.liveInfo?.liveState === 'running') { // |
| 91 | let vliveId = detailData.liveInfo.vlive[0].vliveId as string | 85 | let vliveId = detailData.liveInfo.vlive[0].vliveId as string |
| 92 | - console.error(TAG, 'vliveId==' + vliveId) | ||
| 93 | let pullStreamAddressData = await this.liveViewModel.getLiveRoomPullAddress(vliveId) as GetPullAddressBean | 86 | let pullStreamAddressData = await this.liveViewModel.getLiveRoomPullAddress(vliveId) as GetPullAddressBean |
| 94 | - | ||
| 95 | if (pullStreamAddressData) { | 87 | if (pullStreamAddressData) { |
| 96 | - console.log(TAG, ' GetPullAddressBean:', JSON.stringify(pullStreamAddressData)) | 88 | + // console.log(TAG, ' GetPullAddressBean:', JSON.stringify(pullStreamAddressData)) |
| 97 | let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url | 89 | let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url |
| 98 | detailData.liveInfo.vlive[0].liveUrl = m3u8uUrl | 90 | detailData.liveInfo.vlive[0].liveUrl = m3u8uUrl |
| 99 | this.playUrl = m3u8uUrl | 91 | this.playUrl = m3u8uUrl |
| 100 | - console.log(TAG, ' GetPullAddressBean:', m3u8uUrl) | 92 | + // console.log(TAG, ' GetPullAddressBean:', m3u8uUrl) |
| 101 | } | 93 | } |
| 102 | - | ||
| 103 | } | 94 | } |
| 104 | 95 | ||
| 105 | this.liveLandscape = | 96 | this.liveLandscape = |
| @@ -133,7 +124,7 @@ export struct DetailPlayLiveCommon { | @@ -133,7 +124,7 @@ export struct DetailPlayLiveCommon { | ||
| 133 | ToastUtils.shortToast('内容不存在') | 124 | ToastUtils.shortToast('内容不存在') |
| 134 | router.back() | 125 | router.back() |
| 135 | } | 126 | } |
| 136 | - },()=>{ | 127 | + }, () => { |
| 137 | this.isLoading | 128 | this.isLoading |
| 138 | ToastUtils.shortToast('内容不存在') | 129 | ToastUtils.shortToast('内容不存在') |
| 139 | router.back() | 130 | router.back() |
| @@ -141,8 +132,6 @@ export struct DetailPlayLiveCommon { | @@ -141,8 +132,6 @@ export struct DetailPlayLiveCommon { | ||
| 141 | }) | 132 | }) |
| 142 | } | 133 | } |
| 143 | 134 | ||
| 144 | - | ||
| 145 | - | ||
| 146 | onPageShow() { | 135 | onPageShow() { |
| 147 | this.pageShow = Math.random() | 136 | this.pageShow = Math.random() |
| 148 | Logger.info(TAG, 'onPageShow') | 137 | Logger.info(TAG, 'onPageShow') |
| @@ -152,10 +141,10 @@ export struct DetailPlayLiveCommon { | @@ -152,10 +141,10 @@ export struct DetailPlayLiveCommon { | ||
| 152 | onPageHide() { | 141 | onPageHide() { |
| 153 | this.pageHide = Math.random() | 142 | this.pageHide = Math.random() |
| 154 | Logger.info(TAG, 'onPageHide') | 143 | Logger.info(TAG, 'onPageHide') |
| 155 | - console.error("XXXXZZZZ", '---onPageHide------------') | ||
| 156 | //页面浏览 | 144 | //页面浏览 |
| 157 | - TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Live_Detail,TrackConstants.PageName.Live_Detail | ||
| 158 | - ,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000)) | 145 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Live_Detail, |
| 146 | + TrackConstants.PageName.Live_Detail | ||
| 147 | + , Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime) / 1000)) | ||
| 159 | 148 | ||
| 160 | } | 149 | } |
| 161 | 150 |
| @@ -9,6 +9,7 @@ import { router, window } from '@kit.ArkUI'; | @@ -9,6 +9,7 @@ import { router, window } from '@kit.ArkUI'; | ||
| 9 | import { WDAliPlayerController } from 'wdPlayer/Index'; | 9 | import { WDAliPlayerController } from 'wdPlayer/Index'; |
| 10 | import { LiveOperRowListView } from 'wdComponent'; | 10 | import { LiveOperRowListView } from 'wdComponent'; |
| 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 { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index'; | ||
| 12 | 13 | ||
| 13 | let TAG: string = 'DetailPlayLivePage'; | 14 | let TAG: string = 'DetailPlayLivePage'; |
| 14 | 15 | ||
| @@ -34,7 +35,6 @@ export struct DetailPlayLivePage { | @@ -34,7 +35,6 @@ export struct DetailPlayLivePage { | ||
| 34 | @Consume @Watch('onBackPressCus') pageBackPress: number | 35 | @Consume @Watch('onBackPressCus') pageBackPress: number |
| 35 | @Consume contentDetailData: ContentDetailDTO | 36 | @Consume contentDetailData: ContentDetailDTO |
| 36 | @Consume publishCommentModel: publishCommentModel | 37 | @Consume publishCommentModel: publishCommentModel |
| 37 | - | ||
| 38 | // 尽量不要动属性。用来作为输入了评论之后,值传递 | 38 | // 尽量不要动属性。用来作为输入了评论之后,值传递 |
| 39 | @State lastInputedLiveComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的直播间消息 | 39 | @State lastInputedLiveComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的直播间消息 |
| 40 | @State lastInputedChatComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的大家聊消息 | 40 | @State lastInputedChatComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的大家聊消息 |
| @@ -69,10 +69,12 @@ export struct DetailPlayLivePage { | @@ -69,10 +69,12 @@ export struct DetailPlayLivePage { | ||
| 69 | TopPlayComponent({ playerController: this.playerController }) | 69 | TopPlayComponent({ playerController: this.playerController }) |
| 70 | .height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%') | 70 | .height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%') |
| 71 | 71 | ||
| 72 | - TabComponent({ tabs: this.tabs, | 72 | + TabComponent({ |
| 73 | + tabs: this.tabs, | ||
| 73 | changeToTab: this.changeToTab, | 74 | changeToTab: this.changeToTab, |
| 74 | lastInputedLiveComment: this.lastInputedLiveComment, | 75 | lastInputedLiveComment: this.lastInputedLiveComment, |
| 75 | - lastInputedChatComment: this.lastInputedChatComment}) | 76 | + lastInputedChatComment: this.lastInputedChatComment |
| 77 | + }) | ||
| 76 | .layoutWeight(1) | 78 | .layoutWeight(1) |
| 77 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | 79 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) |
| 78 | 80 | ||
| @@ -95,6 +97,10 @@ export struct DetailPlayLivePage { | @@ -95,6 +97,10 @@ export struct DetailPlayLivePage { | ||
| 95 | } else { | 97 | } else { |
| 96 | this.lastInputedChatComment = result | 98 | this.lastInputedChatComment = result |
| 97 | } | 99 | } |
| 100 | + // 发布评论埋点 | ||
| 101 | + TrackingContent.commentClick(TrackConstants.PageName.Live_Detail, | ||
| 102 | + TrackConstants.PageName.Live_Detail, | ||
| 103 | + TrackParamConvert.contentDetail(this.contentDetailData)); | ||
| 98 | }) | 104 | }) |
| 99 | } | 105 | } |
| 100 | } | 106 | } |
| @@ -7,6 +7,7 @@ import { WDAliPlayerController } from 'wdPlayer/Index'; | @@ -7,6 +7,7 @@ import { WDAliPlayerController } from 'wdPlayer/Index'; | ||
| 7 | import { DisplayDirection } from 'wdConstant/Index'; | 7 | import { DisplayDirection } from 'wdConstant/Index'; |
| 8 | import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index'; | 8 | import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index'; |
| 9 | import { PlayerEndView } from '../widgets/vertical/PlayerEndView'; | 9 | import { PlayerEndView } from '../widgets/vertical/PlayerEndView'; |
| 10 | +import { TrackConstants, TrackingButton } from 'wdTracking/Index'; | ||
| 10 | 11 | ||
| 11 | const storage = LocalStorage.getShared(); | 12 | const storage = LocalStorage.getShared(); |
| 12 | const TAG = 'DetailPlayVLivePage' | 13 | const TAG = 'DetailPlayVLivePage' |
| @@ -96,6 +97,9 @@ export struct DetailPlayVLivePage { | @@ -96,6 +97,9 @@ export struct DetailPlayVLivePage { | ||
| 96 | .markAnchor({ x: 56, y: this.bottomSafeHeight }) | 97 | .markAnchor({ x: 56, y: this.bottomSafeHeight }) |
| 97 | .onClick(() => { | 98 | .onClick(() => { |
| 98 | this.swiperController.showNext() | 99 | this.swiperController.showNext() |
| 100 | + // 埋点 | ||
| 101 | + TrackingButton.click('clearScreen', TrackConstants.PageName.Live_Detail, | ||
| 102 | + TrackConstants.PageName.Live_Detail) | ||
| 99 | }) | 103 | }) |
| 100 | 104 | ||
| 101 | } | 105 | } |
| @@ -116,7 +120,5 @@ export struct DetailPlayVLivePage { | @@ -116,7 +120,5 @@ export struct DetailPlayVLivePage { | ||
| 116 | console.error(TAG, 'getLiveDetails catch', message) | 120 | console.error(TAG, 'getLiveDetails catch', message) |
| 117 | }) | 121 | }) |
| 118 | } | 122 | } |
| 119 | - | ||
| 120 | - | ||
| 121 | } | 123 | } |
| 122 | 124 |
| 1 | -import { ContentDetailDTO, | 1 | +import { |
| 2 | + ContentDetailDTO, | ||
| 2 | GetPullAddressBean, | 3 | GetPullAddressBean, |
| 3 | - LiveDetailsBean, LiveRoomBean, LiveRoomDataBean, | 4 | + LiveDetailsBean, |
| 5 | + LiveRoomBean, | ||
| 6 | + LiveRoomDataBean, | ||
| 4 | LiveRoomItemBean, | 7 | LiveRoomItemBean, |
| 5 | - ValueType } from 'wdBean/Index' | 8 | + ValueType |
| 9 | +} from 'wdBean/Index' | ||
| 6 | import { ContentDetailRequest } from 'wdDetailPlayApi/Index' | 10 | import { ContentDetailRequest } from 'wdDetailPlayApi/Index' |
| 7 | import { Logger } from 'wdKit/Index' | 11 | import { Logger } from 'wdKit/Index' |
| 8 | import { ToastUtils } from 'wdKit/src/main/ets/utils/ToastUtils' | 12 | import { ToastUtils } from 'wdKit/src/main/ets/utils/ToastUtils' |
| @@ -32,16 +36,25 @@ export class LiveViewModel { | @@ -32,16 +36,25 @@ export class LiveViewModel { | ||
| 32 | 36 | ||
| 33 | } | 37 | } |
| 34 | 38 | ||
| 35 | - async getLiveRoomPullAddress(vliveId:string) : Promise<GetPullAddressBean>{ | 39 | + /** |
| 40 | + * 获取直播间的拉流地址 | ||
| 41 | + * @param vliveId | ||
| 42 | + * @returns | ||
| 43 | + */ | ||
| 44 | + async getLiveRoomPullAddress(vliveId: string): Promise<GetPullAddressBean | null> { | ||
| 36 | 45 | ||
| 37 | - return new Promise<GetPullAddressBean>((success, fail) => { | ||
| 38 | - ContentDetailRequest.getLiveRoomPullStream(vliveId).then(async (resDTO: ResponseDTO<GetPullAddressBean>) => { | 46 | + return new Promise<GetPullAddressBean | null>((success, fail) => { |
| 47 | + ContentDetailRequest.getLiveRoomPullStream(vliveId) | ||
| 48 | + .then(async (resDTO: ResponseDTO<GetPullAddressBean>) => { | ||
| 39 | console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data)) | 49 | console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data)) |
| 40 | if (resDTO.data) { | 50 | if (resDTO.data) { |
| 41 | success(resDTO.data) | 51 | success(resDTO.data) |
| 52 | + } else { | ||
| 53 | + success(null) | ||
| 42 | } | 54 | } |
| 43 | - }).catch(() => { | ||
| 44 | - fail("数据为空") | 55 | + }) |
| 56 | + .catch(() => { | ||
| 57 | + success(null) | ||
| 45 | }) | 58 | }) |
| 46 | 59 | ||
| 47 | }) | 60 | }) |
| @@ -102,6 +115,7 @@ export class LiveViewModel { | @@ -102,6 +115,7 @@ export class LiveViewModel { | ||
| 102 | }) | 115 | }) |
| 103 | }) | 116 | }) |
| 104 | } | 117 | } |
| 118 | + | ||
| 105 | // 直播详情-C端点赞接口 | 119 | // 直播详情-C端点赞接口 |
| 106 | getLiveRoomNumberLike(liveId: string, number: number, deviceId: string | number) { | 120 | getLiveRoomNumberLike(liveId: string, number: number, deviceId: string | number) { |
| 107 | return new Promise<number>((success, fail) => { | 121 | return new Promise<number>((success, fail) => { |
| @@ -112,6 +126,7 @@ export class LiveViewModel { | @@ -112,6 +126,7 @@ export class LiveViewModel { | ||
| 112 | }) | 126 | }) |
| 113 | }) | 127 | }) |
| 114 | } | 128 | } |
| 129 | + | ||
| 115 | // 直播详情-查询是否点赞接口 | 130 | // 直播详情-查询是否点赞接口 |
| 116 | getLiveLike(liveId: string, userId: ValueType, deviceId: string | number) { | 131 | getLiveLike(liveId: string, userId: ValueType, deviceId: string | number) { |
| 117 | return new Promise<boolean>((success, fail) => { | 132 | return new Promise<boolean>((success, fail) => { |
| 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 { |
| 69 | + // this.ListLayout() | ||
| 70 | + | ||
| 71 | + CustomPullToRefresh({ | ||
| 72 | + alldata: this.liveChatList, | ||
| 73 | + scroller: this.scroller, | ||
| 74 | + hasMore: false, | ||
| 75 | + customList: () => { | ||
| 65 | this.ListLayout() | 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,33 +90,34 @@ export struct TabChatComponent { | @@ -73,33 +90,34 @@ 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 | - // } | 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() | ||
| 101 | } | 108 | } |
| 102 | } | 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 | + }) | ||
| 120 | + } | ||
| 103 | 121 | ||
| 104 | @Builder | 122 | @Builder |
| 105 | LoadingLayout() { | 123 | LoadingLayout() { |
| @@ -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) { |
| @@ -56,7 +56,7 @@ export struct PlayUIComponent { | @@ -56,7 +56,7 @@ export struct PlayUIComponent { | ||
| 56 | /* | 56 | /* |
| 57 | 初始话播放器设置 | 57 | 初始话播放器设置 |
| 58 | */ | 58 | */ |
| 59 | - initPlayerSet(){ | 59 | + initPlayerSet() { |
| 60 | 60 | ||
| 61 | //播放进度监听 | 61 | //播放进度监听 |
| 62 | if (this.playerController) { | 62 | if (this.playerController) { |
| @@ -280,7 +280,12 @@ export struct PlayUIComponent { | @@ -280,7 +280,12 @@ export struct PlayUIComponent { | ||
| 280 | } | 280 | } |
| 281 | 281 | ||
| 282 | // 进度条 | 282 | // 进度条 |
| 283 | + if (this.contentDetailData.liveInfo?.liveState == 'running') { | ||
| 284 | + Blank() | ||
| 285 | + } else { | ||
| 283 | this.playProgressView() | 286 | this.playProgressView() |
| 287 | + } | ||
| 288 | + | ||
| 284 | // 总的播放时间 | 289 | // 总的播放时间 |
| 285 | if (this.contentDetailData?.liveInfo?.liveState != 'running' || this.contentDetailData.showTime) { | 290 | if (this.contentDetailData?.liveInfo?.liveState != 'running' || this.contentDetailData.showTime) { |
| 286 | Text(this.totalTime) | 291 | Text(this.totalTime) |
| 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,21 +25,20 @@ export struct TopPlayComponent { | @@ -25,21 +25,20 @@ 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 | // 当前播放资源的状态 |
| 32 | @Provide playSourceState: number = 0 | 32 | @Provide playSourceState: number = 0 |
| 33 | private playUrl: string = "" | 33 | private playUrl: string = "" |
| 34 | private xComponentIsLoaded: boolean = false | 34 | private xComponentIsLoaded: boolean = false |
| 35 | - pageParam: ParamType = {} | ||
| 36 | 35 | ||
| 37 | aboutToAppear(): void { | 36 | aboutToAppear(): void { |
| 38 | if (this.playerController) { | 37 | if (this.playerController) { |
| 39 | 38 | ||
| 40 | this.playerController.onCanplay = () => { | 39 | this.playerController.onCanplay = () => { |
| 41 | this.isCanPlay = true | 40 | this.isCanPlay = true |
| 42 | - this.isLoading = true | 41 | + this.isHideLoading = true |
| 43 | this.playerController?.play() | 42 | this.playerController?.play() |
| 44 | } | 43 | } |
| 45 | 44 | ||
| @@ -49,7 +48,7 @@ export struct TopPlayComponent { | @@ -49,7 +48,7 @@ export struct TopPlayComponent { | ||
| 49 | Logger.debug(TAG, 'status==>' + status) | 48 | Logger.debug(TAG, 'status==>' + status) |
| 50 | if (status === PlayerConstants.STATUS_ERROR) { | 49 | if (status === PlayerConstants.STATUS_ERROR) { |
| 51 | this.isError = true | 50 | this.isError = true |
| 52 | - this.isLoading = true | 51 | + this.isHideLoading = true |
| 53 | this.isCanPlay = false | 52 | this.isCanPlay = false |
| 54 | } else if (status === PlayerConstants.STATUS_COMPLETION) { | 53 | } else if (status === PlayerConstants.STATUS_COMPLETION) { |
| 55 | // 播放完成 | 54 | // 播放完成 |
| @@ -67,8 +66,9 @@ export struct TopPlayComponent { | @@ -67,8 +66,9 @@ export struct TopPlayComponent { | ||
| 67 | * 更新直播播放数据 | 66 | * 更新直播播放数据 |
| 68 | */ | 67 | */ |
| 69 | updateData() { | 68 | updateData() { |
| 70 | - // 检测等待中的直播预告是否视频资源 | 69 | + // 检测直播等待状态的直播预告是否视频资源 |
| 71 | 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' | ||
| 72 | && this.contentDetailData.liveInfo.previewUrl && | 72 | && this.contentDetailData.liveInfo.previewUrl && |
| 73 | this.contentDetailData.liveInfo.previewUrl.length > 0) { | 73 | this.contentDetailData.liveInfo.previewUrl.length > 0) { |
| 74 | // 预告资源是视频 | 74 | // 预告资源是视频 |
| @@ -79,7 +79,6 @@ export struct TopPlayComponent { | @@ -79,7 +79,6 @@ export struct TopPlayComponent { | ||
| 79 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl && | 79 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl && |
| 80 | this.contentDetailData.liveInfo.previewUrl.length > 0) { | 80 | this.contentDetailData.liveInfo.previewUrl.length > 0) { |
| 81 | this.previewUrl = this.contentDetailData.liveInfo.previewUrl | 81 | this.previewUrl = this.contentDetailData.liveInfo.previewUrl |
| 82 | - | ||
| 83 | } else if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) { | 82 | } else if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) { |
| 84 | this.previewUrl = this.contentDetailData.fullColumnImgUrls[0].url | 83 | this.previewUrl = this.contentDetailData.fullColumnImgUrls[0].url |
| 85 | } | 84 | } |
| @@ -88,18 +87,17 @@ export struct TopPlayComponent { | @@ -88,18 +87,17 @@ export struct TopPlayComponent { | ||
| 88 | 87 | ||
| 89 | if (this.isVideoSource) { | 88 | if (this.isVideoSource) { |
| 90 | this.isWait = false | 89 | this.isWait = false |
| 91 | - this.isLoading = false | 90 | + this.isHideLoading = false |
| 92 | } else { | 91 | } else { |
| 93 | this.isWait = this.contentDetailData?.liveInfo?.liveState == 'wait' | 92 | this.isWait = this.contentDetailData?.liveInfo?.liveState == 'wait' |
| 94 | if (this.isWait) { | 93 | if (this.isWait) { |
| 95 | - this.isLoading = true | 94 | + this.isHideLoading = true |
| 96 | } | 95 | } |
| 97 | } | 96 | } |
| 98 | 97 | ||
| 99 | this.isEnd = this.contentDetailData?.liveInfo?.liveState === 'end' && | 98 | this.isEnd = this.contentDetailData?.liveInfo?.liveState === 'end' && |
| 100 | StringUtils.isEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri) | 99 | StringUtils.isEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri) |
| 101 | 100 | ||
| 102 | - // Logger.debug(TAG, `---0------>` + this.isWait + ' ->' + this.isLoading + ' ->' + this.isEnd) | ||
| 103 | if (!this.isWait) { | 101 | if (!this.isWait) { |
| 104 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.vlive.length > 0) { | 102 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.vlive.length > 0) { |
| 105 | let playUrl = '' | 103 | let playUrl = '' |
| @@ -115,31 +113,38 @@ export struct TopPlayComponent { | @@ -115,31 +113,38 @@ export struct TopPlayComponent { | ||
| 115 | } else { | 113 | } else { |
| 116 | Logger.debug(TAG, `---0------>${playUrl}`) | 114 | Logger.debug(TAG, `---0------>${playUrl}`) |
| 117 | if (StringUtils.isNotEmpty(playUrl)) { | 115 | if (StringUtils.isNotEmpty(playUrl)) { |
| 116 | + Logger.debug(TAG, `---isNotEmpty------>`) | ||
| 118 | this.playUrl = playUrl | 117 | this.playUrl = playUrl |
| 119 | this.tryToPlay() | 118 | this.tryToPlay() |
| 120 | } | 119 | } |
| 121 | } | 120 | } |
| 122 | } else { | 121 | } else { |
| 123 | this.isWait = true | 122 | this.isWait = true |
| 124 | - this.isLoading = true | 123 | + this.isHideLoading = true |
| 124 | + } | ||
| 125 | } | 125 | } |
| 126 | + // 直播结束 | ||
| 127 | + if (this.contentDetailData?.liveInfo?.liveState === 'end') { | ||
| 128 | + this.isHideLoading = true | ||
| 129 | + this.isWait = StringUtils.isNotEmpty(this.playUrl) | ||
| 126 | } | 130 | } |
| 127 | 131 | ||
| 132 | + | ||
| 128 | // 文字直播 running 状态 | 133 | // 文字直播 running 状态 |
| 129 | if (this.contentDetailData?.liveInfo?.liveWay === 1 && this.contentDetailData?.liveInfo?.liveState === 'running') { | 134 | if (this.contentDetailData?.liveInfo?.liveWay === 1 && this.contentDetailData?.liveInfo?.liveState === 'running') { |
| 130 | this.isWait = true | 135 | this.isWait = true |
| 131 | - this.isLoading = true | 136 | + this.isHideLoading = true |
| 132 | if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) { | 137 | if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) { |
| 133 | this.previewUrl = this.contentDetailData.fullColumnImgUrls[0].url | 138 | this.previewUrl = this.contentDetailData.fullColumnImgUrls[0].url |
| 134 | } else { | 139 | } else { |
| 135 | this.previewUrl = '' | 140 | this.previewUrl = '' |
| 136 | } | 141 | } |
| 137 | } | 142 | } |
| 138 | - | 143 | + //Logger.debug(TAG, `---0------>` + this.isWait + ' ->' + this.isHideLoading + ' ->' + this.isEnd+' -->'+this.isVideoSource) |
| 139 | } | 144 | } |
| 140 | 145 | ||
| 141 | tryToPlay() { | 146 | tryToPlay() { |
| 142 | - Logger.debug(TAG, `---1------>`) | 147 | + |
| 143 | if (!this.xComponentIsLoaded) { | 148 | if (!this.xComponentIsLoaded) { |
| 144 | Logger.debug(TAG, "需要xComponent加载完成") | 149 | Logger.debug(TAG, "需要xComponent加载完成") |
| 145 | return | 150 | return |
| @@ -148,16 +153,12 @@ export struct TopPlayComponent { | @@ -148,16 +153,12 @@ export struct TopPlayComponent { | ||
| 148 | Logger.debug(TAG, "播放地址为空") | 153 | Logger.debug(TAG, "播放地址为空") |
| 149 | return | 154 | return |
| 150 | } | 155 | } |
| 151 | - this.contentTrackingDict() | ||
| 152 | - this.playerController?.firstPlay(this.playUrl, TrackConstants.PageName.Live_Detail, this.pageParam); | ||
| 153 | - } | ||
| 154 | 156 | ||
| 155 | - contentTrackingDict() { | ||
| 156 | - this.pageParam = { | 157 | + this.playerController?.firstPlay(this.playUrl, TrackConstants.PageName.Live_Detail, { |
| 157 | 'contentType': `${this.contentDetailData.newsType}`, | 158 | 'contentType': `${this.contentDetailData.newsType}`, |
| 158 | 'contentId': `${this.contentDetailData.newsId}`, | 159 | 'contentId': `${this.contentDetailData.newsId}`, |
| 159 | 'contentName': `${this.contentDetailData.newsTitle || ''}`, | 160 | 'contentName': `${this.contentDetailData.newsTitle || ''}`, |
| 160 | - } | 161 | + }); |
| 161 | } | 162 | } |
| 162 | 163 | ||
| 163 | build() { | 164 | build() { |
| @@ -166,12 +167,14 @@ export struct TopPlayComponent { | @@ -166,12 +167,14 @@ export struct TopPlayComponent { | ||
| 166 | WDPlayerRenderLiveView({ | 167 | WDPlayerRenderLiveView({ |
| 167 | playerController: this.playerController, | 168 | playerController: this.playerController, |
| 168 | onLoad: async () => { | 169 | onLoad: async () => { |
| 169 | - this.isLoading = false | 170 | + if (StringUtils.isNotEmpty(this.playUrl)) { |
| 171 | + this.isHideLoading = false | ||
| 170 | this.isError = false | 172 | this.isError = false |
| 171 | this.xComponentIsLoaded = true | 173 | this.xComponentIsLoaded = true |
| 172 | Logger.debug(TAG, `---onLoad------>`) | 174 | Logger.debug(TAG, `---onLoad------>`) |
| 173 | this.tryToPlay() | 175 | this.tryToPlay() |
| 174 | } | 176 | } |
| 177 | + } | ||
| 175 | }) | 178 | }) |
| 176 | .height('100%') | 179 | .height('100%') |
| 177 | .width('100%') | 180 | .width('100%') |
| @@ -185,12 +188,13 @@ export struct TopPlayComponent { | @@ -185,12 +188,13 @@ export struct TopPlayComponent { | ||
| 185 | .objectFit(ImageFit.Cover) | 188 | .objectFit(ImageFit.Cover) |
| 186 | .alt($r('app.media.live_room_image_fail')) | 189 | .alt($r('app.media.live_room_image_fail')) |
| 187 | .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None) | 190 | .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None) |
| 188 | - .contrast(this.isEnd ? 0.2 : 1) | 191 | + // .contrast(this.isEnd ? 0.4 : 1) |
| 192 | + .blur(this.isEnd ? 20 : 0) | ||
| 189 | .width('100%') | 193 | .width('100%') |
| 190 | } | 194 | } |
| 191 | 195 | ||
| 192 | // loading | 196 | // loading |
| 193 | - PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible) | 197 | + PictureLoading().visibility(this.isHideLoading ? Visibility.None : Visibility.Visible) |
| 194 | 198 | ||
| 195 | // 视频播放器上的控制面板和信息 | 199 | // 视频播放器上的控制面板和信息 |
| 196 | PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay, liveUrl: this.playUrl }) | 200 | PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay, liveUrl: this.playUrl }) |
| @@ -226,7 +230,7 @@ export struct TopPlayComponent { | @@ -226,7 +230,7 @@ export struct TopPlayComponent { | ||
| 226 | .margin({ top: 16 }) | 230 | .margin({ top: 16 }) |
| 227 | .padding(0) | 231 | .padding(0) |
| 228 | .onClick(() => { | 232 | .onClick(() => { |
| 229 | - this.isLoading = false | 233 | + this.isHideLoading = false |
| 230 | this.isError = false | 234 | this.isError = false |
| 231 | this.xComponentIsLoaded = true | 235 | this.xComponentIsLoaded = true |
| 232 | this.tryToPlay() | 236 | this.tryToPlay() |
| @@ -11,6 +11,7 @@ import { ChartItemCompereComponent } from './ChartItemCompereComponent' | @@ -11,6 +11,7 @@ import { ChartItemCompereComponent } from './ChartItemCompereComponent' | ||
| 11 | import { ChatItemComponent } from './ChartItemComponent' | 11 | import { ChatItemComponent } from './ChartItemComponent' |
| 12 | import { router } from '@kit.ArkUI' | 12 | import { router } from '@kit.ArkUI' |
| 13 | import { EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index' | 13 | import { EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index' |
| 14 | +import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index' | ||
| 14 | 15 | ||
| 15 | const TAG = "PlayerCommentComponent" | 16 | const TAG = "PlayerCommentComponent" |
| 16 | /** | 17 | /** |
| @@ -105,6 +106,7 @@ export struct PlayerCommentComponent { | @@ -105,6 +106,7 @@ export struct PlayerCommentComponent { | ||
| 105 | contentDetailData: this.contentDetailData, | 106 | contentDetailData: this.contentDetailData, |
| 106 | onCommentInputFocus: () => { | 107 | onCommentInputFocus: () => { |
| 107 | 108 | ||
| 109 | + | ||
| 108 | }, | 110 | }, |
| 109 | onCommentInputed: (content) => { | 111 | onCommentInputed: (content) => { |
| 110 | if (content.comment) { | 112 | if (content.comment) { |
| @@ -116,6 +118,11 @@ export struct PlayerCommentComponent { | @@ -116,6 +118,11 @@ export struct PlayerCommentComponent { | ||
| 116 | this.liveChatList.push(result) | 118 | this.liveChatList.push(result) |
| 117 | this.scroller.scrollEdge(Edge.Bottom) | 119 | this.scroller.scrollEdge(Edge.Bottom) |
| 118 | }) | 120 | }) |
| 121 | + | ||
| 122 | + // 发布评论埋点 | ||
| 123 | + TrackingContent.commentClick(TrackConstants.PageName.Live_Detail, | ||
| 124 | + TrackConstants.PageName.Live_Detail, | ||
| 125 | + TrackParamConvert.contentDetail(this.contentDetailData)); | ||
| 119 | } | 126 | } |
| 120 | }, | 127 | }, |
| 121 | onBack: () => { | 128 | onBack: () => { |
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | "tablet", | 8 | "tablet", |
| 9 | "2in1" | 9 | "2in1" |
| 10 | ], | 10 | ], |
| 11 | + "compressNativeLibs": true, | ||
| 11 | "deliveryWithInstall": true, | 12 | "deliveryWithInstall": true, |
| 12 | "pages": "$profile:main_pages", | 13 | "pages": "$profile:main_pages", |
| 13 | "requestPermissions": [ | 14 | "requestPermissions": [ |
| @@ -13,7 +13,7 @@ import { PlayerBottomView } from '../view/PlayerBottomView'; | @@ -13,7 +13,7 @@ import { PlayerBottomView } from '../view/PlayerBottomView'; | ||
| 13 | import { PlayerRightView } from '../view/PlayerRightView'; | 13 | import { PlayerRightView } from '../view/PlayerRightView'; |
| 14 | import { DisplayDirection } from 'wdConstant/Index'; | 14 | import { DisplayDirection } from 'wdConstant/Index'; |
| 15 | import { CommentDialogView } from '../view/CommentDialogView'; | 15 | import { CommentDialogView } from '../view/CommentDialogView'; |
| 16 | -import { window } from '@kit.ArkUI'; | 16 | +import { componentUtils, window } from '@kit.ArkUI'; |
| 17 | import { PlayerFullScreenView } from '../view/PlayerFullScreenView'; | 17 | import { PlayerFullScreenView } from '../view/PlayerFullScreenView'; |
| 18 | import { OperRowListView, publishCommentModel } from 'wdComponent/Index'; | 18 | import { OperRowListView, publishCommentModel } from 'wdComponent/Index'; |
| 19 | import { ParamType, TrackConstants } from 'wdTracking/Index'; | 19 | import { ParamType, TrackConstants } from 'wdTracking/Index'; |
| @@ -40,7 +40,7 @@ export struct DetailPlayShortVideoPage { | @@ -40,7 +40,7 @@ export struct DetailPlayShortVideoPage { | ||
| 40 | @Provide isOpenDetail: boolean = false // 查看详情按钮点击 | 40 | @Provide isOpenDetail: boolean = false // 查看详情按钮点击 |
| 41 | @Provide isDragging: boolean = false // 拖动时间进度条 | 41 | @Provide isDragging: boolean = false // 拖动时间进度条 |
| 42 | @Provide status: number = PlayerConstants.STATUS_START; | 42 | @Provide status: number = PlayerConstants.STATUS_START; |
| 43 | - @Consume showCommentList: boolean | 43 | + @Consume @Watch("showCommentListChanged") showCommentList: boolean |
| 44 | @Consume displayDirection: DisplayDirection | 44 | @Consume displayDirection: DisplayDirection |
| 45 | @Consume @Watch('videoStatusChange') switchVideoStatus: boolean | 45 | @Consume @Watch('videoStatusChange') switchVideoStatus: boolean |
| 46 | @Consume @Watch('pageShowChange') pageShow: number | 46 | @Consume @Watch('pageShowChange') pageShow: number |
| @@ -207,15 +207,18 @@ export struct DetailPlayShortVideoPage { | @@ -207,15 +207,18 @@ export struct DetailPlayShortVideoPage { | ||
| 207 | * 屏幕变化动态计算播放器宽高 | 207 | * 屏幕变化动态计算播放器宽高 |
| 208 | */ | 208 | */ |
| 209 | calculatePlayerRect() { | 209 | calculatePlayerRect() { |
| 210 | - let width = this.windowWidth | ||
| 211 | - let height = this.windowHeight | ||
| 212 | - if (this.displayDirection === DisplayDirection.VERTICAL) { | ||
| 213 | - width = this.windowWidth | ||
| 214 | - height = this.windowHeight | ||
| 215 | - } else { | ||
| 216 | - width = this.windowHeight | ||
| 217 | - height = this.windowWidth | ||
| 218 | - } | 210 | + const windowClass = WindowModel.shared.getWindowClass(); // 获取应用主窗口 |
| 211 | + const rect: window.Rect = windowClass.getWindowProperties().windowRect; | ||
| 212 | + | ||
| 213 | + let width = rect.width | ||
| 214 | + let height = rect.height | ||
| 215 | + // if (this.displayDirection === DisplayDirection.VERTICAL) { | ||
| 216 | + width = rect.width | ||
| 217 | + height = rect.height | ||
| 218 | + // } else { | ||
| 219 | + // width = rect.height | ||
| 220 | + // height = rect.width | ||
| 221 | + // } | ||
| 219 | // 视频宽高比屏幕大,则宽度撑满 | 222 | // 视频宽高比屏幕大,则宽度撑满 |
| 220 | if (this.ratio > width / height) { | 223 | if (this.ratio > width / height) { |
| 221 | this.playerWidth = '100%' | 224 | this.playerWidth = '100%' |
| @@ -225,10 +228,19 @@ export struct DetailPlayShortVideoPage { | @@ -225,10 +228,19 @@ export struct DetailPlayShortVideoPage { | ||
| 225 | this.playerHeight = '100%' | 228 | this.playerHeight = '100%' |
| 226 | this.playerWidth = px2vp(height * this.ratio) | 229 | this.playerWidth = px2vp(height * this.ratio) |
| 227 | } | 230 | } |
| 228 | - console.log('calculatePlayerRect=====', this.windowWidth, this.windowHeight) | 231 | + console.log('calculatePlayerRect=====', width, height) |
| 229 | 232 | ||
| 230 | } | 233 | } |
| 231 | 234 | ||
| 235 | + showCommentListChanged() { | ||
| 236 | + if (this.showCommentList) { | ||
| 237 | + this.playerWidth = px2vp(this.windowWidth) | ||
| 238 | + this.playerHeight = px2vp(this.windowWidth) / (16 / 9.0) | ||
| 239 | + } else { | ||
| 240 | + this.calculatePlayerRect() | ||
| 241 | + } | ||
| 242 | + } | ||
| 243 | + | ||
| 232 | build() { | 244 | build() { |
| 233 | Stack({ alignContent: Alignment.Top }) { | 245 | Stack({ alignContent: Alignment.Top }) { |
| 234 | Column() { | 246 | Column() { |
| @@ -278,6 +290,7 @@ export struct DetailPlayShortVideoPage { | @@ -278,6 +290,7 @@ export struct DetailPlayShortVideoPage { | ||
| 278 | .width('100%') | 290 | .width('100%') |
| 279 | 291 | ||
| 280 | } | 292 | } |
| 293 | + .id('video-container') | ||
| 281 | .height('100%') | 294 | .height('100%') |
| 282 | .width('100%') | 295 | .width('100%') |
| 283 | .onAreaChange(() => this.calculatePlayerRect()) | 296 | .onAreaChange(() => this.calculatePlayerRect()) |
| @@ -305,7 +318,9 @@ export struct DetailPlayShortVideoPage { | @@ -305,7 +318,9 @@ export struct DetailPlayShortVideoPage { | ||
| 305 | 318 | ||
| 306 | @Builder | 319 | @Builder |
| 307 | playerViewBuilder() { | 320 | playerViewBuilder() { |
| 308 | - Stack() { | 321 | + Stack({ |
| 322 | + alignContent: this.showCommentList && this.index === this.currentIndex ? Alignment.Top : Alignment.Center | ||
| 323 | + }) { | ||
| 309 | WDPlayerRenderView({ | 324 | WDPlayerRenderView({ |
| 310 | playerController: this.playerController, | 325 | playerController: this.playerController, |
| 311 | onLoad: async () => { | 326 | onLoad: async () => { |
| @@ -335,7 +350,6 @@ export struct DetailPlayShortVideoPage { | @@ -335,7 +350,6 @@ export struct DetailPlayShortVideoPage { | ||
| 335 | } | 350 | } |
| 336 | .width('100%') | 351 | .width('100%') |
| 337 | .height('100%') | 352 | .height('100%') |
| 338 | - .align(Alignment.Center) | ||
| 339 | 353 | ||
| 340 | } | 354 | } |
| 341 | 355 |
| @@ -31,6 +31,8 @@ export struct DetailVideoListPage { | @@ -31,6 +31,8 @@ export struct DetailVideoListPage { | ||
| 31 | @Provide switchVideoStatus: boolean = true | 31 | @Provide switchVideoStatus: boolean = true |
| 32 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL | 32 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL |
| 33 | @Provide showCommentList: boolean = false | 33 | @Provide showCommentList: boolean = false |
| 34 | + @Provide pageName: string = TrackConstants.PageName.VideoDetail | ||
| 35 | + @Provide pageId: string = TrackConstants.PageName.VideoDetail | ||
| 34 | @State data: ContentDetailDTO[] = [] | 36 | @State data: ContentDetailDTO[] = [] |
| 35 | @State currentIndex: number = 0 | 37 | @State currentIndex: number = 0 |
| 36 | @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 | 38 | @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 |
| @@ -30,7 +30,8 @@ const storage = LocalStorage.getShared(); | @@ -30,7 +30,8 @@ const storage = LocalStorage.getShared(); | ||
| 30 | @Component | 30 | @Component |
| 31 | export struct VideoChannelDetail { | 31 | export struct VideoChannelDetail { |
| 32 | private groupId: string = '' // 楼层id | 32 | private groupId: string = '' // 楼层id |
| 33 | - private pageId: string = '' //页面id | 33 | + @Provide private pageId: string = '' //页面id |
| 34 | + @Provide private pageName: string = '' | ||
| 34 | private pageNum: number = 1 | 35 | private pageNum: number = 1 |
| 35 | private pageSize: number = 5 | 36 | private pageSize: number = 5 |
| 36 | private loadStrategy: string = 'first_load' // 首次加载: first_load, 上推刷新: push_up, 下拉刷新: pull_down | 37 | private loadStrategy: string = 'first_load' // 首次加载: first_load, 上推刷新: push_up, 下拉刷新: pull_down |
| @@ -41,7 +41,8 @@ export struct PlayerRightView { | @@ -41,7 +41,8 @@ export struct PlayerRightView { | ||
| 41 | @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 41 | @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 42 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 | 42 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 |
| 43 | pageParam: ParamType = {} | 43 | pageParam: ParamType = {} |
| 44 | - PageName: string = '' | 44 | + @Consume pageName: string |
| 45 | + @Consume pageId: string | ||
| 45 | followUserId: string = '' | 46 | followUserId: string = '' |
| 46 | followUserName: string = '' | 47 | followUserName: string = '' |
| 47 | 48 | ||
| @@ -59,19 +60,6 @@ export struct PlayerRightView { | @@ -59,19 +60,6 @@ export struct PlayerRightView { | ||
| 59 | 'contentId': `${this.contentDetailData.newsId}`, | 60 | 'contentId': `${this.contentDetailData.newsId}`, |
| 60 | 'contentName': `${this.contentDetailData.newsTitle || ''}`, | 61 | 'contentName': `${this.contentDetailData.newsTitle || ''}`, |
| 61 | } | 62 | } |
| 62 | - if(this.contentDetailData.newsType == 1) { | ||
| 63 | - this.PageName = TrackConstants.PageName.VideoDetail // 点播 | ||
| 64 | - } else if(this.contentDetailData.newsType == 2) { | ||
| 65 | - this.PageName = TrackConstants.PageName.Live_Detail // 直播 | ||
| 66 | - } else if(this.contentDetailData.newsType == 5) { | ||
| 67 | - this.PageName = TrackConstants.PageName.Summary_Detail // 专题详情页 | ||
| 68 | - } else if(this.contentDetailData.newsType == 8) { | ||
| 69 | - this.PageName = TrackConstants.PageName.Article_Detail // 图文详情页 | ||
| 70 | - } else if(this.contentDetailData.newsType == 9) { | ||
| 71 | - this.PageName = TrackConstants.PageName.Atlas_Detail // 图集详情页 | ||
| 72 | - } else if(this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) { | ||
| 73 | - this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频 | ||
| 74 | - } | ||
| 75 | this.followUserId = this.contentDetailData?.rmhInfo?.rmhId || '' | 63 | this.followUserId = this.contentDetailData?.rmhInfo?.rmhId || '' |
| 76 | this.followUserName = this.contentDetailData?.rmhInfo?.rmhName || '' | 64 | this.followUserName = this.contentDetailData?.rmhInfo?.rmhName || '' |
| 77 | } | 65 | } |
| @@ -104,11 +92,11 @@ export struct PlayerRightView { | @@ -104,11 +92,11 @@ export struct PlayerRightView { | ||
| 104 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1' | 92 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1' |
| 105 | if (this.newsStatusOfUser.likeStatus == '1') { | 93 | if (this.newsStatusOfUser.likeStatus == '1') { |
| 106 | this.interactData.likeNum = Number(this.interactData.likeNum || 0) + 1 | 94 | this.interactData.likeNum = Number(this.interactData.likeNum || 0) + 1 |
| 107 | - TrackingContent.like(true,this.PageName,this.PageName,this.pageParam) | 95 | + TrackingContent.like(true,this.pageId,this.pageName,this.pageParam) |
| 108 | console.log(TAG, '点赞') | 96 | console.log(TAG, '点赞') |
| 109 | } else { | 97 | } else { |
| 110 | this.interactData.likeNum = Math.max(0, Number(this.interactData.likeNum || 0) - 1) | 98 | this.interactData.likeNum = Math.max(0, Number(this.interactData.likeNum || 0) - 1) |
| 111 | - TrackingContent.like(false,this.PageName,this.PageName,this.pageParam) | 99 | + TrackingContent.like(false,this.pageId,this.pageName,this.pageParam) |
| 112 | console.log(TAG, '取消点赞') | 100 | console.log(TAG, '取消点赞') |
| 113 | } | 101 | } |
| 114 | console.log(TAG, '点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum) | 102 | console.log(TAG, '点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum) |
| @@ -144,11 +132,11 @@ export struct PlayerRightView { | @@ -144,11 +132,11 @@ export struct PlayerRightView { | ||
| 144 | // this.queryContentInteractCount() | 132 | // this.queryContentInteractCount() |
| 145 | if (this.newsStatusOfUser.collectStatus === 1) { | 133 | if (this.newsStatusOfUser.collectStatus === 1) { |
| 146 | this.interactData.collectNum = Number(this.interactData.collectNum || 0) + 1 | 134 | this.interactData.collectNum = Number(this.interactData.collectNum || 0) + 1 |
| 147 | - TrackingContent.collect(true,this.PageName,this.PageName,this.pageParam) | 135 | + TrackingContent.collect(true,this.pageId,this.pageName,this.pageParam) |
| 148 | console.log(TAG, '收藏') | 136 | console.log(TAG, '收藏') |
| 149 | } else { | 137 | } else { |
| 150 | this.interactData.collectNum = Math.max(0, Number(this.interactData.collectNum || 0) - 1) | 138 | this.interactData.collectNum = Math.max(0, Number(this.interactData.collectNum || 0) - 1) |
| 151 | - TrackingContent.collect(false,this.PageName,this.PageName,this.pageParam) | 139 | + TrackingContent.collect(false,this.pageId,this.pageName,this.pageParam) |
| 152 | console.log(TAG, '取消收藏') | 140 | console.log(TAG, '取消收藏') |
| 153 | } | 141 | } |
| 154 | console.log(TAG, '收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum) | 142 | console.log(TAG, '收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum) |
| @@ -212,7 +200,7 @@ export struct PlayerRightView { | @@ -212,7 +200,7 @@ export struct PlayerRightView { | ||
| 212 | } | 200 | } |
| 213 | }) | 201 | }) |
| 214 | console.log(TAG, '关注号主') | 202 | console.log(TAG, '关注号主') |
| 215 | - TrackingContent.follow(true,this.followUserId,this.followUserName,TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,this.pageParam) | 203 | + TrackingContent.follow(true,this.followUserId,this.followUserName,this.pageId,this.pageName,this.pageParam) |
| 216 | } | 204 | } |
| 217 | }) | 205 | }) |
| 218 | } | 206 | } |
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | "tablet", | 8 | "tablet", |
| 9 | "2in1" | 9 | "2in1" |
| 10 | ], | 10 | ], |
| 11 | + "compressNativeLibs": true, | ||
| 11 | "deliveryWithInstall": true, | 12 | "deliveryWithInstall": true, |
| 12 | "pages": "$profile:main_pages", | 13 | "pages": "$profile:main_pages", |
| 13 | "requestPermissions": [ | 14 | "requestPermissions": [ |
| 1 | -import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils,CustomToast, StringUtils, NetworkUtil } from 'wdKit' | 1 | +import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils,CustomToast, StringUtils, NetworkUtil, |
| 2 | + BreakpointSystem } from 'wdKit' | ||
| 2 | import router from '@ohos.router' | 3 | import router from '@ohos.router' |
| 3 | import { LoginViewModel } from './LoginViewModel' | 4 | import { LoginViewModel } from './LoginViewModel' |
| 4 | import { LoginInputComponent } from './LoginInputComponent' | 5 | import { LoginInputComponent } from './LoginInputComponent' |
| @@ -56,6 +57,17 @@ struct LoginPage { | @@ -56,6 +57,17 @@ struct LoginPage { | ||
| 56 | 57 | ||
| 57 | loginViewModel = new LoginViewModel() | 58 | loginViewModel = new LoginViewModel() |
| 58 | @State isProtocol:boolean=false | 59 | @State isProtocol:boolean=false |
| 60 | + @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; | ||
| 61 | + private breakpointSystem = new BreakpointSystem(); | ||
| 62 | + @State percent:number = 1 | ||
| 63 | + | ||
| 64 | + currentChanged(){ | ||
| 65 | + if(this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"){ | ||
| 66 | + this.percent = 0.7 | ||
| 67 | + }else { | ||
| 68 | + this.percent = 1 | ||
| 69 | + } | ||
| 70 | + } | ||
| 59 | onCodeSend() { | 71 | onCodeSend() { |
| 60 | Logger.debug(TAG, "isCodeSend:" + this.isCodeSend + "") | 72 | Logger.debug(TAG, "isCodeSend:" + this.isCodeSend + "") |
| 61 | if (this.isCodeSend) { | 73 | if (this.isCodeSend) { |
| @@ -66,6 +78,12 @@ struct LoginPage { | @@ -66,6 +78,12 @@ struct LoginPage { | ||
| 66 | 78 | ||
| 67 | aboutToAppear() { | 79 | aboutToAppear() { |
| 68 | Logger.debug(TAG, "aboutToAppear:" + this.isCodeSend + "") | 80 | Logger.debug(TAG, "aboutToAppear:" + this.isCodeSend + "") |
| 81 | + this.breakpointSystem.register(); | ||
| 82 | + this.currentChanged() | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + aboutToDisappear(): void { | ||
| 86 | + this.breakpointSystem.unregister(); | ||
| 69 | } | 87 | } |
| 70 | 88 | ||
| 71 | onPageShow() { | 89 | onPageShow() { |
| @@ -144,10 +162,10 @@ struct LoginPage { | @@ -144,10 +162,10 @@ struct LoginPage { | ||
| 144 | Text("登录") | 162 | Text("登录") |
| 145 | .borderRadius(4) | 163 | .borderRadius(4) |
| 146 | .fontColor(this.isSubmit ? "#FFFFFFFF" : "#66FFFFFF") | 164 | .fontColor(this.isSubmit ? "#FFFFFFFF" : "#66FFFFFF") |
| 147 | - .fontSize("31lpx") | 165 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 148 | .fontWeight(400) | 166 | .fontWeight(400) |
| 149 | - .margin({ top: 20 }) | ||
| 150 | - .lineHeight("50lpx") | 167 | + .margin({ top: `${this.calcHeight(20)}` }) |
| 168 | + .lineHeight(`${this.calcHeight(50)}lpx`) | ||
| 151 | .height(44) | 169 | .height(44) |
| 152 | .textAlign(TextAlign.Center) | 170 | .textAlign(TextAlign.Center) |
| 153 | .width("100%") | 171 | .width("100%") |
| @@ -170,9 +188,9 @@ struct LoginPage { | @@ -170,9 +188,9 @@ struct LoginPage { | ||
| 170 | if (!this.checkCodePage) { | 188 | if (!this.checkCodePage) { |
| 171 | Text('忘记密码') | 189 | Text('忘记密码') |
| 172 | .fontColor('#666666') | 190 | .fontColor('#666666') |
| 173 | - .fontSize("31lpx") | 191 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 174 | .fontWeight(400) | 192 | .fontWeight(400) |
| 175 | - .lineHeight("38lpx") | 193 | + .lineHeight(`${this.calcHeight(38)}lpx`) |
| 176 | .margin({ top: 16 }) | 194 | .margin({ top: 16 }) |
| 177 | .onClick(() => { | 195 | .onClick(() => { |
| 178 | TrackingButton.click("loginPageForgotPassword",TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page) | 196 | TrackingButton.click("loginPageForgotPassword",TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page) |
| @@ -217,7 +235,8 @@ struct LoginPage { | @@ -217,7 +235,8 @@ struct LoginPage { | ||
| 217 | 235 | ||
| 218 | ProtocolComponent({ | 236 | ProtocolComponent({ |
| 219 | cancelMethod: (): void => this.cancelProtocol(), | 237 | cancelMethod: (): void => this.cancelProtocol(), |
| 220 | - agreeMethod: (): void => this.agreeProtocol() | 238 | + agreeMethod: (): void => this.agreeProtocol(), |
| 239 | + percent:$percent | ||
| 221 | }) | 240 | }) |
| 222 | .visibility(this.isProtocol ? Visibility.Visible : Visibility.None) | 241 | .visibility(this.isProtocol ? Visibility.Visible : Visibility.None) |
| 223 | 242 | ||
| @@ -301,15 +320,15 @@ struct LoginPage { | @@ -301,15 +320,15 @@ struct LoginPage { | ||
| 301 | Row() { | 320 | Row() { |
| 302 | Row() { | 321 | Row() { |
| 303 | Image(this.checkCodePage ? $r('app.media.login_qt') : $r('app.media.login_other_password')) | 322 | Image(this.checkCodePage ? $r('app.media.login_qt') : $r('app.media.login_other_password')) |
| 304 | - .size({ width: "35lpx", height: "35lpx" }) | ||
| 305 | - .margin({right:"8lpx"}) | ||
| 306 | - .height("38lpx") | ||
| 307 | - .width("38lpx") | 323 | + .size({ width: `${this.calcHeight(35)}lpx`, height: `${this.calcHeight(35)}lpx` }) |
| 324 | + .margin({right:`${this.calcHeight(8)}lpx`}) | ||
| 325 | + .height(`${this.calcHeight(38)}lpx`) | ||
| 326 | + .width(`${this.calcHeight(38)}lpx`) | ||
| 308 | Text(this.checkCodePage ? "密码登录" : "手机号登录") | 327 | Text(this.checkCodePage ? "密码登录" : "手机号登录") |
| 309 | .fontWeight(400) | 328 | .fontWeight(400) |
| 310 | .fontColor("#3D3D3D") | 329 | .fontColor("#3D3D3D") |
| 311 | - .fontSize("23lpx") | ||
| 312 | - .lineHeight("38lpx") | 330 | + .fontSize(`${this.calcHeight(23)}lpx`) |
| 331 | + .lineHeight(`${this.calcHeight(38)}lpx`) | ||
| 313 | } | 332 | } |
| 314 | .onClick(() => { | 333 | .onClick(() => { |
| 315 | this.onPageHide() | 334 | this.onPageHide() |
| @@ -332,7 +351,7 @@ struct LoginPage { | @@ -332,7 +351,7 @@ struct LoginPage { | ||
| 332 | }.height(36) | 351 | }.height(36) |
| 333 | .width('100%') | 352 | .width('100%') |
| 334 | .padding({ left: 25, right: 25 }) | 353 | .padding({ left: 25, right: 25 }) |
| 335 | - .margin({ top: "46lpx" }) | 354 | + .margin({ top: `${this.calcHeight(46)}lpx` }) |
| 336 | } | 355 | } |
| 337 | .width('100%') | 356 | .width('100%') |
| 338 | .margin({ bottom: 40 }) | 357 | .margin({ bottom: 40 }) |
| @@ -478,7 +497,9 @@ struct LoginPage { | @@ -478,7 +497,9 @@ struct LoginPage { | ||
| 478 | .slide(SlideEffect.Right) | 497 | .slide(SlideEffect.Right) |
| 479 | } | 498 | } |
| 480 | 499 | ||
| 481 | - | 500 | + calcHeight(value:number): number{ |
| 501 | + return value * this.percent | ||
| 502 | + } | ||
| 482 | } | 503 | } |
| 483 | 504 | ||
| 484 | 505 | ||
| @@ -486,41 +507,42 @@ struct LoginPage { | @@ -486,41 +507,42 @@ struct LoginPage { | ||
| 486 | struct ProtocolComponent { | 507 | struct ProtocolComponent { |
| 487 | cancelMethod?: () => void | 508 | cancelMethod?: () => void |
| 488 | agreeMethod?: () => void | 509 | agreeMethod?: () => void |
| 510 | + @Link percent:number | ||
| 489 | 511 | ||
| 490 | build() { | 512 | build() { |
| 491 | Stack() { | 513 | Stack() { |
| 492 | Column() { | 514 | Column() { |
| 493 | Text("温馨提示") | 515 | Text("温馨提示") |
| 494 | .fontColor("#222222") | 516 | .fontColor("#222222") |
| 495 | - .fontSize("35lpx") | ||
| 496 | - .lineHeight("50lpx") | 517 | + .fontSize(`${this.calcHeight(35)}lpx`) |
| 518 | + .lineHeight(`${this.calcHeight(50)}lpx`) | ||
| 497 | .width("100%") | 519 | .width("100%") |
| 498 | .fontWeight(500) | 520 | .fontWeight(500) |
| 499 | .textAlign(TextAlign.Center) | 521 | .textAlign(TextAlign.Center) |
| 500 | - .margin({ top: "38lpx" }) | 522 | + .margin({ top: `${this.calcHeight(38)}lpx` }) |
| 501 | Text() { | 523 | Text() { |
| 502 | Span("为保障您的合法权益,请阅读并同意") | 524 | Span("为保障您的合法权益,请阅读并同意") |
| 503 | - .fontSize("27lpx") | ||
| 504 | - .lineHeight("42lpx") | 525 | + .fontSize(`${this.calcHeight(27)}lpx`) |
| 526 | + .lineHeight(`${this.calcHeight(42)}lpx`) | ||
| 505 | .fontWeight(400) | 527 | .fontWeight(400) |
| 506 | .fontColor("#666666") | 528 | .fontColor("#666666") |
| 507 | 529 | ||
| 508 | Span("《用户协议》") | 530 | Span("《用户协议》") |
| 509 | - .fontSize("27lpx") | ||
| 510 | - .lineHeight("42lpx") | 531 | + .fontSize(`${this.calcHeight(27)}lpx`) |
| 532 | + .lineHeight(`${this.calcHeight(42)}lpx`) | ||
| 511 | .fontWeight(400) | 533 | .fontWeight(400) |
| 512 | .fontColor("#ED2800") | 534 | .fontColor("#ED2800") |
| 513 | .onClick(() => { | 535 | .onClick(() => { |
| 514 | let bean = { contentID: "1", pageID: "" } as Params | 536 | let bean = { contentID: "1", pageID: "" } as Params |
| 515 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) | 537 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) |
| 516 | }) | 538 | }) |
| 517 | - Span("及").fontSize("27lpx") | ||
| 518 | - .lineHeight("42lpx") | 539 | + Span("及").fontSize(`${this.calcHeight(27)}lpx`) |
| 540 | + .lineHeight(`${this.calcHeight(42)}lpx`) | ||
| 519 | .fontWeight(400) | 541 | .fontWeight(400) |
| 520 | .fontColor("#666666") | 542 | .fontColor("#666666") |
| 521 | Span("《隐私政策》") | 543 | Span("《隐私政策》") |
| 522 | - .fontSize("27lpx") | ||
| 523 | - .lineHeight("42lpx") | 544 | + .fontSize(`${this.calcHeight(27)}lpx`) |
| 545 | + .lineHeight(`${this.calcHeight(42)}lpx`) | ||
| 524 | .fontWeight(400) | 546 | .fontWeight(400) |
| 525 | .fontColor("#ED2800") | 547 | .fontColor("#ED2800") |
| 526 | .onClick(() => { | 548 | .onClick(() => { |
| @@ -528,20 +550,20 @@ struct ProtocolComponent { | @@ -528,20 +550,20 @@ struct ProtocolComponent { | ||
| 528 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) | 550 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) |
| 529 | }) | 551 | }) |
| 530 | Span("后进行登录") | 552 | Span("后进行登录") |
| 531 | - .fontSize("27lpx") | ||
| 532 | - .lineHeight("42lpx") | 553 | + .fontSize(`${this.calcHeight(27)}lpx`) |
| 554 | + .lineHeight(`${this.calcHeight(42)}lpx`) | ||
| 533 | .fontWeight(400) | 555 | .fontWeight(400) |
| 534 | .fontColor("#666666") | 556 | .fontColor("#666666") |
| 535 | - }.margin({ top: "23lpx", left: "31lpx", right: "31lpx" }) | 557 | + }.margin({ top: `${this.calcHeight(23)}lpx`, left: `${this.calcHeight(31)}lpx`, right: `${this.calcHeight(31)}lpx` }) |
| 536 | .wordBreak(WordBreak.BREAK_ALL) | 558 | .wordBreak(WordBreak.BREAK_ALL) |
| 537 | .textAlign(TextAlign.Start) | 559 | .textAlign(TextAlign.Start) |
| 538 | 560 | ||
| 539 | - Divider().color("#f5f5f5").width("100%").margin({ top: "27lpx" }).height('1lpx').strokeWidth('1lpx') | 561 | + Divider().color("#f5f5f5").width("100%").margin({ top: `${this.calcHeight(27)}lpx` }).height(`${this.calcHeight(1)}lpx`).strokeWidth(`${this.calcHeight(1)}lpx`) |
| 540 | Row() { | 562 | Row() { |
| 541 | Text('放弃登录') | 563 | Text('放弃登录') |
| 542 | - .fontSize("31lpx") | 564 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 543 | .fontWeight(500) | 565 | .fontWeight(500) |
| 544 | - .lineHeight("42lpx") | 566 | + .lineHeight(`${this.calcHeight(42)}lpx`) |
| 545 | .fontColor("#999999") | 567 | .fontColor("#999999") |
| 546 | .layoutWeight(1) | 568 | .layoutWeight(1) |
| 547 | .textAlign(TextAlign.Center) | 569 | .textAlign(TextAlign.Center) |
| @@ -553,17 +575,17 @@ struct ProtocolComponent { | @@ -553,17 +575,17 @@ struct ProtocolComponent { | ||
| 553 | .height('100%') | 575 | .height('100%') |
| 554 | 576 | ||
| 555 | Divider() | 577 | Divider() |
| 556 | - .width("1lpx") | ||
| 557 | - .strokeWidth('1lpx') | 578 | + .width(`${this.calcHeight(1)}lpx`) |
| 579 | + .strokeWidth(`${this.calcHeight(1)}lpx`) | ||
| 558 | .vertical(true) | 580 | .vertical(true) |
| 559 | .height('100%') | 581 | .height('100%') |
| 560 | .color("#F5F5F5") | 582 | .color("#F5F5F5") |
| 561 | 583 | ||
| 562 | 584 | ||
| 563 | Text('同意并登录') | 585 | Text('同意并登录') |
| 564 | - .fontSize("31lpx") | 586 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 565 | .fontWeight(500) | 587 | .fontWeight(500) |
| 566 | - .lineHeight("42lpx") | 588 | + .lineHeight(`${this.calcHeight(42)}lpx`) |
| 567 | .fontColor("#ED2800") | 589 | .fontColor("#ED2800") |
| 568 | .layoutWeight(1) | 590 | .layoutWeight(1) |
| 569 | .textAlign(TextAlign.Center) | 591 | .textAlign(TextAlign.Center) |
| @@ -582,15 +604,19 @@ struct ProtocolComponent { | @@ -582,15 +604,19 @@ struct ProtocolComponent { | ||
| 582 | .justifyContent(FlexAlign.Center) | 604 | .justifyContent(FlexAlign.Center) |
| 583 | } | 605 | } |
| 584 | .backgroundColor(Color.White) | 606 | .backgroundColor(Color.White) |
| 585 | - .borderRadius("12lpx") | ||
| 586 | - .width("528lpx") | ||
| 587 | - .height("309lpx") | 607 | + .borderRadius(`${this.calcHeight(12)}lpx`) |
| 608 | + .width(`${this.calcHeight(528)}lpx`) | ||
| 609 | + .height(`${this.calcHeight(309)}lpx`) | ||
| 588 | 610 | ||
| 589 | }.width('100%') | 611 | }.width('100%') |
| 590 | .height('100%') | 612 | .height('100%') |
| 591 | .backgroundColor('#66000000') | 613 | .backgroundColor('#66000000') |
| 592 | 614 | ||
| 593 | } | 615 | } |
| 616 | + | ||
| 617 | + calcHeight(value:number): number{ | ||
| 618 | + return value * this.percent | ||
| 619 | + } | ||
| 594 | } | 620 | } |
| 595 | 621 | ||
| 596 | function trackTypeClick(typeValue: number,pageId: string){ | 622 | function trackTypeClick(typeValue: number,pageId: string){ |
| 1 | -import { CustomToast, DateTimeUtils} from 'wdKit/Index'; | 1 | +import { BreakpointSystem, CustomToast, DateTimeUtils} from 'wdKit/Index'; |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 3 | import { LoginModel } from './LoginModel'; | 3 | import { LoginModel } from './LoginModel'; |
| 4 | import { ModifyPasswordRequestItem } from './ModifyPasswordRequestItem'; | 4 | import { ModifyPasswordRequestItem } from './ModifyPasswordRequestItem'; |
| @@ -29,6 +29,27 @@ struct ModifyPasswordPage { | @@ -29,6 +29,27 @@ struct ModifyPasswordPage { | ||
| 29 | }) | 29 | }) |
| 30 | pageShowTime:number = 0; | 30 | pageShowTime:number = 0; |
| 31 | pageHideTime:number = 0; | 31 | pageHideTime:number = 0; |
| 32 | + @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; | ||
| 33 | + private breakpointSystem = new BreakpointSystem(); | ||
| 34 | + @State percent:number = 1 | ||
| 35 | + | ||
| 36 | + currentChanged(){ | ||
| 37 | + if(this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"){ | ||
| 38 | + this.percent = 0.7 | ||
| 39 | + }else { | ||
| 40 | + this.percent = 1 | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + aboutToAppear() { | ||
| 45 | + this.breakpointSystem.register(); | ||
| 46 | + this.currentChanged() | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + aboutToDisappear(): void { | ||
| 50 | + this.breakpointSystem.unregister(); | ||
| 51 | + } | ||
| 52 | + | ||
| 32 | 53 | ||
| 33 | onPageShow() { | 54 | onPageShow() { |
| 34 | this.pageShowTime = DateTimeUtils.getTimeStamp() | 55 | this.pageShowTime = DateTimeUtils.getTimeStamp() |
| @@ -42,25 +63,54 @@ struct ModifyPasswordPage { | @@ -42,25 +63,54 @@ struct ModifyPasswordPage { | ||
| 42 | } | 63 | } |
| 43 | 64 | ||
| 44 | build() { | 65 | build() { |
| 45 | - Row() { | ||
| 46 | - Column() { | 66 | + Column(){ |
| 67 | + this.TitleBackComponent('') | ||
| 47 | this.ModifyPasswordLayout() | 68 | this.ModifyPasswordLayout() |
| 48 | } | 69 | } |
| 49 | - .width('100%') | ||
| 50 | - .height('100%') | ||
| 51 | - }.width('100%') | ||
| 52 | - .height('100%') | 70 | + |
| 71 | + } | ||
| 72 | + | ||
| 73 | + @Builder TitleBackComponent(title:string){ | ||
| 74 | + RelativeContainer() { | ||
| 75 | + Text(title) | ||
| 76 | + .fontColor('#FF333333') | ||
| 77 | + .fontSize(18) | ||
| 78 | + .textAlign(TextAlign.Center) | ||
| 79 | + .height(44) | ||
| 80 | + .alignRules({ | ||
| 81 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 82 | + left: { anchor: "__container__", align: HorizontalAlign.Start }, | ||
| 83 | + right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 84 | + | ||
| 85 | + }) | ||
| 86 | + .id('titleContent') | ||
| 87 | + Image($r("app.media.login_back_icon")) | ||
| 88 | + .objectFit(ImageFit.Auto) | ||
| 89 | + .height(24) | ||
| 90 | + .width(24) | ||
| 91 | + .margin({ | ||
| 92 | + left: 16, top: 8 | ||
| 93 | + }) | ||
| 94 | + .alignRules({ | ||
| 95 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 96 | + left: { anchor: "__container__", align: HorizontalAlign.Start }, | ||
| 97 | + }) | ||
| 98 | + .onClick(() => { | ||
| 99 | + router.back() | ||
| 100 | + }) | ||
| 101 | + .id('backImage') | ||
| 102 | + | ||
| 103 | + }.height(44) | ||
| 53 | } | 104 | } |
| 54 | 105 | ||
| 55 | 106 | ||
| 56 | @Builder ModifyPasswordLayout(){ | 107 | @Builder ModifyPasswordLayout(){ |
| 57 | - Navigation() { | ||
| 58 | Column(){ | 108 | Column(){ |
| 59 | Column() { | 109 | Column() { |
| 60 | Text("修改密码").fontWeight(FontWeight.Bold).fontSize(20).maxLines(1) | 110 | Text("修改密码").fontWeight(FontWeight.Bold).fontSize(20).maxLines(1) |
| 61 | } | 111 | } |
| 62 | .width('100%') | 112 | .width('100%') |
| 63 | - .height('75lpx') | 113 | + .height(`${this.calcHeight(75)}lpx`) |
| 64 | .alignItems(HorizontalAlign.Start) | 114 | .alignItems(HorizontalAlign.Start) |
| 65 | 115 | ||
| 66 | Row() { | 116 | Row() { |
| @@ -77,12 +127,12 @@ struct ModifyPasswordPage { | @@ -77,12 +127,12 @@ struct ModifyPasswordPage { | ||
| 77 | }) | 127 | }) |
| 78 | } | 128 | } |
| 79 | .alignItems(VerticalAlign.Center) | 129 | .alignItems(VerticalAlign.Center) |
| 80 | - .height('80lpx') | 130 | + .height(`${this.calcHeight(80)}lpx`) |
| 81 | .backgroundColor('#f5f5f5') | 131 | .backgroundColor('#f5f5f5') |
| 82 | .borderRadius('4vp') | 132 | .borderRadius('4vp') |
| 83 | } | 133 | } |
| 84 | .width('100%') | 134 | .width('100%') |
| 85 | - .height('110lpx') | 135 | + .height(`${this.calcHeight(110)}lpx`) |
| 86 | .backgroundColor(0xffffff0) | 136 | .backgroundColor(0xffffff0) |
| 87 | .alignItems(VerticalAlign.Center) | 137 | .alignItems(VerticalAlign.Center) |
| 88 | 138 | ||
| @@ -100,12 +150,12 @@ struct ModifyPasswordPage { | @@ -100,12 +150,12 @@ struct ModifyPasswordPage { | ||
| 100 | }) | 150 | }) |
| 101 | } | 151 | } |
| 102 | .alignItems(VerticalAlign.Center) | 152 | .alignItems(VerticalAlign.Center) |
| 103 | - .height('80lpx') | 153 | + .height(`${this.calcHeight(80)}lpx`) |
| 104 | .backgroundColor('#f5f5f5') | 154 | .backgroundColor('#f5f5f5') |
| 105 | .borderRadius('4vp') | 155 | .borderRadius('4vp') |
| 106 | } | 156 | } |
| 107 | .width('100%') | 157 | .width('100%') |
| 108 | - .height('110lpx') | 158 | + .height(`${this.calcHeight(110)}lpx`) |
| 109 | .backgroundColor(0xffffff0) | 159 | .backgroundColor(0xffffff0) |
| 110 | .alignItems(VerticalAlign.Center) | 160 | .alignItems(VerticalAlign.Center) |
| 111 | 161 | ||
| @@ -123,32 +173,32 @@ struct ModifyPasswordPage { | @@ -123,32 +173,32 @@ struct ModifyPasswordPage { | ||
| 123 | }) | 173 | }) |
| 124 | } | 174 | } |
| 125 | .alignItems(VerticalAlign.Center) | 175 | .alignItems(VerticalAlign.Center) |
| 126 | - .height('80lpx') | 176 | + .height(`${this.calcHeight(80)}lpx`) |
| 127 | .backgroundColor('#f5f5f5') | 177 | .backgroundColor('#f5f5f5') |
| 128 | .borderRadius('4vp') | 178 | .borderRadius('4vp') |
| 129 | } | 179 | } |
| 130 | .width('100%') | 180 | .width('100%') |
| 131 | - .height('110lpx') | 181 | + .height(`${this.calcHeight(110)}lpx`) |
| 132 | .backgroundColor(0xffffff0) | 182 | .backgroundColor(0xffffff0) |
| 133 | .alignItems(VerticalAlign.Center) | 183 | .alignItems(VerticalAlign.Center) |
| 134 | 184 | ||
| 135 | Column() { | 185 | Column() { |
| 136 | - Text("提示:密码长度6~20位,使用大写字母、小写字母、数字、特殊字符中三种或三种以上").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'}) | 186 | + Text("提示:密码长度6~20位,使用大写字母、小写字母、数字、特殊字符中三种或三种以上").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:`${this.calcHeight(10)}lpx`}) |
| 137 | } | 187 | } |
| 138 | .width('100%') | 188 | .width('100%') |
| 139 | - .height('85lpx') | 189 | + .height(`${this.calcHeight(85)}lpx`) |
| 140 | .alignItems(HorizontalAlign.Start) | 190 | .alignItems(HorizontalAlign.Start) |
| 141 | 191 | ||
| 142 | Row() { | 192 | Row() { |
| 143 | Button( { type: ButtonType.Normal, stateEffect: true }){ | 193 | Button( { type: ButtonType.Normal, stateEffect: true }){ |
| 144 | Text("确认") | 194 | Text("确认") |
| 145 | .fontColor("#fff") | 195 | .fontColor("#fff") |
| 146 | - .fontSize("35lpx") | ||
| 147 | - .lineHeight("50lpx") | 196 | + .fontSize(`${this.calcHeight(35)}lpx`) |
| 197 | + .lineHeight(`${this.calcHeight(50)}lpx`) | ||
| 148 | .opacity(this.btnStatus ?1:0.5) | 198 | .opacity(this.btnStatus ?1:0.5) |
| 149 | } | 199 | } |
| 150 | .width('100%') | 200 | .width('100%') |
| 151 | - .height('80lpx') | 201 | + .height(`${this.calcHeight(80)}lpx`) |
| 152 | .backgroundColor(this.btnStatus ? '#ED2800' : '#99ED2800') | 202 | .backgroundColor(this.btnStatus ? '#ED2800' : '#99ED2800') |
| 153 | .borderRadius('4vp') | 203 | .borderRadius('4vp') |
| 154 | .onClick(() => { | 204 | .onClick(() => { |
| @@ -158,25 +208,22 @@ struct ModifyPasswordPage { | @@ -158,25 +208,22 @@ struct ModifyPasswordPage { | ||
| 158 | } | 208 | } |
| 159 | }) | 209 | }) |
| 160 | } | 210 | } |
| 161 | - .padding({top:'25lpx'}) | 211 | + .padding({top:`${this.calcHeight(25)}lpx`}) |
| 162 | .alignItems(VerticalAlign.Center) | 212 | .alignItems(VerticalAlign.Center) |
| 163 | .width('100%') | 213 | .width('100%') |
| 164 | - .height('120lpx') | 214 | + .height(`${this.calcHeight(120)}lpx`) |
| 165 | 215 | ||
| 166 | Column() { | 216 | Column() { |
| 167 | - Text("忘记密码").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'}) | 217 | + Text("忘记密码").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:`${this.calcHeight(10)}lpx`}) |
| 168 | .onClick(()=>{ | 218 | .onClick(()=>{ |
| 169 | WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage) | 219 | WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage) |
| 170 | }) | 220 | }) |
| 171 | } | 221 | } |
| 172 | .width('100%') | 222 | .width('100%') |
| 173 | - .height('85lpx') | 223 | + .height(`${this.calcHeight(85)}lpx`) |
| 174 | .alignItems(HorizontalAlign.Center) | 224 | .alignItems(HorizontalAlign.Center) |
| 175 | - }.padding({top:"92lpx",left:"48lpx",right:"48lpx"}) | 225 | + }.padding({top:`${this.calcHeight(92)}lpx`,left:`${this.calcHeight(48)}lpx`,right:`${this.calcHeight(48)}lpx`}) |
| 176 | 226 | ||
| 177 | - }.titleMode(NavigationTitleMode.Mini) | ||
| 178 | - .backButtonIcon($r("app.media.login_back_icon")) | ||
| 179 | - .title('') | ||
| 180 | } | 227 | } |
| 181 | 228 | ||
| 182 | inputTextChange(){ | 229 | inputTextChange(){ |
| @@ -211,6 +258,10 @@ struct ModifyPasswordPage { | @@ -211,6 +258,10 @@ struct ModifyPasswordPage { | ||
| 211 | this.toastText = msg | 258 | this.toastText = msg |
| 212 | this.dialogToast.open() | 259 | this.dialogToast.open() |
| 213 | } | 260 | } |
| 261 | + | ||
| 262 | + calcHeight(value:number): number{ | ||
| 263 | + return value * this.percent | ||
| 264 | + } | ||
| 214 | } | 265 | } |
| 215 | 266 | ||
| 216 | 267 |
| @@ -103,6 +103,7 @@ export class WDPlayerController { | @@ -103,6 +103,7 @@ export class WDPlayerController { | ||
| 103 | case AVPlayerStatus.PLAYING: | 103 | case AVPlayerStatus.PLAYING: |
| 104 | this.setBright(); | 104 | this.setBright(); |
| 105 | this.status = PlayerConstants.STATUS_START; | 105 | this.status = PlayerConstants.STATUS_START; |
| 106 | + this.avPlayer!.videoScaleType = media.VideoScaleType.VIDEO_SCALE_TYPE_FIT | ||
| 106 | this.watchStatus(); | 107 | this.watchStatus(); |
| 107 | break; | 108 | break; |
| 108 | case AVPlayerStatus.PAUSED: | 109 | case AVPlayerStatus.PAUSED: |
| 1 | import componentUtils from '@ohos.arkui.componentUtils'; | 1 | import componentUtils from '@ohos.arkui.componentUtils'; |
| 2 | import { WDPlayerController } from '../controller/WDPlayerController' | 2 | import { WDPlayerController } from '../controller/WDPlayerController' |
| 3 | -import { WindowModel } from 'wdKit'; | ||
| 4 | -import { Logger } from '../utils/Logger'; | 3 | +import { Logger, WindowModel } from 'wdKit'; |
| 5 | import { enableAliPlayer } from '../utils/GlobalSetting'; | 4 | import { enableAliPlayer } from '../utils/GlobalSetting'; |
| 5 | +import json from '@ohos.util.json'; | ||
| 6 | +import { JSON } from '@kit.ArkTS'; | ||
| 6 | 7 | ||
| 7 | class Size { | 8 | class Size { |
| 8 | width: Length = "100%"; | 9 | width: Length = "100%"; |
| @@ -82,12 +83,17 @@ export struct WDPlayerRenderView { | @@ -82,12 +83,17 @@ export struct WDPlayerRenderView { | ||
| 82 | libraryname: enableAliPlayer && this.enableAliPlayer ? "premierlibrary" : undefined, | 83 | libraryname: enableAliPlayer && this.enableAliPlayer ? "premierlibrary" : undefined, |
| 83 | controller: this.xComponentController | 84 | controller: this.xComponentController |
| 84 | }) | 85 | }) |
| 86 | + .id(this.insId) | ||
| 85 | .onLoad(async (event) => { | 87 | .onLoad(async (event) => { |
| 86 | Logger.info(TAG, 'onLoad') | 88 | Logger.info(TAG, 'onLoad') |
| 87 | - this.xComponentController.setXComponentSurfaceSize({ | ||
| 88 | - surfaceWidth: 1920, | ||
| 89 | - surfaceHeight: 1080 | 89 | + |
| 90 | + if (this.videoHeight > 0 && this.videoWidth > 0) { | ||
| 91 | + this.xComponentController.setXComponentSurfaceRect({ | ||
| 92 | + surfaceWidth: this.videoWidth, | ||
| 93 | + surfaceHeight: this.videoHeight | ||
| 90 | }); | 94 | }); |
| 95 | + } | ||
| 96 | + | ||
| 91 | if (enableAliPlayer && this.enableAliPlayer) { | 97 | if (enableAliPlayer && this.enableAliPlayer) { |
| 92 | this.playerController?.setSurfaceId(this.insId) | 98 | this.playerController?.setSurfaceId(this.insId) |
| 93 | } else { | 99 | } else { |
| @@ -98,8 +104,8 @@ export struct WDPlayerRenderView { | @@ -98,8 +104,8 @@ export struct WDPlayerRenderView { | ||
| 98 | } | 104 | } |
| 99 | }) | 105 | }) |
| 100 | .zIndex(1000) | 106 | .zIndex(1000) |
| 101 | - .width(this.selfSize.width) | ||
| 102 | - .height(this.selfSize.height) | 107 | + // .width(this.selfSize.width) |
| 108 | + // .height(this.selfSize.height) | ||
| 103 | } | 109 | } |
| 104 | .onAreaChange(() => { | 110 | .onAreaChange(() => { |
| 105 | this.updateLayout() | 111 | this.updateLayout() |
| @@ -108,19 +114,55 @@ export struct WDPlayerRenderView { | @@ -108,19 +114,55 @@ export struct WDPlayerRenderView { | ||
| 108 | .justifyContent(FlexAlign.Center) | 114 | .justifyContent(FlexAlign.Center) |
| 109 | .height('100%') | 115 | .height('100%') |
| 110 | .width('100%') | 116 | .width('100%') |
| 111 | - .align(this.videoWidth > this.videoHeight ? Alignment.Top : Alignment.Center) | 117 | + // .align(this.videoWidth > this.videoHeight ? Alignment.Top : Alignment.Center) |
| 118 | + .align(Alignment.Center) | ||
| 112 | } | 119 | } |
| 113 | 120 | ||
| 114 | updateLayout() { | 121 | updateLayout() { |
| 122 | + | ||
| 115 | let info = componentUtils.getRectangleById(this.insId); | 123 | let info = componentUtils.getRectangleById(this.insId); |
| 116 | - if (info.size.width > 0 && info.size.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) { | ||
| 117 | - if (info.size.width / info.size.height > this.videoWidth / this.videoHeight) { | ||
| 118 | - let scale = info.size.height / this.videoHeight; | ||
| 119 | - this.selfSize = new Size((this.videoWidth * scale / info.size.width) * 100 + "%", '100%'); | ||
| 120 | - } else { | ||
| 121 | - let scale = info.size.width / this.videoWidth; | ||
| 122 | - this.selfSize = new Size('100%', (this.videoHeight * scale / info.size.height) * 100 + "%"); | 124 | + Logger.debug(TAG, "播放器区域变化: " + JSON.stringify(info)) |
| 125 | + | ||
| 126 | + Logger.debug(TAG, "xComponent rect: " + JSON.stringify(this.xComponentController.getXComponentSurfaceRect())) | ||
| 127 | + | ||
| 128 | + if (info.size.width > 0 && info.size.height > 0) { | ||
| 129 | + | ||
| 130 | + // 竖屏 | ||
| 131 | + if (this.videoHeight > 0 && this.videoWidth > 0 && this.videoWidth < this.videoHeight) { | ||
| 132 | + let ratio = this.videoWidth / this.videoHeight | ||
| 133 | + const height = info.size.width / ratio | ||
| 134 | + | ||
| 135 | + // 竖屏,缩放高度大于 视频区域高度 | ||
| 136 | + if (height > info.size.height) { | ||
| 137 | + | ||
| 138 | + Logger.debug(TAG, "ratio = " + ratio + " ==> new height = " + height) | ||
| 139 | + | ||
| 140 | + Logger.debug(TAG, "高度固定,求宽度: " + info.size.height * ratio) | ||
| 141 | + | ||
| 142 | + this.xComponentController.setXComponentSurfaceRect({ | ||
| 143 | + surfaceWidth: info.size.height * ratio, | ||
| 144 | + surfaceHeight: info.size.height | ||
| 145 | + }); | ||
| 146 | + return | ||
| 147 | + } | ||
| 123 | } | 148 | } |
| 149 | + | ||
| 150 | + this.xComponentController.setXComponentSurfaceRect({ | ||
| 151 | + surfaceWidth: info.size.width, | ||
| 152 | + surfaceHeight: info.size.height | ||
| 153 | + }); | ||
| 124 | } | 154 | } |
| 155 | + | ||
| 156 | + | ||
| 157 | + | ||
| 158 | + // if (info.size.width > 0 && info.size.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) { | ||
| 159 | + // if (info.size.width / info.size.height > this.videoWidth / this.videoHeight) { | ||
| 160 | + // let scale = info.size.height / this.videoHeight; | ||
| 161 | + // this.selfSize = new Size((this.videoWidth * scale / info.size.width) * 100 + "%", '100%'); | ||
| 162 | + // } else { | ||
| 163 | + // let scale = info.size.width / this.videoWidth; | ||
| 164 | + // this.selfSize = new Size('100%', (this.videoHeight * scale / info.size.height) * 100 + "%"); | ||
| 165 | + // } | ||
| 166 | + // } | ||
| 125 | } | 167 | } |
| 126 | } | 168 | } |
| @@ -135,6 +135,9 @@ export namespace TrackConstants { | @@ -135,6 +135,9 @@ export namespace TrackConstants { | ||
| 135 | /// 我的预约 | 135 | /// 我的预约 |
| 136 | My_Saved_Live = "mySavedLivePage", | 136 | My_Saved_Live = "mySavedLivePage", |
| 137 | 137 | ||
| 138 | + /// 直播预约更多列表 | ||
| 139 | + Live_Appointment_List = "liveSubscribeListPage", | ||
| 140 | + | ||
| 138 | /// 兴趣选择 | 141 | /// 兴趣选择 |
| 139 | Preference_Selection = "preferenceSelectionPage", | 142 | Preference_Selection = "preferenceSelectionPage", |
| 140 | /// 升级页面 | 143 | /// 升级页面 |
-
Please register or login to post a comment