diff --git a/products/expert/src/main/ets/pages/Home.ets b/products/expert/src/main/ets/pages/Home.ets index 3f8beaa..2b96f81 100644 --- a/products/expert/src/main/ets/pages/Home.ets +++ b/products/expert/src/main/ets/pages/Home.ets @@ -1,5 +1,5 @@ import { TabBarComp } from '../pages/Tabbar/TabBarComp'; -import { BasicConstant, themeManager,hdHttp, HdResponse, authStore } from '@itcast/basic'; +import { BasicConstant, themeManager,hdHttp, HdResponse, authStore, preferenceStore } from '@itcast/basic'; import { emitter } from '@kit.BasicServicesKit'; import { common } from '@kit.AbilityKit'; import { promptAction } from '@kit.ArkUI'; @@ -7,6 +7,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; import { patientDbManager, PatientEntity } from '@itcast/basic'; import { NimRepository } from '../entryability/NimRepository' import { AppConfig } from '../constants/AppConfig' +import { HashMap } from '@kit.ArkTS'; @Entry @Component @@ -26,6 +27,20 @@ struct Home { } } + getHcp_tokenData() { + const hashMap: HashMap = new HashMap(); + hdHttp.httpReq(BasicConstant.checkUser,hashMap).then(async (res: HdResponse) => { + let json:Record = JSON.parse(res+'') as Record + if(json.code == '200') { + preferenceStore.setItemString(BasicConstant.EXPERT_HCP_TOKEN,String(json.data['hcp_token'])) + } else { + console.error('hcp_token:'+json.message) + } + }).catch((err: BusinessError) => { + console.info(`hcp_token: ${err}`); + }) + } + aboutToAppear(): void { emitter.on({ eventId: 10000 }, (e) => { if (e.data && e.data.activeIndex) { @@ -57,6 +72,7 @@ struct Home { this.onChangeIndex() // emitter.emit({eventId:BasicConstant.notification_home_tab_change},{data:{'changeIndex':this.activeIndex}}) // this.loadPatients(); + this.getHcp_tokenData() } onPageHide(): void {