gitignore
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { hdHttp, HdResponse,BasicConstant, logger,LoginInfo, authStore } from '@itcast/basic'
|
||||
import { hdHttp, HdResponse,BasicConstant,ExpertData, authStore } from '@itcast/basic'
|
||||
import HashMap from '@ohos.util.HashMap'
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import { promptAction, router } from '@kit.ArkUI'
|
||||
@@ -9,10 +9,17 @@ import { OfficeSelectedSheet } from './OfficeSelectedSheet'
|
||||
import { PositionSelectedSheet } from './PositionSelectedSheet'
|
||||
import { http } from '@kit.NetworkKit';
|
||||
|
||||
interface LoginParams {
|
||||
interface extraData {
|
||||
uuid: string
|
||||
}
|
||||
|
||||
interface callBackData {
|
||||
expert:ExpertData,
|
||||
code:number,
|
||||
message:string,
|
||||
specialy:[]
|
||||
}
|
||||
|
||||
@Component
|
||||
export struct EditUserDataComp {
|
||||
@State photoPath:string = BasicConstant.imageHeader+authStore.getUser().photo;
|
||||
@@ -54,57 +61,35 @@ export struct EditUserDataComp {
|
||||
hashMap.set('uuid',authStore.getUser().uuid)
|
||||
hdHttp.post<string>(userDataUrl, {
|
||||
uuid: authStore.getUser().uuid,
|
||||
} as LoginParams).then(async (res: HdResponse<string>) => {
|
||||
logger.info('Response login111'+res);
|
||||
console.info(`Response login succeeded333: ${res}`);
|
||||
} as extraData).then(async (res: HdResponse<string>) => {
|
||||
let json:callBackData = JSON.parse(res+'') as callBackData;
|
||||
if(json.code == 1 && json.expert && typeof json.expert === 'object') {
|
||||
authStore.updateUser(json.expert)
|
||||
this.arrToStringSpecialy(json.specialy);
|
||||
console.log('用户信息成功:', authStore.getUser().intro);
|
||||
} else {
|
||||
console.error('用户信息失败:'+json.message)
|
||||
promptAction.showToast({ message: json.message, duration: 1000 })
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
console.info(`Response login fail222222222222222: ${err}`);
|
||||
})
|
||||
|
||||
|
||||
// hdHttp.oldPost<string>(userDataUrl,hashMap).then(async (res: HdResponse<string>) => {
|
||||
// console.info(`Response officelist succeeded: ${res}`);
|
||||
// let json:LoginInfo = JSON.parse(res+'') as LoginInfo;
|
||||
// if(json.code=='1') {
|
||||
// authStore.setUser(json.data)
|
||||
// console.log('用户信息成功:', json);
|
||||
// } else {
|
||||
// console.error('用户信息失败:'+json.message)
|
||||
// promptAction.showToast({ message: json.message, duration: 1000 })
|
||||
// }
|
||||
// }).catch((err: BusinessError) => {
|
||||
// console.error(`Response login fail: ${err}`);
|
||||
// })
|
||||
// hdHttp.httpReq<string>(userDataUrl,hashMap).then(async (res: HdResponse<string>) => {
|
||||
// logger.info('Response officelist success'+res);
|
||||
// console.info(`Response officelist succeeded: ${res}`);
|
||||
// let json:LoginInfo = JSON.parse(res+'') as LoginInfo;
|
||||
// if(json.code=='1') {
|
||||
// authStore.setUser(json.data)
|
||||
// console.log('用户信息成功:', json);
|
||||
// } else {
|
||||
// console.error('用户信息失败:'+json.message)
|
||||
// promptAction.showToast({ message: json.message, duration: 1000 })
|
||||
// }
|
||||
// }).catch((err: BusinessError) => {
|
||||
// console.info(`Response login fail: ${err}`);
|
||||
// })
|
||||
}
|
||||
|
||||
arrToStringSpecialy(specialy: Array<object>) {
|
||||
arrToStringSpecialy(data: Array<object>) {
|
||||
// 声明类型化数组
|
||||
let zhuangArr: string[] = [];
|
||||
// 获取响应数据中的specialy数组(需根据实际API调整类型)
|
||||
const array = specialy['specialy'] as Array<Record<string, string>>;
|
||||
const array = data as Array<Record<string, string>>;
|
||||
// 遍历提取diseaseName
|
||||
if (specialy) {
|
||||
if (data) {
|
||||
zhuangArr = array
|
||||
.filter(item => item['diseaseName']) // 过滤空值[8](@ref)
|
||||
.map(item => item['diseaseName'] ?? ''); // 安全转换[9](@ref)
|
||||
}
|
||||
// 拼接为逗号分隔字符串
|
||||
const DiseaseName = zhuangArr.join(','); // 等效componentsJoinedByString[8](@ref)
|
||||
return DiseaseName;
|
||||
this.diseaseName = zhuangArr.join(',');
|
||||
console.info('diseaseName:', this.diseaseName);
|
||||
}
|
||||
|
||||
private initPhotoDialog() {
|
||||
|
||||
@@ -44,7 +44,11 @@ export struct EditUserDataItem {
|
||||
Text(this.content)
|
||||
.fontSize(16)
|
||||
.fontColor('#333333')
|
||||
.margin({ right: this.hasArrow?0:10 })
|
||||
.width('60%')
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.maxLines(1)
|
||||
.margin({right: this.hasArrow?0:10 })
|
||||
.textAlign(TextAlign.End)
|
||||
}
|
||||
if (this.hasArrow) {
|
||||
Image($r('sys.media.ohos_ic_public_arrow_right'))
|
||||
|
||||
@@ -1,10 +1,34 @@
|
||||
import { hdHttp, HdResponse,BasicConstant,ExpertData, authStore,RequestDefaultModel } from '@itcast/basic'
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import { HeroPopWindow } from '../view/HeroPopWindow'
|
||||
import HashMap from '@ohos.util.HashMap'
|
||||
import { router } from '@kit.ArkUI'
|
||||
|
||||
interface extraData {
|
||||
uuid: string
|
||||
}
|
||||
|
||||
interface callBackData {
|
||||
expert:ExpertData,
|
||||
code:number,
|
||||
message:string,
|
||||
specialy:[]
|
||||
}
|
||||
|
||||
interface heroFirst {
|
||||
id: string;
|
||||
nick_name: string;
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Component
|
||||
export struct HeaderView {
|
||||
@State heroIndex: number = 0 // 当前页索引
|
||||
@State photoPath:string = BasicConstant.imageHeader+authStore.getUser().photo;
|
||||
@State name:string = authStore.getUser().realName;
|
||||
@State myPageData:object = new Object;
|
||||
@State heroArray:Array<object> = [];
|
||||
|
||||
private scrollerForList: Scroller = new Scroller()
|
||||
private heroList: string[] = ['2020年英雄榜','2021年英雄榜','2022年英雄榜','2023年英雄榜','2024年英雄榜']
|
||||
|
||||
@@ -14,6 +38,57 @@ export struct HeaderView {
|
||||
customStyle: true
|
||||
})
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.uploadUserDataAction();
|
||||
this.uploadBackImgAction();
|
||||
}
|
||||
|
||||
uploadUserDataAction() {
|
||||
const hashMap: HashMap<string, string> = new HashMap();
|
||||
const userDataUrl:string = BasicConstant.urlExpert+'getExpertByUuid';
|
||||
hashMap.set('uuid',authStore.getUser().uuid)
|
||||
hdHttp.post<string>(userDataUrl, {
|
||||
uuid: authStore.getUser().uuid,
|
||||
} as extraData).then(async (res: HdResponse<string>) => {
|
||||
let json:callBackData = JSON.parse(res+'') as callBackData;
|
||||
if(json.code == 1 && json.expert && typeof json.expert === 'object') {
|
||||
authStore.updateUser(json.expert)
|
||||
console.log('用户信息成功:', authStore.getUser().intro);
|
||||
} else {
|
||||
console.error('用户信息失败:'+json.message)
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
console.info(`Response login fail222222222222222: ${err}`);
|
||||
})
|
||||
}
|
||||
|
||||
uploadBackImgAction() {
|
||||
const hashMap: HashMap<string, string> = new HashMap();
|
||||
const userDataUrl:string = BasicConstant.urlmyLan+'my';
|
||||
hdHttp.httpReq<string>(userDataUrl,hashMap).then(async (res: HdResponse<string>) => {
|
||||
console.info(`我的背景图: ${res}`);
|
||||
let json:RequestDefaultModel = JSON.parse(res+'') as RequestDefaultModel;
|
||||
if(json.code == '200') {
|
||||
this.myPageData = json.data;
|
||||
// 获取ranking值(带安全类型转换)
|
||||
const ranking: string = this.myPageData["ranking"]?.toString() ?? "";
|
||||
if (Number(ranking) > 0) {
|
||||
// 创建排名对象[4](@ref)
|
||||
const rankDic: heroFirst = {
|
||||
"id": "ranking",
|
||||
"nick_name": `随访达人 I 排名${ranking}`
|
||||
};
|
||||
// 插入数组首位[9](@ref)
|
||||
this.heroArray.unshift(rankDic);
|
||||
}
|
||||
} else {
|
||||
console.error('我的背景图:'+json.message)
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
console.info(`Response login fail: ${err}`);
|
||||
})
|
||||
}
|
||||
|
||||
handleAvatarClick() {
|
||||
router.pushUrl({url:'pages/MinePage/EditUserDataPage'})
|
||||
}
|
||||
@@ -22,33 +97,33 @@ export struct HeaderView {
|
||||
// Row() {
|
||||
Column({space:5}) {
|
||||
Row({space:10}) {
|
||||
Image($r('app.media.app_icon'))
|
||||
Image(this.photoPath)
|
||||
.alt($r('app.media.userPhoto_default'))
|
||||
.margin({left:15})
|
||||
.width(60)
|
||||
.height(60)
|
||||
.borderRadius(30)
|
||||
.borderRadius(5)
|
||||
.objectFit(ImageFit.Fill)
|
||||
.onClick(()=>this.handleAvatarClick())
|
||||
Column({space:5}) {
|
||||
Text('段钟平专家工作室')
|
||||
Text(this.name)
|
||||
.fontSize(18)
|
||||
.fontColor('#333')
|
||||
.fontColor('#FFFFFF')
|
||||
.onClick(()=>this.handleAvatarClick())
|
||||
List({space:5,initialIndex:this.heroIndex,scroller:this.scrollerForList}) {
|
||||
ForEach(this.heroList, (item: string,index:number) => {
|
||||
ForEach(this.heroArray, (item: object,index:number) => {
|
||||
ListItem() {
|
||||
Row() {
|
||||
Image($r('app.media.app_icon'))
|
||||
Image($r('app.media.my_home_hero_ranking'))
|
||||
.width(13)
|
||||
.height(13)
|
||||
.margin({left:7})
|
||||
Text(item)
|
||||
Text(item["nick_name"])
|
||||
.fontColor(Color.White)
|
||||
.fontSize(11)
|
||||
.margin({left:4,right:10})
|
||||
}
|
||||
.height(18)
|
||||
// .width('autp')
|
||||
.margin({right:5})
|
||||
.borderRadius(9)
|
||||
.borderWidth(1)
|
||||
@@ -75,7 +150,7 @@ export struct HeaderView {
|
||||
}
|
||||
.width('100%')
|
||||
.height(97)
|
||||
.backgroundColor(Color.Green)
|
||||
.backgroundImage(this.myPageData["myInfoBackGround"]).backgroundImageSize(ImageSize.Cover)
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export struct OtherList {
|
||||
// new ListClass(1,$r('app.media.app_icon'),'福利卡兑换'),
|
||||
// new ListClass(2,$r('app.media.app_icon'),'发票管理'),
|
||||
// new ListClass(3,$r('app.media.app_icon'),'常用银行卡'),
|
||||
new ListClass(4,$r('app.media.app_icon'),'设置与帮助')
|
||||
new ListClass(4,$r('app.media.my_page_sethelp'),'设置与帮助')
|
||||
]
|
||||
|
||||
build() {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
Reference in New Issue
Block a user