|
|
@@ -30,22 +30,29 @@ struct SettingPage {
|
|
|
@StorageProp(UserInfo.KEY) private userInfo: UserInfo = userInfo
|
|
|
@State private value: string = ''
|
|
|
private yTPhotoHelper = new YTPhotoHelper(this.getUIContext().getHostContext()!)
|
|
|
- private reviseBuilderArr: Array<BasicType<undefined>> = [
|
|
|
+ private reviseBuilderArr: Array<BasicType> = [
|
|
|
{
|
|
|
text: '头像修改',
|
|
|
- src: '',
|
|
|
+ src: '头像',
|
|
|
click: () => {
|
|
|
this.showHeaderImgRevise = true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
text: '昵称修改',
|
|
|
+ src: '名称',
|
|
|
click: () => {
|
|
|
this.showReviseName = true
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // text: '密码设置',
|
|
|
+ // click: () => {
|
|
|
+ // yTRouter.router2UpdatePasswordPage()
|
|
|
+ // }
|
|
|
+ // }
|
|
|
]
|
|
|
- private options: BasicType<undefined>[] = [
|
|
|
+ private options: BasicType[] = [
|
|
|
{
|
|
|
text: '拍照',
|
|
|
click: async () => {
|
|
|
@@ -80,14 +87,14 @@ struct SettingPage {
|
|
|
Column() {
|
|
|
YTHeader({ defaultStyle: { title: '用户设置' } })
|
|
|
Column() {
|
|
|
- ForEach(this.reviseBuilderArr, (item: BasicType<undefined>, index) => {
|
|
|
+ ForEach(this.reviseBuilderArr, (item: BasicType, index) => {
|
|
|
this.reviseBuilder(item)
|
|
|
if (index < this.reviseBuilderArr.length - 1) {
|
|
|
Column() {
|
|
|
Text('')
|
|
|
.height(1)
|
|
|
.width('100%')
|
|
|
- .backgroundColor('#0A000000')
|
|
|
+ .backgroundColor('#1c1c1c1a')
|
|
|
}
|
|
|
.padding({ left: 12, right: 8 })
|
|
|
.bindSheet($$this.showHeaderImgRevise, this.changeBuilder, {
|
|
|
@@ -97,28 +104,46 @@ struct SettingPage {
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
- YTButton({
|
|
|
- btContent: '退出登录', click: () => {
|
|
|
- this.userInfo.logout()
|
|
|
- yTRouter.routerBack()
|
|
|
- IBestToast.show({ message: '退出登录成功' })
|
|
|
- }
|
|
|
- })
|
|
|
- .margin({ top: 426, bottom: 12 })
|
|
|
+ Blank()
|
|
|
+ .layoutWeight(1)
|
|
|
+
|
|
|
YTButton({
|
|
|
btContent: '注销用户',
|
|
|
- btFontColor: Color.Red,
|
|
|
+ btFontColor: '#991C1C1C',
|
|
|
+ btFontSize: 16,
|
|
|
+ btHeight: 48,
|
|
|
+ btBorderRadius: 40,
|
|
|
bgc: Color.White,
|
|
|
click: () => {
|
|
|
yTToast.doubleConfirm({
|
|
|
- text: '警告⚠', message: '确定要注销吗?\n注销后数据可能丢失无法恢复!', click: () => {
|
|
|
- userInfo.logout()
|
|
|
- yTToast.hide()
|
|
|
- yTRouter.routerBack()
|
|
|
+ message: '注销后无法恢复,是否确定注销?', click: () => {
|
|
|
+ YTUserRequest.logout(() => {
|
|
|
+ yTToast.hide()
|
|
|
+ yTRouter.routerBack()
|
|
|
+ setTimeout(() => {
|
|
|
+ IBestToast.show('注销成功')
|
|
|
+ }, 50)
|
|
|
+ })
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+ YTButton({
|
|
|
+ btContent: '退出登录',
|
|
|
+ click: () => {
|
|
|
+ this.userInfo.logout()
|
|
|
+ yTRouter.routerBack()
|
|
|
+ IBestToast.show({ message: '退出登录成功' })
|
|
|
+ },
|
|
|
+ btFontSize: 16,
|
|
|
+ btHeight: 48,
|
|
|
+ btBorderRadius: 40,
|
|
|
+ })
|
|
|
+ Text()
|
|
|
+ .height(200)
|
|
|
+ .width('100%')
|
|
|
+
|
|
|
}
|
|
|
.bindSheet($$this.showReviseName, this.reviseNameBuilder, {
|
|
|
height: 275,
|
|
|
@@ -128,6 +153,7 @@ struct SettingPage {
|
|
|
.padding({
|
|
|
left: 16,
|
|
|
right: 16,
|
|
|
+
|
|
|
})
|
|
|
}
|
|
|
.padding({ bottom: this.safeBottom })
|
|
|
@@ -135,21 +161,23 @@ struct SettingPage {
|
|
|
}
|
|
|
|
|
|
@Builder
|
|
|
- reviseBuilder(item: BasicType<undefined>) {
|
|
|
+ reviseBuilder(item: BasicType) {
|
|
|
Row() {
|
|
|
Text(item.text)
|
|
|
.fontSize($r('[basic].float.page_text_font_size_12'))
|
|
|
- .fontColor('#80000000')
|
|
|
+ .fontColor('#FF1C1C1C')
|
|
|
+ .fontWeight(500)
|
|
|
+ .fontSize(16)
|
|
|
Row() {
|
|
|
- if (typeof item.src == 'string') {
|
|
|
- Image(this.userInfo.getHeadImg())
|
|
|
- .height(24)
|
|
|
- .width(24)
|
|
|
- .borderRadius(12)
|
|
|
- } else {
|
|
|
- Text(this.userInfo.getName())
|
|
|
- .fontSize($r('[basic].float.page_text_font_size_12'))
|
|
|
- .fontColor('#CC000000')
|
|
|
+ if (item.src == '头像') {
|
|
|
+ Image(this.userInfo.getHeadImg() ? this.userInfo.getHeadImg() : $r('app.media.default_img'))
|
|
|
+ .height(32)
|
|
|
+ .width(32)
|
|
|
+ .borderRadius(99)
|
|
|
+ } else if (item.src == '名称') {
|
|
|
+ Text(this.userInfo.getName() ?? this.userInfo.getPhoneNumber() ?? this.userInfo.getId()?.toString())
|
|
|
+ .fontSize(16)
|
|
|
+ .fontColor('#E61C1C1C')
|
|
|
}
|
|
|
Image($r('app.media.right_arrow'))
|
|
|
.width(24)
|
|
|
@@ -159,7 +187,7 @@ struct SettingPage {
|
|
|
.width('100%')
|
|
|
.justifyContent(FlexAlign.SpaceBetween)
|
|
|
.padding({ left: 12, right: 4 })
|
|
|
- .height(36)
|
|
|
+ .height(56)
|
|
|
.onClick(item.click)
|
|
|
}
|
|
|
|
|
|
@@ -183,12 +211,8 @@ struct SettingPage {
|
|
|
.backgroundColor(Color.White)
|
|
|
.border({ width: 1, color: '#14000000' })
|
|
|
.margin({ bottom: 25 })
|
|
|
- .onChange((value) => {
|
|
|
- if (value.length > 7) {
|
|
|
- this.value = value.slice(0, 7)
|
|
|
- IBestToast.show({ type: "warning", message: '用户名称最大为7位' })
|
|
|
- }
|
|
|
- })
|
|
|
+ .maxLength(7)
|
|
|
+
|
|
|
|
|
|
Row({ space: 32 }) {
|
|
|
YTButton({
|