Merge branch 'master' of https://gitea.igandanyiyuan.com/gdxz/harmony
This commit is contained in:
commit
ca68e42541
@ -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> {
|
||||
// 打开文件并读取数据
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { hdHttp, HdResponse, BasicConstant, ExpertData, authStore } from '@itcast/basic'
|
||||
import { hdHttp, HdResponse, BasicConstant, ExpertData, authStore, ChangeUtil } from '@itcast/basic'
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import promptAction from '@ohos.promptAction';
|
||||
import HashMap from '@ohos.util.HashMap';
|
||||
@ -106,24 +106,23 @@ export struct ChangePasswordComp {
|
||||
.borderWidth(1)
|
||||
.fontColor($r('app.color.main_color'))
|
||||
.onClick(() => {
|
||||
const passwordRegex = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/
|
||||
if (this.oldPassword.length <= 0 || !this.oldPassword) {
|
||||
if (!this.oldPassword) {
|
||||
promptAction.showToast({message:'请输入原密码'})
|
||||
return
|
||||
}
|
||||
if (!passwordRegex.test(this.oldPassword)) {
|
||||
if (!ChangeUtil.isPassword(this.oldPassword)) {
|
||||
promptAction.showToast({message:'原密码格式错误'})
|
||||
return
|
||||
}
|
||||
if (this.newPassword.length <= 0 || !this.newPassword) {
|
||||
if (!this.newPassword) {
|
||||
promptAction.showToast({message:'请输入原密码'})
|
||||
return
|
||||
}
|
||||
if (!passwordRegex.test(this.newPassword)) {
|
||||
if (!ChangeUtil.isPassword(this.newPassword)) {
|
||||
promptAction.showToast({message:'新密码格式错误'})
|
||||
return
|
||||
}
|
||||
if (this.confirmPassword.length <= 0 || !this.confirmPassword) {
|
||||
if (!this.confirmPassword) {
|
||||
promptAction.showToast({message:'请确认新密码'})
|
||||
return
|
||||
}
|
||||
@ -131,7 +130,7 @@ export struct ChangePasswordComp {
|
||||
promptAction.showToast({message:'新密码与确认密码不一致'})
|
||||
return
|
||||
}
|
||||
if (!passwordRegex.test(this.confirmPassword)) {
|
||||
if (!ChangeUtil.isPassword(this.confirmPassword)) {
|
||||
promptAction.showToast({message:'密码格式不正确,请重新输入!'})
|
||||
return
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { hdHttp, HdResponse, BasicConstant, ExpertData, authStore } from '@itcast/basic'
|
||||
import { hdHttp, HdResponse, BasicConstant, ExpertData, authStore, ChangeUtil } from '@itcast/basic'
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import promptAction from '@ohos.promptAction';
|
||||
import HashMap from '@ohos.util.HashMap';
|
||||
@ -130,7 +130,7 @@ export struct ChangePhoneComp {
|
||||
promptAction.showToast({message:'请输入手机号'})
|
||||
return
|
||||
}
|
||||
if (!EMAIL_REGEX.test(this.phoneNumber)) {
|
||||
if (!ChangeUtil.isMobileNum(this.phoneNumber)) {
|
||||
promptAction.showToast({message:'请输入正确的手机号'})
|
||||
return
|
||||
}
|
||||
@ -154,12 +154,12 @@ export struct ChangePhoneComp {
|
||||
.fontSize(18)
|
||||
.position({x:'5%',y:'80%'})
|
||||
.onClick(() => {
|
||||
if (this.phoneNumber.length < 11 || !this.phoneNumber) {
|
||||
if (!this.phoneNumber) {
|
||||
promptAction.showToast({message:'请输入手机号'})
|
||||
return
|
||||
}
|
||||
if (!EMAIL_REGEX.test(this.phoneNumber)) {
|
||||
promptAction.showToast({message:'请输入正确的手机号'})
|
||||
if (!ChangeUtil.isMobileNum(this.phoneNumber)) {
|
||||
promptAction.showToast({message:'手机号格式错误,请重新输入'})
|
||||
return
|
||||
}
|
||||
if (!this.smsCode) {
|
||||
@ -174,6 +174,3 @@ export struct ChangePhoneComp {
|
||||
.backgroundColor('#FFFFFF')
|
||||
}
|
||||
}
|
||||
|
||||
// 手机正则表达式
|
||||
const EMAIL_REGEX = /^1[3-9][0-9]{9}$/
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { hdHttp, HdResponse, BasicConstant, ExpertData, authStore } from '@itcast/basic'
|
||||
import { hdHttp, HdResponse, BasicConstant, ExpertData, authStore, ChangeUtil } from '@itcast/basic'
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import promptAction from '@ohos.promptAction';
|
||||
import { router } from '@kit.ArkUI';
|
||||
@ -66,10 +66,6 @@ export struct ChooseEmailComp {
|
||||
})
|
||||
}
|
||||
|
||||
private validateEmailFormat(email: string): boolean {
|
||||
return EMAIL_REGEX.test(email.trim())
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
// 手机号输入框
|
||||
@ -114,10 +110,10 @@ export struct ChooseEmailComp {
|
||||
.fontSize(18)
|
||||
.position({x:'5%',y:'80%'})
|
||||
.onClick(() => {
|
||||
// if (this.validateEmailFormat(this.emailString)) {
|
||||
// promptAction.showToast({message:'请输入正确的邮箱格式'})
|
||||
// return
|
||||
// }
|
||||
if (!ChangeUtil.isEmail(this.emailString)) {
|
||||
promptAction.showToast({message:'请输入正确的邮箱格式'})
|
||||
return
|
||||
}
|
||||
this.commitEmailData(this.emailString);
|
||||
})
|
||||
}
|
||||
@ -126,6 +122,3 @@ export struct ChooseEmailComp {
|
||||
.backgroundColor('#FFFFFF')
|
||||
}
|
||||
}
|
||||
|
||||
// 邮箱正则表达式
|
||||
const EMAIL_REGEX = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
||||
|
||||
@ -1,5 +1,21 @@
|
||||
import promptAction from '@ohos.promptAction';
|
||||
import { router } from '@kit.ArkUI';
|
||||
import HashMap from '@ohos.util.HashMap';
|
||||
import { hdHttp, HdResponse, BasicConstant, ChangeUtil, authStore } from '@itcast/basic'
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import promptAction from '@ohos.promptAction';
|
||||
|
||||
interface callBackData {
|
||||
code: number,
|
||||
message:string,
|
||||
msg:string,
|
||||
data: string
|
||||
}
|
||||
|
||||
interface updateExtraData {
|
||||
mobile: string,
|
||||
password: string,
|
||||
sms: string
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Component
|
||||
@ -12,7 +28,44 @@ export struct ForgetPasswordComp {
|
||||
@State passWordSrc1: Resource = $r('app.media.icon_forgetpassword_show');
|
||||
@State passWordSrc2: Resource = $r('app.media.icon_forgetpassword');
|
||||
|
||||
// 验证码倒计时
|
||||
submitData() {
|
||||
if (!this.phoneNumber) {
|
||||
promptAction.showToast({message:'请输入手机号'})
|
||||
return
|
||||
}
|
||||
if (!ChangeUtil.isMobileNum(this.phoneNumber)) {
|
||||
promptAction.showToast({message:'手机号格式错误,请重新输入'})
|
||||
return
|
||||
}
|
||||
if (!this.smsCode) {
|
||||
promptAction.showToast({message:'请输入验证码'})
|
||||
return
|
||||
}
|
||||
if (!this.password) {
|
||||
promptAction.showToast({message:'请输入密码'})
|
||||
return
|
||||
}
|
||||
if (!ChangeUtil.isPassword(this.password)) {
|
||||
promptAction.showToast({message:'密码格式错误,请重新输入'})
|
||||
return
|
||||
}
|
||||
|
||||
const hashMap: HashMap<string, string> = new HashMap();
|
||||
hashMap.set('mobile',this.phoneNumber)
|
||||
hashMap.set('password',this.password)
|
||||
hashMap.set('sms',this.smsCode)
|
||||
hdHttp.httpReq<string>(BasicConstant.updatePwd, hashMap).then(async (res: HdResponse<string>) => {
|
||||
let json:callBackData = JSON.parse(res+'') as callBackData;
|
||||
console.log('忘记密码 修改数据成功:',json);
|
||||
promptAction.showToast({message:json.message});
|
||||
if (json.code === 200) {
|
||||
router.back();
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
console.error(`忘记密码 修改数据 fail: ${err}`);
|
||||
})
|
||||
}
|
||||
|
||||
private startCountdown() {
|
||||
this.countdown = 60
|
||||
const timer = setInterval(() => {
|
||||
@ -32,7 +85,6 @@ export struct ForgetPasswordComp {
|
||||
.height(18)
|
||||
.objectFit(ImageFit.Contain)
|
||||
.margin({left:10})
|
||||
// 手机号输入框
|
||||
TextInput({ placeholder: '请输入手机号码' })
|
||||
.fontSize(16)
|
||||
.backgroundColor(Color.White)
|
||||
@ -47,7 +99,6 @@ export struct ForgetPasswordComp {
|
||||
.borderWidth(1)
|
||||
.borderColor('#CCCCCC')
|
||||
|
||||
// 验证码输入区域
|
||||
Row() {
|
||||
Row() {
|
||||
Image($r('app.media.icon_verification_code'))
|
||||
@ -58,6 +109,9 @@ export struct ForgetPasswordComp {
|
||||
TextInput({ placeholder: '请输入验证码' })
|
||||
.fontSize(16)
|
||||
.backgroundColor(Color.White)
|
||||
.onChange((value:string)=>{
|
||||
this.smsCode = value;
|
||||
})
|
||||
}
|
||||
.margin({ top: 10 })
|
||||
.width('60%')
|
||||
@ -80,10 +134,10 @@ export struct ForgetPasswordComp {
|
||||
.margin({ top: 10 })
|
||||
.enabled(this.countdown === 0)
|
||||
.onClick(() => {
|
||||
if (this.phoneNumber.length >= 11) {
|
||||
if (ChangeUtil.isMobileNum(this.phoneNumber)) {
|
||||
this.startCountdown()
|
||||
} else {
|
||||
promptAction.showToast({message:'请输入手机号'})
|
||||
promptAction.showToast({message:'手机号格式错误,请重新输入'})
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -91,18 +145,26 @@ export struct ForgetPasswordComp {
|
||||
.justifyContent(FlexAlign.SpaceBetween)
|
||||
|
||||
Row() {
|
||||
Image($r('app.media.icon_forgetpassword_show'))
|
||||
Image($r('app.media.login_password'))
|
||||
.width(18)
|
||||
.height(18)
|
||||
.objectFit(ImageFit.Contain)
|
||||
.margin({left:10})
|
||||
// 密码输入框
|
||||
TextInput({ placeholder: '6~16位数字字母组合' })
|
||||
.fontSize(16)
|
||||
.width('95%')
|
||||
.width('83%')
|
||||
.backgroundColor(Color.White)
|
||||
.type(this.showPassword ? InputType.Normal : InputType.Password)
|
||||
.passwordIcon({ onIconSrc: this.passWordSrc1, offIconSrc: this.passWordSrc2 })
|
||||
.showPasswordIcon(false)
|
||||
.type(this.showPassword?InputType.Normal:InputType.Password)
|
||||
.onChange((value:string)=>{
|
||||
this.password = value;
|
||||
})
|
||||
Image(this.showPassword?this.passWordSrc1:this.passWordSrc2)
|
||||
.width(20)
|
||||
.height(15)
|
||||
.onClick(()=>{
|
||||
this.showPassword = !this.showPassword;
|
||||
})
|
||||
}
|
||||
.margin({ top: 10 })
|
||||
.width('95%')
|
||||
@ -111,7 +173,6 @@ export struct ForgetPasswordComp {
|
||||
.borderWidth(1)
|
||||
.borderColor('#CCCCCC')
|
||||
|
||||
// 登录按钮
|
||||
Button({type:ButtonType.Normal}){
|
||||
Text('登 录')
|
||||
}
|
||||
@ -123,23 +184,7 @@ export struct ForgetPasswordComp {
|
||||
.fontColor('#FFFFFF')
|
||||
.fontSize(18)
|
||||
.onClick(() => {
|
||||
// 处理登录逻辑
|
||||
if (!/^1[3-9]\d{9}$/.test(this.phoneNumber)) {
|
||||
promptAction.showToast({message:'请输入有效手机号'})
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.smsCode) {
|
||||
promptAction.showToast({message:'请输入验证码'})
|
||||
return
|
||||
}
|
||||
|
||||
if (!/^(?=.*[a-zA-Z])(?=.*\d)[\w]{6,16}$/.test(this.password)) {
|
||||
promptAction.showToast({message:'密码格式不正确'})
|
||||
return
|
||||
}
|
||||
|
||||
// 执行登录操作...
|
||||
this.submitData();
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
|
||||
@ -16,10 +16,15 @@ export struct FourSection {
|
||||
@State refreshFlag: boolean = false;
|
||||
|
||||
@State fourSectionList:Array<MyPageSectionClass> = [
|
||||
new MyPageSectionClass('oneItem',$r('app.media.app_icon'),'微信绑定',''),
|
||||
new MyPageSectionClass('twoItem',$r('app.media.my_page_choosePhone'),'更换手机号','pages/MinePage/ChangePhonePage'),
|
||||
new MyPageSectionClass('threeItem',this.pushIconPath,this.pushStatus,''),
|
||||
new MyPageSectionClass('fourItem',$r('app.media.my_page_version'),'发现新版本','')
|
||||
// new MyPageSectionClass('oneItem',$r('app.media.app_icon'),'微信绑定',''),
|
||||
// new MyPageSectionClass('twoItem',$r('app.media.my_page_choosePhone'),'更换手机号','pages/MinePage/ChangePhonePage'),
|
||||
// new MyPageSectionClass('threeItem',this.pushIconPath,this.pushStatus,''),
|
||||
// new MyPageSectionClass('fourItem',$r('app.media.my_page_version'),'发现新版本','')
|
||||
|
||||
new MyPageSectionClass('oneItem',$r('app.media.my_page_choosePhone'),'更换手机号','pages/MinePage/ChangePhonePage'),
|
||||
new MyPageSectionClass('twoItem',this.pushIconPath,this.pushStatus,''),
|
||||
new MyPageSectionClass('threeItem',$r('app.media.app_icon'),'关于','pages/WebView/WebPage'),
|
||||
new MyPageSectionClass('fourItem',$r('app.media.app_icon'),'直播群','pages/WebView/WebPage')
|
||||
];
|
||||
|
||||
aboutToAppear() {
|
||||
@ -54,7 +59,7 @@ export struct FourSection {
|
||||
this.pushIconPath = this.pushStatus == '通知已开'?$r('app.media.my_page_message_on'):$r('app.media.my_home_push_down');
|
||||
// 更新数组中的标题
|
||||
this.fourSectionList = this.fourSectionList.map((item, index) => {
|
||||
if (index === 2) {
|
||||
if (index === 1) {
|
||||
return new MyPageSectionClass(item.id, this.pushIconPath, this.pushStatus, item.path);
|
||||
}
|
||||
return item;
|
||||
@ -102,6 +107,16 @@ export struct FourSection {
|
||||
.onClick(()=>{
|
||||
if (item.title.includes('通知')) {
|
||||
this.handleNotificationClick();
|
||||
} else if (item.title.includes('关于')) {
|
||||
router.pushUrl({
|
||||
url:item.path,
|
||||
params: { url: 'http://doc.igandan.com/app/html/about/2017/about2.html' ,title:'关于肝胆相照'}
|
||||
})
|
||||
} else if (item.title.includes('直播群')) {
|
||||
router.pushUrl({
|
||||
url: 'pages/WebView/WebPage',
|
||||
params: { url: 'http://wx.igandan.com/qun/gdxzqun' ,title:'肝胆相照直播群'}
|
||||
})
|
||||
} else {
|
||||
router.pushUrl({
|
||||
url:item.path
|
||||
|
||||
@ -15,6 +15,13 @@ interface callBackData {
|
||||
specialy:[]
|
||||
}
|
||||
|
||||
interface callMyBackData {
|
||||
expert:ExpertData,
|
||||
code:number,
|
||||
message:string,
|
||||
specialy:[]
|
||||
}
|
||||
|
||||
interface heroFirst {
|
||||
id: string;
|
||||
nick_name: string;
|
||||
@ -28,12 +35,12 @@ export struct HeaderView {
|
||||
@State name:string = authStore.getUser().realName;
|
||||
@State myPageData:object = new Object;
|
||||
@State heroArray:Array<object> = [];
|
||||
@State clickHeroId:string = '';
|
||||
|
||||
private scrollerForList: Scroller = new Scroller()
|
||||
private heroList: string[] = ['2020年英雄榜','2021年英雄榜','2022年英雄榜','2023年英雄榜','2024年英雄榜']
|
||||
|
||||
dialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: HeroPopWindow(),
|
||||
builder: HeroPopWindow({heroId:this.clickHeroId}),
|
||||
alignment: DialogAlignment.Center,
|
||||
customStyle: true
|
||||
})
|
||||
@ -64,21 +71,21 @@ export struct HeaderView {
|
||||
|
||||
uploadBackImgAction() {
|
||||
const hashMap: HashMap<string, string> = new HashMap();
|
||||
const userDataUrl:string = BasicConstant.urlExpertAPI+'my';
|
||||
hdHttp.httpReq<string>(userDataUrl,hashMap).then(async (res: HdResponse<string>) => {
|
||||
hdHttp.httpReq<string>(BasicConstant.myData,hashMap).then(async (res: HdResponse<string>) => {
|
||||
console.info(`我的背景图: ${res}`);
|
||||
let json:RequestDefaultModel = JSON.parse(res+'') as RequestDefaultModel;
|
||||
if(json.code == '200') {
|
||||
this.heroArray = json.data["honor_list"];
|
||||
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 {
|
||||
@ -103,7 +110,7 @@ export struct HeaderView {
|
||||
.width(60)
|
||||
.height(60)
|
||||
.borderRadius(5)
|
||||
.objectFit(ImageFit.Fill)
|
||||
.objectFit(ImageFit.Cover)
|
||||
.onClick(()=>this.handleAvatarClick())
|
||||
Column({space:5}) {
|
||||
Text(this.name)
|
||||
@ -111,14 +118,14 @@ export struct HeaderView {
|
||||
.fontColor('#FFFFFF')
|
||||
.onClick(()=>this.handleAvatarClick())
|
||||
List({space:5,initialIndex:this.heroIndex,scroller:this.scrollerForList}) {
|
||||
ForEach(this.heroArray, (item: object,index:number) => {
|
||||
ForEach(this.heroArray, (item: heroFirst) => {
|
||||
ListItem() {
|
||||
Row() {
|
||||
Image($r('app.media.my_home_hero_ranking'))
|
||||
Image(item.id === 'ranking'?$r('app.media.my_home_hero_ranking'):$r('app.media.my_page_header_hertIcon'))
|
||||
.width(13)
|
||||
.height(13)
|
||||
.margin({left:7})
|
||||
Text(item["nick_name"])
|
||||
Text(item.nick_name)
|
||||
.fontColor(Color.White)
|
||||
.fontSize(11)
|
||||
.margin({left:4,right:10})
|
||||
@ -128,14 +135,11 @@ export struct HeaderView {
|
||||
.borderRadius(9)
|
||||
.borderWidth(1)
|
||||
.borderColor(Color.White)
|
||||
.onClick(() => {
|
||||
console.log('Show HeroPopWindow');
|
||||
})
|
||||
.onClick(()=>{
|
||||
this.dialogController.open();
|
||||
// if (!this.heroArray[index] as heroFirst == 'ranking') {
|
||||
// this.dialogController.open(heroId:this.heroArray[index]['id'] as string);
|
||||
// }
|
||||
if (item.id !== 'ranking') {
|
||||
this.clickHeroId = item.id;
|
||||
this.dialogController.open();
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
BIN
features/mypage/src/main/resources/base/media/login_password.png
Normal file
BIN
features/mypage/src/main/resources/base/media/login_password.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Loading…
x
Reference in New Issue
Block a user