@zykjcommon/questions 0.0.31 → 0.0.32

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.
@@ -24710,6 +24710,103 @@ var state = {
24710
24710
 
24711
24711
 
24712
24712
 
24713
+ var parseQuestionListItem = function parseQuestionListItem(mode, question_list, answer_map) {
24714
+ var _this = this;
24715
+ var parentIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
24716
+ function parseContent(arr, contentWidth) {
24717
+ arr.forEach(function (item) {
24718
+ if (item['<>'] === 'img') {
24719
+ if (item.hasOwnProperty('width')) {
24720
+ var width = Number(item.width);
24721
+ if (width > contentWidth) {
24722
+ item.width = Math.floor(contentWidth);
24723
+ item.height && delete item.height;
24724
+ }
24725
+ }
24726
+ }
24727
+ if (item.html && item.html.length) {
24728
+ parseContent(item.html, contentWidth);
24729
+ }
24730
+ });
24731
+ }
24732
+ question_list.forEach(function (item, index) {
24733
+ item.questionComponent = questionMapper[item.question_type];
24734
+ // item.questionIndex = index + 1
24735
+ if (parentIndex === undefined) {
24736
+ item.questionIndex = index + 1;
24737
+ } else {
24738
+ item.questionIndex = parentIndex + 1 + '-' + (index + 1);
24739
+ item.questionIndex2 = index + 1;
24740
+ }
24741
+ if (answer_map && answer_map.hasOwnProperty(item.question_id)) {
24742
+ item.answerMap = answer_map[item.question_id];
24743
+ if (mode === 'analysis') {
24744
+ //analysis页面特殊处理
24745
+ if (item.answerMap.user_coding_file) {
24746
+ item.answerMap.oss_temp_url = item.answerMap.user_coding_file;
24747
+ }
24748
+ //analysis页面特殊处理score字段为 answerMap.question_max_score
24749
+ item.score = item.answerMap.question_max_score;
24750
+ //预览接口学生答案以user_开头,为适配考试的学生答案,做处理
24751
+ var answerMapKeys = Object.keys(item.answerMap);
24752
+ var reg = /^user_/ig;
24753
+ answerMapKeys.forEach(function (answerMapKeysItem) {
24754
+ if (reg.test(answerMapKeysItem)) {
24755
+ var newProp = answerMapKeysItem.replace(reg, '');
24756
+ item.answerMap[newProp] = item.answerMap[answerMapKeysItem];
24757
+ }
24758
+ });
24759
+ }
24760
+ } else {
24761
+ item.answerMap = null;
24762
+ }
24763
+ var question_type = item.question_type;
24764
+ if (question_type == 3) {
24765
+ //判断题手动构造选项数组
24766
+ item.exam_options_data = [{
24767
+ index: 1,
24768
+ data: {
24769
+ name: '正确'
24770
+ }
24771
+ }, {
24772
+ index: 2,
24773
+ data: {
24774
+ name: '错误'
24775
+ }
24776
+ }];
24777
+ } else {
24778
+ if (item.exam_options_data && item.exam_options_data.length) {
24779
+ item.exam_options_data.forEach(function (subItem, subIndex) {
24780
+ subItem.enIndex = js_fun.indexToEnIndex(subIndex + 1);
24781
+ });
24782
+ }
24783
+ }
24784
+ //转化content富文本
24785
+ try {
24786
+ var contentArr = JSON.parse(item.content);
24787
+ var contentWidth = jQuery('.question-list').width() - 30;
24788
+ //图片宽度超出框架的时候把宽度设置成框架大小
24789
+ parseContent(contentArr, contentWidth);
24790
+ item.htmlContent = $.json2html({}, contentArr);
24791
+ } catch (e) {
24792
+ item.htmlContent = item.content;
24793
+ }
24794
+ //转化analysis富文本
24795
+ try {
24796
+ if (item.analysis) {
24797
+ item.analysisHtmlContent = $.json2html({}, JSON.parse(item.analysis));
24798
+ } else {
24799
+ item.analysisHtmlContent = '';
24800
+ }
24801
+ } catch (e) {
24802
+ item.analysisHtmlContent = item.analysis;
24803
+ }
24804
+ //如果是阅读题要递归解析
24805
+ if (item.sub_questions && item.sub_questions.length) {
24806
+ _this.parseQuestionListItem(mode, item.sub_questions, answer_map, index);
24807
+ }
24808
+ });
24809
+ };
24713
24810
  /* harmony default export */ function buildEntry(store) {
24714
24811
  //动态注册store
24715
24812
  store.registerModule('zykjcommonQuestions', questions_store);
@@ -24719,103 +24816,7 @@ var state = {
24719
24816
  Vue.mixin({
24720
24817
  methods: {
24721
24818
  //公共解析questionItem方法
24722
- parseQuestionListItem: function parseQuestionListItem(mode, question_list, answer_map) {
24723
- var _this = this;
24724
- var parentIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
24725
- function parseContent(arr, contentWidth) {
24726
- arr.forEach(function (item) {
24727
- if (item['<>'] === 'img') {
24728
- if (item.hasOwnProperty('width')) {
24729
- var width = Number(item.width);
24730
- if (width > contentWidth) {
24731
- item.width = Math.floor(contentWidth);
24732
- item.height && delete item.height;
24733
- }
24734
- }
24735
- }
24736
- if (item.html && item.html.length) {
24737
- parseContent(item.html, contentWidth);
24738
- }
24739
- });
24740
- }
24741
- question_list.forEach(function (item, index) {
24742
- item.questionComponent = questionMapper[item.question_type];
24743
- // item.questionIndex = index + 1
24744
- if (parentIndex === undefined) {
24745
- item.questionIndex = index + 1;
24746
- } else {
24747
- item.questionIndex = parentIndex + 1 + '-' + (index + 1);
24748
- item.questionIndex2 = index + 1;
24749
- }
24750
- if (answer_map && answer_map.hasOwnProperty(item.question_id)) {
24751
- item.answerMap = answer_map[item.question_id];
24752
- if (mode === 'analysis') {
24753
- //analysis页面特殊处理
24754
- if (item.answerMap.user_coding_file) {
24755
- item.answerMap.oss_temp_url = item.answerMap.user_coding_file;
24756
- }
24757
- //analysis页面特殊处理score字段为 answerMap.question_max_score
24758
- item.score = item.answerMap.question_max_score;
24759
- //预览接口学生答案以user_开头,为适配考试的学生答案,做处理
24760
- var answerMapKeys = Object.keys(item.answerMap);
24761
- var reg = /^user_/ig;
24762
- answerMapKeys.forEach(function (answerMapKeysItem) {
24763
- if (reg.test(answerMapKeysItem)) {
24764
- var newProp = answerMapKeysItem.replace(reg, '');
24765
- item.answerMap[newProp] = item.answerMap[answerMapKeysItem];
24766
- }
24767
- });
24768
- }
24769
- } else {
24770
- item.answerMap = null;
24771
- }
24772
- var question_type = item.question_type;
24773
- if (question_type == 3) {
24774
- //判断题手动构造选项数组
24775
- item.exam_options_data = [{
24776
- index: 1,
24777
- data: {
24778
- name: '正确'
24779
- }
24780
- }, {
24781
- index: 2,
24782
- data: {
24783
- name: '错误'
24784
- }
24785
- }];
24786
- } else {
24787
- if (item.exam_options_data && item.exam_options_data.length) {
24788
- item.exam_options_data.forEach(function (subItem, subIndex) {
24789
- subItem.enIndex = js_fun.indexToEnIndex(subIndex + 1);
24790
- });
24791
- }
24792
- }
24793
- //转化content富文本
24794
- try {
24795
- var contentArr = JSON.parse(item.content);
24796
- var contentWidth = jQuery('.question-list').width() - 30;
24797
- //图片宽度超出框架的时候把宽度设置成框架大小
24798
- parseContent(contentArr, contentWidth);
24799
- item.htmlContent = $.json2html({}, contentArr);
24800
- } catch (e) {
24801
- item.htmlContent = item.content;
24802
- }
24803
- //转化analysis富文本
24804
- try {
24805
- if (item.analysis) {
24806
- item.analysisHtmlContent = $.json2html({}, JSON.parse(item.analysis));
24807
- } else {
24808
- item.analysisHtmlContent = '';
24809
- }
24810
- } catch (e) {
24811
- item.analysisHtmlContent = item.analysis;
24812
- }
24813
- //如果是阅读题要递归解析
24814
- if (item.sub_questions && item.sub_questions.length) {
24815
- _this.parseQuestionListItem(mode, item.sub_questions, answer_map, index);
24816
- }
24817
- });
24818
- }
24819
+ parseQuestionListItem: parseQuestionListItem
24819
24820
  }
24820
24821
  });
24821
24822
  Vue.component('Question_SingleChoice', Question_SingleChoice);
@@ -24826,6 +24827,7 @@ var state = {
24826
24827
  Vue.component('Question_Programming', Question_Programming);
24827
24828
  Vue.component('Question_Classify', Question_Classify);
24828
24829
  },
24830
+ parseQuestionListItem: parseQuestionListItem,
24829
24831
  questionMapper: questionMapper,
24830
24832
  Question_SingleChoice: Question_SingleChoice,
24831
24833
  Question_MultipleChoice: Question_MultipleChoice,
@@ -24720,6 +24720,103 @@ var state = {
24720
24720
 
24721
24721
 
24722
24722
 
24723
+ var parseQuestionListItem = function parseQuestionListItem(mode, question_list, answer_map) {
24724
+ var _this = this;
24725
+ var parentIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
24726
+ function parseContent(arr, contentWidth) {
24727
+ arr.forEach(function (item) {
24728
+ if (item['<>'] === 'img') {
24729
+ if (item.hasOwnProperty('width')) {
24730
+ var width = Number(item.width);
24731
+ if (width > contentWidth) {
24732
+ item.width = Math.floor(contentWidth);
24733
+ item.height && delete item.height;
24734
+ }
24735
+ }
24736
+ }
24737
+ if (item.html && item.html.length) {
24738
+ parseContent(item.html, contentWidth);
24739
+ }
24740
+ });
24741
+ }
24742
+ question_list.forEach(function (item, index) {
24743
+ item.questionComponent = questionMapper[item.question_type];
24744
+ // item.questionIndex = index + 1
24745
+ if (parentIndex === undefined) {
24746
+ item.questionIndex = index + 1;
24747
+ } else {
24748
+ item.questionIndex = parentIndex + 1 + '-' + (index + 1);
24749
+ item.questionIndex2 = index + 1;
24750
+ }
24751
+ if (answer_map && answer_map.hasOwnProperty(item.question_id)) {
24752
+ item.answerMap = answer_map[item.question_id];
24753
+ if (mode === 'analysis') {
24754
+ //analysis页面特殊处理
24755
+ if (item.answerMap.user_coding_file) {
24756
+ item.answerMap.oss_temp_url = item.answerMap.user_coding_file;
24757
+ }
24758
+ //analysis页面特殊处理score字段为 answerMap.question_max_score
24759
+ item.score = item.answerMap.question_max_score;
24760
+ //预览接口学生答案以user_开头,为适配考试的学生答案,做处理
24761
+ var answerMapKeys = Object.keys(item.answerMap);
24762
+ var reg = /^user_/ig;
24763
+ answerMapKeys.forEach(function (answerMapKeysItem) {
24764
+ if (reg.test(answerMapKeysItem)) {
24765
+ var newProp = answerMapKeysItem.replace(reg, '');
24766
+ item.answerMap[newProp] = item.answerMap[answerMapKeysItem];
24767
+ }
24768
+ });
24769
+ }
24770
+ } else {
24771
+ item.answerMap = null;
24772
+ }
24773
+ var question_type = item.question_type;
24774
+ if (question_type == 3) {
24775
+ //判断题手动构造选项数组
24776
+ item.exam_options_data = [{
24777
+ index: 1,
24778
+ data: {
24779
+ name: '正确'
24780
+ }
24781
+ }, {
24782
+ index: 2,
24783
+ data: {
24784
+ name: '错误'
24785
+ }
24786
+ }];
24787
+ } else {
24788
+ if (item.exam_options_data && item.exam_options_data.length) {
24789
+ item.exam_options_data.forEach(function (subItem, subIndex) {
24790
+ subItem.enIndex = js_fun.indexToEnIndex(subIndex + 1);
24791
+ });
24792
+ }
24793
+ }
24794
+ //转化content富文本
24795
+ try {
24796
+ var contentArr = JSON.parse(item.content);
24797
+ var contentWidth = jQuery('.question-list').width() - 30;
24798
+ //图片宽度超出框架的时候把宽度设置成框架大小
24799
+ parseContent(contentArr, contentWidth);
24800
+ item.htmlContent = $.json2html({}, contentArr);
24801
+ } catch (e) {
24802
+ item.htmlContent = item.content;
24803
+ }
24804
+ //转化analysis富文本
24805
+ try {
24806
+ if (item.analysis) {
24807
+ item.analysisHtmlContent = $.json2html({}, JSON.parse(item.analysis));
24808
+ } else {
24809
+ item.analysisHtmlContent = '';
24810
+ }
24811
+ } catch (e) {
24812
+ item.analysisHtmlContent = item.analysis;
24813
+ }
24814
+ //如果是阅读题要递归解析
24815
+ if (item.sub_questions && item.sub_questions.length) {
24816
+ _this.parseQuestionListItem(mode, item.sub_questions, answer_map, index);
24817
+ }
24818
+ });
24819
+ };
24723
24820
  /* harmony default export */ function buildEntry(store) {
24724
24821
  //动态注册store
24725
24822
  store.registerModule('zykjcommonQuestions', questions_store);
@@ -24729,103 +24826,7 @@ var state = {
24729
24826
  Vue.mixin({
24730
24827
  methods: {
24731
24828
  //公共解析questionItem方法
24732
- parseQuestionListItem: function parseQuestionListItem(mode, question_list, answer_map) {
24733
- var _this = this;
24734
- var parentIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
24735
- function parseContent(arr, contentWidth) {
24736
- arr.forEach(function (item) {
24737
- if (item['<>'] === 'img') {
24738
- if (item.hasOwnProperty('width')) {
24739
- var width = Number(item.width);
24740
- if (width > contentWidth) {
24741
- item.width = Math.floor(contentWidth);
24742
- item.height && delete item.height;
24743
- }
24744
- }
24745
- }
24746
- if (item.html && item.html.length) {
24747
- parseContent(item.html, contentWidth);
24748
- }
24749
- });
24750
- }
24751
- question_list.forEach(function (item, index) {
24752
- item.questionComponent = questionMapper[item.question_type];
24753
- // item.questionIndex = index + 1
24754
- if (parentIndex === undefined) {
24755
- item.questionIndex = index + 1;
24756
- } else {
24757
- item.questionIndex = parentIndex + 1 + '-' + (index + 1);
24758
- item.questionIndex2 = index + 1;
24759
- }
24760
- if (answer_map && answer_map.hasOwnProperty(item.question_id)) {
24761
- item.answerMap = answer_map[item.question_id];
24762
- if (mode === 'analysis') {
24763
- //analysis页面特殊处理
24764
- if (item.answerMap.user_coding_file) {
24765
- item.answerMap.oss_temp_url = item.answerMap.user_coding_file;
24766
- }
24767
- //analysis页面特殊处理score字段为 answerMap.question_max_score
24768
- item.score = item.answerMap.question_max_score;
24769
- //预览接口学生答案以user_开头,为适配考试的学生答案,做处理
24770
- var answerMapKeys = Object.keys(item.answerMap);
24771
- var reg = /^user_/ig;
24772
- answerMapKeys.forEach(function (answerMapKeysItem) {
24773
- if (reg.test(answerMapKeysItem)) {
24774
- var newProp = answerMapKeysItem.replace(reg, '');
24775
- item.answerMap[newProp] = item.answerMap[answerMapKeysItem];
24776
- }
24777
- });
24778
- }
24779
- } else {
24780
- item.answerMap = null;
24781
- }
24782
- var question_type = item.question_type;
24783
- if (question_type == 3) {
24784
- //判断题手动构造选项数组
24785
- item.exam_options_data = [{
24786
- index: 1,
24787
- data: {
24788
- name: '正确'
24789
- }
24790
- }, {
24791
- index: 2,
24792
- data: {
24793
- name: '错误'
24794
- }
24795
- }];
24796
- } else {
24797
- if (item.exam_options_data && item.exam_options_data.length) {
24798
- item.exam_options_data.forEach(function (subItem, subIndex) {
24799
- subItem.enIndex = js_fun.indexToEnIndex(subIndex + 1);
24800
- });
24801
- }
24802
- }
24803
- //转化content富文本
24804
- try {
24805
- var contentArr = JSON.parse(item.content);
24806
- var contentWidth = jQuery('.question-list').width() - 30;
24807
- //图片宽度超出框架的时候把宽度设置成框架大小
24808
- parseContent(contentArr, contentWidth);
24809
- item.htmlContent = $.json2html({}, contentArr);
24810
- } catch (e) {
24811
- item.htmlContent = item.content;
24812
- }
24813
- //转化analysis富文本
24814
- try {
24815
- if (item.analysis) {
24816
- item.analysisHtmlContent = $.json2html({}, JSON.parse(item.analysis));
24817
- } else {
24818
- item.analysisHtmlContent = '';
24819
- }
24820
- } catch (e) {
24821
- item.analysisHtmlContent = item.analysis;
24822
- }
24823
- //如果是阅读题要递归解析
24824
- if (item.sub_questions && item.sub_questions.length) {
24825
- _this.parseQuestionListItem(mode, item.sub_questions, answer_map, index);
24826
- }
24827
- });
24828
- }
24829
+ parseQuestionListItem: parseQuestionListItem
24829
24830
  }
24830
24831
  });
24831
24832
  Vue.component('Question_SingleChoice', Question_SingleChoice);
@@ -24836,6 +24837,7 @@ var state = {
24836
24837
  Vue.component('Question_Programming', Question_Programming);
24837
24838
  Vue.component('Question_Classify', Question_Classify);
24838
24839
  },
24840
+ parseQuestionListItem: parseQuestionListItem,
24839
24841
  questionMapper: questionMapper,
24840
24842
  Question_SingleChoice: Question_SingleChoice,
24841
24843
  Question_MultipleChoice: Question_MultipleChoice,