You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/63618.f7ecdc8c.async.js

2058 lines
104 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[63618],{
/***/ 11448:
/*!*********************************************!*\
!*** ./src/components/UploadFile/index.tsx ***!
\*********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ cT: function() { return /* binding */ uploadFile; },
/* harmony export */ pe: function() { return /* binding */ decrypt; }
/* harmony export */ });
/* unused harmony exports reNameFile, UploadFile */
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/toConsumableArray.js */ 37205);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js */ 79800);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js */ 39647);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js */ 7557);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js */ 41498);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ 59301);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! antd */ 54580);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! antd */ 8591);
/* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/utils/fetch */ 43391);
/* harmony import */ var crypto_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! crypto-js */ 28209);
/* harmony import */ var crypto_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(crypto_js__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! uuid */ 1012);
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! umi */ 5841);
/* harmony import */ var ali_oss__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ali-oss */ 75264);
/* harmony import */ var ali_oss__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(ali_oss__WEBPACK_IMPORTED_MODULE_11__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
var _excluded = ["user", "cancelUpload"];
var Dragger = antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z.Dragger;
var decrypt = function decrypt(word) {
var ENC_KEY = "bf3c199c2470cb477d907b1e0917c17b";
var IV = "5183666c72eec9e4";
var key = crypto_js__WEBPACK_IMPORTED_MODULE_8___default().enc.Utf8.parse(ENC_KEY);
var iv = crypto_js__WEBPACK_IMPORTED_MODULE_8___default().enc.Utf8.parse(IV);
var decrypt = crypto_js__WEBPACK_IMPORTED_MODULE_8___default().AES.decrypt(word, key, {
iv: iv,
mode: (crypto_js__WEBPACK_IMPORTED_MODULE_8___default().mode).CBC
// padding: CryptoJS.pad.ZeroPadding
});
return decrypt.toString((crypto_js__WEBPACK_IMPORTED_MODULE_8___default().enc).Utf8);
};
var tempCheckpoint;
// 重命名
var reNameFile = /*#__PURE__*/(/* unused pure expression or super */ null && (function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
var _res$data, _res$data2, _res$data3, _res$data4, _res$data5, _res$data6;
var identifier, oldFilename, newFilename, res, client;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
identifier = _ref.identifier, oldFilename = _ref.oldFilename, newFilename = _ref.newFilename;
_context.next = 3;
return Fetch('/api/buckets/get_upload_token_for_big_files.json', {
method: "get"
});
case 3:
res = _context.sent;
res.data = JSON.parse(decrypt(res.data));
client = new OSS({
endpoint: res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.end_point,
region: res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.region,
accessKeyId: res === null || res === void 0 || (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.access_key_id,
accessKeySecret: res === null || res === void 0 || (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.access_key_secret,
bucket: res === null || res === void 0 || (_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : _res$data5.bucket,
stsToken: res === null || res === void 0 || (_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : _res$data6.security_token
});
return _context.abrupt("return", new Promise(function (resolve, reject) {
console.log(11111, "".concat(identifier, "/").concat(oldFilename), "".concat(identifier, "/").concat(newFilename), res.data);
client.copy("/".concat(identifier, "/").concat(oldFilename), "/".concat(identifier, "/").concat(newFilename)).then(function (r) {
console.log('拷贝成功', r);
// client
// .delete(`${identifier}/${oldFilename}`)
// .then(r => console.log(r))
// .catch(e => console.log(e));
})["catch"](function (e) {
console.log(e);
// debugger
});
}));
case 7:
case "end":
return _context.stop();
}
}, _callee);
}));
return function reNameFile(_x) {
return _ref2.apply(this, arguments);
};
}()));
var uploadFile = /*#__PURE__*/function () {
var _ref3 = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_5___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4___default()().mark(function _callee2(file, obj, config) {
var _res$data7, _res$data8, _res$data9, _res$data10, _res$data11, _res$data12;
var res, namearrs, name, client;
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4___default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
obj.file_name = file.name;
_context2.next = 3;
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP)('/api/buckets/get_upload_token.json', {
method: "get"
});
case 3:
res = _context2.sent;
console.log("decrypt(res.data):", decrypt(res.data));
res.data = JSON.parse(decrypt(res.data));
namearrs = file.name.split(".");
namearrs.pop();
name = obj.realFileName ? namearrs.join("") : (0,uuid__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z)(); // const name = file.name
client = new (ali_oss__WEBPACK_IMPORTED_MODULE_11___default())({
endpoint: res === null || res === void 0 || (_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : _res$data7.end_point,
region: res === null || res === void 0 || (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.region,
accessKeyId: res === null || res === void 0 || (_res$data9 = res.data) === null || _res$data9 === void 0 ? void 0 : _res$data9.access_key_id,
accessKeySecret: res === null || res === void 0 || (_res$data10 = res.data) === null || _res$data10 === void 0 ? void 0 : _res$data10.access_key_secret,
bucket: res === null || res === void 0 || (_res$data11 = res.data) === null || _res$data11 === void 0 ? void 0 : _res$data11.bucket,
stsToken: res === null || res === void 0 || (_res$data12 = res.data) === null || _res$data12 === void 0 ? void 0 : _res$data12.security_token
});
return _context2.abrupt("return", new Promise(function (resolve, reject) {
var _res$data13;
client.multipartUpload("".concat(name), new Blob([file], {
type: file.type
}), _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()({
timeout: 200 * 1000,
partSize: 102400
}, config), {}, {
callback: {
url: res === null || res === void 0 || (_res$data13 = res.data) === null || _res$data13 === void 0 ? void 0 : _res$data13.callback_url,
host: res === null || res === void 0 ? void 0 : res.data.bucket_host,
body: 'bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&my_var=${x:my_var}&' + (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* .parseParams */ .rz)(obj)
// body: 'bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&my_var=${x:my_var}&login=' + obj.login + '&container_id=' + obj.container_id + '&container_type='+obj.container_type,
}
})).then(function (result) {
var _result$data;
file.response = (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.data;
resolve(result === null || result === void 0 ? void 0 : result.data);
})["catch"](function (err) {
reject(err);
console.log("err:", err);
});
}));
case 11:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function uploadFile(_x2, _x3, _x4) {
return _ref3.apply(this, arguments);
};
}();
var UploadFile = function UploadFile(_ref4) {
var user = _ref4.user,
cancelUpload = _ref4.cancelUpload,
props = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_2___default()(_ref4, _excluded);
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)([]),
_useState2 = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState, 2),
fileList = _useState2[0],
setFileList = _useState2[1];
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(),
_useState4 = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState3, 2),
client = _useState4[0],
setClient = _useState4[1];
var _props = {
onRemove: function onRemove(e) {
setFileList(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_0___default()(fileList.filter(function (item) {
return item.name !== e.name;
})));
props.onChange(fileList.filter(function (item) {
return item.name !== e.name;
}));
},
disabled: props.disabled,
multiple: true,
fileList: fileList === null || fileList === void 0 ? void 0 : fileList.map(function (item) {
return item.file;
}),
customRequest: function customRequest() {},
beforeUpload: function () {
var _beforeUpload = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_5___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4___default()().mark(function _callee3(file) {
var fileSize;
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4___default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
fileSize = props.maxSize || 1024 * 1024 * 1024 * 1;
if (!fileList.filter(function (item) {
return item.name === file.name;
}).length) {
_context3.next = 4;
break;
}
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .ZP.info("".concat(file.name, "\u5DF2\u5B58\u5728\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9"));
return _context3.abrupt("return");
case 4:
if (!((file === null || file === void 0 ? void 0 : file.size) > fileSize)) {
_context3.next = 7;
break;
}
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .ZP.info("\u6587\u4EF6\u8D85\u8FC7".concat(fileSize / 1024 / 1024 / 1024, "GB\uFF0C\u4E0D\u7B26\u5408\u4E0A\u4F20\u8981\u6C42"));
return _context3.abrupt("return", false);
case 7:
fileList.push({
name: file.name,
file: file
});
setFileList(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_0___default()(fileList));
props.onChange(fileList);
return _context3.abrupt("return", false);
case 11:
case "end":
return _context3.stop();
}
}, _callee3);
}));
function beforeUpload(_x5) {
return _beforeUpload.apply(this, arguments);
}
return beforeUpload;
}()
};
var _uploadFiles = /*#__PURE__*/function () {
var _ref5 = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_5___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4___default()().mark(function _callee4(file, obj) {
var _res$data14, _res$data15, _res$data16, _res$data17, _res$data18, _res$data19;
var name, res, namearrs, filename;
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4___default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
obj.file_name = file.name;
name = file.name;
_context4.next = 4;
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP)('/api/buckets/get_upload_token_for_big_files.json', {
method: "get"
});
case 4:
res = _context4.sent;
res.data = JSON.parse(decrypt(res.data));
if (!((res === null || res === void 0 ? void 0 : res.status) !== 0)) {
_context4.next = 12;
break;
}
fileList[fileList.findIndex(function (item) {
return item.name === name;
})]['status'] = 'error';
fileList[fileList.findIndex(function (item) {
return item.name === name;
})]['file']['status'] = 'error';
props.onChange(fileList);
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .ZP.warning("上传失败,请重新尝试");
return _context4.abrupt("return");
case 12:
client = new (ali_oss__WEBPACK_IMPORTED_MODULE_11___default())({
endpoint: res === null || res === void 0 || (_res$data14 = res.data) === null || _res$data14 === void 0 ? void 0 : _res$data14.end_point,
region: res === null || res === void 0 || (_res$data15 = res.data) === null || _res$data15 === void 0 ? void 0 : _res$data15.region,
accessKeyId: res === null || res === void 0 || (_res$data16 = res.data) === null || _res$data16 === void 0 ? void 0 : _res$data16.access_key_id,
accessKeySecret: res === null || res === void 0 || (_res$data17 = res.data) === null || _res$data17 === void 0 ? void 0 : _res$data17.access_key_secret,
bucket: res === null || res === void 0 || (_res$data18 = res.data) === null || _res$data18 === void 0 ? void 0 : _res$data18.bucket,
stsToken: res === null || res === void 0 || (_res$data19 = res.data) === null || _res$data19 === void 0 ? void 0 : _res$data19.security_token
});
console.log(file, 'file');
setClient(client);
// const filename = uuidv4()
namearrs = file.name.split(".");
namearrs.pop();
filename = obj.realFileName ? namearrs.join(".") : (0,uuid__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z)();
return _context4.abrupt("return", new Promise(function (resolve, reject) {
try {
var _res$data20;
client.multipartUpload("".concat(props.identifier, "/").concat(filename).concat(name.indexOf(".") > -1 ? '.' + name.split(".").pop() : ""), new Blob([file.file], {
type: file.file.type
}), {
timeout: 3600 * 1000,
partSize: 1002400,
progress: function progress(p, checkpoint, res) {
try {
console.log("进度", p, checkpoint, res);
var index = fileList.findIndex(function (item) {
return item.name === name;
});
fileList[index]['file']['percent'] = p * 100;
// if (p === 1) {
// fileList[index]['status'] = 'done'
// fileList[index]['file']['status'] = 'done'
// props.onChange(fileList)
// }
fileList[index].tempCheckpoint = checkpoint;
setFileList(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_0___default()(fileList));
} catch (e) {}
},
checkpoint: fileList[fileList.findIndex(function (item) {
return item.name === name;
})].tempCheckpoint,
callback: {
customValue: {
id: name + ''
},
url: res === null || res === void 0 || (_res$data20 = res.data) === null || _res$data20 === void 0 ? void 0 : _res$data20.callback_url,
host: res === null || res === void 0 ? void 0 : res.data.bucket_host,
body: 'bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&my_var=${x:my_var}&' + (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* .parseParams */ .rz)(obj)
}
}).then(function (result) {
var _result$data2;
var index = fileList.findIndex(function (item) {
return item.name === name;
});
var status = 'done';
if (((_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.status) === 0) {
var _result$data3;
file.response = (_result$data3 = result.data) === null || _result$data3 === void 0 ? void 0 : _result$data3.data;
var _index = fileList.findIndex(function (item) {
return item.name === name;
});
fileList[_index]['status'] = 'done';
fileList[_index]['file']['status'] = 'done';
} else {
var _result$data4;
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .ZP.warning((_result$data4 = result.data) === null || _result$data4 === void 0 ? void 0 : _result$data4.message);
status = 'error';
}
fileList[index]['status'] = status;
fileList[index]['file']['status'] = status;
props.onChange(fileList);
resolve(result === null || result === void 0 ? void 0 : result.data);
})["catch"](function (err) {
fileList[fileList.findIndex(function (item) {
return item.name === name;
})]['status'] = 'error';
fileList[fileList.findIndex(function (item) {
return item.name === name;
})]['file']['status'] = 'error';
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .ZP.warning("上传失败,请重新尝试");
setFileList(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_0___default()(fileList));
props.onChange(fileList);
reject(err);
console.log("err:", err);
});
} catch (e) {
// debugger
}
}));
case 19:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return function _uploadFiles(_x6, _x7) {
return _ref5.apply(this, arguments);
};
}();
(0,react__WEBPACK_IMPORTED_MODULE_6__.useEffect)(function () {
if (fileList.every(function (item) {
return item === 'done' || item === 'error';
})) {
props.onComplete(fileList);
}
}, [fileList]);
(0,react__WEBPACK_IMPORTED_MODULE_6__.useEffect)(function () {
if (cancelUpload) {
var _client;
(_client = client) === null || _client === void 0 || _client.cancel();
}
}, [cancelUpload]);
(0,react__WEBPACK_IMPORTED_MODULE_6__.useEffect)(function () {
if (props.uploading) fileList.map( /*#__PURE__*/function () {
var _ref6 = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_5___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4___default()().mark(function _callee5(item) {
var _user$userInfo, res;
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4___default()().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
if (!((!item.status || item.status === 'error') && !cancelUpload)) {
_context5.next = 6;
break;
}
item.status = 'uploading';
item.file.status = 'uploading';
_context5.next = 5;
return _uploadFiles(item, {
login: user === null || user === void 0 || (_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.login,
container_type: props.container_type,
container_id: props.container_id,
description: props.description,
realFileName: props.realFileName
});
case 5:
res = _context5.sent;
case 6:
case "end":
return _context5.stop();
}
}, _callee5);
}));
return function (_x8) {
return _ref6.apply(this, arguments);
};
}());
}, [props.uploading]);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(Dragger, _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()({}, _props), {}, {
height: props.height,
className: props.className,
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("p", {
className: "ant-upload-hint",
children: props.text || '拖拽文件或者点击上传'
})
}));
};
/* harmony default export */ __webpack_exports__.ZP = ((0,umi__WEBPACK_IMPORTED_MODULE_9__.connect)(function (_ref7) {
var loading = _ref7.loading,
globalSetting = _ref7.globalSetting,
user = _ref7.user;
return {
globalSetting: globalSetting,
loading: loading.models.competitions,
user: user
};
})(UploadFile));
/***/ }),
/***/ 63618:
/*!****************************************************************!*\
!*** ./src/pages/DataSet/AddOrEditModal/index.tsx + 1 modules ***!
\****************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ DataSet_AddOrEditModal; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
var objectSpread2 = __webpack_require__(82242);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/toConsumableArray.js
var toConsumableArray = __webpack_require__(37205);
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(7557);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(41498);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(79800);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
var input = __webpack_require__(10249);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/index.js + 19 modules
var es_form = __webpack_require__(78241);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
var message = __webpack_require__(8591);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
var modal = __webpack_require__(43418);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/spin/index.js + 1 modules
var spin = __webpack_require__(71418);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/upload/index.js + 24 modules
var upload = __webpack_require__(54580);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
var tooltip = __webpack_require__(6848);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/progress/index.js + 13 modules
var progress = __webpack_require__(93948);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
var es_radio = __webpack_require__(5112);
;// CONCATENATED MODULE: ./src/pages/DataSet/AddOrEditModal/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var AddOrEditModalmodules = ({"flex_box_center":"flex_box_center___SntrE","flex_space_between":"flex_space_between___g4tse","flex_box_vertical_center":"flex_box_vertical_center___ooGcI","flex_box_center_end":"flex_box_center_end___UM2Cs","flex_box_column":"flex_box_column___vRGBc","prompt":"prompt___a_aRk","box":"box___X84XK","row":"row___wofpN","icon":"icon___ixIOQ"});
// EXTERNAL MODULE: ./src/utils/fetch.ts
var fetch = __webpack_require__(43391);
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(11919);
// EXTERNAL MODULE: ./src/components/UploadFile/index.tsx
var UploadFile = __webpack_require__(11448);
// EXTERNAL MODULE: ./node_modules/_uuid@8.3.0@uuid/dist/esm-browser/v4.js + 4 modules
var v4 = __webpack_require__(1012);
// EXTERNAL MODULE: ./node_modules/_ali-oss@6.10.0@ali-oss/dist/aliyun-oss-sdk.js
var aliyun_oss_sdk = __webpack_require__(75264);
var aliyun_oss_sdk_default = /*#__PURE__*/__webpack_require__.n(aliyun_oss_sdk);
// EXTERNAL MODULE: ./src/pages/DataSet/SelectData/index.tsx + 1 modules
var SelectData = __webpack_require__(80162);
// EXTERNAL MODULE: ./src/components/ui-customization/index.tsx + 32 modules
var ui_customization = __webpack_require__(77421);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/DataSet/AddOrEditModal/index.tsx
var TextArea = input/* default */.Z.TextArea;
var AddOrEditModal = function AddOrEditModal(_ref) {
var dataSetInfo = _ref.dataSetInfo,
attachmentInfo = _ref.attachmentInfo,
visible = _ref.visible,
_ref$onClose = _ref.onClose,
onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
_ref$onSuccess = _ref.onSuccess,
onSuccess = _ref$onSuccess === void 0 ? function () {} : _ref$onSuccess;
var _useState = (0,_react_17_0_2_react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
fileList = _useState2[0],
setFileList = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
btnLoading = _useState4[0],
setBtnLoading = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(false),
_useState6 = slicedToArray_default()(_useState5, 2),
loading = _useState6[0],
setLoading = _useState6[1];
var _Form$useForm = es_form/* default */.Z.useForm(),
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
form = _Form$useForm2[0];
var _useState7 = (0,_react_17_0_2_react.useState)([]),
_useState8 = slicedToArray_default()(_useState7, 2),
tagsActive = _useState8[0],
setTagsActive = _useState8[1];
var _useState9 = (0,_react_17_0_2_react.useState)({}),
_useState10 = slicedToArray_default()(_useState9, 2),
data = _useState10[0],
setData = _useState10[1];
var fileListRef = (0,_react_17_0_2_react.useRef)([]);
(0,_react_17_0_2_react.useEffect)(function () {
if (visible) {
if (dataSetInfo) {
var _ref2 = dataSetInfo || {},
title = _ref2.title,
is_public = _ref2.is_public,
desc = _ref2.desc,
attachments = _ref2.attachments,
data_set_tags = _ref2.data_set_tags;
var currentFileList = attachments.map(function (e) {
var gather = {
id: String(Math.random()).slice(-6),
name: e.title,
response: {
attachment_id: e.id
},
size: e.size,
description: e.description || '',
percent: 100,
status: 'done'
};
return gather;
});
setFileList(currentFileList);
setTagsActive(data_set_tags);
var formValue = {
title: title,
is_public: is_public,
desc: desc
};
form.setFieldsValue(formValue);
}
if (attachmentInfo) {
var _currentFileList = attachmentInfo.map(function (e) {
var gather = {
id: String(Math.random()).slice(-6),
name: e.title,
response: {
attachment_id: e.id
},
size: e.size,
description: e.description || '',
percent: 100,
status: 'done'
};
return gather;
});
setFileList(_currentFileList);
}
getData();
}
}, [visible]);
(0,_react_17_0_2_react.useEffect)(function () {
fileListRef.current = fileList;
}, [fileList]);
(0,_react_17_0_2_react.useEffect)(function () {
if (fileList !== null && fileList !== void 0 && fileList.length) {
form.setFields([{
name: 'attachments',
errors: []
}]);
} else {
form.setFields([{
name: 'attachments',
errors: ['数据集不能为空']
}]);
}
}, [fileList.length]);
(0,_react_17_0_2_react.useEffect)(function () {
if (tagsActive !== null && tagsActive !== void 0 && tagsActive.length) {
form.setFields([{
name: 'tag_ids',
errors: []
}]);
} else {
form.setFields([{
name: 'tag_ids',
errors: ['数据集标签不能为空']
}]);
}
}, [tagsActive.length]);
var getData = /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
setLoading(true);
_context.next = 3;
return (0,fetch/* default */.ZP)('/api/data_sets/extra_info.jsoin', {
method: "get"
});
case 3:
res = _context.sent;
if (res.status === 0) {
setData(res === null || res === void 0 ? void 0 : res.data);
setLoading(false);
}
case 5:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getData() {
return _ref3.apply(this, arguments);
};
}();
var uploadProps = {
multiple: true,
withCredentials: true,
showUploadList: false,
beforeUpload: function () {
var _beforeUpload = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(file) {
var _file$name;
var nameItem, fileSize, listTotalSize, m, gb, gather;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (!(((_file$name = file.name) === null || _file$name === void 0 || (_file$name = _file$name.split('.')) === null || _file$name === void 0 || (_file$name = _file$name.slice(0, -1)) === null || _file$name === void 0 || (_file$name = _file$name.join('.')) === null || _file$name === void 0 ? void 0 : _file$name.length) > 60)) {
_context2.next = 3;
break;
}
message/* default */.ZP.warning("\u300A".concat(file.name, "\u300B\u6587\u4EF6\u540D\u79F0\u8FC7\u957F\uFF0C\u65E0\u6CD5\u4E0A\u4F20"));
return _context2.abrupt("return", Promise.reject());
case 3:
nameItem = [].concat(toConsumableArray_default()(data.data_set_filenames), toConsumableArray_default()(fileListRef.current.map(function (e) {
return e.name;
})));
if (!nameItem.includes(file.name)) {
_context2.next = 7;
break;
}
message/* default */.ZP.warning("\u300A".concat(file.name, "\u300B\u5DF2\u5B58\u5728\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9"));
return _context2.abrupt("return", Promise.reject());
case 7:
// 当前文件大小
fileSize = file.size / 1024 / 1024; // fileList中的文件总大小
listTotalSize = data === null || data === void 0 ? void 0 : data.data_sets_filesize;
fileListRef.current.forEach(function (item) {
listTotalSize += item === null || item === void 0 ? void 0 : item.size;
});
listTotalSize = listTotalSize / 1024 / 1024;
// if (fileSize > 2000) {
// message.warning(`《${file.name}》文件无法上传。超过单个文件上传大小限制(2GB)`)
// return Promise.reject();
// }
m = listTotalSize + fileSize / (1024 * 1024);
gb = (m / 1024).toFixed(2);
if (!(gb > 10 && !(data !== null && data !== void 0 && data.current_user_no_limit))) {
_context2.next = 16;
break;
}
message/* default */.ZP.warning("\u300A".concat(file.name, "\u300B\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u50A8\u5B58\u7A7A\u95F4\u5927\u5C0F\u9650\u5236(10GB)"));
return _context2.abrupt("return", Promise.reject());
case 16:
gather = {
id: String(Math.random()).slice(-6),
name: file.name,
size: file.size,
file: file,
description: '',
percent: 0,
status: 'uploading'
}; // OSSUploadFiles(gather, {
// login: data?.login,
// container_type: 'DataSet',
// container_id: null,
// description: '',
// realFileName: true
// })
LocalUploadFiles(gather);
setFileList(function (p) {
return [].concat(toConsumableArray_default()(p), [gather]);
});
return _context2.abrupt("return", Promise.reject());
case 20:
case "end":
return _context2.stop();
}
}, _callee2);
}));
function beforeUpload(_x) {
return _beforeUpload.apply(this, arguments);
}
return beforeUpload;
}()
};
var handleRemove = /*#__PURE__*/function () {
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(file) {
var currentFile, _currentFile$client;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
currentFile = fileListRef.current.find(function (item) {
return item.name === file.name;
}); // if (currentFile?.response?.attachment_id) {
// await Fetch('/api/data_sets/single_destroy_files.json', {
// method: "delete",
// body: {
// attachment_id: currentFile?.response?.attachment_id
// }
// })
// }
if (currentFile !== null && currentFile !== void 0 && currentFile.client) {
currentFile === null || currentFile === void 0 || (_currentFile$client = currentFile.client) === null || _currentFile$client === void 0 || _currentFile$client.abort();
}
setFileList(function (p) {
return p.filter(function (item) {
return item.name !== file.name;
});
});
case 3:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return function handleRemove(_x2) {
return _ref4.apply(this, arguments);
};
}();
var updateCancel = function updateCancel() {
var _fileListRef$current;
(_fileListRef$current = fileListRef.current) === null || _fileListRef$current === void 0 || _fileListRef$current.forEach(function (e) {
if (e !== null && e !== void 0 && e.client) {
var _e$client;
e === null || e === void 0 || (_e$client = e.client) === null || _e$client === void 0 || _e$client.abort();
}
});
};
console.log(fileList, 'fileList1');
var OSSUploadFiles = /*#__PURE__*/function () {
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(file, obj) {
var _res$data, _res$data2, _res$data3, _res$data4, _res$data5, _res$data6, _fileListRef$current$, _fileListRef$current2, _res$data7;
var name, res, client, nameArray, filename;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
obj.file_name = file.name;
name = file.name;
_context4.next = 4;
return (0,fetch/* default */.ZP)('/api/buckets/get_data_set_token.json', {
method: "get"
});
case 4:
res = _context4.sent;
if (!((res === null || res === void 0 ? void 0 : res.status) !== 0)) {
_context4.next = 9;
break;
}
setFileList(function (p) {
p[p.findIndex(function (item) {
return item.name === name;
})]['status'] = 'error';
return toConsumableArray_default()(p);
});
message/* default */.ZP.warning("上传失败,请重新尝试");
return _context4.abrupt("return");
case 9:
res.data = JSON.parse((0,UploadFile/* decrypt */.pe)(res.data));
client = new (aliyun_oss_sdk_default())({
endpoint: res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.end_point,
region: res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.region,
accessKeyId: res === null || res === void 0 || (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.access_key_id,
accessKeySecret: res === null || res === void 0 || (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.access_key_secret,
bucket: res === null || res === void 0 || (_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : _res$data5.bucket,
stsToken: res === null || res === void 0 || (_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : _res$data6.security_token
});
nameArray = file.name.split(".");
nameArray.pop();
filename = obj.realFileName ? nameArray.join(".") : (0,v4/* default */.Z)();
client.multipartUpload("datasets/".concat(obj === null || obj === void 0 ? void 0 : obj.login, "/").concat(filename).concat(name.indexOf(".") > -1 ? '.' + name.split(".").pop() : ""), new Blob([file.file], {
type: file.file.type
}), {
timeout: 3600 * 1000,
partSize: 1002400,
progress: function progress(percent, checkpoint, res) {
console.log("进度", percent, checkpoint, res);
setFileList(function (p) {
var i = p.findIndex(function (item) {
return item.name === name;
});
p[i]['client'] = client;
p[i]['percent'] = percent * 100;
p[i]['checkpoint'] = checkpoint;
return toConsumableArray_default()(p);
});
},
checkpoint: (_fileListRef$current$ = fileListRef.current[(_fileListRef$current2 = fileListRef.current) === null || _fileListRef$current2 === void 0 ? void 0 : _fileListRef$current2.findIndex(function (item) {
return item.name === name;
})]) === null || _fileListRef$current$ === void 0 ? void 0 : _fileListRef$current$.checkpoint,
callback: {
customValue: {
id: name + ''
},
url: res === null || res === void 0 || (_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : _res$data7.callback_url,
host: res === null || res === void 0 ? void 0 : res.data.bucket_host,
body: 'bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&my_var=${x:my_var}&' + (0,fetch/* parseParams */.rz)(obj)
}
}).then(function (result) {
setFileList(function (p) {
var _result$data;
var i = p.findIndex(function (item) {
return item.name === name;
});
var status = 'done';
if (((_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.status) === 0) {
var _result$data2;
p[i].response = (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.data;
} else {
var _result$data3;
message/* default */.ZP.warning((_result$data3 = result.data) === null || _result$data3 === void 0 ? void 0 : _result$data3.message);
status = 'error';
}
p[i]['status'] = status;
return toConsumableArray_default()(p);
});
})["catch"](function (err) {
console.log('接口错误:', err);
if ((err === null || err === void 0 ? void 0 : err.name) !== 'cancel') {
setFileList(function (p) {
var i = p.findIndex(function (item) {
return item.name === name;
});
p[i]['status'] = 'error';
return toConsumableArray_default()(p);
});
}
});
case 15:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return function OSSUploadFiles(_x3, _x4) {
return _ref5.apply(this, arguments);
};
}();
var LocalUploadFiles = /*#__PURE__*/function () {
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5(gather) {
var file, fileSize, name, chunkSize, totalChunks, res, uploadId, chunk_count, client, promises, percent, _loop, i, completed, step, _promises$slice, subTasks, p, result;
return regeneratorRuntime_default()().wrap(function _callee5$(_context6) {
while (1) switch (_context6.prev = _context6.next) {
case 0:
file = gather.file;
fileSize = file.size;
name = file.name;
chunkSize = 1024 * 1024 * 2; // 2MB
totalChunks = Math.ceil(fileSize / chunkSize);
_context6.next = 7;
return (0,fetch/* default */.ZP)("/api/attachments/multipart_breakpoint_upload_start", {
method: 'POST',
body: {
fileName: name,
chunkCount: totalChunks,
size: file === null || file === void 0 ? void 0 : file.size,
lastModified: file === null || file === void 0 ? void 0 : file.lastModified,
user_id: data === null || data === void 0 ? void 0 : data.user_id,
container_type: 'DataSet'
}
});
case 7:
res = _context6.sent;
if (!((res === null || res === void 0 ? void 0 : res.status) !== 0)) {
_context6.next = 11;
break;
}
setFileList(function (p) {
var i = p.findIndex(function (item) {
return item.name === name;
});
if (i > -1) {
p[i]['status'] = 'error';
return toConsumableArray_default()(p);
}
return p;
});
return _context6.abrupt("return");
case 11:
uploadId = res.upload_id, chunk_count = res.chunk_count;
client = new AbortController();
promises = [];
percent = chunk_count;
_loop = /*#__PURE__*/regeneratorRuntime_default()().mark(function _loop() {
var start, end, chunk, formData;
return regeneratorRuntime_default()().wrap(function _loop$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
start = i * chunkSize;
end = Math.min(start + chunkSize, fileSize);
chunk = file.slice(start, end);
formData = new FormData();
formData.append('chunk', chunk);
formData.append('fileName', name);
formData.append('chunkIndex', (i + 1).toString());
formData.append('uploadId', uploadId);
formData.append('user_id', data === null || data === void 0 ? void 0 : data.user_id);
formData.append('container_type', 'DataSet');
promises.push(function () {
return (0,fetch/* default */.ZP)("/api/attachments/multipart_upload", {
method: 'POST',
body: formData,
signal: client.signal
}, true).then(function (res) {
percent++;
var currentProgress = Math.round(percent / totalChunks * 100);
console.log("进度", currentProgress, res);
try {
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
setFileList(function (p) {
var i = p.findIndex(function (item) {
return item.name === name;
});
p[i]['client'] = client;
p[i]['percent'] = currentProgress;
return toConsumableArray_default()(p);
});
} else {
setFileList(function (p) {
var i = p.findIndex(function (item) {
return item.name === name;
});
if (i > -1) {
p[i]['status'] = 'error';
return toConsumableArray_default()(p);
}
return p;
});
}
} catch (err) {
console.log('接口错误:', err);
}
});
});
case 11:
case "end":
return _context5.stop();
}
}, _loop);
});
i = chunk_count;
case 17:
if (!(i < totalChunks)) {
_context6.next = 22;
break;
}
return _context6.delegateYield(_loop(), "t0", 19);
case 19:
i++;
_context6.next = 17;
break;
case 22:
completed = 0;
step = 4;
case 24:
if (!(completed < promises.length)) {
_context6.next = 33;
break;
}
subTasks = (_promises$slice = promises.slice(completed, completed + step)) === null || _promises$slice === void 0 ? void 0 : _promises$slice.map(function (t) {
return t();
});
if (!(subTasks.length > 0)) {
_context6.next = 31;
break;
}
_context6.next = 29;
return Promise.all(subTasks);
case 29:
p = _context6.sent;
completed += step;
case 31:
_context6.next = 24;
break;
case 33:
_context6.next = 35;
return (0,fetch/* default */.ZP)("/api/attachments/multipart_upload_end", {
method: 'POST',
body: {
fileName: file.name,
chunkCount: totalChunks,
uploadId: uploadId,
container_type: 'DataSet'
}
});
case 35:
result = _context6.sent;
if ((result === null || result === void 0 ? void 0 : result.status) === 0) {
setFileList(function (p) {
var i = p.findIndex(function (item) {
return item.name === name;
});
if (i > -1) {
p[i]['status'] = 'done';
p[i].response = {
attachment_id: result === null || result === void 0 ? void 0 : result.id
};
return toConsumableArray_default()(p);
}
return p;
});
} else {
setFileList(function (p) {
var i = p.findIndex(function (item) {
return item.name === name;
});
if (i > -1) {
p[i]['status'] = 'error';
return toConsumableArray_default()(p);
}
return p;
});
}
case 37:
case "end":
return _context6.stop();
}
}, _callee5);
}));
return function LocalUploadFiles(_x5) {
return _ref6.apply(this, arguments);
};
}();
var replaceTrim = function replaceTrim(str) {
str = str || '';
str = String(str);
// 替换空和换行
str = str.replace(/\s+/g, '');
return str;
};
var handleFinish = /*#__PURE__*/function () {
var _ref7 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6() {
var value, title, is_public, desc, errorList, attachments, body, res, _res;
return regeneratorRuntime_default()().wrap(function _callee6$(_context7) {
while (1) switch (_context7.prev = _context7.next) {
case 0:
value = form.getFieldsValue();
title = value.title, is_public = value.is_public, desc = value.desc;
errorList = [];
if (!replaceTrim(title)) {
errorList.push({
name: 'title',
errors: ['数据集名称不能为空']
});
}
if (!(fileList !== null && fileList !== void 0 && fileList.length)) {
errorList.push({
name: 'attachments',
errors: ['数据集不能为空']
});
}
if (!(tagsActive !== null && tagsActive !== void 0 && tagsActive.length)) {
errorList.push({
name: 'tag_ids',
errors: ['数据集标签不能为空']
});
}
if (!errorList.length) {
_context7.next = 9;
break;
}
form.setFields(errorList);
return _context7.abrupt("return");
case 9:
attachments = fileList.map(function (e) {
var _e$response;
return {
attachment_id: (_e$response = e.response) === null || _e$response === void 0 ? void 0 : _e$response.attachment_id,
description: e.description
};
});
setBtnLoading(true);
body = {
title: value.title,
attachments: attachments,
tag_ids: tagsActive.map(function (e) {
return e.id;
}),
is_public: is_public,
desc: desc
};
if (!dataSetInfo) {
_context7.next = 18;
break;
}
_context7.next = 15;
return (0,fetch/* default */.ZP)("/api/data_sets/".concat(dataSetInfo === null || dataSetInfo === void 0 ? void 0 : dataSetInfo.id, ".json"), {
method: "put",
body: body
});
case 15:
res = _context7.sent;
_context7.next = 21;
break;
case 18:
_context7.next = 20;
return (0,fetch/* default */.ZP)('/api/data_sets.json', {
method: "post",
body: body
});
case 20:
res = _context7.sent;
case 21:
if (res.status === 0) {
message/* default */.ZP.success('操作成功');
onSuccess((_res = res) === null || _res === void 0 || (_res = _res.data) === null || _res === void 0 ? void 0 : _res.data_set_id);
}
setBtnLoading(false);
case 23:
case "end":
return _context7.stop();
}
}, _callee6);
}));
return function handleFinish() {
return _ref7.apply(this, arguments);
};
}();
//拿到选择的标签
var getDataSet = function getDataSet(data) {
setTagsActive(data);
};
var btnDisabled = fileList.some(function (e) {
return e.status === 'uploading';
});
console.log("fileList", fileList);
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z
// centered
// maskClosable={false}
// keyboard={false}
, {
destroyOnClose: true,
confirmLoading: btnLoading,
bodyStyle: {
paddingLeft: 16,
paddingTop: 20
},
okButtonProps: {
disabled: btnDisabled
},
title: dataSetInfo ? '编辑数据集' : "创建数据集",
width: 660,
onCancel: function onCancel() {
if (btnDisabled) {
modal/* default */.Z.confirm({
title: "关闭弹框提示",
content: "有文件未上传,是否确定离开?",
okText: "离开",
cancelText: "取消",
onOk: function onOk() {
onClose();
}
});
return;
}
onClose();
},
okText: "\u786E\u5B9A",
onOk: handleFinish,
open: visible,
afterClose: function afterClose() {
setFileList([]);
setTagsActive([]);
setBtnLoading(false);
setLoading(false);
updateCancel();
form.resetFields();
},
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(spin/* default */.Z, {
spinning: loading,
children: [!(data !== null && data !== void 0 && data.current_user_no_limit) && !loading && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: AddOrEditModalmodules.prompt,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "icon icon-tishi11 font12 mr10"
}), "\u6E29\u99A8\u63D0\u793A:\u5E73\u53F0\u4E3A\u7528\u6237\u63D0\u4F9B\u4E86", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#3061D0',
margin: '0 5px'
},
children: "10GB"
}), "\u7684\u6570\u636E\u96C6\u5B58\u50A8\u7A7A\u95F4\uFF0C\u60A8\u76EE\u524D\u5DF2\u4F7F\u7528\u4E86", /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
color: '#FF9D18',
margin: '0 5px'
},
children: [((data === null || data === void 0 ? void 0 : data.data_sets_filesize) / (1024 * 1024 * 1024)).toFixed(2), "GB"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
form: form,
colon: false,
labelCol: {
span: 4
},
wrapperCol: {
span: 20
},
size: "large",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u6570\u636E\u96C6\u540D\u79F0",
name: "title",
rules: [{
required: true,
message: '数据集名称不能为空'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
placeholder: "\u8BF7\u8F93\u5165\u6570\u636E\u96C6\u540D\u79F0",
showCount: true,
maxLength: 60
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
style: {
marginBottom: 0
},
name: "attachments",
label: "\u4E0A\u4F20\u6570\u636E\u96C6",
rules: [{
required: true,
message: '数据集不能为空'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
position: 'relative'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(upload/* default */.Z, objectSpread2_default()(objectSpread2_default()({}, uploadProps), {}, {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(ui_customization/* CustomButton */.op, {
style: {
borderRadius: 2
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "icon-shangchuan3 mr5 font14"
}), "\u4E0A\u4F20\u6587\u4EF6"]
})
})), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
color: '#9096A3',
fontSize: '12px',
marginLeft: '10px',
position: 'absolute',
left: '115px',
top: '-2px'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: "1.\u5355\u4E2A\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC72G"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: "2.\u4E2A\u4EBA\u4E0A\u4F20\u603B\u4F53\u79EF\u4E0D\u8D85\u8FC710GB\uFF0C\u6587\u4EF6\u540D\u4E0D\u8D85\u8FC760\u5B57"
})]
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: AddOrEditModalmodules.box,
children: fileList.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: AddOrEditModalmodules.row,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: AddOrEditModalmodules.icon,
children: [item.status === 'done' && /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-wancheng",
style: {
color: '#19CB70'
}
}), item.status === 'error' && /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-cuowu",
style: {
color: '#E30000',
marginLeft: 1,
fontSize: 13
}
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
width: 176
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: item === null || item === void 0 ? void 0 : item.name,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
color: item.status === 'error' ? '#E30000' : '#3061D0',
textDecoration: 'underline'
},
children: (0,util/* cutFileName */.tP)(item === null || item === void 0 ? void 0 : item.name, 9)
})
}), item.status === 'uploading' && /*#__PURE__*/(0,jsx_runtime.jsx)(progress/* default */.Z, {
strokeColor: "#3061D0",
trailColor: "rgba(144, 150, 163, 0.1)",
percent: item.percent,
showInfo: false,
size: [168, 4]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
onClick: function onClick() {
return handleRemove(item);
},
className: "iconfont icon-shanchu14 font14 ml20 mr20",
style: {
cursor: 'pointer',
color: '#F65160'
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
value: item.description,
onChange: function onChange(e) {
setFileList(function (p) {
var i = p.findIndex(function (e) {
return e.name === item.name;
});
p[i]['description'] = e.target.value;
return toConsumableArray_default()(p);
});
},
placeholder: "\u5907\u6CE8\u8BF4\u660E",
showCount: true,
maxLength: 100,
style: {
width: '286px'
}
})]
}, item.id);
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u6807\u7B7E",
name: "tag_ids",
rules: [{
required: true,
message: '数据集标签不能为空'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(SelectData/* default */.Z, {
isTagsValue: true,
width: "514",
selectWidth: "514",
placeholder: "\u6DFB\u52A0\u6807\u7B7E",
getDataSet: getDataSet,
tags: tagsActive
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
initialValue: 0,
label: "\u662F\u5426\u516C\u5F00",
name: "is_public",
rules: [{
required: true
}],
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default.Group */.ZP.Group, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 1,
children: "\u662F"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 0,
children: "\u5426"
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
position: 'relative',
left: '100px',
top: '-20px',
width: '400px',
color: '#9096A3',
fontSize: '12px'
},
children: "\u516C\u5F00\u9700\u8981\u7BA1\u7406\u5458\u5BA1\u6838\u901A\u8FC7\u540E\u53EF\u88AB\u5176\u4ED6\u7528\u6237\u8BBF\u95EE"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u7B80\u4ECB\u6458\u8981",
name: "desc",
style: {
marginBottom: 0
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(TextArea, {
placeholder: "\u6B64\u6570\u636E\u96C6\u4E3B\u8981\u5305\u542B\u4EC0\u4E48\u5185\u5BB9\uFF0C\u53EF\u4EE5\u7528\u6765\u505A\u4EC0\u4E48\uFF1F"
})
})]
})]
})
});
};
/* harmony default export */ var DataSet_AddOrEditModal = (AddOrEditModal);
/***/ }),
/***/ 80162:
/*!************************************************************!*\
!*** ./src/pages/DataSet/SelectData/index.tsx + 1 modules ***!
\************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ SelectData; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/toConsumableArray.js
var toConsumableArray = __webpack_require__(37205);
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(7557);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(41498);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(79800);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
var _umi_production_exports = __webpack_require__(5841);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/select/index.js
var es_select = __webpack_require__(57809);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/spin/index.js + 1 modules
var spin = __webpack_require__(71418);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
var message = __webpack_require__(8591);
;// CONCATENATED MODULE: ./src/pages/DataSet/SelectData/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var SelectDatamodules = ({"flex_box_center":"flex_box_center___OmLFa","flex_space_between":"flex_space_between___Pwqhp","flex_box_vertical_center":"flex_box_vertical_center___UJzms","flex_box_center_end":"flex_box_center_end___qMu25","flex_box_column":"flex_box_column___AimtA","selectList":"selectList___hGJUN","selectHeader":"selectHeader___HxdBZ","selectContent":"selectContent___oWjby","contentTitle":"contentTitle___xlVyW","contentTags":"contentTags___BGCLU","tagName":"tagName___MIGDL","tagNameActive":"tagNameActive___JCRev","activeStyle":"activeStyle___FvXnt","activeLabel":"activeLabel___RzW9T","activeValue":"activeValue___qxoch","activeItem":"activeItem___NfFjA","activeClose":"activeClose___Su7dS","activeSubmit":"activeSubmit___gjhQA"});
// EXTERNAL MODULE: ./src/service/dataset.ts
var dataset = __webpack_require__(77414);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/DataSet/SelectData/index.tsx
var Page = function Page(_ref) {
var user = _ref.user,
width = _ref.width,
selectWidth = _ref.selectWidth,
tags = _ref.tags,
getDataSet = _ref.getDataSet,
_ref$placeholder = _ref.placeholder,
placeholder = _ref$placeholder === void 0 ? '全部标签' : _ref$placeholder,
_ref$isTagsValue = _ref.isTagsValue,
isTagsValue = _ref$isTagsValue === void 0 ? false : _ref$isTagsValue;
var _useState = (0,_react_17_0_2_react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
tagsList = _useState2[0],
setTagsList = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)([]),
_useState4 = slicedToArray_default()(_useState3, 2),
active = _useState4[0],
setActive = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(false),
_useState6 = slicedToArray_default()(_useState5, 2),
loading = _useState6[0],
setLoading = _useState6[1];
var selectRef = (0,_react_17_0_2_react.useRef)(null);
(0,_react_17_0_2_react.useEffect)(function () {
getTags();
}, []);
//获取全部标签
var getTags = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
setLoading(true);
_context.next = 3;
return (0,dataset/* data_sets_tags */.bj)({}).then(function (res) {
if ((res === null || res === void 0 ? void 0 : res.status) == 0) {
setTagsList(res === null || res === void 0 ? void 0 : res.data);
}
});
case 3:
setLoading(false);
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getTags() {
return _ref2.apply(this, arguments);
};
}();
var tagsText = tags === null || tags === void 0 ? void 0 : tags.map(function (e) {
return e.tag_name;
}).join('、');
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"], {
onFocus: function onFocus() {
setActive(tags);
},
ref: selectRef,
style: {
width: selectWidth ? selectWidth + 'px' : 300
},
placeholder: (tags === null || tags === void 0 ? void 0 : tags.length) > 0 ? isTagsValue ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-grey-333",
children: tagsText
}) : "\u5DF2\u9009\u4E2D".concat(tags === null || tags === void 0 ? void 0 : tags.length, "\u4E2A\u6807\u7B7E") : placeholder,
size: "large"
// open={true}
,
dropdownStyle: {
width: width + 'px',
zIndex: 1000
},
className: SelectDatamodules.selectStyle
// defaultValue={tags}
,
dropdownRender: function dropdownRender() {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: SelectDatamodules.selectList,
style: {
width: width + 'px'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: SelectDatamodules.selectHeader,
children: "\u8BF7\u9009\u62E91\uFF5E5\u4E2A\u6807\u7B7E"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
spinning: loading,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: SelectDatamodules.selectContent,
children: tagsList === null || tagsList === void 0 ? void 0 : tagsList.map(function (v, k) {
var _v$child;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: SelectDatamodules.contentTitle,
style: {
marginTop: k > 0 ? '20px' : '0'
},
children: v === null || v === void 0 ? void 0 : v.tag_type_cn
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: SelectDatamodules.contentTags,
children: v === null || v === void 0 || (_v$child = v.child) === null || _v$child === void 0 ? void 0 : _v$child.map(function (item, key) {
var _active$map;
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: active !== null && active !== void 0 && (_active$map = active.map(function (uid) {
return uid === null || uid === void 0 ? void 0 : uid.id;
})) !== null && _active$map !== void 0 && _active$map.includes(item === null || item === void 0 ? void 0 : item.id) ? SelectDatamodules.tagNameActive : SelectDatamodules.tagName,
onClick: function onClick() {
var _active$map2;
if (active !== null && active !== void 0 && (_active$map2 = active.map(function (uid) {
return uid === null || uid === void 0 ? void 0 : uid.id;
})) !== null && _active$map2 !== void 0 && _active$map2.includes(item === null || item === void 0 ? void 0 : item.id)) {
// 如果 active 包含当前 item则从 active 中移除它
setActive(active.filter(function (tag) {
return (tag === null || tag === void 0 ? void 0 : tag.id) != (item === null || item === void 0 ? void 0 : item.id);
}));
} else {
if ((active === null || active === void 0 ? void 0 : active.length) < 5) {
// 否则,将当前 item 添加到 active 中
setActive([].concat(toConsumableArray_default()(active), [item]));
} else {
message/* default */.ZP.warning('最多可选择5个标签');
}
}
},
children: item === null || item === void 0 ? void 0 : item.tag_name
}, key);
})
})]
}, k);
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: SelectDatamodules.activeStyle,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: SelectDatamodules.activeLabel,
children: "\u5DF2\u9009\u6807\u7B7E:"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: SelectDatamodules.activeValue,
style: {
width: width - 120 + 'px'
},
children: active === null || active === void 0 ? void 0 : active.map(function (item, key) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: SelectDatamodules.activeItem,
children: [item === null || item === void 0 ? void 0 : item.tag_name, /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-guanbi11 ml5 mr5",
style: {
fontSize: '10px',
cursor: "pointer"
},
onClick: function onClick() {
setActive(active.filter(function (tag) {
return (tag === null || tag === void 0 ? void 0 : tag.id) !== (item === null || item === void 0 ? void 0 : item.id);
}));
}
})]
}, key);
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: "flex",
marginBottom: '20px'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: SelectDatamodules.activeClose,
onClick: function onClick(e) {
e.stopPropagation();
getDataSet(toConsumableArray_default()(tags));
setActive([]);
setTimeout(function () {
if (selectRef.current) {
selectRef.current.blur();
}
}, 10); // 10ms 的延迟时间可以根据需要调整
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: SelectDatamodules.activeSubmit,
onClick: function onClick(e) {
e.stopPropagation();
getDataSet(toConsumableArray_default()(active));
setActive([]);
setTimeout(function () {
if (selectRef.current) {
selectRef.current.blur();
}
}, 10); // 10ms 的延迟时间可以根据需要调整
},
children: "\u786E\u8BA4"
})]
})]
});
}
});
};
/* harmony default export */ var SelectData = ((0,_umi_production_exports.connect)(function (_ref3) {
var user = _ref3.user;
return {
user: user
};
})(Page));
/***/ }),
/***/ 77414:
/*!********************************!*\
!*** ./src/service/dataset.ts ***!
\********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ A0: function() { return /* binding */ edit_file_info; },
/* harmony export */ Ce: function() { return /* binding */ used_shixuns; },
/* harmony export */ Dx: function() { return /* binding */ revoke_apply_public; },
/* harmony export */ Il: function() { return /* binding */ single_destroy_files; },
/* harmony export */ R2: function() { return /* binding */ edit_introduce; },
/* harmony export */ R9: function() { return /* binding */ collections_cancel; },
/* harmony export */ Ru: function() { return /* binding */ data_sets_info; },
/* harmony export */ To: function() { return /* binding */ apply_public; },
/* harmony export */ _S: function() { return /* binding */ data_sets_query; },
/* harmony export */ a6: function() { return /* binding */ cancel_public; },
/* harmony export */ bj: function() { return /* binding */ data_sets_tags; },
/* harmony export */ l5: function() { return /* binding */ teach_group_shares; },
/* harmony export */ nW: function() { return /* binding */ collections_ok; },
/* harmony export */ pP: function() { return /* binding */ data_sets_delete; },
/* harmony export */ pi: function() { return /* binding */ data_sets_list; }
/* harmony export */ });
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js */ 7557);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js */ 41498);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/fetch */ 43391);
//获取标签
function data_sets_tags(_x) {
return _data_sets_tags.apply(this, arguments);
}
//数据集列表
function _data_sets_tags() {
_data_sets_tags = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee(params) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)('/api/data_sets/tags.json', {
method: 'get',
params: _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default()({}, params)
}));
case 1:
case "end":
return _context.stop();
}
}, _callee);
}));
return _data_sets_tags.apply(this, arguments);
}
function data_sets_query(_x2) {
return _data_sets_query.apply(this, arguments);
}
//申请公开
function _data_sets_query() {
_data_sets_query = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee2(params) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
return _context2.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/data_sets.json", {
method: 'get',
params: _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default()({}, params)
}));
case 1:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _data_sets_query.apply(this, arguments);
}
function apply_public(_x3) {
return _apply_public.apply(this, arguments);
}
//撤销申请公开
function _apply_public() {
_apply_public = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee3(data) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
return _context3.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/data_sets/".concat(data, "/apply_public.json"), {
method: 'post'
}));
case 1:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return _apply_public.apply(this, arguments);
}
function revoke_apply_public(_x4) {
return _revoke_apply_public.apply(this, arguments);
}
//取消公开
function _revoke_apply_public() {
_revoke_apply_public = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee4(data) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
return _context4.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/data_sets/".concat(data, "/revoke_apply_public.json"), {
method: 'post'
}));
case 1:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return _revoke_apply_public.apply(this, arguments);
}
function cancel_public(_x5) {
return _cancel_public.apply(this, arguments);
}
//收藏数据集
function _cancel_public() {
_cancel_public = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee5(data) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
return _context5.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/data_sets/".concat(data, "/cancel_public.json"), {
method: 'post'
}));
case 1:
case "end":
return _context5.stop();
}
}, _callee5);
}));
return _cancel_public.apply(this, arguments);
}
function collections_ok(_x6) {
return _collections_ok.apply(this, arguments);
}
//取消收藏
function _collections_ok() {
_collections_ok = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee6(data) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee6$(_context6) {
while (1) switch (_context6.prev = _context6.next) {
case 0:
return _context6.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/collections.json", {
method: 'post',
body: _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default()({}, data)
}));
case 1:
case "end":
return _context6.stop();
}
}, _callee6);
}));
return _collections_ok.apply(this, arguments);
}
function collections_cancel(_x7) {
return _collections_cancel.apply(this, arguments);
}
//获取数据集详情
function _collections_cancel() {
_collections_cancel = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee7(data) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee7$(_context7) {
while (1) switch (_context7.prev = _context7.next) {
case 0:
return _context7.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/collections/cancel.json", {
method: 'delete',
body: _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default()({}, data)
}));
case 1:
case "end":
return _context7.stop();
}
}, _callee7);
}));
return _collections_cancel.apply(this, arguments);
}
function data_sets_info(_x8) {
return _data_sets_info.apply(this, arguments);
}
//编辑数据集介绍
function _data_sets_info() {
_data_sets_info = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee8(params) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee8$(_context8) {
while (1) switch (_context8.prev = _context8.next) {
case 0:
return _context8.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/data_sets/".concat(params, ".json"), {
method: 'get'
}));
case 1:
case "end":
return _context8.stop();
}
}, _callee8);
}));
return _data_sets_info.apply(this, arguments);
}
function edit_introduce(_x9) {
return _edit_introduce.apply(this, arguments);
}
//获取其他践项目
function _edit_introduce() {
_edit_introduce = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee9(data) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee9$(_context9) {
while (1) switch (_context9.prev = _context9.next) {
case 0:
return _context9.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/data_sets/".concat(data === null || data === void 0 ? void 0 : data.id, "/edit_introduce.json"), {
method: 'put',
body: _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default()({}, data)
}));
case 1:
case "end":
return _context9.stop();
}
}, _callee9);
}));
return _edit_introduce.apply(this, arguments);
}
function used_shixuns(_x10) {
return _used_shixuns.apply(this, arguments);
}
//实训数据集
function _used_shixuns() {
_used_shixuns = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee10(params) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee10$(_context10) {
while (1) switch (_context10.prev = _context10.next) {
case 0:
return _context10.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/data_sets/".concat(params === null || params === void 0 ? void 0 : params.id, "/used_shixuns.json"), {
method: 'get',
params: _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default()({}, params)
}));
case 1:
case "end":
return _context10.stop();
}
}, _callee10);
}));
return _used_shixuns.apply(this, arguments);
}
function data_sets_list(_x11) {
return _data_sets_list.apply(this, arguments);
}
//删除数据集
function _data_sets_list() {
_data_sets_list = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee11(params) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee11$(_context11) {
while (1) switch (_context11.prev = _context11.next) {
case 0:
return _context11.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/shixuns/".concat(params, "/data_sets_list.json"), {
method: 'get'
}));
case 1:
case "end":
return _context11.stop();
}
}, _callee11);
}));
return _data_sets_list.apply(this, arguments);
}
function data_sets_delete(_x12) {
return _data_sets_delete.apply(this, arguments);
}
//共享
function _data_sets_delete() {
_data_sets_delete = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee12(data) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee12$(_context12) {
while (1) switch (_context12.prev = _context12.next) {
case 0:
return _context12.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/data_sets/".concat(data, "/delete.json"), {
method: 'delete'
}));
case 1:
case "end":
return _context12.stop();
}
}, _callee12);
}));
return _data_sets_delete.apply(this, arguments);
}
function teach_group_shares(_x13) {
return _teach_group_shares.apply(this, arguments);
}
//删除单个数据集文件
function _teach_group_shares() {
_teach_group_shares = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee13(data) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee13$(_context13) {
while (1) switch (_context13.prev = _context13.next) {
case 0:
return _context13.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/teach_group_shares.json", {
method: 'post',
body: _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default()({}, data)
}));
case 1:
case "end":
return _context13.stop();
}
}, _callee13);
}));
return _teach_group_shares.apply(this, arguments);
}
function single_destroy_files(_x14) {
return _single_destroy_files.apply(this, arguments);
}
//编辑数据集文件
function _single_destroy_files() {
_single_destroy_files = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee14(data) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee14$(_context14) {
while (1) switch (_context14.prev = _context14.next) {
case 0:
return _context14.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/data_sets/single_destroy_files.json", {
method: 'delete',
body: _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default()({}, data)
}));
case 1:
case "end":
return _context14.stop();
}
}, _callee14);
}));
return _single_destroy_files.apply(this, arguments);
}
function edit_file_info(_x15) {
return _edit_file_info.apply(this, arguments);
}
function _edit_file_info() {
_edit_file_info = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee15(data) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee15$(_context15) {
while (1) switch (_context15.prev = _context15.next) {
case 0:
return _context15.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/data_sets/".concat(data === null || data === void 0 ? void 0 : data.id, "/edit_file_info.json"), {
method: 'put',
body: _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default()({}, data)
}));
case 1:
case "end":
return _context15.stop();
}
}, _callee15);
}));
return _edit_file_info.apply(this, arguments);
}
/***/ })
}]);