Просмотр исходного кода

feat(mobile-h5): add design tokens and global style entry

Co-authored-by: Cursor <cursoragent@cursor.com>
zlwu 2 месяцев назад
Родитель
Сommit
cfe0e616ab

+ 25 - 0
mobile-h5/App.vue

@@ -0,0 +1,25 @@
+<script>
+  export default {
+    onLaunch() {
+      console.log('App Launch')
+    },
+    onShow() {
+      console.log('App Show')
+    },
+    onHide() {
+      console.log('App Hide')
+    }
+  }
+</script>
+
+<style lang="scss">
+  @import './styles/vant-theme.scss';
+  @import './styles/app.scss';
+  @import './styles/components/menu-grid.scss';
+  @import './styles/components/todo.scss';
+  @import './styles/components/list.scss';
+  @import './styles/components/detail.scss';
+  @import './styles/components/attach.scss';
+  @import './styles/components/flow.scss';
+  @import './styles/components/form-shell.scss';
+</style>

+ 27 - 0
mobile-h5/styles/app.scss

@@ -0,0 +1,27 @@
+@import './tokens.scss';
+
+page {
+  @include token-css-vars;
+  background-color: var(--bg-page);
+  color: var(--text-primary);
+  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
+  font-size: 28rpx;
+  line-height: 1.5;
+  box-sizing: border-box;
+}
+
+view, text {
+  box-sizing: border-box;
+}
+
+.page-shell {
+  min-height: 100vh;
+  background:
+    radial-gradient(840rpx 440rpx at 100% 0%, rgba(214, 163, 67, 0.14), transparent 55%),
+    radial-gradient(760rpx 400rpx at 0% 20%, rgba(10, 159, 109, 0.1), transparent 50%),
+    linear-gradient(180deg, #e8f5ef 0%, #f4f7f6 40%, #f7f9f8 100%);
+}
+
+.safe-bottom {
+  padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
+}

+ 1 - 0
mobile-h5/styles/components/attach.scss

@@ -0,0 +1 @@
+// Task 4: attachment styles (.d-attach-list, .d-attach-upload, .d-attach-card, file type classes)

+ 1 - 0
mobile-h5/styles/components/detail.scss

@@ -0,0 +1 @@
+// Task 4: detail page styles (.detail-page, .detail-hero, .detail-metric-dock, .detail-section, .detail-footer)

+ 1 - 0
mobile-h5/styles/components/flow.scss

@@ -0,0 +1 @@
+// Task 4: flow timeline styles (.flow-list, .flow-item, .flow-dot, .flow-card)

+ 1 - 0
mobile-h5/styles/components/form-shell.scss

@@ -0,0 +1 @@
+// Task 4: form shell styles (.form-page, .form-section-title, .form-footer)

+ 1 - 0
mobile-h5/styles/components/list.scss

@@ -0,0 +1 @@
+// Task 4: list page styles (.list-hero, .list-filter-dock, .seg-tabs, .biz-card, status variants)

+ 1 - 0
mobile-h5/styles/components/menu-grid.scss

@@ -0,0 +1 @@
+// Task 4: menu-grid styles (.menu-grid, .menu-card, .menu-icon, .menu-title)

+ 1 - 0
mobile-h5/styles/components/todo.scss

@@ -0,0 +1 @@
+// Task 4: todo panel styles (.todo-panel, .todo-stats, .todo-stat, .todo-list, .todo-item)

+ 14 - 0
mobile-h5/styles/mixins.scss

@@ -0,0 +1,14 @@
+@mixin hero-green {
+  background: linear-gradient(155deg, #066647 0%, #0a9f6d 48%, #12b37a 100%);
+  color: #ffffff;
+  border-radius: 0 0 56rpx 56rpx;
+  position: relative;
+  overflow: hidden;
+}
+
+@mixin surface-card {
+  background: var(--surface, #ffffff);
+  border: 1rpx solid var(--border, #dcebe4);
+  border-radius: var(--radius-card, 28rpx);
+  box-shadow: var(--shadow-soft);
+}

+ 35 - 0
mobile-h5/styles/tokens.scss

@@ -0,0 +1,35 @@
+// 唯一 Token 源 — 对齐三墙 / Demo,禁止 #10b981
+$brand-green: #0a9f6d;
+$brand-green-dark: #087f57;
+$brand-green-soft: #e9f9f2;
+$barley-yellow: #d6a343;
+$barley-yellow-soft: #fff7e8;
+$bg-page: #f5f8f7;
+$surface: #ffffff;
+$text-primary: #1f2a26;
+$text-muted: #6b7b74;
+$border: #dcebe4;
+$danger: #d14343;
+$warning: #cf8a19;
+$success: #189b65;
+$radius-card: 28rpx;
+$radius-lg: 40rpx;
+
+@mixin token-css-vars {
+  --brand-green: #{$brand-green};
+  --brand-green-dark: #{$brand-green-dark};
+  --brand-green-soft: #{$brand-green-soft};
+  --barley-yellow: #{$barley-yellow};
+  --barley-yellow-soft: #{$barley-yellow-soft};
+  --bg-page: #{$bg-page};
+  --surface: #{$surface};
+  --text-primary: #{$text-primary};
+  --text-muted: #{$text-muted};
+  --border: #{$border};
+  --danger: #{$danger};
+  --warning: #{$warning};
+  --success: #{$success};
+  --radius-card: #{$radius-card};
+  --radius-lg: #{$radius-lg};
+  --shadow-soft: 0 8rpx 32rpx rgba(8, 127, 87, 0.08);
+}

+ 16 - 0
mobile-h5/styles/vant-theme.scss

@@ -0,0 +1,16 @@
+page {
+  --button-primary-background-color: #0a9f6d;
+  --button-primary-border-color: #0a9f6d;
+  --button-primary-color: #ffffff;
+  --nav-bar-background-color: transparent;
+  --nav-bar-title-text-color: #ffffff;
+  --nav-bar-icon-color: #ffffff;
+  --tabs-bottom-bar-color: #0a9f6d;
+  --tag-primary-color: #0a9f6d;
+  --tag-success-color: #189b65;
+  --tag-danger-color: #d14343;
+  --tag-warning-color: #cf8a19;
+  --steps-active-color: #0a9f6d;
+  --notice-bar-background-color: #e9f9f2;
+  --notice-bar-text-color: #087f57;
+}

+ 78 - 0
mobile-h5/uni.scss

@@ -0,0 +1,78 @@
+/**
+ * 这里是uni-app内置的常用样式变量
+ *
+ * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
+ * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
+ *
+ */
+
+/**
+ * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
+ *
+ * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
+ */
+
+@import './styles/tokens.scss';
+
+/* 颜色变量 */
+
+/* 行为相关颜色 */
+$uni-color-primary: $brand-green;
+$uni-color-success: $success;
+$uni-color-warning: $warning;
+$uni-color-error: $danger;
+
+/* 文字基本颜色 */
+$uni-text-color:#333;//基本色
+$uni-text-color-inverse:#fff;//反色
+$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息
+$uni-text-color-placeholder: #808080;
+$uni-text-color-disable:#c0c0c0;
+
+/* 背景颜色 */
+$uni-bg-color:#ffffff;
+$uni-bg-color-grey:#f8f8f8;
+$uni-bg-color-hover:#f1f1f1;//点击状态颜色
+$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
+
+/* 边框颜色 */
+$uni-border-color:#c8c7cc;
+
+/* 尺寸变量 */
+
+/* 文字尺寸 */
+$uni-font-size-sm:12px;
+$uni-font-size-base:14px;
+$uni-font-size-lg:16px;
+
+/* 图片尺寸 */
+$uni-img-size-sm:20px;
+$uni-img-size-base:26px;
+$uni-img-size-lg:40px;
+
+/* Border Radius */
+$uni-border-radius-sm: 2px;
+$uni-border-radius-base: 3px;
+$uni-border-radius-lg: 6px;
+$uni-border-radius-circle: 50%;
+
+/* 水平间距 */
+$uni-spacing-row-sm: 5px;
+$uni-spacing-row-base: 10px;
+$uni-spacing-row-lg: 15px;
+
+/* 垂直间距 */
+$uni-spacing-col-sm: 4px;
+$uni-spacing-col-base: 8px;
+$uni-spacing-col-lg: 12px;
+
+/* 透明度 */
+$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
+
+/* 文章场景相关 */
+$uni-color-title: #2C405A; // 文章标题颜色
+$uni-font-size-title:20px;
+$uni-color-subtitle: #555555; // 二级标题颜色
+$uni-font-size-subtitle:26px;
+$uni-color-paragraph: #3F536E; // 文章段落颜色
+$uni-font-size-paragraph:15px;