fix: 修改默认模板,修改投票题数据回显问题 (#7)
This commit is contained in:
parent
02d6613d63
commit
936b0f52f4
@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
npm install
|
|
||||||
for appDir in `ls src/apps`
|
|
||||||
do
|
|
||||||
cd src/apps/$appDir
|
|
||||||
# 进行安装依赖
|
|
||||||
npm install
|
|
||||||
cd ../../../
|
|
||||||
done
|
|
||||||
cd ..
|
|
@ -120,7 +120,7 @@
|
|||||||
"optionOrigin": "",
|
"optionOrigin": "",
|
||||||
"answerTip": "",
|
"answerTip": "",
|
||||||
"type": "radio-star",
|
"type": "radio-star",
|
||||||
"title": "标题3",
|
"title": "标题2",
|
||||||
"answer": "",
|
"answer": "",
|
||||||
"othersKeyMap": {},
|
"othersKeyMap": {},
|
||||||
"options": [],
|
"options": [],
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"valid": "",
|
"valid": "",
|
||||||
"field": "data631",
|
"field": "data631",
|
||||||
"title": "标题3",
|
"title": "标题1",
|
||||||
"placeholder": "",
|
"placeholder": "",
|
||||||
"sLimit": 1,
|
"sLimit": 1,
|
||||||
"randomSort": false,
|
"randomSort": false,
|
||||||
@ -85,7 +85,7 @@
|
|||||||
"innerType": "radio",
|
"innerType": "radio",
|
||||||
"placeholderDesc": "",
|
"placeholderDesc": "",
|
||||||
"field": "data606",
|
"field": "data606",
|
||||||
"title": "标题1",
|
"title": "标题2",
|
||||||
"placeholder": "",
|
"placeholder": "",
|
||||||
"randomSort": false,
|
"randomSort": false,
|
||||||
"checked": false,
|
"checked": false,
|
||||||
@ -93,7 +93,7 @@
|
|||||||
"maxNum": "",
|
"maxNum": "",
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"text": "甜的",
|
"text": "选项1",
|
||||||
"imageUrl": "",
|
"imageUrl": "",
|
||||||
"others": false,
|
"others": false,
|
||||||
"mustOthers": false,
|
"mustOthers": false,
|
||||||
@ -102,7 +102,7 @@
|
|||||||
"hash": "115019"
|
"hash": "115019"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "咸的",
|
"text": "选项2",
|
||||||
"imageUrl": "",
|
"imageUrl": "",
|
||||||
"others": false,
|
"others": false,
|
||||||
"mustOthers": false,
|
"mustOthers": false,
|
||||||
|
@ -62,11 +62,14 @@ class SurveySubmitService {
|
|||||||
const configData = dataListMap[field]
|
const configData = dataListMap[field]
|
||||||
if (configData && /vote/.exec(configData.type)) {
|
if (configData && /vote/.exec(configData.type)) {
|
||||||
const voteData = (await surveyKeyStoreService.get({ surveyPath: surveySubmitData.surveyPath, key: field, type: 'vote' })) || { total: 0 }
|
const voteData = (await surveyKeyStoreService.get({ surveyPath: surveySubmitData.surveyPath, key: field, type: 'vote' })) || { total: 0 }
|
||||||
|
const fields = Array.isArray(surveySubmitData.data[field]) ? surveySubmitData.data[field] : [surveySubmitData.data[field]]
|
||||||
|
for (const field of fields) {
|
||||||
voteData.total++;
|
voteData.total++;
|
||||||
if (!voteData[surveySubmitData.data[field]]) {
|
if (!voteData[field]) {
|
||||||
voteData[surveySubmitData.data[field]] = 1
|
voteData[field] = 1
|
||||||
} else {
|
} else {
|
||||||
voteData[surveySubmitData.data[field]]++;
|
voteData[field]++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await surveyKeyStoreService.set({ surveyPath: surveySubmitData.surveyPath, key: field, data: voteData, type: 'vote' })
|
await surveyKeyStoreService.set({ surveyPath: surveySubmitData.surveyPath, key: field, data: voteData, type: 'vote' })
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 8.9 KiB |
Loading…
Reference in New Issue
Block a user