2021-12-21 19:13:37 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="AppUniMsg">
|
2021-12-22 09:28:39 +08:00
|
|
|
|
<u-tabs :list="tabList" :is-scroll="false" :current="currentTabs" height="96" bg-color="#3975C6" inactive-color="#fff" active-color="#fff" @change="change"></u-tabs>
|
|
|
|
|
|
|
2021-12-21 19:13:37 +08:00
|
|
|
|
<template v-if="datas.length > 0">
|
2021-12-21 19:15:48 +08:00
|
|
|
|
<AiCard v-for="(item, i) in datas" :key="i" @click.native="toAdd(item, 1)">
|
2021-12-21 19:13:37 +08:00
|
|
|
|
<template #custom>
|
|
|
|
|
|
<div class="titles">
|
|
|
|
|
|
{{ item.title }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2021-12-22 09:28:39 +08:00
|
|
|
|
<div class="publishUnitNames">
|
|
|
|
|
|
<span>发布部门:</span>
|
2021-12-21 19:13:37 +08:00
|
|
|
|
<span>{{ item.publishUnitName }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2021-12-22 09:28:39 +08:00
|
|
|
|
<div class="createTimes">
|
|
|
|
|
|
<span>发布时间:</span>
|
2021-12-21 19:13:37 +08:00
|
|
|
|
<span>{{ item.createTime }}</span>
|
|
|
|
|
|
</div>
|
2021-12-22 09:28:39 +08:00
|
|
|
|
|
2021-12-22 09:44:40 +08:00
|
|
|
|
<div class="imgs">
|
|
|
|
|
|
<img :src="items.url" alt="" v-for="(items, i) in item.images" :key="i" />
|
|
|
|
|
|
</div>
|
2021-12-21 19:13:37 +08:00
|
|
|
|
</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>
|
2021-12-22 09:28:39 +08:00
|
|
|
|
import { mapState } from 'vuex'
|
|
|
|
|
|
|
2021-12-21 19:13:37 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: 'AppUniMsg',
|
|
|
|
|
|
appName: '小程序公告',
|
|
|
|
|
|
components: {},
|
|
|
|
|
|
props: {},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
datas: [],
|
|
|
|
|
|
current: 1,
|
|
|
|
|
|
size: 10,
|
|
|
|
|
|
deletShow: false,
|
|
|
|
|
|
deletId: '',
|
2021-12-22 09:28:39 +08:00
|
|
|
|
tabList: [
|
|
|
|
|
|
{
|
|
|
|
|
|
name: '全部公告',
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
name: '我的发布',
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
|
|
|
|
|
currentTabs: 0,
|
2021-12-21 19:13:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
2021-12-22 09:28:39 +08:00
|
|
|
|
...mapState(['user']),
|
|
|
|
|
|
|
2021-12-21 19:13:37 +08:00
|
|
|
|
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,
|
2021-12-22 09:28:39 +08:00
|
|
|
|
createUserId: this.currentTabs == 1 ? this.user.id : '',
|
2021-12-21 19:13:37 +08:00
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
.then((res) => {
|
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
|
this.datas = this.current > 1 ? [...this.datas, ...res.data.records] : res.data.records
|
2021-12-22 09:28:39 +08:00
|
|
|
|
if (this.datas) {
|
|
|
|
|
|
this.datas.map((item) => {
|
|
|
|
|
|
if (item.images) {
|
|
|
|
|
|
item.images = JSON.parse(item.images || '[]')
|
|
|
|
|
|
}
|
|
|
|
|
|
return item
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-21 19:13:37 +08:00
|
|
|
|
this.pages = res.data.pages
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
toAdd(item, type) {
|
2021-12-21 19:15:48 +08:00
|
|
|
|
console.log(type)
|
2021-12-21 19:13:37 +08:00
|
|
|
|
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()
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-12-22 09:28:39 +08:00
|
|
|
|
|
|
|
|
|
|
change(index) {
|
|
|
|
|
|
this.currentTabs = index
|
|
|
|
|
|
this.getList()
|
|
|
|
|
|
},
|
2021-12-21 19:13:37 +08:00
|
|
|
|
},
|
|
|
|
|
|
onReachBottom() {
|
|
|
|
|
|
this.current = this.current + 1
|
|
|
|
|
|
this.getList()
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
2021-12-22 09:44:40 +08:00
|
|
|
|
uni-page-body {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
2021-12-21 19:13:37 +08:00
|
|
|
|
.AppUniMsg {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
::v-deep .AiCard {
|
|
|
|
|
|
background: #f3f6f9;
|
|
|
|
|
|
.start {
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
padding: 32px;
|
|
|
|
|
|
border-radius: 16px;
|
2021-12-22 09:28:39 +08:00
|
|
|
|
.fill {
|
|
|
|
|
|
.titles {
|
|
|
|
|
|
font-size: 30px;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
font-family: 500;
|
|
|
|
|
|
}
|
2021-12-22 09:44:40 +08:00
|
|
|
|
.imgs {
|
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
|
img {
|
|
|
|
|
|
width: 200px;
|
|
|
|
|
|
height: 200px;
|
|
|
|
|
|
margin-right: 8px;
|
|
|
|
|
|
}
|
|
|
|
|
|
img:nth-child(3n) {
|
|
|
|
|
|
margin-right: 0;
|
|
|
|
|
|
}
|
2021-12-22 09:28:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-12-21 19:13:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
.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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-22 09:44:40 +08:00
|
|
|
|
.u-load-more-wrap {
|
|
|
|
|
|
background: #f3f6f9 !important;
|
|
|
|
|
|
margin: 0 !important;
|
|
|
|
|
|
padding: 34px 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-21 19:13:37 +08:00
|
|
|
|
.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>
|