|
@@ -1,6 +1,7 @@
|
|
|
import { WallSaveAPIType } from "@/types";
|
|
|
import http from "@/utils/http";
|
|
|
-import { AppDispatch } from "..";
|
|
|
+import axios from "axios";
|
|
|
+import store, { AppDispatch } from "..";
|
|
|
|
|
|
/**
|
|
|
* 获取万物墙自动播放数据
|
|
@@ -12,11 +13,10 @@ export const getWallAutoApi = () => {
|
|
|
/**
|
|
|
* 修改万物墙自动播放数据
|
|
|
*/
|
|
|
-export const editWallAutoApi = (data: {content:string}) => {
|
|
|
+export const editWallAutoApi = (data: { content: string }) => {
|
|
|
return http.post("cms/wall/setConfig", data);
|
|
|
};
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 获取列表数据
|
|
|
*/
|
|
@@ -51,21 +51,21 @@ export const wallSortAPI = (id1: number, id2: number) => {
|
|
|
/**
|
|
|
* 内容-新增|编辑
|
|
|
*/
|
|
|
-export const setWallSave = (data:WallSaveAPIType) => {
|
|
|
- return http.post('cms/wall/save',data);
|
|
|
+export const setWallSave = (data: WallSaveAPIType) => {
|
|
|
+ return http.post("cms/wall/save", data);
|
|
|
};
|
|
|
|
|
|
-
|
|
|
// 上传附件的进度条
|
|
|
const UpAsyncLodingDom: any = document.querySelector("#UpAsyncLoding");
|
|
|
const progressDom: any = document.querySelector("#progress");
|
|
|
|
|
|
-
|
|
|
+const CancelToken = axios.CancelToken;
|
|
|
/**
|
|
|
* 上传封面图和附件
|
|
|
*/
|
|
|
export const goodsUploadAPI = (data: any) => {
|
|
|
UpAsyncLodingDom.style.opacity = 1;
|
|
|
+ UpAsyncLodingDom.style.pointerEvents = "auto";
|
|
|
|
|
|
return http.post("cms/wall/upload", data, {
|
|
|
timeout: 50000,
|
|
@@ -74,12 +74,19 @@ export const goodsUploadAPI = (data: any) => {
|
|
|
const complete = (e.loaded / e.total) * 100 || 0;
|
|
|
progressDom.style.width = complete + "%";
|
|
|
},
|
|
|
+ // 取消上传
|
|
|
+ cancelToken: new CancelToken(function executor(c) {
|
|
|
+ store.dispatch({
|
|
|
+ type: "login/closeUpFile",
|
|
|
+ payload: { fu: c, state: true },
|
|
|
+ });
|
|
|
+ }),
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 内容-新增|编辑
|
|
|
*/
|
|
|
-export const getWallDetailAPI = (id:number) => {
|
|
|
+export const getWallDetailAPI = (id: number) => {
|
|
|
return http.get(`cms/wall/detail/${id}`);
|
|
|
};
|