feat:问卷功能联调
This commit is contained in:
2
components.d.ts
vendored
2
components.d.ts
vendored
@@ -2,7 +2,7 @@
|
||||
// @ts-nocheck
|
||||
// Generated by unplugin-vue-components
|
||||
// Read more: https://github.com/vuejs/core/pull/3399
|
||||
export {};
|
||||
export {}
|
||||
|
||||
/* prettier-ignore */
|
||||
declare module 'vue' {
|
||||
|
||||
@@ -22,6 +22,20 @@ export function getSurveysPage(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) {
|
||||
return request({
|
||||
url: 'console/h5_scene',
|
||||
|
||||
@@ -44,12 +44,12 @@
|
||||
<div class="survey_item_action">
|
||||
<!-- <el-space direction="horizontal">-->
|
||||
<div>
|
||||
<el-button> 删除</el-button>
|
||||
<el-button> 复制</el-button>
|
||||
<el-button style="border: 2px solid #71b73c">
|
||||
<el-button @click="deleteItem(item)"> 删除</el-button>
|
||||
<el-button @click="copyItem(item)"> 复制</el-button>
|
||||
<el-button @click="toPreiview(item)" style="border: 2px solid #71b73c">
|
||||
<el-text style="color: #71b73c">预览</el-text>
|
||||
</el-button>
|
||||
<el-button color="#6fb937">
|
||||
<el-button @click="toPublish(item)" color="#6fb937">
|
||||
<el-text style="color: white">开启投放</el-text>
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -70,8 +70,11 @@
|
||||
|
||||
<script setup>
|
||||
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 { showDialog, showFailToast, showSuccessToast, showToast } from 'vant';
|
||||
import { useRouter } from 'vue-router';
|
||||
const router = useRouter();
|
||||
const survey = ref([]);
|
||||
const form = ref({
|
||||
page: 1,
|
||||
@@ -103,7 +106,69 @@ const fetchSurveys = async () => {
|
||||
// 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(() => {
|
||||
fetchSurveys();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user