From b1651d337cf1ea98fe6f1720e7231a87f950dbcc Mon Sep 17 00:00:00 2001 From: Wenzhe Date: Mon, 2 Feb 2026 23:30:44 +0800 Subject: [PATCH] v1.1.9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、增加生成环境屏蔽console输出,仅限H5 2、增加向上滑动提示,如果用户手动滑动后,该提示隐藏掉 --- App.vue | 1 + components/SinglePageContainer.vue | 34 ++++++++++++++++++++++++------ main.js | 10 +++++++++ 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/App.vue b/App.vue index f3b9fe0..e66a105 100644 --- a/App.vue +++ b/App.vue @@ -2,6 +2,7 @@ export default { onLaunch: function() { console.log('App Launch') + console.log(process.env.NODE_ENV); }, onShow: function() { console.log('App Show') diff --git a/components/SinglePageContainer.vue b/components/SinglePageContainer.vue index a1c74ea..f5ff776 100644 --- a/components/SinglePageContainer.vue +++ b/components/SinglePageContainer.vue @@ -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,14 +259,16 @@ onMounted(() => { // 标记页面准备就绪,隐藏加载提示并显示页面 isPageReady.value = true titleImageShown.value = true + // 自动滚动结束 + isAutoScrolling.value = false console.log('设置 isPageReady = true,准备显示页面') } }, 300) } - + // 初始滚动到首页 - 延迟更长时间确保内容渲染 setTimeout(scrollToHomePage, 800) - + // 额外的确保措施,等待更长时间后再次尝试 setTimeout(scrollToHomePage, 1500) }) @@ -266,6 +277,11 @@ onMounted(() => { const handleScroll = (event) => { if (isScrolling.value) return + // 只有在非自动滚动状态下,才标记为已手动滑动 + if (!isAutoScrolling.value && !hasScrolled.value && event.detail.scrollTop > 50) { + hasScrolled.value = true + } + // 在uniapp中,scroll-view的scroll事件传递的是event.detail对象 const scrollTop = event.detail.scrollTop const viewportHeight = window.innerHeight @@ -600,10 +616,10 @@ 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 { diff --git a/main.js b/main.js index 9163cef..a125161 100644 --- a/main.js +++ b/main.js @@ -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'