feat(api): 新增问卷设计相关接口并优化问卷创建流程
- 新增问卷设计相关接口: snQuestions, saveQuestion, sync, questionDetails - 实现问卷创建功能,包括生成问卷模板和保存问卷标题、介绍等信息 -优化内容可编辑组件,增加失焦时保存内容的功能 - 更新环境变量和代理配置,以适应新的后端接口地址
This commit is contained in:
@@ -1,17 +1,70 @@
|
||||
<script setup lang="ts">
|
||||
// import { ref } from 'vue';
|
||||
import { consoleSurveys } from '@/api/home/index.js';
|
||||
import { snQuestions, questionDetails } from '@/api/design/index.js';
|
||||
import { surveys } from './Hooks/useRequestHooks';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useCounterStore } from '@/stores/counter';
|
||||
import { storeToRefs } from 'pinia';
|
||||
// 获取 Store 实例
|
||||
const counterStore = useCounterStore();
|
||||
const store = storeToRefs(counterStore);
|
||||
|
||||
import { getQuestionList } from '@/api/home/index.js';
|
||||
const router = useRouter();
|
||||
// const surveys = ref([]);
|
||||
//
|
||||
// getQuestionList({}).then((res) => {
|
||||
// console.log(res.data.data);
|
||||
// surveys.value = res.data.data;
|
||||
// });
|
||||
|
||||
const { data: questionList } = await getQuestionList();
|
||||
console.log(questionList);
|
||||
console.log(surveys);
|
||||
|
||||
const createdQuestion = (item) => {
|
||||
const query = {
|
||||
group_id: 0,
|
||||
project_name: `${item.title}问卷 `,
|
||||
remarks: '',
|
||||
scene_code: item.scene_code,
|
||||
scene_code_info: item.scene_code_info,
|
||||
tags: ''
|
||||
};
|
||||
consoleSurveys(query).then((res) => {
|
||||
if (res.data) {
|
||||
snQuestions({ sn: res.data.data.sn }).then((ques) => {
|
||||
if (ques.data) {
|
||||
ques.data.data.survey.introduction = `<p>为优化活动服务品质,烦请完成问卷,感谢配合!您的反馈至关重要!(此提示语为默认提示语,您可选择自行输入本问卷的提示语)</p>`;
|
||||
store.questionsInfo.value = ques.data.data;
|
||||
questionDetails({
|
||||
sn: res.data.data.sn,
|
||||
introduction: ques.data.data.survey.introduction,
|
||||
title: ques.data.data.survey.title
|
||||
}).then(() => {
|
||||
router.push({
|
||||
path: '/create',
|
||||
query: {
|
||||
sn: res.data.data.sn
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<van-cell style="position: relative; z-index: 1">
|
||||
<div style="text-align: left">新建问卷</div>
|
||||
<van-row>
|
||||
<van-col v-for="survey in surveys" :key="survey.title" span="6" class="survey">
|
||||
<van-col
|
||||
v-for="survey in surveys"
|
||||
:key="survey.title"
|
||||
span="6"
|
||||
class="survey"
|
||||
@click="createdQuestion(survey)"
|
||||
>
|
||||
<img width="45px" :src="survey.icon" alt=" " />
|
||||
<span>{{ survey.title }}</span>
|
||||
</van-col>
|
||||
|
||||
Reference in New Issue
Block a user