chuangte_bike_newxcx/page_user/guzhang/gonggaolist.vue

270 lines
6.0 KiB
Vue

<template>
<view class="page">
<u-navbar title="公告协议" :border-bottom="false" :background="bgc" back-icon-color="#262B37" title-color='#262B37'
title-size='36' height='44' id="navbar">
</u-navbar>
<scroll-view class="listsc">
<view class="list_item" v-for="(item,index) in gglist" :key="index" @click="btnitem(item)">
<view class="top">
<view class="lt">
<!-- 优化喇叭图标 -->
<image src="https://api.ccttiot.com/smartmeter/img/static/uE4QQ7KwMa3GFM0oMqNC"
mode="aspectFit"
class="notice-icon"
></image>
<text class="notice-title">{{item.title || '小程序升级'}}</text>
</view>
<view class="rt">
<!-- 可选的NEW标记 -->
<view v-if="index === 0" class="new-tag">最新</view>
</view>
</view>
<view class="cen">
<!-- 时间戳 -->
<view class="time-stamp">
{{item.createTime || '2025-11-05 12:22:56'}}
</view>
</view>
<view class="bot">
<view class="detail-btn">
查看详情
</view>
<u-icon name="arrow-right" color="#3D3D3D" size="28"></u-icon>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
bgc: {
backgroundColor: "#fff",
},
gglist:[]
}
},
onLoad() {
this.getgonggao()
},
methods: {
// 获取公告列表
getgonggao(){
this.$u.get(`/app/article/list?code=MCH_NOTICE&appId=${this.$store.state.appid}`).then(res =>{
if(res.code == 200){
this.gglist = res.data
}
})
},
// 点击跳转详情
btnitem(item){
uni.navigateTo({
url:'/page_user/guzhang/gonggaoxq?id=' + item.id
})
}
}
}
</script>
<style lang="scss" scoped>
page {
background: #F7F7F7;
}
.listsc{
background: linear-gradient(180deg, #F7F7F7 0%, #F0F5FF 100%);
min-height: 100vh;
.list_item{
width: 710rpx;
margin: auto;
margin-top: 20rpx;
background: #FFFFFF;
border-radius: 24rpx;
margin-bottom: 24rpx;
padding: 32rpx;
box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
transition: all 0.3s ease;
border: 1px solid rgba(229, 234, 243, 0.8);
&:last-child {
margin-bottom: 0;
}
&:active {
transform: translateY(-2rpx);
box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.08);
}
// 顶部区域
.top{
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
.lt{
display: flex;
align-items: center;
.notice-icon {
width: 48rpx;
height: 48rpx;
margin-right: 20rpx;
filter: drop-shadow(0 4rpx 8rpx rgba(66, 133, 244, 0.2));
}
.notice-title {
font-size: 34rpx;
font-weight: 600;
color: #1A1A1A;
letter-spacing: -0.5rpx;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}
}
.rt {
.new-tag {
background: linear-gradient(135deg, #FF6B6B 0%, #FF8E8E 100%);
color: #FFFFFF;
font-size: 20rpx;
font-weight: 600;
padding: 6rpx 14rpx;
border-radius: 20rpx;
box-shadow: 0 4rpx 12rpx rgba(255, 107, 107, 0.2);
letter-spacing: 0.5rpx;
}
}
}
// 中间区域
.cen {
border-bottom: 1px solid rgba(229, 234, 243, 0.8);
margin-top: 10rpx;
.time-stamp {
font-size: 26rpx;
color: #8A94A6;
margin-bottom: 16rpx;
display: flex;
align-items: center;
&::before {
content: '';
display: inline-block;
width: 32rpx;
height: 32rpx;
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%238A94A6"><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm0 18c-4.4 0-8-3.6-8-8s3.6-8 8-8 8 3.6 8 8-3.6 8-8 8zm.5-13H11v6l5.2 3.2.8-1.3-4.5-2.7V7z"/></svg>') no-repeat center;
background-size: contain;
margin-right: 8rpx;
}
}
.content-preview {
font-size: 30rpx;
color: #4A5568;
line-height: 1.6;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
font-weight: 400;
letter-spacing: 0.2rpx;
}
}
// 底部区域
.bot {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 24rpx;
.detail-btn {
font-size: 28rpx;
color: #4285F4;
font-weight: 500;
display: flex;
align-items: center;
&::after {
content: '';
display: inline-block;
width: 0;
height: 0;
margin-left: 8rpx;
transition: transform 0.3s ease;
}
}
.u-icon {
transition: transform 0.3s ease;
color: #4285F4 !important;
}
}
// 悬停效果
&:hover {
.bot {
.detail-btn::after {
width: 8rpx;
height: 8rpx;
border-right: 2rpx solid #4285F4;
border-bottom: 2rpx solid #4285F4;
transform: rotate(-45deg);
}
.u-icon {
transform: translateX(4rpx);
}
}
}
}
// 空状态
:empty + .empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 200rpx 0;
.empty-img {
width: 200rpx;
height: 200rpx;
opacity: 0.5;
margin-bottom: 32rpx;
}
.empty-text {
font-size: 30rpx;
color: #8A94A6;
font-weight: 400;
}
}
}
// 加载动画
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.list_item {
animation: fadeInUp 0.4s ease forwards;
opacity: 0;
&:nth-child(1) { animation-delay: 0.1s; }
&:nth-child(2) { animation-delay: 0.2s; }
&:nth-child(3) { animation-delay: 0.3s; }
&:nth-child(4) { animation-delay: 0.4s; }
}
</style>