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 { export default {
onLaunch: function() { onLaunch: function() {
console.log('App Launch') console.log('App Launch')
console.log(process.env.NODE_ENV);
}, },
onShow: function() { onShow: function() {
console.log('App Show') console.log('App Show')

View File

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

10
main.js
View File

@ -4,6 +4,16 @@ import App from './App'
import * as Pinia from 'pinia'; import * as Pinia from 'pinia';
import VueLazyload from 'vue-lazyload' 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 // #ifndef VUE3
import Vue from 'vue' import Vue from 'vue'
import './uni.promisify.adaptor' import './uni.promisify.adaptor'