AiCard #custom #menu

This commit is contained in:
花有清香月有阴
2021-12-16 17:13:18 +08:00
parent 81c6e9ce04
commit c61082f72c
4 changed files with 187 additions and 154 deletions

View File

@@ -9,13 +9,13 @@
<u-form-item label="公开类型" prop="status" required style="position: relative">
<u-input v-model="forms.status" disabled placeholder="请选择公开类型" @click="showStstus = true" />
<u-select v-model="showStstus" :list="$dict.getDict('realityStatus')" value-name="dictValue" label-name="dictName" @confirm="realityStstus"></u-select>
<u-select v-model="showStstus" :list="$dict.getDict('realityStatus')" value-name="dictValue" label-name="dictName" @confirm="selectStatus"></u-select>
<u-icon name="arrow-right" color="#CCCCCC" style="position: absolute; top: 25px; right: 30px"></u-icon>
</u-form-item>
<u-form-item label="发布地区" prop="areaId" required style="position: relative">
<AiAreaPicker v-model="areaId" :areaId="areaIdProps" @select="areaSelect"></AiAreaPicker>
<AiAreaPicker v-model="forms.areaId" :areaId="areaIdProps" @select="areaSelect"></AiAreaPicker>
<u-icon name="arrow-right" color="#CCCCCC" style="position: absolute; top: 25px; right: 30px"></u-icon>
</u-form-item>
@@ -45,10 +45,11 @@ export default {
props: {},
data() {
return {
show: false,
id: '',
forms: {
title: '',
status: '',
statusValue: '',
content: '',
fileIds: [],
areaId: '',
@@ -59,43 +60,45 @@ export default {
}
},
computed: { ...mapState(['user']) },
created() {
onLoad(o) {
console.log(o)
this.id = o.id
this.areaIdProps = this.user.areaId
this.$dict.load('realityStatus').then(() => {
this.getDetail()
})
},
mounted() {},
methods: {
getDetail() {
this.$http.post(`/app/appvisitvondolence/queryDetailById?id=${this.params.id}`).then((res) => {
if (res?.data) {
this.forms = res.data
this.forms.realityValue = res.data.reality
this.forms.reality = this.$dict.getLabel('realityStatus', res.data.reality)
if (res.data.images) {
this.forms.images = JSON.parse(res.data.images || '[]')
}
}
})
},
// getDetail() {
// this.$http.post(`/app/appvisitvondolence/queryDetailById?id=${this.id}`).then((res) => {
// if (res?.data) {
// this.forms = res.data
// this.forms.statusValue = res.data.status
// this.forms.status = this.$dict.getLabel('realityStatus', res.data.status)
// if (res.data.images) {
// this.forms.images = JSON.parse(res.data.images || '[]')
// }
// }
// })
// },
submit() {
if (this.flag) return
this.$refs.uForm.validate((valid) => {
if (valid) {
if (!this.forms.create_user_name) {
return this.$u.toast('请选择走访慰问对象')
}
if (!this.forms.title) {
return this.$u.toast('请输入入户走访事项')
return this.$u.toast('请输入标题')
}
if (!this.forms.content) {
return this.$u.toast('请输入正文')
}
const imgs = []
if (this.forms.images) {
this.forms.images.map((e) => {
console.log(e)
if (this.forms.fileIds) {
this.forms.fileIds.map((e) => {
imgs.push({ url: e.url, id: e.id })
})
}
@@ -103,26 +106,19 @@ export default {
this.flag = true
this.$http
.post(`/app/appvisitvondolence/addOrUpdate`, {
areaId: this.forms.areaId,
applicationId: this.forms.applicationId,
name: this.forms.create_user_name,
optionId: this.forms.applicationId,
reality: this.forms.realityValue ? this.forms.realityValue : this.forms.reality,
title: this.forms.title,
description: this.forms.description,
createUserId: this.user.id,
createUserName: this.user.name,
images: JSON.stringify(imgs) || [],
status: this.forms.statusValue ? this.forms.statusValue : this.forms.status,
areaId: this.forms.areaId,
content: this.forms.content,
// images: JSON.stringify(imgs) || [],
images: imgs || [],
id: this.id,
})
.then((res) => {
console.log(4)
if (res.code == 0) {
console.log(5)
this.$u.toast('发布成功')
this.flag = false
uni.navigateTo({ url: `./AppWalkask` })
console.log(6)
uni.navigateTo({ url: `./AppServicePublic` })
}
})
} else {
@@ -132,24 +128,12 @@ export default {
},
areaSelect(e) {
if (e.type == 5) {
this.forms.areaId = e.id
} else {
return this.$u.toast('请选择到村')
}
},
backlist(e) {
console.log(e.item)
this.forms.create_user_name = e.item.create_user_name
this.forms.applicationId = e.appId
this.forms.optionId = e.item.id
// this.addList = true
},
realityStstus(e) {
this.forms.reality = e[0].label
this.forms.realityValue = e[0].value
selectStatus(e) {
this.forms.status = e[0].label
this.forms.statusValue = e[0].value
},
},
}

View File

@@ -8,13 +8,10 @@
<u-search class="serach_content" placeholder="请输入公开标题" :show-action="false" v-model="keyword" @clear="clearSearch" @search="search"></u-search>
<template v-if="datas.length > 0">
<u-card v-for="(item, index) in datas" :key="index" :foot-border-top="false" :head-border-bottom="false" :show-head="false" :border-radius="32" @click="goDetail(item, 1)">
<view class="body" slot="body">
<view class="u-body-item">
<AiCard v-for="(item, i) in datas" :key="i" @click.native="toAdd(item, 1)">
<template #custom>
<div class="title">{{ item.createUserName }}</div>
</view>
<view class="u-body-item">
<div class="flex">
<span class="left">
<span class="garydiv">财务公开</span>
@@ -26,9 +23,17 @@
<span>人看过</span>
</span>
</div>
</view>
</view>
</u-card>
<div class="imgs">
<!-- <img :src="items.url" alt="" v-for="(items, i) in item.images" :key="i" @click.stop="previewImage(item.images, items.url)" /> -->
</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>
@@ -38,6 +43,8 @@
<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>
@@ -57,6 +64,8 @@ export default {
current: 1,
size: 10,
pages: 0,
deletShow: false,
deletId: '',
}
},
computed: {
@@ -92,20 +101,37 @@ export default {
},
areaSelect(e) {
if (e.type == 5) {
this.areaId = e.id
} else {
return this.$u.toast('请选择到村')
}
this.getList()
},
goDetail(item) {
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` })
}
},
toAdd() {
uni.navigateTo({ url: `./Add` })
toDetele(item) {
this.deletShow = true
this.deletId = item.id
},
delet() {
this.$http.post(`/app/appvisitvondolence/delete?ids=${this.deletId}`).then((res) => {
if (res.code == 0) {
this.$u.toast('删除成功!')
this.getList()
}
})
},
},
onReachBottom() {
@@ -135,14 +161,16 @@ uni-page-body {
padding: 20px 30px;
}
.u-card {
::v-deep .u-card__body {
.body {
position: relative;
.u-body-item {
::v-deep .AiCard {
background: #f3f6f9;
.start {
background: #fff;
padding: 32px;
border-radius: 16px;
.title {
font-size: 36px;
font-size: 32px;
font-weight: 500;
color: #333333;
margin-bottom: 16px;
}
.flex {
@@ -172,6 +200,17 @@ uni-page-body {
}
}
}
.mask {
.moreMenu {
.menu {
text-align: center;
line-height: 80px;
width: 192px;
height: 80px;
font-size: 28px;
font-weight: 400;
color: #333333;
}
}
}
}

View File

@@ -25,13 +25,32 @@ export default {
components: {},
props: {},
data() {
return {}
return {
data: [],
id: '',
}
},
computed: {},
watch: {},
created() {},
onLoad(o) {
this.id = o.id
this.$dict.load('realityStatus').then(() => {
// this.getDetail()
})
},
mounted() {},
methods: {},
methods: {
getDetail() {
this.$http.post(`/app/appvisitvondolence/queryDetailById?id=${this.id}`).then((res) => {
if (res?.data) {
this.data = res.data
if (this.data.images) {
this.data.images = JSON.parse(this.data.images || '[]')
}
}
})
},
},
}
</script>

View File

@@ -4,8 +4,7 @@
<div class="header-description">
<u-form :model="forms" ref="uForm" label-width="auto">
<u-form-item label="区域选择" prop="areaId" style="position: relative">
<AiAreaPicker v-model="forms.areaId" ref="areaIds" :areaId="areaIdProps" @select="areaSelect"
style="color: #333"></AiAreaPicker>
<AiAreaPicker v-model="forms.areaId" ref="areaIds" :areaId="areaIdProps" @select="areaSelect" style="color: #333"></AiAreaPicker>
</u-form-item>
<u-form-item label="走访对象" prop="create_user_name" required style="position: relative">
@@ -17,21 +16,18 @@
<u-form-item label="现实状态" prop="reality" style="position: relative">
<u-input v-model="forms.reality" disabled placeholder="请选择走访慰问对象" @click="showStstus = true" />
<u-select v-model="showStstus" :list="$dict.getDict('realityStatus')" value-name="dictValue"
label-name="dictName" @confirm="realityStstus"></u-select>
<u-select v-model="showStstus" :list="$dict.getDict('realityStatus')" value-name="dictValue" label-name="dictName" @confirm="realityStstus"></u-select>
<u-icon name="arrow-right" color="#CCCCCC" style="position: absolute; top: 25px; right: 30px"></u-icon>
</u-form-item>
<u-form-item label="入户走访事项" prop="title" required label-position="top">
<u-input v-model="forms.title" placeholder="请输入入户走访事项(30字以内)" type="textarea" auto-height height="60"
maxlength="30"/>
<u-input v-model="forms.title" placeholder="请输入入户走访事项(30字以内)" type="textarea" auto-height height="60" maxlength="30" />
<div>{{ forms.title.length }}/30</div>
</u-form-item>
<u-form-item label="入户走访内容" prop="description" label-position="top">
<u-input v-model="forms.description" placeholder="请输入入户走访事项(500字以内)" type="textarea" auto-height height="60"
maxlength="500"/>
<u-input v-model="forms.description" placeholder="请输入入户走访事项(500字以内)" type="textarea" auto-height height="60" maxlength="500" />
<div>{{ forms.description.length }}/500</div>
</u-form-item>
@@ -106,7 +102,6 @@ export default {
},
submit() {
console.log(1)
if (this.flag) return
this.$refs.uForm.validate((valid) => {
@@ -121,7 +116,6 @@ export default {
const imgs = []
if (this.forms.images) {
this.forms.images.map((e) => {
console.log(e)
imgs.push({ url: e.url, id: e.id })
})
}
@@ -142,13 +136,10 @@ export default {
id: this.id,
})
.then((res) => {
console.log(4)
if (res.code == 0) {
console.log(5)
this.$u.toast('保存成功')
this.flag = false
uni.navigateTo({ url: `./AppWalkask` })
console.log(6)
}
})
} else {