yuzhilin
@@ -30,6 +30,7 @@ export struct CustomToast { @@ -30,6 +30,7 @@ export struct CustomToast {
30 .fontSize("27lpx") 30 .fontSize("27lpx")
31 .lineHeight("38lpx") 31 .lineHeight("38lpx")
32 }.borderRadius(`${this.bgBorderRadius}lpx`) 32 }.borderRadius(`${this.bgBorderRadius}lpx`)
  33 + .constraintSize({maxWidth:"86%"})
33 .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"}) 34 .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"})
34 .backgroundColor($r("app.color.black")) 35 .backgroundColor($r("app.color.black"))
35 .opacity(0.7) 36 .opacity(0.7)
@@ -297,6 +297,10 @@ export class HttpUrlUtils { @@ -297,6 +297,10 @@ export class HttpUrlUtils {
297 */ 297 */
298 static readonly ATTENTION_BATCH_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/attention/batch"; 298 static readonly ATTENTION_BATCH_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/attention/batch";
299 299
  300 + /**
  301 + * 查询是否设置过密码checkSetPassword
  302 + */
  303 + static readonly CHECK_SET_PASSWORD_PATH: string = "/api/rmrb-user-center/user/zh/c/ifSetPassword";
300 304
301 static getHost(): string { 305 static getHost(): string {
302 return HostManager.getHost(); 306 return HostManager.getHost();
@@ -689,4 +693,10 @@ export class HttpUrlUtils { @@ -689,4 +693,10 @@ export class HttpUrlUtils {
689 return url; 693 return url;
690 } 694 }
691 695
  696 + //查询是否设置过密码
  697 + static checkSetPassword() {
  698 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.CHECK_SET_PASSWORD_PATH;
  699 + return url;
  700 + }
  701 +
692 } 702 }
@@ -68,6 +68,7 @@ export class WDRouterPage { @@ -68,6 +68,7 @@ export class WDRouterPage {
68 static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); 68 static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage");
69 static oneKeyLoginPage = new WDRouterPage("wdLogin", "ets/pages/login/OneKeyLoginPage"); 69 static oneKeyLoginPage = new WDRouterPage("wdLogin", "ets/pages/login/OneKeyLoginPage");
70 static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); 70 static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage");
  71 + static modifyPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ModifyPasswordPage");
71 //我的 预约 72 //我的 预约
72 static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); 73 static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage");
73 //我的 关注 74 //我的 关注
@@ -170,13 +170,20 @@ export default struct MinePageUserSimpleInfoUI { @@ -170,13 +170,20 @@ export default struct MinePageUserSimpleInfoUI {
170 if(value!=null){ 170 if(value!=null){
171 if(StringUtils.isEmpty(this.levelHead)){ 171 if(StringUtils.isEmpty(this.levelHead)){
172 if(this.userType === "1"){ 172 if(this.userType === "1"){
  173 + if(value.levelHead != undefined){
173 this.levelHead = value.levelHead 174 this.levelHead = value.levelHead
174 } 175 }
175 } 176 }
  177 + }
  178 + if(value.levelId != undefined){
176 this.levelId = value.levelId 179 this.levelId = value.levelId
177 UserDataLocal.setUserLevel(this.levelId) 180 UserDataLocal.setUserLevel(this.levelId)
  181 + }
  182 +
  183 + if(StringUtils.isNotEmpty(this.levelHead)){
178 UserDataLocal.setUserLevelHeaderUrl(this.levelHead + "") 184 UserDataLocal.setUserLevelHeaderUrl(this.levelHead + "")
179 } 185 }
  186 + }
180 }).catch((err:Error)=>{ 187 }).catch((err:Error)=>{
181 console.log(TAG,JSON.stringify(err)) 188 console.log(TAG,JSON.stringify(err))
182 }) 189 })
@@ -3,6 +3,7 @@ import { MineSettingComponent } from '../setting/MineSettingComponent'; @@ -3,6 +3,7 @@ import { MineSettingComponent } from '../setting/MineSettingComponent';
3 import { AccountAndSecurityLayout } from '../setting/AccountAndSecurityLayout'; 3 import { AccountAndSecurityLayout } from '../setting/AccountAndSecurityLayout';
4 import router from '@ohos.router'; 4 import router from '@ohos.router';
5 import { Action, Params } from 'wdBean'; 5 import { Action, Params } from 'wdBean';
  6 +import { DateTimeUtils } from 'wdKit/Index';
6 7
7 @Entry 8 @Entry
8 @Component 9 @Component
@@ -10,11 +11,12 @@ struct SettingPage { @@ -10,11 +11,12 @@ struct SettingPage {
10 @State message: string = 'Hello World 02' 11 @State message: string = 'Hello World 02'
11 @State pageType: string = 'mainSetting'; 12 @State pageType: string = 'mainSetting';
12 @State params:Params = router.getParams() as Params; 13 @State params:Params = router.getParams() as Params;
  14 + @State enterActivityTime:number = 0;
13 15
14 onPageShow() { 16 onPageShow() {
15 17
16 this.pageType = this.params.pageID; 18 this.pageType = this.params.pageID;
17 - 19 + this.enterActivityTime = DateTimeUtils.getTimeStamp()
18 } 20 }
19 21
20 build() { 22 build() {
@@ -22,7 +24,7 @@ struct SettingPage { @@ -22,7 +24,7 @@ struct SettingPage {
22 if (this.pageType == 'mainSetting') { 24 if (this.pageType == 'mainSetting') {
23 MineSettingComponent() 25 MineSettingComponent()
24 } else { 26 } else {
25 - AccountAndSecurityLayout() 27 + AccountAndSecurityLayout({enterActivityTime:this.enterActivityTime})
26 } 28 }
27 }.setFullWidth() 29 }.setFullWidth()
28 } 30 }
@@ -29,6 +29,10 @@ export struct AccountAndSecurityLayout { @@ -29,6 +29,10 @@ export struct AccountAndSecurityLayout {
29 @State cacheSice: number = 0 29 @State cacheSice: number = 0
30 @State protocolState: boolean = false //协议勾选状态 30 @State protocolState: boolean = false //协议勾选状态
31 @State isAccountPage: boolean = true 31 @State isAccountPage: boolean = true
  32 + @State ifSetPassword: boolean = false //是否设置过密码
  33 +
  34 + @Watch("checkSetPassword") @Prop enterActivityTime:number = 0;
  35 +
32 logoutViewModel = new LogoutViewModel() 36 logoutViewModel = new LogoutViewModel()
33 dialogController: CustomDialogController = new CustomDialogController({ 37 dialogController: CustomDialogController = new CustomDialogController({
34 builder: CustomLogoutDialog({ 38 builder: CustomLogoutDialog({
@@ -61,6 +65,23 @@ export struct AccountAndSecurityLayout { @@ -61,6 +65,23 @@ export struct AccountAndSecurityLayout {
61 // 获取设置页面数据 65 // 获取设置页面数据
62 this.getAccountAndSecurityData() 66 this.getAccountAndSecurityData()
63 this.addEmitEvent() 67 this.addEmitEvent()
  68 + this.checkSetPassword()
  69 + }
  70 +
  71 + checkSetPassword(){
  72 + MineSettingDatasModel.checkSetPassword().then((value) => {
  73 + if (value != null) {
  74 + if(value.hasSet == "1"){
  75 + this.ifSetPassword = true
  76 + if(this.listData.length>0){
  77 + this.listData[1] = new MineMainSettingFunctionItem(null, '修改密码', null, 0, false,"")
  78 + }
  79 + }else{
  80 + this.ifSetPassword = false
  81 + }
  82 + }
  83 + }).catch((err: Error) => {
  84 + })
64 } 85 }
65 86
66 async getAccountAndSecurityData() { 87 async getAccountAndSecurityData() {
@@ -162,9 +183,14 @@ export struct AccountAndSecurityLayout { @@ -162,9 +183,14 @@ export struct AccountAndSecurityLayout {
162 let pageType = {'pageType': 2} as Record<string, number>; 183 let pageType = {'pageType': 2} as Record<string, number>;
163 WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) 184 WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType)
164 }else if (index == 1) { 185 }else if (index == 1) {
165 - 186 + if (this.ifSetPassword) {
  187 + //修改密码
  188 + WDRouterRule.jumpWithPage(WDRouterPage.modifyPasswordPage)
  189 + }else{
  190 + //设置密码
166 let pageType = {'pageType': 1} as Record<string, number>; 191 let pageType = {'pageType': 1} as Record<string, number>;
167 WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) 192 WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType)
  193 + }
168 }else if (index == 3) { 194 }else if (index == 3) {
169 this.isAccountPage=false 195 this.isAccountPage=false
170 // WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) 196 // WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType)
1 1
2 import HashMap from '@ohos.util.HashMap'; 2 import HashMap from '@ohos.util.HashMap';
3 -import { ResponseDTO, WDHttp } from 'wdNetwork'; 3 +import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
4 import { Logger, SPHelper } from 'wdKit'; 4 import { Logger, SPHelper } from 'wdKit';
5 import { MineMainSettingFunctionItem } from '../viewmodel/MineMainSettingFunctionItem'; 5 import { MineMainSettingFunctionItem } from '../viewmodel/MineMainSettingFunctionItem';
6 import { SpConstants } from 'wdConstant/Index'; 6 import { SpConstants } from 'wdConstant/Index';
  7 +import { CheckSetPasswordItem } from '../viewmodel/CheckSetPasswordItem';
7 8
8 9
9 const TAG = "MineSettingDatasModel" 10 const TAG = "MineSettingDatasModel"
@@ -108,6 +109,33 @@ class MineSettingDatasModel{ @@ -108,6 +109,33 @@ class MineSettingDatasModel{
108 // }) 109 // })
109 // } 110 // }
110 111
  112 +
  113 + /**
  114 + * 判断是否设置过密码
  115 + */
  116 + checkSetPassword(): Promise<CheckSetPasswordItem> {
  117 + return new Promise<CheckSetPasswordItem>((success, error) => {
  118 + Logger.info(TAG, `checkSetPassword start`);
  119 + this.fetchCheckSetPassword().then((navResDTO: ResponseDTO<CheckSetPasswordItem>) => {
  120 + if (!navResDTO || navResDTO.code != 0) {
  121 + error(null)
  122 + return
  123 + }
  124 + Logger.info(TAG, "checkSetPassword then,checkSetPasswordResDTO.timeStamp:" + navResDTO.timestamp);
  125 + let navigationBean = navResDTO.data as CheckSetPasswordItem
  126 + success(navigationBean);
  127 + }).catch((err: Error) => {
  128 + Logger.error(TAG, `checkSetPassword catch, error.name : ${err.name}, error.message:${err.message}`);
  129 + error(null)
  130 + })
  131 + })
  132 + }
  133 +
  134 + fetchCheckSetPassword() {
  135 + let url = HttpUrlUtils.checkSetPassword()
  136 + return WDHttp.get<ResponseDTO<CheckSetPasswordItem>>(url)
  137 + };
  138 +
111 } 139 }
112 140
113 const mineSettingDatasModel = MineSettingDatasModel.getInstance() 141 const mineSettingDatasModel = MineSettingDatasModel.getInstance()
  1 +
  2 +export class CheckSetPasswordItem{
  3 + hasSet: string = "0" //是否设置过密码,0未设置,1已设置
  4 +}
@@ -122,6 +122,26 @@ struct ForgetPasswordPage { @@ -122,6 +122,26 @@ struct ForgetPasswordPage {
122 return 122 return
123 } 123 }
124 124
  125 + if(this.pageType == 0 && this.phoneContent.indexOf("****")!=-1){
  126 + //设置密码 忘记密码跳转过来的 需要使用上面方法
  127 + this.loginViewModel.sendVerifyCodeByToken().then(()=>{
  128 + this.showToastTip("已发送")
  129 + this.codeStateSuccess=true
  130 + this.isCodeSend=false
  131 + }).catch((message: string)=>{
  132 + let netStatus = NetworkUtil.isNetConnected()
  133 + if (netStatus) {
  134 + this.showToastTip(message)
  135 + } else {
  136 + this.showToastTip("验证码获取失败,请重新尝试")
  137 + }
  138 + this.codeStateSuccess=false
  139 + this.isCodeSend=false
  140 + })
  141 +
  142 + return
  143 + }
  144 +
125 this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => { 145 this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => {
126 this.showToastTip("已发送") 146 this.showToastTip("已发送")
127 this.codeStateSuccess=true 147 this.codeStateSuccess=true
@@ -166,6 +186,22 @@ struct ForgetPasswordPage { @@ -166,6 +186,22 @@ struct ForgetPasswordPage {
166 }) 186 })
167 return 187 return
168 } 188 }
  189 +
  190 + if(this.pageType == 0 && this.phoneContent.indexOf("****")!=-1){
  191 + this.loginViewModel.checkVerifyCodeByToken(this.codeContent).then(()=>{
  192 + let params: SettingPasswordParams = {
  193 + pageID:'1',
  194 + phoneContent:this.phoneContent,
  195 + codeContent:this.codeContent,
  196 + pageType:1
  197 + }
  198 + WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params)
  199 + }).catch((message: string)=>{
  200 + this.showToastTip(message)
  201 + })
  202 + return
  203 + }
  204 +
169 this.loginViewModel.checkVerifyCode(this.phoneContent, this.codeContent).then(() => { 205 this.loginViewModel.checkVerifyCode(this.phoneContent, this.codeContent).then(() => {
170 let params: SettingPasswordParams = { 206 let params: SettingPasswordParams = {
171 pageID:'1', 207 pageID:'1',
1 import { SpConstants } from 'wdConstant/Index' 1 import { SpConstants } from 'wdConstant/Index'
2 -import { DateTimeUtils, Logger, SPHelper } from 'wdKit' 2 +import { DateTimeUtils, Logger, SPHelper, StringUtils } from 'wdKit'
3 3
4 @Component 4 @Component
5 export struct LoginInputComponent { 5 export struct LoginInputComponent {
@@ -33,9 +33,15 @@ export struct LoginInputComponent { @@ -33,9 +33,15 @@ export struct LoginInputComponent {
33 } 33 }
34 34
35 async aboutToAppear(){ 35 async aboutToAppear(){
36 - if (this.pageType == 1) { 36 + if (this.pageType == 1 ) {
37 this.phoneContent = await SPHelper.default.get(SpConstants.USER_PHONE,"") as string; 37 this.phoneContent = await SPHelper.default.get(SpConstants.USER_PHONE,"") as string;
38 } 38 }
  39 + if(this.pageType == 0 ){
  40 + let phone = await SPHelper.default.get(SpConstants.USER_PHONE,"") as string
  41 + if(StringUtils.isNotEmpty(phone)){
  42 + this.phoneContent = phone
  43 + }
  44 + }
39 } 45 }
40 @Builder 46 @Builder
41 addCodeLayout() { 47 addCodeLayout() {
@@ -60,6 +66,27 @@ export struct LoginInputComponent { @@ -60,6 +66,27 @@ export struct LoginInputComponent {
60 } 66 }
61 }) 67 })
62 }else{ 68 }else{
  69 + //修改密码 里面的 忘记密码(已登录)
  70 + if(StringUtils.isNotEmpty(this.phoneContent) && this.phoneContent.indexOf("****")!=-1 && this.pageType == 0){
  71 + TextInput({ text: this.securityPhone(this.phoneContent) })
  72 + .fontColor("#333333")
  73 + .fontSize(16)
  74 + .height(48)
  75 + .maxLength(11)
  76 + .margin({ top: 36 })
  77 + .borderRadius(4)
  78 + .focusable(false)
  79 + .type(InputType.PhoneNumber)
  80 + .onChange((content) => {
  81 + this.phoneContent = content
  82 + this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 4)
  83 + if (content.length >= 11) {
  84 + this.codeBtnState = true
  85 + } else {
  86 + this.codeBtnState = false
  87 + }
  88 + })
  89 + }else {
63 TextInput({text: this.phoneContent, placeholder: "请输入手机号" }) 90 TextInput({text: this.phoneContent, placeholder: "请输入手机号" })
64 .fontSize(16) 91 .fontSize(16)
65 .height(48) 92 .height(48)
@@ -88,6 +115,7 @@ export struct LoginInputComponent { @@ -88,6 +115,7 @@ export struct LoginInputComponent {
88 } 115 }
89 }) 116 })
90 } 117 }
  118 + }
91 119
92 120
93 Row() { 121 Row() {
1 import HashMap from '@ohos.util.HashMap'; 1 import HashMap from '@ohos.util.HashMap';
2 -import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork'; 2 +import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork';
3 import { Logger } from 'wdKit'; 3 import { Logger } from 'wdKit';
4 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; 4 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
5 import { LoginBean } from './LoginBean'; 5 import { LoginBean } from './LoginBean';
6 import { CheckVerifyBean } from './CheckVerifyBean'; 6 import { CheckVerifyBean } from './CheckVerifyBean';
7 import { UserDetail } from 'wdBean/Index'; 7 import { UserDetail } from 'wdBean/Index';
  8 +import { ModifyPasswordRequestItem } from './ModifyPasswordRequestItem';
8 9
9 const TAG = 'LoginModel' 10 const TAG = 'LoginModel'
10 11
@@ -312,5 +313,30 @@ export class LoginModel { @@ -312,5 +313,30 @@ export class LoginModel {
312 }) 313 })
313 } 314 }
314 315
  316 + /**
  317 + * 修改密码
  318 + */
  319 + modifyPassword(obj:ModifyPasswordRequestItem): Promise<String> {
  320 + return new Promise<String>((success, error) => {
  321 + Logger.info(TAG, `modifyPassword start`);
  322 + this.fetchModifyPassword(obj).then((navResDTO: ResponseDTO<String>) => {
  323 + if (!navResDTO || navResDTO.code != 0) {
  324 + error(navResDTO.message)
  325 + return
  326 + }
  327 + Logger.info(TAG, "modifyPassword then,modifyPasswordResDTO.timeStamp:" + navResDTO.timestamp);
  328 + success("0");
  329 + }).catch((err: Error) => {
  330 + Logger.error(TAG, `modifyPassword catch, error.name : ${err.name}, error.message:${err.message}`);
  331 + error("出错了,请稍后重试")
  332 + })
  333 + })
  334 + }
  335 +
  336 + fetchModifyPassword(obj:ModifyPasswordRequestItem) {
  337 + let url = HttpUrlUtils.getResetPassworddUrl()
  338 + return WDHttp.post<ResponseDTO<String>>(url,obj)
  339 + };
  340 +
315 } 341 }
316 342
@@ -159,6 +159,7 @@ export class LoginViewModel { @@ -159,6 +159,7 @@ export class LoginViewModel {
159 SPHelper.default.saveSync(SpConstants.USER_STATUS, '') 159 SPHelper.default.saveSync(SpConstants.USER_STATUS, '')
160 SPHelper.default.saveSync(SpConstants.USER_Type, '') 160 SPHelper.default.saveSync(SpConstants.USER_Type, '')
161 SPHelper.default.saveSync(SpConstants.USER_NAME, '') 161 SPHelper.default.saveSync(SpConstants.USER_NAME, '')
  162 + SPHelper.default.saveSync(SpConstants.USER_PHONE, '')
162 UserDataLocal.clearUserData() 163 UserDataLocal.clearUserData()
163 success(data) 164 success(data)
164 }).catch((message: string) => { 165 }).catch((message: string) => {
  1 +import { CustomToast} from 'wdKit/Index';
  2 +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
  3 +import { LoginModel } from './LoginModel';
  4 +import { LoginViewModel } from './LoginViewModel';
  5 +import { ModifyPasswordRequestItem } from './ModifyPasswordRequestItem';
  6 +import { router } from '@kit.ArkUI';
  7 +import { encryptMessage } from '../../utils/cryptoUtil';
  8 +
  9 +/**
  10 + * 修改密码页面
  11 + * */
  12 +@Entry
  13 +@Component
  14 +struct ModifyPasswordPage {
  15 + password_old: string = '';
  16 + password_new: string = '';
  17 + password_new_repeat: string = '';
  18 + @State btnStatus: boolean = false;
  19 + @State toastText:string = ""
  20 + loginModel = new LoginModel()
  21 + dialogToast: CustomDialogController = new CustomDialogController({
  22 + builder: CustomToast({
  23 + msg: this.toastText,
  24 + }),
  25 + autoCancel: false,
  26 + alignment: DialogAlignment.Center,
  27 + offset: { dx: 0, dy: -20 },
  28 + gridCount: 1,
  29 + customStyle: true,
  30 + maskColor:"#00000000"
  31 + })
  32 +
  33 +
  34 + build() {
  35 + Row() {
  36 + Column() {
  37 + this.ModifyPasswordLayout()
  38 + }
  39 + .width('100%')
  40 + .height('100%')
  41 + }.width('100%')
  42 + .height('100%')
  43 + }
  44 +
  45 +
  46 + @Builder ModifyPasswordLayout(){
  47 + Navigation() {
  48 + Column(){
  49 + Column() {
  50 + Text("修改密码").fontWeight(FontWeight.Bold).fontSize(20).maxLines(1)
  51 + }
  52 + .width('100%')
  53 + .height('75lpx')
  54 + .alignItems(HorizontalAlign.Start)
  55 +
  56 + Row() {
  57 + Row() {
  58 + TextInput({ placeholder: "请输入原密码" })
  59 + .placeholderColor("#CCCCCC")
  60 + .type(InputType.Password)
  61 + .showPasswordIcon(true)
  62 + .backgroundColor('#00000000')
  63 + .onChange((value: string) => {
  64 + this.password_old = value
  65 + this.inputTextChange()
  66 + })
  67 + }
  68 + .alignItems(VerticalAlign.Center)
  69 + .height('80lpx')
  70 + .backgroundColor('#f5f5f5')
  71 + .borderRadius('4vp')
  72 + }
  73 + .width('100%')
  74 + .height('110lpx')
  75 + .backgroundColor(0xffffff0)
  76 + .alignItems(VerticalAlign.Center)
  77 +
  78 + Row() {
  79 + Row() {
  80 + TextInput({ placeholder: "请输入新密码" })
  81 + .placeholderColor("#CCCCCC")
  82 + .type(InputType.Password)
  83 + .showPasswordIcon(true)
  84 + .backgroundColor('#00000000')
  85 + .onChange((value: string) => {
  86 + this.password_new = value
  87 + this.inputTextChange()
  88 + })
  89 + }
  90 + .alignItems(VerticalAlign.Center)
  91 + .height('80lpx')
  92 + .backgroundColor('#f5f5f5')
  93 + .borderRadius('4vp')
  94 + }
  95 + .width('100%')
  96 + .height('110lpx')
  97 + .backgroundColor(0xffffff0)
  98 + .alignItems(VerticalAlign.Center)
  99 +
  100 + Row() {
  101 + Row() {
  102 + TextInput({ placeholder: "请再请输入原密码" })
  103 + .placeholderColor("#CCCCCC")
  104 + .type(InputType.Password)
  105 + .showPasswordIcon(true)
  106 + .backgroundColor('#00000000')
  107 + .onChange((value: string) => {
  108 + this.password_new_repeat = value
  109 + this.inputTextChange()
  110 + })
  111 + }
  112 + .alignItems(VerticalAlign.Center)
  113 + .height('80lpx')
  114 + .backgroundColor('#f5f5f5')
  115 + .borderRadius('4vp')
  116 + }
  117 + .width('100%')
  118 + .height('110lpx')
  119 + .backgroundColor(0xffffff0)
  120 + .alignItems(VerticalAlign.Center)
  121 +
  122 + Column() {
  123 + Text("提示:密码长度6-20位,需答谢字母、小写字母、数字、特殊字符中组合三种及三种以上组成").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'})
  124 + }
  125 + .width('100%')
  126 + .height('85lpx')
  127 + .alignItems(HorizontalAlign.Start)
  128 +
  129 + Row() {
  130 + Button("确认", { type: ButtonType.Normal, stateEffect: true })
  131 + .width('100%')
  132 + .height('80lpx')
  133 + .backgroundColor(this.btnStatus ? '#da3e22' : '#e5856d')
  134 + .fontColor('#fff')
  135 + .borderRadius('4vp')
  136 + .onClick(() => {
  137 + if(this.btnStatus){
  138 + this.submit()
  139 + }
  140 + })
  141 + }
  142 + .padding({top:'25lpx'})
  143 + .alignItems(VerticalAlign.Center)
  144 + .width('100%')
  145 + .height('120lpx')
  146 +
  147 + Column() {
  148 + Text("忘记密码").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'})
  149 + .onClick(()=>{
  150 + let pageType = { 'pageType': 0 } as Record<string, number>;
  151 + WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType)
  152 + })
  153 + }
  154 + .width('100%')
  155 + .height('85lpx')
  156 + .alignItems(HorizontalAlign.Center)
  157 + }.padding({top:"92lpx",left:"48lpx",right:"48lpx"})
  158 +
  159 + }.titleMode(NavigationTitleMode.Mini)
  160 + .title('')
  161 + }
  162 +
  163 + inputTextChange(){
  164 + if ((this.password_old.length >= 6 && this.password_old.length <= 20) && (this.password_new.length >= 6 && this.password_new.length <= 20)&& (this.password_new_repeat.length >= 6 && this.password_new_repeat.length <= 20)) {
  165 + this.btnStatus = true;
  166 + } else {
  167 + this.btnStatus = false;
  168 + }
  169 + }
  170 +
  171 + async submit(){
  172 + if(this.password_new != this.password_new_repeat ){
  173 + this.showToastTip("两次输入的密码不一致,请重新输入")
  174 + return
  175 + }
  176 + let old = await encryptMessage(this.password_old)
  177 + let newValue = await encryptMessage(this.password_new)
  178 + let c = new ModifyPasswordRequestItem(old,newValue)
  179 + this.loginModel.modifyPassword(c).then((value) => {
  180 + if (value != null) {
  181 + if(value == "0"){
  182 + this.showToastTip("修改成功")
  183 + router.back()
  184 + }
  185 + }
  186 + }).catch((err: string) => {
  187 + this.showToastTip(err)
  188 + })
  189 + }
  190 +
  191 + showToastTip(msg:string){
  192 + this.toastText = msg
  193 + this.dialogToast.open()
  194 + }
  195 +}
  1 +export class ModifyPasswordRequestItem{
  2 + oldPassword:string = ""
  3 + newPassword:string = ""
  4 +
  5 + constructor(oldPassword:string , newPassword:string) {
  6 + this.oldPassword = oldPassword
  7 + this.newPassword = newPassword
  8 + }
  9 +}
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 "pages/login/SettingPasswordPage", 7 "pages/login/SettingPasswordPage",
8 "pages/login/SettingPasswordLayout", 8 "pages/login/SettingPasswordLayout",
9 "pages/guide/GuidePages", 9 "pages/guide/GuidePages",
10 - "pages/login/OneKeyLoginPage" 10 + "pages/login/OneKeyLoginPage",
  11 + "pages/login/ModifyPasswordPage"
11 ] 12 ]
12 } 13 }