feat:模板删除联调
This commit is contained in:
5
components.d.ts
vendored
5
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' {
|
||||
@@ -38,12 +38,9 @@ declare module 'vue' {
|
||||
VanRadio: typeof import('vant/es')['Radio']
|
||||
VanRadioGroup: typeof import('vant/es')['RadioGroup']
|
||||
VanRow: typeof import('vant/es')['Row']
|
||||
VanSearch: typeof import('vant/es')['Search']
|
||||
VanStepper: typeof import('vant/es')['Stepper']
|
||||
VanSwitch: typeof import('vant/es')['Switch']
|
||||
VanTab: typeof import('vant/es')['Tab']
|
||||
VanTabbar: typeof import('vant/es')['Tabbar']
|
||||
VanTabbarItem: typeof import('vant/es')['TabbarItem']
|
||||
VanTabs: typeof import('vant/es')['Tabs']
|
||||
YLCascader: typeof import('./src/components/YLCascader.vue')['default']
|
||||
YLInput: typeof import('./src/components/YLInput.vue')['default']
|
||||
|
||||
@@ -45,3 +45,9 @@ export function useTemplate(sn, params) {
|
||||
data: params
|
||||
});
|
||||
}
|
||||
export function deleteTemplate(sn) {
|
||||
return request({
|
||||
url: `/console/templates/${sn}`,
|
||||
method: 'delete'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,7 +2,14 @@
|
||||
<div class="common-layout">
|
||||
<!-- title 标题和搜索栏 -->
|
||||
<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>
|
||||
<van-icon name="left-long" class-prefix="mobilefont" size="18" style="color: #fff" />
|
||||
</template>
|
||||
|
||||
@@ -25,7 +25,7 @@ const router = createRouter({
|
||||
path: '/survey',
|
||||
name: 'survey',
|
||||
meta: {
|
||||
title: '问卷'
|
||||
title: '最新问卷'
|
||||
},
|
||||
component: () => import('../views/Survey/Index.vue')
|
||||
},
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
/>
|
||||
<!--组件底部左侧操作-->
|
||||
<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">
|
||||
<div
|
||||
v-if="item.question_type.includes(el.question_type)"
|
||||
|
||||
@@ -98,8 +98,9 @@ const chooseItem = () => {
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
@import '@/assets/css/theme';
|
||||
|
||||
.choose-question-container {
|
||||
padding: 12px 12px 0 12px;
|
||||
padding: 12px 12px 0;
|
||||
|
||||
& .choose-question-context {
|
||||
overflow: hidden;
|
||||
|
||||
@@ -46,7 +46,7 @@ import { getSurveysPage } from '@/api/home/index.js';
|
||||
const survey = ref({
|
||||
project_name: ''
|
||||
});
|
||||
const fetchSurveys = async() => {
|
||||
const fetchSurveys = async () => {
|
||||
const params = {
|
||||
page: 1,
|
||||
per_page: 10,
|
||||
|
||||
@@ -20,7 +20,7 @@ const marketList = ref([]);
|
||||
const active = ref(null);
|
||||
const marketInfo = ref([]);
|
||||
|
||||
const getTableList = async() => {
|
||||
const getTableList = async () => {
|
||||
const res = await getListScene();
|
||||
if (res.data.code === 0) {
|
||||
res.data.data.forEach((item) => {
|
||||
@@ -31,7 +31,7 @@ const getTableList = async() => {
|
||||
getMarketInfo(marketList.value[0]);
|
||||
}
|
||||
};
|
||||
const getMarketInfo = async(item) => {
|
||||
const getMarketInfo = async (item) => {
|
||||
const data = marketList.value.filter((market, index) => item === index)[0];
|
||||
if (data) {
|
||||
const params = {
|
||||
|
||||
@@ -1,33 +1,51 @@
|
||||
<template>
|
||||
<div class="">
|
||||
<div>
|
||||
<van-row gutter="20">
|
||||
<van-col v-for="(item, index) in info" :key="index" span="11" class="market-item">
|
||||
<div class="content">
|
||||
<div class="title fw-bold fs-14">
|
||||
<div class="flex align-center">
|
||||
<img src="./svgs/contentSvg.svg" alt="Content Icon" style="width: 14px" />
|
||||
<p class="title_con">{{ item.title }}</p>
|
||||
</div>
|
||||
<img src="./svgs/MarketItemSvg.svg" alt="Content Icon" style="width: 14px" />
|
||||
<div class="mark_container">
|
||||
<!-- <van-row gutter="20">-->
|
||||
<div v-for="(item, index) in info" :key="index" class="market-item">
|
||||
<div class="content">
|
||||
<div class="title fw-bold fs-14">
|
||||
<div class="flex align-center">
|
||||
<img src="./svgs/contentSvg.svg" alt="Content Icon" style="width: 14px" />
|
||||
<p class="title_con">{{ item.title }}</p>
|
||||
</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>
|
||||
<van-icon
|
||||
v-if="userInfo.userName === item.created_user"
|
||||
name="delete1"
|
||||
class-prefix="mobilefont"
|
||||
size="18"
|
||||
style="color: #ff6214"
|
||||
@click="deleteItem(item)"
|
||||
/>
|
||||
|
||||
<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>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </van-row>-->
|
||||
</div>
|
||||
</div>
|
||||
</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 MarketItemSvg from './svgs/MarketItemSvg.svg';
|
||||
const { info } = defineProps({
|
||||
@@ -37,12 +55,42 @@ const { info } = defineProps({
|
||||
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>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.mark_container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.market-item {
|
||||
//margin-right: 4%;
|
||||
box-sizing: border-box;
|
||||
width: 49%;
|
||||
margin-bottom: 12px;
|
||||
padding: 10px;
|
||||
border-radius: 8px;
|
||||
|
||||
@@ -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 |
@@ -51,8 +51,8 @@
|
||||
<Design
|
||||
:activeId="activeId"
|
||||
class="design"
|
||||
@get-active-question="getActiveQuestion"
|
||||
:filterGap="true"
|
||||
@get-active-question="getActiveQuestion"
|
||||
>
|
||||
<template #button="{ item }">
|
||||
<div v-if="activeId === item.id" class="design-button">
|
||||
@@ -677,8 +677,8 @@ onMounted(async () => {
|
||||
min-height: 70vh;
|
||||
|
||||
.design-button {
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
text-align: center;
|
||||
|
||||
& > button {
|
||||
padding: 0.5rem;
|
||||
|
||||
@@ -8,18 +8,19 @@
|
||||
</van-col>
|
||||
<van-col :span="showLastButton ? 12 : 24">
|
||||
<van-button v-show="page < pages" color="#71b73c" @click="next">
|
||||
{{ showStart && page === 0
|
||||
? startText
|
||||
: showSubmit && page + 1 === pages
|
||||
? submitText
|
||||
: nextText || nextButtonText }}
|
||||
{{
|
||||
showStart && page === 0
|
||||
? startText
|
||||
: showSubmit && page + 1 === pages
|
||||
? submitText
|
||||
: nextText || nextButtonText
|
||||
}}
|
||||
</van-button>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { computed, defineComponent } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
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 {
|
||||
prevButtonText,
|
||||
nextButtonText,
|
||||
|
||||
@@ -42,4 +42,4 @@ watch(
|
||||
emit('changeAnswer', res);
|
||||
}
|
||||
);
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
// import RichText from '@/components/RichText.vue';
|
||||
import { computed, defineComponent } from 'vue';
|
||||
// import Remark from '../components/Remark/index.vue';
|
||||
@@ -35,7 +34,11 @@ import { useQuestionStore } from '@/stores/Questions/useQuestionStore';
|
||||
import { storeToRefs } from 'pinia';
|
||||
|
||||
export default defineComponent({
|
||||
components: {/* RichText, */ /* Remark, */ /* LangTranslate */ },
|
||||
components: {
|
||||
/* RichText, */
|
||||
/* Remark, */
|
||||
/* LangTranslate */
|
||||
},
|
||||
props: {
|
||||
// 标题
|
||||
stem: {
|
||||
@@ -144,8 +147,8 @@ export default defineComponent({
|
||||
// 替换文本
|
||||
let replacement = '';
|
||||
// 查找引用问题
|
||||
const question
|
||||
= props.questions.find((question) => {
|
||||
const question =
|
||||
props.questions.find((question) => {
|
||||
// 矩阵题
|
||||
if (question.question_type >= 8 && question.question_type <= 11) {
|
||||
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;
|
||||
})
|
||||
|| props.questions.find((question) => {
|
||||
}) ||
|
||||
props.questions.find((question) => {
|
||||
// 矩阵题
|
||||
if (question.question_type >= 8 && question.question_type <= 11) {
|
||||
return question.title === (value + cycleIndexStr).split('_R')[0].split('_C')[0];
|
||||
@@ -184,8 +187,8 @@ export default defineComponent({
|
||||
replacement = answer[option.option_key];
|
||||
}
|
||||
} else if (
|
||||
question.question_type === 2
|
||||
&& Object.keys(answer).length >= question.config.min_select
|
||||
question.question_type === 2 &&
|
||||
Object.keys(answer).length >= question.config.min_select
|
||||
) {
|
||||
// 查找引用选项(多选)
|
||||
options.forEach((option) => {
|
||||
@@ -287,7 +290,7 @@ export default defineComponent({
|
||||
min-height: 24px;
|
||||
margin-bottom: 24px;
|
||||
|
||||
>span {
|
||||
> span {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@@ -312,4 +315,4 @@ export default defineComponent({
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<img :src="publishInfo?.img_url" alt="" width="100px" height="100px" />
|
||||
<div class="tit">
|
||||
<div>{{ surveyTitle || '' }}</div>
|
||||
<div style="font-weight: 600;font-size: 14px;">扫码填写问卷</div>
|
||||
<div style="font-weight: 600; font-size: 14px">扫码填写问卷</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tip">移动端仅做数据回收,问卷数据分析请前往PC端浏览</div>
|
||||
@@ -95,21 +95,21 @@ type OperateItem = (typeof operateList)[0];
|
||||
|
||||
const operateBtn = (item: OperateItem) => {
|
||||
switch (item.type) {
|
||||
case 'shareLink':
|
||||
shareLink();
|
||||
break;
|
||||
case 'copyLink':
|
||||
copyLink();
|
||||
break;
|
||||
case 'qrCode':
|
||||
downLoadImg();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 'shareLink':
|
||||
shareLink();
|
||||
break;
|
||||
case 'copyLink':
|
||||
copyLink();
|
||||
break;
|
||||
case 'qrCode':
|
||||
downLoadImg();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
// 复制链接
|
||||
function copyLink () {
|
||||
function copyLink() {
|
||||
const input = document.createElement('input');
|
||||
input.value = publishInfo.value.url;
|
||||
document.body.appendChild(input);
|
||||
@@ -119,7 +119,7 @@ function copyLink () {
|
||||
showToast('复制成功');
|
||||
}
|
||||
// 分享链接
|
||||
function shareLink () {
|
||||
function shareLink() {
|
||||
const params = {
|
||||
type: 'shareToWx',
|
||||
title: publishInfo.value.download_url.title,
|
||||
@@ -136,7 +136,7 @@ function shareLink () {
|
||||
}
|
||||
|
||||
// 下载二维码
|
||||
function downLoadImg () {
|
||||
function downLoadImg() {
|
||||
const { title, url } = publishInfo.value.download_url;
|
||||
if (utils.getSessionStorage('xToken')) {
|
||||
appBridge.save2Album(url, () => {
|
||||
@@ -193,7 +193,7 @@ watch(status, (val) => {
|
||||
getCode();
|
||||
}
|
||||
});
|
||||
onMounted(async() => {
|
||||
onMounted(async () => {
|
||||
// status.value = 1;
|
||||
// publishInfo.value.img_url
|
||||
// = 'https://test-cxp-pubcos.yili.com/uat-yls//survey-api/publish/202503130938138261340.png';
|
||||
@@ -209,7 +209,7 @@ onMounted(async() => {
|
||||
<style scoped lang="scss">
|
||||
.container {
|
||||
height: 100vh;
|
||||
background: linear-gradient(to bottom, #70B937 5.3rem, #F2F2F2 8rem);
|
||||
background: linear-gradient(to bottom, #70b937 5.3rem, #f2f2f2 8rem);
|
||||
|
||||
button {
|
||||
padding: 3px 20px;
|
||||
@@ -252,9 +252,10 @@ onMounted(async() => {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
margin: 25px 24px 0 24px;
|
||||
margin: 25px 24px 0;
|
||||
color: #7f7f7f;
|
||||
font-size: 13px;
|
||||
|
||||
span {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
Reference in New Issue
Block a user