Commit 9ec944e3 authored by jtwu's avatar jtwu

取名功能验收优化

parent 7cf40d06
......@@ -164,8 +164,8 @@
<view class="shall_be_word">
<view class="item_top">
<span class="title_txt">必有字</span>
<input class="shall_be_input" placeholder="多、浩、雨" v-model="requiredChars"
@blur="e => enforceSeparator(e, 1)" />
<input class="shall_be_input" :placeholder="showPlaceholder?'示例:多、浩、雨':''" v-model="requiredChars"
@blur="e => enforceSeparator(e, 1)" @focus="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="然、萌" v-model="avoidChars"
@blur="e => enforceSeparator(e, 2)" />
<input class="taboo_input" :placeholder="showPlaceholder2?'示例:然、萌':''" v-model="avoidChars"
@blur="e => enforceSeparator(e, 2)" @focus="showPlaceholder2=false" />
</view>
<view class="item_line"></view>
</view>
......@@ -277,9 +277,11 @@
// 性别选择
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('');
//期望风格
......@@ -400,9 +402,11 @@
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)
}
}
......@@ -420,12 +424,47 @@
expectedStyle: expectedStyle.value
}
// console.log('开始取名::', param)
if (!param.birthStatus || !param.birthTime || !param.surname || !param.gender || !param.wordCount) {
// if (!param.birthStatus || !param.birthTime || !param.surname || !param.gender || !param.wordCount) {
// uni.showToast({
// title: '还有信息没填写哦',
// icon: 'none'
// })
// return;
// }
if (!param.birthStatus) {
uni.showToast({
title: '还有信息没填写哦',
title: '请选择出生状态',
icon: 'none'
})
return;
}
if(!param.birthTime){
uni.showToast({
title: '请选择出生时间',
icon: 'none'
})
return;
}
if(!param.surname){
uni.showToast({
title: '请输入姓氏',
icon: 'none'
})
return;
}
if(!param.gender){
uni.showToast({
title: '请选择性别',
icon: 'none'
})
return;
}
if(!param.wordCount){
uni.showToast({
title: '请选择数字要求',
icon: 'none'
})
return;
}
//验证通过,调接口
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment