diff --git a/components.d.ts b/components.d.ts index cc91605..1f6fe25 100644 --- a/components.d.ts +++ b/components.d.ts @@ -31,8 +31,6 @@ declare module 'vue' { VanCol: typeof import('vant/es')['Col'] VanDivider: typeof import('vant/es')['Divider'] VanField: typeof import('vant/es')['Field'] - VanGrid: typeof import('vant/es')['Grid'] - VanGridItem: typeof import('vant/es')['GridItem'] VanIcon: typeof import('vant/es')['Icon'] VanList: typeof import('vant/es')['List'] VanNavBar: typeof import('vant/es')['NavBar'] diff --git a/package.json b/package.json index b0b0af7..8433648 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "unplugin-auto-import": "^0.18.6", "unplugin-vue-components": "^0.27.5", "vite": "^6.0.0", + "vitest": "^3.0.9", "vue-tsc": "^2.0.21" }, "browserslist": [ diff --git a/src/stores/Questions/useQuestionStore.ts b/src/stores/Questions/useQuestionStore.ts index 91fe4b6..dc1c6cb 100644 --- a/src/stores/Questions/useQuestionStore.ts +++ b/src/stores/Questions/useQuestionStore.ts @@ -34,7 +34,7 @@ export const useQuestionStore = defineStore('questionStore', () => { return ![102, 104, 105, 201].includes(questions.value[0]?.question_type); }); - // 作用未知 + // 作用未知, 应该是 language const l = ref({}); // 主题颜色 const themeColor = ref({}); diff --git a/src/types/question.d.ts b/src/types/question.d.ts new file mode 100644 index 0000000..3f0cc17 --- /dev/null +++ b/src/types/question.d.ts @@ -0,0 +1,110 @@ +export declare interface OptionConfigType { + type?: number; + price?: number; + title?: string; + gradient?: string; + image_url?: string[]; + child_area?: null; + option_type?: number; + instructions?: string[]; + binding_goods_id?: string; + limit_right_content?: string; +} + +export declare interface questionOptionType { + // 包含 HTML 标签的字符串,例如 "

选项1

" + option?: string; + is_other?: number; + is_fixed?: number; + is_remove_other?: number; + level?: number; + option_key?: string; + option_index?: string; + option_code?: string; + option_config?: OptionConfigType; + parent_option_index?: number; + children?: null; +} + +declare interface IQuestionOption { + type: number; + cite_type: number; + relation_type: number; + relation_out_scope: number[]; + relation_last_scope: number; + relation_first_scope: number; + relation_question_index: number; + options?: questionOptionType[]; +} + +// 答案 config 类型 +export declare interface IQuestionConfig { + text_type?: number; + include_mark; + disabled?: string[]; + version?: string; + scene?: string | null; + shelf?: string | null; + ware?: string | null; + row_option_groups?: string | null; + cell_option_groups?: string | null; + is_repeat?: number; + allow_repeat_num?: number; + repeat_type?: number; + alert_text?: string; + is_required?: number; + is_change_row_cell?: number; + select_random?: number; + row_random?: number; + cell_random?: number; + is_three_dimensions?: number; + material_sn?: string; + scene_information?: string | null; + simple_scene_information?: string | null; + is_behavior?: number; + is_price_tag?: number; + is_brand?: number; + is_initialize?: number; + is_default_perspective?: number; + is_disable_lines_same?: number; + disable_lines_same?: number; + float_window?: number; + is_disable?: number; + float_window_content?: string; + popup_window?: number; + popup_window_content?: string; + is_show?: string[]; + quick_type?: number; + is_limit_right_content?: number; + option_group_random_inside?: string | null; + option_group_random_outside?: string | null; +} + +// 答案 question +export declare interface IQuestion { + error: string; + answer?: unknown; + id?: string; + title?: string; + stem?: string; + other?: string; + // options 列表项,第一个是默认 + list: questionOptionType[]; + question_index?: number; + question_type?: number; + config?: QuestionConfig; + created_at?: string; + created_user_id?: number; + updated_user_id?: number | null; + survey_id?: number; + logic_config?: LogicConfig; + options: questionOptionType[]; + associate?: any[]; + logics_has?: string | null; + last_option_index?: number; + question_code?: string; + question_value?: string; + question_tag?: string; + planet_id?: string; + permissions?: any | null; +} diff --git a/src/types/questions/completion.d.ts b/src/types/questions/completion.d.ts new file mode 100644 index 0000000..ba4f2af --- /dev/null +++ b/src/types/questions/completion.d.ts @@ -0,0 +1,33 @@ +declare interface ICompletionConfig { + decimal_few: number; + float_window: number; + float_window_content: string; + include_mark: number; + is_behavior: number; + is_brand: number; + is_default_perspective: number; + is_initialize: number; + is_price_tag: number; + is_required: number; + is_show: string[]; + is_three_dimensions: number; + left_prompt: string; + line_height: number; + line_type: number; + material_sn: string; + max: number | ''; + min: number | ''; + placeholder: string; + popup_window: number; + popup_window_content: string; + quick_type: number; + right_prompt: string; + scene: string | null; + scene_information: string | null; + shelf: string | null; + simple_scene_information: string | null; + text_type: number; + type_name: string; + version: string; + ware: string | null; +} diff --git a/src/views/Design/components/Questions/types/martrix.d.ts b/src/views/Design/components/Questions/types/martrix.d.ts index c824f8b..25c6497 100644 --- a/src/views/Design/components/Questions/types/martrix.d.ts +++ b/src/views/Design/components/Questions/types/martrix.d.ts @@ -62,86 +62,6 @@ type Option = { cascade?: any[]; }; -/** - * 配置类型 - * @property {string[]} disabled - 禁用的选项列表(通常为空数组) - * @property {string} version - 版本号(通常为空字符串) - * @property {string | null} scene - 场景(通常为 null) - * @property {string | null} shelf - 货架(通常为 null) - * @property {string | null} ware - 商品(通常为 null) - * @property {string | null} row_option_groups - 行选项组(通常为 null) - * @property {string | null} cell_option_groups - 列选项组(通常为 null) - * @property {number} is_repeat - 是否重复(0 表示否,1 表示是) - * @property {number} allow_repeat_num - 允许重复的数量 - * @property {number} repeat_type - 重复类型(通常为 0) - * @property {string} alert_text - 提示文本 - * @property {number} is_required - 是否必填(0 表示否,1 表示是) - * @property {number} is_change_row_cell - 是否允许更改行列选项(0 表示否,1 表示是) - * @property {number} select_random - 是否随机选择行(0 表示否,1 表示是) - * @property {number} row_random - 是否随机选择行选项(0 表示否,1 表示是) - * @property {number} cell_random - 是否随机选择列选项(0 表示否,1 表示是) - * @property {number} is_three_dimensions - 是否为三维矩阵(0 表示否,1 表示是) - * @property {string} material_sn - 材料编号(通常为空字符串) - * @property {string | null} scene_information - 场景信息(通常为 null) - * @property {string | null} simple_scene_information - 简单场景信息(通常为 null) - * @property {number} is_behavior - 是否为行为相关(0 表示否,1 表示是) - * @property {number} is_price_tag - 是否为价格标签(0 表示否,1 表示是) - * @property {number} is_brand - 是否为品牌相关(0 表示否,1 表示是) - * @property {number} is_initialize - 是否初始化(0 表示否,1 表示是) - * @property {number} is_default_perspective - 是否为默认视角(0 表示否,1 表示是) - * @property {number} is_disable_lines_same - 是否禁用行列相同(0 表示否,1 表示是) - * @property {number} disable_lines_same - 禁用行列相同的值(通常为 1) - * @property {number} float_window - 是否显示悬浮窗(0 表示否,1 表示是) - * @property {number} is_disable - 是否禁用(0 表示否,1 表示是) - * @property {string} float_window_content - 悬浮窗内容(通常为空字符串) - * @property {number} popup_window - 是否显示弹窗(0 表示否,1 表示是) - * @property {string} popup_window_content - 弹窗内容(通常为空字符串) - * @property {string[]} is_show - 是否显示的选项列表(通常为空数组) - * @property {number} quick_type - 快速类型(通常为 0) - * @property {number} is_limit_right_content - 是否限制右侧内容(0 表示否,1 表示是) - * @property {string | null} option_group_random_inside - 行列选项组内随机(通常为 null) - * @property {string | null} option_group_random_outside - 行列选项组外随机(通常为 null) - */ -type Config = { - disabled?: string[]; - version?: string; - scene?: string | null; - shelf?: string | null; - ware?: string | null; - row_option_groups?: string | null; - cell_option_groups?: string | null; - is_repeat?: number; - allow_repeat_num?: number; - repeat_type?: number; - alert_text?: string; - is_required?: number; - is_change_row_cell?: number; - select_random?: number; - row_random?: number; - cell_random?: number; - is_three_dimensions?: number; - material_sn?: string; - scene_information?: string | null; - simple_scene_information?: string | null; - is_behavior?: number; - is_price_tag?: number; - is_brand?: number; - is_initialize?: number; - is_default_perspective?: number; - is_disable_lines_same?: number; - disable_lines_same?: number; - float_window?: number; - is_disable?: number; - float_window_content?: string; - popup_window?: number; - popup_window_content?: string; - is_show?: string[]; - quick_type?: number; - is_limit_right_content?: number; - option_group_random_inside?: string | null; - option_group_random_outside?: string | null; -}; - /** * 逻辑配置类型 * @property {string} expect - 期望值(通常为空字符串) diff --git a/src/views/Design/components/Questions/types/question.d.ts b/src/views/Design/components/Questions/types/question.d.ts index 0f9d31a..e69de29 100644 --- a/src/views/Design/components/Questions/types/question.d.ts +++ b/src/views/Design/components/Questions/types/question.d.ts @@ -1,65 +0,0 @@ -interface OptionConfigType { - type?: number; - price?: number; - title?: string; - gradient?: string; - image_url?: string[]; - child_area?: null; - option_type?: number; - instructions?: string[]; - binding_goods_id?: string; - limit_right_content?: string; -} - -interface questionOptionType { - // 包含 HTML 标签的字符串,例如 "

选项1

" - option?: string; - is_other?: number; - is_fixed?: number; - is_remove_other?: number; - level?: number; - option_key?: string; - option_index?: string; - option_code?: string; - option_config?: OptionConfigType; - parent_option_index?: number; - children?: null; -} - -type questionsList = { - type: number; - cite_type: number; - relation_type: number; - relation_out_scope: number[]; - relation_last_scope: number; - relation_first_scope: number; - relation_question_index: number; - options?: questionOptionType[]; -}; - -type question = { - error: string; - answer?: unknown; - id?: string; - title?: string; - stem?: string; - other?: string; - list: questionsList[]; - question_index?: number; - question_type?: number; - config?: Config; - created_at?: string; - created_user_id?: number; - updated_user_id?: number | null; - survey_id?: number; - logic_config?: LogicConfig; - options: questionsList[]; - associate?: any[]; - logics_has?: string | null; - last_option_index?: number; - question_code?: string; - question_value?: string; - question_tag?: string; - planet_id?: string; - permissions?: any | null; -}; diff --git a/src/views/Survey/views/Preview/Index.vue b/src/views/Survey/views/Preview/Index.vue index db6d408..19e2c04 100644 --- a/src/views/Survey/views/Preview/Index.vue +++ b/src/views/Survey/views/Preview/Index.vue @@ -24,26 +24,22 @@ -