Showing
12 changed files
with
128 additions
and
193 deletions
| @@ -2,46 +2,30 @@ import { StringUtils } from './StringUtils'; | @@ -2,46 +2,30 @@ import { StringUtils } from './StringUtils'; | ||
| 2 | import { SPHelper } from './SPHelper'; | 2 | import { SPHelper } from './SPHelper'; |
| 3 | import { Logger } from './Logger'; | 3 | import { Logger } from './Logger'; |
| 4 | 4 | ||
| 5 | -const KEY_USER_TOKEN = 'userToken'; | ||
| 6 | - | ||
| 7 | const TAG: string = 'AccountManagerUtils'; | 5 | const TAG: string = 'AccountManagerUtils'; |
| 8 | 6 | ||
| 9 | // 是否已登录hadLogin | 7 | // 是否已登录hadLogin |
| 10 | let hasLogin: boolean = false; | 8 | let hasLogin: boolean = false; |
| 11 | 9 | ||
| 12 | export class AccountManagerUtils { | 10 | export class AccountManagerUtils { |
| 13 | - // 是否已登录hadLogin | ||
| 14 | - // private static hasLogin: boolean = undefined; | 11 | + |
| 12 | + // 这里需要和其他模块value值一致 !!!! | ||
| 13 | + // TODO: 以前清楚谁写的遗留代码,后续考虑删除 | ||
| 14 | + static readonly USER_ID = "userId" | ||
| 15 | 15 | ||
| 16 | constructor() { | 16 | constructor() { |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | - static async getUserToken(): Promise<string> { | ||
| 20 | - let userToken = await SPHelper.default.get(KEY_USER_TOKEN, '') as string; | 19 | + static async getUserId(): Promise<string> { |
| 20 | + let userId = await SPHelper.default.get(AccountManagerUtils.USER_ID, '') as string; | ||
| 21 | // Logger.info(TAG, 'getUserToken UserToken.' + userToken); | 21 | // Logger.info(TAG, 'getUserToken UserToken.' + userToken); |
| 22 | - return userToken; | 22 | + return userId; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | - static getUserTokenSync(): string { | ||
| 26 | - let userToken = SPHelper.default.getSync(KEY_USER_TOKEN, '') as string; | 25 | + static getUserIdSync(): string { |
| 26 | + let userId = SPHelper.default.getSync(AccountManagerUtils.USER_ID, '') as string; | ||
| 27 | // Logger.info(TAG, 'getUserToken UserToken.' + userToken); | 27 | // Logger.info(TAG, 'getUserToken UserToken.' + userToken); |
| 28 | - return userToken; | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | - static async putUserToken(value: string) { | ||
| 32 | - await SPHelper.default.save(KEY_USER_TOKEN, value); | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - static putUserTokenSync(value: string) { | ||
| 36 | - SPHelper.default.saveSync(KEY_USER_TOKEN, value); | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - static async deleteUserToken() { | ||
| 40 | - await SPHelper.default.delete(KEY_USER_TOKEN); | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - static deleteUserTokenSync() { | ||
| 44 | - SPHelper.default.deleteSync(KEY_USER_TOKEN); | 28 | + return userId; |
| 45 | } | 29 | } |
| 46 | 30 | ||
| 47 | /** | 31 | /** |
| @@ -51,7 +35,7 @@ export class AccountManagerUtils { | @@ -51,7 +35,7 @@ export class AccountManagerUtils { | ||
| 51 | */ | 35 | */ |
| 52 | static async isLogin() { | 36 | static async isLogin() { |
| 53 | Logger.info(TAG, 'isLogin hasLogin1:' + hasLogin); | 37 | Logger.info(TAG, 'isLogin hasLogin1:' + hasLogin); |
| 54 | - let lastUserToken = await AccountManagerUtils.getUserToken() | 38 | + let lastUserToken = await AccountManagerUtils.getUserId() |
| 55 | Logger.info(TAG, 'isLogin lastUserToken:' + lastUserToken); | 39 | Logger.info(TAG, 'isLogin lastUserToken:' + lastUserToken); |
| 56 | if (StringUtils.isEmpty(lastUserToken)) { | 40 | if (StringUtils.isEmpty(lastUserToken)) { |
| 57 | hasLogin = false; | 41 | hasLogin = false; |
| @@ -72,7 +56,7 @@ export class AccountManagerUtils { | @@ -72,7 +56,7 @@ export class AccountManagerUtils { | ||
| 72 | */ | 56 | */ |
| 73 | static isLoginSync() { | 57 | static isLoginSync() { |
| 74 | Logger.info(TAG, 'isLogin hasLogin1:' + hasLogin); | 58 | Logger.info(TAG, 'isLogin hasLogin1:' + hasLogin); |
| 75 | - let lastUserToken = AccountManagerUtils.getUserTokenSync() | 59 | + let lastUserToken = AccountManagerUtils.getUserIdSync() |
| 76 | Logger.info(TAG, 'isLogin lastUserToken:' + lastUserToken); | 60 | Logger.info(TAG, 'isLogin lastUserToken:' + lastUserToken); |
| 77 | if (StringUtils.isEmpty(lastUserToken)) { | 61 | if (StringUtils.isEmpty(lastUserToken)) { |
| 78 | hasLogin = false; | 62 | hasLogin = false; |
| @@ -70,6 +70,7 @@ export struct DynamicDetailComponent { | @@ -70,6 +70,7 @@ export struct DynamicDetailComponent { | ||
| 70 | @State isPageEnd: boolean = false | 70 | @State isPageEnd: boolean = false |
| 71 | @State publishCommentModel: publishCommentModel = new publishCommentModel() | 71 | @State publishCommentModel: publishCommentModel = new publishCommentModel() |
| 72 | @State reachEndIncreament: number = 0 | 72 | @State reachEndIncreament: number = 0 |
| 73 | + @State operationButtonList: string[] = [] | ||
| 73 | 74 | ||
| 74 | async aboutToAppear() { | 75 | async aboutToAppear() { |
| 75 | await this.getContentDetailData() | 76 | await this.getContentDetailData() |
| @@ -532,15 +533,7 @@ export struct DynamicDetailComponent { | @@ -532,15 +533,7 @@ export struct DynamicDetailComponent { | ||
| 532 | if (this.contentDetailData?.openComment) { | 533 | if (this.contentDetailData?.openComment) { |
| 533 | Divider().strokeWidth(6).color('#f5f5f5').margin({ top: $r('app.float.margin_24') }) | 534 | Divider().strokeWidth(6).color('#f5f5f5').margin({ top: $r('app.float.margin_24') }) |
| 534 | CommentComponent({ | 535 | CommentComponent({ |
| 535 | - publishCommentModel: { | ||
| 536 | - targetId: String(this.contentDetailData?.newsId || ''), | ||
| 537 | - targetRelId: this.contentDetailData?.reLInfo?.relId, | ||
| 538 | - targetTitle: this.contentDetailData?.newsTitle, | ||
| 539 | - targetRelType: this.contentDetailData?.reLInfo?.relType, | ||
| 540 | - targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId), | ||
| 541 | - keyArticle: String(this.contentDetailData?.keyArticle), | ||
| 542 | - targetType: String(this.contentDetailData?.newsType), | ||
| 543 | - } as publishCommentModel | 536 | + publishCommentModel: this.publishCommentModel |
| 544 | }) | 537 | }) |
| 545 | } | 538 | } |
| 546 | Blank().layoutWeight(1) | 539 | Blank().layoutWeight(1) |
| @@ -557,7 +550,7 @@ export struct DynamicDetailComponent { | @@ -557,7 +550,7 @@ export struct DynamicDetailComponent { | ||
| 557 | OperRowListView({ | 550 | OperRowListView({ |
| 558 | contentDetailData: this.contentDetailData, | 551 | contentDetailData: this.contentDetailData, |
| 559 | publishCommentModel: this.publishCommentModel, | 552 | publishCommentModel: this.publishCommentModel, |
| 560 | - operationButtonList: ['comment', 'collect', 'share'], | 553 | + operationButtonList: this.operationButtonList, |
| 561 | styleType: 1, | 554 | styleType: 1, |
| 562 | }) | 555 | }) |
| 563 | 556 | ||
| @@ -574,13 +567,6 @@ export struct DynamicDetailComponent { | @@ -574,13 +567,6 @@ export struct DynamicDetailComponent { | ||
| 574 | * */ | 567 | * */ |
| 575 | private async getContentDetailData() { | 568 | private async getContentDetailData() { |
| 576 | this.isNetConnected = NetworkUtil.isNetConnected() | 569 | this.isNetConnected = NetworkUtil.isNetConnected() |
| 577 | - this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 578 | - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | ||
| 579 | - this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 580 | - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 581 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 582 | - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 583 | - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 584 | try { | 570 | try { |
| 585 | let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) | 571 | let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) |
| 586 | this.isPageEnd = true; | 572 | this.isPageEnd = true; |
| @@ -590,6 +576,20 @@ export struct DynamicDetailComponent { | @@ -590,6 +576,20 @@ export struct DynamicDetailComponent { | ||
| 590 | let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) | 576 | let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) |
| 591 | this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime) | 577 | this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime) |
| 592 | console.log('动态详情', JSON.stringify(this.contentDetailData)) | 578 | console.log('动态详情', JSON.stringify(this.contentDetailData)) |
| 579 | + | ||
| 580 | + if (this.contentDetailData?.openComment) { | ||
| 581 | + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 582 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') | ||
| 583 | + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 584 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '') | ||
| 585 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '') | ||
| 586 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '') | ||
| 587 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | ||
| 588 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | ||
| 589 | + } | ||
| 590 | + | ||
| 591 | + this.operationButtonList = ['comment', 'collect', 'share'] | ||
| 592 | + | ||
| 593 | } catch (exception) { | 593 | } catch (exception) { |
| 594 | console.log('请求失败', JSON.stringify(exception)) | 594 | console.log('请求失败', JSON.stringify(exception)) |
| 595 | this.isPageEnd = true; | 595 | this.isPageEnd = true; |
| @@ -234,13 +234,13 @@ export struct ImageAndTextPageComponent { | @@ -234,13 +234,13 @@ export struct ImageAndTextPageComponent { | ||
| 234 | } | 234 | } |
| 235 | if (this.contentDetailData?.openComment) { | 235 | if (this.contentDetailData?.openComment) { |
| 236 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | 236 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') |
| 237 | - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | 237 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') |
| 238 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | 238 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle |
| 239 | - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 240 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 241 | - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 242 | - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 243 | - this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | 239 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '') |
| 240 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '') | ||
| 241 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '') | ||
| 242 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | ||
| 243 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | ||
| 244 | } | 244 | } |
| 245 | if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length && | 245 | if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length && |
| 246 | this.contentDetailData?.audioList[0].audioUrl) { | 246 | this.contentDetailData?.audioList[0].audioUrl) { |
| @@ -445,13 +445,13 @@ export struct MultiPictureDetailPageComponent { | @@ -445,13 +445,13 @@ export struct MultiPictureDetailPageComponent { | ||
| 445 | // } | 445 | // } |
| 446 | if (this.contentDetailData?.openComment) { | 446 | if (this.contentDetailData?.openComment) { |
| 447 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | 447 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') |
| 448 | - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | 448 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') |
| 449 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | 449 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle |
| 450 | - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 451 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 452 | - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 453 | - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 454 | - this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | 450 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '') |
| 451 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '') | ||
| 452 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '') | ||
| 453 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | ||
| 454 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | ||
| 455 | } | 455 | } |
| 456 | // this.contentDetailData.photoList = [] | 456 | // this.contentDetailData.photoList = [] |
| 457 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { | 457 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { |
| @@ -72,13 +72,13 @@ export struct SpacialTopicPageComponent { | @@ -72,13 +72,13 @@ export struct SpacialTopicPageComponent { | ||
| 72 | this.contentDetailData = detailBeans[0]; | 72 | this.contentDetailData = detailBeans[0]; |
| 73 | // if (this.contentDetailData[0]?.openComment) { | 73 | // if (this.contentDetailData[0]?.openComment) { |
| 74 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | 74 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') |
| 75 | - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | 75 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') |
| 76 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | 76 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle |
| 77 | - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 78 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 79 | - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 80 | - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 81 | - this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | 77 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '') |
| 78 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '') | ||
| 79 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '') | ||
| 80 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | ||
| 81 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | ||
| 82 | // } | 82 | // } |
| 83 | this.trySendData2H5() | 83 | this.trySendData2H5() |
| 84 | } | 84 | } |
| @@ -164,7 +164,7 @@ class CommentViewModel { | @@ -164,7 +164,7 @@ class CommentViewModel { | ||
| 164 | publishComment(model: publishCommentModel) { | 164 | publishComment(model: publishCommentModel) { |
| 165 | 165 | ||
| 166 | return new Promise<commentItemModel>((success, fail) => { | 166 | return new Promise<commentItemModel>((success, fail) => { |
| 167 | - const visitorMode = model.visitorComment == "1" && AccountManagerUtils.isLoginSync() == false | 167 | + const visitorMode = model.visitorComment == "1" && HttpUtils.isLogin() == false |
| 168 | let url = visitorMode ? HttpUrlUtils.getNoUserPublishCommentUrl() : HttpUrlUtils.getPublishCommentUrl() | 168 | let url = visitorMode ? HttpUrlUtils.getNoUserPublishCommentUrl() : HttpUrlUtils.getPublishCommentUrl() |
| 169 | 169 | ||
| 170 | let bean: Record<string, string> = {}; | 170 | let bean: Record<string, string> = {}; |
| @@ -64,13 +64,13 @@ export struct DetailPlayLiveCommon { | @@ -64,13 +64,13 @@ export struct DetailPlayLiveCommon { | ||
| 64 | // if (this.contentDetailData.openComment === 1) { | 64 | // if (this.contentDetailData.openComment === 1) { |
| 65 | console.log(TAG, '查询视频详情用于评论展示 openComment:', this.contentDetailData.openComment) | 65 | console.log(TAG, '查询视频详情用于评论展示 openComment:', this.contentDetailData.openComment) |
| 66 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | 66 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') |
| 67 | - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | 67 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') |
| 68 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | 68 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle |
| 69 | - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 70 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 71 | - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 72 | - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 73 | - this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | 69 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '') |
| 70 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '') | ||
| 71 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '') | ||
| 72 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | ||
| 73 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | ||
| 74 | this.publishCommentModel.commentContent = '' | 74 | this.publishCommentModel.commentContent = '' |
| 75 | // } | 75 | // } |
| 76 | } | 76 | } |
| @@ -166,12 +166,13 @@ export struct DetailPlayShortVideoPage { | @@ -166,12 +166,13 @@ export struct DetailPlayShortVideoPage { | ||
| 166 | this.queryNewsInfoOfUser() | 166 | this.queryNewsInfoOfUser() |
| 167 | 167 | ||
| 168 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | 168 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') |
| 169 | - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | 169 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') |
| 170 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | 170 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle |
| 171 | - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 172 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 173 | - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 174 | - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | 171 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '') |
| 172 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '') | ||
| 173 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '') | ||
| 174 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | ||
| 175 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | ||
| 175 | this.publishCommentModel.commentContent = '' | 176 | this.publishCommentModel.commentContent = '' |
| 176 | 177 | ||
| 177 | } | 178 | } |
| @@ -17,13 +17,13 @@ export struct CommentComponentPage { | @@ -17,13 +17,13 @@ export struct CommentComponentPage { | ||
| 17 | aboutToAppear(): void { | 17 | aboutToAppear(): void { |
| 18 | 18 | ||
| 19 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | 19 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') |
| 20 | - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | 20 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') |
| 21 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | 21 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle |
| 22 | - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 23 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 24 | - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 25 | - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 26 | - this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | 22 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '') |
| 23 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '') | ||
| 24 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '') | ||
| 25 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | ||
| 26 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | ||
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | build() { | 29 | build() { |
| 1 | -import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage' | ||
| 2 | -import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule' | ||
| 3 | -import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index' | ||
| 4 | - | ||
| 5 | -@CustomDialog | ||
| 6 | -export struct CustomProtocolDialog { | ||
| 7 | - controller: CustomDialogController | ||
| 8 | - | ||
| 9 | - cancel: () => void = () => { | ||
| 10 | - } | ||
| 11 | - | ||
| 12 | - confirm: () => void = () => { | ||
| 13 | - } | ||
| 14 | - | ||
| 15 | - build() { | ||
| 16 | - Column() { | ||
| 17 | - Text("温馨提示") | ||
| 18 | - .fontColor("#222222") | ||
| 19 | - .fontSize(18) | ||
| 20 | - .width("100%") | ||
| 21 | - .fontWeight(FontWeight.Bold) | ||
| 22 | - .textAlign(TextAlign.Center) | ||
| 23 | - .margin({ top: 20 }) | ||
| 24 | - Text() { | ||
| 25 | - Span("为保障您的合法权益,请阅读并同意").fontSize(14).fontColor("#666666") | ||
| 26 | - Span("《用户协议》").fontSize(14).fontColor("#ED2800").onClick(()=>{ | ||
| 27 | - let bean={contentID:"1",pageID:""} as Params | ||
| 28 | - WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | ||
| 29 | - this.controller.close() | ||
| 30 | - }) | ||
| 31 | - Span("及").fontSize(14).fontColor("#666666") | ||
| 32 | - Span("《隐私政策》").fontSize(14).fontColor("#ED2800").onClick(()=>{ | ||
| 33 | - let bean={contentID:"2",pageID:""} as Params | ||
| 34 | - WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | ||
| 35 | - this.controller.close() | ||
| 36 | - }) | ||
| 37 | - Span("后进行登录").fontSize(14).fontColor("#666666") | ||
| 38 | - }.margin({ top: 12, left: 16, right: 16 }) | ||
| 39 | - | ||
| 40 | - Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp') | ||
| 41 | - Row() { | ||
| 42 | - Text('放弃登录') | ||
| 43 | - .fontSize(16) | ||
| 44 | - .fontColor("#999999") | ||
| 45 | - .layoutWeight(1) | ||
| 46 | - .fontWeight(FontWeight.Medium) | ||
| 47 | - .textAlign(TextAlign.Center) | ||
| 48 | - .onClick(() => { | ||
| 49 | - this.controller.close() | ||
| 50 | - if (this.cancel) { | ||
| 51 | - this.cancel() | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - }) | ||
| 55 | - .height('100%') | ||
| 56 | - // Divider().color("#999999").height('100%').width('0.5vp') | ||
| 57 | - Text('同意并登录') | ||
| 58 | - .fontSize(16) | ||
| 59 | - .fontColor("#ED2800") | ||
| 60 | - .layoutWeight(1) | ||
| 61 | - .fontWeight(FontWeight.Medium) | ||
| 62 | - .textAlign(TextAlign.Center) | ||
| 63 | - .border({ | ||
| 64 | - width: { left: 1 }, | ||
| 65 | - color: "#999999", | ||
| 66 | - style: { left: BorderStyle.Solid } | ||
| 67 | - | ||
| 68 | - }) | ||
| 69 | - .onClick(() => { | ||
| 70 | - this.controller.close() | ||
| 71 | - if (this.confirm) { | ||
| 72 | - this.confirm() | ||
| 73 | - } | ||
| 74 | - }) | ||
| 75 | - .height('100%') | ||
| 76 | - }.layoutWeight(1).justifyContent(FlexAlign.Center) | ||
| 77 | - }.height(161).backgroundColor(Color.White).borderRadius(6).width('74%') | ||
| 78 | - } | ||
| 79 | -} |
| 1 | import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils,CustomToast, StringUtils, NetworkUtil } from 'wdKit' | 1 | import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils,CustomToast, StringUtils, NetworkUtil } from 'wdKit' |
| 2 | -import { CustomProtocolDialog } from './CustomProtocolDialog' | ||
| 3 | import router from '@ohos.router' | 2 | import router from '@ohos.router' |
| 4 | import { LoginViewModel } from './LoginViewModel' | 3 | import { LoginViewModel } from './LoginViewModel' |
| 5 | import { LoginInputComponent } from './LoginInputComponent' | 4 | import { LoginInputComponent } from './LoginInputComponent' |
| @@ -57,18 +56,6 @@ struct LoginPage { | @@ -57,18 +56,6 @@ struct LoginPage { | ||
| 57 | maskColor:"#00000000" | 56 | maskColor:"#00000000" |
| 58 | }) | 57 | }) |
| 59 | 58 | ||
| 60 | - dialogController: CustomDialogController = new CustomDialogController({ | ||
| 61 | - builder: CustomProtocolDialog({ | ||
| 62 | - cancel: () => { | ||
| 63 | - | ||
| 64 | - }, | ||
| 65 | - confirm: () => { | ||
| 66 | - this.requestLogin() | ||
| 67 | - } | ||
| 68 | - }), | ||
| 69 | - customStyle: true, | ||
| 70 | - alignment:DialogAlignment.Center | ||
| 71 | - }) | ||
| 72 | loginViewModel = new LoginViewModel() | 59 | loginViewModel = new LoginViewModel() |
| 73 | @State isProtocol:boolean=false | 60 | @State isProtocol:boolean=false |
| 74 | onCodeSend() { | 61 | onCodeSend() { |
| @@ -467,32 +454,58 @@ struct ProtocolComponent { | @@ -467,32 +454,58 @@ struct ProtocolComponent { | ||
| 467 | Column() { | 454 | Column() { |
| 468 | Text("温馨提示") | 455 | Text("温馨提示") |
| 469 | .fontColor("#222222") | 456 | .fontColor("#222222") |
| 470 | - .fontSize(18) | 457 | + .fontSize("35lpx") |
| 458 | + .lineHeight("50lpx") | ||
| 471 | .width("100%") | 459 | .width("100%") |
| 472 | - .fontWeight(FontWeight.Bold) | 460 | + .fontWeight(500) |
| 473 | .textAlign(TextAlign.Center) | 461 | .textAlign(TextAlign.Center) |
| 474 | - .margin({ top: 20 }) | 462 | + .margin({ top: "38lpx" }) |
| 475 | Text() { | 463 | Text() { |
| 476 | - Span("为保障您的合法权益,请阅读并同意").fontSize(14).fontColor("#666666") | ||
| 477 | - Span("《用户协议》").fontSize(14).fontColor("#ED2800").onClick(() => { | 464 | + Span("为保障您的合法权益,请阅读并同意") |
| 465 | + .fontSize("27lpx") | ||
| 466 | + .lineHeight("42lpx") | ||
| 467 | + .fontWeight(400) | ||
| 468 | + .fontColor("#666666") | ||
| 469 | + | ||
| 470 | + Span("《用户协议》") | ||
| 471 | + .fontSize("27lpx") | ||
| 472 | + .lineHeight("42lpx") | ||
| 473 | + .fontWeight(400) | ||
| 474 | + .fontColor("#ED2800") | ||
| 475 | + .onClick(() => { | ||
| 478 | let bean = { contentID: "1", pageID: "" } as Params | 476 | let bean = { contentID: "1", pageID: "" } as Params |
| 479 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) | 477 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) |
| 480 | }) | 478 | }) |
| 481 | - Span("及").fontSize(14).fontColor("#666666") | ||
| 482 | - Span("《隐私政策》").fontSize(14).fontColor("#ED2800").onClick(() => { | 479 | + Span("及").fontSize("27lpx") |
| 480 | + .lineHeight("42lpx") | ||
| 481 | + .fontWeight(400) | ||
| 482 | + .fontColor("#666666") | ||
| 483 | + Span("《隐私政策》") | ||
| 484 | + .fontSize("27lpx") | ||
| 485 | + .lineHeight("42lpx") | ||
| 486 | + .fontWeight(400) | ||
| 487 | + .fontColor("#ED2800") | ||
| 488 | + .onClick(() => { | ||
| 483 | let bean = { contentID: "2", pageID: "" } as Params | 489 | let bean = { contentID: "2", pageID: "" } as Params |
| 484 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) | 490 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) |
| 485 | }) | 491 | }) |
| 486 | - Span("后进行登录").fontSize(14).fontColor("#666666") | ||
| 487 | - }.margin({ top: 12, left: 16, right: 16 }) | ||
| 488 | - | ||
| 489 | - Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp') | 492 | + Span("后进行登录") |
| 493 | + .fontSize("27lpx") | ||
| 494 | + .lineHeight("42lpx") | ||
| 495 | + .fontWeight(400) | ||
| 496 | + .fontColor("#666666") | ||
| 497 | + }.margin({ top: "23lpx", left: "31lpx", right: "31lpx" }) | ||
| 498 | + .wordBreak(WordBreak.BREAK_ALL) | ||
| 499 | + .textAlign(TextAlign.Start) | ||
| 500 | + | ||
| 501 | + Divider().color("#f5f5f5").width("100%").margin({ top: "27lpx" }).height('1lpx').strokeWidth('1lpx') | ||
| 490 | Row() { | 502 | Row() { |
| 491 | Text('放弃登录') | 503 | Text('放弃登录') |
| 492 | - .fontSize(16) | 504 | + .fontSize("31lpx") |
| 505 | + .fontWeight(500) | ||
| 506 | + .lineHeight("42lpx") | ||
| 493 | .fontColor("#999999") | 507 | .fontColor("#999999") |
| 494 | .layoutWeight(1) | 508 | .layoutWeight(1) |
| 495 | - .fontWeight(FontWeight.Medium) | ||
| 496 | .textAlign(TextAlign.Center) | 509 | .textAlign(TextAlign.Center) |
| 497 | .onClick(() => { | 510 | .onClick(() => { |
| 498 | if (this.cancelMethod) { | 511 | if (this.cancelMethod) { |
| @@ -500,18 +513,26 @@ struct ProtocolComponent { | @@ -500,18 +513,26 @@ struct ProtocolComponent { | ||
| 500 | } | 513 | } |
| 501 | }) | 514 | }) |
| 502 | .height('100%') | 515 | .height('100%') |
| 503 | - // Divider().color("#999999").height('100%').width('0.5vp') | 516 | + |
| 517 | + Divider() | ||
| 518 | + .width("1lpx") | ||
| 519 | + .strokeWidth('1lpx') | ||
| 520 | + .vertical(true) | ||
| 521 | + .height('100%') | ||
| 522 | + .color("#F5F5F5") | ||
| 523 | + | ||
| 524 | + | ||
| 504 | Text('同意并登录') | 525 | Text('同意并登录') |
| 505 | - .fontSize(16) | 526 | + .fontSize("31lpx") |
| 527 | + .fontWeight(500) | ||
| 528 | + .lineHeight("42lpx") | ||
| 506 | .fontColor("#ED2800") | 529 | .fontColor("#ED2800") |
| 507 | .layoutWeight(1) | 530 | .layoutWeight(1) |
| 508 | - .fontWeight(FontWeight.Medium) | ||
| 509 | .textAlign(TextAlign.Center) | 531 | .textAlign(TextAlign.Center) |
| 510 | .border({ | 532 | .border({ |
| 511 | width: { left: 1 }, | 533 | width: { left: 1 }, |
| 512 | - color: "#999999", | 534 | + color: "#F5F5F5", |
| 513 | style: { left: BorderStyle.Solid } | 535 | style: { left: BorderStyle.Solid } |
| 514 | - | ||
| 515 | }) | 536 | }) |
| 516 | .onClick(() => { | 537 | .onClick(() => { |
| 517 | if (this.agreeMethod) { | 538 | if (this.agreeMethod) { |
| @@ -519,8 +540,13 @@ struct ProtocolComponent { | @@ -519,8 +540,13 @@ struct ProtocolComponent { | ||
| 519 | } | 540 | } |
| 520 | }) | 541 | }) |
| 521 | .height('100%') | 542 | .height('100%') |
| 522 | - }.layoutWeight(1).justifyContent(FlexAlign.Center) | ||
| 523 | - }.height(161).backgroundColor(Color.White).borderRadius(6).width('74%') | 543 | + }.layoutWeight(1) |
| 544 | + .justifyContent(FlexAlign.Center) | ||
| 545 | + } | ||
| 546 | + .backgroundColor(Color.White) | ||
| 547 | + .borderRadius("12lpx") | ||
| 548 | + .width("528lpx") | ||
| 549 | + .height("309lpx") | ||
| 524 | 550 | ||
| 525 | }.width('100%') | 551 | }.width('100%') |
| 526 | .height('100%') | 552 | .height('100%') |
-
Please register or login to post a comment