refactor(Design): 优化问卷题目样式和布局

-调整了多个组件的左图标样式,统一为带编号的标题格式
- 优化了选择题和其他题型的样式,提高了可读性和美观度
-调整了部分颜色和间距,使整体风格更加协调
This commit is contained in:
陈昱达
2025-03-23 13:53:33 +08:00
parent f88e955c01
commit 32a87991e1
12 changed files with 65 additions and 46 deletions

View File

@@ -27,6 +27,7 @@
--van-tabs-bottom-bar-width: 28px; --van-tabs-bottom-bar-width: 28px;
--van-loading-text-color: #fff; --van-loading-text-color: #fff;
--van-loading-spinner-color: #fff; --van-loading-spinner-color: #fff;
--van-action-sheet-cancel-text-color: #000;
} }
/* semantic color variables for this project */ /* semantic color variables for this project */

View File

@@ -260,6 +260,7 @@ input {
position: relative; position: relative;
&::after { &::after {
color: #c8c9ca;
content: attr(data-placeholder); content: attr(data-placeholder);
position: absolute; position: absolute;
top: 0; top: 0;
@@ -267,3 +268,18 @@ input {
pointer-events: none; // 确保占位符不会干扰用户输入 pointer-events: none; // 确保占位符不会干扰用户输入
} }
} }
.content-title,
.introduction {
.editor-placeholder {
&::after {
color: #fff;
}
}
}
.van-field__label--required {
&::before {
display: none !important;
}
}

View File

@@ -11,7 +11,7 @@
> >
<!-- eslint-disable-next-line --> <!-- eslint-disable-next-line -->
<template #item="{ element, index }"> <template #item="{ element, index }">
<div class="flex align-center option-action-container"> <div class="flex align-center option-action-container space-between">
<slot name="item" :element="element" :index="index"></slot> <slot name="item" :element="element" :index="index"></slot>
<span v-if="active" class="flex"> <span v-if="active" class="flex">
<!--<van-icon class-prefix="mobilefont" <!--<van-icon class-prefix="mobilefont"
@@ -31,7 +31,7 @@
</div> </div>
<!-- 操作项弹窗--> <!-- 操作项弹窗-->
<van-action-sheet v-model:show="show"> <van-action-sheet v-model:show="show">
<div class="van-action-sheet-title">操作选项</div> <div class="van-action-sheet-title">选项操作</div>
<van-cell-group :border="false" class="br12 round-group"> <van-cell-group :border="false" class="br12 round-group">
<van-cell title="固定置底"> <van-cell title="固定置底">

View File

@@ -7,7 +7,7 @@
<!-- 操作项弹窗--> <!-- 操作项弹窗-->
<van-action-sheet v-model:show="show" title=""> <van-action-sheet v-model:show="show" title="">
<div class="van-action-sheet-title">操作选项</div> <div class="van-action-sheet-title">题目设置</div>
<van-cell-group <van-cell-group
v-if="![6].includes(activeQuestion.question_type)" v-if="![6].includes(activeQuestion.question_type)"
:border="false" :border="false"

View File

@@ -6,9 +6,7 @@
label-align="top" label-align="top"
class="contenteditable-question-title base-select" class="contenteditable-question-title base-select"
> >
<template #left-icon> <template #left-icon> {{ isPreview ? element.title : index + 1 }}. </template>
{{ isPreview ? element.title : index + 1 }}
</template>
<template #label> <template #label>
<contenteditable <contenteditable
v-model="element.stem" v-model="element.stem"
@@ -77,6 +75,7 @@
> >
<template #default> <template #default>
<div class="flex align-center van-cell"> <div class="flex align-center van-cell">
<div class="flex" style="width: 100%; flex-wrap: wrap">
<contenteditable <contenteditable
v-model="it.option" v-model="it.option"
:className="active ? 'contenteditable-input' : ''" :className="active ? 'contenteditable-input' : ''"
@@ -88,8 +87,12 @@
</div> </div>
</template> </template>
</contenteditable> </contenteditable>
<div v-if="it.is_other"> <input
<input class="other-input" type="text" /> class="other-input"
type="text"
v-if="it.is_other"
style="width: 100%"
/>
</div> </div>
</div> </div>
</template> </template>
@@ -164,10 +167,10 @@ const emitValue = () => {
} }
& .other-input { & .other-input {
width: 100px; width: 100%;
height: 20px; height: 20px;
margin-left: 20px;
padding: 3px 5px; padding: 3px 5px;
margin-top: 10px;
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 5px; border-radius: 5px;
outline: none; outline: none;

View File

@@ -7,9 +7,7 @@
label-align="top" label-align="top"
class="contenteditable-question-title" class="contenteditable-question-title"
> >
<template #left-icon> <template #left-icon> {{ isPreview ? element.title : index + 1 }}. </template>
{{ isPreview ? element.title : index + 1 }}
</template>
<template #label> <template #label>
<contenteditable <contenteditable
v-model="element.stem" v-model="element.stem"

View File

@@ -16,7 +16,7 @@ const { element } = toRefs(props);
* 上传文件 * 上传文件
* @description 上传文件 * @description 上传文件
*/ */
function handleFileUpload () { function handleFileUpload() {
const fileInput = document.createElement('input'); const fileInput = document.createElement('input');
fileInput.type = 'file'; fileInput.type = 'file';
// 文件类型限制 // 文件类型限制
@@ -27,7 +27,7 @@ function handleFileUpload () {
fileInput.addEventListener('change', handleFileChange); fileInput.addEventListener('change', handleFileChange);
function handleFileChange (event: Event) { function handleFileChange(event: Event) {
const files = (event.target as HTMLInputElement).files; const files = (event.target as HTMLInputElement).files;
if (files) { if (files) {
// 检测文件数量 // 检测文件数量
@@ -70,13 +70,24 @@ const emitValue = () => {
<template> <template>
<van-cell-group> <van-cell-group>
<van-field v-model="element.stem" :label="element.stem" :required="element.config.is_required === 1" <van-field
label-align="top" input-align="center" class="contenteditable-question-title"> v-model="element.stem"
<template #left-icon> {{ isPreview ? element.title : index + 1 }}</template> :label="element.stem"
:required="element.config.is_required === 1"
label-align="top"
input-align="center"
class="contenteditable-question-title"
>
<template #left-icon> {{ isPreview ? element.title : index + 1 }}.</template>
<!-- 使用 title 插槽来自定义标题 --> <!-- 使用 title 插槽来自定义标题 -->
<template #label> <template #label>
<contenteditable v-model="element.stem" :active="active" @blur="emitValue" className="contenteditable-label" <contenteditable
:errorMessage="errorMessage"></contenteditable> v-model="element.stem"
:active="active"
@blur="emitValue"
className="contenteditable-label"
:errorMessage="errorMessage"
></contenteditable>
</template> </template>
<template #input> <template #input>

View File

@@ -115,9 +115,7 @@ const errorMessage = defineModel('errorMessage', {
label-align="top" label-align="top"
class="contenteditable-question-title" class="contenteditable-question-title"
> >
<template #left-icon> <template #left-icon> {{ isPreview ? element.title : index + 1 }}. </template>
{{ isPreview ? element.title : index + 1 }}
</template>
<!-- 使用 title 插槽来自定义标题 --> <!-- 使用 title 插槽来自定义标题 -->
<template #label> <template #label>
<contenteditable <contenteditable

View File

@@ -7,9 +7,7 @@
label-align="top" label-align="top"
class="contenteditable-question-title" class="contenteditable-question-title"
> >
<template #left-icon> <template #left-icon> {{ isPreview ? element.title : index + 1 }}. </template>
{{ isPreview ? element.title : index + 1 }}
</template>
<template #label> <template #label>
<contenteditable <contenteditable
v-model="element.stem" v-model="element.stem"

View File

@@ -7,9 +7,7 @@
label-align="top" label-align="top"
class="contenteditable-question-title" class="contenteditable-question-title"
> >
<template #left-icon> <template #left-icon> {{ isPreview ? element.title : index + 1 }}. </template>
{{ isPreview ? element.title : index + 1 }}
</template>
<template #label> <template #label>
<contenteditable <contenteditable
v-model="element.stem" v-model="element.stem"

View File

@@ -204,9 +204,7 @@ async function handleUploadImg() {
:border="false" :border="false"
readonly readonly
> >
<template #left-icon> <template #left-icon> {{ isPreview ? element.title : index + 1 }}. </template>
{{ isPreview ? element.title : index + 1 }}
</template>
<template #label> <template #label>
<contenteditable <contenteditable
v-model="element.stem" v-model="element.stem"

View File

@@ -7,9 +7,7 @@
label-align="top" label-align="top"
class="base-select contenteditable-question-title" class="base-select contenteditable-question-title"
> >
<template #left-icon> <template #left-icon> {{ isPreview ? element.title : index + 1 }}. </template>
{{ isPreview ? element.title : index + 1 }}
</template>
<template #label> <template #label>
<contenteditable <contenteditable
v-model="element.stem" v-model="element.stem"