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.
266 lines
11 KiB
266 lines
11 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[44449],{
|
|
|
|
/***/ 77627:
|
|
/*!**************************************************************!*\
|
|
!*** ./src/pages/Competitions/Exports/index.tsx + 1 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 */ Exports; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
|
|
var regeneratorRuntime = __webpack_require__(7557);
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__(82242);
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
|
|
var asyncToGenerator = __webpack_require__(41498);
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
|
|
var slicedToArray = __webpack_require__(79800);
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__(39647);
|
|
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
|
|
// 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);
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
|
|
var _umi_production_exports = __webpack_require__(80184);
|
|
// EXTERNAL MODULE: ./node_modules/_html2pdf.js@0.10.3@html2pdf.js/dist/html2pdf.js
|
|
var html2pdf = __webpack_require__(44164);
|
|
var html2pdf_default = /*#__PURE__*/__webpack_require__.n(html2pdf);
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
var util = __webpack_require__(1079);
|
|
// EXTERNAL MODULE: ./src/service/competitions.ts
|
|
var competitions = __webpack_require__(94414);
|
|
// EXTERNAL MODULE: ./src/components/ImagesIcon/index.ts + 32 modules
|
|
var ImagesIcon = __webpack_require__(44189);
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
var env = __webpack_require__(67390);
|
|
;// CONCATENATED MODULE: ./src/pages/Competitions/Exports/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Exportsmodules = ({"wrp":"wrp___RgCVv","underline":"underline___h554C","win":"win___xzwAk","desc":"desc___AvQYp"});
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
;// CONCATENATED MODULE: ./src/pages/Competitions/Exports/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["classroomList", "dispatch"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var CompetitionsExportPage = function CompetitionsExportPage(_ref) {
|
|
var classroomList = _ref.classroomList,
|
|
dispatch = _ref.dispatch,
|
|
props = objectWithoutProperties_default()(_ref, _excluded);
|
|
var _useState = (0,_react_17_0_2_react.useState)(false),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
show = _useState2[0],
|
|
setShow = _useState2[1];
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(props.location.query),
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
query = _useState4[0],
|
|
setQuery = _useState4[1];
|
|
var reportElement = (0,_react_17_0_2_react.useRef)();
|
|
var dataType = [{
|
|
name: '最新',
|
|
id: 'created_at'
|
|
}, {
|
|
name: '最热',
|
|
id: 'visits'
|
|
}];
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
// setShow(true)
|
|
// if (isCommonSuperAdminOrOperation() && !query.id) setShow(true);
|
|
if (query.id) getData();
|
|
}, []);
|
|
var getData = /*#__PURE__*/function () {
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
_context.next = 2;
|
|
return (0,competitions/* getCertificateInfo */.Ju)(objectSpread2_default()({}, query));
|
|
case 2:
|
|
res = _context.sent;
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
setShow(true);
|
|
query.school_name = res.data.school_name;
|
|
query.user_name = res.data.username;
|
|
query.student_id = res.data.student_id;
|
|
query.win_type = res.data.competition_name;
|
|
query.win = res.data.award_name;
|
|
query.group = res.data.competition;
|
|
query.suffix = res.data.identity;
|
|
query.prize_template_id = res.data.prize_template_id;
|
|
setQuery(objectSpread2_default()({}, query));
|
|
// query.student_id = res.data.student_id;
|
|
}
|
|
case 4:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
return function getData() {
|
|
return _ref2.apply(this, arguments);
|
|
};
|
|
}();
|
|
var exportReport = /*#__PURE__*/function () {
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
var opt, doc, url;
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
case 0:
|
|
opt = {
|
|
margin: [20, 0, 0, 0],
|
|
filename: "11.pdf",
|
|
enableLinks: false,
|
|
html2canvas: {
|
|
scale: 5,
|
|
allowTaint: false,
|
|
useCORS: true
|
|
// width: 1000,
|
|
},
|
|
// pagebreak:{mode:["avoid-all", 'css', 'legacy'],before:"#reportElement"},
|
|
jsPDF: {
|
|
format: [1360, 1010],
|
|
orientation: 'landscape',
|
|
unit: "px"
|
|
},
|
|
image: {
|
|
type: 'jpeg',
|
|
quality: 0.98
|
|
}
|
|
}; // html2pdf().set(opt).from(reportElement.current).save();
|
|
// const pdfUrl = await html2pdf()
|
|
// .from(reportElement.current)
|
|
// .set(opt)
|
|
// .toPdf()
|
|
// // .output('bloburl')
|
|
// const a = await pdfUrl.get("pdf")
|
|
// console.log("pdfUrl:", pdfUrl)
|
|
doc = html2pdf_default()().set(opt).from(reportElement.current).toPdf(); // for (let j = 1; j < pages.length; j++) {
|
|
// doc = doc.get('pdf').then(
|
|
// (pdf: any) => { pdf.addPage() }
|
|
// ).from(pages[j]).toContainer().toCanvas().toPdf()
|
|
// }
|
|
_context2.next = 4;
|
|
return doc.get('pdf');
|
|
case 4:
|
|
doc = _context2.sent;
|
|
_context2.next = 7;
|
|
return doc.output('bloburl');
|
|
case 7:
|
|
url = _context2.sent;
|
|
//
|
|
(0,util/* downLoadLink */.Nd)("".concat(query.school_name, "_").concat(query.user_name, "_").concat(query.win, "_").concat(query.group, ".pdf"), url);
|
|
case 9:
|
|
case "end":
|
|
return _context2.stop();
|
|
}
|
|
}, _callee2);
|
|
}));
|
|
return function exportReport() {
|
|
return _ref3.apply(this, arguments);
|
|
};
|
|
}();
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
children: show && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
className: "tc mt10 mb30",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
size: "large",
|
|
type: "primary",
|
|
onClick: exportReport,
|
|
children: "\u5BFC\u51FA\u5956\u72B6"
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
className: "edu-container relative",
|
|
style: {
|
|
height: 880,
|
|
width: 1000
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
ref: reportElement,
|
|
id: "reportElement",
|
|
style: {
|
|
width: 1000,
|
|
position: "relative"
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
className: Exportsmodules.wrp,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
className: "ml50",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Exportsmodules.underline,
|
|
children: query.school_name || '国防科技大学'
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "ml20 mr20 ".concat(Exportsmodules.underline),
|
|
children: query.user_name || ''
|
|
}), query.suffix, query.student_id && query.type == 2 && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
children: ["\uFF0C\u5B66\u53F7", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "".concat(Exportsmodules.underline, " ml20"),
|
|
children: query.student_id
|
|
})]
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "mt10",
|
|
children: ["\u8363\u83B7\uFF1A\u201C", query.win_type || '', !!query.group && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
children: ["\uFF08", query.group || '代码标注组', "\uFF09"]
|
|
}), "\u201D"]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Exportsmodules.win,
|
|
children: query.win || '一等奖'
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Exportsmodules.desc,
|
|
children: "\u7279\u53D1\u6B64\u8BC1\uFF0C\u4EE5\u8D44\u9F13\u52B1\u3002"
|
|
})]
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
src: query.prize_template_id ? env/* default */.Z.IMG_SERVER + "/api/attachments/" + query.prize_template_id : ImagesIcon/* certificateIcon */.uM,
|
|
style: {
|
|
width: "100%"
|
|
}
|
|
})]
|
|
})
|
|
})]
|
|
})
|
|
});
|
|
};
|
|
/* harmony default export */ var Exports = ((0,_umi_production_exports.connect)(function (_ref4) {
|
|
var classroomList = _ref4.classroomList,
|
|
user = _ref4.user;
|
|
return {
|
|
classroomList: classroomList,
|
|
user: user
|
|
};
|
|
})(CompetitionsExportPage));
|
|
|
|
/***/ })
|
|
|
|
}]); |