Files
lanecarford_front/src/views/asistant/components/InputArea.vue

171 lines
3.3 KiB
Vue
Raw Normal View History

2025-10-14 16:42:09 +08:00
<template>
<div class="input-area">
2025-10-15 15:46:01 +08:00
<div class="shortcut-container flex">
<div
class="shortcut-item flex flex-center"
v-for="item in shortcutList"
:key="item"
@click="handleShortcut(item)"
>
{{ item }}
</div>
</div>
2025-10-14 16:42:09 +08:00
<div class="input-container">
<!-- 加号图标 -->
<div class="icon-wrapper">
<SvgIcon name="plus" size="40" />
</div>
<!-- 分隔线 -->
<div class="divider"></div>
<!-- 输入框 -->
<div class="input-wrapper">
<input
v-model="inputValue"
type="text"
placeholder="Ask anything about your desired outfit"
class="text-input"
@keyup.enter="handleSend"
/>
</div>
<!-- 语音图标 -->
<div class="icon-wrapper">
<SvgIcon name="audio" size="52" />
</div>
<!-- 发送图标 -->
<div class="icon-wrapper send-icon" @click="handleSend">
<SvgIcon name="send" size="46" />
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import SvgIcon from '@/components/SvgIcon/index.vue'
interface InputAreaEmits {
'send-message': [message: string]
}
const inputValue = ref<string>('')
2025-10-15 15:46:01 +08:00
const shortcutList: string[] = [
'Suggest shoe styles',
'Recommend evening bags',
'Suggest accessory combinations',
'Suggest color combinations',
'Suggest fabric combinations',
'Suggest style combinations'
]
2025-10-14 16:42:09 +08:00
const emit = defineEmits<InputAreaEmits>()
const handleSend = (): void => {
if (inputValue.value.trim()) {
console.log('input发送消息:', inputValue.value)
emit('send-message', inputValue.value)
inputValue.value = ''
}
}
2025-10-15 15:46:01 +08:00
const handleShortcut = (item: string): void => {
console.log('handleShortcut', item)
inputValue.value = item
}
2025-10-14 16:42:09 +08:00
</script>
<style lang="less" scoped>
.input-area {
background-color: #fff;
}
2025-10-15 15:46:01 +08:00
.shortcut-container {
overflow-x: auto;
flex-wrap: nowrap;
padding: 0 4.4rem;
column-gap: 1.2rem;
margin-bottom: 2.84rem;
&::-webkit-scrollbar {
display: none;
}
.shortcut-item {
font-size: 4.2rem;
width: fit-content;
font-family: 'robotoBold';
white-space: nowrap;
height: 8.1rem;
line-height: 8.1rem;
padding: 2.2rem 2.8rem;
color: #6d6868;
background-color: #efefef;
border-radius: 2rem;
}
}
2025-10-14 16:42:09 +08:00
.input-container {
display: flex;
align-items: center;
background-color: #efefef;
padding: 0 4.85rem 0 5.2rem;
height: 19.3rem;
}
.icon-wrapper {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
&.send-icon {
margin-left: 4.38rem;
}
}
.divider {
width: 2px;
height: 14.9rem;
margin-left: 5.59rem;
margin-right: 3.5rem;
background-color: #888;
}
.input-wrapper {
flex: 1;
display: flex;
align-items: center;
}
.text-input {
width: 100%;
border: none;
outline: none;
background: transparent;
font-size: 4rem;
font-family: 'robotoBold';
font-weight: 400;
line-height: 121%;
// padding-right: 2rem;
margin-right: 4.21rem;
color: #000;
2025-10-14 16:42:09 +08:00
&::placeholder {
color: #888;
letter-spacing: -0.01em;
font-weight: 400;
font-family: 'robotoBold';
word-spacing: -5px;
2025-10-14 16:42:09 +08:00
}
}
// 确保图标颜色为 #6d6868
:deep(.svg-icon) {
color: #6d6868;
svg {
fill: #6d6868;
}
}
</style>