@seasonkoh/webaz 0.1.7 → 0.1.8
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/dist/layer1-agent/L1-1-mcp-server/server.js +295 -9
- package/dist/pwa/public/app.js +3062 -0
- package/dist/pwa/public/i18n.js +580 -0
- package/dist/pwa/public/index.html +18 -0
- package/dist/pwa/public/manifest.json +13 -0
- package/dist/pwa/public/style.css +262 -0
- package/dist/pwa/public/sw.js +24 -0
- package/dist/pwa/server.js +1840 -9
- package/package.json +4 -2
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/* DCP PWA — 移动优先 */
|
|
2
|
+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }
|
|
3
|
+
|
|
4
|
+
:root {
|
|
5
|
+
--primary: #4f46e5;
|
|
6
|
+
--primary-light: #ede9fe;
|
|
7
|
+
--success: #059669;
|
|
8
|
+
--warning: #d97706;
|
|
9
|
+
--danger: #dc2626;
|
|
10
|
+
--gray-50: #f9fafb;
|
|
11
|
+
--gray-100: #f3f4f6;
|
|
12
|
+
--gray-300: #d1d5db;
|
|
13
|
+
--gray-500: #6b7280;
|
|
14
|
+
--gray-700: #374151;
|
|
15
|
+
--gray-900: #111827;
|
|
16
|
+
--radius: 12px;
|
|
17
|
+
--shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
body {
|
|
21
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
22
|
+
background: var(--gray-50);
|
|
23
|
+
color: var(--gray-900);
|
|
24
|
+
min-height: 100vh;
|
|
25
|
+
-webkit-font-smoothing: antialiased;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* ── 顶部导航 ── */
|
|
29
|
+
.navbar {
|
|
30
|
+
background: #fff;
|
|
31
|
+
border-bottom: 1px solid var(--gray-100);
|
|
32
|
+
padding: 0 16px;
|
|
33
|
+
height: 56px;
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: space-between;
|
|
37
|
+
position: sticky;
|
|
38
|
+
top: 0;
|
|
39
|
+
z-index: 100;
|
|
40
|
+
}
|
|
41
|
+
.navbar-brand { font-size: 18px; font-weight: 700; color: var(--primary); text-decoration: none }
|
|
42
|
+
.navbar-actions { display: flex; gap: 8px }
|
|
43
|
+
|
|
44
|
+
/* ── 底部 Tab 栏 ── */
|
|
45
|
+
.tabbar {
|
|
46
|
+
position: fixed;
|
|
47
|
+
bottom: 0; left: 0; right: 0;
|
|
48
|
+
background: #fff;
|
|
49
|
+
border-top: 1px solid var(--gray-100);
|
|
50
|
+
display: flex;
|
|
51
|
+
height: 60px;
|
|
52
|
+
z-index: 100;
|
|
53
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
54
|
+
}
|
|
55
|
+
.tab-item {
|
|
56
|
+
flex: 1;
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
gap: 2px;
|
|
62
|
+
font-size: 10px;
|
|
63
|
+
color: var(--gray-500);
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
border: none;
|
|
66
|
+
background: none;
|
|
67
|
+
padding: 8px 4px;
|
|
68
|
+
transition: color .15s;
|
|
69
|
+
}
|
|
70
|
+
.tab-item.active { color: var(--primary) }
|
|
71
|
+
.tab-icon { font-size: 20px; line-height: 1 }
|
|
72
|
+
|
|
73
|
+
/* ── 主内容区 ── */
|
|
74
|
+
.main { padding: 16px 16px 80px; max-width: 640px; margin: 0 auto }
|
|
75
|
+
|
|
76
|
+
/* ── 页面标题 ── */
|
|
77
|
+
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 16px }
|
|
78
|
+
.page-sub { font-size: 14px; color: var(--gray-500); margin-bottom: 20px }
|
|
79
|
+
|
|
80
|
+
/* ── 卡片 ── */
|
|
81
|
+
.card {
|
|
82
|
+
background: #fff;
|
|
83
|
+
border-radius: var(--radius);
|
|
84
|
+
box-shadow: var(--shadow);
|
|
85
|
+
padding: 16px;
|
|
86
|
+
margin-bottom: 12px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* ── 商品卡片 ── */
|
|
90
|
+
.product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px }
|
|
91
|
+
.product-card {
|
|
92
|
+
background: #fff;
|
|
93
|
+
border-radius: var(--radius);
|
|
94
|
+
box-shadow: var(--shadow);
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
transition: transform .15s, box-shadow .15s;
|
|
98
|
+
}
|
|
99
|
+
.product-card:active { transform: scale(.97) }
|
|
100
|
+
.product-img {
|
|
101
|
+
width: 100%; aspect-ratio: 1;
|
|
102
|
+
background: var(--gray-100);
|
|
103
|
+
display: flex; align-items: center; justify-content: center;
|
|
104
|
+
font-size: 40px;
|
|
105
|
+
}
|
|
106
|
+
.product-body { padding: 10px }
|
|
107
|
+
.product-name { font-size: 13px; font-weight: 600; line-height: 1.4; margin-bottom: 4px }
|
|
108
|
+
.product-price { font-size: 16px; font-weight: 700; color: var(--primary) }
|
|
109
|
+
.product-seller { font-size: 11px; color: var(--gray-500); margin-top: 2px }
|
|
110
|
+
|
|
111
|
+
/* ── 搜索栏 ── */
|
|
112
|
+
.search-bar {
|
|
113
|
+
display: flex; gap: 8px; margin-bottom: 16px;
|
|
114
|
+
}
|
|
115
|
+
.search-input {
|
|
116
|
+
flex: 1;
|
|
117
|
+
padding: 10px 14px;
|
|
118
|
+
border: 1px solid var(--gray-300);
|
|
119
|
+
border-radius: 99px;
|
|
120
|
+
font-size: 15px;
|
|
121
|
+
outline: none;
|
|
122
|
+
}
|
|
123
|
+
.search-input:focus { border-color: var(--primary) }
|
|
124
|
+
|
|
125
|
+
/* ── 表单 ── */
|
|
126
|
+
.form-group { margin-bottom: 16px }
|
|
127
|
+
.form-label { font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; display: block }
|
|
128
|
+
.form-control {
|
|
129
|
+
width: 100%;
|
|
130
|
+
padding: 12px 14px;
|
|
131
|
+
border: 1px solid var(--gray-300);
|
|
132
|
+
border-radius: 10px;
|
|
133
|
+
font-size: 15px;
|
|
134
|
+
outline: none;
|
|
135
|
+
background: #fff;
|
|
136
|
+
transition: border-color .15s;
|
|
137
|
+
}
|
|
138
|
+
.form-control:focus { border-color: var(--primary) }
|
|
139
|
+
textarea.form-control { min-height: 80px; resize: vertical }
|
|
140
|
+
select.form-control { appearance: none }
|
|
141
|
+
|
|
142
|
+
/* ── 按钮 ── */
|
|
143
|
+
.btn {
|
|
144
|
+
display: inline-flex; align-items: center; justify-content: center; gap: 6px;
|
|
145
|
+
padding: 12px 20px;
|
|
146
|
+
border-radius: 10px;
|
|
147
|
+
font-size: 15px; font-weight: 600;
|
|
148
|
+
border: none; cursor: pointer;
|
|
149
|
+
transition: opacity .15s, transform .1s;
|
|
150
|
+
width: 100%;
|
|
151
|
+
}
|
|
152
|
+
.btn:active { transform: scale(.97) }
|
|
153
|
+
.btn-primary { background: var(--primary); color: #fff }
|
|
154
|
+
.btn-success { background: var(--success); color: #fff }
|
|
155
|
+
.btn-danger { background: var(--danger); color: #fff }
|
|
156
|
+
.btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary) }
|
|
157
|
+
.btn-gray { background: var(--gray-100); color: var(--gray-700) }
|
|
158
|
+
.btn-sm { padding: 8px 16px; font-size: 13px; width: auto }
|
|
159
|
+
.btn:disabled { opacity: .4; cursor: not-allowed }
|
|
160
|
+
.btn-row { display: flex; gap: 8px }
|
|
161
|
+
|
|
162
|
+
/* ── 状态徽章 ── */
|
|
163
|
+
.badge {
|
|
164
|
+
display: inline-block;
|
|
165
|
+
padding: 3px 10px;
|
|
166
|
+
border-radius: 99px;
|
|
167
|
+
font-size: 12px; font-weight: 600;
|
|
168
|
+
}
|
|
169
|
+
.badge-blue { background: #dbeafe; color: #1d4ed8 }
|
|
170
|
+
.badge-yellow { background: #fef3c7; color: #92400e }
|
|
171
|
+
.badge-green { background: #d1fae5; color: #065f46 }
|
|
172
|
+
.badge-red { background: #fee2e2; color: #991b1b }
|
|
173
|
+
.badge-gray { background: var(--gray-100); color: var(--gray-700) }
|
|
174
|
+
.badge-purple { background: var(--primary-light); color: var(--primary) }
|
|
175
|
+
|
|
176
|
+
/* ── 订单列表 ── */
|
|
177
|
+
.order-item { display: flex; gap: 12px; align-items: flex-start }
|
|
178
|
+
.order-icon { font-size: 28px; line-height: 1; flex-shrink: 0 }
|
|
179
|
+
.order-info { flex: 1; min-width: 0 }
|
|
180
|
+
.order-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
|
|
181
|
+
.order-meta { font-size: 12px; color: var(--gray-500); margin-top: 3px }
|
|
182
|
+
.order-amount { font-size: 15px; font-weight: 700; color: var(--primary); flex-shrink: 0 }
|
|
183
|
+
|
|
184
|
+
/* ── 状态时间线 ── */
|
|
185
|
+
.timeline { position: relative; padding-left: 24px }
|
|
186
|
+
.timeline::before {
|
|
187
|
+
content: '';
|
|
188
|
+
position: absolute; left: 8px; top: 8px; bottom: 0;
|
|
189
|
+
width: 2px; background: var(--gray-100);
|
|
190
|
+
}
|
|
191
|
+
.timeline-item { position: relative; padding-bottom: 20px; font-size: 13px }
|
|
192
|
+
.timeline-item::before {
|
|
193
|
+
content: '';
|
|
194
|
+
position: absolute; left: -20px; top: 4px;
|
|
195
|
+
width: 10px; height: 10px;
|
|
196
|
+
border-radius: 50%;
|
|
197
|
+
background: var(--primary);
|
|
198
|
+
border: 2px solid #fff;
|
|
199
|
+
box-shadow: 0 0 0 2px var(--primary);
|
|
200
|
+
}
|
|
201
|
+
.timeline-status { font-weight: 700; color: var(--gray-900) }
|
|
202
|
+
.timeline-actor { color: var(--gray-500) }
|
|
203
|
+
.timeline-time { color: var(--gray-300); font-size: 11px }
|
|
204
|
+
.timeline-evidence { color: var(--success); font-size: 11px }
|
|
205
|
+
|
|
206
|
+
/* ── 钱包卡片 ── */
|
|
207
|
+
.wallet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
|
|
208
|
+
.wallet-item { background: var(--gray-50); border-radius: 10px; padding: 12px }
|
|
209
|
+
.wallet-label { font-size: 11px; color: var(--gray-500); margin-bottom: 4px }
|
|
210
|
+
.wallet-value { font-size: 20px; font-weight: 700; color: var(--gray-900) }
|
|
211
|
+
.wallet-unit { font-size: 12px; color: var(--gray-500); font-weight: 400 }
|
|
212
|
+
|
|
213
|
+
/* ── 空状态 ── */
|
|
214
|
+
.empty { text-align: center; padding: 48px 16px; color: var(--gray-500) }
|
|
215
|
+
.empty-icon { font-size: 48px; margin-bottom: 12px }
|
|
216
|
+
.empty-text { font-size: 15px }
|
|
217
|
+
|
|
218
|
+
/* ── Alert ── */
|
|
219
|
+
.alert {
|
|
220
|
+
padding: 12px 14px;
|
|
221
|
+
border-radius: 10px;
|
|
222
|
+
font-size: 14px;
|
|
223
|
+
margin-bottom: 12px;
|
|
224
|
+
}
|
|
225
|
+
.alert-error { background: #fee2e2; color: #991b1b }
|
|
226
|
+
.alert-success { background: #d1fae5; color: #065f46 }
|
|
227
|
+
.alert-info { background: var(--primary-light); color: var(--primary) }
|
|
228
|
+
.alert-warning { background: #fef3c7; color: #92400e }
|
|
229
|
+
|
|
230
|
+
/* ── 分割线 ── */
|
|
231
|
+
.divider { height: 1px; background: var(--gray-100); margin: 16px 0 }
|
|
232
|
+
|
|
233
|
+
/* ── 详情行 ── */
|
|
234
|
+
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-size: 14px }
|
|
235
|
+
.detail-row:not(:last-child) { border-bottom: 1px solid var(--gray-100) }
|
|
236
|
+
.detail-label { color: var(--gray-500) }
|
|
237
|
+
.detail-value { font-weight: 600; text-align: right; max-width: 60% }
|
|
238
|
+
|
|
239
|
+
/* ── 登录页 ── */
|
|
240
|
+
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px; }
|
|
241
|
+
.login-logo { font-size: 48px; text-align: center; margin-bottom: 8px }
|
|
242
|
+
.login-title { text-align: center; font-size: 24px; font-weight: 700; margin-bottom: 4px }
|
|
243
|
+
.login-sub { text-align: center; color: var(--gray-500); font-size: 14px; margin-bottom: 32px }
|
|
244
|
+
|
|
245
|
+
/* ── Tab 切换 ── */
|
|
246
|
+
.seg-ctrl { display: flex; background: var(--gray-100); border-radius: 10px; padding: 4px; margin-bottom: 16px }
|
|
247
|
+
.seg-btn {
|
|
248
|
+
flex: 1; text-align: center; padding: 8px; border-radius: 8px;
|
|
249
|
+
font-size: 14px; font-weight: 600; cursor: pointer;
|
|
250
|
+
border: none; background: none; color: var(--gray-500);
|
|
251
|
+
transition: all .15s;
|
|
252
|
+
}
|
|
253
|
+
.seg-btn.active { background: #fff; color: var(--primary); box-shadow: var(--shadow) }
|
|
254
|
+
|
|
255
|
+
/* ── 加载态 ── */
|
|
256
|
+
.loading { text-align: center; padding: 40px; color: var(--gray-500); font-size: 14px }
|
|
257
|
+
@keyframes spin { to { transform: rotate(360deg) } }
|
|
258
|
+
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--gray-300); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; margin-right: 8px }
|
|
259
|
+
|
|
260
|
+
/* ── 操作区域 ── */
|
|
261
|
+
.action-area { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-top: 16px }
|
|
262
|
+
.action-title { font-size: 13px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Service Worker — 网络优先,离线降级缓存;API 请求不缓存
|
|
2
|
+
const CACHE = 'webaz-v3'
|
|
3
|
+
|
|
4
|
+
self.addEventListener('install', e => {
|
|
5
|
+
self.skipWaiting()
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
self.addEventListener('activate', e => {
|
|
9
|
+
e.waitUntil(caches.keys().then(keys =>
|
|
10
|
+
Promise.all(keys.filter(k => k !== CACHE).map(k => caches.delete(k)))
|
|
11
|
+
))
|
|
12
|
+
self.clients.claim()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
self.addEventListener('fetch', e => {
|
|
16
|
+
if (e.request.url.includes('/api/')) return
|
|
17
|
+
e.respondWith(
|
|
18
|
+
fetch(e.request).then(res => {
|
|
19
|
+
const clone = res.clone()
|
|
20
|
+
caches.open(CACHE).then(c => c.put(e.request, clone))
|
|
21
|
+
return res
|
|
22
|
+
}).catch(() => caches.match(e.request))
|
|
23
|
+
)
|
|
24
|
+
})
|