最新状态

This commit is contained in:
Ls
2026-03-26 08:34:32 +08:00
parent 22f77eb290
commit deaf39e943
43 changed files with 18037 additions and 86 deletions

143
AGENTS.md Normal file
View File

@@ -0,0 +1,143 @@
# AGENTS.md - Swimming uni-app Project
## Build & Development Commands
### Development Servers
```bash
npm run dev:h5 # Run H5 development server
npm run dev:mp-weixin # Run WeChat mini-program development
npm run dev:app # Run app development
npm run dev:app-android # Run Android app development
npm run dev:app-ios # Run iOS app development
npm run dev:mp-alipay # Run Alipay mini-program
npm run dev:mp-baidu # Run Baidu mini-program
npm run dev:mp-qq # Run QQ mini-program
npm run dev:mp-toutiao # Run Toutiao mini-program
```
### Build Commands
```bash
npm run build:h5 # Build for H5
npm run build:mp-weixin # Build for WeChat mini-program
npm run build:app # Build for app
npm run build:app-android # Build for Android
npm run build:app-ios # Build for iOS
```
### Type Checking
```bash
npm run type-check # Run TypeScript type checking (vue-tsc --noEmit)
```
### Testing
- **Note**: No test framework configured in this project yet.
## Code Style Guidelines
### Imports & Path Aliases
- Use `@/` alias for imports from `src/` directory (configured in `tsconfig.json`)
- Example: `import { Service } from '@/Service/Service'`
- Import Vue composition API functions from 'vue'
- Import uni-app lifecycle hooks from `@dcloudio/uni-app`
### File Structure
```
src/
├── pages/ # Page components (with sub-packages)
├── components/ # Reusable Vue components
├── Service/ # API services and utilities
├── common/ # Common utilities and helpers
├── static/ # Static assets (images, etc.)
├── types/ # TypeScript type definitions
├── uni_modules/ # Uni-app modules
└── colorui/ # ColorUI CSS framework
```
### Naming Conventions
- **Files**: PascalCase for components (e.g., `ImageCropper.vue`), camelCase for utilities
- **Components**: PascalCase for component names
- **Variables**: camelCase for local variables and functions
- **Constants**: UPPER_SNAKE_CASE for constants
- **Classes**: PascalCase for class names (e.g., `Service`)
- **CSS Classes**: kebab-case (e.g., `home-container`, `timer-card`)
### TypeScript
- Use `lang="ts"` in Vue SFC `<script>` tags
- Use `<script setup>` syntax for Vue 3 composition API
- Type function parameters and return values
- Use `any` sparingly, prefer proper type definitions
- Path alias: `@/*` maps to `./src/*`
### Vue Component Structure
```vue
<template>
<!-- Template with tabs for indentation -->
</template>
<script setup lang="ts">
// Imports first
// Composition API logic
// Functions
// Lifecycle hooks
</script>
<style lang="scss" scoped>
/* SCSS styles with nested structure */
</style>
```
### Formatting
- **Indentation**: Use tabs (not spaces) for indentation
- **Quotes**: Single quotes for strings in TypeScript/JavaScript
- **Semicolons**: Optional but consistent (project uses semicolons)
- **Line endings**: CRLF (Windows)
- **SCSS**: Use nested selectors, kebab-case class names
### Error Handling
- Use `Service.Msg()` for toast messages
- Use `Service.Alert()` for modal dialogs
- API requests through `Service.Request()` handle 401 (token expired) automatically
- Return `ResultData` objects from service methods
- Clean up intervals in `onUnmounted()` lifecycle hook
### UI Components
- Use **uview-plus** as primary UI component library
- Use **ColorUI** for CSS framework and icons
- Component prefix: `u-` for uview-plus components (e.g., `<u-icon>`, `<u-button>`)
### Service Layer Pattern
- Extend `BaseConfig` for service classes
- Use static methods for utility functions
- `Service` class provides:
- API requests: `Service.Request()`
- Navigation: `Service.GoPage()`, `Service.GoPageTab()`, `Service.GoPageBack()`
- Storage: `Service.SetStorageCache()`, `Service.GetStorageCache()`
- Messages: `Service.Msg()`, `Service.Alert()`
- Loading: `Service.LoadIng()`, `Service.LoadClose()`
### uni-app Specifics
- Use `uni.` API for platform-specific operations
- Pages registered in `src/pages.json`
- Tab bar configured in `src/pages.json`
- Use `rpx` units for responsive design
- Global styles in `src/App.vue` and `src/uni.scss`
### Git & Commit
- `.gitignore` includes `node_modules/`, `dist/`, `unpackage/`
- Commit messages should be descriptive (in Chinese or English)
### Key Dependencies
- Vue 3.4.21
- TypeScript 4.9.4
- Vite 5.2.8
- uni-app 3.0.0
- uview-plus 3.3.54
- dayjs (date manipulation)
- echarts (charts)
- vue-i18n (internationalization)
### No Existing Rules
- No `.cursor/rules/` or `.cursorrules` found
- No `.github/copilot-instructions.md` found
- No ESLint or Prettier configuration found
- Follow existing code patterns when making changes

14
package-lock.json generated
View File

@@ -12682,15 +12682,13 @@
}
},
"node_modules/uview-plus": {
"version": "3.3.54",
"resolved": "https://registry.npmmirror.com/uview-plus/-/uview-plus-3.3.54.tgz",
"integrity": "sha512-c/KcwTkbJed6ZZqxh7mreDFjtkq5ebNkMHsvgFn53xKVEbjWuGJ/zz4jOXWoO+n0r5hxH1LzrDXXDDiBDvqORA==",
"dependencies": {
"clipboard": "^2.0.11",
"dayjs": "^1.11.3"
},
"version": "3.7.13",
"resolved": "https://registry.npmmirror.com/uview-plus/-/uview-plus-3.7.13.tgz",
"integrity": "sha512-vHByf0kxKReYxam6BuU6wn/80giCkMaMUHEblhkf4kAjP852b86V3ctkjfGtV17MEIORFo3Vkve+HFnHNXpwNg==",
"engines": {
"HBuilderX": "^3.1.0"
"HBuilderX": "^3.1.0",
"uni-app": "^4.66",
"uni-app-x": ""
}
},
"node_modules/v8-to-istanbul": {

View File

@@ -1,9 +1,7 @@
<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import { NvpMerchService } from '@/Service/Nvp/NvpMerchService'
import { NvpMerchService } from '@/Service/Nvp/NvpMerchService'
onLaunch(() => {
uni.hideTabBar()
getUpData()
console.log("App Launch");
});
onShow(() => {
@@ -12,39 +10,16 @@
onHide(() => {
console.log("App Hide");
});
const getUpData=()=>{
// #ifdef APP
plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
NvpMerchService.GetAppVersion().then(res=>{
console.log('wgtinfo.versionCode',wgtinfo.versionCode);
if (res.data.version > wgtinfo.versionCode) {
setTimeout(function() {
uni.navigateTo({
url: "/pages/upData/upData?info=" +
encodeURIComponent(
JSON.stringify(res.data))
})
}, 1000)
}
})
})
// #endif
}
</script>
<style lang="scss">
@import "uview-plus/index.scss";
@import "colorui/main.css";
@import "colorui/icon.css";
page {
--nav-mian: #F84F28; //全局颜色
--nav-vice: #F59D77; //副颜色
--nav-diluted: #F2C0A3; //淡颜色
}
@import "colorui/icon.css";
</style>
page {
--nav-mian: #22a6f2; //全局颜色
--nav-vice: #00a2ff; //副颜色
--nav-diluted: #6ba9cd; //淡颜色
}
</style>

View File

@@ -15,6 +15,16 @@ export class Service extends BaseConfig {
}
}
//获取静态图片地址
static GetIconImg(path : string) {
return path;
if (path.startsWith('http') || path.startsWith('https')) {
return path;
} else {
return `${this.payuploadUrl}${path}`;
}
}
//获取图片地址
static GetMateUrlByImg(path : string) {
if (path.startsWith('http') || path.startsWith('https')) {
@@ -240,6 +250,13 @@ export class Service extends BaseConfig {
// 时间戳处理
static formatDate(time : any, type : number) : string {
if(time==0 && type==6 ){
return "00:00"
}
if(time==0 && type==5 ){
return "00"
}
const date = new Date(time);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始所以加1并用0填充
@@ -258,11 +275,14 @@ export class Service extends BaseConfig {
return `${hours}:${minutes}`;
} else if (type == 4) {
return `${year}${month}${day}`;
}else if (type == 5) {
return `${seconds}`;
}
else {
return `${hours}:${minutes}`;
}
}
/*****节流*****/

View File

@@ -0,0 +1,19 @@
export interface Project {
id: string;
name: string;
createdAt: number;
}
export interface StudentRecord {
id: string;
projectId: string;
name: string;
time: number;
createdAt: number;
}
export interface TimingState {
isRunning: boolean;
startTime: number;
elapsedTime: number;
}

View File

@@ -0,0 +1,69 @@
import type { Project, StudentRecord } from '../Domain/Project';
const STORAGE_KEYS = {
PROJECTS: 'swimming_projects',
RECORDS: 'swimming_records',
};
export class StorageManager {
static async getProjects(): Promise<Project[]> {
try {
const data = uni.getStorageSync(STORAGE_KEYS.PROJECTS);
return data ? JSON.parse(data) : [];
} catch {
return [];
}
}
static async saveProjects(projects: Project[]): Promise<void> {
uni.setStorageSync(STORAGE_KEYS.PROJECTS, JSON.stringify(projects));
}
static async addProject(project: Project): Promise<void> {
const projects = await this.getProjects();
projects.unshift(project);
await this.saveProjects(projects);
}
static async deleteProject(projectId: string): Promise<void> {
const projects = await this.getProjects();
const filtered = projects.filter(p => p.id !== projectId);
await this.saveProjects(filtered);
}
static async getRecordsByProject(projectId: string): Promise<StudentRecord[]> {
try {
const data = uni.getStorageSync(STORAGE_KEYS.RECORDS);
const records: StudentRecord[] = data ? JSON.parse(data) : [];
return records.filter(r => r.projectId === projectId);
} catch {
return [];
}
}
static async saveRecords(records: StudentRecord[]): Promise<void> {
uni.setStorageSync(STORAGE_KEYS.RECORDS, JSON.stringify(records));
}
static async addRecord(record: StudentRecord): Promise<void> {
try {
const data = uni.getStorageSync(STORAGE_KEYS.RECORDS);
const records: StudentRecord[] = data ? JSON.parse(data) : [];
records.unshift(record);
await this.saveRecords(records);
} catch {
const records: StudentRecord[] = [record];
await this.saveRecords(records);
}
}
static async deleteRecord(recordId: string): Promise<void> {
try {
const data = uni.getStorageSync(STORAGE_KEYS.RECORDS);
const records: StudentRecord[] = data ? JSON.parse(data) : [];
const filtered = records.filter(r => r.id !== recordId);
await this.saveRecords(filtered);
} catch {
}
}
}

View File

@@ -0,0 +1,22 @@
export function formatTime(ms: number): string {
if (ms < 0) ms = 0;
const totalSeconds = Math.floor(ms / 1000);
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60;
const milliseconds = Math.floor((ms % 1000) / 10);
const hh = hours.toString().padStart(2, '0');
const mm = minutes.toString().padStart(2, '0');
const ss = seconds.toString().padStart(2, '0');
const mmm = milliseconds.toString().padStart(2, '0');
if (hours > 0) {
return `${hh}:${mm}:${ss}.${mmm}`;
}
return `${mm}:${ss}.${mmm}`;
}
export function generateId(): string {
return Date.now().toString(36) + Math.random().toString(36).substr(2);
}

View File

@@ -1,5 +1,5 @@
{
"name" : "科讯代购",
"name" : "智能秒表",
"appid" : "__UNI__06C2D6A",
"description" : "",
"versionName" : "1.0.8",
@@ -112,7 +112,7 @@
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "",
"appid" : "wx6a9cfc961962b249",
"setting" : {
"urlCheck" : false
},

View File

@@ -8,46 +8,110 @@
}
},
"pages": [ //pages数组中第一项表示应用启动页参考https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "门店运营",
"navigationBarBackgroundColor": "#36394D",
"navigationStyle": "custom",
"backgroundColor": "#F8F8F8"
"navigationBarTitleText": "智能秒表"
}
},
{
"path" : "pages/index/user",
"style" :
{
"navigationBarTitleText" : "我的"
"path": "pages/index/user",
"style": {
"navigationBarTitleText": "我的"
}
}
],
"subPackages": [{
"root": "pages/userFunc",
"pages": [{
"path" : "setCourse",
"style" :
{
"navigationBarTitleText" : "新增项目"
}
},
{
"path" : "swiming",
"style" :
{
"navigationBarTitleText" : "游泳项目",
"navigationStyle": "custom"
}
},
{
"path" : "segmentation",
"style" :
{
"navigationBarTitleText" : "分段"
}
},
{
"path" : "student",
"style" :
{
"navigationBarTitleText" : "学员管理"
}
},
{
"path" : "analyze",
"style" :
{
"navigationBarTitleText" : "数据分析"
}
},
{
"path" : "dataAnalyze",
"style" :
{
"navigationBarTitleText" : "数据分析图"
}
},
{
"path" : "set",
"style" :
{
"navigationBarTitleText" : "设置"
}
},
{
"path" : "projectList",
"style" :
{
"navigationBarTitleText" : "项目列表"
}
},
{
"path" : "project",
"style" :
{
"navigationBarTitleText" : "包干"
}
}]
}],
"globalStyle": {
"navigationBarTextStyle": "white",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "v派商家",
"navigationBarBackgroundColor": "#F84F28",
"backgroundColor": "#F8F8F8"
"navigationBarBackgroundColor": "#fff",
"backgroundColor": "#000"
},
"tabBar": {
"color": "#000",
"selectedColor": "#000",
"backgroundColor": "#FFFFFF",
"list": [ {
"pagePath": "pages/index/index",
"iconPath": "static/tab/01.png",
"selectedIconPath": "static/tab/02.png",
"text": "主页"
}, {
"pagePath": "pages/index/user",
"iconPath": "static/tab/01.png",
"selectedIconPath": "static/tab/02.png",
"text": "我的"
}
"list": [{
"pagePath": "pages/index/index",
"iconPath": "static/tab/01.png",
"selectedIconPath": "static/tab/02.png",
"text": "智能秒表"
},
{
"pagePath": "pages/index/user",
"iconPath": "static/tab/01.png",
"selectedIconPath": "static/tab/02.png",
"text": "我的"
}
]
}
}

View File

@@ -1,29 +1,407 @@
<template>
<view>
11111
<view class="home-container">
<!-- 项目列表区域 -->
<view v-if="projects.length > 0" class="projects-section">
<!-- 计时器模块 -->
<view class="timer-card">
<view class="timer-header">
<text class="timer-title">计时模块</text>
<view class="" style="display: flex; align-items: center; justify-content: space-between;" >
<text class="task-count">1个任务</text>
</view>
</view>
<view @click="Service.GoPage('/pages/userFunc/swiming')" class="timer-content">
<view class="timer-circle">
<view class="circle-progress">
<view class="progress-ring">
<view class="ring-inner">
<u-icon name="clock" size="32" color="#1890ff"></u-icon>
</view>
</view>
</view>
</view>
<view class="timer-info">
<text class="timer-name">自由泳500米</text>
<text class="timer-time">00:00''00</text>
</view>
<view class="timer-control">
<u-icon name="play-circle" size="30" color="#1890ff" ></u-icon>
</view>
</view>
</view>
</view>
<!-- 空状态 -->
<view v-else class="empty-state-container">
<!-- 主卡片 -->
<view class="main-card" style="position: relative">
<!-- 顶部计时器图标 -->
<view class="timer-icon"
style="position: absolute; top: -20rpx; right: -20rpx">
<u-icon name="clock" bold="true" size="24" color="#666"></u-icon>
</view>
<!-- 游泳图标 -->
<view class="swim-icon">
<img :src="Service.GetIconImg('/static/index/swiming.png')" style="width: 100rpx; height: 100rpx"
alt="" />
</view>
</view>
<!-- 提示文字 -->
<view class="message-section">
<text class="title">暂无项目</text>
<text class="subtitle"> 您的计时列表目前是空的点击下方按钮开始您的第一次游泳训练记录吧 </text>
</view>
<!-- 添加项目按钮 -->
<view class="action-section">
<button class="add-project-btn" @click="addProject">
<u-icon name="plus" size="24" color="#fff"></u-icon>
<text class="btn-text">添加项目</text>
</button>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { onShow, onLoad } from '@dcloudio/uni-app';
import { NvpAgentService, Service } from '@/Service/Nvp/NvpAgentService';
import { ref, computed, onMounted, onUnmounted } from 'vue'
import { Service } from '@/Service/Service'
// 模拟项目数据
const projects = ref([{}])
onShow(() => {
// 计时器状态
const isTimerRunning = ref(true)
const timerSeconds = ref(784) // 13分04秒
let timerInterval : number | null = null
// 添加项目
const addProject = () => {
// 这里可以添加导航到项目设置页面的逻辑
uni.navigateTo({
url: '/pages/userFunc/setCourse',
})
}
// 生命周期
onMounted(() => {
})
onLoad(() => {
onUnmounted(() => {
if (timerInterval) {
clearInterval(timerInterval)
}
})
</script>
<style lang="scss">
<style lang="scss" >
page {
background-color: #fdfdfd;
background-color: #f5f5f5;
}
.home-container {
padding: 20rpx;
}
/* 项目列表区域 */
.projects-section {
padding: 20rpx 0;
}
/* 计时器卡片 */
.timer-card {
background-color: #fff;
border-radius: 20rpx;
padding: 30rpx;
margin-bottom: 20rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.timer-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30rpx;
.timer-title {
font-size: 28rpx;
font-weight: 600;
color: #333;
}
.task-count {
font-size: 24rpx;
color: #666;
}
}
.timer-content {
display: flex;
align-items: center;
gap: 30rpx;
}
.timer-circle {
position: relative;
}
.circle-progress {
width: 120rpx;
height: 120rpx;
position: relative;
}
.progress-ring {
width: 100%;
height: 100%;
border-radius: 50%;
background: conic-gradient(#1890ff 0deg, #e6f7ff 0deg);
display: flex;
align-items: center;
justify-content: center;
}
.ring-inner {
width: 90rpx;
height: 90rpx;
background-color: #fff;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.timer-info {
flex: 1;
}
.timer-name {
font-size: 28rpx;
font-weight: 600;
color: #333;
margin-bottom: 10rpx;
display: block;
}
.timer-time {
font-size: 40rpx;
font-weight: 700;
color: #333;
margin-bottom: 10rpx;
display: block;
}
.timer-status {
display: flex;
align-items: center;
gap: 8rpx;
}
.status-dot {
width: 12rpx;
height: 12rpx;
border-radius: 50%;
}
.status-dot.running {
background-color: #52c41a;
}
.status-dot.paused {
background-color: #faad14;
}
.status-dot.waiting {
background-color: #999;
}
.status-text {
font-size: 22rpx;
color: #666;
}
.timer-control {
padding-left: 20rpx;
}
/* 日常习惯区域 */
.routine-section {
background-color: #fff;
border-radius: 20rpx;
padding: 30rpx;
margin-bottom: 20rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.routine-title {
font-size: 20rpx;
color: #999;
margin-bottom: 10rpx;
display: block;
}
.habit-title {
font-size: 28rpx;
font-weight: 600;
color: #333;
margin-bottom: 5rpx;
display: block;
}
.habit-count {
font-size: 24rpx;
color: #666;
margin-bottom: 30rpx;
display: block;
}
.habit-list {
space-y: 20rpx;
}
.habit-item {
display: flex;
align-items: center;
gap: 20rpx;
padding: 20rpx 0;
border-bottom: 1rpx solid #f0f0f0;
}
.habit-item:last-child {
border-bottom: none;
}
.habit-icon {
width: 80rpx;
height: 80rpx;
background-color: #f5f5f5;
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: center;
}
.habit-info {
flex: 1;
}
.habit-name {
font-size: 26rpx;
font-weight: 500;
color: #333;
margin-bottom: 5rpx;
display: block;
}
.habit-time {
font-size: 32rpx;
font-weight: 600;
color: #333;
display: block;
}
.habit-control {
padding-right: 20rpx;
}
.habit-status {
display: flex;
align-items: center;
gap: 8rpx;
}
/* 空状态 */
.empty-state-container {
display: flex;
flex-direction: column;
align-items: center;
padding: 60rpx 40rpx;
position: relative;
}
/* 顶部计时器图标 */
.timer-icon {
width: 80rpx;
height: 80rpx;
background-color: #fff;
border-radius: 20rpx;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
z-index: 10;
}
/* 主卡片 */
.main-card {
width: 320rpx;
height: 320rpx;
background-color: #fff;
border-radius: 24rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
margin-bottom: 60rpx;
position: relative;
}
/* 提示文字 */
.message-section {
text-align: center;
margin-bottom: 80rpx;
.title {
font-size: 36rpx;
font-weight: 600;
color: #333;
margin-bottom: 20rpx;
display: block;
}
.subtitle {
font-size: 26rpx;
color: #666;
line-height: 1.5;
padding: 0 20rpx;
}
}
/* 添加项目按钮 */
.action-section {
width: 100%;
max-width: 600rpx;
.add-project-btn {
width: 100%;
height: 88rpx;
background-color: #1890ff;
color: #fff;
font-size: 32rpx;
font-weight: 600;
border-radius: 12rpx;
border: none;
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
box-shadow: 0 4rpx 12rpx rgba(24, 144, 255, 0.3);
.btn-text {
font-size: 32rpx;
color: #fff;
}
}
}
</style>

View File

@@ -1,19 +1,401 @@
<template>
<view>
</view>
<view class="user-container">
<!-- 用户信息卡片 -->
<view class="user-card">
<view class="user-avatar">
<view class="avatar-circle">
<u-icon name="account" size="52" color="#fff"></u-icon>
</view>
</view>
<view class="user-info">
<text class="user-nickname">游泳爱好者</text>
<view class="user-phone-wrapper">
<u-icon name="phone" size="14" color="rgba(255,255,255,0.7)"></u-icon>
<text class="user-phone">138****8888</text>
</view>
</view>
<view @click="Service.GoPage('/pages/userFunc/set')" class="user-edit">
<u-icon name="edit-pen" size="20" color="rgba(255,255,255,0.8)"></u-icon>
</view>
</view>
<!-- 统计数据区域 -->
<view class="stats-section">
<view class="stats-card">
<view class="stat-item">
<text class="stat-value">12</text>
<text class="stat-label">我的项目</text>
</view>
<view class="stat-divider"></view>
<view class="stat-item">
<text class="stat-value">8</text>
<text class="stat-label">记录数</text>
</view>
<view class="stat-divider"></view>
<view class="stat-item">
<text class="stat-value">8</text>
<text class="stat-label">学员数</text>
</view>
</view>
</view>
<!-- 功能菜单区域 -->
<view class="menu-section">
<view class="menu-card">
<view class="menu-item" @click="Service.GoPage('/pages/userFunc/projectList')">
<view class="menu-icon project-icon">
<u-icon name="list" size="26" color="#fff"></u-icon>
</view>
<view class="menu-content">
<text class="menu-title">项目管理</text>
<text class="menu-desc">管理训练项目和设置</text>
</view>
<view class="menu-arrow">
<u-icon name="arrow-right" size="18" color="#ccc"></u-icon>
</view>
</view>
<view class="menu-divider"></view>
<view class="menu-item" @click="Service.GoPage('/pages/userFunc/student')">
<view class="menu-icon academy-icon">
<u-icon name="grid" size="26" color="#fff"></u-icon>
</view>
<view class="menu-content">
<text class="menu-title">学员管理</text>
<text class="menu-desc">管理学员信息和课程</text>
</view>
<view class="menu-arrow">
<u-icon name="arrow-right" size="18" color="#ccc"></u-icon>
</view>
</view>
<view class="menu-divider"></view>
<view class="menu-item" @click="Service.GoPage('/pages/userFunc/analyze')" >
<view class="menu-icon analysis-icon">
<u-icon name="order" size="26" color="#fff"></u-icon>
</view>
<view class="menu-content">
<text class="menu-title">数据分析</text>
<text class="menu-desc">查看训练数据和统计</text>
</view>
<view class="menu-arrow">
<u-icon name="arrow-right" size="18" color="#ccc"></u-icon>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { onShow,onLoad } from "@dcloudio/uni-app";
onLoad(() => {
import { onShow, onLoad } from "@dcloudio/uni-app"
import { Service } from '@/Service/Service'
});
onLoad(() => {
onShow(() => {
})
});
onShow(() => {
})
// 跳转到设置
const goToSettings = () => {
Service.Msg('系统设置功能开发中')
}
// 跳转到关于
const goToAbout = () => {
Service.Msg('关于我们功能开发中')
}
</script>
<style lang="scss">
<style lang="scss" scoped>
page {
background-color: #f5f5f5;
}
.user-container {
padding: 20rpx;
padding-top: 30rpx;
padding-bottom: 40rpx;
}
/* 用户信息卡片 */
.user-card {
background: linear-gradient(135deg, #1890ff 0%, #36cfc9 50%, #096dd9 100%);
border-radius: 28rpx;
padding: 40rpx 30rpx;
margin-bottom: 24rpx;
display: flex;
align-items: center;
gap: 20rpx;
box-shadow: 0 12rpx 32rpx rgba(24, 144, 255, 0.35),
0 4rpx 12rpx rgba(24, 144, 255, 0.2);
position: relative;
overflow: hidden;
&::before {
content: '';
position: absolute;
top: -60%;
right: -40%;
width: 400rpx;
height: 400rpx;
background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, transparent 70%);
pointer-events: none;
}
&::after {
content: '';
position: absolute;
bottom: -40%;
left: -20%;
width: 300rpx;
height: 300rpx;
background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
pointer-events: none;
}
}
.user-avatar {
position: relative;
z-index: 1;
.avatar-circle {
width: 130rpx;
height: 130rpx;
background: rgba(255, 255, 255, 0.3);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
border: 5rpx solid rgba(255, 255, 255, 0.4);
backdrop-filter: blur(20rpx);
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.1);
}
.avatar-badge {
position: absolute;
bottom: 0;
right: 0;
width: 44rpx;
height: 44rpx;
background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
border: 3rpx solid #fff;
box-shadow: 0 4rpx 12rpx rgba(82, 196, 26, 0.4);
}
}
.user-info {
flex: 1;
position: relative;
z-index: 1;
.user-nickname {
font-size: 38rpx;
font-weight: 700;
color: #fff;
margin-bottom: 14rpx;
display: block;
text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
}
.user-phone-wrapper {
display: flex;
align-items: center;
gap: 8rpx;
.user-phone {
font-size: 26rpx;
color: rgba(255, 255, 255, 0.9);
font-weight: 500;
}
}
}
.user-edit {
width: 60rpx;
height: 60rpx;
background: rgba(255, 255, 255, 0.2);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
backdrop-filter: blur(10rpx);
position: relative;
z-index: 1;
transition: all 0.3s ease;
&:active {
background: rgba(255, 255, 255, 0.35);
transform: scale(0.95);
}
}
/* 统计数据区域 */
.stats-section {
margin-bottom: 24rpx;
.stats-card {
background-color: #fff;
border-radius: 24rpx;
padding: 30rpx 20rpx;
display: flex;
align-items: center;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
}
.stat-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
gap: 8rpx;
.stat-value {
font-size: 40rpx;
font-weight: 700;
background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.stat-label {
font-size: 24rpx;
color: #999;
font-weight: 500;
}
}
.stat-divider {
width: 1rpx;
height: 60rpx;
background: linear-gradient(180deg, transparent 0%, #e8e8e8 50%, transparent 100%);
}
}
/* 功能菜单区域 */
.menu-section,
.settings-section {
margin-bottom: 24rpx;
.menu-card {
background-color: #fff;
border-radius: 24rpx;
padding: 10rpx 0;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
overflow: hidden;
}
.menu-item {
display: flex;
align-items: center;
padding: 32rpx 30rpx;
transition: all 0.25s ease;
position: relative;
&::after {
content: '';
position: absolute;
left: 30rpx;
right: 30rpx;
bottom: 0;
height: 100%;
background: linear-gradient(90deg, rgba(24, 144, 255, 0.05) 0%, transparent 100%);
opacity: 0;
transition: opacity 0.25s ease;
pointer-events: none;
}
&:active {
background-color: #fafafa;
&::after {
opacity: 1;
}
}
}
.menu-icon {
width: 88rpx;
height: 88rpx;
border-radius: 20rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 24rpx;
box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease;
&.project-icon {
background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
}
&.academy-icon {
background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
}
&.analysis-icon {
background: linear-gradient(135deg, #faad14 0%, #d48806 100%);
}
&.settings-icon {
background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
}
&.about-icon {
background: linear-gradient(135deg, #722ed1 0%, #531dab 100%);
}
}
.menu-content {
flex: 1;
.menu-title {
font-size: 32rpx;
font-weight: 600;
color: #333;
margin-bottom: 6rpx;
display: block;
}
.menu-desc {
font-size: 24rpx;
color: #999;
}
}
.menu-arrow {
transition: transform 0.3s ease;
}
.menu-item:active {
.menu-icon {
transform: scale(0.95);
}
.menu-arrow {
transform: translateX(6rpx);
}
}
.menu-divider {
height: 1rpx;
background: linear-gradient(90deg, transparent 0%, #f0f0f0 20%, #f0f0f0 80%, transparent 100%);
margin: 0 30rpx;
}
}
</style>

View File

@@ -0,0 +1,426 @@
<template>
<view class="analyze-container">
<!-- 页面标题区域 -->
<view class="header-section">
<view class="header-title">
<text class="title">数据分析</text>
<text class="subtitle">训练数据统计与分析</text>
</view>
</view>
<!-- 统计数据卡片 -->
<view class="stats-section">
<view class="stats-card">
<view class="stat-item">
<text class="stat-value">{{ projects.length }}</text>
<text class="stat-label">项目总数</text>
</view>
<view class="stat-divider"></view>
<view class="stat-item">
<text class="stat-value">{{ totalStudents }}</text>
<text class="stat-label">学员总数</text>
</view>
<view class="stat-divider"></view>
<view class="stat-item">
<text class="stat-value">{{ totalRecords }}</text>
<text class="stat-label">记录次数</text>
</view>
</view>
</view>
<!-- 项目列表区域 -->
<view class="projects-section">
<view class="section-header">
<text class="section-title">项目列表</text>
<text class="section-count">{{ projects.length }}个项目</text>
</view>
<view v-if="projects.length === 0" class="empty-state">
<view class="empty-icon">
<u-icon name="chart" size="64" color="#ddd"></u-icon>
</view>
<text class="empty-text">暂无数据</text>
<text class="empty-desc">创建项目后这里会显示数据分析</text>
</view>
<view v-else class="projects-list">
<view v-for="(project, index) in projects" :key="project.id" class="project-card"
@click="Service.GoPage('/pages/userFunc/dataAnalyze')">
<view class="project-header">
<view class="project-mode" :class="getModeClass(project.mode)">
<text class="mode-text">{{ project.mode }}</text>
</view>
<view class="project-time">
<u-icon name="clock" size="14" color="#999"></u-icon>
<text class="time-text">{{ project.createTime }}</text>
</view>
</view>
<view class="project-info">
<text class="project-name">{{ project.name }}</text>
<view class="project-stats">
<view class="stat-badge">
<u-icon name="account" size="14" color="#1890ff"></u-icon>
<text class="badge-text">{{ project.studentCount }}位学员</text>
</view>
<view v-if="project.recordCount > 0" class="stat-badge record-badge">
<u-icon name="checkmark-circle" size="14" color="#52c41a"></u-icon>
<text class="badge-text">{{ project.recordCount }}次记录</text>
</view>
</view>
</view>
<view class="project-arrow">
<u-icon name="arrow-right" size="18" color="#ccc"></u-icon>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { onShow, onLoad } from "@dcloudio/uni-app"
import { Service } from '@/Service/Service'
import { ref, computed, } from 'vue'
// 定义项目类型
interface Project {
id : string
name : string
mode : '计时' | '包干' | '分段'
createTime : string
studentCount : number
recordCount : number
}
// 项目列表数据
const projects = ref<Project[]>([
{
id: '001',
name: '自由泳50米',
mode: '计时',
createTime: '2024-01-15 14:30',
studentCount: 8,
recordCount: 24
},
{
id: '002',
name: '蛙泳100米',
mode: '包干',
createTime: '2024-01-14 10:15',
studentCount: 6,
recordCount: 18
},
{
id: '003',
name: '仰泳200米',
mode: '分段',
createTime: '2024-01-13 16:45',
studentCount: 5,
recordCount: 20
},
{
id: '004',
name: '蝶泳50米',
mode: '计时',
createTime: '2024-01-12 09:20',
studentCount: 4,
recordCount: 12
},
{
id: '005',
name: '混合泳100米',
mode: '包干',
createTime: '2024-01-11 15:00',
studentCount: 7,
recordCount: 21
}
])
// 计算统计数据
const totalStudents = computed(() => {
return projects.value.reduce((sum, p) => sum + p.studentCount, 0)
})
const totalRecords = computed(() => {
return projects.value.reduce((sum, p) => sum + p.recordCount, 0)
})
onLoad(() => {
})
onShow(() => {
})
// 获取模式对应的样式类
const getModeClass = (mode : string) => {
const classMap : Record<string, string> = {
'计时': 'mode-timing',
'包干': 'mode-package',
'分段': 'mode-segment'
}
return classMap[mode] || ''
}
</script>
<style lang="scss" scoped>
page {
background-color: #f5f5f5;
}
.analyze-container {
min-height: 100vh;
padding: 20rpx;
padding-bottom: 40rpx;
}
/* 页面标题区域 */
.header-section {
margin-bottom: 24rpx;
.header-title {
.title {
font-size: 36rpx;
font-weight: 700;
color: #333;
display: block;
margin-bottom: 8rpx;
}
.subtitle {
font-size: 24rpx;
color: #999;
}
}
}
/* 统计数据区域 */
.stats-section {
margin-bottom: 24rpx;
.stats-card {
background-color: #fff;
border-radius: 24rpx;
padding: 30rpx 20rpx;
display: flex;
align-items: center;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
}
.stat-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
gap: 8rpx;
.stat-value {
font-size: 44rpx;
font-weight: 700;
background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.stat-label {
font-size: 24rpx;
color: #999;
font-weight: 500;
}
}
.stat-divider {
width: 1rpx;
height: 60rpx;
background: linear-gradient(180deg, transparent 0%, #e8e8e8 50%, transparent 100%);
}
}
/* 项目列表区域 */
.projects-section {
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.section-title {
font-size: 30rpx;
font-weight: 600;
color: #333;
}
.section-count {
font-size: 24rpx;
color: #999;
background-color: #f5f5f5;
padding: 6rpx 16rpx;
border-radius: 16rpx;
}
}
.empty-state {
background-color: #fff;
border-radius: 24rpx;
padding: 100rpx 40rpx;
display: flex;
flex-direction: column;
align-items: center;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
.empty-icon {
margin-bottom: 24rpx;
opacity: 0.6;
}
.empty-text {
font-size: 30rpx;
font-weight: 600;
color: #666;
margin-bottom: 12rpx;
}
.empty-desc {
font-size: 24rpx;
color: #999;
}
}
}
.projects-list {
.project-card {
background-color: #fff;
border-radius: 20rpx;
padding: 28rpx 24rpx;
margin-bottom: 16rpx;
display: flex;
align-items: center;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
&::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 6rpx;
background: linear-gradient(180deg, #1890ff 0%, #096dd9 100%);
opacity: 0;
transition: opacity 0.3s ease;
}
&:active {
transform: scale(0.98);
box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0.04);
&::before {
opacity: 1;
}
}
.project-header {
position: absolute;
top: 20rpx;
right: 24rpx;
display: flex;
align-items: center;
gap: 12rpx;
.project-mode {
padding: 6rpx 14rpx;
border-radius: 12rpx;
font-size: 22rpx;
font-weight: 600;
&.mode-timing {
background-color: #e6f7ff;
color: #1890ff;
}
&.mode-package {
background-color: #fff7e6;
color: #faad14;
}
&.mode-segment {
background-color: #f6ffed;
color: #52c41a;
}
.mode-text {
font-size: 22rpx;
font-weight: 600;
}
}
.project-time {
display: flex;
align-items: center;
gap: 6rpx;
.time-text {
font-size: 22rpx;
color: #999;
}
}
}
.project-info {
flex: 1;
padding-right: 60rpx;
.project-name {
font-size: 32rpx;
font-weight: 600;
color: #333;
display: block;
margin-bottom: 16rpx;
}
.project-stats {
display: flex;
gap: 12rpx;
flex-wrap: wrap;
.stat-badge {
display: flex;
align-items: center;
gap: 6rpx;
padding: 8rpx 14rpx;
background-color: #f5f5f5;
border-radius: 12rpx;
&.record-badge {
background-color: #f6ffed;
}
.badge-text {
font-size: 22rpx;
color: #666;
font-weight: 500;
}
}
}
}
.project-arrow {
position: absolute;
right: 24rpx;
top: 50%;
transform: translateY(-50%);
transition: transform 0.3s ease;
}
&:active .project-arrow {
transform: translateY(-50%) translateX(6rpx);
}
}
}
</style>

View File

@@ -0,0 +1,280 @@
<template>
<view class="data-analyze-container">
<!-- 页面标题区域 -->
<view class="header-section">
<view class="header-title">
<text class="title">数据图表</text>
<text class="subtitle">训练数据可视化分析</text>
</view>
</view>
<!-- 多人折线图 -->
<view class="chart-card">
<view class="chart-header">
<text class="chart-title">多人成绩趋势</text>
<text class="chart-desc">近5次训练成绩对比</text>
</view>
<view class="chart-box">
<qiun-data-charts
type="line"
:opts="lineOpts"
:chartData="lineChartData"
:ontouch="true"
/>
</view>
</view>
<!-- 完成率饼状图 - 每个学生 -->
<view class="chart-card">
<view class="chart-header">
<text class="chart-title">学员完成率</text>
<text class="chart-desc">各学员训练完成情况统计</text>
</view>
<view class="chart-box">
<qiun-data-charts
type="pie"
:opts="completionOpts"
:chartData="completionChartData"
:ontouch="true"
/>
</view>
</view>
<!-- 排名统计图 -->
<view class="chart-card">
<view class="chart-header">
<text class="chart-title">学员排名</text>
<text class="chart-desc">按最佳成绩排名</text>
</view>
<view class="chart-box">
<qiun-data-charts
type="column"
:opts="columnOpts"
:chartData="columnChartData"
:ontouch="true"
/>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { onShow, onLoad } from "@dcloudio/uni-app"
import { ref, computed, } from 'vue'
// 折线图配置
const lineOpts = ref({
color: ['#1890ff', '#52c41a', '#faad14', '#f5222d', '#722ed1'],
padding: [15, 10, 0, 15],
legend: {},
xAxis: {
disableGrid: true,
itemCount: 4
},
yAxis: {
data: [{ min: 0 }]
},
extra: {
line: {
type: 'curve',
width: 2,
activeType: 'hollow'
}
}
})
const lineChartData = ref({
categories: ['第1次', '第2次', '第3次', '第4次', '第5次'],
series: [
{
name: '张三',
data: [45, 42, 38, 40, 36]
},
{
name: '李四',
data: [50, 48, 45, 44, 42]
},
{
name: '王五',
data: [55, 52, 50, 48, 45]
}
]
})
// 完成率饼状图配置
const completionOpts = ref({
color: ['#1890ff', '#52c41a', '#faad14', '#f5222d', '#722ed1', '#13c2c2'],
padding: [5, 5, 5, 5],
legend: {},
extra: {
pie: {
activeOpacity: 0.5,
activeRadius: 10,
offsetAngle: 0,
labelWidth: 15,
ringWidth: 40,
title: {
name: '总完成率',
fontSize: 15,
color: '#666666'
},
subtitle: {
name: '87%',
fontSize: 20,
color: '#1890ff'
}
}
}
})
const completionChartData = ref({
series: [
{
name: '完成率',
data: [
{ value: 17, name: '张三' },
{
value: 17,
name: '李四',
color: '#52c41a'
},
{
value: 17,
name: '王五',
color: '#faad14'
},
{
value: 14,
name: '赵六',
color: '#f5222d'
},
{
value: 14,
name: '钱七',
color: '#722ed1'
},
{
value: 11,
name: '孙八',
color: '#13c2c2'
}
]
}
]
})
// 柱状图配置
const columnOpts = ref({
color: ['#1890ff', '#52c41a', '#faad14', '#f5222d', '#722ed1', '#13c2c2'],
padding: [15, 10, 0, 15],
legend: {},
xAxis: {
disableGrid: true
},
yAxis: {
data: [{ min: 0, max: 60 }]
},
extra: {
column: {
type: 'group',
width: 30,
activeBgColor: '#000000',
activeBgOpacity: 0.08,
linearType: 'custom',
seriesGap: 2,
categoryGap: 0.5,
barBorderCircle: true
}
}
})
const columnChartData = ref({
categories: ['张三', '李四', '王五', '赵六', '钱七', '孙八'],
series: [
{
name: '最佳成绩(秒)',
data: [36, 42, 45, 50, 56, 60]
}
]
})
onLoad(() => {
})
onShow(() => {
})
</script>
<style lang="scss" scoped>
page {
background-color: #f5f5f5;
}
.data-analyze-container {
min-height: 100vh;
padding: 20rpx;
padding-bottom: 40rpx;
}
/* 页面标题区域 */
.header-section {
margin-bottom: 24rpx;
.header-title {
.title {
font-size: 36rpx;
font-weight: 700;
color: #333;
display: block;
margin-bottom: 8rpx;
}
.subtitle {
font-size: 24rpx;
color: #999;
}
}
}
/* 图表卡片 */
.chart-card {
background-color: #fff;
border-radius: 24rpx;
padding: 24rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
transition: all 0.3s ease;
&:active {
transform: scale(0.995);
}
.chart-header {
margin-bottom: 20rpx;
padding-left: 8rpx;
border-left: 6rpx solid #1890ff;
.chart-title {
font-size: 30rpx;
font-weight: 600;
color: #333;
display: block;
margin-bottom: 6rpx;
}
.chart-desc {
font-size: 24rpx;
color: #999;
}
}
.chart-box {
width: 100%;
height: 500rpx;
background-color: #fafafa;
border-radius: 16rpx;
overflow: hidden;
}
}
</style>

View File

@@ -0,0 +1,610 @@
<template>
<view class="project-container">
<!-- 计划时长 -->
<view class="card-section">
<view class="section-title">计划时长</view>
<view class="plan-duration-display">
<text class="duration-value">{{ formatPlanTime(planDuration) }}</text>
</view>
</view>
<!-- 计时器列表 -->
<view class="card-section">
<view class="section-header">
<text class="section-title">计时器列表</text>
<view class="add-btn" @click="addTimer">
<u-icon name="plus" size="18" color="#fff"></u-icon>
<text class="add-text">添加</text>
</view>
</view>
<view class="timers-grid">
<view v-for="(timer, index) in timers" :key="timer.id" class="timer-card-wrapper">
<view class="timer-circle">
<!-- 删除按钮 -->
<view class="delete-btn-wrapper">
<view class="delete-btn" @click="deleteTimer(timer, index)">
<u-icon name="trash" size="16" color="#fff"></u-icon>
</view>
</view>
<view class="circle-content">
<view class="timer-sound">
<text class="sound-text">{{ timer.studentName || '计时器 ' + (index + 1) }}</text>
</view>
<view class="timer-time">{{ formatTime(timer.currentTime) }}</view>
<view class="timer-duration">{{ formatDuration(timer.currentTime) }}</view>
</view>
<!-- 休息时长 - 有休息时间就显示 -->
<view class="rest-time" v-if="timer.totalRestTime > 0 || timer.status === 'paused'">
<text class="rest-label">休息</text>
<text class="rest-value">{{ formatRestTime(timer.displayRestTime) }}</text>
</view>
<view class="timer-controls">
<u-icon name="reload" size="32" color="#22a6f2" @click="resetTimer(timer)"></u-icon>
<u-icon v-if="timer.status !== 'completed'" :name="timer.status === 'running' ? 'pause-circle' : 'play-circle'" size="32" color="#22a6f2"
@click="toggleTimer(timer)"></u-icon>
<u-icon v-if="timer.status !== 'completed'" name="checkmark-circle" size="32" color="#52c41a" @click="completeTimer(timer)"></u-icon>
<u-icon v-else name="checkmark-circle" size="32" color="#52c41a"></u-icon>
</view>
</view>
</view>
</view>
</view>
<!-- 底部按钮区域 -->
<view class="bottom-buttons-section">
<view class="bottom-buttons">
<!-- 全部开始按钮 -->
<button v-if="!hasRunningTimers" class="bottom-btn start-all-btn" @click="startAllTimers">
<u-icon name="play-circle" size="20" color="#fff"></u-icon>
<text class="btn-text">全部开始</text>
</button>
<!-- 全部暂停按钮 -->
<button v-else class="bottom-btn pause-all-btn" @click="pauseAllTimers">
<u-icon name="pause-circle" size="20" color="#fff"></u-icon>
<text class="btn-text">全部暂停</text>
</button>
<!-- 提交按钮 -->
<button class="bottom-btn submit-btn" @click="submitData">
<u-icon name="checkmark" size="20" color="#fff"></u-icon>
<text class="btn-text">提交</text>
</button>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, onUnmounted, computed } from 'vue'
import { Service } from '@/Service/Service'
interface TimerItem {
id: string
currentTime: number
status: 'idle' | 'running' | 'paused' | 'completed'
studentName: string
totalRestTime: number
pauseStartTime: number
displayRestTime: number
}
// 计划时长(秒)
const planDuration = ref(3600)
// 学生列表(用于选择学生)
const studentNames = ['张三', '李四', '王五', '赵六', '钱七', '孙八']
// 计时器列表
const timers = ref<TimerItem[]>([
{ id: '1', currentTime: 0, status: 'idle', studentName: studentNames[0], totalRestTime: 0, pauseStartTime: 0, displayRestTime: 0 },
{ id: '2', currentTime: 0, status: 'idle', studentName: studentNames[1], totalRestTime: 0, pauseStartTime: 0, displayRestTime: 0 }
])
// 计时器间隔 - 主计时器
const timerIntervals = ref<Map<string, { interval: number, startTime: number }>>(new Map())
// 休息时间计时器
const restTimerIntervals = ref<Map<string, number>>(new Map())
// 计算是否有正在运行的计时器
const hasRunningTimers = computed(() => {
return timers.value.some(timer => timer.status === 'running')
})
// 格式化计划时间显示
const formatPlanTime = (seconds: number): string => {
const hours = Math.floor(seconds / 3600)
const mins = Math.floor((seconds % 3600) / 60)
if (hours > 0) {
return `${hours}小时${mins}分钟`
}
return `${mins}分钟`
}
// 格式化时间显示
const formatTime = (seconds: number): string => {
const hours = Math.floor(seconds / 3600)
const mins = Math.floor((seconds % 3600) / 60)
const secs = Math.floor(seconds % 60)
return `${hours.toString().padStart(2, '0')}:${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`
}
// 格式化持续时间
const formatDuration = (seconds: number): string => {
const hours = Math.floor(seconds / 3600)
const mins = Math.floor((seconds % 3600) / 60)
let result = ''
if (hours > 0) {
result += `${hours}小时`
}
if (mins > 0) {
result += `${mins}分钟`
}
if (hours === 0 && mins === 0) {
result = '0分钟'
}
return result
}
// 格式化休息时间
const formatRestTime = (seconds: number): string => {
const mins = Math.floor(seconds / 60)
const secs = Math.floor(seconds % 60)
return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`
}
// 添加计时器
const addTimer = () => {
const nextIndex = timers.value.length % studentNames.length
timers.value.push({
id: Date.now().toString(),
currentTime: 0,
status: 'idle',
studentName: studentNames[nextIndex],
totalRestTime: 0,
pauseStartTime: 0,
displayRestTime: 0
})
Service.Msg('添加成功', 'success')
}
// 删除计时器
const deleteTimer = (timer: TimerItem, index: number) => {
uni.showModal({
title: '确认删除',
content: `确定要删除 ${timer.studentName || '计时器 ' + (index + 1)} 吗?`,
success: (res) => {
if (res.confirm) {
// 先停止计时器
if (timer.status === 'running') {
stopSingleTimer(timer)
}
if (timer.status === 'paused') {
stopRestTimer(timer)
}
// 从列表中移除
timers.value = timers.value.filter(t => t.id !== timer.id)
Service.Msg('删除成功')
}
},
})
}
// 开始主计时器
const startTimer = (timer: TimerItem) => {
if (timer.status === 'running') return
// 停止休息计时器,保存当前休息时间
if (timer.status === 'paused') {
stopRestTimer(timer)
}
timer.status = 'running'
const startTime = Date.now() - timer.currentTime * 1000
const interval = setInterval(() => {
const elapsed = (Date.now() - startTime) / 1000
timer.currentTime = elapsed
}, 10)
timerIntervals.value.set(timer.id, { interval, startTime })
}
// 停止单个主计时器
const stopSingleTimer = (timer: TimerItem) => {
if (timer.status !== 'running') return
timer.status = 'paused'
const timerData = timerIntervals.value.get(timer.id)
if (timerData) {
clearInterval(timerData.interval)
timerIntervals.value.delete(timer.id)
}
// 开始休息计时器,从总休息时间继续
startRestTimer(timer)
}
// 开始休息计时器
const startRestTimer = (timer: TimerItem) => {
timer.pauseStartTime = Date.now()
const interval = setInterval(() => {
const elapsed = (Date.now() - timer.pauseStartTime) / 1000
timer.displayRestTime = timer.totalRestTime + elapsed
}, 10)
restTimerIntervals.value.set(timer.id, interval)
}
// 停止休息计时器
const stopRestTimer = (timer: TimerItem) => {
const interval = restTimerIntervals.value.get(timer.id)
if (interval) {
clearInterval(interval)
restTimerIntervals.value.delete(timer.id)
}
// 保存这次的休息时间到总休息时间
timer.totalRestTime = timer.displayRestTime
}
// 停止所有计时器
const stopAllTimers = () => {
timers.value.forEach(timer => {
if (timer.status === 'running') {
stopSingleTimer(timer)
}
})
}
// 全部开始
const startAllTimers = () => {
timers.value.forEach(timer => {
if (timer.status !== 'completed' && timer.status !== 'running') {
startTimer(timer)
}
})
Service.Msg('全部已开始')
}
// 全部暂停
const pauseAllTimers = () => {
timers.value.forEach(timer => {
if (timer.status === 'running') {
stopSingleTimer(timer)
}
})
Service.Msg('全部已暂停')
}
// 切换计时器状态
const toggleTimer = (timer: TimerItem) => {
if (timer.status === 'completed') return
if (timer.status === 'running') {
stopSingleTimer(timer)
} else {
startTimer(timer)
}
}
// 完成计时器
const completeTimer = (timer: TimerItem) => {
// 如果正在暂停中,保存休息时间
if (timer.status === 'paused') {
stopRestTimer(timer)
}
// 先停止当前计时器
stopSingleTimer(timer)
timer.status = 'completed'
// 停止所有其他计时器
stopAllTimers()
Service.Msg('已完成,所有计时器已暂停', 'success')
}
// 重置计时器
const resetTimer = (timer: TimerItem) => {
stopSingleTimer(timer)
stopRestTimer(timer)
timer.currentTime = 0
timer.status = 'idle'
timer.totalRestTime = 0
timer.displayRestTime = 0
timer.pauseStartTime = 0
Service.Msg('已重置')
}
// 提交数据
const submitData = () => {
// 先暂停所有计时器
pauseAllTimers()
// 检查是否有数据
const hasData = timers.value.some(timer => timer.currentTime > 0 || timer.totalRestTime > 0)
if (!hasData) {
Service.Msg('暂无数据可提交')
return
}
// 这里可以添加提交到后端的逻辑
Service.Msg('提交成功', 'success')
// 提交后可以选择返回上一页
setTimeout(() => {
Service.GoPageBack()
}, 1000)
}
// 页面卸载时清理所有计时器
onUnmounted(() => {
timerIntervals.value.forEach(({ interval }) => {
clearInterval(interval)
})
restTimerIntervals.value.forEach((interval) => {
clearInterval(interval)
})
})
</script>
<style lang="scss" scoped>
.project-container {
min-height: 100vh;
background-color: #f6f6f6;
padding: 20rpx 20rpx;
padding-bottom: 200rpx;
}
/* 卡片区域 */
.card-section {
background-color: #fff;
border-radius: 20rpx;
padding: 30rpx;
margin-bottom: 20rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.section-title {
font-size: 28rpx;
font-weight: 600;
color: #333;
margin-bottom: 24rpx;
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30rpx;
.section-title {
margin-bottom: 0;
}
.add-btn {
display: flex;
align-items: center;
gap: 8rpx;
background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
padding: 12rpx 24rpx;
border-radius: 30rpx;
.add-text {
font-size: 24rpx;
color: #fff;
font-weight: 500;
}
}
}
/* 计划时长显示 */
.plan-duration-display {
text-align: center;
padding: 30rpx;
background-color: #f5f5f5;
border-radius: 16rpx;
.duration-value {
font-size: 36rpx;
font-weight: 600;
color: #333;
}
}
/* 计时器网格 */
.timers-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 30rpx;
}
/* 计时器卡片包装器 */
.timer-card-wrapper {
display: flex;
justify-content: center;
}
/* 计时器圆形 - 一比一复原 segmentation 页面 */
.timer-circle {
width: 320rpx;
min-height: 380rpx;
border-radius: 20rpx;
background-color: #fff;
display: flex;
padding: 20rpx;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
box-shadow: 0 4rpx 16rpx rgba(250, 140, 22, 0.3);
/* 删除按钮包装器 */
.delete-btn-wrapper {
position: absolute;
top: 16rpx;
right: 16rpx;
z-index: 10;
.delete-btn {
width: 56rpx;
height: 56rpx;
background: linear-gradient(135deg, #ff4d4f 0%, #d9363e 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4rpx 12rpx rgba(255, 77, 79, 0.4);
transition: all 0.2s ease;
&:active {
transform: scale(0.95);
}
}
}
.circle-content {
padding: 26rpx;
border-radius: 50%;
border: 14rpx solid #faad14;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 14rpx;
}
.timer-sound {
display: flex;
align-items: center;
gap: 8rpx;
padding: 8rpx 16rpx;
background-color: rgba(255, 255, 255, 0.2);
border-radius: 20rpx;
.sound-text {
font-size: 22rpx;
font-weight: 500;
color: #333;
}
}
.timer-time {
font-size: 42rpx;
font-weight: bold;
color: #333;
}
.timer-duration {
font-size: 22rpx;
opacity: 0.9;
background-color: #f6f6f6;
padding: 4rpx 12rpx;
border-radius: 4rpx;
color: #666;
}
/* 休息时长 */
.rest-time {
display: flex;
align-items: center;
gap: 8rpx;
margin-top: 16rpx;
padding: 8rpx 20rpx;
background-color: #fff7e6;
border-radius: 20rpx;
.rest-label {
font-size: 20rpx;
color: #fa8c16;
font-weight: 500;
}
.rest-value {
font-size: 22rpx;
color: #fa8c16;
font-weight: bold;
font-family: 'DIN Alternate', monospace;
}
}
.timer-controls {
display: flex;
justify-content: space-between;
align-items: center;
width: 260rpx;
margin-top: 16rpx;
u-icon {
cursor: pointer;
transition: all 0.2s ease;
&:hover {
transform: scale(1.1);
}
}
}
}
/* 底部按钮区域 */
.bottom-buttons-section {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: #fff;
padding: 20rpx 30rpx;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
border-top: 1rpx solid #f0f0f0;
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.08);
z-index: 100;
}
.bottom-buttons {
display: flex;
gap: 20rpx;
.bottom-btn {
flex: 1;
height: 88rpx;
border-radius: 16rpx;
border: none;
display: flex;
align-items: center;
justify-content: center;
gap: 10rpx;
font-size: 28rpx;
font-weight: 600;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
transition: all 0.2s ease;
&:active {
transform: scale(0.98);
}
.btn-text {
font-size: 28rpx;
color: #fff;
font-weight: 600;
}
}
/* 全部开始按钮 */
.start-all-btn {
background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
}
/* 全部暂停按钮 */
.pause-all-btn {
background: linear-gradient(135deg, #faad14 0%, #d48806 100%);
}
/* 提交按钮 */
.submit-btn {
background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
}
}
</style>

View File

@@ -0,0 +1,404 @@
<template>
<view class="project-list-container">
<!-- 页面标题区域 -->
<view class="header-section">
<view class="header-title" style="display: flex; align-items: center; justify-content: space-between;" >
<text class="title">项目列表</text>
<text class="subtitle">{{ projects.length }}个项目</text>
</view>
</view>
<!-- 项目列表 -->
<view class="projects-section">
<view v-if="projects.length === 0" class="empty-state">
<view class="empty-icon">
<u-icon name="list" size="64" color="#ddd"></u-icon>
</view>
<text class="empty-text">暂无项目</text>
<text class="empty-desc">点击下方按钮创建第一个项目</text>
</view>
<view v-else class="projects-list">
<view v-for="(project, index) in projects" :key="project.id" class="project-card" @click="viewProjectDetail(project)">
<view class="project-header">
<view class="project-mode" :class="getModeClass(project.mode)">
<text class="mode-text">{{ project.mode }}</text>
</view>
<view class="project-time">
<u-icon name="clock" size="14" color="#999"></u-icon>
<text class="time-text">{{ project.createTime }}</text>
</view>
</view>
<view class="project-info">
<text class="project-name">{{ project.name }}</text>
<view class="project-stats">
<view class="stat-badge">
<u-icon name="account" size="14" color="#1890ff"></u-icon>
<text class="badge-text">{{ project.studentCount }}位学员</text>
</view>
<view v-if="project.recordCount > 0" class="stat-badge record-badge">
<u-icon name="checkmark-circle" size="14" color="#52c41a"></u-icon>
<text class="badge-text">{{ project.recordCount }}条记录</text>
</view>
</view>
</view>
<view class="project-arrow">
<u-icon name="arrow-right" size="18" color="#ccc"></u-icon>
</view>
</view>
</view>
</view>
<!-- 底部添加按钮 -->
<view class="bottom-add-btn">
<button class="add-btn" @click="addProject">
<u-icon name="plus" size="24" color="#fff"></u-icon>
<text class="btn-text">添加项目</text>
</button>
</view>
</view>
</template>
<script setup lang="ts">
import { onShow, onLoad } from "@dcloudio/uni-app"
import { Service } from '@/Service/Service'
import { ref } from "vue"
// 定义项目类型
interface Project {
id: string
name: string
mode: '计时' | '包干' | '分段'
createTime: string
studentCount: number
recordCount: number
}
// 项目列表数据
const projects = ref<Project[]>([
{
id: '001',
name: '自由泳50米',
mode: '计时',
createTime: '2024-01-15 14:30',
studentCount: 8,
recordCount: 24
},
{
id: '002',
name: '蛙泳100米',
mode: '包干',
createTime: '2024-01-14 10:15',
studentCount: 6,
recordCount: 18
},
{
id: '003',
name: '仰泳200米',
mode: '分段',
createTime: '2024-01-13 16:45',
studentCount: 5,
recordCount: 20
},
{
id: '004',
name: '蝶泳50米',
mode: '计时',
createTime: '2024-01-12 09:20',
studentCount: 4,
recordCount: 12
},
{
id: '005',
name: '混合泳100米',
mode: '包干',
createTime: '2024-01-11 15:00',
studentCount: 7,
recordCount: 21
}
])
onLoad(() => {
})
onShow(() => {
})
// 获取模式对应的样式类
const getModeClass = (mode: string): string => {
const classMap: Record<string, string> = {
'计时': 'mode-timing',
'包干': 'mode-package',
'分段': 'mode-segment'
}
return classMap[mode] || ''
}
// 查看项目详情
const viewProjectDetail = (project: Project) => {
Service.Msg(`查看「${project.name}」详情`)
}
// 添加项目
const addProject = () => {
Service.GoPage('/pages/userFunc/setCourse')
}
</script>
<style lang="scss" scoped>
page {
background-color: #f5f5f5;
}
.project-list-container {
min-height: 100vh;
padding: 20rpx;
padding-bottom: 180rpx;
}
/* 页面标题区域 */
.header-section {
margin-bottom: 24rpx;
.header-title {
.title {
font-size: 36rpx;
font-weight: 700;
color: #333;
display: block;
margin-bottom: 8rpx;
}
.subtitle {
font-size: 24rpx;
color: #999;
}
}
}
/* 项目列表区域 */
.projects-section {
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.section-title {
font-size: 30rpx;
font-weight: 600;
color: #333;
}
.section-count {
font-size: 24rpx;
color: #999;
background-color: #f5f5f5;
padding: 6rpx 16rpx;
border-radius: 16rpx;
}
}
.empty-state {
background-color: #fff;
border-radius: 24rpx;
padding: 100rpx 40rpx;
display: flex;
flex-direction: column;
align-items: center;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
.empty-icon {
margin-bottom: 24rpx;
opacity: 0.6;
}
.empty-text {
font-size: 30rpx;
font-weight: 600;
color: #666;
margin-bottom: 12rpx;
}
.empty-desc {
font-size: 24rpx;
color: #999;
}
}
}
.projects-list {
.project-card {
background-color: #fff;
border-radius: 20rpx;
padding: 28rpx 24rpx;
margin-bottom: 16rpx;
display: flex;
align-items: center;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
&::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 6rpx;
background: linear-gradient(180deg, #1890ff 0%, #096dd9 100%);
opacity: 0;
transition: opacity 0.3s ease;
}
&:active {
transform: scale(0.98);
box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0.04);
&::before {
opacity: 1;
}
}
.project-header {
position: absolute;
top: 20rpx;
right: 24rpx;
display: flex;
align-items: center;
gap: 12rpx;
.project-mode {
padding: 6rpx 14rpx;
border-radius: 12rpx;
font-size: 22rpx;
font-weight: 600;
&.mode-timing {
background-color: #e6f7ff;
color: #1890ff;
}
&.mode-package {
background-color: #fff7e6;
color: #faad14;
}
&.mode-segment {
background-color: #f6ffed;
color: #52c41a;
}
.mode-text {
font-size: 22rpx;
font-weight: 600;
}
}
.project-time {
display: flex;
align-items: center;
gap: 6rpx;
.time-text {
font-size: 22rpx;
color: #999;
}
}
}
.project-info {
flex: 1;
padding-right: 60rpx;
.project-name {
font-size: 32rpx;
font-weight: 600;
color: #333;
display: block;
margin-bottom: 16rpx;
}
.project-stats {
display: flex;
gap: 12rpx;
flex-wrap: wrap;
.stat-badge {
display: flex;
align-items: center;
gap: 6rpx;
padding: 8rpx 14rpx;
background-color: #f5f5f5;
border-radius: 12rpx;
&.record-badge {
background-color: #f6ffed;
}
.badge-text {
font-size: 22rpx;
color: #666;
font-weight: 500;
}
}
}
}
.project-arrow {
position: absolute;
right: 24rpx;
top: 50%;
transform: translateY(-50%);
transition: transform 0.3s ease;
}
&:active .project-arrow {
transform: translateY(-50%) translateX(6rpx);
}
}
}
/* 底部添加按钮 */
.bottom-add-btn {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: #fff;
padding: 20rpx 30rpx;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
border-top: 1rpx solid #f0f0f0;
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.08);
z-index: 100;
.add-btn {
width: 100%;
height: 96rpx;
background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
border-radius: 20rpx;
border: none;
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
box-shadow: 0 8rpx 24rpx rgba(24, 144, 255, 0.4);
transition: all 0.3s ease;
&:active {
transform: scale(0.97);
box-shadow: 0 4rpx 12rpx rgba(24, 144, 255, 0.3);
}
.btn-text {
font-size: 32rpx;
color: #fff;
font-weight: 700;
}
}
}
</style>

View File

@@ -0,0 +1,512 @@
<template>
<view class="segmentation-container">
<!-- 总计时器区域 -->
<view class="total-time-section">
<view class="timer-circle">
<view class="circle-content">
<view class="timer-sound">
<text class="sound-text">计时器</text>
</view>
<view class="timer-time">{{ formatTime(currentTime) }}</view>
<view class="timer-duration">{{ formatDuration(currentTime) }}</view>
</view>
<view class="timer-controls">
<u-icon name="reload" size="32" color="#22a6f2" @click="resetAll"></u-icon>
<u-icon :name="isRunning ? 'pause-circle' : 'play-circle'" size="32" color="#22a6f2"
@click="toggleTimer"></u-icon>
</view>
</view>
</view>
<!-- 学生列表 -->
<view class="students-section">
<view class="section-header">
<text class="section-title">学生列表</text>
<text class="student-count">{{ students.length }}位学生</text>
</view>
<view class="students-list">
<view v-for="(student, index) in students" :key="student.id" class="student-item">
<view class="student-header">
<view class="student-number">{{ student.number }}</view>
<view class="student-info">
<text class="student-name">{{ student.name }}</text>
<text class="student-lane">{{ student.lane }}</text>
</view>
<view class="student-buttons">
<button class="record-btn" @click="recordStudentSegment(student)">
<u-icon name="checkmark" size="18" color="#fff"></u-icon>
<text class="btn-text">记录</text>
</button>
<button class="reset-btn" @click="resetStudent(student)">
<u-icon name="reload" size="18" color="#fff"></u-icon>
<text class="btn-text">重置</text>
</button>
</view>
</view>
<!-- 分段时间块 -->
<view class="segments-list">
<view v-for="(segment, segIndex) in student.segments" :key="segIndex" class="segment-item">
<text class="segment-label">{{ segIndex + 1 }}</text>
<text class="segment-time">{{ segment.time ? formatTime(segment.time) : '--:--.--' }}</text>
</view>
<view class="segment-item empty">
<text class="segment-label">{{ student.segments.length + 1 }}</text>
<text class="segment-time">--:--.--</text>
</view>
</view>
</view>
</view>
</view>
<!-- 保存按钮 -->
<view class="save-btn-wrapper">
<button class="save-btn" @click="saveData">
<text class="btn-text">保存</text>
</button>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, onUnmounted } from 'vue'
import { Service } from '@/Service/Service'
// 最大分段数
const maxSegments = 4
// 学生列表
const students = ref<Array<any>>([
{
id: '1',
number: '01',
name: '张三',
lane: '第一泳道',
segments: []
},
{
id: '2',
number: '02',
name: '李四',
lane: '第二泳道',
segments: []
},
{
id: '3',
number: '03',
name: '王五',
lane: '第三泳道',
segments: []
},
{
id: '4',
number: '04',
name: '赵六',
lane: '第四泳道',
segments: []
}
])
// 计时器状态
const isRunning = ref(false)
const currentTime = ref(0)
let timerInterval : number | null = null
let startTime : number = 0
// 格式化时间显示
const formatTime = (seconds : number) : string => {
const hours = Math.floor(seconds / 3600)
const mins = Math.floor((seconds % 3600) / 60)
const secs = Math.floor(seconds % 60)
return `${hours.toString().padStart(2, '0')}:${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`
}
// 格式化持续时间
const formatDuration = (seconds : number) : string => {
const hours = Math.floor(seconds / 3600)
const mins = Math.floor((seconds % 3600) / 60)
let result = ''
if (hours > 0) {
result += `${hours}小时`
}
if (mins > 0) {
result += `${mins}分钟`
}
if (hours === 0 && mins === 0) {
result = '0分钟'
}
return result
}
// 开始计时
const startTimer = () => {
if (isRunning.value) return
isRunning.value = true
startTime = Date.now() - currentTime.value * 1000
timerInterval = setInterval(() => {
const elapsed = (Date.now() - startTime) / 1000
currentTime.value = elapsed
}, 10)
}
// 停止计时
const stopTimer = () => {
if (!isRunning.value) return
isRunning.value = false
if (timerInterval) {
clearInterval(timerInterval)
timerInterval = null
}
}
// 切换计时器状态
const toggleTimer = () => {
if (isRunning.value) {
stopTimer()
} else {
startTimer()
}
}
// 记录学生分段
const recordStudentSegment = (student : Student) => {
if (!isRunning.value) {
Service.Msg('请先开始计时')
return
}
if (student.segments.length >= maxSegments) {
Service.Msg('已达到最大分段数')
return
}
student.segments.push({
time: currentTime.value
})
Service.Msg(`${student.name}${student.segments.length}段已记录`)
}
// 重置学生
const resetStudent = (student : Student) => {
student.segments = []
Service.Msg(`${student.name} 已重置`)
}
// 重置全部
const resetAll = () => {
stopTimer()
currentTime.value = 0
students.value.forEach(student => {
student.segments = []
})
Service.Msg('已全部重置')
}
// 保存数据
const saveData = () => {
// 检查是否有记录的数据
const hasData = students.value.some(s => s.segments.length > 0)
if (!hasData) {
Service.Msg('暂无数据可保存')
return
}
// 这里可以添加保存到后端或本地存储的逻辑
Service.Msg('保存成功', 'success')
// 保存后可以选择返回上一页
setTimeout(() => {
Service.GoPageBack()
}, 1000)
}
// 页面卸载时清理计时器
onUnmounted(() => {
if (timerInterval) {
clearInterval(timerInterval)
}
})
</script>
<style lang="scss" scoped>
.segmentation-container {
min-height: 100vh;
background-color: #f6f6f6;
padding: 20rpx 20rpx;
padding-bottom: 200rpx;
}
/* 总计时器区域 */
.total-time-section {
margin-top: 20rpx;
margin-bottom: 40rpx;
display: flex;
justify-content: center;
}
.timer-circle {
width: 350rpx;
height: 360rpx;
border-radius: 20rpx;
background-color: #fff;
display: flex;
padding: 20rpx;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
box-shadow: 0 4rpx 16rpx rgba(250, 140, 22, 0.3);
.circle-content {
// background-color: #faad14;
padding: 30rpx;
border-radius: 50%;
border: 16rpx solid #faad14;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 16rpx;
}
.timer-sound {
display: flex;
align-items: center;
gap: 8rpx;
padding: 8rpx 16rpx;
background-color: rgba(255, 255, 255, 0.2);
border-radius: 20rpx;
.sound-text {
font-size: 24rpx;
font-weight: 500;
}
}
.timer-time {
font-size: 48rpx;
font-weight: bold;
}
.timer-duration {
font-size: 24rpx;
opacity: 0.9;
background-color: #f6f6f6;
padding: 4rpx 12rpx;
border-radius: 4rpx;
}
.timer-controls {
display: flex;
justify-content: space-between;
align-items: center;
width: 280rpx;
u-icon {
cursor: pointer;
transition: all 0.2s ease;
&:hover {
transform: scale(1.1);
}
}
}
}
/* 学生列表区域 */
.students-section {
margin-bottom: 20rpx;
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.section-title {
font-size: 32rpx;
font-weight: 600;
color: #333;
}
.student-count {
font-size: 24rpx;
color: #999;
background-color: #f5f5f5;
padding: 6rpx 16rpx;
border-radius: 16rpx;
}
}
.students-list {
.student-item {
background-color: #fff;
border-radius: 20rpx;
padding: 30rpx;
margin-bottom: 20rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
.student-header {
display: flex;
align-items: center;
margin-bottom: 24rpx;
.student-number {
width: 56rpx;
height: 56rpx;
background-color: #e6f7ff;
color: #1890ff;
font-size: 28rpx;
font-weight: 600;
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 20rpx;
}
.student-info {
flex: 1;
.student-name {
font-size: 30rpx;
font-weight: 500;
color: #333;
margin-bottom: 4rpx;
display: block;
}
.student-lane {
font-size: 24rpx;
color: #999;
}
}
.student-buttons {
display: flex;
gap: 12rpx;
.record-btn,
.reset-btn {
height: 56rpx;
padding: 0 20rpx;
border-radius: 8rpx;
border: none;
font-size: 24rpx;
font-weight: 500;
display: flex;
align-items: center;
justify-content: center;
gap: 6rpx;
.btn-text {
font-size: 24rpx;
color: #fff;
}
}
.record-btn {
background-color: #52c41a;
}
.reset-btn {
background-color: #faad14;
}
}
}
/* 分段时间列表 */
.segments-list {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
.segment-item {
flex: 1;
min-width: 140rpx;
background-color: #f5f5f5;
border-radius: 12rpx;
padding: 20rpx 16rpx;
text-align: center;
&.empty {
opacity: 0.5;
}
.segment-label {
font-size: 22rpx;
color: #666;
display: block;
margin-bottom: 8rpx;
}
.segment-time {
font-size: 26rpx;
font-weight: 600;
color: #333;
font-family: 'DIN Alternate', monospace;
}
}
}
}
}
}
/* 保存按钮 */
.save-btn-wrapper {
position: fixed;
bottom: 40rpx;
right: 30rpx;
z-index: 100;
.save-btn {
width: 140rpx;
height: 140rpx;
background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
border-radius: 50%;
border: none;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8rpx;
box-shadow: 0 8rpx 24rpx rgba(24, 144, 255, 0.5),
0 4rpx 12rpx rgba(24, 144, 255, 0.3);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
pointer-events: none;
}
&:active {
transform: scale(0.95);
box-shadow: 0 4rpx 12rpx rgba(24, 144, 255, 0.4),
0 2rpx 6rpx rgba(24, 144, 255, 0.2);
}
.btn-text {
font-size: 26rpx;
color: #fff;
font-weight: 600;
letter-spacing: 1rpx;
}
}
}
</style>

310
src/pages/userFunc/set.vue Normal file
View File

@@ -0,0 +1,310 @@
<template>
<view class="settings-container">
<!-- 头像设置区域 -->
<view class="settings-card">
<view class="card-header">
<text class="card-title">头像设置</text>
</view>
<view class="avatar-section">
<view class="avatar-wrapper">
<view class="avatar-circle">
<u-icon name="account" size="64" color="#fff"></u-icon>
</view>
<view class="avatar-edit" @click="changeAvatar">
<u-icon name="camera" size="20" color="#fff"></u-icon>
</view>
</view>
<text class="avatar-tip">点击更换头像</text>
</view>
</view>
<!-- 基本信息设置 -->
<view class="settings-card">
<view class="card-header">
<text class="card-title">基本信息</text>
</view>
<view class="form-section">
<view class="form-group">
<text class="form-label">用户姓名</text>
<view class="input-wrapper">
<input
class="form-input"
v-model="userInfo.name"
placeholder="请输入用户姓名"
type="text"
maxlength="20"
/>
</view>
</view>
<view class="form-divider"></view>
<view class="form-group">
<text class="form-label">手机号码</text>
<view class="input-wrapper">
<input
class="form-input"
v-model="userInfo.phone"
placeholder="请输入手机号码"
type="number"
maxlength="11"
/>
</view>
</view>
</view>
</view>
<!-- 保存按钮 -->
<view class="save-section">
<button class="save-btn" @click="saveUserInfo">
<text class="btn-text">保存修改</text>
</button>
</view>
</view>
</template>
<script setup lang="ts">
import { onShow, onLoad } from "@dcloudio/uni-app"
import { Service } from '@/Service/Service'
import { ref } from 'vue'
// 用户信息
interface UserInfo {
name: string
phone: string
}
const userInfo = ref<UserInfo>({
name: '游泳爱好者',
phone: '13888888888'
})
onLoad(() => {
// 可以在这里从本地存储加载用户信息
})
onShow(() => {
})
// 更换头像
const changeAvatar = () => {
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
Service.Msg('头像更换成功', 'success')
}
})
}
// 保存用户信息
const saveUserInfo = () => {
if (!userInfo.value.name.trim()) {
Service.Msg('请输入用户姓名')
return
}
if (!userInfo.value.phone.trim()) {
Service.Msg('请输入手机号码')
return
}
// 简单的手机号验证
const phoneReg = /^1[3-9]\d{9}$/
if (!phoneReg.test(userInfo.value.phone)) {
Service.Msg('请输入正确的手机号码')
return
}
// 模拟保存成功
Service.Msg('保存成功', 'success')
// 保存成功后可以返回上一页
setTimeout(() => {
Service.GoPageBack()
}, 1000)
}
</script>
<style lang="scss" scoped>
page {
background-color: #f5f5f5;
}
.settings-container {
padding: 20rpx;
padding-bottom: 180rpx;
}
/* 页面标题区域 */
.header-section {
margin-bottom: 24rpx;
.header-title {
.title {
font-size: 36rpx;
font-weight: 700;
color: #333;
display: block;
margin-bottom: 8rpx;
}
.subtitle {
font-size: 24rpx;
color: #999;
}
}
}
/* 设置卡片 */
.settings-card {
background-color: #fff;
border-radius: 24rpx;
padding: 0;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
overflow: hidden;
.card-header {
padding: 24rpx 24rpx 16rpx;
border-bottom: 1rpx solid #f0f0f0;
.card-title {
font-size: 28rpx;
font-weight: 600;
color: #333;
}
}
}
/* 头像设置区域 */
.avatar-section {
padding: 40rpx 24rpx;
display: flex;
flex-direction: column;
align-items: center;
.avatar-wrapper {
position: relative;
margin-bottom: 20rpx;
.avatar-circle {
width: 160rpx;
height: 160rpx;
background: linear-gradient(135deg, #1890ff 0%, #36cfc9 50%, #096dd9 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 8rpx 24rpx rgba(24, 144, 255, 0.3);
}
.avatar-edit {
position: absolute;
bottom: 0;
right: 0;
width: 56rpx;
height: 56rpx;
background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
border: 4rpx solid #fff;
box-shadow: 0 4rpx 12rpx rgba(82, 196, 26, 0.4);
transition: all 0.3s ease;
&:active {
transform: scale(0.9);
}
}
}
.avatar-tip {
font-size: 24rpx;
color: #999;
}
}
/* 表单区域 */
.form-section {
padding: 20rpx 24rpx;
.form-group {
padding: 20rpx 0;
.form-label {
display: block;
font-size: 28rpx;
font-weight: 600;
color: #333;
margin-bottom: 16rpx;
}
.input-wrapper {
background-color: #f5f5f5;
border-radius: 16rpx;
padding: 0 24rpx;
transition: all 0.2s ease;
&:focus-within {
background-color: #fff;
box-shadow: 0 0 0 4rpx rgba(24, 144, 255, 0.15);
}
.form-input {
width: 100%;
height: 88rpx;
font-size: 28rpx;
color: #333;
}
}
}
.form-divider {
height: 1rpx;
background-color: #f0f0f0;
margin: 0;
}
}
/* 保存按钮区域 */
.save-section {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: #fff;
padding: 20rpx 30rpx;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
border-top: 1rpx solid #f0f0f0;
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.08);
z-index: 100;
.save-btn {
width: 100%;
height: 96rpx;
background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
border-radius: 20rpx;
border: none;
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
box-shadow: 0 8rpx 24rpx rgba(24, 144, 255, 0.4);
transition: all 0.3s ease;
&:active {
transform: scale(0.97);
box-shadow: 0 4rpx 12rpx rgba(24, 144, 255, 0.3);
}
.btn-text {
font-size: 32rpx;
color: #fff;
font-weight: 700;
}
}
}
</style>

View File

@@ -0,0 +1,809 @@
<template>
<view class="set-course-container">
<!-- 项目信息 -->
<view class="card-section">
<view class="section-title">项目信息</view>
<!-- 项目名称输入 -->
<view class="form-item">
<view class="form-label">项目名称</view>
<input class="form-input" v-model="tempProjectName" placeholder="请输入项目名称自由泳50米" type="text" />
</view>
<!-- 模块选择 -->
<view class="form-item">
<view class="form-label">模块类型</view>
<view class="select-wrapper" @click="showModulePicker = true">
<text class="select-value"
:class="{ placeholder: !selectedModule }">{{ selectedModule || '请选择模块类型' }}</text>
<u-icon name="arrow-down" size="16" color="#999"></u-icon>
</view>
</view>
<!-- 段数输入仅在选择分段模块时显示 -->
<view v-if="selectedModule === '分段'" class="form-item">
<view class="form-label">段数</view>
<input class="form-input" v-model="segmentCount" placeholder="请输入段数" type="number" />
</view>
<!-- 秒表模式 -->
<view class="form-item">
<view class="form-label">秒表模式</view>
<view class="radio-group">
<view class="radio-item" :class="{ active: stopwatchMode === 'interval' }"
@click="stopwatchMode = 'interval'">
<view class="radio-circle">
<view v-if="stopwatchMode === 'interval'" class="radio-dot"></view>
</view>
<text class="radio-label">间隔出发</text>
</view>
<view class="radio-item" :class="{ active: stopwatchMode === 'together' }"
@click="stopwatchMode = 'together'">
<view class="radio-circle">
<view v-if="stopwatchMode === 'together'" class="radio-dot"></view>
</view>
<text class="radio-label">一起出发</text>
</view>
</view>
</view>
<!-- 间隔时间输入 -->
<view v-if=" stopwatchMode === 'interval'" class="form-item">
<view class="form-label">间隔时间</view>
<input class="form-input" v-model="intervalTime" placeholder="请输入间隔时间" type="number" />
</view>
</view>
<!-- 计时器区域 -->
<view class="card-section timer-section" @click="showTimePicker = true">
<view class="timer-display">
<view class="timer-text">{{ hours<10?('0'+hours):hours }}:{{ minutes<10?('0'+minutes):minutes }}</view>
<text class="timer-milliseconds">:{{ seconds<10?('0'+seconds):seconds }}</text>
</view>
<view class="timer-hint">点击设置时间</view>
</view>
<!-- 学生列表 -->
<view class="card-section">
<view class="section-header">
<text class="section-title">学生列表</text>
<view class="header-actions">
<view class="select-all" @click="toggleSelectAll">
<view class="checkbox" :class="{ checked: isAllSelected }">
<u-icon v-if="isAllSelected" name="checkmark" size="14" color="#fff"></u-icon>
</view>
<text class="select-text">全选</text>
</view>
<view v-if="tempSelectedStudents.length > 0" class="delete-selected"
@click="deleteSelectedStudents">
<u-icon name="trash" size="18" color="#ff4444"></u-icon>
<text class="delete-text">删除({{ tempSelectedStudents.length }})</text>
</view>
</view>
</view>
<view class="students-list">
<up-dragsort :key="dragSortKey" :initialList="tempStudents" direction="vertical"
@drag-end="handleDragEnd">
<template #default="{ item, index }">
<view class="student-item" :class="{ selected: item.selected }">
<view class="student-info" @click.stop="toggleStudent(item)">
<text class="student-index">{{ index + 1 }}</text>
<text class="student-name">{{ item.name }}</text>
</view>
<view class="lane-input-wrapper" @click.stop="openLanePicker(item)">
<view class="lane-select" :class="{ placeholder: !item.lane }">
{{ item.lane || '选择泳道' }}
</view>
<u-icon name="arrow-down" size="14" color="#999"></u-icon>
</view>
<view v-if="selectedModule === '包干'" class="laps-input-wrapper">
<input class="laps-input" v-model="item.laps" placeholder="圈数" type="number"
@click.stop />
</view>
<view class="student-actions">
<view class="action-icon delete" @click.stop="deleteStudent(item.id)">
<u-icon name="trash" size="18" color="#ff4444"></u-icon>
</view>
</view>
</view>
</template>
</up-dragsort>
</view>
<!-- 添加学生 -->
<view class="add-student-wrapper">
<input class="add-student-input" v-model="newStudentName" placeholder="输入学生姓名" type="text"
@confirm="addStudent" />
<button class="add-student-btn" @click="addStudent">
<u-icon name="plus" size="20" color="#fff"></u-icon>
</button>
</view>
</view>
<!-- 底部按钮 -->
<view class="bottom-section">
<button class="submit-btn" @click="recordTime"
:disabled="tempSelectedStudents.length === 0 || !tempProjectName.trim() || !selectedModule">新增项目</button>
</view>
<!-- 模块选择器 -->
<u-picker :show="showModulePicker" :columns="moduleColumns" @confirm="onModuleConfirm"
@cancel="showModulePicker = false"></u-picker>
<!-- 时间选择器 -->
<u-picker :show="showTimePicker" :columns="timeColumns" @confirm="onTimeConfirm"
@cancel="showTimePicker = false"></u-picker>
<!-- 泳道选择器 -->
<u-picker :show="showLanePicker" :columns="laneOptions" @confirm="onLaneConfirm"
@cancel="closeLanePicker"></u-picker>
</view>
</template>
<script setup lang="ts">
import { ref, computed, onUnmounted, onMounted, nextTick } from 'vue'
import { Service } from '@/Service/Service'
// 定义学生类型
interface Student {
id : string
name : string
selected : boolean
recordTime : string
lane : string
laps : string
}
// 定义成绩记录类型
interface Record {
projectName : string
moduleType : string
stopwatchMode ?: string
intervalTime ?: string
segmentCount ?: string
date : string
students : {
id : string
name : string
time : string
laps ?: string
}[]
}
// 用于强制更新拖拽组件的 key
const dragSortKey = ref(0)
// 模块选择相关
const showModulePicker = ref(false)
const selectedModule = ref('')
const moduleColumns = ref([
[{ text: '计时', value: '计时' },
{ text: '包干', value: '包干' },
{ text: '分段', value: '分段' }]
])
let hours = ref('0')
let minutes = ref('0')
let seconds = ref('0')
// 秒表模式
const stopwatchMode = ref<'interval' | 'together'>('interval')
// 间隔时间(秒)
const intervalTime = ref('')
// 段数
const segmentCount = ref('')
// 项目名称
const projectName = ref('')
// 临时项目名称
const tempProjectName = ref('')
// 新学生姓名
const newStudentName = ref('')
// 学生列表
const students = ref<Student[]>([
{ id: '1', name: '张三', selected: false, recordTime: '', lane: '', laps: '' },
{ id: '2', name: '李四', selected: false, recordTime: '', lane: '', laps: '' },
{ id: '3', name: '王五', selected: false, recordTime: '', lane: '', laps: '' },
{ id: '4', name: '赵六', selected: false, recordTime: '', lane: '', laps: '' },
])
// 临时学生列表
const tempStudents = ref<Student[]>([])
// 成绩记录
const records = ref<Record[]>([])
// 计时器状态
const isRunning = ref(false)
const currentTime = ref(0)
let timerInterval : number | null = null
let startTime : number = 0
// 模块选择确认
const onModuleConfirm = (e : any) => {
selectedModule.value = e.value[0].text
showModulePicker.value = false
}
// 泳道选择相关
const showLanePicker = ref(false)
const currentEditStudent = ref<Student | null>(null)
const laneOptions = ref([
[{ text: '泳道1', value: '泳道1' },
{ text: '泳道2', value: '泳道2' }]
])
// 时间选择相关
const showTimePicker = ref(false)
const timeColumns = ref([
// 小时0-99
Array.from({ length: 100 }, (_, i) => ({ text: `${i.toString().padStart(2, '0')}`, value: i })),
// 分钟0-59
Array.from({ length: 60 }, (_, i) => ({ text: `${i.toString().padStart(2, '0')}`, value: i })),
// 秒0-59
Array.from({ length: 60 }, (_, i) => ({ text: `${i.toString().padStart(2, '0')}`, value: i }))
])
// 计算属性:选中的学生
const selectedStudents = computed(() => {
return students.value.filter((s) => s.selected)
})
// 计算属性:临时选中的学生
const tempSelectedStudents = computed(() => {
return tempStudents.value.filter((s) => s.selected)
})
// 计算属性:是否全选
const isAllSelected = computed(() => {
return tempStudents.value.length > 0 && tempStudents.value.every((s) => s.selected)
})
// 打开泳道选择器
const openLanePicker = (student : Student) => {
currentEditStudent.value = student
showLanePicker.value = true
}
// 关闭泳道选择器
const closeLanePicker = () => {
showLanePicker.value = false
currentEditStudent.value = null
}
// 泳道选择确认
const onLaneConfirm = (e : any) => {
if (currentEditStudent.value) {
currentEditStudent.value.lane = e.value[0].text
}
closeLanePicker()
}
// 时间选择确认
const onTimeConfirm = (e : any) => {
console.log(e.value);
hours.value = e.value[0].value
minutes.value = e.value[1].value
seconds.value = e.value[2].value
currentTime.value = Number(hours.value) * 3600 + Number(minutes.value) * 60 + Number(seconds.value)
showTimePicker.value = false
}
// 全选/取消全选
const toggleSelectAll = () => {
const newValue = !isAllSelected.value
tempStudents.value.forEach((s) => {
s.selected = newValue
})
}
// 切换学生选择状态
const toggleStudent = (student : Student) => {
student.selected = !student.selected
}
// 添加学生
const addStudent = () => {
if (!newStudentName.value.trim()) {
Service.Msg('请输入学生姓名')
return
}
const newStudent : Student = {
id: Date.now().toString(),
name: newStudentName.value.trim(),
selected: false,
recordTime: '',
lane: '',
laps: '',
}
tempStudents.value.push(newStudent)
newStudentName.value = ''
dragSortKey.value++
Service.Msg('添加成功', 'success')
}
// 删除学生
const deleteStudent = (id : string) => {
uni.showModal({
title: '确认删除',
content: '确定要删除这个学生吗?',
success: (res) => {
if (res.confirm) {
tempStudents.value = tempStudents.value.filter((s) => s.id !== id)
dragSortKey.value++
}
},
})
}
// 删除选中的学生
const deleteSelectedStudents = () => {
if (tempSelectedStudents.value.length === 0) {
Service.Msg('请先选择要删除的学生')
return
}
uni.showModal({
title: '确认删除',
content: `确定要删除选中的 ${tempSelectedStudents.value.length} 个学生吗?`,
success: (res) => {
if (res.confirm) {
const selectedIds = tempSelectedStudents.value.map((s) => s.id)
tempStudents.value = tempStudents.value.filter((s) => !selectedIds.includes(s.id))
dragSortKey.value++
Service.Msg('删除成功', 'success')
}
},
})
}
// 创建项目
const recordTime = () => {
if (!tempProjectName.value.trim()) {
Service.Msg('请输入项目名称')
return
}
if (!selectedModule.value) {
Service.Msg('请选择模块类型')
return
}
// 如果选择了计时模块且是间隔出发模式,需要验证间隔时间
if (selectedModule.value === '计时' && stopwatchMode.value === 'interval') {
if (!intervalTime.value.trim()) {
Service.Msg('请输入间隔时间')
return
}
const intervalNum = parseFloat(intervalTime.value)
if (isNaN(intervalNum) || intervalNum <= 0) {
Service.Msg('请输入有效的间隔时间')
return
}
}
if (tempSelectedStudents.value.length === 0) {
Service.Msg('请选择学生')
return
}
Service.Msg('项目创建成功', 'success')
}
// 拖拽结束处理
const handleDragEnd = (list : Student[]) => {
tempStudents.value = list
dragSortKey.value++
}
// 页面加载
onMounted(() => {
// 深拷贝学生列表到临时列表
tempStudents.value = JSON.parse(JSON.stringify(students.value))
})
</script>
<style lang="scss" scoped>
.set-course-container {
min-height: 100vh;
background-color: #f5f5f5;
padding: 20rpx;
padding-bottom: 140rpx;
}
/* 卡片区域 */
.card-section {
background-color: #fff;
border-radius: 20rpx;
padding: 30rpx;
margin-bottom: 20rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.section-title {
font-size: 28rpx;
font-weight: 600;
color: #333;
margin-bottom: 24rpx;
}
/* 表单项 */
.form-item {
margin-bottom: 24rpx;
&:last-child {
margin-bottom: 0;
}
.form-label {
font-size: 26rpx;
color: #666;
margin-bottom: 12rpx;
display: block;
}
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.header-actions {
display: flex;
align-items: center;
gap: 20rpx;
.select-all {
display: flex;
align-items: center;
gap: 10rpx;
.checkbox {
width: 36rpx;
height: 36rpx;
border: 2rpx solid #ddd;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
&.checked {
background-color: #1890ff;
border-color: #1890ff;
}
}
.select-text {
font-size: 26rpx;
color: #666;
}
}
.delete-selected {
display: flex;
align-items: center;
gap: 8rpx;
padding: 8rpx 16rpx;
background-color: #fff0f0;
border-radius: 30rpx;
.delete-text {
font-size: 24rpx;
color: #ff4444;
}
}
}
}
/* 表单输入 */
.form-input {
width: 100%;
height: 88rpx;
background-color: #f5f5f5;
border-radius: 12rpx;
padding: 0 24rpx;
font-size: 28rpx;
color: #333;
}
/* 选择器包装器 */
.select-wrapper {
width: 100%;
height: 88rpx;
background-color: #f5f5f5;
border-radius: 12rpx;
padding: 0 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
.select-value {
font-size: 28rpx;
color: #333;
&.placeholder {
color: #999;
}
}
}
/* 单选按钮组 */
.radio-group {
display: flex;
gap: 40rpx;
.radio-item {
display: flex;
align-items: center;
gap: 12rpx;
cursor: pointer;
.radio-circle {
width: 36rpx;
height: 36rpx;
border: 2rpx solid #ddd;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s;
.radio-dot {
width: 18rpx;
height: 18rpx;
background-color: #1890ff;
border-radius: 50%;
}
}
.radio-label {
font-size: 28rpx;
color: #333;
}
&.active {
.radio-circle {
border-color: #1890ff;
}
}
}
}
/* 计时器区域 */
.timer-section {
text-align: center;
cursor: pointer;
transition: all 0.3s;
&:active {
opacity: 0.8;
}
.timer-display {
display: flex;
align-items: baseline;
justify-content: center;
.timer-text {
font-size: 72rpx;
font-weight: bold;
color: #333;
}
.timer-milliseconds {
font-size: 36rpx;
color: #666;
font-family: 'DIN Alternate', monospace;
}
}
.timer-hint {
font-size: 24rpx;
color: #999;
margin-top: 16rpx;
}
}
/* 学生列表 */
.students-list {
margin-bottom: 20rpx;
.student-item {
display: flex;
align-items: center;
padding: 24rpx 20rpx;
border-bottom: 1rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
}
&.selected {
margin-top: 10rpx;
background-color: #e6f7ff;
padding-left: 30rpx;
padding-right: 30rpx;
border-radius: 12rpx;
}
.drag-handle {
margin-right: 12rpx;
cursor: grab;
display: flex;
align-items: center;
justify-content: center;
&:active {
cursor: grabbing;
}
}
.student-checkbox {
margin-right: 20rpx;
.checkbox {
width: 36rpx;
height: 36rpx;
border: 2rpx solid #ddd;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
&.checked {
background-color: #1890ff;
border-color: #1890ff;
}
}
}
.student-info {
flex: 1;
display: flex;
align-items: center;
gap: 20rpx;
cursor: pointer;
.student-index {
font-size: 24rpx;
color: #999;
width: 40rpx;
}
.student-name {
font-size: 30rpx;
color: #333;
}
}
.lane-input-wrapper {
margin-right: 20rpx;
display: flex;
align-items: center;
gap: 8rpx;
background-color: #f5f5f5;
border-radius: 8rpx;
padding: 0 16rpx;
height: 60rpx;
transition: all 0.2s ease;
&:active {
background-color: #e8e8e8;
}
.lane-select {
font-size: 26rpx;
color: #333;
text-align: center;
&.placeholder {
color: #999;
}
}
}
.laps-input-wrapper {
margin-right: 20rpx;
display: flex;
align-items: center;
.laps-input {
width: 100rpx;
height: 60rpx;
background-color: #f5f5f5;
border-radius: 8rpx;
padding: 0 16rpx;
font-size: 26rpx;
color: #333;
text-align: center;
}
}
.student-actions {
.action-icon {
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background-color: #fff0f0;
}
}
}
}
/* 添加学生 */
.add-student-wrapper {
display: flex;
gap: 20rpx;
.add-student-input {
flex: 1;
height: 80rpx;
background-color: #f5f5f5;
border-radius: 12rpx;
padding: 0 24rpx;
font-size: 28rpx;
color: #333;
}
.add-student-btn {
width: 80rpx;
height: 80rpx;
background-color: #1890ff;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
border: none;
}
}
/* 底部按钮区域 */
.bottom-section {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 20rpx 30rpx;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
background-color: #fff;
border-top: 1rpx solid #f0f0f0;
.submit-btn {
width: 100%;
height: 88rpx;
background-color: #1890ff;
color: #fff;
font-size: 32rpx;
font-weight: 600;
border-radius: 12rpx;
border: none;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4rpx 12rpx rgba(24, 144, 255, 0.3);
&:disabled {
background-color: #ccc;
box-shadow: none;
}
}
}
</style>

View File

@@ -0,0 +1,547 @@
<template>
<view class="student-container">
<!-- 页面标题区域 -->
<view class="header-section">
<view class="header-title">
<text class="title">学员管理</text>
<text class="subtitle">{{ students.length }}位学员</text>
</view>
</view>
<!-- 学员列表 -->
<view class="students-section">
<view v-if="students.length === 0" class="empty-state">
<view class="empty-icon">
<u-icon name="account" size="64" color="#ddd"></u-icon>
</view>
<text class="empty-text">暂无学员</text>
<text class="empty-desc">点击下方按钮添加第一位学员</text>
</view>
<view v-else class="students-list">
<view v-for="(student, index) in students" :key="student.id" class="student-card">
<view class="student-info">
<view class="student-number">{{ student.number }}</view>
<view class="student-details">
<text class="student-name">{{ student.name }}</text>
</view>
</view>
<view class="student-actions">
<view class="action-btn edit-btn" @click="openEditModal(student)">
<u-icon name="edit-pen" size="18" color="#1890ff"></u-icon>
</view>
<view class="action-btn delete-btn" @click="confirmDelete(student)">
<u-icon name="trash" size="18" color="#ff4d4f"></u-icon>
</view>
</view>
</view>
</view>
</view>
<!-- 底部添加按钮 -->
<view class="bottom-add-btn">
<button class="add-btn" @click="showAddModal = true">
<u-icon name="plus" size="24" color="#fff"></u-icon>
<text class="btn-text">添加学员</text>
</button>
</view>
<!-- 添加/编辑学员弹窗 -->
<view v-if="showAddModal || showEditModal" class="modal-overlay" @click="closeModal"></view>
<view v-if="showAddModal || showEditModal" class="student-modal">
<view class="modal-header">
<text class="modal-title">{{ showAddModal ? '添加学员' : '编辑学员' }}</text>
<view class="modal-close" @click="closeModal">
<u-icon name="close" size="20" color="#999"></u-icon>
</view>
</view>
<view class="modal-content">
<view class="form-group">
<text class="form-label">序号</text>
<input class="form-input" v-model="formData.number" placeholder="请输入序号" type="text" />
</view>
<view class="form-group">
<text class="form-label">学员姓名</text>
<input class="form-input" v-model="formData.name" placeholder="请输入学员姓名" type="text" />
</view>
</view>
<view class="modal-footer">
<button class="modal-cancel-btn" @click="closeModal">取消</button>
<button class="modal-confirm-btn" @click="saveStudent">
{{ showAddModal ? '添加' : '保存' }}
</button>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { onShow, onLoad } from "@dcloudio/uni-app"
import { Service } from '@/Service/Service'
import { ref } from "vue"
// 定义学员类型
interface Student {
id : string
number : string
name : string
}
// 学员列表
const students = ref<Student[]>([
{ id: '001', number: '01', name: '张三' },
{ id: '002', number: '02', name: '李四' },
{ id: '003', number: '03', name: '王五' },
{ id: '004', number: '04', name: '赵六' }
])
// 弹窗状态
const showAddModal = ref(false)
const showEditModal = ref(false)
// 表单数据
const formData = ref({
id: '',
number: '',
name: ''
})
// 当前编辑的学员
const editingStudent = ref<Student | null>(null)
onLoad(() => {
})
onShow(() => {
})
// 打开编辑弹窗
const openEditModal = (student : Student) => {
editingStudent.value = student
formData.value = {
id: student.id,
number: student.number,
name: student.name
}
showEditModal.value = true
}
// 关闭弹窗
const closeModal = () => {
showAddModal.value = false
showEditModal.value = false
editingStudent.value = null
formData.value = {
id: '',
number: '',
name: ''
}
}
// 保存学员
const saveStudent = () => {
if (!formData.value.number.trim()) {
Service.Msg('请输入序号')
return
}
if (!formData.value.name.trim()) {
Service.Msg('请输入学员姓名')
return
}
if (showAddModal.value) {
// 添加新学员
const newStudent : Student = {
id: Date.now().toString().slice(-6),
number: formData.value.number.trim(),
name: formData.value.name.trim()
}
students.value.push(newStudent)
Service.Msg('添加成功', 'success')
} else if (showEditModal.value && editingStudent.value) {
// 编辑学员
const index = students.value.findIndex(s => s.id === editingStudent.value!.id)
if (index !== -1) {
students.value[index] = {
...students.value[index],
number: formData.value.number.trim(),
name: formData.value.name.trim()
}
Service.Msg('修改成功', 'success')
}
}
closeModal()
}
// 确认删除
const confirmDelete = (student : Student) => {
uni.showModal({
title: '确认删除',
content: `确定要删除学员「${student.name}」吗?`,
confirmColor: '#ff4d4f',
success: (res) => {
if (res.confirm) {
deleteStudent(student.id)
}
}
})
}
// 删除学员
const deleteStudent = (id : string) => {
students.value = students.value.filter(s => s.id !== id)
Service.Msg('删除成功', 'success')
}
</script>
<style lang="scss" scoped>
page {
background-color: #f5f5f5;
}
.student-container {
min-height: 100vh;
padding: 20rpx;
padding-bottom: 180rpx;
}
/* 页面标题区域 */
.header-section {
margin-bottom: 24rpx;
.header-title {
display: flex;
align-items: center;
justify-content: space-between;
.title {
font-size: 36rpx;
font-weight: 700;
color: #333;
display: block;
margin-bottom: 8rpx;
}
.subtitle {
font-size: 24rpx;
color: #999;
}
}
}
/* 学员列表区域 */
.students-section {
.empty-state {
background-color: #fff;
border-radius: 24rpx;
padding: 80rpx 40rpx;
display: flex;
flex-direction: column;
align-items: center;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
.empty-icon {
margin-bottom: 24rpx;
opacity: 0.6;
}
.empty-text {
font-size: 30rpx;
font-weight: 600;
color: #666;
margin-bottom: 12rpx;
}
.empty-desc {
font-size: 24rpx;
color: #999;
}
}
}
.students-list {
.student-card {
background-color: #fff;
border-radius: 20rpx;
padding: 28rpx 24rpx;
margin-bottom: 16rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
transition: all 0.3s ease;
&:active {
transform: scale(0.98);
box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0.04);
}
.student-info {
display: flex;
align-items: center;
gap: 20rpx;
flex: 1;
.student-number {
width: 64rpx;
height: 64rpx;
background: linear-gradient(135deg, #e6f7ff 0%, #bae7ff 100%);
color: #1890ff;
font-size: 28rpx;
font-weight: 700;
border-radius: 14rpx;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2rpx 8rpx rgba(24, 144, 255, 0.15);
}
.student-details {
.student-name {
font-size: 32rpx;
font-weight: 600;
color: #333;
display: block;
margin-bottom: 6rpx;
}
.student-id {
font-size: 24rpx;
color: #999;
}
}
}
.student-actions {
display: flex;
gap: 12rpx;
.action-btn {
width: 64rpx;
height: 64rpx;
border-radius: 14rpx;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.25s ease;
&.edit-btn {
background-color: #e6f7ff;
&:active {
background-color: #bae7ff;
transform: scale(0.92);
}
}
&.delete-btn {
background-color: #fff1f0;
&:active {
background-color: #ffccc7;
transform: scale(0.92);
}
}
}
}
}
}
/* 弹窗样式 */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 998;
animation: fadeIn 0.2s ease;
}
.student-modal {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 90%;
max-width: 640rpx;
background-color: #fff;
border-radius: 28rpx;
z-index: 999;
animation: slideUp 0.3s ease;
overflow: hidden;
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.2);
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx 30rpx;
border-bottom: 1rpx solid #f0f0f0;
.modal-title {
font-size: 32rpx;
font-weight: 700;
color: #333;
}
.modal-close {
width: 56rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
transition: background-color 0.2s ease;
&:active {
background-color: #f5f5f5;
}
}
}
.modal-content {
padding: 36rpx 30rpx;
}
.modal-footer {
display: flex;
gap: 16rpx;
padding: 24rpx 30rpx 36rpx;
border-top: 1rpx solid #f0f0f0;
}
}
/* 表单样式 */
.form-group {
margin-bottom: 32rpx;
&:last-child {
margin-bottom: 0;
}
.form-label {
display: block;
font-size: 28rpx;
font-weight: 600;
color: #333;
margin-bottom: 14rpx;
}
.form-input {
width: 100%;
height: 88rpx;
background-color: #f5f5f5;
border-radius: 16rpx;
padding: 0 24rpx;
font-size: 28rpx;
color: #333;
transition: all 0.2s ease;
&:focus {
background-color: #fff;
box-shadow: 0 0 0 4rpx rgba(24, 144, 255, 0.15);
}
}
}
/* 弹窗按钮 */
.modal-cancel-btn,
.modal-confirm-btn {
flex: 1;
height: 88rpx;
border-radius: 16rpx;
border: none;
font-size: 30rpx;
font-weight: 600;
transition: all 0.25s ease;
}
.modal-cancel-btn {
background-color: #f5f5f5;
color: #666;
&:active {
background-color: #e8e8e8;
transform: scale(0.96);
}
}
.modal-confirm-btn {
background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
color: #fff;
box-shadow: 0 6rpx 16rpx rgba(24, 144, 255, 0.35);
&:active {
transform: scale(0.96);
box-shadow: 0 3rpx 8rpx rgba(24, 144, 255, 0.25);
}
}
/* 底部添加按钮 */
.bottom-add-btn {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: #fff;
padding: 20rpx 30rpx;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
border-top: 1rpx solid #f0f0f0;
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.08);
z-index: 100;
.add-btn {
width: 100%;
height: 96rpx;
background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
border-radius: 20rpx;
border: none;
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
box-shadow: 0 8rpx 24rpx rgba(24, 144, 255, 0.4);
transition: all 0.3s ease;
&:active {
transform: scale(0.97);
box-shadow: 0 4rpx 12rpx rgba(24, 144, 255, 0.3);
}
.btn-text {
font-size: 32rpx;
color: #fff;
font-weight: 700;
}
}
}
/* 动画 */
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes slideUp {
from {
opacity: 0;
transform: translate(-50%, -45%);
}
to {
opacity: 1;
transform: translate(-50%, -50%);
}
}
</style>

View File

@@ -0,0 +1,839 @@
<template>
<view class="swim-timer-container">
<up-navbar title="自由泳500米" :placeholder='true' :autoBack="true" @click="rightClick()" rightIcon='more-dot-fill'>
</up-navbar>
<view class="total-time-section">
<text class="time-label">当前总用时</text>
<view class="" style="position: relative;">
<view class="total-time">{{ formatTime(currentTime) }}</view>
<view class="" style="position: absolute; right: 0; bottom: 4rpx;">
<view v-if="stopwatchMode!=='together'" @click="recordNextAthlete"
style=" display: flex; align-items: center; justify-content: center; background-color: #fff; border: 1rpx solid #e2e2e2; width: 70rpx; height: 70rpx; padding: 10rpx; border-radius: 50%;">
<img :src="Service.GetIconImg('/static/index/Flag.png')" style="width: 35rpx; height: 35rpx;"
alt="" />
</view>
</view>
</view>
</view>
<!-- 选手列表 -->
<view class="athletes-section">
<view class="section-header">
<text class="section-title">选手列表</text>
<text class="athlete-count">{{ athletes.length }}位选手</text>
</view>
<view class="athletes-list">
<view v-for="(athlete, index) in athletes" :key="athlete.id" class="athlete-item"
:class="{ finished: athlete.finished, fastest: athlete.isFastest }">
<view class="athlete-number">{{ athlete.number }}</view>
<view class="athlete-info">
<text class="athlete-name">{{ athlete.name }}</text>
<text class="athlete-lane">{{ athlete.lane }}</text>
</view>
<view class="time-wrapper">
<text class="athlete-time">{{ formatTime(athlete.time) }}</text>
<text v-if="athlete.bestTime" class="best-time">最快: {{ formatTime(athlete.bestTime) }}</text>
</view>
<view class="" style="display: flex;align-items: center; gap: 10rpx;">
<view v-if="stopwatchMode=='together'" @click="handleAthleteFirstButton(athlete, index)">
<u-icon name="pause-circle" bold="true" size="22" color="#1890ff"></u-icon>
</view>
<view @click="resetAthleteTime(athlete)">
<u-icon name="reload" bold="true" size="24" color="#1890ff"></u-icon>
</view>
</view>
</view>
</view>
</view>
<!-- 底部控制按钮 -->
<view class="control-buttons">
<button class="start-btn" @click="startTimer" :disabled="isRunning">
<u-icon name="play-right" size="24" color="#fff"></u-icon>
<text class="btn-text">开始</text>
</button>
<button class="pause-btn" @click="stopTimer" :disabled="!isRunning">
<u-icon name="pause" size="24" color="#fff"></u-icon>
<text class="btn-text">暂停</text>
</button>
<button class="reset-all-btn" @click="resetAll">
<u-icon name="reload" size="24" color="#fff"></u-icon>
<text class="btn-text">重置</text>
</button>
</view>
<!-- 更多选项弹出框 -->
<view v-if="showMoreModal" class="modal-overlay" @click="closeMoreModal"></view>
<view v-if="showMoreModal" class="more-modal">
<view class="modal-item" @click="showStopwatchModal = true; showMoreModal = false">
<u-icon name="clock" size="24" color="#1890ff"></u-icon>
<text class="modal-item-text">调试秒表模式</text>
<u-icon name="arrow-right" size="16" color="#ccc"></u-icon>
</view>
<view class="modal-item" @click="showAddStudentModal = true; showMoreModal = false">
<u-icon name="plus-circle" size="24" color="#52c41a"></u-icon>
<text class="modal-item-text">添加学生</text>
<u-icon name="arrow-right" size="16" color="#ccc"></u-icon>
</view>
<view class="modal-cancel" @click="closeMoreModal">
取消
</view>
</view>
<!-- 秒表模式弹出框 -->
<view v-if="showStopwatchModal" class="modal-overlay" @click="closeStopwatchModal"></view>
<view v-if="showStopwatchModal" class="stopwatch-modal">
<view class="modal-header">
<text class="modal-title">秒表模式</text>
<view class="modal-close" @click="closeStopwatchModal">
<u-icon name="close" size="20" color="#999"></u-icon>
</view>
</view>
<view class="modal-content">
<view class="stopwatch-option" :class="{ active: stopwatchMode === 'interval' }" @click="stopwatchMode = 'interval'">
<view class="option-radio">
<view v-if="stopwatchMode === 'interval'" class="option-dot"></view>
</view>
<text class="option-text">间隔出发</text>
</view>
<view v-if="stopwatchMode === 'interval'" class="interval-input-wrapper">
<view class="form-group">
<text class="form-label">间隔时间</text>
<input class="form-input" v-model="intervalTime" placeholder="请输入间隔时间" type="number" />
</view>
</view>
<view class="stopwatch-option" :class="{ active: stopwatchMode === 'together' }"
@click="stopwatchMode = 'together'">
<view class="option-radio">
<view v-if="stopwatchMode === 'together'" class="option-dot"></view>
</view>
<text class="option-text">一起出发</text>
</view>
</view>
<view class="modal-footer">
<button class="modal-confirm-btn" @click="confirmStopwatchMode">确定</button>
</view>
</view>
<!-- 添加学生弹出框 -->
<view v-if="showAddStudentModal" class="modal-overlay" @click="closeAddStudentModal"></view>
<view v-if="showAddStudentModal" class="add-student-modal">
<view class="modal-header">
<text class="modal-title">添加学生</text>
<view class="modal-close" @click="closeAddStudentModal">
<u-icon name="close" size="20" color="#999"></u-icon>
</view>
</view>
<view class="modal-content">
<view class="form-group">
<text class="form-label">学生姓名</text>
<input class="form-input" v-model="newStudentName" placeholder="请输入学生姓名" type="text" />
</view>
<view class="form-group">
<text class="form-label">序号</text>
<input class="form-input" v-model="newStudentLane" placeholder="请输入序号" type="text" />
</view>
</view>
<view class="modal-footer">
<button class="modal-cancel-btn" @click="closeAddStudentModal">取消</button>
<button class="modal-confirm-btn" @click="addNewStudent">添加</button>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, onUnmounted, computed } from 'vue'
import { Service } from '@/Service/Service';
// 定义选手类型
interface Athlete {
id: string
number: string
name: string
lane: string
time: number
bestTime: number | null
finished: boolean
isFastest: boolean
}
// 选手列表
const athletes = ref<Athlete[]>([
{ id: '1', number: '01', name: '张三', lane: '第一泳道', time: 0, bestTime: null, finished: false, isFastest: false },
{ id: '2', number: '02', name: '李四', lane: '第二泳道', time: 0, bestTime: null, finished: false, isFastest: false },
{ id: '3', number: '03', name: '王五', lane: '第三泳道', time: 0, bestTime: null, finished: false, isFastest: false },
{ id: '4', number: '04', name: '赵六', lane: '第四泳道', time: 0, bestTime: null, finished: false, isFastest: false }
])
// 计时器状态
const isRunning = ref(false)
const currentTime = ref(0)
let timerInterval: number | null = null
let startTime: number = 0
// 当前要记录的选手索引
const currentAthleteIndex = ref(0)
// 秒表模式
const stopwatchMode = ref<'interval' | 'together'>('interval')
// 间隔时间(秒)
const intervalTime = ref('')
// 弹出框状态
const showMoreModal = ref(false)
const showStopwatchModal = ref(false)
const showAddStudentModal = ref(false)
// 新学生信息
const newStudentName = ref('')
const newStudentLane = ref('')
// 计算已完成的选手
const finishedAthletes = computed(() => {
return athletes.value.filter(a => a.finished)
})
// 格式化时间显示
const formatTime = (seconds: number): string => {
const mins = Math.floor(seconds / 60)
const secs = Math.floor(seconds % 60)
const ms = Math.floor((seconds % 1) * 100)
return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}.${ms.toString().padStart(2, '0')}`
}
// 开始计时
const startTimer = () => {
if (isRunning.value) return
isRunning.value = true
startTime = Date.now() - currentTime.value * 1000
timerInterval = setInterval(() => {
const elapsed = (Date.now() - startTime) / 1000
currentTime.value = elapsed
// 更新未完成选手的时间
athletes.value.forEach(athlete => {
if (!athlete.finished) {
athlete.time = elapsed
}
})
}, 10)
}
// 停止计时
const stopTimer = () => {
if (!isRunning.value) return
isRunning.value = false
if (timerInterval) {
clearInterval(timerInterval)
timerInterval = null
}
}
// 记录下一个选手
const recordNextAthlete = () => {
if (currentAthleteIndex.value >= athletes.value.length) {
Service.Msg('所有选手已完成')
return
}
const athlete = athletes.value[currentAthleteIndex.value]
athlete.finished = true
athlete.time = currentTime.value
// 更新最快记录
if (athlete.bestTime === null || athlete.time < athlete.bestTime) {
athlete.bestTime = athlete.time
}
// 更新最快选手
updateFastestAthlete()
currentAthleteIndex.value++
// 如果所有选手都完成了,停止计时
if (currentAthleteIndex.value >= athletes.value.length) {
stopTimer()
Service.Msg('所有选手已完成!')
}
}
// 更新最快选手
const updateFastestAthlete = () => {
// 先清除所有最快标记
athletes.value.forEach(a => a.isFastest = false)
// 找出已完成的选手
const finished = athletes.value.filter(a => a.finished && a.time > 0)
if (finished.length === 0) return
// 找出时间最短的
const fastest = finished.reduce((prev, curr) => {
return prev.time < curr.time ? prev : curr
})
fastest.isFastest = true
}
// 重置选手时间
const resetAthleteTime = (athlete: Athlete) => {
athlete.time = 0
athlete.finished = false
athlete.isFastest = false
// 重新排序索引
reorderAthletes()
updateFastestAthlete()
}
// 处理选手第一个按钮点击
const handleAthleteFirstButton = (athlete: Athlete, index: number) => {
// 如果是一起出发模式,记录该选手时间
if (stopwatchMode.value === 'together') {
if (athlete.finished) {
Service.Msg('该选手已记录')
return
}
athlete.finished = true
athlete.time = currentTime.value
// 更新最快记录
if (athlete.bestTime === null || athlete.time < athlete.bestTime) {
athlete.bestTime = athlete.time
}
// 更新最快选手
updateFastestAthlete()
// 检查是否所有选手都完成了
const allFinished = athletes.value.every(a => a.finished)
if (allFinished) {
stopTimer()
Service.Msg('所有选手已完成!')
} else {
Service.Msg(`${athlete.name} 已记录`)
}
} else {
// 间隔出发模式,重置选手时间
resetAthleteTime(athlete)
}
}
// 重新排序选手索引
const reorderAthletes = () => {
const unfinished = athletes.value.filter(a => !a.finished)
currentAthleteIndex.value = athletes.value.length - unfinished.length
}
// 重置所有
const resetAll = () => {
stopTimer()
currentTime.value = 0
currentAthleteIndex.value = 0
athletes.value.forEach(athlete => {
athlete.time = 0
athlete.finished = false
athlete.isFastest = false
})
}
// 右上角更多按钮点击
const rightClick = () => {
showMoreModal.value = true
}
// 关闭更多弹出框
const closeMoreModal = () => {
showMoreModal.value = false
}
// 关闭秒表模式弹出框
const closeStopwatchModal = () => {
showStopwatchModal.value = false
}
// 确认秒表模式
const confirmStopwatchMode = () => {
if (stopwatchMode.value === 'interval') {
if (!intervalTime.value.trim()) {
Service.Msg('请输入间隔时间')
return
}
const intervalNum = parseFloat(intervalTime.value)
if (isNaN(intervalNum) || intervalNum <= 0) {
Service.Msg('请输入有效的间隔时间')
return
}
Service.Msg(`已切换为间隔出发模式,间隔${intervalTime.value}`, 'success')
} else {
Service.Msg('已切换为一起出发模式', 'success')
}
showStopwatchModal.value = false
}
// 关闭添加学生弹出框
const closeAddStudentModal = () => {
showAddStudentModal.value = false
newStudentName.value = ''
newStudentLane.value = ''
}
// 添加新学生
const addNewStudent = () => {
if (!newStudentName.value.trim()) {
Service.Msg('请输入学生姓名')
return
}
const newNumber = (athletes.value.length + 1).toString().padStart(2, '0')
const newAthlete: Athlete = {
id: Date.now().toString(),
number: newNumber,
name: newStudentName.value.trim(),
lane: newStudentLane.value.trim() || `${newNumber}泳道`,
time: 0,
bestTime: null,
finished: false,
isFastest: false
}
athletes.value.push(newAthlete)
Service.Msg('添加成功', 'success')
closeAddStudentModal()
}
// 页面卸载时清理计时器
onUnmounted(() => {
if (timerInterval) {
clearInterval(timerInterval)
}
})
</script>
<style lang="scss" scoped>
.swim-timer-container {
min-height: 100vh;
background-color: #f6f6f6;
padding: 20rpx 20rpx;
}
/* 总用时区域 */
.total-time-section {
margin-top: 20rpx;
text-align: center;
margin-bottom: 60rpx;
.time-label {
font-size: 28rpx;
color: #666666;
margin-bottom: 20rpx;
display: block;
}
.total-time {
font-size: 80rpx;
font-weight: bold;
color: #1890ff;
}
}
/* 选手列表区域 */
.athletes-section {
margin-bottom: 120rpx;
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.section-title {
font-size: 32rpx;
font-weight: 600;
color: #333333;
}
.athlete-count {
font-size: 24rpx;
color: #999999;
background-color: #f5f5f5;
padding: 6rpx 16rpx;
border-radius: 16rpx;
}
}
.athletes-list {
.athlete-item {
display: flex;
align-items: center;
padding: 24rpx;
margin-bottom: 16rpx;
background-color: #ffffff;
border-radius: 16rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
transition: all 0.3s;
&.finished {
background-color: #f6ffed;
border: 2rpx solid #b7eb8f;
}
&.fastest {
background-color: #fff7e6;
border: 2rpx solid #ffd591;
}
.athlete-number {
width: 56rpx;
height: 56rpx;
background-color: #e6f7ff;
color: #1890ff;
font-size: 28rpx;
font-weight: 600;
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 20rpx;
}
.athlete-info {
flex: 1;
margin-right: 30rpx;
position: relative;
.athlete-name {
font-size: 30rpx;
font-weight: 500;
color: #333333;
margin-bottom: 4rpx;
display: block;
}
.athlete-lane {
font-size: 24rpx;
color: #999999;
}
.fastest-tag {
position: absolute;
top: 0;
right: 0;
font-size: 20rpx;
color: #fa8c16;
background-color: #fff7e6;
padding: 2rpx 10rpx;
border-radius: 8rpx;
}
}
.time-wrapper {
display: flex;
flex-direction: column;
align-items: flex-end;
margin-right: 20rpx;
min-width: 160rpx;
.athlete-time {
font-size: 32rpx;
font-weight: 600;
color: #333333;
font-family: 'DIN Alternate', monospace;
}
.best-time {
font-size: 20rpx;
color: #999;
margin-top: 4rpx;
}
}
.reset-btn {
width: 48rpx;
height: 48rpx;
background-color: #f5f5f5;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
}
}
}
/* 底部控制按钮 */
.control-buttons {
display: flex;
gap: 20rpx;
justify-content: center;
padding-bottom: env(safe-area-inset-bottom);
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: #fff;
padding: 20rpx;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
border-top: 1rpx solid #f0f0f0;
.start-btn,
.pause-btn,
.reset-all-btn {
flex: 1;
height: 88rpx;
border-radius: 12rpx;
border: none;
font-size: 30rpx;
font-weight: 600;
display: flex;
align-items: center;
justify-content: center;
gap: 10rpx;
max-width: 220rpx;
}
.start-btn {
background-color: #52c41a;
color: #ffffff;
&:disabled {
background-color: #ccc;
}
}
.pause-btn {
background-color: #fa541c;
color: #ffffff;
&:disabled {
background-color: #ccc;
}
}
.reset-all-btn {
background-color: #1890ff;
color: #ffffff;
}
.btn-text {
font-size: 30rpx;
color: #ffffff;
}
}
/* 弹出框遮罩 */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 998;
}
/* 更多选项弹出框 */
.more-modal {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: #fff;
border-radius: 24rpx 24rpx 0 0;
z-index: 999;
padding: 20rpx;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
.modal-item {
display: flex;
align-items: center;
padding: 30rpx 20rpx;
border-bottom: 1rpx solid #f5f5f5;
.modal-item-text {
flex: 1;
font-size: 30rpx;
color: #333;
margin-left: 20rpx;
}
}
.modal-cancel {
text-align: center;
padding: 30rpx;
font-size: 30rpx;
color: #666;
background-color: #f5f5f5;
border-radius: 12rpx;
margin-top: 20rpx;
}
}
/* 秒表模式和添加学生弹出框 */
.stopwatch-modal,
.add-student-modal {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 90%;
max-width: 600rpx;
background-color: #fff;
border-radius: 24rpx;
z-index: 999;
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #f0f0f0;
.modal-title {
font-size: 32rpx;
font-weight: 600;
color: #333;
}
.modal-close {
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
}
}
.modal-content {
padding: 30rpx;
}
.modal-footer {
display: flex;
gap: 20rpx;
padding: 30rpx;
border-top: 1rpx solid #f0f0f0;
.modal-cancel-btn,
.modal-confirm-btn {
flex: 1;
height: 80rpx;
border-radius: 12rpx;
border: none;
font-size: 30rpx;
font-weight: 600;
}
.modal-cancel-btn {
background-color: #f5f5f5;
color: #666;
}
.modal-confirm-btn {
background-color: #1890ff;
color: #fff;
}
}
}
/* 秒表模式选项 */
.stopwatch-option {
display: flex;
align-items: center;
padding: 24rpx 0;
border-bottom: 1rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
}
&.active {
.option-radio {
border-color: #1890ff;
}
}
.option-radio {
width: 36rpx;
height: 36rpx;
border: 2rpx solid #ddd;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 20rpx;
transition: all 0.3s;
.option-dot {
width: 18rpx;
height: 18rpx;
background-color: #1890ff;
border-radius: 50%;
}
}
.option-text {
font-size: 30rpx;
color: #333;
}
}
/* 间隔时间输入框 */
.interval-input-wrapper {
padding: 20rpx 0 20rpx 56rpx;
border-bottom: 1rpx solid #f5f5f5;
.form-group {
margin-bottom: 0;
.form-label {
display: block;
font-size: 26rpx;
color: #666;
margin-bottom: 12rpx;
}
.form-input {
width: 100%;
height: 72rpx;
background-color: #f5f5f5;
border-radius: 12rpx;
padding: 0 24rpx;
font-size: 28rpx;
color: #333;
}
}
}
/* 表单组 */
.form-group {
margin-bottom: 30rpx;
&:last-child {
margin-bottom: 0;
}
.form-label {
display: block;
font-size: 28rpx;
color: #666;
margin-bottom: 12rpx;
}
.form-input {
width: 100%;
height: 80rpx;
background-color: #f5f5f5;
border-radius: 12rpx;
padding: 0 24rpx;
font-size: 28rpx;
color: #333;
}
}
</style>

BIN
src/static/index/Flag.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
src/static/index/pause.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,320 @@
## 2.5.0-202301012023-01-01
- 秋云图表组件 修改条件编译顺序确保uniapp的cli方式的项目依赖不完整时可以正常显示
- 秋云图表组件 恢复props属性directory的使用以修复vue3项目中开启echarts后echarts目录识别错误的bug
- uCharts.js 修复区域图、混合图只有一个数据时图表显示不正确的bug
- uCharts.js 修复折线图、区域图中时间轴类别图表tooltip指示点显示不正确的bug
- uCharts.js 修复x轴使用labelCount时并且boundaryGap = 'justify' 并且关闭Y轴显示的时候最后一个坐标值不显示的bug
- uCharts.js 修复折线图只有一组数据时 ios16 渲染颜色不正确的bug
- uCharts.js 修复玫瑰图半径显示不正确的bug
- uCharts.js 柱状图、山峰图增加正负图功能y轴网格如果需要显示0轴则由 min max 及 splitNumber 确定后续版本优化自动显示0轴
- uCharts.js 柱状图column增加 opts.extra.column.labelPosition数据标签位置有效值为 outside外部, insideTop内顶部, center内中间, bottom内底部
- uCharts.js 雷达图radar增加 opts.extra.radar.labelShow否显示各项标识文案是默认true
- uCharts.js 提示窗tooltip增加 opts.extra.tooltip.boxPadding提示窗边框填充距离默认3px
- uCharts.js 提示窗tooltip增加 opts.extra.tooltip.fontSize提示窗字体大小配置默认13px
- uCharts.js 提示窗tooltip增加 opts.extra.tooltip.lineHeight提示窗文字行高默认20px
- uCharts.js 提示窗tooltip增加 opts.extra.tooltip.legendShow是否显示左侧图例默认true
- uCharts.js 提示窗tooltip增加 opts.extra.tooltip.legendShape图例形状图例标识样式有效值为 auto自动跟随图例, diamond◆, circle●, triangle▲, square■, rect▬, line-
- uCharts.js 标记线markLine增加 opts.extra.markLine.labelFontSize字体大小配置默认13px
- uCharts.js 标记线markLine增加 opts.extra.markLine.labelPadding标签边框内填充距离默认6px
- uCharts.js 折线图line增加 opts.extra.line.linearType渐变色类型可选值 none关闭渐变色custom 自定义渐变色。使用自定义渐变色时请赋值serie.linearColor作为颜色值
- uCharts.js 折线图line增加 serie.linearColor渐变色数组格式为2维数组[起始位置,颜色值],例如[[0,'#0EE2F8'],[0.3,'#2BDCA8'],[0.6,'#1890FF'],[1,'#9A60B4']]
- uCharts.js 折线图line增加 opts.extra.line.onShadow是否开启折线阴影开启后请赋值serie.setShadow阴影设置
- uCharts.js 折线图line增加 serie.setShadow阴影配置格式为4位数组[offsetX,offsetY,blur,color]
- uCharts.js 折线图line增加 opts.extra.line.animation动画效果方向可选值为vertical 垂直动画效果horizontal 水平动画效果
- uCharts.js X轴xAxis增加 opts.xAxis.lineHeightX轴字体行高默认20px
- uCharts.js X轴xAxis增加 opts.xAxis.marginTopX轴文字距离轴线的距离默认0px
- uCharts.js X轴xAxis增加 opts.xAxis.title当前X轴标题
- uCharts.js X轴xAxis增加 opts.xAxis.titleFontSize标题字体大小默认13px
- uCharts.js X轴xAxis增加 opts.xAxis.titleOffsetY标题纵向偏移距离负数为向上偏移正数向下偏移
- uCharts.js X轴xAxis增加 opts.xAxis.titleOffsetX标题横向偏移距离负数为向左偏移正数向右偏移
- uCharts.js X轴xAxis增加 opts.xAxis.titleFontColor标题字体颜色默认#666666
## 报错TypeError: Cannot read properties of undefined (reading 'length')
- 如果是uni-modules版本组件请先登录HBuilderX账号
- 在HBuilderX中的manifest.json点击重新获取uniapp的appid或者删除appid重新粘贴重新运行
- 如果是cli项目请使用码云上的非uniCloud版本组件
- 或者添加uniCloud的依赖
- 或者使用原生uCharts
## 2.4.5-202211302022-11-30
- uCharts.js 优化tooltip当文字很多变为左侧显示时如果画布仍显显示不下提示框错位置变为以左侧0位置起画
- uCharts.js 折线图修复特殊情况下只有单点数据并改变线宽后点变为圆形的bug
- uCharts.js 修复Y轴disabled启用后无效并报错的bug
- uCharts.js 修复仪表盘起始结束角度特殊情况下显示不正确的bug
- uCharts.js 雷达图新增参数 opts.extra.radar.radius , 自定义雷达图半径
- uCharts.js 折线图、区域图增加tooltip指示点opts.extra.line.activeType/opts.extra.area.activeType可选值"none"不启用激活指示点,"hollow"空心点模式,"solid"实心点模式
## 2.4.4-202211022022-11-02
- 秋云图表组件 修复使用echarts时reload、reshow无法调用重新渲染的bug[详见码云PR](https://gitee.com/uCharts/uCharts/pulls/40)
- 秋云图表组件 修复使用echarts时初始化时宽高不正确的bug[详见码云PR](https://gitee.com/uCharts/uCharts/pulls/42)
- 秋云图表组件 修复uniapp的h5使用history模式时无法加载echarts的bug
- 秋云图表组件 小程序端@complete@scrollLeft@scrollRight@getTouchStart@getTouchMove@getTouchEnd事件增加opts参数传出,方便一些特殊需求的交互获取数据。
- uCharts.js 修复calTooltipYAxisData方法内formatter格式化方法未与y轴方法同步的问题[详见码云PR](https://gitee.com/uCharts/uCharts/pulls/43)
- uCharts.js 地图新增参数opts.series[i].fillOpacity以透明度方式来设置颜色过度效果[详见码云PR](https://gitee.com/uCharts/uCharts/pulls/38)
- uCharts.js 地图新增参数opts.extra.map.active是否启用点击激活变色
- uCharts.js 地图新增参数opts.extra.map.activeTextColor是否启用点击激活变色
- uCharts.js 地图新增渲染完成事件renderComplete
- uCharts.js 漏斗图修复当部分数据相同时tooltip提示窗点击错误的bug
- uCharts.js 漏斗图新增参数series.data[i].centerText 居中标签文案
- uCharts.js 漏斗图新增参数series.data[i].centerTextSize 居中标签文案字体大小默认opts.fontSize
- uCharts.js 漏斗图新增参数series.data[i].centerTextColor 居中标签文案字体颜色,默认#FFFFFF
- uCharts.js 漏斗图新增参数opts.extra.funnel.minSize 最小值的最小宽度默认0
- uCharts.js 进度条新增参数opts.extra.arcbar.direction动画方向可选值为cw顺时针、ccw逆时针
- uCharts.js 混合图新增参数opts.extra.mix.line.width折线的宽度默认2
- uCharts.js 修复tooltip开启horizentalLine水平横线标注时图表显示错位的bug
- uCharts.js 优化tooltip当文字很多变为左侧显示时如果画布仍显显示不下提示框错位置变为以左侧0位置起画
- uCharts.js 修复开启滚动条后X轴文字超出绘图区域后的隐藏逻辑
- uCharts.js 柱状图、条状图修复堆叠模式不能通过{value,color}赋值单个柱子颜色的问题
- uCharts.js 气泡图修复不识别series.textSize和series.textColor的bug
## 报错TypeError: Cannot read properties of undefined (reading 'length')
1. 如果是uni-modules版本组件请先登录HBuilderX账号
2. 在HBuilderX中的manifest.json点击重新获取uniapp的appid或者删除appid重新粘贴重新运行
3. 如果是cli项目请使用码云上的非uniCloud版本组件
4. 或者添加uniCloud的依赖
5. 或者使用原生uCharts
## 2.4.3-202205052022-05-05
- 秋云图表组件 修复开启canvas2d后将series赋值为空数组显示加载图标时再次赋值后画布闪动的bug
- 秋云图表组件 修复升级hbx最新版后ECharts的highlight方法报错的bug
- uCharts.js 雷达图新增参数opts.extra.radar.gridEval数据点位网格抽希默认1
- uCharts.js 雷达图新增参数opts.extra.radar.axisLabel 是否显示刻度点值默认false
- uCharts.js 雷达图新增参数opts.extra.radar.axisLabelTofix刻度点值小数位数默认0
- uCharts.js 雷达图新增参数opts.extra.radar.labelPointShow是否显示末端刻度圆点默认false
- uCharts.js 雷达图新增参数opts.extra.radar.labelPointRadius刻度圆点的半径默认3
- uCharts.js 雷达图新增参数opts.extra.radar.labelPointColor刻度圆点的颜色默认#cccccc
- uCharts.js 雷达图新增参数opts.extra.radar.linearType渐变色类型可选值"none"关闭渐变,"custom"开启渐变
- uCharts.js 雷达图新增参数opts.extra.radar.customColor自定义渐变颜色数组类型对应series的数组长度以匹配不同series颜色的不同配色方案例如["#FA7D8D", "#EB88E2"]
- uCharts.js 雷达图优化支持series.textColor、series.textSize属性
- uCharts.js 柱状图中温度计式图标优化支持全圆角类型修复边框有缝隙的bug详见官网【演示】中的温度计图表
- uCharts.js 柱状图新增参数opts.extra.column.activeWidth当前点击柱状图的背景宽度默认一个单元格单位
- uCharts.js 混合图增加opts.extra.mix.area.gradient 区域图是否开启渐变色
- uCharts.js 混合图增加opts.extra.mix.area.opacity 区域图透明度默认0.2
- uCharts.js 饼图、圆环图、玫瑰图、漏斗图增加opts.series[0].data[i].labelText自定义标签文字避免formatter格式化的繁琐详见官网【演示】中的饼图
- uCharts.js 饼图、圆环图、玫瑰图、漏斗图增加opts.series[0].data[i].labelShow自定义是否显示某一个指示标签避免因饼图类别太多导致标签重复或者居多导致图形变形的问题详见官网【演示】中的饼图
- uCharts.js 增加opts.series[i].legendText/opts.series[0].data[i].legendText与series.name同级自定义图例显示文字的方法
- uCharts.js 优化X轴、Y轴formatter格式化方法增加形参统一为fromatter:function(value,index,opts){}
- uCharts.js 修复横屏模式下无法使用双指缩放方法的bug
- uCharts.js 修复当只有一条数据或者多条数据值相等的时候Y轴自动计算的最大值错误的bug
- 【官网模板】增加外部自定义图例与图表交互的例子,[点击跳转](https://www.ucharts.cn/v2/#/layout/info?id=2)
## 注意非unimodules 版本如因更新 hbx 至 3.4.7 导致报错如下,请到码云更新非 unimodules 版本组件,[点击跳转](https://gitee.com/uCharts/uCharts/tree/master/uni-app/uCharts-%E7%BB%84%E4%BB%B6)
> Error in callback for immediate watcher "uchartsOpts": "SyntaxError: Unexpected token u in JSON at position 0"
## 2.4.2-202204212022-04-21
- 秋云图表组件 修复HBX升级3.4.6.20220420版本后echarts报错的问题
## 2.4.2-202204202022-04-20
## 重要此版本uCharts新增了很多功能修复了诸多已知问题
- 秋云图表组件 新增onzoom开启双指缩放功能仅uCharts前提需要直角坐标系类图表类型并且ontouch为true、opts.enableScroll为true详见实例项目K线图
- 秋云图表组件 新增optsWatch是否监听opts变化关闭optsWatch后动态修改opts不会触发图表重绘
- 秋云图表组件 修复开启canvas2d功能后动态更新数据后画布闪动的bug
- 秋云图表组件 去除directory属性改为自动获取echarts.min.js路径升级不受影响
- 秋云图表组件 增加getImage()方法及@getImage事件通过ref调用getImage()方法获,触发@getImage事件获取当前画布的base64图片文件流
- 秋云图表组件 支付宝、字节跳动、飞书、快手小程序支持开启canvas2d同层渲染设置。
- 秋云图表组件 新增加【非uniCloud】版本组件避免有些不需要uniCloud的使用组件发布至小程序需要提交隐私声明问题请到码云[【非uniCloud版本】](https://gitee.com/uCharts/uCharts/tree/master/uni-app/uCharts-%E7%BB%84%E4%BB%B6)或npm[【非uniCloud版本】](https://www.npmjs.com/package/@qiun/uni-ucharts)下载使用。
- uCharts.js 新增dobuleZoom双指缩放功能
- uCharts.js 新增山峰图type="mount"数据格式为饼图类格式不需要传入categories具体详见新版官网在线演示
- uCharts.js 修复折线图当数据中存在null时tooltip报错的bug
- uCharts.js 修复饼图类当画布比较小时自动计算的半径是负数报错的bug
- uCharts.js 统一各图表类型的series.formatter格式化方法的形参为(val, index, series, opts),方便格式化时有更多参数可用
- uCharts.js 标记线功能增加labelText自定义显示文字增加labelAlign标签显示位置左侧或右侧增加标签显示位置微调labelOffsetX、labelOffsetY
- uCharts.js 修复条状图当数值很小时开启圆角后样式错误的bug
- uCharts.js 修复X轴开启disabled后X轴仍占用空间的bug
- uCharts.js 修复X轴开启滚动条并且开启rotateLabel后X轴文字与滚动条重叠的bug
- uCharts.js 增加X轴rotateAngle文字旋转自定义角度取值范围(-90至90)
- uCharts.js 修复地图文字标签层级显示不正确的bug
- uCharts.js 修复饼图、圆环图、玫瑰图当数据全部为0的时候不显示数据标签的bug
- uCharts.js 修复当opts.padding上边距为0时Y轴顶部刻度标签位置不正确的bug
## 另外我们还开发了各大原生小程序组件已发布至码云和npm
[https://gitee.com/uCharts/uCharts](https://gitee.com/uCharts/uCharts)
[https://www.npmjs.com/~qiun](https://www.npmjs.com/~qiun)
## 对于原生uCharts文档我们已上线新版官方网站详情点击下面链接进入官网
[https://www.uCharts.cn/v2/](https://www.ucharts.cn/v2/)
## 2.3.7-202201222022-01-22
## 重要使用vue3编译请使用cli模式并升级至最新依赖HbuilderX编译需要使用3.3.8以上版本
- uCharts.js 修复uni-app平台组件模式使用vue3编译到小程序报错的bug。
## 2.3.7-202201182022-01-18
## 注意使用vue3的前提是需要3.3.8.20220114-alpha版本的HBuilder
## 2.3.67-202201182022-01-18
- 秋云图表组件 组件初步支持vue3全端编译会有些问题具体详见下面修改
1. 小程序端运行时在uni_modules文件夹的qiun-data-charts.js中搜索 new uni_modules_qiunDataCharts_js_sdk_uCharts_uCharts.uCharts将.uCharts去掉。
2. 小程序端发行时在uni_modules文件夹的qiun-data-charts.js中搜索 new e.uCharts将.uCharts去掉变为 new e。
3. 如果觉得上述步骤比较麻烦如果您的项目只编译到小程序端可以修改u-charts.js最后一行导出方式将 export default uCharts;变更为 export default { uCharts: uCharts }; 这样变更后H5和App端的renderjs会有问题请开发者自行选择。此问题非组件问题请等待DC官方修复Vue3的小程序端
## 2.3.6-202201112022-01-11
- 秋云图表组件 修改组件 props 属性中的 background 默认值为 rgba(0,0,0,0)
## 2.3.6-202112012021-12-01
- uCharts.js 修复bar条状图开启圆角模式时值很小时圆角渲染错误的bug
## 2.3.5-202110142021-10-15
- uCharts.js 增加vue3的编译支持仅原生uChartsqiun-data-charts组件后续会支持请关注更新
## 2.3.4-202110122021-10-12
- 秋云图表组件 修复 mac os x 系统 mouseover 事件丢失的 bug
## 2.3.3-202107062021-07-06
- uCharts.js 增加雷达图开启数据点值opts.dataLabel的显示
## 2.3.2-202106272021-06-27
- 秋云图表组件 修复tooltipCustom个别情况下传值不正确报错TypeError: Cannot read property 'name' of undefined的bug
## 2.3.1-202106162021-06-16
- uCharts.js 修复圆角柱状图使用4角圆角时当数值过大时不正确的bug
## 2.3.0-202106122021-06-12
- uCharts.js 【重要】uCharts增加nvue兼容可在nvue项目中使用gcanvas组件渲染uCharts[详见码云uCharts-demo-nvue](https://gitee.com/uCharts/uCharts)
- 秋云图表组件 增加tapLegend属性是否开启图例点击交互事件
- 秋云图表组件 getIndex事件中增加返回uCharts实例中的opts参数以便在页面中调用参数
- 示例项目 pages/other/other.vue增加app端自定义tooltip的方法详见showOptsTooltip方法
## 2.2.1-202106032021-06-03
- uCharts.js 修复饼图、圆环图、玫瑰图当起始角度不为0时tooltip位置不准确的bug
- uCharts.js 增加温度计式柱状图开启顶部半圆形的配置
## 2.2.0-202105292021-05-29
- uCharts.js 增加条状图type="bar"
- 示例项目 pages/ucharts/ucharts.vue增加条状图的demo
## 2.1.7-202105242021-05-24
- uCharts.js 修复大数据量模式下曲线图不平滑的bug
## 2.1.6-202105232021-05-23
- 秋云图表组件 修复小程序端开启滚动条更新数据后滚动条位置不符合预期的bug
## 2.1.5-20210517022021-05-17
- uCharts.js 修复自定义Y轴min和max值为0时不能正确显示的bug
## 2.1.5-202105172021-05-17
- uCharts.js 修复Y轴自定义min和max时未按指定的最大值最小值显示坐标轴刻度的bug
## 2.1.4-202105162021-05-16
- 秋云图表组件 优化onWindowResize防抖方法
- 秋云图表组件 修复APP端uCharts更新数据时清空series显示loading图标后再显示图表图表抖动的bug
- uCharts.js 修复开启canvas2d后x轴、y轴、series自定义字体大小未按比例缩放的bug
- 示例项目 修复format-e.vue拼写错误导致app端使用uCharts渲染图表
## 2.1.3-202105132021-05-13
- 秋云图表组件 修改uCharts变更chartData数据为updateData方法支持带滚动条的数据动态打点
- 秋云图表组件 增加onWindowResize防抖方法 fix by ど誓言,如尘般染指流年づ
- 秋云图表组件 H5或者APP变更chartData数据显示loading图表时原数据闪现的bug
- 秋云图表组件 props增加errorReload禁用错误点击重新加载的方法
- uCharts.js 增加tooltip显示categoryx轴对应点位标题的功能opts.extra.tooltip.showCategory默认为false
- uCharts.js 修复mix混合图只有柱状图时tooltip的分割线显示位置不正确的bug
- uCharts.js 修复开启滚动条图表在拖动中动态打点滚动条位置不正确的bug
- uCharts.js 修复饼图类数据格式为echarts数据格式series为空数组报错的bug
- 示例项目 修改uCharts.js更新到v2.1.2版本后,@getIndex方法获取索引值变更为e.currentIndex.index
- 示例项目 pages/updata/updata.vue增加滚动条拖动更新数据动态打点的demo
- 示例项目 pages/other/other.vue增加errorReload禁用错误点击重新加载的demo
## 2.1.2-202105092021-05-09
秋云图表组件 修复APP端初始化时就传入chartData或lacaldata不显示图表的bug
## 2.1.1-202105092021-05-09
- 秋云图表组件 变更ECharts的eopts配置在renderjs内执行支持在config-echarts.js配置文件内写function配置。
- 秋云图表组件 修复APP端报错Prop being mutated: "onmouse"错误的bug。
- 秋云图表组件 修复APP端报错Error: Not FoundPage[6][-1,27] at view.umd.min.js:1的bug。
## 2.1.0-202105072021-05-07
- 秋云图表组件 修复初始化时就有数据或者数据更新的时候loading加载动画闪动的bug
- uCharts.js 修复x轴format方法categories为字符串类型时返回NaN的bug
- uCharts.js 修复series.textColor、legend.fontColor未执行全局默认颜色的bug
## 2.1.0-202105062021-05-06
- 秋云图表组件 修复极个别情况下报错item.properties undefined的bug
- 秋云图表组件 修复极个别情况下关闭加载动画reshow不起作用无法显示图表的bug
- 示例项目 pages/ucharts/ucharts.vue 增加时间轴折线图type="tline"、时间轴区域图type="tarea"、散点图type="scatter"、气泡图demotype="bubble"、倒三角形漏斗图opts.extra.funnel.type="triangle"、金字塔形漏斗图opts.extra.funnel.type="pyramid"
- 示例项目 pages/format-u/format-u.vue 增加X轴format格式化示例
- uCharts.js 升级至v2.1.0版本
- uCharts.js 修复 玫瑰图面积模式点击tooltip位置不正确的bug
- uCharts.js 修复 玫瑰图点击图例只剩一个类别显示空白的bug
- uCharts.js 修复 饼图类图点击图例其他图表tooltip位置某些情况下不准的bug
- uCharts.js 修复 x轴为矢量轴时间轴情况下点击tooltip位置不正确的bug
- uCharts.js 修复 词云图获取点击索引偶尔不准的bug
- uCharts.js 增加 直角坐标系图表X轴format格式化方法原生uCharts.js用法请使用formatter
- uCharts.js 增加 漏斗图扩展配置倒三角形opts.extra.funnel.type="triangle"金字塔形opts.extra.funnel.type="pyramid"
- uCharts.js 增加 散点图opts.type="scatter"、气泡图opts.type="bubble"
- 后期计划 完善散点图、气泡图增加markPoints标记点增加横向条状图。
## 2.0.0-202105022021-05-02
- uCharts.js 修复词云图获取点击索引不正确的bug
## 2.0.0-202105012021-05-01
- 秋云图表组件 修复QQ小程序、百度小程序在关闭动画效果情况下v-for循环使用图表显示不正确的bug
## 2.0.0-202104262021-04-26
- 秋云图表组件 修复QQ小程序不支持canvas2d的bug
- 秋云图表组件 修复钉钉小程序某些情况点击坐标计算错误的bug
- uCharts.js 增加 extra.column.categoryGap 参数柱状图类每个category点位X轴点柱子组之间的间距
- uCharts.js 增加 yAxis.data[i].titleOffsetY 参数,标题纵向偏移距离,负数为向上偏移,正数向下偏移
- uCharts.js 增加 yAxis.data[i].titleOffsetX 参数,标题横向偏移距离,负数为向左偏移,正数向右偏移
- uCharts.js 增加 extra.gauge.labelOffset 参数仪表盘标签文字径向便宜距离默认13px
## 2.0.0-20210422-22021-04-22
秋云图表组件 修复 formatterAssign 未判断 args[key] == null 的情况导致栈溢出的 bug
## 2.0.0-202104222021-04-22
- 秋云图表组件 修复H5、APP、支付宝小程序、微信小程序canvas2d模式下横屏模式的bug
## 2.0.0-202104212021-04-21
- uCharts.js 修复多行图例的情况下图例在上方或者下方时图例float为左侧或者右侧时第二行及以后的图例对齐方式不正确的bug
## 2.0.0-202104202021-04-20
- 秋云图表组件 修复微信小程序开启canvas2d模式后windows版微信小程序不支持canvas2d模式的bug
- 秋云图表组件 修改非uni_modules版本为v2.0版本qiun-data-charts组件
## 2.0.0-202104192021-04-19
## v1.0版本已停更建议转uni_modules版本组件方式调用点击右侧绿色【使用HBuilderX导入插件】即可使用示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。
## 初次使用如果提示未注册&lt;qiun-data-charts&gt;组件请重启HBuilderX如仍不好用请重启电脑
## 如果是cli项目请尝试清理node_modules重新install还不行就删除项目再重新install。
## 此问题已于DCloud官方确认HBuilderX下个版本会修复。
## 其他图表不显示问题详见[常见问题选项卡](https://demo.ucharts.cn)
## <font color=#FF0000> 新手请先完整阅读帮助文档及常见问题3遍右侧蓝色按钮示例项目请看2遍 </font>
## [DEMO演示及在线生成工具v2.0文档https://demo.ucharts.cn](https://demo.ucharts.cn)
## [图表组件在项目中的应用参见 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651)
- uCharts.js 修复混合图中柱状图单独设置颜色不生效的bug
- uCharts.js 修复多Y轴单独设置fontSize时开启canvas2d后未对应放大字体的bug
## 2.0.0-202104182021-04-18
- 秋云图表组件 增加directory配置修复H5端history模式下如果发布到二级目录无法正确加载echarts.min.js的bug
## 2.0.0-202104162021-04-16
## v1.0版本已停更建议转uni_modules版本组件方式调用点击右侧绿色【使用HBuilderX导入插件】即可使用示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。
## 初次使用如果提示未注册&lt;qiun-data-charts&gt;组件请重启HBuilderX如仍不好用请重启电脑
## 如果是cli项目请尝试清理node_modules重新install还不行就删除项目再重新install。
## 此问题已于DCloud官方确认HBuilderX下个版本会修复。
## 其他图表不显示问题详见[常见问题选项卡](https://demo.ucharts.cn)
## <font color=#FF0000> 新手请先完整阅读帮助文档及常见问题3遍右侧蓝色按钮示例项目请看2遍 </font>
## [DEMO演示及在线生成工具v2.0文档https://demo.ucharts.cn](https://demo.ucharts.cn)
## [图表组件在项目中的应用参见 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651)
- 秋云图表组件 修复APP端某些情况下报错`Not Found Page`的bugfix by 高级bug开发技术员
- 示例项目 修复APP端v-for循环某些情况下报错`Not Found Page`的bugfix by 高级bug开发技术员
- uCharts.js 修复非直角坐标系tooltip提示窗右侧超出未变换方向显示的bug
## 2.0.0-202104152021-04-15
- 秋云图表组件 修复H5端发布到二级目录下echarts无法加载的bug
- 秋云图表组件 修复某些情况下echarts.off('finished')移除监听事件报错的bug
## 2.0.0-202104142021-04-14
## v1.0版本已停更建议转uni_modules版本组件方式调用点击右侧绿色【使用HBuilderX导入插件】即可使用示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。
## 初次使用如果提示未注册&lt;qiun-data-charts&gt;组件请重启HBuilderX如仍不好用请重启电脑
## 如果是cli项目请尝试清理node_modules重新install还不行就删除项目再重新install。
## 此问题已于DCloud官方确认HBuilderX下个版本会修复。
## 其他图表不显示问题详见[常见问题选项卡](https://demo.ucharts.cn)
## <font color=#FF0000> 新手请先完整阅读帮助文档及常见问题3遍右侧蓝色按钮示例项目请看2遍 </font>
## [DEMO演示及在线生成工具v2.0文档https://demo.ucharts.cn](https://demo.ucharts.cn)
## [图表组件在项目中的应用参见 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651)
- 秋云图表组件 修复H5端在cli项目下ECharts引用地址错误的bug
- 示例项目 增加ECharts的formatter用法的示例(详见示例项目format-e.vue)
- uCharts.js 增加圆环图中心背景色的配置extra.ring.centerColor
- uCharts.js 修复微信小程序安卓端柱状图开启透明色后显示不正确的bug
## 2.0.0-202104132021-04-13
- 秋云图表组件 修复百度小程序多个图表真机未能正确获取根元素dom尺寸的bug
- 秋云图表组件 修复百度小程序横屏模式方向不正确的bug
- 秋云图表组件 修改ontouch时@getTouchStart@getTouchMove@getTouchEnd的触发条件
- uCharts.js 修复饼图类数据格式series属性不生效的bug
- uCharts.js 增加时序区域图 详见示例项目中ucharts.vue
## 2.0.0-20210412-22021-04-12
## v1.0版本已停更建议转uni_modules版本组件方式调用点击右侧绿色【使用HBuilderX导入插件】即可使用示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。
## 初次使用如果提示未注册&lt;qiun-data-charts&gt;组件请重启HBuilderX。如仍不好用请重启电脑此问题已于DCloud官方确认HBuilderX下个版本会修复。
## [DEMO演示及在线生成工具v2.0文档https://demo.ucharts.cn](https://demo.ucharts.cn)
## [图表组件在uniCloudAdmin中的应用 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651)
- 秋云图表组件 修复uCharts在APP端横屏模式下不能正确渲染的bug
- 示例项目 增加ECharts柱状图渐变色、圆角柱状图、横向柱状图条状图的示例
## 2.0.0-202104122021-04-12
- 秋云图表组件 修复created中判断echarts导致APP端无法识别改回mounted中判断echarts初始化
- uCharts.js 修复2d模式下series.textOffset未乘像素比的bug
## 2.0.0-202104112021-04-11
## v1.0版本已停更建议转uni_modules版本组件方式调用点击右侧绿色【使用HBuilderX导入插件】即可使用示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。
## 初次使用如果提示未注册<qiun-data-charts>组件请重启HBuilderX并清空小程序开发者工具缓存。
## [DEMO演示及在线生成工具v2.0文档https://demo.ucharts.cn](https://demo.ucharts.cn)
## [图表组件在uniCloudAdmin中的应用 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651)
- uCharts.js 折线图区域图增加connectNulls断点续连的功能详见示例项目中ucharts.vue
- 秋云图表组件 变更初始化方法为created变更type2d默认值为true优化2d模式下组件初始化后dom获取不到的bug
- 秋云图表组件 修复左右布局时右侧图表点击坐标错误的bug修复tooltip柱状图自定义颜色显示object的bug
## 2.0.0-202104102021-04-10
- 修复左右布局时右侧图表点击坐标错误的bug修复柱状图自定义颜色tooltip显示object的bug
- 增加标记线及柱状图自定义颜色的demo
## 2.0.0-202104092021-04-08
## v1.0版本已停更建议转uni_modules版本组件方式调用点击右侧【使用HBuilderX导入插件】即可体验DEMO演示及在线生成工具v2.0文档)[https://demo.ucharts.cn](https://demo.ucharts.cn)
## 图表组件在uniCloudAdmin中的应用 [UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651)
- uCharts.js 修复钉钉小程序百度小程序measureText不准确的bug修复2d模式下饼图类activeRadius为按比例放大的bug
- 修复组件在支付宝小程序端点击位置不准确的bug
## 2.0.0-202104082021-04-07
- 修复组件在支付宝小程序端不能显示的bug目前支付宝小程不能点击交互后续修复
- uCharts.js 修复高分屏下柱状图类,圆弧进度条 自定义宽度不能按比例放大的bug
## 2.0.0-202104072021-04-06
## v1.0版本已停更建议转uni_modules版本组件方式调用点击右侧【使用HBuilderX导入插件】即可体验DEMO演示及在线生成工具v2.0文档)[https://demo.ucharts.cn](https://demo.ucharts.cn)
## 增加 通过tofix和unit快速格式化y轴的demo add by `howcode`
## 增加 图表组件在uniCloudAdmin中的应用 [UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651)
## 2.0.0-202104062021-04-05
# 秋云图表组件+uCharts v2.0版本同步上线使用方法详见https://demo.ucharts.cn帮助页
## 2.0.02021-04-05
# 秋云图表组件+uCharts v2.0版本同步上线使用方法详见https://demo.ucharts.cn帮助页

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,162 @@
<template>
<view class="container loading1">
<view class="shape shape1"></view>
<view class="shape shape2"></view>
<view class="shape shape3"></view>
<view class="shape shape4"></view>
</view>
</template>
<script>
export default {
name: 'loading1',
data() {
return {
};
}
}
</script>
<style scoped="true">
.container {
width: 30px;
height: 30px;
position: relative;
}
.container.loading1 {
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
.container .shape {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1 {
left: 0;
background-color: #1890FF;
}
.container .shape.shape2 {
right: 0;
background-color: #91CB74;
}
.container .shape.shape3 {
bottom: 0;
background-color: #FAC858;
}
.container .shape.shape4 {
bottom: 0;
right: 0;
background-color: #EE6666;
}
.loading1 .shape1 {
-webkit-animation: animation1shape1 0.5s ease 0s infinite alternate;
animation: animation1shape1 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation1shape1 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(16px, 16px);
transform: translate(16px, 16px);
}
}
@keyframes animation1shape1 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(16px, 16px);
transform: translate(16px, 16px);
}
}
.loading1 .shape2 {
-webkit-animation: animation1shape2 0.5s ease 0s infinite alternate;
animation: animation1shape2 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation1shape2 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-16px, 16px);
transform: translate(-16px, 16px);
}
}
@keyframes animation1shape2 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-16px, 16px);
transform: translate(-16px, 16px);
}
}
.loading1 .shape3 {
-webkit-animation: animation1shape3 0.5s ease 0s infinite alternate;
animation: animation1shape3 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation1shape3 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(16px, -16px);
transform: translate(16px, -16px);
}
}
@keyframes animation1shape3 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(16px, -16px);
transform: translate(16px, -16px);
}
}
.loading1 .shape4 {
-webkit-animation: animation1shape4 0.5s ease 0s infinite alternate;
animation: animation1shape4 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation1shape4 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-16px, -16px);
transform: translate(-16px, -16px);
}
}
@keyframes animation1shape4 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-16px, -16px);
transform: translate(-16px, -16px);
}
}
</style>

View File

@@ -0,0 +1,170 @@
<template>
<view class="container loading2">
<view class="shape shape1"></view>
<view class="shape shape2"></view>
<view class="shape shape3"></view>
<view class="shape shape4"></view>
</view>
</template>
<script>
export default {
name: 'loading2',
data() {
return {
};
}
}
</script>
<style scoped="true">
.container {
width: 30px;
height: 30px;
position: relative;
}
.container.loading2 {
-webkit-transform: rotate(10deg);
transform: rotate(10deg);
}
.container.loading2 .shape {
border-radius: 5px;
}
.container.loading2{
-webkit-animation: rotation 1s infinite;
animation: rotation 1s infinite;
}
.container .shape {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1 {
left: 0;
background-color: #1890FF;
}
.container .shape.shape2 {
right: 0;
background-color: #91CB74;
}
.container .shape.shape3 {
bottom: 0;
background-color: #FAC858;
}
.container .shape.shape4 {
bottom: 0;
right: 0;
background-color: #EE6666;
}
.loading2 .shape1 {
-webkit-animation: animation2shape1 0.5s ease 0s infinite alternate;
animation: animation2shape1 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation2shape1 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(20px, 20px);
transform: translate(20px, 20px);
}
}
@keyframes animation2shape1 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(20px, 20px);
transform: translate(20px, 20px);
}
}
.loading2 .shape2 {
-webkit-animation: animation2shape2 0.5s ease 0s infinite alternate;
animation: animation2shape2 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation2shape2 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-20px, 20px);
transform: translate(-20px, 20px);
}
}
@keyframes animation2shape2 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-20px, 20px);
transform: translate(-20px, 20px);
}
}
.loading2 .shape3 {
-webkit-animation: animation2shape3 0.5s ease 0s infinite alternate;
animation: animation2shape3 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation2shape3 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(20px, -20px);
transform: translate(20px, -20px);
}
}
@keyframes animation2shape3 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(20px, -20px);
transform: translate(20px, -20px);
}
}
.loading2 .shape4 {
-webkit-animation: animation2shape4 0.5s ease 0s infinite alternate;
animation: animation2shape4 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation2shape4 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-20px, -20px);
transform: translate(-20px, -20px);
}
}
@keyframes animation2shape4 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-20px, -20px);
transform: translate(-20px, -20px);
}
}
</style>

View File

@@ -0,0 +1,173 @@
<template>
<view class="container loading3">
<view class="shape shape1"></view>
<view class="shape shape2"></view>
<view class="shape shape3"></view>
<view class="shape shape4"></view>
</view>
</template>
<script>
export default {
name: 'loading3',
data() {
return {
};
}
}
</script>
<style scoped="true">
.container {
width: 30px;
height: 30px;
position: relative;
}
.container.loading3 {
-webkit-animation: rotation 1s infinite;
animation: rotation 1s infinite;
}
.container.loading3 .shape1 {
border-top-left-radius: 10px;
}
.container.loading3 .shape2 {
border-top-right-radius: 10px;
}
.container.loading3 .shape3 {
border-bottom-left-radius: 10px;
}
.container.loading3 .shape4 {
border-bottom-right-radius: 10px;
}
.container .shape {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1 {
left: 0;
background-color: #1890FF;
}
.container .shape.shape2 {
right: 0;
background-color: #91CB74;
}
.container .shape.shape3 {
bottom: 0;
background-color: #FAC858;
}
.container .shape.shape4 {
bottom: 0;
right: 0;
background-color: #EE6666;
}
.loading3 .shape1 {
-webkit-animation: animation3shape1 0.5s ease 0s infinite alternate;
animation: animation3shape1 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation3shape1 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(5px, 5px);
transform: translate(5px, 5px);
}
}
@keyframes animation3shape1 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(5px, 5px);
transform: translate(5px, 5px);
}
}
.loading3 .shape2 {
-webkit-animation: animation3shape2 0.5s ease 0s infinite alternate;
animation: animation3shape2 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation3shape2 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-5px, 5px);
transform: translate(-5px, 5px);
}
}
@keyframes animation3shape2 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-5px, 5px);
transform: translate(-5px, 5px);
}
}
.loading3 .shape3 {
-webkit-animation: animation3shape3 0.5s ease 0s infinite alternate;
animation: animation3shape3 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation3shape3 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(5px, -5px);
transform: translate(5px, -5px);
}
}
@keyframes animation3shape3 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(5px, -5px);
transform: translate(5px, -5px);
}
}
.loading3 .shape4 {
-webkit-animation: animation3shape4 0.5s ease 0s infinite alternate;
animation: animation3shape4 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation3shape4 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-5px, -5px);
transform: translate(-5px, -5px);
}
}
@keyframes animation3shape4 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-5px, -5px);
transform: translate(-5px, -5px);
}
}
</style>

View File

@@ -0,0 +1,222 @@
<template>
<view class="container loading5">
<view class="shape shape1"></view>
<view class="shape shape2"></view>
<view class="shape shape3"></view>
<view class="shape shape4"></view>
</view>
</template>
<script>
export default {
name: 'loading5',
data() {
return {
};
}
}
</script>
<style scoped="true">
.container {
width: 30px;
height: 30px;
position: relative;
}
.container.loading5 .shape {
width: 15px;
height: 15px;
}
.container .shape {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1 {
left: 0;
background-color: #1890FF;
}
.container .shape.shape2 {
right: 0;
background-color: #91CB74;
}
.container .shape.shape3 {
bottom: 0;
background-color: #FAC858;
}
.container .shape.shape4 {
bottom: 0;
right: 0;
background-color: #EE6666;
}
.loading5 .shape1 {
animation: animation5shape1 2s ease 0s infinite reverse;
}
@-webkit-keyframes animation5shape1 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, 15px);
transform: translate(0, 15px);
}
50% {
-webkit-transform: translate(15px, 15px);
transform: translate(15px, 15px);
}
75% {
-webkit-transform: translate(15px, 0);
transform: translate(15px, 0);
}
}
@keyframes animation5shape1 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, 15px);
transform: translate(0, 15px);
}
50% {
-webkit-transform: translate(15px, 15px);
transform: translate(15px, 15px);
}
75% {
-webkit-transform: translate(15px, 0);
transform: translate(15px, 0);
}
}
.loading5 .shape2 {
animation: animation5shape2 2s ease 0s infinite reverse;
}
@-webkit-keyframes animation5shape2 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(-15px, 0);
transform: translate(-15px, 0);
}
50% {
-webkit-transform: translate(-15px, 15px);
transform: translate(-15px, 15px);
}
75% {
-webkit-transform: translate(0, 15px);
transform: translate(0, 15px);
}
}
@keyframes animation5shape2 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(-15px, 0);
transform: translate(-15px, 0);
}
50% {
-webkit-transform: translate(-15px, 15px);
transform: translate(-15px, 15px);
}
75% {
-webkit-transform: translate(0, 15px);
transform: translate(0, 15px);
}
}
.loading5 .shape3 {
animation: animation5shape3 2s ease 0s infinite reverse;
}
@-webkit-keyframes animation5shape3 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(15px, 0);
transform: translate(15px, 0);
}
50% {
-webkit-transform: translate(15px, -15px);
transform: translate(15px, -15px);
}
75% {
-webkit-transform: translate(0, -15px);
transform: translate(0, -15px);
}
}
@keyframes animation5shape3 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(15px, 0);
transform: translate(15px, 0);
}
50% {
-webkit-transform: translate(15px, -15px);
transform: translate(15px, -15px);
}
75% {
-webkit-transform: translate(0, -15px);
transform: translate(0, -15px);
}
}
.loading5 .shape4 {
animation: animation5shape4 2s ease 0s infinite reverse;
}
@-webkit-keyframes animation5shape4 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, -15px);
transform: translate(0, -15px);
}
50% {
-webkit-transform: translate(-15px, -15px);
transform: translate(-15px, -15px);
}
75% {
-webkit-transform: translate(-15px, 0);
transform: translate(-15px, 0);
}
}
@keyframes animation5shape4 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, -15px);
transform: translate(0, -15px);
}
50% {
-webkit-transform: translate(-15px, -15px);
transform: translate(-15px, -15px);
}
75% {
-webkit-transform: translate(-15px, 0);
transform: translate(-15px, 0);
}
}
</style>

View File

@@ -0,0 +1,229 @@
<template>
<view class="container loading6">
<view class="shape shape1"></view>
<view class="shape shape2"></view>
<view class="shape shape3"></view>
<view class="shape shape4"></view>
</view>
</template>
<script>
export default {
name: 'loading6',
data() {
return {
};
}
}
</script>
<style scoped="true">
.container {
width: 30px;
height: 30px;
position: relative;
}
.container.loading6 {
-webkit-animation: rotation 1s infinite;
animation: rotation 1s infinite;
}
.container.loading6 .shape {
width: 12px;
height: 12px;
border-radius: 2px;
}
.container .shape {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1 {
left: 0;
background-color: #1890FF;
}
.container .shape.shape2 {
right: 0;
background-color: #91CB74;
}
.container .shape.shape3 {
bottom: 0;
background-color: #FAC858;
}
.container .shape.shape4 {
bottom: 0;
right: 0;
background-color: #EE6666;
}
.loading6 .shape1 {
-webkit-animation: animation6shape1 2s linear 0s infinite normal;
animation: animation6shape1 2s linear 0s infinite normal;
}
@-webkit-keyframes animation6shape1 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, 18px);
transform: translate(0, 18px);
}
50% {
-webkit-transform: translate(18px, 18px);
transform: translate(18px, 18px);
}
75% {
-webkit-transform: translate(18px, 0);
transform: translate(18px, 0);
}
}
@keyframes animation6shape1 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, 18px);
transform: translate(0, 18px);
}
50% {
-webkit-transform: translate(18px, 18px);
transform: translate(18px, 18px);
}
75% {
-webkit-transform: translate(18px, 0);
transform: translate(18px, 0);
}
}
.loading6 .shape2 {
-webkit-animation: animation6shape2 2s linear 0s infinite normal;
animation: animation6shape2 2s linear 0s infinite normal;
}
@-webkit-keyframes animation6shape2 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(-18px, 0);
transform: translate(-18px, 0);
}
50% {
-webkit-transform: translate(-18px, 18px);
transform: translate(-18px, 18px);
}
75% {
-webkit-transform: translate(0, 18px);
transform: translate(0, 18px);
}
}
@keyframes animation6shape2 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(-18px, 0);
transform: translate(-18px, 0);
}
50% {
-webkit-transform: translate(-18px, 18px);
transform: translate(-18px, 18px);
}
75% {
-webkit-transform: translate(0, 18px);
transform: translate(0, 18px);
}
}
.loading6 .shape3 {
-webkit-animation: animation6shape3 2s linear 0s infinite normal;
animation: animation6shape3 2s linear 0s infinite normal;
}
@-webkit-keyframes animation6shape3 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(18px, 0);
transform: translate(18px, 0);
}
50% {
-webkit-transform: translate(18px, -18px);
transform: translate(18px, -18px);
}
75% {
-webkit-transform: translate(0, -18px);
transform: translate(0, -18px);
}
}
@keyframes animation6shape3 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(18px, 0);
transform: translate(18px, 0);
}
50% {
-webkit-transform: translate(18px, -18px);
transform: translate(18px, -18px);
}
75% {
-webkit-transform: translate(0, -18px);
transform: translate(0, -18px);
}
}
.loading6 .shape4 {
-webkit-animation: animation6shape4 2s linear 0s infinite normal;
animation: animation6shape4 2s linear 0s infinite normal;
}
@-webkit-keyframes animation6shape4 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, -18px);
transform: translate(0, -18px);
}
50% {
-webkit-transform: translate(-18px, -18px);
transform: translate(-18px, -18px);
}
75% {
-webkit-transform: translate(-18px, 0);
transform: translate(-18px, 0);
}
}
@keyframes animation6shape4 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, -18px);
transform: translate(0, -18px);
}
50% {
-webkit-transform: translate(-18px, -18px);
transform: translate(-18px, -18px);
}
75% {
-webkit-transform: translate(-18px, 0);
transform: translate(-18px, 0);
}
}
</style>

View File

@@ -0,0 +1,36 @@
<template>
<view>
<Loading1 v-if="loadingType==1"/>
<Loading2 v-if="loadingType==2"/>
<Loading3 v-if="loadingType==3"/>
<Loading4 v-if="loadingType==4"/>
<Loading5 v-if="loadingType==5"/>
</view>
</template>
<script>
import Loading1 from "./loading1.vue";
import Loading2 from "./loading2.vue";
import Loading3 from "./loading3.vue";
import Loading4 from "./loading4.vue";
import Loading5 from "./loading5.vue";
export default {
components:{Loading1,Loading2,Loading3,Loading4,Loading5},
name: 'qiun-loading',
props: {
loadingType: {
type: Number,
default: 2
},
},
data() {
return {
};
},
}
</script>
<style>
</style>

View File

@@ -0,0 +1,422 @@
/*
* uCharts®
* 高性能跨平台图表库支持H5、APP、小程序微信/支付宝/百度/头条/QQ/360、Vue、Taro等支持canvas的框架平台
* Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved.
* Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
* 复制使用请保留本段注释,感谢支持开源!
*
* uCharts®官方网站
* https://www.uCharts.cn
*
* 开源地址:
* https://gitee.com/uCharts/uCharts
*
* uni-app插件市场地址
* http://ext.dcloud.net.cn/plugin?id=271
*
*/
// 通用配置项
// 主题颜色配置如每个图表类型需要不同主题请在对应图表类型上更改color属性
const color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'];
const cfe = {
//demotype为自定义图表类型
"type": ["pie", "ring", "rose", "funnel", "line", "column", "area", "radar", "gauge","candle","demotype"],
//增加自定义图表类型如果需要categories请在这里加入您的图表类型例如最后的"demotype"
"categories": ["line", "column", "area", "radar", "gauge", "candle","demotype"],
//instance为实例变量承载属性option为eopts承载属性不要删除
"instance": {},
"option": {},
//下面是自定义format配置因除H5端外的其他端无法通过props传递函数只能通过此属性对应下标的方式来替换
"formatter":{
"tooltipDemo1":function(res){
let result = ''
for (let i in res) {
if (i == 0) {
result += res[i].axisValueLabel + '年销售额'
}
let value = '--'
if (res[i].data !== null) {
value = res[i].data
}
// #ifdef H5
result += '\n' + res[i].seriesName + '' + value + ' 万元'
// #endif
// #ifdef APP-PLUS
result += '<br/>' + res[i].marker + res[i].seriesName + '' + value + ' 万元'
// #endif
}
return result;
},
legendFormat:function(name){
return "自定义图例+"+name;
},
yAxisFormatDemo:function (value, index) {
return value + '元';
},
seriesFormatDemo:function(res){
return res.name + '年' + res.value + '元';
}
},
//这里演示了自定义您的图表类型的option可以随意命名之后在组件上 type="demotype" 后组件会调用这个花括号里的option如果组件上还存在eopts参数会将demotype与eopts中option合并后渲染图表。
"demotype":{
"color": color,
//在这里填写echarts的option即可
},
//下面是自定义配置,请添加项目所需的通用配置
"column": {
"color": color,
"title": {
"text": ''
},
"tooltip": {
"trigger": 'axis'
},
"grid": {
"top": 30,
"bottom": 50,
"right": 15,
"left": 40
},
"legend": {
"bottom": 'left',
},
"toolbox": {
"show": false,
},
"xAxis": {
"type": 'category',
"axisLabel": {
"color": '#666666'
},
"axisLine": {
"lineStyle": {
"color": '#CCCCCC'
}
},
"boundaryGap": true,
"data": []
},
"yAxis": {
"type": 'value',
"axisTick": {
"show": false,
},
"axisLabel": {
"color": '#666666'
},
"axisLine": {
"lineStyle": {
"color": '#CCCCCC'
}
},
},
"seriesTemplate": {
"name": '',
"type": 'bar',
"data": [],
"barwidth": 20,
"label": {
"show": true,
"color": "#666666",
"position": 'top',
},
},
},
"line": {
"color": color,
"title": {
"text": ''
},
"tooltip": {
"trigger": 'axis'
},
"grid": {
"top": 30,
"bottom": 50,
"right": 15,
"left": 40
},
"legend": {
"bottom": 'left',
},
"toolbox": {
"show": false,
},
"xAxis": {
"type": 'category',
"axisLabel": {
"color": '#666666'
},
"axisLine": {
"lineStyle": {
"color": '#CCCCCC'
}
},
"boundaryGap": true,
"data": []
},
"yAxis": {
"type": 'value',
"axisTick": {
"show": false,
},
"axisLabel": {
"color": '#666666'
},
"axisLine": {
"lineStyle": {
"color": '#CCCCCC'
}
},
},
"seriesTemplate": {
"name": '',
"type": 'line',
"data": [],
"barwidth": 20,
"label": {
"show": true,
"color": "#666666",
"position": 'top',
},
},
},
"area": {
"color": color,
"title": {
"text": ''
},
"tooltip": {
"trigger": 'axis'
},
"grid": {
"top": 30,
"bottom": 50,
"right": 15,
"left": 40
},
"legend": {
"bottom": 'left',
},
"toolbox": {
"show": false,
},
"xAxis": {
"type": 'category',
"axisLabel": {
"color": '#666666'
},
"axisLine": {
"lineStyle": {
"color": '#CCCCCC'
}
},
"boundaryGap": true,
"data": []
},
"yAxis": {
"type": 'value',
"axisTick": {
"show": false,
},
"axisLabel": {
"color": '#666666'
},
"axisLine": {
"lineStyle": {
"color": '#CCCCCC'
}
},
},
"seriesTemplate": {
"name": '',
"type": 'line',
"data": [],
"areaStyle": {},
"label": {
"show": true,
"color": "#666666",
"position": 'top',
},
},
},
"pie": {
"color": color,
"title": {
"text": ''
},
"tooltip": {
"trigger": 'item'
},
"grid": {
"top": 40,
"bottom": 30,
"right": 15,
"left": 15
},
"legend": {
"bottom": 'left',
},
"seriesTemplate": {
"name": '',
"type": 'pie',
"data": [],
"radius": '50%',
"label": {
"show": true,
"color": "#666666",
"position": 'top',
},
},
},
"ring": {
"color": color,
"title": {
"text": ''
},
"tooltip": {
"trigger": 'item'
},
"grid": {
"top": 40,
"bottom": 30,
"right": 15,
"left": 15
},
"legend": {
"bottom": 'left',
},
"seriesTemplate": {
"name": '',
"type": 'pie',
"data": [],
"radius": ['40%', '70%'],
"avoidLabelOverlap": false,
"label": {
"show": true,
"color": "#666666",
"position": 'top',
},
"labelLine": {
"show": true
},
},
},
"rose": {
"color": color,
"title": {
"text": ''
},
"tooltip": {
"trigger": 'item'
},
"legend": {
"top": 'bottom'
},
"seriesTemplate": {
"name": '',
"type": 'pie',
"data": [],
"radius": "55%",
"center": ['50%', '50%'],
"roseType": 'area',
},
},
"funnel": {
"color": color,
"title": {
"text": ''
},
"tooltip": {
"trigger": 'item',
"formatter": "{b} : {c}%"
},
"legend": {
"top": 'bottom'
},
"seriesTemplate": {
"name": '',
"type": 'funnel',
"left": '10%',
"top": 60,
"bottom": 60,
"width": '80%',
"min": 0,
"max": 100,
"minSize": '0%',
"maxSize": '100%',
"sort": 'descending',
"gap": 2,
"label": {
"show": true,
"position": 'inside'
},
"labelLine": {
"length": 10,
"lineStyle": {
"width": 1,
"type": 'solid'
}
},
"itemStyle": {
"bordercolor": '#fff',
"borderwidth": 1
},
"emphasis": {
"label": {
"fontSize": 20
}
},
"data": [],
},
},
"gauge": {
"color": color,
"tooltip": {
"formatter": '{a} <br/>{b} : {c}%'
},
"seriesTemplate": {
"name": '业务指标',
"type": 'gauge',
"detail": {"formatter": '{value}%'},
"data": [{"value": 50, "name": '完成率'}]
},
},
"candle": {
"xAxis": {
"data": []
},
"yAxis": {},
"color": color,
"title": {
"text": ''
},
"dataZoom": [{
"type": 'inside',
"xAxisIndex": [0, 1],
"start": 10,
"end": 100
},
{
"show": true,
"xAxisIndex": [0, 1],
"type": 'slider',
"bottom": 10,
"start": 10,
"end": 100
}
],
"seriesTemplate": {
"name": '',
"type": 'k',
"data": [],
},
}
}
export default cfe;

View File

@@ -0,0 +1,606 @@
/*
* uCharts®
* 高性能跨平台图表库支持H5、APP、小程序微信/支付宝/百度/头条/QQ/360、Vue、Taro等支持canvas的框架平台
* Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved.
* Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
* 复制使用请保留本段注释,感谢支持开源!
*
* uCharts®官方网站
* https://www.uCharts.cn
*
* 开源地址:
* https://gitee.com/uCharts/uCharts
*
* uni-app插件市场地址
* http://ext.dcloud.net.cn/plugin?id=271
*
*/
// 主题颜色配置如每个图表类型需要不同主题请在对应图表类型上更改color属性
const color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'];
//事件转换函数主要用作格式化x轴为时间轴根据需求自行修改
const formatDateTime = (timeStamp, returnType)=>{
var date = new Date();
date.setTime(timeStamp * 1000);
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = m < 10 ? ('0' + m) : m;
var d = date.getDate();
d = d < 10 ? ('0' + d) : d;
var h = date.getHours();
h = h < 10 ? ('0' + h) : h;
var minute = date.getMinutes();
var second = date.getSeconds();
minute = minute < 10 ? ('0' + minute) : minute;
second = second < 10 ? ('0' + second) : second;
if(returnType == 'full'){return y + '-' + m + '-' + d + ' '+ h +':' + minute + ':' + second;}
if(returnType == 'y-m-d'){return y + '-' + m + '-' + d;}
if(returnType == 'h:m'){return h +':' + minute;}
if(returnType == 'h:m:s'){return h +':' + minute +':' + second;}
return [y, m, d, h, minute, second];
}
const cfu = {
//demotype为自定义图表类型一般不需要自定义图表类型只需要改根节点上对应的类型即可
"type":["pie","ring","rose","word","funnel","map","arcbar","line","column","mount","bar","area","radar","gauge","candle","mix","tline","tarea","scatter","bubble","demotype"],
"range":["饼状图","圆环图","玫瑰图","词云图","漏斗图","地图","圆弧进度条","折线图","柱状图","山峰图","条状图","区域图","雷达图","仪表盘","K线图","混合图","时间轴折线","时间轴区域","散点图","气泡图","自定义类型"],
//增加自定义图表类型如果需要categories请在这里加入您的图表类型例如最后的"demotype"
//自定义类型时需要注意"tline","tarea","scatter","bubble"等时间轴矢量x轴类图表没有categories不需要加入categories
"categories":["line","column","mount","bar","area","radar","gauge","candle","mix","demotype"],
//instance为实例变量承载属性不要删除
"instance":{},
//option为opts及eopts承载属性不要删除
"option":{},
//下面是自定义format配置因除H5端外的其他端无法通过props传递函数只能通过此属性对应下标的方式来替换
"formatter":{
"yAxisDemo1":function(val, index, opts){return val+'元'},
"yAxisDemo2":function(val, index, opts){return val.toFixed(2)},
"xAxisDemo1":function(val, index, opts){return val+'年';},
"xAxisDemo2":function(val, index, opts){return formatDateTime(val,'h:m')},
"seriesDemo1":function(val, index, series, opts){return val+'元'},
"tooltipDemo1":function(item, category, index, opts){
if(index==0){
return '随便用'+item.data+'年'
}else{
return '其他我没改'+item.data+'天'
}
},
"pieDemo":function(val, index, series, opts){
if(index !== undefined){
return series[index].name+''+series[index].data+'元'
}
},
},
//这里演示了自定义您的图表类型的option可以随意命名之后在组件上 type="demotype" 后组件会调用这个花括号里的option如果组件上还存在opts参数会将demotype与opts中option合并后渲染图表。
"demotype":{
//我这里把曲线图当做了自定义图表类型,您可以根据需要随意指定类型或配置
"type": "line",
"color": color,
"padding": [15,10,0,15],
"xAxis": {
"disableGrid": true,
},
"yAxis": {
"gridType": "dash",
"dashLength": 2,
},
"legend": {
},
"extra": {
"line": {
"type": "curve",
"width": 2
},
}
},
//下面是自定义配置,请添加项目所需的通用配置
"pie":{
"type": "pie",
"color": color,
"padding": [5,5,5,5],
"extra": {
"pie": {
"activeOpacity": 0.5,
"activeRadius": 10,
"offsetAngle": 0,
"labelWidth": 15,
"border": true,
"borderWidth": 3,
"borderColor": "#FFFFFF"
},
}
},
"ring":{
"type": "ring",
"color": color,
"padding": [5,5,5,5],
"rotate": false,
"dataLabel": true,
"legend": {
"show": true,
"position": "right",
"lineHeight": 25,
},
"title": {
"name": "收益率",
"fontSize": 15,
"color": "#666666"
},
"subtitle": {
"name": "70%",
"fontSize": 25,
"color": "#7cb5ec"
},
"extra": {
"ring": {
"ringWidth":30,
"activeOpacity": 0.5,
"activeRadius": 10,
"offsetAngle": 0,
"labelWidth": 15,
"border": true,
"borderWidth": 3,
"borderColor": "#FFFFFF"
},
},
},
"rose":{
"type": "rose",
"color": color,
"padding": [5,5,5,5],
"legend": {
"show": true,
"position": "left",
"lineHeight": 25,
},
"extra": {
"rose": {
"type": "area",
"minRadius": 50,
"activeOpacity": 0.5,
"activeRadius": 10,
"offsetAngle": 0,
"labelWidth": 15,
"border": false,
"borderWidth": 2,
"borderColor": "#FFFFFF"
},
}
},
"word":{
"type": "word",
"color": color,
"extra": {
"word": {
"type": "normal",
"autoColors": false
}
}
},
"funnel":{
"type": "funnel",
"color": color,
"padding": [15,15,0,15],
"extra": {
"funnel": {
"activeOpacity": 0.3,
"activeWidth": 10,
"border": true,
"borderWidth": 2,
"borderColor": "#FFFFFF",
"fillOpacity": 1,
"labelAlign": "right"
},
}
},
"map":{
"type": "map",
"color": color,
"padding": [0,0,0,0],
"dataLabel": true,
"extra": {
"map": {
"border": true,
"borderWidth": 1,
"borderColor": "#666666",
"fillOpacity": 0.6,
"activeBorderColor": "#F04864",
"activeFillColor": "#FACC14",
"activeFillOpacity": 1
},
}
},
"arcbar":{
"type": "arcbar",
"color": color,
"title": {
"name": "百分比",
"fontSize": 25,
"color": "#00FF00"
},
"subtitle": {
"name": "默认标题",
"fontSize": 15,
"color": "#666666"
},
"extra": {
"arcbar": {
"type": "default",
"width": 12,
"backgroundColor": "#E9E9E9",
"startAngle": 0.75,
"endAngle": 0.25,
"gap": 2
}
}
},
"line":{
"type": "line",
"color": color,
"padding": [15,10,0,15],
"xAxis": {
"disableGrid": true,
},
"yAxis": {
"gridType": "dash",
"dashLength": 2,
},
"legend": {
},
"extra": {
"line": {
"type": "straight",
"width": 2,
"activeType": "hollow"
},
}
},
"tline":{
"type": "line",
"color": color,
"padding": [15,10,0,15],
"xAxis": {
"disableGrid": false,
"boundaryGap":"justify",
},
"yAxis": {
"gridType": "dash",
"dashLength": 2,
"data":[
{
"min":0,
"max":80
}
]
},
"legend": {
},
"extra": {
"line": {
"type": "curve",
"width": 2,
"activeType": "hollow"
},
}
},
"tarea":{
"type": "area",
"color": color,
"padding": [15,10,0,15],
"xAxis": {
"disableGrid": true,
"boundaryGap":"justify",
},
"yAxis": {
"gridType": "dash",
"dashLength": 2,
"data":[
{
"min":0,
"max":80
}
]
},
"legend": {
},
"extra": {
"area": {
"type": "curve",
"opacity": 0.2,
"addLine": true,
"width": 2,
"gradient": true,
"activeType": "hollow"
},
}
},
"column":{
"type": "column",
"color": color,
"padding": [15,15,0,5],
"xAxis": {
"disableGrid": true,
},
"yAxis": {
"data":[{"min":0}]
},
"legend": {
},
"extra": {
"column": {
"type": "group",
"width": 30,
"activeBgColor": "#000000",
"activeBgOpacity": 0.08
},
}
},
"mount":{
"type": "mount",
"color": color,
"padding": [15,15,0,5],
"xAxis": {
"disableGrid": true,
},
"yAxis": {
"data":[{"min":0}]
},
"legend": {
},
"extra": {
"mount": {
"type": "mount",
"widthRatio": 1.5,
},
}
},
"bar":{
"type": "bar",
"color": color,
"padding": [15,30,0,5],
"xAxis": {
"boundaryGap":"justify",
"disableGrid":false,
"min":0,
"axisLine":false
},
"yAxis": {
},
"legend": {
},
"extra": {
"bar": {
"type": "group",
"width": 30,
"meterBorde": 1,
"meterFillColor": "#FFFFFF",
"activeBgColor": "#000000",
"activeBgOpacity": 0.08
},
}
},
"area":{
"type": "area",
"color": color,
"padding": [15,15,0,15],
"xAxis": {
"disableGrid": true,
},
"yAxis": {
"gridType": "dash",
"dashLength": 2,
},
"legend": {
},
"extra": {
"area": {
"type": "straight",
"opacity": 0.2,
"addLine": true,
"width": 2,
"gradient": false,
"activeType": "hollow"
},
}
},
"radar":{
"type": "radar",
"color": color,
"padding": [5,5,5,5],
"dataLabel": false,
"legend": {
"show": true,
"position": "right",
"lineHeight": 25,
},
"extra": {
"radar": {
"gridType": "radar",
"gridColor": "#CCCCCC",
"gridCount": 3,
"opacity": 0.2,
"max": 200,
"labelShow": true
},
}
},
"gauge":{
"type": "gauge",
"color": color,
"title": {
"name": "66Km/H",
"fontSize": 25,
"color": "#2fc25b",
"offsetY": 50
},
"subtitle": {
"name": "实时速度",
"fontSize": 15,
"color": "#1890ff",
"offsetY": -50
},
"extra": {
"gauge": {
"type": "default",
"width": 30,
"labelColor": "#666666",
"startAngle": 0.75,
"endAngle": 0.25,
"startNumber": 0,
"endNumber": 100,
"labelFormat": "",
"splitLine": {
"fixRadius": 0,
"splitNumber": 10,
"width": 30,
"color": "#FFFFFF",
"childNumber": 5,
"childWidth": 12
},
"pointer": {
"width": 24,
"color": "auto"
}
}
}
},
"candle":{
"type": "candle",
"color": color,
"padding": [15,15,0,15],
"enableScroll": true,
"enableMarkLine": true,
"dataLabel": false,
"xAxis": {
"labelCount": 4,
"itemCount": 40,
"disableGrid": true,
"gridColor": "#CCCCCC",
"gridType": "solid",
"dashLength": 4,
"scrollShow": true,
"scrollAlign": "left",
"scrollColor": "#A6A6A6",
"scrollBackgroundColor": "#EFEBEF"
},
"yAxis": {
},
"legend": {
},
"extra": {
"candle": {
"color": {
"upLine": "#f04864",
"upFill": "#f04864",
"downLine": "#2fc25b",
"downFill": "#2fc25b"
},
"average": {
"show": true,
"name": ["MA5","MA10","MA30"],
"day": [5,10,20],
"color": ["#1890ff","#2fc25b","#facc14"]
}
},
"markLine": {
"type": "dash",
"dashLength": 5,
"data": [
{
"value": 2150,
"lineColor": "#f04864",
"showLabel": true
},
{
"value": 2350,
"lineColor": "#f04864",
"showLabel": true
}
]
}
}
},
"mix":{
"type": "mix",
"color": color,
"padding": [15,15,0,15],
"xAxis": {
"disableGrid": true,
},
"yAxis": {
"disabled": false,
"disableGrid": false,
"splitNumber": 5,
"gridType": "dash",
"dashLength": 4,
"gridColor": "#CCCCCC",
"padding": 10,
"showTitle": true,
"data": []
},
"legend": {
},
"extra": {
"mix": {
"column": {
"width": 20
}
},
}
},
"scatter":{
"type": "scatter",
"color":color,
"padding":[15,15,0,15],
"dataLabel":false,
"xAxis": {
"disableGrid": false,
"gridType":"dash",
"splitNumber":5,
"boundaryGap":"justify",
"min":0
},
"yAxis": {
"disableGrid": false,
"gridType":"dash",
},
"legend": {
},
"extra": {
"scatter": {
},
}
},
"bubble":{
"type": "bubble",
"color":color,
"padding":[15,15,0,15],
"xAxis": {
"disableGrid": false,
"gridType":"dash",
"splitNumber":5,
"boundaryGap":"justify",
"min":0,
"max":250
},
"yAxis": {
"disableGrid": false,
"gridType":"dash",
"data":[{
"min":0,
"max":150
}]
},
"legend": {
},
"extra": {
"bubble": {
"border":2,
"opacity": 0.5,
},
}
}
}
export default cfu;

View File

@@ -0,0 +1,5 @@
# uCharts JSSDK说明
1、如不使用uCharts组件可直接引用u-charts.js打包编译后会`自动压缩`,压缩后体积约为`120kb`
2、如果120kb的体积仍需压缩请手到uCharts官网通过在线定制选择您需要的图表。
3、config-ucharts.js为uCharts组件的用户配置文件升级前请`自行备份config-ucharts.js`文件,以免被强制覆盖。
4、config-echarts.js为ECharts组件的用户配置文件升级前请`自行备份config-echarts.js`文件,以免被强制覆盖。

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,80 @@
{
"id": "qiun-data-charts",
"displayName": "秋云 ucharts echarts 高性能跨全端图表组件",
"version": "2.5.0-20230101",
"description": "uCharts 新增正负柱状图支持H5及APP用 ucharts echarts 渲染图表uniapp可视化首选组件",
"keywords": [
"ucharts",
"echarts",
"f2",
"图表",
"可视化"
],
"repository": "https://gitee.com/uCharts/uCharts",
"engines": {
},
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": "474119"
},
"declaration": {
"ads": "无",
"data": "插件不采集任何数据",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/~qiun",
"type": "component-vue"
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"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"
},
"快应用": {
"华为": "y",
"联盟": "y"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}

View File

@@ -0,0 +1,84 @@
![logo](https://img-blog.csdnimg.cn/4a276226973841468c1be356f8d9438b.png)
[![star](https://gitee.com/uCharts/uCharts/badge/star.svg?theme=gvp)](https://gitee.com/uCharts/uCharts/stargazers)
[![fork](https://gitee.com/uCharts/uCharts/badge/fork.svg?theme=gvp)](https://gitee.com/uCharts/uCharts/members)
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![npm package](https://img.shields.io/npm/v/@qiun/ucharts.svg?style=flat-square)](https://www.npmjs.com/~qiun)
## uCharts简介
`uCharts`是一款基于`canvas API`开发的适用于所有前端应用的图表库,开发者编写一套代码,可运行到 Web、iOS、Android基于 uni-app / taro )、以及各种小程序(微信/支付宝/百度/头条/飞书/QQ/快手/钉钉/淘宝)、快应用等更多支持 canvas API 的平台。
## 官方网站
## [https://www.ucharts.cn](https://www.ucharts.cn)
## 快速体验
一套代码编到多个平台依次扫描二维码亲自体验uCharts图表跨平台效果其他平台请自行编译。
![](https://www.ucharts.cn/images/web/guide/qrcode20220224.png)
![](https://img-blog.csdnimg.cn/7d0115593ff24ac39a224fb7c6ed72a4.png)
## 致开发者
感谢各位开发者`五年`来对秋云及uCharts的支持uCharts的进步离不开各位开发者的鼓励与贡献。为更好的帮助各位开发者使用图表工具我们推出了新版官网增加了在线定制、问答社区、在线配置等一些增值服务为确保您能更好的应用图表组件建议您先`仔细阅读官网指南`以及`常见问题`,而不是下载下来`直接使用`。如仍然不能解决,请到`官网社区`或开通会员后加入`专属VIP会员群`提问将会很快得到回答。
## 视频教程
## [uCharts新手入门教程](https://www.bilibili.com/video/BV1qA411Q7se/?share_source=copy_web&vd_source=42a1242f9aaade6427736af69eb2e1d9)
## 社群支持
uCharts官方拥有5个2000人的QQ群及专属VIP会员群支持庞大的用户量证明我们一直在努力请各位放心使用uCharts的开源图表组件的开发团队付出了大量的时间与精力经过四来的考验不会有比较明显的bug请各位放心使用。如果您有更好的想法可以在`码云提交Pull Requests`以帮助更多开发者完成需求再次感谢各位对uCharts的鼓励与支持
#### 官方交流群
- 交流群1371774600已满
- 交流群2619841586已满
- 交流群3955340127已满
- 交流群4641669795已满
- 交流群5236294809只能扫码加入
![](https://www.ucharts.cn/images/web/qq5.jpg)
- 口令`uniapp`
#### 专属VIP会员群
- 开通会员后详见【账号详情】页面中顶部的滚动通知
- 口令`您的用户ID`
## 版权信息
uCharts始终坚持开源遵循 [Apache Licence 2.0](https://www.apache.org/licenses/LICENSE-2.0.html) 开源协议意味着您无需支付任何费用即可将uCharts应用到您的产品中。
注意这并不意味着您可以将uCharts应用到非法的领域比如涉及赌博暴力等方面。如因此产生纠纷或法律问题uCharts相关方及秋云科技不承担任何责任。
## 合作伙伴
[![DIY官网](https://www.ucharts.cn/images/web/guide/links/diy-gw.png)](https://www.diygw.com/)
[![HasChat](https://www.ucharts.cn/images/web/guide/links/haschat.png)](https://gitee.com/howcode/has-chat)
[![uViewUI](https://www.ucharts.cn/images/web/guide/links/uView.png)](https://www.uviewui.com/)
[![图鸟UI](https://www.ucharts.cn/images/web/guide/links/tuniao.png)](https://ext.dcloud.net.cn/plugin?id=7088)
[![thorui](https://www.ucharts.cn/images/web/guide/links/thorui.png)](https://ext.dcloud.net.cn/publisher?id=202)
[![FirstUI](https://www.ucharts.cn/images/web/guide/links/first.png)](https://www.firstui.cn/)
[![nProUI](https://www.ucharts.cn/images/web/guide/links/nPro.png)](https://ext.dcloud.net.cn/plugin?id=5169)
[![GraceUI](https://www.ucharts.cn/images/web/guide/links/grace.png)](https://www.graceui.com/)
## 更新记录
详见官网指南中说明,[点击此处查看](https://www.ucharts.cn/v2/#/guide/index?id=100)
## 相关链接
- [uCharts官网](https://www.ucharts.cn)
- [DCloud插件市场地址](https://ext.dcloud.net.cn/plugin?id=271)
- [uCharts码云开源托管地址](https://gitee.com/uCharts/uCharts) [![star](https://gitee.com/uCharts/uCharts/badge/star.svg?theme=gvp)](https://gitee.com/uCharts/uCharts/stargazers)
- [uCharts npm开源地址](https://www.ucharts.cn)
- [ECharts官网](https://echarts.apache.org/zh/index.html)
- [ECharts配置手册](https://echarts.apache.org/zh/option.html)
- [图表组件在项目中的应用 ReportPlus数据报表](https://www.ucharts.cn/v2/#/layout/info?id=1)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long