fix: 修复矩阵多选提示语错误
- 获取数据放到 store 内进行 - 修复提示语错误
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { AnswerApi } from '@/views/Survey/views/Preview/js/api';
|
||||
import { getLanguage } from '@/views/Survey/views/Preview/js/language';
|
||||
|
||||
export const useQuestionStore = defineStore('questionStore', () => {
|
||||
const questionsData = ref();
|
||||
@@ -39,6 +41,32 @@ export const useQuestionStore = defineStore('questionStore', () => {
|
||||
// 主题颜色
|
||||
const themeColor = ref({});
|
||||
|
||||
// 开始更新数据
|
||||
getQuestions();
|
||||
|
||||
// 更新数据
|
||||
async function getQuestions() {
|
||||
const urlParamSearch = new URL(location.href).searchParams;
|
||||
let { data } = await AnswerApi.getQuetions({
|
||||
id: urlParamSearch.get('sn'),
|
||||
data: {
|
||||
is_preview: 1,
|
||||
is_template: urlParamSearch.get('is_template') || 0,
|
||||
source: urlParamSearch.get('source') ?? ''
|
||||
}
|
||||
});
|
||||
data = data.data;
|
||||
// 多语言
|
||||
data.languageType = [
|
||||
data?.survey?.style?.is_en_tips ? 'en' : '',
|
||||
data?.survey?.style?.is_cn_tips ? 'zh' : ''
|
||||
].filter((i) => !!i);
|
||||
l.value = getLanguage(data.languageType);
|
||||
// console.log(`l value:`, l.value);
|
||||
data.language = l.value;
|
||||
questionsData.value = data;
|
||||
}
|
||||
|
||||
return {
|
||||
questionsData,
|
||||
styleInfo,
|
||||
|
||||
Reference in New Issue
Block a user