feat(uniapp): 加开发用「练一练」悬浮入口

- 新组件 dev-training-entry:右下角圆形悬浮按钮,带 DEV 标签
- 仅在 isDevMode() 为真时显示,上线打包自动隐藏
- 挂载到首页和个人中心,方便快速跳转 /pages/training/index 测试

后续走装修系统给 user 页配「练一练」服务图标后即可移除此组件

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-25 10:37:23 +08:00
co-authored by Cursor
parent 275a7a550d
commit d46cfff079
3 changed files with 80 additions and 0 deletions
@@ -0,0 +1,75 @@
<template>
<view v-if="visible" class="dev-training-entry" @click="goTraining">
<view class="entry-icon">💪</view>
<view class="entry-text">练一练</view>
<view class="entry-tag">DEV</view>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { isDevMode } from '@/utils/env'
const props = withDefaults(
defineProps<{
bottom?: number
}>(),
{ bottom: 200 },
)
const visible = ref(isDevMode())
const goTraining = () => {
uni.navigateTo({ url: '/pages/training/index' })
}
</script>
<style lang="scss" scoped>
.dev-training-entry {
position: fixed;
right: 24rpx;
bottom: v-bind('props.bottom + "rpx"');
z-index: 999;
width: 110rpx;
height: 110rpx;
border-radius: 50%;
background: linear-gradient(135deg, #22c55e, #16a34a);
box-shadow: 0 6rpx 20rpx rgba(34, 197, 94, 0.4);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
transition: transform 0.2s;
&:active {
transform: scale(0.92);
}
.entry-icon {
font-size: 40rpx;
line-height: 1;
}
.entry-text {
font-size: 18rpx;
color: #fff;
margin-top: 4rpx;
line-height: 1;
}
.entry-tag {
position: absolute;
top: -8rpx;
right: -8rpx;
background: #ef4444;
color: #fff;
font-size: 16rpx;
padding: 2rpx 8rpx;
border-radius: 8rpx;
line-height: 1.4;
}
}
</style>
+3
View File
@@ -87,6 +87,8 @@
<MpPrivacyPopup></MpPrivacyPopup>
<!-- #endif -->
<dev-training-entry />
<tabbar/>
</view>
</template>
@@ -96,6 +98,7 @@ import {getIndex} from '@/api/shop'
import {onLoad, onPageScroll} from "@dcloudio/uni-app";
import {computed, reactive, ref} from 'vue'
import {useAppStore} from '@/stores/app'
import DevTrainingEntry from '@/components/dev-training-entry/index.vue'
// #ifdef MP
import MpPrivacyPopup from './component/mp-privacy-popup.vue'
+2
View File
@@ -25,6 +25,7 @@
<w-user-banner :content="item.content" :styles="item.styles" />
</template>
</view>
<dev-training-entry />
<tabbar />
</view>
</template>
@@ -35,6 +36,7 @@ import { useUserStore } from '@/stores/user'
import { onShow } from '@dcloudio/uni-app'
import { storeToRefs } from 'pinia'
import { reactive } from 'vue'
import DevTrainingEntry from '@/components/dev-training-entry/index.vue'
const state = reactive<{
meta: any[]
pages: any[]