feat: 新增选项操作功能并优化问卷设计页面

- 新增 OptionAction 组件用于选项操作
- 更新 BaseSelect 组件,集成 OptionAction 功能
- 优化 Paging 组件样式
- 调整 Design 页面布局和样式
This commit is contained in:
陈昱达
2025-03-04 18:46:26 +08:00
parent d5d189c916
commit 520242ec51
9 changed files with 87 additions and 66 deletions

View File

@@ -1,9 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import Layouts from './layouts/index.vue'; import { RouterView } from 'vue-router';
</script> </script>
<template> <template>
<div> <div>
<Layouts /> <RouterView />
</div> </div>
</template> </template>

View File

@@ -1,25 +1,25 @@
import { createRouter, createWebHistory } from 'vue-router'; import { createRouter, createWebHistory } from 'vue-router';
import Home from '../views/Home/Index.vue'; import layout from '@/layouts/index.vue';
import Design from '@/views/Design/Index.vue'; import Design from '@/views/Design/Index.vue';
const router = createRouter({ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHistory(import.meta.env.BASE_URL),
routes: [ routes: [
{ {
path: '/', path: '/',
name: 'home', name: '/',
component: Home, component: layout,
redirect: '/home',
meta: { meta: {
title: '首页' title: '首页'
}
}, },
children: [
{ {
path: '/design', path: '/home',
name: 'design', name: 'home',
meta: {}, meta: {
// route level code-splitting title: '首页'
// this generates a separate chunk (About.[hash].js) for this route },
// which is lazy-loaded when the route is visited. component: () => import('../views/Home/Index.vue')
component: Design
}, },
{ {
path: '/survey', path: '/survey',
@@ -38,6 +38,17 @@ const router = createRouter({
component: () => import('../views/Market/Index.vue') component: () => import('../views/Market/Index.vue')
} }
] ]
},
{
path: '/design',
name: 'design',
meta: {},
// route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: Design
}
]
}); });
export default router; export default router;

View File

@@ -35,19 +35,21 @@
<van-divider></van-divider> <van-divider></van-divider>
<van-cell title="题前隐藏" :border="false"> <van-cell title="题前隐藏" :border="false">
<template #right-icon> <template #right-icon>
<span> {{ getSkipTypeText() }} <van-icon name="arrow"></van-icon></span> <span> {{ getSkipTypeText(0) }} <van-icon name="arrow"></van-icon></span>
</template> </template>
</van-cell> </van-cell>
<van-cell title="题后跳转" :border="false"> <van-cell title="题后跳转" :border="false">
<template #right-icon> <template #right-icon>
<span> 设置 <van-icon name="arrow"></van-icon></span> <span> {{ getSkipTypeText(1) }} <van-icon name="arrow"></van-icon></span>
</template> </template>
</van-cell> </van-cell>
<van-divider></van-divider> <van-divider></van-divider>
<van-cell title="下移选项" :border="false" @click="questionMove('down')"></van-cell> <van-cell title="下移题目" :border="false" @click="questionMove('down')"></van-cell>
<van-cell title="上移选项" :border="false" @click="questionMove('up')"></van-cell> <van-cell title="上移题目" :border="false" @click="questionMove('up')"></van-cell>
</van-cell-group> </van-cell-group>
</van-action-sheet> </van-action-sheet>
<!-- 题目操作 题前 题后-->
</template> </template>
<script setup> <script setup>
import { showConfirmDialog } from 'vant'; import { showConfirmDialog } from 'vant';
@@ -80,6 +82,7 @@ const props = defineProps({
} }
}); });
const questions = ref(props.questions); const questions = ref(props.questions);
// 当前题目 // 当前题目
const activeQuestion = ref(props.data); const activeQuestion = ref(props.data);
@@ -122,11 +125,21 @@ const questionMove = (action) => {
}; };
// 获取题前隐藏 和题后 跳转 文字 // 获取题前隐藏 和题后 跳转 文字
const getSkipTypeText = () => { const getSkipTypeText = (skipType) => {
setTimeout(() => { const ls = [];
logics[0].id = 123; logics.map((item) => {
}, 2000); if (
return logics[0].id; item.skip_type === skipType &&
item.question_index === activeQuestion.value.question_index
) {
ls.push(item);
}
});
let text = '未设置';
if (ls.length > 0) {
text = `已配置 (${ls.length})`;
}
return text;
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -11,7 +11,8 @@
class="iconfont active-icon" class="iconfont active-icon"
:style="{ marginRight: isLastPage ? '0' : '16px' }" :style="{ marginRight: isLastPage ? '0' : '16px' }"
@click="activePage" @click="activePage"
>&#xe86c;</i> >&#xe86c;</i
>
<template v-if="!isLastPage"> <template v-if="!isLastPage">
<i class="iconfont moverQues" style="margin-right: 16px">&#xe71b;</i> <i class="iconfont moverQues" style="margin-right: 16px">&#xe71b;</i>
<i class="iconfont" @click="deleteHandle">&#xe6c5;</i> <i class="iconfont" @click="deleteHandle">&#xe6c5;</i>

View File

@@ -11,9 +11,7 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts"></script>
</script>
<style scoped> <style scoped>
.market { .market {

View File

@@ -6,15 +6,12 @@
<span @click="$router.push('/survey')">全部问卷></span> <span @click="$router.push('/survey')">全部问卷></span>
</div> </div>
<div class="survey_items"> <div class="survey_items">
<div v-for="survey in 3" :key="survey"> <div v-for="survey in 3" :key="survey"></div>
</div>
</div> </div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts"></script>
</script>
<style scoped> <style scoped>
.survey { .survey {
@@ -44,6 +41,5 @@
background-color: white; background-color: white;
} }
} }
} }
</style> </style>

View File

@@ -3,7 +3,9 @@
<div v-for="item in 10" :key="item" class="template"> <div v-for="item in 10" :key="item" class="template">
<img src="https://picsum.photos/131/128" width="110" height="100" alt="" /> <img src="https://picsum.photos/131/128" width="110" height="100" alt="" />
<span>报名/签到模板</span> <span>报名/签到模板</span>
<span style="color: rgb(127, 127, 127);">报名签到 | 引用 {{ item }} | 创建人: {{ '张三' }}</span> <span style="color: rgb(127, 127, 127)"
>报名签到 | 引用 {{ item }} | 创建人: {{ '张三' }}</span
>
</div> </div>
</div> </div>
</template> </template>