Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
飞
飞鹤小程序
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
FH
飞鹤小程序
Commits
9428ad5e
Commit
9428ad5e
authored
Jul 01, 2025
by
jtwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
9ec944e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
50 deletions
+54
-50
naming.vue
pages/naming/naming.vue
+54
-50
No files found.
pages/naming/naming.vue
View file @
9428ad5e
...
...
@@ -81,8 +81,7 @@
<view
class=
"surname_box"
>
<view
class=
"item_top"
>
<span
class=
"title_txt"
><span
:style=
"
{color: '#b27c1e'}">*
</span>
姓氏
</span>
<input
class=
"name_input"
v-model=
"surname"
@
input=
"setNameInput"
@
blur=
"forceCorrection"
/>
<input
class=
"name_input"
v-model=
"surname"
@
input=
"setNameInput"
@
blur=
"forceCorrection"
/>
</view>
<view
class=
"item_line"
></view>
</view>
...
...
@@ -164,8 +163,9 @@
<view
class=
"shall_be_word"
>
<view
class=
"item_top"
>
<span
class=
"title_txt"
>
必有字
</span>
<input
class=
"shall_be_input"
:placeholder=
"showPlaceholder?'示例:多、浩、雨':''"
v-model=
"requiredChars"
@
blur=
"e => enforceSeparator(e, 1)"
@
focus=
"showPlaceholder=false"
/>
<input
class=
"shall_be_input"
:placeholder=
"showPlaceholder ? '示例:多、浩、雨' : ''"
v-model=
"requiredChars"
@
blur=
"e => enforceSeparator(e, 1)"
@
click=
"showPlaceholder = false"
/>
</view>
<view
class=
"item_line"
></view>
</view>
...
...
@@ -174,8 +174,8 @@
<view
class=
"taboo_word"
>
<view
class=
"item_top"
>
<span
class=
"title_txt"
>
避讳字
</span>
<input
class=
"taboo_input"
:placeholder=
"showPlaceholder2
?'示例:然、萌':
''"
v-model=
"avoidChars"
@
blur=
"e => enforceSeparator(e, 2)"
@
focus=
"showPlaceholder2=false"
/>
<input
class=
"taboo_input"
:placeholder=
"showPlaceholder2
? '示例:然、萌' :
''"
v-model=
"avoidChars"
@
blur=
"e => enforceSeparator(e, 2)"
@
click=
"showPlaceholder2 = false"
/>
</view>
<view
class=
"item_line"
></view>
</view>
...
...
@@ -188,7 +188,7 @@
<view
class=
"radio-group"
>
<view
:style=
"
{display: 'flex'}">
<label
class=
"radio-item"
:class=
"
{ active: expectedStyle === '古风诗词' }"
@click="expectedStyle = '古风诗词'">
@click="
(expectedStyle === '古风诗词')? expectedStyle = '' :
expectedStyle = '古风诗词'">
<radio
:style=
"
{opacity: 0}" :checked="expectedStyle === '古风诗词'"
color="#4a90e2" />
<view
class=
"custom-radio"
:style=
"
{display: 'flex','margin-top': '-41rpx'}">
...
...
@@ -199,7 +199,7 @@
</view>
</label>
<label
class=
"radio-item"
:class=
"
{ active: expectedStyle === '蛇年生肖' }"
@click="expectedStyle = '蛇年生肖'">
@click="
(expectedStyle === '蛇年生肖')? expectedStyle = '' :
expectedStyle = '蛇年生肖'">
<radio
:style=
"
{opacity: 0}" :checked="expectedStyle === '蛇年生肖'"
color="#4a90e2" />
<view
class=
"custom-radio"
:style=
"
{display: 'flex','margin-top': '-41rpx'}">
...
...
@@ -212,7 +212,7 @@
</view>
<view
:style=
"
{display: 'flex'}">
<label
class=
"radio-item"
:class=
"
{ active: expectedStyle === '龙年生肖' }"
@click="expectedStyle = '龙年生肖'">
@click="
(expectedStyle === '龙年生肖')? expectedStyle = '' :
expectedStyle = '龙年生肖'">
<radio
:style=
"
{opacity: 0}" :checked="expectedStyle === '龙年生肖'"
color="#4a90e2" />
<view
class=
"custom-radio"
:style=
"
{display: 'flex','margin-top': '-41rpx'}">
...
...
@@ -223,7 +223,7 @@
</view>
</label>
<label
class=
"radio-item"
:class=
"
{ active: expectedStyle === '马年生肖' }"
@click="expectedStyle = '马年生肖'">
@click="
(expectedStyle === '马年生肖')? expectedStyle = '' :
expectedStyle = '马年生肖'">
<radio
:style=
"
{opacity: 0}" :checked="expectedStyle === '马年生肖'"
color="#4a90e2" />
<view
class=
"custom-radio"
:style=
"
{display: 'flex','margin-top': '-41rpx'}">
...
...
@@ -242,7 +242,8 @@
</view>
<view
class=
"naming_btn"
:style=
"
{backgroundImage: `url(${$baseUrl}aiNaming/btn.png)`}" @click="onNaming">
<view
class=
"naming_btn"
:style=
"
{backgroundImage: `url(${$baseUrl}aiNaming/naming_btn.png)`}"
@click="onNaming">
</view>
</view>
</view>
...
...
@@ -277,10 +278,10 @@
// 性别选择
const
gender
=
ref
(
''
);
// 字数要求
const
wordCount
=
ref
(
''
);
const
wordCount
=
ref
(
''
);
const
showPlaceholder
=
ref
(
true
);
//必有字
const
requiredChars
=
ref
(
''
);
const
requiredChars
=
ref
(
''
);
const
showPlaceholder2
=
ref
(
true
);
//避讳字
const
avoidChars
=
ref
(
''
);
...
...
@@ -402,10 +403,10 @@
text
=
text
.
replace
(
/、/g
,
''
)
// 2. 在每个字符后插入分隔符(最后一个字符除外)
const
formatted
=
[...
text
].
join
(
'、'
)
if
(
idx
==
1
)
{
if
(
idx
==
1
)
{
showPlaceholder
.
value
=
true
;
// 获取焦点时隐藏占位符
requiredChars
.
value
=
formatted
.
slice
(
0
,
5
)
}
else
if
(
idx
==
2
)
{
}
else
if
(
idx
==
2
)
{
showPlaceholder2
.
value
=
true
;
// 获取焦点时隐藏占位符
avoidChars
.
value
=
formatted
.
slice
(
0
,
5
)
}
...
...
@@ -424,47 +425,47 @@
expectedStyle
:
expectedStyle
.
value
}
// console.log('开始取名::', param)
// if (!param.birthStatus || !param.birthTime || !param.surname || !param.gender || !param.wordCount) {
// uni.showToast({
// title: '还有信息没填写哦',
// icon: 'none'
// })
// return;
// }
// if (!param.birthStatus || !param.birthTime || !param.surname || !param.gender || !param.wordCount) {
// uni.showToast({
// title: '还有信息没填写哦',
// icon: 'none'
// })
// return;
// }
if
(
!
param
.
birthStatus
)
{
uni
.
showToast
({
title
:
'请选择出生状态'
,
icon
:
'none'
})
return
;
}
if
(
!
param
.
birthTime
)
{
}
if
(
!
param
.
birthTime
)
{
uni
.
showToast
({
title
:
'请选择出生时间'
,
icon
:
'none'
})
return
;
}
if
(
!
param
.
surname
)
{
return
;
}
if
(
!
param
.
surname
)
{
uni
.
showToast
({
title
:
'请输入姓氏'
,
icon
:
'none'
})
return
;
}
if
(
!
param
.
gender
)
{
return
;
}
if
(
!
param
.
gender
)
{
uni
.
showToast
({
title
:
'请选择性别'
,
icon
:
'none'
})
return
;
}
if
(
!
param
.
wordCount
)
{
return
;
}
if
(
!
param
.
wordCount
)
{
uni
.
showToast
({
title
:
'请选择数字要求'
,
icon
:
'none'
})
return
;
return
;
}
//验证通过,调接口
...
...
@@ -481,13 +482,13 @@
let
d
=
await
aiNaming
(
param
);
if
(
d
)
{
let
nameList
=
d
?.
data
;
console
.
log
(
'取名回调:'
,
nameList
)
if
(
nameList
[
0
].
meaning
==
"未获取解释"
){
uni
.
showToast
({
title
:
'生成失败,请检查你输入的内容'
,
icon
:
'none'
})
return
console
.
log
(
'取名回调:'
,
nameList
)
if
(
nameList
[
0
].
meaning
==
"未获取解释"
)
{
uni
.
showToast
({
title
:
'生成失败,请检查你输入的内容'
,
icon
:
'none'
})
return
}
// 隐藏
uni
.
hideLoading
()
...
...
@@ -512,16 +513,19 @@
}
</
script
>
<
style
lang=
"less"
scoped
>
::v-deep .uni-datetime-picker--btn{
background-color: #d3a358 !important;
}
::v-deep .uni-calendar-item--checked{
background-color: #d3a358 !important;
}
::v-deep .uni-datetime-picker-btn-text{
color: #d3a358 !important;
<
style
lang=
"less"
scoped
>
::v-deep .uni-datetime-picker--btn {
background-color: #d3a358 !important;
}
::v-deep .uni-calendar-item--checked {
background-color: #d3a358 !important;
}
::v-deep .uni-datetime-picker-btn-text {
color: #d3a358 !important;
}
.naming_bg {
// position: absolute;
width: 100%;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment