touchstudy-core 0.1.122 → 0.1.124

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,8 +6,7 @@ interface Props {
6
6
  resultData?: ExamResult;
7
7
  textbookResult?: TextbookResult;
8
8
  examTime: string;
9
- status?: string;
10
- isShow?: (value: number) => boolean;
9
+ isShow: (value: number) => boolean;
11
10
  isStudent: boolean;
12
11
  categoryResponses: CategoryResponse[];
13
12
  timelyOrderQuestions: TimelyOrderQuestion[];
package/dist/index.js CHANGED
@@ -5101,9 +5101,6 @@ var PrintExamView2 = function PrintExamView2(_ref) {
5101
5101
  setErrorLinks([]);
5102
5102
  setState(PrintState.Printing);
5103
5103
  };
5104
- console.log({
5105
- status: status
5106
- });
5107
5104
  var print = function print(_ref2) {
5108
5105
  var examSessionId = _ref2.examSessionId,
5109
5106
  studentId = _ref2.studentId,
@@ -5122,7 +5119,7 @@ var PrintExamView2 = function PrintExamView2(_ref) {
5122
5119
  code: code,
5123
5120
  examSessionId: "" + examSessionId,
5124
5121
  studentId: "" + studentId,
5125
- message: isTeacher ? "/teacher/exam-results/" + examSessionId + "/students/" + studentId + "/print" : "/student/exam-results/" + code + "/print"
5122
+ message: isTeacher ? "/teacher/exam-results/" + examSessionId + "/students/" + studentId + "/print?status=" + status.join(",") : "/student/exam-results/" + code + "/print"
5126
5123
  }]);
5127
5124
  });
5128
5125
  if (!isTeacher) {
@@ -5209,7 +5206,7 @@ var PrintExamView2 = function PrintExamView2(_ref) {
5209
5206
  code: (_event$data = event.data) === null || _event$data === void 0 ? void 0 : _event$data.code,
5210
5207
  examSessionId: (_event$data2 = event.data) === null || _event$data2 === void 0 ? void 0 : _event$data2.examSessionId,
5211
5208
  studentId: "" + studentId,
5212
- message: isTeacher ? "/teacher/exam-results/" + event.data.examSessionId + "/students/" + event.data.studentId + "/print" : "/student/exam-results/" + event.data.code + "/print"
5209
+ message: isTeacher ? "/teacher/exam-results/" + event.data.examSessionId + "/students/" + event.data.studentId + "/print?status=" + status.join(",") : "/student/exam-results/" + event.data.code + "/print"
5213
5210
  }]);
5214
5211
  });
5215
5212
  }
@@ -5246,7 +5243,7 @@ var PrintExamView2 = function PrintExamView2(_ref) {
5246
5243
  className: "mt-2"
5247
5244
  }, React__default.createElement(material.Typography, {
5248
5245
  fontWeight: 700
5249
- }, t("download_failed"), ":"), Array.from(new Set(errorLinks)).map(function (i) {
5246
+ }, t("download_failed"), ":"), Array.from(new Set(errorLinks)).map(function (i, index) {
5250
5247
  var _info$createdBy;
5251
5248
  var info = isTeacher ? dataExamSession.find(function (exam) {
5252
5249
  return "" + (exam === null || exam === void 0 ? void 0 : exam.examSessionId) === "" + (i === null || i === void 0 ? void 0 : i.examSessionId) && "" + (exam === null || exam === void 0 ? void 0 : exam.studentId) === "" + (i === null || i === void 0 ? void 0 : i.studentId);
@@ -5254,6 +5251,7 @@ var PrintExamView2 = function PrintExamView2(_ref) {
5254
5251
  return (exam === null || exam === void 0 ? void 0 : exam.code) === (i === null || i === void 0 ? void 0 : i.code);
5255
5252
  });
5256
5253
  return React__default.createElement(material.Stack, {
5254
+ key: index,
5257
5255
  borderBottom: 1,
5258
5256
  borderColor: theme.palette.grey[500]
5259
5257
  }, React__default.createElement("a", {
@@ -5283,10 +5281,11 @@ var PrintExamView2 = function PrintExamView2(_ref) {
5283
5281
  gap: 1,
5284
5282
  flexWrap: "wrap"
5285
5283
  }
5286
- }, TabList.map(function (_ref3) {
5284
+ }, TabList.map(function (_ref3, index) {
5287
5285
  var label = _ref3.label,
5288
5286
  value = _ref3.value;
5289
5287
  return React__default.createElement(material.FormControlLabel, {
5288
+ key: index,
5290
5289
  control: React__default.createElement(material.Checkbox, {
5291
5290
  onChange: handleChangeStatus,
5292
5291
  value: value,
@@ -18556,7 +18555,6 @@ var PrintExamResult = function PrintExamResult(_ref) {
18556
18555
  textbookResult = _ref.textbookResult,
18557
18556
  chapterId = _ref.chapterId,
18558
18557
  examTime = _ref.examTime,
18559
- status = _ref.status,
18560
18558
  isShow = _ref.isShow,
18561
18559
  isStudent = _ref.isStudent,
18562
18560
  totalTime = _ref.totalTime,
@@ -18569,11 +18567,6 @@ var PrintExamResult = function PrintExamResult(_ref) {
18569
18567
  longTimeSpend = _ref.longTimeSpend,
18570
18568
  contentRef = _ref.contentRef,
18571
18569
  setRenderedChart = _ref.setRenderedChart;
18572
- console.log({
18573
- bang: status,
18574
- chapterId: chapterId,
18575
- bang2: isShow === null || isShow === void 0 ? void 0 : isShow(TabList$2[1].value)
18576
- });
18577
18570
  var academy = reactRedux.useSelector(function (state) {
18578
18571
  var _state$common;
18579
18572
  return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.academy;
@@ -18747,7 +18740,7 @@ var PrintExamResult = function PrintExamResult(_ref) {
18747
18740
  fontWeight: 600,
18748
18741
  color: styles.gray_700
18749
18742
  }
18750
- }, resultData === null || resultData === void 0 ? void 0 : resultData.teacherName)))))), (!status || (isShow === null || isShow === void 0 ? void 0 : isShow(TabList$2[0].value))) && React__default.createElement(material.Stack, {
18743
+ }, resultData === null || resultData === void 0 ? void 0 : resultData.teacherName)))))), isShow(TabList$2[0].value) && React__default.createElement(material.Stack, {
18751
18744
  display: "flex",
18752
18745
  flexDirection: "column",
18753
18746
  gap: "12px"
@@ -18761,7 +18754,7 @@ var PrintExamResult = function PrintExamResult(_ref) {
18761
18754
  data: resultData,
18762
18755
  categories: categoryResponses,
18763
18756
  isStudent: isStudent
18764
- })), (!status || (isShow === null || isShow === void 0 ? void 0 : isShow(TabList$2[1].value))) && React__default.createElement(material.Stack, {
18757
+ })), isShow(TabList$2[1].value) && React__default.createElement(material.Stack, {
18765
18758
  display: "flex",
18766
18759
  flexDirection: "column",
18767
18760
  gap: "12px",
@@ -18788,7 +18781,7 @@ var PrintExamResult = function PrintExamResult(_ref) {
18788
18781
  series: allSeries[index],
18789
18782
  setIsRendered: setRenderedChart
18790
18783
  });
18791
- })), (!status || (isShow === null || isShow === void 0 ? void 0 : isShow(TabList$2[2].value))) && React__default.createElement(material.Stack, {
18784
+ })), isShow(TabList$2[2].value) && React__default.createElement(material.Stack, {
18792
18785
  display: "flex",
18793
18786
  flexDirection: "column",
18794
18787
  gap: "12px",
@@ -18797,7 +18790,7 @@ var PrintExamResult = function PrintExamResult(_ref) {
18797
18790
  sx: textStyle
18798
18791
  }, i18n.t(TabList$2[2].label)), React__default.createElement(CompareGrass, {
18799
18792
  effectSize: effectSize
18800
- })), (!status || (isShow === null || isShow === void 0 ? void 0 : isShow(TabList$2[3].value))) && React__default.createElement(material.Stack, {
18793
+ })), isShow(TabList$2[3].value) && React__default.createElement(material.Stack, {
18801
18794
  display: "flex",
18802
18795
  flexDirection: "column",
18803
18796
  gap: "12px",
@@ -19631,7 +19624,6 @@ var useExamResultData = function useExamResultData(props) {
19631
19624
  var _temp6 = _catch(function () {
19632
19625
  return Promise.resolve(Promise.all([getChapterResultsApi(chapterId), getChapterResultsLongTimeSpendApi(chapterId), getChapterResultsEffectSizeApi(chapterId), getChapterResultsTimeOrderQuestionApi(chapterId), getChapterResultsCategoriesApi(chapterId)])).then(function (result) {
19633
19626
  var _result$0$data3, _result$1$data3, _result$2$data3, _result$3$data3, _result$4$data3;
19634
- console.log(result);
19635
19627
  handleChangeTab === null || handleChangeTab === void 0 ? void 0 : handleChangeTab(0);
19636
19628
  setDataChartIndex(0);
19637
19629
  setTextbookResult((_result$0$data3 = result[0].data) === null || _result$0$data3 === void 0 ? void 0 : _result$0$data3.data);
@@ -20180,8 +20172,9 @@ var usePrintExamResult = function usePrintExamResult(isDataFetching, fileName, t
20180
20172
  };
20181
20173
  var _temp3 = _catch(function () {
20182
20174
  function _temp2() {
20183
- html2pdf().from(element).set(options).save();
20184
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
20175
+ return Promise.resolve(html2pdf().from(element).set(options).save()).then(function () {
20176
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
20177
+ });
20185
20178
  }
20186
20179
  var element = contentRef.current;
20187
20180
  var options = {
@@ -20192,7 +20185,7 @@ var usePrintExamResult = function usePrintExamResult(isDataFetching, fileName, t
20192
20185
  quality: 1
20193
20186
  },
20194
20187
  html2canvas: {
20195
- scale: 4
20188
+ scale: 1.5
20196
20189
  },
20197
20190
  jsPDF: {
20198
20191
  format: 'a4',
@@ -20894,12 +20887,10 @@ var usePrintView = function usePrintView(_ref) {
20894
20887
  var search = window.location.search;
20895
20888
  var query = new URLSearchParams(search);
20896
20889
  var status = query.get('status') || '';
20897
- var isPrintAll = status === "";
20898
- var isShow = function isShow(value) {
20899
- return (status === null || status === void 0 ? void 0 : status.split(',').some(function (i) {
20900
- return i === value.toString();
20901
- })) || false;
20902
- };
20890
+ var isPrintAll = !(status !== null && status !== void 0 && status.length);
20891
+ var isShow = React.useCallback(function (value) {
20892
+ return isPrintAll || (status === null || status === void 0 ? void 0 : status.split(',').includes(value.toString()));
20893
+ }, [isPrintAll, status]);
20903
20894
  var handelPrintSuccess = function handelPrintSuccess() {
20904
20895
  var _window$opener$postMe, _window$opener;
20905
20896
  var data;
@@ -21023,11 +21014,10 @@ var PrintExamResultView = function PrintExamResultView(_ref) {
21023
21014
  }),
21024
21015
  fileName = _usePrintView.fileName,
21025
21016
  isDone = _usePrintView.isDone,
21026
- status = _usePrintView.status,
21027
21017
  isShow = _usePrintView.isShow,
21028
21018
  handelPrintSuccess = _usePrintView.handelPrintSuccess,
21029
21019
  handelPrintError = _usePrintView.handelPrintError;
21030
- var _usePrintExamResult = usePrintExamResult(isLoading, fileName, !status || isShow !== null && isShow !== void 0 && isShow(TabList$2[1].value) ? timelyOrderQuestions.length : 0, handelPrintSuccess, handelPrintError, true),
21020
+ var _usePrintExamResult = usePrintExamResult(isLoading, fileName, isShow !== null && isShow !== void 0 && isShow(TabList$2[1].value) ? timelyOrderQuestions.length : 0, handelPrintSuccess, handelPrintError, true),
21031
21021
  contentRef = _usePrintExamResult.contentRef,
21032
21022
  setRenderedChart = _usePrintExamResult.setRenderedChart;
21033
21023
  var isTabletUp = material.useMediaQuery("(min-width:900px)");
@@ -21054,7 +21044,6 @@ var PrintExamResultView = function PrintExamResultView(_ref) {
21054
21044
  fileName: fileName,
21055
21045
  isShow: isShow,
21056
21046
  totalTime: totalTime,
21057
- status: status,
21058
21047
  setRenderedChart: setRenderedChart
21059
21048
  }) : isLoading === undefined || isLoading === true ? React__default.createElement(LoadingComponent, {
21060
21049
  isLoading: !!isLoading,