Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
shishuangxi
2024-04-16 15:02:05 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
37ceb5366b60cc21a19614eed576417c760baf41
37ceb536
1 parent
3f207053
绑定手机号
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
173 additions
and
18 deletions
sight_harmony/commons/wdConstant/src/main/ets/constants/SpConstants.ets
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
sight_harmony/features/wdComponent/src/main/ets/components/setting/AccountAndSecurityLayout.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/ForgetPasswordPage.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginModel.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginProtocolWebview.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginViewModel.ets
sight_harmony/products/phone/src/main/ets/pages/viewModel/LaunchModel.ets
sight_harmony/commons/wdConstant/src/main/ets/constants/SpConstants.ets
View file @
37ceb53
...
...
@@ -13,6 +13,11 @@ export class SpConstants{
//协议相关
static USER_PROTOCOL = "user_protocol" //用户协议
static PRIVATE_PROTOCOL = "private_protocol" //隐私协议
static LOGOUT_PROTOCOL = "logout_protocol" //人民日报客户端app注销协议
static MESSAGE_BOARD_USER_PROTOCOL = "message_board_user_protocol" //"留言板-用户协议"
static MESSAGE_BOARD_NOTICE_PROTOCOL = "message_board_notice_protocol" //留言板-留言须知
static MESSAGE_BOARD_QUESTION_PROTOCOL = "message_board_question_protocol" //"留言板-发布提问规定""
static MESSAGE_BOARD_PRIVATE_PROTOCOL = "message_board_private_protocol" //"留言板-隐私政策"
//设置页面
static SETTING_WIFI_IMAGE_SWITCH = "setting_wifi_switch" //wifi 图片开关
static SETTING_WIFI_VIDEO_SWITCH = "setting_wifi_switch" //wifi 视频开关
...
...
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
View file @
37ceb53
...
...
@@ -525,6 +525,12 @@ export class HttpUrlUtils {
return url;
}
//获取用户安全页信息
static querySecurity() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/security/query";
return url;
}
static getAppointmentListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH
return url
...
...
sight_harmony/features/wdComponent/src/main/ets/components/setting/AccountAndSecurityLayout.ets
View file @
37ceb53
...
...
@@ -17,6 +17,7 @@ import { Router } from '@ohos.arkui.UIContext';
import promptAction from '@ohos.promptAction';
import { LogoutViewModel } from '../../viewmodel/LogoutViewModel';
import { CustomLogoutDialog } from './CustomLogoutDialog';
import { emitter } from '@kit.BasicServicesKit';
export { SettingPasswordParams } from "wdLogin"
...
...
@@ -41,9 +42,11 @@ export struct AccountAndSecurityLayout {
alignment: DialogAlignment.Center
})
aboutToAppear() {
// 获取设置页面数据
this.getAccountAndSecurityData()
this.addEmitEvent()
}
async getAccountAndSecurityData() {
...
...
@@ -56,6 +59,28 @@ export struct AccountAndSecurityLayout {
}
addEmitEvent(){
// 定义一个eventId为1的事件
let event: emitter.InnerEvent = {
eventId: 10010
};
// 收到eventId为1的事件后执行该回调
let callback = (eventData: emitter.EventData): void => {
promptAction.showToast({
message: JSON.stringify(eventData)
});
if(eventData&&eventData.data){
this.listData[0].subTitle = eventData.data['content']
}
Logger.debug( 'event callback:' + JSON.stringify(eventData));
};
// 订阅eventId为1的事件
emitter.on(event, callback);
}
build() {
Column(){
if(this.isAccountPage){
...
...
@@ -106,7 +131,8 @@ export struct AccountAndSecurityLayout {
ListItem() {
if (item.type == 0) {
Column() {
this.getArrowCell(item)
// this.getArrowCell(item)
AccountArrowCell({ item:item})
}.padding({ left: '27lpx' }).height('117lpx').justifyContent(FlexAlign.Center)
} else if (item.type == 1) {
Column() {
...
...
@@ -285,7 +311,7 @@ export struct AccountAndSecurityLayout {
}.alignItems(VerticalAlign.Center)
Row() {
Text("
登录
")
Text("
注销账户
")
.borderRadius(4)
.fontColor(this.protocolState ? "#FFFFFFFF" : "#66FFFFFF")
.fontSize(18)
...
...
@@ -404,4 +430,47 @@ export struct AccountAndSecurityLayout {
securityNum = phoneNum.replace(needSecurityString,'****')
return securityNum;
}
}
@Component
export struct AccountArrowCell{
@ObjectLink item: MineMainSettingFunctionItem
build() {
Column() {
Row() {
// 左侧logo和标题
Row() {
// 判断有没有图片
if (this.item.imgSrc) {
Image(this.item.imgSrc)
.height('38lpx')
.margin({ right: '5lpx' })
}
Text(`${this.item.title}`)
.margin({ top: '8lpx' })
.height('38lpx')
.fontColor('#333333')
.fontSize('29lpx')
}.width('60%')
// 右侧文案和右箭头
Row() {
Text(this.item.subTitle ? this.item.subTitle : '')
.fontColor('#999999')
.maxLines(1)
Image($r('app.media.mine_user_arrow'))
.width('27lpx')
.height('27lpx')
.objectFit(ImageFit.Auto)
Column().width('29lpx')
}.width('40%')
.margin({ right: '29lpx' })
.justifyContent(FlexAlign.End)
}
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.SpaceBetween)
}
.height('54lpx')
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/ForgetPasswordPage.ets
View file @
37ceb53
...
...
@@ -7,7 +7,9 @@ import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/
import { WDRouterRule, WDRouterPage } from 'wdRouter';
import { SettingPasswordParams } from './SettingPasswordLayout'
import { Router } from '@ohos.arkui.UIContext'
import { ToastUtils } from 'wdKit/Index'
import { SPHelper, ToastUtils } from 'wdKit/Index'
import { SpConstants } from 'wdConstant/Index'
import { emitter } from '@kit.BasicServicesKit'
const TAG = 'ForgetPasswordPage'
...
...
@@ -147,7 +149,34 @@ struct ForgetPasswordPage {
}
this.loginViewModel.changeBindPhone(this.phoneContent,this.codeContent).then(()=>{
ToastUtils.shortToast('绑定成功')
this.querySecurity()
})
}
querySecurity(){
this.loginViewModel.querySecurity().then(()=>{
SPHelper.default.save(SpConstants.USER_PHONE,this.phoneContent)
this.sendEmitEvent()
router.back()
}).catch(()=>{
})
}
sendEmitEvent(){
// 定义一个eventId为1的事件,事件优先级为Low
let event: emitter.InnerEvent = {
eventId: 10010,
priority: emitter.EventPriority.LOW
};
let eventData: emitter.EventData = {
data: {
content: this.phoneContent,
}
};
// 发送eventId为1的事件,事件内容为eventData
emitter.emit(event, eventData);
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginModel.ets
View file @
37ceb53
...
...
@@ -71,11 +71,11 @@ export class LoginModel {
return new Promise<LoginBean>((success, fail) => {
HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean, headers).then((data: ResponseDTO<LoginBean>) => {
Logger.debug("LoginViewModel:success2 ", data.message)
if (!data
|| !data.data
) {
if (!data) {
fail("数据为空")
return
}
if (data.code != 0) {
if (
!data.data||
data.code != 0) {
fail(data.message)
return
}
...
...
@@ -99,11 +99,11 @@ export class LoginModel {
return new Promise<LoginBean>((success, fail) => {
HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean, headers).then((data: ResponseDTO<LoginBean>) => {
Logger.debug("LoginViewModel:success2 ", data.message)
if (!data
|| !data.data
) {
if (!data) {
fail("数据为空")
return
}
if (data.code != 0) {
if (
!data.data||
data.code != 0) {
fail(data.message)
return
}
...
...
@@ -268,10 +268,10 @@ export class LoginModel {
let bean: Record<string, Object> = {};
bean['phone'] = phone
bean['verifyCode'] = verificationCode
return new Promise<LoginBean>((success, fail) => {
HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.changeBindPhone(), bean, headers).then((data: ResponseDTO<LoginBean>) => {
return new Promise<object>((success, fail) => {
HttpRequest.post<ResponseDTO<object>>(HttpUrlUtils.changeBindPhone(), bean, headers).then((data: ResponseDTO<object>) => {
Logger.debug("LoginViewModel:success2 ", data.message)
if (!data
|| !data.data
) {
if (!data) {
fail("数据为空")
return
}
...
...
@@ -279,7 +279,29 @@ export class LoginModel {
fail(data.message)
return
}
success(data.data)
success(data)
}, (error: Error) => {
fail(error.message)
Logger.debug("LoginViewModel:error2 ", error.toString())
})
})
}
/**获取用户安全页信息*/
querySecurity(){
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<object>((success, fail) => {
HttpRequest.get<ResponseDTO<object>>(HttpUrlUtils.querySecurity(), headers).then((data: ResponseDTO<object>) => {
Logger.debug("LoginViewModel:success2 ", data.message)
if (!data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
return
}
success(data)
}, (error: Error) => {
fail(error.message)
Logger.debug("LoginViewModel:error2 ", error.toString())
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
View file @
37ceb53
...
...
@@ -312,6 +312,8 @@ struct LoginPage {
url: `${WDRouterPage.getBundleInfo()}`
}
)
}).catch((error:string)=>{
promptAction.showToast({ message: error })
})
} else {
this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => {
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginProtocolWebview.ets
View file @
37ceb53
...
...
@@ -14,18 +14,22 @@ struct LoginProtocolWebview {
webviewController: webview.WebviewController = new webview.WebviewController()
userProtocol = "https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1005.html"
privateProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1001.html'
logoutProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1003.html'
async aboutToAppear() {
if (router.getParams()) {
let params = router.getParams() as Params
Logger.info(TAG, 'params.contentID:' + params.contentID);
if (params.contentID == "1") {
if (params.contentID == "1") {
//用户协议
this.webUrl = await SPHelper.default.get(SpConstants.USER_PROTOCOL, this.userProtocol) as string
this.webviewController.loadUrl(this.webUrl)
} else
{
} else
if(params.contentID == "2"){ //隐私协议
this.webUrl = await SPHelper.default.get(SpConstants.PRIVATE_PROTOCOL, this.privateProtocol) as string
this.webviewController.loadUrl(this.webUrl)
}else if(params.contentID == "3"){ //注销协议
this.webUrl = await SPHelper.default.get(SpConstants.LOGOUT_PROTOCOL, this.logoutProtocol) as string
this.webviewController.loadUrl(this.webUrl)
}
}
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginViewModel.ets
View file @
37ceb53
...
...
@@ -59,8 +59,8 @@ export class LoginViewModel {
HttpUrlUtils.setUserType(data.userType+"")
HttpUrlUtils.setUserToken(data.jwtToken)
success(data)
}).catch(() => {
fail()
}).catch((error:string) => {
fail(error)
})
})
}
...
...
@@ -169,8 +169,8 @@ export class LoginViewModel {
}
changeBindPhone(phone: string, verificationCode: string) {
return new Promise<LoginBean>((success, fail) => {
this.loginModel.changeBindPhone(phone, verificationCode).then((data: LoginBean) => {
return new Promise<object>((success, fail) => {
this.loginModel.changeBindPhone(phone, verificationCode).then((data: object) => {
success(data)
}).catch(() => {
fail()
...
...
@@ -178,7 +178,15 @@ export class LoginViewModel {
})
}
querySecurity(){
return new Promise<object>((success, fail) => {
this.loginModel.querySecurity().then((data: object) => {
success(data)
}).catch(() => {
fail()
})
})
}
async doMd(content: string): Promise<string> {
let mdAlgName = 'SHA256'; // 摘要算法名
...
...
sight_harmony/products/phone/src/main/ets/pages/viewModel/LaunchModel.ets
View file @
37ceb53
...
...
@@ -26,6 +26,16 @@ export class LaunchModel {
SPHelper.default.save(SpConstants.USER_PROTOCOL, data.data[i].linkUrl)
} else if (data.data[i].type == 2) {
SPHelper.default.save(SpConstants.PRIVATE_PROTOCOL, data.data[i].linkUrl)
}else if (data.data[i].type == 4) {
SPHelper.default.save(SpConstants.LOGOUT_PROTOCOL, data.data[i].linkUrl)
}else if (data.data[i].type == 5) {
SPHelper.default.save(SpConstants.MESSAGE_BOARD_USER_PROTOCOL, data.data[i].linkUrl)
}else if (data.data[i].type == 6) {
SPHelper.default.save(SpConstants.MESSAGE_BOARD_NOTICE_PROTOCOL, data.data[i].linkUrl)
}else if (data.data[i].type == 7) {
SPHelper.default.save(SpConstants.MESSAGE_BOARD_QUESTION_PROTOCOL, data.data[i].linkUrl)
}else if (data.data[i].type == 8) {
SPHelper.default.save(SpConstants.MESSAGE_BOARD_PRIVATE_PROTOCOL, data.data[i].linkUrl)
}
}
...
...
Please
register
or
login
to post a comment