增加vConsole调试工具
This commit is contained in:
+36
-2
@@ -113,6 +113,15 @@
|
||||
<text class="menu-arrow">></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 开发调试工具(仅开发环境显示) -->
|
||||
<view v-if="isDev" class="dev-tools">
|
||||
<view class="dev-tools-title">开发工具</view>
|
||||
<view class="menu-item">
|
||||
<text class="menu-text">vConsole 调试</text>
|
||||
<switch :checked="vconsoleEnabled" color="#2979ff" @change="onVConsoleChange" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部左右箭头导航条 -->
|
||||
@@ -139,6 +148,7 @@
|
||||
<script>
|
||||
import PageNavBar from '@/components/page-nav-bar/page-nav-bar.vue';
|
||||
import config from '@/config/env.js';
|
||||
import { isVConsoleEnabled, showVConsole, hideVConsole } from '@/utils/vconsole';
|
||||
|
||||
export default {
|
||||
components: { PageNavBar },
|
||||
@@ -157,7 +167,9 @@ export default {
|
||||
{ title: '联系客服', action: 'call' },
|
||||
{ title: '公众号信息', action: 'qrcode' }
|
||||
],
|
||||
servicePhone: config.servicePhone
|
||||
servicePhone: config.servicePhone,
|
||||
isDev: process.env.NODE_ENV === 'development',
|
||||
vconsoleEnabled: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -193,6 +205,13 @@ export default {
|
||||
// 无设备编号且非 tab 跳转,跳回扫码页
|
||||
uni.redirectTo({ url: '/pages/index/scan' });
|
||||
}
|
||||
|
||||
// 初始化 vConsole 状态
|
||||
this.vconsoleEnabled = isVConsoleEnabled();
|
||||
},
|
||||
onReady() {
|
||||
// 页面渲染完成后再次检查状态
|
||||
this.vconsoleEnabled = isVConsoleEnabled();
|
||||
},
|
||||
methods: {
|
||||
switchTab(tab) { this.currentTab = tab; },
|
||||
@@ -267,7 +286,16 @@ export default {
|
||||
}
|
||||
},
|
||||
handleNavPrev() { this.currentTab = 'home'; },
|
||||
handleNavNext() { uni.showToast({ title: '暂无下一页', icon: 'none' }); }
|
||||
handleNavNext() { uni.showToast({ title: '暂无下一页', icon: 'none' }); },
|
||||
onVConsoleChange(e) {
|
||||
const enabled = e.detail.value;
|
||||
if (enabled) {
|
||||
showVConsole();
|
||||
} else {
|
||||
hideVConsole();
|
||||
}
|
||||
this.vconsoleEnabled = enabled;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -403,6 +431,12 @@ page { height: 100%; background-color: #fff; }
|
||||
.menu-text { font-size: 30rpx; color: #333; }
|
||||
.menu-arrow { font-size: 28rpx; color: #ccc; }
|
||||
|
||||
/* 开发工具区域 */
|
||||
.dev-tools { margin-top: 20rpx; background-color: #fff; border-radius: 16rpx; overflow: hidden; }
|
||||
.dev-tools-title { padding: 20rpx 28rpx 10rpx; font-size: 24rpx; color: #999; }
|
||||
.dev-tools .menu-item { align-items: center; }
|
||||
.dev-tools switch { transform: scale(0.8); }
|
||||
|
||||
/* ====== 公众号二维码弹窗 ====== */
|
||||
.qrcode-popup-mask {
|
||||
position: fixed;
|
||||
|
||||
Reference in New Issue
Block a user