修正了 pages 名为拼音的问题

This commit is contained in:
2026-06-13 10:44:02 +08:00
parent 76cc4ac55e
commit 296e41a8a7
249 changed files with 29660 additions and 29505 deletions

View File

@@ -0,0 +1,103 @@
Page({
onShow() {
// 原有代码...
// 🆕 注册通知组件
this.registerNotificationComponent();
},
// 🆕 新增:注册通知组件
registerNotificationComponent() {
const app = getApp();
const notificationComp = this.selectComponent('#global-notification');
if (notificationComp && notificationComp.showNotification) {
console.log('🏪 商城页面注册通知组件');
app.globalData.globalNotification = {
show: (data) => notificationComp.showNotification(data),
hide: () => notificationComp.hideNotification()
};
}
},
data: {
// 图片URL带时间戳避免缓存
imageUrl: '',
// 容器高度初始为100vh加载后调整为图片高度
containerHeight: 0
},
onLoad() {
// 初始设置容器高度为屏幕高度
this.getSystemInfo()
// 构建图片URL带时间戳
this.buildImageUrl()
},
// 获取系统信息
getSystemInfo() {
const res = wx.getSystemInfoSync()
this.setData({
containerHeight: res.windowHeight
})
},
// 构建图片URL关键加时间戳避免缓存
buildImageUrl() {
const app = getApp()
const ossImageUrl = app.globalData.ossImageUrl || ''
const dashouguize = app.globalData.dashouguize || ''
// 加上时间戳参数,强制每次重新加载
const timestamp = new Date().getTime()
const fullImageUrl = ossImageUrl + dashouguize + '?t=' + timestamp
//console.log('规则图片URL带时间戳:', fullImageUrl)
this.setData({
imageUrl: fullImageUrl
})
},
// 图片加载成功
onImageLoad(e) {
//console.log('图片加载成功,原始尺寸:', e.detail.width, 'x', e.detail.height)
// 根据图片实际高度设置容器高度
// 图片宽度为屏幕宽度,高度按比例计算
const systemInfo = wx.getSystemInfoSync()
const screenWidth = systemInfo.screenWidth // 单位px
// 图片的实际像素尺寸
const imageWidth = e.detail.width
const imageHeight = e.detail.height
// 计算在小程序中显示的高度(保持比例)
// 图片在小程序中宽度为100%屏幕宽度,高度按比例缩放
const displayHeight = (imageHeight / imageWidth) * screenWidth
//console.log('计算后显示高度:', displayHeight, 'px')
// 设置容器高度为图片高度
this.setData({
containerHeight: displayHeight
})
},
// 图片加载失败
onImageError() {
console.error('图片加载失败')
wx.showToast({
title: '图片加载失败',
icon: 'none',
duration: 2000
})
},
// 下拉刷新
onPullDownRefresh() {
// 重新构建图片URL带新时间戳
this.buildImageUrl()
// 停止下拉刷新
wx.stopPullDownRefresh()
}
})

View File

@@ -0,0 +1,11 @@
{
"usingComponents": {
"global-notification": "/components/global-notification/global-notification"
},
"navigationBarTitleText": "用户规则",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"backgroundColor": "#ffffff",
"enablePullDownRefresh": false,
"backgroundTextStyle": "dark"
}

View File

@@ -0,0 +1,12 @@
<!-- 打手规则页面 - 图片完整覆盖 -->
<view class="container" style="height:{{containerHeight}}px">
<image
src="{{ imageUrl }}"
mode="widthFix"
class="rule-image"
bindload="onImageLoad"
binderror="onImageError"
style="width:100%;height:auto"
></image>
</view>
<global-notification id="global-notification" />

View File

@@ -0,0 +1,15 @@
/* 页面容器 */
.container {
width: 100%;
position: relative;
overflow-y: auto;
background-color: #ffffff;
}
/* 规则图片样式 - 绝对定位,从顶部开始 */
.rule-image {
position: absolute;
top: 0;
left: 0;
display: block;
}