Commit 9428ad5e authored by jtwu's avatar jtwu

优化

parent 9ec944e3
...@@ -81,8 +81,7 @@ ...@@ -81,8 +81,7 @@
<view class="surname_box"> <view class="surname_box">
<view class="item_top"> <view class="item_top">
<span class="title_txt"><span :style="{color: '#b27c1e'}">*</span>姓氏</span> <span class="title_txt"><span :style="{color: '#b27c1e'}">*</span>姓氏</span>
<input class="name_input" v-model="surname" @input="setNameInput" <input class="name_input" v-model="surname" @input="setNameInput" @blur="forceCorrection" />
@blur="forceCorrection" />
</view> </view>
<view class="item_line"></view> <view class="item_line"></view>
</view> </view>
...@@ -164,8 +163,9 @@ ...@@ -164,8 +163,9 @@
<view class="shall_be_word"> <view class="shall_be_word">
<view class="item_top"> <view class="item_top">
<span class="title_txt">必有字</span> <span class="title_txt">必有字</span>
<input class="shall_be_input" :placeholder="showPlaceholder?'示例:多、浩、雨':''" v-model="requiredChars" <input class="shall_be_input" :placeholder="showPlaceholder ? '示例:多、浩、雨' : ''"
@blur="e => enforceSeparator(e, 1)" @focus="showPlaceholder=false" /> v-model="requiredChars" @blur="e => enforceSeparator(e, 1)"
@click="showPlaceholder = false"/>
</view> </view>
<view class="item_line"></view> <view class="item_line"></view>
</view> </view>
...@@ -174,8 +174,8 @@ ...@@ -174,8 +174,8 @@
<view class="taboo_word"> <view class="taboo_word">
<view class="item_top"> <view class="item_top">
<span class="title_txt">避讳字</span> <span class="title_txt">避讳字</span>
<input class="taboo_input" :placeholder="showPlaceholder2?'示例:然、萌':''" v-model="avoidChars" <input class="taboo_input" :placeholder="showPlaceholder2 ? '示例:然、萌' : ''" v-model="avoidChars"
@blur="e => enforceSeparator(e, 2)" @focus="showPlaceholder2=false" /> @blur="e => enforceSeparator(e, 2)" @click="showPlaceholder2 = false"/>
</view> </view>
<view class="item_line"></view> <view class="item_line"></view>
</view> </view>
...@@ -188,7 +188,7 @@ ...@@ -188,7 +188,7 @@
<view class="radio-group"> <view class="radio-group">
<view :style="{display: 'flex'}"> <view :style="{display: 'flex'}">
<label class="radio-item" :class="{ active: expectedStyle === '古风诗词' }" <label class="radio-item" :class="{ active: expectedStyle === '古风诗词' }"
@click="expectedStyle = '古风诗词'"> @click="(expectedStyle === '古风诗词')? expectedStyle = '' : expectedStyle = '古风诗词'">
<radio :style="{opacity: 0}" :checked="expectedStyle === '古风诗词'" <radio :style="{opacity: 0}" :checked="expectedStyle === '古风诗词'"
color="#4a90e2" /> color="#4a90e2" />
<view class="custom-radio" :style="{display: 'flex','margin-top': '-41rpx'}"> <view class="custom-radio" :style="{display: 'flex','margin-top': '-41rpx'}">
...@@ -199,7 +199,7 @@ ...@@ -199,7 +199,7 @@
</view> </view>
</label> </label>
<label class="radio-item" :class="{ active: expectedStyle === '蛇年生肖' }" <label class="radio-item" :class="{ active: expectedStyle === '蛇年生肖' }"
@click="expectedStyle = '蛇年生肖'"> @click="(expectedStyle === '蛇年生肖')? expectedStyle = '' : expectedStyle = '蛇年生肖'">
<radio :style="{opacity: 0}" :checked="expectedStyle === '蛇年生肖'" <radio :style="{opacity: 0}" :checked="expectedStyle === '蛇年生肖'"
color="#4a90e2" /> color="#4a90e2" />
<view class="custom-radio" :style="{display: 'flex','margin-top': '-41rpx'}"> <view class="custom-radio" :style="{display: 'flex','margin-top': '-41rpx'}">
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
</view> </view>
<view :style="{display: 'flex'}"> <view :style="{display: 'flex'}">
<label class="radio-item" :class="{ active: expectedStyle === '龙年生肖' }" <label class="radio-item" :class="{ active: expectedStyle === '龙年生肖' }"
@click="expectedStyle = '龙年生肖'"> @click="(expectedStyle === '龙年生肖')? expectedStyle = '' : expectedStyle = '龙年生肖'">
<radio :style="{opacity: 0}" :checked="expectedStyle === '龙年生肖'" <radio :style="{opacity: 0}" :checked="expectedStyle === '龙年生肖'"
color="#4a90e2" /> color="#4a90e2" />
<view class="custom-radio" :style="{display: 'flex','margin-top': '-41rpx'}"> <view class="custom-radio" :style="{display: 'flex','margin-top': '-41rpx'}">
...@@ -223,7 +223,7 @@ ...@@ -223,7 +223,7 @@
</view> </view>
</label> </label>
<label class="radio-item" :class="{ active: expectedStyle === '马年生肖' }" <label class="radio-item" :class="{ active: expectedStyle === '马年生肖' }"
@click="expectedStyle = '马年生肖'"> @click="(expectedStyle === '马年生肖')? expectedStyle = '' : expectedStyle = '马年生肖'">
<radio :style="{opacity: 0}" :checked="expectedStyle === '马年生肖'" <radio :style="{opacity: 0}" :checked="expectedStyle === '马年生肖'"
color="#4a90e2" /> color="#4a90e2" />
<view class="custom-radio" :style="{display: 'flex','margin-top': '-41rpx'}"> <view class="custom-radio" :style="{display: 'flex','margin-top': '-41rpx'}">
...@@ -242,7 +242,8 @@ ...@@ -242,7 +242,8 @@
</view> </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> </view>
</view> </view>
...@@ -277,10 +278,10 @@ ...@@ -277,10 +278,10 @@
// 性别选择 // 性别选择
const gender = ref(''); const gender = ref('');
// 字数要求 // 字数要求
const wordCount = ref(''); const wordCount = ref('');
const showPlaceholder = ref(true); const showPlaceholder = ref(true);
//必有字 //必有字
const requiredChars = ref(''); const requiredChars = ref('');
const showPlaceholder2 = ref(true); const showPlaceholder2 = ref(true);
//避讳字 //避讳字
const avoidChars = ref(''); const avoidChars = ref('');
...@@ -402,10 +403,10 @@ ...@@ -402,10 +403,10 @@
text = text.replace(/、/g, '') text = text.replace(/、/g, '')
// 2. 在每个字符后插入分隔符(最后一个字符除外) // 2. 在每个字符后插入分隔符(最后一个字符除外)
const formatted = [...text].join('、') const formatted = [...text].join('、')
if (idx == 1) { if (idx == 1) {
showPlaceholder.value = true; // 获取焦点时隐藏占位符 showPlaceholder.value = true; // 获取焦点时隐藏占位符
requiredChars.value = formatted.slice(0, 5) requiredChars.value = formatted.slice(0, 5)
} else if (idx == 2) { } else if (idx == 2) {
showPlaceholder2.value = true; // 获取焦点时隐藏占位符 showPlaceholder2.value = true; // 获取焦点时隐藏占位符
avoidChars.value = formatted.slice(0, 5) avoidChars.value = formatted.slice(0, 5)
} }
...@@ -424,47 +425,47 @@ ...@@ -424,47 +425,47 @@
expectedStyle: expectedStyle.value expectedStyle: expectedStyle.value
} }
// console.log('开始取名::', param) // 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({ // uni.showToast({
// title: '还有信息没填写哦', // title: '还有信息没填写哦',
// icon: 'none' // icon: 'none'
// }) // })
// return; // return;
// } // }
if (!param.birthStatus) { if (!param.birthStatus) {
uni.showToast({ uni.showToast({
title: '请选择出生状态', title: '请选择出生状态',
icon: 'none' icon: 'none'
}) })
return; return;
} }
if(!param.birthTime){ if (!param.birthTime) {
uni.showToast({ uni.showToast({
title: '请选择出生时间', title: '请选择出生时间',
icon: 'none' icon: 'none'
}) })
return; return;
} }
if(!param.surname){ if (!param.surname) {
uni.showToast({ uni.showToast({
title: '请输入姓氏', title: '请输入姓氏',
icon: 'none' icon: 'none'
}) })
return; return;
} }
if(!param.gender){ if (!param.gender) {
uni.showToast({ uni.showToast({
title: '请选择性别', title: '请选择性别',
icon: 'none' icon: 'none'
}) })
return; return;
} }
if(!param.wordCount){ if (!param.wordCount) {
uni.showToast({ uni.showToast({
title: '请选择数字要求', title: '请选择数字要求',
icon: 'none' icon: 'none'
}) })
return; return;
} }
//验证通过,调接口 //验证通过,调接口
...@@ -481,13 +482,13 @@ ...@@ -481,13 +482,13 @@
let d = await aiNaming(param); let d = await aiNaming(param);
if (d) { if (d) {
let nameList = d?.data; let nameList = d?.data;
console.log('取名回调:', nameList) console.log('取名回调:', nameList)
if(nameList[0].meaning == "未获取解释"){ if (nameList[0].meaning == "未获取解释") {
uni.showToast({ uni.showToast({
title: '生成失败,请检查你输入的内容', title: '生成失败,请检查你输入的内容',
icon: 'none' icon: 'none'
}) })
return return
} }
// 隐藏 // 隐藏
uni.hideLoading() uni.hideLoading()
...@@ -512,16 +513,19 @@ ...@@ -512,16 +513,19 @@
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
::v-deep .uni-datetime-picker--btn{ ::v-deep .uni-datetime-picker--btn {
background-color: #d3a358 !important; background-color: #d3a358 !important;
} }
::v-deep .uni-calendar-item--checked{
background-color: #d3a358 !important; ::v-deep .uni-calendar-item--checked {
} background-color: #d3a358 !important;
::v-deep .uni-datetime-picker-btn-text{
color: #d3a358 !important;
} }
::v-deep .uni-datetime-picker-btn-text {
color: #d3a358 !important;
}
.naming_bg { .naming_bg {
// position: absolute; // position: absolute;
width: 100%; width: 100%;
......
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