index.tsx 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import MHeader from '@/components/m-header';
  2. import MSticky from '@/components/m-sticky';
  3. import { defineComponent, onMounted } from 'vue';
  4. import styles from './index.module.less';
  5. import { useRouter } from 'vue-router';
  6. import { Image, showToast } from 'vant';
  7. import AiExam from './images/ai-exam.png';
  8. import WoringPractice from './images/woring-practice.png';
  9. import WoringStat from './images/woring-stat.png';
  10. import AiExamTablet from './images/ai-exam-tablet.png';
  11. import WoringPracticeTablet from './images/woring-practice-tablet.png';
  12. import WoringStatTablet from './images/woring-stat-tablet.png';
  13. import request from '@/helpers/request';
  14. import { browser } from '@/helpers/utils';
  15. import { postMessage } from '@/helpers/native-message';
  16. import WoringGuide from '@/custom-plugins/guide-page/woring-guide';
  17. export default defineComponent({
  18. name: 'wroing-book',
  19. setup() {
  20. const router = useRouter();
  21. /** 错题练习 */
  22. const onErrorPractice = async () => {
  23. try {
  24. const { data } = await request.post(
  25. '/edu-app/studentUnitExamination/errorEdition',
  26. {
  27. hideLoading: false,
  28. data: {
  29. page: 1,
  30. rows: 50
  31. }
  32. }
  33. );
  34. const temp = data || {};
  35. if (temp.total > 0) {
  36. router.push({
  37. path: '/error-question-mode'
  38. });
  39. } else {
  40. setTimeout(() => {
  41. showToast('暂无错题');
  42. }, 100);
  43. }
  44. } catch {
  45. //
  46. }
  47. };
  48. onMounted(() => {
  49. // setTimeout(() => {
  50. // const script = document.createElement('script');
  51. // script.type = 'text/javascript';
  52. // script.src = 'https://online.dayaedu.com/_AMapService111';
  53. // document.body.appendChild(script);
  54. // }, 1000);
  55. });
  56. return () => (
  57. <div
  58. class={[
  59. styles.woringBook,
  60. browser().isTablet ? styles.woringBookTablet : ''
  61. ]}>
  62. <MSticky position="top">
  63. <MHeader border={false} background="transparent">
  64. {{
  65. content: () => (
  66. <div class={styles.woringHeader}>
  67. <i
  68. onClick={() => {
  69. if (browser().isApp) {
  70. postMessage({
  71. api: 'goBack'
  72. });
  73. } else {
  74. router.back();
  75. }
  76. }}
  77. class={[
  78. 'van-badge__wrapper van-icon van-icon-arrow-left van-nav-bar__arrow',
  79. styles.leftArrow
  80. ]}></i>
  81. <span class={styles.title}>
  82. <i></i>
  83. </span>
  84. </div>
  85. )
  86. }}
  87. </MHeader>
  88. </MSticky>
  89. <div class={styles.woringSecgtion}>
  90. <Image
  91. {...{ id: 'woring-0' }}
  92. lazyLoad
  93. src={browser().isTablet ? WoringStatTablet : WoringStat}
  94. class={styles.woringImg}
  95. onClick={() => router.push('wroing-stat')}
  96. />
  97. {/* 错题练习 */}
  98. <Image
  99. {...{ id: 'woring-1' }}
  100. lazyLoad
  101. src={browser().isTablet ? WoringPracticeTablet : WoringPractice}
  102. class={styles.woringImg}
  103. onClick={onErrorPractice}
  104. />
  105. <Image
  106. {...{ id: 'woring-2' }}
  107. lazyLoad
  108. src={browser().isTablet ? AiExamTablet : AiExam}
  109. class={styles.woringImg}
  110. onClick={() => router.push('ai-exam')}
  111. />
  112. </div>
  113. <WoringGuide></WoringGuide>
  114. </div>
  115. );
  116. }
  117. });