feat:模板删除联调

This commit is contained in:
du.meimei
2025-03-17 17:57:18 +08:00
parent c902b018b0
commit 8549b7adb3
15 changed files with 137 additions and 102 deletions

5
components.d.ts vendored
View File

@@ -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' {
@@ -38,12 +38,9 @@ declare module 'vue' {
VanRadio: typeof import('vant/es')['Radio'] VanRadio: typeof import('vant/es')['Radio']
VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanRadioGroup: typeof import('vant/es')['RadioGroup']
VanRow: typeof import('vant/es')['Row'] VanRow: typeof import('vant/es')['Row']
VanSearch: typeof import('vant/es')['Search']
VanStepper: typeof import('vant/es')['Stepper'] VanStepper: typeof import('vant/es')['Stepper']
VanSwitch: typeof import('vant/es')['Switch'] VanSwitch: typeof import('vant/es')['Switch']
VanTab: typeof import('vant/es')['Tab'] VanTab: typeof import('vant/es')['Tab']
VanTabbar: typeof import('vant/es')['Tabbar']
VanTabbarItem: typeof import('vant/es')['TabbarItem']
VanTabs: typeof import('vant/es')['Tabs'] VanTabs: typeof import('vant/es')['Tabs']
YLCascader: typeof import('./src/components/YLCascader.vue')['default'] YLCascader: typeof import('./src/components/YLCascader.vue')['default']
YLInput: typeof import('./src/components/YLInput.vue')['default'] YLInput: typeof import('./src/components/YLInput.vue')['default']

View File

@@ -45,3 +45,9 @@ export function useTemplate(sn, params) {
data: params data: params
}); });
} }
export function deleteTemplate(sn) {
return request({
url: `/console/templates/${sn}`,
method: 'delete'
});
}

View File

@@ -2,7 +2,14 @@
<div class="common-layout"> <div class="common-layout">
<!-- title 标题和搜索栏 --> <!-- title 标题和搜索栏 -->
<header class="header"> <header class="header">
<van-nav-bar :title="$route.meta.title" left-arrow safe-area-inset-top @click-left="goBack"> <van-nav-bar
class="navbar-header"
:title="$route.meta.title"
left-arrow
safe-area-inset-top
:border="false"
@click-left="goBack"
>
<template #left> <template #left>
<van-icon name="left-long" class-prefix="mobilefont" size="18" style="color: #fff" /> <van-icon name="left-long" class-prefix="mobilefont" size="18" style="color: #fff" />
</template> </template>

View File

@@ -25,7 +25,7 @@ const router = createRouter({
path: '/survey', path: '/survey',
name: 'survey', name: 'survey',
meta: { meta: {
title: '问卷' title: '最新问卷'
}, },
component: () => import('../views/Survey/Index.vue') component: () => import('../views/Survey/Index.vue')
}, },

View File

@@ -97,7 +97,7 @@
/> />
<!--组件底部左侧操作--> <!--组件底部左侧操作-->
<template #action="{ element: el }"> <template #action="{ element: el }">
<div class="flex slot-actions" v-if="el.id === chooseQuestionId"> <div v-if="el.id === chooseQuestionId" class="flex slot-actions">
<template v-for="(item, optionIndex) in actionOptions"> <template v-for="(item, optionIndex) in actionOptions">
<div <div
v-if="item.question_type.includes(el.question_type)" v-if="item.question_type.includes(el.question_type)"

View File

@@ -98,8 +98,9 @@ const chooseItem = () => {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '@/assets/css/theme'; @import '@/assets/css/theme';
.choose-question-container { .choose-question-container {
padding: 12px 12px 0 12px; padding: 12px 12px 0;
& .choose-question-context { & .choose-question-context {
overflow: hidden; overflow: hidden;

View File

@@ -46,7 +46,7 @@ import { getSurveysPage } from '@/api/home/index.js';
const survey = ref({ const survey = ref({
project_name: '' project_name: ''
}); });
const fetchSurveys = async() => { const fetchSurveys = async () => {
const params = { const params = {
page: 1, page: 1,
per_page: 10, per_page: 10,

View File

@@ -20,7 +20,7 @@ const marketList = ref([]);
const active = ref(null); const active = ref(null);
const marketInfo = ref([]); const marketInfo = ref([]);
const getTableList = async() => { const getTableList = async () => {
const res = await getListScene(); const res = await getListScene();
if (res.data.code === 0) { if (res.data.code === 0) {
res.data.data.forEach((item) => { res.data.data.forEach((item) => {
@@ -31,7 +31,7 @@ const getTableList = async() => {
getMarketInfo(marketList.value[0]); getMarketInfo(marketList.value[0]);
} }
}; };
const getMarketInfo = async(item) => { const getMarketInfo = async (item) => {
const data = marketList.value.filter((market, index) => item === index)[0]; const data = marketList.value.filter((market, index) => item === index)[0];
if (data) { if (data) {
const params = { const params = {

View File

@@ -1,33 +1,51 @@
<template> <template>
<div class=""> <div class="">
<div> <div class="mark_container">
<van-row gutter="20"> <!-- <van-row gutter="20">-->
<van-col v-for="(item, index) in info" :key="index" span="11" class="market-item"> <div v-for="(item, index) in info" :key="index" class="market-item">
<div class="content"> <div class="content">
<div class="title fw-bold fs-14"> <div class="title fw-bold fs-14">
<div class="flex align-center"> <div class="flex align-center">
<img src="./svgs/contentSvg.svg" alt="Content Icon" style="width: 14px" /> <img src="./svgs/contentSvg.svg" alt="Content Icon" style="width: 14px" />
<p class="title_con">{{ item.title }}</p> <p class="title_con">{{ item.title }}</p>
</div>
<img src="./svgs/MarketItemSvg.svg" alt="Content Icon" style="width: 14px" />
</div> </div>
<div class="desc flex space-between"> <van-icon
<div> v-if="userInfo.userName === item.created_user"
<p>创建人</p> name="delete1"
<p class="fw-bold">{{ item.created_user }}</p> class-prefix="mobilefont"
</div> size="18"
<div> style="color: #ff6214"
<p>引用次数</p> @click="deleteItem(item)"
<p class="fw-bold">{{ item.quote_nums }}</p> />
</div>
<van-icon
v-else
name="delete1"
class-prefix="mobilefont"
size="18"
style="color: #c1c1c1"
/>
</div>
<div class="desc flex space-between">
<div>
<p>创建人</p>
<p class="fw-bold">{{ item.created_user }}</p>
</div>
<div>
<p>引用次数</p>
<p class="fw-bold">{{ item.quote_nums }}</p>
</div> </div>
</div> </div>
</van-col> </div>
</van-row> </div>
<!-- </van-row>-->
</div> </div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup>
import { ref, defineProps, onMounted } from 'vue';
import { deleteTemplate } from '@/api/home/index.js';
import { showDialog, showSuccessToast, showFailToast } from 'vant';
// import contentSvg from './svgs/contentSvg.svg'; // import contentSvg from './svgs/contentSvg.svg';
// import MarketItemSvg from './svgs/MarketItemSvg.svg'; // import MarketItemSvg from './svgs/MarketItemSvg.svg';
const { info } = defineProps({ const { info } = defineProps({
@@ -37,12 +55,42 @@ const { info } = defineProps({
default: () => ({}) default: () => ({})
} }
}); });
const userInfo = ref({ userName: '' });
const deleteItem = (item) => {
showDialog({
title: '是否确认删除此模板?',
showCancelButton: true,
confirmButtonColor: '#03B03C'
})
.then(async () => {
const res = await deleteTemplate(item.sn);
if (res.data.code === 0) {
showSuccessToast('删除成功');
} else {
showFailToast(res.data);
}
})
.catch(() => {
// on cancel
});
};
onMounted(() => {
userInfo.value = JSON.parse(sessionStorage.getItem('userInfo'));
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.mark_container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.market-item { .market-item {
//margin-right: 4%; //margin-right: 4%;
box-sizing: border-box; box-sizing: border-box;
width: 49%;
margin-bottom: 12px; margin-bottom: 12px;
padding: 10px; padding: 10px;
border-radius: 8px; border-radius: 8px;

View File

@@ -1,31 +0,0 @@
<svg
t="1741944281591"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="3990"
width="16"
height="16"
>
<path
d="M607.897867 768.043004c-17.717453 0-31.994625-14.277171-31.994625-31.994625L575.903242 383.935495c0-17.717453 14.277171-31.994625 31.994625-31.994625s31.994625 14.277171 31.994625 31.994625l0 351.94087C639.892491 753.593818 625.61532 768.043004 607.897867 768.043004z"
fill="#d81e06"
p-id="3991"
/>
<path
d="M415.930119 768.043004c-17.717453 0-31.994625-14.277171-31.994625-31.994625L383.935495 383.935495c0-17.717453 14.277171-31.994625 31.994625-31.994625 17.717453 0 31.994625 14.277171 31.994625 31.994625l0 351.94087C447.924744 753.593818 433.647573 768.043004 415.930119 768.043004z"
fill="#d81e06"
p-id="3992"
/>
<path
d="M928.016126 223.962372l-159.973123 0L768.043004 159.973123c0-52.980346-42.659499-95.983874-95.295817-95.983874L351.94087 63.989249c-52.980346 0-95.983874 43.003528-95.983874 95.983874l0 63.989249-159.973123 0c-17.717453 0-31.994625 14.277171-31.994625 31.994625s14.277171 31.994625 31.994625 31.994625l832.032253 0c17.717453 0 31.994625-14.277171 31.994625-31.994625S945.73358 223.962372 928.016126 223.962372zM319.946246 159.973123c0-17.545439 14.449185-31.994625 31.994625-31.994625l320.806316 0c17.545439 0 31.306568 14.105157 31.306568 31.994625l0 63.989249L319.946246 223.962372 319.946246 159.973123 319.946246 159.973123z"
fill="#d81e06"
p-id="3993"
/>
<path
d="M736.048379 960.010751 288.123635 960.010751c-52.980346 0-95.983874-43.003528-95.983874-95.983874L192.139761 383.591466c0-17.717453 14.277171-31.994625 31.994625-31.994625s31.994625 14.277171 31.994625 31.994625l0 480.435411c0 17.717453 14.449185 31.994625 31.994625 31.994625l448.096758 0c17.717453 0 31.994625-14.277171 31.994625-31.994625L768.215018 384.795565c0-17.717453 14.277171-31.994625 31.994625-31.994625s31.994625 14.277171 31.994625 31.994625l0 479.231312C832.032253 916.835209 789.028725 960.010751 736.048379 960.010751z"
fill="#d81e06"
p-id="3994"
/>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -51,8 +51,8 @@
<Design <Design
:activeId="activeId" :activeId="activeId"
class="design" class="design"
@get-active-question="getActiveQuestion"
:filterGap="true" :filterGap="true"
@get-active-question="getActiveQuestion"
> >
<template #button="{ item }"> <template #button="{ item }">
<div v-if="activeId === item.id" class="design-button"> <div v-if="activeId === item.id" class="design-button">
@@ -677,8 +677,8 @@ onMounted(async () => {
min-height: 70vh; min-height: 70vh;
.design-button { .design-button {
text-align: center;
margin-top: 10px; margin-top: 10px;
text-align: center;
& > button { & > button {
padding: 0.5rem; padding: 0.5rem;

View File

@@ -8,18 +8,19 @@
</van-col> </van-col>
<van-col :span="showLastButton ? 12 : 24"> <van-col :span="showLastButton ? 12 : 24">
<van-button v-show="page < pages" color="#71b73c" @click="next"> <van-button v-show="page < pages" color="#71b73c" @click="next">
{{ showStart && page === 0 {{
? startText showStart && page === 0
: showSubmit && page + 1 === pages ? startText
? submitText : showSubmit && page + 1 === pages
: nextText || nextButtonText }} ? submitText
: nextText || nextButtonText
}}
</van-button> </van-button>
</van-col> </van-col>
</van-row> </van-row>
</template> </template>
<script> <script>
import { computed, defineComponent } from 'vue'; import { computed, defineComponent } from 'vue';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { useQuestionStore } from '@/stores/Questions/useQuestionStore'; import { useQuestionStore } from '@/stores/Questions/useQuestionStore';
@@ -128,7 +129,9 @@ export default defineComponent({
} }
} }
const showLastButton = computed(() => props.showPrevious && props.page > props.min && props.page < props.pages - 1); const showLastButton = computed(
() => props.showPrevious && props.page > props.min && props.page < props.pages - 1
);
return { return {
prevButtonText, prevButtonText,
nextButtonText, nextButtonText,

View File

@@ -42,4 +42,4 @@ watch(
emit('changeAnswer', res); emit('changeAnswer', res);
} }
); );
</script> </script>

View File

@@ -26,7 +26,6 @@
</template> </template>
<script> <script>
// import RichText from '@/components/RichText.vue'; // import RichText from '@/components/RichText.vue';
import { computed, defineComponent } from 'vue'; import { computed, defineComponent } from 'vue';
// import Remark from '../components/Remark/index.vue'; // import Remark from '../components/Remark/index.vue';
@@ -35,7 +34,11 @@ import { useQuestionStore } from '@/stores/Questions/useQuestionStore';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
export default defineComponent({ export default defineComponent({
components: {/* RichText, */ /* Remark, */ /* LangTranslate */ }, components: {
/* RichText, */
/* Remark, */
/* LangTranslate */
},
props: { props: {
// 标题 // 标题
stem: { stem: {
@@ -144,8 +147,8 @@ export default defineComponent({
// 替换文本 // 替换文本
let replacement = ''; let replacement = '';
// 查找引用问题 // 查找引用问题
const question const question =
= props.questions.find((question) => { props.questions.find((question) => {
// 矩阵题 // 矩阵题
if (question.question_type >= 8 && question.question_type <= 11) { if (question.question_type >= 8 && question.question_type <= 11) {
return question.title === value.split('_R')[0].split('_C')[0]; return question.title === value.split('_R')[0].split('_C')[0];
@@ -155,8 +158,8 @@ export default defineComponent({
return question.title === value.split('_A')[0]; return question.title === value.split('_A')[0];
} }
return question.title === value; return question.title === value;
}) }) ||
|| props.questions.find((question) => { props.questions.find((question) => {
// 矩阵题 // 矩阵题
if (question.question_type >= 8 && question.question_type <= 11) { if (question.question_type >= 8 && question.question_type <= 11) {
return question.title === (value + cycleIndexStr).split('_R')[0].split('_C')[0]; return question.title === (value + cycleIndexStr).split('_R')[0].split('_C')[0];
@@ -184,8 +187,8 @@ export default defineComponent({
replacement = answer[option.option_key]; replacement = answer[option.option_key];
} }
} else if ( } else if (
question.question_type === 2 question.question_type === 2 &&
&& Object.keys(answer).length >= question.config.min_select Object.keys(answer).length >= question.config.min_select
) { ) {
// 查找引用选项(多选) // 查找引用选项(多选)
options.forEach((option) => { options.forEach((option) => {
@@ -287,7 +290,7 @@ export default defineComponent({
min-height: 24px; min-height: 24px;
margin-bottom: 24px; margin-bottom: 24px;
>span { > span {
flex-shrink: 0; flex-shrink: 0;
} }
@@ -312,4 +315,4 @@ export default defineComponent({
margin-bottom: 0; margin-bottom: 0;
} }
} }
</style> </style>

View File

@@ -10,7 +10,7 @@
<img :src="publishInfo?.img_url" alt="" width="100px" height="100px" /> <img :src="publishInfo?.img_url" alt="" width="100px" height="100px" />
<div class="tit"> <div class="tit">
<div>{{ surveyTitle || '' }}</div> <div>{{ surveyTitle || '' }}</div>
<div style="font-weight: 600;font-size: 14px;">扫码填写问卷</div> <div style="font-weight: 600; font-size: 14px">扫码填写问卷</div>
</div> </div>
</div> </div>
<div class="tip">移动端仅做数据回收问卷数据分析请前往PC端浏览</div> <div class="tip">移动端仅做数据回收问卷数据分析请前往PC端浏览</div>
@@ -95,21 +95,21 @@ type OperateItem = (typeof operateList)[0];
const operateBtn = (item: OperateItem) => { const operateBtn = (item: OperateItem) => {
switch (item.type) { switch (item.type) {
case 'shareLink': case 'shareLink':
shareLink(); shareLink();
break; break;
case 'copyLink': case 'copyLink':
copyLink(); copyLink();
break; break;
case 'qrCode': case 'qrCode':
downLoadImg(); downLoadImg();
break; break;
default: default:
break; break;
} }
}; };
// 复制链接 // 复制链接
function copyLink () { function copyLink() {
const input = document.createElement('input'); const input = document.createElement('input');
input.value = publishInfo.value.url; input.value = publishInfo.value.url;
document.body.appendChild(input); document.body.appendChild(input);
@@ -119,7 +119,7 @@ function copyLink () {
showToast('复制成功'); showToast('复制成功');
} }
// 分享链接 // 分享链接
function shareLink () { function shareLink() {
const params = { const params = {
type: 'shareToWx', type: 'shareToWx',
title: publishInfo.value.download_url.title, title: publishInfo.value.download_url.title,
@@ -136,7 +136,7 @@ function shareLink () {
} }
// 下载二维码 // 下载二维码
function downLoadImg () { function downLoadImg() {
const { title, url } = publishInfo.value.download_url; const { title, url } = publishInfo.value.download_url;
if (utils.getSessionStorage('xToken')) { if (utils.getSessionStorage('xToken')) {
appBridge.save2Album(url, () => { appBridge.save2Album(url, () => {
@@ -193,7 +193,7 @@ watch(status, (val) => {
getCode(); getCode();
} }
}); });
onMounted(async() => { onMounted(async () => {
// status.value = 1; // status.value = 1;
// publishInfo.value.img_url // publishInfo.value.img_url
// = 'https://test-cxp-pubcos.yili.com/uat-yls//survey-api/publish/202503130938138261340.png'; // = 'https://test-cxp-pubcos.yili.com/uat-yls//survey-api/publish/202503130938138261340.png';
@@ -209,7 +209,7 @@ onMounted(async() => {
<style scoped lang="scss"> <style scoped lang="scss">
.container { .container {
height: 100vh; height: 100vh;
background: linear-gradient(to bottom, #70B937 5.3rem, #F2F2F2 8rem); background: linear-gradient(to bottom, #70b937 5.3rem, #f2f2f2 8rem);
button { button {
padding: 3px 20px; padding: 3px 20px;
@@ -252,9 +252,10 @@ onMounted(async() => {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
margin: 25px 24px 0 24px; margin: 25px 24px 0;
color: #7f7f7f; color: #7f7f7f;
font-size: 13px; font-size: 13px;
span { span {
display: flex; display: flex;
flex-direction: column; flex-direction: column;