12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import { stringify } from 'qs';
- import { request } from 'umi';
- export async function getList(projectId) {
- const res = await request(`/api/v1/dumu/pull-msg/${projectId}`);
- res.data.forEach((item) => {
- item.url = base64ToImageUrl(item.event_bg);
- });
- return res.data;
- }
- export async function getAlarmList(data) {
- const res = await request(`/api/task/v1/grade-alarm/list`, {
- method: 'POST',
- data,
- });
- return res.data;
- }
- function base64ToImageUrl(base64String) {
- const byteCharacters = atob(base64String);
- const byteArrays = [];
- for (let i = 0; i < byteCharacters.length; i++) {
- byteArrays.push(byteCharacters.charCodeAt(i));
- }
- const byteArray = new Uint8Array(byteArrays);
- const blob = new Blob([byteArray], { type: 'image/png' });
- const imageUrl = URL.createObjectURL(blob);
- return imageUrl;
- }
- export async function getHistoryList(projectId, params) {
- const res = await request(
- `/api/v1/dumu/list/${projectId}?${stringify(params)}`,
- );
- res.data.list.forEach((item) => {
- item.url = base64ToImageUrl(item.event_bg);
- });
- return res.data.list;
- }
- export async function getCameraList(projectId, params) {
- const res = await request(
- `/api/v1/dumu/list/${projectId}?${stringify(params)}`,
- );
- return res.data;
- }
- export async function getDetail(detailId, options) {
- const res = await request(`/api/v1/dumu/detail/${detailId}`, options);
- return res.data;
- }
|