From a4bcd5ae1fcc132a61d76a93852f76d300058859 Mon Sep 17 00:00:00 2001 From: Ls <2391972606@qq.com> Date: Tue, 31 Mar 2026 08:40:11 +0800 Subject: [PATCH] =?UTF-8?q?'=E6=8F=90=E4=BA=A4'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/dataAnalyze/Curve.vue | 34 +- src/pages/dataAnalyze/baoganAnalyze.vue | 266 +++- src/pages/dataAnalyze/grades.vue | 124 +- src/pages/dataAnalyze/paragraphAnalyze.vue | 998 ++++++++++++- src/pages/dataAnalyze/timingAnalze.vue | 9 +- src/pages/index/index.vue | 1203 +++++++++++----- src/pages/index/user.vue | 23 +- src/pages/userFunc/analyze.vue | 2 +- src/pages/userFunc/setCourse.vue | 1281 +++++++++-------- src/pages/userFunc/setCourse.vue.bak | 902 ++++++++++++ src/pages/userFunc/swiming.vue | 204 ++- src/uni_modules/qiun-data-charts/package.json | 92 +- 12 files changed, 3883 insertions(+), 1255 deletions(-) create mode 100644 src/pages/userFunc/setCourse.vue.bak diff --git a/src/pages/dataAnalyze/Curve.vue b/src/pages/dataAnalyze/Curve.vue index 7569e32..812b324 100644 --- a/src/pages/dataAnalyze/Curve.vue +++ b/src/pages/dataAnalyze/Curve.vue @@ -46,22 +46,6 @@ - - - - - - - 请先选择项目 - - - - - - - - 该项目暂无学员数据 - @@ -573,23 +557,7 @@ } } - .hint-state { - margin: 0 20rpx; - background-color: #fff; - border-radius: 16rpx; - padding: 80rpx 40rpx; - text-align: center; - box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05); - - .hint-icon { - margin-bottom: 24rpx; - } - - .hint-text { - font-size: 28rpx; - color: #999; - } - } + .chart-section { margin: 0 20rpx; diff --git a/src/pages/dataAnalyze/baoganAnalyze.vue b/src/pages/dataAnalyze/baoganAnalyze.vue index 2cba9ff..527aa20 100644 --- a/src/pages/dataAnalyze/baoganAnalyze.vue +++ b/src/pages/dataAnalyze/baoganAnalyze.vue @@ -8,6 +8,42 @@ + + + + 项目名称 + + {{ selectedProject }} + + + + + 选择学生 + + {{ selectedStudent }} + + + + + + + + + + + - - - - - - 请选择日期查看数据 - + @@ -115,18 +145,46 @@ detail: string } - const tableData = ref([{ name: '张小明', projectName: '100米自由泳', plan: '2000米', completion: 95, detail: '1900/2000' }, - { name: '李小红', projectName: '100米自由泳', plan: '2000米', completion: 88, detail: '1760/2000' }, - { name: '王小明', projectName: '200米自由泳', plan: '1500米', completion: 100, detail: '1500/1500' }]) + const tableData = ref([]) + + // 项目列表 + const projectList = ref([ + { label: '全部项目', value: 'all' }, + { label: '100米自由泳', value: '100m-free' }, + { label: '200米自由泳', value: '200m-free' }, + { label: '400米自由泳', value: '400m-free' }, + { label: '100米蛙泳', value: '100m-breast' } + ]) + + // 学生列表 + const studentList = ref([ + { label: '全部学生', value: 'all' }, + { label: '张小明', value: 'zhang-xiaoming' }, + { label: '李小红', value: 'li-xiaohong' }, + { label: '王小明', value: 'wang-xiaoming' }, + { label: '赵小芳', value: 'zhao-xiaofang' }, + { label: '陈小刚', value: 'chen-xiaogang' } + ]) + + // 选中的项目和学生 + const selectedProject = ref('全部项目') + const selectedStudent = ref('全部学生') + const selectedProjectValue = ref('all') + const selectedStudentValues = ref([]) + + // 选择器显示状态 + const showProjectPicker = ref(false) + const showStudentPicker = ref(false) + const defaultStudentIndex = ref([0]) // 日历打点数据 - const selectedDates = ref([ - { date: '2026-03-15', info: '训练' }, - { date: '2026-03-18', info: '训练' }, - { date: '2026-03-20', info: '训练' }, - { date: '2026-03-22', info: '训练' }, - { date: '2026-03-25', info: '训练' } - ]) + // const selectedDates = ref([ + // { date: '2026-03-15', info: '训练' }, + // { date: '2026-03-18', info: '训练' }, + // { date: '2026-03-20', info: '训练' }, + // { date: '2026-03-22', info: '训练' }, + // { date: '2026-03-25', info: '训练' } + // ]) // 平均完成率 const averageCompletion = computed(() => { @@ -135,37 +193,44 @@ return Math.round(total / tableData.value.length) }) - // 模拟数据 + // 完整模拟数据 const mockData: Record = { - '2026-03-15': [ + '2026-03-28': [ { name: '张小明', projectName: '100米自由泳', plan: '2000米', completion: 95, detail: '1900/2000' }, - { name: '李小红', projectName: '100米自由泳', plan: '2000米', completion: 88, detail: '1760/2000' }, - { name: '王小明', projectName: '200米自由泳', plan: '1500米', completion: 100, detail: '1500/1500' } - ], - '2026-03-18': [ - { name: '张小明', projectName: '100米自由泳', plan: '2000米', completion: 90, detail: '1800/2000' }, + { name: '张小明', projectName: '200米自由泳', plan: '1500米', completion: 88, detail: '1320/1500' }, { name: '李小红', projectName: '100米自由泳', plan: '2000米', completion: 92, detail: '1840/2000' }, - { name: '赵小芳', projectName: '100米自由泳', plan: '1800米', completion: 85, detail: '1530/1800' }, - { name: '王小明', projectName: '200米自由泳', plan: '1500米', completion: 95, detail: '1425/1500' } + { name: '李小红', projectName: '400米自由泳', plan: '1200米', completion: 85, detail: '1020/1200' }, + { name: '王小明', projectName: '100米自由泳', plan: '2000米', completion: 90, detail: '1800/2000' }, + { name: '赵小芳', projectName: '100米蛙泳', plan: '1800米', completion: 88, detail: '1584/1800' }, + { name: '陈小刚', projectName: '200米自由泳', plan: '1500米', completion: 95, detail: '1425/1500' } ], - '2026-03-20': [ - { name: '张小明', projectName: '100米自由泳', plan: '2000米', completion: 87, detail: '1740/2000' }, - { name: '李小红', projectName: '100米自由泳', plan: '2000米', completion: 90, detail: '1800/2000' } - ], - '2026-03-22': [ - { name: '张小明', projectName: '100米自由泳', plan: '2000米', completion: 92, detail: '1840/2000' }, - { name: '李小红', projectName: '100米自由泳', plan: '2000米', completion: 88, detail: '1760/2000' }, - { name: '赵小芳', projectName: '100米自由泳', plan: '1800米', completion: 90, detail: '1620/1800' }, - { name: '王小明', projectName: '200米自由泳', plan: '1500米', completion: 98, detail: '1470/1500' }, - { name: '陈小刚', projectName: '100米自由泳', plan: '2000米', completion: 75, detail: '1500/2000' } - ], - '2026-03-25': [ - { name: '张小明', projectName: '100米自由泳', plan: '2000米', completion: 85, detail: '1700/2000' }, + '2026-03-29': [ + { name: '张小明', projectName: '100米自由泳', plan: '2000米', completion: 90, detail: '1800/2000' }, + { name: '张小明', projectName: '100米蛙泳', plan: '1800米', completion: 85, detail: '1530/1800' }, { name: '李小红', projectName: '100米自由泳', plan: '2000米', completion: 95, detail: '1900/2000' }, - { name: '赵小芳', projectName: '100米自由泳', plan: '1800米', completion: 88, detail: '1584/1800' } + { name: '李小红', projectName: '200米自由泳', plan: '1500米', completion: 92, detail: '1380/1500' }, + { name: '王小明', projectName: '200米自由泳', plan: '1500米', completion: 98, detail: '1470/1500' }, + { name: '赵小芳', projectName: '100米自由泳', plan: '2000米', completion: 82, detail: '1640/2000' }, + { name: '陈小刚', projectName: '100米自由泳', plan: '2000米', completion: 88, detail: '1760/2000' } + ], + '2026-03-30': [ + { name: '张小明', projectName: '100米自由泳', plan: '2000米', completion: 92, detail: '1840/2000' }, + { name: '张小明', projectName: '400米自由泳', plan: '1200米', completion: 90, detail: '1080/1200' }, + { name: '李小红', projectName: '100米自由泳', plan: '2000米', completion: 88, detail: '1760/2000' }, + { name: '李小红', projectName: '100米蛙泳', plan: '1800米', completion: 95, detail: '1710/1800' }, + { name: '王小明', projectName: '100米自由泳', plan: '2000米', completion: 95, detail: '1900/2000' }, + { name: '赵小芳', projectName: '200米自由泳', plan: '1500米', completion: 85, detail: '1275/1500' }, + { name: '陈小刚', projectName: '400米自由泳', plan: '1200米', completion: 92, detail: '1104/1200' } ] } + // 日历打点数据 + const selectedDates = ref([ + { date: '2026-03-28', info: '训练' }, + { date: '2026-03-29', info: '训练' }, + { date: '2026-03-30', info: '训练' } + ]) + onLoad(() => { loadData() }) @@ -196,16 +261,86 @@ // 日期选择处理 const handleDateChange = (e: any) => { - // 点击日期后的处理 const date = e.fulldate selectedDate.value = date + filterAndLoadData() + } - // 加载该日期的数据 - if (mockData[date]) { - tableData.value = mockData[date] + // 项目选择确认 + const handleProjectConfirm = (e: any) => { + const item = e.value[0] + selectedProject.value = item.label + selectedProjectValue.value = item.value + showProjectPicker.value = false + filterAndLoadData() + } + + // 学生选择确认 + const handleStudentConfirm = (e: any) => { + const items = e.value + selectedStudentValues.value = items.map((item: any) => item.value) + + if (selectedStudentValues.value.length === 0) { + selectedStudent.value = '未选择' + } else if (selectedStudentValues.value.includes('all')) { + selectedStudent.value = '全部学生' } else { - tableData.value = [] + const selectedNames = items.map((item: any) => item.label) + selectedStudent.value = selectedNames.length > 2 + ? `${selectedNames.slice(0, 2).join(', ')}等${selectedNames.length}人` + : selectedNames.join(', ') } + + defaultStudentIndex.value = e.indexs + showStudentPicker.value = false + filterAndLoadData() + } + + // 过滤并加载数据 + const filterAndLoadData = () => { + if (!selectedDate.value) { + tableData.value = [] + return + } + + const dateData = mockData[selectedDate.value] + if (!dateData) { + tableData.value = [] + return + } + + let filteredData = [...dateData] + + // 按项目过滤 + if (selectedProjectValue.value !== 'all') { + const projectMap: Record = { + '100m-free': '100米自由泳', + '200m-free': '200米自由泳', + '400m-free': '400米自由泳', + '100m-breast': '100米蛙泳' + } + const targetProject = projectMap[selectedProjectValue.value] + if (targetProject) { + filteredData = filteredData.filter(item => item.projectName === targetProject) + } + } + + // 按学生过滤 + if (selectedStudentValue.value !== 'all') { + const studentMap: Record = { + 'zhang-xiaoming': '张小明', + 'li-xiaohong': '李小红', + 'wang-xiaoming': '王小明', + 'zhao-xiaofang': '赵小芳', + 'chen-xiaogang': '陈小刚' + } + const targetStudent = studentMap[selectedStudentValue.value] + if (targetStudent) { + filteredData = filteredData.filter(item => item.name === targetStudent) + } + } + + tableData.value = filteredData } @@ -241,6 +376,47 @@ } } + /* 选择器区域 */ + .selector-section { + background-color: #fff; + margin: 0 20rpx 20rpx; + border-radius: 16rpx; + padding: 24rpx; + display: flex; + gap: 20rpx; + box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05); + + .selector-item { + flex: 1; + display: flex; + align-items: center; + justify-content: space-between; + padding: 20rpx 24rpx; + background-color: #f8f8f8; + border-radius: 12rpx; + + .selector-label { + font-size: 28rpx; + color: #666; + margin-right: 16rpx; + } + + .selector-value { + flex: 1; + display: flex; + align-items: center; + justify-content: flex-end; + + .value-text { + font-size: 28rpx; + color: #333; + font-weight: 500; + margin-right: 8rpx; + } + } + } + } + /* 日历组件包装 */ .calendar-wrapper { background-color: #fff; diff --git a/src/pages/dataAnalyze/grades.vue b/src/pages/dataAnalyze/grades.vue index 953762d..5514dbf 100644 --- a/src/pages/dataAnalyze/grades.vue +++ b/src/pages/dataAnalyze/grades.vue @@ -23,22 +23,6 @@ - - - - - - - 请先选择项目 - - - - - - - - 该项目暂无排名数据 - @@ -70,11 +54,6 @@ {{ index + 1 }} - - - {{ item.name.charAt(0) }} - - {{ item.name }} @@ -308,9 +287,23 @@ .project-select-section { background-color: #fff; margin: 0 20rpx 20rpx; - border-radius: 16rpx; + border-radius: 20rpx; padding: 28rpx; - box-shadow: 0 2rpxrpx 12rpx rgba(0, 0, 0, 0.05); + box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05); + position: relative; + overflow: hidden; + transition: all 0.3s ease; + + &::before { + content: ''; + position: absolute; + left: 0; + top: 0; + bottom: 0; + width: 6rpx; + // background: linear-gradient(180deg, #1890ff 0%, #096dd9 100%); + border-radius: 20rpx 0 0 20rpx; + } .picker-wrapper { display: flex; @@ -323,8 +316,9 @@ transition: all 0.3s ease; &:active { - background-color: #f0f0f0; - border-color: #eb2f96; + background-color: #fff0f5; + border-color: #1890ff; + transform: scale(0.98); } .picker-text { @@ -334,24 +328,7 @@ } } - /* ==================== 提示状态容器 ==================== */ - .hint-state { - margin: 0 20rpx; - background-color: #fff; - border-radius: 16rpx; - padding: 80rpx 40rpx; - text-align: center; - box-shadow: 0 2rpxrpx 12rpx rgba(0, 0, 0, 0.05); - .hint-icon { - margin-bottom: 24rpx; - } - - .hint-text { - font-size: 28rpx; - color: #999; - } - } /* ==================== 排名列表区域 ==================== */ .ranking-section { @@ -360,13 +337,26 @@ // 统计卡片 .stats-card { background-color: #fff; - border-radius: 16rpx; + border-radius: 20rpx; padding: 24rpx; margin-bottom: 20rpx; display: flex; align-items: center; justify-content: space-around; - box-shadow: 0 2rpxrpx 12rpx rgba(0, 0, 0, 0.05); + box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05); + position: relative; + overflow: hidden; + + &::before { + content: ''; + position: absolute; + left: 0; + top: 0; + bottom: 0; + width: 6rpx; + // background: linear-gradient(180deg, #1890ff 0%, #096dd9 100%); + border-radius: 20rpx 0 0 20rpx; + } .stat-item { text-align: center; @@ -381,7 +371,7 @@ .stat-value { font-size: 32rpx; font-weight: 700; - color: #eb2f96; + color: #1890ff; } } @@ -398,32 +388,36 @@ // 排名项 .ranking-item { background-color: #fff; - border-radius: 16rpx; + border-radius: 20rpx; padding: 24rpx; margin-bottom: 16rpx; display: flex; align-items: center; gap: 20rpx; - box-shadow: 0 2rpxrpx 12rpx rgba(0, 0, 0, 0.05); + 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; + border-radius: 20rpx 0 0 20rpx; + } &:active { transform: scale(0.98); box-shadow: 0 4rpx 16rpx rgba(235, 47, 150, 0.15); - } - // 前三名特殊样式 - &.top-three { &::before { - content: ''; - position: absolute; - left: 0; - top: 0; - bottom: 0; - width: 6rpx; - background: linear-gradient(180deg, #eb2f96 0%, #f759ab 100%); - border-radius: 16rpx 0 0 16rpx; + opacity: 1; } } @@ -437,7 +431,7 @@ justify-content: center; flex-shrink: 0; background-color: #f0f0f0; - box-shadow: 0 2rpxrpx 8rpx rgba(0, 0, 0, 0.1); + box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1); .rank-number { font-size: 24rpx; @@ -448,7 +442,7 @@ // 前三名特殊颜色 &.rank-1 { background: linear-gradient(135deg, #ffd700 0%, #ffec3d 100%); - box-shadow: 0 2rpxrpx 8rpx rgba(255, 215, 0, 0.4); + box-shadow: 0 2rpx 8.6rpx rgba(255, 215, 0, 0.4); .rank-number { color: #fff; @@ -458,7 +452,7 @@ &.rank-2 { background: linear-gradient(135deg, #c0c0c0 0%, #d9d9d9 100%); - box-shadow: 0 2rpxrpx 8rpx rgba(192, 192, 192, 0.4); + box-shadow: 0 2rpx 8rpx rgba(192, 192, 192, 0.4); .rank-number { color: #fff; @@ -467,7 +461,7 @@ &.rank-3 { background: linear-gradient(135deg, #cd7f32 0%, #e6963d 100%); - box-shadow: 0 2rpxrpx 8rpx rgba(205, 127, 50, 0.4); + box-shadow: 0 2rpx 8rpx rgba(205, 127, 50, 0.4); .rank-number { color: #fff; @@ -479,13 +473,13 @@ .student-avatar { width: 70rpx; height: 70rpx; - background: linear-gradient(135deg, #eb2f96 0%, #f759ab 100%); + background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; - box-shadow: 0 2rpxrpx 8rpx rgba(235, 47, 150, 0.3); + box-shadow: 0 2rpx 8rpx rgba(235, 47, 150, 0.3); .avatar-text { font-size: 28rpx; @@ -509,7 +503,7 @@ .student-speed { font-size: 26rpx; - color: #eb2f96; + color: #1890ff; font-weight: 500; } } diff --git a/src/pages/dataAnalyze/paragraphAnalyze.vue b/src/pages/dataAnalyze/paragraphAnalyze.vue index 2ed65ea..891705e 100644 --- a/src/pages/dataAnalyze/paragraphAnalyze.vue +++ b/src/pages/dataAnalyze/paragraphAnalyze.vue @@ -1,18 +1,1002 @@ - \ No newline at end of file + diff --git a/src/pages/dataAnalyze/timingAnalze.vue b/src/pages/dataAnalyze/timingAnalze.vue index a131d46..27da24b 100644 --- a/src/pages/dataAnalyze/timingAnalze.vue +++ b/src/pages/dataAnalyze/timingAnalze.vue @@ -58,14 +58,7 @@ - - - - - - - 请选择日期查看数据 - + diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 337737c..427c482 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -1,164 +1,230 @@ - \ No newline at end of file diff --git a/src/pages/index/user.vue b/src/pages/index/user.vue index 0718fe2..40ea2de 100644 --- a/src/pages/index/user.vue +++ b/src/pages/index/user.vue @@ -152,37 +152,36 @@ /* 用户信息卡片 */ .user-card { - background: linear-gradient(135deg, #1890ff 0%, #36cfc9 50%, #096dd9 100%); + background: linear-gradient(135deg, #1890ff 0%, #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); + box-shadow: 0 8rpx 24rpx rgba(24, 144, 255, 0.25); 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%); + top: -40%; + right: -30%; + width: 300rpx; + height: 300rpx; + background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%); pointer-events: none; } &::after { content: ''; position: absolute; - bottom: -40%; + bottom: -30%; left: -20%; - width: 300rpx; - height: 300rpx; - background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 70%); + width: 250rpx; + height: 250rpx; + background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%); pointer-events: none; } } diff --git a/src/pages/userFunc/analyze.vue b/src/pages/userFunc/analyze.vue index d0b231c..b7a04c2 100644 --- a/src/pages/userFunc/analyze.vue +++ b/src/pages/userFunc/analyze.vue @@ -55,7 +55,7 @@ - + diff --git a/src/pages/userFunc/setCourse.vue b/src/pages/userFunc/setCourse.vue index dfeeedc..f1c62c6 100644 --- a/src/pages/userFunc/setCourse.vue +++ b/src/pages/userFunc/setCourse.vue @@ -1,542 +1,352 @@ \ No newline at end of file diff --git a/src/pages/userFunc/setCourse.vue.bak b/src/pages/userFunc/setCourse.vue.bak new file mode 100644 index 0000000..a359733 --- /dev/null +++ b/src/pages/userFunc/setCourse.vue.bak @@ -0,0 +1,902 @@ + + + + + diff --git a/src/pages/userFunc/swiming.vue b/src/pages/userFunc/swiming.vue index 2b5d83e..1e306c8 100644 --- a/src/pages/userFunc/swiming.vue +++ b/src/pages/userFunc/swiming.vue @@ -24,19 +24,19 @@ - + {{ index+1 }} {{ athlete.name }} - {{ athlete.lane }} + {{ athlete.gender }} · {{ athlete.age }}岁 {{ formatTime(athlete.time) }} 最快: {{ formatTime(athlete.bestTime) }} - + @@ -128,12 +128,34 @@ - 学生姓名 - + 姓名 + - 序号 - + 性别 + + + + + + + 出生日期 + + + {{ Service.formatDate(newStudentBirthday,2) || '请选择出生日期' }} + + + + + + 年龄 + @@ -146,6 +168,9 @@ 保存 + + + @@ -158,7 +183,9 @@ id : string number : string name : string - lane : string + gender : string + age : string + birthday : string time : number bestTime : number | null finished : boolean @@ -167,10 +194,10 @@ // 选手列表 const athletes = ref([ - { 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 } + { id: '1', number: '01', name: '张三', gender: '男', age: '18', birthday: '2006-01-01', time: 0, bestTime: null, finished: false, isFastest: false }, + { id: '2', number: '02', name: '李四', gender: '女', age: '17', birthday: '2007-01-01', time: 0, bestTime: null, finished: false, isFastest: false }, + { id: '3', number: '03', name: '王五', gender: '男', age: '19', birthday: '2005-01-01', time: 0, bestTime: null, finished: false, isFastest: false }, + { id: '4', number: '04', name: '赵六', gender: '女', age: '18', birthday: '2006-01-01', time: 0, bestTime: null, finished: false, isFastest: false } ]) // 计时器状态 @@ -194,26 +221,32 @@ // 新学生信息 const newStudentName = ref('') - const newStudentLane = ref('') + const newStudentGender = ref('男') + const newStudentBirthday = ref('') + const newStudentAge = ref('') + + // 日期选择器相关 + const showDatePicker = ref(false) + const currentDate = ref('') // 计算已完成的选手 const finishedAthletes = computed(() => { return athletes.value.filter(a => a.finished) }) - const deleStu = (id:any) => { + const deleStu = (id : any) => { uni.showModal({ title: '提示', // 对话框标题 content: '是否删除该学生', // 显示的内容 showCancel: true, // 是否显示取消按钮 success: function (res) { if (res.confirm) { - let index= athletes.value.findIndex((item)=>{ - return item.id==id + let index = athletes.value.findIndex((item) => { + return item.id == id }) - athletes.value.splice(index,1) + athletes.value.splice(index, 1) } else if (res.cancel) { - + } } }); @@ -317,34 +350,29 @@ // 处理选手第一个按钮点击 const handleAthleteFirstButton = (athlete : Athlete, index : number) => { // 如果是一起出发模式,记录该选手时间 - if (stopwatchMode.value === 'together') { - if (athlete.finished) { - Service.Msg('该选手已记录') - return - } + if (athlete.finished) { + Service.Msg('该选手已记录') + return + } - athlete.finished = true - athlete.time = currentTime.value + athlete.finished = true + athlete.time = currentTime.value - // 更新最快记录 - if (athlete.bestTime === null || athlete.time < athlete.bestTime) { - athlete.bestTime = athlete.time - } + // 更新最快记录 + if (athlete.bestTime === null || athlete.time < athlete.bestTime) { + athlete.bestTime = athlete.time + } - // 更新最快选手 - updateFastestAthlete() + // 更新最快选手 + updateFastestAthlete() - // 检查是否所有选手都完成了 - const allFinished = athletes.value.every(a => a.finished) - if (allFinished) { - stopTimer() - Service.Msg('所有选手已完成!') - } else { - Service.Msg(`${athlete.name} 已记录`) - } + // 检查是否所有选手都完成了 + const allFinished = athletes.value.every(a => a.finished) + if (allFinished) { + stopTimer() + Service.Msg('所有选手已完成!') } else { - // 间隔出发模式,重置选手时间 - resetAthleteTime(athlete) + Service.Msg(`${athlete.name} 已记录`) } } @@ -401,17 +429,61 @@ showStopwatchModal.value = false } + // 性别选择变化 + const onGenderChange = (e : any) => { + newStudentGender.value = e.detail.value + } + + // 打开日期选择器 + const openDatePicker = () => { + showDatePicker.value = true + } + + // 根据出生日期计算年龄 + const calculateAge = (birthday : string) : string => { + const birthDate = new Date(birthday) + const today = new Date() + let age = today.getFullYear() - birthDate.getFullYear() + const monthDiff = today.getMonth() - birthDate.getMonth() + + // 如果当前月份小于出生月份,或者月份相同但日期还没到,年龄减1 + if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) { + age-- + } + + return age.toString() + } + + // 日期选择确认 + const onDateConfirm = (e : any) => { + let selectedDate = e + if (Array.isArray(e) && e.length > 0) { + selectedDate = e[0] + } else if (e && e.value) { + selectedDate = e.value + } + newStudentBirthday.value = selectedDate + newStudentAge.value = calculateAge(selectedDate) + showDatePicker.value = false + } + // 关闭添加学生弹出框 const closeAddStudentModal = () => { showAddStudentModal.value = false newStudentName.value = '' - newStudentLane.value = '' + newStudentGender.value = '男' + newStudentBirthday.value = '' + newStudentAge.value = '' } // 添加新学生 const addNewStudent = () => { if (!newStudentName.value.trim()) { - Service.Msg('请输入学生姓名') + Service.Msg('请输入姓名') + return + } + if (!newStudentBirthday.value.trim()) { + Service.Msg('请选择出生日期') return } @@ -420,7 +492,9 @@ id: Date.now().toString(), number: newNumber, name: newStudentName.value.trim(), - lane: newStudentLane.value.trim() || `第${newNumber}泳道`, + gender: newStudentGender.value, + age: newStudentAge.value.trim(), + birthday: newStudentBirthday.value.trim(), time: 0, bestTime: null, finished: false, @@ -873,6 +947,46 @@ } } + /* 性别单选按钮组 */ + .radio-group { + display: flex; + gap: 40rpx; + + .radio-item { + display: flex; + align-items: center; + gap: 12rpx; + + .radio-text { + font-size: 28rpx; + color: #333; + } + } + } + + /* 日期选择器包装 */ + .date-picker-wrapper { + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + height: 80rpx; + background-color: #f5f5f5; + border-radius: 12rpx; + padding: 0 24rpx; + cursor: pointer; + + .date-value { + font-size: 28rpx; + color: #333; + flex: 1; + + &.placeholder { + color: #999; + } + } + } + /* 悬浮保存按钮 */ .float-save-btn { position: fixed; diff --git a/src/uni_modules/qiun-data-charts/package.json b/src/uni_modules/qiun-data-charts/package.json index eb4f706..875dc5f 100644 --- a/src/uni_modules/qiun-data-charts/package.json +++ b/src/uni_modules/qiun-data-charts/package.json @@ -9,11 +9,13 @@ "f2", "图表", "可视化" -], + ], "repository": "https://gitee.com/uCharts/uCharts", -"engines": { + "engines": { + "uni-app": "^3.1.0", + "uni-app-x": "^3.1.0" }, -"dcloudext": { + "dcloudext": { "sale": { "regular": { "price": "0.00" @@ -31,48 +33,66 @@ "permissions": "无" }, "npmurl": "https://www.npmjs.com/~qiun", - "type": "component-vue" + "type": "component-vue", + "darkmode": "-", + "i18n": "-", + "widescreen": "-" }, "uni_modules": { "dependencies": [], "encrypt": [], "platforms": { "cloud": { - "tcb": "y", - "aliyun": "y" + "tcb": "√", + "aliyun": "√" }, "client": { - "App": { - "app-vue": "y", - "app-nvue": "y" + "uni-app": { + "vue": { + "vue2": "-", + "vue3": "-" + }, + "web": { + "safari": "-", + "chrome": "-" + }, + "app": { + "vue": "-", + "nvue": "-", + "android": "-", + "ios": "-", + "harmony": "-" + }, + "mp": { + "weixin": "-", + "alipay": "-", + "toutiao": "-", + "baidu": "-", + "kuaishou": "-", + "jd": "-", + "harmony": "-", + "qq": "-", + "lark": "-", + "xhs": "-" + }, + "quickapp": { + "huawei": "-", + "union": "-" + } }, - "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" + "uni-app-x": { + "web": { + "safari": "-", + "chrome": "-" + }, + "app": { + "android": "-", + "ios": "-", + "harmony": "-" + }, + "mp": { + "weixin": "-" + } } } }