添加扫码签到功能和相关配置

This commit is contained in:
future
2026-06-03 16:26:44 +08:00
committed by liwentao
parent d6e17b9944
commit e9ef34bb7e
8 changed files with 1482 additions and 6 deletions
@@ -0,0 +1,97 @@
<template>
<view class="qr-status">
<!-- 加载中状态 -->
<view v-if="status === 'loading'" class="status-loading">
<view class="status-icon">
<view class="loading-spinner"></view>
</view>
<text>生成中...</text>
</view>
<!-- 签到成功状态 -->
<view v-else-if="status === 'scanned'" class="status-success">
<view class="status-icon">
<uni-icons type="checkmarkcircle" size="40rpx" color="#2ECC71"></uni-icons>
</view>
<text>签到成功</text>
</view>
<!-- 错误状态支持自定义文案 -->
<view v-else-if="status === 'error'" class="status-error">
<view class="status-icon">
<uni-icons type="closecircle" size="40rpx" color="#E74C3C"></uni-icons>
</view>
<text>{{ errorText || '签到失败,请重试' }}</text>
</view>
</view>
</template>
<script setup>
import { defineProps } from 'vue';
// 扩展Props,支持自定义错误文案
const props = defineProps({
status: {
type: String,
required: true,
default: ''
},
// 自定义错误文本(可选)
errorText: {
type: String,
required: false,
default: ''
}
});
</script>
<style scoped>
/* 保留原样式,新增加载中样式 */
.qr-status {
margin-bottom: 48rpx;
}
.status-loading,
.status-waiting,
.status-success,
.status-error {
display: flex;
align-items: center;
justify-content: center;
gap: 16rpx;
font-size: 29rpx;
}
.status-icon {
display: flex;
align-items: center;
}
/* 加载中样式 */
.status-loading {
color: #FF6B35;
}
.loading-spinner {
width: 40rpx;
height: 40rpx;
border: 4rpx solid #E9EDF2;
border-top-color: #FF6B35;
border-radius: 50%;
animation: spin 1s linear infinite;
}
.status-success {
color: #2ECC71;
}
.status-error {
color: #E74C3C;
}
/* 旋转动画 */
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
@@ -6,6 +6,7 @@
v-for="(item, index) in entries"
:key="index"
class="entry-item"
@tap="QEClick(item.path)"
>
<!-- 入口图标容器 -->
<view :class="['entry-icon', { accent: item.accent }]">
@@ -21,37 +22,44 @@
</template>
<script setup>
const QEClick = () => {
uni.navigateTo({
url:"/pages/checkIn/checkIn"
})
}
// 快捷入口数据列表
const entries = [
{
icon: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/icons/course.png',
title: '找课程',
desc: '精品课程',
accent: false ,
accent: false
},
{
icon: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/icons/plan.png',
title: '训练计划',
desc: '个性定制',
accent: true ,
accent: true
},
{
icon: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/icons/data.png',
title: '健身数据',
desc: '记录分析',
accent: false ,
accent: false
},
{
icon: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/icons/message.png',
title: '消息',
desc: '通知消息',
accent: true,
accent: true
},
{
icon: 'https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/icons/checkIn.png',
title: '签到',
desc: '打卡签到',
accent: false,
path: "/pages/checkIn/checkIn"
}
]
</script>