feat: 添加更多模板跳转功能
- 为"更多模板"按钮添加了跳转到模板市场的功能 - 完善了用户交互体验,使导航更加直观 - 优化了问卷创建流程
This commit is contained in:
@@ -1,205 +1,209 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { consoleSurveys, getQuestionList, useTemplate } from '@/api/home/index.js';
|
import { consoleSurveys, getQuestionList, useTemplate } from '@/api/home/index.js';
|
||||||
import { saveQuestions, snQuestions } from '@/api/design/index.js';
|
import { saveQuestions, snQuestions } from '@/api/design/index.js';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useCounterStore } from '@/stores/counter';
|
import { useCounterStore } from '@/stores/counter';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import homePen from '@/assets/img/home/home-pen.png';
|
import homePen from '@/assets/img/home/home-pen.png';
|
||||||
// 获取 Store 实例
|
// 获取 Store 实例
|
||||||
const counterStore = useCounterStore();
|
const counterStore = useCounterStore();
|
||||||
const store = storeToRefs(counterStore);
|
const store = storeToRefs(counterStore);
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const surveys = ref([]);
|
const surveys = ref([]);
|
||||||
|
|
||||||
const createdNewPage = defineModel('createdNewPage', {
|
const createdNewPage = defineModel('createdNewPage', {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
});
|
});
|
||||||
const createdQuestion = (item) => {
|
const createdQuestion = (item) => {
|
||||||
// 为 智能创建建立链接
|
// 为 智能创建建立链接
|
||||||
if (item.h5Title === '智能创建') {
|
if (item.h5Title === '智能创建') {
|
||||||
return router.push({ name: 'intelligentGeneration' });
|
return router.push({ name: 'intelligentGeneration' });
|
||||||
}
|
}
|
||||||
|
// 为 更多模板添加对应的跳转链接
|
||||||
const query = {
|
if (item.h5Title === '更多模板') {
|
||||||
group_id: 0,
|
return router.push({ name: 'templateMarket' });
|
||||||
source: 1,
|
}
|
||||||
project_name: `${item.title}问卷 `,
|
|
||||||
remarks: '为优化活动服务品质,烦请完成问卷,感谢配合',
|
const query = {
|
||||||
scene_code: item.parentCode,
|
group_id: 0,
|
||||||
scene_code_info: item.code,
|
source: 1,
|
||||||
// 很迷茫 模板新增 tag 空数组 非模板 就是k
|
project_name: `${item.title}问卷 `,
|
||||||
tags: ''
|
remarks: '为优化活动服务品质,烦请完成问卷,感谢配合',
|
||||||
};
|
scene_code: item.parentCode,
|
||||||
if (createdNewPage.value) {
|
scene_code_info: item.code,
|
||||||
query.scene_code = item.parentCode;
|
// 很迷茫 模板新增 tag 空数组 非模板 就是k
|
||||||
query.tags = '';
|
tags: ''
|
||||||
} else {
|
};
|
||||||
if (item.sn) {
|
if (createdNewPage.value) {
|
||||||
query.scene_code = null;
|
query.scene_code = item.parentCode;
|
||||||
query.tags = [];
|
query.tags = '';
|
||||||
}
|
} else {
|
||||||
}
|
if (item.sn) {
|
||||||
|
query.scene_code = null;
|
||||||
// 如果放在了底部 当作新增组件
|
query.tags = [];
|
||||||
if (createdNewPage.value) {
|
}
|
||||||
consoleSurveys(query).then((res) => {
|
}
|
||||||
if (res.data) {
|
|
||||||
createdApx(res);
|
// 如果放在了底部 当作新增组件
|
||||||
}
|
if (createdNewPage.value) {
|
||||||
});
|
consoleSurveys(query).then((res) => {
|
||||||
} else {
|
if (res.data) {
|
||||||
if (item.sn) {
|
createdApx(res);
|
||||||
useTemplate(item.sn, query).then((temp) => {
|
}
|
||||||
if (temp.data) {
|
});
|
||||||
createdApx(temp);
|
} else {
|
||||||
}
|
if (item.sn) {
|
||||||
});
|
useTemplate(item.sn, query).then((temp) => {
|
||||||
} else {
|
if (temp.data) {
|
||||||
consoleSurveys(query).then((res) => {
|
createdApx(temp);
|
||||||
if (res.data) {
|
}
|
||||||
createdApx(res);
|
});
|
||||||
}
|
} else {
|
||||||
});
|
consoleSurveys(query).then((res) => {
|
||||||
}
|
if (res.data) {
|
||||||
}
|
createdApx(res);
|
||||||
};
|
}
|
||||||
const createdApx = (res) => {
|
});
|
||||||
snQuestions({ sn: res.data.data.sn }).then((ques) => {
|
}
|
||||||
if (ques.data) {
|
}
|
||||||
ques.data.data.survey.introduction = `<p>为优化活动服务品质,烦请完成问卷,感谢配合!您的反馈至关重要!</p>`;
|
};
|
||||||
store.questionsInfo.value = ques.data.data;
|
const createdApx = (res) => {
|
||||||
saveQuestions({
|
snQuestions({ sn: res.data.data.sn }).then((ques) => {
|
||||||
sn: res.data.data.sn,
|
if (ques.data) {
|
||||||
introduction: ques.data.data.survey.introduction,
|
ques.data.data.survey.introduction = `<p>为优化活动服务品质,烦请完成问卷,感谢配合!您的反馈至关重要!</p>`;
|
||||||
title: ques.data.data.survey.title
|
store.questionsInfo.value = ques.data.data;
|
||||||
}).then(() => {
|
saveQuestions({
|
||||||
router.push({
|
sn: res.data.data.sn,
|
||||||
path: '/create',
|
introduction: ques.data.data.survey.introduction,
|
||||||
query: {
|
title: ques.data.data.survey.title
|
||||||
sn: res.data.data.sn
|
}).then(() => {
|
||||||
}
|
router.push({
|
||||||
});
|
path: '/create',
|
||||||
});
|
query: {
|
||||||
}
|
sn: res.data.data.sn
|
||||||
});
|
}
|
||||||
};
|
});
|
||||||
|
});
|
||||||
// 添加获取问卷列表的方法
|
}
|
||||||
const getList = () => {
|
});
|
||||||
getQuestionList().then((res) => {
|
};
|
||||||
if (res.data.code === 0) {
|
|
||||||
if (res.data.data) {
|
// 添加获取问卷列表的方法
|
||||||
res.data.data.forEach((item) => {
|
const getList = () => {
|
||||||
// if (item.parentCode && item.parentCode === 1) {
|
getQuestionList().then((res) => {
|
||||||
surveys.value.push(item);
|
if (res.data.code === 0) {
|
||||||
// }
|
if (res.data.data) {
|
||||||
});
|
res.data.data.forEach((item) => {
|
||||||
|
// if (item.parentCode && item.parentCode === 1) {
|
||||||
// surveys.value.push({});
|
surveys.value.push(item);
|
||||||
}
|
// }
|
||||||
}
|
});
|
||||||
});
|
|
||||||
};
|
// surveys.value.push({});
|
||||||
|
}
|
||||||
// 在组件挂载时调用
|
}
|
||||||
onMounted(() => {
|
});
|
||||||
getList();
|
};
|
||||||
});
|
|
||||||
</script>
|
// 在组件挂载时调用
|
||||||
|
onMounted(() => {
|
||||||
<template>
|
getList();
|
||||||
<div class="create_survey">
|
});
|
||||||
<div class="create_survey_title" style="color: #000; text-align: left">新建问卷</div>
|
</script>
|
||||||
<div class="home-pen">
|
|
||||||
<img :src="homePen" alt="" />
|
<template>
|
||||||
</div>
|
<div class="create_survey">
|
||||||
<div class="surveys">
|
<div class="create_survey_title" style="color: #000; text-align: left">新建问卷</div>
|
||||||
<!-- <div @click="$router.push({ name: 'intelligentGeneration' })">AI 智能创建</div> -->
|
<div class="home-pen">
|
||||||
<div
|
<img :src="homePen" alt="" />
|
||||||
v-for="survey in surveys"
|
</div>
|
||||||
:key="survey.title"
|
<div class="surveys">
|
||||||
class="survey"
|
<!-- <div @click="$router.push({ name: 'intelligentGeneration' })">AI 智能创建</div> -->
|
||||||
@click="createdQuestion(survey)"
|
<div
|
||||||
>
|
v-for="survey in surveys"
|
||||||
<img :src="survey.h5Image" alt="" width="40" />
|
:key="survey.title"
|
||||||
<span>{{ survey.h5Title }}</span>
|
class="survey"
|
||||||
</div>
|
@click="createdQuestion(survey)"
|
||||||
</div>
|
>
|
||||||
</div>
|
<img :src="survey.h5Image" alt="" width="40" />
|
||||||
</template>
|
<span>{{ survey.h5Title }}</span>
|
||||||
|
</div>
|
||||||
<style lang="scss" scoped>
|
</div>
|
||||||
.home-pen {
|
</div>
|
||||||
//height: 200px;
|
</template>
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
<style lang="scss" scoped>
|
||||||
left: 0;
|
.home-pen {
|
||||||
z-index: -1;
|
//height: 200px;
|
||||||
|
position: absolute;
|
||||||
//width: 100%;
|
top: 0;
|
||||||
background: #fff;
|
left: 0;
|
||||||
|
z-index: -1;
|
||||||
img {
|
|
||||||
width: 100%;
|
//width: 100%;
|
||||||
|
background: #fff;
|
||||||
//height: 200px;
|
|
||||||
}
|
img {
|
||||||
}
|
width: 100%;
|
||||||
|
|
||||||
.create_survey {
|
//height: 200px;
|
||||||
overflow: hidden;
|
}
|
||||||
margin-top: 10px;
|
}
|
||||||
border-radius: 16px;
|
|
||||||
background-image: url('@/assets/img/home/item-back.png');
|
.create_survey {
|
||||||
background-position: center; /* 确保图片居中显示 */
|
overflow: hidden;
|
||||||
background-size: cover; /* 或者使用具体的尺寸,如 100% 100% */
|
margin-top: 10px;
|
||||||
background-repeat: no-repeat;
|
border-radius: 16px;
|
||||||
|
background-image: url('@/assets/img/home/item-back.png');
|
||||||
//padding: 15px;
|
background-position: center; /* 确保图片居中显示 */
|
||||||
|
background-size: cover; /* 或者使用具体的尺寸,如 100% 100% */
|
||||||
color: #000;
|
background-repeat: no-repeat;
|
||||||
|
|
||||||
.create_survey_title {
|
//padding: 15px;
|
||||||
position: relative;
|
|
||||||
margin: 16px;
|
color: #000;
|
||||||
color: #000;
|
|
||||||
font-weight: bold;
|
.create_survey_title {
|
||||||
font-size: 15px;
|
position: relative;
|
||||||
font-family: PingFangSC, 'PingFang SC';
|
margin: 16px;
|
||||||
}
|
color: #000;
|
||||||
|
font-weight: bold;
|
||||||
& .warp {
|
font-size: 15px;
|
||||||
flex-wrap: wrap;
|
font-family: PingFangSC, 'PingFang SC';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
& .warp {
|
||||||
//全部问卷容器
|
flex-wrap: wrap;
|
||||||
.surveys {
|
}
|
||||||
display: grid;
|
}
|
||||||
grid-template-columns: repeat(4, 1fr);
|
|
||||||
grid-template-rows: repeat(2, 1fr);
|
//全部问卷容器
|
||||||
// 单个问卷
|
.surveys {
|
||||||
.survey {
|
display: grid;
|
||||||
display: flex;
|
grid-template-columns: repeat(4, 1fr);
|
||||||
flex-direction: column;
|
grid-template-rows: repeat(2, 1fr);
|
||||||
align-items: center;
|
// 单个问卷
|
||||||
text-align: center;
|
.survey {
|
||||||
|
display: flex;
|
||||||
img {
|
flex-direction: column;
|
||||||
width: 50px;
|
align-items: center;
|
||||||
height: 50px;
|
text-align: center;
|
||||||
}
|
|
||||||
|
img {
|
||||||
span {
|
width: 50px;
|
||||||
margin-top: 8px;
|
height: 50px;
|
||||||
margin-bottom: 10px;
|
}
|
||||||
color: #000;
|
|
||||||
font-weight: 400;
|
span {
|
||||||
font-size: 0.34rem;
|
margin-top: 8px;
|
||||||
}
|
margin-bottom: 10px;
|
||||||
}
|
color: #000;
|
||||||
}
|
font-weight: 400;
|
||||||
</style>
|
font-size: 0.34rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user