Files
aurora-admin/frameworks-mobile/DatePicker.vue2.vue
T
aurora-admin f1fbfc2ddb
Regression / regression (push) Canceled after 0s
feat(品牌标识): 几何 K 图标(favicon/顶栏标记/theme-color) + 并行会话成果入库
## 品牌标识(本次会话)

起因:品牌此前没有任何图形标识 —— 唯一 favicon 是内联 data-URI 里的字母「A」,
那是 v2.0.0「Aurora Admin → Kole UI」改名漏掉的一处(PC 顶栏也是「A」,
移动端站已是「K」;移动端文档站则完全没有 favicon)。

- 几何:24 网格三个互不接触的笔画(竖 + 两斜),圆头描边;
  描边 2.25 → 16px 标签页尺寸下正好 1.5px = 规范原文「描边1.5px」
- 取色分两套(刻意):favicon 硬编码品牌蓝/白(渲染在浏览器标签栏,不继承 kole-dark);
  顶栏标记走 currentColor(实测暗色下自动转 rgb(20,22,28))
- 新增 theme-color 双条(light #FFFFFF / dark #1C1F26,取 --kole-color-card-bg)
- 修 site/app.js hero 标语 KOLE ADMIN → KOLE UI(改名变形残留)
- 移动端 7 个模板补 favicon(此前计数 0)

验收:门禁 9 条全 OK(site-routing/site-routes/mobile-docs/mobile-site/isolation/
theme/nav/i18n/icons);PC 回归 1464/1464 · 移动端 807/807,各连跑 8 次一致;
两端 favicon 405 字节逐字节一致;PC 站控制台错误 1→0。

## 并行会话成果(本次一并入库)

- 图标系统:2576 图标(TDesign/Element Plus,MIT)+ 11 端注入 + 5 个构建门禁工具
  + IconPreview 预览页 + ICON-SPEC.md 冻结规格
- 移动端平台:47 组件 × 6 端 + 文档站 53 页 + 隔离门禁
- PC 组件:103 个大后台组件 / 组件11 批次
- uni-app:PC 端试点 + 移动端端实现 + 真实编译验证

## 工程

- .gitignore 补 .scratch/ 与 .zcode-preexisting-*.txt(会话中间产物,实测 9.1MB,不入库)
- CHANGELOG 补品牌标识条目
- ROADMAP 登 S8-P4(品牌标识任务包 + og:image/apple-touch-icon 未做部分)
2026-09-21 10:05:48 +08:00

158 lines
5.2 KiB
Vue
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.
<template>
<div>
<slot></slot>
<div
class="kole-m-datepicker__mask"
:class="{ 'is-open': open }"
aria-hidden="true"
@click="onMaskClick"
></div>
<div
class="kole-m-datepicker"
:class="panelClass"
role="dialog"
aria-modal="true"
:aria-labelledby="titleId"
:aria-hidden="open ? null : 'true'"
>
<div class="kole-m-datepicker__header">
<button class="kole-m-datepicker__btn" type="button" @click="onCancelClick">取消</button>
<span class="kole-m-datepicker__title" :id="titleId">{{ label }}</span>
<button
class="kole-m-datepicker__btn kole-m-datepicker__btn--confirm"
type="button"
@click="onConfirmClick"
>确定</button>
</div>
<div class="kole-m-datepicker__columns">
<ul
v-for="col in columns"
:key="col.key"
class="kole-m-datepicker__column"
role="listbox"
:aria-label="col.label"
>
<li
v-for="(option, i) in col.options"
:key="col.key + '-' + i"
class="kole-m-datepicker__option"
:class="{ 'is-selected': isSelected(col.key, option) }"
role="option"
:aria-selected="isSelected(col.key, option) ? 'true' : 'false'"
@click="select(col.key, option)"
>{{ option }}</li>
</ul>
</div>
</div>
</div>
</template>
<script>
/* 日期选择器(移动端)— 规格 §18。
底部浮层 = 装饰性遮罩(aria-hidden)+ 面板;遮罩点击关闭,closeOnMask=false 时不关(规格 §18.5)。
面板 role="dialog" + aria-modal="true",标题元素 id 由 aria-labelledby 指向(规格 §18.6)。
每列 role="listbox"、选项 role="option" + aria-selected;is-selected 与 aria-selected 同步
(选中值以 YYYY-MM-DD 文本呈现:value 直接消费,不依赖视觉滚动位置)。
本端不发明选择事件(契约只有 confirm / close):点选只改本地高亮。 */
var COLUMN_LABELS = { year: '年', month: '月', day: '日' };
/* 面板标题元素 id 的自增种子:同页多实例不撞号(不依赖内部实例字段) */
var titleSeed = 0;
/* value 形如 YYYY-MM-DD;mode=month 时只有 YYYY-MM,day 为空串 */
function partsOf(value) {
var seg = String(value || '').split('-');
return { year: seg[0] || '', month: seg[1] || '', day: seg[2] || '' };
}
/* 选项文字可能带单位(「9 月」),取首个数字段比较;纯符号选项退回逐字比较 */
function sameValue(option, part) {
if (part === undefined || part === null || part === '') return false;
var digits = String(option).match(/[0-9]+/);
if (digits) return String(Number(digits[0])) === String(Number(part));
return String(option) === String(part);
}
/* mode=date → 年/月/日 三列;mode=month → 年/月 两列(规格 §18.3) */
function columnsOf(mode, years, months, days) {
var cols = [
{ key: 'year', label: COLUMN_LABELS.year, options: years },
{ key: 'month', label: COLUMN_LABELS.month, options: months }
];
if (mode !== 'month') cols.push({ key: 'day', label: COLUMN_LABELS.day, options: days });
return cols;
}
export default {
name: 'KoleMDatePicker',
props: {
mode: { type: String, default: 'date' },
round: { type: Boolean, default: false },
open: { type: Boolean, default: false },
closeOnMask: { type: Boolean, default: true },
value: { type: String, default: '' },
years: { type: Array, default: function () { return []; } },
months: { type: Array, default: function () { return []; } },
days: { type: Array, default: function () { return []; } }
},
data: function () {
/* 每个实例占一个号,标题 id 因此唯一(aria-labelledby 指向它) */
titleSeed += 1;
return {
instanceId: titleSeed,
/* null = 跟随 value 属性;点选后本地记账,确认前不改宿主的值 */
draft: null
};
},
computed: {
titleId: function () {
return 'kole-m-datepicker-title-' + this.instanceId;
},
title: function () {
return this.mode === 'month' ? '选择月份' : '选择日期';
},
label: function () {
return this.value ? this.title + ':' + this.value : this.title;
},
columns: function () {
return columnsOf(this.mode, this.years, this.months, this.days);
},
picked: function () {
return this.draft || partsOf(this.value);
},
panelClass: function () {
return [
this.round ? 'kole-m-datepicker--round' : '',
this.open ? 'is-open' : ''
].filter(Boolean);
}
},
methods: {
isSelected: function (key, option) {
return sameValue(option, this.picked[key]);
},
select: function (key, option) {
var next = partsOf(this.value);
next.year = this.picked.year;
next.month = this.picked.month;
next.day = this.picked.day;
next[key] = String(option);
this.draft = next;
},
onMaskClick: function () {
if (!this.closeOnMask) return;
this.$emit('close');
},
onCancelClick: function () {
this.$emit('close');
},
onConfirmClick: function () {
this.$emit('confirm');
}
}
};
</script>
<style src="./DatePicker.css"></style>