微信小程序页面迁移校验之前 P5任务处理之前
This commit is contained in:
36
apps/miniprogram - 副本/miniprogram/utils/task.ts
Normal file
36
apps/miniprogram - 副本/miniprogram/utils/task.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* 任务类型映射工具函数
|
||||
* 纯函数,无 wx.* 依赖
|
||||
*/
|
||||
|
||||
export type TaskType = 'callback' | 'priority_recall' | 'relationship'
|
||||
|
||||
const TASK_TYPE_COLOR_MAP: Record<TaskType, string> = {
|
||||
callback: '#0052d9',
|
||||
priority_recall: '#e34d59',
|
||||
relationship: '#00a870',
|
||||
}
|
||||
|
||||
const TASK_TYPE_LABEL_MAP: Record<TaskType, string> = {
|
||||
callback: '回访',
|
||||
priority_recall: '优先召回',
|
||||
relationship: '关系构建',
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务类型对应的颜色
|
||||
* @param type 任务类型
|
||||
* @returns 颜色 hex 值,未知类型返回灰色
|
||||
*/
|
||||
export function getTaskTypeColor(type: TaskType): string {
|
||||
return TASK_TYPE_COLOR_MAP[type] ?? '#8b8b8b'
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务类型对应的中文标签
|
||||
* @param type 任务类型
|
||||
* @returns 中文标签,未知类型返回空字符串
|
||||
*/
|
||||
export function getTaskTypeLabel(type: TaskType): string {
|
||||
return TASK_TYPE_LABEL_MAP[type] ?? ''
|
||||
}
|
||||
Reference in New Issue
Block a user