exercise.js 953 B

1234567891011121314151617181920212223242526272829303132
  1. import { ref } from 'vue';
  2. import { GetShareConfig } from '@/api/app';
  3. export const questionColorList = [
  4. { label: '正确', color: '#D9D9D9' },
  5. { label: '错题', color: '#F2555A' },
  6. { label: '主观题', color: '#FEF2A4' }
  7. ];
  8. export function useExerciseTeacher() {
  9. let exercise_share_url_path = ref('');
  10. GetShareConfig().then(({ exercise_share_url_path: path }) => {
  11. exercise_share_url_path.value = path;
  12. });
  13. /**
  14. * 跳转到答题页面
  15. * @param {string} exercise_share_record_id 分享记录id
  16. * @param {string} exercise_answer_record_id 答题记录id
  17. * @param {number} index 题目索引
  18. */
  19. function exerciseLink(exercise_share_record_id, exercise_answer_record_id, index) {
  20. window.open(
  21. `${exercise_share_url_path.value}?share_record_id=${exercise_share_record_id}&answer_record_id=${exercise_answer_record_id}&question_index=${index}`,
  22. '_blank'
  23. );
  24. }
  25. return {
  26. exerciseLink
  27. };
  28. }