|
@@ -63,12 +63,23 @@ export struct WebDavAccountDialog {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
build() {
|
|
build() {
|
|
|
|
|
+ Scroll(){
|
|
|
|
|
+ this.contentBuilder()
|
|
|
|
|
+ }
|
|
|
|
|
+ .height('100%')
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .scrollBar(BarState.Off)
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Builder
|
|
|
|
|
+ contentBuilder() {
|
|
|
Column({ space: 16 }) {
|
|
Column({ space: 16 }) {
|
|
|
// 标题
|
|
// 标题
|
|
|
Text(this.isEditMode ? '编辑账户' : '添加账户')
|
|
Text(this.isEditMode ? '编辑账户' : '添加账户')
|
|
|
.fontSize(18)
|
|
.fontSize(18)
|
|
|
.fontWeight(FontWeight.Bold)
|
|
.fontWeight(FontWeight.Bold)
|
|
|
- .fontColor($r('app.color.index_tab_font_color'))
|
|
|
|
|
|
|
+ .fontColor($r('app.color.index_tab_font_color'));
|
|
|
|
|
|
|
|
// 账户封面选择
|
|
// 账户封面选择
|
|
|
Column({ space: 8 }) {
|
|
Column({ space: 8 }) {
|
|
@@ -76,7 +87,7 @@ export struct WebDavAccountDialog {
|
|
|
.fontSize(14)
|
|
.fontSize(14)
|
|
|
.fontColor(this.isDarkMode ? '#EBEBF5' : '#666666')
|
|
.fontColor(this.isDarkMode ? '#EBEBF5' : '#666666')
|
|
|
.fontWeight(FontWeight.Medium)
|
|
.fontWeight(FontWeight.Medium)
|
|
|
- .alignSelf(ItemAlign.Start)
|
|
|
|
|
|
|
+ .alignSelf(ItemAlign.Start);
|
|
|
|
|
|
|
|
// 封面选择区域
|
|
// 封面选择区域
|
|
|
Row({ space: 12 }) {
|
|
Row({ space: 12 }) {
|
|
@@ -87,25 +98,25 @@ export struct WebDavAccountDialog {
|
|
|
.width(80)
|
|
.width(80)
|
|
|
.height(80)
|
|
.height(80)
|
|
|
.borderRadius(8)
|
|
.borderRadius(8)
|
|
|
- .objectFit(ImageFit.Cover)
|
|
|
|
|
|
|
+ .objectFit(ImageFit.Cover);
|
|
|
} else {
|
|
} else {
|
|
|
// 默认封面图标
|
|
// 默认封面图标
|
|
|
Column() {
|
|
Column() {
|
|
|
Image($r('app.media.cloudDisk'))
|
|
Image($r('app.media.cloudDisk'))
|
|
|
.width(40)
|
|
.width(40)
|
|
|
.height(40)
|
|
.height(40)
|
|
|
- .fillColor(this.isDarkMode ? Color.White : this.themeColor)
|
|
|
|
|
|
|
+ .fillColor(this.isDarkMode ? Color.White : this.themeColor);
|
|
|
}
|
|
}
|
|
|
.width(80)
|
|
.width(80)
|
|
|
.height(80)
|
|
.height(80)
|
|
|
.backgroundColor(this.isDarkMode ? '#2C2C2E' : $r('app.color.input_background'))
|
|
.backgroundColor(this.isDarkMode ? '#2C2C2E' : $r('app.color.input_background'))
|
|
|
.borderRadius(8)
|
|
.borderRadius(8)
|
|
|
- .justifyContent(FlexAlign.Center)
|
|
|
|
|
|
|
+ .justifyContent(FlexAlign.Center);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
.onClick(() => {
|
|
.onClick(() => {
|
|
|
- this.handleSelectCover()
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ this.handleSelectCover();
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
// 操作按钮
|
|
// 操作按钮
|
|
|
Column({ space: 8 }) {
|
|
Column({ space: 8 }) {
|
|
@@ -116,8 +127,8 @@ export struct WebDavAccountDialog {
|
|
|
.fontColor(this.isDarkMode ? '#FFFFFF' : $r('app.color.text_color'))
|
|
.fontColor(this.isDarkMode ? '#FFFFFF' : $r('app.color.text_color'))
|
|
|
.backgroundColor(this.isDarkMode ? '#2C2C2E' : $r('app.color.input_background'))
|
|
.backgroundColor(this.isDarkMode ? '#2C2C2E' : $r('app.color.input_background'))
|
|
|
.onClick(() => {
|
|
.onClick(() => {
|
|
|
- this.handleSelectCover()
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ this.handleSelectCover();
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
if (this.coverPath) {
|
|
if (this.coverPath) {
|
|
|
Button('移除封面')
|
|
Button('移除封面')
|
|
@@ -127,118 +138,118 @@ export struct WebDavAccountDialog {
|
|
|
.fontColor(this.isDarkMode ? '#FF453A' : Color.Red)
|
|
.fontColor(this.isDarkMode ? '#FF453A' : Color.Red)
|
|
|
.backgroundColor(this.isDarkMode ? 'rgba(255,69,58,0.2)' : '#FFE5E5')
|
|
.backgroundColor(this.isDarkMode ? 'rgba(255,69,58,0.2)' : '#FFE5E5')
|
|
|
.onClick(() => {
|
|
.onClick(() => {
|
|
|
- this.handleRemoveCover()
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ this.handleRemoveCover();
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- .alignItems(HorizontalAlign.Start)
|
|
|
|
|
|
|
+ .alignItems(HorizontalAlign.Start);
|
|
|
}
|
|
}
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
- .justifyContent(FlexAlign.Start)
|
|
|
|
|
|
|
+ .justifyContent(FlexAlign.Start);
|
|
|
}
|
|
}
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
- .alignItems(HorizontalAlign.Start)
|
|
|
|
|
|
|
+ .alignItems(HorizontalAlign.Start);
|
|
|
|
|
|
|
|
// 账户名称
|
|
// 账户名称
|
|
|
Row({ space: 8 }) {
|
|
Row({ space: 8 }) {
|
|
|
Text('名称')
|
|
Text('名称')
|
|
|
.fontSize(14)
|
|
.fontSize(14)
|
|
|
- .fontColor($r('app.color.index_tab_font_color'))
|
|
|
|
|
|
|
+ .fontColor($r('app.color.index_tab_font_color'));
|
|
|
TextArea({ placeholder: '请输入账户名称', text: this.accountName })
|
|
TextArea({ placeholder: '请输入账户名称', text: this.accountName })
|
|
|
.layoutWeight(1)
|
|
.layoutWeight(1)
|
|
|
.maxLines(1)
|
|
.maxLines(1)
|
|
|
.onChange((value: string) => {
|
|
.onChange((value: string) => {
|
|
|
this.accountName = value;
|
|
this.accountName = value;
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
- .alignItems(VerticalAlign.Center)
|
|
|
|
|
|
|
+ .alignItems(VerticalAlign.Center);
|
|
|
|
|
|
|
|
// 服务器地址
|
|
// 服务器地址
|
|
|
Row({ space: 8 }) {
|
|
Row({ space: 8 }) {
|
|
|
Text('服务器')
|
|
Text('服务器')
|
|
|
.fontSize(14)
|
|
.fontSize(14)
|
|
|
.maxLines(2)
|
|
.maxLines(2)
|
|
|
- .fontColor($r('app.color.index_tab_font_color'))
|
|
|
|
|
|
|
+ .fontColor($r('app.color.index_tab_font_color'));
|
|
|
TextArea({ placeholder: '例如: example.com', text: this.host })
|
|
TextArea({ placeholder: '例如: example.com', text: this.host })
|
|
|
.layoutWeight(1)
|
|
.layoutWeight(1)
|
|
|
.onChange((value: string) => {
|
|
.onChange((value: string) => {
|
|
|
this.host = value;
|
|
this.host = value;
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- .alignItems(VerticalAlign.Center)
|
|
|
|
|
|
|
+ .alignItems(VerticalAlign.Center);
|
|
|
|
|
|
|
|
// 端口
|
|
// 端口
|
|
|
Row({ space: 8 }) {
|
|
Row({ space: 8 }) {
|
|
|
Text('端口')
|
|
Text('端口')
|
|
|
.fontSize(14)
|
|
.fontSize(14)
|
|
|
- .fontColor($r('app.color.index_tab_font_color'))
|
|
|
|
|
|
|
+ .fontColor($r('app.color.index_tab_font_color'));
|
|
|
TextInput({ placeholder: '默认: 80', text: this.port.toString() })
|
|
TextInput({ placeholder: '默认: 80', text: this.port.toString() })
|
|
|
.layoutWeight(1)
|
|
.layoutWeight(1)
|
|
|
.maxLines(1)
|
|
.maxLines(1)
|
|
|
.type(InputType.Number)
|
|
.type(InputType.Number)
|
|
|
.onChange((value: string) => {
|
|
.onChange((value: string) => {
|
|
|
this.port = parseInt(value) || 80;
|
|
this.port = parseInt(value) || 80;
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- .alignItems(VerticalAlign.Center)
|
|
|
|
|
|
|
+ .alignItems(VerticalAlign.Center);
|
|
|
|
|
|
|
|
// 文件目录
|
|
// 文件目录
|
|
|
Row({ space: 8 }) {
|
|
Row({ space: 8 }) {
|
|
|
Text('文件目录')
|
|
Text('文件目录')
|
|
|
.fontSize(14)
|
|
.fontSize(14)
|
|
|
- .fontColor($r('app.color.index_tab_font_color'))
|
|
|
|
|
|
|
+ .fontColor($r('app.color.index_tab_font_color'));
|
|
|
TextInput({ placeholder: '例如: /music', text: this.filepath })
|
|
TextInput({ placeholder: '例如: /music', text: this.filepath })
|
|
|
.layoutWeight(1)
|
|
.layoutWeight(1)
|
|
|
.maxLines(1)
|
|
.maxLines(1)
|
|
|
.onChange((value: string) => {
|
|
.onChange((value: string) => {
|
|
|
this.filepath = value;
|
|
this.filepath = value;
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- .alignItems(VerticalAlign.Center)
|
|
|
|
|
|
|
+ .alignItems(VerticalAlign.Center);
|
|
|
|
|
|
|
|
// 用户名
|
|
// 用户名
|
|
|
Row({ space: 8 }) {
|
|
Row({ space: 8 }) {
|
|
|
Text('用户名')
|
|
Text('用户名')
|
|
|
.fontSize(14)
|
|
.fontSize(14)
|
|
|
- .fontColor($r('app.color.index_tab_font_color'))
|
|
|
|
|
|
|
+ .fontColor($r('app.color.index_tab_font_color'));
|
|
|
TextInput({ placeholder: '请输入用户名', text: this.username })
|
|
TextInput({ placeholder: '请输入用户名', text: this.username })
|
|
|
.layoutWeight(1)
|
|
.layoutWeight(1)
|
|
|
.maxLines(1)
|
|
.maxLines(1)
|
|
|
.onChange((value: string) => {
|
|
.onChange((value: string) => {
|
|
|
this.username = value;
|
|
this.username = value;
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- .alignItems(VerticalAlign.Center)
|
|
|
|
|
|
|
+ .alignItems(VerticalAlign.Center);
|
|
|
|
|
|
|
|
// 密码
|
|
// 密码
|
|
|
Row({ space: 8 }) {
|
|
Row({ space: 8 }) {
|
|
|
Text('密码')
|
|
Text('密码')
|
|
|
.fontSize(14)
|
|
.fontSize(14)
|
|
|
- .fontColor($r('app.color.index_tab_font_color'))
|
|
|
|
|
|
|
+ .fontColor($r('app.color.index_tab_font_color'));
|
|
|
TextInput({ placeholder: '请输入密码', text: this.password })
|
|
TextInput({ placeholder: '请输入密码', text: this.password })
|
|
|
.type(InputType.Password)
|
|
.type(InputType.Password)
|
|
|
.layoutWeight(1)
|
|
.layoutWeight(1)
|
|
|
.maxLines(2)
|
|
.maxLines(2)
|
|
|
.onChange((value: string) => {
|
|
.onChange((value: string) => {
|
|
|
this.password = value;
|
|
this.password = value;
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- .alignItems(VerticalAlign.Center)
|
|
|
|
|
|
|
+ .alignItems(VerticalAlign.Center);
|
|
|
|
|
|
|
|
// HTTPS开关
|
|
// HTTPS开关
|
|
|
Row() {
|
|
Row() {
|
|
|
Text('启用HTTPS')
|
|
Text('启用HTTPS')
|
|
|
.fontSize(14)
|
|
.fontSize(14)
|
|
|
- .fontColor($r('app.color.index_tab_font_color'))
|
|
|
|
|
- Blank()
|
|
|
|
|
|
|
+ .fontColor($r('app.color.index_tab_font_color'));
|
|
|
|
|
+ Blank();
|
|
|
Toggle({ type: ToggleType.Switch, isOn: this.enableHttps })
|
|
Toggle({ type: ToggleType.Switch, isOn: this.enableHttps })
|
|
|
.selectedColor(this.themeColor)
|
|
.selectedColor(this.themeColor)
|
|
|
.onChange((isOn: boolean) => {
|
|
.onChange((isOn: boolean) => {
|
|
|
this.enableHttps = isOn;
|
|
this.enableHttps = isOn;
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- .width('100%')
|
|
|
|
|
|
|
+ .width('100%');
|
|
|
|
|
|
|
|
// 按钮
|
|
// 按钮
|
|
|
Row({ space: 12 }) {
|
|
Row({ space: 12 }) {
|
|
@@ -248,7 +259,7 @@ export struct WebDavAccountDialog {
|
|
|
.layoutWeight(1)
|
|
.layoutWeight(1)
|
|
|
.onClick(() => {
|
|
.onClick(() => {
|
|
|
this.onCancel?.();
|
|
this.onCancel?.();
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
Button(this.isEditMode ? '保存' : '添加', { type: ButtonType.Capsule })
|
|
Button(this.isEditMode ? '保存' : '添加', { type: ButtonType.Capsule })
|
|
|
.backgroundColor(this.themeColor)
|
|
.backgroundColor(this.themeColor)
|
|
@@ -260,7 +271,7 @@ export struct WebDavAccountDialog {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const updatedAccount = new WebDavAccount();
|
|
const updatedAccount = new WebDavAccount();
|
|
|
- if(this.isEditMode){
|
|
|
|
|
|
|
+ if (this.isEditMode) {
|
|
|
updatedAccount.id = this.account.id;
|
|
updatedAccount.id = this.account.id;
|
|
|
}
|
|
}
|
|
|
updatedAccount.name = this.accountName;
|
|
updatedAccount.name = this.accountName;
|
|
@@ -279,10 +290,10 @@ export struct WebDavAccountDialog {
|
|
|
updatedAccount.imageFilePath = '';
|
|
updatedAccount.imageFilePath = '';
|
|
|
this.onConfirm?.(updatedAccount);
|
|
this.onConfirm?.(updatedAccount);
|
|
|
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
- .margin({ top: 8 })
|
|
|
|
|
|
|
+ .margin({ top: 8 });
|
|
|
}
|
|
}
|
|
|
.padding(24)
|
|
.padding(24)
|
|
|
.width('90%')
|
|
.width('90%')
|