feat:问卷功能联调
This commit is contained in:
2
components.d.ts
vendored
2
components.d.ts
vendored
@@ -2,7 +2,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// Generated by unplugin-vue-components
|
// Generated by unplugin-vue-components
|
||||||
// Read more: https://github.com/vuejs/core/pull/3399
|
// Read more: https://github.com/vuejs/core/pull/3399
|
||||||
export {};
|
export {}
|
||||||
|
|
||||||
/* prettier-ignore */
|
/* prettier-ignore */
|
||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
|
|||||||
@@ -22,6 +22,20 @@ export function getSurveysPage(params) {
|
|||||||
params
|
params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// 复制问卷
|
||||||
|
export function copySurveys(sn) {
|
||||||
|
return request({
|
||||||
|
url: `/console/surveys/${sn}`,
|
||||||
|
method: 'post'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 复制问卷
|
||||||
|
export function deleteSurveys(sn) {
|
||||||
|
return request({
|
||||||
|
url: `/console/surveys/${sn}`,
|
||||||
|
method: 'delete'
|
||||||
|
});
|
||||||
|
}
|
||||||
export function getListScene(params) {
|
export function getListScene(params) {
|
||||||
return request({
|
return request({
|
||||||
url: 'console/h5_scene',
|
url: 'console/h5_scene',
|
||||||
|
|||||||
@@ -52,8 +52,8 @@
|
|||||||
<martrix-question
|
<martrix-question
|
||||||
v-if="
|
v-if="
|
||||||
element.question_type === 8 ||
|
element.question_type === 8 ||
|
||||||
element.question_type === 9 ||
|
element.question_type === 9 ||
|
||||||
element.question_type === 10
|
element.question_type === 10
|
||||||
"
|
"
|
||||||
:element="computedElement(element)"
|
:element="computedElement(element)"
|
||||||
:index="index"
|
:index="index"
|
||||||
|
|||||||
@@ -44,12 +44,12 @@
|
|||||||
<div class="survey_item_action">
|
<div class="survey_item_action">
|
||||||
<!-- <el-space direction="horizontal">-->
|
<!-- <el-space direction="horizontal">-->
|
||||||
<div>
|
<div>
|
||||||
<el-button> 删除</el-button>
|
<el-button @click="deleteItem(item)"> 删除</el-button>
|
||||||
<el-button> 复制</el-button>
|
<el-button @click="copyItem(item)"> 复制</el-button>
|
||||||
<el-button style="border: 2px solid #71b73c">
|
<el-button @click="toPreiview(item)" style="border: 2px solid #71b73c">
|
||||||
<el-text style="color: #71b73c">预览</el-text>
|
<el-text style="color: #71b73c">预览</el-text>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button color="#6fb937">
|
<el-button @click="toPublish(item)" color="#6fb937">
|
||||||
<el-text style="color: white">开启投放</el-text>
|
<el-text style="color: white">开启投放</el-text>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -70,8 +70,11 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
import { getSurveysPage } from '@/api/home/index.js';
|
import { deleteTemplate, getSurveysPage, copySurveys, deleteSurveys } from '@/api/home/index.js';
|
||||||
import { Io5EllipsisHorizontalSharp } from 'vue-icons-plus/io5';
|
import { Io5EllipsisHorizontalSharp } from 'vue-icons-plus/io5';
|
||||||
|
import { showDialog, showFailToast, showSuccessToast, showToast } from 'vant';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
const router = useRouter();
|
||||||
const survey = ref([]);
|
const survey = ref([]);
|
||||||
const form = ref({
|
const form = ref({
|
||||||
page: 1,
|
page: 1,
|
||||||
@@ -103,7 +106,69 @@ const fetchSurveys = async () => {
|
|||||||
// Toast()
|
// Toast()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const deleteItem = (item) => {
|
||||||
|
showDialog({
|
||||||
|
title: `确认删除问卷${item.project_name} ?`,
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#03B03C'
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
const res = await deleteSurveys(item.sn);
|
||||||
|
if (res.data.message) {
|
||||||
|
showToast(res.data.message);
|
||||||
|
} else {
|
||||||
|
showToast('删除成功!');
|
||||||
|
}
|
||||||
|
form.value.page = 1;
|
||||||
|
await fetchSurveys();
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
if (res.data.message) {
|
||||||
|
showToast(res.data.message);
|
||||||
|
}
|
||||||
|
form.value.page = 1;
|
||||||
|
fetchSurveys();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const copyItem = (item) => {
|
||||||
|
showDialog({
|
||||||
|
title: `确认复制问卷${item.project_name} ?`,
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#03B03C'
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
const res = await copySurveys(item.sn);
|
||||||
|
console.log(res);
|
||||||
|
if (res.data.code === 200 || res.data.code === 201) {
|
||||||
|
showSuccessToast('复制成功');
|
||||||
|
form.value.page = 1;
|
||||||
|
await fetchSurveys();
|
||||||
|
} else {
|
||||||
|
showFailToast(res.data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
// on cancel
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const toPreiview = (item) => {
|
||||||
|
router.push({
|
||||||
|
path: '/preview',
|
||||||
|
query: {
|
||||||
|
sn: item.sn,
|
||||||
|
name: item.project_name,
|
||||||
|
source: 0
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const toPublish = (item) => {
|
||||||
|
router.push({
|
||||||
|
path: '/publish',
|
||||||
|
query: {
|
||||||
|
sn: item.sn
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchSurveys();
|
fetchSurveys();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user