@morya-ui/setup 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +93 -0
- package/bin/morya-ui-setup.js +14 -0
- package/package.json +35 -0
- package/src/cli.mjs +200 -0
- package/src/copy-template.mjs +62 -0
- package/src/fs-utils.mjs +23 -0
- package/src/install.mjs +63 -0
- package/src/mcp.mjs +50 -0
- package/src/package-json.mjs +30 -0
- package/src/styles.mjs +109 -0
- package/template/.agents/skills/morya-ui-pages/SKILL.md +150 -0
- package/template/.agents/skills/morya-ui-pages/evals/evals.json +53 -0
- package/template/.agents/skills/morya-ui-pages/references/component-index.md +72 -0
- package/template/.agents/skills/morya-ui-pages/references/design-system.md +90 -0
- package/template/.agents/skills/morya-ui-pages/references/feedback.md +66 -0
- package/template/.agents/skills/morya-ui-pages/references/optional-companions.md +29 -0
- package/template/.agents/skills/morya-ui-pages/references/page-layouts.md +76 -0
- package/template/.agents/skills/morya-ui-pages/references/review-checklist.md +49 -0
- package/template/.agents/skills/morya-ui-pages/references/surfaces.md +89 -0
- package/template/.agents/skills/morya-ui-pages/references/visual-craft.md +83 -0
- package/template/.cursor/rules/coding-style.mdc +41 -0
- package/template/.cursor/rules/component-usage.mdc +41 -0
- package/template/.cursor/rules/design-system.mdc +17 -0
- package/template/.cursor/rules/page-layout.mdc +67 -0
- package/template/DESIGN.md +121 -0
- package/template/design-tokens/tokens.css +55 -0
- package/template/design-tokens/tokens.json +77 -0
- package/template/docs/components.md +144 -0
- package/template/docs/feedback-message-vs-toast.md +103 -0
- package/template/docs/golden-pages/dashboard-page.vue +103 -0
- package/template/docs/golden-pages/empty-state.vue +66 -0
- package/template/docs/golden-pages/form-page.vue +107 -0
- package/template/docs/golden-pages/landing-page.vue +328 -0
- package/template/docs/golden-pages/list-page.vue +127 -0
- package/template/docs/golden-pages/login-page.vue +191 -0
- package/template/scripts/check-raw-colors.mjs +74 -0
- package/template/src/examples/DashboardPageExample.vue +103 -0
- package/template/src/examples/EmptyStateExample.vue +66 -0
- package/template/src/examples/FormPageExample.vue +107 -0
- package/template/src/examples/LandingPageExample.vue +328 -0
- package/template/src/examples/ListPageExample.vue +127 -0
- package/template/src/examples/LoginPageExample.vue +191 -0
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* 黄金样例:营销落地页(Express)
|
|
4
|
+
* @see DESIGN.md §3 · morya-ui-pages surfaces § Express
|
|
5
|
+
* 首屏单一任务;控件用 M*;色彩只走 --m-*;避开 AI 默认脸。
|
|
6
|
+
*/
|
|
7
|
+
import { MAccordion, MButton, MConfigProvider, MTag, zhCN } from 'morya-ui'
|
|
8
|
+
|
|
9
|
+
const faqTabs = [
|
|
10
|
+
{ value: 'stack', header: '必须用特定框架吗?' },
|
|
11
|
+
{ value: 'hosting', header: '流水线跑在哪里?' },
|
|
12
|
+
{ value: 'migrate', header: '如何从现有 CI 迁过来?' },
|
|
13
|
+
]
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<MConfigProvider :locale="zhCN">
|
|
18
|
+
<div class="landing">
|
|
19
|
+
<header class="landing-nav">
|
|
20
|
+
<span class="landing-nav__brand">流水线 CI</span>
|
|
21
|
+
<nav class="landing-nav__links" aria-label="页面导航">
|
|
22
|
+
<a href="#why">为何选择</a>
|
|
23
|
+
<a href="#capabilities">能力</a>
|
|
24
|
+
<a href="#faq">常见问题</a>
|
|
25
|
+
</nav>
|
|
26
|
+
<MButton label="免费试用" size="small" />
|
|
27
|
+
</header>
|
|
28
|
+
|
|
29
|
+
<section class="landing-hero" aria-labelledby="hero-title">
|
|
30
|
+
<p class="landing-hero__brand">流水线 CI</p>
|
|
31
|
+
<h1 id="hero-title">把每次提交变成可回放的交付</h1>
|
|
32
|
+
<p class="landing-hero__lead">
|
|
33
|
+
为工程团队准备的构建与发布编排。少点配置,多看结果。
|
|
34
|
+
</p>
|
|
35
|
+
<div class="landing-hero__cta">
|
|
36
|
+
<MButton label="开始使用" />
|
|
37
|
+
<MButton label="查看文档" severity="secondary" text />
|
|
38
|
+
</div>
|
|
39
|
+
<div class="landing-hero__visual" role="img" aria-label="构建时间线示意">
|
|
40
|
+
<div class="landing-hero__track">
|
|
41
|
+
<span>检出</span>
|
|
42
|
+
<span>测试</span>
|
|
43
|
+
<span>制品</span>
|
|
44
|
+
<span>发布</span>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</section>
|
|
48
|
+
|
|
49
|
+
<section id="why" class="landing-section">
|
|
50
|
+
<h2>为何选择</h2>
|
|
51
|
+
<p class="landing-section__lead">面向真实仓库节奏,而不是演示用的仪表盘皮肤。</p>
|
|
52
|
+
<ul class="landing-points">
|
|
53
|
+
<li>
|
|
54
|
+
<strong>可回放</strong>
|
|
55
|
+
<span>每次运行保留完整日志与产物索引,失败可复现。</span>
|
|
56
|
+
</li>
|
|
57
|
+
<li>
|
|
58
|
+
<strong>少样板</strong>
|
|
59
|
+
<span>默认流水线覆盖检出、缓存与并行矩阵,按需覆盖。</span>
|
|
60
|
+
</li>
|
|
61
|
+
<li>
|
|
62
|
+
<strong>权限清楚</strong>
|
|
63
|
+
<span>环境、密钥与审批流按仓库边界隔离。</span>
|
|
64
|
+
</li>
|
|
65
|
+
</ul>
|
|
66
|
+
</section>
|
|
67
|
+
|
|
68
|
+
<section id="capabilities" class="landing-section landing-section--alt">
|
|
69
|
+
<h2>能力</h2>
|
|
70
|
+
<p class="landing-section__lead">用组件库控件表达交互,不引入第二套 UI。</p>
|
|
71
|
+
<div class="landing-cards">
|
|
72
|
+
<article>
|
|
73
|
+
<MTag value="构建" severity="info" />
|
|
74
|
+
<h3>并行矩阵</h3>
|
|
75
|
+
<p>按系统与 Node 版本展开任务,失败任务可单独重跑。</p>
|
|
76
|
+
</article>
|
|
77
|
+
<article>
|
|
78
|
+
<MTag value="发布" severity="success" />
|
|
79
|
+
<h3>环境门禁</h3>
|
|
80
|
+
<p>生产发布需要审批与变更说明,记录谁在何时放行。</p>
|
|
81
|
+
</article>
|
|
82
|
+
<article>
|
|
83
|
+
<MTag value="观测" />
|
|
84
|
+
<h3>耗时对比</h3>
|
|
85
|
+
<p>同分支历史耗时并排,找出突然变慢的步骤。</p>
|
|
86
|
+
</article>
|
|
87
|
+
</div>
|
|
88
|
+
</section>
|
|
89
|
+
|
|
90
|
+
<section id="faq" class="landing-section">
|
|
91
|
+
<h2>常见问题</h2>
|
|
92
|
+
<MAccordion :tabs="faqTabs" default-value="stack">
|
|
93
|
+
<template #stack>
|
|
94
|
+
<p class="landing-faq">
|
|
95
|
+
任意可容器化的仓库即可。示例以 Vue / Node 为主,不绑定单一前端脚手架。
|
|
96
|
+
</p>
|
|
97
|
+
</template>
|
|
98
|
+
<template #hosting>
|
|
99
|
+
<p class="landing-faq">
|
|
100
|
+
可自托管 runner,也可使用托管队列。密钥不进入日志明文。
|
|
101
|
+
</p>
|
|
102
|
+
</template>
|
|
103
|
+
<template #migrate>
|
|
104
|
+
<p class="landing-faq">
|
|
105
|
+
从现有 YAML 映射阶段与缓存键;保留原有制品路径可降低切换成本。
|
|
106
|
+
</p>
|
|
107
|
+
</template>
|
|
108
|
+
</MAccordion>
|
|
109
|
+
</section>
|
|
110
|
+
|
|
111
|
+
<footer class="landing-footer">
|
|
112
|
+
<span>流水线 CI</span>
|
|
113
|
+
<MButton label="联系销售" severity="secondary" text />
|
|
114
|
+
</footer>
|
|
115
|
+
</div>
|
|
116
|
+
</MConfigProvider>
|
|
117
|
+
</template>
|
|
118
|
+
|
|
119
|
+
<style scoped>
|
|
120
|
+
.landing {
|
|
121
|
+
min-height: 100vh;
|
|
122
|
+
background: var(--m-color-surface);
|
|
123
|
+
color: var(--m-color-text);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.landing-nav {
|
|
127
|
+
display: flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
gap: var(--m-space-4);
|
|
130
|
+
padding: var(--m-space-4) clamp(1.25rem, 4vw, 3rem);
|
|
131
|
+
border-bottom: 1px solid var(--m-color-border);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.landing-nav__brand {
|
|
135
|
+
font-weight: 700;
|
|
136
|
+
letter-spacing: -0.02em;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.landing-nav__links {
|
|
140
|
+
display: flex;
|
|
141
|
+
flex: 1;
|
|
142
|
+
gap: var(--m-space-4);
|
|
143
|
+
margin-left: var(--m-space-2);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.landing-nav__links a {
|
|
147
|
+
color: var(--m-color-text-muted);
|
|
148
|
+
text-decoration: none;
|
|
149
|
+
font-size: 0.9375rem;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.landing-nav__links a:hover {
|
|
153
|
+
color: var(--m-color-primary);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.landing-hero {
|
|
157
|
+
display: grid;
|
|
158
|
+
gap: var(--m-space-4);
|
|
159
|
+
padding: clamp(2.5rem, 8vw, 5.5rem) clamp(1.25rem, 4vw, 3rem) clamp(3rem, 8vw, 5rem);
|
|
160
|
+
max-width: 72rem;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.landing-hero__brand {
|
|
164
|
+
margin: 0;
|
|
165
|
+
font-size: 0.8125rem;
|
|
166
|
+
letter-spacing: 0.12em;
|
|
167
|
+
text-transform: uppercase;
|
|
168
|
+
color: var(--m-color-text-muted);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.landing-hero h1 {
|
|
172
|
+
margin: 0;
|
|
173
|
+
max-width: 14em;
|
|
174
|
+
font-size: clamp(2.25rem, 5vw, 3.5rem);
|
|
175
|
+
font-weight: 700;
|
|
176
|
+
line-height: 1.12;
|
|
177
|
+
letter-spacing: -0.035em;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.landing-hero__lead {
|
|
181
|
+
margin: 0;
|
|
182
|
+
max-width: 36rem;
|
|
183
|
+
font-size: 1.125rem;
|
|
184
|
+
line-height: 1.55;
|
|
185
|
+
color: var(--m-color-text-muted);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.landing-hero__cta {
|
|
189
|
+
display: flex;
|
|
190
|
+
flex-wrap: wrap;
|
|
191
|
+
gap: var(--m-space-3);
|
|
192
|
+
margin-top: var(--m-space-2);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.landing-hero__visual {
|
|
196
|
+
margin-top: var(--m-space-5);
|
|
197
|
+
padding: var(--m-space-5);
|
|
198
|
+
border: 1px solid var(--m-color-border);
|
|
199
|
+
border-radius: var(--m-radius-md);
|
|
200
|
+
background:
|
|
201
|
+
linear-gradient(
|
|
202
|
+
135deg,
|
|
203
|
+
color-mix(in srgb, var(--m-color-primary) 12%, var(--m-color-surface)),
|
|
204
|
+
var(--m-color-surface) 60%
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.landing-hero__track {
|
|
209
|
+
display: grid;
|
|
210
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
211
|
+
gap: var(--m-space-3);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.landing-hero__track span {
|
|
215
|
+
padding: var(--m-space-3) var(--m-space-4);
|
|
216
|
+
border-left: 3px solid var(--m-color-primary);
|
|
217
|
+
background: color-mix(in srgb, var(--m-color-surface) 80%, transparent);
|
|
218
|
+
font-size: 0.875rem;
|
|
219
|
+
font-weight: 600;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.landing-section {
|
|
223
|
+
padding: clamp(2.5rem, 6vw, 4rem) clamp(1.25rem, 4vw, 3rem);
|
|
224
|
+
max-width: 72rem;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.landing-section--alt {
|
|
228
|
+
border-block: 1px solid var(--m-color-border);
|
|
229
|
+
background: color-mix(in srgb, var(--m-color-border) 18%, var(--m-color-surface));
|
|
230
|
+
max-width: none;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.landing-section h2 {
|
|
234
|
+
margin: 0 0 var(--m-space-3);
|
|
235
|
+
font-size: 1.75rem;
|
|
236
|
+
letter-spacing: -0.02em;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.landing-section__lead {
|
|
240
|
+
margin: 0 0 var(--m-space-5);
|
|
241
|
+
max-width: 36rem;
|
|
242
|
+
color: var(--m-color-text-muted);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.landing-points {
|
|
246
|
+
list-style: none;
|
|
247
|
+
margin: 0;
|
|
248
|
+
padding: 0;
|
|
249
|
+
display: grid;
|
|
250
|
+
gap: var(--m-space-4);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.landing-points li {
|
|
254
|
+
display: grid;
|
|
255
|
+
gap: var(--m-space-2);
|
|
256
|
+
max-width: 40rem;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.landing-points strong {
|
|
260
|
+
font-size: 1.0625rem;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.landing-points span {
|
|
264
|
+
color: var(--m-color-text-muted);
|
|
265
|
+
line-height: 1.55;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.landing-cards {
|
|
269
|
+
display: grid;
|
|
270
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
271
|
+
gap: var(--m-space-4);
|
|
272
|
+
max-width: 72rem;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.landing-cards article {
|
|
276
|
+
display: grid;
|
|
277
|
+
gap: var(--m-space-3);
|
|
278
|
+
padding: var(--m-space-5);
|
|
279
|
+
border: 1px solid var(--m-color-border);
|
|
280
|
+
border-radius: var(--m-radius-md);
|
|
281
|
+
background: var(--m-color-surface);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.landing-cards h3 {
|
|
285
|
+
margin: 0;
|
|
286
|
+
font-size: 1.125rem;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.landing-cards p {
|
|
290
|
+
margin: 0;
|
|
291
|
+
color: var(--m-color-text-muted);
|
|
292
|
+
line-height: 1.55;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.landing-faq {
|
|
296
|
+
margin: 0;
|
|
297
|
+
color: var(--m-color-text-muted);
|
|
298
|
+
line-height: 1.55;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.landing-footer {
|
|
302
|
+
display: flex;
|
|
303
|
+
align-items: center;
|
|
304
|
+
justify-content: space-between;
|
|
305
|
+
gap: var(--m-space-4);
|
|
306
|
+
padding: var(--m-space-5) clamp(1.25rem, 4vw, 3rem);
|
|
307
|
+
border-top: 1px solid var(--m-color-border);
|
|
308
|
+
color: var(--m-color-text-muted);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
@media (max-width: 900px) {
|
|
312
|
+
.landing-nav__links {
|
|
313
|
+
display: none;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.landing-hero__track,
|
|
317
|
+
.landing-cards {
|
|
318
|
+
grid-template-columns: 1fr 1fr;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
@media (max-width: 560px) {
|
|
323
|
+
.landing-hero__track,
|
|
324
|
+
.landing-cards {
|
|
325
|
+
grid-template-columns: 1fr;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
</style>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* 黄金样例:列表页
|
|
4
|
+
* @see DESIGN.md §3
|
|
5
|
+
*/
|
|
6
|
+
import {
|
|
7
|
+
MBreadcrumb,
|
|
8
|
+
MButton,
|
|
9
|
+
MConfigProvider,
|
|
10
|
+
MInput,
|
|
11
|
+
MLayout,
|
|
12
|
+
MLayoutContent,
|
|
13
|
+
MLayoutHeader,
|
|
14
|
+
MLayoutSider,
|
|
15
|
+
MMenu,
|
|
16
|
+
MPageContent,
|
|
17
|
+
MPageFilters,
|
|
18
|
+
MPageToolbar,
|
|
19
|
+
MSelect,
|
|
20
|
+
MSpace,
|
|
21
|
+
MTable,
|
|
22
|
+
MTag,
|
|
23
|
+
zhCN,
|
|
24
|
+
} from 'morya-ui'
|
|
25
|
+
import { ref } from 'vue'
|
|
26
|
+
|
|
27
|
+
const keyword = ref('')
|
|
28
|
+
const status = ref<string | undefined>()
|
|
29
|
+
|
|
30
|
+
const statusOptions = [
|
|
31
|
+
{ label: '全部', value: '' },
|
|
32
|
+
{ label: '启用', value: 'active' },
|
|
33
|
+
{ label: '停用', value: 'inactive' },
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
const columns = [
|
|
37
|
+
{ key: 'name', label: '名称' },
|
|
38
|
+
{ key: 'status', label: '状态' },
|
|
39
|
+
{ key: 'updatedAt', label: '更新时间' },
|
|
40
|
+
{ key: 'actions', label: '操作', width: 128 },
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
const rows = [
|
|
44
|
+
{ id: '1', name: '示例项目 A', status: 'active', updatedAt: '2026-09-01' },
|
|
45
|
+
{ id: '2', name: '示例项目 B', status: 'inactive', updatedAt: '2026-08-28' },
|
|
46
|
+
{ id: '3', name: '示例项目 C', status: 'active', updatedAt: '2026-08-25' },
|
|
47
|
+
{ id: '4', name: '示例项目 D', status: 'active', updatedAt: '2026-08-20' },
|
|
48
|
+
{ id: '5', name: '示例项目 E', status: 'inactive', updatedAt: '2026-08-15' },
|
|
49
|
+
]
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<MConfigProvider :locale="zhCN">
|
|
54
|
+
<MLayout has-sider fill-viewport>
|
|
55
|
+
<MLayoutSider bordered>
|
|
56
|
+
<MMenu :model="[{ label: '用户管理', key: 'users' }, { label: '角色管理', key: 'roles' }]" />
|
|
57
|
+
</MLayoutSider>
|
|
58
|
+
|
|
59
|
+
<MLayout>
|
|
60
|
+
<MLayoutHeader padding="var(--m-space-4) var(--m-space-6)">
|
|
61
|
+
<MBreadcrumb :model="[{ label: '首页', to: '/' }, { label: '用户管理' }]" />
|
|
62
|
+
</MLayoutHeader>
|
|
63
|
+
|
|
64
|
+
<MLayoutContent>
|
|
65
|
+
<MPageContent>
|
|
66
|
+
<MPageFilters aria-label="筛选">
|
|
67
|
+
<MSpace wrap>
|
|
68
|
+
<MInput v-model="keyword" placeholder="搜索名称" clearable style="width: 14rem" />
|
|
69
|
+
<MSelect
|
|
70
|
+
v-model="status"
|
|
71
|
+
:options="statusOptions"
|
|
72
|
+
placeholder="状态"
|
|
73
|
+
clearable
|
|
74
|
+
style="width: 10rem"
|
|
75
|
+
/>
|
|
76
|
+
<MButton severity="primary">
|
|
77
|
+
查询
|
|
78
|
+
</MButton>
|
|
79
|
+
<MButton severity="secondary">
|
|
80
|
+
重置
|
|
81
|
+
</MButton>
|
|
82
|
+
</MSpace>
|
|
83
|
+
</MPageFilters>
|
|
84
|
+
|
|
85
|
+
<MPageToolbar title="用户管理">
|
|
86
|
+
<template #actions>
|
|
87
|
+
<MButton severity="primary">
|
|
88
|
+
新建用户
|
|
89
|
+
</MButton>
|
|
90
|
+
</template>
|
|
91
|
+
</MPageToolbar>
|
|
92
|
+
|
|
93
|
+
<MTable
|
|
94
|
+
:columns="columns"
|
|
95
|
+
:rows="rows"
|
|
96
|
+
:rows-per-page="3"
|
|
97
|
+
paginator
|
|
98
|
+
striped
|
|
99
|
+
bordered
|
|
100
|
+
row-key="id"
|
|
101
|
+
aria-label="用户列表"
|
|
102
|
+
>
|
|
103
|
+
<template #cell-status="{ value }">
|
|
104
|
+
<MTag :value="value === 'active' ? '启用' : '停用'" :severity="value === 'active' ? 'success' : 'secondary'" />
|
|
105
|
+
</template>
|
|
106
|
+
<template #cell-actions>
|
|
107
|
+
<MSpace>
|
|
108
|
+
<MButton severity="secondary" size="small">
|
|
109
|
+
编辑
|
|
110
|
+
</MButton>
|
|
111
|
+
<MButton severity="danger" size="small">
|
|
112
|
+
删除
|
|
113
|
+
</MButton>
|
|
114
|
+
</MSpace>
|
|
115
|
+
</template>
|
|
116
|
+
<template #empty>
|
|
117
|
+
<p style="margin: 0; padding: var(--m-space-8); text-align: center; color: var(--m-color-text-muted)">
|
|
118
|
+
暂无用户数据
|
|
119
|
+
</p>
|
|
120
|
+
</template>
|
|
121
|
+
</MTable>
|
|
122
|
+
</MPageContent>
|
|
123
|
+
</MLayoutContent>
|
|
124
|
+
</MLayout>
|
|
125
|
+
</MLayout>
|
|
126
|
+
</MConfigProvider>
|
|
127
|
+
</template>
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* 黄金样例:登录页(Account + 轻量品牌)
|
|
4
|
+
* @see DESIGN.md §3 · morya-ui-pages surfaces § Account
|
|
5
|
+
*/
|
|
6
|
+
import {
|
|
7
|
+
MButton,
|
|
8
|
+
MConfigProvider,
|
|
9
|
+
MForm,
|
|
10
|
+
MFormItem,
|
|
11
|
+
MInput,
|
|
12
|
+
MInputPassword,
|
|
13
|
+
MSpace,
|
|
14
|
+
zhCN,
|
|
15
|
+
} from 'morya-ui'
|
|
16
|
+
import { reactive, ref } from 'vue'
|
|
17
|
+
|
|
18
|
+
const submitting = ref(false)
|
|
19
|
+
const formError = ref('')
|
|
20
|
+
|
|
21
|
+
const model = reactive({
|
|
22
|
+
email: '',
|
|
23
|
+
password: '',
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
async function onSubmit() {
|
|
27
|
+
formError.value = ''
|
|
28
|
+
submitting.value = true
|
|
29
|
+
try {
|
|
30
|
+
// await api.login(model)
|
|
31
|
+
if (!model.email || !model.password) {
|
|
32
|
+
formError.value = '请输入邮箱和密码后再试。'
|
|
33
|
+
return
|
|
34
|
+
}
|
|
35
|
+
} finally {
|
|
36
|
+
submitting.value = false
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<MConfigProvider :locale="zhCN">
|
|
43
|
+
<div class="login-shell">
|
|
44
|
+
<aside class="login-brand" aria-label="品牌">
|
|
45
|
+
<p class="login-brand__mark">青禾书房</p>
|
|
46
|
+
<h1 class="login-brand__title">把好书留在手边</h1>
|
|
47
|
+
<p class="login-brand__lead">
|
|
48
|
+
店员与会员共用同一套账户。登录后继续进货、上架与会员服务。
|
|
49
|
+
</p>
|
|
50
|
+
</aside>
|
|
51
|
+
|
|
52
|
+
<main class="login-main">
|
|
53
|
+
<div class="login-panel">
|
|
54
|
+
<header class="login-panel__header">
|
|
55
|
+
<h2>登录</h2>
|
|
56
|
+
<p>使用工作邮箱进入后台。</p>
|
|
57
|
+
</header>
|
|
58
|
+
|
|
59
|
+
<!-- 表单级常驻错误:token 样式告警条(字段错误优先用 errorMessage) -->
|
|
60
|
+
<p v-if="formError" class="login-alert" role="alert">
|
|
61
|
+
{{ formError }}
|
|
62
|
+
</p>
|
|
63
|
+
|
|
64
|
+
<MForm @submit="onSubmit">
|
|
65
|
+
<MFormItem label="邮箱" name="email" required>
|
|
66
|
+
<MInput
|
|
67
|
+
v-model="model.email"
|
|
68
|
+
type="email"
|
|
69
|
+
placeholder="name@qinghe.example"
|
|
70
|
+
autocomplete="username"
|
|
71
|
+
fluid
|
|
72
|
+
/>
|
|
73
|
+
</MFormItem>
|
|
74
|
+
|
|
75
|
+
<MFormItem label="密码" name="password" required>
|
|
76
|
+
<MInputPassword
|
|
77
|
+
v-model="model.password"
|
|
78
|
+
placeholder="请输入密码"
|
|
79
|
+
autocomplete="current-password"
|
|
80
|
+
fluid
|
|
81
|
+
/>
|
|
82
|
+
</MFormItem>
|
|
83
|
+
|
|
84
|
+
<MSpace style="margin-top: var(--m-space-2)" alignment="center">
|
|
85
|
+
<MButton type="submit" label="登录" :loading="submitting" />
|
|
86
|
+
<MButton type="button" label="忘记密码" severity="secondary" text />
|
|
87
|
+
</MSpace>
|
|
88
|
+
</MForm>
|
|
89
|
+
</div>
|
|
90
|
+
</main>
|
|
91
|
+
</div>
|
|
92
|
+
</MConfigProvider>
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<style scoped>
|
|
96
|
+
.login-shell {
|
|
97
|
+
display: grid;
|
|
98
|
+
grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
|
|
99
|
+
min-height: 100vh;
|
|
100
|
+
background: var(--m-color-surface);
|
|
101
|
+
color: var(--m-color-text);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.login-brand {
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-direction: column;
|
|
107
|
+
justify-content: flex-end;
|
|
108
|
+
gap: var(--m-space-4);
|
|
109
|
+
padding: clamp(2rem, 6vw, 4.5rem);
|
|
110
|
+
background:
|
|
111
|
+
linear-gradient(
|
|
112
|
+
165deg,
|
|
113
|
+
color-mix(in srgb, var(--m-color-primary) 18%, var(--m-color-surface)) 0%,
|
|
114
|
+
var(--m-color-surface) 55%,
|
|
115
|
+
color-mix(in srgb, var(--m-color-border) 35%, var(--m-color-surface)) 100%
|
|
116
|
+
);
|
|
117
|
+
border-right: 1px solid var(--m-color-border);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.login-brand__mark {
|
|
121
|
+
margin: 0;
|
|
122
|
+
font-size: 0.8125rem;
|
|
123
|
+
letter-spacing: 0.14em;
|
|
124
|
+
text-transform: uppercase;
|
|
125
|
+
color: var(--m-color-text-muted);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.login-brand__title {
|
|
129
|
+
margin: 0;
|
|
130
|
+
max-width: 12em;
|
|
131
|
+
font-size: clamp(2rem, 4vw, 3rem);
|
|
132
|
+
font-weight: 650;
|
|
133
|
+
line-height: 1.15;
|
|
134
|
+
letter-spacing: -0.03em;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.login-brand__lead {
|
|
138
|
+
margin: 0;
|
|
139
|
+
max-width: 28rem;
|
|
140
|
+
color: var(--m-color-text-muted);
|
|
141
|
+
line-height: 1.6;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.login-main {
|
|
145
|
+
display: grid;
|
|
146
|
+
place-items: center;
|
|
147
|
+
padding: var(--m-space-6);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.login-panel {
|
|
151
|
+
width: min(100%, 22rem);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.login-panel__header {
|
|
155
|
+
margin-bottom: var(--m-space-5);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.login-panel__header h2 {
|
|
159
|
+
margin: 0 0 var(--m-space-2);
|
|
160
|
+
font-size: 1.5rem;
|
|
161
|
+
font-weight: 650;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.login-panel__header p {
|
|
165
|
+
margin: 0;
|
|
166
|
+
color: var(--m-color-text-muted);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.login-alert {
|
|
170
|
+
margin: 0 0 var(--m-space-4);
|
|
171
|
+
padding: var(--m-space-3) var(--m-space-4);
|
|
172
|
+
border: 1px solid color-mix(in srgb, var(--m-color-danger) 40%, var(--m-color-border));
|
|
173
|
+
border-radius: var(--m-radius-md);
|
|
174
|
+
background: color-mix(in srgb, var(--m-color-danger) 10%, var(--m-color-surface));
|
|
175
|
+
color: var(--m-color-danger);
|
|
176
|
+
font-size: 0.875rem;
|
|
177
|
+
line-height: 1.45;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@media (max-width: 768px) {
|
|
181
|
+
.login-shell {
|
|
182
|
+
grid-template-columns: 1fr;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.login-brand {
|
|
186
|
+
border-right: 0;
|
|
187
|
+
border-bottom: 1px solid var(--m-color-border);
|
|
188
|
+
min-height: 12rem;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
</style>
|