refactor(mp): CSS 变量主题 + 登录页改造 — UI 优化 Phase 0-2
Phase 0: 建立 design token 体系 - tokens.scss 新增 --tk-pri/--tk-pri-l/--tk-pri-d/--tk-shadow-btn/--tk-shadow-tab - .doctor-mode 覆盖为靛蓝色系,.elder-mode 非线性放大字号 - variables.scss 新增医生端色彩 + 阴影变量 Phase 1: 组件库 + 页面全局替换 - 75 个页面 SCSS $pri → var(--tk-pri) 全量替换 - 11 个新 UI 组件(PrimaryButton/TabFilter/FormInput/ProgressRing 等) - 8 个现有组件 SCSS 更新 - 18 个医生端页面 useElderClass → useDoctorClass - PageHeader 匹配原型 NavBar 规格 Phase 2: 登录页重写 - Logo: 方形+ → 圆形渐变 H - 登录方式: 纯微信 → 账号密码 + 微信一键登录 - 新增 credentialLogin API + store action - 字号/间距严格匹配原型 mp-01-login.html
This commit is contained in:
54
apps/miniprogram/src/components/ui/PrimaryButton/index.scss
Normal file
54
apps/miniprogram/src/components/ui/PrimaryButton/index.scss
Normal file
@@ -0,0 +1,54 @@
|
||||
@import '../../../styles/variables.scss';
|
||||
|
||||
.primary-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--tk-gap-xs);
|
||||
width: 100%;
|
||||
background: var(--tk-pri);
|
||||
color: $white;
|
||||
font-weight: 600;
|
||||
border: none;
|
||||
border-radius: 14px;
|
||||
box-shadow: var(--tk-shadow-btn);
|
||||
transition: opacity 0.15s, transform 0.15s;
|
||||
|
||||
&--default {
|
||||
height: var(--tk-btn-primary-h);
|
||||
font-size: var(--tk-font-body-lg);
|
||||
}
|
||||
|
||||
&--large {
|
||||
height: 54px;
|
||||
font-size: var(--tk-font-h2);
|
||||
}
|
||||
|
||||
&:active:not(&--disabled):not(&--loading) {
|
||||
opacity: var(--tk-touch-feedback-opacity);
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
&--disabled {
|
||||
opacity: 0.5;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
&__spinner {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border: 2px solid rgba(255, 255, 255, 0.3);
|
||||
border-top-color: $white;
|
||||
border-radius: 50%;
|
||||
animation: primary-btn-spin 0.6s linear infinite;
|
||||
}
|
||||
|
||||
&__text {
|
||||
color: $white;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes primary-btn-spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
38
apps/miniprogram/src/components/ui/PrimaryButton/index.tsx
Normal file
38
apps/miniprogram/src/components/ui/PrimaryButton/index.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import React from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import './index.scss';
|
||||
|
||||
interface PrimaryButtonProps {
|
||||
children: React.ReactNode;
|
||||
onClick?: () => void;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
size?: 'default' | 'large';
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const PrimaryButton: React.FC<PrimaryButtonProps> = ({
|
||||
children,
|
||||
onClick,
|
||||
disabled = false,
|
||||
loading = false,
|
||||
size = 'default',
|
||||
className = '',
|
||||
}) => {
|
||||
const cls = [
|
||||
'primary-btn',
|
||||
`primary-btn--${size}`,
|
||||
disabled && 'primary-btn--disabled',
|
||||
loading && 'primary-btn--loading',
|
||||
className,
|
||||
].filter(Boolean).join(' ');
|
||||
|
||||
return (
|
||||
<View className={cls} onClick={!disabled && !loading ? onClick : undefined}>
|
||||
{loading && <View className='primary-btn__spinner' />}
|
||||
<Text className='primary-btn__text'>{children}</Text>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
export default React.memo(PrimaryButton);
|
||||
Reference in New Issue
Block a user