小程序公告

This commit is contained in:
花有清香月有阴
2021-12-21 19:13:37 +08:00
parent 824ebb5987
commit 09faaeed2c
6 changed files with 457 additions and 4 deletions

View File

@@ -0,0 +1,162 @@
<template>
<div class="AppUniMsg">
<template v-if="datas.length > 0">
<AiCard v-for="(item, i) in datas" :key="i" @click="toAdd(item, 1)">
<template #custom>
<div class="titles">
{{ item.title }}
</div>
<div class="titles">
<span>发布部门</span>
<span>{{ item.publishUnitName }}</span>
</div>
<div class="titles">
<span>发布时间</span>
<span>{{ item.createTime }}</span>
</div>
</template>
<template #menu>
<div class="menu" @tap.stop="toAdd(item, 2)">编辑</div>
<div class="menu" @tap.stop="toDetele(item)">删除</div>
</template>
</AiCard>
<u-loadmore :status="loadmore" color="#999" font-size="24" margin-top="32" margin-bottom="80" />
</template>
<AiEmpty description="暂无数据" v-else></AiEmpty>
<AiFixedBtn>
<div class="addBtn iconfont iconfont-iconfangda" @tap.stop="toAdd()" />
</AiFixedBtn>
<u-modal v-model="deletShow" content="您确认要删除该条信息吗?" :show-cancel-button="true" :mask-close-able="true" :show-title="false" @confirm="delet"></u-modal>
</div>
</template>
<script>
export default {
name: 'AppUniMsg',
appName: '小程序公告',
components: {},
props: {},
data() {
return {
datas: [],
current: 1,
size: 10,
deletShow: false,
deletId: '',
}
},
computed: {
loadmore() {
return this.pages <= this.current ? 'loading ' : 'nomore'
},
},
watch: {},
onLoad() {
this.getList()
},
onShow() {},
methods: {
getList() {
this.$http
.post('/app/appmininotice/list', null, {
params: {
size: this.size,
current: this.current,
},
})
.then((res) => {
if (res.code == 0) {
this.datas = this.current > 1 ? [...this.datas, ...res.data.records] : res.data.records
this.pages = res.data.pages
}
})
},
toAdd(item, type) {
if (type == '1') {
console.log('详情')
uni.navigateTo({ url: `./Detail?id=${item.id}` })
}
if (type == '2') {
console.log('编辑')
uni.navigateTo({ url: `./Add?id=${item.id}` })
}
if (type == null) {
console.log('添加')
uni.navigateTo({ url: `./Add` })
}
},
toDetele(item) {
this.deletShow = true
this.deletId = item.id
},
delet() {
this.$http.post(`/app/appmininotice/delete?ids=${this.deletId}`).then((res) => {
if (res.code == 0) {
this.$u.toast('删除成功!')
this.getList()
}
})
},
},
onReachBottom() {
this.current = this.current + 1
this.getList()
},
}
</script>
<style scoped lang="scss">
.AppUniMsg {
height: 100%;
::v-deep .AiCard {
background: #f3f6f9;
.start {
background: #fff;
padding: 32px;
border-radius: 16px;
}
.mask {
.moreMenu {
transform: translate(-175px, 20px);
.menu {
text-align: center;
line-height: 80px;
width: 192px;
height: 80px;
font-size: 28px;
font-weight: 400;
color: #333333;
}
}
}
}
.AiFixedBtn {
.movableArea {
.addBtn {
display: flex;
justify-content: center;
align-items: center;
width: 96px;
height: 96px;
flex-shrink: 0;
background: $uni-color-primary;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
font-size: 48px;
color: #fff;
border-radius: 50%;
}
}
}
}
</style>