王士厅
Showing 82 changed files with 1388 additions and 207 deletions
  1 +{
  2 + "appKey": "662f39fecac2a664de284236",
  3 + "channel": "rmrb_china_0000"
  4 +}
@@ -268,6 +268,18 @@ @@ -268,6 +268,18 @@
268 ] 268 ]
269 } 269 }
270 ] 270 ]
  271 + },
  272 + {
  273 + "name": "wdTracking",
  274 + "srcPath": "./features/wdTracking",
  275 + "targets": [
  276 + {
  277 + "name": "default",
  278 + "applyToProducts": [
  279 + "default"
  280 + ]
  281 + }
  282 + ]
271 } 283 }
272 ] 284 ]
273 } 285 }
@@ -49,3 +49,7 @@ export { NetworkUtil } from './src/main/ets/utils/NetworkUtil' @@ -49,3 +49,7 @@ export { NetworkUtil } from './src/main/ets/utils/NetworkUtil'
49 export { NetworkManager } from './src/main/ets/network/NetworkManager' 49 export { NetworkManager } from './src/main/ets/network/NetworkManager'
50 50
51 export { NetworkType } from './src/main/ets/network/NetworkType' 51 export { NetworkType } from './src/main/ets/network/NetworkType'
  52 +
  53 +export { CustomToast } from './src/main/ets/reusable/CustomToast'
  54 +
  55 +export { UmengStats } from "./src/main/ets/umeng/UmengStats"
  1 +{
  2 + "meta": {
  3 + "stableOrder": true
  4 + },
  5 + "lockfileVersion": 3,
  6 + "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
  7 + "specifiers": {
  8 + "@umeng/analytics@^1.0.19": "@umeng/analytics@1.0.19",
  9 + "@umeng/common@^1.0.21": "@umeng/common@1.0.21",
  10 + "libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon": "libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon"
  11 + },
  12 + "packages": {
  13 + "@umeng/analytics@1.0.19": {
  14 + "name": "@umeng/analytics",
  15 + "integrity": "sha512-0m9z5l8to+POjDl9UkCQC8s4P+e2E1OILwUglC7ME4QwqfH44e59GLJtQdwF0h6kwpsy3YBft4SoWK8MYbuP7g==",
  16 + "resolved": "https://ohpm.openharmony.cn/ohpm/@umeng/analytics/-/analytics-1.0.19.har",
  17 + "registryType": "ohpm"
  18 + },
  19 + "@umeng/common@1.0.21": {
  20 + "name": "@umeng/common",
  21 + "integrity": "sha512-EbXsd4OoRisTQf5egNY/+z1D2bvrYw9VwC2xu3EJA9TiDPSbnaJZ5+yltA/Se6yZ4oCcFvq6e5/AAfPuumunbw==",
  22 + "resolved": "https://ohpm.openharmony.cn/ohpm/@umeng/common/-/common-1.0.21.har",
  23 + "registryType": "ohpm",
  24 + "dependencies": {
  25 + "libcommon.so": "./src/main/cpp/types/libcommon"
  26 + }
  27 + },
  28 + "libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon": {
  29 + "name": "libcommon.so",
  30 + "resolved": "../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon",
  31 + "registryType": "local"
  32 + }
  33 + }
  34 +}
@@ -6,5 +6,8 @@ @@ -6,5 +6,8 @@
6 "description": "Please describe the basic information.", 6 "description": "Please describe the basic information.",
7 "main": "Index.ets", 7 "main": "Index.ets",
8 "version": "1.0.0", 8 "version": "1.0.0",
9 - "dependencies": {} 9 + "dependencies": {
  10 + "@umeng/common": "^1.0.21",
  11 + "@umeng/analytics": "^1.0.19"
  12 + }
10 } 13 }
  1 +@CustomDialog
  2 +export struct CustomToast {
  3 + public static LENGTH_LONG = 5000;
  4 + public static LENGTH_SHORT = 3000;
  5 +
  6 + @State msg: string = ""
  7 + @State duration: number = CustomToast.LENGTH_SHORT
  8 + @State bgBorderRadius: number = 10
  9 +
  10 + controller: CustomDialogController
  11 +
  12 + dismiss: () => void = () => {
  13 + }
  14 +
  15 + aboutToAppear(): void {
  16 + let intervalID = setInterval(() => {
  17 + if (this.controller != undefined) {
  18 + this.controller.close()
  19 + this.dismiss()
  20 + clearInterval(intervalID);
  21 + }
  22 + }, this.duration);
  23 + }
  24 +
  25 + build() {
  26 + Row() {
  27 + Text(this.msg)
  28 + .fontWeight(FontWeight.Regular)
  29 + .fontColor($r('app.color.white'))
  30 + .fontSize("27lpx")
  31 + .lineHeight("38lpx")
  32 + }.borderRadius(`${this.bgBorderRadius}lpx`)
  33 + .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"})
  34 + .backgroundColor($r("app.color.black"))
  35 + .opacity(0.7)
  36 + }
  37 +}
  1 +import { preInit, InternalPlugin, setLogEnabled, init, onEventObject, onProfileSignOff,
  2 + onProfileSignIn } from '@umeng/analytics';
  3 +import { common } from '@kit.AbilityKit';
  4 +import { AccountManagerUtils } from '../utils/AccountManagerUtils';
  5 +import { UserDataLocal } from '../utils/UserDataLocal';
  6 +import { EmitterUtils } from '../utils/EmitterUtils';
  7 +
  8 +export class UmengStats {
  9 +
  10 + private static _inited = false
  11 +
  12 + // 启动时调用
  13 + static preInit(context: common.UIAbilityContext) {
  14 +
  15 + // 需在 AppScope/resources/rawfile/umconfig.json 配置key和channel
  16 + preInit({
  17 + context: context.getApplicationContext(),
  18 + plugins: [new InternalPlugin()],
  19 + enableLog: true
  20 +
  21 + });
  22 + }
  23 +
  24 + // 在用户同意隐私政策后再调用此方法
  25 + static initAfterAgreeProtocol() {
  26 + init();
  27 + UmengStats._inited = true
  28 +
  29 + UmengStats.onLogin()
  30 + UmengStats.event("testHarmony", {"key1": "value1"})
  31 + }
  32 +
  33 + // TODO: 登录成功调用
  34 + static onLogin() {
  35 + AccountManagerUtils.isLogin().then((login) => {
  36 + if (!login) { return }
  37 +
  38 + let userId = UserDataLocal.getUserId()
  39 + if (userId.length > 0) {
  40 + onProfileSignIn("USER", userId)
  41 + }
  42 + })
  43 + }
  44 + // TODO: 退出登录调用
  45 + static onLogout() {
  46 + onProfileSignOff()
  47 + }
  48 +
  49 + // 属性key,128位以内的非空字符串,value为256位以内的数值或字符串
  50 + static event(eventId: string, param?: Record<string, string | number>) {
  51 + if (!UmengStats._inited) {
  52 + return
  53 + }
  54 + onEventObject(eventId, param);
  55 + }
  56 +}
@@ -509,6 +509,26 @@ export class DateTimeUtils { @@ -509,6 +509,26 @@ export class DateTimeUtils {
509 } 509 }
510 return num; 510 return num;
511 } 511 }
  512 +
  513 + /**
  514 + * 去除发布日期前导零
  515 + * @param dateTimeString 2024年01月01日 00:00
  516 + * @returns 2024年1月1日 00:00
  517 + */
  518 + static removeTrailingZeros(dateTimeString: string) {
  519 + // 分割日期时间字符串
  520 + const [datePart, timePart] = dateTimeString.split(' ');
  521 + // 分割日期
  522 + const [year, month, day] = datePart.match(/\d+/g);
  523 + // 去除年和月后面的零
  524 + const trimmedMonth = parseInt(month, 10);
  525 + const trimmedDay = parseInt(day, 10);
  526 +
  527 + // 重新组合日期时间字符串
  528 + const newDateTimeString = `${year}${trimmedMonth}${trimmedDay} ${timePart}`;
  529 +
  530 + return newDateTimeString;
  531 + }
512 } 532 }
513 533
514 // const dateTimeUtils = new DateTimeUtils() 534 // const dateTimeUtils = new DateTimeUtils()
@@ -125,6 +125,37 @@ export class StringUtils { @@ -125,6 +125,37 @@ export class StringUtils {
125 static isScore(text: string): boolean { 125 static isScore(text: string): boolean {
126 return StringUtils.SCORE_REG_EXP.test(text); 126 return StringUtils.SCORE_REG_EXP.test(text);
127 } 127 }
  128 +
  129 + //手机号校验
  130 + static photoMatch(phone:string) : boolean {
  131 + /**
  132 + * 移动号段正则表达式
  133 + */
  134 + let CM_NUM = "^((13[4-9])|(147)|(15[0-2,7-9])|(178)|(18[2-4,7-8]))\\d{8}|(1705)\\d{7}$";
  135 + /**
  136 + * 联通号段正则表达式
  137 + */
  138 + let CU_NUM = "^((13[0-2])|(145)|(15[5-6])|(176)|(18[5,6]))\\d{8}|(1709)\\d{7}$";
  139 + /**
  140 + * 电信号段正则表达式
  141 + */
  142 + let CT_NUM = "^((133)|(153)|(177)|(18[0,1,9]))\\d{8}$";
  143 + /**
  144 + * 官网正则
  145 + */
  146 + let GW_NUM = "^1(3|4|5|6|7|8|9)\\d{9}$";
  147 +
  148 + let CM_NUM_reg : RegExp = new RegExp(CM_NUM);
  149 + let CU_NUM_reg : RegExp = new RegExp(CU_NUM);
  150 + let CT_NUM_reg : RegExp = new RegExp(CT_NUM);
  151 + let GW_NUM_reg : RegExp = new RegExp(GW_NUM);
  152 +
  153 + if (CM_NUM_reg.test(phone) || CU_NUM_reg.test(phone) || CT_NUM_reg.test(phone) || GW_NUM_reg.test(phone)) {
  154 + return true;
  155 + }
  156 + console.log('请输入正确的手机号')
  157 + return false;
  158 + }
128 } 159 }
129 160
130 // export default new StringUtils(); 161 // export default new StringUtils();
@@ -3,6 +3,10 @@ @@ -3,6 +3,10 @@
3 { 3 {
4 "name": "white", 4 "name": "white",
5 "value": "#FFFFFF" 5 "value": "#FFFFFF"
  6 + },
  7 + {
  8 + "name": "black",
  9 + "value": "#000000"
6 } 10 }
7 ] 11 ]
8 } 12 }
@@ -88,6 +88,9 @@ export class ProcessUtils { @@ -88,6 +88,9 @@ export class ProcessUtils {
88 return; 88 return;
89 } 89 }
90 let type = content.objectType; 90 let type = content.objectType;
  91 + if (typeof type == "number") {
  92 + type = `${type}`
  93 + }
91 console.log(TAG, 'objectType', `${JSON.stringify(content)}`); 94 console.log(TAG, 'objectType', `${JSON.stringify(content)}`);
92 switch (type) { 95 switch (type) {
93 case ContentConstants.TYPE_NONE: 96 case ContentConstants.TYPE_NONE:
@@ -10,6 +10,7 @@ import Url from '@ohos.url' @@ -10,6 +10,7 @@ import Url from '@ohos.url'
10 import { ContentDTO, PhotoListBean } from 'wdBean'; 10 import { ContentDTO, PhotoListBean } from 'wdBean';
11 import { handleJsCallAppService } from './JsCallAppService' 11 import { handleJsCallAppService } from './JsCallAppService'
12 import { HttpUtils } from 'wdNetwork/Index'; 12 import { HttpUtils } from 'wdNetwork/Index';
  13 +
13 const TAG = 'JsBridgeBiz' 14 const TAG = 'JsBridgeBiz'
14 15
15 class AppInfo { 16 class AppInfo {
@@ -20,6 +21,7 @@ class AppInfo { @@ -20,6 +21,7 @@ class AppInfo {
20 screenTabbarSafeHeight: number = 42 // TODO 这里需要动态获取 21 screenTabbarSafeHeight: number = 42 // TODO 这里需要动态获取
21 imei: string = HttpUtils.getImei() 22 imei: string = HttpUtils.getImei()
22 device_id: string = HttpUtils.getDeviceId() 23 device_id: string = HttpUtils.getDeviceId()
  24 + fontSizes: string = 'small'
23 // TODO 完善 25 // TODO 完善
24 } 26 }
25 27
1 import { CompDTO } from 'wdBean'; 1 import { CompDTO } from 'wdBean';
2 import { CommonConstants, CompStyle } from 'wdConstant'; 2 import { CommonConstants, CompStyle } from 'wdConstant';
3 import { LabelComponent } from './view/LabelComponent'; 3 import { LabelComponent } from './view/LabelComponent';
4 -import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';  
5 import { 4 import {
6 HorizontalStrokeCardThreeTwoRadioForMoreComponent 5 HorizontalStrokeCardThreeTwoRadioForMoreComponent
7 } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent'; 6 } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent';
@@ -11,21 +10,19 @@ import { @@ -11,21 +10,19 @@ import {
11 import { ZhSingleRow02 } from './compview/ZhSingleRow02'; 10 import { ZhSingleRow02 } from './compview/ZhSingleRow02';
12 import { ZhSingleRow03 } from './compview/ZhSingleRow03'; 11 import { ZhSingleRow03 } from './compview/ZhSingleRow03';
13 import { ZhSingleRow04 } from './compview/ZhSingleRow04'; 12 import { ZhSingleRow04 } from './compview/ZhSingleRow04';
14 -import { ZhSingleRow05 } from './compview/ZhSingleRow05';  
15 import { ZhSingleRow06 } from './compview/ZhSingleRow06'; 13 import { ZhSingleRow06 } from './compview/ZhSingleRow06';
16 import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; 14 import { ZhSingleColumn04 } from './compview/ZhSingleColumn04';
17 -import { ZhSingleColumn05 } from './compview/ZhSingleColumn05';  
18 import { ZhSingleColumn09 } from './compview/ZhSingleColumn09'; 15 import { ZhSingleColumn09 } from './compview/ZhSingleColumn09';
19 import { ZhGridLayout03 } from './compview/ZhGridLayout03'; 16 import { ZhGridLayout03 } from './compview/ZhGridLayout03';
20 import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01'; 17 import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01';
21 import { CardParser } from './CardParser'; 18 import { CardParser } from './CardParser';
22 -import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent';  
23 import { ZhGridLayout02 } from './compview/ZhGridLayout02'; 19 import { ZhGridLayout02 } from './compview/ZhGridLayout02';
24 import { Card2Component } from './cardview/Card2Component'; 20 import { Card2Component } from './cardview/Card2Component';
25 import { Card5Component } from './cardview/Card5Component'; 21 import { Card5Component } from './cardview/Card5Component';
26 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 22 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
27 import { AdvCardParser } from './cardViewAdv/AdvCardParser'; 23 import { AdvCardParser } from './cardViewAdv/AdvCardParser';
28 import PageModel from '../viewmodel/PageModel'; 24 import PageModel from '../viewmodel/PageModel';
  25 +import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
29 26
30 /** 27 /**
31 * comp适配器. 28 * comp适配器.
@@ -35,13 +32,15 @@ import PageModel from '../viewmodel/PageModel'; @@ -35,13 +32,15 @@ import PageModel from '../viewmodel/PageModel';
35 @Component 32 @Component
36 export struct CompParser { 33 export struct CompParser {
37 @State compDTO: CompDTO = {} as CompDTO 34 @State compDTO: CompDTO = {} as CompDTO
38 -  
39 @State private pageModel: PageModel = new PageModel(); 35 @State private pageModel: PageModel = new PageModel();
40 @State compIndex: number = 0; 36 @State compIndex: number = 0;
41 37
42 build() { 38 build() {
43 Column() { 39 Column() {
44 - this.componentBuilder(this.compDTO, this.compIndex); 40 + if (this.compDTO.name !="月度排行卡") {
  41 +
  42 + this.componentBuilder(this.compDTO, this.compIndex);
  43 + }
45 } 44 }
46 } 45 }
47 46
@@ -54,7 +53,8 @@ export struct CompParser { @@ -54,7 +53,8 @@ export struct CompParser {
54 } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { 53 } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
55 ZhCarouselLayout01({ compDTO: compDTO }) 54 ZhCarouselLayout01({ compDTO: compDTO })
56 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) 55 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
57 - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) { 56 + } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) {// && compDTO.name ==="横划卡"
  57 +
58 LiveHorizontalCardComponent({ compDTO: compDTO }) 58 LiveHorizontalCardComponent({ compDTO: compDTO })
59 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) 59 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
60 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) { 60 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) {
@@ -103,7 +103,7 @@ export struct CompParser { @@ -103,7 +103,7 @@ export struct CompParser {
103 ZhSingleColumn09({ compDTO }) 103 ZhSingleColumn09({ compDTO })
104 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) 104 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
105 } else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告 105 } else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
106 - AdvCardParser({pageModel:this.pageModel,compDTO}) 106 + AdvCardParser({ pageModel: this.pageModel, compDTO })
107 //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 }) 107 //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 })
108 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) 108 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
109 } else if (!Number.isNaN(Number(compDTO.compStyle))) { 109 } else if (!Number.isNaN(Number(compDTO.compStyle))) {
@@ -123,6 +123,6 @@ export struct CompParser { @@ -123,6 +123,6 @@ export struct CompParser {
123 } 123 }
124 } 124 }
125 125
126 - // } 126 + // }
127 } 127 }
128 128
@@ -29,7 +29,8 @@ import { publishCommentModel } from './comment/model/PublishCommentModel'; @@ -29,7 +29,8 @@ import { publishCommentModel } from './comment/model/PublishCommentModel';
29 import { CommentComponent } from './comment/view/CommentComponent'; 29 import { CommentComponent } from './comment/view/CommentComponent';
30 30
31 const TAG = 'DynamicDetailComponent' 31 const TAG = 'DynamicDetailComponent'
32 -@Preview 32 +const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
  33 +// @Preview
33 @Component 34 @Component
34 export struct DynamicDetailComponent { 35 export struct DynamicDetailComponent {
35 //入参 36 //入参
@@ -53,6 +54,7 @@ export struct DynamicDetailComponent { @@ -53,6 +54,7 @@ export struct DynamicDetailComponent {
53 //跳转 54 //跳转
54 private mJumpInfo: ContentDTO = {} as ContentDTO; 55 private mJumpInfo: ContentDTO = {} as ContentDTO;
55 56
  57 + @State publishTime: string = ''
56 58
57 59
58 async aboutToAppear() { 60 async aboutToAppear() {
@@ -71,7 +73,7 @@ export struct DynamicDetailComponent { @@ -71,7 +73,7 @@ export struct DynamicDetailComponent {
71 .height($r('app.float.margin_28')) 73 .height($r('app.float.margin_28'))
72 .margin({ left: $r('app.float.margin_16') }) 74 .margin({ left: $r('app.float.margin_16') })
73 Blank() 75 Blank()
74 - Text(StringUtils.isEmpty(this.contentDetailData.publishTime)?"":this.contentDetailData.publishTime.replace('-','年').replace('-','月').replace(' ','日 ').substring(0,this.contentDetailData.publishTime.length-2)) 76 + Text(this.publishTime)
75 .fontColor($r('app.color.color_B0B0B0')) 77 .fontColor($r('app.color.color_B0B0B0'))
76 .fontSize($r('app.float.font_size_12')) 78 .fontSize($r('app.float.font_size_12'))
77 .lineHeight($r('app.float.margin_28')) 79 .lineHeight($r('app.float.margin_28'))
@@ -79,6 +81,8 @@ export struct DynamicDetailComponent { @@ -79,6 +81,8 @@ export struct DynamicDetailComponent {
79 } 81 }
80 .height($r('app.float.margin_48')) 82 .height($r('app.float.margin_48'))
81 .width('100%') 83 .width('100%')
  84 + .alignItems(VerticalAlign.Bottom)
  85 + .padding({bottom:5})
82 //分割线 86 //分割线
83 Image($r('app.media.ic_news_detail_division')) 87 Image($r('app.media.ic_news_detail_division'))
84 .width('100%') 88 .width('100%')
@@ -142,15 +146,23 @@ export struct DynamicDetailComponent { @@ -142,15 +146,23 @@ export struct DynamicDetailComponent {
142 .margin({right: $r('app.float.margin_6')}) 146 .margin({right: $r('app.float.margin_6')})
143 if(!StringUtils.isEmpty(this.followStatus)){ 147 if(!StringUtils.isEmpty(this.followStatus)){
144 if (this.followStatus == '0') { 148 if (this.followStatus == '0') {
145 - Text('+关注')  
146 - .width($r('app.float.margin_54'))  
147 - .height($r('app.float.margin_24'))  
148 - .textAlign(TextAlign.Center)  
149 - .fontSize($r('app.float.font_size_12'))  
150 - .borderRadius($r('app.float.vp_3'))  
151 - .backgroundColor($r('app.color.color_ED2800'))  
152 - .fontColor($r('app.color.color_fff'))  
153 - .onClick(() => { 149 + Row() {
  150 + Blank().layoutWeight(1)
  151 + Image($r('app.media.icon_add_attention'))
  152 + .width($r('app.float.vp_12'))
  153 + .height($r('app.float.vp_12'))
  154 + .margin({right:2})
  155 + Text('关注')
  156 + .textAlign(TextAlign.Center)
  157 + .fontSize($r('app.float.font_size_12'))
  158 + .fontColor($r('app.color.color_fff'))
  159 + Blank().layoutWeight(1)
  160 + }
  161 + .width($r('app.float.margin_54'))
  162 + .height($r('app.float.margin_24'))
  163 + .borderRadius($r('app.float.vp_3'))
  164 + .backgroundColor($r('app.color.color_ED2800'))
  165 + .onClick(() => {
154 this.handleAccention() 166 this.handleAccention()
155 }) 167 })
156 } else { 168 } else {
@@ -330,23 +342,23 @@ export struct DynamicDetailComponent { @@ -330,23 +342,23 @@ export struct DynamicDetailComponent {
330 ,left: $r('app.float.vp_12') 342 ,left: $r('app.float.vp_12')
331 ,right: $r('app.float.vp_12') }) 343 ,right: $r('app.float.vp_12') })
332 //微信/朋友圈/微博 344 //微信/朋友圈/微博
333 - Row(){  
334 - Image($r('app.media.xxhdpi_pic_wechat'))  
335 - .width($r('app.float.margin_116'))  
336 - .height($r('app.float.margin_36'))  
337 - .objectFit(ImageFit.Cover)  
338 - Image($r('app.media.xxhdpi_pic_pyq'))  
339 - .width($r('app.float.margin_116'))  
340 - .height($r('app.float.margin_36'))  
341 - .margin({ left: $r('app.float.margin_4_negative')})  
342 - .objectFit(ImageFit.Cover)  
343 - Image($r('app.media.xxhdpi_pic_wb'))  
344 - .width($r('app.float.margin_116'))  
345 - .height($r('app.float.margin_36'))  
346 - .margin({ left: $r('app.float.margin_4_negative')})  
347 - .objectFit(ImageFit.Cover)  
348 - }  
349 - .margin({ top: $r('app.float.margin_24')}) 345 + // Row(){
  346 + // Image($r('app.media.xxhdpi_pic_wechat'))
  347 + // .width($r('app.float.margin_116'))
  348 + // .height($r('app.float.margin_36'))
  349 + // .objectFit(ImageFit.Cover)
  350 + // Image($r('app.media.xxhdpi_pic_pyq'))
  351 + // .width($r('app.float.margin_116'))
  352 + // .height($r('app.float.margin_36'))
  353 + // .margin({ left: $r('app.float.margin_4_negative')})
  354 + // .objectFit(ImageFit.Cover)
  355 + // Image($r('app.media.xxhdpi_pic_wb'))
  356 + // .width($r('app.float.margin_116'))
  357 + // .height($r('app.float.margin_36'))
  358 + // .margin({ left: $r('app.float.margin_4_negative')})
  359 + // .objectFit(ImageFit.Cover)
  360 + // }
  361 + // .margin({ top: $r('app.float.margin_24')})
350 //点赞 362 //点赞
351 Row(){ 363 Row(){
352 Blank().layoutWeight(1) 364 Blank().layoutWeight(1)
@@ -427,6 +439,10 @@ export struct DynamicDetailComponent { @@ -427,6 +439,10 @@ export struct DynamicDetailComponent {
427 try { 439 try {
428 let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) 440 let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
429 this.contentDetailData = data[0]; 441 this.contentDetailData = data[0];
  442 + let dateTime =
  443 + DateTimeUtils.parseDate(this.contentDetailData?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
  444 + let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
  445 + this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime)
430 console.log('动态详情',JSON.stringify(this.contentDetailData)) 446 console.log('动态详情',JSON.stringify(this.contentDetailData))
431 } catch (exception) { 447 } catch (exception) {
432 console.log('请求失败',JSON.stringify(exception)) 448 console.log('请求失败',JSON.stringify(exception))
@@ -295,15 +295,15 @@ export struct ENewspaperPageComponent { @@ -295,15 +295,15 @@ export struct ENewspaperPageComponent {
295 .backgroundColor($r('app.color.color_80000000')) 295 .backgroundColor($r('app.color.color_80000000'))
296 .id('e_newspaper_container') 296 .id('e_newspaper_container')
297 297
298 - ENewspaperListDialog({  
299 - newspaperListBean: this.newspaperListBean,  
300 - closeDialog: () => {  
301 - this.isOpenListDialog = false  
302 - }  
303 - })  
304 - .visibility(this.isOpenListDialog ? Visibility.Visible : Visibility.None) 298 + if (this.isOpenListDialog) {
  299 + ENewspaperListDialog({
  300 + newspaperListBean: this.newspaperListBean,
  301 + closeDialog: () => {
  302 + this.isOpenListDialog = false
  303 + }
  304 + })
  305 + }
305 } 306 }
306 -  
307 } 307 }
308 308
309 private async getNewspaperTime() { 309 private async getNewspaperTime() {
@@ -61,13 +61,12 @@ export struct ImageAndTextPageComponent { @@ -61,13 +61,12 @@ export struct ImageAndTextPageComponent {
61 Text(this.publishTime) 61 Text(this.publishTime)
62 .fontColor($r('app.color.color_B0B0B0')) 62 .fontColor($r('app.color.color_B0B0B0'))
63 .fontSize($r('app.float.font_size_13')) 63 .fontSize($r('app.float.font_size_13'))
64 - .height('100%')  
65 - .align(Alignment.End)  
66 } 64 }
67 .width(CommonConstants.FULL_WIDTH) 65 .width(CommonConstants.FULL_WIDTH)
68 .height(32) 66 .height(32)
69 .padding({ left: 15, right: 15, }) 67 .padding({ left: 15, right: 15, })
70 .justifyContent(FlexAlign.SpaceBetween) 68 .justifyContent(FlexAlign.SpaceBetween)
  69 + .alignItems(VerticalAlign.Bottom)
71 .backgroundColor(Color.White) 70 .backgroundColor(Color.White)
72 71
73 Row() { 72 Row() {
@@ -205,7 +204,8 @@ export struct ImageAndTextPageComponent { @@ -205,7 +204,8 @@ export struct ImageAndTextPageComponent {
205 this.contentDetailData = detailBeans; 204 this.contentDetailData = detailBeans;
206 let dateTime = 205 let dateTime =
207 DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); 206 DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
208 - this.publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) 207 + let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
  208 + this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime)
209 if (this.contentDetailData[0]?.recommendShow === 1) { 209 if (this.contentDetailData[0]?.recommendShow === 1) {
210 this.getRecommend() 210 this.getRecommend()
211 } 211 }
@@ -66,7 +66,7 @@ export struct ImageAndTextWebComponent { @@ -66,7 +66,7 @@ export struct ImageAndTextWebComponent {
66 loadImageOnlyWifiSwitch: '2', 66 loadImageOnlyWifiSwitch: '2',
67 networkStatus: Number(NetworkUtil.isNetConnected()), 67 networkStatus: Number(NetworkUtil.isNetConnected()),
68 darkMode: 'light', 68 darkMode: 'light',
69 - fontSizes: 'normalsize' 69 + fontSizes: 'small'
70 70
71 } as H5ReceiveDataExtraBean 71 } as H5ReceiveDataExtraBean
72 let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { 72 let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = {
@@ -13,6 +13,7 @@ import { image } from '@kit.ImageKit'; @@ -13,6 +13,7 @@ import { image } from '@kit.ImageKit';
13 import { getPicture, imageNet2PixelMap } from '../../utils/ImageUtils'; 13 import { getPicture, imageNet2PixelMap } from '../../utils/ImageUtils';
14 import { effectKit } from '@kit.ArkGraphics2D'; 14 import { effectKit } from '@kit.ArkGraphics2D';
15 import { window } from '@kit.ArkUI'; 15 import { window } from '@kit.ArkUI';
  16 +import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'
16 17
17 const TAG = 'MorningEveningPaperComponent'; 18 const TAG = 'MorningEveningPaperComponent';
18 19
@@ -111,12 +112,19 @@ export struct MorningEveningPaperComponent { @@ -111,12 +112,19 @@ export struct MorningEveningPaperComponent {
111 Logger.info(TAG, "currentTime = " + currentTime) 112 Logger.info(TAG, "currentTime = " + currentTime)
112 Logger.info(TAG, `currentTime = ${currentTime}`) 113 Logger.info(TAG, `currentTime = ${currentTime}`)
113 try { 114 try {
  115 + let dailyPaperTopicBean = await DailyPaperTopicModel.getDailyPaperTopic()
  116 + if (dailyPaperTopicBean) {
  117 + dailyPaperTopicPageId = '' + dailyPaperTopicBean.id
  118 + Logger.info(TAG, "pageID = " + dailyPaperTopicPageId)
  119 + }
  120 +
114 // let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId) 121 // let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId)
115 let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091" 122 let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091"
116 this.pageInfoBean = pageInfoBean; 123 this.pageInfoBean = pageInfoBean;
117 this.title = this.pageInfoBean?.topicInfo?.title 124 this.title = this.pageInfoBean?.topicInfo?.title
118 - let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN);  
119 - this.subTitle = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) 125 + let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN)
  126 + const dateShow = new Date(dateTime)
  127 + this.subTitle = `${dateShow.getFullYear()}年\n${(dateShow.getMonth() + 1)}月${dateShow.getDate()}日`
120 Logger.info(TAG, "pageInfoBean topicDate = " + this.pageInfoBean?.topicInfo?.topicDate) 128 Logger.info(TAG, "pageInfoBean topicDate = " + this.pageInfoBean?.topicInfo?.topicDate)
121 Logger.info(TAG, "pageInfoBean title = " + this.pageInfoBean?.topicInfo?.title) 129 Logger.info(TAG, "pageInfoBean title = " + this.pageInfoBean?.topicInfo?.title)
122 130
@@ -166,6 +174,7 @@ export struct MorningEveningPaperComponent { @@ -166,6 +174,7 @@ export struct MorningEveningPaperComponent {
166 let color = colorPicker.getMainColorSync(); 174 let color = colorPicker.getMainColorSync();
167 // 将取色器选取的color示例转换为十六进制颜色代码 175 // 将取色器选取的color示例转换为十六进制颜色代码
168 this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16); 176 this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16);
  177 + Logger.debug(TAG, "compInfoBean compStyle = " + this.mixedBgColor)
169 }); 178 });
170 179
171 } 180 }
@@ -218,7 +227,6 @@ export struct MorningEveningPaperComponent { @@ -218,7 +227,6 @@ export struct MorningEveningPaperComponent {
218 .margin({ left: 14, right: 14 }) 227 .margin({ left: 14, right: 14 })
219 } 228 }
220 .width('100%') 229 .width('100%')
221 - // .backgroundColor('#000080')  
222 // .backgroundColor(Color.Black) 230 // .backgroundColor(Color.Black)
223 // .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black) 231 // .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black)
224 .backgroundColor(this.mixedBgColor ?? Color.Black) 232 .backgroundColor(this.mixedBgColor ?? Color.Black)
1 import router from '@ohos.router'; 1 import router from '@ohos.router';
  2 +import { ToastUtils } from 'wdKit';
2 3
3 /** 4 /**
4 * 早晚报页面标题bar 5 * 早晚报页面标题bar
@@ -74,6 +75,9 @@ export struct PaperTitleComponent { @@ -74,6 +75,9 @@ export struct PaperTitleComponent {
74 }) 75 })
75 .id('img_share') 76 .id('img_share')
76 .margin({ right: 13 }) 77 .margin({ right: 13 })
  78 + .onClick(() => {
  79 + ToastUtils.showToast('分享为公共方法,待开发', 1000)
  80 + })
77 } 81 }
78 .margin({ left: 14, right: 14 }) 82 .margin({ left: 14, right: 14 })
79 .height($r('app.float.top_bar_height')) 83 .height($r('app.float.top_bar_height'))
@@ -101,8 +101,8 @@ export struct SingleColumn999Component { @@ -101,8 +101,8 @@ export struct SingleColumn999Component {
101 .height(100) 101 .height(100)
102 .padding(9) 102 .padding(9)
103 .fontColor(Color.White) 103 .fontColor(Color.White)
104 - .fontSize($r('app.float.font_size_16'))  
105 - .fontWeight(FontWeight.Medium) 104 + .fontSize($r('app.float.vp_14'))
  105 + .fontWeight(400)
106 .textAlign(TextAlign.Center) 106 .textAlign(TextAlign.Center)
107 .align(Alignment.Bottom) 107 .align(Alignment.Bottom)
108 .maxLines(1) 108 .maxLines(1)
@@ -130,8 +130,8 @@ export struct SingleColumn999Component { @@ -130,8 +130,8 @@ export struct SingleColumn999Component {
130 .width("100%")// .height(100) 130 .width("100%")// .height(100)
131 .padding(9) 131 .padding(9)
132 .fontColor(Color.White) 132 .fontColor(Color.White)
133 - .fontSize($r('app.float.font_size_16'))  
134 - .fontWeight(FontWeight.Medium) 133 + .fontSize($r('app.float.font_size_14'))
  134 + .fontWeight(400)
135 .textAlign(TextAlign.Center) 135 .textAlign(TextAlign.Center)
136 .align(Alignment.Bottom) 136 .align(Alignment.Bottom)
137 .maxLines(1) 137 .maxLines(1)
@@ -9,6 +9,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; @@ -9,6 +9,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
9 */ 9 */
10 const TAG: string = 'Card10Component'; 10 const TAG: string = 'Card10Component';
11 11
  12 +@Preview
12 @Component 13 @Component
13 export struct Card10Component { 14 export struct Card10Component {
14 @State contentDTO: ContentDTO = {} as ContentDTO; 15 @State contentDTO: ContentDTO = {} as ContentDTO;
@@ -24,6 +25,9 @@ export struct Card10Component { @@ -24,6 +25,9 @@ export struct Card10Component {
24 .maxLines(2) 25 .maxLines(2)
25 .textOverflow({ overflow: TextOverflow.Ellipsis }) 26 .textOverflow({ overflow: TextOverflow.Ellipsis })
26 .margin({ bottom: 19 }) 27 .margin({ bottom: 19 })
  28 + .onClick((event: ClickEvent) => {
  29 + ProcessUtils.processPage(this.contentDTO)
  30 + })
27 } 31 }
28 // 大图 32 // 大图
29 Stack() { 33 Stack() {
@@ -36,12 +40,18 @@ export struct Card10Component { @@ -36,12 +40,18 @@ export struct Card10Component {
36 .onClick((event: ClickEvent) => { 40 .onClick((event: ClickEvent) => {
37 ProcessUtils.processPage(this.contentDTO) 41 ProcessUtils.processPage(this.contentDTO)
38 }) 42 })
39 - Text('专题')  
40 - .fontSize($r('app.float.font_size_12'))  
41 - .padding({ left: 8, right: 8, top: 3, bottom: 3 })  
42 - .backgroundColor(Color.Red)  
43 - .fontColor(Color.White)  
44 - .borderRadius($r('app.float.button_border_radius')) 43 + // Text('专题')
  44 + // .fontSize($r('app.float.font_size_12'))
  45 + // .padding({ left: 8, right: 8, top: 3, bottom: 3 })
  46 + // .backgroundColor(Color.Red)
  47 + // .fontColor(Color.White)
  48 + // .borderRadius($r('app.float.button_border_radius'))
  49 + // .margin({ left: 5, bottom: 5 })
  50 +
  51 + ImageSpan($r('app.media.special'))
  52 + .width($r('app.float.font_size_36'))
  53 + .objectFit(ImageFit.Fill)
  54 + .verticalAlign(ImageSpanAlignment.CENTER)
45 .margin({ left: 5, bottom: 5 }) 55 .margin({ left: 5, bottom: 5 })
46 }.alignContent(Alignment.BottomStart) 56 }.alignContent(Alignment.BottomStart)
47 57
@@ -89,12 +99,32 @@ export struct Card10Component { @@ -89,12 +99,32 @@ export struct Card10Component {
89 timelineItem(item: slideShows, index: number) { 99 timelineItem(item: slideShows, index: number) {
90 Row() { 100 Row() {
91 Column() { 101 Column() {
92 - Text(item.newsTitle)  
93 - .fontSize($r('app.float.font_size_17'))  
94 - .fontWeight(400)  
95 - .fontColor($r('app.color.color_222222'))  
96 - .maxLines(2)  
97 - .textOverflow({ overflow: TextOverflow.Ellipsis }) 102 +
  103 + Text(item.newsTitle) {
  104 + if (item.objectType == '5') {
  105 + // Text('专题')
  106 + // .fontSize($r('app.float.font_size_12'))
  107 + // .padding({ left: 8, right: 8, top: 3, bottom: 3 })
  108 + // .backgroundColor(Color.Red)
  109 + // .fontColor(Color.White)
  110 + // .borderRadius($r('app.float.button_border_radius'))
  111 + // .margin({ right: 5 })
  112 + ImageSpan($r('app.media.special'))
  113 + .width($r('app.float.font_size_36'))
  114 + .objectFit(ImageFit.Fill)
  115 + .verticalAlign(ImageSpanAlignment.CENTER)
  116 + .margin({ right: 5 })
  117 + }
  118 +
  119 + Span(item.newsTitle)
  120 + }
  121 + .fontSize($r('app.float.font_size_17'))
  122 + .fontWeight(400)
  123 + .fontColor($r('app.color.color_222222'))
  124 + .maxLines(2)
  125 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  126 +
  127 +
98 CardSourceInfo( 128 CardSourceInfo(
99 { 129 {
100 contentDTO: { 130 contentDTO: {
@@ -105,6 +105,9 @@ export class commentItemModel { @@ -105,6 +105,9 @@ export class commentItemModel {
105 targetRelObjectId: string = ''; 105 targetRelObjectId: string = '';
106 targetRelType: string = ''; 106 targetRelType: string = '';
107 targetType: string = ''; 107 targetType: string = '';
  108 + h5Url: string = '';
  109 + pageId: string = '';
  110 + topicType: string = '';
108 visitorComment: string = ''; 111 visitorComment: string = '';
109 shareInfo: commentItemShareInfoModel = new commentItemShareInfoModel; 112 shareInfo: commentItemShareInfoModel = new commentItemShareInfoModel;
110 api_commentId: string = ''; 113 api_commentId: string = '';
@@ -6,8 +6,10 @@ import display from '@ohos.display'; @@ -6,8 +6,10 @@ import display from '@ohos.display';
6 const collapseString = '...展开全文' 6 const collapseString = '...展开全文'
7 const uncollapseString = '...收起' 7 const uncollapseString = '...收起'
8 8
  9 +const TestLongText = "超过三行超\n过三行超过\n三行超超过三行\n超过三行超过三行超过三\n行超过"
  10 +
9 @Component 11 @Component
10 -@Preview 12 +// @Preview
11 export struct CommentText { 13 export struct CommentText {
12 // 长文本 14 // 长文本
13 @State longMessage: string = '' 15 @State longMessage: string = ''
@@ -26,6 +28,7 @@ export struct CommentText { @@ -26,6 +28,7 @@ export struct CommentText {
26 @State expandedStates: boolean = false; 28 @State expandedStates: boolean = false;
27 @State fontSize: number = 18; 29 @State fontSize: number = 18;
28 @State fontWeight: FontWeight = FontWeight.Regular 30 @State fontWeight: FontWeight = FontWeight.Regular
  31 + @State lineHeight: number = 24
29 fontColor: ResourceColor = $r('app.color.color_222222') 32 fontColor: ResourceColor = $r('app.color.color_222222')
30 // 测量文本宽度(单位px) 33 // 测量文本宽度(单位px)
31 @State textWidth: number = 0; 34 @State textWidth: number = 0;
@@ -37,6 +40,8 @@ export struct CommentText { @@ -37,6 +40,8 @@ export struct CommentText {
37 promise: Promise<Array<display.Display>> = display.getAllDisplays() 40 promise: Promise<Array<display.Display>> = display.getAllDisplays()
38 41
39 aboutToAppear() { 42 aboutToAppear() {
  43 + // this.longMessage = TestLongText
  44 +
40 console.log(`文本宽度为:${this.textWidth}`) 45 console.log(`文本宽度为:${this.textWidth}`)
41 let padding = vp2px(5 + this.marginWidth) 46 let padding = vp2px(5 + this.marginWidth)
42 47
@@ -58,6 +63,17 @@ export struct CommentText { @@ -58,6 +63,17 @@ export struct CommentText {
58 this.isExpanded = (this.screenWidth - padding) * this.lines <= this.textWidth 63 this.isExpanded = (this.screenWidth - padding) * this.lines <= this.textWidth
59 // this.expandedStates = this.isExpanded; 64 // this.expandedStates = this.isExpanded;
60 65
  66 + let lines = this.getTextLineNum(
  67 + this.longMessage,
  68 + (this.screenWidth - padding),
  69 + this.lineHeight,
  70 + this.fontSize,
  71 + this.fontWeight
  72 + )
  73 + if (lines > 3) {
  74 + this.isExpanded = true
  75 + }
  76 +
61 //需要展开的话计算3行需要显示的文字 77 //需要展开的话计算3行需要显示的文字
62 if (this.isExpanded) { 78 if (this.isExpanded) {
63 79
@@ -76,13 +92,25 @@ export struct CommentText { @@ -76,13 +92,25 @@ export struct CommentText {
76 wordBreak:WordBreak.BREAK_ALL 92 wordBreak:WordBreak.BREAK_ALL
77 }) 93 })
78 94
  95 + let size = this.topMeasureText(
  96 + string,
  97 + (this.screenWidth - padding),
  98 + this.lineHeight,
  99 + this.fontSize,
  100 + this.fontWeight,
  101 + WordBreak.BREAK_ALL)
  102 + let height: number = Number(size.height)
  103 + let lines = Math.ceil(px2vp(height) / this.lineHeight)
  104 +
79 //计算有误差20 105 //计算有误差20
80 106
81 - if (thisTextWidth >= maxLineTextWidth) { 107 + if (thisTextWidth >= maxLineTextWidth || lines > 3) {
  108 + // if (this.maxLineMesssage.endsWith('\n')) {
  109 + // this.maxLineMesssage = this.maxLineMesssage.slice(0, this.maxLineMesssage.length - 1)
  110 + // }
82 break 111 break
83 } 112 }
84 this.maxLineMesssage = element; 113 this.maxLineMesssage = element;
85 -  
86 } 114 }
87 } 115 }
88 116
@@ -152,6 +180,24 @@ export struct CommentText { @@ -152,6 +180,24 @@ export struct CommentText {
152 180
153 // .height('100%') 181 // .height('100%')
154 } 182 }
  183 +
  184 + // 获取文本几行
  185 + private getTextLineNum(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource, fontWeight: FontWeight) {
  186 + let size = this.topMeasureText(text, constraintWidth, lineHeight, fontSize, fontWeight)
  187 + let height: number = Number(size.height)
  188 + return Math.ceil(px2vp(height) / lineHeight)
  189 + }
  190 +
  191 + private topMeasureText(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource, fontWeight: FontWeight, wordBreak?: WordBreak) {
  192 + return measure.measureTextSize({
  193 + textContent: text,
  194 + fontSize: fontSize,
  195 + lineHeight: lineHeight,
  196 + constraintWidth: constraintWidth,
  197 + fontWeight: fontWeight,
  198 + wordBreak: wordBreak,
  199 + })
  200 + }
155 } 201 }
156 202
157 203
@@ -161,7 +207,11 @@ export struct CommentText { @@ -161,7 +207,11 @@ export struct CommentText {
161 struct Index { 207 struct Index {
162 build() { 208 build() {
163 Column() { 209 Column() {
164 - CommentText() 210 + CommentText({longMessage: TestLongText,
  211 + maxline: 3,
  212 + fontSize: 14,
  213 + fontWeight: FontWeight.Regular,
  214 + marginWidth: (95 + 16)})
165 } 215 }
166 } 216 }
167 } 217 }
@@ -9,7 +9,8 @@ import { EmptyComponent, WDViewDefaultType } from '../../view/EmptyComponent' @@ -9,7 +9,8 @@ import { EmptyComponent, WDViewDefaultType } from '../../view/EmptyComponent'
9 import NoMoreLayout from '../../page/NoMoreLayout' 9 import NoMoreLayout from '../../page/NoMoreLayout'
10 import { CommentCustomDialog } from './CommentCustomDialog' 10 import { CommentCustomDialog } from './CommentCustomDialog'
11 import { publishCommentModel } from '../model/PublishCommentModel' 11 import { publishCommentModel } from '../model/PublishCommentModel'
12 -import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' 12 +import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index'
  13 +import { ContentDTO } from 'wdBean/Index'
13 14
14 const TAG = 'QualityCommentsComponent'; 15 const TAG = 'QualityCommentsComponent';
15 16
@@ -355,6 +356,9 @@ struct QualityCommentItem { @@ -355,6 +356,9 @@ struct QualityCommentItem {
355 Image($r('app.media.more')).width(12).height(12) 356 Image($r('app.media.more')).width(12).height(12)
356 357
357 }.width('100%').height(40).justifyContent(FlexAlign.SpaceBetween) 358 }.width('100%').height(40).justifyContent(FlexAlign.SpaceBetween)
  359 + .onClick(() => {
  360 + this.jumpToDetail()
  361 + })
358 362
359 } 363 }
360 .backgroundColor('#F9F9F9') 364 .backgroundColor('#F9F9F9')
@@ -418,6 +422,22 @@ struct QualityCommentItem { @@ -418,6 +422,22 @@ struct QualityCommentItem {
418 } 422 }
419 423
420 } 424 }
  425 +
  426 + jumpToDetail() {
  427 + // programInfoModel.api_isCommentAction = YES;
  428 +
  429 + let program: ContentDTO = {
  430 + objectId: this.item.targetId,
  431 + objectType: this.item.targetType,
  432 + relId: this.item.targetRelId,
  433 + relType: this.item.targetRelType,
  434 + // objectLevel: this.item.topicType,
  435 + pageId: this.item.pageId,
  436 + linkUrl: this.item.h5Url,
  437 + } as ContentDTO
  438 +
  439 + ProcessUtils.processPage(program)
  440 + }
421 } 441 }
422 442
423 function commentLikeChange(item: commentItemModel) { 443 function commentLikeChange(item: commentItemModel) {
1 import { Action, ContentDTO, Params } from 'wdBean'; 1 import { Action, ContentDTO, Params } from 'wdBean';
2 import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant'; 2 import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant';
3 -import { Logger } from 'wdKit'; 3 +import { Logger, ToastUtils } from 'wdKit';
4 import { CompUtils } from '../../utils/CompUtils'; 4 import { CompUtils } from '../../utils/CompUtils';
5 import { ProcessUtils, WDRouterRule } from 'wdRouter'; 5 import { ProcessUtils, WDRouterRule } from 'wdRouter';
6 6
@@ -475,7 +475,7 @@ export struct PaperSingleColumn999CardView { @@ -475,7 +475,7 @@ export struct PaperSingleColumn999CardView {
475 } 475 }
476 .justifyContent(FlexAlign.Start) 476 .justifyContent(FlexAlign.Start)
477 477
478 - Image($r('app.media.icon_forward')) 478 + Image($r('app.media.icon_paper_share'))
479 .width(16) 479 .width(16)
480 .height(16) 480 .height(16)
481 .margin({ left: 10, right: 22, top: 10, bottom: 10 }) 481 .margin({ left: 10, right: 22, top: 10, bottom: 10 })
@@ -483,6 +483,9 @@ export struct PaperSingleColumn999CardView { @@ -483,6 +483,9 @@ export struct PaperSingleColumn999CardView {
483 center: { anchor: '__container__', align: VerticalAlign.Center }, 483 center: { anchor: '__container__', align: VerticalAlign.Center },
484 right: { anchor: '__container__', align: HorizontalAlign.End } 484 right: { anchor: '__container__', align: HorizontalAlign.End }
485 }) 485 })
  486 + .onClick(() => {
  487 + ToastUtils.showToast('分享为公共方法,待开发', 1000)
  488 + })
486 }.width(CommonConstants.FULL_PARENT) 489 }.width(CommonConstants.FULL_PARENT)
487 .justifyContent(FlexAlign.SpaceBetween) 490 .justifyContent(FlexAlign.SpaceBetween)
488 } 491 }
@@ -214,20 +214,23 @@ struct ChannelDialog { @@ -214,20 +214,23 @@ struct ChannelDialog {
214 Flex({ justifyContent: FlexAlign.SpaceBetween }) { 214 Flex({ justifyContent: FlexAlign.SpaceBetween }) {
215 ForEach(this.homeChannelList, (item: TopNavDTO, index: number) => { 215 ForEach(this.homeChannelList, (item: TopNavDTO, index: number) => {
216 Stack() { 216 Stack() {
217 - Image(item.channelId === this.indexSettingChannelId ? $r('app.media.index_setting_button_active') : $r('app.media.index_setting_button')) 217 + Image(item.channelId === this.indexSettingChannelId ? $r('app.media.index_setting_button_active') :
  218 + $r('app.media.index_setting_button'))
218 .objectFit(ImageFit.Auto) 219 .objectFit(ImageFit.Auto)
219 .rotate({ 220 .rotate({
220 angle: index === 1 ? 180 : 0 221 angle: index === 1 ? 180 : 0
221 }) 222 })
222 Row() { 223 Row() {
223 if (index === 0) { 224 if (index === 0) {
224 - Image(item.channelId === this.indexSettingChannelId ? $r('app.media.recommend_icon') : $r('app.media.recommend_icon_active')) 225 + Image(item.channelId === this.indexSettingChannelId ? $r('app.media.recommend_icon') :
  226 + $r('app.media.recommend_icon_active'))
225 .width(20) 227 .width(20)
226 } 228 }
227 Text(item.name) 229 Text(item.name)
228 .textAlign(TextAlign.Center) 230 .textAlign(TextAlign.Center)
229 .fontSize(16) 231 .fontSize(16)
230 .fontColor(item.channelId === this.indexSettingChannelId ? '#ffffff' : '#ED2800') 232 .fontColor(item.channelId === this.indexSettingChannelId ? '#ffffff' : '#ED2800')
  233 +
231 } 234 }
232 .width('100%') 235 .width('100%')
233 .justifyContent(FlexAlign.Center) 236 .justifyContent(FlexAlign.Center)
@@ -275,8 +278,8 @@ struct ChannelDialog { @@ -275,8 +278,8 @@ struct ChannelDialog {
275 GridItem() { 278 GridItem() {
276 Row() { 279 Row() {
277 Text(item.name) 280 Text(item.name)
278 - .fontSize(14)  
279 - .fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.headlinesOn === 1 || item.movePermitted === 0 ? '#999999' : '#222222')) 281 + .fontSize(14)// .fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.headlinesOn === 1 || item.movePermitted === 0 ? '#999999' : '#222222'))
  282 + .fontColor(item.headlinesOn === 1 || item.movePermitted === 0 ? '#999999' : '#222222')
280 283
281 if (this.isEditIng && item.delPermitted === 1 && item.movePermitted === 1) { 284 if (this.isEditIng && item.delPermitted === 1 && item.movePermitted === 1) {
282 Image($r('app.media.icon_audio_close')) 285 Image($r('app.media.icon_audio_close'))
@@ -292,7 +295,7 @@ struct ChannelDialog { @@ -292,7 +295,7 @@ struct ChannelDialog {
292 .width('23%') 295 .width('23%')
293 .height(40) 296 .height(40)
294 .border({ 297 .border({
295 - width: item.headlinesOn === 1 || item.movePermitted === 0 ? 0 : 1, 298 + width: item.headlinesOn === 1 || item.movePermitted === 0 ? 0 : 1,
296 color: '#EDEDED', 299 color: '#EDEDED',
297 radius: 3 300 radius: 3
298 }) 301 })
@@ -319,7 +322,11 @@ struct ChannelDialog { @@ -319,7 +322,11 @@ struct ChannelDialog {
319 } 322 }
320 } 323 }
321 }), 324 }),
322 - PanGesture({ fingers: 1, direction: this.isEditIng ? PanDirection.All:PanDirection.None, distance: 0 }) 325 + PanGesture({
  326 + fingers: 1,
  327 + direction: this.isEditIng ? PanDirection.All : PanDirection.None,
  328 + distance: 0
  329 + })
323 .onActionStart((event: GestureEvent) => { 330 .onActionStart((event: GestureEvent) => {
324 this.dragItem = item.num 331 this.dragItem = item.num
325 this.dragRefOffsetX = 0 332 this.dragRefOffsetX = 0
@@ -449,7 +456,12 @@ struct ChannelDialog { @@ -449,7 +456,12 @@ struct ChannelDialog {
449 }.width('100%').height('100%') 456 }.width('100%').height('100%')
450 .scrollBar(BarState.Off) 457 .scrollBar(BarState.Off)
451 } 458 }
452 - .padding({ top: 40, right: 15, bottom: 40, left: 15 }) 459 + .padding({
  460 + top: 40,
  461 + right: 15,
  462 + bottom: 40,
  463 + left: 15
  464 + })
453 .backgroundColor('#ffffff') 465 .backgroundColor('#ffffff')
454 } 466 }
455 } 467 }
@@ -43,17 +43,34 @@ struct EditUserInfoPage { @@ -43,17 +43,34 @@ struct EditUserInfoPage {
43 Row() { 43 Row() {
44 Column() { 44 Column() {
45 CustomTitleUI({titleName:'编辑资料'}) 45 CustomTitleUI({titleName:'编辑资料'})
46 - Image(this.headerImg)  
47 - .alt($r('app.media.default_head'))  
48 - .backgroundColor(Color.Gray)  
49 - .width(100)  
50 - .height(100)  
51 - .borderRadius(50)  
52 - .margin({top:20,bottom:-10}) 46 +
  47 + Stack(){
  48 + Image(this.headerImg)
  49 + .alt($r('app.media.default_head'))
  50 + .backgroundColor(Color.Gray)
  51 + .width(84)
  52 + .height(84)
  53 + .borderRadius(42)
  54 +
  55 +
  56 + if (this.headerImg.length === 0){
  57 + Image('')
  58 + .width('84')
  59 + .height('84')
  60 + .backgroundColor(Color.Gray)
  61 + .opacity(0.7)
  62 + .borderRadius(5)
  63 + .borderRadius(42)
  64 +
  65 + Image($r('app.media.seletct_photo'))
  66 + .width('30')
  67 + .height('30')
  68 + }
  69 + }.margin({top:20,bottom:-10})
53 70
54 Button('点击更换头像') 71 Button('点击更换头像')
55 .fontColor(Color.Gray) 72 .fontColor(Color.Gray)
56 - .fontSize(18) 73 + .fontSize(15)
57 .backgroundColor(Color.White) 74 .backgroundColor(Color.White)
58 .margin(20) 75 .margin(20)
59 76
@@ -79,14 +96,14 @@ struct EditUserInfoPage { @@ -79,14 +96,14 @@ struct EditUserInfoPage {
79 Column(){ 96 Column(){
80 Row(){ 97 Row(){
81 Text(r.title) 98 Text(r.title)
82 - .fontSize(18) 99 + .fontSize(15)
83 .fontColor(Color.Gray) 100 .fontColor(Color.Gray)
84 Blank() 101 Blank()
85 102
86 Text(r.subTitle) 103 Text(r.subTitle)
87 .textOverflow({overflow:TextOverflow.Ellipsis}) 104 .textOverflow({overflow:TextOverflow.Ellipsis})
88 .maxLines(1) 105 .maxLines(1)
89 - .fontSize(16) 106 + .fontSize(14)
90 .fontColor(Color.Gray) 107 .fontColor(Color.Gray)
91 .padding({right:10}) 108 .padding({right:10})
92 .width('70%') 109 .width('70%')
@@ -197,7 +197,7 @@ export struct TopNavigationComponent { @@ -197,7 +197,7 @@ export struct TopNavigationComponent {
197 .width(18) 197 .width(18)
198 .height(18) 198 .height(18)
199 Text('早晚报') 199 Text('早晚报')
200 - .fontColor($r('app.color.color_B0B0B0')) 200 + .fontColor("#666666")
201 .fontSize($r('app.float.font_size_13')) 201 .fontSize($r('app.float.font_size_13'))
202 } 202 }
203 .alignItems(VerticalAlign.Center) 203 .alignItems(VerticalAlign.Center)
@@ -385,11 +385,12 @@ export struct PeopleShipMainComponent { @@ -385,11 +385,12 @@ export struct PeopleShipMainComponent {
385 }) 385 })
386 Logger.debug('PeopleShipMainComponent', `一键关注接口参数: ${JSON.stringify(objects)}`); 386 Logger.debug('PeopleShipMainComponent', `一键关注接口参数: ${JSON.stringify(objects)}`);
387 let batchInfo = await PeopleShipMainViewModel.getAttentionBatchInfo(objects) 387 let batchInfo = await PeopleShipMainViewModel.getAttentionBatchInfo(objects)
  388 + this.oneKeyFollow = false
388 if (batchInfo.code === 0 || batchInfo.code.toString() === "0") { 389 if (batchInfo.code === 0 || batchInfo.code.toString() === "0") {
389 this.getData() 390 this.getData()
390 } 391 }
391 } catch (exception) { 392 } catch (exception) {
392 - 393 + this.oneKeyFollow = false
393 } 394 }
394 } 395 }
395 396
@@ -54,7 +54,7 @@ export struct FirstTabTopSearchComponent { @@ -54,7 +54,7 @@ export struct FirstTabTopSearchComponent {
54 ForEach(this.searchTextData, (item: string, index: number) => { 54 ForEach(this.searchTextData, (item: string, index: number) => {
55 Text(item) 55 Text(item)
56 .fontWeight(400) 56 .fontWeight(400)
57 - .fontColor($r('app.color.color_B0B0B0')) 57 + .fontColor("#666666")
58 .fontSize($r('app.float.font_size_13')) 58 .fontSize($r('app.float.font_size_13'))
59 .textAlign(TextAlign.Start) 59 .textAlign(TextAlign.Start)
60 .maxLines(1) 60 .maxLines(1)
@@ -14,7 +14,7 @@ export struct newsSkeleton { @@ -14,7 +14,7 @@ export struct newsSkeleton {
14 Column() { 14 Column() {
15 Row() { 15 Row() {
16 Column() { 16 Column() {
17 - Image($rawfile('apph5/image/peopleSeleton.svg')).width('100%').height(47)// 后缀名不能省略 17 + Image($r('app.media.peopleSeleton')).width('100%').height(47)// 后缀名不能省略
18 .interpolation(ImageInterpolation.High) 18 .interpolation(ImageInterpolation.High)
19 textArea('100%', 9) 19 textArea('100%', 9)
20 }.width('72.00%').alignItems(HorizontalAlign.Start).margin({ right: 5 }) 20 }.width('72.00%').alignItems(HorizontalAlign.Start).margin({ right: 5 })
1 import { ToastUtils, Logger, NumberFormatterUtils, SPHelper } from 'wdKit'; 1 import { ToastUtils, Logger, NumberFormatterUtils, SPHelper } from 'wdKit';
  2 +import promptAction from '@ohos.promptAction';
2 import { 3 import {
3 InputMethodProperty, 4 InputMethodProperty,
4 batchLikeAndCollectResult, 5 batchLikeAndCollectResult,
@@ -41,7 +42,7 @@ const TAG = 'OperRowListView'; @@ -41,7 +42,7 @@ const TAG = 'OperRowListView';
41 @Preview 42 @Preview
42 @Component 43 @Component
43 export struct OperRowListView { 44 export struct OperRowListView {
44 - @Prop contentDetailData: ContentDetailDTO // 稿件详情 45 + @Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情
45 @State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件 46 @State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件
46 @ObjectLink publishCommentModel: publishCommentModel 47 @ObjectLink publishCommentModel: publishCommentModel
47 // @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 48 // @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@@ -52,7 +53,9 @@ export struct OperRowListView { @@ -52,7 +53,9 @@ export struct OperRowListView {
52 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 53 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
53 needLike: boolean = true 54 needLike: boolean = true
54 55
55 - async aboutToAppear() { 56 + // async aboutToAppear() {
  57 + async onDetailUpdated() {
  58 + if (!this.contentDetailData) return
56 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') 59 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
57 if (user_id) { 60 if (user_id) {
58 this.getInteractDataStatus() 61 this.getInteractDataStatus()
@@ -99,20 +102,22 @@ export struct OperRowListView { @@ -99,20 +102,22 @@ export struct OperRowListView {
99 }) 102 })
100 .width(42) 103 .width(42)
101 104
102 - ForEach(this.operationButtonList, (item: string, index: number) => {  
103 - if (item == 'comment') {  
104 - this.builderComment()  
105 - } else if (item == 'like' && this.needLike) {  
106 - this.builderLike()  
107 - } else if (item == 'collect') {  
108 - this.builderCollect()  
109 - } else if (item == 'listen') {  
110 - this.builderListen()  
111 - } else if (item == 'share') {  
112 - this.builderShare()  
113 - } else {  
114 - }  
115 - }) 105 + if (this.contentDetailData) {
  106 + ForEach(this.operationButtonList, (item: string, index: number) => {
  107 + if (item == 'comment') {
  108 + this.builderComment()
  109 + } else if (item == 'like' && this.needLike) {
  110 + this.builderLike()
  111 + } else if (item == 'collect') {
  112 + this.builderCollect()
  113 + } else if (item == 'listen') {
  114 + this.builderListen()
  115 + } else if (item == 'share') {
  116 + this.builderShare()
  117 + } else {
  118 + }
  119 + })
  120 + }
116 } 121 }
117 .width('100%') 122 .width('100%')
118 .justifyContent(FlexAlign.Start) 123 .justifyContent(FlexAlign.Start)
@@ -121,7 +126,8 @@ export struct OperRowListView { @@ -121,7 +126,8 @@ export struct OperRowListView {
121 .backgroundColor(Color.White) 126 .backgroundColor(Color.White)
122 .padding({ 127 .padding({
123 top: 10, 128 top: 10,
124 - bottom: `${this.bottomSafeHeight}px` 129 + // bottom: `${this.bottomSafeHeight}px`
  130 + bottom: 50
125 }) 131 })
126 } 132 }
127 133
@@ -267,6 +273,9 @@ export struct OperRowListView { @@ -267,6 +273,9 @@ export struct OperRowListView {
267 PageRepository.postExecuteCollectRecord(params).then(res => { 273 PageRepository.postExecuteCollectRecord(params).then(res => {
268 if (this.newsStatusOfUser) { 274 if (this.newsStatusOfUser) {
269 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 275 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
  276 + if(this.newsStatusOfUser.collectStatus === 1){
  277 + promptAction.showToast({ message: '收藏成功' })
  278 + }
270 this.queryContentInteractCount() 279 this.queryContentInteractCount()
271 } 280 }
272 }) 281 })
@@ -15,11 +15,15 @@ export struct ENewspaperListDialog { @@ -15,11 +15,15 @@ export struct ENewspaperListDialog {
15 @Prop @Watch('updateRecordsData') newspaperListBean: NewspaperListBean = {} as NewspaperListBean 15 @Prop @Watch('updateRecordsData') newspaperListBean: NewspaperListBean = {} as NewspaperListBean
16 private listScroller: Scroller = new Scroller() 16 private listScroller: Scroller = new Scroller()
17 @State scrollOffset: number = 0 17 @State scrollOffset: number = 0
  18 + @State isCurrentViewOpen: boolean = false
18 //文字版选择弹框 19 //文字版选择弹框
19 pageListDialogController: CustomDialogController = new CustomDialogController({ 20 pageListDialogController: CustomDialogController = new CustomDialogController({
20 builder: ENewspaperPageDialog({ 21 builder: ENewspaperPageDialog({
21 dialogType: 1, 22 dialogType: 1,
22 newspaperListBean: this.newspaperListBean, 23 newspaperListBean: this.newspaperListBean,
  24 + dialogVisibility: (visibility: boolean) => {
  25 + this.isCurrentViewOpen = !visibility
  26 + }
23 }), 27 }),
24 alignment: DialogAlignment.TopStart, 28 alignment: DialogAlignment.TopStart,
25 offset: { dx: 0, dy: 224 }, 29 offset: { dx: 0, dy: 224 },
@@ -37,10 +41,13 @@ export struct ENewspaperListDialog { @@ -37,10 +41,13 @@ export struct ENewspaperListDialog {
37 let _scrollIndex = Number.parseInt(this.currentPageNum) 41 let _scrollIndex = Number.parseInt(this.currentPageNum)
38 console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "_scrollIndex:", _scrollIndex) 42 console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "_scrollIndex:", _scrollIndex)
39 let scrollIndexEnd = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex 43 let scrollIndexEnd = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex
40 - this.listScroller.scrollToIndex(scrollIndexEnd) 44 + if (!this.isCurrentViewOpen) {
  45 + this.listScroller.scrollToIndex(scrollIndexEnd)
  46 + }
41 } 47 }
42 48
43 aboutToAppear(): void { 49 aboutToAppear(): void {
  50 + this.isCurrentViewOpen = true
44 console.log("ENewspaperListDialog-aboutToAppear", "currentPageNum:", this.currentPageNum) 51 console.log("ENewspaperListDialog-aboutToAppear", "currentPageNum:", this.currentPageNum)
45 let _scrollIndex = Number.parseInt(this.currentPageNum) 52 let _scrollIndex = Number.parseInt(this.currentPageNum)
46 console.log("ENewspaperListDialog-aboutToAppear", "_scrollIndex:", _scrollIndex) 53 console.log("ENewspaperListDialog-aboutToAppear", "_scrollIndex:", _scrollIndex)
@@ -52,6 +59,7 @@ export struct ENewspaperListDialog { @@ -52,6 +59,7 @@ export struct ENewspaperListDialog {
52 // if (this.pageListDialogController) { 59 // if (this.pageListDialogController) {
53 // this.pageListDialogController = null 60 // this.pageListDialogController = null
54 // } 61 // }
  62 + this.isCurrentViewOpen = false
55 } 63 }
56 64
57 build() { 65 build() {
@@ -221,26 +229,26 @@ export struct ENewspaperListDialog { @@ -221,26 +229,26 @@ export struct ENewspaperListDialog {
221 .padding({ 229 .padding({
222 left: 15, 230 left: 15,
223 right: 15, 231 right: 15,
224 - top: 16, 232 + // top: 16,
225 bottom: 16 233 bottom: 16
226 }) 234 })
227 .margin({ 235 .margin({
228 bottom: 85 236 bottom: 85
229 }) 237 })
230 .scrollBar(BarState.Off) 238 .scrollBar(BarState.Off)
231 - 239 + .edgeEffect(EdgeEffect.None)
232 .onScrollIndex((firstIndex: number, lastIndex: number, centerIndex: number) => { 240 .onScrollIndex((firstIndex: number, lastIndex: number, centerIndex: number) => {
233 - // console.info('ENewspaperListDialog::first' + firstIndex)  
234 - // console.info('ENewspaperListDialog::last' + lastIndex)  
235 - // console.info('ENewspaperListDialog::center' + centerIndex) 241 + console.info('ENewspaperListDialog::first' + firstIndex)
  242 + console.info('ENewspaperListDialog::last' + lastIndex)
  243 + console.info('ENewspaperListDialog::center' + centerIndex)
236 // this.updateCurrentPageNum(firstIndex) 244 // this.updateCurrentPageNum(firstIndex)
237 // const tempIndex = this.findClassIndex(firstIndex) 245 // const tempIndex = this.findClassIndex(firstIndex)
238 - if (firstIndex !== centerIndex) {  
239 - return  
240 - } 246 + // if (firstIndex !== centerIndex) {
  247 + // return
  248 + // }
241 // console.info(`this.scrollOffset:` + this.scrollOffset) 249 // console.info(`this.scrollOffset:` + this.scrollOffset)
242 // if (this.scrollOffset == 0) { 250 // if (this.scrollOffset == 0) {
243 - this.currentPageNum = `${centerIndex < 9 ? '0' + (centerIndex + 1) : centerIndex + 1}` 251 + this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}`
244 // } 252 // }
245 }) 253 })
246 .onScroll((scrollOffset: number, scrollState: ScrollState) => { 254 .onScroll((scrollOffset: number, scrollState: ScrollState) => {
@@ -9,11 +9,24 @@ export struct ENewspaperPageDialog { @@ -9,11 +9,24 @@ export struct ENewspaperPageDialog {
9 pageDialogController?: CustomDialogController 9 pageDialogController?: CustomDialogController
10 @Consume @Watch('onCurrentPageNumUpdated') currentPageNum: string 10 @Consume @Watch('onCurrentPageNumUpdated') currentPageNum: string
11 @Prop newspaperListBean: NewspaperListBean = {} as NewspaperListBean 11 @Prop newspaperListBean: NewspaperListBean = {} as NewspaperListBean
  12 + public dialogVisibility?: (visibility: boolean) => void
12 13
13 onCurrentPageNumUpdated(): void { 14 onCurrentPageNumUpdated(): void {
14 console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) 15 console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
15 } 16 }
16 17
  18 + aboutToAppear(): void {
  19 + if (this.dialogType == 1 && this.dialogVisibility) {
  20 + this.dialogVisibility(true)
  21 + }
  22 + }
  23 +
  24 + aboutToDisappear(): void {
  25 + if (this.dialogType == 1 && this.dialogVisibility) {
  26 + this.dialogVisibility(false)
  27 + }
  28 + }
  29 +
17 build() { 30 build() {
18 Column() { 31 Column() {
19 if (this.dialogType == 1) { 32 if (this.dialogType == 1) {
  1 +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1713249268044" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2925" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M884.736 546.88c-1.792-5.12-7.04-9.728-12.8-7.232-3.2 1.344-10.496 12.544-11.072 9.6-2.752-14.08 16.704-18.048 19.52-25.344 3.008-8-4.224-11.52-10.24-13.888a47.232 47.232 0 0 1-16.192-11.072c-4.928-4.992-17.024-12.352-21.568-3.2-1.28 4.352-0.512 12.608-2.176 17.92-1.92 6.272-9.088 6.72-13.44 11.328-6.208 6.848 0.64 9.216 4.8 14.464 3.84 4.992 1.216 40.384-5.248 52.48-3.2 6.016-86.336 72.064-100.032 75.52-15.744 3.84-15.68 20.48-8.96 29.696 8.576 11.712 27.008 6.272 36.16-0.448 5.76-4.352 44.288-45.056 53.44-53.44 3.712-3.392 18.688-22.976 19.84-10.432a46.912 46.912 0 0 1-1.728 16.96c-1.856 5.888-5.568 14.848-5.12 21.248 0.768 10.24 19.2 24.32 28.8 20.096 6.208-2.816 6.72-12.096 6.08-18.816-0.576-7.04 0.768-49.024 2.24-62.72a46.08 46.08 0 0 1 5.952-20.8c5.248-8.768 36.928-27.072 31.744-41.92z m-226.88 26.624c-2.816 6.08-14.272-3.84-17.152-6.528-2.88-2.56-6.464-4.48-6.016-8.896 0.576-4.48 5.76-5.12 5.76-5.12 1.792-0.32 17.792-0.96 18.88 1.856a55.296 55.296 0 0 1-1.472 18.688z m14.72-97.28c-10.816-1.408-23.296 9.472-31.616 14.72-4.096 2.56-27.52 14.4-24 20.48 2.432 4.096 17.024 0.576 21.76-0.512 13.44-3.072 20.48-12.032 23.872-9.792 2.88 1.92 1.024 32.64-4.48 32.064-12.032-1.152-19.2-10.624-32.064-15.872-3.968-1.6-11.776-4.608-9.088 2.624 0.768 2.176 3.648 5.056 4.672 7.168 2.368 4.8 4.48 21.504 2.368 25.152-4.224 6.976-8.704-5.376-9.792-8.064-2.048-5.12-3.328-10.368-5.12-15.552-1.536-4.736-5.568-16.96-10.944-16.256-6.208 0.832-1.664 27.968-2.816 33.728-3.84 19.456-5.504 25.216-6.144 37.952-0.512 10.304 0 27.392 11.84 30.528 15.808 4.224 18.048-9.344 19.456-18.56 0.32-2.176 0.832-6.784 1.92-8.64 1.664-2.752 3.84-3.2 5.888-0.512 1.664 2.304 0.96 5.696 3.456 7.936 2.496 2.304 5.312 1.92 8.576 2.56 5.056 0.96 11.328-0.96 14.464 3.84 3.2 5.12 2.176 10.56 8.32 14.016 13.44 7.36 19.84-7.168 20.864-16.896 1.216-11.648 1.792-22.592 2.368-34.176 0.576-11.712 1.088-24.448 4.096-35.776a244.48 244.48 0 0 1 5.248-17.024 22.72 22.72 0 0 0 0.768-16.256c-3.776-9.728-19.648-18.368-23.936-18.88z m-165.312 2.304c4.48-4.16 12.032-9.664 10.88-16.32-4.352-25.92-44.672-8.384-59.968-0.768-22.208 11.136-11.52 5.824-50.432 24.96-5.888 2.816-3.2 7.04-2.304 9.6 3.2 9.216 17.664 13.632 23.808 9.728 5.12-3.264 54.08-37.76 56.704-34.112 4.032 5.504-20.8 24.512-32.32 29.056-5.12 2.048-13.184 9.408-14.784 15.04a12.992 12.992 0 0 0 0.192 8.96l-0.64-0.256c-1.856 0.64-6.848-0.192-8.512 0.96-1.536 1.024 1.728 20.928 8.128 33.28 2.304 4.352 4.288 8.32-1.088 11.008-6.208 3.072-17.088 15.68-4.928 16.832 2.624 0.256 5.44 0.384 7.68-0.896 1.728-1.024 4.992-2.944 7.488-2.24 2.56 0.768 4.736 8.32 6.4 10.944 5.312 8.064 24.576 43.328 33.728 45.632 8 2.048 21.312-1.152 24-9.984 1.408-4.416 2.56-36.864 2.496-41.664-0.064-4.288 0.256-9.856-0.896-13.76-1.088-3.648-3.84-9.152-8.448-7.872-4.928 1.28-5.184 8.832-6.016 12.8-1.024 4.8-2.24 26.304-7.232 26.368-3.52 0-20.16-26.624-22.016-30.336-1.92-3.776-3.52-7.36-0.96-11.008 4.48-6.464 19.2-14.976 11.264-23.68-6.272-6.784-20.48-4.992-22.592 3.584-0.64 2.56 0.896 12.608-4.416 8.96-3.072-2.112-8.704-17.088-6.656-19.2 0.832-0.832 4.224-1.472 7.296-1.792h3.2c10.88-0.96 26.496-6.72 29.952-15.296 1.152-2.88 2.56-6.592 0.064-8.576-1.984-1.664-2.624-1.92-3.2-4.16-0.64-2.688 19.52-21.504 24.128-25.792z m472.064 56.128c16.384-7.808 49.408-7.424 44.096-39.04-1.088-6.528-4.352-20.032-13.568-19.52-8 0.448-14.272 12.8-17.792 18.816-8.96 15.36-26.496 30.4-38.912 43.264-15.68 16.256-41.088 60.992-43.84 60.992-7.296-0.064 3.264-29.248 4.992-33.536 10.176-25.28 42.88-104.256 47.808-113.28 9.152-16.832 15.808-25.792 26.112-41.664 20.352-31.36-14.848-30.336-14.848-30.336-9.92 0.768-16.256 7.296-21.952 11.776-6.272 4.8-12.8 8.064-19.712 11.904-6.784 3.84-15.36 7.872-9.472 16.128 4.992 7.04 10.752 7.744 18.24 8.512a38.72 38.72 0 0 0 7.36 0.512c-1.216 7.232-25.28 50.112-30.848 66.752-11.392 34.24-20.224 98.368-36.8 128a29.888 29.888 0 0 0-3.392 23.68c2.112 6.912 14.272 11.52 21.952 5.376 6.144-4.864 6.976-29.312 28.48-67.072 6.016-10.496 9.6-6.144 14.592 3.584 4.544 8.768 8.512 31.104 14.592 39.296 19.52 26.176 41.408 18.688 44.352 9.472 4.48-13.632-3.84-23.872-9.792-29.824-16.896-16.704-59.712-28.992-49.152-48 7.872-14.08 28.544-21.504 37.504-25.792zM260.544 386.816c-0.576-9.856-6.912-17.472-16.064-22.72-4.288-2.496-19.52-9.664-23.04-6.144l1.472-0.32c-6.016 2.688-1.92 21.312-2.496 26.688-1.024 9.984-6.336 22.208-9.792 31.872-7.232 20.032-13.888 37.824-21.056 57.856a576.64 576.64 0 0 1-26.944 61.312c-9.984 19.84-19.712 40.256-29.888 59.84-5.76 11.2-11.84 22.272-19.2 32.32-6.848 9.152-14.464 20.352-22.784 28.416-6.848 6.592-15.872 12.8-24.512 16.064-10.496 4.032-20.032 4.864-30.72 6.912-4.928 0.896-26.24 2.304-31.04 4.096-13.696 4.992 7.872 11.648 13.952 11.584 21.76 0 44.992 1.536 64.64-5.568 18.944-6.912 35.84-21.12 47.936-36.736 13.44-17.344 37.632-61.76 46.976-81.216 11.52-23.808 58.24-112.64 62.912-125.312 6.08-16.64 20.544-41.408 19.648-59.008z m550.144 102.4a24.512 24.512 0 0 0 16.96-1.472 25.6 25.6 0 0 1 16.448-2.176c4.736 0.64 8.832 1.28 13.76 0.448 6.08-0.96 7.808-2.112 12.8-5.12 4.864-2.944 9.408-2.496 14.784-3.328a20.8 20.8 0 0 0 11.584-6.912c6.784-7.04 12.16-18.624 3.648-25.728-3.968-3.328-15.552-9.664-27.712-4.736a265.216 265.216 0 0 0-25.664 16.64c-9.728 6.912-21.568 9.472-31.488 15.36-3.84 2.24-9.152 5.248-11.648 8.96-3.264 4.672 1.92 6.784 6.528 8.064zM437.952 595.712c-11.008-4.672-14.912 2.624-21.632 6.464-3.264-5.12 0.128-12.416 0.96-17.856 0.96-6.4 6.72-38.4-17.92-51.008-1.984-1.024-5.568-1.472-5.568 1.408l-2.24 18.24c-5.632 43.2-9.728 53.76-10.112 60.864-0.256 6.848-0.704 16.576 3.712 21.952 3.648 4.288 9.472 7.488 15.488 5.824 5.76-1.472 24.128-17.472 29.056-22.208 5.056-4.8 19.008-19.2 8.256-23.68z m378.88-166.208c4.48 1.472 21.312 1.344 19.008 7.68-1.344 3.776-6.272 6.4-9.088 9.088-1.664 1.664-8.448 7.872-7.68 10.112 1.408 4.544 21.376-7.616 25.344-10.624 4.288-3.328 8.704-6.208 13.696-8.448 4.928-2.304 18.56-7.168 28.736-15.36 10.048-8.256 45.312-69.312 45.888-74.304 1.152-10.368-10.432-23.488-20.928-27.456-4.48-1.728-9.792 7.808-11.072 10.624-2.304 5.12-15.552 30.72-19.712 39.36a61.504 61.504 0 0 1-19.136 23.872c-8.96 6.08-18.56 8.896-28.8 11.904-5.248 1.6-26.688 6.656-28.8 9.792-2.88 4.224 8.192 12.352 12.544 13.76z m-489.088 219.136c-5.248 1.536-35.2 8.96-40.512 7.808-28.928-5.888-30.272-32.832-79.04-75.904-1.664-1.536-19.584-12.032-18.176-4.48 0 0 15.424 26.624 18.816 31.552 3.712 5.312 20.032 42.88 22.592 48.192 2.432 5.056 4.992 10.368 7.68 15.232 5.44 9.344 15.68 22.272 27.072 24.832 5.76 1.28 24.512-4.352 30.144-7.104 11.328-5.632 22.528-12.8 32.192-21.312 3.84-3.328 8.64-7.744 10.112-12.672 2.304-7.808-5.248-7.808-10.88-6.144z" p-id="2926" fill="#f6f6f6"></path></svg>
  1 +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1715075661006" class="icon" viewBox="0 0 2048 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7815" width="64" height="32" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M1920 0a128 128 0 0 1 128 128v768a128 128 0 0 1-128 128H128a128 128 0 0 1-128-128V128a128 128 0 0 1 128-128h1792zM569.344 135.168c-6.144 30.72-12.288 61.44-19.2 92.928H347.392v51.456h191.232c-7.68 32.256-15.36 63.744-23.808 95.232H295.168v53.76h204.288c-16.128 52.992-33.792 103.68-52.224 152.832h379.392c-40.704 50.688-96.768 99.84-167.424 145.92a2339.2 2339.2 0 0 0-165.888-51.456l-29.184 43.008a1960.896 1960.896 0 0 1 356.352 134.4l30.72-48.384a1604.032 1604.032 0 0 0-132.864-56.064c79.104-56.832 136.704-114.432 173.568-171.264V529.92H526.336c10.752-31.488 22.272-65.28 33.024-101.376h425.472v-53.76h-410.88c7.68-29.952 15.36-61.44 23.04-95.232h342.528v-51.456H608.512c6.144-27.648 11.52-57.6 17.664-88.32l-56.832-4.608z m829.44 354.816h-325.632v50.688h152.064v186.624c-23.808-17.664-46.08-42.24-66.048-73.728 3.84-23.04 6.144-46.848 7.68-72.96l-49.152-6.144c-3.84 87.552-26.112 165.888-67.584 235.776l39.936 35.328a565.696 565.696 0 0 0 57.6-135.936c31.488 44.544 67.584 76.032 108.288 92.928 44.16 19.136 151.04 29.12 322.176 29.888l173.952 0.064 9.216-55.296c-34.88 1.408-85.696 2.816-152.32 3.008l-20.48 0.064c-157.44 0-258.048-6.912-302.592-20.736a89.408 89.408 0 0 0-11.52-4.608v-83.712h105.216V622.08h-105.216V540.672h124.416v-50.688z m201.984-122.88h-50.688v108.288c-1.536 57.6-13.056 104.448-33.024 140.544-22.272 34.56-60.672 62.208-115.968 82.176l29.952 47.616c58.368-23.04 101.376-54.528 127.488-95.232 26.112-43.776 40.704-102.144 42.24-175.104V367.104z m29.952 228.864l-36.864 35.328c49.92 39.936 89.088 78.336 117.504 113.664l39.168-38.4a850.24 850.24 0 0 0-119.808-110.592z m110.592-424.704h-331.776v50.688h143.616a539.136 539.136 0 0 1-9.984 61.44h-109.824v310.272h49.152V331.008h185.856v262.656h51.456V283.392h-126.72c4.608-19.968 7.68-39.936 9.984-61.44h138.24v-50.688zM1369.6 170.496h-261.888v268.032H1369.6V170.496z m-53.76 156.672v65.28h-154.368v-65.28h154.368z m0-110.592V284.16h-154.368V216.576h154.368z" fill="#ff0000" p-id="7816"></path></svg>
@@ -344,7 +344,6 @@ const app = Vue.createApp({ @@ -344,7 +344,6 @@ const app = Vue.createApp({
344 344
345 // 页面加载 内容详情数据 最外层方法 345 // 页面加载 内容详情数据 最外层方法
346 const initData = async (res, id, devApp) => { 346 const initData = async (res, id, devApp) => {
347 - console.log("initData:",res)  
348 /**判断是否为本地开发环境,是的话初始化数据,不是的话通过app提供的方法,h5发送数据给app**/ 347 /**判断是否为本地开发环境,是的话初始化数据,不是的话通过app提供的方法,h5发送数据给app**/
349 if (window.config.VUE_BASE_NODE === 'dev') { 348 if (window.config.VUE_BASE_NODE === 'dev') {
350 if (devApp || window.config.devApp) { 349 if (devApp || window.config.devApp) {
@@ -405,7 +404,6 @@ const app = Vue.createApp({ @@ -405,7 +404,6 @@ const app = Vue.createApp({
405 if ([ 200, '0' ].includes(res.code) > 0) { 404 if ([ 200, '0' ].includes(res.code) > 0) {
406 if (res.data) { 405 if (res.data) {
407 const details = res.data.length > 0 ? res.data[0] : {} 406 const details = res.data.length > 0 ? res.data[0] : {}
408 - // const details = res.data || {}  
409 hasDetails = true 407 hasDetails = true
410 // 获取用户登录状态 408 // 获取用户登录状态
411 if (hasAppLoginExtra.value) { 409 if (hasAppLoginExtra.value) {
1 import { window } from '@kit.ArkUI' 1 import { window } from '@kit.ArkUI'
2 -import { NumberFormatterUtils, WindowModel } from 'wdKit/Index' 2 +import { NumberFormatterUtils, StringUtils, WindowModel } from 'wdKit/Index'
3 import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index' 3 import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index'
4 import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' 4 import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'
5 import { DisplayDirection } from 'wdConstant/Index' 5 import { DisplayDirection } from 'wdConstant/Index'
@@ -20,7 +20,8 @@ export struct PlayUIComponent { @@ -20,7 +20,8 @@ export struct PlayUIComponent {
20 @Consume displayDirection: DisplayDirection 20 @Consume displayDirection: DisplayDirection
21 21
22 onChangeMenuVisible() { 22 onChangeMenuVisible() {
23 - if (!this.liveDetailsBean || !this.liveDetailsBean.liveInfo || this.liveDetailsBean?.liveInfo?.liveState === 'wait') { 23 + if (!this.liveDetailsBean || !this.liveDetailsBean.liveInfo ||
  24 + this.liveDetailsBean?.liveInfo?.liveState === 'wait') {
24 return 25 return
25 } 26 }
26 let time: number = 0 27 let time: number = 0
@@ -216,30 +217,38 @@ export struct PlayUIComponent { @@ -216,30 +217,38 @@ export struct PlayUIComponent {
216 this.playOrPauseBtn() 217 this.playOrPauseBtn()
217 Blank() 218 Blank()
218 } else if (this.liveDetailsBean?.liveInfo?.liveState == 'end') { 219 } else if (this.liveDetailsBean?.liveInfo?.liveState == 'end') {
219 - this.playOrPauseBtn()  
220 - Text(this.currentTime)  
221 - .fontColor(Color.White)  
222 - .fontWeight(600)  
223 - .fontSize('12fp')  
224 - .margin({  
225 - left: 16  
226 - })  
227 - this.playProgressView()  
228 - Text(this.totalTime)  
229 - .fontColor(Color.White)  
230 - .fontWeight(600)  
231 - .fontSize('12fp')  
232 - .margin({  
233 - right: 16  
234 - }) 220 + if (StringUtils.isEmpty(this.liveDetailsBean?.liveInfo?.vlive[0]?.replayUri)) {
  221 + Blank()
  222 + } else {
  223 + this.playOrPauseBtn()
  224 + Text(this.currentTime)
  225 + .fontColor(Color.White)
  226 + .fontWeight(600)
  227 + .fontSize('12fp')
  228 + .margin({
  229 + left: 16
  230 + })
  231 + this.playProgressView()
  232 + Text(this.totalTime)
  233 + .fontColor(Color.White)
  234 + .fontWeight(600)
  235 + .fontSize('12fp')
  236 + .margin({
  237 + right: 16
  238 + })
  239 + }
235 } 240 }
236 if (this.liveDetailsBean?.liveInfo?.liveState == 'running' 241 if (this.liveDetailsBean?.liveInfo?.liveState == 'running'
237 - || this.liveDetailsBean?.liveInfo?.liveState == 'end') { 242 + || (this.liveDetailsBean?.liveInfo?.liveState == 'end' &&
  243 + StringUtils.isNotEmpty(this.liveDetailsBean?.liveInfo?.vlive[0]?.replayUri))
  244 + ) {
238 Image($r('app.media.icon_live_player_full_screen')) 245 Image($r('app.media.icon_live_player_full_screen'))
239 .width(24) 246 .width(24)
240 .height(24) 247 .height(24)
241 .onClick(() => { 248 .onClick(() => {
242 - this.displayDirection = this.displayDirection == DisplayDirection.VERTICAL ? DisplayDirection.VIDEO_HORIZONTAL : DisplayDirection.VERTICAL 249 + this.displayDirection =
  250 + this.displayDirection == DisplayDirection.VERTICAL ? DisplayDirection.VIDEO_HORIZONTAL :
  251 + DisplayDirection.VERTICAL
243 WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ? 252 WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
244 window.Orientation.PORTRAIT : 253 window.Orientation.PORTRAIT :
245 window.Orientation.LANDSCAPE_INVERTED) 254 window.Orientation.LANDSCAPE_INVERTED)
1 import { LiveDetailsBean } from 'wdBean/Index'; 1 import { LiveDetailsBean } from 'wdBean/Index';
  2 +import { StringUtils } from 'wdKit/Index';
2 import { WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; 3 import { WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index';
3 import { PlayUIComponent } from './PlayUIComponent'; 4 import { PlayUIComponent } from './PlayUIComponent';
4 5
@@ -8,7 +9,10 @@ export struct TopPlayComponent { @@ -8,7 +9,10 @@ export struct TopPlayComponent {
8 @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean 9 @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean
9 playerController?: WDPlayerController 10 playerController?: WDPlayerController
10 @State imgUrl: string = '' 11 @State imgUrl: string = ''
  12 + //未开始
11 @State isWait: boolean = false 13 @State isWait: boolean = false
  14 + //已结束直播
  15 + @State isEnd: boolean = false
12 16
13 aboutToAppear(): void { 17 aboutToAppear(): void {
14 if (this.playerController) { 18 if (this.playerController) {
@@ -24,6 +28,8 @@ export struct TopPlayComponent { @@ -24,6 +28,8 @@ export struct TopPlayComponent {
24 this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url 28 this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
25 } 29 }
26 this.isWait = this.liveDetailsBean?.liveInfo?.liveState == 'wait' 30 this.isWait = this.liveDetailsBean?.liveInfo?.liveState == 'wait'
  31 + this.isEnd = this.liveDetailsBean?.liveInfo?.liveState === 'end' &&
  32 + StringUtils.isEmpty(this.liveDetailsBean?.liveInfo?.vlive[0]?.replayUri)
27 if (!this.isWait && this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.vlive.length > 0) { 33 if (!this.isWait && this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.vlive.length > 0) {
28 let playUrl = '' 34 let playUrl = ''
29 if (this.liveDetailsBean.liveInfo.liveState == 'running') { 35 if (this.liveDetailsBean.liveInfo.liveState == 'running') {
@@ -31,8 +37,10 @@ export struct TopPlayComponent { @@ -31,8 +37,10 @@ export struct TopPlayComponent {
31 } else if (this.liveDetailsBean.liveInfo.liveState == 'end') { 37 } else if (this.liveDetailsBean.liveInfo.liveState == 'end') {
32 playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri 38 playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri
33 } 39 }
34 - this.playerController?.firstPlay(playUrl);  
35 // this.playerController?.firstPlay('https://rmrbcmsonline.peopleapp.com/upload/rmh/video/mp4/202404/1713752415708fb81d0b8f137b.mp4'); 40 // this.playerController?.firstPlay('https://rmrbcmsonline.peopleapp.com/upload/rmh/video/mp4/202404/1713752415708fb81d0b8f137b.mp4');
  41 + if (StringUtils.isNotEmpty(playUrl)) {
  42 + this.playerController?.firstPlay(playUrl);
  43 + }
36 } 44 }
37 } 45 }
38 46
@@ -48,10 +56,18 @@ export struct TopPlayComponent { @@ -48,10 +56,18 @@ export struct TopPlayComponent {
48 .visibility(this.isWait ? Visibility.None : Visibility.Visible) 56 .visibility(this.isWait ? Visibility.None : Visibility.Visible)
49 Image(this.imgUrl) 57 Image(this.imgUrl)
50 .objectFit(ImageFit.Contain) 58 .objectFit(ImageFit.Contain)
51 - .visibility(this.isWait ? Visibility.Visible : Visibility.None) 59 + .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None)
  60 + .contrast(this.isEnd ? 0.2 : 1)
52 PlayUIComponent({ playerController: this.playerController }) 61 PlayUIComponent({ playerController: this.playerController })
  62 + Text('直播已结束')
  63 + .fontSize('20fp')
  64 + .fontWeight(500)
  65 + .fontColor(Color.White)
  66 + .visibility(this.isEnd ? Visibility.Visible :
  67 + Visibility.None)
53 } 68 }
54 .width('100%') 69 .width('100%')
  70 + .alignSelf(ItemAlign.Center)
55 } 71 }
56 72
57 aboutToDisappear(): void { 73 aboutToDisappear(): void {
@@ -101,7 +101,7 @@ export struct VideoChannelDetail { @@ -101,7 +101,7 @@ export struct VideoChannelDetail {
101 openFullScreen() { 101 openFullScreen() {
102 WindowModel.shared.setWindowSystemBarProperties({ 102 WindowModel.shared.setWindowSystemBarProperties({
103 statusBarContentColor: '#ffffff', 103 statusBarContentColor: '#ffffff',
104 - statusBarColor: '#000000', 104 + // statusBarColor: '#000000',
105 // navigationBarColor: '#000000', 105 // navigationBarColor: '#000000',
106 // navigationBarContentColor: '#ffffff' 106 // navigationBarContentColor: '#ffffff'
107 }) 107 })
@@ -116,7 +116,7 @@ export struct VideoChannelDetail { @@ -116,7 +116,7 @@ export struct VideoChannelDetail {
116 closeFullScreen() { 116 closeFullScreen() {
117 WindowModel.shared.setWindowSystemBarProperties({ 117 WindowModel.shared.setWindowSystemBarProperties({
118 statusBarContentColor: '#000000', 118 statusBarContentColor: '#000000',
119 - statusBarColor: '#ffffff', 119 + // statusBarColor: '#ffffff',
120 // navigationBarColor: '#0x66000000', 120 // navigationBarColor: '#0x66000000',
121 // navigationBarContentColor: '#0xE5FFFFFF' 121 // navigationBarContentColor: '#0xE5FFFFFF'
122 122
@@ -170,7 +170,7 @@ export struct PlayerRightView { @@ -170,7 +170,7 @@ export struct PlayerRightView {
170 .width(58) 170 .width(58)
171 .position({ x: '100%', y: '100%' }) 171 .position({ x: '100%', y: '100%' })
172 .markAnchor({ x: '100%', y: '100%' }) 172 .markAnchor({ x: '100%', y: '100%' })
173 - .padding({ bottom: 72, right: 10 }) 173 + .padding({ bottom: 0, right: 10 })
174 .visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible) 174 .visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible)
175 175
176 } 176 }
@@ -229,7 +229,8 @@ export struct PlayerRightView { @@ -229,7 +229,8 @@ export struct PlayerRightView {
229 } 229 }
230 } else if (this.likesStyle === 3) { 230 } else if (this.likesStyle === 3) {
231 return { 231 return {
232 - url: this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_candle_check`) : $r(`app.media.ic_candle_uncheck`), 232 + url: this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_candle_check`) :
  233 + $r(`app.media.ic_candle_uncheck`),
233 name: '默哀' 234 name: '默哀'
234 } 235 }
235 } 236 }
@@ -239,13 +240,17 @@ export struct PlayerRightView { @@ -239,13 +240,17 @@ export struct PlayerRightView {
239 } 240 }
240 241
241 transNum2String(name: 'likeNum' | 'collectNum' | 'commentNum') { 242 transNum2String(name: 'likeNum' | 'collectNum' | 'commentNum') {
242 - console.log(TAG, 'transNum2String', this.interactData.likeNum, this.interactData.collectNum, this.interactData.commentNum) 243 + console.log(TAG, 'transNum2String', this.interactData.likeNum, this.interactData.collectNum,
  244 + this.interactData.commentNum)
243 if (name === 'likeNum') { 245 if (name === 'likeNum') {
244 - return this.interactData.likeNum != 0 ? NumberFormatterUtils.formatNumberWithWan(this.interactData.likeNum || '') : '' 246 + return this.interactData.likeNum != 0 ?
  247 + NumberFormatterUtils.formatNumberWithWan(this.interactData.likeNum || '') : ''
245 } else if (name === 'collectNum') { 248 } else if (name === 'collectNum') {
246 - return this.interactData.collectNum != 0 ? NumberFormatterUtils.formatNumberWithWan(this.interactData.collectNum || '') : '' 249 + return this.interactData.collectNum != 0 ?
  250 + NumberFormatterUtils.formatNumberWithWan(this.interactData.collectNum || '') : ''
247 } else { 251 } else {
248 - return this.interactData.commentNum != 0 ? NumberFormatterUtils.formatNumberWithWan(this.interactData.commentNum || '') : '' 252 + return this.interactData.commentNum != 0 ?
  253 + NumberFormatterUtils.formatNumberWithWan(this.interactData.commentNum || '') : ''
249 } 254 }
250 } 255 }
251 256
@@ -282,7 +287,8 @@ export struct PlayerRightView { @@ -282,7 +287,8 @@ export struct PlayerRightView {
282 @Builder 287 @Builder
283 collectBuilderView() { 288 collectBuilderView() {
284 Column() { 289 Column() {
285 - Image(this.newsStatusOfUser.collectStatus == 1 ? $r(`app.media.ic_collect_check`) : $r(`app.media.ic_collect_uncheck`)) 290 + Image(this.newsStatusOfUser.collectStatus == 1 ? $r(`app.media.ic_collect_check`) :
  291 + $r(`app.media.ic_collect_uncheck`))
286 .width(32) 292 .width(32)
287 .aspectRatio(1) 293 .aspectRatio(1)
288 .onClick(() => { 294 .onClick(() => {
@@ -25,7 +25,7 @@ export struct PlayerTitleComment { @@ -25,7 +25,7 @@ export struct PlayerTitleComment {
25 name: this.getName(), 25 name: this.getName(),
26 title: this.getTitle(), 26 title: this.getTitle(),
27 summary: this.getSummary(), 27 summary: this.getSummary(),
28 - isOpen: this.isOpen 28 + isOpenDetail: this.isOpen
29 29
30 }), 30 }),
31 autoCancel: false, 31 autoCancel: false,
@@ -164,9 +164,12 @@ export struct PlayerTitleComment { @@ -164,9 +164,12 @@ export struct PlayerTitleComment {
164 step: 0.01, 164 step: 0.01,
165 // style: SliderStyle.OutSet 165 // style: SliderStyle.OutSet
166 }) 166 })
167 - .blockColor(this.status === PlayerConstants.STATUS_START ? Color.Transparent : $r('app.color.play_block_color'))  
168 - .trackColor(this.status === PlayerConstants.STATUS_START ? $r('app.color.play_track_color') : $r('app.color.pause_track_color'))  
169 - .selectedColor(this.status === PlayerConstants.STATUS_START ? $r('app.color.play_selected_color') : $r('app.color.pause_selected_color')) 167 + .blockColor(this.status === PlayerConstants.STATUS_START ? Color.Transparent :
  168 + $r('app.color.play_block_color'))
  169 + .trackColor(this.status === PlayerConstants.STATUS_START ? $r('app.color.play_track_color') :
  170 + $r('app.color.pause_track_color'))
  171 + .selectedColor(this.status === PlayerConstants.STATUS_START ? $r('app.color.play_selected_color') :
  172 + $r('app.color.pause_selected_color'))
170 .trackThickness(this.status === PlayerConstants.STATUS_START ? 1 : 4) 173 .trackThickness(this.status === PlayerConstants.STATUS_START ? 1 : 4)
171 .blockStyle({ 174 .blockStyle({
172 type: this.status === PlayerConstants.STATUS_START ? SliderBlockType.DEFAULT : SliderBlockType.IMAGE, 175 type: this.status === PlayerConstants.STATUS_START ? SliderBlockType.DEFAULT : SliderBlockType.IMAGE,
@@ -202,7 +205,12 @@ export struct PlayerTitleComment { @@ -202,7 +205,12 @@ export struct PlayerTitleComment {
202 .margin({ left: 12 }) 205 .margin({ left: 12 })
203 } 206 }
204 .alignItems(VerticalAlign.Center) 207 .alignItems(VerticalAlign.Center)
205 - .padding({ left: 16, right: 16, top: 11, bottom: 11 }) 208 + .padding({
  209 + left: 16,
  210 + right: 16,
  211 + top: 11,
  212 + bottom: 11
  213 + })
206 } 214 }
207 215
208 } 216 }
@@ -47,7 +47,7 @@ export struct PlayerTitleView { @@ -47,7 +47,7 @@ export struct PlayerTitleView {
47 fontSize: 15, 47 fontSize: 15,
48 fontWeight: 400, 48 fontWeight: 400,
49 lineHeight: 20, 49 lineHeight: 20,
50 - constraintWidth: this.windowWidth - 100 - 16 - 22 + 'px', 50 + constraintWidth: this.windowWidth - 150 - 16 - 22 + 'px',
51 51
52 }) 52 })
53 this.titleHeight = info?.height as number || 0 53 this.titleHeight = info?.height as number || 0
@@ -87,7 +87,12 @@ export struct PlayerTitleView { @@ -87,7 +87,12 @@ export struct PlayerTitleView {
87 */ 87 */
88 if (this.titleHeight > 200 || this.getSummary()) { 88 if (this.titleHeight > 200 || this.getSummary()) {
89 Text('查看详情 > ') 89 Text('查看详情 > ')
90 - .padding({ left: 6, right: 6, top: 4, bottom: 4 }) 90 + .padding({
  91 + left: 6,
  92 + right: 6,
  93 + top: 4,
  94 + bottom: 4
  95 + })
91 .borderRadius(2) 96 .borderRadius(2)
92 .backgroundColor('#99636363') 97 .backgroundColor('#99636363')
93 .fontColor(Color.White) 98 .fontColor(Color.White)
@@ -102,7 +107,7 @@ export struct PlayerTitleView { @@ -102,7 +107,7 @@ export struct PlayerTitleView {
102 } 107 }
103 108
104 } 109 }
105 - .width(this.windowWidth - 100 + 'px') 110 + .width(this.windowWidth - 150 + 'px')
106 .padding({ left: 16, right: 22 }) 111 .padding({ left: 16, right: 22 })
107 .alignItems(HorizontalAlign.Start) 112 .alignItems(HorizontalAlign.Start)
108 .visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible) 113 .visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible)
@@ -62,7 +62,7 @@ export class HWLocationUtils { @@ -62,7 +62,7 @@ export class HWLocationUtils {
62 if (requestGrant) { 62 if (requestGrant) {
63 HWLocationUtils.getCurrentLocation() 63 HWLocationUtils.getCurrentLocation()
64 } else { 64 } else {
65 - PermissionUtils.openPermissionsInSystemSettings(context) 65 + // PermissionUtils.openPermissionsInSystemSettings(context)
66 } 66 }
67 } 67 }
68 68
@@ -2,11 +2,10 @@ import { Logger } from 'wdKit/src/main/ets/utils/Logger' @@ -2,11 +2,10 @@ import { Logger } from 'wdKit/src/main/ets/utils/Logger'
2 import { LoginInputComponent } from './LoginInputComponent' 2 import { LoginInputComponent } from './LoginInputComponent'
3 import { LoginViewModel } from './LoginViewModel' 3 import { LoginViewModel } from './LoginViewModel'
4 import router from '@ohos.router' 4 import router from '@ohos.router'
5 -import promptAction from '@ohos.promptAction'  
6 import { WDRouterRule, WDRouterPage } from 'wdRouter'; 5 import { WDRouterRule, WDRouterPage } from 'wdRouter';
7 import { SettingPasswordParams } from './SettingPasswordLayout' 6 import { SettingPasswordParams } from './SettingPasswordLayout'
8 import { Router } from '@ohos.arkui.UIContext' 7 import { Router } from '@ohos.arkui.UIContext'
9 -import { EmitterEventId, EmitterUtils, SPHelper, ToastUtils } from 'wdKit/Index' 8 +import { CustomToast, EmitterEventId, EmitterUtils, SPHelper, ToastUtils } from 'wdKit/Index'
10 import { SpConstants } from 'wdConstant/Index' 9 import { SpConstants } from 'wdConstant/Index'
11 import { emitter } from '@kit.BasicServicesKit' 10 import { emitter } from '@kit.BasicServicesKit'
12 11
@@ -31,6 +30,18 @@ struct ForgetPasswordPage { @@ -31,6 +30,18 @@ struct ForgetPasswordPage {
31 this.sendVerifyCode() 30 this.sendVerifyCode()
32 } 31 }
33 } 32 }
  33 + @State toastText:string = ""
  34 + dialogToast: CustomDialogController = new CustomDialogController({
  35 + builder: CustomToast({
  36 + msg: this.toastText,
  37 + }),
  38 + autoCancel: false,
  39 + alignment: DialogAlignment.Center,
  40 + offset: { dx: 0, dy: -20 },
  41 + gridCount: 1,
  42 + customStyle: true,
  43 + maskColor:"#00000000"
  44 + })
34 45
35 46
36 47
@@ -100,11 +111,11 @@ struct ForgetPasswordPage { @@ -100,11 +111,11 @@ struct ForgetPasswordPage {
100 111
101 if(this.pageType == 1){ 112 if(this.pageType == 1){
102 this.loginViewModel.sendVerifyCodeByToken().then(()=>{ 113 this.loginViewModel.sendVerifyCodeByToken().then(()=>{
103 - promptAction.showToast({ message: "已发送" }) 114 + this.showToastTip("已发送")
104 this.codeStateSuccess=true 115 this.codeStateSuccess=true
105 this.isCodeSend=false 116 this.isCodeSend=false
106 }).catch((message: string)=>{ 117 }).catch((message: string)=>{
107 - promptAction.showToast({ message: message }) 118 + this.showToastTip(message)
108 this.codeStateSuccess=false 119 this.codeStateSuccess=false
109 this.isCodeSend=false 120 this.isCodeSend=false
110 }) 121 })
@@ -112,12 +123,12 @@ struct ForgetPasswordPage { @@ -112,12 +123,12 @@ struct ForgetPasswordPage {
112 } 123 }
113 124
114 this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => { 125 this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => {
115 - promptAction.showToast({ message: "已发送" }) 126 + this.showToastTip("已发送")
116 this.codeStateSuccess=true 127 this.codeStateSuccess=true
117 this.isCodeSend=false 128 this.isCodeSend=false
118 Logger.debug(TAG, "sendVerifyCode: " + verifyCode) 129 Logger.debug(TAG, "sendVerifyCode: " + verifyCode)
119 }).catch((message: string)=>{ 130 }).catch((message: string)=>{
120 - promptAction.showToast({ message: message }) 131 + this.showToastTip(message)
121 this.codeStateSuccess=false 132 this.codeStateSuccess=false
122 this.isCodeSend=false 133 this.isCodeSend=false
123 }) 134 })
@@ -146,7 +157,7 @@ struct ForgetPasswordPage { @@ -146,7 +157,7 @@ struct ForgetPasswordPage {
146 } 157 }
147 WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params) 158 WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params)
148 }).catch((message: string)=>{ 159 }).catch((message: string)=>{
149 - promptAction.showToast({ message: message }) 160 + this.showToastTip(message)
150 }) 161 })
151 return 162 return
152 } 163 }
@@ -159,10 +170,10 @@ struct ForgetPasswordPage { @@ -159,10 +170,10 @@ struct ForgetPasswordPage {
159 } 170 }
160 WDRouterRule.jumpWithReplacePage(WDRouterPage.settingPasswordPage, params) 171 WDRouterRule.jumpWithReplacePage(WDRouterPage.settingPasswordPage, params)
161 172
162 - promptAction.showToast({message:"校验成功,准备跳转设置页面"}) 173 + this.showToastTip("校验成功,准备跳转设置页面")
163 Logger.debug(TAG,"校验成功") 174 Logger.debug(TAG,"校验成功")
164 }).catch((error:string)=>{ 175 }).catch((error:string)=>{
165 - promptAction.showToast({message:error}) 176 + this.showToastTip(error)
166 Logger.debug(TAG,"校验失败") 177 Logger.debug(TAG,"校验失败")
167 }) 178 })
168 } 179 }
@@ -217,4 +228,9 @@ struct ForgetPasswordPage { @@ -217,4 +228,9 @@ struct ForgetPasswordPage {
217 // 发送eventId为1的事件,事件内容为eventData 228 // 发送eventId为1的事件,事件内容为eventData
218 emitter.emit(event, eventData); 229 emitter.emit(event, eventData);
219 } 230 }
  231 +
  232 + showToastTip(msg:string){
  233 + this.toastText = msg
  234 + this.dialogToast.open()
  235 + }
220 } 236 }
@@ -22,13 +22,13 @@ export struct LoginInputComponent { @@ -22,13 +22,13 @@ export struct LoginInputComponent {
22 async aboutToAppear(){ 22 async aboutToAppear(){
23 if (this.pageType == 1) { 23 if (this.pageType == 1) {
24 this.phoneContent = await SPHelper.default.get(SpConstants.USER_PHONE,"") as string; 24 this.phoneContent = await SPHelper.default.get(SpConstants.USER_PHONE,"") as string;
25 - Logger.debug("ddd")  
26 } 25 }
27 } 26 }
28 @Builder 27 @Builder
29 addCodeLayout() { 28 addCodeLayout() {
30 if (this.pageType == 1){ 29 if (this.pageType == 1){
31 TextInput({ placeholder: this.securityPhone(this.phoneContent) }) 30 TextInput({ placeholder: this.securityPhone(this.phoneContent) })
  31 + .placeholderColor("#CCCCCC")
32 .fontSize(16) 32 .fontSize(16)
33 .height(48) 33 .height(48)
34 .maxLength(11) 34 .maxLength(11)
@@ -47,9 +47,10 @@ export struct LoginInputComponent { @@ -47,9 +47,10 @@ export struct LoginInputComponent {
47 } 47 }
48 }) 48 })
49 }else{ 49 }else{
50 - TextInput({ placeholder: "请输入手机号" }) 50 + TextInput({text: this.phoneContent, placeholder: "请输入手机号" })
51 .fontSize(16) 51 .fontSize(16)
52 .height(48) 52 .height(48)
  53 + .placeholderColor("#CCCCCC")
53 .maxLength(11) 54 .maxLength(11)
54 .margin({ top: 36 }) 55 .margin({ top: 36 })
55 .backgroundColor("#F5F5F5") 56 .backgroundColor("#F5F5F5")
@@ -68,7 +69,8 @@ export struct LoginInputComponent { @@ -68,7 +69,8 @@ export struct LoginInputComponent {
68 69
69 70
70 Row() { 71 Row() {
71 - TextInput({ placeholder: "验证码" }) 72 + TextInput({ text: this.codeContent,placeholder: "验证码" })
  73 + .placeholderColor("#CCCCCC")
72 .layoutWeight(1) 74 .layoutWeight(1)
73 .fontSize(16) 75 .fontSize(16)
74 .height(48) 76 .height(48)
1 -import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils } from 'wdKit' 1 +import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils,CustomToast, StringUtils } from 'wdKit'
2 import { CustomProtocolDialog } from './CustomProtocolDialog' 2 import { CustomProtocolDialog } from './CustomProtocolDialog'
3 import router from '@ohos.router' 3 import router from '@ohos.router'
4 import { LoginViewModel } from './LoginViewModel' 4 import { LoginViewModel } from './LoginViewModel'
5 import { LoginInputComponent } from './LoginInputComponent' 5 import { LoginInputComponent } from './LoginInputComponent'
6 -import promptAction from '@ohos.promptAction'  
7 import { ErrorToastUtils, SPHelper } from 'wdKit' 6 import { ErrorToastUtils, SPHelper } from 'wdKit'
8 import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage'; 7 import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage';
9 import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule'; 8 import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule';
@@ -39,14 +38,26 @@ struct LoginPage { @@ -39,14 +38,26 @@ struct LoginPage {
39 @State phoneContent: string = "" //手机号 38 @State phoneContent: string = "" //手机号
40 @State codeContent: string = "" //验证码 39 @State codeContent: string = "" //验证码
41 @State protocolState: boolean = false //协议勾选状态 40 @State protocolState: boolean = false //协议勾选状态
42 - accountContent = '' //账号  
43 - passwordContent = '' 41 + @State accountContent: string = '' //账号
  42 + @State passwordContent: string = ''
44 @State isSubmit: boolean = false 43 @State isSubmit: boolean = false
45 @State checkCodePage: boolean = true //判断是否是验证码页面 默认验证码登录 44 @State checkCodePage: boolean = true //判断是否是验证码页面 默认验证码登录
46 @State passwordSwitch: boolean = true //密码显示 45 @State passwordSwitch: boolean = true //密码显示
47 // @State isPasswordSubmit: boolean = false //账户密码状态 是否出发登录 46 // @State isPasswordSubmit: boolean = false //账户密码状态 是否出发登录
48 lastTime: number = 0 47 lastTime: number = 0
49 @State codeStateSuccess:boolean=false 48 @State codeStateSuccess:boolean=false
  49 + @State toastText:string = ""
  50 + dialogToast: CustomDialogController = new CustomDialogController({
  51 + builder: CustomToast({
  52 + msg: this.toastText,
  53 + }),
  54 + autoCancel: false,
  55 + alignment: DialogAlignment.Center,
  56 + offset: { dx: 0, dy: -20 },
  57 + gridCount: 1,
  58 + customStyle: true,
  59 + maskColor:"#00000000"
  60 + })
50 61
51 dialogController: CustomDialogController = new CustomDialogController({ 62 dialogController: CustomDialogController = new CustomDialogController({
52 builder: CustomProtocolDialog({ 63 builder: CustomProtocolDialog({
@@ -202,8 +213,9 @@ struct LoginPage { @@ -202,8 +213,9 @@ struct LoginPage {
202 @Builder 213 @Builder
203 addPassword() { 214 addPassword() {
204 Column() { 215 Column() {
205 - TextInput({ placeholder: "请输入账号", controller: this.phoneController }) 216 + TextInput({ text: this.accountContent,placeholder: "请输入账号", controller: this.phoneController })
206 .fontSize(16) 217 .fontSize(16)
  218 + .placeholderColor("#CCCCCC")
207 .height(48) 219 .height(48)
208 .backgroundColor("#F5F5F5") 220 .backgroundColor("#F5F5F5")
209 .borderRadius(4) 221 .borderRadius(4)
@@ -243,6 +255,7 @@ struct LoginPage { @@ -243,6 +255,7 @@ struct LoginPage {
243 @Builder 255 @Builder
244 addPasswordInputLayout() { 256 addPasswordInputLayout() {
245 TextInput({ placeholder: "请输入密码", text: this.passwordContent }) 257 TextInput({ placeholder: "请输入密码", text: this.passwordContent })
  258 + .placeholderColor("#CCCCCC")
246 .layoutWeight(1) 259 .layoutWeight(1)
247 .fontSize(16) 260 .fontSize(16)
248 .height(48) 261 .height(48)
@@ -299,8 +312,8 @@ struct LoginPage { @@ -299,8 +312,8 @@ struct LoginPage {
299 .size({ width: 20, height: 20 }) 312 .size({ width: 20, height: 20 })
300 }.backgroundImage($r('app.media.login_other_right'), ImageRepeat.NoRepeat) 313 }.backgroundImage($r('app.media.login_other_right'), ImageRepeat.NoRepeat)
301 .otherStyle().onClick(() => { 314 .otherStyle().onClick(() => {
  315 + this.updateAccount()
302 this.checkCodePage = !this.checkCodePage; 316 this.checkCodePage = !this.checkCodePage;
303 - this.passwordContent = ''  
304 this.passwordSwitch = true 317 this.passwordSwitch = true
305 this.isSubmit = false 318 this.isSubmit = false
306 }) 319 })
@@ -313,15 +326,29 @@ struct LoginPage { @@ -313,15 +326,29 @@ struct LoginPage {
313 }.width('100%').margin({ bottom: 40 }) 326 }.width('100%').margin({ bottom: 40 })
314 } 327 }
315 328
  329 + updateAccount(){
  330 + if(this.checkCodePage){
  331 + //验证码切换 密码
  332 + if(StringUtils.photoMatch(this.phoneContent)){
  333 + this.accountContent = this.phoneContent
  334 + }
  335 + }else{
  336 + //密码切换 验证码
  337 + if(StringUtils.photoMatch(this.accountContent)){
  338 + this.phoneContent = this.accountContent
  339 + }
  340 + }
  341 + }
  342 +
316 //发送验证码 343 //发送验证码
317 sendVerifyCode() { 344 sendVerifyCode() {
318 this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => { 345 this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => {
319 - promptAction.showToast({ message: "已发送" }) 346 + this.showToastTip("已发送")
320 Logger.debug(TAG, "sendVerifyCode: " + verifyCode) 347 Logger.debug(TAG, "sendVerifyCode: " + verifyCode)
321 this.codeStateSuccess=true 348 this.codeStateSuccess=true
322 this.isCodeSend=false 349 this.isCodeSend=false
323 }).catch((message:string)=>{ 350 }).catch((message:string)=>{
324 - promptAction.showToast({ message: message }) 351 + this.showToastTip(message)
325 this.codeStateSuccess=false 352 this.codeStateSuccess=false
326 this.isCodeSend=false 353 this.isCodeSend=false
327 Logger.debug(TAG, "sendVerifyCode: " + message) 354 Logger.debug(TAG, "sendVerifyCode: " + message)
@@ -339,12 +366,13 @@ struct LoginPage { @@ -339,12 +366,13 @@ struct LoginPage {
339 this.queryUserDetail() 366 this.queryUserDetail()
340 EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) 367 EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION)
341 }).catch((error:string)=>{ 368 }).catch((error:string)=>{
342 - promptAction.showToast({ message: error }) 369 + this.showToastTip(error)
343 }) 370 })
344 } else { 371 } else {
345 this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => { 372 this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => {
346 Logger.debug(TAG, "requestLogin: " + data.jwtToken) 373 Logger.debug(TAG, "requestLogin: " + data.jwtToken)
347 - promptAction.showToast({ message: '登录成功' }) 374 + this.showToastTip('登录成功')
  375 +
348 ///同步兴趣tag 376 ///同步兴趣tag
349 let interestsModel = new InterestsHobbiesModel() 377 let interestsModel = new InterestsHobbiesModel()
350 interestsModel.updateInterests() 378 interestsModel.updateInterests()
@@ -357,12 +385,17 @@ struct LoginPage { @@ -357,12 +385,17 @@ struct LoginPage {
357 // url: `${WDRouterPage.getBundleInfo()}` 385 // url: `${WDRouterPage.getBundleInfo()}`
358 // }) 386 // })
359 }).catch((value: string) => { 387 }).catch((value: string) => {
360 - promptAction.showToast({ message: value }) 388 + this.showToastTip(value)
361 }) 389 })
362 } 390 }
363 391
364 } 392 }
365 393
  394 + showToastTip(msg:string){
  395 + this.toastText = msg
  396 + this.dialogToast.open()
  397 + }
  398 +
366 queryUserDetail(){ 399 queryUserDetail(){
367 this.loginViewModel.queryUserDetail().then(()=>{ 400 this.loginViewModel.queryUserDetail().then(()=>{
368 router.back({ 401 router.back({
@@ -490,4 +523,4 @@ struct ProtocolComponent { @@ -490,4 +523,4 @@ struct ProtocolComponent {
490 .backgroundColor('#66000000') 523 .backgroundColor('#66000000')
491 524
492 } 525 }
493 -}  
  526 +}
@@ -16,11 +16,15 @@ struct LoginProtocolWebview { @@ -16,11 +16,15 @@ struct LoginProtocolWebview {
16 privateProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1001.html' 16 privateProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1001.html'
17 logoutProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1003.html' 17 logoutProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1003.html'
18 huaweiAuthProtocol = 'https://privacy.consumer.huawei.com/legal/id/authentication-terms.htm?code=CN&language=zh-CN' 18 huaweiAuthProtocol = 'https://privacy.consumer.huawei.com/legal/id/authentication-terms.htm?code=CN&language=zh-CN'
  19 + @State contentID:string = "0"
19 20
20 async aboutToAppear() { 21 async aboutToAppear() {
21 if (router.getParams()) { 22 if (router.getParams()) {
22 let params = router.getParams() as Params 23 let params = router.getParams() as Params
23 Logger.info(TAG, 'params.contentID:' + params.contentID); 24 Logger.info(TAG, 'params.contentID:' + params.contentID);
  25 + if(params.contentID != undefined){
  26 + this.contentID = params.contentID
  27 + }
24 if (params.contentID == "1") { //"人民日报客户端网络服务使用协议" 28 if (params.contentID == "1") { //"人民日报客户端网络服务使用协议"
25 this.webUrl = await SPHelper.default.get(SpConstants.NET_SERVICE_PROTOCOL, this.userProtocol) as string 29 this.webUrl = await SPHelper.default.get(SpConstants.NET_SERVICE_PROTOCOL, this.userProtocol) as string
26 this.webviewController.loadUrl(this.webUrl) 30 this.webviewController.loadUrl(this.webUrl)
@@ -71,6 +75,7 @@ struct LoginProtocolWebview { @@ -71,6 +75,7 @@ struct LoginProtocolWebview {
71 Logger.info(TAG, 'onHttpErrorReceive event.request.getRequestUrl:' + event?.request.getRequestUrl()); 75 Logger.info(TAG, 'onHttpErrorReceive event.request.getRequestUrl:' + event?.request.getRequestUrl());
72 Logger.info(TAG, 'onHttpErrorReceive event.response.getResponseCode:' + event?.response.getResponseCode()); 76 Logger.info(TAG, 'onHttpErrorReceive event.response.getResponseCode:' + event?.response.getResponseCode());
73 }) 77 })
  78 + .padding({bottom:this.contentID === "2" ? "40lpx" : 0 })
74 } 79 }
75 } 80 }
76 } 81 }
1 import ArrayList from '@ohos.util.ArrayList'; 1 import ArrayList from '@ohos.util.ArrayList';
2 -import promptAction from '@ohos.promptAction';  
3 import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index'; 2 import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index';
4 import router from '@ohos.router'; 3 import router from '@ohos.router';
5 import { LoginViewModel } from './LoginViewModel'; 4 import { LoginViewModel } from './LoginViewModel';
6 -import { Logger, SPHelper, ToastUtils } from 'wdKit'; 5 +import { CustomToast, Logger, SPHelper, ToastUtils } from 'wdKit';
7 import { 6 import {
8 SpConstants 7 SpConstants
9 } from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants' 8 } from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants'
@@ -58,6 +57,19 @@ export struct SettingPasswordLayout { @@ -58,6 +57,19 @@ export struct SettingPasswordLayout {
58 loginViewModel = new LoginViewModel() 57 loginViewModel = new LoginViewModel()
59 pageType?:number; //0、登录->忘记密码 1、设置->重置密码 2、设置->更换手机 58 pageType?:number; //0、登录->忘记密码 1、设置->重置密码 2、设置->更换手机
60 59
  60 + @State toastText:string = ""
  61 + dialogToast: CustomDialogController = new CustomDialogController({
  62 + builder: CustomToast({
  63 + msg: this.toastText,
  64 + }),
  65 + autoCancel: false,
  66 + alignment: DialogAlignment.Center,
  67 + offset: { dx: 0, dy: -20 },
  68 + gridCount: 1,
  69 + customStyle: true,
  70 + maskColor:"#00000000"
  71 + })
  72 +
61 aboutToAppear() { 73 aboutToAppear() {
62 let params:SettingPasswordParams = router.getParams() as SettingPasswordParams; 74 let params:SettingPasswordParams = router.getParams() as SettingPasswordParams;
63 this.pageId = parseInt(params.pageID); 75 this.pageId = parseInt(params.pageID);
@@ -187,6 +199,7 @@ export struct SettingPasswordLayout { @@ -187,6 +199,7 @@ export struct SettingPasswordLayout {
187 Row() { 199 Row() {
188 Row() { 200 Row() {
189 TextInput({ placeholder: item.inputPlacholder }) 201 TextInput({ placeholder: item.inputPlacholder })
  202 + .placeholderColor("#CCCCCC")
190 .type(InputType.Password) 203 .type(InputType.Password)
191 .showPasswordIcon(true) 204 .showPasswordIcon(true)
192 .backgroundColor('#00000000') 205 .backgroundColor('#00000000')
@@ -194,7 +207,7 @@ export struct SettingPasswordLayout { @@ -194,7 +207,7 @@ export struct SettingPasswordLayout {
194 this.inputTextChange(value, item.inputTag) 207 this.inputTextChange(value, item.inputTag)
195 }) 208 })
196 .onSubmit((EnterKeyType) => { 209 .onSubmit((EnterKeyType) => {
197 - promptAction.showToast({ message: 'submit' }) 210 + this.showToastTip('submit')
198 }) 211 })
199 } 212 }
200 .alignItems(VerticalAlign.Center) 213 .alignItems(VerticalAlign.Center)
@@ -213,12 +226,13 @@ export struct SettingPasswordLayout { @@ -213,12 +226,13 @@ export struct SettingPasswordLayout {
213 Row() { 226 Row() {
214 Row() { 227 Row() {
215 TextInput({ placeholder: item.inputPlacholder }) 228 TextInput({ placeholder: item.inputPlacholder })
  229 + .placeholderColor("#CCCCCC")
216 .backgroundColor('#00000000') 230 .backgroundColor('#00000000')
217 .onChange((value: string) => { 231 .onChange((value: string) => {
218 this.inputTextChange(value, item.inputTag) 232 this.inputTextChange(value, item.inputTag)
219 }) 233 })
220 .onSubmit((EnterKeyType) => { 234 .onSubmit((EnterKeyType) => {
221 - promptAction.showToast({ message: 'submit' }) 235 + this.showToastTip('submit')
222 }) 236 })
223 } 237 }
224 .alignItems(VerticalAlign.Center) 238 .alignItems(VerticalAlign.Center)
@@ -239,6 +253,7 @@ export struct SettingPasswordLayout { @@ -239,6 +253,7 @@ export struct SettingPasswordLayout {
239 Image($r('app.media.get_code_bg')).width('100%').borderRadius('4vp') 253 Image($r('app.media.get_code_bg')).width('100%').borderRadius('4vp')
240 Row() { 254 Row() {
241 TextInput({ placeholder: item.inputPlacholder }) 255 TextInput({ placeholder: item.inputPlacholder })
  256 + .placeholderColor("#CCCCCC")
242 .backgroundColor('#00000000') 257 .backgroundColor('#00000000')
243 .width('67.28%') 258 .width('67.28%')
244 .onChange((value: string) => { 259 .onChange((value: string) => {
@@ -264,7 +279,7 @@ export struct SettingPasswordLayout { @@ -264,7 +279,7 @@ export struct SettingPasswordLayout {
264 Text(item.compDesc).fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'}) 279 Text(item.compDesc).fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'})
265 .onClick(()=>{ 280 .onClick(()=>{
266 if (item.compDesc == '忘记密码') { 281 if (item.compDesc == '忘记密码') {
267 - promptAction.showToast({ message: '密码不符合密码规范' }) 282 + this.showToastTip('密码不符合密码规范')
268 } 283 }
269 }) 284 })
270 } 285 }
@@ -307,11 +322,11 @@ export struct SettingPasswordLayout { @@ -307,11 +322,11 @@ export struct SettingPasswordLayout {
307 if (this.btnStatus) { 322 if (this.btnStatus) {
308 // 需要+手机号校验 323 // 需要+手机号校验
309 if (this.password01.length < 6 || this.password01.length > 20) { 324 if (this.password01.length < 6 || this.password01.length > 20) {
310 - promptAction.showToast({ message: '密码不符合密码规范' }) 325 + this.showToastTip('密码不符合密码规范')
311 return 326 return
312 } 327 }
313 if (this.password01 != this.password02) { 328 if (this.password01 != this.password02) {
314 - promptAction.showToast({ message: '密码不一致' }) 329 + this.showToastTip('密码不一致')
315 return 330 return
316 } 331 }
317 if(this.pageId == 1){ //设置密码 332 if(this.pageId == 1){ //设置密码
@@ -339,7 +354,6 @@ export struct SettingPasswordLayout { @@ -339,7 +354,6 @@ export struct SettingPasswordLayout {
339 Logger.error(TAG, 'catch err:' + JSON.stringify(err)); 354 Logger.error(TAG, 'catch err:' + JSON.stringify(err));
340 }); 355 });
341 } 356 }
342 - // promptAction.showToast({ message: '请求接口' })  
343 } 357 }
344 358
345 359
@@ -363,5 +377,10 @@ export struct SettingPasswordLayout { @@ -363,5 +377,10 @@ export struct SettingPasswordLayout {
363 } 377 }
364 } 378 }
365 } 379 }
  380 +
  381 + showToastTip(msg:string){
  382 + this.toastText = msg
  383 + this.dialogToast.open()
  384 + }
366 } 385 }
367 386
  1 +/node_modules
  2 +/oh_modules
  3 +/.preview
  4 +/build
  5 +/.cxx
  6 +/.test
  1 +export { TrackingModule } from "./src/main/ets/TrackingModule"
  2 +
  3 +export { ParamType } from "./src/main/ets/common/PublicParams"
  4 +export { TrackConstants } from "./src/main/ets/common/TrackConstants"
  5 +export { TrackParamConvert } from "./src/main/ets/common/TrackParamConvert"
  6 +
  7 +export { Tracking } from "./src/main/ets/tracking/Tracking"
  8 +export { TrackingButton } from "./src/main/ets/tracking/TrackingButton"
  9 +export { TrackingContent } from "./src/main/ets/tracking/TrackingContent"
  10 +export { TrackingPageBrowse } from "./src/main/ets/tracking/TrackingPageBrowse"
  11 +export { TrackingPlay } from "./src/main/ets/tracking/TrackingPlay"
  1 +{
  2 + "apiType": "stageMode",
  3 + "buildOption": {
  4 + },
  5 + "buildOptionSet": [
  6 + {
  7 + "name": "release",
  8 + "arkOptions": {
  9 + "obfuscation": {
  10 + "ruleOptions": {
  11 + "enable": true,
  12 + "files": [
  13 + "./obfuscation-rules.txt"
  14 + ]
  15 + }
  16 + }
  17 + },
  18 + },
  19 + ],
  20 + "targets": [
  21 + {
  22 + "name": "default"
  23 + }
  24 + ]
  25 +}
  1 +import { hspTasks } from '@ohos/hvigor-ohos-plugin';
  2 +
  3 +export default {
  4 + system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
  5 + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
  6 +}
  1 +# Define project specific obfuscation rules here.
  2 +# You can include the obfuscation configuration files in the current module's build-profile.json5.
  3 +#
  4 +# For more details, see
  5 +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
  6 +
  7 +# Obfuscation options:
  8 +# -disable-obfuscation: disable all obfuscations
  9 +# -enable-property-obfuscation: obfuscate the property names
  10 +# -enable-toplevel-obfuscation: obfuscate the names in the global scope
  11 +# -compact: remove unnecessary blank spaces and all line feeds
  12 +# -remove-log: remove all console.* statements
  13 +# -print-namecache: print the name cache that contains the mapping from the old names to new names
  14 +# -apply-namecache: reuse the given cache file
  15 +
  16 +# Keep options:
  17 +# -keep-property-name: specifies property names that you want to keep
  18 +# -keep-global-name: specifies names that you want to keep in the global scope
1 -../../../../oh_modules/.ohpm/@sensorsdata+analytics@0.0.2/oh_modules/@sensorsdata/analytics  
  1 +import sensors from '@sensorsdata/analytics';
  2 +import { common } from '@kit.AbilityKit';
  3 +import { HostEnum, HostManager } from 'wdNetwork/Index';
  4 +
  5 +/// 统计埋点模块
  6 +export class TrackingModule {
  7 +
  8 + private static SA_DATA_SERVER_URL_PRODUCT = "https://data.pdnews.cn/sa?project=PDChinese"
  9 + private static SA_DATA_SERVER_URL_TEST = "https://data.pdnews.cn/sa?project=PDChineseTest"
  10 +
  11 + private static _init = false
  12 + static getHasInit() {
  13 + return TrackingModule._init;
  14 + }
  15 +
  16 + /// 初始化
  17 + static startup(context: common.UIAbilityContext) : Promise<void> {
  18 +
  19 + return new Promise((resolve) => {
  20 + const isOnlineEnv = HostManager.getHost() === HostEnum.HOST_PRODUCT
  21 +
  22 + sensors.init({
  23 + //TODO: 服务器接收地址 暂时用测试环境的
  24 + server_url: isOnlineEnv ? TrackingModule.SA_DATA_SERVER_URL_TEST : TrackingModule.SA_DATA_SERVER_URL_TEST,
  25 + // Ability 上下文
  26 + context: context,
  27 + // 是否显示日志
  28 + show_log: true,
  29 + // 是否开启采集位置信息,需要 app 授权,默认 false
  30 + enable_track_location: true,
  31 + // 是否开启批量发送,默认 false
  32 + batch_send: true,
  33 + // 数据发送超时时间
  34 + datasend_timeout: 10000,
  35 + // 开启 App 打通 H5
  36 + app_js_bridge: false
  37 + }).then((inited) => {
  38 + TrackingModule._init = inited
  39 +
  40 + resolve()
  41 + });
  42 + })
  43 + }
  44 +
  45 +
  46 +}
  1 +import { SpConstants } from 'wdConstant/Index';
  2 +import { AccountManagerUtils, AppUtils, DeviceUtil, SPHelper, StringUtils } from 'wdKit/Index';
  3 +import { HostEnum, HostManager } from 'wdNetwork/Index';
  4 +
  5 +export type ParamType = Record<string, string | number | boolean | Array<string>>
  6 +
  7 +export class PublicParams {
  8 +
  9 + getPublicParams() : Promise<ParamType> {
  10 + return new Promise((resolve) => {
  11 +
  12 + let pub: ParamType = {
  13 + "userName": SPHelper.default.getSync(SpConstants.USER_NAME, '') as string,
  14 + "pdUseId": SPHelper.default.getSync(SpConstants.USER_ID, '') as string,
  15 + "creatorId": SPHelper.default.getSync(SpConstants.USER_CREATOR_ID, '') as string,
  16 + "pdCnsBirthday": SPHelper.default.getSync(SpConstants.USER_BIRTHDAY, '') as string,
  17 + "city": PublicParams.getLocationCity(),
  18 + "sex":` ${SPHelper.default.getSync(SpConstants.USER_SEX, 0) as number}`,
  19 + "isSign": AccountManagerUtils.isLoginSync() ? "1" : "0",
  20 + "environment": PublicParams.getEnv(),
  21 + "os": AppUtils.getOSName(),
  22 + "actionTime": new Date().getTime() * 0.001,
  23 + "channel": AppUtils.getAppChannel(),
  24 + "version": AppUtils.getAppVersionName(),
  25 + "deviceId": DeviceUtil.clientId(),
  26 + "model": DeviceUtil.getMarketName() || "未知",
  27 + "mpaasId": PublicParams.getMpaasId(),
  28 + }
  29 + resolve(pub)
  30 + })
  31 + }
  32 +
  33 + private static getEnv() {
  34 + switch (HostManager.getHost()) {
  35 + case HostEnum.HOST_UAT:
  36 + return "uat"
  37 + case HostEnum.HOST_SIT:
  38 + return "sit"
  39 + case HostEnum.HOST_PRODUCT:
  40 + return "prod"
  41 + case HostEnum.HOST_DEV:
  42 + return "dev"
  43 + default:
  44 + return "prod"
  45 + }
  46 + }
  47 +
  48 + private static getLocationCity() {
  49 + let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string
  50 + if (StringUtils.isNotEmpty(cityName)) {
  51 + return encodeURI(cityName)
  52 + }
  53 + return ""
  54 + }
  55 +
  56 + private static getMpaasId() {
  57 + // TODO: 新增mpaasId utdid
  58 + return 'alsjdflajxaljdlfjaldjfa';
  59 + }
  60 +}
  1 +export namespace TrackConstants {
  2 +
  3 + export enum EventType {
  4 + Show = 0,
  5 + Click = 1
  6 + }
  7 +
  8 + // 行为类型
  9 + export enum ActionType {
  10 + Show = "show", // 曝光/展示
  11 + DetailPageShow = "detailPageShow",
  12 + Collect = "collect",
  13 + CollectTag = "collectTag",
  14 + UnCollect = "uncollect",
  15 + Follow = "follow",
  16 + UnFollow = "unfollow",
  17 + Like = "like",
  18 + DisLike = "dislike",
  19 + Share = "share",
  20 + Comment = "comment",
  21 + Browse = "browse",
  22 + Download = "download",
  23 + Subscribe = "subscribe",
  24 + UnSubscribe = "unSubscribe",
  25 + CloseInterestCard = "closeInterestCard",
  26 + SelectInterestCard = "selectInterestCard",
  27 +
  28 + }
  29 +
  30 + // 分享聚道
  31 + export enum ShareChannelType {
  32 + Poster = "poster",
  33 + Wechat = "wechat",
  34 + Moments = "moments",
  35 + Sina = "sinaweibo",
  36 + Dingtalk = "dingTalk",
  37 + QQ = "qq",
  38 + Qzone = "qzone",
  39 + CopyLink = "copyLink",
  40 +
  41 + }
  42 +
  43 + // 专题类型
  44 + export enum SummaryType {
  45 + Live = "liveTopic",
  46 + Article = "articleTopic",
  47 + Audio = "audioTopic",
  48 + Talk = "talkTopic",
  49 + MorningAndEveningNews = "morningAndEveningNewsTopic",
  50 + TimeAxis = "timeAxisTopic"
  51 + }
  52 +
  53 + // 直播类别
  54 + export enum LiveType {
  55 + Subscribe = "liveSubscribe",
  56 + Running = "livePlaying",
  57 + End = "liveEnd"
  58 + }
  59 +
  60 + // 所属区域
  61 + export enum RegionName{
  62 + KaiPing = "0",
  63 + GuaJiao = "1",
  64 + Feed = "2",
  65 + CaiDan = "3",
  66 + }
  67 +
  68 + // 页面名称或页面id。这里是不包含运营配置页面的pageid的
  69 + export enum PageName {
  70 + DynamicDetail = "dynamicDetailPage",
  71 + VideoDetail = "videoDetailPage",
  72 + Live_Detail = "liveDetailPage",
  73 + /// 音频详情页
  74 + Audio_Detail = "audioDetailPage",
  75 + /// 音频正文页
  76 + Audio_Detail_Text = "audioTextPage",
  77 +
  78 + /// 图文详情页
  79 + Article_Detail = "articleDetailPage",
  80 + /// 图集详情页
  81 + Atlas_Detail = "atlasDetailPage",
  82 +
  83 + ///电子报页面
  84 + Eletronic_Paper = "newsPaperPage",
  85 +
  86 + /// 金刚位详情
  87 + KeyPosition = "diamondDetailPage",
  88 +
  89 + /// 问政详情页
  90 + Ask_Detail = "questionAnswerPage",
  91 + /// 专题详情页
  92 + Summary_Detail = "summaryDetailPage",
  93 + /// 搜索页
  94 + Search = "searchPage",
  95 + /// 我的
  96 + My = "myPage",
  97 +
  98 + /// 设置页
  99 + Setting = "settingPage",
  100 + /// 账号管理
  101 + Account_Management = "accountManagementPage",
  102 + /// 注销账户
  103 + Cancel_Account = "cancelAccountPage",
  104 +
  105 + /// 隐私设置
  106 + Privacy_Setting = "privacySettingPage",
  107 + /// 意见反馈
  108 + Feedback = "feedbackPage",
  109 + /// 关于
  110 + About = "aboutPage",
  111 +
  112 + /// 编辑资料
  113 + Edit_Information = "editInformationPage",
  114 + /// 登录页
  115 + Login_Page = "loginPage",
  116 + /// 手机号登录
  117 + Phone_Login_Page = "phoneNumberLoginPage",
  118 + /// 我的评论
  119 + My_Comment = "myCommentPage",
  120 + ///草稿箱
  121 + My_DraftBox = "draftBoxPage",
  122 +
  123 + /// 我的关注
  124 + My_Follow = "myFollowPage",
  125 + /// 我的收藏
  126 + My_Collect = "myCollectPage",
  127 + /// 浏览历史
  128 + My_History = "myHistoryPage",
  129 +
  130 + /// 消息
  131 + My_Notification = "myNotificationPage",
  132 +
  133 + /// 我的预约
  134 + My_Saved_Live = "mySavedLivePage",
  135 +
  136 + /// 兴趣选择
  137 + Preference_Selection = "preferenceSelectionPage",
  138 + /// 升级页面
  139 + Update = "updatePage",
  140 + /// 开屏广告页
  141 + Open_Screen = "openScreenPage",
  142 +
  143 + /// 新手引导页
  144 + Guide = "guidePage",
  145 + /// 启动页
  146 + Launch = "launchPage",
  147 +
  148 + /// 个人主页(主态)
  149 + Main_Personal = "mainPersonalPage",
  150 + /// 个人主页(客态)
  151 + Customer_Personal = "customerPersonalPage",
  152 +
  153 + /// 个人资料页
  154 + Personal_Data = "personalDataPage",
  155 + /// H5下载页面
  156 + H5download = "H5DownloadPage",
  157 +
  158 + /// 找回密码
  159 + Retrieve_Password = "retrievePasswordPage",
  160 + /// 重置密码
  161 + Reset_Password = "resetPasswordPage",
  162 +
  163 + /// 一键登录
  164 + OneClick_Login = "oneClickLoginPage",
  165 + /// 二维码扫描
  166 + QR_Scan = "QRCodeLoginPage",
  167 + /// 绑定手机号
  168 + Bind_PhoneNum = "bindPhoneNumberPage",
  169 +
  170 + /// 验证当前手机号
  171 + Checking_PhoneNum = "checkingPhoneNumberPage",
  172 +
  173 + /// 更改手机号
  174 + Change_PhoneNum = "changePhoneNumberPage",
  175 +
  176 + /// 设置密码
  177 + Setup_Passwd = "setPasswordPage",
  178 +
  179 + /// 修改密码
  180 + Change_Passwd = "changePasswordPage",
  181 +
  182 + /// 第三方账号绑定手机号
  183 + Third_Part_Account_Bind_PhoneNum = "bindingThirdNumberPage",
  184 +
  185 + /// 实名认证
  186 + RealName_Authentication = "realNameAuthenticationPage",
  187 +
  188 + /// 发布文章
  189 + Publish_Article = "publishArticlePage",
  190 +
  191 + /// 发布视频
  192 + Publish_Video = "publishVideoPage",
  193 +
  194 + /// 发布动态
  195 + Publish_Dynamic = "publishDynamicPage",
  196 +
  197 + /// 发布图集
  198 + Publish_Atlas = "publishAtlasPage",
  199 +
  200 + /// 举报评论
  201 + Report_Comment = "reportCommentsPage",
  202 +
  203 + /// 优质评论
  204 + Best_Comment = "bestCommentsPage",
  205 +
  206 + /// 举报内容
  207 + Report_Content = "reportContentPage",
  208 +
  209 + ///兴趣偏好页
  210 + Interest = "preferenceSelectionPage",
  211 + }
  212 +}
  1 +import { ContentDetailDTO } from 'wdBean/Index';
  2 +import { ParamType } from './PublicParams';
  3 +
  4 +export class TrackParamConvert {
  5 +
  6 + static convertContentDetail(detail: ContentDetailDTO) : ParamType {
  7 +
  8 + let param: ParamType = {
  9 + "contentType": detail.newsType.toFixed(0),
  10 + "contentId": detail.newsId,
  11 + "contentName": detail.newsTitle
  12 +
  13 + //TODO: 添加更多参数
  14 +
  15 +
  16 + }
  17 +
  18 + TrackParamConvert.appendRecommend(detail, param)
  19 + return param
  20 + }
  21 +
  22 + private static appendRecommend(detail: ContentDetailDTO, to: ParamType) {
  23 +
  24 + to["sceneId"] = "9999"
  25 + to["subSceneId"] = ""
  26 + to["cnsTraceId"] = "selfHold"
  27 + to["itemId"] = ""
  28 + to["expIds"] = ""
  29 +
  30 + /// 这里填写默认值,后续在分享处 再重写
  31 + to["shareChannel"] = ""
  32 + /// 这里填写默认值,后续在action=browse时,再重写
  33 + to["duration"] = 0
  34 + }
  35 +}
  1 +@Entry
  2 +@Component
  3 +struct Index {
  4 + @State message: string = 'Hello World';
  5 +
  6 + build() {
  7 + Row() {
  8 + Column() {
  9 + Text(this.message)
  10 + .fontSize(50)
  11 + .fontWeight(FontWeight.Bold)
  12 + }
  13 + .width('100%')
  14 + }
  15 + .height('100%')
  16 + }
  17 +}
  1 +import { Logger } from 'wdKit/Index';
  2 +import { TrackingModule } from '../TrackingModule';
  3 +import sensors from '@sensorsdata/analytics';
  4 +import { ParamType, PublicParams } from '../common/PublicParams';
  5 +import { HashMap } from '@kit.ArkTS';
  6 +import { TrackConstants } from '../common/TrackConstants';
  7 +
  8 +const TAG = "WDTracking"
  9 +
  10 +export class Tracking {
  11 +
  12 + static event(eventId: string, params?: ParamType) {
  13 +
  14 + if (!TrackingModule.getHasInit()) {
  15 + Logger.warn(TAG, "还没有初始化 " + eventId + " " + JSON.stringify(params))
  16 + return
  17 + }
  18 +
  19 + //TODO: 添加运行单独线程?
  20 +
  21 + let publicParams = new PublicParams()
  22 + publicParams.getPublicParams().then((pubParams) => {
  23 +
  24 + if (params) {
  25 + for (const obj of Object.entries(params)) {
  26 + // Logger.info(TAG, ` ${obj[0]} => ` + `${obj[1]}`);
  27 + pubParams[obj[0]] = obj[1]
  28 + }
  29 + }
  30 + sensors.track(eventId, pubParams)
  31 + })
  32 + }
  33 +}
  1 +import { ParamType } from '../common/PublicParams';
  2 +import { Tracking } from './Tracking';
  3 +
  4 +export class TrackingButton {
  5 +
  6 + static click(buttonName: string, pageId: string, pageName: string, extParams?: ParamType) {
  7 +
  8 + if (!extParams) {
  9 + extParams = {}
  10 + }
  11 + extParams["pageName"] = pageName
  12 + extParams["pageId"] = pageId
  13 + extParams["clickButtonName"] = buttonName
  14 +
  15 + Tracking.event("name_click", extParams)
  16 + }
  17 +}
  1 +import { ParamType } from '../common/PublicParams'
  2 +import { TrackConstants } from "../common/TrackConstants"
  3 +
  4 +export class TrackingContent {
  5 +
  6 + /// 内容曝光/内容点击 事件
  7 + /// eventType 曝光 / 点击类型
  8 + /// pageName 如果是统一业务值 见 TrackConstants
  9 + /// pageId
  10 + /// extParams 模型转换成字段参数传值 转换方法见 TrackParamConvert
  11 + static common(eventType: TrackConstants.EventType, pageId: string, pageName: string, extParams: ParamType) {
  12 +
  13 + }
  14 +
  15 + static commonShare(shareType: number, pageId: string, pageName: string, extParams: ParamType) {
  16 +
  17 + }
  18 +
  19 + static like(like: boolean, pageId: string, pageName: string, extParams: ParamType) {
  20 +
  21 + }
  22 +
  23 + static collect(collect: boolean, pageId: string, pageName: string, extParams: ParamType) {
  24 +
  25 + }
  26 +
  27 + static follow(follow: boolean, followUserId: string, followUserName: string, pageId: string, pageName: string, extParams: ParamType) {
  28 +
  29 + }
  30 +
  31 + static commentClick(pageId: string, pageName: string, extParams: ParamType) {
  32 +
  33 + }
  34 +
  35 + static commentShare(pageId: string, pageName: string, extParams: ParamType) {
  36 +
  37 + }
  38 +
  39 + // 内容下载点击事件 1.图片 2.音频 3.视频
  40 + static download(donwloadContentType: number, pageId: string, pageName: string, extParams: ParamType) {
  41 +
  42 + }
  43 +
  44 +
  45 +}
  1 +export class TrackingPageBrowse {
  2 +
  3 +
  4 +}
  1 +import { ParamType } from '../common/PublicParams';
  2 +
  3 +/*
  4 + * 处理音频、视频、直播 正片播放、播放结束、播放错误等
  5 + * */
  6 +export class TrackingPlay {
  7 +
  8 + // 视频
  9 + static videoPositivePlay(prepareTime: number, pageId: string, pageName: string, extParams: ParamType) {
  10 +
  11 + }
  12 +
  13 + static videoPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) {
  14 +
  15 + }
  16 +
  17 + static videoPlayError(errorInfo: string, pageId: string, pageName: string, extParams: ParamType) {
  18 +
  19 + }
  20 +
  21 +
  22 + // 音频
  23 + static audioPositivePlay(prepareTime: number, pageId: string, pageName: string, extParams: ParamType) {
  24 +
  25 + }
  26 +
  27 + static audioPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) {
  28 +
  29 + }
  30 +
  31 + static audioPlayError(errorInfo: string, pageId: string, pageName: string, extParams: ParamType) {
  32 +
  33 + }
  34 +
  35 +
  36 + // 直播
  37 + static liveVideoPositivePlay(prepareTime: number, pageId: string, pageName: string, extParams: ParamType) {
  38 +
  39 + }
  40 +
  41 + static liveVideoPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) {
  42 +
  43 + }
  44 +
  45 +}
  1 +{
  2 + "module": {
  3 + "name": "wdTracking",
  4 + "type": "shared",
  5 + "description": "$string:shared_desc",
  6 + "deviceTypes": [
  7 + "phone",
  8 + "tablet",
  9 + "2in1"
  10 + ],
  11 + "deliveryWithInstall": true,
  12 + "pages": "$profile:main_pages"
  13 + }
  14 +}
  1 +{
  2 + "color": [
  3 + {
  4 + "name": "white",
  5 + "value": "#FFFFFF"
  6 + }
  7 + ]
  8 +}
  1 +{
  2 + "string": [
  3 + {
  4 + "name": "shared_desc",
  5 + "value": "埋点封装库"
  6 + }
  7 + ]
  8 +}
  1 +import localUnitTest from './LocalUnit.test';
  2 +
  3 +export default function testsuite() {
  4 + localUnitTest();
  5 +}
  1 +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
  2 +
  3 +export default function localUnitTest() {
  4 + describe('localUnitTest',() => {
  5 + // Defines a test suite. Two parameters are supported: test suite name and test suite function.
  6 + beforeAll(() => {
  7 + // Presets an action, which is performed only once before all test cases of the test suite start.
  8 + // This API supports only one parameter: preset action function.
  9 + });
  10 + beforeEach(() => {
  11 + // Presets an action, which is performed before each unit test case starts.
  12 + // The number of execution times is the same as the number of test cases defined by **it**.
  13 + // This API supports only one parameter: preset action function.
  14 + });
  15 + afterEach(() => {
  16 + // Presets a clear action, which is performed after each unit test case ends.
  17 + // The number of execution times is the same as the number of test cases defined by **it**.
  18 + // This API supports only one parameter: clear action function.
  19 + });
  20 + afterAll(() => {
  21 + // Presets a clear action, which is performed after all test cases of the test suite end.
  22 + // This API supports only one parameter: clear action function.
  23 + });
  24 + it('assertContain', 0, () => {
  25 + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
  26 + let a = 'abc';
  27 + let b = 'b';
  28 + // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
  29 + expect(a).assertContain(b);
  30 + expect(a).assertEqual(a);
  31 + });
  32 + });
  33 +}
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
17 "wdNetwork": "file:../../commons/wdNetwork", 17 "wdNetwork": "file:../../commons/wdNetwork",
18 "wdHwAbility": "file:../../features/wdHwAbility", 18 "wdHwAbility": "file:../../features/wdHwAbility",
19 "wdJsBridge": "file:../../commons/wdJsBridge", 19 "wdJsBridge": "file:../../commons/wdJsBridge",
20 - "wdLogin": "file:../../features/wdLogin" 20 + "wdLogin": "file:../../features/wdLogin",
  21 + "wdTracking": "file:../../features/wdTracking"
21 } 22 }
22 } 23 }
@@ -12,6 +12,7 @@ import { @@ -12,6 +12,7 @@ import {
12 NetworkType, 12 NetworkType,
13 SPHelper, 13 SPHelper,
14 StringUtils, 14 StringUtils,
  15 + UmengStats,
15 WindowModel 16 WindowModel
16 } from 'wdKit'; 17 } from 'wdKit';
17 import { HostEnum, HostManager, WDHttp } from 'wdNetwork'; 18 import { HostEnum, HostManager, WDHttp } from 'wdNetwork';
@@ -21,6 +22,7 @@ import { WDPushNotificationManager } from 'wdHwAbility/Index'; @@ -21,6 +22,7 @@ import { WDPushNotificationManager } from 'wdHwAbility/Index';
21 22
22 export default class EntryAbility extends UIAbility { 23 export default class EntryAbility extends UIAbility {
23 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { 24 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
  25 + UmengStats.preInit(this.context)
24 SPHelper.init(this.context); 26 SPHelper.init(this.context);
25 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); 27 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
26 registerRouter(); 28 registerRouter();
@@ -68,7 +68,7 @@ struct LaunchInterestsHobbiesPage { @@ -68,7 +68,7 @@ struct LaunchInterestsHobbiesPage {
68 Stack(){ 68 Stack(){
69 Column({}){ 69 Column({}){
70 Text(item.name) 70 Text(item.name)
71 - .fontSize('35lpx') 71 + .fontSize(18)
72 .fontColor('#FFFFFF') 72 .fontColor('#FFFFFF')
73 .margin({top:'21lpx',left:'19lpx'}) 73 .margin({top:'21lpx',left:'19lpx'})
74 .width('100%') 74 .width('100%')
@@ -140,7 +140,7 @@ struct LaunchInterestsHobbiesPage { @@ -140,7 +140,7 @@ struct LaunchInterestsHobbiesPage {
140 promptAction.showToast({ 140 promptAction.showToast({
141 message : '请先选择您感兴趣的内容哦', 141 message : '请先选择您感兴趣的内容哦',
142 duration: 2000, 142 duration: 2000,
143 - bottom: 50 143 + bottom: '50%'
144 }) 144 })
145 return 145 return
146 } 146 }
@@ -11,8 +11,9 @@ import { WDRouterPage } from 'wdRouter'; @@ -11,8 +11,9 @@ import { WDRouterPage } from 'wdRouter';
11 import { LaunchModel } from '../viewModel/LaunchModel' 11 import { LaunchModel } from '../viewModel/LaunchModel'
12 import { LaunchPageModel } from '../viewModel/LaunchPageModel' 12 import { LaunchPageModel } from '../viewModel/LaunchPageModel'
13 import LaunchDataModel from '../viewModel/LaunchDataModel' 13 import LaunchDataModel from '../viewModel/LaunchDataModel'
14 -import { Logger, SPHelper } from 'wdKit/Index'; 14 +import { Logger, SPHelper, UmengStats } from 'wdKit/Index';
15 import { SpConstants } from 'wdConstant/Index'; 15 import { SpConstants } from 'wdConstant/Index';
  16 +import { TrackingModule } from 'wdTracking/Index'
16 17
17 @Entry 18 @Entry
18 @Component 19 @Component
@@ -44,6 +45,8 @@ struct LaunchPage { @@ -44,6 +45,8 @@ struct LaunchPage {
44 } 45 }
45 46
46 onConfirm() { 47 onConfirm() {
  48 + UmengStats.initAfterAgreeProtocol()
  49 + TrackingModule.startup(getContext(this) as common.UIAbilityContext)
47 // Save privacy agreement status. 50 // Save privacy agreement status.
48 this.saveIsPrivacy(); 51 this.saveIsPrivacy();
49 //跳转引导页 52 //跳转引导页
@@ -94,6 +97,10 @@ struct LaunchPage { @@ -94,6 +97,10 @@ struct LaunchPage {
94 this.dialogController.open(); 97 this.dialogController.open();
95 // } 98 // }
96 } else { 99 } else {
  100 +
  101 + UmengStats.initAfterAgreeProtocol()
  102 + TrackingModule.startup(getContext(this) as common.UIAbilityContext)
  103 +
97 //需要根据请求数据判断是否需要进入广告页,广告数据为nil则直接跳转到首页 104 //需要根据请求数据判断是否需要进入广告页,广告数据为nil则直接跳转到首页
98 //获取本地存储的启动页数据 105 //获取本地存储的启动页数据
99 106