zhenghy

merge

... ... @@ -511,7 +511,12 @@ export class HttpUrlUtils {
}
static getVerifyCodeByTokenUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/sendVerifyCodeByToken";
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/sendVerifyCodeByToken";
return url;
}
static getCheckVerifyCodeByToken() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/checkVerifyCodeByToken";
return url;
}
... ...
... ... @@ -3,6 +3,8 @@ import { EmptyComponent } from '../view/EmptyComponent'
@Entry
@Component
export struct DefaultPage {
@State type: number = 1
retry() {
console.log('daj点击了重试')
}
... ... @@ -10,10 +12,14 @@ export struct DefaultPage {
build() {
Row() {
EmptyComponent({
emptyType: 8, emptyButton: true, retry: () => {
emptyType: this.type,
emptyButton: true,
retry: () => {
this.retry()
}
})
// .height('612lpx')
// .width('100%')
}
}
}
\ No newline at end of file
... ...
... ... @@ -7,52 +7,52 @@ const TAG = 'EmptyComponent';
* WDViewDefaultType 缺省页
*/
export const enum WDViewDefaultType {
/// 1.默认
/// 0.默认
WDViewDefaultType_Default,
/// 2.无网
/// 1.无网
WDViewDefaultType_NoNetwork,
/// 3.暂无内容(列表页)
/// 2.暂无内容(列表页)
WDViewDefaultType_NoListContent,
/// 4.内容找不到了(内容详情页)
/// 3.内容找不到了(内容详情页)
WDViewDefaultType_NoContent,
/// 5.无搜索内容
/// 4.无搜索内容
WDViewDefaultType_NoSearchResult,
/// 6.无消息内容
/// 5.无消息内容
WDViewDefaultType_NoMessage,
/// 7.无收藏内容
/// 6.无收藏内容
WDViewDefaultType_NoCollection,
/// 8.无历史记录
/// 7.无历史记录
WDViewDefaultType_NoHistory,
/// 9.网络失败 请稍后重试-倒计时
/// 8.网络失败 请稍后重试-倒计时
WDViewDefaultType_NetworkFailed,
/// 10.内容获取失败
/// 9.内容获取失败
WDViewDefaultType_ContentFailed,
/// 11.无预约内容
/// 10.无预约内容
WDViewDefaultType_NoBooking,
/// 12.无评论内容
/// 11.无评论内容
WDViewDefaultType_NoComment,
/// 13.暂无作品
/// 12.暂无作品
WDViewDefaultType_NoCreation,
/// 14.该号主无法访问
/// 13.该号主无法访问
WDViewDefaultType_NoVisitAccount,
/// 15.暂无关注
/// 14.暂无关注
WDViewDefaultType_NoFollow,
/// 18.视频加载失败
/// 15.视频图集加载失败
WDViewDefaultType_NoVideo,
/// 19.暂无内容1
/// 16.暂无内容1
WDViewDefaultType_NoContent1,
}
/**
* 空数据/无数据
*/
// @Preview
@Preview
@Component
export struct EmptyComponent {
// private emptySize: SizeOptions = {};
@State emptyWidth: string | number = CommonConstants.FULL_PARENT;
@State emptyHeight: string | number = CommonConstants.FULL_PARENT;
@State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default
@Link emptyType: number; // 缺省图类型,传枚举
@State emptyButton: boolean = false
@State timeNum: number = 10
/**
... ... @@ -127,8 +127,8 @@ export struct EmptyComponent {
// .height(this.EMPTY_IMAGE_HEIGHT)
Text(this.emptyType !== 8 ? this.buildNoDataTip() : `${this.buildNoDataTip()}(${this.timeNum}s)`)
.fontSize($r('app.float.normal_text_size'))
.fontColor('#000000')
.fontSize($r('app.float.font_size_14'))
.fontColor('#FF999999')
.fontWeight(FontWeight.Normal)
.opacity(this.TEXT_OPACITY)
.margin({ top: this.EMPTY_TIP_TEXT_MARGIN_TOP })
... ... @@ -136,7 +136,8 @@ export struct EmptyComponent {
Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`);
})
if (this.emptyButton) {
if (this.isShowButton()) {
if (this.emptyType !== 15) {
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
... ... @@ -145,17 +146,37 @@ export struct EmptyComponent {
.fontColor('#FF666666')
.border({ width: 1 })
.borderColor('#FFEDEDED')
.borderRadius(4)
.fontSize($r('app.float.font_size_12'))
.margin({ top: 16 })
.padding(0)
.onClick(() => {
this.retry()
})
} else {
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
.height(28)
.backgroundColor(Color.Black)
.fontColor('#FFCCCCCC')
.border({ width: 1 })
.borderColor('#4DFFFFFF')
.borderRadius(4)
.fontSize($r('app.float.font_size_12'))
.margin({ top: 16 })
.padding(0)
.onClick(() => {
this.retry()
})
}
}
}
.justifyContent(FlexAlign.Center)
.width(this.emptyWidth)
.height(this.emptyHeight)
// .backgroundColor(Color.Black)
}
buildNoDataTip(): string {
... ... @@ -224,4 +245,12 @@ export struct EmptyComponent {
}
return imageString
}
isShowButton() {
if (this.emptyType === 1 || this.emptyType === 9 || this.emptyType === 15) {
return true
} else {
return false
}
}
}
... ...
... ... @@ -96,6 +96,16 @@ struct ForgetPasswordPage {
if (this.isEmpty(this.phoneContent)) {
return
}
if(this.pageType == 1){
this.loginViewModel.sendVerifyCodeByToken().then(()=>{
promptAction.showToast({ message: "验证码已发送成功" })
}).catch((message: string)=>{
promptAction.showToast({ message: message })
})
return
}
this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => {
promptAction.showToast({ message: "验证码已发送成功" })
Logger.debug(TAG, "sendVerifyCode: " + verifyCode)
... ... @@ -115,7 +125,20 @@ struct ForgetPasswordPage {
if (this.isEmpty(this.codeContent)) {
return
}
if(this.pageType == 1){
this.loginViewModel.checkVerifyCodeByToken(this.codeContent).then(()=>{
let params: SettingPasswordParams = {
pageID:'1',
phoneContent:this.phoneContent,
codeContent:this.codeContent,
pageType:this.pageType
}
WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params)
}).catch((message: string)=>{
promptAction.showToast({ message: message })
})
return
}
this.loginViewModel.checkVerifyCode(this.phoneContent, this.codeContent).then(() => {
let params: SettingPasswordParams = {
pageID:'1',
... ...
... ... @@ -41,9 +41,9 @@ export class LoginModel {
let bean: Record<string, string> = {};
// bean['phoneNum'] = number
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<string>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getVerifyCodeByTokenUrl(), bean, headers).then((data: ResponseDTO<string>) => {
if (!data || !data.data) {
return new Promise<object>((success, fail) => {
HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.getVerifyCodeByTokenUrl(),bean, headers).then((data: ResponseDTO<object>) => {
if (!data) {
fail("数据为空")
return
}
... ... @@ -51,7 +51,7 @@ export class LoginModel {
fail(data.message)
return
}
success(data.data)
success(data)
}, (error: Error) => {
fail(error.message)
Logger.debug("LoginViewModel:error ", error.toString())
... ... @@ -148,9 +148,9 @@ export class LoginModel {
// bean['phone'] = phone
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<CheckVerifyBean>((success, fail) => {
HttpRequest.post<ResponseDTO<CheckVerifyBean>>(HttpUrlUtils.getCheckVerifyByTokenCodeUrl(), bean, headers).then((data: ResponseDTO<CheckVerifyBean>) => {
HttpRequest.post<ResponseDTO<CheckVerifyBean>>(HttpUrlUtils.getCheckVerifyCodeByToken(), bean, headers).then((data: ResponseDTO<CheckVerifyBean>) => {
Logger.debug("LoginViewModel:success2 ", data.message)
if (!data || !data.data) {
if (!data) {
fail("数据为空")
return
}
... ... @@ -158,7 +158,9 @@ export class LoginModel {
fail(data.message)
return
}
if(data.data){
success(data.data)
}
}, (error: Error) => {
Logger.debug("LoginViewModel:error2 ", error.toString())
fail(error.message)
... ...
... ... @@ -33,7 +33,7 @@ export class LoginViewModel {
}
sendVerifyCodeByToken() {
return new Promise<string>((success, fail) => {
return new Promise<object>((success, fail) => {
this.loginModel.sendVerifyCodeByToken().then((data) => {
success(data)
}).catch((message: string) => {
... ... @@ -55,7 +55,6 @@ export class LoginViewModel {
SPHelper.default.save(SpConstants.USER_STATUS, data.status)
SPHelper.default.save(SpConstants.USER_Type, data.userType)
SPHelper.default.save(SpConstants.USER_NAME, data.userName)
SPHelper.default.save(SpConstants.USER_PHONE, phone)
HttpUrlUtils.setUserId(data.id+"")
HttpUrlUtils.setUserType(data.userType+"")
HttpUrlUtils.setUserToken(data.jwtToken)
... ... @@ -80,7 +79,6 @@ export class LoginViewModel {
SPHelper.default.save(SpConstants.USER_STATUS, data.status)
SPHelper.default.save(SpConstants.USER_Type, data.userType)
SPHelper.default.save(SpConstants.USER_NAME, data.userName)
SPHelper.default.save(SpConstants.USER_PHONE, phone)
HttpUrlUtils.setUserId(data.id+"")
HttpUrlUtils.setUserType(data.userType+"")
HttpUrlUtils.setUserToken(data.jwtToken)
... ...