146 lines
3.5 KiB
Vue
146 lines
3.5 KiB
Vue
<script setup lang="ts">
|
||
// ③ 确认信息并补充备注:用户名称 / 用户手机号(登录账号资料预填)+ 补充备注
|
||
import { computed } from 'vue'
|
||
import type { Demand } from '@/types/business/demand'
|
||
|
||
interface Props {
|
||
demand: Demand
|
||
}
|
||
|
||
const props = defineProps<Props>()
|
||
|
||
const emit = defineEmits<{ update: [partial: Partial<Demand>] }>()
|
||
|
||
const REMARK_MAX = 500
|
||
|
||
const remarkLength = computed(() => props.demand.supplementaryRemarks.length)
|
||
|
||
function onUserName(event: Event): void {
|
||
emit('update', { userName: (event.target as HTMLInputElement).value })
|
||
}
|
||
|
||
function onUserPhone(event: Event): void {
|
||
emit('update', { userPhone: (event.target as HTMLInputElement).value })
|
||
}
|
||
|
||
function onRemark(event: Event): void {
|
||
emit('update', { supplementaryRemarks: (event.target as HTMLTextAreaElement).value })
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<div class="demand-confirm">
|
||
<div class="demand-confirm__row">
|
||
<div class="demand-confirm__field">
|
||
<label class="demand-confirm__label" for="demand-user-name">用户名称</label>
|
||
<input
|
||
id="demand-user-name"
|
||
class="demand-confirm__input"
|
||
type="text"
|
||
maxlength="30"
|
||
:value="props.demand.userName"
|
||
placeholder="请输入用户名称"
|
||
@input="onUserName"
|
||
>
|
||
</div>
|
||
<div class="demand-confirm__field">
|
||
<label class="demand-confirm__label" for="demand-user-phone">用户手机号</label>
|
||
<input
|
||
id="demand-user-phone"
|
||
class="demand-confirm__input"
|
||
type="tel"
|
||
maxlength="30"
|
||
:value="props.demand.userPhone"
|
||
placeholder="请输入用户手机号"
|
||
@input="onUserPhone"
|
||
>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="demand-confirm__field">
|
||
<label class="demand-confirm__label" for="demand-remark">补充备注</label>
|
||
<div class="demand-confirm__area">
|
||
<textarea
|
||
id="demand-remark"
|
||
class="demand-confirm__textarea"
|
||
:maxlength="REMARK_MAX"
|
||
:value="props.demand.supplementaryRemarks"
|
||
placeholder="其他需要说明的事项…"
|
||
@input="onRemark"
|
||
/>
|
||
<span class="demand-confirm__count">{{ remarkLength }}/{{ REMARK_MAX }}字</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<style lang="less" scoped>
|
||
.demand-confirm {
|
||
.flex(column, flex-start, stretch);
|
||
gap: @spacing-lg;
|
||
|
||
&__row {
|
||
.flex(row, flex-start, stretch);
|
||
// 设计稿:两个 503 设计px 输入框(≈387px),间距 73 设计px ≈ 56px,整行不占满
|
||
gap: 56px;
|
||
}
|
||
|
||
&__field {
|
||
.flex(column, flex-start, stretch);
|
||
gap: 10px;
|
||
min-width: 0;
|
||
}
|
||
|
||
// 行内两列(用户名称 / 用户手机号)定宽;补充备注整行铺满
|
||
&__row &__field {
|
||
flex: 0 0 387px;
|
||
}
|
||
|
||
&__label {
|
||
font-size: 15px;
|
||
font-weight: 500;
|
||
color: @demand-heading;
|
||
}
|
||
|
||
&__input {
|
||
.text-control();
|
||
height: 38px;
|
||
font-size: 15px;
|
||
border-color: @demand-line;
|
||
color: @demand-ink;
|
||
|
||
&::placeholder {
|
||
color: @demand-line;
|
||
}
|
||
}
|
||
|
||
&__area {
|
||
position: relative;
|
||
width: 100%;
|
||
}
|
||
|
||
&__textarea {
|
||
.text-control();
|
||
min-height: 208px;
|
||
padding: 10px 14px 24px;
|
||
font-size: 15px;
|
||
border-color: @demand-line;
|
||
color: @demand-ink;
|
||
line-height: 1.7;
|
||
resize: vertical;
|
||
|
||
&::placeholder {
|
||
color: @demand-line;
|
||
}
|
||
}
|
||
|
||
&__count {
|
||
position: absolute;
|
||
right: @spacing-sm;
|
||
bottom: @spacing-xs;
|
||
font-size: @font-size-sm;
|
||
color: @text-color-secondary;
|
||
}
|
||
}
|
||
</style>
|