1、增加生成环境屏蔽console输出,仅限H5
2、增加向上滑动提示,如果用户手动滑动后,该提示隐藏掉
This commit is contained in:
Wenzhe 2026-02-02 23:30:44 +08:00
parent 02a6419622
commit b1651d337c
3 changed files with 39 additions and 6 deletions

View File

@ -2,6 +2,7 @@
export default {
onLaunch: function() {
console.log('App Launch')
console.log(process.env.NODE_ENV);
},
onShow: function() {
console.log('App Show')

View File

@ -48,6 +48,10 @@ const generatedCouplet = ref(null)
const pageVisitUuid = ref('')
//
const hasSubmittedUserInfo = ref(false)
//
const hasScrolled = ref(false)
//
const isAutoScrolling = ref(false)
//
@ -165,6 +169,9 @@ onMounted(() => {
//
const scrollToHomePage = () => {
//
isAutoScrolling.value = true
if (!scrollContainer.value) {
console.log('scrollContainer 尚未初始化')
return
@ -242,6 +249,8 @@ onMounted(() => {
//
isPageReady.value = true
titleImageShown.value = true
//
isAutoScrolling.value = false
console.log('设置 isPageReady = true准备显示页面')
}, 50)
} else {
@ -250,6 +259,8 @@ onMounted(() => {
//
isPageReady.value = true
titleImageShown.value = true
//
isAutoScrolling.value = false
console.log('设置 isPageReady = true准备显示页面')
}
}, 300)
@ -266,6 +277,11 @@ onMounted(() => {
const handleScroll = (event) => {
if (isScrolling.value) return
//
if (!isAutoScrolling.value && !hasScrolled.value && event.detail.scrollTop > 50) {
hasScrolled.value = true
}
// uniappscroll-viewscrollevent.detail
const scrollTop = event.detail.scrollTop
const viewportHeight = window.innerHeight
@ -600,10 +616,10 @@ onUnmounted(() => {
</section>
<!-- 向上滑动提示 -->
<!-- <div class="scroll-tip-bottom">
<div class="tip-icon"></div>
<div class="scroll-tip-bottom" v-if="!hasScrolled">
<img src="/static/images/icon_hand1.png" class="tip-icon" alt="滑动提示" />
<p>向上滑动探索商圈</p>
</div> -->
</div>
<!-- 抽奖留资弹窗 -->
<LotteryFormModal
@ -778,7 +794,7 @@ onUnmounted(() => {
/* 向上滑动提示样式 */
.scroll-tip-bottom {
position: fixed;
bottom: 50px;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
display: flex;
@ -786,6 +802,12 @@ onUnmounted(() => {
align-items: center;
animation: bounce 1.5s infinite;
z-index: 100;
color: white;
}
.tip-icon {
width: 64rpx;
height: 78rpx;
}
@keyframes bounce {

10
main.js
View File

@ -4,6 +4,16 @@ import App from './App'
import * as Pinia from 'pinia';
import VueLazyload from 'vue-lazyload'
// 生产环境屏蔽 console 输出
if (process.env.NODE_ENV === 'production') {
// 重写 console.log
console.log = function() {};
console.warn = function() {};
console.error = function() {};
console.info = function() {};
console.debug = function() {};
}
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'