|
|
@ -10,7 +10,7 @@ |
|
|
</template> |
|
|
</template> |
|
|
</EffectFade> |
|
|
</EffectFade> |
|
|
</div> |
|
|
</div> |
|
|
<PlateInput @handle-energy="handleEnergy" :search-methods="searchMethods" :license="license" :needsEnergy="needsEnergy" /> |
|
|
|
|
|
|
|
|
<PlateInput @confirm="confirm" @handle-energy="handleEnergy" :search-methods="searchMethods" :license="license" :needsEnergy="needsEnergy" /> |
|
|
<PlateKeyboard @del="del" @handle-keyboard="handleKeyboard" :search-methods="searchMethods" /> |
|
|
<PlateKeyboard @del="del" @handle-keyboard="handleKeyboard" :search-methods="searchMethods" /> |
|
|
<div class="parking-info"> |
|
|
<div class="parking-info"> |
|
|
<h1 class="title">{{ switchLanguage(parkingInfo, 'title') }}</h1> |
|
|
<h1 class="title">{{ switchLanguage(parkingInfo, 'title') }}</h1> |
|
|
@ -38,17 +38,20 @@ import { isLicensePlate, isUppercaseWord, isZhWord } from '@/utils/utils' |
|
|
import { storeToRefs } from 'pinia' |
|
|
import { storeToRefs } from 'pinia' |
|
|
import { computed, defineAsyncComponent, ref, watch } from 'vue' |
|
|
import { computed, defineAsyncComponent, ref, watch } from 'vue' |
|
|
import { list } from './tabs' |
|
|
import { list } from './tabs' |
|
|
|
|
|
import Shop from '@/utils/Class/Shop' |
|
|
|
|
|
import { useRouter } from 'vue-router' |
|
|
const CarInfo = defineAsyncComponent(() => import('@/components/CarInfo/CarInfo.vue')) |
|
|
const CarInfo = defineAsyncComponent(() => import('@/components/CarInfo/CarInfo.vue')) |
|
|
|
|
|
|
|
|
const NOT_ENERGY_PLATE = 7 //非能源车牌长度 |
|
|
const NOT_ENERGY_PLATE = 7 //非能源车牌长度 |
|
|
const ENERGY_PLATE = 8 //能源车牌长度 |
|
|
const ENERGY_PLATE = 8 //能源车牌长度 |
|
|
const SPACE_MAX_LENGTH = 5 //车位最大允许长度 |
|
|
const SPACE_MAX_LENGTH = 5 //车位最大允许长度 |
|
|
|
|
|
|
|
|
|
|
|
const router = useRouter() |
|
|
const store = useStore() |
|
|
const store = useStore() |
|
|
const { config } = storeToRefs(store) |
|
|
|
|
|
|
|
|
const { config, currentBuildingFloorsList } = storeToRefs(store) |
|
|
|
|
|
|
|
|
const tabIdx = ref(0) |
|
|
const tabIdx = ref(0) |
|
|
const needsEnergy = computed(() => (tabIdx.value === 0 ? true : false)) |
|
|
|
|
|
|
|
|
const needsEnergy = computed(() => tabIdx.value === 0) |
|
|
const searchMethods = computed(() => (tabIdx.value === 0 ? '车牌' : '车位')) |
|
|
const searchMethods = computed(() => (tabIdx.value === 0 ? '车牌' : '车位')) |
|
|
function handleTab(index) { |
|
|
function handleTab(index) { |
|
|
tabIdx.value = index |
|
|
tabIdx.value = index |
|
|
@ -69,7 +72,9 @@ function handleKeyboard(item) { |
|
|
(!isEnergy.value && license.value.length >= NOT_ENERGY_PLATE) || |
|
|
(!isEnergy.value && license.value.length >= NOT_ENERGY_PLATE) || |
|
|
(isEnergy.value && license.value.length >= ENERGY_PLATE) || |
|
|
(isEnergy.value && license.value.length >= ENERGY_PLATE) || |
|
|
(license.value.length === 0 && !isZhWord(item)) || |
|
|
(license.value.length === 0 && !isZhWord(item)) || |
|
|
(license.value.length === 1 && !isUppercaseWord(item)) |
|
|
|
|
|
|
|
|
(license.value.length === 1 && !isUppercaseWord(item)) || |
|
|
|
|
|
(license.value.length > 1 && license.value.length <= 8 && isZhWord(item)) || |
|
|
|
|
|
(license.value.length >= 7 && (isZhWord(item) || isUppercaseWord(item))) |
|
|
) { |
|
|
) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
@ -89,6 +94,26 @@ function handleEnergy(flag) { |
|
|
license.value.length >= ENERGY_PLATE && license.value.pop() |
|
|
license.value.length >= ENERGY_PLATE && license.value.pop() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//找车 |
|
|
|
|
|
function confirm() { |
|
|
|
|
|
if (tabIdx.value === 0) { |
|
|
|
|
|
//TODO |
|
|
|
|
|
Message({ text: '抱歉暂时无法使用车牌找车', type: 'success' }) |
|
|
|
|
|
} else { |
|
|
|
|
|
//车位 |
|
|
|
|
|
const info = window.Map_QM.pathPark({ shopNum: license.value }) |
|
|
|
|
|
if (info?.node?.length) { |
|
|
|
|
|
const floorName = currentBuildingFloorsList.value.filter(item => item.order === info.floor)?.[0]?.name |
|
|
|
|
|
const shop = new Shop({ name: license.value, floorOrder: info.floor, floorName, logoPath: '/static/img/tcc/png', yaxis: info.node }) |
|
|
|
|
|
store.SET_SHOP(shop) |
|
|
|
|
|
router.push('/nav') |
|
|
|
|
|
} else { |
|
|
|
|
|
Message({ text: `暂未查到车位信息`, type: 'success' }) |
|
|
|
|
|
license.value = [] |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
watch( |
|
|
watch( |
|
|
license, |
|
|
license, |
|
|
newVal => { |
|
|
newVal => { |
|
|
|