feat: add resident miniapp MVP
This commit is contained in:
@@ -1 +1,20 @@
|
||||
Page({})
|
||||
const { listNotices } = require('../../api/noticeApi')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
loading: false,
|
||||
notices: []
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.load()
|
||||
},
|
||||
|
||||
load() {
|
||||
this.setData({ loading: true })
|
||||
listNotices()
|
||||
.then((notices) => this.setData({ notices: notices || [] }))
|
||||
.catch((error) => wx.showToast({ title: error.message, icon: 'none' }))
|
||||
.finally(() => this.setData({ loading: false }))
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1 +1,12 @@
|
||||
<view class="page">社区公告</view>
|
||||
<view class="page">
|
||||
<view class="section-title">社区公告</view>
|
||||
<view wx:for="{{notices}}" wx:key="id" class="card">
|
||||
<view class="row between">
|
||||
<view>{{item.title}}</view>
|
||||
<view wx:if="{{item.pinned}}" class="tag">置顶</view>
|
||||
</view>
|
||||
<view class="muted">{{item.category}} {{item.publishedAt}}</view>
|
||||
<view>{{item.content}}</view>
|
||||
</view>
|
||||
<view wx:if="{{!notices.length && !loading}}" class="card muted">暂无公告</view>
|
||||
</view>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
.card > view:last-child {
|
||||
margin-top: 12rpx;
|
||||
line-height: 44rpx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user