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.
1001 lines
51 KiB
1001 lines
51 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[8688],{
|
|
|
|
/***/ 41993:
|
|
/*!**********************************************************!*\
|
|
!*** ./src/components/FixedButton/index.tsx + 1 modules ***!
|
|
\**********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
t: function() { return /* binding */ FixedButton; }
|
|
});
|
|
|
|
// 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/button/index.js
|
|
var es_button = __webpack_require__(3113);
|
|
;// CONCATENATED MODULE: ./src/components/FixedButton/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var FixedButtonmodules = ({"buttonFixed":"buttonFixed___vyq30","button":"button___hxmYv","buttonWrap":"buttonWrap___uK8dl"});
|
|
// EXTERNAL MODULE: ./node_modules/_classnames@2.3.2@classnames/index.js
|
|
var _classnames_2_3_2_classnames = __webpack_require__(12124);
|
|
var _classnames_2_3_2_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_3_2_classnames);
|
|
;// CONCATENATED MODULE: ./src/components/FixedButton/index.tsx
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
|
|
|
|
|
|
|
|
const FixedButton = ({
|
|
cancelText = "\u53D6\u6D88",
|
|
okText = "\u786E\u5B9A",
|
|
loading = false,
|
|
hasOkBtn = true,
|
|
hasCancelBtn = true,
|
|
okButtonProps = {},
|
|
onCancel = () => {
|
|
},
|
|
onOk = () => {
|
|
},
|
|
className = ""
|
|
}) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: _classnames_2_3_2_classnames_default()(FixedButtonmodules.buttonFixed, className) }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: FixedButtonmodules.buttonWrap }, hasCancelBtn && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_button/* default */.ZP,
|
|
{
|
|
size: "middle",
|
|
className: `${FixedButtonmodules.button} mr20`,
|
|
onClick: onCancel
|
|
},
|
|
cancelText
|
|
), hasOkBtn && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_button/* default */.ZP,
|
|
__spreadValues({
|
|
size: "middle",
|
|
type: "primary",
|
|
className: `${FixedButtonmodules.button} mr20`,
|
|
loading,
|
|
onClick: onOk
|
|
}, okButtonProps),
|
|
okText
|
|
)));
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 97282:
|
|
/*!*****************************************!*\
|
|
!*** ./src/components/NoData/index.tsx ***!
|
|
\*****************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var _assets_images_icons_nodata_png__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/assets/images/icons/nodata.png */ 4977);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! antd */ 3113);
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
|
|
|
|
|
|
const noData = ({
|
|
img,
|
|
buttonProps = {},
|
|
styles = {},
|
|
customText,
|
|
ButtonText,
|
|
ButtonClick,
|
|
Buttonclass,
|
|
ButtonTwo,
|
|
imgStyles,
|
|
loading = false
|
|
}) => {
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
"section",
|
|
{
|
|
className: "tc animated fadeIn",
|
|
style: __spreadValues(__spreadValues({}, { color: "#999", margin: "100px auto", visibility: loading ? "hidden" : "visible" }), styles)
|
|
},
|
|
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("img", { src: img || _assets_images_icons_nodata_png__WEBPACK_IMPORTED_MODULE_1__, style: __spreadValues({}, imgStyles) }),
|
|
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("p", { className: "mt20 font14" }, customText || "\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),
|
|
ButtonText && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .ZP, __spreadValues({ className: Buttonclass, onClick: ButtonClick }, buttonProps), ButtonText),
|
|
ButtonTwo && ButtonTwo
|
|
);
|
|
};
|
|
/* harmony default export */ __webpack_exports__.Z = (noData);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 11778:
|
|
/*!*********************************************************!*\
|
|
!*** ./src/components/PreviewAll/index.tsx + 1 modules ***!
|
|
\*********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ PreviewAll; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
;// CONCATENATED MODULE: ./src/components/PreviewAll/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var PreviewAllmodules = ({"wrp":"wrp___dq7YK","bgBlack":"bgBlack___ARIUV","monaco":"monaco___VnZC3","darkBlue":"darkBlue___UprA9","close":"close___LKoWu","embed":"embed___hvpEJ"});
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
var es_button = __webpack_require__(3113);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/ArrowDownOutlined.js + 1 modules
|
|
var ArrowDownOutlined = __webpack_require__(98915);
|
|
// EXTERNAL MODULE: ./src/components/monaco-editor/index.jsx + 4 modules
|
|
var monaco_editor = __webpack_require__(1699);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
|
|
var tooltip = __webpack_require__(6848);
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
var util = __webpack_require__(3163);
|
|
// EXTERNAL MODULE: ./src/service/exercise.ts
|
|
var exercise = __webpack_require__(40610);
|
|
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
|
|
var NoData = __webpack_require__(97282);
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
var env = __webpack_require__(64741);
|
|
;// CONCATENATED MODULE: ./src/components/PreviewAll/index.tsx
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var PreviewAll = (({ editOffice = "view", data, theme, type, filename, monacoEditor, className, style, close, onClose, hasMask, disabledDownload, onImgDimensions, showNodata }) => {
|
|
const [src, setSrc] = (0,_react_17_0_2_react.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt");
|
|
const [token, setToken] = (0,_react_17_0_2_react.useState)("");
|
|
const [officeData, setOfficeData] = (0,_react_17_0_2_react.useState)();
|
|
const officePath = window.ENV === "build" ? "/react/build" : "";
|
|
const apiServer = location.host.startsWith("localhost") ? env/* default */.Z.PROXY_SERVER : env/* default */.Z.API_SERVER;
|
|
const unit = 1024 * 1024;
|
|
const maxSize = 10 * unit;
|
|
const closeRef = (0,_react_17_0_2_react.useRef)();
|
|
if ((data == null ? void 0 : data.startsWith("/api")) && type !== "txt") {
|
|
data = env/* default */.Z.API_SERVER + data;
|
|
}
|
|
const getFileExtension = (url) => {
|
|
const filename2 = url.substring(url.lastIndexOf("/") + 1);
|
|
const extension = filename2.split(".").pop();
|
|
return extension;
|
|
};
|
|
if (filename)
|
|
monacoEditor.filename = filename;
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a, _b;
|
|
const cookies = (_b = (_a = document.cookie) == null ? void 0 : _a.replace(/\s/g, "")) == null ? void 0 : _b.split(";");
|
|
cookies == null ? void 0 : cookies.map((item) => {
|
|
let i = item.split("=");
|
|
if (i[0] === "_educoder_session") {
|
|
setToken(i[1]);
|
|
}
|
|
});
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (type === "office") {
|
|
if (data.indexOf("bigfilescdn.") > -1) {
|
|
setOfficeData({
|
|
url: data,
|
|
fileType: getFileExtension(data),
|
|
model: data.indexOf("model=edit") ? "edit" : "view"
|
|
});
|
|
} else {
|
|
getData();
|
|
}
|
|
}
|
|
}, [type, data]);
|
|
const getData = () => __async(void 0, null, function* () {
|
|
console.log("data:", data);
|
|
let _url = data;
|
|
if (!data.startsWith("http")) {
|
|
_url = location.origin + _url;
|
|
}
|
|
let _id = new URL(_url).pathname.split("/").pop();
|
|
const res = yield (0,exercise/* setEcsAttachment */.gJ)({ attachment_id: _id });
|
|
res.url = apiServer + res.url;
|
|
setOfficeData(res);
|
|
});
|
|
const handleClick = () => {
|
|
if (data.startsWith("http") || data.startsWith("blob:")) {
|
|
handleDown();
|
|
return;
|
|
}
|
|
(0,util/* downloadFile */.Sv)(filename || "educoder", data, filename);
|
|
};
|
|
const handleDown = () => {
|
|
(0,util/* downLoadLink */.Nd)(filename || "educoder", decodeURIComponent(data));
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: __spreadValues({}, style || {}), className: `${hasMask && PreviewAllmodules.bgBlack} ${!!type ? PreviewAllmodules.wrp : "hide"}` }, close && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: PreviewAllmodules.close, ref: closeRef }, !!onImgDimensions && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8", getPopupContainer: () => closeRef.current }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: () => {
|
|
onClose();
|
|
onImgDimensions();
|
|
} }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "icon-yulanpizhu" }))), !disabledDownload && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6", getPopupContainer: () => closeRef.current }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: handleDown }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "icon-quxiaozhiding" }))), /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u5173\u95ED", getPopupContainer: () => closeRef.current }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "", onClick: onClose }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "icon-guanbi1" })))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: `${PreviewAllmodules[className]} ${className} ${PreviewAllmodules.monaco} ${type === "txt" ? "show" : "hide"}` }, type === "txt" && /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
monaco_editor/* default */.ZP,
|
|
__spreadValues({}, monacoEditor)
|
|
))), type === "audio" && /* @__PURE__ */ _react_17_0_2_react.createElement("audio", { src: `${(data == null ? void 0 : data.indexOf("http://")) > -1 || (data == null ? void 0 : data.indexOf("https://")) > -1 ? "" : "data:audio/mp3;base64,"}${data}`, autoPlay: true }), type === "video" && /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, (data == null ? void 0 : data.indexOf("http")) > -1 ? /* @__PURE__ */ _react_17_0_2_react.createElement("video", { controls: true, src: `${data}`, autoPlay: true }) : /* @__PURE__ */ _react_17_0_2_react.createElement("video", { controls: true, src: `data:video/mp4;base64,${data}`, autoPlay: true })), type === "office" && officeData && /* @__PURE__ */ _react_17_0_2_react.createElement("iframe", { src: `${officePath}/office.html?key=${officeData.key}&url=${btoa(officeData.url)}&callbackUrl=${apiServer + officeData.callbackUrl}&fileType=${officeData.fileType}&title=${officeData.title}&model=${editOffice}&officeServer=${env/* default */.Z.ONLYOFFICE}&disabledDownload=${!!disabledDownload}` }), type === "html" && /* @__PURE__ */ _react_17_0_2_react.createElement("iframe", { src: data + "&disposition=inline" }), type === "pdf" && /* @__PURE__ */ _react_17_0_2_react.createElement("iframe", { src: `${officePath}/js/pdfview/index.html?url=${data}&disabledDownload=${!!disabledDownload}` }), type === "image" && /* @__PURE__ */ _react_17_0_2_react.createElement("img", { src: `${(data == null ? void 0 : data.indexOf("http://")) > -1 || (data == null ? void 0 : data.indexOf("https://")) > -1 ? "" : "data:image/png;base64,"}${data}` }), (type === "other" || type === "download") && /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, showNodata ? /* @__PURE__ */ _react_17_0_2_react.createElement(NoData/* default */.Z, { customText: "\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B", ButtonTwo: /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { icon: /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-xiazai4 font14" }), type: "primary", size: "middle", onClick: handleClick }, "\u4E0B\u8F7D") }) : /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "primary", size: "middle", onClick: handleClick }, /* @__PURE__ */ _react_17_0_2_react.createElement(ArrowDownOutlined/* default */.Z, null), "\u70B9\u51FB\u4E0B\u8F7D")));
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 70501:
|
|
/*!**************************************************************************************************!*\
|
|
!*** ./src/pages/Shixuns/Detail/Repository/components/SelectFilePathModal/index.tsx + 1 modules ***!
|
|
\**************************************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ components_SelectFilePathModal; }
|
|
});
|
|
|
|
// 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 + 14 modules
|
|
var _umi_production_exports = __webpack_require__(87210);
|
|
// 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/input/index.js + 5 modules
|
|
var input = __webpack_require__(1056);
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Detail/Repository/components/SelectFilePathModal/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var SelectFilePathModalmodules = ({"wrap":"wrap___TwY3U","content":"content___Ks95W","mainPathWrap":"mainPathWrap___CrMaa","colorBlue":"colorBlue___dvWbP"});
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Detail/Repository/components/SelectFilePathModal/index.tsx
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
const SelectFilePathModal = ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
loading,
|
|
dispatch,
|
|
title,
|
|
pathList: propsPathList = [],
|
|
showInputPath = false,
|
|
isMergeSelectFile = false,
|
|
onFinish = () => {
|
|
}
|
|
}) => {
|
|
const [form] = es_form["default"].useForm();
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const location = (0,_umi_production_exports.useLocation)();
|
|
const isRepository = (0,_react_17_0_2_react.useRef)();
|
|
const [selectPath, setSelectPath] = (0,_react_17_0_2_react.useState)("");
|
|
const [originPath, setOriginPath] = (0,_react_17_0_2_react.useState)("");
|
|
const [mainPathList, setMainPathList] = (0,_react_17_0_2_react.useState)([]);
|
|
const [treeList, setTreeList] = (0,_react_17_0_2_react.useState)([]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a, _b;
|
|
isRepository.current = ((_b = (_a = location.pathname) == null ? void 0 : _a.split("/")) == null ? void 0 : _b[3]) === "repository";
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (shixunsDetail.actionTabs.key !== "Repository-SelectFilePath") {
|
|
return;
|
|
}
|
|
const path = propsPathList.join("/");
|
|
let arr = [];
|
|
propsPathList.map((item, index) => {
|
|
if (index === 0) {
|
|
arr.push({ val: "\u6839\u76EE\u5F55", path: "" }, { val: `/${item}`, path });
|
|
} else {
|
|
arr.push({ val: `/${item}`, path });
|
|
}
|
|
});
|
|
setMainPathList(arr);
|
|
setSelectPath(path);
|
|
setOriginPath(path);
|
|
handleGetPathData(path);
|
|
}, [shixunsDetail.actionTabs.key]);
|
|
const handleGetPathData = (path) => __async(void 0, null, function* () {
|
|
const res = yield dispatch({
|
|
type: isRepository.current ? "shixunsDetail/getRepository" : "shixunsDetail/getSecretRepository",
|
|
payload: {
|
|
id: params.id,
|
|
path
|
|
}
|
|
});
|
|
if (res) {
|
|
setTreeList(res.trees || []);
|
|
}
|
|
});
|
|
const handleClickTree = (item) => {
|
|
let newPath = selectPath;
|
|
if (item.type === "tree") {
|
|
mainPathList.length ? mainPathList.push({ val: `/${item.name}`, path: item.name }) : mainPathList.push({ val: "\u6839\u76EE\u5F55", path: "" }, { val: `/${item.name}`, path: item.name });
|
|
setMainPathList(mainPathList);
|
|
newPath = selectPath ? `${selectPath}/${item.name}` : item.name;
|
|
setSelectPath(newPath);
|
|
}
|
|
handleGetPathData(newPath);
|
|
};
|
|
const handleClickMainPath = (item, index) => {
|
|
const currentPathList = mainPathList.filter((_, key) => key <= index);
|
|
setMainPathList(currentPathList);
|
|
const currentPath = currentPathList.filter((_, key) => key !== 0).map((item2) => item2.val).join("").substr(1);
|
|
setSelectPath(currentPath);
|
|
handleGetPathData(currentPath);
|
|
};
|
|
const handleOk = () => __async(void 0, null, function* () {
|
|
const values = form == null ? void 0 : form.getFieldsValue();
|
|
const path = selectPath ? `${selectPath}${(values == null ? void 0 : values.name) ? `/${values == null ? void 0 : values.name}` : ""}` : values == null ? void 0 : values.name;
|
|
if (isMergeSelectFile) {
|
|
onFinish(path);
|
|
handleCancel();
|
|
return;
|
|
}
|
|
if (showInputPath) {
|
|
yield form.validateFields();
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/uploadGitFolder",
|
|
payload: __spreadValues(__spreadValues({}, {
|
|
id: params.id,
|
|
path
|
|
}), isRepository.current ? {} : { secret_repository: true })
|
|
});
|
|
onFinish(originPath);
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.info("\u65B0\u5EFA\u6210\u529F");
|
|
}
|
|
} else {
|
|
onFinish(path);
|
|
message/* default */.ZP.success("\u9009\u62E9\u6587\u4EF6\u76EE\u5F55\u6210\u529F");
|
|
}
|
|
handleCancel();
|
|
});
|
|
const handleCancel = () => {
|
|
dispatch({
|
|
type: "shixunsDetail/setActionTabs",
|
|
payload: {}
|
|
});
|
|
form.resetFields();
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
centered: true,
|
|
title: title || "\u65B0\u5EFA\u6587\u4EF6\u5939",
|
|
closable: false,
|
|
keyboard: false,
|
|
open: shixunsDetail.actionTabs.key === "Repository-SelectFilePath",
|
|
onOk: handleOk,
|
|
onCancel: handleCancel
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectFilePathModalmodules.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectFilePathModalmodules.content }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectFilePathModalmodules.mainPathWrap }, !!(mainPathList == null ? void 0 : mainPathList.length) && mainPathList.map((item, index) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("a", { key: index, onClick: () => handleClickMainPath(item, index) }, item.val);
|
|
})), !!(treeList == null ? void 0 : treeList.length) && treeList.map((item, index) => {
|
|
return item.type === "tree" && /* @__PURE__ */ _react_17_0_2_react.createElement("a", { key: index, onClick: () => handleClickTree(item) }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: `iconfont icon-wenjianjia ${SelectFilePathModalmodules.colorBlue}` }), item.name);
|
|
})), /* @__PURE__ */ _react_17_0_2_react.createElement("label", { className: "mt5" }, "\u9009\u4E2D\u7684\u65B0\u5EFA\u6587\u4EF6\u5939\u76EE\u5F55\uFF1A"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt5 mb5" }, selectPath), showInputPath && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"],
|
|
{
|
|
form,
|
|
scrollToFirstError: true,
|
|
className: "mt20"
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { name: "name", rules: [{ required: true, message: "\u8BF7\u8F93\u5165\u540D\u79F0" }, { whitespace: true, message: "\u8BF7\u52FF\u8F93\u5165\u7A7A\u683C" }] }, /* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { placeholder: "\u8BF7\u8F93\u5165\u65B0\u6587\u4EF6\u5939\u540D/\u5B50\u6587\u4EF6\u5939\u540D\u3002\uFF08\u5982\uFF1Asrc/step1\uFF09" }))
|
|
))
|
|
);
|
|
};
|
|
/* harmony default export */ var components_SelectFilePathModal = ((0,_umi_production_exports.connect)(
|
|
({
|
|
shixunsDetail,
|
|
loading,
|
|
globalSetting
|
|
}) => ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
loading: loading.models.index
|
|
})
|
|
)(SelectFilePathModal));
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 13687:
|
|
/*!*******************************************************************!*\
|
|
!*** ./src/pages/Shixuns/Detail/Repository/index.tsx + 3 modules ***!
|
|
\*******************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
// ESM COMPAT FLAG
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"default": function() { return /* binding */ Detail_Repository; }
|
|
});
|
|
|
|
// 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 + 14 modules
|
|
var _umi_production_exports = __webpack_require__(87210);
|
|
// 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/tooltip/index.js + 3 modules
|
|
var tooltip = __webpack_require__(6848);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/popover/index.js
|
|
var popover = __webpack_require__(60324);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
var es_button = __webpack_require__(3113);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tree/index.js + 8 modules
|
|
var tree = __webpack_require__(51218);
|
|
// EXTERNAL MODULE: ./node_modules/_react-copy-to-clipboard@5.0.2@react-copy-to-clipboard/lib/index.js
|
|
var lib = __webpack_require__(56102);
|
|
// EXTERNAL MODULE: ./src/components/FixedButton/index.tsx + 1 modules
|
|
var FixedButton = __webpack_require__(41993);
|
|
// EXTERNAL MODULE: ./src/components/PreviewAll/index.tsx + 1 modules
|
|
var PreviewAll = __webpack_require__(11778);
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Detail/Repository/components/Edit/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Editmodules = ({"bg":"bg___ihsIB","wrap":"wrap___H02Km","content":"content___gqaUt","pathWrap":"pathWrap___EC4ja","pathContent":"pathContent___o2I24"});
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Detail/Repository/components/Edit/index.tsx
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Edit = ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
loading,
|
|
user,
|
|
dispatch,
|
|
content,
|
|
fixedButtonVisible = true,
|
|
pathList = [],
|
|
onSetShowContent = () => {
|
|
},
|
|
onClickRootPath = () => {
|
|
},
|
|
onClickOhterPath = () => {
|
|
}
|
|
}) => {
|
|
var _a, _b;
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const location = (0,_umi_production_exports.useLocation)();
|
|
const isRepository = (0,_react_17_0_2_react.useRef)();
|
|
const [codeMirrorValue, setCodeMirrorValue] = (0,_react_17_0_2_react.useState)();
|
|
const editable = (_b = (_a = user.userInfo) == null ? void 0 : _a.shixun) == null ? void 0 : _b.editable;
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
dispatch({
|
|
type: "globalSetting/footerToggle",
|
|
payload: false
|
|
});
|
|
return () => {
|
|
dispatch({
|
|
type: "globalSetting/footerToggle",
|
|
payload: true
|
|
});
|
|
};
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a2, _b2;
|
|
isRepository.current = ((_b2 = (_a2 = location.pathname) == null ? void 0 : _a2.split("/")) == null ? void 0 : _b2[3]) === "repository";
|
|
}, [location.pathname]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
try {
|
|
if (!!((_c = (_b2 = (_a2 = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _a2.content) == null ? void 0 : _b2.content) == null ? void 0 : _c.length) || ((_e = (_d = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _d.content) == null ? void 0 : _e.content) == "") {
|
|
if (((_f = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _f.file_type) === "txt") {
|
|
setCodeMirrorValue(window.decodeURIComponent(escape(window.atob((_h = (_g = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _g.content) == null ? void 0 : _h.content))));
|
|
} else {
|
|
setCodeMirrorValue((_j = (_i = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _i.content) == null ? void 0 : _j.content);
|
|
}
|
|
}
|
|
} catch (e) {
|
|
setCodeMirrorValue(window.atob((_l = (_k = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _k.content) == null ? void 0 : _l.content));
|
|
}
|
|
}, [content]);
|
|
const handleSave = () => __async(void 0, null, function* () {
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/updateRepositoryFile",
|
|
payload: {
|
|
id: params.id,
|
|
path: (pathList == null ? void 0 : pathList.length) ? pathList.join("/") : "",
|
|
content: codeMirrorValue,
|
|
secret_repository: isRepository.current ? null : true
|
|
}
|
|
});
|
|
if (res) {
|
|
message/* default */.ZP.info("\u4FDD\u5B58\u6210\u529F");
|
|
const item = pathList.length > 1 ? pathList[pathList.length - 2] : "";
|
|
item ? onClickOhterPath(item, pathList.length - 2) : onClickRootPath();
|
|
}
|
|
});
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: Editmodules.bg }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Editmodules.wrap }, !!(pathList == null ? void 0 : pathList.length) && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Editmodules.pathWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Editmodules.pathContent }, /* @__PURE__ */ _react_17_0_2_react.createElement("a", { onClick: onClickRootPath }, params.id), pathList.map((item, index) => {
|
|
if (index === pathList.length - 1) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("span", { key: index }, " / ", item);
|
|
}
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("a", { onClick: () => onClickOhterPath(item, index) }, " / ", item);
|
|
}))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt20", style: { position: "relative", minHeight: 500 } }, content && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
PreviewAll/* default */.Z,
|
|
{
|
|
filename: content.filename,
|
|
type: content.file_type === "office" ? "download" : content.file_type,
|
|
data: codeMirrorValue,
|
|
style: { position: "absolute", zIndex: 1 },
|
|
monacoEditor: {
|
|
value: codeMirrorValue,
|
|
language: content == null ? void 0 : content.language,
|
|
theme: "vs",
|
|
// onChange: onCodeChange,
|
|
// onSave: onSave,
|
|
// forbidCopy: forbidCopy,
|
|
options: {
|
|
readOnly: true
|
|
}
|
|
}
|
|
}
|
|
))), fixedButtonVisible && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
FixedButton/* FixedButton */.t,
|
|
{
|
|
okText: "\u4FDD\u5B58",
|
|
hasOkBtn: editable,
|
|
onCancel: () => onSetShowContent(true),
|
|
onOk: handleSave
|
|
}
|
|
));
|
|
};
|
|
/* harmony default export */ var components_Edit = ((0,_umi_production_exports.connect)(
|
|
({
|
|
shixunsDetail,
|
|
loading,
|
|
globalSetting,
|
|
user
|
|
}) => ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
user,
|
|
loading: loading.models.index
|
|
})
|
|
)(Edit));
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Detail/Repository/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Repositorymodules = ({"bg":"bg___D4cwy","contentbg":"contentbg___Id0pg","wrap":"wrap___MSDnd","modal":"modal___wkS0s","head":"head___e9UA3","headLeft":"headLeft____KVI7","headInputWrap":"headInputWrap___KpP4V","popover":"popover___TGO24","info":"info___f5jtZ","infoUser":"infoUser___syQV8","infoSubmitText":"infoSubmitText___wLlcr","deleteWrap":"deleteWrap___C2Nvj","content":"content___jG0lY","pl23":"pl23___DFTpV","colorBlue":"colorBlue___RBryy","pathContent":"pathContent___vCyoJ","nodata":"nodata___piT_j","nodataText":"nodataText___EquBb"});
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
var env = __webpack_require__(64741);
|
|
// EXTERNAL MODULE: ./src/pages/Shixuns/Detail/components/Right/index.tsx + 4 modules
|
|
var Right = __webpack_require__(97206);
|
|
// EXTERNAL MODULE: ./src/pages/Shixuns/Detail/Repository/components/SelectFilePathModal/index.tsx + 1 modules
|
|
var SelectFilePathModal = __webpack_require__(70501);
|
|
// EXTERNAL MODULE: ./src/service/shixuns.ts
|
|
var shixuns = __webpack_require__(86151);
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Detail/Repository/index.tsx
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && __getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var Repository_async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Repository = (_a) => {
|
|
var _b = _a, {
|
|
shixunsDetail,
|
|
globalSetting,
|
|
loading,
|
|
user,
|
|
dispatch
|
|
} = _b, props = __objRest(_b, [
|
|
"shixunsDetail",
|
|
"globalSetting",
|
|
"loading",
|
|
"user",
|
|
"dispatch"
|
|
]);
|
|
var _a2, _b2, _c, _d;
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const location = (0,_umi_production_exports.useLocation)();
|
|
const isRepository = (0,_react_17_0_2_react.useRef)();
|
|
const [showContent, setShowContent] = (0,_react_17_0_2_react.useState)(true);
|
|
const [treeList, setTreeList] = (0,_react_17_0_2_react.useState)([]);
|
|
const [gitUrl, setGitUrl] = (0,_react_17_0_2_react.useState)();
|
|
const [commitInfo, setCommitInfo] = (0,_react_17_0_2_react.useState)();
|
|
const [checkedValue, setCheckedValue] = (0,_react_17_0_2_react.useState)();
|
|
const [pathList, setPathList] = (0,_react_17_0_2_react.useState)([]);
|
|
const [editContent, setEditContent] = (0,_react_17_0_2_react.useState)();
|
|
const [secretDirPath, setSecretDirPath] = (0,_react_17_0_2_react.useState)();
|
|
const [isMergeSelectFile, setIsMergeSelectFile] = (0,_react_17_0_2_react.useState)(false);
|
|
const [newMergeValue, setNewMergeValue] = (0,_react_17_0_2_react.useState)();
|
|
const editable = false;
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a3, _b3;
|
|
const repository = ((_b3 = (_a3 = location.pathname) == null ? void 0 : _a3.split("/")) == null ? void 0 : _b3[3]) === "repository";
|
|
if (location.pathname.includes("/master/shixun_show")) {
|
|
isRepository.current = repository;
|
|
const splitPathList = location.pathname.split("/");
|
|
if (splitPathList.length > 5) {
|
|
const paths = splitPathList.splice(6, splitPathList.length);
|
|
setPathList(paths);
|
|
const path = (paths == null ? void 0 : paths.length) ? paths.join("/") : "";
|
|
handleGetRepository(path);
|
|
}
|
|
return;
|
|
}
|
|
if (isRepository.current !== repository) {
|
|
isRepository.current = repository;
|
|
setShowContent(true);
|
|
handleGetRepository();
|
|
setPathList([]);
|
|
}
|
|
}, [location.pathname]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
}, [location.pathname]);
|
|
const handleGetRepository = (path = "") => Repository_async(void 0, null, function* () {
|
|
var _a3;
|
|
const res = yield dispatch({
|
|
type: isRepository.current ? "shixunsDetail/getRepository" : "shixunsDetail/getSecretRepository",
|
|
payload: {
|
|
id: params.id,
|
|
path
|
|
}
|
|
});
|
|
if (res) {
|
|
setTreeList(res.trees || []);
|
|
setSecretDirPath((res == null ? void 0 : res.secret_dir_path) || "");
|
|
setGitUrl(res.git_url || "");
|
|
setCommitInfo(((_a3 = res.commits) == null ? void 0 : _a3[0]) || {});
|
|
}
|
|
});
|
|
const handleMergeSelectFile = (path = "") => Repository_async(void 0, null, function* () {
|
|
const res = yield (0,shixuns/* setSecretDir */.Zt)({ id: params.id, secret_dir_path: path });
|
|
res && setNewMergeValue(path);
|
|
});
|
|
const handleGetRepositoryCode = (path = "") => Repository_async(void 0, null, function* () {
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/getFileContent",
|
|
payload: {
|
|
id: params.id,
|
|
path,
|
|
secret_repository: isRepository.current ? null : true
|
|
}
|
|
});
|
|
if ((res == null ? void 0 : res.status) === -2) {
|
|
return res;
|
|
}
|
|
if ((res == null ? void 0 : res.status) === -1) {
|
|
return res;
|
|
}
|
|
if (res) {
|
|
setShowContent(false);
|
|
setEditContent(res);
|
|
}
|
|
return res;
|
|
});
|
|
const handleSelectTree = (selectedKeys) => Repository_async(void 0, null, function* () {
|
|
const selected = selectedKeys == null ? void 0 : selectedKeys[0];
|
|
const findTree = treeList.find((item) => item.name === selected);
|
|
if (!findTree) {
|
|
return;
|
|
}
|
|
const paths = [...pathList, selected];
|
|
const path = (paths == null ? void 0 : paths.length) ? paths.join("/") : "";
|
|
if (findTree.type === "blob") {
|
|
const res = yield handleGetRepositoryCode(path);
|
|
if ((res == null ? void 0 : res.status) !== -1 && (res == null ? void 0 : res.status) !== -2) {
|
|
setPathList(paths);
|
|
}
|
|
return;
|
|
}
|
|
setPathList(paths);
|
|
handleGetRepository(path);
|
|
});
|
|
const handleDeleteFile = () => {
|
|
if (!checkedValue) {
|
|
message/* default */.ZP.info("\u8BF7\u9009\u62E9\u8981\u5220\u9664\u7684\u6587\u4EF6");
|
|
return;
|
|
}
|
|
modal["default"].confirm({
|
|
centered: true,
|
|
title: "\u786E\u8BA4\u9700\u8981\u5220\u9664\u8BE5\u6587\u4EF6?",
|
|
okText: "\u786E\u5B9A",
|
|
cancelText: "\u53D6\u6D88",
|
|
onOk: () => Repository_async(void 0, null, function* () {
|
|
const path = (pathList == null ? void 0 : pathList.length) ? pathList.join("/") : "";
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/deleteGitFile",
|
|
payload: {
|
|
id: params.id,
|
|
path: path ? `${path}/${checkedValue}` : checkedValue,
|
|
message: `\u5220\u9664${path}`,
|
|
secret_repository: isRepository.current ? null : true
|
|
}
|
|
});
|
|
if (res) {
|
|
message/* default */.ZP.info("\u5220\u9664\u6210\u529F");
|
|
handleGetRepository(path);
|
|
setCheckedValue(null);
|
|
}
|
|
})
|
|
});
|
|
};
|
|
const handleClickRootPath = () => {
|
|
setShowContent(true);
|
|
setPathList([]);
|
|
handleGetRepository();
|
|
};
|
|
const handleClickOhterPath = (item, index) => {
|
|
setShowContent(true);
|
|
const paths = pathList.filter((_, key) => key <= index);
|
|
setPathList(paths);
|
|
const path = (paths == null ? void 0 : paths.length) ? paths.join("/") : "";
|
|
handleGetRepository(path);
|
|
};
|
|
const handleCheckTree = (checked) => {
|
|
setCheckedValue(checked == null ? void 0 : checked[0]);
|
|
};
|
|
const treeData = treeList == null ? void 0 : treeList.map((item, index) => {
|
|
return {
|
|
title: /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "font14 pt5 pb5" }, item.type === "tree" ? /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: `iconfont icon-xingzhuangjiehebeifen font12 ${Repositorymodules.colorBlue} mr5` }) : /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: `iconfont icon-xingzhuangjiehe font12 ${Repositorymodules.colorBlue} mr5` }), item.name),
|
|
// disableCheckbox: checkedValue && (checkedValue !== item.name),
|
|
// className: item.type === 'tree' ? styles.pl23 : '',
|
|
// checkable: item.type !== 'tree',
|
|
key: item.name
|
|
};
|
|
});
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: Repositorymodules.bg }, showContent ? /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Repositorymodules.contentbg }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Repositorymodules.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Repositorymodules.head }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Repositorymodules.headLeft }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, "\u7F51\u5740\u514B\u9686\uFF1A"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: `${Repositorymodules.headInputWrap} mr5` }, /* @__PURE__ */ _react_17_0_2_react.createElement("input", { defaultValue: gitUrl }), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
lib.CopyToClipboard,
|
|
{
|
|
text: gitUrl,
|
|
onCopy: () => message/* default */.ZP.success("\u590D\u5236\u6210\u529F")
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { placement: "topLeft", title: "\u70B9\u51FB\u590D\u5236\u7248\u672C\u5E93" }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-fuzhi2 current ml5" }))
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
popover/* default */.Z,
|
|
{
|
|
overlayClassName: Repositorymodules.popover,
|
|
placement: "bottomRight",
|
|
content: /* @__PURE__ */ _react_17_0_2_react.createElement("p", { className: "font12" }, "\u8BF7\u4E0A\u4F20\u5F53\u524D\u5B9E\u8BAD\u4E2D\u5404\u4E2A\u5173\u5361\u6D89\u53CA\u7684\u6240\u6709\u6587\u4EF6", /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), "\u5305\u62EC\u4EFB\u52A1\u6587\u4EF6\u3001\u6267\u884C\u6587\u4EF6\uFF0C\u4EE5\u53CA\u5176\u4ED6\u7684\u5FC5\u987B\u6587\u4EF6", /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), "\u63D0\u4EA4\u4EE3\u7801\u7684\u65B9\u6CD5\uFF1A", /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), "1\u3001\u5728\u7535\u8111\u4E0A\u5B89\u88C5Git tortoise\u5BA2\u6237\u7AEF\uFF0C", /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), "\u6216\u8005\u5176\u5B83\u719F\u6089\u7684Git\u5BA2\u6237\u7AEF,\u5728Git\u5BA2\u6237\u7AEF\u4E0A\u5411\u5DE6\u4FA7\u7684\u5730\u5740\u63D0\u4EA4\u4EE3\u7801", /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), "2.\u76F4\u63A5\u5728\u5E73\u53F0\u4E0A\u65B0\u5EFA\u6587\u4EF6/\u6587\u4EF6\u5939\uFF0C\u6216\u8005\u62D6\u62FD\u4E0A\u4F20\u76F8\u5173\u4EE3\u7801\u6587\u4EF6", /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), "\u6CE8\u610F:", /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), "\u8BF7\u5728Git\u5BA2\u6237\u7AEF\u8981\u6C42\u586B\u5199\u65F6\uFF0C\u6309\u7167\u5982\u4E0B\u8BF4\u660E\u586B\u5199\uFF1A", /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), "* \u7528\u6237\u540D\uFF1A\u4F7F\u7528\u60A8\u5728\u672C\u5E73\u53F0\u7ED1\u5B9A\u7684\u90AE\u7BB1", /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), "* \u53E3\u4EE4\uFF1A\u4F7F\u7528\u60A8\u5728\u672C\u5E73\u53F0\u7684\u767B\u5F55\u53E3\u4EE4"),
|
|
trigger: "click"
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-tishi2" })
|
|
)), editable && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Repositorymodules.actionWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "primary", className: "mr5", onClick: () => {
|
|
window.sessionStorage.setItem("pathArray", pathList.join(","));
|
|
_umi_production_exports.history.push(`/shixuns/${params.id}/${isRepository.current ? "repository" : "secret_repository"}/upload_file`);
|
|
} }, "\u4E0A\u4F20\u6587\u4EF6"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "primary", className: "mr5", onClick: () => {
|
|
window.sessionStorage.setItem("pathArray", pathList.join(","));
|
|
_umi_production_exports.history.push(`/shixuns/${params.id}/${isRepository.current ? "repository" : "secret_repository"}/add_file`);
|
|
} }, "\u65B0\u5EFA\u6587\u4EF6"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "primary", className: "mr5", onClick: () => {
|
|
setIsMergeSelectFile(false);
|
|
dispatch({
|
|
type: "shixunsDetail/setActionTabs",
|
|
payload: { key: "Repository-SelectFilePath" }
|
|
});
|
|
} }, "\u65B0\u5EFA\u6587\u4EF6\u5939"))), !isRepository.current && /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "pt40 pl20 pr20 font14 c-orange" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\u79C1\u5BC6\u7248\u672C\u5E93\u7684\u6587\u4EF6\u5BF9\u5B66\u5458\u59CB\u7EC8\u9690\u85CF\uFF0C\u65E0\u6CD5\u8BBF\u95EE\u67E5\u770B\u3002 "), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\u82E5\u8BC4\u6D4B\u5B66\u5458\u4EFB\u52A1\u9700\u8981\u4F7F\u7528\u79C1\u5BC6\u7248\u672C\u5E93\u7684\u6587\u4EF6\uFF0C\u8BF7\u6307\u5B9A\u5C06\u79C1\u5BC6\u7248\u672C\u5E93\u5408\u5E76\u5230\u5E38\u89C4\u7248\u672C\u5E93\u7684\u76EE\u6807\u8DEF\u5F84\uFF0C\u4EE5\u786E\u4FDD\u8BC4\u6D4B\u65F6\u80FD\u8BBF\u95EE\u79C1\u5BC6\u7248\u672C\u5E93\u7684\u6587\u4EF6\u3002"))), treeData.length ? /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Repositorymodules.info }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Repositorymodules.infoUser }, (commitInfo == null ? void 0 : commitInfo.author) && /* @__PURE__ */ _react_17_0_2_react.createElement("img", { width: "35", height: "35", alt: (_a2 = commitInfo == null ? void 0 : commitInfo.author) == null ? void 0 : _a2.name, src: `${env/* default */.Z.IMG_SERVER}/${(_b2 = commitInfo == null ? void 0 : commitInfo.author) == null ? void 0 : _b2.image_url}` }), /* @__PURE__ */ _react_17_0_2_react.createElement("a", { href: (_c = commitInfo == null ? void 0 : commitInfo.author) == null ? void 0 : _c.user_url, target: "_blank", className: `mr5` }, (_d = commitInfo == null ? void 0 : commitInfo.author) == null ? void 0 : _d.name), /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, "\u63D0\u4EA4\u4E8E", /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, commitInfo == null ? void 0 : commitInfo.time), " \uFF1A", commitInfo == null ? void 0 : commitInfo.title)), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { onClick: () => _umi_production_exports.history.push(`/shixuns/${params.id}/${isRepository.current ? "repository" : "secret_repository"}/${params.id}/commits`) }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-tijiaojilu font18 mr5" }), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: `${Repositorymodules.infoSubmitText} current` }, "\u63D0\u4EA4\u8BB0\u5F55"))), !!(pathList == null ? void 0 : pathList.length) && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Repositorymodules.pathWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Repositorymodules.pathContent }, /* @__PURE__ */ _react_17_0_2_react.createElement("a", { onClick: handleClickRootPath }, params.id), pathList.map((item, index) => {
|
|
if (index === pathList.length - 1) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, " / ", item);
|
|
}
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("a", { onClick: () => handleClickOhterPath(item, index) }, " / ", item);
|
|
}))), editable && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Repositorymodules.deleteWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { className: "font14", type: "link", onClick: handleDeleteFile }, "\u5220\u9664")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Repositorymodules.content }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
tree["default"],
|
|
{
|
|
checkable: editable,
|
|
treeData,
|
|
onSelect: handleSelectTree,
|
|
onCheck: handleCheckTree
|
|
}
|
|
))) : /* @__PURE__ */ _react_17_0_2_react.createElement(NoData, null))), /* @__PURE__ */ _react_17_0_2_react.createElement(Right/* default */.Z, null)) : /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
components_Edit,
|
|
{
|
|
content: editContent,
|
|
pathList,
|
|
fixedButtonVisible: false,
|
|
onSetShowContent: (flag) => {
|
|
const paths = (pathList == null ? void 0 : pathList.length) ? pathList == null ? void 0 : pathList.filter((_, index) => index !== pathList.length - 1) : [];
|
|
setPathList(paths);
|
|
setShowContent(flag);
|
|
},
|
|
onClickRootPath: handleClickRootPath,
|
|
onClickOhterPath: handleClickOhterPath
|
|
}
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
SelectFilePathModal/* default */.Z,
|
|
{
|
|
pathList,
|
|
showInputPath: true,
|
|
isMergeSelectFile,
|
|
onFinish: (path) => {
|
|
isMergeSelectFile ? handleMergeSelectFile(path) : handleGetRepository(path);
|
|
setIsMergeSelectFile(false);
|
|
}
|
|
}
|
|
));
|
|
};
|
|
const NoData = () => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: `tc mt20 pb50 ${Repositorymodules.nodata}` }, /* @__PURE__ */ _react_17_0_2_react.createElement("img", { src: `${env/* default */.Z.IMG_SERVER}/images/educoder/RepositoryNoneData.png` }), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Repositorymodules.nodataText }, "\u6B64\u5904\u5B58\u653E\u672C\u5B9E\u8BAD\u6240\u9700\u7684\u6240\u6709\u4EE3\u7801\u7B49\u76F8\u5173\u6587\u4EF6\uFF0C\u4F60\u53EF\u4EE5\u901A\u8FC7\u4EE5\u4E0B\u4E24\u79CD\u65B9\u5F0F\u6765\u4F7F\u7528\uFF1A"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Repositorymodules.nodataText }, "1\u3001", /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, /* @__PURE__ */ _react_17_0_2_react.createElement("a", { href: "/forums/2784", target: "_blank" }, "Git\u5BA2\u6237\u7AEF")), "\u4E0A\u4F20\u5DF2\u6709\u6587\u4EF6\u6765\u5F00\u59CB\u4F7F\u7528\u3002"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: `${Repositorymodules.nodataText}` }, "2\u3001\u76F4\u63A5\u5728\u5E73\u53F0\u4E0A\u521B\u5EFA\u6587\u4EF6\u76EE\u5F55\u4EE5\u53CA\u76F8\u5173\u4EE3\u7801\u6587\u4EF6\u3002"));
|
|
};
|
|
/* harmony default export */ var Detail_Repository = ((0,_umi_production_exports.connect)(
|
|
({
|
|
shixunsDetail,
|
|
loading,
|
|
globalSetting,
|
|
user
|
|
}) => ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
user,
|
|
loading: loading.models.index
|
|
})
|
|
)(Repository));
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |