|
@@ -18,7 +18,7 @@ addIcons({ 'arrow-back-outline': arrowBackOutline, radioButtonOffOutline, closeC
|
|
templateUrl: './generate-option.component.html',
|
|
templateUrl: './generate-option.component.html',
|
|
styleUrls: ['./generate-option.component.scss'],
|
|
styleUrls: ['./generate-option.component.scss'],
|
|
standalone: true,
|
|
standalone: true,
|
|
- imports: [CustomHeaderComponent,IonicModule, CommonModule, FormsModule],
|
|
|
|
|
|
+ imports: [CustomHeaderComponent, IonicModule, CommonModule, FormsModule],
|
|
})
|
|
})
|
|
export class GenerateOptionComponent implements OnInit {
|
|
export class GenerateOptionComponent implements OnInit {
|
|
/**
|
|
/**
|
|
@@ -34,6 +34,39 @@ export class GenerateOptionComponent implements OnInit {
|
|
goBack() {
|
|
goBack() {
|
|
this.navCtrl.back();
|
|
this.navCtrl.back();
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * @常量定义
|
|
|
|
+ */
|
|
|
|
+ description: { [key: string]: string } = {
|
|
|
|
+ '中国风': "汉服/唐装/中式元素/古典美",
|
|
|
|
+ '日系': "棉麻/清新/柔和/文艺/舒适/盐系/森女系",
|
|
|
|
+ '韩系': "色彩淡雅/感性/温柔/气质/甜美",
|
|
|
|
+ '欧美风': "Athflow风/随性/简单/街头/帅气/张扬/性感/中性",
|
|
|
|
+ '英伦风': "学院派/复古猎装/绅士格子/复古/低饱和度",
|
|
|
|
+ '法式': "优雅/浪漫/知性/碎花/慵懒",
|
|
|
|
+ '波西米亚风': "层层叠叠的花边/细绳结/皮质的流苏/纷乱的珠串装饰",
|
|
|
|
+ '通勤风': "职业装/OL风/时髦知识分子风/简约通勤",
|
|
|
|
+ '休闲风': "时尚/街头/日常/慵懒休闲风",
|
|
|
|
+ '田园风': "轻松/舒适/棉麻/碎花/蕾丝",
|
|
|
|
+ '校园风': "美式校园/英伦校园/日式JK",
|
|
|
|
+ '约会装': "御姐/软妹/辣妹/仙女/淑女",
|
|
|
|
+ '度假风': "轻盈/舒适/清爽/自然/休闲",
|
|
|
|
+ '新中式': "传统中式元素融合现代设计/混搭/中式美学元素/更日常",
|
|
|
|
+ '淑女风': "知性/优雅/简洁大方/现代都市",
|
|
|
|
+ '名媛风': "高贵/典雅/精致/凸显气质",
|
|
|
|
+ '简约风': "艺术/至简纯粹/质感/高级感",
|
|
|
|
+ '极简风': "老钱风/CleanFit风/静奢风简约/大气/中性",
|
|
|
|
+ '中性风': "无性别主义/中性色调",
|
|
|
|
+ '民族风': "民族元素/手工艺/色彩鲜艳",
|
|
|
|
+ '复古风': "随性/文艺/复古/浊色调",
|
|
|
|
+ '嘻哈风': "街头文化/运动/奢华时尚",
|
|
|
|
+ '哥特风格': "暗黑/锐角三角形/金属件",
|
|
|
|
+ '浪漫主义': "柔美/荷叶边/透明",
|
|
|
|
+ '洛可可风格': "C型漩涡花纹/胸衣/木耳边/花边",
|
|
|
|
+ '洛丽塔风格': "可爱/甜美/蕾丝/褶边",
|
|
|
|
+ '维多利亚风': "蕾丝/细砂/荷叶边/缎带蝴蝶结/多层次/褶皱/抽褶/羊腿袖",
|
|
|
|
+ '未来主义': "金属色/现代几何/科技感",
|
|
|
|
+ };
|
|
/**
|
|
/**
|
|
* @选项卡定义变量
|
|
* @选项卡定义变量
|
|
*/
|
|
*/
|
|
@@ -45,11 +78,10 @@ export class GenerateOptionComponent implements OnInit {
|
|
weight: '不限制',
|
|
weight: '不限制',
|
|
season: '不限制',
|
|
season: '不限制',
|
|
customDesc: '',
|
|
customDesc: '',
|
|
- regStyle: '不限制',
|
|
|
|
- sceFunction: '不限制',
|
|
|
|
- dsgPhilosophy: '不限制',
|
|
|
|
|
|
+ areaStyle: '不限制',
|
|
|
|
+ function: '不限制',
|
|
|
|
+ designIdea: '不限制',
|
|
artStyle: '不限制',
|
|
artStyle: '不限制',
|
|
- color: '不限制',
|
|
|
|
};
|
|
};
|
|
//性别选项卡定义变量
|
|
//性别选项卡定义变量
|
|
gender: { [key: string]: boolean } = {
|
|
gender: { [key: string]: boolean } = {
|
|
@@ -102,7 +134,6 @@ export class GenerateOptionComponent implements OnInit {
|
|
'休闲风': false,
|
|
'休闲风': false,
|
|
'田园风': false,
|
|
'田园风': false,
|
|
'校园风': false,
|
|
'校园风': false,
|
|
- 'Party风': false,
|
|
|
|
'约会装': false,
|
|
'约会装': false,
|
|
'度假风': false
|
|
'度假风': false
|
|
};
|
|
};
|
|
@@ -115,11 +146,8 @@ export class GenerateOptionComponent implements OnInit {
|
|
'极简风': false,
|
|
'极简风': false,
|
|
'中性风': false,
|
|
'中性风': false,
|
|
'民族风': false,
|
|
'民族风': false,
|
|
- '戏剧风': false,
|
|
|
|
'复古风': false,
|
|
'复古风': false,
|
|
- 'Y2K': false,
|
|
|
|
'嘻哈风': false,
|
|
'嘻哈风': false,
|
|
- '甜酷风': false
|
|
|
|
}
|
|
}
|
|
//艺术风格选项卡定义变量
|
|
//艺术风格选项卡定义变量
|
|
artStyle: { [key: string]: boolean } = {
|
|
artStyle: { [key: string]: boolean } = {
|
|
@@ -136,6 +164,24 @@ export class GenerateOptionComponent implements OnInit {
|
|
'美拉德穿搭': false
|
|
'美拉德穿搭': false
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @根据索引找到键值
|
|
|
|
+ */
|
|
|
|
+ getKeyByIndex(option: { [key: string]: boolean }, index: number): string {
|
|
|
|
+ const keys = Object.keys(option); // 获取 option 对象中的所有键
|
|
|
|
+ return keys[index]; // 根据索引找到选中的键
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * @返回字典中true值对应的key
|
|
|
|
+ */
|
|
|
|
+ getSelectedKey(option: { [key: string]: boolean }): string {
|
|
|
|
+ for (const key in option) {
|
|
|
|
+ if (option[key]) {
|
|
|
|
+ return key;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return "null"; // 如果没有找到选中的键,则返回null
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* @切换选项卡
|
|
* @切换选项卡
|
|
* 1.option:字典对象
|
|
* 1.option:字典对象
|
|
@@ -143,15 +189,19 @@ export class GenerateOptionComponent implements OnInit {
|
|
* 3.name:字典变量名
|
|
* 3.name:字典变量名
|
|
*/
|
|
*/
|
|
toggleActive(option: { [key: string]: boolean }, index: number, name: string) {
|
|
toggleActive(option: { [key: string]: boolean }, index: number, name: string) {
|
|
- for (const optkey in option) {
|
|
|
|
- option[optkey] = false;
|
|
|
|
|
|
+ const selectedKey = this.getKeyByIndex(option, index); // 根据索引找到选中的键
|
|
|
|
+ if (!option[selectedKey]) {
|
|
|
|
+ for (const optkey in option) {
|
|
|
|
+ option[optkey] = false;
|
|
|
|
+ }
|
|
|
|
+ // 将选中的键对应的值设置为 true
|
|
|
|
+ option[selectedKey] = true;
|
|
|
|
+ // 更新 userProfile 中的对应字段
|
|
|
|
+ this.userProfile[name as keyof UserProfile] = selectedKey;
|
|
|
|
+ }else{
|
|
|
|
+ option[selectedKey] = false;
|
|
|
|
+ this.userProfile[name as keyof UserProfile] = '不限制';
|
|
}
|
|
}
|
|
- const keys = Object.keys(option); // 获取 option 对象中的所有键
|
|
|
|
- const selectedKey = keys[index]; // 根据索引找到选中的键
|
|
|
|
- // 将选中的键对应的值设置为 true
|
|
|
|
- option[selectedKey] = true;
|
|
|
|
- // 更新 userProfile 中的对应字段
|
|
|
|
- this.userProfile[name as keyof UserProfile] = selectedKey;
|
|
|
|
console.log(this.userProfile);
|
|
console.log(this.userProfile);
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -163,7 +213,14 @@ export class GenerateOptionComponent implements OnInit {
|
|
getImageSrc(option: { [key: string]: boolean }, index: number, String: string): string {
|
|
getImageSrc(option: { [key: string]: boolean }, index: number, String: string): string {
|
|
const keys = Object.keys(option); // 获取 option 对象中的所有键
|
|
const keys = Object.keys(option); // 获取 option 对象中的所有键
|
|
const selectedKey = keys[index]; // 根据索引找到选中的键
|
|
const selectedKey = keys[index]; // 根据索引找到选中的键
|
|
|
|
+ if (String.includes('areaStyle') ||
|
|
|
|
+ String.includes('function') ||
|
|
|
|
+ String.includes('designIdea') ||
|
|
|
|
+ String.includes('artStyle')) {
|
|
|
|
+ return '/assets/generate-option-style/' + String + '.jpg';
|
|
|
|
+ }
|
|
const isActive = option[selectedKey];
|
|
const isActive = option[selectedKey];
|
|
|
|
+ // return isActive ? 'https://app.fmode.cn/dev/jxnu/202226701053/assets/generate-option-style/' + String + '-isActive-true.png' : 'https://app.fmode.cn/dev/jxnu/202226701053/assets/generate-option-style/' + String + '-isActive-false.png';
|
|
return isActive ? '/assets/generate-option-style/' + String + '-isActive-true.png' : '/assets/generate-option-style/' + String + '-isActive-false.png';
|
|
return isActive ? '/assets/generate-option-style/' + String + '-isActive-true.png' : '/assets/generate-option-style/' + String + '-isActive-false.png';
|
|
}
|
|
}
|
|
|
|
|
|
@@ -254,18 +311,18 @@ export class GenerateOptionComponent implements OnInit {
|
|
* 3.调用doGenerateTask方法
|
|
* 3.调用doGenerateTask方法
|
|
*/
|
|
*/
|
|
sendMsgAndGoGenerateResult() {
|
|
sendMsgAndGoGenerateResult() {
|
|
- if(this.validate()){
|
|
|
|
- this.showJudgePage();
|
|
|
|
- console.log("展示当前读取到的用户信息:");
|
|
|
|
- console.log(this.userProfile);
|
|
|
|
- this.doGenerateTask();
|
|
|
|
|
|
+ if (this.validate()) {
|
|
|
|
+ this.showJudgePage();
|
|
|
|
+ console.log("展示当前读取到的用户信息:");
|
|
|
|
+ console.log(this.userProfile);
|
|
|
|
+ this.doGenerateTask();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- validate(){
|
|
|
|
|
|
+ validate() {
|
|
console.log("开始验证用户信息");
|
|
console.log("开始验证用户信息");
|
|
let currentUser = new CloudUser();
|
|
let currentUser = new CloudUser();
|
|
- if(!currentUser?.id){
|
|
|
|
|
|
+ if (!currentUser?.id) {
|
|
console.log("用户未登录,请先登录");
|
|
console.log("用户未登录,请先登录");
|
|
//openUserLoginModal(this.modalCtrl as any);
|
|
//openUserLoginModal(this.modalCtrl as any);
|
|
return false;
|
|
return false;
|
|
@@ -284,9 +341,8 @@ type UserProfile = {
|
|
weight: string;
|
|
weight: string;
|
|
season: string;
|
|
season: string;
|
|
customDesc: string;
|
|
customDesc: string;
|
|
- regStyle: string;
|
|
|
|
- sceFunction: string;
|
|
|
|
- dsgPhilosophy: string;
|
|
|
|
|
|
+ areaStyle: string;
|
|
|
|
+ function: string;
|
|
|
|
+ designIdea: string;
|
|
artStyle: string;
|
|
artStyle: string;
|
|
- color: string;
|
|
|
|
};
|
|
};
|