diff --git a/web/src/render/App.vue b/web/src/render/App.vue index c4f914ea..242905c1 100644 --- a/web/src/render/App.vue +++ b/web/src/render/App.vue @@ -4,12 +4,12 @@ diff --git a/web/src/render/components/QuestionWrapper.vue b/web/src/render/components/QuestionWrapper.vue index df8e0113..e18e9280 100644 --- a/web/src/render/components/QuestionWrapper.vue +++ b/web/src/render/components/QuestionWrapper.vue @@ -13,10 +13,10 @@ import QuestionRuleContainer from '../../materials/questions/QuestionRuleContain import { useVoteMap } from '@/render/hooks/useVoteMap' import { useShowOthers } from '@/render/hooks/useShowOthers' import { useShowInput } from '@/render/hooks/useShowInput' -import store from '@/render/store' import { cloneDeep } from 'lodash-es' import { ruleEngine } from '@/render/hooks/useRuleEngine.js' import { useQuestionStore } from '../stores/question' +import { useSurveyStore } from '../stores/survey' import { NORMAL_CHOICES, RATES, QUESTION_TYPE } from '@/common/typeEnum.ts' @@ -34,9 +34,10 @@ const props = defineProps({ }) const emit = defineEmits(['change']) const questionStore = useQuestionStore() +const surveyStore = useSurveyStore() const formValues = computed(() => { - return store.state.formValues + return surveyStore.formValues }) const questionConfig = computed(() => { let moduleConfig = props.moduleConfig @@ -98,7 +99,8 @@ watch( key: field, value: value } - store.commit('changeFormData', data) + // store.commit('changeFormData', data) + surveyStore.changeData(data) } } ) diff --git a/web/src/render/hooks/useProgress.js b/web/src/render/hooks/useProgress.js index 731b0a48..b76981cb 100644 --- a/web/src/render/hooks/useProgress.js +++ b/web/src/render/hooks/useProgress.js @@ -1,6 +1,7 @@ -import store from '../store/index' +import { useSurveyStore } from '../stores/survey' import { computed } from 'vue' export const useProgressBar = () => { + const surveyStore = useSurveyStore() const isVariableEmpty = (variable) => { if (variable === undefined || variable === null) { return true @@ -22,7 +23,7 @@ export const useProgressBar = () => { fillCount: 0, topicCount: 0 } - const formValues = store.state.formValues + const formValues = surveyStore.formValues for (let key in formValues) { if (key.split('_').length > 1) continue diff --git a/web/src/render/hooks/useShowInput.js b/web/src/render/hooks/useShowInput.js index 66ee9018..b4982c4f 100644 --- a/web/src/render/hooks/useShowInput.js +++ b/web/src/render/hooks/useShowInput.js @@ -1,9 +1,10 @@ -import store from '../store/index' import { useQuestionStore } from '../stores/question' +import { useSurveyStore } from '../stores/survey' export const useShowInput = (questionKey) => { const questionStore = useQuestionStore() - const formValues = store.state.formValues + const surveyStore = useSurveyStore() + const formValues = surveyStore.formValues const questionVal = formValues[questionKey] let rangeConfig = questionStore.questionData[questionKey].rangeConfig let othersValue = {} @@ -21,7 +22,8 @@ export const useShowInput = (questionKey) => { key: rangeKey, value: '' } - store.commit('changeFormData', data) + + surveyStore.changeData(data) } } } diff --git a/web/src/render/hooks/useShowOthers.js b/web/src/render/hooks/useShowOthers.js index c405eae4..df5a8b9e 100644 --- a/web/src/render/hooks/useShowOthers.js +++ b/web/src/render/hooks/useShowOthers.js @@ -1,9 +1,10 @@ -import store from '../store/index' import { useQuestionStore } from '../stores/question' +import { useSurveyStore } from '../stores/survey' export const useShowOthers = (questionKey) => { const questionStore = useQuestionStore() - const formValues = store.state.formValues + const surveyStore = useSurveyStore() + const formValues = surveyStore.formValues const questionVal = formValues[questionKey] let othersValue = {} let options = questionStore.questionData[questionKey].options.map((optionItem) => { @@ -16,7 +17,7 @@ export const useShowOthers = (questionKey) => { key: opKey, value: '' } - store.commit('changeFormData', data) + surveyStore.changeData(data) } return { ...optionItem, diff --git a/web/src/render/main.js b/web/src/render/main.js index 6d8f5c74..ca68f229 100644 --- a/web/src/render/main.js +++ b/web/src/render/main.js @@ -2,7 +2,6 @@ import { createApp } from 'vue' import App from './App.vue' import EventBus from './utils/eventbus' import router from './router' -import store from './store' import { createPinia } from 'pinia' const app = createApp(App) @@ -12,7 +11,6 @@ const $bus = new EventBus() app.provide('$bus', $bus) // 挂载到this上 app.config.globalProperties.$bus = $bus -app.use(store) app.use(pinia) app.use(router) diff --git a/web/src/render/pages/ErrorPage.vue b/web/src/render/pages/ErrorPage.vue index 47dfac44..28ac2d80 100755 --- a/web/src/render/pages/ErrorPage.vue +++ b/web/src/render/pages/ErrorPage.vue @@ -11,20 +11,18 @@