* [bug#54569] modify citation value and selectColumn value of thinkradio.

This commit is contained in:
Zhangyu
2024-08-30 17:38:36 +08:00
committed by 刘刚
parent a7a8fe63c7
commit cdbcbf0534
2 changed files with 8 additions and 6 deletions
+5 -4
View File
@@ -16,6 +16,7 @@ window.changeQuoteTitle = function(event)
const quoteQuestions = $('.options-quote-title').data().quoteQuestions;
const quoteTitle = $('input[name="options[quoteTitle]').val();
const selectColumn = $('.options-quote-title').data().selectColumn
$.each(quoteQuestions, function(index, item) {
const options = JSON.parse(item.options);
@@ -30,8 +31,8 @@ window.changeQuoteTitle = function(event)
/* 渲染选择列的下拉项。Renders a drop-down item for a select column.*/
$.each(requiredFields, function(index, key) {
/* 必填列的值-1是多列填空fields数组的key。The value of -1 in the required column is the key for the multi column fill in the blank fields array. */
const keyValue = parseInt(key) - 1;
citationItems.push({key: keyValue, value:keyValue, text: fields[keyValue]});
const keyValue = parseInt(key);
citationItems.push({key: keyValue, value:keyValue, text: fields[keyValue - 1]});
})
$('.quote-citation').toggleClass('gap-4', multicolumnStep);
@@ -43,7 +44,7 @@ window.changeQuoteTitle = function(event)
/* 引用题目为多列填空题的时候,重置选择列的下拉选项和默认值, 修改引用方式为:引用某行输入项。 */
/* When the reference question is a multi-column fill-in-the-blank question, reset the drop-down options and default values of the selected column, and change the reference method to: reference an input item in a row. */
$('.select-column .picker-box').zui('picker').render({items: citationItems});
$('.select-column .picker-box').zui('picker').$.setValue(citationItems[0]);
$('.select-column .picker-box').zui('picker').$.setValue(selectColumn || citationItems[0]);
$('.multicolumn-citation input[name="options[citation]"]').prop('checked', true);
}
else
@@ -52,6 +53,6 @@ window.changeQuoteTitle = function(event)
/* If the reference question type is multiple choice or single choice, clear the drop-down options and default values in the selection column, and change the default reference method to: reference the selected item in the question. */
$('.select-column .picker-box').zui('picker').render({items: []});
$('.select-column .picker-box').zui('picker').$.setValue('');
if(citation) $('.citation input[id="options[citation]' + citation + '"]').prop('checked', true);
$('.citation input[id="options[citation]' + citation || 1 + '"]').prop('checked', true);
}
}
+3 -2
View File
@@ -18,7 +18,7 @@ class thinkRadio extends thinkQuestion
'quoteTitle?: string',
'quoteQuestions?: array',
'citation?: int=1',
'selectColumn?: int',
'selectColumn?: string',
'isResult?: bool = false',
);
@@ -157,6 +157,7 @@ class thinkRadio extends thinkQuestion
picker
(
setdata('quote-questions', $quoteQuestions),
setdata('selectColumn', $selectColumn),
set(array
(
'class' => 'options-quote-title',
@@ -211,7 +212,7 @@ class thinkRadio extends thinkQuestion
'placeholder' => $lang->thinkstep->placeholder->quoteTitle,
'required' => true,
'items' => array(),
'value' => $selectColumn,
'value' => $selectColumn
))
)
)