|
@@ -1,4 +1,5 @@
|
|
import { $postParam, $post } from "@/plugins/axios";
|
|
import { $postParam, $post } from "@/plugins/axios";
|
|
|
|
+import { fileMD5 } from "@/plugins/md5";
|
|
|
|
|
|
export const cardConfigInfos = (id) => {
|
|
export const cardConfigInfos = (id) => {
|
|
return $postParam("/api/admin/basic/card_rule/get_one", { id });
|
|
return $postParam("/api/admin/basic/card_rule/get_one", { id });
|
|
@@ -15,20 +16,20 @@ export const saveCard1 = (datas, config = {}) => {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-export const saveCard = (datas, config = {}) => {
|
|
|
|
|
|
+export const saveCard = async (datas, config = {}) => {
|
|
const formData = new FormData();
|
|
const formData = new FormData();
|
|
for (const key in datas) {
|
|
for (const key in datas) {
|
|
const val = datas[key];
|
|
const val = datas[key];
|
|
if (key === "content") {
|
|
if (key === "content") {
|
|
- formData.append(
|
|
|
|
- key,
|
|
|
|
- new File([val], `${Date.now()}.json`, { type: "text/json" })
|
|
|
|
- );
|
|
|
|
|
|
+ const file = new File([val], `${Date.now()}.json`, { type: "text/json" });
|
|
|
|
+ formData.append(key, file);
|
|
|
|
+ const md5 = await fileMD5(file);
|
|
|
|
+ formData.append(`${key}Md5`, md5);
|
|
} else if (key === "htmlContent") {
|
|
} else if (key === "htmlContent") {
|
|
- formData.append(
|
|
|
|
- key,
|
|
|
|
- new File([val], `${Date.now()}.html`, { type: "text/html" })
|
|
|
|
- );
|
|
|
|
|
|
+ const file = new File([val], `${Date.now()}.html`, { type: "text/html" });
|
|
|
|
+ formData.append(key, file);
|
|
|
|
+ const md5 = await fileMD5(file);
|
|
|
|
+ formData.append(`${key}Md5`, md5);
|
|
} else {
|
|
} else {
|
|
formData.append(key, val);
|
|
formData.append(key, val);
|
|
}
|
|
}
|