refactor(home): 重构首页组件和 API 接口

- 新增 consoleSurveys 和 useTemplate API 接口
- 优化 create-survey 组件,支持创建新页面和使用模板
- 更新 last-survey 和 market 组件,使用新的 API 接口
-重构 home 页面,统一处理用户信息获取和错误处理
- 更新类型声明,添加 Element Plus 和 Vant 组件
This commit is contained in:
陈昱达
2025-03-17 12:22:15 +08:00
parent 590e023b5c
commit 09304e1ca4
11 changed files with 145 additions and 69 deletions

View File

@@ -1,6 +1,8 @@
<template>
<van-field v-model="element.stem" :label="element.stem" :required="element.config.is_required === 1" label-align="top"
class="contenteditable-question-title base-select">
<van-field
v-model="element.stem" :label="element.stem" :required="element.config.is_required === 1" label-align="top"
class="contenteditable-question-title base-select"
>
<template #left-icon>
{{ index + 1 }}
</template>
@@ -11,11 +13,15 @@
<template #input>
<template v-for="(item, optionIndex) in element.options" :key="item.id">
<van-radio-group v-if="element.question_type === 1" v-model="choiceValue">
<option-action :data="isPreview ? item.options : item" :active="active" :question="element"
handle=".moverQues">
<option-action
:data="isPreview ? item.options : item" :active="active" :question="element"
handle=".moverQues"
>
<template #item="{ element: it, index: itIndex }">
<van-radio :key="itIndex" :name="it.option_index" :label="it.label" :disabled="it.disabled"
icon-size="0.45rem">
<van-radio
:key="itIndex" :name="it.option_index" :label="it.label" :disabled="it.disabled"
icon-size="0.45rem"
>
<!-- 自定义文本 -->
<template #default>
<div class="flex align-center van-cell">
@@ -37,11 +43,15 @@
</van-radio-group>
<van-checkbox-group v-if="element.question_type === 2" v-model="value" shape="square">
<option-action v-model:data="element.options[optionIndex]" handle=".moverQues" :active="active"
:question="element">
<option-action
v-model:data="element.options[optionIndex]" handle=".moverQues" :active="active"
:question="element"
>
<template #item="{ element: it, index: itIndex }">
<van-checkbox :key="itIndex" :name="it.option_index" :label="it.label" :disabled="it.disabled"
icon-size="0.45rem">
<van-checkbox
:key="itIndex" :name="it.option_index" :label="it.label" :disabled="it.disabled"
icon-size="0.45rem"
>
<template #default>
<div class="flex align-center van-cell">
<contenteditable v-model="it.option" className="contenteditable-input" :active="active">
@@ -106,7 +116,6 @@ const emitValue = () => {
}
.base-select {
& .van-checkbox-group,
.van-radio-group {
width: 100%;