2023-11-10 12:33:22 +08:00
|
|
|
import { defineFakeRoute } from "vite-plugin-fake-server/client";
|
|
|
|
import { faker } from "@faker-js/faker/locale/zh_CN";
|
2021-03-29 16:38:52 +08:00
|
|
|
|
2021-10-19 18:58:47 +08:00
|
|
|
type mapType = {
|
|
|
|
plateNumber: string;
|
|
|
|
driver: string;
|
2023-11-10 12:33:22 +08:00
|
|
|
orientation: number;
|
|
|
|
lng: number;
|
|
|
|
lat: number;
|
2021-10-19 18:58:47 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const mapList = (): Array<mapType> => {
|
|
|
|
const result: Array<mapType> = [];
|
2021-03-29 16:38:52 +08:00
|
|
|
for (let index = 0; index < 200; index++) {
|
|
|
|
result.push({
|
2023-11-10 12:33:22 +08:00
|
|
|
plateNumber: `豫A${faker.string.numeric({
|
|
|
|
length: 5
|
|
|
|
})}${faker.string.alphanumeric({
|
|
|
|
casing: "upper"
|
|
|
|
})}`,
|
|
|
|
driver: faker.person.firstName(),
|
|
|
|
orientation: faker.number.int({ min: 1, max: 360 }),
|
|
|
|
lng: faker.location.latitude({ max: 114.1, min: 113 }),
|
|
|
|
lat: faker.location.latitude({ max: 35.1, min: 34 })
|
2021-05-28 02:05:24 +08:00
|
|
|
});
|
2021-03-29 16:38:52 +08:00
|
|
|
}
|
2021-05-28 02:05:24 +08:00
|
|
|
return result;
|
|
|
|
};
|
2021-03-29 16:38:52 +08:00
|
|
|
|
2023-11-10 12:33:22 +08:00
|
|
|
export default defineFakeRoute([
|
2021-03-29 16:38:52 +08:00
|
|
|
{
|
2023-09-27 15:09:15 +08:00
|
|
|
url: "/get-map-info",
|
2021-05-28 02:05:24 +08:00
|
|
|
method: "get",
|
2021-03-29 16:38:52 +08:00
|
|
|
response: () => {
|
|
|
|
return {
|
2022-10-25 12:17:13 +08:00
|
|
|
success: true,
|
|
|
|
data: mapList()
|
2021-05-28 02:05:24 +08:00
|
|
|
};
|
2021-07-20 17:16:42 +08:00
|
|
|
}
|
|
|
|
}
|
2023-11-10 12:33:22 +08:00
|
|
|
]);
|