From 620c20ac531d6bfdfea6a262de72fc02b1cd47f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E9=91=AB?= Date: Thu, 20 Oct 2022 10:27:23 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=BD=A6=E7=89=8C=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MovieDetail/MovieDetail.vue | 25 ++++++-------- src/components/PlateInput/PlateInput.vue | 12 ++++--- .../PublicComponent/PublicComponent.vue | 13 +++++++- src/components/Search/Search.vue | 1 + src/utils/utils.js | 2 +- src/views/Guide/Guide.vue | 1 + src/views/Parking/Parking.vue | 33 ++++++++++++++++--- 7 files changed, 62 insertions(+), 25 deletions(-) diff --git a/src/components/MovieDetail/MovieDetail.vue b/src/components/MovieDetail/MovieDetail.vue index 6a3d309..e6efba9 100644 --- a/src/components/MovieDetail/MovieDetail.vue +++ b/src/components/MovieDetail/MovieDetail.vue @@ -51,10 +51,8 @@ v-for="(item, index) of dateList" :key="item.week" > -
- {{ item.customDate }} - {{ item.week }} -
+ {{ item.customDate }} + {{ item.week }} @@ -212,7 +210,6 @@ function close() { .remark { font-weight: 700; color: rgba(0, 0, 0, 0.6); - padding-bottom: 10px; margin-left: 24px; font-family: 'font_bold'; font-size: 14px; @@ -237,18 +234,20 @@ function close() { height: 128px; background: rgba(0, 0, 0, 0.2); border-radius: 12px; - padding: 6px; + padding: 6px 0; margin-bottom: 24px; .date-content { display: inline-block; white-space: nowrap; + padding: 0 6px; + &::before { position: absolute; content: ''; left: 6px; background: linear-gradient(90deg, #f6a62c 0%, #ffbc3f 100%); - box-shadow: 0px 20px 30px rgba(221, 152, 55, 0.2); + box-shadow: 0 20px 30px rgba(221, 152, 55, 0.2); border-radius: 8px; border: 1px solid rgba(255, 189, 53, 1); width: 134px; @@ -259,17 +258,13 @@ function close() { } .date-item { - position: relative; - display: inline-block; - margin-right: 12px; - } - .flex { - width: 134px; - height: 116px; - display: flex; + display: inline-flex; flex-direction: column; align-items: center; justify-content: center; + margin-right: 12px; + width: 134px; + height: 116px; } .date { position: relative; diff --git a/src/components/PlateInput/PlateInput.vue b/src/components/PlateInput/PlateInput.vue index 29ea064..01a57fa 100644 --- a/src/components/PlateInput/PlateInput.vue +++ b/src/components/PlateInput/PlateInput.vue @@ -2,7 +2,7 @@
@@ -18,7 +18,7 @@ 新能源 {{ _isEnergy ? (license.length === ENERGY_PLATE && license[license.length - 1]) || '' : '' }}
-
+
@@ -49,9 +49,9 @@ const props = defineProps({ } }) -const renderInputLengh = computed(() => (props.searchMethods === '车牌' ? NOT_ENERGY_PLATE : props.spaceMaxLength)) +const renderInputLength = computed(() => (props.searchMethods === '车牌' ? NOT_ENERGY_PLATE : props.spaceMaxLength)) -const emits = defineEmits(['handle-energy']) +const emits = defineEmits(['handle-energy', 'confirm']) const _isEnergy = ref(false) emits('handle-energy', _isEnergy.value) @@ -59,6 +59,10 @@ function handleEnergy() { _isEnergy.value = !_isEnergy.value emits('handle-energy', _isEnergy.value) } + +function confirm() { + emits('confirm') +} diff --git a/src/components/Search/Search.vue b/src/components/Search/Search.vue index 0f29ad7..0918411 100644 --- a/src/components/Search/Search.vue +++ b/src/components/Search/Search.vue @@ -212,6 +212,7 @@ onBeforeUnmount(() => { width: 432px; display: flex; flex-wrap: wrap; + align-items: flex-start; padding-left: 64px; .margin { margin-right: 40px; diff --git a/src/utils/utils.js b/src/utils/utils.js index fe4ad49..aa09e35 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -23,7 +23,7 @@ export const checkPhoneNumber = phone => { * @returns {boolean} */ export const isLicensePlate = str => { - return /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领]{1}[A-HJ-NP-Z]{1}(?:(([0-9]{5}[DF])|([DF][A-HJ-NP-Z0-9][0-9]{4}))|[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1})$/.test( + return /^(?:[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-HJ-NP-Z]{1}(?:(?:[0-9]{5}[DF])|(?:[DF](?:[A-HJ-NP-Z0-9])[0-9]{4})))|(?:[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9 挂学警港澳]{1})$/.test( str ) } diff --git a/src/views/Guide/Guide.vue b/src/views/Guide/Guide.vue index c1e7d79..18e134a 100644 --- a/src/views/Guide/Guide.vue +++ b/src/views/Guide/Guide.vue @@ -324,6 +324,7 @@ watch( } .facility-list { display: flex; + align-items: flex-start; } .margin { margin-right: 16px; diff --git a/src/views/Parking/Parking.vue b/src/views/Parking/Parking.vue index ee83a91..f97d593 100644 --- a/src/views/Parking/Parking.vue +++ b/src/views/Parking/Parking.vue @@ -10,7 +10,7 @@
- +

{{ switchLanguage(parkingInfo, 'title') }}

@@ -38,17 +38,20 @@ import { isLicensePlate, isUppercaseWord, isZhWord } from '@/utils/utils' import { storeToRefs } from 'pinia' import { computed, defineAsyncComponent, ref, watch } from 'vue' import { list } from './tabs' +import Shop from '@/utils/Class/Shop' +import { useRouter } from 'vue-router' const CarInfo = defineAsyncComponent(() => import('@/components/CarInfo/CarInfo.vue')) const NOT_ENERGY_PLATE = 7 //非能源车牌长度 const ENERGY_PLATE = 8 //能源车牌长度 const SPACE_MAX_LENGTH = 5 //车位最大允许长度 +const router = useRouter() const store = useStore() -const { config } = storeToRefs(store) +const { config, currentBuildingFloorsList } = storeToRefs(store) const tabIdx = ref(0) -const needsEnergy = computed(() => (tabIdx.value === 0 ? true : false)) +const needsEnergy = computed(() => tabIdx.value === 0) const searchMethods = computed(() => (tabIdx.value === 0 ? '车牌' : '车位')) function handleTab(index) { tabIdx.value = index @@ -69,7 +72,9 @@ function handleKeyboard(item) { (!isEnergy.value && license.value.length >= NOT_ENERGY_PLATE) || (isEnergy.value && license.value.length >= ENERGY_PLATE) || (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 } @@ -89,6 +94,26 @@ function handleEnergy(flag) { 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( license, newVal => {