refactor(survey): 优化创建问卷页面样式和逻辑

- 修改问卷列表展示逻辑,移除 parentCode 判断条件
- 更新问卷列表项的图片和标题字段- 优化投放设置弹窗的样式和结构
- 调整全局样式,增加 van-cell 的样式
- 添加 babel 配置文件,配置 preset-env
This commit is contained in:
陈昱达
2025-03-18 19:28:39 +08:00
parent b6d0ecea7a
commit e1c1429a47
6 changed files with 47 additions and 38 deletions

4
auto-imports.d.ts vendored
View File

@@ -5,4 +5,6 @@
// Generated by unplugin-auto-import // Generated by unplugin-auto-import
// biome-ignore lint: disable // biome-ignore lint: disable
export {} export {}
declare global {} declare global {
}

15
babel.config.json Normal file
View File

@@ -0,0 +1,15 @@
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": 3,
"targets": {
"chrome": "58",
"ie": "11"
}
}
]
]
}

5
components.d.ts vendored
View File

@@ -26,11 +26,8 @@ declare module 'vue' {
VanCellGroup: typeof import('vant/es')['CellGroup'] VanCellGroup: typeof import('vant/es')['CellGroup']
VanCheckbox: typeof import('vant/es')['Checkbox'] VanCheckbox: typeof import('vant/es')['Checkbox']
VanCheckboxGroup: typeof import('vant/es')['CheckboxGroup'] VanCheckboxGroup: typeof import('vant/es')['CheckboxGroup']
VanCol: typeof import('vant/es')['Col']
VanDivider: typeof import('vant/es')['Divider'] VanDivider: typeof import('vant/es')['Divider']
VanField: typeof import('vant/es')['Field'] VanField: typeof import('vant/es')['Field']
VanGrid: typeof import('vant/es')['Grid']
VanGridItem: typeof import('vant/es')['GridItem']
VanIcon: typeof import('vant/es')['Icon'] VanIcon: typeof import('vant/es')['Icon']
VanList: typeof import('vant/es')['List'] VanList: typeof import('vant/es')['List']
VanNavBar: typeof import('vant/es')['NavBar'] VanNavBar: typeof import('vant/es')['NavBar']
@@ -38,9 +35,7 @@ declare module 'vue' {
VanPopup: typeof import('vant/es')['Popup'] VanPopup: typeof import('vant/es')['Popup']
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']
VanSearch: typeof import('vant/es')['Search'] VanSearch: typeof import('vant/es')['Search']
VanStep: typeof import('vant/es')['Step']
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']

View File

@@ -4,7 +4,7 @@ import { onMounted } from 'vue';
import appBridge from '@/assets/js/appBridge'; import appBridge from '@/assets/js/appBridge';
import utils from '@/assets/js/common'; import utils from '@/assets/js/common';
onMounted(async() => { onMounted(async () => {
if (utils.getParameter('digitalYiliToken')) { if (utils.getParameter('digitalYiliToken')) {
// 隐藏/显示 header // 隐藏/显示 header
appBridge.setHeaderShown(false); appBridge.setHeaderShown(false);

View File

@@ -87,12 +87,12 @@ const getList = () => {
if (res.data.code === 0) { if (res.data.code === 0) {
if (res.data.data) { if (res.data.data) {
res.data.data.forEach((item) => { res.data.data.forEach((item) => {
if (item.parentCode && item.parentCode === 1) { // if (item.parentCode && item.parentCode === 1) {
surveys.value.push(item); surveys.value.push(item);
} // }
}); });
surveys.value.push({}); // surveys.value.push({});
} }
} }
}); });
@@ -118,8 +118,8 @@ onMounted(() => {
class="survey" class="survey"
@click="createdQuestion(survey)" @click="createdQuestion(survey)"
> >
<img :src="survey.image" alt="" width="40" /> <img :src="survey.h5Image" alt="" width="40" />
<span>{{ survey.title }}</span> <span>{{ survey.h5Title }}</span>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -146,11 +146,9 @@
<!-- 投放设置--> <!-- 投放设置-->
<van-action-sheet v-model:show="showSetting" title="" style="background-color: #f2f2f2"> <van-action-sheet v-model:show="showSetting" title="" style="background-color: #f2f2f2">
<template #description> <div class="van-action-sheet-title flex flex-start">投放设置</div>
<div class="setting_title flex flex-start">投放设置</div> <van-cell-group :border="false" class="round-group br12">
</template> <van-cell title="每页一题" :border="false" label-align="left">
<van-cell-group :border="false" class="setting_group">
<van-cell title="每页一题" class="setting_block" :border="false" label-align="left">
<template #right-icon> <template #right-icon>
<van-switch <van-switch
v-model="questionInfo.survey.is_one_page_one_question" v-model="questionInfo.survey.is_one_page_one_question"
@@ -162,7 +160,8 @@
></van-switch> ></van-switch>
</template> </template>
</van-cell> </van-cell>
<van-divider></van-divider> </van-cell-group>
<van-cell-group :border="false" class="round-group br12">
<van-cell title="投放数量" class="setting_block" :border="false" label-align="left"> <van-cell title="投放数量" class="setting_block" :border="false" label-align="left">
<template #right-icon> <template #right-icon>
<van-switch <van-switch
@@ -190,8 +189,10 @@
<template #right-icon> </template> <template #right-icon> </template>
</van-field> </van-field>
</van-cell-group> </van-cell-group>
<van-divider></van-divider> </van-cell-group>
<van-cell title="有效期" class="border-top" :border="false" label-align="left">
<van-cell-group :border="false" class="round-group br12">
<van-cell title="有效期" class="border-top" label-align="left">
<template #right-icon> <template #right-icon>
<van-switch <van-switch
v-model="questionInfo.survey.is_time" v-model="questionInfo.survey.is_time"
@@ -225,7 +226,7 @@
</van-field> </van-field>
</van-cell-group> </van-cell-group>
<van-cell title="断点续答" :border="false" label-align="left"> <van-cell title="断点续答" label-align="left">
<template #right-icon> <template #right-icon>
<van-switch <van-switch
v-model="questionInfo.survey.is_breakpoint" v-model="questionInfo.survey.is_breakpoint"
@@ -241,7 +242,6 @@
<van-cell <van-cell
title="企微身份获取(开启后仅支持私有化企业环境作答)" title="企微身份获取(开启后仅支持私有化企业环境作答)"
class="border-bottom" class="border-bottom"
:border="false"
label-align="left" label-align="left"
> >
<template #right-icon> <template #right-icon>
@@ -255,8 +255,10 @@
></van-switch> ></van-switch>
</template> </template>
</van-cell> </van-cell>
<van-divider></van-divider> </van-cell-group>
<van-cell title="IP答题次数限制" class="border-top" :border="false" label-align="left">
<van-cell-group class="round-group br12" :border="false">
<van-cell title="IP答题次数限制" class="border-top" label-align="left">
<template #right-icon> <template #right-icon>
<van-switch <van-switch
v-model="questionInfo.survey.is_ip_number" v-model="questionInfo.survey.is_ip_number"
@@ -268,7 +270,11 @@
></van-switch> ></van-switch>
</template> </template>
</van-cell> </van-cell>
<van-cell-group v-if="questionInfo.survey.is_ip_number === 1" class="child-group"> <van-cell-group
:border="false"
v-if="questionInfo.survey.is_ip_number === 1"
class="child-group"
>
<van-field <van-field
v-model="questionInfo.survey.is_number" v-model="questionInfo.survey.is_number"
label="同一个IP地址只能作答" label="同一个IP地址只能作答"
@@ -306,18 +312,6 @@
<template #right-icon> </template> <template #right-icon> </template>
</van-field> </van-field>
</van-cell-group> </van-cell-group>
<van-divider></van-divider>
<!-- <van-field-->
<!-- v-model="endText"-->
<!-- label="结束语"-->
<!-- :border="false"-->
<!-- readonly-->
<!-- label-align="left"-->
<!-- input-align="right"-->
<!-- is-link-->
<!-- @click="openEndTextModel"-->
<!-- >-->
<!-- </van-field>-->
</van-cell-group> </van-cell-group>
</van-action-sheet> </van-action-sheet>
@@ -798,6 +792,9 @@ onMounted(async () => {
font-weight: bold; font-weight: bold;
} }
:deep(.van-cell) {
padding: 8px;
}
.survey-action { .survey-action {
position: fixed; position: fixed;
bottom: 0; bottom: 0;