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
yangsunyue_wd
2024-04-01 11:03:16 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
dcd8f90dde474fc2eccbd7ae8b517a2faa4d481a
dcd8f90d
1 parent
e04a41a5
desc:退出登录接口
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
0 deletions
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginModel.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginViewModel.ets
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
View file @
dcd8f90
...
...
@@ -247,6 +247,14 @@ export class HttpUrlUtils {
return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc';
}
static getRefreshToken() {
let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN,"")
if(StringUtils.isNotEmpty(refreshToken)) {
return refreshToken as string;
}
return '';
}
private static getDeviceId() {
// TODO
return '8a81226a-cabd-3e1b-b630-b51db4a720ed';
...
...
@@ -337,6 +345,12 @@ export class HttpUrlUtils {
return url;
}
static getLogoutUrl() {
let url = HttpUrlUtils.hostUrl + "/api/rmrb-user-center/user/zh/c/logout";
return url;
}
static getResetPassworddUrl() {
let url = HttpUrlUtils.hostUrl + "/api/rmrb-user-center/user/zh/c/resetPassword";
return url;
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginModel.ets
View file @
dcd8f90
...
...
@@ -221,5 +221,30 @@ export class LoginModel {
})
}
//退出登录
logOut() {
let bean: Record<string, string> = {};
bean['refreshToken'] = HttpUrlUtils.getRefreshToken();
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<string>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getLogoutUrl(), bean, headers).then((data: ResponseDTO<string>) => {
if (!data || !data.data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
return
}
success(data.data)
}, (error: Error) => {
fail(error.message)
Logger.debug("LoginViewModel:error ", error.toString())
})
})
}
}
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginViewModel.ets
View file @
dcd8f90
...
...
@@ -139,10 +139,25 @@ export class LoginViewModel {
fail(message)
})
})
}
// 登出
logOut(){
return new Promise<string>(async (success, fail) => {
this.loginModel.logOut().then((data) => {
//清除登录状态以及token、userid等信息
HttpUrlUtils.setUserId('');
HttpUrlUtils.setUserType('');
HttpUrlUtils.setUserToken('');
success(data)
}).catch((message: string) => {
fail(message)
})
})
}
async doMd(content: string): Promise<string> {
let mdAlgName = 'SHA256'; // 摘要算法名
let message = content; // 待摘要的数据
...
...
Please
register
or
login
to post a comment