You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
231 lines
4.8 KiB
231 lines
4.8 KiB
<template>
|
|
<TransitionGroup name="width" mode="out-in" tag="div" class="plateinput-wrapper" :class="[searchMethods === '车位' ? 'active' : '']">
|
|
<div
|
|
class="input"
|
|
v-for="(item, index) of renderInputLength"
|
|
:key="item"
|
|
:class="[index === license.length - 1 ? 'active' : '', searchMethods === '车位' ? 'space' : '']"
|
|
>
|
|
<span class="text">{{ license[index] }}</span>
|
|
</div>
|
|
<div
|
|
key="energy"
|
|
v-if="needsEnergy"
|
|
class="last input"
|
|
@click="handleEnergy"
|
|
:class="[_isEnergy ? 'enrgy' : '', _isEnergy && license.length === ENERGY_PLATE ? 'active' : '']"
|
|
>
|
|
<span class="text" v-if="!_isEnergy">新能源</span>
|
|
<span class="text" v-else>{{ _isEnergy ? (license.length === ENERGY_PLATE && license[license.length - 1]) || '' : '' }}</span>
|
|
</div>
|
|
<div key="btn" class="btn" @click="confirm">
|
|
<img src="../../assets/images/parking/search-parking.png" class="icon" alt="" />
|
|
</div>
|
|
</TransitionGroup>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref, computed } from 'vue'
|
|
|
|
const NOT_ENERGY_PLATE = 7
|
|
const ENERGY_PLATE = 8
|
|
|
|
const props = defineProps({
|
|
spaceMaxLength: {
|
|
type: Number,
|
|
default: 5
|
|
},
|
|
license: {
|
|
type: Array,
|
|
default: () => []
|
|
},
|
|
needsEnergy: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
searchMethods: {
|
|
type: String,
|
|
validator: status => ['车牌', '车位'].includes(status)
|
|
}
|
|
})
|
|
|
|
const renderInputLength = computed(() => (props.searchMethods === '车牌' ? NOT_ENERGY_PLATE : props.spaceMaxLength))
|
|
|
|
const emits = defineEmits(['handle-energy', 'confirm'])
|
|
const _isEnergy = ref(false)
|
|
emits('handle-energy', _isEnergy.value)
|
|
|
|
function handleEnergy() {
|
|
_isEnergy.value = !_isEnergy.value
|
|
emits('handle-energy', _isEnergy.value)
|
|
}
|
|
|
|
function confirm() {
|
|
emits('confirm')
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.plateinput-wrapper {
|
|
display: flex;
|
|
position: relative;
|
|
margin-bottom: 32px;
|
|
margin-left: 170px;
|
|
&.active {
|
|
&::before {
|
|
left: 141px;
|
|
}
|
|
}
|
|
&::before {
|
|
content: '';
|
|
position: absolute;
|
|
width: 2px;
|
|
height: 63px;
|
|
background: rgba(0, 0, 0, 0.1);
|
|
border-radius: 2px;
|
|
left: 176px;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
transition: left 0.5s;
|
|
}
|
|
}
|
|
.input {
|
|
position: relative;
|
|
border-radius: 8px;
|
|
width: 80px;
|
|
height: 100px;
|
|
margin-right: 8px;
|
|
font-weight: 700;
|
|
font-size: 32px;
|
|
line-height: 100px;
|
|
text-align: center;
|
|
color: rgba(0, 0, 0, 0.8);
|
|
font-family: 'font_bold';
|
|
background: #ffffff;
|
|
box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.03);
|
|
border-radius: 8px;
|
|
&.space {
|
|
margin-right: 8px !important;
|
|
width: 132px;
|
|
&:first-child {
|
|
margin-right: 22px !important;
|
|
}
|
|
}
|
|
.text {
|
|
position: relative;
|
|
z-index: 3;
|
|
}
|
|
|
|
&::after {
|
|
width: 80px;
|
|
height: 100px;
|
|
left: 0;
|
|
top: 0;
|
|
content: '';
|
|
position: absolute;
|
|
background: #ffffff;
|
|
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.03);
|
|
border-radius: 8px;
|
|
z-index: 2;
|
|
}
|
|
&.space {
|
|
&:nth-child(2) {
|
|
margin-right: 12px;
|
|
}
|
|
&::after {
|
|
width: 132px;
|
|
}
|
|
}
|
|
&.active {
|
|
&::before {
|
|
position: absolute;
|
|
content: '';
|
|
top: -2px;
|
|
right: -2px;
|
|
bottom: -2px;
|
|
left: -2px;
|
|
background: var(--color-linear-lightgoldenyellow);
|
|
border-radius: 8px;
|
|
z-index: 1;
|
|
}
|
|
}
|
|
&:nth-child(2) {
|
|
margin-right: 18px;
|
|
}
|
|
}
|
|
|
|
.last {
|
|
line-height: initial;
|
|
&.enrgy {
|
|
.text {
|
|
padding-top: 0;
|
|
font-weight: 700;
|
|
font-size: 32px;
|
|
line-height: 90px;
|
|
text-align: center;
|
|
color: rgba(0, 0, 0, 0.8);
|
|
}
|
|
&::after {
|
|
background: #ffffff;
|
|
content: '';
|
|
}
|
|
}
|
|
&::after {
|
|
content: '+';
|
|
font-weight: 700;
|
|
font-size: 32px;
|
|
color: rgba(0, 0, 0, 0.4);
|
|
line-height: 60px;
|
|
background: transparent;
|
|
}
|
|
.text {
|
|
width: 80px;
|
|
height: 100px;
|
|
display: inline-block;
|
|
font-weight: 700;
|
|
font-size: 18px;
|
|
font-family: 'font_bold';
|
|
color: rgba(0, 0, 0, 0.4);
|
|
border: 2px solid #fff;
|
|
text-align: center;
|
|
border-radius: 8px;
|
|
padding-top: 51px;
|
|
}
|
|
}
|
|
|
|
.btn {
|
|
position: absolute;
|
|
right: 40px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-left: 12px;
|
|
width: 156px;
|
|
height: 100px;
|
|
background: linear-gradient(90deg, #ffbd35 0%, #ffd260 100%);
|
|
box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.03), inset 0px -4px 0px rgba(243, 176, 36, 0.5);
|
|
border-radius: 8px;
|
|
transition: all 0.5s;
|
|
|
|
.icon {
|
|
width: 32px;
|
|
}
|
|
}
|
|
|
|
.width-enter-active,
|
|
.width-leave-active {
|
|
width: 80px;
|
|
transition: all 0.5s;
|
|
transition-timing-function: cubic-bezier(0.75, 0, 0.24, 1);
|
|
}
|
|
|
|
.width-enter-from,
|
|
.width-leave-to {
|
|
width: 0;
|
|
opacity: 0;
|
|
}
|
|
.width-move {
|
|
transition: transform 0.5s !important;
|
|
transition-timing-function: cubic-bezier(0.75, 0, 0.24, 1);
|
|
}
|
|
</style>
|
|
|