feat: 优化组件和页面功能
- 新增 YlSwiper 轮播组件,基于 swiper 库实现,支持自定义渲染和多种配置项 - 优化 YlTable 组件,提升表格渲染性能和使用体验 - 优化 LogicInfo 组件,修复数据为空时的显示问题,使用 currentTabs 替代重复的计算属性 - 优化 AnalysisInfo 组件,移除冗余类型转换 - 新增问卷列表组件 QuestionList,用于展示任务相关问卷 - 更新 vite 配置,支持 swiper 自定义元素 - 添加 swiper 依赖包
This commit is contained in:
@@ -1,35 +1,57 @@
|
||||
<script setup lang="ts">
|
||||
import SurveyAnalysis from '@/views/Survey/views/Analysis/Index.vue';
|
||||
import { fetchSurveys } from '@/hooks/request/useSurvey';
|
||||
import { cellWithoutPadding } from '@/utils/theme/cell';
|
||||
import QuestionList from './components/QuestionList.vue';
|
||||
import YlSwiper from '@/components/YlSwiper/Index.vue';
|
||||
|
||||
const { surveys } = fetchSurveys();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<van-cell :style="cellWithoutPadding" class="swipe-container">
|
||||
<template #extra>
|
||||
<van-swipe class="my-swipe" indicator-color="white" :loop="false">
|
||||
<van-swipe-item :key="survey.sn" v-for="survey in surveys">
|
||||
<section style="width: 90vw">
|
||||
<h3 style="margin: 10px 0 -10px 10px">我的任务</h3>
|
||||
<survey-analysis :sn="survey.sn" :disable-search="true" :disable-insight="true" />
|
||||
</section>
|
||||
</van-swipe-item>
|
||||
<!-- 指示器 -->
|
||||
<!-- <template #indicator="{ active, total }">
|
||||
<div class="custom-indicator">{{ active + 1 }}/{{ total }}</div>
|
||||
</template> -->
|
||||
</van-swipe>
|
||||
</template>
|
||||
</van-cell>
|
||||
<div class="carousel-container">
|
||||
<!-- 方式一:使用默认插槽,手动添加 swiper-slide 元素 -->
|
||||
<yl-swiper
|
||||
:slides-per-view="1"
|
||||
:centered-slides="true"
|
||||
:pagination="true"
|
||||
:navigation="true"
|
||||
:loop="false"
|
||||
:space-between="0"
|
||||
:allow-touch-move="false"
|
||||
>
|
||||
<swiper-slide v-for="question in surveys" :key="question.sn">
|
||||
<question-list :survey="question" style="max-width: 100vw; overflow: hidden" />
|
||||
</swiper-slide>
|
||||
</yl-swiper>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use '@/assets/css/theme';
|
||||
|
||||
.swipe-container {
|
||||
.carousel-container {
|
||||
background-color: #fff;
|
||||
overflow: hidden;
|
||||
margin-top: theme.$gap;
|
||||
border-radius: theme.$card-radius;
|
||||
padding: 10px;
|
||||
|
||||
.carousel-item {
|
||||
.swipe-container {
|
||||
margin-top: theme.$gap;
|
||||
border-radius: theme.$card-radius;
|
||||
}
|
||||
}
|
||||
|
||||
.slide-content {
|
||||
height: 150px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user