张善主

Merge remote-tracking branch 'origin/main'

... ... @@ -441,6 +441,12 @@ export class HttpUrlUtils {
return url;
}
//游客评论合并
static visitorMergeComment() {
let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/visitorMerge";
return url;
}
static getAppointmentListDataUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH
return url
... ...
... ... @@ -8,6 +8,7 @@ import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI'
import { SPHelper, StringUtils } from 'wdKit'
import { SpConstants } from 'wdConstant'
import dataPreferences from '@ohos.data.preferences';
import { MergeRecordDialog } from '../../dialog/MergeRecordDialog'
const TAG = 'MinePageComponent';
... ... @@ -30,9 +31,23 @@ export struct MinePageComponent {
this.isLogin = false
}else {
this.isLogin = true
this.addRecordDialog()
}
}
}
mergeDialogController: CustomDialogController = new CustomDialogController({
builder: MergeRecordDialog({
cancel: () => {
this.clearMergeRecord()
},
confirm: () => {
this.dealMergeRecordData()
}
}),
customStyle: true,
alignment: DialogAlignment.Center,
autoCancel: false
})
aboutToAppear(){
this.getUserLogin()
... ... @@ -112,5 +127,29 @@ export struct MinePageComponent {
}
}
addRecordDialog() {
setTimeout(() => {
this.dealMergeRecordDialog()
}, 300)
}
dealMergeRecordDialog() {
let commentTime = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, "")
if (StringUtils.isNotEmpty(commentTime)) {
this.mergeDialogController.open()
}
}
dealMergeRecordData() {
MinePageDatasModel.visitorMergeComment().then(() => {
this.mergeDialogController.close()
}).catch(() => {
this.mergeDialogController.close()
})
}
clearMergeRecord(){
SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, "")
}
}
... ...
@CustomDialog
export struct MergeRecordDialog {
controller: CustomDialogController
cancel: () => void = () => {
}
confirm: () => void = () => {
}
build() {
Column() {
Text("合并游客记录到当前账号,可避免信息丢失")
.fontColor("#222222")
.fontSize(18)
.width("100%")
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Center)
.margin({ top: 20 })
Divider().color("#999999").width("100%").margin({ top: 20 }).height('1vp')
Row() {
Text('取消')
.fontSize(16)
.fontColor("#648DF2")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.onClick(() => {
this.controller.close()
if (this.cancel) {
this.cancel()
}
})
.height('100%')
// Divider().color("#999999").height('100%').width('0.5vp')
Text('一键合并')
.fontSize(16)
.fontColor("#648DF2")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.border({
width: { left: 1 },
color: "#999999",
style: { left: BorderStyle.Solid }
})
.onClick(() => {
this.controller.close()
if (this.confirm) {
this.confirm()
}
})
.height('100%')
}.layoutWeight(1).justifyContent(FlexAlign.Center)
}.height(140).backgroundColor(Color.White).borderRadius(10).width('74%')
}
}
\ No newline at end of file
... ...
... ... @@ -4,7 +4,7 @@ import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsI
import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel';
import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem';
import { Logger, StringUtils, EmitterUtils, EmitterEventId } from 'wdKit';
import { Logger, StringUtils, EmitterUtils, EmitterEventId, SPHelper } from 'wdKit';
import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem';
import { FollowListDetailRequestItem } from '../viewmodel/FollowListDetailRequestItem';
import { FollowListItem } from '../viewmodel/FollowListItem';
... ... @@ -22,6 +22,7 @@ import { UserFollowListRequestItem } from '../viewmodel/UserFollowListRequestIte
import { AppointmentOperationRequestItem } from '../viewmodel/AppointmentOperationRequestItem';
import { CommentLikeOperationRequestItem } from '../viewmodel/CommentLikeOperationRequestItem';
import { FollowOperationRequestItem } from '../viewmodel/FollowOperationRequestItem';
import { SpConstants } from 'wdConstant/Index';
const TAG = "MinePageDatasModel"
... ... @@ -559,7 +560,26 @@ class MinePageDatasModel{
return WDHttp.post<ResponseDTO>(url,object)
};
visitorMergeComment() {
let bean: Record<string, string> = {};
bean['time'] = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, "") as string
bean['deviceId'] = HttpUtils.getDeviceId();
return new Promise<object>((success, error) => {
// Logger.info(TAG, `visitorMergeComment`);
HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.visitorMergeComment(), bean).then((data: ResponseDTO<object>) => {
if (!data) {
error()
}
if (data.code != 0) {
error()
}
SPHelper.default.save(SpConstants.FIRSTCOMMENTTIME, "")
success(data)
}).catch(() => {
error()
})
})
}
}
const minePageDatasModel = MinePageDatasModel.getInstance()
... ...
... ... @@ -60,7 +60,7 @@ export class LoginModel {
let bean: Record<string, Object> = {};
bean['phone'] = phone
bean['loginType'] = loginType
bean['deviceId'] = '60da5af6-9c59-3566-8622-8c6c00710994'
bean['deviceId'] = HttpUtils.getDeviceId()
bean['verificationCode'] = verificationCode
return new Promise<LoginBean>((success, fail) => {
HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean).then((data: ResponseDTO<LoginBean>) => {
... ... @@ -90,7 +90,7 @@ export class LoginModel {
bean['userName'] = phone
}
bean['loginType'] = loginType
bean['deviceId'] = '60da5af6-9c59-3566-8622-8c6c00710994'
bean['deviceId'] = HttpUtils.getDeviceId()
bean['password'] = password
bean['oldPassword'] = oldPassword
return new Promise<LoginBean>((success, fail) => {
... ...