Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
3 changed files
with
223 additions
and
208 deletions
| @@ -98,6 +98,7 @@ export struct OtherHomePageBottomCommentComponent { | @@ -98,6 +98,7 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 98 | }).onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => { | 98 | }).onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => { |
| 99 | if (isVisible) { | 99 | if (isVisible) { |
| 100 | let contentDTO = getParams(item) | 100 | let contentDTO = getParams(item) |
| 101 | + //埋点crash 后面看看 | ||
| 101 | TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal, TrackParamConvert.program(contentDTO)) | 102 | TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal, TrackParamConvert.program(contentDTO)) |
| 102 | } | 103 | } |
| 103 | }) | 104 | }) |
| @@ -110,13 +111,6 @@ export struct OtherHomePageBottomCommentComponent { | @@ -110,13 +111,6 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 110 | } | 111 | } |
| 111 | } | 112 | } |
| 112 | } | 113 | } |
| 113 | - // .onReachEnd(()=>{ | ||
| 114 | - // if (!this.isLoading) { | ||
| 115 | - // this.isLoading = true | ||
| 116 | - // //加载分页数据 | ||
| 117 | - // this.getNewPageData() | ||
| 118 | - // } | ||
| 119 | - // }) | ||
| 120 | .cachedCount(5) | 114 | .cachedCount(5) |
| 121 | .layoutWeight(1) | 115 | .layoutWeight(1) |
| 122 | .scrollBar(BarState.Off) | 116 | .scrollBar(BarState.Off) |
| @@ -135,7 +129,7 @@ export struct OtherHomePageBottomCommentComponent { | @@ -135,7 +129,7 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 135 | .borderRadius(12) | 129 | .borderRadius(12) |
| 136 | } | 130 | } |
| 137 | 131 | ||
| 138 | - getNewPageData() { | 132 | + getNewPageData() { |
| 139 | this.isLoading = true | 133 | this.isLoading = true |
| 140 | if (this.hasMore) { | 134 | if (this.hasMore) { |
| 141 | let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | 135 | let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) |
| @@ -63,213 +63,214 @@ struct OtherNormalUserHomePage { | @@ -63,213 +63,214 @@ struct OtherNormalUserHomePage { | ||
| 63 | 63 | ||
| 64 | 64 | ||
| 65 | build() { | 65 | build() { |
| 66 | - if(this.isConnectNetwork){ | ||
| 67 | - Stack({ alignContent: Alignment.Top }){ | 66 | + Column(){ |
| 67 | + if(this.isConnectNetwork){ | ||
| 68 | Stack({ alignContent: Alignment.Top }){ | 68 | Stack({ alignContent: Alignment.Top }){ |
| 69 | - Image($r('app.media.title_bg')) | ||
| 70 | - .width('100%') | ||
| 71 | - .height(`calc(${295 + this.topSafeHeight + 'lpx'})`) | ||
| 72 | - .objectFit(ImageFit.Cover) | ||
| 73 | - | ||
| 74 | - Row() | ||
| 75 | - .height(px2vp(this.topSafeHeight)) | ||
| 76 | - .width("100%") | ||
| 77 | - .backgroundColor($r('app.color.white')) | ||
| 78 | - .visibility(this.tileOpacity > 0 ? 0 : 1) | ||
| 79 | - .opacity(this.tileOpacity ) | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - Column(){ | ||
| 83 | Stack({ alignContent: Alignment.Top }){ | 69 | Stack({ alignContent: Alignment.Top }){ |
| 84 | - this.MineHomeTitleTransparent() | ||
| 85 | - this.MineHomeTitleWhite() | ||
| 86 | - }.margin({top:px2vp(this.topSafeHeight)}) | ||
| 87 | - | ||
| 88 | - Scroll() { | ||
| 89 | - Column() { | ||
| 90 | - //用户信息区域 | ||
| 91 | - Row() { | ||
| 92 | - Stack(){ | ||
| 93 | - Image(this.headPhotoUrl) | ||
| 94 | - .alt($r('app.media.default_head')) | ||
| 95 | - .width('115lpx') | ||
| 96 | - .height('115lpx') | ||
| 97 | - .objectFit(ImageFit.Cover) | ||
| 98 | - .clip(new Circle({ width: '115lpx', height: '115lpx' })) | ||
| 99 | - Image(this.levelHead) | ||
| 100 | - .width('165lpx') | ||
| 101 | - .height('165lpx') | ||
| 102 | - .objectFit(ImageFit.Cover) | ||
| 103 | - } | 70 | + Image($r('app.media.title_bg')) |
| 71 | + .width('100%') | ||
| 72 | + .height(`calc(${295 + this.topSafeHeight + 'lpx'})`) | ||
| 73 | + .objectFit(ImageFit.Cover) | ||
| 74 | + | ||
| 75 | + Row() | ||
| 76 | + .height(px2vp(this.topSafeHeight)) | ||
| 77 | + .width("100%") | ||
| 78 | + .backgroundColor($r('app.color.white')) | ||
| 79 | + .visibility(this.tileOpacity > 0 ? 0 : 1) | ||
| 80 | + .opacity(this.tileOpacity ) | ||
| 81 | + } | ||
| 104 | 82 | ||
| 105 | - Column() { | ||
| 106 | - Row() { | ||
| 107 | - Text(`${this.userName}`) | ||
| 108 | - .fontColor($r('app.color.white')) | ||
| 109 | - .maxLines(1) | ||
| 110 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 111 | - .fontSize('38lpx') | ||
| 112 | - .lineHeight('50lpx') | ||
| 113 | - .fontWeight('500lpx') | ||
| 114 | - | ||
| 115 | - if(this.levelId>0){ | ||
| 116 | - Text(`等级${this.levelId}`) | ||
| 117 | - .fontColor($r('app.color.color_ED2800')) | ||
| 118 | - .fontSize('23lpx') | ||
| 119 | - .fontWeight(500) | ||
| 120 | - .margin({ left: '10lpx' }) | ||
| 121 | - .backgroundImage($r("app.media.my_grade_bg")) | ||
| 122 | - .backgroundImageSize(ImageSize.Cover) | ||
| 123 | - .padding({left:"17lpx",right:"8lpx"}) | ||
| 124 | - .height('35lpx') | ||
| 125 | - } | ||
| 126 | - Blank() | ||
| 127 | - }.width('507lpx') | 83 | + Column(){ |
| 84 | + Stack({ alignContent: Alignment.Top }){ | ||
| 85 | + this.MineHomeTitleTransparent() | ||
| 86 | + this.MineHomeTitleWhite() | ||
| 87 | + }.margin({top:px2vp(this.topSafeHeight)}) | ||
| 88 | + | ||
| 89 | + Scroll() { | ||
| 90 | + Column() { | ||
| 91 | + //用户信息区域 | ||
| 92 | + Row() { | ||
| 93 | + Stack(){ | ||
| 94 | + Image(this.headPhotoUrl) | ||
| 95 | + .alt($r('app.media.default_head')) | ||
| 96 | + .width('115lpx') | ||
| 97 | + .height('115lpx') | ||
| 98 | + .objectFit(ImageFit.Cover) | ||
| 99 | + .clip(new Circle({ width: '115lpx', height: '115lpx' })) | ||
| 100 | + Image(this.levelHead) | ||
| 101 | + .width('165lpx') | ||
| 102 | + .height('165lpx') | ||
| 103 | + .objectFit(ImageFit.Cover) | ||
| 104 | + } | ||
| 128 | 105 | ||
| 129 | - Row() { | ||
| 130 | - Row() { | ||
| 131 | - Text(`${this.browseNum}`) | ||
| 132 | - .textStyle() | ||
| 133 | - Text("阅读") | ||
| 134 | - .textStyle2() | ||
| 135 | - } | ||
| 136 | - .margin({ right: '15lpx' }) | ||
| 137 | - | ||
| 138 | - Divider() | ||
| 139 | - .height('19lpx') | ||
| 140 | - .width('2lpx') | ||
| 141 | - .color($r('app.color.white')) | ||
| 142 | - .vertical(true) | ||
| 143 | - .opacity(0.4) | 106 | + Column() { |
| 144 | Row() { | 107 | Row() { |
| 145 | - Text(`${this.commentNum}`) | ||
| 146 | - .textStyle() | ||
| 147 | - Text("评论") | ||
| 148 | - .textStyle2() | ||
| 149 | - }.margin({ right: '15lpx', left: '15lpx' }) | ||
| 150 | - | ||
| 151 | - Divider() | ||
| 152 | - .height('19lpx') | ||
| 153 | - .width('2lpx') | ||
| 154 | - .color($r('app.color.white')) | ||
| 155 | - .vertical(true) | ||
| 156 | - .opacity(0.4) | 108 | + Text(`${this.userName}`) |
| 109 | + .fontColor($r('app.color.white')) | ||
| 110 | + .maxLines(1) | ||
| 111 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 112 | + .fontSize('38lpx') | ||
| 113 | + .lineHeight('50lpx') | ||
| 114 | + .fontWeight('500lpx') | ||
| 115 | + | ||
| 116 | + if(this.levelId>0){ | ||
| 117 | + Text(`等级${this.levelId}`) | ||
| 118 | + .fontColor($r('app.color.color_ED2800')) | ||
| 119 | + .fontSize('23lpx') | ||
| 120 | + .fontWeight(500) | ||
| 121 | + .margin({ left: '10lpx' }) | ||
| 122 | + .backgroundImage($r("app.media.my_grade_bg")) | ||
| 123 | + .backgroundImageSize(ImageSize.Cover) | ||
| 124 | + .padding({left:"17lpx",right:"8lpx"}) | ||
| 125 | + .height('35lpx') | ||
| 126 | + } | ||
| 127 | + Blank() | ||
| 128 | + }.width('507lpx') | ||
| 129 | + | ||
| 157 | Row() { | 130 | Row() { |
| 158 | - Text(`${this.attentionNum}`) | ||
| 159 | - .textStyle() | ||
| 160 | - Text("关注") | ||
| 161 | - .textStyle2() | ||
| 162 | - }.margin({ left: '15lpx' }) | ||
| 163 | - }.margin({ top: '23lpx' }) | ||
| 164 | - }.alignItems(HorizontalAlign.Start) | ||
| 165 | - .margin({ left: StringUtils.isEmpty(this.levelHead)?'32lpx':"3lpx" }) | ||
| 166 | - } | ||
| 167 | - .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 168 | - if (this.firstPositionY === 0) { | ||
| 169 | - this.firstPositionY = newValue.globalPosition.y as number | ||
| 170 | - }else{ | ||
| 171 | - let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3) | ||
| 172 | - if(persent > 1){ | ||
| 173 | - persent = 1 | ||
| 174 | - } | ||
| 175 | - this.tileOpacity = persent | 131 | + Row() { |
| 132 | + Text(`${this.browseNum}`) | ||
| 133 | + .textStyle() | ||
| 134 | + Text("阅读") | ||
| 135 | + .textStyle2() | ||
| 136 | + } | ||
| 137 | + .margin({ right: '15lpx' }) | ||
| 138 | + | ||
| 139 | + Divider() | ||
| 140 | + .height('19lpx') | ||
| 141 | + .width('2lpx') | ||
| 142 | + .color($r('app.color.white')) | ||
| 143 | + .vertical(true) | ||
| 144 | + .opacity(0.4) | ||
| 145 | + Row() { | ||
| 146 | + Text(`${this.commentNum}`) | ||
| 147 | + .textStyle() | ||
| 148 | + Text("评论") | ||
| 149 | + .textStyle2() | ||
| 150 | + }.margin({ right: '15lpx', left: '15lpx' }) | ||
| 151 | + | ||
| 152 | + Divider() | ||
| 153 | + .height('19lpx') | ||
| 154 | + .width('2lpx') | ||
| 155 | + .color($r('app.color.white')) | ||
| 156 | + .vertical(true) | ||
| 157 | + .opacity(0.4) | ||
| 158 | + Row() { | ||
| 159 | + Text(`${this.attentionNum}`) | ||
| 160 | + .textStyle() | ||
| 161 | + Text("关注") | ||
| 162 | + .textStyle2() | ||
| 163 | + }.margin({ left: '15lpx' }) | ||
| 164 | + }.margin({ top: '23lpx' }) | ||
| 165 | + }.alignItems(HorizontalAlign.Start) | ||
| 166 | + .margin({ left: StringUtils.isEmpty(this.levelHead)?'32lpx':"3lpx" }) | ||
| 176 | } | 167 | } |
| 177 | - }) | ||
| 178 | - // .backgroundColor($r('app.color.color_transparent')) | ||
| 179 | - .height('184lpx') | ||
| 180 | - .width('100%') | ||
| 181 | - .padding({ left: '6lpx' }) | ||
| 182 | - | ||
| 183 | - //用户简介区域 | ||
| 184 | - if(StringUtils.isNotEmpty(this.desc)){ | ||
| 185 | - Column() { | ||
| 186 | - Row() { | ||
| 187 | - Text('简介:'+this.desc) | ||
| 188 | - .fontSize('27lpx') | ||
| 189 | - .maxLines(3) | ||
| 190 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 191 | - .lineHeight('40lpx') | ||
| 192 | - .fontWeight('400lpx') | ||
| 193 | - .fontColor($r('app.color.color_222222')) | ||
| 194 | - .textAlign(TextAlign.Start) | ||
| 195 | - | ||
| 196 | - } | ||
| 197 | - }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'}) | ||
| 198 | - .alignItems(HorizontalAlign.Start) | ||
| 199 | - .justifyContent(FlexAlign.Center) | ||
| 200 | - .width('100%') | ||
| 201 | - .backgroundColor($r('app.color.white')) | ||
| 202 | - } | ||
| 203 | - //间隔符 | ||
| 204 | - Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') | ||
| 205 | - | ||
| 206 | - //tab 页面 | ||
| 207 | - Stack({ alignContent: Alignment.Top }){ | ||
| 208 | - Tabs({controller: this.controller}) { | ||
| 209 | - TabContent() { | ||
| 210 | - OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum}) | ||
| 211 | - } | ||
| 212 | - TabContent() { | ||
| 213 | - OtherHomePageBottomFollowComponent({curUserId:this.curUserId}) | 168 | + .onAreaChange((oldValue: Area, newValue: Area) => { |
| 169 | + if (this.firstPositionY === 0) { | ||
| 170 | + this.firstPositionY = newValue.globalPosition.y as number | ||
| 171 | + }else{ | ||
| 172 | + let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3) | ||
| 173 | + if(persent > 1){ | ||
| 174 | + persent = 1 | ||
| 175 | + } | ||
| 176 | + this.tileOpacity = persent | ||
| 214 | } | 177 | } |
| 215 | - } | ||
| 216 | - .backgroundColor($r('app.color.white')) | ||
| 217 | - .animationDuration(0) | ||
| 218 | - .onChange((index: number) => { | ||
| 219 | - this.currentIndex = index | ||
| 220 | - trackTabFirstClick(index === 0 ? "评论":"关注") | ||
| 221 | }) | 178 | }) |
| 222 | - .vertical(false) | ||
| 223 | - .barHeight('77lpx') | 179 | + // .backgroundColor($r('app.color.color_transparent')) |
| 180 | + .height('184lpx') | ||
| 181 | + .width('100%') | ||
| 182 | + .padding({ left: '6lpx' }) | ||
| 224 | 183 | ||
| 225 | - Column() { | ||
| 226 | - // 页签 | ||
| 227 | - Row({ space: 7 }) { | ||
| 228 | - Scroll() { | ||
| 229 | - Row() { | ||
| 230 | - this.TabBuilder(0,"评论") | ||
| 231 | - this.TabBuilder(1,"关注") | 184 | + //用户简介区域 |
| 185 | + if(StringUtils.isNotEmpty(this.desc)){ | ||
| 186 | + Column() { | ||
| 187 | + Row() { | ||
| 188 | + Text('简介:'+this.desc) | ||
| 189 | + .fontSize('27lpx') | ||
| 190 | + .maxLines(3) | ||
| 191 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 192 | + .lineHeight('40lpx') | ||
| 193 | + .fontWeight('400lpx') | ||
| 194 | + .fontColor($r('app.color.color_222222')) | ||
| 195 | + .textAlign(TextAlign.Start) | ||
| 196 | + | ||
| 197 | + } | ||
| 198 | + }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'}) | ||
| 199 | + .alignItems(HorizontalAlign.Start) | ||
| 200 | + .justifyContent(FlexAlign.Center) | ||
| 201 | + .width('100%') | ||
| 202 | + .backgroundColor($r('app.color.white')) | ||
| 203 | + } | ||
| 204 | + //间隔符 | ||
| 205 | + Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') | ||
| 206 | + | ||
| 207 | + //tab 页面 | ||
| 208 | + Stack({ alignContent: Alignment.Top }){ | ||
| 209 | + Tabs({controller: this.controller}) { | ||
| 210 | + TabContent() { | ||
| 211 | + OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum}) | ||
| 212 | + } | ||
| 213 | + TabContent() { | ||
| 214 | + OtherHomePageBottomFollowComponent({curUserId:this.curUserId}) | ||
| 215 | + } | ||
| 216 | + } | ||
| 217 | + .backgroundColor($r('app.color.white')) | ||
| 218 | + .animationDuration(0) | ||
| 219 | + .onChange((index: number) => { | ||
| 220 | + this.currentIndex = index | ||
| 221 | + trackTabFirstClick(index === 0 ? "评论":"关注") | ||
| 222 | + }) | ||
| 223 | + .vertical(false) | ||
| 224 | + .barHeight('77lpx') | ||
| 225 | + | ||
| 226 | + Column() { | ||
| 227 | + // 页签 | ||
| 228 | + Row({ space: 7 }) { | ||
| 229 | + Scroll() { | ||
| 230 | + Row() { | ||
| 231 | + this.TabBuilder(0,"评论") | ||
| 232 | + this.TabBuilder(1,"关注") | ||
| 233 | + } | ||
| 234 | + .justifyContent(FlexAlign.Start) | ||
| 232 | } | 235 | } |
| 233 | - .justifyContent(FlexAlign.Start) | 236 | + .align(Alignment.Start) |
| 237 | + .scrollable(ScrollDirection.Horizontal) | ||
| 238 | + .scrollBar(BarState.Off) | ||
| 239 | + .width('90%') | ||
| 240 | + .padding({left:'31lpx'}) | ||
| 234 | } | 241 | } |
| 235 | - .align(Alignment.Start) | ||
| 236 | - .scrollable(ScrollDirection.Horizontal) | ||
| 237 | - .scrollBar(BarState.Off) | ||
| 238 | - .width('90%') | ||
| 239 | - .padding({left:'31lpx'}) | 242 | + .alignItems(VerticalAlign.Bottom) |
| 243 | + .width('100%') | ||
| 240 | } | 244 | } |
| 241 | - .alignItems(VerticalAlign.Bottom) | 245 | + .backgroundColor($r('app.color.white')) |
| 246 | + .alignItems(HorizontalAlign.Start) | ||
| 242 | .width('100%') | 247 | .width('100%') |
| 248 | + .height('77lpx') | ||
| 243 | } | 249 | } |
| 244 | - .backgroundColor($r('app.color.white')) | ||
| 245 | - .alignItems(HorizontalAlign.Start) | ||
| 246 | - .width('100%') | ||
| 247 | - .height('77lpx') | ||
| 248 | - } | ||
| 249 | - }.width("100%") | 250 | + }.width("100%") |
| 251 | + } | ||
| 252 | + .edgeEffect(EdgeEffect.None) | ||
| 253 | + .scrollBar(BarState.Off) | ||
| 254 | + .width('100%') | ||
| 255 | + .layoutWeight(1) | ||
| 250 | } | 256 | } |
| 251 | - .edgeEffect(EdgeEffect.None) | ||
| 252 | - .scrollBar(BarState.Off) | ||
| 253 | - .width('100%') | ||
| 254 | - .layoutWeight(1) | 257 | + }.width('100%') |
| 258 | + .layoutWeight(1) | ||
| 259 | + }else{ | ||
| 260 | + Column(){ | ||
| 261 | + CustomTitleUI({ titleName: "" }) | ||
| 262 | + | ||
| 263 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 264 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 265 | + if(this.isChangeToUserEdit){ | ||
| 266 | + this.getUserInfo() | ||
| 267 | + } | ||
| 268 | + },}) | ||
| 269 | + .layoutWeight(1) | ||
| 270 | + .width('100%') | ||
| 255 | } | 271 | } |
| 256 | - }.width('100%') | ||
| 257 | - .layoutWeight(1) | ||
| 258 | - }else{ | ||
| 259 | - Column(){ | ||
| 260 | - CustomTitleUI({ titleName: "" }) | ||
| 261 | - | ||
| 262 | - EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 263 | - this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 264 | - if(this.isChangeToUserEdit){ | ||
| 265 | - this.getUserInfo() | ||
| 266 | - } | ||
| 267 | - },}) | ||
| 268 | - .layoutWeight(1) | ||
| 269 | - .width('100%') | ||
| 270 | } | 272 | } |
| 271 | - } | ||
| 272 | - | 273 | + }.padding({bottom:px2vp(this.bottomSafeHeight)}) |
| 273 | } | 274 | } |
| 274 | @Builder MineHomeTitleTransparent() { | 275 | @Builder MineHomeTitleTransparent() { |
| 275 | RelativeContainer() { | 276 | RelativeContainer() { |
| @@ -2,7 +2,7 @@ import { Logger } from 'wdKit/Index'; | @@ -2,7 +2,7 @@ import { Logger } from 'wdKit/Index'; | ||
| 2 | import { TrackingModule } from '../TrackingModule'; | 2 | import { TrackingModule } from '../TrackingModule'; |
| 3 | import sensors from '@sensorsdata/analytics'; | 3 | import sensors from '@sensorsdata/analytics'; |
| 4 | import { ParamType, PublicParams } from '../common/PublicParams'; | 4 | import { ParamType, PublicParams } from '../common/PublicParams'; |
| 5 | -import { HashMap } from '@kit.ArkTS'; | 5 | +import { taskpool } from '@kit.ArkTS'; |
| 6 | import { TrackConstants } from '../common/TrackConstants'; | 6 | import { TrackConstants } from '../common/TrackConstants'; |
| 7 | 7 | ||
| 8 | const TAG = "WDTracking" | 8 | const TAG = "WDTracking" |
| @@ -18,17 +18,37 @@ export class Tracking { | @@ -18,17 +18,37 @@ export class Tracking { | ||
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | //TODO: 添加运行单独线程? | 20 | //TODO: 添加运行单独线程? |
| 21 | + taskpool.execute(doTrack, eventId, params).then(() => { | ||
| 22 | + Logger.error('yyyy','event track success') | ||
| 23 | + }).catch(()=>{ | ||
| 24 | + Logger.error('yyyy','event track failed') | ||
| 25 | + }) | ||
| 26 | + | ||
| 27 | + // let publicParams = new PublicParams() | ||
| 28 | + // publicParams.getPublicParams().then((pubParams) => { | ||
| 29 | + // | ||
| 30 | + // if (params) { | ||
| 31 | + // for (const obj of Object.entries(params)) { | ||
| 32 | + // // Logger.info(TAG, ` ${obj[0]} => ` + `${obj[1]}`); | ||
| 33 | + // pubParams[obj[0]] = obj[1] | ||
| 34 | + // } | ||
| 35 | + // } | ||
| 36 | + // sensors.track(eventId, pubParams) | ||
| 37 | + // }) | ||
| 38 | + } | ||
| 39 | +} | ||
| 21 | 40 | ||
| 22 | - let publicParams = new PublicParams() | ||
| 23 | - publicParams.getPublicParams().then((pubParams) => { | 41 | +@Concurrent |
| 42 | +function doTrack(eventId: string, params?: ParamType): void { | ||
| 43 | + let publicParams = new PublicParams() | ||
| 44 | + publicParams.getPublicParams().then((pubParams) => { | ||
| 24 | 45 | ||
| 25 | - if (params) { | ||
| 26 | - for (const obj of Object.entries(params)) { | ||
| 27 | - // Logger.info(TAG, ` ${obj[0]} => ` + `${obj[1]}`); | ||
| 28 | - pubParams[obj[0]] = obj[1] | ||
| 29 | - } | 46 | + if (params) { |
| 47 | + for (const obj of Object.entries(params)) { | ||
| 48 | + // Logger.info(TAG, ` ${obj[0]} => ` + `${obj[1]}`); | ||
| 49 | + pubParams[obj[0]] = obj[1] | ||
| 30 | } | 50 | } |
| 31 | - sensors.track(eventId, pubParams) | ||
| 32 | - }) | ||
| 33 | - } | 51 | + } |
| 52 | + sensors.track(eventId, pubParams) | ||
| 53 | + }) | ||
| 34 | } | 54 | } |
-
Please register or login to post a comment