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/2360.async.js

1797 lines
76 KiB

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[2360],{
/***/ 34829:
/*!*************************************!*\
!*** ./src/pages/tasks/constant.js ***!
\*************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ $Y: function() { return /* binding */ SET_EDITOR_THEME; },
/* harmony export */ A0: function() { return /* binding */ HIDE_EVALUATE_LOADING; },
/* harmony export */ EP: function() { return /* binding */ HIDE_EVALUATE_RESULT; },
/* harmony export */ F_: function() { return /* binding */ MOVE_X; },
/* harmony export */ G9: function() { return /* binding */ UPDATE_TIMESTRAP; },
/* harmony export */ GB: function() { return /* binding */ FETCH_REP_CONTENT; },
/* harmony export */ GR: function() { return /* binding */ GET_DISCUSSES; },
/* harmony export */ GW: function() { return /* binding */ SET_SHOW_DIR; },
/* harmony export */ Hp: function() { return /* binding */ SHOW_TASK_LIST; },
/* harmony export */ Ir: function() { return /* binding */ FETCH_TASK_FAILURE; },
/* harmony export */ N$: function() { return /* binding */ EDIT_REP_CODE; },
/* harmony export */ NZ: function() { return /* binding */ HIDE_TIP_MODAL; },
/* harmony export */ Nv: function() { return /* binding */ HIDE_NOTICE; },
/* harmony export */ OA: function() { return /* binding */ HIDE_PICTURE_VIEW; },
/* harmony export */ OJ: function() { return /* binding */ SET_CHOOSE_ANSWERS; },
/* harmony export */ QF: function() { return /* binding */ ON_AUTO_FORMAT; },
/* harmony export */ RS: function() { return /* binding */ SHOW_REWARD_DIALOG; },
/* harmony export */ RY: function() { return /* binding */ SET_VNC_LOADING; },
/* harmony export */ Rj: function() { return /* binding */ SHOW_TIP_MODAL; },
/* harmony export */ SX: function() { return /* binding */ ACTIVE_DISCUSS_INDEX; },
/* harmony export */ Tp: function() { return /* binding */ SET_EDITOR_FONTSIZE; },
/* harmony export */ Ui: function() { return /* binding */ SHOW_EVALUATE_LOADING; },
/* harmony export */ V1: function() { return /* binding */ EVAL_CHOOSE_END; },
/* harmony export */ Vn: function() { return /* binding */ SET_REWARD; },
/* harmony export */ dL: function() { return /* binding */ SHOW_NOTICE; },
/* harmony export */ fo: function() { return /* binding */ DISABLE_DISCUSS; },
/* harmony export */ gK: function() { return /* binding */ TRIGGER_TAB_FIXED; },
/* harmony export */ hK: function() { return /* binding */ HIDE_TASK_LIST; },
/* harmony export */ i3: function() { return /* binding */ TRIGGER_RIGHT_PANEL_MASK; },
/* harmony export */ ib: function() { return /* binding */ SET_TASK_STAR; },
/* harmony export */ lS: function() { return /* binding */ TRIGGER_ENLARGE_UNITY3D; },
/* harmony export */ m5: function() { return /* binding */ SHOW_EVALUATE_RESULT; },
/* harmony export */ n4: function() { return /* binding */ FETCH_TASK_START; },
/* harmony export */ n_: function() { return /* binding */ SET_ACTIVE_INDEX; },
/* harmony export */ oP: function() { return /* binding */ SET_REPOS; },
/* harmony export */ p2: function() { return /* binding */ SET_EVALUATE_MESSAGE; },
/* harmony export */ pl: function() { return /* binding */ FETCH_ANSWER_INFO; },
/* harmony export */ rM: function() { return /* binding */ PLUS_DISCUSS; },
/* harmony export */ sM: function() { return /* binding */ GET_TASK_LIST; },
/* harmony export */ t2: function() { return /* binding */ CANCEL_REWARD_DIALOG; },
/* harmony export */ tD: function() { return /* binding */ SHOW_DISCUSSES_LOADING; },
/* harmony export */ u8: function() { return /* binding */ TOP_OR_DOWN_DISCUSS; },
/* harmony export */ um: function() { return /* binding */ ON_TAB_TO_SPACE; },
/* harmony export */ vm: function() { return /* binding */ SHOW_PICTURE_VIEW; },
/* harmony export */ wQ: function() { return /* binding */ MOVE_Y; },
/* harmony export */ wj: function() { return /* binding */ EVAL_CHOOSE_START; },
/* harmony export */ wt: function() { return /* binding */ SHOW_ANSWER_LOADING; },
/* harmony export */ yS: function() { return /* binding */ SET_ACTION_TYPE; },
/* harmony export */ yi: function() { return /* binding */ FETCH_TASK_SUCCESS; },
/* harmony export */ ym: function() { return /* binding */ SELECT_UNLOCK_ANSWER; },
/* harmony export */ z2: function() { return /* binding */ UPDATE_TASK_DATA; }
/* harmony export */ });
/* unused harmony exports CREATE_DISCUSS, SHOW_REP_LOADING, SET_REP_PATH, SET_EDITOR_SETTING, SHOW_PATH_LIST, HIDE_PATH_LIST, SET_TAB_INDEX, SET_SSH_TABS, SET_SSH_CONFIGDATA, SET_SSH_CONFIGDATAARR */
const FETCH_TASK_START = "FETCH_TASK_START";
const FETCH_TASK_FAILURE = "FETCH_TASK_FAILURE";
const FETCH_TASK_SUCCESS = "FETCH_TASK_SUCCESS";
const UPDATE_TASK_DATA = "UPDATE_TASK_DATA";
const HIDE_EVALUATE_RESULT = "HIDE_EVALUATE_RESULT";
const SHOW_EVALUATE_RESULT = "SHOW_EVALUATE_RESULT";
const UPDATE_TIMESTRAP = "UPDATE_TIMESTRAP";
const MOVE_X = "MOVE_X";
const MOVE_Y = "MOVE_Y";
const TRIGGER_RIGHT_PANEL_MASK = "TRIGGER_RIGHT_PANEL_MASK ";
const SET_ACTIVE_INDEX = "SET_ACTIVE_INDEX";
const GET_TASK_LIST = "GET_TASK_LIST";
const SHOW_TASK_LIST = "SHOW_TASK_LIST";
const HIDE_TASK_LIST = "HIDE_TASK_LIST";
const SET_TASK_STAR = "SET_TASK_STAR";
const TRIGGER_ENLARGE_UNITY3D = "TRIGGER_ENLARGE_UNITY3D ";
const TRIGGER_TAB_FIXED = "TRIGGER_TAB_FIXED ";
const GET_DISCUSSES = "GET_DISCUSSES";
const SHOW_DISCUSSES_LOADING = "SHOW_DISCUSSES_LOADING";
const TOP_OR_DOWN_DISCUSS = "TOP_OR_DOWN_DISCUSS";
const PLUS_DISCUSS = "PLUS_DISCUSS";
const SET_ACTION_TYPE = "SET_ACTION_TYPE";
const SHOW_REWARD_DIALOG = "SHOW_REWARD_DIALOG";
const CANCEL_REWARD_DIALOG = "CANCEL_REWARD_DIALOG";
const SET_REWARD = "SET_REWARD";
const ACTIVE_DISCUSS_INDEX = "ACTIVE_DISCUSS_INDEX";
const CREATE_DISCUSS = "CREATE_DISCUSS";
const DISABLE_DISCUSS = "DISABLE_DISCUSS";
const SHOW_ANSWER_LOADING = "SHOW_ANSWER_LOADING";
const FETCH_ANSWER_INFO = "FETCH_ANSWER_INFO";
const HIDE_TIP_MODAL = "HIGH_TIP_MODAL";
const SHOW_TIP_MODAL = "SHOW_TIP_MODAL";
const SELECT_UNLOCK_ANSWER = "SELECT_UNLOCK_ANSWER";
const SET_CHOOSE_ANSWERS = "SET_CHOOSE_ANSWERS";
const EVAL_CHOOSE_START = "EVAL_CHOOSE_START";
const EVAL_CHOOSE_END = "EVAL_CHOOSE_END";
const SHOW_REP_LOADING = "SHOW_REP_loading";
const FETCH_REP_CONTENT = "FETCH_REP_CONTENT";
const EDIT_REP_CODE = "EDIT_REP_CONTENT";
const SET_REP_PATH = "SET_REP_PATH";
const SHOW_EVALUATE_LOADING = "SHOW_EVALUATE_LOADING";
const HIDE_EVALUATE_LOADING = "HIDE_EVALUATE_LOADING";
const SET_EVALUATE_MESSAGE = "SET_EVALUATE_MESSAGE";
const SET_SHOW_DIR = "SET_SHOW_DIR";
const SET_EDITOR_SETTING = "SET_EDITOR_SETTING";
const SET_EDITOR_THEME = "SET_EDITOR_THEME";
const SET_EDITOR_FONTSIZE = "SET_EDITOR_FONTSIZE";
const SET_REPOS = "SET_REPOS";
const SHOW_PATH_LIST = "SHOW_PATH_LIST";
const HIDE_PATH_LIST = "HIDE_PATH_LIST";
const HIDE_PICTURE_VIEW = "HIDE_PICTURE_VIEW";
const SHOW_PICTURE_VIEW = "SHOW_PICTURE_VIEW";
const SHOW_NOTICE = "SHOW_NOTICE";
const HIDE_NOTICE = "HIDE_NOTICE";
const SET_TAB_INDEX = "SET_TAB_INDEX";
const SET_SSH_TABS = "SET_SSH_TABS";
const SET_SSH_CONFIGDATA = "SET_SSH_CONFIGDATA";
const SET_SSH_CONFIGDATAARR = "SET_SSH_CONFIGDATAARR";
const SET_VNC_LOADING = "SET_VNC_LOADING ";
const ON_TAB_TO_SPACE = "ON_TAB_TO_SPACE ";
const ON_AUTO_FORMAT = "ON_AUTO_FORMAT ";
/***/ }),
/***/ 41196:
/*!*******************************************************!*\
!*** ./src/pages/tasks/left-panel/discuss/service.js ***!
\*******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ KQ: function() { return /* binding */ submitDiscusses; },
/* harmony export */ KY: function() { return /* binding */ deleteDiscuss; },
/* harmony export */ OY: function() { return /* binding */ hiddenDiscuss; },
/* harmony export */ S8: function() { return /* binding */ rewardDiscuss; },
/* harmony export */ U_: function() { return /* binding */ aiReply; },
/* harmony export */ _Z: function() { return /* binding */ disableDiscuss; },
/* harmony export */ ae: function() { return /* binding */ plusDiscuss; },
/* harmony export */ o7: function() { return /* binding */ fetchDiscusses; },
/* harmony export */ rd: function() { return /* binding */ createDiscuss; },
/* harmony export */ wJ: function() { return /* binding */ topOrDownDiscuss; },
/* harmony export */ wg: function() { return /* binding */ replyDiscuss; }
/* harmony export */ });
/* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/utils/fetch */ 64841);
function fetchDiscusses(shixunIdentifier, page = 1) {
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .get */ .U2)(
`/discusses.json`,
{
container_type: "Shixun",
container_identifier: shixunIdentifier,
page: page - 1
}
);
}
function topOrDownDiscuss(id, top) {
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)(`/discusses/${id}/top_or_down_discuss.json`, { top });
}
function disableDiscuss(id, is_disable) {
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)(`/discusses/${id}/disable_or_open_discuss.json`, {
is_disable: !!is_disable
});
}
function plusDiscuss(id, user_praise) {
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)(`/discusses/${id}/plus.json`, {
container_type: "Discuss",
type: user_praise ? 1 : 0
});
}
function hiddenDiscuss(id, params) {
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)(`/discusses/${id}/hidden.json`, params);
}
function rewardDiscuss(id, params) {
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)(`/discusses/${id}/reward_code.json`, params);
}
function deleteDiscuss(id) {
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .ZP)(`/api/discusses/${id}.json`, {
method: "delete"
});
}
function replyDiscuss(id, content) {
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)(`/discusses/${id}/reply.json`, {
container_type: "Shixun",
content
});
}
function createDiscuss(params) {
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)(`/discusses.json`, params);
}
function aiReply(params) {
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)(`/discusses/ai_reply.json`, params);
}
function submitDiscusses(id, content) {
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)(`/discusses/${id}/turing.json`, content);
}
/***/ }),
/***/ 18343:
/*!******************************************************!*\
!*** ./src/components/Spinner/index.tsx + 1 modules ***!
\******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ Spinner; }
});
// 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 + 15 modules
var _umi_production_exports = __webpack_require__(23852);
;// CONCATENATED MODULE: ./src/components/Spinner/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Spinnermodules = ({"ldsRing":"ldsRing___mpBZC","idsRingWrapper":"idsRingWrapper___Of9_n","ldsring":"ldsring___o0w2t"});
;// CONCATENATED MODULE: ./src/components/Spinner/index.tsx
/* harmony default export */ var Spinner = (({ message, className, children, style = {} }) => {
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: `${Spinnermodules.idsRingWrapper} ${className}` }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Spinnermodules.ldsRing }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null)), message ? /* @__PURE__ */ _react_17_0_2_react.createElement("p", { style }, message) : null, /* @__PURE__ */ _react_17_0_2_react.createElement(_umi_production_exports.Outlet, null));
});
/***/ }),
/***/ 35894:
/*!************************************************************!*\
!*** ./src/components/image-preview/index.tsx + 1 modules ***!
\************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ image_preview; }
});
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
;// CONCATENATED MODULE: ./src/components/image-preview/index.less
// extracted by mini-css-extract-plugin
// EXTERNAL MODULE: ./src/components/mediator.js
var mediator = __webpack_require__(50993);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/image/index.js + 26 modules
var es_image = __webpack_require__(10211);
;// CONCATENATED MODULE: ./src/components/image-preview/index.tsx
/* harmony default export */ var image_preview = (() => {
const [url, setUrl] = (0,_react_17_0_2_react.useState)("");
const [deg, setDeg] = (0,_react_17_0_2_react.useState)(0);
let [width, setwidth] = (0,_react_17_0_2_react.useState)();
let [height, setheight] = (0,_react_17_0_2_react.useState)();
const [down, setdown] = (0,_react_17_0_2_react.useState)(false);
const saveUrl = (0,_react_17_0_2_react.useRef)("");
(0,_react_17_0_2_react.useEffect)(() => {
const unSub = mediator/* default */.Z.subscribe("preview-image", (value) => {
setUrl(value);
console.log(imgref.current);
document.body.style.overflow = "hidden";
});
return unSub;
}, []);
(0,_react_17_0_2_react.useEffect)(() => {
document.addEventListener("keydown", onViewEscClose);
return () => {
document.removeEventListener("keydown", onViewEscClose);
};
}, []);
(0,_react_17_0_2_react.useEffect)(() => {
saveUrl.current = url;
}, [url]);
function onViewEscClose(e) {
if (e.keyCode == 27 && saveUrl.current) {
onClose();
}
}
function onClose() {
document.body.style.overflow = "auto";
setwidth(void 0);
setheight(void 0);
setDeg(0);
setUrl("");
}
function onRotate() {
setDeg(deg + 90);
}
function big() {
width = imgref.current.width * 1.1;
height = imgref.current.height * 1.1;
setheight(height);
setwidth(width);
}
function small() {
width = imgref.current.width / 1.1;
height = imgref.current.height / 1.1;
setheight(height);
setwidth(width);
}
const maskRef = (0,_react_17_0_2_react.useRef)();
const previewWrapperRef = (0,_react_17_0_2_react.useRef)();
const imgref = (0,_react_17_0_2_react.useRef)();
const handleMaskClick = (e) => {
if (e.nativeEvent.target === maskRef.current || e.nativeEvent.target === previewWrapperRef.current) {
onClose();
}
};
return /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, !url ? null : /* @__PURE__ */ _react_17_0_2_react.createElement(
"div",
null,
/* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "preview-wrp-group", ref: previewWrapperRef }, /* @__PURE__ */ _react_17_0_2_react.createElement(
es_image/* default */.Z,
{
className: "image-preview",
src: url,
style: { display: "none" },
preview: {
visible: true,
src: url,
movable: false,
onVisibleChange: (value) => {
setUrl("");
}
},
alt: "\u9884\u89C8\u5927\u56FE"
}
))
));
});
/***/ }),
/***/ 5695:
/*!*********************************************************************************!*\
!*** ./src/pages/tasks/left-panel/discuss/discuss-editor/index.tsx + 1 modules ***!
\*********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ discuss_editor; }
});
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
;// CONCATENATED MODULE: ./src/pages/tasks/left-panel/discuss/discuss-editor/index.less
// extracted by mini-css-extract-plugin
// 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/tooltip/index.js + 3 modules
var tooltip = __webpack_require__(6848);
// 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/row/index.js
var row = __webpack_require__(95237);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/col/index.js
var col = __webpack_require__(43604);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/pagination/index.js + 10 modules
var pagination = __webpack_require__(36697);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
var es_button = __webpack_require__(3113);
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 15 modules
var markdown_editor = __webpack_require__(16393);
// EXTERNAL MODULE: ./src/utils/fetch.ts
var fetch = __webpack_require__(64841);
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx
var RenderHtml = __webpack_require__(92936);
;// CONCATENATED MODULE: ./src/pages/tasks/left-panel/discuss/discuss-editor/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());
});
};
/* harmony default export */ var discuss_editor = (({ id, activeDiscussIndex, onReplyDiscuss, adminOrOperator }) => {
const [value, setValue] = (0,_react_17_0_2_react.useState)("");
const [isOpen, setIsOpen] = (0,_react_17_0_2_react.useState)(false);
function onChange(v) {
setValue(v);
}
function onCommit() {
if (!value) {
message/* default */.ZP.info("\u56DE\u590D\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A!");
return;
}
onReplyDiscuss(id, value);
setValue("");
}
(0,_react_17_0_2_react.useEffect)(() => {
if (activeDiscussIndex != id) {
setIsOpen(false);
}
}, [activeDiscussIndex]);
return /* @__PURE__ */ _react_17_0_2_react.createElement(
"div",
{
key: id,
className: "discuss-item-editor",
style: {
display: activeDiscussIndex === id ? "block" : "none",
width: "100%"
}
},
/* @__PURE__ */ _react_17_0_2_react.createElement(
markdown_editor/* default */.Z,
{
miniToolbar: true,
startInit: activeDiscussIndex === id,
defaultValue: value,
id,
noStorage: true,
watch: false,
height: 155,
placeholder: "\u6211\u8981\u56DE\u590D",
showResizeBar: true,
onChange,
extraUse: adminOrOperator && /* @__PURE__ */ _react_17_0_2_react.createElement(
tooltip/* default */.Z,
{
color: "#fff",
open: isOpen,
destroyTooltipOnHide: true,
title: RecommendAnswer({ id, isOpen, activeDiscussIndex, onChange, setIsOpen }),
overlayStyle: { maxWidth: 600 }
},
/* @__PURE__ */ _react_17_0_2_react.createElement("a", { title: isOpen ? "\u5173\u95ED\u63A8\u8350" : "\u6253\u5F00\u63A8\u8350", onClick: () => setIsOpen(!isOpen) }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-dianzan11" }))
)
}
),
/* @__PURE__ */ _react_17_0_2_react.createElement("a", { onClick: onCommit, className: "btn-send" }, "\u53D1\u9001")
);
});
const RecommendAnswer = (props) => {
const [loading, setLoading] = (0,_react_17_0_2_react.useState)(false);
const [resData, setResData] = (0,_react_17_0_2_react.useState)([]);
const [answerIndex, setAnswerIndex] = (0,_react_17_0_2_react.useState)(1);
(0,_react_17_0_2_react.useEffect)(() => {
if (props == null ? void 0 : props.isOpen) {
getData();
} else {
setAnswerIndex(1);
setResData([]);
}
}, [props == null ? void 0 : props.isOpen]);
const getData = () => __async(void 0, null, function* () {
setLoading(true);
const res = yield (0,fetch/* default */.ZP)(`/api/discusses/${props == null ? void 0 : props.id}/recommend_answer.json`, { method: "get" });
if ((res == null ? void 0 : res.status) == 0) {
setResData(res == null ? void 0 : res.answer);
}
setLoading(false);
});
return /* @__PURE__ */ _react_17_0_2_react.createElement(spin/* default */.Z, { spinning: loading }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { color: "#000" } }, /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { className: "font14", style: { maxHeight: 500, overflow: "auto" }, value: (resData == null ? void 0 : resData[answerIndex - 1]) || "" }), /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { justify: "end", align: "middle" }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(pagination/* default */.Z, { simple: true, current: answerIndex, pageSize: 1, total: (resData == null ? void 0 : resData.length) || 0, onChange: (page) => {
setAnswerIndex(page);
} })), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { onClick: () => __async(void 0, null, function* () {
props == null ? void 0 : props.onChange(resData == null ? void 0 : resData[answerIndex - 1]);
props == null ? void 0 : props.setIsOpen(false);
}) }, "\u586B\u5165\u6587\u672C\u6846")))));
};
/***/ }),
/***/ 2360:
/*!******************************************************************!*\
!*** ./src/pages/tasks/left-panel/discuss/index.jsx + 8 modules ***!
\******************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ discuss; }
});
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
;// CONCATENATED MODULE: ./src/pages/tasks/left-panel/discuss/index.less
// extracted by mini-css-extract-plugin
// EXTERNAL MODULE: ./src/components/Spinner/index.tsx + 1 modules
var Spinner = __webpack_require__(18343);
// EXTERNAL MODULE: ./src/components/modal.tsx
var modal = __webpack_require__(9805);
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
var NoData = __webpack_require__(46948);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
var es_modal = __webpack_require__(43418);
// 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/pagination/index.js + 10 modules
var pagination = __webpack_require__(36697);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input-number/index.js + 14 modules
var input_number = __webpack_require__(96971);
// 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/row/index.js
var row = __webpack_require__(95237);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/col/index.js
var col = __webpack_require__(43604);
// 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/skeleton/index.js + 12 modules
var skeleton = __webpack_require__(2518);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 15 modules
var _umi_production_exports = __webpack_require__(23852);
// EXTERNAL MODULE: ./src/components/mediator.js
var mediator = __webpack_require__(50993);
// EXTERNAL MODULE: ./src/pages/tasks/left-panel/discuss/service.js
var service = __webpack_require__(41196);
// EXTERNAL MODULE: ./src/components/ImagesIcon/index.ts + 33 modules
var ImagesIcon = __webpack_require__(81200);
;// CONCATENATED MODULE: ./src/pages/tasks/left-panel/discuss/components/AiAnswer.tsx
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
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 __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
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 Interest = ({ pathsList, dispatch }) => {
const [form] = es_form["default"].useForm();
const [subjects, setSubjects] = (0,_react_17_0_2_react.useState)();
const [loading, setLoading] = (0,_react_17_0_2_react.useState)(true);
const [visible, setVisible] = (0,_react_17_0_2_react.useState)(false);
const [keyword, setKeyword] = (0,_react_17_0_2_react.useState)({});
const [query, setQuery] = (0,_react_17_0_2_react.useState)({
keyword,
robot: true,
page: 1
});
(0,_react_17_0_2_react.useEffect)(() => {
mediator/* default */.Z.subscribe("ai-replay-show", (data) => {
setKeyword(data);
setVisible(true);
});
}, []);
(0,_react_17_0_2_react.useEffect)(() => {
if (keyword == null ? void 0 : keyword.id)
getData();
}, [keyword]);
const getData = (nextPage) => __async(void 0, null, function* () {
setLoading(true);
const res = yield (0,service/* aiReply */.U_)(__spreadProps(__spreadValues({}, query), { keyword: keyword == null ? void 0 : keyword.content, id: keyword == null ? void 0 : keyword.id }));
setLoading(false);
if (res == null ? void 0 : res.data) {
query.page++;
setQuery(__spreadValues({}, query));
setSubjects(res == null ? void 0 : res.data);
}
});
const handleOk = () => __async(void 0, null, function* () {
getData();
});
const content = /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement("img", { src: ImagesIcon/* qrCodeIcon */.wC, width: 150 }));
return /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement(
es_modal["default"],
{
title: "\u5176\u4ED6\u56DE\u7B54",
mask: true,
open: visible,
okText: "\u6362\u4E00\u6362",
cancelText: "",
onOk: handleOk,
width: 800,
height: 500,
footer: /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { align: "middle", justify: "center" }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { className: "tc" }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "primary", onClick: getData }, "\u6362\u4E00\u6362"), /* @__PURE__ */ _react_17_0_2_react.createElement(popover/* default */.Z, { content, title: "\u5934\u6B4C\u6559\u5E08\u4EA4\u6D41\u793E\u533A" }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "dashed" }, "\u4EBA\u5DE5\u670D\u52A1")))),
onCancel: () => {
setVisible(false);
}
},
/* @__PURE__ */ _react_17_0_2_react.createElement("aside", { style: { minHeight: 300 } }, /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(skeleton/* default */.Z, { loading }, subjects == null ? void 0 : subjects.map((item) => /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { style: { background: "#e9f3f1", padding: "8px 20px", marginBottom: 10, borderRadius: 20 }, span: 24 }, item.text)), !(subjects == null ? void 0 : subjects.length) && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { width: "100%", textAlign: "center" } }, /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), /* @__PURE__ */ _react_17_0_2_react.createElement("img", { src: ImagesIcon/* qrCodeIcon */.wC, width: 150 }), /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), "\u5934\u6B4C\u6559\u5E08\u4EA4\u6D41\u793E\u533A"))))
));
};
/* harmony default export */ var AiAnswer = ((0,_umi_production_exports.connect)(({ pathsList }) => ({
pathsList
}))(Interest));
// EXTERNAL MODULE: ./src/pages/tasks/constant.js
var constant = __webpack_require__(34829);
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(19351);
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx
var RenderHtml = __webpack_require__(92936);
// 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/tooltip/index.js + 3 modules
var tooltip = __webpack_require__(6848);
;// CONCATENATED MODULE: ./src/pages/tasks/left-panel/discuss/discuss-item/index.less
// extracted by mini-css-extract-plugin
// EXTERNAL MODULE: ./src/pages/tasks/left-panel/discuss/discuss-editor/index.tsx + 1 modules
var discuss_editor = __webpack_require__(5695);
// EXTERNAL MODULE: ./src/components/image-preview/index.tsx + 1 modules
var image_preview = __webpack_require__(35894);
// EXTERNAL MODULE: ./src/utils/authority.ts
var authority = __webpack_require__(77883);
;// CONCATENATED MODULE: ./src/pages/tasks/left-panel/discuss/discuss-item/image/appoint1.svg
var appoint1_defProp = Object.defineProperty;
var appoint1_getOwnPropSymbols = Object.getOwnPropertySymbols;
var appoint1_hasOwnProp = Object.prototype.hasOwnProperty;
var appoint1_propIsEnum = Object.prototype.propertyIsEnumerable;
var appoint1_defNormalProp = (obj, key, value) => key in obj ? appoint1_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var appoint1_spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (appoint1_hasOwnProp.call(b, prop))
appoint1_defNormalProp(a, prop, b[prop]);
if (appoint1_getOwnPropSymbols)
for (var prop of appoint1_getOwnPropSymbols(b)) {
if (appoint1_propIsEnum.call(b, prop))
appoint1_defNormalProp(a, prop, b[prop]);
}
return a;
};
const SvgAppoint1 = (props) => /* @__PURE__ */ React.createElement("svg", appoint1_spreadValues({ width: 10, height: 9, xmlns: "http://www.w3.org/2000/svg" }, props), /* @__PURE__ */ React.createElement("title", null, "\u6EE1\u610F"), /* @__PURE__ */ React.createElement("path", { d: "M10 2.731H5.141V0h-1.96L1.675 2.643H0v6.18h7.865L10 2.732Zm-9.431.487h.836v5.03H.569v-5.03Zm8.626.088L7.463 8.249h-5.49V3.218h.031L3.511.575h1.062v2.73h4.622Z", fill: "#000", fillRule: "nonzero" }));
/* harmony default export */ var appoint1 = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iOSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTAgMi43MzFINS4xNDFWMGgtMS45NkwxLjY3NSAyLjY0M0gwdjYuMThoNy44NjVMMTAgMi43MzJabS05LjQzMS40ODdoLjgzNnY1LjAzSC41Njl2LTUuMDNabTguNjI2LjA4OEw3LjQ2MyA4LjI0OWgtNS40OVYzLjIxOGguMDMxTDMuNTExLjU3NWgxLjA2MnYyLjczaDQuNjIyWiIgZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJub256ZXJvIi8+PC9zdmc+");
;// CONCATENATED MODULE: ./src/pages/tasks/left-panel/discuss/discuss-item/image/appoint2.svg
var appoint2_defProp = Object.defineProperty;
var appoint2_getOwnPropSymbols = Object.getOwnPropertySymbols;
var appoint2_hasOwnProp = Object.prototype.hasOwnProperty;
var appoint2_propIsEnum = Object.prototype.propertyIsEnumerable;
var appoint2_defNormalProp = (obj, key, value) => key in obj ? appoint2_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var appoint2_spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (appoint2_hasOwnProp.call(b, prop))
appoint2_defNormalProp(a, prop, b[prop]);
if (appoint2_getOwnPropSymbols)
for (var prop of appoint2_getOwnPropSymbols(b)) {
if (appoint2_propIsEnum.call(b, prop))
appoint2_defNormalProp(a, prop, b[prop]);
}
return a;
};
const SvgAppoint2 = (props) => /* @__PURE__ */ React.createElement("svg", appoint2_spreadValues({ width: 10, height: 9, xmlns: "http://www.w3.org/2000/svg" }, props), /* @__PURE__ */ React.createElement("title", null, "\u6EE1\u610F"), /* @__PURE__ */ React.createElement("path", { d: "M10 2.731H5.141V0h-1.96L1.675 2.643H0v6.18h7.865L10 2.732Zm-9.431.487h.836v5.03H.569v-5.03Zm8.626.088L7.463 8.249h-5.49V3.218h.031L3.511.575h1.062v2.73h4.622Z", fill: "#0152D9", fillRule: "nonzero" }));
/* harmony default export */ var appoint2 = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iOSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTAgMi43MzFINS4xNDFWMGgtMS45NkwxLjY3NSAyLjY0M0gwdjYuMThoNy44NjVMMTAgMi43MzJabS05LjQzMS40ODdoLjgzNnY1LjAzSC41Njl2LTUuMDNabTguNjI2LjA4OEw3LjQ2MyA4LjI0OWgtNS40OVYzLjIxOGguMDMxTDMuNTExLjU3NWgxLjA2MnYyLjczaDQuNjIyWiIgZmlsbD0iIzAxNTJEOSIgZmlsbC1ydWxlPSJub256ZXJvIi8+PC9zdmc+");
;// CONCATENATED MODULE: ./src/pages/tasks/left-panel/discuss/discuss-item/image/disappoint1.svg
var disappoint1_defProp = Object.defineProperty;
var disappoint1_getOwnPropSymbols = Object.getOwnPropertySymbols;
var disappoint1_hasOwnProp = Object.prototype.hasOwnProperty;
var disappoint1_propIsEnum = Object.prototype.propertyIsEnumerable;
var disappoint1_defNormalProp = (obj, key, value) => key in obj ? disappoint1_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var disappoint1_spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (disappoint1_hasOwnProp.call(b, prop))
disappoint1_defNormalProp(a, prop, b[prop]);
if (disappoint1_getOwnPropSymbols)
for (var prop of disappoint1_getOwnPropSymbols(b)) {
if (disappoint1_propIsEnum.call(b, prop))
disappoint1_defNormalProp(a, prop, b[prop]);
}
return a;
};
const SvgDisappoint1 = (props) => /* @__PURE__ */ React.createElement("svg", disappoint1_spreadValues({ width: 10, height: 9, xmlns: "http://www.w3.org/2000/svg" }, props), /* @__PURE__ */ React.createElement("title", null, "\u4E0D\u6EE1\u610F"), /* @__PURE__ */ React.createElement("path", { d: "M7.865 0H0v6.18h1.675l1.506 2.644h1.96V6.092H10L7.865 0ZM.57.575h.836v5.03H.569V.576Zm4.003 4.943v2.73H3.51L2.004 5.607h-.03V.576h5.489l1.732 4.942H4.572Z", fill: "#000", fillRule: "nonzero" }));
/* harmony default export */ var disappoint1 = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iOSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNNy44NjUgMEgwdjYuMThoMS42NzVsMS41MDYgMi42NDRoMS45NlY2LjA5MkgxMEw3Ljg2NSAwWk0uNTcuNTc1aC44MzZ2NS4wM0guNTY5Vi41NzZabTQuMDAzIDQuOTQzdjIuNzNIMy41MUwyLjAwNCA1LjYwN2gtLjAzVi41NzZoNS40ODlsMS43MzIgNC45NDJINC41NzJaIiBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=");
;// CONCATENATED MODULE: ./src/pages/tasks/left-panel/discuss/discuss-item/image/disappoint2.svg
var disappoint2_defProp = Object.defineProperty;
var disappoint2_getOwnPropSymbols = Object.getOwnPropertySymbols;
var disappoint2_hasOwnProp = Object.prototype.hasOwnProperty;
var disappoint2_propIsEnum = Object.prototype.propertyIsEnumerable;
var disappoint2_defNormalProp = (obj, key, value) => key in obj ? disappoint2_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var disappoint2_spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (disappoint2_hasOwnProp.call(b, prop))
disappoint2_defNormalProp(a, prop, b[prop]);
if (disappoint2_getOwnPropSymbols)
for (var prop of disappoint2_getOwnPropSymbols(b)) {
if (disappoint2_propIsEnum.call(b, prop))
disappoint2_defNormalProp(a, prop, b[prop]);
}
return a;
};
const SvgDisappoint2 = (props) => /* @__PURE__ */ React.createElement("svg", disappoint2_spreadValues({ width: 10, height: 9, xmlns: "http://www.w3.org/2000/svg" }, props), /* @__PURE__ */ React.createElement("title", null, "\u4E0D\u6EE1\u610F"), /* @__PURE__ */ React.createElement("path", { d: "M7.865 0H0v6.18h1.675l1.506 2.644h1.96V6.092H10L7.865 0ZM.57.575h.836v5.03H.569V.576Zm4.003 4.943v2.73H3.51L2.004 5.607h-.03V.576h5.489l1.732 4.942H4.572Z", fill: "#0152D9", fillRule: "nonzero" }));
/* harmony default export */ var disappoint2 = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iOSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNNy44NjUgMEgwdjYuMThoMS42NzVsMS41MDYgMi42NDRoMS45NlY2LjA5MkgxMEw3Ljg2NSAwWk0uNTcuNTc1aC44MzZ2NS4wM0guNTY5Vi41NzZabTQuMDAzIDQuOTQzdjIuNzNIMy41MUwyLjAwNCA1LjYwN2gtLjAzVi41NzZoNS40ODlsMS43MzIgNC45NDJINC41NzJaIiBmaWxsPSIjMDE1MkQ5IiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=");
// EXTERNAL MODULE: ./src/utils/fetch.ts
var fetch = __webpack_require__(64841);
;// CONCATENATED MODULE: ./src/pages/tasks/left-panel/discuss/discuss-item/index.jsx
var discuss_item_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());
});
};
function SecondLevelDiscuss({
data,
index,
adminOrOperator,
parentDiscussIndex,
shixunIdentifier,
user,
onSetRewardData,
onSetActionType,
onHandleSubmitDiscusses,
onTopOrDownDiscuss,
handleChildrenPlus,
anserAuthor,
onPlus,
onHandleRepaly,
userInfomation
}) {
const {
author,
can_delete,
content,
hidden,
id,
reward,
time,
reply_status,
user_praise,
praise_count
} = data;
const [isHover, setHover] = (0,_react_17_0_2_react.useState)(false);
const [isHoverSecond, setHoverSecond] = (0,_react_17_0_2_react.useState)(false);
const [isHoverSatisfied, setHoverSatisfied] = (0,_react_17_0_2_react.useState)(false);
const [isHoverDisSatisfied, setHoverDisSatisfied] = (0,_react_17_0_2_react.useState)(false);
const handleQuestions = () => {
if (!isHover)
return;
onHandleSubmitDiscusses(id, {
reply_status: 2
});
};
const handleRobot = () => {
if (!isHoverSecond)
return;
onHandleSubmitDiscusses(id, {
reply_status: 3
});
};
const handleSatisfy = () => {
onHandleSubmitDiscusses(id, {
reply_status: 1
});
};
const handleVerySatisfy = () => {
onHandleSubmitDiscusses(id, {
reply_status: 4
});
};
const renderRatify = () => {
switch (reply_status) {
case 0:
return /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement(
"div",
{
style: { whiteSpace: "nowrap" },
onClick: handleSatisfy,
className: `whether-satisfied ${isHoverSatisfied ? "cursorPoint blue-text-color" : ""}`,
onMouseEnter: () => {
setHoverSatisfied(true);
},
onMouseLeave: () => {
setHoverSatisfied(false);
}
},
/* @__PURE__ */ _react_17_0_2_react.createElement(
"img",
{
src: isHoverSatisfied ? appoint2 : appoint1,
className: "whether-img SVGColor"
}
),
"\u6EE1\u610F"
), /* @__PURE__ */ _react_17_0_2_react.createElement(
popover/* default */.Z,
{
placement: "bottomLeft",
content: /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "content" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "content-disappoint" }, "\u62B1\u6B49\u8BA9\u4F60\u5931\u671B\u4E86\uFF0C\u8BF7\u7EE7\u7EED\u5C1D\u8BD5:"), /* @__PURE__ */ _react_17_0_2_react.createElement(
"div",
{
className: `radius-box marg15 height30-line black6c-optcity ${isHover ? "blue-background cursorPoint blue-background-write" : "gray-background"}`,
onMouseEnter: () => {
setHover(true);
},
onMouseLeave: () => {
setHover(false);
},
onClick: handleQuestions
},
"\u8BF7",
author == null ? void 0 : author.name.trim(),
"\u8001\u5E08\u518D\u5C1D\u8BD5\u56DE\u7B54\u4E00\u6B21\u3002"
), /* @__PURE__ */ _react_17_0_2_react.createElement(
"div",
{
className: `radius-box marg15 height30-line black6c-optcity ${isHoverSecond ? "blue-background cursorPoint blue-background-write" : "gray-background"}`,
onMouseEnter: () => {
setHoverSecond(true);
},
onMouseLeave: () => {
setHoverSecond(false);
},
onClick: handleRobot
},
"\u53EF\u80FD\u542F\u7528\u4E86\u673A\u5668\u4EBA\uFF0C\u8BF7\u5176\u4ED6\u8001\u5E08\u56DE\u7B54\u3002"
)),
trigger: "click"
},
/* @__PURE__ */ _react_17_0_2_react.createElement(
"div",
{
style: { whiteSpace: "nowrap" },
className: `whether-satisfied ${isHoverDisSatisfied ? "cursorPoint blue-text-color" : ""}`,
onMouseEnter: () => {
setHoverDisSatisfied(true);
},
onMouseLeave: () => {
setHoverDisSatisfied(false);
}
},
/* @__PURE__ */ _react_17_0_2_react.createElement(
"img",
{
src: isHoverDisSatisfied ? disappoint2 : disappoint1,
className: "whether-img SVGColor"
}
),
"\u4E0D\u6EE1\u610F"
)
));
case 1:
return /* @__PURE__ */ _react_17_0_2_react.createElement(
"div",
{
style: { whiteSpace: "nowrap" },
className: `radius-box cursorPoint height30 ${index > 0 ? "gray-background" : "blue-background"}`,
onClick: handleVerySatisfy
},
"\u6211\u5F88\u6EE1\u610F"
);
case 2:
return /* @__PURE__ */ _react_17_0_2_react.createElement(
"div",
{
style: { whiteSpace: "nowrap" },
className: `radius-box height30 ${index > 0 ? "gray-background" : "blue-background"}`
},
"\u4E0D\u6EE1\u610F \u7B49\u5F85\u8001\u5E08\u518D\u6B21\u56DE\u7B54"
);
case 3:
return /* @__PURE__ */ _react_17_0_2_react.createElement(
"div",
{
style: { whiteSpace: "nowrap" },
className: `radius-box height30 ${index > 0 ? "gray-background" : "blue-background"}`
},
"\u4E0D\u6EE1\u610F \u7B49\u5F85\u5176\u4ED6\u8001\u5E08\u518D\u6B21\u56DE\u7B54"
);
case 4:
return /* @__PURE__ */ _react_17_0_2_react.createElement(
"div",
{
style: { whiteSpace: "nowrap" },
className: `radius-box height30 ${index > 0 ? "gray-background" : "blue-background"}`
},
"\u6211\u5F88\u6EE1\u610F"
);
default:
return /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null);
}
};
function onRewardDialog() {
onSetRewardData({
id,
index,
user_id: author.user_id,
parentDiscussIndex
});
}
function onHiddenDiscuss() {
onSetActionType({
id,
index,
params: {
hidden: !hidden ? "1" : "0",
container_identifier: shixunIdentifier
},
type: "hidden-discuss",
parentDiscussIndex,
message: !hidden ? "\u786E\u5B9A\u8981\u9690\u85CF\u8BE5\u6761\u56DE\u590D\u5417" : "\u786E\u5B9A\u8981\u53D6\u6D88\u9690\u85CF\u8BE5\u6761\u56DE\u590D\u5417"
});
}
function onDeleteDiscuss() {
onSetActionType({
id,
index,
type: "delete-discuss",
parentDiscussIndex,
message: "\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u6761\u56DE\u590D\u5417"
});
}
const handleChildrenPlusClick = () => {
onHandleRepaly(id, !user_praise, parentDiscussIndex, index);
};
const canDelete = adminOrOperator || can_delete || author.user_id === user.user_id || author.login === user.login;
const anserReplay = (0,_umi_production_exports.useLocation)().pathname.split("/")[1] === "tasks";
return /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "second-level-discuss" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "discuss-info-body" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "discuss-info" }, /* @__PURE__ */ _react_17_0_2_react.createElement("a", { href: `/users/${author.login}`, target: "_blank" }, author.name), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "grey" }, time), reward ? /* @__PURE__ */ _react_17_0_2_react.createElement("a", { className: "c-orange gift", title: `\u5DF2\u5956\u52B1\u91D1\u5E01${reward}` }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-gift c-orange " }), /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, reward)) : null)), /* @__PURE__ */ _react_17_0_2_react.createElement(
RenderHtml/* default */.Z,
{
className: `discuss-content ${index > 0 ? "content-gray" : ""}`,
value: content
}
)), anserReplay && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "btn-group-succes" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "btn-group-gratify" }, renderRatify()), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "btn-group-other" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "discuss-info-body" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "btn-group" }, adminOrOperator && /* @__PURE__ */ _react_17_0_2_react.createElement("a", { onClick: () => discuss_item_async(this, null, function* () {
const res = yield (0,fetch/* default */.ZP)(`/api/discusses/${data.id}/update_faq_data.json`, { method: "get" });
if ((res == null ? void 0 : res.status) == 0) {
message/* default */.ZP.success("\u6DFB\u52A0\u6210\u529F");
}
}) }, "\u52A0\u5165\u5E38\u89C1\u95EE\u9898\u5E93"), user.identity === 1 ? /* @__PURE__ */ _react_17_0_2_react.createElement("a", { onClick: onRewardDialog, title: "\u7ED9TA\u5956\u52B1\u91D1\u5E01" }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-jiangli" })) : null, adminOrOperator ? /* @__PURE__ */ _react_17_0_2_react.createElement(
"a",
{
onClick: onHiddenDiscuss,
title: hidden ? "\u53D6\u6D88\u9690\u85CF" : "\u9690\u85CF\u8BC4\u8BBA"
},
/* @__PURE__ */ _react_17_0_2_react.createElement(
"i",
{
className: hidden ? "iconfont icon-yincangbiyan" : "fa fa-eye"
}
)
) : null, canDelete ? /* @__PURE__ */ _react_17_0_2_react.createElement("a", { onClick: onDeleteDiscuss, title: "\u5220\u9664" }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-shanchu" })) : null, /* @__PURE__ */ _react_17_0_2_react.createElement(
"a",
{
onClick: handleChildrenPlusClick,
className: user_praise ? "c-orange" : ""
},
/* @__PURE__ */ _react_17_0_2_react.createElement(
"i",
{
className: user_praise ? "iconfont icon-dianzan mr3" : "iconfont icon-dianzan-xian mr3 "
}
),
/* @__PURE__ */ _react_17_0_2_react.createElement("span", null, praise_count ? praise_count : "")
))))));
}
/* harmony default export */ var discuss_item = (({
data,
index,
shixunIdentifier,
adminOrOperator,
identity,
onTopOrDownDiscuss,
onPlusDiscuss,
onDisableDiscuss,
onSetActionType,
onSetRewardData,
user,
activeDiscussIndex,
onReplyDiscuss,
onSetActiveDiscussIndex,
allowDisableDiscuss,
onHandleSubmitDiscusses,
onHandleRepaly,
userInfomation
}) => {
const {
content,
children,
game_url,
hidden,
id,
position,
praise_count,
reward,
sticky,
time,
user_praise,
game_passed,
ai_reply_text,
ai_reply_flag,
author,
disable_discuss_status,
reply_status
} = data;
const [showPlusAnimate, setShowPlusAnimate] = (0,_react_17_0_2_react.useState)(false);
(0,_react_17_0_2_react.useEffect)(() => {
if (showPlusAnimate) {
setTimeout(() => setShowPlusAnimate(false), 800);
}
}, [showPlusAnimate]);
function onActiveDiscussIndex() {
var _a;
if (!((_a = (0,authority/* userInfo */.eY)()) == null ? void 0 : _a.authentication)) {
es_modal["default"].confirm({
title: "\u63D0\u793A",
className: "custom-modal-divider ",
icon: null,
content: "\u9700\u8981\u901A\u8FC7\u5B9E\u540D\u9A8C\u8BC1\u540E\uFF0C\u624D\u80FD\u8FDB\u884C\u8BC4\u8BBA\u64CD\u4F5C",
okText: "\u524D\u5F80\u5B9E\u540D\u9A8C\u8BC1",
cancelText: "\u53D6\u6D88",
onOk: () => {
window.open(`/account/certification`);
}
});
return;
}
console.log(id, "idi---------------------------");
onSetActiveDiscussIndex(id);
}
function onTopOrDown() {
onTopOrDownDiscuss(id, !sticky, index);
}
function onPlus() {
onPlusDiscuss(id, !user_praise, index);
}
function onRewardDialog() {
onSetRewardData({
id,
index,
user_id: author.user_id
});
}
function onDeleteDiscuss() {
onSetActionType({
id,
index,
type: "delete-discuss",
message: "\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u6761\u56DE\u590D\u5417"
});
}
function onHiddenDiscuss() {
onSetActionType({
id,
index,
params: {
hidden: !hidden ? "1" : "0",
container_identifier: shixunIdentifier
},
type: "hidden-discuss",
message: !hidden ? "\u786E\u5B9A\u8981\u9690\u85CF\u8BE5\u6761\u56DE\u590D\u5417" : "\u786E\u5B9A\u8981\u53D6\u6D88\u9690\u85CF\u8BE5\u6761\u56DE\u590D\u5417"
});
}
function onDisable() {
onDisableDiscuss(id, disable_discuss_status === 0 ? 2 : 0, index);
}
const handleClick = (e) => {
let { nodeName, src } = e.target;
if (nodeName === "IMG") {
mediator/* default */.Z.publish("preview-image", src);
console.log("src:", src);
}
};
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "discuss-item-container", key: id }, /* @__PURE__ */ _react_17_0_2_react.createElement("a", { href: `/users/${author.login}`, target: "_blank" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
"img",
{
alt: "\u7528\u6237\u5934\u50CF",
height: "50",
src: `${env/* default */.Z.IMG_SERVER}/images/${author.image_url}`,
width: "50"
}
)), /* @__PURE__ */ _react_17_0_2_react.createElement("section", null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "discuss-info" }, /* @__PURE__ */ _react_17_0_2_react.createElement("a", { href: `/users/${author.login}`, target: "_blank" }, author.name), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "grey" }, time), position ? /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-green" }, " [\u7B2C", position, "\u5173] ") : null, game_url ? /* @__PURE__ */ _react_17_0_2_react.createElement(
"a",
{
href: game_url,
target: "_blank",
className: "view-code",
title: "\u70B9\u51FB\u67E5\u770BTA\u7684\u4EE3\u7801\u9875\u9762"
},
"\u67E5\u770B"
) : null, allowDisableDiscuss && /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, disable_discuss_status === 0 && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u7981\u6B62\u8BE5\u7528\u6237\u5728\u6B64\u9879\u76EE\u7684\u8BC4\u8BBA\u529F\u80FD" }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: onDisable, className: "c-red current" }, "\u7981\u6B62\u8BC4\u8BBA\u529F\u80FD")), disable_discuss_status === 2 && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u6062\u590D\u8BE5\u7528\u6237\u5728\u6B64\u5B9E\u8DF5\u9879\u76EE\u7684\u8BC4\u8BBA\u529F\u80FD" }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: onDisable, className: "c-light-primary current" }, "\u6062\u590D\u8BC4\u8BBA\u529F\u80FD")), disable_discuss_status === 1 && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u8BE5\u7528\u6237\u5DF2\u88AB\u7CFB\u7EDF\u7BA1\u7406\u5458\u7981\u8A00" }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-red" }, "\u88AB\u7BA1\u7406\u5458\u7981\u6B62\u8BC4\u8BBA"))), sticky ? /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "top" }, "\u7F6E\u9876") : null, reward ? /* @__PURE__ */ _react_17_0_2_react.createElement("a", { className: "c-orange gift", title: `\u5DF2\u5956\u52B1\u91D1\u5E01${reward}` }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-gift c-orange " }), /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, reward)) : null, identity <= 5 ? /* @__PURE__ */ _react_17_0_2_react.createElement(
"span",
{
style: {
flex: "1",
textAlign: "right",
color: game_passed === 1 ? "#29bd8b" : ""
}
},
game_passed === 1 ? "\u5DF2\u901A\u5173" : "\u672A\u901A\u5173"
) : null), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { onClick: handleClick }, /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { className: "discuss-content", value: content })), ai_reply_flag && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { padding: 10, borderRadius: 4, background: "#f4f4f4" } }, /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { padding: "6px 0" } }, ai_reply_text), /* @__PURE__ */ _react_17_0_2_react.createElement(
es_button/* default */.ZP,
{
style: {
background: "#d1e5f9",
borderRadius: 25,
border: "none",
display: "inline-flex",
justifyItems: "center",
alignItems: "center"
},
onClick: () => setShowPlusAnimate(true),
className: "mr10 mr5 relative c-blue"
},
/* @__PURE__ */ _react_17_0_2_react.createElement(
"span",
{
className: showPlusAnimate ? "plus-one-animate" : "hide",
style: { position: "absolute" }
},
" ",
"+1"
),
/* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-blue icon-duiwoyouyong mr5" }),
/* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-blue" }, "\u5BF9\u6211\u6709\u7528")
), /* @__PURE__ */ _react_17_0_2_react.createElement(
"span",
{
className: "c-orange current",
onClick: () => {
mediator/* default */.Z.publish("ai-replay-show", {
content,
id
});
}
},
"\u5176\u4ED6\u56DE\u7B54"
)), children && children.length > 0 ? /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "reply-discuss-containerActive", onClick: handleClick }, children.map((item, i) => /* @__PURE__ */ _react_17_0_2_react.createElement(
SecondLevelDiscuss,
{
key: item.id,
data: item,
index: i,
userInfomation,
onTopOrDownDiscuss,
shixunIdentifier,
onHandleSubmitDiscusses,
adminOrOperator,
user,
onSetRewardData,
onSetActionType,
parentDiscussIndex: index,
anserAuthor: author,
onHandleRepaly
}
))) : null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "btn-group" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "btn-group-other" }, user.identity === 1 ? /* @__PURE__ */ _react_17_0_2_react.createElement("a", { onClick: onRewardDialog, title: "\u7ED9TA\u5956\u52B1\u91D1\u5E01" }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-jiangli" })) : null, adminOrOperator ? /* @__PURE__ */ _react_17_0_2_react.createElement(
"a",
{
onClick: onHiddenDiscuss,
title: hidden ? "\u53D6\u6D88\u9690\u85CF" : "\u9690\u85CF\u8BC4\u8BBA"
},
/* @__PURE__ */ _react_17_0_2_react.createElement(
"i",
{
className: hidden ? "iconfont icon-yincangbiyan" : "fa fa-eye"
}
)
) : null, identity <= 5 ? /* @__PURE__ */ _react_17_0_2_react.createElement(
"a",
{
onClick: onTopOrDown,
className: sticky ? "btn-top" : "btn-down",
title: sticky ? "\u53D6\u6D88\u7F6E\u9876" : "\u7F6E\u9876"
},
/* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-zhiding1 " })
) : null, adminOrOperator && (!children || children.length == 0) ? /* @__PURE__ */ _react_17_0_2_react.createElement("a", { onClick: onDeleteDiscuss, title: "\u5220\u9664" }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-shanchu" })) : null, /* @__PURE__ */ _react_17_0_2_react.createElement("a", { onClick: onActiveDiscussIndex, title: "\u56DE\u590D" }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-huifu1" })), /* @__PURE__ */ _react_17_0_2_react.createElement("a", { onClick: onPlus, className: user_praise ? "c-orange" : "" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
"i",
{
className: user_praise ? "iconfont icon-dianzan mr3" : "iconfont icon-dianzan-xian mr3 "
}
), /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, praise_count ? praise_count : "")))), /* @__PURE__ */ _react_17_0_2_react.createElement(
discuss_editor/* default */.Z,
{
id,
activeDiscussIndex,
onReplyDiscuss,
adminOrOperator
}
)));
});
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(75798);
;// CONCATENATED MODULE: ./src/pages/tasks/left-panel/discuss/index.jsx
var discuss_defProp = Object.defineProperty;
var discuss_defProps = Object.defineProperties;
var discuss_getOwnPropDescs = Object.getOwnPropertyDescriptors;
var discuss_getOwnPropSymbols = Object.getOwnPropertySymbols;
var discuss_hasOwnProp = Object.prototype.hasOwnProperty;
var discuss_propIsEnum = Object.prototype.propertyIsEnumerable;
var discuss_defNormalProp = (obj, key, value) => key in obj ? discuss_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var discuss_spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (discuss_hasOwnProp.call(b, prop))
discuss_defNormalProp(a, prop, b[prop]);
if (discuss_getOwnPropSymbols)
for (var prop of discuss_getOwnPropSymbols(b)) {
if (discuss_propIsEnum.call(b, prop))
discuss_defNormalProp(a, prop, b[prop]);
}
return a;
};
var discuss_spreadProps = (a, b) => discuss_defProps(a, discuss_getOwnPropDescs(b));
var discuss_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 initialState = {
showRewardDialog: false,
data: null,
page: 1,
loading: false,
actionType: null,
activeDiscussIndex: null
};
function reducer(state, action) {
switch (action.type) {
case constant/* SHOW_DISCUSSES_LOADING */.tD:
return discuss_spreadProps(discuss_spreadValues({}, state), { loading: true });
case constant/* SHOW_REWARD_DIALOG */.RS:
return discuss_spreadProps(discuss_spreadValues({}, state), { showRewardDialog: true });
case constant/* CANCEL_REWARD_DIALOG */.t2:
return discuss_spreadProps(discuss_spreadValues({}, state), { showRewardDialog: false });
case constant/* GET_DISCUSSES */.GR:
return discuss_spreadValues(discuss_spreadValues({}, state), action.payload);
case constant/* TOP_OR_DOWN_DISCUSS */.u8:
return discuss_spreadValues(discuss_spreadValues({}, state), action.payload);
case constant/* PLUS_DISCUSS */.rM:
return discuss_spreadValues(discuss_spreadValues({}, state), action.payload);
case constant/* DISABLE_DISCUSS */.fo:
return discuss_spreadValues(discuss_spreadValues({}, state), action.payload);
case constant/* SET_ACTION_TYPE */.yS:
return discuss_spreadValues(discuss_spreadValues({}, state), action.payload);
case constant/* SET_REWARD */.Vn:
return discuss_spreadValues(discuss_spreadValues({}, state), action.payload);
case constant/* ACTIVE_DISCUSS_INDEX */.SX:
return discuss_spreadValues(discuss_spreadValues({}, state), action.payload);
default:
throw new Error();
}
}
/* harmony default export */ var discuss = (({
shixunIdentifier,
identity,
activeIndex,
user,
allowDisableDiscuss,
userInfo,
isShixunDetail = false,
taskData,
chatgpt,
to_user_id,
challengeId
}) => {
const [state, dispatch] = (0,_react_17_0_2_react.useReducer)(reducer, initialState);
const [open, setOpen] = (0,_react_17_0_2_react.useState)(true);
const [timeRefersh, settimeRefersh] = (0,_react_17_0_2_react.useState)(null);
const {
page,
loading,
data,
actionType,
showRewardDialog,
activeDiscussIndex
} = state;
const rewardData = (0,_react_17_0_2_react.useRef)();
const discussEl = (0,_react_17_0_2_react.useRef)();
const refresh = (0,_react_17_0_2_react.useRef)();
function getDiscusses(value, bool) {
return discuss_async(this, null, function* () {
if (loading) {
return;
}
try {
dispatch({ type: constant/* SHOW_DISCUSSES_LOADING */.tD });
const response = yield (0,service/* fetchDiscusses */.o7)(shixunIdentifier, value);
console.log("activeDiscussIndex", activeDiscussIndex);
dispatch({
type: constant/* GET_DISCUSSES */.GR,
payload: {
activeDiscussIndex: bool ? activeDiscussIndex : null,
page: value,
data: response,
loading: false
}
});
} catch (error) {
console.log(error);
}
});
}
(0,_react_17_0_2_react.useEffect)(() => {
if (activeIndex === 3 && chatgpt) {
clearInterval(refresh.current);
refresh.current = setInterval(() => {
getDiscusses(page, true);
}, 5e3);
} else {
console.log("\u6E05\u9664\u5B9A\u65F6\u5668");
return () => {
clearInterval(refresh.current);
};
}
return () => {
clearInterval(refresh.current);
};
}, [chatgpt, activeIndex, activeDiscussIndex]);
(0,_react_17_0_2_react.useEffect)(() => {
if (!open) {
clearInterval(timeRefersh);
settimeRefersh(
setInterval(() => {
getDiscusses(page, true);
}, 5e3)
);
}
return () => {
clearInterval(timeRefersh);
};
}, [open, page, activeDiscussIndex]);
function onPaginationChange(value) {
getDiscusses(value);
}
function onPlusDiscuss(id, user_praise, index) {
return discuss_async(this, null, function* () {
try {
const response = yield (0,service/* plusDiscuss */.ae)(id, user_praise);
comments[index].user_praise = user_praise;
comments[index].praise_count = response.praise_count;
dispatch({
type: constant/* PLUS_DISCUSS */.rM,
payload: {
data: discuss_spreadProps(discuss_spreadValues({}, data), { comments })
}
});
} catch (error) {
console.log(error);
}
});
}
function onHandleRepaly(id, user_praise, index, i) {
return discuss_async(this, null, function* () {
try {
const response = yield (0,service/* plusDiscuss */.ae)(id, user_praise);
comments[index].children[i].user_praise = user_praise;
comments[index].children[i].praise_count = response.praise_count;
dispatch({
type: constant/* PLUS_DISCUSS */.rM,
payload: {
data: discuss_spreadProps(discuss_spreadValues({}, data), { comments })
}
});
} catch (error) {
console.log(error);
}
});
}
function onDisableDiscuss(id, disable_discuss_status, index) {
return discuss_async(this, null, function* () {
try {
const response = yield (0,service/* disableDiscuss */._Z)(id, disable_discuss_status);
if (response.status !== 0)
return;
const select_user_id = comments[index].author.user_id;
const newComments = comments.map((e) => {
if (e.author.user_id === select_user_id) {
return discuss_spreadProps(discuss_spreadValues({}, e), { disable_discuss_status });
}
return e;
});
dispatch({
type: constant/* DISABLE_DISCUSS */.fo,
payload: {
data: discuss_spreadProps(discuss_spreadValues({}, data), { comments: newComments })
}
});
} catch (error) {
console.log(error);
}
});
}
function onTopOrDownDiscuss(id, sticky, index) {
return discuss_async(this, null, function* () {
try {
yield (0,service/* topOrDownDiscuss */.wJ)(id, sticky);
comments[index].sticky = sticky;
dispatch({
type: constant/* TOP_OR_DOWN_DISCUSS */.u8,
payload: {
data: discuss_spreadProps(discuss_spreadValues({}, data), { comments })
}
});
getDiscusses(state.page);
} catch (error) {
console.log(error);
}
});
}
function onCancelAction() {
dispatch({
type: constant/* SET_ACTION_TYPE */.yS,
payload: {
actionType: null
}
});
}
function onProcessAction() {
return discuss_async(this, null, function* () {
const { id, params, type, index, parentDiscussIndex } = actionType;
if (type === "hidden-discuss") {
yield (0,service/* hiddenDiscuss */.OY)(id, params);
if (!parentDiscussIndex) {
comments[index].hidden = params.hidden == 1 ? true : false;
} else {
comments[parentDiscussIndex].children[index].hidden = params.hidden == 1 ? true : false;
}
dispatch({
type: constant/* SET_ACTION_TYPE */.yS,
payload: {
actionType: null,
data: discuss_spreadProps(discuss_spreadValues({}, data), { comments })
}
});
}
if (type === "delete-discuss") {
yield (0,service/* deleteDiscuss */.KY)(id);
if (parentDiscussIndex || parentDiscussIndex === 0) {
let secondDicusses = comments[parentDiscussIndex].children;
for (let i = secondDicusses.length - 1; i >= 0; i--) {
if (secondDicusses[i].id === id) {
secondDicusses.splice(i, 1);
break;
}
}
comments[parentDiscussIndex].children = secondDicusses;
} else {
for (let i = comments.length - 1; i >= 0; i--) {
if (comments[i].id === id) {
comments.splice(i, 1);
break;
}
}
}
dispatch({
type: constant/* SET_ACTION_TYPE */.yS,
payload: {
actionType: null,
data: discuss_spreadProps(discuss_spreadValues({}, data), { comments })
}
});
}
});
}
function onSetActionType(value) {
dispatch({
type: constant/* SET_ACTION_TYPE */.yS,
payload: {
actionType: value
}
});
}
function onCancelRewardDialog() {
dispatch({ type: constant/* CANCEL_REWARD_DIALOG */.t2 });
}
function onRewardDiscuss() {
return discuss_async(this, null, function* () {
const {
id,
index,
score,
user_id,
parentDiscussIndex
} = rewardData.current;
const response = yield (0,service/* rewardDiscuss */.S8)(id, {
container_type: "Discusses",
score,
user_id
});
if (!parentDiscussIndex) {
comments[index].reward = response.code;
} else {
comments[parentDiscussIndex].children[index].reward = response.code;
}
dispatch({
type: constant/* SET_REWARD */.Vn,
payload: {
showRewardDialog: false,
data: discuss_spreadProps(discuss_spreadValues({}, data), { comments })
}
});
rewardData.current = null;
});
}
function onSetRewardData(value) {
rewardData.current = value;
dispatch({ type: constant/* SHOW_REWARD_DIALOG */.RS });
}
function onSetDiscussScore(value) {
rewardData.current.score = value;
}
function onReplyDiscuss(id, value) {
return discuss_async(this, null, function* () {
try {
const res = yield (0,service/* replyDiscuss */.wg)(id, value);
if (res.status === -3) {
es_modal["default"].info({
title: "\u63D0\u793A",
className: "custom-modal-divider ",
icon: null,
content: "\u4F60\u7684\u8D26\u53F7\u56E0\u4E3A\u53D1\u5E03\u4E86\u4E0D\u5F53\u5185\u5BB9\uFF0C\u73B0\u5DF2\u5C06\u8BC4\u8BBA\u529F\u80FD\u5C4F\u853D\u3002",
okText: "\u786E\u5B9A"
});
onSetActiveDiscussIndex(null);
return;
}
getDiscusses(page);
} catch (error) {
console.log(error);
}
});
}
function onSubmitDiscusses(id, value) {
return discuss_async(this, null, function* () {
try {
const { status } = yield (0,service/* submitDiscusses */.KQ)(id, value);
if (status !== 1)
return;
getDiscusses(page);
} catch (error) {
console.log(error);
}
});
}
function onSetActiveDiscussIndex(value) {
if (activeDiscussIndex === value) {
dispatch({
type: constant/* ACTIVE_DISCUSS_INDEX */.SX,
payload: {
activeDiscussIndex: null
}
});
} else {
dispatch({
type: constant/* ACTIVE_DISCUSS_INDEX */.SX,
payload: {
activeDiscussIndex: value
}
});
}
}
(0,_react_17_0_2_react.useEffect)(() => {
function init() {
return discuss_async(this, null, function* () {
if (activeIndex === 3 && !data && shixunIdentifier) {
yield getDiscusses(page);
}
});
}
init();
}, [shixunIdentifier, activeIndex, page, dispatch]);
(0,_react_17_0_2_react.useEffect)(() => {
const unSub = mediator/* default */.Z.subscribe("create-discuss", () => {
clearInterval(refresh.current);
getDiscusses(page);
if (chatgpt) {
refresh.current = setInterval(() => {
getDiscusses(page);
}, 5e3);
}
});
return unSub;
}, [shixunIdentifier]);
if (!data) {
return /* @__PURE__ */ _react_17_0_2_react.createElement(Spinner/* default */.Z, null);
}
const handleRefresh = () => {
setOpen(!open);
if (!open) {
clearInterval(timeRefersh);
} else {
settimeRefersh(
setInterval(() => {
getDiscusses(page, true);
}, 5e3)
);
}
};
const { disscuss_count, comments, all, can_hidden } = data;
console.log(to_user_id, "to_user_id");
return /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "discuss-container", ref: discussEl }, chatgpt && /* @__PURE__ */ _react_17_0_2_react.createElement(
es_button/* default */.ZP,
{
type: "primary",
style: { float: "right", marginBottom: 10 },
onClick: () => {
(0,util/* openNewWindow */.xg)(`/chatgpt?id=${to_user_id}&position=${challengeId}`);
}
},
"\u8FDB\u5165\u5386\u53F2\u95EE\u7B54"
), (taskData == null ? void 0 : taskData.myshixun_manager) && !chatgpt && /* @__PURE__ */ _react_17_0_2_react.createElement(
es_button/* default */.ZP,
{
style: { float: "right", marginBottom: 10 },
type: "primary",
onClick: handleRefresh
},
open ? "\u5F00\u542F\u5B9E\u65F6\u5237\u65B0" : "\u505C\u6B62\u5B9E\u65F6\u5237\u65B0"
), disscuss_count === 0 ? /* @__PURE__ */ _react_17_0_2_react.createElement(NoData/* default */.Z, { styles: { clear: "both" } }) : null, comments.map((item, index) => /* @__PURE__ */ _react_17_0_2_react.createElement(
discuss_item,
{
user,
key: item.id,
userInfomation: userInfo,
data: item,
index,
identity,
onPaginationChange,
shixunIdentifier,
onSetActionType,
onTopOrDownDiscuss,
adminOrOperator: can_hidden,
onPlusDiscuss,
onDisableDiscuss,
onSetRewardData,
activeDiscussIndex,
onHandleSubmitDiscusses: onSubmitDiscusses,
onSetActiveDiscussIndex,
onReplyDiscuss,
allowDisableDiscuss,
onHandleRepaly
}
)), disscuss_count > 10 ? /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "pagination-container" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
pagination/* default */.Z,
{
showQuickJumper: true,
showSizeChanger: false,
onChange: onPaginationChange,
current: page,
total: disscuss_count
}
)) : null, /* @__PURE__ */ _react_17_0_2_react.createElement(AiAnswer, null)), /* @__PURE__ */ _react_17_0_2_react.createElement(modal/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(
es_modal["default"],
{
centered: true,
title: "\u63D0\u793A",
open: !!actionType,
onOk: onProcessAction,
onCancel: onCancelAction
},
/* @__PURE__ */ _react_17_0_2_react.createElement("p", null, actionType ? actionType.message : "")
), /* @__PURE__ */ _react_17_0_2_react.createElement(
es_modal["default"],
{
centered: true,
width: 400,
title: "\u5956\u52B1\u8BBE\u7F6E",
open: showRewardDialog,
onCancel: onCancelRewardDialog,
onOk: onRewardDiscuss
},
/* @__PURE__ */ _react_17_0_2_react.createElement(
input_number/* default */.Z,
{
placeholder: "\u8BF7\u8F93\u5165\u5956\u52B1\u7684\u91D1\u5E01\u6570\u91CF",
min: 1,
onChange: onSetDiscussScore,
style: { width: "228px" }
}
)
)));
});
/***/ })
}]);