修改bug

This commit is contained in:
xiaoxiao
2025-06-04 11:19:27 +08:00
parent a83890881e
commit 195e42f50e
10 changed files with 176 additions and 120 deletions
@@ -9,21 +9,23 @@ interface DefaultData {
}
@Preview
@CustomDialog
export struct HeroPopWindow {
@Prop heroId:string = '';
@State detailsData:object = new Object;
private years: string[] = ['2019年英雄榜','2018年英雄榜','2017年英雄榜','2016年英雄榜','2015年英雄榜'];
controller: CustomDialogController;
heroDetailsRequestUrl:string = BasicConstant.urlExpertAPI+'gethonorDetail'
hashMap: HashMap<string, string> = new HashMap();
aboutToAppear(): void {
this.updateHeroDetailsAction();
}
updateHeroDetailsAction(){
this.hashMap.set('id',this.heroId);
hdHttp.httpReq<string>(this.heroDetailsRequestUrl,this.hashMap).then(async (res: HdResponse<string>) => {
const hashMap: HashMap<string, string> = new HashMap();
hashMap.set('id',this.heroId);
hdHttp.httpReq<string>(BasicConstant.gethonorDetail,hashMap).then(async (res: HdResponse<string>) => {
let json:RequestDefaultModel = JSON.parse(res+'') as RequestDefaultModel;
if(json.code=='1') {
if(json.code == '1') {
this.detailsData = json.data;
} else {
console.error('英雄榜失败:'+json.message)
@@ -36,39 +38,37 @@ export struct HeroPopWindow {
build() {
Stack() {
//半透明黑色背景
Column().width('100%').height('100%').backgroundColor('#50000000')
//弹窗主体
Column() {
//头部图标
Image($r('app.media.heroPop_headericon'))
.width(80)
.height(80)
Image(BasicConstant.urlImage+this.detailsData['img'])
.alt($r('app.media.heroPop_headericon'))
.width(90)
.height(90)
.margin({top:-25})
.zIndex(2)
//标题和正文范围
Column() {
Text('肝胆英雄榜')
.fontSize(20)
.fontColor('#673986')
Text(this.detailsData['title'])
.fontSize(16)
.fontColor('#DA57E5')
.margin({top:20})
Grid() {
ForEach(this.years,(item:string)=>{
ForEach(this.detailsData['honorlist'],(item:Record<string,string>)=>{
GridItem({style:GridItemStyle.PLAIN}) {
Text(item)
.fontSize(10)
.fontColor(Color.Black)
.backgroundColor(Color.White) // 添加背景色确保可见
Text(item.nick_name)
.fontSize(12)
.fontColor('#DA57E5')
.backgroundColor(Color.White)
.textAlign(TextAlign.Center)
.width('100%') // 确保文本容器宽度
.width('100%').height('100%')
}
.height(20)
.width('48%')
.padding(5)
.borderRadius(10)
// .padding(5)
.borderRadius(5)
.borderWidth(1)
.borderColor(Color.Red)
.borderColor('#DA57E5')
})
}
.columnsGap(10)
@@ -76,15 +76,14 @@ export struct HeroPopWindow {
.padding(10)
.width('100%')
.height('auto')
Text('感谢有您,一路相伴。"肝胆英雄榜"是由国内最具影响力的肝胆病互联网线上服务平台-\n' +
'肝胆相照依据肝胆病医生在各自领域年度所做工作,综合评选出来的最认可的"肝胆好医生",授予证书并赠送精美感恩好礼。\n' +
'目前"肝胆英雄榜"荣誉包括:"护肝大使"护肝新量""公益之星""科普达入"、"视频之星"、"人气科室"及"宣传之星"等。')
.fontSize(12)
.fontColor('#666666')
Text(this.detailsData['note'])
.fontSize(14)
.fontColor('#333333')
.textAlign(TextAlign.Start)
.lineHeight(20)
.width('90%')
.margin({bottom:10})
.margin({top:5,bottom:10})
}
.zIndex(1)
.margin({top:-10,bottom:10})
@@ -94,15 +93,12 @@ export struct HeroPopWindow {
.height('auto')
.width('90%')
//删除按钮
Button() {
Image($r('app.media.heropop_delete'))
.width(30)
.height(30)
}
.zIndex(3)
.position({ x: '88%', y: 10 })
.onClick(() => this.controller.close())
Image($r('app.media.heropop_delete'))
.width(30)
.height(30)
.zIndex(3)
.position({ x: '88%', y: 10 })
.onClick(() => this.controller.close())
}
.width('90%')
.backgroundImage($r('app.media.heroPop_bg'))
@@ -38,7 +38,10 @@ export class BasicConstant {
static readonly videoByKeyWordsNew = BasicConstant.urlExpertApp + "videoByKeyWordsNew";
static readonly tagList = BasicConstant.urlExpertApp + "tagList";
static readonly meetingListBySearch = BasicConstant.urlExpertAPI + "meetingListBySearch";
static readonly videoBySearchNew = BasicConstant.urlExpertApp+'videoBySearchNew'//搜索肝胆视频列表
static readonly videoBySearchNew = BasicConstant.urlExpertApp+'videoBySearchNew';//搜索肝胆视频列表
static readonly myData = BasicConstant.urlExpertAPI+'my';
static readonly gethonorDetail = BasicConstant.urlExpertAPI+'gethonorDetail';
static readonly updatePwd = BasicConstant.urlExpertAPI+'updatePwd'
static readonly province=['全国','北京市','天津市','河北省','山西省'
,'内蒙古自治区','辽宁省','吉林省','黑龙江省','上海市','江苏省','浙江省'
@@ -58,6 +58,10 @@ export class ChangeUtil {
return reg2.test(password);
}
static isEmail(email:string): boolean {
const reg2: RegExp = new RegExp('^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$')
return reg2.test(email);
}
static async convertUriToBase64(uri: string): Promise<string> {
// 打开文件并读取数据