zhenghy

merge

@@ -511,7 +511,12 @@ export class HttpUrlUtils { @@ -511,7 +511,12 @@ export class HttpUrlUtils {
511 } 511 }
512 512
513 static getVerifyCodeByTokenUrl() { 513 static getVerifyCodeByTokenUrl() {
514 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/sendVerifyCodeByToken"; 514 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/sendVerifyCodeByToken";
  515 + return url;
  516 + }
  517 +
  518 + static getCheckVerifyCodeByToken() {
  519 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/checkVerifyCodeByToken";
515 return url; 520 return url;
516 } 521 }
517 522
@@ -3,6 +3,8 @@ import { EmptyComponent } from '../view/EmptyComponent' @@ -3,6 +3,8 @@ import { EmptyComponent } from '../view/EmptyComponent'
3 @Entry 3 @Entry
4 @Component 4 @Component
5 export struct DefaultPage { 5 export struct DefaultPage {
  6 + @State type: number = 1
  7 +
6 retry() { 8 retry() {
7 console.log('daj点击了重试') 9 console.log('daj点击了重试')
8 } 10 }
@@ -10,10 +12,14 @@ export struct DefaultPage { @@ -10,10 +12,14 @@ export struct DefaultPage {
10 build() { 12 build() {
11 Row() { 13 Row() {
12 EmptyComponent({ 14 EmptyComponent({
13 - emptyType: 8, emptyButton: true, retry: () => { 15 + emptyType: this.type,
  16 + emptyButton: true,
  17 + retry: () => {
14 this.retry() 18 this.retry()
15 } 19 }
16 }) 20 })
  21 + // .height('612lpx')
  22 + // .width('100%')
17 } 23 }
18 } 24 }
19 } 25 }
@@ -7,52 +7,52 @@ const TAG = 'EmptyComponent'; @@ -7,52 +7,52 @@ const TAG = 'EmptyComponent';
7 * WDViewDefaultType 缺省页 7 * WDViewDefaultType 缺省页
8 */ 8 */
9 export const enum WDViewDefaultType { 9 export const enum WDViewDefaultType {
10 - /// 1.默认 10 + /// 0.默认
11 WDViewDefaultType_Default, 11 WDViewDefaultType_Default,
12 - /// 2.无网 12 + /// 1.无网
13 WDViewDefaultType_NoNetwork, 13 WDViewDefaultType_NoNetwork,
14 - /// 3.暂无内容(列表页) 14 + /// 2.暂无内容(列表页)
15 WDViewDefaultType_NoListContent, 15 WDViewDefaultType_NoListContent,
16 - /// 4.内容找不到了(内容详情页) 16 + /// 3.内容找不到了(内容详情页)
17 WDViewDefaultType_NoContent, 17 WDViewDefaultType_NoContent,
18 - /// 5.无搜索内容 18 + /// 4.无搜索内容
19 WDViewDefaultType_NoSearchResult, 19 WDViewDefaultType_NoSearchResult,
20 - /// 6.无消息内容 20 + /// 5.无消息内容
21 WDViewDefaultType_NoMessage, 21 WDViewDefaultType_NoMessage,
22 - /// 7.无收藏内容 22 + /// 6.无收藏内容
23 WDViewDefaultType_NoCollection, 23 WDViewDefaultType_NoCollection,
24 - /// 8.无历史记录 24 + /// 7.无历史记录
25 WDViewDefaultType_NoHistory, 25 WDViewDefaultType_NoHistory,
26 - /// 9.网络失败 请稍后重试-倒计时 26 + /// 8.网络失败 请稍后重试-倒计时
27 WDViewDefaultType_NetworkFailed, 27 WDViewDefaultType_NetworkFailed,
28 - /// 10.内容获取失败 28 + /// 9.内容获取失败
29 WDViewDefaultType_ContentFailed, 29 WDViewDefaultType_ContentFailed,
30 - /// 11.无预约内容 30 + /// 10.无预约内容
31 WDViewDefaultType_NoBooking, 31 WDViewDefaultType_NoBooking,
32 - /// 12.无评论内容 32 + /// 11.无评论内容
33 WDViewDefaultType_NoComment, 33 WDViewDefaultType_NoComment,
34 - /// 13.暂无作品 34 + /// 12.暂无作品
35 WDViewDefaultType_NoCreation, 35 WDViewDefaultType_NoCreation,
36 - /// 14.该号主无法访问 36 + /// 13.该号主无法访问
37 WDViewDefaultType_NoVisitAccount, 37 WDViewDefaultType_NoVisitAccount,
38 - /// 15.暂无关注 38 + /// 14.暂无关注
39 WDViewDefaultType_NoFollow, 39 WDViewDefaultType_NoFollow,
40 - /// 18.视频加载失败 40 + /// 15.视频图集加载失败
41 WDViewDefaultType_NoVideo, 41 WDViewDefaultType_NoVideo,
42 - /// 19.暂无内容1 42 + /// 16.暂无内容1
43 WDViewDefaultType_NoContent1, 43 WDViewDefaultType_NoContent1,
44 } 44 }
45 45
46 /** 46 /**
47 * 空数据/无数据 47 * 空数据/无数据
48 */ 48 */
49 -// @Preview 49 +@Preview
50 @Component 50 @Component
51 export struct EmptyComponent { 51 export struct EmptyComponent {
52 // private emptySize: SizeOptions = {}; 52 // private emptySize: SizeOptions = {};
53 @State emptyWidth: string | number = CommonConstants.FULL_PARENT; 53 @State emptyWidth: string | number = CommonConstants.FULL_PARENT;
54 @State emptyHeight: string | number = CommonConstants.FULL_PARENT; 54 @State emptyHeight: string | number = CommonConstants.FULL_PARENT;
55 - @State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default 55 + @Link emptyType: number; // 缺省图类型,传枚举
56 @State emptyButton: boolean = false 56 @State emptyButton: boolean = false
57 @State timeNum: number = 10 57 @State timeNum: number = 10
58 /** 58 /**
@@ -127,8 +127,8 @@ export struct EmptyComponent { @@ -127,8 +127,8 @@ export struct EmptyComponent {
127 // .height(this.EMPTY_IMAGE_HEIGHT) 127 // .height(this.EMPTY_IMAGE_HEIGHT)
128 128
129 Text(this.emptyType !== 8 ? this.buildNoDataTip() : `${this.buildNoDataTip()}(${this.timeNum}s)`) 129 Text(this.emptyType !== 8 ? this.buildNoDataTip() : `${this.buildNoDataTip()}(${this.timeNum}s)`)
130 - .fontSize($r('app.float.normal_text_size'))  
131 - .fontColor('#000000') 130 + .fontSize($r('app.float.font_size_14'))
  131 + .fontColor('#FF999999')
132 .fontWeight(FontWeight.Normal) 132 .fontWeight(FontWeight.Normal)
133 .opacity(this.TEXT_OPACITY) 133 .opacity(this.TEXT_OPACITY)
134 .margin({ top: this.EMPTY_TIP_TEXT_MARGIN_TOP }) 134 .margin({ top: this.EMPTY_TIP_TEXT_MARGIN_TOP })
@@ -136,26 +136,47 @@ export struct EmptyComponent { @@ -136,26 +136,47 @@ export struct EmptyComponent {
136 Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`); 136 Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`);
137 }) 137 })
138 138
139 - if (this.emptyButton) {  
140 - Button('点击重试')  
141 - .type(ButtonType.Normal)  
142 - .width(80)  
143 - .height(28)  
144 - .backgroundColor('#fffffff')  
145 - .fontColor('#FF666666')  
146 - .border({ width: 1 })  
147 - .borderColor('#FFEDEDED')  
148 - .fontSize($r('app.float.font_size_12'))  
149 - .margin({ top: 16 })  
150 - .padding(0)  
151 - .onClick(() => {  
152 - this.retry()  
153 - }) 139 + if (this.isShowButton()) {
  140 + if (this.emptyType !== 15) {
  141 + Button('点击重试')
  142 + .type(ButtonType.Normal)
  143 + .width(80)
  144 + .height(28)
  145 + .backgroundColor('#fffffff')
  146 + .fontColor('#FF666666')
  147 + .border({ width: 1 })
  148 + .borderColor('#FFEDEDED')
  149 + .borderRadius(4)
  150 + .fontSize($r('app.float.font_size_12'))
  151 + .margin({ top: 16 })
  152 + .padding(0)
  153 + .onClick(() => {
  154 + this.retry()
  155 + })
  156 + } else {
  157 + Button('点击重试')
  158 + .type(ButtonType.Normal)
  159 + .width(80)
  160 + .height(28)
  161 + .backgroundColor(Color.Black)
  162 + .fontColor('#FFCCCCCC')
  163 + .border({ width: 1 })
  164 + .borderColor('#4DFFFFFF')
  165 + .borderRadius(4)
  166 + .fontSize($r('app.float.font_size_12'))
  167 + .margin({ top: 16 })
  168 + .padding(0)
  169 + .onClick(() => {
  170 + this.retry()
  171 + })
  172 + }
154 } 173 }
155 } 174 }
156 .justifyContent(FlexAlign.Center) 175 .justifyContent(FlexAlign.Center)
157 .width(this.emptyWidth) 176 .width(this.emptyWidth)
158 .height(this.emptyHeight) 177 .height(this.emptyHeight)
  178 +
  179 + // .backgroundColor(Color.Black)
159 } 180 }
160 181
161 buildNoDataTip(): string { 182 buildNoDataTip(): string {
@@ -224,4 +245,12 @@ export struct EmptyComponent { @@ -224,4 +245,12 @@ export struct EmptyComponent {
224 } 245 }
225 return imageString 246 return imageString
226 } 247 }
227 -}  
  248 +
  249 + isShowButton() {
  250 + if (this.emptyType === 1 || this.emptyType === 9 || this.emptyType === 15) {
  251 + return true
  252 + } else {
  253 + return false
  254 + }
  255 + }
  256 +}
@@ -96,6 +96,16 @@ struct ForgetPasswordPage { @@ -96,6 +96,16 @@ struct ForgetPasswordPage {
96 if (this.isEmpty(this.phoneContent)) { 96 if (this.isEmpty(this.phoneContent)) {
97 return 97 return
98 } 98 }
  99 +
  100 + if(this.pageType == 1){
  101 + this.loginViewModel.sendVerifyCodeByToken().then(()=>{
  102 + promptAction.showToast({ message: "验证码已发送成功" })
  103 + }).catch((message: string)=>{
  104 + promptAction.showToast({ message: message })
  105 + })
  106 + return
  107 + }
  108 +
99 this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => { 109 this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => {
100 promptAction.showToast({ message: "验证码已发送成功" }) 110 promptAction.showToast({ message: "验证码已发送成功" })
101 Logger.debug(TAG, "sendVerifyCode: " + verifyCode) 111 Logger.debug(TAG, "sendVerifyCode: " + verifyCode)
@@ -115,7 +125,20 @@ struct ForgetPasswordPage { @@ -115,7 +125,20 @@ struct ForgetPasswordPage {
115 if (this.isEmpty(this.codeContent)) { 125 if (this.isEmpty(this.codeContent)) {
116 return 126 return
117 } 127 }
118 - 128 + if(this.pageType == 1){
  129 + this.loginViewModel.checkVerifyCodeByToken(this.codeContent).then(()=>{
  130 + let params: SettingPasswordParams = {
  131 + pageID:'1',
  132 + phoneContent:this.phoneContent,
  133 + codeContent:this.codeContent,
  134 + pageType:this.pageType
  135 + }
  136 + WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params)
  137 + }).catch((message: string)=>{
  138 + promptAction.showToast({ message: message })
  139 + })
  140 + return
  141 + }
119 this.loginViewModel.checkVerifyCode(this.phoneContent, this.codeContent).then(() => { 142 this.loginViewModel.checkVerifyCode(this.phoneContent, this.codeContent).then(() => {
120 let params: SettingPasswordParams = { 143 let params: SettingPasswordParams = {
121 pageID:'1', 144 pageID:'1',
@@ -41,9 +41,9 @@ export class LoginModel { @@ -41,9 +41,9 @@ export class LoginModel {
41 let bean: Record<string, string> = {}; 41 let bean: Record<string, string> = {};
42 // bean['phoneNum'] = number 42 // bean['phoneNum'] = number
43 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 43 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
44 - return new Promise<string>((success, fail) => {  
45 - HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getVerifyCodeByTokenUrl(), bean, headers).then((data: ResponseDTO<string>) => {  
46 - if (!data || !data.data) { 44 + return new Promise<object>((success, fail) => {
  45 + HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.getVerifyCodeByTokenUrl(),bean, headers).then((data: ResponseDTO<object>) => {
  46 + if (!data) {
47 fail("数据为空") 47 fail("数据为空")
48 return 48 return
49 } 49 }
@@ -51,7 +51,7 @@ export class LoginModel { @@ -51,7 +51,7 @@ export class LoginModel {
51 fail(data.message) 51 fail(data.message)
52 return 52 return
53 } 53 }
54 - success(data.data) 54 + success(data)
55 }, (error: Error) => { 55 }, (error: Error) => {
56 fail(error.message) 56 fail(error.message)
57 Logger.debug("LoginViewModel:error ", error.toString()) 57 Logger.debug("LoginViewModel:error ", error.toString())
@@ -148,9 +148,9 @@ export class LoginModel { @@ -148,9 +148,9 @@ export class LoginModel {
148 // bean['phone'] = phone 148 // bean['phone'] = phone
149 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 149 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
150 return new Promise<CheckVerifyBean>((success, fail) => { 150 return new Promise<CheckVerifyBean>((success, fail) => {
151 - HttpRequest.post<ResponseDTO<CheckVerifyBean>>(HttpUrlUtils.getCheckVerifyByTokenCodeUrl(), bean, headers).then((data: ResponseDTO<CheckVerifyBean>) => { 151 + HttpRequest.post<ResponseDTO<CheckVerifyBean>>(HttpUrlUtils.getCheckVerifyCodeByToken(), bean, headers).then((data: ResponseDTO<CheckVerifyBean>) => {
152 Logger.debug("LoginViewModel:success2 ", data.message) 152 Logger.debug("LoginViewModel:success2 ", data.message)
153 - if (!data || !data.data) { 153 + if (!data) {
154 fail("数据为空") 154 fail("数据为空")
155 return 155 return
156 } 156 }
@@ -158,7 +158,9 @@ export class LoginModel { @@ -158,7 +158,9 @@ export class LoginModel {
158 fail(data.message) 158 fail(data.message)
159 return 159 return
160 } 160 }
161 - success(data.data) 161 + if(data.data){
  162 + success(data.data)
  163 + }
162 }, (error: Error) => { 164 }, (error: Error) => {
163 Logger.debug("LoginViewModel:error2 ", error.toString()) 165 Logger.debug("LoginViewModel:error2 ", error.toString())
164 fail(error.message) 166 fail(error.message)
@@ -33,7 +33,7 @@ export class LoginViewModel { @@ -33,7 +33,7 @@ export class LoginViewModel {
33 } 33 }
34 34
35 sendVerifyCodeByToken() { 35 sendVerifyCodeByToken() {
36 - return new Promise<string>((success, fail) => { 36 + return new Promise<object>((success, fail) => {
37 this.loginModel.sendVerifyCodeByToken().then((data) => { 37 this.loginModel.sendVerifyCodeByToken().then((data) => {
38 success(data) 38 success(data)
39 }).catch((message: string) => { 39 }).catch((message: string) => {
@@ -55,7 +55,6 @@ export class LoginViewModel { @@ -55,7 +55,6 @@ export class LoginViewModel {
55 SPHelper.default.save(SpConstants.USER_STATUS, data.status) 55 SPHelper.default.save(SpConstants.USER_STATUS, data.status)
56 SPHelper.default.save(SpConstants.USER_Type, data.userType) 56 SPHelper.default.save(SpConstants.USER_Type, data.userType)
57 SPHelper.default.save(SpConstants.USER_NAME, data.userName) 57 SPHelper.default.save(SpConstants.USER_NAME, data.userName)
58 - SPHelper.default.save(SpConstants.USER_PHONE, phone)  
59 HttpUrlUtils.setUserId(data.id+"") 58 HttpUrlUtils.setUserId(data.id+"")
60 HttpUrlUtils.setUserType(data.userType+"") 59 HttpUrlUtils.setUserType(data.userType+"")
61 HttpUrlUtils.setUserToken(data.jwtToken) 60 HttpUrlUtils.setUserToken(data.jwtToken)
@@ -80,7 +79,6 @@ export class LoginViewModel { @@ -80,7 +79,6 @@ export class LoginViewModel {
80 SPHelper.default.save(SpConstants.USER_STATUS, data.status) 79 SPHelper.default.save(SpConstants.USER_STATUS, data.status)
81 SPHelper.default.save(SpConstants.USER_Type, data.userType) 80 SPHelper.default.save(SpConstants.USER_Type, data.userType)
82 SPHelper.default.save(SpConstants.USER_NAME, data.userName) 81 SPHelper.default.save(SpConstants.USER_NAME, data.userName)
83 - SPHelper.default.save(SpConstants.USER_PHONE, phone)  
84 HttpUrlUtils.setUserId(data.id+"") 82 HttpUrlUtils.setUserId(data.id+"")
85 HttpUrlUtils.setUserType(data.userType+"") 83 HttpUrlUtils.setUserType(data.userType+"")
86 HttpUrlUtils.setUserToken(data.jwtToken) 84 HttpUrlUtils.setUserToken(data.jwtToken)