Showing
5 changed files
with
127 additions
and
4 deletions
| @@ -441,6 +441,12 @@ export class HttpUrlUtils { | @@ -441,6 +441,12 @@ export class HttpUrlUtils { | ||
| 441 | return url; | 441 | return url; |
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | + //游客评论合并 | ||
| 445 | + static visitorMergeComment() { | ||
| 446 | + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/visitorMerge"; | ||
| 447 | + return url; | ||
| 448 | + } | ||
| 449 | + | ||
| 444 | static getAppointmentListDataUrl() { | 450 | static getAppointmentListDataUrl() { |
| 445 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH | 451 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH |
| 446 | return url | 452 | return url |
| @@ -8,6 +8,7 @@ import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI' | @@ -8,6 +8,7 @@ import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI' | ||
| 8 | import { SPHelper, StringUtils } from 'wdKit' | 8 | import { SPHelper, StringUtils } from 'wdKit' |
| 9 | import { SpConstants } from 'wdConstant' | 9 | import { SpConstants } from 'wdConstant' |
| 10 | import dataPreferences from '@ohos.data.preferences'; | 10 | import dataPreferences from '@ohos.data.preferences'; |
| 11 | +import { MergeRecordDialog } from '../../dialog/MergeRecordDialog' | ||
| 11 | 12 | ||
| 12 | const TAG = 'MinePageComponent'; | 13 | const TAG = 'MinePageComponent'; |
| 13 | 14 | ||
| @@ -30,9 +31,23 @@ export struct MinePageComponent { | @@ -30,9 +31,23 @@ export struct MinePageComponent { | ||
| 30 | this.isLogin = false | 31 | this.isLogin = false |
| 31 | }else { | 32 | }else { |
| 32 | this.isLogin = true | 33 | this.isLogin = true |
| 34 | + this.addRecordDialog() | ||
| 33 | } | 35 | } |
| 34 | } | 36 | } |
| 35 | } | 37 | } |
| 38 | + mergeDialogController: CustomDialogController = new CustomDialogController({ | ||
| 39 | + builder: MergeRecordDialog({ | ||
| 40 | + cancel: () => { | ||
| 41 | + this.clearMergeRecord() | ||
| 42 | + }, | ||
| 43 | + confirm: () => { | ||
| 44 | + this.dealMergeRecordData() | ||
| 45 | + } | ||
| 46 | + }), | ||
| 47 | + customStyle: true, | ||
| 48 | + alignment: DialogAlignment.Center, | ||
| 49 | + autoCancel: false | ||
| 50 | + }) | ||
| 36 | 51 | ||
| 37 | aboutToAppear(){ | 52 | aboutToAppear(){ |
| 38 | this.getUserLogin() | 53 | this.getUserLogin() |
| @@ -112,5 +127,29 @@ export struct MinePageComponent { | @@ -112,5 +127,29 @@ export struct MinePageComponent { | ||
| 112 | } | 127 | } |
| 113 | } | 128 | } |
| 114 | 129 | ||
| 130 | + addRecordDialog() { | ||
| 131 | + setTimeout(() => { | ||
| 132 | + this.dealMergeRecordDialog() | ||
| 133 | + }, 300) | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + dealMergeRecordDialog() { | ||
| 137 | + let commentTime = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, "") | ||
| 138 | + if (StringUtils.isNotEmpty(commentTime)) { | ||
| 139 | + this.mergeDialogController.open() | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + dealMergeRecordData() { | ||
| 144 | + MinePageDatasModel.visitorMergeComment().then(() => { | ||
| 145 | + this.mergeDialogController.close() | ||
| 146 | + }).catch(() => { | ||
| 147 | + this.mergeDialogController.close() | ||
| 148 | + }) | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + clearMergeRecord(){ | ||
| 152 | + SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, "") | ||
| 153 | + } | ||
| 115 | } | 154 | } |
| 116 | 155 |
| 1 | +@CustomDialog | ||
| 2 | +export struct MergeRecordDialog { | ||
| 3 | + controller: CustomDialogController | ||
| 4 | + cancel: () => void = () => { | ||
| 5 | + } | ||
| 6 | + confirm: () => void = () => { | ||
| 7 | + } | ||
| 8 | + | ||
| 9 | + build() { | ||
| 10 | + Column() { | ||
| 11 | + Text("合并游客记录到当前账号,可避免信息丢失") | ||
| 12 | + .fontColor("#222222") | ||
| 13 | + .fontSize(18) | ||
| 14 | + .width("100%") | ||
| 15 | + .fontWeight(FontWeight.Bold) | ||
| 16 | + .textAlign(TextAlign.Center) | ||
| 17 | + .margin({ top: 20 }) | ||
| 18 | + | ||
| 19 | + Divider().color("#999999").width("100%").margin({ top: 20 }).height('1vp') | ||
| 20 | + Row() { | ||
| 21 | + Text('取消') | ||
| 22 | + .fontSize(16) | ||
| 23 | + .fontColor("#648DF2") | ||
| 24 | + .layoutWeight(1) | ||
| 25 | + .fontWeight(FontWeight.Medium) | ||
| 26 | + .textAlign(TextAlign.Center) | ||
| 27 | + .onClick(() => { | ||
| 28 | + this.controller.close() | ||
| 29 | + if (this.cancel) { | ||
| 30 | + this.cancel() | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + }) | ||
| 34 | + .height('100%') | ||
| 35 | + // Divider().color("#999999").height('100%').width('0.5vp') | ||
| 36 | + Text('一键合并') | ||
| 37 | + .fontSize(16) | ||
| 38 | + .fontColor("#648DF2") | ||
| 39 | + .layoutWeight(1) | ||
| 40 | + .fontWeight(FontWeight.Medium) | ||
| 41 | + .textAlign(TextAlign.Center) | ||
| 42 | + .border({ | ||
| 43 | + width: { left: 1 }, | ||
| 44 | + color: "#999999", | ||
| 45 | + style: { left: BorderStyle.Solid } | ||
| 46 | + | ||
| 47 | + }) | ||
| 48 | + .onClick(() => { | ||
| 49 | + this.controller.close() | ||
| 50 | + if (this.confirm) { | ||
| 51 | + this.confirm() | ||
| 52 | + } | ||
| 53 | + }) | ||
| 54 | + .height('100%') | ||
| 55 | + }.layoutWeight(1).justifyContent(FlexAlign.Center) | ||
| 56 | + }.height(140).backgroundColor(Color.White).borderRadius(10).width('74%') | ||
| 57 | + } | ||
| 58 | +} |
| @@ -4,7 +4,7 @@ import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsI | @@ -4,7 +4,7 @@ import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsI | ||
| 4 | import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel'; | 4 | import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel'; |
| 5 | import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 5 | import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 6 | import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem'; | 6 | import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem'; |
| 7 | -import { Logger, StringUtils, EmitterUtils, EmitterEventId } from 'wdKit'; | 7 | +import { Logger, StringUtils, EmitterUtils, EmitterEventId, SPHelper } from 'wdKit'; |
| 8 | import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem'; | 8 | import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem'; |
| 9 | import { FollowListDetailRequestItem } from '../viewmodel/FollowListDetailRequestItem'; | 9 | import { FollowListDetailRequestItem } from '../viewmodel/FollowListDetailRequestItem'; |
| 10 | import { FollowListItem } from '../viewmodel/FollowListItem'; | 10 | import { FollowListItem } from '../viewmodel/FollowListItem'; |
| @@ -22,6 +22,7 @@ import { UserFollowListRequestItem } from '../viewmodel/UserFollowListRequestIte | @@ -22,6 +22,7 @@ import { UserFollowListRequestItem } from '../viewmodel/UserFollowListRequestIte | ||
| 22 | import { AppointmentOperationRequestItem } from '../viewmodel/AppointmentOperationRequestItem'; | 22 | import { AppointmentOperationRequestItem } from '../viewmodel/AppointmentOperationRequestItem'; |
| 23 | import { CommentLikeOperationRequestItem } from '../viewmodel/CommentLikeOperationRequestItem'; | 23 | import { CommentLikeOperationRequestItem } from '../viewmodel/CommentLikeOperationRequestItem'; |
| 24 | import { FollowOperationRequestItem } from '../viewmodel/FollowOperationRequestItem'; | 24 | import { FollowOperationRequestItem } from '../viewmodel/FollowOperationRequestItem'; |
| 25 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 25 | 26 | ||
| 26 | const TAG = "MinePageDatasModel" | 27 | const TAG = "MinePageDatasModel" |
| 27 | 28 | ||
| @@ -559,7 +560,26 @@ class MinePageDatasModel{ | @@ -559,7 +560,26 @@ class MinePageDatasModel{ | ||
| 559 | return WDHttp.post<ResponseDTO>(url,object) | 560 | return WDHttp.post<ResponseDTO>(url,object) |
| 560 | }; | 561 | }; |
| 561 | 562 | ||
| 562 | - | 563 | + visitorMergeComment() { |
| 564 | + let bean: Record<string, string> = {}; | ||
| 565 | + bean['time'] = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, "") as string | ||
| 566 | + bean['deviceId'] = HttpUtils.getDeviceId(); | ||
| 567 | + return new Promise<object>((success, error) => { | ||
| 568 | + // Logger.info(TAG, `visitorMergeComment`); | ||
| 569 | + HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.visitorMergeComment(), bean).then((data: ResponseDTO<object>) => { | ||
| 570 | + if (!data) { | ||
| 571 | + error() | ||
| 572 | + } | ||
| 573 | + if (data.code != 0) { | ||
| 574 | + error() | ||
| 575 | + } | ||
| 576 | + SPHelper.default.save(SpConstants.FIRSTCOMMENTTIME, "") | ||
| 577 | + success(data) | ||
| 578 | + }).catch(() => { | ||
| 579 | + error() | ||
| 580 | + }) | ||
| 581 | + }) | ||
| 582 | + } | ||
| 563 | } | 583 | } |
| 564 | 584 | ||
| 565 | const minePageDatasModel = MinePageDatasModel.getInstance() | 585 | const minePageDatasModel = MinePageDatasModel.getInstance() |
| @@ -60,7 +60,7 @@ export class LoginModel { | @@ -60,7 +60,7 @@ export class LoginModel { | ||
| 60 | let bean: Record<string, Object> = {}; | 60 | let bean: Record<string, Object> = {}; |
| 61 | bean['phone'] = phone | 61 | bean['phone'] = phone |
| 62 | bean['loginType'] = loginType | 62 | bean['loginType'] = loginType |
| 63 | - bean['deviceId'] = '60da5af6-9c59-3566-8622-8c6c00710994' | 63 | + bean['deviceId'] = HttpUtils.getDeviceId() |
| 64 | bean['verificationCode'] = verificationCode | 64 | bean['verificationCode'] = verificationCode |
| 65 | return new Promise<LoginBean>((success, fail) => { | 65 | return new Promise<LoginBean>((success, fail) => { |
| 66 | HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean).then((data: ResponseDTO<LoginBean>) => { | 66 | HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean).then((data: ResponseDTO<LoginBean>) => { |
| @@ -90,7 +90,7 @@ export class LoginModel { | @@ -90,7 +90,7 @@ export class LoginModel { | ||
| 90 | bean['userName'] = phone | 90 | bean['userName'] = phone |
| 91 | } | 91 | } |
| 92 | bean['loginType'] = loginType | 92 | bean['loginType'] = loginType |
| 93 | - bean['deviceId'] = '60da5af6-9c59-3566-8622-8c6c00710994' | 93 | + bean['deviceId'] = HttpUtils.getDeviceId() |
| 94 | bean['password'] = password | 94 | bean['password'] = password |
| 95 | bean['oldPassword'] = oldPassword | 95 | bean['oldPassword'] = oldPassword |
| 96 | return new Promise<LoginBean>((success, fail) => { | 96 | return new Promise<LoginBean>((success, fail) => { |
-
Please register or login to post a comment