Author SHA1 Message Date
张翔 db517a2da8 fix: 更新测试用例适配 API 路径变更和 userType 参数
- Gateway 测试路径从 /api/auth/ 更新为 /api/admin/auth/
- 移除 /api/checkIn/ 公开路径测试,替换为 /api/admin/auth/ 前缀测试
- SysAuthHandlerTest generateToken stub 增加 ADMIN userType 参数
2026-06-03 11:59:15 +08:00
张翔 5237dfc1cb feat: Web 管理后台及 e2e 测试适配 API 路径变更
- e2e-tests API 路径统一更新为 /api/admin/ 和 /api/member/ 前缀
- Gateway isPublicPath 更新为 /api/admin/auth/ 和 /api/member/auth/
- Gateway 签名白名单路径更新
- 移除已废弃的 /api/checkIn/ 和 /api/auth/login 公开路径
2026-06-03 11:51:47 +08:00
张翔 981d8ef211 feat(security): SecurityConfig 路径规则适配 admin/member 前缀
- /api/auth/** 拆分为 /api/admin/auth/** 和 /api/member/auth/**
- 移除 /** 全放行规则,收紧安全策略
- 诊断路径更新为 /api/admin/diagnostic/**
2026-06-03 11:44:44 +08:00
张翔 244c599a82 feat(router): API 路径规范化,统一 admin/member 前缀
- 后台管理 API 统一前缀 /api/admin/**
- 前台会员 API 统一前缀 /api/member/**
- 签到路由从 /api/checkIn 迁移到 /api/member/checkIn
- 会员卡/交易路由统一到 /api/admin/ 下
2026-06-03 11:43:09 +08:00
张翔 c822719f51 feat(auth): MemberHandler 按 userType 校验区分管理员与会员
- admin 方法使用 getAdminUserIdOrThrow 校验 ADMIN 身份
- 会员自身方法使用 getMemberUserIdOrThrow 校验 MEMBER 身份
2026-06-03 11:41:00 +08:00
张翔 9753d7ebf5 feat(auth): AuthUtil 增加 getAdminUserIdOrThrow 和 getMemberUserIdOrThrow
- getAdminUserIdOrThrow: 校验 userType=ADMIN,否则返回 403
- getMemberUserIdOrThrow: 校验 userType=MEMBER,否则返回 403
- 保留 getMemberIdOrThrow 向后兼容
2026-06-03 11:29:47 +08:00
张翔 5c5bc6419a feat(auth): 内部 JwtAuthenticationFilter 增加 userType 传递
- 从 Token 解析 userType 并存入 authentication.details
- 供下游 AuthUtil 获取 userType 进行权限校验
2026-06-03 11:28:40 +08:00
张翔 47e9a65497 feat(auth): WechatAuthServiceImpl 生成 MEMBER 类型 Token,WechatLoginVO 增加 userType
- 微信登录时显式传入 userType=MEMBER 生成 Token
- WechatLoginVO 增加 userType 字段,登录响应返回 userType=MEMBER
2026-06-03 11:27:47 +08:00
张翔 1a58ee63d2 feat(auth): SysAuthHandler 生成 ADMIN 类型 Token,AuthResponse 增加 userType
- SysAuthHandler 登录时显式传入 userType=ADMIN
- AuthResponse 增加 userType 字段及四参数构造函数
- 旧三参数构造函数默认 userType=ADMIN
2026-06-03 11:25:52 +08:00
张翔 0e7918b31e feat(auth): Gateway JwtAuthenticationFilter 增加路径-userType 校验
- /api/admin/** 路径只允许 userType=ADMIN 访问
- /api/member/** 路径只允许 userType=MEMBER 访问
- 越权访问返回 403 Forbidden
- 请求头增加 X-User-Type 传递 userType
- isPublicPath 统一 /api/member/auth/ 为公开路径
- 补充 userType 路径校验相关单元测试
2026-06-03 11:24:24 +08:00
张翔 0e73bd4520 feat(auth): Gateway JwtUtil 增加 userType 解析支持
- 新增三参数 generateToken 方法,支持传入 userType
- 旧方法默认 userType=ADMIN,保持向后兼容
- 新增 getUserTypeFromToken 方法解析 Token 中的 userType
2026-06-03 11:22:09 +08:00
张翔 f66ff5c8f8 feat(auth): JwtTokenProvider 增加 userType 字段,支持 ADMIN/MEMBER 区分
- 新增四参数 generateToken 方法,支持传入 userType
- 旧方法默认 userType=ADMIN,保持向后兼容
- 新增 getUserTypeFromToken 方法解析 Token 中的 userType
- 补充 userType 相关单元测试
2026-06-03 11:21:20 +08:00
张翔 005c09c99c feat(auth): 添加 UserType 枚举常量,区分 ADMIN 和 MEMBER 用户类型 2026-06-03 11:17:25 +08:00
future 08cf82ac83 签到模块 2026-06-02 09:56:37 +08:00
104 changed files with 1583 additions and 5191 deletions
+7 -7
View File
@@ -5,7 +5,7 @@ test.describe('认证和授权测试', () => {
let userId: number;
test.beforeAll(async ({ request }) => {
const response = await request.post('http://localhost:8080/api/auth/login', {
const response = await request.post('http://localhost:8080/api/admin/auth/login', {
headers: {
'Content-Type': 'application/json'
},
@@ -28,7 +28,7 @@ test.describe('认证和授权测试', () => {
});
await test.step('发送登录请求', async () => {
const response = await page.request.post('http://localhost:8080/api/auth/login', {
const response = await page.request.post('http://localhost:8080/api/admin/auth/login', {
headers: {
'Content-Type': 'application/json'
},
@@ -78,7 +78,7 @@ test.describe('认证和授权测试', () => {
});
await test.step('查询指定用户信息', async () => {
const response = await page.request.get(`http://localhost:8080/api/users/${userId}`, {
const response = await page.request.get(`http://localhost:8080/api/admin/users/${userId}`, {
headers: {
'Authorization': `Bearer ${authToken}`
}
@@ -98,10 +98,10 @@ test.describe('认证和授权测试', () => {
test('权限验证测试', async ({ page }) => {
await test.step('测试访问受保护的API', async () => {
const protectedEndpoints = [
'/api/users',
'/api/roles',
'/api/menus',
'/api/config'
'/api/admin/users',
'/api/admin/roles',
'/api/admin/menus',
'/api/admin/config'
];
for (const endpoint of protectedEndpoints) {
+1 -1
View File
@@ -4,7 +4,7 @@ test.describe('参数配置功能测试', () => {
let authToken: string;
test.beforeAll(async ({ request }) => {
const response = await request.post('http://localhost:8080/api/auth/login', {
const response = await request.post('http://localhost:8080/api/admin/auth/login', {
headers: {
'Content-Type': 'application/json'
},
+1 -1
View File
@@ -4,7 +4,7 @@ test.describe('字典管理功能测试', () => {
let authToken: string;
test.beforeAll(async ({ request }) => {
const response = await request.post('http://localhost:8080/api/auth/login', {
const response = await request.post('http://localhost:8080/api/admin/auth/login', {
headers: {
'Content-Type': 'application/json'
},
+6 -6
View File
@@ -269,7 +269,7 @@ async function verifyAllServices(): Promise<void> {
console.log(' 验证网关到后端的连通性...');
try {
const response = await fetch('http://localhost:8080/api/auth/login', {
const response = await fetch('http://localhost:8080/api/admin/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username: 'admin', password: 'Test@123' }),
@@ -316,7 +316,7 @@ async function waitForBackendReady(): Promise<void> {
console.log(`✅ 后端服务健康检查通过 (尝试 ${i + 1}/${maxRetries})`);
try {
const loginTest = await fetch('http://localhost:8084/api/auth/login', {
const loginTest = await fetch('http://localhost:8084/api/admin/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username: 'admin', password: 'Test@123' }),
@@ -364,7 +364,7 @@ async function waitForGatewayReady(): Promise<void> {
console.log(`✅ 网关服务健康检查通过 (尝试 ${i + 1}/${maxRetries})`);
try {
const loginTest = await fetch('http://localhost:8080/api/auth/login', {
const loginTest = await fetch('http://localhost:8080/api/admin/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username: 'admin', password: 'Test@123' }),
@@ -425,7 +425,7 @@ async function waitForFrontendReady(): Promise<void> {
async function cleanupTestData(): Promise<void> {
try {
// 登录获取token(通过网关)
const loginResponse = await fetch('http://localhost:8080/api/auth/login', {
const loginResponse = await fetch('http://localhost:8080/api/admin/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@@ -458,7 +458,7 @@ async function cleanupTestData(): Promise<void> {
for (const user of users) {
if (user.id > 10) {
try {
await fetch(`http://localhost:8080/api/users/${user.id}`, {
await fetch(`http://localhost:8080/api/admin/users/${user.id}`, {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${token}`
@@ -486,7 +486,7 @@ async function cleanupTestData(): Promise<void> {
for (const role of roles) {
if (role.id > 4) {
try {
await fetch(`http://localhost:8080/api/roles/${role.id}`, {
await fetch(`http://localhost:8080/api/admin/roles/${role.id}`, {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${token}`
@@ -50,7 +50,7 @@ test.describe('管理员完整工作流', () => {
await test.step('提交表单', async () => {
const [response] = await Promise.all([
page.waitForResponse(resp =>
resp.url().includes('/api/roles') && resp.request().method() === 'POST',
resp.url().includes('/api/admin/roles') && resp.request().method() === 'POST',
{ timeout: 10000 }
).catch(() => null),
page.locator('.el-dialog button:has-text("确定")').click()
@@ -112,7 +112,7 @@ test.describe('用户权限边界验证', () => {
});
await test.step('尝试访问受限API', async () => {
const response = await page.request.get('/api/users?page=0&size=10');
const response = await page.request.get('/api/admin/users?page=0&size=10');
expect([200, 401, 403]).toContain(response.status());
});
});
+1 -1
View File
@@ -4,7 +4,7 @@ test.describe('菜单管理功能测试', () => {
let authToken: string;
test.beforeAll(async ({ request }) => {
const response = await request.post('http://localhost:8080/api/auth/login', {
const response = await request.post('http://localhost:8080/api/admin/auth/login', {
headers: {
'Content-Type': 'application/json'
},
+10 -10
View File
@@ -10,7 +10,7 @@ export class ApiClient {
}
async login(username: string, password: string): Promise<{ token: string; userId: number }> {
const response = await this.request.post(`${this.baseURL}/api/auth/login`, {
const response = await this.request.post(`${this.baseURL}/api/admin/auth/login`, {
data: {
username,
password,
@@ -29,7 +29,7 @@ export class ApiClient {
}
async logout(token: string): Promise<void> {
await this.request.post(`${this.baseURL}/api/auth/logout`, {
await this.request.post(`${this.baseURL}/api/admin/auth/logout`, {
headers: {
Authorization: `Bearer ${token}`,
},
@@ -37,7 +37,7 @@ export class ApiClient {
}
async getUsers(token: string): Promise<any[]> {
const response = await this.request.get(`${this.baseURL}/api/users`, {
const response = await this.request.get(`${this.baseURL}/api/admin/users`, {
headers: {
Authorization: `Bearer ${token}`,
},
@@ -51,7 +51,7 @@ export class ApiClient {
}
async createUser(token: string, userData: any): Promise<any> {
const response = await this.request.post(`${this.baseURL}/api/users`, {
const response = await this.request.post(`${this.baseURL}/api/admin/users`, {
headers: {
Authorization: `Bearer ${token}`,
},
@@ -66,7 +66,7 @@ export class ApiClient {
}
async updateUser(token: string, userId: number, userData: any): Promise<any> {
const response = await this.request.put(`${this.baseURL}/api/users/${userId}`, {
const response = await this.request.put(`${this.baseURL}/api/admin/users/${userId}`, {
headers: {
Authorization: `Bearer ${token}`,
},
@@ -81,7 +81,7 @@ export class ApiClient {
}
async deleteUser(token: string, userId: number): Promise<void> {
const response = await this.request.delete(`${this.baseURL}/api/users/${userId}`, {
const response = await this.request.delete(`${this.baseURL}/api/admin/users/${userId}`, {
headers: {
Authorization: `Bearer ${token}`,
},
@@ -93,7 +93,7 @@ export class ApiClient {
}
async getRoles(token: string): Promise<any[]> {
const response = await this.request.get(`${this.baseURL}/api/roles`, {
const response = await this.request.get(`${this.baseURL}/api/admin/roles`, {
headers: {
Authorization: `Bearer ${token}`,
},
@@ -107,7 +107,7 @@ export class ApiClient {
}
async createRole(token: string, roleData: any): Promise<any> {
const response = await this.request.post(`${this.baseURL}/api/roles`, {
const response = await this.request.post(`${this.baseURL}/api/admin/roles`, {
headers: {
Authorization: `Bearer ${token}`,
},
@@ -122,7 +122,7 @@ export class ApiClient {
}
async deleteRole(token: string, roleId: number): Promise<void> {
const response = await this.request.delete(`${this.baseURL}/api/roles/${roleId}`, {
const response = await this.request.delete(`${this.baseURL}/api/admin/roles/${roleId}`, {
headers: {
Authorization: `Bearer ${token}`,
},
@@ -134,7 +134,7 @@ export class ApiClient {
}
async getMenus(token: string): Promise<any[]> {
const response = await this.request.get(`${this.baseURL}/api/menus`, {
const response = await this.request.get(`${this.baseURL}/api/admin/menus`, {
headers: {
Authorization: `Bearer ${token}`,
},
+4 -4
View File
@@ -55,7 +55,7 @@ export class TestDataManager {
}
static async createTestUser(request: APIRequestContext, userData: TestUser): Promise<any> {
const response = await request.post(`${this.apiBaseUrl}/api/users`, {
const response = await request.post(`${this.apiBaseUrl}/api/admin/users`, {
data: userData,
});
@@ -75,7 +75,7 @@ export class TestDataManager {
}
static async createTestRole(request: APIRequestContext, roleData: TestRole): Promise<any> {
const response = await request.post(`${this.apiBaseUrl}/api/roles`, {
const response = await request.post(`${this.apiBaseUrl}/api/admin/roles`, {
data: roleData,
});
@@ -100,7 +100,7 @@ export class TestDataManager {
return;
}
const response = await request.delete(`${this.apiBaseUrl}/api/users/${userData.id}`);
const response = await request.delete(`${this.apiBaseUrl}/api/admin/users/${userData.id}`);
if (!response.ok()) {
console.warn(`Failed to delete test user ${username}: ${await response.text()}`);
}
@@ -114,7 +114,7 @@ export class TestDataManager {
return;
}
const response = await request.delete(`${this.apiBaseUrl}/api/roles/${roleData.id}`);
const response = await request.delete(`${this.apiBaseUrl}/api/admin/roles/${roleData.id}`);
if (!response.ok()) {
console.warn(`Failed to delete test role ${roleKey}: ${await response.text()}`);
}
+48
View File
@@ -0,0 +1,48 @@
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# Virtual machine crash logs
hs_err_pid*
replay_pid*
# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
# IDE
.idea/
*.iml
.vscode/
.settings/
.classpath
.project
# OS
.DS_Store
Thumbs.db
+242
View File
@@ -0,0 +1,242 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.novalon.gym.manage</groupId>
<artifactId>gym-manage-api</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>gym-checkIn</artifactId>
<packaging>jar</packaging>
<name>Gym CheckIn</name>
<description>Check-In Management Module - Member Attendance Services</description>
<dependencies>
<dependency>
<groupId>cn.novalon.gym.manage</groupId>
<artifactId>manage-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>cn.novalon.gym.manage</groupId>
<artifactId>manage-db</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-spring-boot3</artifactId>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-reactor</artifactId>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.21.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>1.21.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>1.21.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>r2dbc-postgresql</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.25</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.5.1</version>
</dependency>
<!-- 添加 ZXing JavaSE 扩展(用于生成图片) -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>21</source>
<target>21</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.5.5.Final</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>check</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.60</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.8.6.0</version>
<dependencies>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs</artifactId>
<version>4.8.6</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>spotbugs-check</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<effort>Max</effort>
<threshold>High</threshold>
<failOnError>true</failOnError>
<excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,46 @@
package cn.novalon.gym.manage.checkIn.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Data
@Configuration
@ConfigurationProperties(prefix = "qr.config")
public class QRCodeConfig {
/**
* 二维码宽度(像素)
*/
private Integer width = 300;
/**
* 二维码高度(像素)
*/
private Integer height = 300;
/**
* 白边宽度
*/
private Integer margin = 1;
/**
* 容错率:L, M, Q, H
*/
private String errorCorrection = "M";
/**
* 图片格式:png, jpg
*/
private String format = "png";
/**
* 是否启用Logo
*/
private Boolean logoEnabled = false;
/**
* Logo路径
*/
private String logoPath = "";
}
@@ -0,0 +1,43 @@
package cn.novalon.gym.manage.checkIn.config;
import cn.novalon.gym.manage.checkIn.websocket.MyWebSocketHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.HandlerMapping;
import org.springframework.web.reactive.handler.SimpleUrlHandlerMapping;
import org.springframework.web.reactive.socket.WebSocketHandler;
import org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter;
import java.util.HashMap;
import java.util.Map;
@Configuration
public class WebSocketConfig {
@Autowired
private MyWebSocketHandler myWebSocketHandler;
/**
* 注册 WebSocket 路由映射
* 路径对应前端连接的 ws://xxx/webSocket/checkIn
*/
@Bean
public HandlerMapping webSocketMapping() {
Map<String, WebSocketHandler> map = new HashMap<>();
map.put("/webSocket/checkIn", myWebSocketHandler);
SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
mapping.setUrlMap(map);
mapping.setOrder(10); // 设置优先级
return mapping;
}
/**
* 注册 WebSocket 处理器适配器(必须)
*/
@Bean
public WebSocketHandlerAdapter handlerAdapter() {
return new WebSocketHandlerAdapter();
}
}
@@ -0,0 +1,43 @@
package cn.novalon.gym.manage.checkIn.constant;
import java.time.LocalDate;
import java.util.UUID;
/**
* 打卡模块 Redis 键常量
*
* @author 付嘉
* @date 2026-05-30
*/
public final class QRRedisKey {
private static final String SEPARATOR = ":";
private static final String QRCODE_USER_DAILY = "qrcode:user:daily";
private static final String QRCODE_CONTENT = "QR_";
private QRRedisKey() {
// 私有构造,防止实例化
}
/**
* 用户当日二维码
* 格式:qrcode:user:daily:{userId}:{date}
* 示例:qrcode:user:daily:1001:2026-05-30
*/
public static String qrcodeUserDaily(Long userId, LocalDate date) {
return QRCODE_USER_DAILY + SEPARATOR + userId + SEPARATOR + date;
}
/**
* 用户当日二维码(今天)
*/
public static String qrcodeUserToday(Long userId) {
return qrcodeUserDaily(userId, LocalDate.now());
}
/**
* 生成二维码内容(每个用户每次调用都不同)
*/
public static String generateQrcodeContent() {
return QRCODE_CONTENT + UUID.randomUUID().toString().replace("-", "");
}
}
@@ -0,0 +1,13 @@
package cn.novalon.gym.manage.checkIn.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class QRCodeDto {
private String qrContent;
private boolean isUsed;
}
@@ -0,0 +1,41 @@
package cn.novalon.gym.manage.checkIn.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("sign_in_record")
public class SignInRecord {
@Id
private Long id;
// 会员ID
@Column("member_id")
private Long memberId;
// 签到日期
@Column("sign_in_date")
private LocalDate signInDate;
// 签到时间
@Column("sign_in_time")
private LocalDateTime signInTime;
// 创建时间
@CreatedDate
@Column("created_at")
private LocalDateTime createdAt;
}
@@ -0,0 +1,69 @@
package cn.novalon.gym.manage.checkIn.handler;
import cn.novalon.gym.manage.checkIn.service.impl.CheckServiceImpl;
import cn.novalon.gym.manage.sys.util.AuthUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;
import java.util.Map;
@Slf4j
@Component
@RequiredArgsConstructor
public class CheckInHandler {
private final AuthUtil authUtil;
private final CheckServiceImpl checkService;
/**
* 签到
*
* POST /api/checkIn
*
*/
public Mono<ServerResponse> checkIn(ServerRequest request) {
Long memberId = 1L;
// authUtil.getMemberIdOrThrow(request);
return request.bodyToMono(Map.class)
.flatMap(body -> {
String qrContent = (String) body.get("qrContent");
log.info("收到签到请求, memberId: {}, qrContent: {}", memberId, qrContent);
return checkService.checkIn(memberId, qrContent)
.flatMap(result -> ServerResponse.ok()
.contentType(MediaType.APPLICATION_JSON)
.bodyValue(Map.of("code", 200, "message", "签到成功")));
})
.onErrorResume(e -> {
log.error("签到失败", e);
return ServerResponse.status(HttpStatus.BAD_REQUEST)
.bodyValue(Map.of("code", 400, "message", e.getMessage()));
});
}
/**
* 获取二维码
*
* GET /api/checkin/qrcode
*
*/
public Mono<ServerResponse> getQRCode(ServerRequest request) {
Long memberId = 1L;
// authUtil.getMemberIdOrThrow(request);
log.info("收到用户{}获取二维码请求", memberId);
return checkService.getQRCode(memberId)
.flatMap(qrCodeVo -> ServerResponse.ok()
.contentType(MediaType.APPLICATION_JSON)
.bodyValue(qrCodeVo));
}
}
@@ -0,0 +1,11 @@
package cn.novalon.gym.manage.checkIn.service;
import cn.novalon.gym.manage.checkIn.vo.QRCodeVo;
import reactor.core.publisher.Mono;
public interface ICheckInService {
Mono<QRCodeVo> getQRCode(Long memberId);
Mono<String> checkIn(Long memberId, String qrContent);
}
@@ -0,0 +1,97 @@
package cn.novalon.gym.manage.checkIn.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.extra.qrcode.QrConfig;
import cn.hutool.json.JSONUtil;
import cn.novalon.gym.manage.checkIn.config.QRCodeConfig;
import cn.novalon.gym.manage.checkIn.constant.QRRedisKey;
import cn.novalon.gym.manage.checkIn.service.ICheckInService;
import cn.novalon.gym.manage.checkIn.vo.QRCodeVo;
import cn.novalon.gym.manage.common.constant.RedisKeyConstants;
import cn.novalon.gym.manage.common.util.RedisUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.HashMap;
import java.util.Map;
@Slf4j
@Service
@RequiredArgsConstructor
public class CheckServiceImpl implements ICheckInService {
@Autowired
private final QRCodeConfig qrCodeConfig;
private final RedisUtil redisUtil;
@Override
public Mono<QRCodeVo> getQRCode(Long memberId) {
log.info("开始查询会员信息");
// TODO: 获取会员信息 - 查会员卡有效期/剩余次数,过期返回,先查缓存,缓存不存在则查数据库
// if (member有效期过了) throw new RuntimeException("会员有效期已过,拒绝生成二维码");
log.info("会员信息查询完成");
log.info("开始生成二维码");
String qrContent = QRRedisKey.generateQrcodeContent();
Map<String, Object> redisMap = new HashMap<>();
redisMap.put("qrContent", qrContent);
redisMap.put("isUsed", false);
return redisUtil.setWithExpire(
RedisKeyConstants.QRCODE_USER_DAILY+memberId+LocalDate.now(),
redisMap,
getSecondsUntilEndOfDay()
)
.then(Mono.fromSupplier(() -> {
String qrCodeBase64 = QrCodeUtil.generateAsBase64(qrContent,
BeanUtil.copyProperties(qrCodeConfig, QrConfig.class), "png");
return new QRCodeVo(qrCodeBase64,false,qrCodeConfig.getWidth(),qrCodeConfig.getHeight());
}));
}
@Override
public Mono<String> checkIn(Long memberId, String qrContent) {
String key = RedisKeyConstants.QRCODE_USER_DAILY+memberId+LocalDate.now();
return redisUtil.get(key)
.flatMap(cachedQrContent -> {
if (cachedQrContent != null) {
// 匹配成功,执行签到逻辑
Map<String, Object> map = JSONUtil.parseObj(cachedQrContent);
if(map.get("qrContent").equals(qrContent)){
if((boolean)map.get("isUsed")){
log.error("重复签到");
throw new RuntimeException("您已经在"+map.get("checkInTime")+"完成签到,请勿重复签到");
}
log.info("二维码匹配成功,memberId: {}", memberId);
// TODO查会员卡缓存,按照卡有效期进行扣减次数,没有缓存查数据库
map.put("isUsed", true);
map.put("checkInTime", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
return redisUtil.set(key,map).
then(Mono.just("签到成功"));
}
}
throw new RuntimeException("二维码无效");
})
.switchIfEmpty(Mono.error(new RuntimeException("二维码已过期或不存在")));
}
private long getSecondsUntilEndOfDay() {
LocalDateTime now = LocalDateTime.now();
LocalDateTime endOfDay = now.toLocalDate().atTime(23, 59, 59);
if (now.isAfter(endOfDay)) return 1;
return ChronoUnit.SECONDS.between(now, endOfDay);
}
}
@@ -0,0 +1,17 @@
package cn.novalon.gym.manage.checkIn.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class QRCodeVo {
private String qrCodeBase64;
private boolean isUsed;
private Integer width;
private Integer height;
}
@@ -0,0 +1,98 @@
package cn.novalon.gym.manage.checkIn.websocket;
import cn.hutool.json.JSONUtil;
import cn.novalon.gym.manage.checkIn.dto.QRCodeDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.socket.WebSocketHandler;
import org.springframework.web.reactive.socket.WebSocketMessage;
import org.springframework.web.reactive.socket.WebSocketSession;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Slf4j
@Component
public class MyWebSocketHandler implements WebSocketHandler {
// 存储所有连接
private static final Map<String, WebSocketSession> sessions = new ConcurrentHashMap<>();
@Override
public Mono<Void> handle(WebSocketSession session) {
String sessionId = session.getId();
// 连接建立
sessions.put(sessionId, session);
log.info("WebSocket 连接建立,sessionId{},当前连接数:{}", sessionId, sessions.size());
// 处理接收到的消息
Flux<WebSocketMessage> output = session.receive()
.doOnNext(message -> {
String payload = message.getPayloadAsText();
log.info("收到消息:{}", payload);
})
.map(message -> {
String payload = message.getPayloadAsText();
String response = processMessage(payload, sessionId);
return session.textMessage(response);
});
// 连接关闭时清理
return session.send(output)
.doFinally(signalType -> {
sessions.remove(sessionId);
log.info("WebSocket 连接关闭,sessionId{},剩余连接数:{}", sessionId, sessions.size());
});
}
/**
* 处理消息逻辑
*/
private String processMessage(String message, String sessionId) {
try {
// 解析 QRCodeDto
QRCodeDto qrCodeDto = JSONUtil.toBean(message, QRCodeDto.class);
String response;
// 判断二维码是否有效
if (qrCodeDto.getQrContent() != null
&& !qrCodeDto.getQrContent().isEmpty()
&& !qrCodeDto.isUsed()) {
// 有效:qrContent 有值且 isUsed 为 false
response = "正在进行签到";
// 可选:将二维码标记为已使用(需要调用后端服务)
// checkInService.handleCheckIn(qrCodeDto.getQrContent());
log.info("二维码有效,sessionId{}qrContent{}", sessionId, qrCodeDto.getQrContent());
} else {
// 无效:qrContent 为空 或 isUsed 为 true
String reason = "";
if (qrCodeDto.getQrContent() == null || qrCodeDto.getQrContent().isEmpty()) {
reason = "二维码内容为空";
} else if (qrCodeDto.isUsed()) {
reason = "二维码已被使用";
}
response = "二维码无效:" + reason;
log.warn("二维码无效,sessionId{},原因:{}", sessionId, reason);
}
return response;
} catch (Exception e) {
log.error("解析消息失败,sessionId{}", sessionId, e);
return "消息格式错误";
}
}
/**
* 获取当前在线连接数
*/
public static int getOnlineCount() {
return sessions.size();
}
}
@@ -0,0 +1,10 @@
# 二维码配置
qr:
config:
width: 300 # 二维码宽度(像素)
height: 300 # 二维码高度(像素)
margin: 1 # 白边宽度(像素)
format: png # 图片格式:png / jpg
error-correction: L #容错率:L, M, Q, H,如果启用Logologo-enabled: true),必须设置为 H
logo-enabled: false # 是否启用Logo(启用时error-correction必须为H
# logo-path: static/logo.png # Logo图片路径(支持相对路径或绝对路径)
@@ -0,0 +1,12 @@
package cn.novalon.gym.manage.checkin;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
public class CheckInModuleTest {
@Test
public void contextLoads() {
}
}
@@ -0,0 +1 @@
# Test Configuration
+5 -1
View File
@@ -128,7 +128,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<!-- Redis响应式支持(会员卡模块需要) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
</dependency>
</dependencies>
<build>
@@ -43,7 +43,7 @@ public class MemberHandler {
@Operation(summary = "获取会员信息", description = "根据当前登录用户获取会员基本信息")
public Mono<ServerResponse> getMemberInfo(ServerRequest request) {
Long memberId = authUtil.getMemberIdOrThrow(request);
Long memberId = authUtil.getMemberUserIdOrThrow(request);
log.info("获取会员信息, memberId: {}", memberId);
@@ -56,7 +56,7 @@ public class MemberHandler {
@Operation(summary = "更新会员信息", description = "更新会员昵称、性别、生日、头像、地址等信息")
public Mono<ServerResponse> updateMemberInfo(ServerRequest request) {
Long memberId = authUtil.getMemberIdOrThrow(request);
Long memberId = authUtil.getMemberUserIdOrThrow(request);
log.info("更新会员信息, memberId: {}", memberId);
@@ -70,7 +70,7 @@ public class MemberHandler {
@Operation(summary = "绑定手机号", description = "通过微信小程序手机号code绑定会员手机号")
public Mono<ServerResponse> bindPhone(ServerRequest request) {
Long memberId = authUtil.getMemberIdOrThrow(request);
Long memberId = authUtil.getMemberUserIdOrThrow(request);
String phoneCode = request.queryParam("phoneCode").orElse("");
@@ -87,7 +87,7 @@ public class MemberHandler {
@Operation(summary = "查询服务号关注状态", description = "查询会员是否关注微信服务号")
public Mono<ServerResponse> checkSubscribeStatus(ServerRequest request) {
Long memberId = authUtil.getMemberIdOrThrow(request);
Long memberId = authUtil.getMemberUserIdOrThrow(request);
log.info("查询服务号关注状态, memberId: {}", memberId);
@@ -102,7 +102,7 @@ public class MemberHandler {
@Operation(summary = "管理员更新手机号", description = "后台管理员为会员更新手机号")
public Mono<ServerResponse> adminUpdatePhone(ServerRequest request) {
Long adminId = authUtil.getMemberIdOrThrow(request);
Long adminId = authUtil.getAdminUserIdOrThrow(request);
String memberIdStr = request.pathVariable("id");
long memberId = NumberUtils.toLong(memberIdStr, 0L);
@@ -134,7 +134,7 @@ public class MemberHandler {
@Operation(summary = "管理员查看会员详情", description = "后台管理员查看指定会员的详细信息")
public Mono<ServerResponse> adminGetMemberInfo(ServerRequest request) {
Long adminId = authUtil.getMemberIdOrThrow(request);
Long adminId = authUtil.getAdminUserIdOrThrow(request);
String memberIdStr = request.pathVariable("id");
long memberId = NumberUtils.toLong(memberIdStr, 0L);
@@ -162,7 +162,7 @@ public class MemberHandler {
@Operation(summary = "管理员编辑会员信息", description = "后台管理员编辑会员信息")
public Mono<ServerResponse> adminUpdateMemberInfo(ServerRequest request) {
Long adminId = authUtil.getMemberIdOrThrow(request);
Long adminId = authUtil.getAdminUserIdOrThrow(request);
String memberIdStr = request.pathVariable("id");
long memberId = NumberUtils.toLong(memberIdStr, 0L);
@@ -181,7 +181,7 @@ public class MemberHandler {
@Operation(summary = "搜索会员列表", description = "后台管理员按关键词搜索会员,支持性别筛选和分页")
public Mono<ServerResponse> searchMembers(ServerRequest request) {
Long adminId = authUtil.getMemberIdOrThrow(request);
Long adminId = authUtil.getAdminUserIdOrThrow(request);
String keyword = request.queryParam("searchValue").orElse(null);
Integer pageNum = NumberUtils.toInt(request.queryParam("pageNum").orElse("1"), 1);
@@ -212,7 +212,7 @@ public class MemberHandler {
@Operation(summary = "查看会员列表", description = "后台管理员分页查看所有会员列表")
public Mono<ServerResponse> getAllMembers(ServerRequest request) {
Long adminId = authUtil.getMemberIdOrThrow(request);
Long adminId = authUtil.getAdminUserIdOrThrow(request);
int pageNum = NumberUtils.toInt(request.queryParam("pageNum").orElse("1"), 1);
int pageSize = NumberUtils.toInt(request.queryParam("pageSize").orElse("10"), 10);
@@ -3,7 +3,7 @@ package cn.novalon.gym.manage.member.service.impl;
import cn.novalon.gym.manage.member.entity.MemberCardRecord;
import cn.novalon.gym.manage.member.repository.MemberCardRecordRepository;
import cn.novalon.gym.manage.member.service.IMemberCardRecordService;
import cn.novalon.gym.manage.member.util.RedisUtil;
import cn.novalon.gym.manage.common.util.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@@ -1,5 +1,6 @@
package cn.novalon.gym.manage.member.service.impl;
import cn.novalon.gym.manage.common.util.RedisUtil;
import cn.novalon.gym.manage.member.entity.MemberCard;
import cn.novalon.gym.manage.member.entity.MemberCardRecord;
import cn.novalon.gym.manage.member.entity.MemberCardTransaction;
@@ -15,7 +16,7 @@ import cn.novalon.gym.manage.member.repository.MemberCardRecordRepository;
import cn.novalon.gym.manage.member.repository.MemberCardRepository;
import cn.novalon.gym.manage.member.service.IMemberCardService;
import cn.novalon.gym.manage.member.service.IMemberCardTransactionService;
import cn.novalon.gym.manage.member.util.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@@ -17,7 +17,7 @@ import cn.novalon.gym.manage.member.service.MemberService;
import cn.novalon.gym.manage.member.util.AesUtil;
import cn.novalon.gym.manage.member.util.BeanConvertUtil;
import cn.novalon.gym.manage.member.util.EsSyncUtils;
import cn.novalon.gym.manage.member.util.RedisUtil;
import cn.novalon.gym.manage.common.util.RedisUtil;
import cn.novalon.gym.manage.member.vo.MemberCardInfoVO;
import cn.novalon.gym.manage.member.vo.MemberDetailVO;
import cn.novalon.gym.manage.member.vo.MemberInfoVO;
@@ -5,7 +5,7 @@ import cn.novalon.gym.manage.member.entity.RefundApplication;
import cn.novalon.gym.manage.member.enums.RefundStatus;
import cn.novalon.gym.manage.member.repository.RefundApplicationRepository;
import cn.novalon.gym.manage.member.service.IRefundApplicationService;
import cn.novalon.gym.manage.member.util.RedisUtil;
import cn.novalon.gym.manage.common.util.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;
@@ -4,7 +4,7 @@ import cn.novalon.gym.manage.common.exception.ErrorCode;
import cn.novalon.gym.manage.common.exception.SystemException;
import cn.novalon.gym.manage.member.config.WechatProperties;
import cn.novalon.gym.manage.member.service.WechatApiService;
import cn.novalon.gym.manage.member.util.RedisUtil;
import cn.novalon.gym.manage.common.util.RedisUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
@@ -16,7 +16,7 @@ import cn.novalon.gym.manage.member.service.WechatAuthService;
import cn.novalon.gym.manage.member.util.AesUtil;
import cn.novalon.gym.manage.member.util.EsSyncUtils;
import cn.novalon.gym.manage.member.util.MemberNoGenerator;
import cn.novalon.gym.manage.member.util.RedisUtil;
import cn.novalon.gym.manage.common.util.RedisUtil;
import cn.novalon.gym.manage.member.util.WechatPhoneUtil;
import cn.novalon.gym.manage.member.vo.WechatLoginVO;
import cn.novalon.gym.manage.sys.security.JwtTokenProvider;
@@ -303,9 +303,9 @@ public class WechatAuthServiceImpl implements WechatAuthService {
}
List<String> roles = new ArrayList<>();
String accessToken = jwtTokenProvider.generateToken(String.valueOf(member.getId()), member.getId(), roles);
String accessToken = jwtTokenProvider.generateToken(String.valueOf(member.getId()), member.getId(), roles, "MEMBER");
log.info("JWT Token 生成成功, memberId: {}", member.getId());
log.info("JWT Token 生成成功, memberId: {}, userType=MEMBER", member.getId());
int expiresIn = 86400;
@@ -316,6 +316,7 @@ public class WechatAuthServiceImpl implements WechatAuthService {
.expiresIn(expiresIn)
.isNewUser(isNewUser)
.needCompleteInfo(needCompleteInfo)
.userType("MEMBER")
.build();
}
}
@@ -8,7 +8,7 @@ import cn.novalon.gym.manage.member.es.repository.MemberESRepository;
import cn.novalon.gym.manage.member.repository.IMemberRepository;
import cn.novalon.gym.manage.member.service.WechatOfficialService;
import cn.novalon.gym.manage.member.util.EsSyncUtils;
import cn.novalon.gym.manage.member.util.RedisUtil;
import cn.novalon.gym.manage.common.util.RedisUtil;
import cn.novalon.gym.manage.member.vo.WechatUserInfoVO;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -35,4 +35,7 @@ public class WechatLoginVO {
// 是否需要补全信息(昵称、手机号等)
private Boolean needCompleteInfo;
// 用户类型(MEMBER
private String userType;
}
+5
View File
@@ -43,6 +43,11 @@
<artifactId>gym-member</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>cn.novalon.gym.manage</groupId>
<artifactId>gym-checkIn</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -1,6 +1,7 @@
package cn.novalon.gym.manage.app.config;
import cn.novalon.gym.manage.checkIn.handler.CheckInHandler;
import cn.novalon.gym.manage.file.handler.SysFileHandler;
import cn.novalon.gym.manage.member.handler.MemberCardHandler;
import cn.novalon.gym.manage.member.handler.MemberCardRecordHandler;
@@ -33,7 +34,7 @@ import static org.springframework.web.reactive.function.server.RouterFunctions.r
*
* 文件定义:配置WebFlux函数式路由,将HTTP请求映射到对应的Handler方法
* 涉及业务:用户、角色、字典、菜单、公告、文件等所有RESTful API路由
* 算法:使用RouterFunctions.route()构建函数式路由规则
* 路由规范:后台管理 API 统一前缀 /api/admin/**,前台会员 API 统一前缀 /api/member/**
*
* @author 张翔
* @date 2026-03-13
@@ -62,154 +63,155 @@ public class SystemRouter {
PasswordDiagnosticHandler passwordDiagnosticHandler,
MemberCardHandler memberCardHandler,
MemberCardRecordHandler memberCardRecordHandler,
MemberCardTransactionHandler memberCardTransactionHandler) {
MemberCardTransactionHandler memberCardTransactionHandler,
CheckInHandler checkInHandler) {
return route()
// ========== 诊断路由 ==========
.GET("/api/diagnostic/password", passwordDiagnosticHandler::diagnose)
// ========== 诊断路由(管理端) ==========
.GET("/api/admin/diagnostic/password", passwordDiagnosticHandler::diagnose)
// ========== 字典路由 ==========
.GET("/api/dictionaries", dictionaryHandler::getAllDictionaries)
.GET("/api/dictionaries/{id}", dictionaryHandler::getDictionaryById)
.GET("/api/dictionaries/type/{type}", dictionaryHandler::getDictionariesByType)
.GET("/api/dictionaries/check/exists", dictionaryHandler::checkTypeAndCodeExists)
.POST("/api/dictionaries", dictionaryHandler::createDictionary)
.PUT("/api/dictionaries/{id}", dictionaryHandler::updateDictionary)
.DELETE("/api/dictionaries/{id}", dictionaryHandler::deleteDictionary)
// ========== 字典路由(管理端) ==========
.GET("/api/admin/dictionaries", dictionaryHandler::getAllDictionaries)
.GET("/api/admin/dictionaries/{id}", dictionaryHandler::getDictionaryById)
.GET("/api/admin/dictionaries/type/{type}", dictionaryHandler::getDictionariesByType)
.GET("/api/admin/dictionaries/check/exists", dictionaryHandler::checkTypeAndCodeExists)
.POST("/api/admin/dictionaries", dictionaryHandler::createDictionary)
.PUT("/api/admin/dictionaries/{id}", dictionaryHandler::updateDictionary)
.DELETE("/api/admin/dictionaries/{id}", dictionaryHandler::deleteDictionary)
// ========== 用户路由 ==========
.GET("/api/users", userHandler::getAllUsers)
.GET("/api/users/page", userHandler::getUsersByPage)
.GET("/api/users/count", userHandler::getUserCount)
.GET("/api/users/username/{username}", userHandler::getUserByUsername)
.GET("/api/users/check/username", userHandler::checkUsernameExists)
.GET("/api/users/check/email", userHandler::checkEmailExists)
.POST("/api/users", userHandler::createUser)
.GET("/api/users/{id}", userHandler::getUserById)
.PUT("/api/users/{id}", userHandler::updateUser)
.DELETE("/api/users/{id}", userHandler::deleteUser)
.POST("/api/users/{id}/action/change-password", userHandler::changePassword)
.POST("/api/users/{id}/action/logical-delete", userHandler::logicalDeleteUser)
.POST("/api/users/logical-delete", userHandler::logicalDeleteUsers)
.POST("/api/users/action/restore", userHandler::restoreUsers)
.POST("/api/users/{id}/action/restore", userHandler::restoreUser)
.GET("/api/users/{id}/roles", userHandler::getUserRoles)
.POST("/api/users/{id}/roles", userHandler::assignRoles)
// ========== 用户路由(管理端) ==========
.GET("/api/admin/users", userHandler::getAllUsers)
.GET("/api/admin/users/page", userHandler::getUsersByPage)
.GET("/api/admin/users/count", userHandler::getUserCount)
.GET("/api/admin/users/username/{username}", userHandler::getUserByUsername)
.GET("/api/admin/users/check/username", userHandler::checkUsernameExists)
.GET("/api/admin/users/check/email", userHandler::checkEmailExists)
.POST("/api/admin/users", userHandler::createUser)
.GET("/api/admin/users/{id}", userHandler::getUserById)
.PUT("/api/admin/users/{id}", userHandler::updateUser)
.DELETE("/api/admin/users/{id}", userHandler::deleteUser)
.POST("/api/admin/users/{id}/action/change-password", userHandler::changePassword)
.POST("/api/admin/users/{id}/action/logical-delete", userHandler::logicalDeleteUser)
.POST("/api/admin/users/logical-delete", userHandler::logicalDeleteUsers)
.POST("/api/admin/users/action/restore", userHandler::restoreUsers)
.POST("/api/admin/users/{id}/action/restore", userHandler::restoreUser)
.GET("/api/admin/users/{id}/roles", userHandler::getUserRoles)
.POST("/api/admin/users/{id}/roles", userHandler::assignRoles)
// ========== 菜单路由 ==========
.GET("/api/menus", menuHandler::getAllMenus)
.GET("/api/menus/tree", menuHandler::getMenuTree)
.GET("/api/menus/{id}", menuHandler::getMenuById)
.POST("/api/menus", menuHandler::createMenu)
.PUT("/api/menus/{id}", menuHandler::updateMenu)
.DELETE("/api/menus/{id}", menuHandler::deleteMenu)
// ========== 菜单路由(管理端) ==========
.GET("/api/admin/menus", menuHandler::getAllMenus)
.GET("/api/admin/menus/tree", menuHandler::getMenuTree)
.GET("/api/admin/menus/{id}", menuHandler::getMenuById)
.POST("/api/admin/menus", menuHandler::createMenu)
.PUT("/api/admin/menus/{id}", menuHandler::updateMenu)
.DELETE("/api/admin/menus/{id}", menuHandler::deleteMenu)
// ========== 角色路由 ==========
.GET("/api/roles", roleHandler::getAllRoles)
.GET("/api/roles/page", roleHandler::getRolesByPage)
.GET("/api/roles/count", roleHandler::getRoleCount)
.GET("/api/roles/name/{roleName}", roleHandler::getRoleByName)
.GET("/api/roles/check-name", roleHandler::checkNameExists)
.GET("/api/roles/{id}", roleHandler::getRoleById)
.POST("/api/roles", roleHandler::createRole)
.PUT("/api/roles/{id}", roleHandler::updateRole)
.DELETE("/api/roles/{id}", roleHandler::deleteRole)
.POST("/api/roles/{id}/restore", roleHandler::restoreRole)
.GET("/api/roles/{id}/permissions", permissionHandler::getPermissionsByRoleId)
.POST("/api/roles/{id}/permissions", permissionHandler::assignPermissionsToRole)
// ========== 角色路由(管理端) ==========
.GET("/api/admin/roles", roleHandler::getAllRoles)
.GET("/api/admin/roles/page", roleHandler::getRolesByPage)
.GET("/api/admin/roles/count", roleHandler::getRoleCount)
.GET("/api/admin/roles/name/{roleName}", roleHandler::getRoleByName)
.GET("/api/admin/roles/check-name", roleHandler::checkNameExists)
.GET("/api/admin/roles/{id}", roleHandler::getRoleById)
.POST("/api/admin/roles", roleHandler::createRole)
.PUT("/api/admin/roles/{id}", roleHandler::updateRole)
.DELETE("/api/admin/roles/{id}", roleHandler::deleteRole)
.POST("/api/admin/roles/{id}/restore", roleHandler::restoreRole)
.GET("/api/admin/roles/{id}/permissions", permissionHandler::getPermissionsByRoleId)
.POST("/api/admin/roles/{id}/permissions", permissionHandler::assignPermissionsToRole)
// ========== 配置路由 ==========
.GET("/api/config", configHandler::getAllConfigs)
.GET("/api/config/{id}", configHandler::getConfigById)
.GET("/api/config/key/{configKey}", configHandler::getConfigByKey)
.POST("/api/config", configHandler::createConfig)
.PUT("/api/config/{id}", configHandler::updateConfig)
.DELETE("/api/config/{id}", configHandler::deleteConfig)
// ========== 配置路由(管理端) ==========
.GET("/api/admin/config", configHandler::getAllConfigs)
.GET("/api/admin/config/{id}", configHandler::getConfigById)
.GET("/api/admin/config/key/{configKey}", configHandler::getConfigByKey)
.POST("/api/admin/config", configHandler::createConfig)
.PUT("/api/admin/config/{id}", configHandler::updateConfig)
.DELETE("/api/admin/config/{id}", configHandler::deleteConfig)
// ========== 日志路由 ==========
.GET("/api/logs/login", logHandler::getAllLoginLogs)
.GET("/api/logs/login/page", logHandler::getLoginLogsByPage)
.GET("/api/logs/login/count", logHandler::getLoginLogCount)
.GET("/api/logs/login/today/count", logHandler::getTodayLoginCount)
.GET("/api/logs/login/recent", logHandler::getRecentLoginLogs)
.GET("/api/logs/login/{id}", logHandler::getLoginLogById)
.POST("/api/logs/login", logHandler::createLoginLog)
.GET("/api/logs/exception", logHandler::getAllExceptionLogs)
.GET("/api/logs/exception/page", logHandler::getExceptionLogsByPage)
.GET("/api/logs/exception/count", logHandler::getExceptionLogCount)
.GET("/api/logs/exception/{id}", logHandler::getExceptionLogById)
.POST("/api/logs/exception", logHandler::createExceptionLog)
.GET("/api/logs/operation", operationLogHandler::getAllOperationLogs)
.GET("/api/logs/operation/export", operationLogHandler::exportOperationLogs)
.GET("/api/logs/operation/page", operationLogHandler::getOperationLogsByPage)
.GET("/api/logs/operation/count", operationLogHandler::getOperationLogCount)
.GET("/api/logs/operation/{id}", operationLogHandler::getOperationLogById)
.POST("/api/logs/operation", operationLogHandler::createOperationLog)
// ========== 日志路由(管理端) ==========
.GET("/api/admin/logs/login", logHandler::getAllLoginLogs)
.GET("/api/admin/logs/login/page", logHandler::getLoginLogsByPage)
.GET("/api/admin/logs/login/count", logHandler::getLoginLogCount)
.GET("/api/admin/logs/login/today/count", logHandler::getTodayLoginCount)
.GET("/api/admin/logs/login/recent", logHandler::getRecentLoginLogs)
.GET("/api/admin/logs/login/{id}", logHandler::getLoginLogById)
.POST("/api/admin/logs/login", logHandler::createLoginLog)
.GET("/api/admin/logs/exception", logHandler::getAllExceptionLogs)
.GET("/api/admin/logs/exception/page", logHandler::getExceptionLogsByPage)
.GET("/api/admin/logs/exception/count", logHandler::getExceptionLogCount)
.GET("/api/admin/logs/exception/{id}", logHandler::getExceptionLogById)
.POST("/api/admin/logs/exception", logHandler::createExceptionLog)
.GET("/api/admin/logs/operation", operationLogHandler::getAllOperationLogs)
.GET("/api/admin/logs/operation/export", operationLogHandler::exportOperationLogs)
.GET("/api/admin/logs/operation/page", operationLogHandler::getOperationLogsByPage)
.GET("/api/admin/logs/operation/count", operationLogHandler::getOperationLogCount)
.GET("/api/admin/logs/operation/{id}", operationLogHandler::getOperationLogById)
.POST("/api/admin/logs/operation", operationLogHandler::createOperationLog)
// ========== 认证路由 ==========
.POST("/api/auth/login", authHandler::login)
.POST("/api/auth/register", authHandler::register)
.POST("/api/auth/logout", authHandler::logout)
// ========== 认证路由(管理端) ==========
.POST("/api/admin/auth/login", authHandler::login)
.POST("/api/admin/auth/register", authHandler::register)
.POST("/api/admin/auth/logout", authHandler::logout)
// ========== 统计路由 ==========
.GET("/api/stats/overview", statsHandler::getOverview)
// ========== 统计路由(管理端) ==========
.GET("/api/admin/stats/overview", statsHandler::getOverview)
// ========== 数据字典路由 ==========
.GET("/api/dict/types", dictHandler::getAllDictTypes)
.GET("/api/dict/types/{id}", dictHandler::getDictTypeById)
.GET("/api/dict/types/type/{dictType}", dictHandler::getDictTypeByType)
.POST("/api/dict/types", dictHandler::createDictType)
.PUT("/api/dict/types/{id}", dictHandler::updateDictType)
.DELETE("/api/dict/types/{id}", dictHandler::deleteDictType)
.GET("/api/dict/data", dictHandler::getAllDictData)
.GET("/api/dict/data/type/{dictType}", dictHandler::getDictDataByType)
.GET("/api/dict/data/{id}", dictHandler::getDictDataById)
.POST("/api/dict/data", dictHandler::createDictData)
.PUT("/api/dict/data/{id}", dictHandler::updateDictData)
.DELETE("/api/dict/data/{id}", dictHandler::deleteDictData)
// ========== 数据字典路由(管理端) ==========
.GET("/api/admin/dict/types", dictHandler::getAllDictTypes)
.GET("/api/admin/dict/types/{id}", dictHandler::getDictTypeById)
.GET("/api/admin/dict/types/type/{dictType}", dictHandler::getDictTypeByType)
.POST("/api/admin/dict/types", dictHandler::createDictType)
.PUT("/api/admin/dict/types/{id}", dictHandler::updateDictType)
.DELETE("/api/admin/dict/types/{id}", dictHandler::deleteDictType)
.GET("/api/admin/dict/data", dictHandler::getAllDictData)
.GET("/api/admin/dict/data/type/{dictType}", dictHandler::getDictDataByType)
.GET("/api/admin/dict/data/{id}", dictHandler::getDictDataById)
.POST("/api/admin/dict/data", dictHandler::createDictData)
.PUT("/api/admin/dict/data/{id}", dictHandler::updateDictData)
.DELETE("/api/admin/dict/data/{id}", dictHandler::deleteDictData)
// ========== 公告路由 ==========
.GET("/api/notices", noticeHandler::getAllNotices)
.GET("/api/notices/{id}", noticeHandler::getNoticeById)
.GET("/api/notices/status/{status}", noticeHandler::getNoticesByStatus)
.POST("/api/notices", noticeHandler::createNotice)
.PUT("/api/notices/{id}", noticeHandler::updateNotice)
.DELETE("/api/notices/{id}", noticeHandler::deleteNotice)
// ========== 公告路由(管理端) ==========
.GET("/api/admin/notices", noticeHandler::getAllNotices)
.GET("/api/admin/notices/{id}", noticeHandler::getNoticeById)
.GET("/api/admin/notices/status/{status}", noticeHandler::getNoticesByStatus)
.POST("/api/admin/notices", noticeHandler::createNotice)
.PUT("/api/admin/notices/{id}", noticeHandler::updateNotice)
.DELETE("/api/admin/notices/{id}", noticeHandler::deleteNotice)
// ========== 消息路由 ==========
.GET("/api/messages/user/{userId}", messageHandler::getMessagesByUser)
.GET("/api/messages/user/{userId}/unread", messageHandler::getUnreadCount)
.GET("/api/messages/user/{userId}/unread/list", messageHandler::getUnreadList)
.POST("/api/messages", messageHandler::createMessage)
.PUT("/api/messages/{id}/read", messageHandler::markAsRead)
.DELETE("/api/messages/{id}", messageHandler::deleteMessage)
// ========== 消息路由(管理端) ==========
.GET("/api/admin/messages/user/{userId}", messageHandler::getMessagesByUser)
.GET("/api/admin/messages/user/{userId}/unread", messageHandler::getUnreadCount)
.GET("/api/admin/messages/user/{userId}/unread/list", messageHandler::getUnreadList)
.POST("/api/admin/messages", messageHandler::createMessage)
.PUT("/api/admin/messages/{id}/read", messageHandler::markAsRead)
.DELETE("/api/admin/messages/{id}", messageHandler::deleteMessage)
// ========== 文件路由 ==========
.GET("/api/files", fileHandler::getAllFiles)
.GET("/api/files/{id}", fileHandler::getFileById)
.POST("/api/files/upload", fileHandler::uploadFile)
.GET("/api/files/{id}/download", fileHandler::downloadFile)
.GET("/api/files/download/{fileName}", fileHandler::downloadFileByName)
.GET("/api/files/{id}/preview", fileHandler::previewFile)
.GET("/api/files/preview/{fileName}", fileHandler::previewFileByName)
.DELETE("/api/files/{id}", fileHandler::deleteFile)
// ========== 文件路由(管理端) ==========
.GET("/api/admin/files", fileHandler::getAllFiles)
.GET("/api/admin/files/{id}", fileHandler::getFileById)
.POST("/api/admin/files/upload", fileHandler::uploadFile)
.GET("/api/admin/files/{id}/download", fileHandler::downloadFile)
.GET("/api/admin/files/download/{fileName}", fileHandler::downloadFileByName)
.GET("/api/admin/files/{id}/preview", fileHandler::previewFile)
.GET("/api/admin/files/preview/{fileName}", fileHandler::previewFileByName)
.DELETE("/api/admin/files/{id}", fileHandler::deleteFile)
// ========== 权限路由 ==========
.GET("/api/permissions", permissionHandler::getAllPermissions)
.GET("/api/permissions/{id}", permissionHandler::getPermissionById)
.GET("/api/permissions/code/{code}", permissionHandler::getPermissionByCode)
.GET("/api/permissions/check-code", permissionHandler::checkCodeExists)
.GET("/api/permissions/count", permissionHandler::getPermissionCount)
.POST("/api/permissions", permissionHandler::createPermission)
.PUT("/api/permissions/{id}", permissionHandler::updatePermission)
.DELETE("/api/permissions/{id}", permissionHandler::deletePermission)
// ========== 权限路由(管理端) ==========
.GET("/api/admin/permissions", permissionHandler::getAllPermissions)
.GET("/api/admin/permissions/{id}", permissionHandler::getPermissionById)
.GET("/api/admin/permissions/code/{code}", permissionHandler::getPermissionByCode)
.GET("/api/admin/permissions/check-code", permissionHandler::checkCodeExists)
.GET("/api/admin/permissions/count", permissionHandler::getPermissionCount)
.POST("/api/admin/permissions", permissionHandler::createPermission)
.PUT("/api/admin/permissions/{id}", permissionHandler::updatePermission)
.DELETE("/api/admin/permissions/{id}", permissionHandler::deletePermission)
// ========== 会员模块路由 - 微信认证 ==========
// ========== 会员模块路由 - 微信认证(前台公开) ==========
.POST("/api/member/auth/miniapp/login", wechatAuthHandler::miniappLogin)
.GET("/api/member/auth/mp/callback", wechatAuthHandler::verifyMpSignature)
.POST("/api/member/auth/mp/callback", wechatAuthHandler::mpCallback)
// ========== 会员模块路由 - 会员信息 ==========
// ========== 会员模块路由 - 会员信息(前台) ==========
.GET("/api/member/info", memberHandler::getMemberInfo)
.PUT("/api/member/info", memberHandler::updateMemberInfo)
.POST("/api/member/phone/bind", memberHandler::bindPhone)
@@ -224,32 +226,35 @@ public class SystemRouter {
// ========================================
// ========== 会员卡管理路由 ==============
// ========== 会员卡管理路由(管理端) ==============
// ========================================
// ===== 会员卡类型管理 =====
.GET("/api/member-cards/active", memberCardHandler::getActiveCards)
.GET("/api/member-cards/{memberCardId}", memberCardHandler::getMemberCardById)
.POST("/api/member-cards", memberCardHandler::createMemberCard)
.GET("/api/admin/member-cards/active", memberCardHandler::getActiveCards)
.GET("/api/admin/member-cards/{memberCardId}", memberCardHandler::getMemberCardById)
.POST("/api/admin/member-cards", memberCardHandler::createMemberCard)
// ===== 会员卡记录管理(核心业务)=====
.POST("/api/member-card-records/purchase", memberCardRecordHandler::purchaseCard)
.POST("/api/member-card-records/{recordId}/renew", memberCardRecordHandler::renewCard)
.POST("/api/member-card-records/{recordId}/use", memberCardRecordHandler::useCard)
.POST("/api/member-card-records/{recordId}/refund", memberCardRecordHandler::refundCard)
.GET("/api/member-card-records/my-cards/{memberId}", memberCardRecordHandler::getMyCards)
.GET("/api/member-card-records/{recordId}", memberCardRecordHandler::getMemberCardRecordById)
.POST("/api/member-card-records/process-expired", memberCardRecordHandler::processExpiredCards)
.POST("/api/admin/member-card-records/purchase", memberCardRecordHandler::purchaseCard)
.POST("/api/admin/member-card-records/{recordId}/renew", memberCardRecordHandler::renewCard)
.POST("/api/admin/member-card-records/{recordId}/use", memberCardRecordHandler::useCard)
.POST("/api/admin/member-card-records/{recordId}/refund", memberCardRecordHandler::refundCard)
.GET("/api/admin/member-card-records/my-cards/{memberId}", memberCardRecordHandler::getMyCards)
.GET("/api/admin/member-card-records/{recordId}", memberCardRecordHandler::getMemberCardRecordById)
.POST("/api/admin/member-card-records/process-expired", memberCardRecordHandler::processExpiredCards)
// ===== 会员卡交易流水管理 =====
.POST("/api/member-card-transactions", memberCardTransactionHandler::insertTransaction)
.GET("/api/member-card-transactions", memberCardTransactionHandler::getTransactionsWithConditions)
.GET("/api/member-card-transactions/member/{memberId}", memberCardTransactionHandler::getMemberTransactions)
.GET("/api/member-card-transactions/card/{cardId}", memberCardTransactionHandler::getTransactionsByCardId)
.GET("/api/member-card-transactions/statistics/deduct/{cardId}", memberCardTransactionHandler::getDeductCountByCardId)
.GET("/api/member-card-transactions/statistics/renew", memberCardTransactionHandler::getRenewAmountByTimeRange)
.GET("/api/member-card-transactions/statistics/purchase/{memberId}", memberCardTransactionHandler::getPurchaseAmountByMember)
.POST("/api/admin/member-card-transactions", memberCardTransactionHandler::insertTransaction)
.GET("/api/admin/member-card-transactions", memberCardTransactionHandler::getTransactionsWithConditions)
.GET("/api/admin/member-card-transactions/member/{memberId}", memberCardTransactionHandler::getMemberTransactions)
.GET("/api/admin/member-card-transactions/card/{cardId}", memberCardTransactionHandler::getTransactionsByCardId)
.GET("/api/admin/member-card-transactions/statistics/deduct/{cardId}", memberCardTransactionHandler::getDeductCountByCardId)
.GET("/api/admin/member-card-transactions/statistics/renew", memberCardTransactionHandler::getRenewAmountByTimeRange)
.GET("/api/admin/member-card-transactions/statistics/purchase/{memberId}", memberCardTransactionHandler::getPurchaseAmountByMember)
// ========= 签到路由(前台会员) ==========
.POST("/api/member/checkIn", checkInHandler::checkIn)
.GET("/api/member/checkIn/qrcode", checkInHandler::getQRCode)
.build();
}
}
@@ -15,8 +15,8 @@ spring:
- org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration
r2dbc:
url: r2dbc:postgresql://${DB_HOST:localhost}:${DB_PORT:55432}/${DB_NAME:manage_system}
username: ${DB_USERNAME:novalon}
password: ${DB_PASSWORD:novalon123}
username: ${DB_USERNAME:postgres}
password: ${DB_PASSWORD:postgres}
pool:
initial-size: 10
max-size: 50
@@ -25,8 +25,8 @@ spring:
acquire-timeout: 5s
datasource:
url: jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:55432}/${DB_NAME:manage_system}
username: ${DB_USERNAME:novalon}
password: ${DB_PASSWORD:novalon123}
username: ${DB_USERNAME:postgres}
password: ${DB_PASSWORD:postgres}
driver-class-name: org.postgresql.Driver
flyway:
enabled: false
+4
View File
@@ -56,6 +56,10 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
</dependencies>
<build>
@@ -1,4 +1,4 @@
package cn.novalon.gym.manage.member.config;
package cn.novalon.gym.manage.common.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -0,0 +1,64 @@
package cn.novalon.gym.manage.common.constant;
/**
* Redis 缓存 Key 常量类
* 统一管理项目中所有 Redis 缓存的 key 前缀
*
* @author auto-generated
* @date 2026-05-30
*/
public final class RedisKeyConstants {
private RedisKeyConstants() {
}
// ==================== 会员模块 ====================
/**
* 会员信息缓存
* 格式:member:info:{memberId}
*/
public static final String MEMBER_INFO = "member:info:";
/**
* 会员详情缓存
* 格式:member:detail:{memberId}
*/
public static final String MEMBER_DETAIL = "member:detail:";
/**
* 会员卡类型缓存
* 格式:member:card:{memberCardId}
*/
public static final String MEMBER_CARD = "member:card:";
/**
* 会员卡记录缓存(包含剩余次数/金额)
* 格式:member:card:record:{recordId}
*/
public static final String MEMBER_CARD_RECORD = "member:card:record:";
/**
* 会员退款申请缓存
* 格式:member:refund:{recordId}
*/
public static final String MEMBER_REFUND = "member:refund:";
// ==================== 签到模块 ====================
/**
* 用户当日二维码缓存
* 格式:qrcode:user:daily:{userId}:{date}
* 示例:qrcode:user:daily:1:2026-05-30
*/
public static final String QRCODE_USER_DAILY = "qrcode:user:daily:";
// ==================== 微信模块 ====================
/**
* 微信 access_token 缓存
* 格式:wechat:access_token:{appType}
* appType: miniapp(小程序), mp(公众号)
*/
public static final String WECHAT_ACCESS_TOKEN = "wechat:access_token:";
}
@@ -0,0 +1,22 @@
package cn.novalon.gym.manage.common.constants;
/**
* 用户类型枚举
* 用于区分后台管理用户和前台会员用户
*/
public enum UserType {
ADMIN,
MEMBER;
public static UserType fromString(String value) {
if (value == null) {
throw new IllegalArgumentException("userType 不能为空");
}
for (UserType type : values()) {
if (type.name().equalsIgnoreCase(value)) {
return type;
}
}
throw new IllegalArgumentException("未知的用户类型: " + value);
}
}
@@ -1,4 +1,4 @@
package cn.novalon.gym.manage.member.util;
package cn.novalon.gym.manage.common.util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.ReactiveRedisTemplate;
@@ -42,6 +42,13 @@ public class JwtAuthenticationFilter extends AbstractGatewayFilterFactory<JwtAut
return exchange.getResponse().setComplete();
}
// 路径-userType 校验:防止越权访问
String userType = jwtUtil.getUserTypeFromToken(token);
if (!isUserTypeAllowedForPath(path, userType)) {
exchange.getResponse().setStatusCode(HttpStatus.FORBIDDEN);
return exchange.getResponse().setComplete();
}
String username = jwtUtil.getUsernameFromToken(token);
Long userId = jwtUtil.getUserIdFromToken(token);
@@ -49,18 +56,34 @@ public class JwtAuthenticationFilter extends AbstractGatewayFilterFactory<JwtAut
.header("X-User-Id", String.valueOf(userId))
.header("X-Member-Id", String.valueOf(userId))
.header("X-Username", username)
.header("X-User-Type", userType != null ? userType : "UNKNOWN")
.build();
return chain.filter(exchange.mutate().request(modifiedRequest).build());
};
}
/**
* 校验路径与 userType 是否匹配
* - /api/admin/** 路径只允许 userType=ADMIN
* - /api/member/** 路径只允许 userType=MEMBER
* - 其他路径不做 userType 校验
*/
private boolean isUserTypeAllowedForPath(String path, String userType) {
if (path.startsWith("/api/admin/")) {
return "ADMIN".equals(userType);
}
if (path.startsWith("/api/member/")) {
return "MEMBER".equals(userType);
}
// 非特定前缀路径不做 userType 校验
return true;
}
private boolean isPublicPath(String path) {
return path.startsWith("/api/auth/") ||
return path.startsWith("/api/admin/auth/") ||
path.equals("/actuator/health") ||
path.equals("/api/member/auth/miniapp/login") ||
path.equals("/api/member/auth/mp/callback") ||
path.equals("/api/auth/login") ||
path.startsWith("/api/member/auth/") ||
path.startsWith("/actuator/info");
}
@@ -63,7 +63,8 @@ public class RbacAuthorizationFilter extends AbstractGatewayFilterFactory<RbacAu
private boolean isPublicPath(String path) {
return path.startsWith("/api/auth/") ||
path.equals("/actuator/health") ||
path.startsWith("/actuator/info");
path.startsWith("/actuator/info") ||
path.startsWith("/api/checkIn/");
}
public static class Config {
@@ -28,6 +28,10 @@ public class JwtUtil {
}
public String generateToken(String username, Long userId) {
return generateToken(username, userId, "ADMIN");
}
public String generateToken(String username, Long userId, String userType) {
Date now = new Date();
Date expiryDate = new Date(now.getTime() + expiration);
@@ -35,13 +39,14 @@ public class JwtUtil {
String token = Jwts.builder()
.setSubject(username)
.claim("userId", userId)
.claim("userType", userType)
.claim("keyVersion", jwtKeyService.getCurrentKeyVersion())
.setIssuedAt(now)
.setExpiration(expiryDate)
.signWith(getSigningKey())
.compact();
logger.debug("Generated JWT token for user: {}, userId: {}", username, userId);
logger.debug("Generated JWT token for user: {}, userId: {}, userType: {}", username, userId, userType);
return token;
} catch (Exception e) {
@@ -74,6 +79,11 @@ public class JwtUtil {
return claims.get("userId", Long.class);
}
public String getUserTypeFromToken(String token) {
Claims claims = parseToken(token);
return claims.get("userType", String.class);
}
public boolean validateToken(String token) {
try {
parseToken(token);
@@ -64,7 +64,7 @@ signature:
max-age-minutes: ${SIGNATURE_MAX_AGE_MINUTES:5}
nonce-cache-size: ${SIGNATURE_NONCE_CACHE_SIZE:10000}
whitelist:
paths: ${SIGNATURE_WHITELIST_PATHS:/actuator/health,/actuator/info,/api/auth/login,/api/auth/register,/api/member/auth/miniapp/login,/api/member/auth/mp/callback}
paths: ${SIGNATURE_WHITELIST_PATHS:/actuator/health,/actuator/info,/api/admin/auth/login,/api/admin/auth/register,/api/member/auth/miniapp/login,/api/member/auth/mp/callback}
resilience:
enabled: ${RESILIENCE_ENABLED:true}
@@ -39,7 +39,7 @@ class GatewayJwtAuthenticationFilterTest {
@Test
void testPublicPath_AllowAccess() {
MockServerHttpRequest request = MockServerHttpRequest.get("/api/auth/login").build();
MockServerHttpRequest request = MockServerHttpRequest.get("/api/admin/auth/login").build();
exchange = MockServerWebExchange.from(request);
when(chain.filter(any(ServerWebExchange.class))).thenReturn(Mono.empty());
@@ -56,7 +56,7 @@ class GatewayJwtAuthenticationFilterTest {
@Test
void testPublicPath_Register() {
MockServerHttpRequest request = MockServerHttpRequest.post("/api/auth/register").build();
MockServerHttpRequest request = MockServerHttpRequest.post("/api/admin/auth/register").build();
exchange = MockServerWebExchange.from(request);
when(chain.filter(any(ServerWebExchange.class))).thenReturn(Mono.empty());
@@ -105,6 +105,40 @@ class GatewayJwtAuthenticationFilterTest {
verify(jwtUtil, never()).validateToken(anyString());
}
@Test
void testPublicPath_MemberAuth() {
MockServerHttpRequest request = MockServerHttpRequest.post("/api/member/auth/miniapp/login").build();
exchange = MockServerWebExchange.from(request);
when(chain.filter(any(ServerWebExchange.class))).thenReturn(Mono.empty());
Mono<Void> result = filter.apply(new JwtAuthenticationFilter.Config())
.filter(exchange, chain);
StepVerifier.create(result)
.verifyComplete();
verify(chain).filter(any(ServerWebExchange.class));
verify(jwtUtil, never()).validateToken(anyString());
}
@Test
void testPublicPath_AdminAuthPrefix() {
MockServerHttpRequest request = MockServerHttpRequest.post("/api/admin/auth/refresh").build();
exchange = MockServerWebExchange.from(request);
when(chain.filter(any(ServerWebExchange.class))).thenReturn(Mono.empty());
Mono<Void> result = filter.apply(new JwtAuthenticationFilter.Config())
.filter(exchange, chain);
StepVerifier.create(result)
.verifyComplete();
verify(chain).filter(any(ServerWebExchange.class));
verify(jwtUtil, never()).validateToken(anyString());
}
@Test
void testProtectedPath_NoAuthHeader() {
MockServerHttpRequest request = MockServerHttpRequest.get("/api/users").build();
@@ -152,6 +186,7 @@ class GatewayJwtAuthenticationFilterTest {
when(jwtUtil.isTokenExpired(validToken)).thenReturn(false);
when(jwtUtil.getUsernameFromToken(validToken)).thenReturn("testuser");
when(jwtUtil.getUserIdFromToken(validToken)).thenReturn(1L);
when(jwtUtil.getUserTypeFromToken(validToken)).thenReturn("ADMIN");
Mono<Void> result = filter.apply(new JwtAuthenticationFilter.Config())
.filter(exchange, chain);
@@ -163,6 +198,7 @@ class GatewayJwtAuthenticationFilterTest {
verify(jwtUtil).isTokenExpired(validToken);
verify(jwtUtil).getUsernameFromToken(validToken);
verify(jwtUtil).getUserIdFromToken(validToken);
verify(jwtUtil).getUserTypeFromToken(validToken);
verify(chain).filter(any(ServerWebExchange.class));
}
@@ -224,6 +260,7 @@ class GatewayJwtAuthenticationFilterTest {
when(jwtUtil.isTokenExpired(validToken)).thenReturn(false);
when(jwtUtil.getUsernameFromToken(validToken)).thenReturn("testuser");
when(jwtUtil.getUserIdFromToken(validToken)).thenReturn(1L);
when(jwtUtil.getUserTypeFromToken(validToken)).thenReturn("ADMIN");
Mono<Void> result = filter.apply(new JwtAuthenticationFilter.Config())
.filter(exchange, chain);
@@ -235,6 +272,7 @@ class GatewayJwtAuthenticationFilterTest {
verify(jwtUtil).isTokenExpired(validToken);
verify(jwtUtil).getUsernameFromToken(validToken);
verify(jwtUtil).getUserIdFromToken(validToken);
verify(jwtUtil).getUserTypeFromToken(validToken);
verify(chain).filter(any(ServerWebExchange.class));
}
@@ -251,6 +289,7 @@ class GatewayJwtAuthenticationFilterTest {
when(jwtUtil.isTokenExpired(validToken)).thenReturn(false);
when(jwtUtil.getUsernameFromToken(validToken)).thenReturn("testuser");
when(jwtUtil.getUserIdFromToken(validToken)).thenReturn(1L);
when(jwtUtil.getUserTypeFromToken(validToken)).thenReturn("ADMIN");
Mono<Void> result = filter.apply(new JwtAuthenticationFilter.Config())
.filter(exchange, chain);
@@ -263,11 +302,12 @@ class GatewayJwtAuthenticationFilterTest {
ServerHttpRequest modifiedRequest = exchangeCaptor.getValue().getRequest();
assert modifiedRequest.getHeaders().getFirst("X-User-Id").equals("1");
assert modifiedRequest.getHeaders().getFirst("X-Username").equals("testuser");
assert modifiedRequest.getHeaders().getFirst("X-User-Type").equals("ADMIN");
}
@Test
void testMixedPath_AuthPath() {
MockServerHttpRequest request = MockServerHttpRequest.get("/api/auth/logout").build();
void testMixedPath_AdminAuthPath() {
MockServerHttpRequest request = MockServerHttpRequest.get("/api/admin/auth/logout").build();
exchange = MockServerWebExchange.from(request);
when(chain.filter(any(ServerWebExchange.class))).thenReturn(Mono.empty());
@@ -295,6 +335,7 @@ class GatewayJwtAuthenticationFilterTest {
when(jwtUtil.isTokenExpired(validToken)).thenReturn(false);
when(jwtUtil.getUsernameFromToken(validToken)).thenReturn("testuser");
when(jwtUtil.getUserIdFromToken(validToken)).thenReturn(1L);
when(jwtUtil.getUserTypeFromToken(validToken)).thenReturn("ADMIN");
Mono<Void> result = filter.apply(new JwtAuthenticationFilter.Config())
.filter(exchange, chain);
@@ -308,4 +349,123 @@ class GatewayJwtAuthenticationFilterTest {
verify(jwtUtil).getUserIdFromToken(validToken);
verify(chain).filter(any(ServerWebExchange.class));
}
// ========== userType 路径校验测试 ==========
@Test
void testAdminPath_WithAdminToken_ShouldPass() {
String adminToken = "admin.jwt.token";
MockServerHttpRequest request = MockServerHttpRequest.get("/api/admin/users")
.header(HttpHeaders.AUTHORIZATION, "Bearer " + adminToken)
.build();
exchange = MockServerWebExchange.from(request);
when(chain.filter(any(ServerWebExchange.class))).thenReturn(Mono.empty());
when(jwtUtil.validateToken(adminToken)).thenReturn(true);
when(jwtUtil.isTokenExpired(adminToken)).thenReturn(false);
when(jwtUtil.getUsernameFromToken(adminToken)).thenReturn("admin");
when(jwtUtil.getUserIdFromToken(adminToken)).thenReturn(1L);
when(jwtUtil.getUserTypeFromToken(adminToken)).thenReturn("ADMIN");
Mono<Void> result = filter.apply(new JwtAuthenticationFilter.Config())
.filter(exchange, chain);
StepVerifier.create(result)
.verifyComplete();
verify(chain).filter(any(ServerWebExchange.class));
}
@Test
void testAdminPath_WithMemberToken_ShouldBeForbidden() {
String memberToken = "member.jwt.token";
MockServerHttpRequest request = MockServerHttpRequest.get("/api/admin/users")
.header(HttpHeaders.AUTHORIZATION, "Bearer " + memberToken)
.build();
exchange = MockServerWebExchange.from(request);
when(jwtUtil.validateToken(memberToken)).thenReturn(true);
when(jwtUtil.isTokenExpired(memberToken)).thenReturn(false);
when(jwtUtil.getUserTypeFromToken(memberToken)).thenReturn("MEMBER");
Mono<Void> result = filter.apply(new JwtAuthenticationFilter.Config())
.filter(exchange, chain);
StepVerifier.create(result)
.verifyComplete();
assert exchange.getResponse().getStatusCode() == HttpStatus.FORBIDDEN;
verify(chain, never()).filter(any(ServerWebExchange.class));
}
@Test
void testMemberPath_WithMemberToken_ShouldPass() {
String memberToken = "member.jwt.token";
MockServerHttpRequest request = MockServerHttpRequest.get("/api/member/info")
.header(HttpHeaders.AUTHORIZATION, "Bearer " + memberToken)
.build();
exchange = MockServerWebExchange.from(request);
when(chain.filter(any(ServerWebExchange.class))).thenReturn(Mono.empty());
when(jwtUtil.validateToken(memberToken)).thenReturn(true);
when(jwtUtil.isTokenExpired(memberToken)).thenReturn(false);
when(jwtUtil.getUsernameFromToken(memberToken)).thenReturn("123");
when(jwtUtil.getUserIdFromToken(memberToken)).thenReturn(123L);
when(jwtUtil.getUserTypeFromToken(memberToken)).thenReturn("MEMBER");
Mono<Void> result = filter.apply(new JwtAuthenticationFilter.Config())
.filter(exchange, chain);
StepVerifier.create(result)
.verifyComplete();
verify(chain).filter(any(ServerWebExchange.class));
}
@Test
void testMemberPath_WithAdminToken_ShouldBeForbidden() {
String adminToken = "admin.jwt.token";
MockServerHttpRequest request = MockServerHttpRequest.get("/api/member/info")
.header(HttpHeaders.AUTHORIZATION, "Bearer " + adminToken)
.build();
exchange = MockServerWebExchange.from(request);
when(jwtUtil.validateToken(adminToken)).thenReturn(true);
when(jwtUtil.isTokenExpired(adminToken)).thenReturn(false);
when(jwtUtil.getUserTypeFromToken(adminToken)).thenReturn("ADMIN");
Mono<Void> result = filter.apply(new JwtAuthenticationFilter.Config())
.filter(exchange, chain);
StepVerifier.create(result)
.verifyComplete();
assert exchange.getResponse().getStatusCode() == HttpStatus.FORBIDDEN;
verify(chain, never()).filter(any(ServerWebExchange.class));
}
@Test
void testNonPrefixedPath_NoUserTypeCheck() {
String adminToken = "admin.jwt.token";
// /api/users 不以 /api/admin/ 或 /api/member/ 开头,不做 userType 校验
MockServerHttpRequest request = MockServerHttpRequest.get("/api/users")
.header(HttpHeaders.AUTHORIZATION, "Bearer " + adminToken)
.build();
exchange = MockServerWebExchange.from(request);
when(chain.filter(any(ServerWebExchange.class))).thenReturn(Mono.empty());
when(jwtUtil.validateToken(adminToken)).thenReturn(true);
when(jwtUtil.isTokenExpired(adminToken)).thenReturn(false);
when(jwtUtil.getUsernameFromToken(adminToken)).thenReturn("admin");
when(jwtUtil.getUserIdFromToken(adminToken)).thenReturn(1L);
when(jwtUtil.getUserTypeFromToken(adminToken)).thenReturn("ADMIN");
Mono<Void> result = filter.apply(new JwtAuthenticationFilter.Config())
.filter(exchange, chain);
StepVerifier.create(result)
.verifyComplete();
verify(chain).filter(any(ServerWebExchange.class));
}
}
@@ -47,7 +47,8 @@ public class SecurityConfig {
.addFilterBefore(jwtAuthenticationFilter, SecurityWebFiltersOrder.AUTHENTICATION)
.addFilterAfter(operationLogWebFilter, SecurityWebFiltersOrder.AUTHORIZATION)
.authorizeExchange(spec -> {
spec.pathMatchers("/api/auth/**").permitAll()
spec.pathMatchers("/api/admin/auth/**").permitAll()
.pathMatchers("/api/member/auth/**").permitAll()
.pathMatchers("/api/public/**").permitAll()
.pathMatchers("/ws/**").permitAll()
.pathMatchers("/actuator/**").permitAll();
@@ -59,7 +60,7 @@ public class SecurityConfig {
.pathMatchers("/v3/api-docs/**").permitAll()
.pathMatchers("/swagger-resources/**").permitAll()
.pathMatchers("/webjars/**").permitAll()
.pathMatchers("/api/diagnostic/**").permitAll();
.pathMatchers("/api/admin/diagnostic/**").permitAll();
logger.info("SecurityConfig: Swagger路径和诊断端点已放行");
}
@@ -20,6 +20,9 @@ public class AuthResponse {
@Schema(description = "用户名", example = "admin")
private String username;
@Schema(description = "用户类型", example = "ADMIN")
private String userType;
public AuthResponse() {
}
@@ -27,6 +30,14 @@ public class AuthResponse {
this.token = token;
this.userId = userId;
this.username = username;
this.userType = "ADMIN";
}
public AuthResponse(String token, Long userId, String username, String userType) {
this.token = token;
this.userId = userId;
this.username = username;
this.userType = userType;
}
public String getToken() {
@@ -52,4 +63,12 @@ public class AuthResponse {
public void setUsername(String username) {
this.username = username;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
}
@@ -133,8 +133,9 @@ public class SysAuthHandler {
.generateToken(
user.getUsername(),
user.getId(),
roleKeys);
logger.info("用户登录成功: username={}, userId={}, roles={}",
roleKeys,
"ADMIN");
logger.info("用户登录成功: username={}, userId={}, roles={}, userType=ADMIN",
user.getUsername(),
user.getId(),
roleKeys);
@@ -146,7 +147,8 @@ public class SysAuthHandler {
AuthResponse response = new AuthResponse(
token,
user.getId(),
user.getUsername());
user.getUsername(),
"ADMIN");
return ServerResponse.ok()
.bodyValue(response);
});
@@ -37,6 +37,7 @@ public class JwtAuthenticationFilter implements WebFilter {
String username = jwtTokenProvider.getUsernameFromToken(token);
jwtTokenProvider.getUserIdFromToken(token);
List<String> roles = jwtTokenProvider.getRolesFromToken(token);
String userType = jwtTokenProvider.getUserTypeFromToken(token);
List<SimpleGrantedAuthority> authorities = roles.stream()
.map(role -> new SimpleGrantedAuthority("ROLE_" + role))
@@ -53,6 +54,9 @@ public class JwtAuthenticationFilter implements WebFilter {
authorities
);
// 将 userType 存入 authentication details,供后续 AuthUtil 使用
authentication.setDetails(userType);
return chain.filter(exchange)
.contextWrite(ReactiveSecurityContextHolder.withAuthentication(authentication));
}
@@ -32,24 +32,19 @@ public class JwtTokenProvider {
}
public String generateToken(String username, Long userId) {
Map<String, Object> claims = new HashMap<>();
claims.put("userId", userId);
claims.put("username", username);
return Jwts.builder()
.setClaims(claims)
.setSubject(username)
.setIssuedAt(new Date())
.setExpiration(new Date(System.currentTimeMillis() + jwtProperties.getExpiration()))
.signWith(getSigningKey())
.compact();
return generateToken(username, userId, java.util.Collections.emptyList(), "ADMIN");
}
public String generateToken(String username, Long userId, java.util.List<String> roles) {
return generateToken(username, userId, roles, "ADMIN");
}
public String generateToken(String username, Long userId, java.util.List<String> roles, String userType) {
Map<String, Object> claims = new HashMap<>();
claims.put("userId", userId);
claims.put("username", username);
claims.put("roles", roles);
claims.put("userType", userType);
return Jwts.builder()
.setClaims(claims)
@@ -85,6 +80,10 @@ public class JwtTokenProvider {
return java.util.Collections.emptyList();
}
public String getUserTypeFromToken(String token) {
return getClaimsFromToken(token).get("userType", String.class);
}
public boolean validateToken(String token) {
try {
getClaimsFromToken(token);
@@ -29,4 +29,38 @@ public class AuthUtil {
if (jwtTokenProvider.getUserIdFromToken(token) <= 0L) throw new IllegalArgumentException("ID无效");
return jwtTokenProvider.getUserIdFromToken(token);
}
/**
* 获取当前 ADMIN 用户 ID,校验 userType 必须为 ADMIN
*/
public Long getAdminUserIdOrThrow(ServerRequest request) {
String token = extractToken(request);
if (token == null) throw new ResponseStatusException(HttpStatus.UNAUTHORIZED, "缺少 Token");
if (!jwtTokenProvider.validateToken(token)) throw new ResponseStatusException(HttpStatus.UNAUTHORIZED, "Token 无效或已过期");
String userType = jwtTokenProvider.getUserTypeFromToken(token);
if (!"ADMIN".equals(userType)) {
log.warn("非管理员用户尝试访问管理端接口, userType={}", userType);
throw new ResponseStatusException(HttpStatus.FORBIDDEN, "无权访问管理端接口");
}
Long userId = jwtTokenProvider.getUserIdFromToken(token);
if (userId <= 0L) throw new IllegalArgumentException("ID无效");
return userId;
}
/**
* 获取当前 MEMBER 用户 ID,校验 userType 必须为 MEMBER
*/
public Long getMemberUserIdOrThrow(ServerRequest request) {
String token = extractToken(request);
if (token == null) throw new ResponseStatusException(HttpStatus.UNAUTHORIZED, "缺少 Token");
if (!jwtTokenProvider.validateToken(token)) throw new ResponseStatusException(HttpStatus.UNAUTHORIZED, "Token 无效或已过期");
String userType = jwtTokenProvider.getUserTypeFromToken(token);
if (!"MEMBER".equals(userType)) {
log.warn("非会员用户尝试访问会员接口, userType={}", userType);
throw new ResponseStatusException(HttpStatus.FORBIDDEN, "无权访问会员接口");
}
Long userId = jwtTokenProvider.getUserIdFromToken(token);
if (userId <= 0L) throw new IllegalArgumentException("ID无效");
return userId;
}
}
@@ -80,7 +80,7 @@ class SysAuthHandlerTest {
// 配置密码编码器Mock来验证密码
when(passwordEncoder.matches(rawPassword, realEncodedPassword)).thenReturn(true);
when(jwtTokenProvider.generateToken(eq("testuser"), eq(1L), anyList())).thenReturn("test_token");
when(jwtTokenProvider.generateToken(eq("testuser"), eq(1L), anyList(), eq("ADMIN"))).thenReturn("test_token");
// 使用测试数据工厂创建角色
SysRole mockRole = TestDataFactory.createUserRole();
@@ -103,7 +103,7 @@ class SysAuthHandlerTest {
.verifyComplete();
verify(userService).findByUsername("testuser");
verify(jwtTokenProvider).generateToken(eq("testuser"), eq(1L), anyList());
verify(jwtTokenProvider).generateToken(eq("testuser"), eq(1L), anyList(), eq("ADMIN"));
}
@Test
@@ -108,4 +108,52 @@ class JwtTokenProviderTest {
assertThat(isValid).isFalse();
}
@Test
void testGenerateTokenWithUserType() {
when(jwtProperties.getSecret()).thenReturn("test-secret-key-for-testing-purposes-only-1234567890");
when(jwtProperties.getExpiration()).thenReturn(3600000L);
String token = jwtTokenProvider.generateToken("testuser", 1L, java.util.List.of("admin"), "ADMIN");
assertThat(token).isNotNull();
assertThat(token).isNotEmpty();
}
@Test
void testGetUserTypeFromToken() {
when(jwtProperties.getSecret()).thenReturn("test-secret-key-for-testing-purposes-only-1234567890");
when(jwtProperties.getExpiration()).thenReturn(3600000L);
String token = jwtTokenProvider.generateToken("testuser", 1L, java.util.List.of("admin"), "ADMIN");
String userType = jwtTokenProvider.getUserTypeFromToken(token);
assertThat(userType).isEqualTo("ADMIN");
}
@Test
void testGetUserTypeFromToken_Member() {
when(jwtProperties.getSecret()).thenReturn("test-secret-key-for-testing-purposes-only-1234567890");
when(jwtProperties.getExpiration()).thenReturn(3600000L);
String token = jwtTokenProvider.generateToken("123", 123L, java.util.List.of(), "MEMBER");
String userType = jwtTokenProvider.getUserTypeFromToken(token);
assertThat(userType).isEqualTo("MEMBER");
}
@Test
void testGetUserTypeFromToken_DefaultIsAdmin() {
when(jwtProperties.getSecret()).thenReturn("test-secret-key-for-testing-purposes-only-1234567890");
when(jwtProperties.getExpiration()).thenReturn(3600000L);
// 使用旧的两参数方法生成的 token 默认 userType 为 ADMIN
String token = jwtTokenProvider.generateToken("testuser", 1L);
String userType = jwtTokenProvider.getUserTypeFromToken(token);
assertThat(userType).isEqualTo("ADMIN");
}
}
+1 -6
View File
@@ -43,6 +43,7 @@
<module>manage-notify</module>
<module>manage-file</module>
<module>gym-member</module>
<module>gym-checkIn</module>
</modules>
<dependencyManagement>
@@ -222,12 +223,6 @@
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!-- Redis响应式支持(会员卡模块需要) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
</dependency>
</dependencies>
<build>
-4
View File
@@ -1,4 +0,0 @@
node_modules/
unpackage/
.hbuilderx/
.DS_Store
-28
View File
@@ -1,28 +0,0 @@
<script>
export default {
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style lang="scss" scoped>
@import 'common/style/base.css';
/*每个页面公共css */
.app-container {
width: 100%;
min-height: 100vh;
max-width: 430px;
margin: 0 auto;
background-color: var(--bg-light);
position: relative;
overflow-x: hidden;
}
</style>
-130
View File
@@ -1,130 +0,0 @@
/**
* ============================================
* 健身房管理系统小程序 - 全局配色变量
* 主题:活力运动风格
* 主色调:深蓝专业 + 活力橙热情
* 兼容暗色/浅色模式基础,保证可访问性
* ============================================
*/
:root {
/* ========== 主品牌色 ========== */
--primary-dark: #0B2B4B; /* 深蓝主色 - 用于头部导航栏、重要按钮、品牌标识,体现专业信赖感 */
--primary-deep: #1A4A6F; /* 中深蓝色 - 用于hover状态、次级按钮、图标点缀,增加层次感 */
--primary-light: #2C6288; /* 浅蓝色(预留)- 用于选中态或辅助背景,保持和谐渐变 */
/* ========== 强调/行动色 ========== */
--accent-orange: #FF6B35; /* 活力橙 - 主要CTA按钮、会员标识、高亮徽章、关键数据,刺激行动力 */
--accent-orange-light: #FF8C5A; /* 浅橙色 - hover轻量背景、渐变辅助,带来温暖运动感 */
--accent-orange-dark: #E55A2B; /* 深橙色 - 按压状态或重要警告,保持色彩体系完整 */
/* ========== 背景色系 ========== */
--bg-light: #F9FAFE; /* 全局浅灰蓝背景 - 柔和且提升深蓝/橙色的视觉舒适度 */
--bg-white: #FFFFFF; /* 纯白卡片背景 - 用于内容卡片、表单区域,提高可读性与层次感 */
--bg-gray: #F2F5F9; /* 浅灰辅助背景 - 分割区域或禁用态背景 */
/* ========== 文本色系 ========== */
--text-dark: #1E2A3A; /* 主要文字 - 标题、正文,保证高对比度 */
--text-muted: #5E6F8D; /* 辅助文字 - 次要信息、占位符,保持易读性 */
--text-light: #8A99B4; /* 更浅文字 - 提示语、时间戳,但需注意与背景对比 */
--text-inverse: #FFFFFF; /* 反白文字 - 深色/橙色背景上的文字 */
/* ========== 边框/分割线 ========== */
--border-light: #E9EDF2; /* 浅边框 - 卡片分割、列表边界,细腻柔和 */
--border-focus: #FF6B35; /* 聚焦边框 - 输入框选中或强调区域,使用橙色点缀 */
/* ========== 状态颜色(功能性) ========== */
--success-green: #2ECC71; /* 成功绿 - 已完成课程、健康打卡 */
--warning-amber: #F39C12; /* 警示橙黄 - 提醒、到期提示 */
--error-red: #E74C3C; /* 错误红 - 异常情况或取消预约 */
--info-blue: #3498DB; /* 信息蓝 - 提示气泡、帮助文字 */
/* ========== 渐变色 (提升活力感) ========== */
--gradient-orange: linear-gradient(135deg, #FF6B35 0%, #FF8C5A 100%); /* 橙色渐变 - 会员按钮、重要徽章 */
--gradient-blue: linear-gradient(135deg, #0B2B4B 0%, #1A4A6F 100%); /* 深蓝渐变 - 头部banner或特别卡片 */
--gradient-subtle: linear-gradient(120deg, #F9FAFE 0%, #FFFFFF 100%); /* 微弱渐变 - 增加细节精致度 */
/* ========== 阴影层级 ========== */
--shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.03), 0 2px 6px rgba(0, 0, 0, 0.05); /* 卡片小阴影 轻量浮起 */
--shadow-md: 0 12px 28px rgba(0, 0, 0, 0.08); /* 中等阴影 - 弹窗或下拉菜单 */
--shadow-lg: 0 20px 35px rgba(0, 0, 0, 0.12); /* 大阴影 - 模态框、悬浮元素 */
--shadow-orange-glow: 0 4px 12px rgba(255, 107, 53, 0.25); /* 橙色光晕 - 增强CTA吸引力 */
/* ========== 圆角规范 (柔和运动风) ========== */
--radius-sm: 12px; /* 小组件、标签圆角 */
--radius-md: 20px; /* 标准卡片圆角 */
--radius-lg: 28px; /* 大容器、头部卡片圆角 */
--radius-full: 999px; /* 胶囊按钮、头像完全圆角 */
/* ========== 布局与间距 ========== */
--spacing-xs: 4px;
--spacing-sm: 8px;
--spacing-md: 16px;
--spacing-lg: 24px;
--spacing-xl: 32px;
/* ========== 字体 (移动端优先) ========== */
--font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
--font-size-xs: 0.7rem; /* 辅助标注 */
--font-size-sm: 0.8rem; /* 次要文字 */
--font-size-base: 0.9rem; /* 正文基准 */
--font-size-md: 1rem; /* 小标题 */
--font-size-lg: 1.2rem; /* 卡片标题 */
--font-size-xl: 1.4rem; /* 大数字/欢迎语 */
--font-weight-regular: 400;
--font-weight-medium: 500;
--font-weight-bold: 700;
--font-weight-extrabold: 800;
}
/* ========== 暗色模式适配(可选,保持品牌一致性) ========== */
@media (prefers-color-scheme: dark) {
:root {
/* 暗色模式下微调背景与文字,保留品牌色核心 */
--bg-light: #121826;
--bg-white: #1E2636;
--bg-gray: #0F141F;
--text-dark: #EDF2F7;
--text-muted: #9AA9C1;
--border-light: #2A3346;
--shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.4);
/* 保留主色深蓝与橙色不变,但可适当提高对比 */
--primary-dark: #123A5E; /* 亮一点保证深色背景可见度 */
--accent-orange: #FF7846; /* 稍微提亮橙色 */
}
}
/* ========== 辅助类 (方便开发直接复用) ========== */
.bg-primary {
background-color: var(--primary-dark);
}
.bg-accent {
background-color: var(--accent-orange);
}
.text-primary {
color: var(--primary-dark);
}
.text-accent {
color: var(--accent-orange);
}
.btn-orange {
background: var(--gradient-orange);
color: white;
border: none;
border-radius: var(--radius-full);
padding: 10px 20px;
font-weight: var(--font-weight-bold);
box-shadow: var(--shadow-orange-glow);
transition: all 0.2s ease;
}
.btn-orange:active {
transform: scale(0.97);
background: var(--accent-orange-dark);
}
.card-default {
background: var(--bg-white);
border-radius: var(--radius-md);
box-shadow: var(--shadow-sm);
border: 1px solid var(--border-light);
padding: var(--spacing-md);
}
-99
View File
@@ -1,99 +0,0 @@
<template>
<!-- 底部导航栏容器 -->
<view class="tab-bar">
<!-- 导航栏项 -->
<view
v-for="(tab, index) in tabs"
:key="index"
:class="['tab-item', { active: activeTab === index }]"
@click="activeTab = index"
>
<!-- 导航栏图标 -->
<image :src="activeTab === index ? tab.iconActive : tab.icon" mode="aspectFit" class="tab-icon" />
<!-- 导航栏标签文字 -->
<text class="tab-label">{{ tab.label }}</text>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
// 当前激活的导航栏索引
const activeTab = ref(0)
// 导航栏数据列表
const tabs = [
{
icon: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/tabBar/home.png',
iconActive: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/tabBar/active/home.png',
label: '首页',
},
{
icon: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/tabBar/course.png',
iconActive: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/tabBar/active/course.png',
label: '课程'
},
{
icon: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/tabBar/train.png',
iconActive: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/tabBar/active/train.png',
label: '训练' ,
},
{
icon: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/tabBar/discover.png',
iconActive: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/tabBar/active/discover.png',
label: '发现',
},
{
icon: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/tabBar/profile.png',
iconActive: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/tabBar/active/profile.png',
label: '我的',
}
]
</script>
<style lang="scss" scoped>
/* 底部导航栏容器样式 */
.tab-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 120rpx;
background: #1A4A6F;
display: flex;
justify-content: space-around;
align-items: center;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.06);
border-radius: 32rpx 32rpx 0 0;
}
/* 导航栏项样式 */
.tab-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 8rpx;
padding: 12rpx 24rpx;
}
/* 导航栏图标样式 */
.tab-icon {
width: 40rpx;
height: 40rpx;
}
/* 导航栏标签文字样式 */
.tab-label {
font-size: 22rpx;
color: #94a3b8;
}
/* 导航栏激活状态文字样式 */
.tab-item.active .tab-label {
color: #f97316;
font-weight: 600;
}
</style>
@@ -1,171 +0,0 @@
<template>
<!-- 轮播图容器 -->
<view class="banner-container">
<!-- 轮播图组件 -->
<swiper
class="banner-swiper"
:circular="true"
:autoplay="true"
:interval="4000"
:duration="500"
:indicator-dots="false"
@change="onSwiperChange"
>
<!-- 轮播项 -->
<swiper-item v-for="(banner, index) in banners" :key="index">
<!-- 轮播内容 -->
<view class="banner-content">
<!-- 轮播图片 -->
<image :src="banner.image" mode="aspectFill" class="banner-image" />
<!-- 图片遮罩层 -->
<view class="banner-overlay"></view>
<!-- 轮播文字信息 -->
<view class="banner-text">
<text class="banner-title">{{ banner.title }}</text>
<text class="banner-subtitle">{{ banner.subtitle }}</text>
<text class="banner-desc">{{ banner.desc }}</text>
</view>
</view>
</swiper-item>
</swiper>
<!-- 轮播指示器点 -->
<view class="banner-dots">
<view
v-for="(_, index) in banners"
:key="index"
:class="['dot', { active: currentIndex === index }]"
></view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
// 轮播图数据列表
const banners = [
{
image: 'https://images.unsplash.com/photo-1534438327276-14e5300c3a48?w=800&q=80',
title: '突破自我',
subtitle: '超越极限',
desc: '科学训练 · 遇见更好的自己'
},
{
image: 'https://images.unsplash.com/photo-1517836357463-d25dfeac3438?w=800&q=80',
title: '专业指导',
subtitle: '高效训练',
desc: '私人定制 · 专属健身方案'
},
{
image: 'https://images.unsplash.com/photo-1571019614242-c5c5dee9f50b?w=800&q=80',
title: '健康生活',
subtitle: '从这里开始',
desc: '全方位 · 打造完美体态'
}
]
// 当前轮播索引,用于控制指示器激活状态
const currentIndex = ref(0)
// 轮播图切换时的回调函数,更新当前索引
const onSwiperChange = (e) => {
currentIndex.value = e.detail.current
}
</script>
<style lang="scss" scoped>
/* 轮播图容器样式 */
.banner-container {
position: relative;
width: 100%;
}
/* 轮播图组件样式 */
.banner-swiper {
width: 100%;
height: 360rpx;
}
/* 轮播内容容器样式 */
.banner-content {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
}
/* 轮播图片样式 */
.banner-image {
width: 100%;
height: 100%;
}
/* 图片遮罩层样式,添加渐变效果 */
.banner-overlay {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: linear-gradient(135deg, rgba(11, 43, 75, 0.85) 0%, rgba(26, 74, 111, 0.6) 100%);
}
/* 轮播文字信息容器样式 */
.banner-text {
position: absolute;
left: 32rpx;
top: 50%;
transform: translateY(-50%);
z-index: 2;
}
/* 轮播标题样式 */
.banner-title {
display: block;
font-size: 48rpx;
font-weight: 800;
color: #ffffff;
margin-bottom: 8rpx;
text-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.3);
}
/* 轮播副标题样式 */
.banner-subtitle {
display: block;
font-size: 56rpx;
font-weight: 800;
color: #f97316;
margin-bottom: 16rpx;
text-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.3);
}
/* 轮播描述文字样式 */
.banner-desc {
display: block;
font-size: 26rpx;
color: rgba(255, 255, 255, 0.8);
}
/* 轮播指示器容器样式 */
.banner-dots {
display: flex;
justify-content: center;
gap: 16rpx;
margin-top: 24rpx;
}
/* 轮播指示器点样式 */
.dot {
width: 48rpx;
height: 8rpx;
border-radius: 9999rpx;
background: #d1d5db;
transition: all 0.3s ease;
}
/* 轮播指示器激活状态样式 */
.dot.active {
width: 64rpx;
background: #f97316;
}
</style>
@@ -1,115 +0,0 @@
<template>
<!-- 快捷入口容器 -->
<view class="quick-entry">
<!-- 快捷入口项 -->
<view
v-for="(item, index) in entries"
:key="index"
class="entry-item"
>
<!-- 入口图标容器 -->
<view :class="['entry-icon', { accent: item.accent }]">
<!-- 入口图标图片 -->
<image :src="item.icon" mode="aspectFit" class="icon-img" />
</view>
<!-- 入口标题 -->
<text class="entry-title">{{ item.title }}</text>
<!-- 入口描述 -->
<text class="entry-desc">{{ item.desc }}</text>
</view>
</view>
</template>
<script setup>
// 快捷入口数据列表
const entries = [
{
icon: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/icons/course.png',
title: '找课程',
desc: '精品课程',
accent: false ,
},
{
icon: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/icons/plan.png',
title: '训练计划',
desc: '个性定制',
accent: true ,
},
{
icon: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/icons/data.png',
title: '健身数据',
desc: '记录分析',
accent: false ,
},
{
icon: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/icons/message.png',
title: '消息',
desc: '通知消息',
accent: true,
},
{
icon: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/icons/checkIn.png',
title: '签到',
desc: '打卡签到',
accent: false,
}
]
</script>
<style lang="scss" scoped>
/* 快捷入口容器样式 */
.quick-entry {
display: flex;
justify-content: space-between;
padding: 32rpx 24rpx;
background: #ffffff;
margin: 24rpx;
border-radius: 24rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
}
/* 快捷入口项样式 */
.entry-item {
display: flex;
flex-direction: column;
align-items: center;
flex: 1;
}
/* 入口图标容器样式 */
.entry-icon {
width: 104rpx;
height: 104rpx;
border-radius: 20rpx;
background: #072A4E;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 16rpx;
}
/* 入口图标图片样式 */
.icon-img {
width: 52rpx;
height: 52rpx;
}
/* 入口图标强调色样式(橙色背景) */
.entry-icon.accent {
background: #FC5A15;
}
/* 入口标题样式 */
.entry-title {
font-size: 26rpx;
font-weight: 600;
color: #1a202c;
margin-bottom: 4rpx;
}
/* 入口描述文字样式 */
.entry-desc {
font-size: 22rpx;
color: #94a3b8;
}
</style>
@@ -1,291 +0,0 @@
<template>
<!-- 推荐课程容器 -->
<view class="recommend-courses">
<!-- 区域标题栏 -->
<view class="section-header">
<!-- 区域标题 -->
<text class="section-title">推荐课程</text>
<!-- 查看更多按钮 -->
<view class="view-more">
<text>查看更多</text>
<text class="arrow">
<uni-icons type="right" size="20" color="#94a3b8"/>
</text>
</view>
</view>
<!-- 课程横向滚动容器 -->
<scroll-view class="courses-scroll" scroll-x="true" :show-scrollbar="false">
<!-- 课程列表 -->
<view class="courses-list">
<!-- 课程卡片 -->
<view
v-for="(course, index) in courses"
:key="index"
class="course-card"
>
<!-- 课程图片区域 -->
<view class="course-image">
<!-- 课程封面图片 -->
<image :src="course.image" mode="aspectFill" class="img" />
<!-- 图片渐变遮罩 -->
<view class="course-overlay"></view>
<!-- 课程标签 -->
<text :class="['course-tag', course.tagType]">{{ course.tag }}</text>
<!-- 课程信息区域 -->
<view class="course-info">
<!-- 课程名称 -->
<text class="course-name">{{ course.name }}</text>
<!-- 课程元信息时长难度 -->
<view class="course-meta">
<!-- 时长信息 -->
<view class="meta-item">
<text class="meta-icon">
<image src="https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/time.png"/>
</text>
<text>{{ course.duration }}</text>
</view>
<!-- 难度信息 -->
<view class="meta-item">
<text class="meta-icon">
<image src="https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/intensity.png"/>
</text>
<text>{{ course.level }}</text>
</view>
</view>
</view>
</view>
<!-- 课程底部区域 -->
<view class="course-footer">
<!-- 参与人数信息 -->
<view class="participants">
<text class="fire-icon">
<image src="https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/hot.png"/>
</text>
<text>{{ course.participants }}人参与</text>
</view>
<!-- 去参与按钮 -->
<view class="join-btn">
<text>去参与</text>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
</template>
<script setup>
// 推荐课程数据列表
const courses = [
{
image: 'https://images.unsplash.com/photo-1534438327276-14e5300c3a48?w=400&q=80',
tag: '限时免费',
tagType: 'free',
name: 'HIIT高强度燃脂',
duration: '30分钟',
level: '中级',
participants: '4587'
},
{
image: 'https://images.unsplash.com/photo-1583454110551-21f2fa2afe61?w=400&q=80',
tag: '人气TOP',
tagType: 'hot',
name: '力量进阶训练',
duration: '45分钟',
level: '高级',
participants: '6231'
},
{
image: 'https://images.unsplash.com/photo-1544367567-0f2fcb009e0b?w=400&q=80',
tag: '新课上线',
tagType: 'new',
name: '瑜伽·身心平衡',
duration: '60分钟',
level: '初级',
participants: '3210'
}
]
</script>
<style lang="scss">
/* 推荐课程容器样式 */
.recommend-courses {
padding: 0 24rpx;
margin-bottom: 32rpx;
}
/* 区域标题栏样式 */
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
}
/* 区域标题样式 */
.section-title {
font-size: 34rpx;
font-weight: 700;
color: #1a202c;
}
/* 查看更多按钮样式 */
.view-more {
display: flex;
align-items: center;
gap: 4rpx;
font-size: 26rpx;
color: #94a3b8;
}
/* 箭头图标样式 */
.arrow {
font-size: 32rpx;
}
/* 课程横向滚动容器样式 */
.courses-scroll {
white-space: nowrap;
}
/* 课程列表样式 */
.courses-list {
display: inline-flex;
gap: 48rpx;
}
/* 课程卡片样式 */
.course-card {
width: 320rpx;
background: #ffffff;
border-radius: 24rpx;
overflow: hidden;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
display: inline-block;
vertical-align: top;
}
/* 课程图片区域样式 */
.course-image {
height: 280rpx;
position: relative;
display: flex;
flex-direction: column;
justify-content: flex-end;
padding: 20rpx;
}
/* 课程封面图片样式 */
.img {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
/* 图片渐变遮罩样式 */
.course-overlay {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 60%);
}
/* 课程标签样式 */
.course-tag {
position: absolute;
top: 16rpx;
right: 16rpx;
padding: 8rpx 16rpx;
border-radius: 12rpx;
font-size: 20rpx;
font-weight: 600;
color: #ffffff;
background: #f97316;
}
/* 课程信息区域样式 */
.course-info {
position: relative;
z-index: 2;
}
/* 课程名称样式 */
.course-name {
display: block;
font-size: 28rpx;
font-weight: 600;
color: #ffffff;
margin-bottom: 8rpx;
}
/* 课程元信息容器样式 */
.course-meta {
display: flex;
gap: 16rpx;
align-items: center;
}
/* 课程元信息项样式 */
.meta-item {
display: flex;
align-items: end;
gap: 6rpx;
font-size: 22rpx;
color: rgba(255, 255, 255, 0.8);
}
/* 元信息图标样式 */
.meta-icon {
font-size: 20rpx;
image{
display: flex;
align-items: center;
width: 25rpx;
height: 25rpx;
}
}
/* 课程底部区域样式 */
.course-footer {
padding: 16rpx 10rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
/* 参与人数信息样式 */
.participants {
display: flex;
align-items: center;
gap: 6rpx;
font-size: 22rpx;
color: #94a3b8;
}
/* 火热图标样式 */
.fire-icon {
font-size: 24rpx;
image{
display: flex;
align-items: center;
width: 30rpx;
height: 30rpx;
}
}
/* 去参与按钮样式 */
.join-btn {
padding: 12rpx 28rpx;
background: transparent;
border: 2rpx solid #f97316;
border-radius: 9999rpx;
font-size: 22rpx;
font-weight: 600;
color: #f97316;
}
</style>
@@ -1,213 +0,0 @@
<template>
<!-- 今日推荐容器 -->
<view class="today-recommend">
<!-- 区域标题栏 -->
<view class="section-header">
<!-- 区域标题 -->
<text class="section-title">今日推荐</text>
<!-- 查看更多按钮 -->
<view class="view-more">
<text>查看更多</text>
<text class="arrow">
<uni-icons type="right" size="20" color="#94a3b8"></uni-icons>
</text>
</view>
</view>
<!-- 推荐列表 -->
<view class="recommend-list">
<!-- 推荐项 -->
<view
v-for="(item, index) in recommends"
:key="index"
class="recommend-item"
>
<!-- 推荐项图片 -->
<image :src="item.image" mode="aspectFill" class="item-image" />
<!-- 推荐项内容区域 -->
<view class="item-content">
<!-- 推荐项标题 -->
<text class="item-title">{{ item.title }}</text>
<!-- 推荐项标签列表 -->
<view class="item-tags">
<text v-for="(tag, tagIndex) in item.tags" :key="tagIndex" class="tag">{{ tag }}</text>
</view>
<!-- 推荐项描述 -->
<text class="item-desc">{{ item.desc }}</text>
</view>
<!-- 推荐项操作区域 -->
<view class="item-action">
<!-- 开始训练按钮 -->
<view class="start-btn">
<text class="start-btn-text">开始训练</text>
</view>
<!-- 参与人数 -->
<text class="participants">{{ item.participants }}人参与</text>
</view>
</view>
</view>
</view>
</template>
<script setup>
// 今日推荐数据列表
const recommends = [
{
image: 'https://images.unsplash.com/photo-1571019613454-1cb2f99b2d8b?w=300&q=80',
title: '晨间活力唤醒跑',
tags: ['20分钟', '初级'],
desc: '唤醒身体,开启活力一天',
participants: '2784'
},
{
image: 'https://images.unsplash.com/photo-1581009146145-b5ef050c149a?w=300&q=80',
title: '全身力量塑形',
tags: ['50分钟', '中级'],
desc: '全身综合训练,塑造完美线条',
participants: '4126'
},
{
image: 'https://images.unsplash.com/photo-1490645935967-10de6ba17061?w=300&q=80',
title: '蛋白增肌饮食指南',
tags: ['营养饮食', '12分钟'],
desc: '科学饮食搭配,助力肌肉增长',
participants: '1865'
}
]
</script>
<style lang="scss" scoped>
/* 今日推荐容器样式 */
.today-recommend {
padding: 0 24rpx;
}
/* 区域标题栏样式 */
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
}
/* 区域标题样式 */
.section-title {
font-size: 34rpx;
font-weight: 700;
color: #1a202c;
}
/* 查看更多按钮样式 */
.view-more {
display: flex;
align-items: center;
gap: 4rpx;
font-size: 26rpx;
color: #94a3b8;
}
/* 箭头图标样式 */
.arrow {
font-size: 32rpx;
}
/* 推荐列表样式 */
.recommend-list {
display: flex;
flex-direction: column;
gap: 24rpx;
}
/* 推荐项卡片样式 */
.recommend-item {
display: flex;
gap: 24rpx;
background: #ffffff;
border-radius: 24rpx;
padding: 20rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
}
/* 推荐项图片样式 */
.item-image {
width: 200rpx;
height: 160rpx;
border-radius: 16rpx;
flex-shrink: 0;
}
/* 推荐项内容区域样式 */
.item-content {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
min-width: 0;
}
/* 推荐项标题样式 */
.item-title {
font-size: 30rpx;
font-weight: 600;
color: #1a202c;
margin-bottom: 12rpx;
}
/* 推荐项标签列表样式 */
.item-tags {
display: flex;
gap: 12rpx;
margin-bottom: 12rpx;
}
/* 推荐项标签样式 */
.tag {
padding: 6rpx 16rpx;
background: #f1f5f9;
border-radius: 8rpx;
font-size: 22rpx;
color: #64748b;
}
/* 推荐项描述文字样式 */
.item-desc {
font-size: 24rpx;
color: #94a3b8;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 推荐项操作区域样式 */
.item-action {
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: center;
gap: 16rpx;
flex-shrink: 0;
}
/* 开始训练按钮样式 */
.start-btn {
padding: 16rpx 28rpx;
background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
border-radius: 9999rpx;
box-shadow: 0 4rpx 16rpx rgba(249, 115, 22, 0.4);
}
/* 开始训练按钮文字样式 */
.start-btn-text {
font-size: 24rpx;
font-weight: 600;
color: #ffffff;
white-space: nowrap;
}
/* 参与人数文字样式 */
.participants {
font-size: 22rpx;
color: #94a3b8;
white-space: nowrap;
}
</style>
-570
View File
@@ -1,570 +0,0 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover">
<title>健身房管理系统 | 动感配色方案</title>
<!-- 引入Font Awesome 6 (免费图标库,增强视觉) -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
}
body {
background: #F5F7FC; /* 整体背景柔和灰白,衬托主色 */
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
padding: 24px 20px 48px;
color: #1E2A3A;
}
/* 主色调变量定义 – 活力运动风格
主色: 动感深蓝 (#0B2B4B) – 权威、专业、沉稳
辅色: 活力橙 (#FF6B35) – 热情、能量、行动召唤
背景浅色: #F9FAFE, 卡片白, 强调蓝绿渐变点缀
*/
:root {
--primary-dark: #0B2B4B; /* 深蓝主色,用于头部、重要按钮、边框强调 */
--primary-deep: #1A4A6F; /* 中深蓝,用于hover、次级强调 */
--accent-orange: #FF6B35; /* 活力橙,CTA、会员卡片、高亮标签 */
--accent-orange-light: #FF8C5A;
--bg-light: #F9FAFE;
--card-white: #FFFFFF;
--text-dark: #1E2A3A;
--text-muted: #5E6F8D;
--border-light: #E9EDF2;
--success-green: #2ECC71;
--warning-amber: #F39C12;
--shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.03), 0 2px 6px rgba(0, 0, 0, 0.05);
--shadow-md: 0 12px 28px rgba(0, 0, 0, 0.08);
--gradient-orange: linear-gradient(135deg, #FF6B35 0%, #FF8C5A 100%);
--gradient-blue: linear-gradient(135deg, #0B2B4B 0%, #1A4A6F 100%);
}
/* 整体容器 */
.demo-container {
max-width: 450px;
margin: 0 auto;
background: var(--bg-light);
border-radius: 36px;
box-shadow: var(--shadow-md);
overflow: hidden;
position: relative;
}
/* 状态栏模拟 (小程序顶部风格) */
.status-bar {
background: var(--primary-dark);
padding: 12px 20px 6px;
color: white;
display: flex;
justify-content: space-between;
font-size: 14px;
font-weight: 500;
}
/* 主头部导航 */
.main-header {
background: var(--primary-dark);
padding: 12px 20px 20px;
color: white;
}
.header-top {
display: flex;
justify-content: space-between;
align-items: baseline;
margin-bottom: 20px;
}
.logo-area h2 {
font-size: 1.6rem;
font-weight: 700;
letter-spacing: -0.3px;
display: flex;
align-items: center;
gap: 6px;
}
.logo-area h2 i {
color: var(--accent-orange);
font-size: 1.7rem;
}
.logo-area p {
font-size: 0.7rem;
opacity: 0.8;
letter-spacing: 0.5px;
}
.header-actions i {
font-size: 1.4rem;
background: rgba(255,255,255,0.15);
padding: 8px;
border-radius: 30px;
margin-left: 8px;
cursor: default;
}
/* 欢迎卡片 + 活力橙强调 */
.welcome-card {
background: white;
border-radius: 28px;
padding: 18px 20px;
margin-top: 12px;
box-shadow: var(--shadow-sm);
display: flex;
justify-content: space-between;
align-items: center;
}
.welcome-text h4 {
font-size: 1rem;
color: var(--text-muted);
font-weight: 500;
}
.welcome-text h3 {
font-size: 1.4rem;
margin-top: 4px;
color: var(--primary-dark);
}
.badge-member {
background: var(--gradient-orange);
padding: 8px 16px;
border-radius: 40px;
color: white;
font-weight: 600;
font-size: 0.8rem;
box-shadow: 0 4px 8px rgba(255,107,53,0.2);
}
/* 主要指标卡片区 */
.stats-grid {
display: flex;
gap: 12px;
padding: 20px;
background: var(--bg-light);
}
.stat-card {
background: var(--card-white);
flex: 1;
border-radius: 24px;
padding: 14px 0;
text-align: center;
box-shadow: var(--shadow-sm);
transition: all 0.2s;
border: 1px solid var(--border-light);
}
.stat-card i {
font-size: 1.8rem;
color: var(--accent-orange);
margin-bottom: 6px;
}
.stat-number {
font-size: 1.6rem;
font-weight: 800;
color: var(--primary-dark);
}
.stat-label {
font-size: 0.7rem;
color: var(--text-muted);
}
/* 功能菜单 grid */
.menu-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 12px;
padding: 8px 20px 20px;
}
.menu-item {
background: var(--card-white);
border-radius: 20px;
padding: 12px 6px;
text-align: center;
transition: all 0.2s ease;
border: 1px solid var(--border-light);
cursor: default;
}
.menu-item i {
font-size: 1.8rem;
color: var(--primary-deep);
margin-bottom: 6px;
display: block;
}
.menu-item span {
font-size: 0.7rem;
font-weight: 500;
color: var(--text-dark);
}
.menu-item:active {
transform: scale(0.96);
background: #FEF5F0;
}
/* 课程/热门活动区域 */
.section-title {
display: flex;
justify-content: space-between;
padding: 8px 20px 4px;
align-items: baseline;
}
.section-title h3 {
font-size: 1.2rem;
font-weight: 700;
color: var(--primary-dark);
}
.section-title a {
font-size: 0.75rem;
color: var(--accent-orange);
font-weight: 600;
}
.class-list {
padding: 8px 20px 20px;
display: flex;
flex-direction: column;
gap: 12px;
}
.class-card {
background: white;
border-radius: 20px;
padding: 12px 16px;
display: flex;
align-items: center;
gap: 14px;
box-shadow: var(--shadow-sm);
border-left: 5px solid var(--accent-orange);
transition: all 0.2s;
}
.class-icon {
width: 48px;
height: 48px;
background: rgba(255,107,53,0.1);
border-radius: 30px;
display: flex;
align-items: center;
justify-content: center;
}
.class-icon i {
font-size: 1.8rem;
color: var(--accent-orange);
}
.class-info {
flex: 1;
}
.class-info h4 {
font-size: 1rem;
font-weight: 700;
}
.class-info p {
font-size: 0.7rem;
color: var(--text-muted);
margin-top: 4px;
}
.class-time {
font-size: 0.75rem;
background: #F0F3F9;
padding: 4px 10px;
border-radius: 40px;
font-weight: 600;
color: var(--primary-deep);
}
/* 底部导航栏 (Tab Bar 模拟) */
.bottom-tab {
background: white;
backdrop-filter: blur(0px);
border-top: 1px solid var(--border-light);
display: flex;
justify-content: space-around;
padding: 10px 20px 22px;
border-radius: 0 0 36px 36px;
}
.tab-item {
text-align: center;
color: var(--text-muted);
transition: 0.1s;
cursor: default;
}
.tab-item i {
font-size: 1.5rem;
}
.tab-item span {
font-size: 0.7rem;
display: block;
margin-top: 4px;
}
.tab-item.active {
color: var(--accent-orange);
font-weight: 600;
}
/* 教练推荐卡片额外装饰 */
.trainer-spot {
background: var(--gradient-blue);
margin: 0 20px 20px;
border-radius: 28px;
padding: 16px 18px;
display: flex;
align-items: center;
justify-content: space-between;
color: white;
}
.trainer-info h4 {
font-size: 0.9rem;
opacity: 0.9;
}
.trainer-info h3 {
font-size: 1.1rem;
font-weight: 700;
}
.trainer-btn {
background: var(--accent-orange);
border: none;
padding: 8px 18px;
border-radius: 50px;
color: white;
font-weight: 600;
font-size: 0.8rem;
cursor: default;
}
/* 配色展示条 / 设计说明 */
.color-palette-show {
max-width: 450px;
margin: 28px auto 0;
background: white;
border-radius: 32px;
padding: 18px 20px;
box-shadow: var(--shadow-sm);
}
.color-title {
font-weight: 700;
margin-bottom: 12px;
color: var(--primary-dark);
font-size: 1rem;
display: flex;
align-items: center;
gap: 8px;
}
.color-swatches {
display: flex;
gap: 16px;
flex-wrap: wrap;
}
.swatch {
flex: 1;
min-width: 70px;
text-align: center;
}
.swatch-circle {
height: 50px;
border-radius: 16px;
margin-bottom: 8px;
box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.swatch span {
font-size: 0.7rem;
font-weight: 500;
color: var(--text-dark);
}
hr {
margin: 20px 0 8px;
border: none;
height: 1px;
background: var(--border-light);
}
.note {
font-size: 0.7rem;
color: var(--text-muted);
text-align: center;
margin-top: 12px;
}
i, .tab-item, .menu-item, .stat-card {
cursor: default;
}
</style>
</head>
<body>
<div class="demo-container">
<!-- 模拟小程序状态栏/胶囊区 -->
<div class="status-bar">
<span>9:41</span>
<span><i class="fas fa-signal"></i> <i class="fas fa-battery-full"></i></span>
</div>
<!-- 主头部深蓝区 -->
<div class="main-header">
<div class="header-top">
<div class="logo-area">
<h2><i class="fas fa-dumbbell"></i> IRONPULSE</h2>
<p>智能健身 · 即刻燃动</p>
</div>
<div class="header-actions">
<i class="fas fa-bell"></i>
<i class="fas fa-user-circle"></i>
</div>
</div>
<!-- 用户欢迎卡片,橙色高亮会员 -->
<div class="welcome-card">
<div class="welcome-text">
<h4>欢迎回来,</h4>
<h3>张峻铭 <span style="font-size: 0.8rem;">💪</span></h3>
</div>
<div class="badge-member">MVP 黑金会员</div>
</div>
</div>
<!-- 关键指标 活力橙点缀 -->
<div class="stats-grid">
<div class="stat-card">
<i class="fas fa-fire"></i>
<div class="stat-number">1,280</div>
<div class="stat-label">今日卡路里</div>
</div>
<div class="stat-card">
<i class="fas fa-clock"></i>
<div class="stat-number">126</div>
<div class="stat-label">运动分钟</div>
</div>
<div class="stat-card">
<i class="fas fa-calendar-check"></i>
<div class="stat-number">12</div>
<div class="stat-label">本月课程</div>
</div>
</div>
<!-- 功能区 网格菜单(四大模块) -->
<div class="menu-grid">
<div class="menu-item"><i class="fas fa-qrcode"></i><span>签到</span></div>
<div class="menu-item"><i class="fas fa-chalkboard-user"></i><span>团课预约</span></div>
<div class="menu-item"><i class="fas fa-chart-line"></i><span>体测报告</span></div>
<div class="menu-item"><i class="fas fa-cog"></i><span>我的会籍</span></div>
</div>
<!-- 热门课程板块 (动态橙边风格) -->
<div class="section-title">
<h3><i class="fas fa-heartbeat" style="color: var(--accent-orange); margin-right: 6px;"></i> 热门团课</h3>
<a href="#">查看全部 →</a>
</div>
<div class="class-list">
<div class="class-card">
<div class="class-icon"><i class="fas fa-bicycle"></i></div>
<div class="class-info">
<h4>极速燃脂 · 动感单车</h4>
<p>张教练 | 综合有氧</p>
</div>
<div class="class-time">19:30 满员</div>
</div>
<div class="class-card">
<div class="class-icon"><i class="fas fa-hand-fist"></i></div>
<div class="class-info">
<h4>搏击风暴 · 泰拳基础</h4>
<p>李娜 | 格斗区</p>
</div>
<div class="class-time">18:00 火热</div>
</div>
<div class="class-card">
<div class="class-icon"><i class="fas fa-person-walking"></i></div>
<div class="class-info">
<h4>普拉提核心唤醒</h4>
<p>Elena | 瑜伽室</p>
</div>
<div class="class-time">明早 09:30</div>
</div>
</div>
<!-- 教练推荐 使用深蓝渐变+橙色按钮 -->
<div class="trainer-spot">
<div class="trainer-info">
<h4>🌟 明星私教推荐</h4>
<h3>Alex 王 · 增肌塑形专家</h3>
<p style="font-size: 0.7rem; opacity:0.85;">剩余3个时段可约</p>
</div>
<div class="trainer-btn">立即预约</div>
</div>
<!-- 底部tab栏 当前选中“首页”凸显橙色-->
<div class="bottom-tab">
<div class="tab-item active"><i class="fas fa-home"></i><span>首页</span></div>
<div class="tab-item"><i class="fas fa-calendar-alt"></i><span>日程</span></div>
<div class="tab-item"><i class="fas fa-chart-simple"></i><span>数据</span></div>
<div class="tab-item"><i class="fas fa-user"></i><span>我的</span></div>
</div>
</div>
<!-- 配色方案展示区,直观看到颜色搭配,帮助设计决策 -->
<div class="color-palette-show">
<div class="color-title">
<i class="fas fa-palette" style="color: #FF6B35;"></i> 健身房管理系统 · 能量配色方案
</div>
<div class="color-swatches">
<div class="swatch">
<div class="swatch-circle" style="background: #0B2B4B;"></div>
<span>深蓝主色 #0B2B4B<br>专业信赖</span>
</div>
<div class="swatch">
<div class="swatch-circle" style="background: #FF6B35;"></div>
<span>活力橙 #FF6B35<br>行动/热情</span>
</div>
<div class="swatch">
<div class="swatch-circle" style="background: #1A4A6F;"></div>
<span>深邃辅助 #1A4A6F</span>
</div>
<div class="swatch">
<div class="swatch-circle" style="background: #F9FAFE; border:1px solid #E2E8F0;"></div>
<span>浅色背景 #F9FAFE</span>
</div>
<div class="swatch">
<div class="swatch-circle" style="background: #FFFFFF; border:1px solid #E2E8F0;"></div>
<span>卡片白 #FFFFFF</span>
</div>
</div>
<hr>
<div class="note">
<i class="fas fa-lightbulb" style="color: #FF6B35;"></i> 设计理念:深蓝色传递专业与稳定感,活力橙色提升运动热情与CTA转化。<br>
圆润卡片 + 强烈对比,适合健身管理小程序的年轻、力量与现代氛围。
</div>
</div>
<!-- 额外注释:颜色可访问性强,橙蓝互补但明度舒适 -->
</body>
</html>
-20
View File
@@ -1,20 +0,0 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script>
</body>
</html>
-22
View File
@@ -1,22 +0,0 @@
import App from './App'
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
// #endif
// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif
+3 -11
View File
@@ -1,11 +1,10 @@
{
"name": "gym-manage-uniapp",
"appid" : "__UNI__1F1874C",
"description" : "",
"appid": "",
"description": "Gym Management System Mobile App",
"versionName": "1.0.0",
"versionCode": "100",
"transformPx": false,
/* 5+App */
"app-plus": {
"usingComponents": true,
"nvueStyleCompiler": "uni-app",
@@ -16,11 +15,8 @@
"autoclose": true,
"delay": 0
},
/* */
"modules": {},
/* */
"distribute": {
/* android */
"android": {
"permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
@@ -40,17 +36,13 @@
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios */
"ios": {},
/* SDK */
"sdkConfigs": {}
}
},
/* */
"quickapp": {},
/* */
"mp-weixin": {
"appid" : "wx8278fdbc9f158915",
"appid": "",
"setting": {
"urlCheck": false
},
+19
View File
@@ -0,0 +1,19 @@
{
"name": "gym-manage-uniapp",
"version": "1.0.0",
"description": "Gym Management System Mobile App",
"main": "main.js",
"scripts": {
"dev:mp-weixin": "uni -p mp-weixin",
"build:mp-weixin": "uni build -p mp-weixin",
"dev:h5": "uni",
"build:h5": "uni build"
},
"keywords": [
"uniapp",
"gym",
"management"
],
"author": "Novalon",
"license": "MIT"
}
+15 -4
View File
@@ -1,17 +1,28 @@
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "健身房"
"navigationBarTitleText": "首页"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarTitleText": "健身房管理系统",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"uniIdRouter": {}
"tabBar": {
"color": "#7A7E83",
"selectedColor": "#007AFF",
"borderStyle": "black",
"backgroundColor": "#F8F8F8",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页"
}
]
}
}
-41
View File
@@ -1,41 +0,0 @@
<template>
<view class="home-page">
<!-- Banner轮播 -->
<BannerSwiper />
<!-- 功能入口 -->
<QuickEntry />
<!-- 推荐课程 -->
<RecommendCourses />
<!-- 今日推荐 -->
<TodayRecommend />
<!-- 底部占位 -->
<view class="bottom-placeholder"></view>
<!-- 底部导航 -->
<TabBar />
</view>
</template>
<script setup>
import BannerSwiper from '@/components/index/BannerSwiper.vue'
import QuickEntry from '@/components/index/QuickEntry.vue'
import RecommendCourses from '@/components/index/RecommendCourses.vue'
import TodayRecommend from '@/components/index/TodayRecommend.vue'
import TabBar from '@/components/TabBar.vue'
</script>
<style lang="scss" scoped>
.home-page {
min-height: 100vh;
background-color: #f0f4f8;
padding-bottom: 160rpx;
}
.bottom-placeholder {
height: 40rpx;
}
</style>
@@ -0,0 +1,40 @@
<template>
<view class="container">
<text class="title">健身房管理系统</text>
<text class="subtitle">欢迎使用 UniApp 移动端</text>
</view>
</template>
<script>
export default {
data() {
return {
title: '健身房管理系统'
}
},
onLoad() {
console.log('Index page loaded')
}
}
</script>
<style>
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20px;
}
.title {
font-size: 24px;
font-weight: bold;
margin-bottom: 10px;
}
.subtitle {
font-size: 16px;
color: #666;
}
</style>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

@@ -1,13 +0,0 @@
uni.addInterceptor({
returnValue (res) {
if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
return res;
}
return new Promise((resolve, reject) => {
res.then((res) => {
if (!res) return resolve(res)
return res[0] ? reject(res[0]) : resolve(res[1])
});
});
},
});
-76
View File
@@ -1,76 +0,0 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
$uni-color-primary: #007aff;
$uni-color-success: #4cd964;
$uni-color-warning: #f0ad4e;
$uni-color-error: #dd524d;
/* 文字基本颜色 */
$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;
@@ -1,44 +0,0 @@
## 2.0.122025-08-26
- 优化 uni-app x 下 size 类型问题
## 2.0.112025-08-18
- 修复 图标点击事件返回
## 2.0.92024-01-12
fix: 修复图标大小默认值错误的问题
## 2.0.82023-12-14
- 修复 项目未使用 ts 情况下,打包报错的bug
## 2.0.72023-12-14
- 修复 size 属性为 string 时,不加单位导致尺寸异常的bug
## 2.0.62023-12-11
- 优化 兼容老版本icon类型,如 top bottom 等
## 2.0.52023-12-11
- 优化 兼容老版本icon类型,如 top bottom 等
## 2.0.42023-12-06
- 优化 uni-app x 下示例项目图标排序
## 2.0.32023-12-06
- 修复 nvue下引入组件报错的bug
## 2.0.22023-12-05
-优化 size 属性支持单位
## 2.0.12023-12-05
- 新增 uni-app x 支持定义图标
## 1.3.52022-01-24
- 优化 size 属性可以传入不带单位的字符串数值
## 1.3.42022-01-24
- 优化 size 支持其他单位
## 1.3.32022-01-17
- 修复 nvue 有些图标不显示的bug,兼容老版本图标
## 1.3.22021-12-01
- 优化 示例可复制图标名称
## 1.3.12021-11-23
- 优化 兼容旧组件 type 值
## 1.3.02021-11-19
- 新增 更多图标
- 优化 自定义图标使用方式
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-icons](https://uniapp.dcloud.io/component/uniui/uni-icons)
## 1.1.72021-11-08
## 1.2.02021-07-30
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.1.52021-05-12
- 新增 组件示例地址
## 1.1.42021-02-05
- 调整为uni_modules目录规范
@@ -1,91 +0,0 @@
<template>
<text class="uni-icons" :style="styleObj">
<slot>{{unicode}}</slot>
</text>
</template>
<script>
import { fontData, IconsDataItem } from './uniicons_file'
/**
* Icons 图标
* @description 用于展示 icon 图标
* @tutorial https://ext.dcloud.net.cn/plugin?id=28
* @property {Number} size 图标大小
* @property {String} type 图标图案,参考示例
* @property {String} color 图标颜色
* @property {String} customPrefix 自定义图标
* @event {Function} click 点击 Icon 触发事件
*/
export default {
name: "uni-icons",
props: {
type: {
type: String,
default: ''
},
color: {
type: String,
default: '#333333'
},
size: {
type: [Number, String],
default: 16
},
fontFamily: {
type: String,
default: ''
}
},
data() {
return {};
},
computed: {
unicode() : string {
let codes = fontData.find((item : IconsDataItem) : boolean => { return item.font_class == this.type })
if (codes !== null) {
return codes.unicode
}
return ''
},
iconSize() : string {
const size = this.size
if (typeof size == 'string') {
const reg = /^[0-9]*$/g
return reg.test(size as string) ? '' + size + 'px' : '' + size;
// return '' + this.size
}
return this.getFontSize(size as number)
},
styleObj() : UTSJSONObject {
if (this.fontFamily !== '') {
return { color: this.color, fontSize: this.iconSize, fontFamily: this.fontFamily }
}
return { color: this.color, fontSize: this.iconSize }
}
},
created() { },
methods: {
/**
* 字体大小
*/
getFontSize(size : number) : string {
return size + 'px';
},
},
}
</script>
<style scoped>
@font-face {
font-family: UniIconsFontFamily;
src: url('./uniicons.ttf');
}
.uni-icons {
font-family: UniIconsFontFamily;
font-size: 18px;
font-style: normal;
color: #333;
}
</style>
@@ -1,110 +0,0 @@
<template>
<!-- #ifdef APP-NVUE -->
<text :style="styleObj" class="uni-icons" @click="_onClick">{{unicode}}</text>
<!-- #endif -->
<!-- #ifndef APP-NVUE -->
<text :style="styleObj" class="uni-icons" :class="['uniui-'+type,customPrefix,customPrefix?type:'']" @click="_onClick">
<slot></slot>
</text>
<!-- #endif -->
</template>
<script>
import { fontData } from './uniicons_file_vue.js';
const getVal = (val) => {
const reg = /^[0-9]*$/g
return (typeof val === 'number' || reg.test(val)) ? val + 'px' : val;
}
// #ifdef APP-NVUE
var domModule = weex.requireModule('dom');
import iconUrl from './uniicons.ttf'
domModule.addRule('fontFace', {
'fontFamily': "uniicons",
'src': "url('" + iconUrl + "')"
});
// #endif
/**
* Icons 图标
* @description 用于展示 icons 图标
* @tutorial https://ext.dcloud.net.cn/plugin?id=28
* @property {Number} size 图标大小
* @property {String} type 图标图案,参考示例
* @property {String} color 图标颜色
* @property {String} customPrefix 自定义图标
* @event {Function} click 点击 Icon 触发事件
*/
export default {
name: 'UniIcons',
emits: ['click'],
props: {
type: {
type: String,
default: ''
},
color: {
type: String,
default: '#333333'
},
size: {
type: [Number, String],
default: 16
},
customPrefix: {
type: String,
default: ''
},
fontFamily: {
type: String,
default: ''
}
},
data() {
return {
icons: fontData
}
},
computed: {
unicode() {
let code = this.icons.find(v => v.font_class === this.type)
if (code) {
return code.unicode
}
return ''
},
iconSize() {
return getVal(this.size)
},
styleObj() {
if (this.fontFamily !== '') {
return `color: ${this.color}; font-size: ${this.iconSize}; font-family: ${this.fontFamily};`
}
return `color: ${this.color}; font-size: ${this.iconSize};`
}
},
methods: {
_onClick(e) {
this.$emit('click', e)
}
}
}
</script>
<style lang="scss">
/* #ifndef APP-NVUE */
@import './uniicons.css';
@font-face {
font-family: uniicons;
src: url('./uniicons.ttf');
}
/* #endif */
.uni-icons {
font-family: uniicons;
text-decoration: none;
text-align: center;
}
</style>
@@ -1,664 +0,0 @@
.uniui-cart-filled:before {
content: "\e6d0";
}
.uniui-gift-filled:before {
content: "\e6c4";
}
.uniui-color:before {
content: "\e6cf";
}
.uniui-wallet:before {
content: "\e6b1";
}
.uniui-settings-filled:before {
content: "\e6ce";
}
.uniui-auth-filled:before {
content: "\e6cc";
}
.uniui-shop-filled:before {
content: "\e6cd";
}
.uniui-staff-filled:before {
content: "\e6cb";
}
.uniui-vip-filled:before {
content: "\e6c6";
}
.uniui-plus-filled:before {
content: "\e6c7";
}
.uniui-folder-add-filled:before {
content: "\e6c8";
}
.uniui-color-filled:before {
content: "\e6c9";
}
.uniui-tune-filled:before {
content: "\e6ca";
}
.uniui-calendar-filled:before {
content: "\e6c0";
}
.uniui-notification-filled:before {
content: "\e6c1";
}
.uniui-wallet-filled:before {
content: "\e6c2";
}
.uniui-medal-filled:before {
content: "\e6c3";
}
.uniui-fire-filled:before {
content: "\e6c5";
}
.uniui-refreshempty:before {
content: "\e6bf";
}
.uniui-location-filled:before {
content: "\e6af";
}
.uniui-person-filled:before {
content: "\e69d";
}
.uniui-personadd-filled:before {
content: "\e698";
}
.uniui-arrowthinleft:before {
content: "\e6d2";
}
.uniui-arrowthinup:before {
content: "\e6d3";
}
.uniui-arrowthindown:before {
content: "\e6d4";
}
.uniui-back:before {
content: "\e6b9";
}
.uniui-forward:before {
content: "\e6ba";
}
.uniui-arrow-right:before {
content: "\e6bb";
}
.uniui-arrow-left:before {
content: "\e6bc";
}
.uniui-arrow-up:before {
content: "\e6bd";
}
.uniui-arrow-down:before {
content: "\e6be";
}
.uniui-arrowthinright:before {
content: "\e6d1";
}
.uniui-down:before {
content: "\e6b8";
}
.uniui-bottom:before {
content: "\e6b8";
}
.uniui-arrowright:before {
content: "\e6d5";
}
.uniui-right:before {
content: "\e6b5";
}
.uniui-up:before {
content: "\e6b6";
}
.uniui-top:before {
content: "\e6b6";
}
.uniui-left:before {
content: "\e6b7";
}
.uniui-arrowup:before {
content: "\e6d6";
}
.uniui-eye:before {
content: "\e651";
}
.uniui-eye-filled:before {
content: "\e66a";
}
.uniui-eye-slash:before {
content: "\e6b3";
}
.uniui-eye-slash-filled:before {
content: "\e6b4";
}
.uniui-info-filled:before {
content: "\e649";
}
.uniui-reload:before {
content: "\e6b2";
}
.uniui-micoff-filled:before {
content: "\e6b0";
}
.uniui-map-pin-ellipse:before {
content: "\e6ac";
}
.uniui-map-pin:before {
content: "\e6ad";
}
.uniui-location:before {
content: "\e6ae";
}
.uniui-starhalf:before {
content: "\e683";
}
.uniui-star:before {
content: "\e688";
}
.uniui-star-filled:before {
content: "\e68f";
}
.uniui-calendar:before {
content: "\e6a0";
}
.uniui-fire:before {
content: "\e6a1";
}
.uniui-medal:before {
content: "\e6a2";
}
.uniui-font:before {
content: "\e6a3";
}
.uniui-gift:before {
content: "\e6a4";
}
.uniui-link:before {
content: "\e6a5";
}
.uniui-notification:before {
content: "\e6a6";
}
.uniui-staff:before {
content: "\e6a7";
}
.uniui-vip:before {
content: "\e6a8";
}
.uniui-folder-add:before {
content: "\e6a9";
}
.uniui-tune:before {
content: "\e6aa";
}
.uniui-auth:before {
content: "\e6ab";
}
.uniui-person:before {
content: "\e699";
}
.uniui-email-filled:before {
content: "\e69a";
}
.uniui-phone-filled:before {
content: "\e69b";
}
.uniui-phone:before {
content: "\e69c";
}
.uniui-email:before {
content: "\e69e";
}
.uniui-personadd:before {
content: "\e69f";
}
.uniui-chatboxes-filled:before {
content: "\e692";
}
.uniui-contact:before {
content: "\e693";
}
.uniui-chatbubble-filled:before {
content: "\e694";
}
.uniui-contact-filled:before {
content: "\e695";
}
.uniui-chatboxes:before {
content: "\e696";
}
.uniui-chatbubble:before {
content: "\e697";
}
.uniui-upload-filled:before {
content: "\e68e";
}
.uniui-upload:before {
content: "\e690";
}
.uniui-weixin:before {
content: "\e691";
}
.uniui-compose:before {
content: "\e67f";
}
.uniui-qq:before {
content: "\e680";
}
.uniui-download-filled:before {
content: "\e681";
}
.uniui-pyq:before {
content: "\e682";
}
.uniui-sound:before {
content: "\e684";
}
.uniui-trash-filled:before {
content: "\e685";
}
.uniui-sound-filled:before {
content: "\e686";
}
.uniui-trash:before {
content: "\e687";
}
.uniui-videocam-filled:before {
content: "\e689";
}
.uniui-spinner-cycle:before {
content: "\e68a";
}
.uniui-weibo:before {
content: "\e68b";
}
.uniui-videocam:before {
content: "\e68c";
}
.uniui-download:before {
content: "\e68d";
}
.uniui-help:before {
content: "\e679";
}
.uniui-navigate-filled:before {
content: "\e67a";
}
.uniui-plusempty:before {
content: "\e67b";
}
.uniui-smallcircle:before {
content: "\e67c";
}
.uniui-minus-filled:before {
content: "\e67d";
}
.uniui-micoff:before {
content: "\e67e";
}
.uniui-closeempty:before {
content: "\e66c";
}
.uniui-clear:before {
content: "\e66d";
}
.uniui-navigate:before {
content: "\e66e";
}
.uniui-minus:before {
content: "\e66f";
}
.uniui-image:before {
content: "\e670";
}
.uniui-mic:before {
content: "\e671";
}
.uniui-paperplane:before {
content: "\e672";
}
.uniui-close:before {
content: "\e673";
}
.uniui-help-filled:before {
content: "\e674";
}
.uniui-paperplane-filled:before {
content: "\e675";
}
.uniui-plus:before {
content: "\e676";
}
.uniui-mic-filled:before {
content: "\e677";
}
.uniui-image-filled:before {
content: "\e678";
}
.uniui-locked-filled:before {
content: "\e668";
}
.uniui-info:before {
content: "\e669";
}
.uniui-locked:before {
content: "\e66b";
}
.uniui-camera-filled:before {
content: "\e658";
}
.uniui-chat-filled:before {
content: "\e659";
}
.uniui-camera:before {
content: "\e65a";
}
.uniui-circle:before {
content: "\e65b";
}
.uniui-checkmarkempty:before {
content: "\e65c";
}
.uniui-chat:before {
content: "\e65d";
}
.uniui-circle-filled:before {
content: "\e65e";
}
.uniui-flag:before {
content: "\e65f";
}
.uniui-flag-filled:before {
content: "\e660";
}
.uniui-gear-filled:before {
content: "\e661";
}
.uniui-home:before {
content: "\e662";
}
.uniui-home-filled:before {
content: "\e663";
}
.uniui-gear:before {
content: "\e664";
}
.uniui-smallcircle-filled:before {
content: "\e665";
}
.uniui-map-filled:before {
content: "\e666";
}
.uniui-map:before {
content: "\e667";
}
.uniui-refresh-filled:before {
content: "\e656";
}
.uniui-refresh:before {
content: "\e657";
}
.uniui-cloud-upload:before {
content: "\e645";
}
.uniui-cloud-download-filled:before {
content: "\e646";
}
.uniui-cloud-download:before {
content: "\e647";
}
.uniui-cloud-upload-filled:before {
content: "\e648";
}
.uniui-redo:before {
content: "\e64a";
}
.uniui-images-filled:before {
content: "\e64b";
}
.uniui-undo-filled:before {
content: "\e64c";
}
.uniui-more:before {
content: "\e64d";
}
.uniui-more-filled:before {
content: "\e64e";
}
.uniui-undo:before {
content: "\e64f";
}
.uniui-images:before {
content: "\e650";
}
.uniui-paperclip:before {
content: "\e652";
}
.uniui-settings:before {
content: "\e653";
}
.uniui-search:before {
content: "\e654";
}
.uniui-redo-filled:before {
content: "\e655";
}
.uniui-list:before {
content: "\e644";
}
.uniui-mail-open-filled:before {
content: "\e63a";
}
.uniui-hand-down-filled:before {
content: "\e63c";
}
.uniui-hand-down:before {
content: "\e63d";
}
.uniui-hand-up-filled:before {
content: "\e63e";
}
.uniui-hand-up:before {
content: "\e63f";
}
.uniui-heart-filled:before {
content: "\e641";
}
.uniui-mail-open:before {
content: "\e643";
}
.uniui-heart:before {
content: "\e639";
}
.uniui-loop:before {
content: "\e633";
}
.uniui-pulldown:before {
content: "\e632";
}
.uniui-scan:before {
content: "\e62a";
}
.uniui-bars:before {
content: "\e627";
}
.uniui-checkbox:before {
content: "\e62b";
}
.uniui-checkbox-filled:before {
content: "\e62c";
}
.uniui-shop:before {
content: "\e62f";
}
.uniui-headphones:before {
content: "\e630";
}
.uniui-cart:before {
content: "\e631";
}
@@ -1,664 +0,0 @@
export type IconsData = {
id : string
name : string
font_family : string
css_prefix_text : string
description : string
glyphs : Array<IconsDataItem>
}
export type IconsDataItem = {
font_class : string
unicode : string
}
export const fontData = [
{
"font_class": "arrow-down",
"unicode": "\ue6be"
},
{
"font_class": "arrow-left",
"unicode": "\ue6bc"
},
{
"font_class": "arrow-right",
"unicode": "\ue6bb"
},
{
"font_class": "arrow-up",
"unicode": "\ue6bd"
},
{
"font_class": "auth",
"unicode": "\ue6ab"
},
{
"font_class": "auth-filled",
"unicode": "\ue6cc"
},
{
"font_class": "back",
"unicode": "\ue6b9"
},
{
"font_class": "bars",
"unicode": "\ue627"
},
{
"font_class": "calendar",
"unicode": "\ue6a0"
},
{
"font_class": "calendar-filled",
"unicode": "\ue6c0"
},
{
"font_class": "camera",
"unicode": "\ue65a"
},
{
"font_class": "camera-filled",
"unicode": "\ue658"
},
{
"font_class": "cart",
"unicode": "\ue631"
},
{
"font_class": "cart-filled",
"unicode": "\ue6d0"
},
{
"font_class": "chat",
"unicode": "\ue65d"
},
{
"font_class": "chat-filled",
"unicode": "\ue659"
},
{
"font_class": "chatboxes",
"unicode": "\ue696"
},
{
"font_class": "chatboxes-filled",
"unicode": "\ue692"
},
{
"font_class": "chatbubble",
"unicode": "\ue697"
},
{
"font_class": "chatbubble-filled",
"unicode": "\ue694"
},
{
"font_class": "checkbox",
"unicode": "\ue62b"
},
{
"font_class": "checkbox-filled",
"unicode": "\ue62c"
},
{
"font_class": "checkmarkempty",
"unicode": "\ue65c"
},
{
"font_class": "circle",
"unicode": "\ue65b"
},
{
"font_class": "circle-filled",
"unicode": "\ue65e"
},
{
"font_class": "clear",
"unicode": "\ue66d"
},
{
"font_class": "close",
"unicode": "\ue673"
},
{
"font_class": "closeempty",
"unicode": "\ue66c"
},
{
"font_class": "cloud-download",
"unicode": "\ue647"
},
{
"font_class": "cloud-download-filled",
"unicode": "\ue646"
},
{
"font_class": "cloud-upload",
"unicode": "\ue645"
},
{
"font_class": "cloud-upload-filled",
"unicode": "\ue648"
},
{
"font_class": "color",
"unicode": "\ue6cf"
},
{
"font_class": "color-filled",
"unicode": "\ue6c9"
},
{
"font_class": "compose",
"unicode": "\ue67f"
},
{
"font_class": "contact",
"unicode": "\ue693"
},
{
"font_class": "contact-filled",
"unicode": "\ue695"
},
{
"font_class": "down",
"unicode": "\ue6b8"
},
{
"font_class": "bottom",
"unicode": "\ue6b8"
},
{
"font_class": "download",
"unicode": "\ue68d"
},
{
"font_class": "download-filled",
"unicode": "\ue681"
},
{
"font_class": "email",
"unicode": "\ue69e"
},
{
"font_class": "email-filled",
"unicode": "\ue69a"
},
{
"font_class": "eye",
"unicode": "\ue651"
},
{
"font_class": "eye-filled",
"unicode": "\ue66a"
},
{
"font_class": "eye-slash",
"unicode": "\ue6b3"
},
{
"font_class": "eye-slash-filled",
"unicode": "\ue6b4"
},
{
"font_class": "fire",
"unicode": "\ue6a1"
},
{
"font_class": "fire-filled",
"unicode": "\ue6c5"
},
{
"font_class": "flag",
"unicode": "\ue65f"
},
{
"font_class": "flag-filled",
"unicode": "\ue660"
},
{
"font_class": "folder-add",
"unicode": "\ue6a9"
},
{
"font_class": "folder-add-filled",
"unicode": "\ue6c8"
},
{
"font_class": "font",
"unicode": "\ue6a3"
},
{
"font_class": "forward",
"unicode": "\ue6ba"
},
{
"font_class": "gear",
"unicode": "\ue664"
},
{
"font_class": "gear-filled",
"unicode": "\ue661"
},
{
"font_class": "gift",
"unicode": "\ue6a4"
},
{
"font_class": "gift-filled",
"unicode": "\ue6c4"
},
{
"font_class": "hand-down",
"unicode": "\ue63d"
},
{
"font_class": "hand-down-filled",
"unicode": "\ue63c"
},
{
"font_class": "hand-up",
"unicode": "\ue63f"
},
{
"font_class": "hand-up-filled",
"unicode": "\ue63e"
},
{
"font_class": "headphones",
"unicode": "\ue630"
},
{
"font_class": "heart",
"unicode": "\ue639"
},
{
"font_class": "heart-filled",
"unicode": "\ue641"
},
{
"font_class": "help",
"unicode": "\ue679"
},
{
"font_class": "help-filled",
"unicode": "\ue674"
},
{
"font_class": "home",
"unicode": "\ue662"
},
{
"font_class": "home-filled",
"unicode": "\ue663"
},
{
"font_class": "image",
"unicode": "\ue670"
},
{
"font_class": "image-filled",
"unicode": "\ue678"
},
{
"font_class": "images",
"unicode": "\ue650"
},
{
"font_class": "images-filled",
"unicode": "\ue64b"
},
{
"font_class": "info",
"unicode": "\ue669"
},
{
"font_class": "info-filled",
"unicode": "\ue649"
},
{
"font_class": "left",
"unicode": "\ue6b7"
},
{
"font_class": "link",
"unicode": "\ue6a5"
},
{
"font_class": "list",
"unicode": "\ue644"
},
{
"font_class": "location",
"unicode": "\ue6ae"
},
{
"font_class": "location-filled",
"unicode": "\ue6af"
},
{
"font_class": "locked",
"unicode": "\ue66b"
},
{
"font_class": "locked-filled",
"unicode": "\ue668"
},
{
"font_class": "loop",
"unicode": "\ue633"
},
{
"font_class": "mail-open",
"unicode": "\ue643"
},
{
"font_class": "mail-open-filled",
"unicode": "\ue63a"
},
{
"font_class": "map",
"unicode": "\ue667"
},
{
"font_class": "map-filled",
"unicode": "\ue666"
},
{
"font_class": "map-pin",
"unicode": "\ue6ad"
},
{
"font_class": "map-pin-ellipse",
"unicode": "\ue6ac"
},
{
"font_class": "medal",
"unicode": "\ue6a2"
},
{
"font_class": "medal-filled",
"unicode": "\ue6c3"
},
{
"font_class": "mic",
"unicode": "\ue671"
},
{
"font_class": "mic-filled",
"unicode": "\ue677"
},
{
"font_class": "micoff",
"unicode": "\ue67e"
},
{
"font_class": "micoff-filled",
"unicode": "\ue6b0"
},
{
"font_class": "minus",
"unicode": "\ue66f"
},
{
"font_class": "minus-filled",
"unicode": "\ue67d"
},
{
"font_class": "more",
"unicode": "\ue64d"
},
{
"font_class": "more-filled",
"unicode": "\ue64e"
},
{
"font_class": "navigate",
"unicode": "\ue66e"
},
{
"font_class": "navigate-filled",
"unicode": "\ue67a"
},
{
"font_class": "notification",
"unicode": "\ue6a6"
},
{
"font_class": "notification-filled",
"unicode": "\ue6c1"
},
{
"font_class": "paperclip",
"unicode": "\ue652"
},
{
"font_class": "paperplane",
"unicode": "\ue672"
},
{
"font_class": "paperplane-filled",
"unicode": "\ue675"
},
{
"font_class": "person",
"unicode": "\ue699"
},
{
"font_class": "person-filled",
"unicode": "\ue69d"
},
{
"font_class": "personadd",
"unicode": "\ue69f"
},
{
"font_class": "personadd-filled",
"unicode": "\ue698"
},
{
"font_class": "personadd-filled-copy",
"unicode": "\ue6d1"
},
{
"font_class": "phone",
"unicode": "\ue69c"
},
{
"font_class": "phone-filled",
"unicode": "\ue69b"
},
{
"font_class": "plus",
"unicode": "\ue676"
},
{
"font_class": "plus-filled",
"unicode": "\ue6c7"
},
{
"font_class": "plusempty",
"unicode": "\ue67b"
},
{
"font_class": "pulldown",
"unicode": "\ue632"
},
{
"font_class": "pyq",
"unicode": "\ue682"
},
{
"font_class": "qq",
"unicode": "\ue680"
},
{
"font_class": "redo",
"unicode": "\ue64a"
},
{
"font_class": "redo-filled",
"unicode": "\ue655"
},
{
"font_class": "refresh",
"unicode": "\ue657"
},
{
"font_class": "refresh-filled",
"unicode": "\ue656"
},
{
"font_class": "refreshempty",
"unicode": "\ue6bf"
},
{
"font_class": "reload",
"unicode": "\ue6b2"
},
{
"font_class": "right",
"unicode": "\ue6b5"
},
{
"font_class": "scan",
"unicode": "\ue62a"
},
{
"font_class": "search",
"unicode": "\ue654"
},
{
"font_class": "settings",
"unicode": "\ue653"
},
{
"font_class": "settings-filled",
"unicode": "\ue6ce"
},
{
"font_class": "shop",
"unicode": "\ue62f"
},
{
"font_class": "shop-filled",
"unicode": "\ue6cd"
},
{
"font_class": "smallcircle",
"unicode": "\ue67c"
},
{
"font_class": "smallcircle-filled",
"unicode": "\ue665"
},
{
"font_class": "sound",
"unicode": "\ue684"
},
{
"font_class": "sound-filled",
"unicode": "\ue686"
},
{
"font_class": "spinner-cycle",
"unicode": "\ue68a"
},
{
"font_class": "staff",
"unicode": "\ue6a7"
},
{
"font_class": "staff-filled",
"unicode": "\ue6cb"
},
{
"font_class": "star",
"unicode": "\ue688"
},
{
"font_class": "star-filled",
"unicode": "\ue68f"
},
{
"font_class": "starhalf",
"unicode": "\ue683"
},
{
"font_class": "trash",
"unicode": "\ue687"
},
{
"font_class": "trash-filled",
"unicode": "\ue685"
},
{
"font_class": "tune",
"unicode": "\ue6aa"
},
{
"font_class": "tune-filled",
"unicode": "\ue6ca"
},
{
"font_class": "undo",
"unicode": "\ue64f"
},
{
"font_class": "undo-filled",
"unicode": "\ue64c"
},
{
"font_class": "up",
"unicode": "\ue6b6"
},
{
"font_class": "top",
"unicode": "\ue6b6"
},
{
"font_class": "upload",
"unicode": "\ue690"
},
{
"font_class": "upload-filled",
"unicode": "\ue68e"
},
{
"font_class": "videocam",
"unicode": "\ue68c"
},
{
"font_class": "videocam-filled",
"unicode": "\ue689"
},
{
"font_class": "vip",
"unicode": "\ue6a8"
},
{
"font_class": "vip-filled",
"unicode": "\ue6c6"
},
{
"font_class": "wallet",
"unicode": "\ue6b1"
},
{
"font_class": "wallet-filled",
"unicode": "\ue6c2"
},
{
"font_class": "weibo",
"unicode": "\ue68b"
},
{
"font_class": "weixin",
"unicode": "\ue691"
}
] as IconsDataItem[]
// export const fontData = JSON.parse<IconsDataItem>(fontDataJson)
@@ -1,649 +0,0 @@
export const fontData = [
{
"font_class": "arrow-down",
"unicode": "\ue6be"
},
{
"font_class": "arrow-left",
"unicode": "\ue6bc"
},
{
"font_class": "arrow-right",
"unicode": "\ue6bb"
},
{
"font_class": "arrow-up",
"unicode": "\ue6bd"
},
{
"font_class": "auth",
"unicode": "\ue6ab"
},
{
"font_class": "auth-filled",
"unicode": "\ue6cc"
},
{
"font_class": "back",
"unicode": "\ue6b9"
},
{
"font_class": "bars",
"unicode": "\ue627"
},
{
"font_class": "calendar",
"unicode": "\ue6a0"
},
{
"font_class": "calendar-filled",
"unicode": "\ue6c0"
},
{
"font_class": "camera",
"unicode": "\ue65a"
},
{
"font_class": "camera-filled",
"unicode": "\ue658"
},
{
"font_class": "cart",
"unicode": "\ue631"
},
{
"font_class": "cart-filled",
"unicode": "\ue6d0"
},
{
"font_class": "chat",
"unicode": "\ue65d"
},
{
"font_class": "chat-filled",
"unicode": "\ue659"
},
{
"font_class": "chatboxes",
"unicode": "\ue696"
},
{
"font_class": "chatboxes-filled",
"unicode": "\ue692"
},
{
"font_class": "chatbubble",
"unicode": "\ue697"
},
{
"font_class": "chatbubble-filled",
"unicode": "\ue694"
},
{
"font_class": "checkbox",
"unicode": "\ue62b"
},
{
"font_class": "checkbox-filled",
"unicode": "\ue62c"
},
{
"font_class": "checkmarkempty",
"unicode": "\ue65c"
},
{
"font_class": "circle",
"unicode": "\ue65b"
},
{
"font_class": "circle-filled",
"unicode": "\ue65e"
},
{
"font_class": "clear",
"unicode": "\ue66d"
},
{
"font_class": "close",
"unicode": "\ue673"
},
{
"font_class": "closeempty",
"unicode": "\ue66c"
},
{
"font_class": "cloud-download",
"unicode": "\ue647"
},
{
"font_class": "cloud-download-filled",
"unicode": "\ue646"
},
{
"font_class": "cloud-upload",
"unicode": "\ue645"
},
{
"font_class": "cloud-upload-filled",
"unicode": "\ue648"
},
{
"font_class": "color",
"unicode": "\ue6cf"
},
{
"font_class": "color-filled",
"unicode": "\ue6c9"
},
{
"font_class": "compose",
"unicode": "\ue67f"
},
{
"font_class": "contact",
"unicode": "\ue693"
},
{
"font_class": "contact-filled",
"unicode": "\ue695"
},
{
"font_class": "down",
"unicode": "\ue6b8"
},
{
"font_class": "bottom",
"unicode": "\ue6b8"
},
{
"font_class": "download",
"unicode": "\ue68d"
},
{
"font_class": "download-filled",
"unicode": "\ue681"
},
{
"font_class": "email",
"unicode": "\ue69e"
},
{
"font_class": "email-filled",
"unicode": "\ue69a"
},
{
"font_class": "eye",
"unicode": "\ue651"
},
{
"font_class": "eye-filled",
"unicode": "\ue66a"
},
{
"font_class": "eye-slash",
"unicode": "\ue6b3"
},
{
"font_class": "eye-slash-filled",
"unicode": "\ue6b4"
},
{
"font_class": "fire",
"unicode": "\ue6a1"
},
{
"font_class": "fire-filled",
"unicode": "\ue6c5"
},
{
"font_class": "flag",
"unicode": "\ue65f"
},
{
"font_class": "flag-filled",
"unicode": "\ue660"
},
{
"font_class": "folder-add",
"unicode": "\ue6a9"
},
{
"font_class": "folder-add-filled",
"unicode": "\ue6c8"
},
{
"font_class": "font",
"unicode": "\ue6a3"
},
{
"font_class": "forward",
"unicode": "\ue6ba"
},
{
"font_class": "gear",
"unicode": "\ue664"
},
{
"font_class": "gear-filled",
"unicode": "\ue661"
},
{
"font_class": "gift",
"unicode": "\ue6a4"
},
{
"font_class": "gift-filled",
"unicode": "\ue6c4"
},
{
"font_class": "hand-down",
"unicode": "\ue63d"
},
{
"font_class": "hand-down-filled",
"unicode": "\ue63c"
},
{
"font_class": "hand-up",
"unicode": "\ue63f"
},
{
"font_class": "hand-up-filled",
"unicode": "\ue63e"
},
{
"font_class": "headphones",
"unicode": "\ue630"
},
{
"font_class": "heart",
"unicode": "\ue639"
},
{
"font_class": "heart-filled",
"unicode": "\ue641"
},
{
"font_class": "help",
"unicode": "\ue679"
},
{
"font_class": "help-filled",
"unicode": "\ue674"
},
{
"font_class": "home",
"unicode": "\ue662"
},
{
"font_class": "home-filled",
"unicode": "\ue663"
},
{
"font_class": "image",
"unicode": "\ue670"
},
{
"font_class": "image-filled",
"unicode": "\ue678"
},
{
"font_class": "images",
"unicode": "\ue650"
},
{
"font_class": "images-filled",
"unicode": "\ue64b"
},
{
"font_class": "info",
"unicode": "\ue669"
},
{
"font_class": "info-filled",
"unicode": "\ue649"
},
{
"font_class": "left",
"unicode": "\ue6b7"
},
{
"font_class": "link",
"unicode": "\ue6a5"
},
{
"font_class": "list",
"unicode": "\ue644"
},
{
"font_class": "location",
"unicode": "\ue6ae"
},
{
"font_class": "location-filled",
"unicode": "\ue6af"
},
{
"font_class": "locked",
"unicode": "\ue66b"
},
{
"font_class": "locked-filled",
"unicode": "\ue668"
},
{
"font_class": "loop",
"unicode": "\ue633"
},
{
"font_class": "mail-open",
"unicode": "\ue643"
},
{
"font_class": "mail-open-filled",
"unicode": "\ue63a"
},
{
"font_class": "map",
"unicode": "\ue667"
},
{
"font_class": "map-filled",
"unicode": "\ue666"
},
{
"font_class": "map-pin",
"unicode": "\ue6ad"
},
{
"font_class": "map-pin-ellipse",
"unicode": "\ue6ac"
},
{
"font_class": "medal",
"unicode": "\ue6a2"
},
{
"font_class": "medal-filled",
"unicode": "\ue6c3"
},
{
"font_class": "mic",
"unicode": "\ue671"
},
{
"font_class": "mic-filled",
"unicode": "\ue677"
},
{
"font_class": "micoff",
"unicode": "\ue67e"
},
{
"font_class": "micoff-filled",
"unicode": "\ue6b0"
},
{
"font_class": "minus",
"unicode": "\ue66f"
},
{
"font_class": "minus-filled",
"unicode": "\ue67d"
},
{
"font_class": "more",
"unicode": "\ue64d"
},
{
"font_class": "more-filled",
"unicode": "\ue64e"
},
{
"font_class": "navigate",
"unicode": "\ue66e"
},
{
"font_class": "navigate-filled",
"unicode": "\ue67a"
},
{
"font_class": "notification",
"unicode": "\ue6a6"
},
{
"font_class": "notification-filled",
"unicode": "\ue6c1"
},
{
"font_class": "paperclip",
"unicode": "\ue652"
},
{
"font_class": "paperplane",
"unicode": "\ue672"
},
{
"font_class": "paperplane-filled",
"unicode": "\ue675"
},
{
"font_class": "person",
"unicode": "\ue699"
},
{
"font_class": "person-filled",
"unicode": "\ue69d"
},
{
"font_class": "personadd",
"unicode": "\ue69f"
},
{
"font_class": "personadd-filled",
"unicode": "\ue698"
},
{
"font_class": "personadd-filled-copy",
"unicode": "\ue6d1"
},
{
"font_class": "phone",
"unicode": "\ue69c"
},
{
"font_class": "phone-filled",
"unicode": "\ue69b"
},
{
"font_class": "plus",
"unicode": "\ue676"
},
{
"font_class": "plus-filled",
"unicode": "\ue6c7"
},
{
"font_class": "plusempty",
"unicode": "\ue67b"
},
{
"font_class": "pulldown",
"unicode": "\ue632"
},
{
"font_class": "pyq",
"unicode": "\ue682"
},
{
"font_class": "qq",
"unicode": "\ue680"
},
{
"font_class": "redo",
"unicode": "\ue64a"
},
{
"font_class": "redo-filled",
"unicode": "\ue655"
},
{
"font_class": "refresh",
"unicode": "\ue657"
},
{
"font_class": "refresh-filled",
"unicode": "\ue656"
},
{
"font_class": "refreshempty",
"unicode": "\ue6bf"
},
{
"font_class": "reload",
"unicode": "\ue6b2"
},
{
"font_class": "right",
"unicode": "\ue6b5"
},
{
"font_class": "scan",
"unicode": "\ue62a"
},
{
"font_class": "search",
"unicode": "\ue654"
},
{
"font_class": "settings",
"unicode": "\ue653"
},
{
"font_class": "settings-filled",
"unicode": "\ue6ce"
},
{
"font_class": "shop",
"unicode": "\ue62f"
},
{
"font_class": "shop-filled",
"unicode": "\ue6cd"
},
{
"font_class": "smallcircle",
"unicode": "\ue67c"
},
{
"font_class": "smallcircle-filled",
"unicode": "\ue665"
},
{
"font_class": "sound",
"unicode": "\ue684"
},
{
"font_class": "sound-filled",
"unicode": "\ue686"
},
{
"font_class": "spinner-cycle",
"unicode": "\ue68a"
},
{
"font_class": "staff",
"unicode": "\ue6a7"
},
{
"font_class": "staff-filled",
"unicode": "\ue6cb"
},
{
"font_class": "star",
"unicode": "\ue688"
},
{
"font_class": "star-filled",
"unicode": "\ue68f"
},
{
"font_class": "starhalf",
"unicode": "\ue683"
},
{
"font_class": "trash",
"unicode": "\ue687"
},
{
"font_class": "trash-filled",
"unicode": "\ue685"
},
{
"font_class": "tune",
"unicode": "\ue6aa"
},
{
"font_class": "tune-filled",
"unicode": "\ue6ca"
},
{
"font_class": "undo",
"unicode": "\ue64f"
},
{
"font_class": "undo-filled",
"unicode": "\ue64c"
},
{
"font_class": "up",
"unicode": "\ue6b6"
},
{
"font_class": "top",
"unicode": "\ue6b6"
},
{
"font_class": "upload",
"unicode": "\ue690"
},
{
"font_class": "upload-filled",
"unicode": "\ue68e"
},
{
"font_class": "videocam",
"unicode": "\ue68c"
},
{
"font_class": "videocam-filled",
"unicode": "\ue689"
},
{
"font_class": "vip",
"unicode": "\ue6a8"
},
{
"font_class": "vip-filled",
"unicode": "\ue6c6"
},
{
"font_class": "wallet",
"unicode": "\ue6b1"
},
{
"font_class": "wallet-filled",
"unicode": "\ue6c2"
},
{
"font_class": "weibo",
"unicode": "\ue68b"
},
{
"font_class": "weixin",
"unicode": "\ue691"
}
]
// export const fontData = JSON.parse<IconsDataItem>(fontDataJson)
@@ -1,111 +0,0 @@
{
"id": "uni-icons",
"displayName": "uni-icons 图标",
"version": "2.0.12",
"description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。",
"keywords": [
"uni-ui",
"uniui",
"icon",
"图标"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": "^3.2.14",
"uni-app": "^4.08",
"uni-app-x": "^4.61"
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue",
"darkmode": "x",
"i18n": "x",
"widescreen": "x"
},
"uni_modules": {
"dependencies": [
"uni-scss"
],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "x",
"aliyun": "x",
"alipay": "x"
},
"client": {
"uni-app": {
"vue": {
"vue2": "√",
"vue3": "√"
},
"web": {
"safari": "√",
"chrome": "√"
},
"app": {
"vue": "√",
"nvue": "-",
"android": {
"extVersion": "",
"minVersion": "29"
},
"ios": "√",
"harmony": "√"
},
"mp": {
"weixin": "√",
"alipay": "√",
"toutiao": "√",
"baidu": "√",
"kuaishou": "-",
"jd": "-",
"harmony": "-",
"qq": "√",
"lark": "-"
},
"quickapp": {
"huawei": "√",
"union": "√"
}
},
"uni-app-x": {
"web": {
"safari": "√",
"chrome": "√"
},
"app": {
"android": {
"extVersion": "",
"minVersion": "29"
},
"ios": "√",
"harmony": "√"
},
"mp": {
"weixin": "√"
}
}
}
}
}
}
@@ -1,8 +0,0 @@
## Icons 图标
> **组件名:uni-icons**
> 代码块: `uIcons`
用于展示 icons 图标 。
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-icons)
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
@@ -1,8 +0,0 @@
## 1.0.32022-01-21
- 优化 组件示例
## 1.0.22021-11-22
- 修复 / 符号在 vue 不同版本兼容问题引起的报错问题
## 1.0.12021-11-22
- 修复 vue3中scss语法兼容问题
## 1.0.02021-11-18
- init
@@ -1 +0,0 @@
@import './styles/index.scss';
@@ -1,82 +0,0 @@
{
"id": "uni-scss",
"displayName": "uni-scss 辅助样式",
"version": "1.0.3",
"description": "uni-sass是uni-ui提供的一套全局样式 ,通过一些简单的类名和sass变量,实现简单的页面布局操作,比如颜色、边距、圆角等。",
"keywords": [
"uni-scss",
"uni-ui",
"辅助样式"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"category": [
"JS SDK",
"通用 SDK"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "u"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
},
"快应用": {
"华为": "n",
"联盟": "n"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}
@@ -1,4 +0,0 @@
`uni-sass``uni-ui`提供的一套全局样式 ,通过一些简单的类名和`sass`变量,实现简单的页面布局操作,比如颜色、边距、圆角等。
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-sass)
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
@@ -1,7 +0,0 @@
@import './setting/_variables.scss';
@import './setting/_border.scss';
@import './setting/_color.scss';
@import './setting/_space.scss';
@import './setting/_radius.scss';
@import './setting/_text.scss';
@import './setting/_styles.scss';
@@ -1,3 +0,0 @@
.uni-border {
border: 1px $uni-border-1 solid;
}
@@ -1,66 +0,0 @@
// TODO 暂时不需要 class ,需要用户使用变量实现 ,如果使用类名其实并不推荐
// @mixin get-styles($k,$c) {
// @if $k == size or $k == weight{
// font-#{$k}:#{$c}
// }@else{
// #{$k}:#{$c}
// }
// }
$uni-ui-color:(
// 主色
primary: $uni-primary,
primary-disable: $uni-primary-disable,
primary-light: $uni-primary-light,
// 辅助色
success: $uni-success,
success-disable: $uni-success-disable,
success-light: $uni-success-light,
warning: $uni-warning,
warning-disable: $uni-warning-disable,
warning-light: $uni-warning-light,
error: $uni-error,
error-disable: $uni-error-disable,
error-light: $uni-error-light,
info: $uni-info,
info-disable: $uni-info-disable,
info-light: $uni-info-light,
// 中性色
main-color: $uni-main-color,
base-color: $uni-base-color,
secondary-color: $uni-secondary-color,
extra-color: $uni-extra-color,
// 背景色
bg-color: $uni-bg-color,
// 边框颜色
border-1: $uni-border-1,
border-2: $uni-border-2,
border-3: $uni-border-3,
border-4: $uni-border-4,
// 黑色
black:$uni-black,
// 白色
white:$uni-white,
// 透明
transparent:$uni-transparent
) !default;
@each $key, $child in $uni-ui-color {
.uni-#{"" + $key} {
color: $child;
}
.uni-#{"" + $key}-bg {
background-color: $child;
}
}
.uni-shadow-sm {
box-shadow: $uni-shadow-sm;
}
.uni-shadow-base {
box-shadow: $uni-shadow-base;
}
.uni-shadow-lg {
box-shadow: $uni-shadow-lg;
}
.uni-mask {
background-color:$uni-mask;
}
@@ -1,55 +0,0 @@
@mixin radius($r,$d:null ,$important: false){
$radius-value:map-get($uni-radius, $r) if($important, !important, null);
// Key exists within the $uni-radius variable
@if (map-has-key($uni-radius, $r) and $d){
@if $d == t {
border-top-left-radius:$radius-value;
border-top-right-radius:$radius-value;
}@else if $d == r {
border-top-right-radius:$radius-value;
border-bottom-right-radius:$radius-value;
}@else if $d == b {
border-bottom-left-radius:$radius-value;
border-bottom-right-radius:$radius-value;
}@else if $d == l {
border-top-left-radius:$radius-value;
border-bottom-left-radius:$radius-value;
}@else if $d == tl {
border-top-left-radius:$radius-value;
}@else if $d == tr {
border-top-right-radius:$radius-value;
}@else if $d == br {
border-bottom-right-radius:$radius-value;
}@else if $d == bl {
border-bottom-left-radius:$radius-value;
}
}@else{
border-radius:$radius-value;
}
}
@each $key, $child in $uni-radius {
@if($key){
.uni-radius-#{"" + $key} {
@include radius($key)
}
}@else{
.uni-radius {
@include radius($key)
}
}
}
@each $direction in t, r, b, l,tl, tr, br, bl {
@each $key, $child in $uni-radius {
@if($key){
.uni-radius-#{"" + $direction}-#{"" + $key} {
@include radius($key,$direction,false)
}
}@else{
.uni-radius-#{$direction} {
@include radius($key,$direction,false)
}
}
}
}
@@ -1,56 +0,0 @@
@mixin fn($space,$direction,$size,$n) {
@if $n {
#{$space}-#{$direction}: #{$size*$uni-space-root}px
} @else {
#{$space}-#{$direction}: #{-$size*$uni-space-root}px
}
}
@mixin get-styles($direction,$i,$space,$n){
@if $direction == t {
@include fn($space, top,$i,$n);
}
@if $direction == r {
@include fn($space, right,$i,$n);
}
@if $direction == b {
@include fn($space, bottom,$i,$n);
}
@if $direction == l {
@include fn($space, left,$i,$n);
}
@if $direction == x {
@include fn($space, left,$i,$n);
@include fn($space, right,$i,$n);
}
@if $direction == y {
@include fn($space, top,$i,$n);
@include fn($space, bottom,$i,$n);
}
@if $direction == a {
@if $n {
#{$space}:#{$i*$uni-space-root}px;
} @else {
#{$space}:#{-$i*$uni-space-root}px;
}
}
}
@each $orientation in m,p {
$space: margin;
@if $orientation == m {
$space: margin;
} @else {
$space: padding;
}
@for $i from 0 through 16 {
@each $direction in t, r, b, l, x, y, a {
.uni-#{$orientation}#{$direction}-#{$i} {
@include get-styles($direction,$i,$space,true);
}
.uni-#{$orientation}#{$direction}-n#{$i} {
@include get-styles($direction,$i,$space,false);
}
}
}
}
@@ -1,167 +0,0 @@
/* #ifndef APP-NVUE */
$-color-white:#fff;
$-color-black:#000;
@mixin base-style($color) {
color: #fff;
background-color: $color;
border-color: mix($-color-black, $color, 8%);
&:not([hover-class]):active {
background: mix($-color-black, $color, 10%);
border-color: mix($-color-black, $color, 20%);
color: $-color-white;
outline: none;
}
}
@mixin is-color($color) {
@include base-style($color);
&[loading] {
@include base-style($color);
&::before {
margin-right:5px;
}
}
&[disabled] {
&,
&[loading],
&:not([hover-class]):active {
color: $-color-white;
border-color: mix(darken($color,10%), $-color-white);
background-color: mix($color, $-color-white);
}
}
}
@mixin base-plain-style($color) {
color:$color;
background-color: mix($-color-white, $color, 90%);
border-color: mix($-color-white, $color, 70%);
&:not([hover-class]):active {
background: mix($-color-white, $color, 80%);
color: $color;
outline: none;
border-color: mix($-color-white, $color, 50%);
}
}
@mixin is-plain($color){
&[plain] {
@include base-plain-style($color);
&[loading] {
@include base-plain-style($color);
&::before {
margin-right:5px;
}
}
&[disabled] {
&,
&:active {
color: mix($-color-white, $color, 40%);
background-color: mix($-color-white, $color, 90%);
border-color: mix($-color-white, $color, 80%);
}
}
}
}
.uni-btn {
margin: 5px;
color: #393939;
border:1px solid #ccc;
font-size: 16px;
font-weight: 200;
background-color: #F9F9F9;
// TODO 暂时处理边框隐藏一边的问题
overflow: visible;
&::after{
border: none;
}
&:not([type]),&[type=default] {
color: #999;
&[loading] {
background: none;
&::before {
margin-right:5px;
}
}
&[disabled]{
color: mix($-color-white, #999, 60%);
&,
&[loading],
&:active {
color: mix($-color-white, #999, 60%);
background-color: mix($-color-white,$-color-black , 98%);
border-color: mix($-color-white, #999, 85%);
}
}
&[plain] {
color: #999;
background: none;
border-color: $uni-border-1;
&:not([hover-class]):active {
background: none;
color: mix($-color-white, $-color-black, 80%);
border-color: mix($-color-white, $-color-black, 90%);
outline: none;
}
&[disabled]{
&,
&[loading],
&:active {
background: none;
color: mix($-color-white, #999, 60%);
border-color: mix($-color-white, #999, 85%);
}
}
}
}
&:not([hover-class]):active {
color: mix($-color-white, $-color-black, 50%);
}
&[size=mini] {
font-size: 16px;
font-weight: 200;
border-radius: 8px;
}
&.uni-btn-small {
font-size: 14px;
}
&.uni-btn-mini {
font-size: 12px;
}
&.uni-btn-radius {
border-radius: 999px;
}
&[type=primary] {
@include is-color($uni-primary);
@include is-plain($uni-primary)
}
&[type=success] {
@include is-color($uni-success);
@include is-plain($uni-success)
}
&[type=error] {
@include is-color($uni-error);
@include is-plain($uni-error)
}
&[type=warning] {
@include is-color($uni-warning);
@include is-plain($uni-warning)
}
&[type=info] {
@include is-color($uni-info);
@include is-plain($uni-info)
}
}
/* #endif */
@@ -1,24 +0,0 @@
@mixin get-styles($k,$c) {
@if $k == size or $k == weight{
font-#{$k}:#{$c}
}@else{
#{$k}:#{$c}
}
}
@each $key, $child in $uni-headings {
/* #ifndef APP-NVUE */
.uni-#{$key} {
@each $k, $c in $child {
@include get-styles($k,$c)
}
}
/* #endif */
/* #ifdef APP-NVUE */
.container .uni-#{$key} {
@each $k, $c in $child {
@include get-styles($k,$c)
}
}
/* #endif */
}
@@ -1,146 +0,0 @@
// @use "sass:math";
@import '../tools/functions.scss';
// 间距基础倍数
$uni-space-root: 2 !default;
// 边框半径默认值
$uni-radius-root:5px !default;
$uni-radius: () !default;
// 边框半径断点
$uni-radius: map-deep-merge(
(
0: 0,
// TODO 当前版本暂时不支持 sm 属性
// 'sm': math.div($uni-radius-root, 2),
null: $uni-radius-root,
'lg': $uni-radius-root * 2,
'xl': $uni-radius-root * 6,
'pill': 9999px,
'circle': 50%
),
$uni-radius
);
// 字体家族
$body-font-family: 'Roboto', sans-serif !default;
// 文本
$heading-font-family: $body-font-family !default;
$uni-headings: () !default;
$letterSpacing: -0.01562em;
$uni-headings: map-deep-merge(
(
'h1': (
size: 32px,
weight: 300,
line-height: 50px,
// letter-spacing:-0.01562em
),
'h2': (
size: 28px,
weight: 300,
line-height: 40px,
// letter-spacing: -0.00833em
),
'h3': (
size: 24px,
weight: 400,
line-height: 32px,
// letter-spacing: normal
),
'h4': (
size: 20px,
weight: 400,
line-height: 30px,
// letter-spacing: 0.00735em
),
'h5': (
size: 16px,
weight: 400,
line-height: 24px,
// letter-spacing: normal
),
'h6': (
size: 14px,
weight: 500,
line-height: 18px,
// letter-spacing: 0.0125em
),
'subtitle': (
size: 12px,
weight: 400,
line-height: 20px,
// letter-spacing: 0.00937em
),
'body': (
font-size: 14px,
font-weight: 400,
line-height: 22px,
// letter-spacing: 0.03125em
),
'caption': (
'size': 12px,
'weight': 400,
'line-height': 20px,
// 'letter-spacing': 0.03333em,
// 'text-transform': false
)
),
$uni-headings
);
// 主色
$uni-primary: #2979ff !default;
$uni-primary-disable:lighten($uni-primary,20%) !default;
$uni-primary-light: lighten($uni-primary,25%) !default;
// 辅助色
// 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。
$uni-success: #18bc37 !default;
$uni-success-disable:lighten($uni-success,20%) !default;
$uni-success-light: lighten($uni-success,25%) !default;
$uni-warning: #f3a73f !default;
$uni-warning-disable:lighten($uni-warning,20%) !default;
$uni-warning-light: lighten($uni-warning,25%) !default;
$uni-error: #e43d33 !default;
$uni-error-disable:lighten($uni-error,20%) !default;
$uni-error-light: lighten($uni-error,25%) !default;
$uni-info: #8f939c !default;
$uni-info-disable:lighten($uni-info,20%) !default;
$uni-info-light: lighten($uni-info,25%) !default;
// 中性色
// 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。
$uni-main-color: #3a3a3a !default; // 主要文字
$uni-base-color: #6a6a6a !default; // 常规文字
$uni-secondary-color: #909399 !default; // 次要文字
$uni-extra-color: #c7c7c7 !default; // 辅助说明
// 边框颜色
$uni-border-1: #F0F0F0 !default;
$uni-border-2: #EDEDED !default;
$uni-border-3: #DCDCDC !default;
$uni-border-4: #B9B9B9 !default;
// 常规色
$uni-black: #000000 !default;
$uni-white: #ffffff !default;
$uni-transparent: rgba($color: #000000, $alpha: 0) !default;
// 背景色
$uni-bg-color: #f7f7f7 !default;
/* 水平间距 */
$uni-spacing-sm: 8px !default;
$uni-spacing-base: 15px !default;
$uni-spacing-lg: 30px !default;
// 阴影
$uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5) !default;
$uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2) !default;
$uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5) !default;
// 蒙版
$uni-mask: rgba($color: #000000, $alpha: 0.4) !default;

Some files were not shown because too many files have changed in this diff Show More