Files
Yep_Q 67f5dfbe50 feat: 实现多订单班支持系统
主要功能:
- 修改RequirementModal支持12个订单班选择
- 添加OrderClassIconMap图标映射组件
- Store中添加selectedOrderClass状态管理
- WorkflowPage支持传递orderClass参数
- web_result添加URL参数切换功能
- 创建order-class-handler.js动态处理页面主题

技术改进:
- 创建软链接关联订单班数据目录
- 生成wenlu.json和food.json数据结构
- 删除重复的web_result目录
- 添加测试页面test-order-class.html

影响范围:
- 展会策划系统现支持12个订单班
- 结果展示页面自动适配不同订单班主题
- 用户可选择不同行业生成对应方案

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-29 10:02:15 +08:00

109 lines
2.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @typedef {import('mdast').Nodes} Nodes
*
* @typedef Options
* Configuration (optional).
* @property {boolean | null | undefined} [includeImageAlt=true]
* Whether to use `alt` for `image`s (default: `true`).
* @property {boolean | null | undefined} [includeHtml=true]
* Whether to use `value` of HTML (default: `true`).
*/
/** @type {Options} */
const emptyOptions = {}
/**
* Get the text content of a node or list of nodes.
*
* Prefers the nodes plain-text fields, otherwise serializes its children,
* and if the given value is an array, serialize the nodes in it.
*
* @param {unknown} [value]
* Thing to serialize, typically `Node`.
* @param {Options | null | undefined} [options]
* Configuration (optional).
* @returns {string}
* Serialized `value`.
*/
export function toString(value, options) {
const settings = options || emptyOptions
const includeImageAlt =
typeof settings.includeImageAlt === 'boolean'
? settings.includeImageAlt
: true
const includeHtml =
typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true
return one(value, includeImageAlt, includeHtml)
}
/**
* One node or several nodes.
*
* @param {unknown} value
* Thing to serialize.
* @param {boolean} includeImageAlt
* Include image `alt`s.
* @param {boolean} includeHtml
* Include HTML.
* @returns {string}
* Serialized node.
*/
function one(value, includeImageAlt, includeHtml) {
if (node(value)) {
if ('value' in value) {
return value.type === 'html' && !includeHtml ? '' : value.value
}
if (includeImageAlt && 'alt' in value && value.alt) {
return value.alt
}
if ('children' in value) {
return all(value.children, includeImageAlt, includeHtml)
}
}
if (Array.isArray(value)) {
return all(value, includeImageAlt, includeHtml)
}
return ''
}
/**
* Serialize a list of nodes.
*
* @param {Array<unknown>} values
* Thing to serialize.
* @param {boolean} includeImageAlt
* Include image `alt`s.
* @param {boolean} includeHtml
* Include HTML.
* @returns {string}
* Serialized nodes.
*/
function all(values, includeImageAlt, includeHtml) {
/** @type {Array<string>} */
const result = []
let index = -1
while (++index < values.length) {
result[index] = one(values[index], includeImageAlt, includeHtml)
}
return result.join('')
}
/**
* Check if `value` looks like a node.
*
* @param {unknown} value
* Thing.
* @returns {value is Nodes}
* Whether `value` is a node.
*/
function node(value) {
return Boolean(value && typeof value === 'object')
}