| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import { http } from "@/utils/http";
- import { faker } from "@faker-js/faker/locale/zh_CN";
- type Result = {
- success: boolean;
- data: Array<any>;
- };
- type mapType = {
- plateNumber: string;
- driver: string;
- orientation: number;
- lng: number;
- lat: number;
- };
- const mapList = (): Array<mapType> => {
- const result: Array<mapType> = [];
- for (let index = 0; index < 10; index++) {
- result.push({
- 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 })
- });
- }
- return result;
- };
- /** 地图数据 */
- // export const mapJson = (params?: object) => {
- // return http.request<Result>("get", "/get-map-info", { params });
- // };
- /** 地图数据 */
- export const mapJson = (params?: object) => {
- return {
- success: true,
- data: mapList()
- };
- };
- /** 文件上传 */
- export const formUpload = data => {
- return http.request<Result>(
- "post",
- "https://run.mocky.io/v3/3aa761d7-b0b3-4a03-96b3-6168d4f7467b",
- { data },
- {
- headers: {
- "Content-Type": "multipart/form-data"
- }
- }
- );
- };
|