Files
dvcp_v2_wxcp_app/src/saas/AppWalkask/AppWalkask.vue
changjinpeng 354d9fffda 图片上传
2022-03-15 16:55:58 +08:00

372 lines
9.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="AppWalkask">
<template v-if="isList">
<div class="header-top">
<u-tabs :list="tabList" :is-scroll="false" :current="currentTabs" height="96" bg-color="#3975C6" inactive-color="#fff" active-color="#fff" @change="change"></u-tabs>
</div>
<div class="header-middle">
<div class="currentLeft">
<div class="currentLeft-top">
<u-search v-model="keyword" :clearabled="true" placeholder="请输入标题、对象或走访人" :show-action="false" bg-color="#1F5CAF" search-icon-color="#E2E8F1" color="#E2E8F1" height="58" @search="handerSearch" @clear="handerClear"></u-search>
</div>
<template v-if="data.length > 0">
<AiCard v-for="(item, i) in data" :key="i" @click.native="goDetail(item, 1)" :ref="item.id">
<template #custom>
<div class="cards-left">
<span class="walkName">走访对象{{ item.name }}</span>
<span class="tags" v-if="item.applicationId">{{ $dict.getLabel('appSpecialTypeFive', item.applicationId) }}</span>
<span class="tags" v-if="item.reality">{{ $dict.getLabel('realityStatus', item.reality) }}</span>
</div>
<div class="cards-hint">{{ item.title }}</div>
<div class="imgs">
<img :src="items.url" alt="" v-for="(items, i) in JSON.parse(item.images || '[]')" :key="i" @click.stop="previewImage(JSON.parse(item.images || '[]'), items.url)" v-if="i < 3" />
</div>
<div class="cards-bottom">
<span>走访人<AiOpenData v-if="item.createUserName" type="userName" :openid="item.createUserName" style="display: inline-block" /></span>
<span style="margin-left: 8px">{{ item.visitTime }}</span>
</div>
</template>
<template #menu v-if="item.createUserId == user.id">
<div class="menu" @tap.stop="toAdd(item, 2)">编辑</div>
<div class="menu" @tap.stop="toDetele(item)">删除</div>
</template>
</AiCard>
</template>
<!-- <div v-else>
<AiEmpty description="您还未添加过入户走访慰问" class="emptyWrap"></AiEmpty>
<div class="addBtns">
<span> 点击</span>
<span class="toAdds" @click="toAdd()">新增按钮</span>
<span> 试试试吧~</span>
</div>
</div> -->
<div class="empty" v-else>
<img src="https://cdn.cunwuyun.cn/dvcp/h5/no-data.png" alt="" />
<p>您还未添加过走访慰问<br />点击<span @click="toAdd()">新增按钮</span>试试吧</p>
</div>
</div>
</div>
<u-modal v-model="deletShow" content="您确认要删除该条信息吗?" :show-cancel-button="true" :mask-close-able="true" :show-title="false" @confirm="delet"></u-modal>
<div class="addBtn iconfont iconfont-iconfangda" @tap.stop="toAdd()" />
</template>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'AppWalkask',
appName: '走访慰问',
components: {},
props: {},
data() {
return {
data: [],
tabList: [
{
name: '全部',
},
{
name: '我的走访',
},
],
currentTabs: 0,
show: false,
keyword: '',
deletShow: false,
isList: true,
comp: '',
params: null,
current: 1,
areaId: '',
areaName: '',
size: 10,
deletId: '',
pages: 0,
}
},
computed: {
...mapState(['user']),
},
onLoad() {
this.areaId = this.user.areaId
this.areaName = this.user.areaName
this.$dict.load('realityStatus', 'appSpecialTypeFive').then(() => {
this.getList()
})
uni.$on('updateList', () => {
this.current = 1
this.getList()
})
},
onShow() {
document.title = '走访慰问'
},
mounted() {},
methods: {
getListInit() {
this.data = []
this.current = 1
this.getList()
},
getList() {
this.$http
.post('/app/appvisitvondolence/list', null, {
params: {
size: this.size,
current: this.current,
createUserId: this.currentTabs == 1 ? this.user.id : '',
title: this.keyword,
},
})
.then((res) => {
if (res.code == 0) {
if (this.current > res.data.pages) {
return
}
this.data = this.current > 1 ? [...this.data, ...res.data.records] : res.data.records
this.pages = res.data.pages
}
})
},
areaSelect(e) {
this.data = []
this.areaId = e
this.getListInit()
},
change(index) {
this.areaId = this.user.areaId
this.keyword = ''
this.currentTabs = index
this.getListInit()
},
goDetail(item, hint) {
if (item?.id) {
this.$refs?.[item.id]?.[0]?.handleClose()
}
if (hint == 1) {
uni.navigateTo({ url: `./detail?id=${item.id}` })
}
},
toAdd(item, hint) {
if (item?.id) {
this.$refs?.[item.id]?.[0]?.handleClose()
}
if (hint == 2) {
uni.navigateTo({ url: `./add?id=${item.id}` })
} else {
uni.navigateTo({ url: `./add` })
}
},
toDetele(item) {
this.deletShow = true
this.deletId = item.id
this.$refs?.[item.id]?.[0]?.handleClose()
},
delet() {
this.$http.post(`/app/appvisitvondolence/delete?ids=${this.deletId}`).then((res) => {
if (res.code == 0) {
this.$u.toast('删除成功!')
this.getListInit()
}
})
},
handerSearch(e) {
this.keyword = e
this.getListInit()
},
handerClear() {
this.keyword = ''
this.getListInit()
},
previewImage(images, img) {
uni.previewImage({
urls: images.map((v) => v.url),
current: img,
})
},
},
onReachBottom() {
this.current = this.current + 1
this.getList()
},
}
</script>
<style lang="scss" scoped>
uni-page-body {
height: 100%;
background: #fff;
}
.AppWalkask {
height: 100%;
.header-middle {
.currentLeft,
.currentRight {
padding-bottom: 56px;
.currentLeft-top {
display: flex;
align-items: center;
background: #3975c6;
padding: 24px 30px;
.left {
width: 40%;
display: flex;
align-items: center;
img {
width: 48px;
height: 48px;
}
}
}
.AiCard {
::v-deep .start {
border-bottom: 1px solid #dddddd;
.fill {
.cards-left {
.walkName {
font-size: 32px;
font-weight: 500;
margin-right: 16px;
color: #333;
}
.tags {
display: inline-block;
padding: 6px 16px;
background: #f3f4f7;
border-radius: 4px;
font-size: 28px;
color: #999999;
margin-left: 16px;
}
}
.cards-hint {
margin-top: 16px;
font-size: 30px;
color: #666666;
line-height: 1.4;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.imgs {
margin-top: 20px;
img {
width: 221px;
height: 221px;
margin-right: 8px;
}
img:nth-child(3n + 0) {
margin-right: 0;
}
}
.cards-bottom {
margin: 24px 0 16px 0;
font-size: 24px;
color: #999999;
}
}
}
::v-deep .mask {
.moreMenu {
.menu {
text-align: center;
line-height: 80px;
width: 192px;
height: 80px;
font-size: 28px;
font-weight: 400;
color: #333333;
}
}
}
}
.addBtns {
text-align: center;
color: #b7b7b7;
margin-top: 10px;
font-size: 28px;
.toAdds {
color: #467dfe;
}
}
}
}
.addBtn {
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%;
justify-content: center;
align-items: center;
display: flex;
position: fixed;
right: 6px;
bottom: 106px;
z-index: 9;
}
.empty {
height: 100%;
img {
width: 282px;
height: 306px;
margin: 168px 0 0 234px;
}
p {
text-align: center;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #999;
line-height: 44px;
span {
color: #467dfe;
}
}
}
}
</style>