Regression / regression (push) Canceled after 0s
## 品牌标识(本次会话) 起因:品牌此前没有任何图形标识 —— 唯一 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 未做部分)
113 lines
4.1 KiB
Vue
113 lines
4.1 KiB
Vue
<template>
|
||
<!-- 只读形态:整组是一个 role="img",名称由 aria-label 播报(不留下可聚焦的星) -->
|
||
<div
|
||
v-if="readonly"
|
||
class="kole-m-rate"
|
||
:class="rateClass"
|
||
role="img"
|
||
:aria-label="`${label} ${value} 分(满分 ${max} 分)`"
|
||
>
|
||
<span class="kole-m-rate__stars" aria-hidden="true">
|
||
<span v-for="(i, k) in starIndexes" :key="k" class="kole-m-rate__star">
|
||
<span class="kole-m-rate__glyph">
|
||
<span class="kole-m-rate__base">★</span>
|
||
<span class="kole-m-rate__fill" :style="{ width: ratioOf(i) * 100 + '%' }">★</span>
|
||
</span>
|
||
</span>
|
||
</span>
|
||
<slot>
|
||
<span class="kole-m-rate__text">{{ value }} 分</span>
|
||
</slot>
|
||
</div>
|
||
|
||
<div
|
||
v-else
|
||
class="kole-m-rate"
|
||
:class="rateClass"
|
||
role="radiogroup"
|
||
:aria-label="label"
|
||
:aria-disabled="disabled ? 'true' : null"
|
||
@keydown="onKeyDown"
|
||
>
|
||
<span class="kole-m-rate__stars">
|
||
<button
|
||
v-for="(i, k) in starIndexes"
|
||
:key="k"
|
||
class="kole-m-rate__star"
|
||
type="button"
|
||
role="radio"
|
||
:aria-checked="ratioOf(i) >= 1 ? 'true' : 'false'"
|
||
:aria-label="(i + 1) + ' 星'"
|
||
:disabled="disabled"
|
||
@click="pick(i, $event)"
|
||
>
|
||
<span class="kole-m-rate__glyph" aria-hidden="true">
|
||
<span class="kole-m-rate__base">★</span>
|
||
<span class="kole-m-rate__fill" :style="{ width: ratioOf(i) * 100 + '%' }">★</span>
|
||
</span>
|
||
<template v-if="allowHalf">
|
||
<span class="kole-m-rate__half kole-m-rate__half--left" data-half="left"></span>
|
||
<span class="kole-m-rate__half kole-m-rate__half--right" data-half="right"></span>
|
||
</template>
|
||
</button>
|
||
</span>
|
||
<slot>
|
||
<span class="kole-m-rate__text">{{ value }} 分</span>
|
||
</slot>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup>
|
||
/* 评分(移动端)— 规格 §36
|
||
点第 N 颗星取 N 分;allowHalf=true 时点某颗星的左半取 N-0.5 分(规则见规格 §36.5)。
|
||
触屏上没有鼠标悬停预览,所以「已选中的部分」靠填充比例表达(半星 = 左半填充),
|
||
不能只靠颜色深浅;星形本体视觉 24px,热区撑到 44px 高。
|
||
readonly=true 时是纯展示(用 role="img" + aria-label 播报「N 分(满分 M 分)」),
|
||
此时不渲染任何可聚焦控件 —— 列表里一行一个评分不该抢走键盘序列。 */
|
||
import { computed } from 'vue';
|
||
|
||
const props = defineProps({
|
||
value: { type: Number, default: 0 },
|
||
max: { type: Number, default: 5 },
|
||
allowHalf: { type: Boolean, default: false },
|
||
size: { type: String, default: 'default' },
|
||
readonly: { type: Boolean, default: false },
|
||
disabled: { type: Boolean, default: false },
|
||
label: { type: String, default: '评分' }
|
||
});
|
||
const emit = defineEmits(['change']);
|
||
|
||
const starIndexes = computed(() => Array.from({ length: props.max }, (_, i) => i));
|
||
|
||
const rateClass = computed(() => [
|
||
props.allowHalf ? 'kole-m-rate--half' : '',
|
||
props.size === 'small' ? 'kole-m-rate--small' : '',
|
||
props.readonly ? 'kole-m-rate--readonly' : '',
|
||
props.disabled ? 'is-disabled' : ''
|
||
].filter(Boolean));
|
||
|
||
function ratioOf(i) {
|
||
return Math.max(0, Math.min(1, props.value - i));
|
||
}
|
||
function pick(i, e) {
|
||
if (props.readonly || props.disabled) return;
|
||
/* 半星判定:点在左半区取 N-0.5,右半区取 N(整星模式下位置不影响取值) */
|
||
const el = e.target && e.target.getAttribute ? e.target : null;
|
||
const isLeftHalf = props.allowHalf && el && el.getAttribute('data-half') === 'left';
|
||
const index = i + 1;
|
||
emit('change', isLeftHalf ? index - 0.5 : index);
|
||
}
|
||
function onKeyDown(e) {
|
||
if (props.readonly || props.disabled) return;
|
||
const delta = e.key === 'ArrowLeft' || e.key === 'ArrowDown' ? -1 : e.key === 'ArrowRight' || e.key === 'ArrowUp' ? 1 : 0;
|
||
if (!delta) return;
|
||
e.preventDefault();
|
||
const stepValue = props.allowHalf ? 0.5 : 1;
|
||
const min = props.allowHalf ? 0.5 : 1;
|
||
const next = Math.round((props.value + delta * stepValue) * 2) / 2;
|
||
emit('change', Math.max(min, Math.min(props.max, next)));
|
||
}
|
||
</script>
|
||
|
||
<style src="./Rate.css"></style>
|