v1.1.9
1、增加生成环境屏蔽console输出,仅限H5 2、增加向上滑动提示,如果用户手动滑动后,该提示隐藏掉
This commit is contained in:
parent
02a6419622
commit
b1651d337c
1
App.vue
1
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')
|
||||
|
|
|
|||
|
|
@ -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(() => {
|
|||
</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
10
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'
|
||||
|
|
|
|||
Loading…
Reference in New Issue