陈剑华

Merge remote-tracking branch 'origin/main'

@@ -10,6 +10,10 @@ export class SpConstants{ @@ -10,6 +10,10 @@ export class SpConstants{
10 static USER_STATUS="user_status" 10 static USER_STATUS="user_status"
11 static USER_TEMP_TOKEN="tempToken" 11 static USER_TEMP_TOKEN="tempToken"
12 static USER_PHONE = "user_phone" 12 static USER_PHONE = "user_phone"
  13 + static USER_CREATOR_ID = "creatorId"
  14 + static USER_HEAD_PHOTO_URL = "headPhotoUrl"
  15 + static USER_SEX = "sex"
  16 + static USER_BIRTHDAY = "birthday"
13 //协议相关 17 //协议相关
14 static NET_SERVICE_PROTOCOL = "user_protocol" //人民日报客户端网络服务使用协议 18 static NET_SERVICE_PROTOCOL = "user_protocol" //人民日报客户端网络服务使用协议
15 static PRIVATE_PROTOCOL = "private_protocol" //人民日报客户端用户隐私协议 19 static PRIVATE_PROTOCOL = "private_protocol" //人民日报客户端用户隐私协议
@@ -148,3 +148,8 @@ export { @@ -148,3 +148,8 @@ export {
148 InfluenceData 148 InfluenceData
149 } from './src/main/ets/bean/peoples/PeopleShipUserDetailData'; 149 } from './src/main/ets/bean/peoples/PeopleShipUserDetailData';
150 150
  151 +export {
  152 + UserDetail,
  153 + UserExtend
  154 +} from './src/main/ets/bean/user/UserDetail';
  155 +
  1 +export interface UserDetail{
  2 + createTime:string
  3 + headPhotoStatus:number
  4 + id:number
  5 + modifyNumber:number
  6 + phone:string
  7 + status:number
  8 + tenancy:number
  9 + userNameStatus:number
  10 + userType:number
  11 + userName:string
  12 + userExtend:UserExtend
  13 +}
  14 +
  15 + export interface UserExtend{
  16 + airec:number
  17 + deviceId:string
  18 + lastLoginTime:string
  19 + sex:number
  20 + address:string
  21 + birthday:string
  22 + city:string
  23 + county:string
  24 + headPhotoUrl:string
  25 + introduction:string
  26 + province:string
  27 + sign:string
  28 + creatorId:string
  29 +}
  30 +
@@ -7,6 +7,7 @@ import { CheckVerifyBean } from './CheckVerifyBean'; @@ -7,6 +7,7 @@ import { CheckVerifyBean } from './CheckVerifyBean';
7 import { 7 import {
8 SpConstants 8 SpConstants
9 } from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants' 9 } from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants'
  10 +import { UserDetail } from 'wdBean/Index';
10 11
11 12
12 const TAG = 'LoginModel' 13 const TAG = 'LoginModel'
@@ -302,5 +303,26 @@ export class LoginModel { @@ -302,5 +303,26 @@ export class LoginModel {
302 }) 303 })
303 } 304 }
304 305
  306 + queryUserDetail() {
  307 + let bean: Record<string, string> = {};
  308 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  309 + return new Promise<UserDetail>((success, fail) => {
  310 + HttpBizUtil.get<ResponseDTO<UserDetail>>(HttpUrlUtils.queryUserDetail(), headers).then((data: ResponseDTO<UserDetail>) => {
  311 + if (!data || !data.data) {
  312 + fail("数据为空")
  313 + return
  314 + }
  315 + if (data.code != 0) {
  316 + fail(data.message)
  317 + return
  318 + }
  319 + success(data.data)
  320 + }, (error: Error) => {
  321 + fail(error.message)
  322 + Logger.debug("LoginViewModel:error ", error.toString())
  323 + })
  324 + })
  325 + }
  326 +
305 } 327 }
306 328
@@ -321,13 +321,7 @@ struct LoginPage { @@ -321,13 +321,7 @@ struct LoginPage {
321 ///同步兴趣tag 321 ///同步兴趣tag
322 let interestsModel = new InterestsHobbiesModel() 322 let interestsModel = new InterestsHobbiesModel()
323 interestsModel.updateInterests() 323 interestsModel.updateInterests()
324 -  
325 - router.back({  
326 - params: { userName: data.userName,  
327 - userId:data.id},  
328 - url: `${WDRouterPage.getBundleInfo()}`  
329 - }  
330 - ) 324 + this.queryUserDetail()
331 }).catch((error:string)=>{ 325 }).catch((error:string)=>{
332 promptAction.showToast({ message: error }) 326 promptAction.showToast({ message: error })
333 }) 327 })
@@ -339,12 +333,12 @@ struct LoginPage { @@ -339,12 +333,12 @@ struct LoginPage {
339 ///同步兴趣tag 333 ///同步兴趣tag
340 let interestsModel = new InterestsHobbiesModel() 334 let interestsModel = new InterestsHobbiesModel()
341 interestsModel.updateInterests() 335 interestsModel.updateInterests()
342 -  
343 - router.back({  
344 - params: { userName: data.userName,  
345 - userId:data.id},  
346 - url: `${WDRouterPage.getBundleInfo()}`  
347 - }) 336 + this.queryUserDetail()
  337 + // router.back({
  338 + // params: { userName: data.userName,
  339 + // userId:data.id},
  340 + // url: `${WDRouterPage.getBundleInfo()}`
  341 + // })
348 }).catch((value: string) => { 342 }).catch((value: string) => {
349 promptAction.showToast({ message: value }) 343 promptAction.showToast({ message: value })
350 }) 344 })
@@ -352,6 +346,19 @@ struct LoginPage { @@ -352,6 +346,19 @@ struct LoginPage {
352 346
353 } 347 }
354 348
  349 + queryUserDetail(){
  350 + this.loginViewModel.queryUserDetail().then(()=>{
  351 + router.back({
  352 + url: `${WDRouterPage.getBundleInfo()}`
  353 + }
  354 + )
  355 + }).catch(()=>{
  356 + router.back({
  357 + url: `${WDRouterPage.getBundleInfo()}`
  358 + })
  359 + })
  360 + }
  361 +
355 //登录 362 //登录
356 loginSubmit() { 363 loginSubmit() {
357 Logger.debug(TAG, "loginSubmit " + this.checkCodePage) 364 Logger.debug(TAG, "loginSubmit " + this.checkCodePage)
@@ -9,6 +9,7 @@ import { encryptMessage } from '../../utils/cryptoUtil' @@ -9,6 +9,7 @@ import { encryptMessage } from '../../utils/cryptoUtil'
9 9
10 import { HttpUrlUtils } from 'wdNetwork/src/main/ets/http/HttpUrlUtils' 10 import { HttpUrlUtils } from 'wdNetwork/src/main/ets/http/HttpUrlUtils'
11 import { SpConstants } from 'wdConstant/Index' 11 import { SpConstants } from 'wdConstant/Index'
  12 +import { UserDetail } from 'wdBean/Index';
12 13
13 const TAG = "LoginViewModel" 14 const TAG = "LoginViewModel"
14 15
@@ -213,4 +214,26 @@ export class LoginViewModel { @@ -213,4 +214,26 @@ export class LoginViewModel {
213 return bufferStr; 214 return bufferStr;
214 215
215 } 216 }
  217 +
  218 + queryUserDetail(){
  219 + return new Promise<UserDetail>((success, fail) => {
  220 + this.loginModel.queryUserDetail().then((data: UserDetail) => {
  221 + //保存sp
  222 + if(data){
  223 + SPHelper.default.save(SpConstants.USER_NAME, data.userName)
  224 + SPHelper.default.save(SpConstants.USER_PHONE, data.phone)
  225 + }
  226 + if(data.userExtend){
  227 + SPHelper.default.save(SpConstants.USER_SEX, data.userExtend.sex)
  228 + SPHelper.default.save(SpConstants.USER_CREATOR_ID, data.userExtend.creatorId+"")
  229 + SPHelper.default.save(SpConstants.USER_HEAD_PHOTO_URL, data.userExtend.headPhotoUrl)
  230 + SPHelper.default.save(SpConstants.USER_BIRTHDAY, data.userExtend.birthday)
  231 + }
  232 +
  233 + success(data)
  234 + }).catch(() => {
  235 + fail()
  236 + })
  237 + })
  238 + }
216 } 239 }