Browse Source

fix: 🧩 停车优化

pull/1/head
liyongle 3 years ago
parent
commit
51935a2844
  1. 12
      src/composables/useFindCar.ts
  2. 4
      src/http/api/parking/index.ts

12
src/composables/useFindCar.ts

@ -1,9 +1,9 @@
import { ref } from 'vue'
import { getFindCar } from '@/http/api/parking'
import { HTTP_CODE } from '@/enums'
import { isLicensePlate } from '@/utils/utils'
import { useRootStore } from '@/store/root'
import { useRouter } from 'vue-router'
import { HTTP_CODE } from '@/enums'
import Message from '@/base/Message/Message'
export const useFindCar = () => {
@ -25,11 +25,13 @@ export const useFindCar = () => {
loading.value = true
const { code, msg, data } = await getFindCar(plate)
if (code === HTTP_CODE.ERR_OK) {
result.value = { ...data, carCode: plate, parkingTime: toHoursAndMinutes(Number(data.parkingTime)) }
showCarDetail.value = true
} else {
Message({ text: msg, type: 'success' })
if (data) {
result.value = { ...data, carCode: plate, parkingTime: toHoursAndMinutes(Number(data.parkingTime)) }
showCarDetail.value = true
}
return
}
Message({ text: msg, type: 'success' })
} catch (error) {
Message({ text: error as string, type: 'success' })
} finally {

4
src/http/api/parking/index.ts

@ -1,9 +1,9 @@
import { request } from '../../http'
// 找车
export const getFindCar = (plateId: string) => request<CarInfo>({ url: `/v1/web/thirdPark`, params: { plateId }, method: 'get' })
export const getFindCar = (plateId: string) => request<CarInfo>({ url: `/guide/v1/web/thirdPark`, params: { plateId }, method: 'get' })
// 周边交通
export const getThirdTraffic = (projectCode: string) =>
request<Traffic[]>({ url: `/v1/web/thirdTraffic`, params: { projectCode }, method: 'get' })
request<Traffic[]>({ url: `/guide/v1/web/thirdTraffic`, params: { projectCode }, method: 'get' })
export const getParkingInfo = () => request<ParkingInfo>({ url: `/JSON/getParkingInfo.json` })

Loading…
Cancel
Save