feat(api): 新增问卷设计相关接口并优化问卷创建流程
- 新增问卷设计相关接口: snQuestions, saveQuestion, sync, questionDetails - 实现问卷创建功能,包括生成问卷模板和保存问卷标题、介绍等信息 -优化内容可编辑组件,增加失焦时保存内容的功能 - 更新环境变量和代理配置,以适应新的后端接口地址
This commit is contained in:
2
.env
2
.env
@@ -1,5 +1,5 @@
|
||||
# .env
|
||||
VITE_APP_BASE_URL=http://192.168.3.7:15001/
|
||||
VITE_APP_BASE_URL=http://192.168.8.165:15011/
|
||||
VITE_APP_ENV=development
|
||||
VITE_APP_CURRENTMODE=dev
|
||||
VITE_APP_BASEOSS=https://diaoyan-files.automark.cc
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# .env.development
|
||||
VITE_APP_BASEURL=http://192.168.3.7:15001/api/
|
||||
VITE_APP_BASEURL=http://192.168.8.165:15011/
|
||||
VITE_APP_ENV=development
|
||||
VITE_APP_CURRENTMODE=dev
|
||||
VITE_APP_BASEOSS=https://diaoyan-files.automark.cc
|
||||
|
||||
31
src/api/design/index.js
Normal file
31
src/api/design/index.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import request from '@/utils/request.js';
|
||||
export function snQuestions(params) {
|
||||
return request({
|
||||
url: `/console/surveys/${params.sn}/questions`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
// 操作编辑
|
||||
export function saveQuestion(params) {
|
||||
return request({
|
||||
url: `console/surveys/${params.sn}/questions`,
|
||||
method: 'post',
|
||||
data: params
|
||||
});
|
||||
}
|
||||
export function sync(params) {
|
||||
return request({
|
||||
url: `console/surveys/${params.sn}/sync`,
|
||||
method: 'post',
|
||||
data: params
|
||||
});
|
||||
}
|
||||
export function questionDetails(params) {
|
||||
// let sn = params.sn;
|
||||
// delete params.sn;
|
||||
return request({
|
||||
url: `console/surveys/${params.sn}/details`,
|
||||
method: 'post',
|
||||
data: params
|
||||
});
|
||||
}
|
||||
@@ -7,3 +7,13 @@ export function getQuestionList(params) {
|
||||
params
|
||||
});
|
||||
}
|
||||
export function consoleSurveys(params) {
|
||||
return request({
|
||||
url: '/console/surveys',
|
||||
method: 'post',
|
||||
data: {
|
||||
...params,
|
||||
source: '1'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ const props = defineProps({
|
||||
|
||||
const editor = ref(null);
|
||||
const editorAction = ref(null);
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
const emit = defineEmits(['update:modelValue', 'blur']);
|
||||
const save = (e) => {
|
||||
emit('update:modelValue', e.innerHTML);
|
||||
};
|
||||
@@ -42,6 +42,9 @@ const functions = {
|
||||
};
|
||||
|
||||
const funEvent = (item) => {
|
||||
// 保持焦点在编辑器
|
||||
const selection = window.getSelection();
|
||||
selection.getRangeAt(0);
|
||||
functions[item.fun]();
|
||||
};
|
||||
|
||||
@@ -81,16 +84,40 @@ const actions = [
|
||||
fun: 'italic'
|
||||
}
|
||||
];
|
||||
const checkContains = (element, target) => {
|
||||
try {
|
||||
return element?.contains(target) ?? false;
|
||||
} catch (e) {
|
||||
console.error('Contains check failed:', e);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
editor.value.addEventListener('focus', () => {
|
||||
showAction.value = true;
|
||||
});
|
||||
editor.value.addEventListener('blur', () => {
|
||||
setTimeout(() => {
|
||||
|
||||
// 如果点击了 editor 与 editorAction 其他地方就触发保存
|
||||
|
||||
document.addEventListener('click', (e) => {
|
||||
if (!editor.value || !editorAction.value) return;
|
||||
|
||||
const target = e.composedPath?.()?.[0] || e.target;
|
||||
const isEditor = checkContains(editor.value, target);
|
||||
const isActionBar = checkContains(editorAction.value, target);
|
||||
|
||||
if (!isEditor && !isActionBar) {
|
||||
showAction.value = false;
|
||||
});
|
||||
save(editor.value);
|
||||
emit('blur', editor.value);
|
||||
}
|
||||
});
|
||||
// editor.value.addEventListener('blur', () => {
|
||||
// setTimeout(() => {
|
||||
// showAction.value = false;
|
||||
// });
|
||||
// });
|
||||
document.addEventListener('resize', () => {
|
||||
showAction.value = false;
|
||||
});
|
||||
|
||||
@@ -15,7 +15,10 @@ const modules = Object.entries(modulesFiles).reduce(
|
||||
export const useCounterStore = defineStore('counter', () => {
|
||||
// 引入 common 模块
|
||||
const commonStore = useCommonStore();
|
||||
const { questionsInfo } = storeToRefs(commonStore);
|
||||
const ques = storeToRefs(commonStore);
|
||||
|
||||
// 暴露 fetchQuestionInfo 方法
|
||||
const { fetchQuestionInfo, setQuestionInfo } = commonStore;
|
||||
// 返回需要暴露的内容
|
||||
return { commonStore, questionsInfo, modules };
|
||||
return { commonStore, modules, fetchQuestionInfo, ...ques, setQuestionInfo };
|
||||
});
|
||||
|
||||
@@ -9,27 +9,20 @@ export const useCommonStore = defineStore('common', {
|
||||
state: () => ({
|
||||
questionsInfo: {
|
||||
survey: {
|
||||
id: '',
|
||||
introduction:
|
||||
'<p>为优化活动服务品质,烦请完成问卷,感谢配合!您的反馈至关重要!(此提示语为默认提示语,您可选择自行输入本问卷的提示语)</p>',
|
||||
pages: [
|
||||
[24, 27, 26, 1],
|
||||
[2, 3, 4, 5, 6, 7],
|
||||
[8, 9, 10, 11, 12, 13, 14],
|
||||
[15, 16, 17, 18, 19, 20, 21],
|
||||
[28, 22]
|
||||
],
|
||||
sn: '',
|
||||
id: 9577,
|
||||
introduction: '<p>123</p>',
|
||||
pages: [[]],
|
||||
sn: 'oxywX8W6',
|
||||
status: 0,
|
||||
title: '<p>问卷标题</p>',
|
||||
title: '报名签到问卷 ',
|
||||
detail_pages: [],
|
||||
group_pages: [],
|
||||
is_one_page_one_question: 0,
|
||||
last_question_index: 0,
|
||||
is_three_d_permissions: 0,
|
||||
is_dept: 1,
|
||||
last_title: 'Q5',
|
||||
project_name: '',
|
||||
last_title: 'Q0',
|
||||
project_name: '报名签到问卷 ',
|
||||
quota_end_content:
|
||||
'<p style="text-align:center"><img style="width:220px;margin-top:30px;margin-bottom: 40px;" src="https://cxp-pubcos.yili.com/prod-yls/theme/XxgQ98WN/1693807609602_962_error.png"></p>\n<p style="text-align:center;font-size: 16px;font-weight: 500;padding-bottom: 12px;/* margin-bottom: 10px; */">很抱歉,本次调研不太适合您的情况,感谢您的参与!</p>',
|
||||
quota_end_url: '',
|
||||
@@ -44,220 +37,21 @@ export const useCommonStore = defineStore('common', {
|
||||
end_jump_status: 0,
|
||||
end_jump_standing_time: 0,
|
||||
success_end_content:
|
||||
'<p style="text-align:center"><img style="width:220px;margin-top:30px;margin-bottom: 40px;" src="https://cxp-pubcos.yili.com/prod-yls/theme/XxgQ98WN/1693807609607_514_success.png"></p>\n<p style="text-align:center;font-size: 16px;font-weight: 500;padding-bottom: 12px;/* margin-bottom: 10px; */">您已完成本次调研,感谢您的参与!</p>\n<p style="text-align:center;color: #85b43a;font-size: 16px;font-weight: 550;">【成功完成】</p>',
|
||||
'<p style="text-align:center"><img style="width:220px;margin-top:30px;margin-bottom: 40px;" src="https://cxp-pubcos.yili.com/prod-yls/theme/XxgQ98WN/1693807609607_514_success.png"></p>\n<p style="text-align:center;font-size: 16px;font-weight: 500;padding-bottom: 12px;/* margin-bottom: 10px; */">您已完成本次调研,感谢您的参与!</p>\n<p style="text-align:center;color: 85b43a;font-size: 16px;font-weight: 550;">【成功完成】</p>',
|
||||
success_end_url: '',
|
||||
success_end_url_select: 0,
|
||||
success_standing_time: 0,
|
||||
template_type: 300,
|
||||
local_pages: [
|
||||
{
|
||||
pages: [],
|
||||
is_short_time: 0,
|
||||
short_time: '',
|
||||
is_show: 0,
|
||||
use_type: 0
|
||||
},
|
||||
{
|
||||
pages: [],
|
||||
is_short_time: 0,
|
||||
short_time: '',
|
||||
is_show: 0,
|
||||
use_type: 0
|
||||
},
|
||||
{
|
||||
pages: [],
|
||||
is_short_time: 0,
|
||||
short_time: '',
|
||||
is_show: 0,
|
||||
use_type: 0
|
||||
},
|
||||
{
|
||||
pages: [],
|
||||
is_short_time: 0,
|
||||
short_time: '',
|
||||
is_show: 0,
|
||||
use_type: 0
|
||||
},
|
||||
{
|
||||
pages: [],
|
||||
is_short_time: 0,
|
||||
short_time: '',
|
||||
is_show: 0,
|
||||
use_type: 0
|
||||
}
|
||||
]
|
||||
template_type: 0,
|
||||
local_pages: []
|
||||
},
|
||||
logics: [
|
||||
{
|
||||
logic: [
|
||||
{
|
||||
value: '',
|
||||
location: 0,
|
||||
date: '',
|
||||
time: '',
|
||||
type: 0,
|
||||
row_type: 0,
|
||||
cell_type: 0,
|
||||
logic: 'if',
|
||||
operator: '=',
|
||||
is_answer: 1,
|
||||
is_select: 0,
|
||||
row_index: 0,
|
||||
cell_index: 0,
|
||||
question_type: 1,
|
||||
question_index: 24,
|
||||
relation_question_index: 0,
|
||||
relation_question_row_index: 0,
|
||||
relation_question_cell_index: 0,
|
||||
is_option_group: 0,
|
||||
option_index: 1,
|
||||
skip_type: null,
|
||||
question_id: null
|
||||
}
|
||||
],
|
||||
skip_question_index: 27,
|
||||
skip_type: 0,
|
||||
id: 472148,
|
||||
question_index: 24,
|
||||
question_id: '17852294'
|
||||
},
|
||||
{
|
||||
logic: [
|
||||
{
|
||||
value: '',
|
||||
location: 0,
|
||||
date: '',
|
||||
time: '',
|
||||
type: 0,
|
||||
row_type: 0,
|
||||
cell_type: 0,
|
||||
logic: 'if',
|
||||
operator: '=',
|
||||
is_answer: 1,
|
||||
is_select: 0,
|
||||
row_index: 0,
|
||||
cell_index: 0,
|
||||
question_type: 1,
|
||||
question_index: 24,
|
||||
relation_question_index: 0,
|
||||
relation_question_row_index: 0,
|
||||
relation_question_cell_index: 0,
|
||||
is_option_group: 0,
|
||||
option_index: 0,
|
||||
skip_type: null,
|
||||
question_id: null
|
||||
}
|
||||
],
|
||||
skip_type: 0,
|
||||
id: 472149,
|
||||
question_index: 24,
|
||||
question_id: '17852294'
|
||||
},
|
||||
{
|
||||
logic: [
|
||||
{
|
||||
value: '',
|
||||
location: 0,
|
||||
date: '',
|
||||
time: '',
|
||||
type: 0,
|
||||
row_type: 0,
|
||||
cell_type: 0,
|
||||
logic: 'if',
|
||||
operator: '=',
|
||||
is_answer: 1,
|
||||
is_select: 0,
|
||||
row_index: 0,
|
||||
cell_index: 0,
|
||||
question_type: 1,
|
||||
question_index: 24,
|
||||
relation_question_index: 0,
|
||||
relation_question_row_index: 0,
|
||||
relation_question_cell_index: 0,
|
||||
is_option_group: 0,
|
||||
option_index: 0,
|
||||
skip_type: null,
|
||||
question_id: null
|
||||
}
|
||||
],
|
||||
skip_type: 0,
|
||||
id: 472151,
|
||||
question_index: 24,
|
||||
question_id: '17852294'
|
||||
},
|
||||
{
|
||||
logic: [
|
||||
{
|
||||
logic: 'if',
|
||||
question_index: 30,
|
||||
question_type: 1,
|
||||
is_answer: 1,
|
||||
operator: '=',
|
||||
option_index: 2,
|
||||
relation_question_index: 0,
|
||||
type: 0,
|
||||
is_option_group: 0,
|
||||
group_index: null
|
||||
},
|
||||
{
|
||||
logic: 'and',
|
||||
question_index: 30,
|
||||
question_type: 1,
|
||||
is_answer: 1,
|
||||
operator: '=',
|
||||
option_index: 1,
|
||||
relation_question_index: 0,
|
||||
type: 0,
|
||||
is_option_group: 1,
|
||||
group_index: 1
|
||||
}
|
||||
],
|
||||
skip_question_index: 0,
|
||||
skip_type: 1,
|
||||
id: 472152,
|
||||
question_index: 24,
|
||||
question_id: '17852294'
|
||||
},
|
||||
{
|
||||
logic: [
|
||||
{
|
||||
logic: 'if',
|
||||
question_index: 30,
|
||||
question_type: 1,
|
||||
is_answer: 0,
|
||||
operator: '=',
|
||||
option_index: 0,
|
||||
relation_question_index: 0,
|
||||
type: 0
|
||||
}
|
||||
],
|
||||
skip_type: 1,
|
||||
id: '28fe4d64-81eb-4937-a082-c519ac74374f',
|
||||
question_index: 24,
|
||||
question_id: '17852294'
|
||||
},
|
||||
{
|
||||
logic: [
|
||||
{
|
||||
operator: '=',
|
||||
is_answer: 1,
|
||||
question_type: 1,
|
||||
logic: 'always'
|
||||
}
|
||||
],
|
||||
skip_type: 1,
|
||||
id: '459f781f-8db0-4663-b2d1-9ddad627078e',
|
||||
question_index: 24,
|
||||
question_id: '17852294'
|
||||
}
|
||||
],
|
||||
|
||||
logics: [],
|
||||
questions: [],
|
||||
cycle_pages: null
|
||||
}
|
||||
}),
|
||||
actions: {
|
||||
async fetchQuestionInfo(questionInfo) {
|
||||
console.log(questionInfo, 456);
|
||||
try {
|
||||
if (!questionInfo) return;
|
||||
|
||||
@@ -276,6 +70,8 @@ export const useCommonStore = defineStore('common', {
|
||||
}
|
||||
},
|
||||
setQuestionInfo(questionInfo) {
|
||||
console.log(questionInfo, 9998);
|
||||
console.log(this);
|
||||
this.questionsInfo = questionInfo;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -4,13 +4,9 @@ import axios from 'axios';
|
||||
// import { A_COMMON_CLEAR_TOKEN } from '@/stores/constance/constance.common.js';
|
||||
|
||||
import * as config from '@/config.js';
|
||||
|
||||
console.log(config.default);
|
||||
// import {proxyUrl} from config.default
|
||||
//
|
||||
|
||||
const NODE_ENV = import.meta.env.VITE_APP_ENV;
|
||||
const baseURL = NODE_ENV === 'production' ? config.default.proxyUrl : '/backend-api';
|
||||
const baseURL = NODE_ENV === 'production' ? config.default.proxyUrl : 'http://192.168.8.165:15011/';
|
||||
|
||||
// axios.defaults.withCredentials = true;
|
||||
|
||||
@@ -31,7 +27,8 @@ service.interceptors.request.use(
|
||||
if (!config.headers.remoteIp) {
|
||||
config.baseURL += '/api';
|
||||
}
|
||||
// config.headers.remoteIp = localStorage.getItem('plantIp') || '127.0.0.1';
|
||||
delete config.headers.host;
|
||||
config.headers.remoteIp = localStorage.getItem('plantIp') || '127.0.0.1';
|
||||
// if (store.state.common.token) {
|
||||
// config.headers['Login-Type'] = 'pc';
|
||||
// config.headers.Authorization = `Bearer ${store.state.common.token}`;
|
||||
@@ -45,10 +42,10 @@ service.interceptors.request.use(
|
||||
service.interceptors.response.use(
|
||||
(response) => {
|
||||
if (
|
||||
response.status === 200 ||
|
||||
response.status === 201 ||
|
||||
response.status === 202 ||
|
||||
response.status === 204
|
||||
response.status === 200
|
||||
|| response.status === 201
|
||||
|| response.status === 202
|
||||
|| response.status === 204
|
||||
) {
|
||||
if (response.config.method === 'put') {
|
||||
// message.success('保存中...');
|
||||
|
||||
@@ -1,27 +1,39 @@
|
||||
export const surveys = [
|
||||
{
|
||||
title: '报名签到',
|
||||
icon: 'https://files.axshare.com/gsc/DR6075/de/a0/49/dea049d6ad3e4c2c80af44258c6c76d6/images/%E9%A6%96%E9%A1%B5_1/u48.png?pageId=74b3e5b2-848e-4258-8a34-9e220127c8a6'
|
||||
icon: 'https://files.axshare.com/gsc/DR6075/de/a0/49/dea049d6ad3e4c2c80af44258c6c76d6/images/%E9%A6%96%E9%A1%B5_1/u48.png?pageId=74b3e5b2-848e-4258-8a34-9e220127c8a6',
|
||||
scene_code: 1,
|
||||
scene_code_info: 11
|
||||
},
|
||||
{
|
||||
title: '满意度调研',
|
||||
icon: 'https://files.axshare.com/gsc/DR6075/63/4d/77/634d77293a4d41d1b3d145974a8fb6a7/images/%E9%A6%96%E9%A1%B5_1/u27.png?pageId=5cc10b9f-56eb-48dc-943a-bfe7afb18a64'
|
||||
icon: 'https://files.axshare.com/gsc/DR6075/63/4d/77/634d77293a4d41d1b3d145974a8fb6a7/images/%E9%A6%96%E9%A1%B5_1/u27.png?pageId=5cc10b9f-56eb-48dc-943a-bfe7afb18a64',
|
||||
scene_code: 1,
|
||||
scene_code_info: 16
|
||||
},
|
||||
{
|
||||
title: '快速投票',
|
||||
icon: 'https://files.axshare.com/gsc/DR6075/63/4d/77/634d77293a4d41d1b3d145974a8fb6a7/images/首页_1/u29.png?pageId=5cc10b9f-56eb-48dc-943a-bfe7afb18a64'
|
||||
icon: 'https://files.axshare.com/gsc/DR6075/63/4d/77/634d77293a4d41d1b3d145974a8fb6a7/images/首页_1/u29.png?pageId=5cc10b9f-56eb-48dc-943a-bfe7afb18a64',
|
||||
scene_code: 1,
|
||||
scene_code_info: 13
|
||||
},
|
||||
{
|
||||
title: '打分评估',
|
||||
icon: 'https://files.axshare.com/gsc/DR6075/63/4d/77/634d77293a4d41d1b3d145974a8fb6a7/images/首页_1/u31.png?pageId=5cc10b9f-56eb-48dc-943a-bfe7afb18a64'
|
||||
icon: 'https://files.axshare.com/gsc/DR6075/63/4d/77/634d77293a4d41d1b3d145974a8fb6a7/images/首页_1/u31.png?pageId=5cc10b9f-56eb-48dc-943a-bfe7afb18a64',
|
||||
scene_code: 1,
|
||||
scene_code_info: 14
|
||||
},
|
||||
{
|
||||
title: 'NPS调研',
|
||||
icon: 'https://files.axshare.com/gsc/DR6075/63/4d/77/634d77293a4d41d1b3d145974a8fb6a7/images/首页_1/u22.png?pageId=5cc10b9f-56eb-48dc-943a-bfe7afb18a64'
|
||||
icon: 'https://files.axshare.com/gsc/DR6075/63/4d/77/634d77293a4d41d1b3d145974a8fb6a7/images/首页_1/u22.png?pageId=5cc10b9f-56eb-48dc-943a-bfe7afb18a64',
|
||||
scene_code: 1,
|
||||
scene_code_info: 17
|
||||
},
|
||||
{
|
||||
title: '考评测试',
|
||||
icon: 'https://files.axshare.com/gsc/DR6075/63/4d/77/634d77293a4d41d1b3d145974a8fb6a7/images/首页_1/u24.png?pageId=5cc10b9f-56eb-48dc-943a-bfe7afb18a64'
|
||||
icon: 'https://files.axshare.com/gsc/DR6075/63/4d/77/634d77293a4d41d1b3d145974a8fb6a7/images/首页_1/u24.png?pageId=5cc10b9f-56eb-48dc-943a-bfe7afb18a64',
|
||||
scene_code: 1,
|
||||
scene_code_info: 15
|
||||
},
|
||||
{
|
||||
title: '表单收集',
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -10,13 +10,18 @@
|
||||
<div>
|
||||
<div>
|
||||
<!--问卷标题-->
|
||||
<contenteditable v-model="questionInfo.survey.title" :active="true"></contenteditable>
|
||||
<contenteditable
|
||||
v-model="questionInfo.survey.title"
|
||||
:active="true"
|
||||
@blur="saveTitle"
|
||||
></contenteditable>
|
||||
</div>
|
||||
<div>
|
||||
<!-- 问卷标注-->
|
||||
<contenteditable
|
||||
v-model="questionInfo.survey.introduction"
|
||||
:active="true"
|
||||
@blur="saveTitle"
|
||||
></contenteditable>
|
||||
</div>
|
||||
|
||||
@@ -254,7 +259,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
|
||||
import { questionDetails, snQuestions } from '@/api/design/index';
|
||||
import Design from '@/views/Design/Index.vue';
|
||||
import { useCounterStore } from '@/stores/counter';
|
||||
import { storeToRefs } from 'pinia';
|
||||
@@ -278,10 +285,7 @@ const counterStore = useCounterStore();
|
||||
const store = storeToRefs(counterStore);
|
||||
|
||||
const chooseQuestionId = ref('');
|
||||
const questionInfo = ref(store.questionsInfo.value);
|
||||
|
||||
const activeQuestionIndex = ref(-1);
|
||||
|
||||
const currentDate = ref();
|
||||
const currentType = ref();
|
||||
const route = useRoute();
|
||||
@@ -350,6 +354,14 @@ const getActiveQuestion = (activeQues) => {
|
||||
});
|
||||
};
|
||||
|
||||
const saveTitle = () => {
|
||||
questionDetails({
|
||||
sn: route.query.sn,
|
||||
title: questionInfo.value.survey.title,
|
||||
introduction: questionInfo.value.survey.introduction
|
||||
});
|
||||
};
|
||||
|
||||
const quesList = ref([
|
||||
{
|
||||
icon: '',
|
||||
@@ -437,14 +449,14 @@ const questionEvent = (item) => {
|
||||
options:
|
||||
item.json.options.length > 0
|
||||
? item.json.options.map((item) => {
|
||||
return item.map((it) => {
|
||||
return {
|
||||
...it,
|
||||
// 主键生成
|
||||
id: uuidv4()
|
||||
};
|
||||
});
|
||||
})
|
||||
return item.map((it) => {
|
||||
return {
|
||||
...it,
|
||||
// 主键生成
|
||||
id: uuidv4()
|
||||
};
|
||||
});
|
||||
})
|
||||
: []
|
||||
})
|
||||
);
|
||||
@@ -465,6 +477,21 @@ const init = () => {
|
||||
show.value = true;
|
||||
};
|
||||
defineExpose({ init });
|
||||
|
||||
// 获取题目象棋
|
||||
const getQuestionDetail = () => {
|
||||
return snQuestions({ sn: route.query.sn }).then((res) => {
|
||||
if (res.data) {
|
||||
counterStore.setQuestionInfo(res.data.data);
|
||||
return res.data.data; // 返回数据以便在onMounted中使用
|
||||
}
|
||||
});
|
||||
};
|
||||
const questionInfo = computed(() => store.questionsInfo.value);
|
||||
|
||||
onMounted(async () => {
|
||||
await getQuestionDetail(); // 等待接口返回数据
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -21,12 +21,14 @@ export default defineConfig(({ mode }) => {
|
||||
host: '0.0.0.0',
|
||||
port: 3000,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://192.168.11.119:8090/api/api/',
|
||||
'/backend-api': {
|
||||
target: proxyUrl,
|
||||
changeOrigin: true,
|
||||
logLevel: 'debug',
|
||||
rewrite: (path) => path.replace(/^\/api/, '/backend-api'), // 添加新前缀
|
||||
bypass: (req) => req.headers.accept?.indexOf('html') !== -1 // 跳过 HTML 请求
|
||||
pathRewrite: {
|
||||
'^/backend-api': '' // 路径重写
|
||||
},
|
||||
// bypass: (req) => req.headers.accept?.indexOf('html') !== -1, // 跳过 HTML 请求
|
||||
cookieDomainRewrite: 'localhost'
|
||||
},
|
||||
'/request-java': {
|
||||
target: `${proxyUrlDelivery}/api`,
|
||||
|
||||
Reference in New Issue
Block a user