修正了 pages 名为拼音的问题
This commit is contained in:
90
pages/manager-assign/manager-assign.js
Normal file
90
pages/manager-assign/manager-assign.js
Normal file
@@ -0,0 +1,90 @@
|
||||
// pages/manager-assign/manager-assign.js
|
||||
const app = getApp()
|
||||
import request from '../../utils/request.js'
|
||||
|
||||
Page({
|
||||
data: {
|
||||
images: [], // 图片完整URL列表
|
||||
lastUpdate: '', // 最新更新时间
|
||||
visitCount: 0, // 浏览次数
|
||||
loading: true, // 加载中
|
||||
ossImageUrl: '' // OSS基础地址
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
// 获取OSS地址
|
||||
this.setData({
|
||||
ossImageUrl: app.globalData.ossImageUrl || ''
|
||||
})
|
||||
this.loadData()
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.registerNotificationComponent()
|
||||
},
|
||||
|
||||
// 注册全局通知组件
|
||||
registerNotificationComponent() {
|
||||
const notificationComp = this.selectComponent('#global-notification')
|
||||
if (notificationComp && notificationComp.showNotification) {
|
||||
app.globalData.globalNotification = {
|
||||
show: (data) => notificationComp.showNotification(data),
|
||||
hide: () => notificationComp.hideNotification()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 加载数据
|
||||
loadData() {
|
||||
this.setData({ loading: true })
|
||||
|
||||
request({
|
||||
url: '/peizhi/gzal',
|
||||
method: 'POST',
|
||||
header: { 'content-type': 'application/json' }
|
||||
})
|
||||
.then(res => {
|
||||
if (res && res.data && res.data.code === 0) {
|
||||
const data = res.data.data || {}
|
||||
const ossImageUrl = this.data.ossImageUrl
|
||||
// 拼接完整URL
|
||||
const fullImages = (data.images || []).map(url => {
|
||||
if (url && !url.startsWith('http')) {
|
||||
return ossImageUrl + url
|
||||
}
|
||||
return url
|
||||
})
|
||||
this.setData({
|
||||
images: fullImages,
|
||||
lastUpdate: data.last_update || '',
|
||||
visitCount: data.visit_count || 0,
|
||||
loading: false
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res?.data?.msg || '加载失败',
|
||||
icon: 'none'
|
||||
})
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('加载关注阿龙数据失败', err)
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'none'
|
||||
})
|
||||
this.setData({ loading: false })
|
||||
})
|
||||
},
|
||||
|
||||
// 图片加载成功(可选)
|
||||
onImageLoad(e) {
|
||||
// 可忽略
|
||||
},
|
||||
|
||||
// 图片加载失败
|
||||
onImageError(e) {
|
||||
console.warn('图片加载失败', e)
|
||||
}
|
||||
})
|
||||
8
pages/manager-assign/manager-assign.json
Normal file
8
pages/manager-assign/manager-assign.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"navigationBarTitleText": "关注星阙",
|
||||
"usingComponents": {
|
||||
"global-notification": "/components/global-notification/global-notification"
|
||||
},
|
||||
"enablePullDownRefresh": false,
|
||||
"backgroundTextStyle": "dark"
|
||||
}
|
||||
39
pages/manager-assign/manager-assign.wxml
Normal file
39
pages/manager-assign/manager-assign.wxml
Normal file
@@ -0,0 +1,39 @@
|
||||
<view class="guanzhual-page">
|
||||
<!-- 头部信息区 -->
|
||||
<view class="header-info">
|
||||
<view class="title-section">
|
||||
<text class="main-title">关注快手</text>
|
||||
<text class="visit-count">{{visitCount}}次浏览</text>
|
||||
</view>
|
||||
<view class="sub-info">
|
||||
<text class="update-time" wx:if="{{lastUpdate}}">更新时间:{{lastUpdate}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 图片列表 -->
|
||||
<view class="image-list">
|
||||
<block wx:for="{{images}}" wx:key="index">
|
||||
<view class="image-item">
|
||||
<image
|
||||
src="{{item}}"
|
||||
mode="widthFix"
|
||||
lazy-load="true"
|
||||
bindload="onImageLoad"
|
||||
binderror="onImageError"
|
||||
></image>
|
||||
</view>
|
||||
</block>
|
||||
<view wx:if="{{images.length === 0 && !loading}}" class="empty-tip">
|
||||
<text>暂无内容</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载状态 -->
|
||||
<view class="loading-container" wx:if="{{loading}}">
|
||||
<view class="loading-spinner"></view>
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 全局通知组件 -->
|
||||
<global-notification id="global-notification" />
|
||||
</view>
|
||||
95
pages/manager-assign/manager-assign.wxss
Normal file
95
pages/manager-assign/manager-assign.wxss
Normal file
@@ -0,0 +1,95 @@
|
||||
/* pages/manager-assign/manager-assign.wxss */
|
||||
page {
|
||||
background-color: #ffffff;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.guanzhual-page {
|
||||
padding-bottom: 30rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 头部信息 */
|
||||
.header-info {
|
||||
padding: 30rpx 20rpx 20rpx 20rpx;
|
||||
border-bottom: 2rpx solid #f5f5f5;
|
||||
}
|
||||
|
||||
.title-section {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.main-title {
|
||||
font-size: 40rpx;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.visit-count {
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.sub-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 26rpx;
|
||||
color: #aaaaaa;
|
||||
}
|
||||
|
||||
.update-time {
|
||||
color: #888888;
|
||||
}
|
||||
|
||||
/* 图片列表 */
|
||||
.image-list {
|
||||
padding: 0 8rpx; /* 非常微小的左右边距 */
|
||||
}
|
||||
|
||||
.image-item {
|
||||
width: 100%;
|
||||
margin-bottom: 6rpx; /* 极小的上下间距 */
|
||||
background-color: #fafafa;
|
||||
overflow: hidden;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
|
||||
.image-item image {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* 空状态提示 */
|
||||
.empty-tip {
|
||||
padding: 100rpx 0;
|
||||
text-align: center;
|
||||
color: #999999;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
/* 加载状态 */
|
||||
.loading-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 100rpx 0;
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border: 4rpx solid #e0e0e0;
|
||||
border-top-color: #00C853;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
Reference in New Issue
Block a user