quiz.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const navBarHeight = 44;
  4. const _sfc_main = {
  5. __name: "quiz",
  6. setup(__props) {
  7. const url = common_vendor.ref("");
  8. const assessmentId = common_vendor.ref("");
  9. const source = common_vendor.ref("");
  10. const statusBarHeight = common_vendor.index.getSystemInfoSync().statusBarHeight || 20;
  11. const navBarStyle = `padding-top:${statusBarHeight}px;height:${navBarHeight}px;`;
  12. const contentStyle = `margin-top:${statusBarHeight + navBarHeight}px;`;
  13. const handleBack = () => {
  14. if (source.value === "kaoshixing" && assessmentId.value) {
  15. common_vendor.index.redirectTo({
  16. url: `/pages/common/webview?mode=kaoshixing&assessmentId=${encodeURIComponent(assessmentId.value)}`
  17. });
  18. return true;
  19. }
  20. common_vendor.index.navigateBack();
  21. return true;
  22. };
  23. common_vendor.onBackPress((options) => {
  24. return handleBack();
  25. });
  26. common_vendor.onLoad((options) => {
  27. assessmentId.value = options.assessmentId || "";
  28. source.value = options.from || "";
  29. if (options.from === "report") {
  30. const cachedUrl = common_vendor.index.getStorageSync("temp_report_url");
  31. if (cachedUrl) {
  32. url.value = cachedUrl;
  33. common_vendor.index.removeStorageSync("temp_report_url");
  34. return;
  35. }
  36. }
  37. if (options.from === "kaoshixing") {
  38. const cachedUrl = common_vendor.index.getStorageSync("temp_exam_url");
  39. if (cachedUrl) {
  40. url.value = cachedUrl;
  41. common_vendor.index.removeStorageSync("temp_exam_url");
  42. return;
  43. }
  44. }
  45. if (options.url) {
  46. url.value = decodeURIComponent(options.url);
  47. common_vendor.index.__f__("log", "at pages/assessment/quiz.vue:67", "Quiz WebView Loading URL:", url.value);
  48. }
  49. });
  50. return (_ctx, _cache) => {
  51. return common_vendor.e({
  52. a: common_vendor.o(handleBack),
  53. b: common_vendor.s(navBarStyle),
  54. c: url.value
  55. }, url.value ? {
  56. d: url.value
  57. } : {}, {
  58. e: common_vendor.s(contentStyle)
  59. });
  60. };
  61. }
  62. };
  63. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-e770efc2"]]);
  64. wx.createPage(MiniProgramPage);
  65. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/assessment/quiz.js.map