globalVariable.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. const MathQueue = function (elementId) {
  2. // check MathJax is ready
  3. if (!window.MathJax.version) return
  4. // re-render
  5. // window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub, docEle]);
  6. MathJax.startup.promise.then(_ => {
  7. if (!elementId) return MathJax.typesetPromise()
  8. const docEle = document.getElementById(elementId)
  9. if (!docEle) return
  10. MathJax.typesetPromise([docEle])
  11. })
  12. };
  13. const EvalOpenStates = ["已开启", "未开启"];
  14. const EvalInspectionStates = ["已阅卷", "未阅卷"];
  15. const MergeEvalOpenStates = function (item) {
  16. if (!item || EvalOpenStates.includes(item))
  17. return EvalOpenStates
  18. return [...EvalOpenStates, item]
  19. }
  20. const MergeEvalInspectionStates = function (item) {
  21. if (!item || EvalInspectionStates.includes(item))
  22. return EvalInspectionStates;
  23. return [...EvalInspectionStates, item]
  24. }
  25. const TailingClassName = function (className) {
  26. if (!className) return "";
  27. if (className.endsWith("班")) return className;
  28. return className + "班";
  29. }
  30. const EvalTitleSeperator = "--------";
  31. const uploadFileTypes = ['application/msword', 'application/pdf', 'application/vnd.ms-powerpoint',
  32. 'application/vnd.ms-excel', 'image/jpeg', 'image/jpg', 'image/png',
  33. 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
  34. 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
  35. 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
  36. ]
  37. export default {
  38. MathQueue,
  39. EvalOpenStates,
  40. EvalInspectionStates,
  41. MergeEvalOpenStates,
  42. MergeEvalInspectionStates,
  43. TailingClassName,
  44. EvalTitleSeperator,
  45. uploadFileTypes
  46. }