This commit is contained in:
yanran200730
2023-03-28 17:01:52 +08:00
parent f497a3a658
commit 4e14121dbd
16 changed files with 3294 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
<template>
<div class="AppActivitiesManagement">
<keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
</template>
<script>
import List from './components/List'
import Add from './components/Add'
import Detail from './components/Detail'
export default {
name: 'AppDynamic',
label: '精选动态',
props: {
instance: Function,
dict: Object
},
data () {
return {
component: 'List',
params: {},
include: []
}
},
components: {
List,
Add,
Detail
},
methods: {
onChange (data) {
if (data.type === 'Add') {
this.component = 'Add'
this.params = data.params
}
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
}
if (data.type === 'List') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
}
}
}
}
</script>
<style lang="scss">
.AppActivitiesManagement {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,421 @@
<template>
<section class="activitiesAdd">
<ai-detail v-show="id && !isEdit">
<template slot="title">
<ai-title title="活动详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
</template>
<template slot="content">
<ai-card :title="info.title">
<template #right>
<span style="color:#2266FF;cursor: pointer;font-size: 12px;" class="iconfont iconEdit" v-if="isEdit==false && info.status==0" @click="update">修改</span>
</template>
<template #content v-if="isEdit == false">
<ai-wrapper>
<ai-info-item label="活动名称" :value="info.title"></ai-info-item>
<ai-info-item label="创建人" :value="info.createUserName"></ai-info-item>
<ai-info-item label="活动说明" isLine :value="info.detail"></ai-info-item>
<ai-info-item label="活动地点" :value="info.address"></ai-info-item>
<ai-info-item label="标绘地址" isLine><div id="mapDetail"></div></ai-info-item>
<ai-info-item label="活动状态">
{{ dict.getLabel('tfx_activityStatus',info.status) }}
</ai-info-item>
<ai-info-item label="打卡范围">{{ info.clockRange }}</ai-info-item>
<ai-info-item label="进场打卡时间">{{ info.intoBegintime }}{{ info.intoEndtime}}</ai-info-item>
<ai-info-item label="进场得积分">{{ info.intoIntegral }}</ai-info-item>
<ai-info-item label="离场打卡时间">{{ info.exitBegintime }}{{ info.exitEndtime}}</ai-info-item>
<ai-info-item label="离场得积分">{{ info.exitIntegral }}</ai-info-item>
</ai-wrapper>
</template>
</ai-card>
</template>
</ai-detail>
<ai-detail v-show="!id || isEdit==true">
<ai-title slot="title" :title="id? '编辑活动':'创建活动'" isShowBottomBorder isShowBack @onBackClick="cancel(true)"/>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<div class="add-form">
<el-form ref="form" :model="form" :rules="formRules" size="small" label-width="150px">
<el-form-item label="活动名称" prop="title">
<el-input v-model="form.title" placeholder="请输入" show-word-limit maxlength="64"></el-input>
</el-form-item>
<el-form-item label="活动说明">
<el-input type="textarea" :rows="5" v-model="form.detail" placeholder="请输入" show-word-limit maxlength="500"></el-input>
</el-form-item>
<el-form-item style="width: 100%" label="地理位置" prop="location">
<el-button @click="showMap = true">地图标绘</el-button>
</el-form-item>
<el-form-item label="标绘地址">
<el-input v-model="form.address" disabled ></el-input>
</el-form-item>
<el-form-item label="打卡范围" prop="clockRange" style="width: 550px">
<el-input type="number" v-model="form.clockRange" placeholder="请输入" >
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="进场打卡时间" prop="intoTime">
<el-date-picker v-model="form.intoTime" type="datetimerange" start-placeholder="开始日期" :picker-options="timeOption"
end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" ></el-date-picker>
</el-form-item>
<el-form-item label="进场得积分" prop="intoIntegral" style="width: 550px">
<el-input v-model="form.intoIntegral" type="number" placeholder="请输入" >
<template slot="append">积分</template>
</el-input>
</el-form-item>
<el-form-item label="离场打卡时间" prop="exitTime">
<el-date-picker v-model="form.exitTime" type="datetimerange" start-placeholder="开始日期" :picker-options="timeOption"
end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
</el-form-item>
<el-form-item label="离场得积分" prop="exitIntegral" style="width: 550px">
<el-input v-model="form.exitIntegral" type="number" placeholder="请输入" >
<template slot="append">积分</template>
</el-input>
</el-form-item>
</el-form>
</div>
</template>
</ai-card>
</template>
<template #footer>
<el-button class="delete-btn footer-btn" @click="cancel(false)">取消</el-button>
<el-button class="footer-btn" type="primary" @click="confirm()">保存</el-button>
</template>
</ai-detail>
<ai-dialog title="地图" :visible.sync="showMap" @opened="initMap" width="800px" class="mapDialog" @onConfirm="selectMap">
<div id="map"></div>
<el-form label-width="80px" style="padding: 10px 20px 0 20px;">
<el-row type="flex" justify="space-between">
<el-form-item label="经度">
<el-input disabled size="small" v-model="placeDetail.lng"></el-input>
</el-form-item>
<el-form-item label="纬度">
<el-input disabled size="small" v-model="placeDetail.lat"></el-input>
</el-form-item>
</el-row>
</el-form>
<el-input id="searchPlaceInput" size="medium" class="searchPlaceInput" clearable v-model="searchPlace" autocomplete="on" @change="placeSearch.search(searchPlace)" placeholder="请输入关键字">
<el-button type="primary" slot="append" @click="placeSearch.search(searchPlace)">搜索</el-button>
</el-input>
<div id="searchPlaceOutput" />
</ai-dialog>
</section>
</template>
<script>
import AMapLoader from '@amap/amap-jsapi-loader'
export default {
props: {
instance: Function,
dict: Object,
params: Object,
},
data() {
var validLocation = (rule, value, callback) => {
if(!this.form.lat || !this.form.lng) {
return callback(new Error('请标绘地理位置'))
} else {
callback()
}
}
return {
form: {
title: '',
detail: '',
lng: '',
lat: '',
address: '',
clockRange: '',
intoTime: [],
intoBegintime: '',
intoEndtime: '',
intoIntegral: '',
exitTime: [],
exitBegintime: '',
exitEndtime: '',
exitIntegral: '',
},
formRules: {
title: [{required: true, message: "请输入活动名称", trigger: "blur"}],
location: [{required: true, validator: validLocation, trigger: "blur"}],
clockRange: [{required: true, message: "请输入打卡范围", trigger: "blur"}],
intoTime: [{required: true, message: "请选择进场打卡时间", trigger: "blur"}],
intoIntegral: [{required: true, message: "请输入进场得积分", trigger: "blur"}],
exitTime: [{required: true, message: "请选择离场打卡时间", trigger: "blur"}],
exitIntegral: [{required: true, message: "请输入离场得积分", trigger: "blur"}],
},
id: '',
isEdit: false,
info: {},
mapDetail: null,
map: null,
placeSearch: null,
placeDetail: {
lng: '',
lat: '',
address: ''
},
showMap: false,
searchPlace: '',
timeOption: {
disabledDate(date) {
return date.getTime() < Date.now() - 24 * 60 * 60 * 1000
}
},
}
},
created() {
this.$dict.load('tfx_activityStatus')
if(this.params && this.params.id) {
this.id = this.params.id
this.getDetail()
setTimeout(() => {
},500)
}
},
watch: {
'form.intoTime': {
handler(val) {
if(val) {
this.form.intoBegintime = val[0]
this.form.intoEndtime = val[1]
}
}
},
'form.exitTime': {
handler(val) {
if(val) {
this.form.exitBegintime = val[0]
this.form.exitEndtime = val[1]
}
}
}
},
methods: {
selectMap() {
this.form.lng = this.placeDetail.lng
this.form.lat = this.placeDetail.lat
this.form.address = this.placeDetail.address
this.showMap = false
},
initMap() {
AMapLoader.load({
key: '54a02a43d9828a8f9cd4f26fe281e74e',
version: '2.0',
plugins: ['AMap.PlaceSearch', 'AMap.AutoComplete', 'AMap.Geocoder'],
}).then((AMap) => {
this.map = new AMap.Map('map', {
resizeEnable: true,
zooms: [6, 20],
center:[104.067923463,30.6799428454],
zoom: 11,
})
this.placeSearch = new AMap.PlaceSearch({ map: this.map })
new AMap.AutoComplete({
input: 'searchPlaceInput',
output: 'searchPlaceOutput',
}).on('select', (e) => {
if (e?.poi) {
this.placeSearch.setCity(e.poi.adcode)
this.movePosition(e.poi.location)
}
})
this.map.on('click', (e) => {
new AMap.Geocoder().getAddress(e.lnglat, (sta, res) => {
if (res?.regeocode) {
this.placeDetail = {
lng: e.lnglat?.lng,
lat: e.lnglat?.lat,
address: res.regeocode.formattedAddress,
}
}
})
this.movePosition(e.lnglat)
})
})
},
movePosition(center) {
if (this.map) {
this.map.clearMap()
this.map.panTo(center)
this.map.add([
new AMap.Marker({
position: center,
clickable: true,
}),
])
this.map.setFitView()
}
},
cancel (isRefresh) {
this.$emit('change', {
type: 'activitiesList',
isRefresh: !!isRefresh
})
},
getMap(lng,lat,address) {
AMapLoader.load({
key: '54a02a43d9828a8f9cd4f26fe281e74e',
version: '2.0',
plugins: ['AMap.PlaceSearch', 'AMap.AutoComplete', 'AMap.Geocoder'],
}).then((AMap) => {
this.mapDetail = new AMap.Map(document.getElementById("mapDetail"), {
resizeEnable: true,
zooms: [6, 20],
center:[104.067923463,30.6799428454],
zoom: 11,
})
let marker = new AMap.Marker({
position: new AMap.LngLat(lng,lat),
title: address
})
this.mapDetail.add(marker);
})
},
update() {
this.isEdit = true
this.getDetail()
},
getDetail() {
this.instance.post(`api/appactivityinfo/queryDetailById`,null, {
params: {id:this.id}
}).then((res) => {
if(res?.data) {
this.form = res.data
this.form.intoTime = [res.data.intoBegintime,res.data.intoEndtime]
this.form.exitTime = [res.data.exitBegintime,res.data.exitEndtime]
this.info = res.data
this.placeDetail.lng = res.data.lng
this.placeDetail.lat = res.data.lat
this.getMap(this.info.lng,this.info.lat,this.info.address)
}
})
},
selectCandidate(v) {
this.form.candidateUsers = v
},
selectVote(e) {
this.form.voteUsers = e
},
handleAreaSelect(v) {
this.form.areaName = v?.[0]?.label
},
confirm() {
this.$refs.form.validate((valid) => {
if (valid) {
if(new Date(this.form.intoBegintime).getTime() <= Date.now()){
return this.$message.error('进场打卡开始时间不能小于当前时间')
}
let intoEnd = new Date(this.form.intoEndtime).getTime()
let exitBegin = new Date(this.form.exitBegintime).getTime()
if(exitBegin <= intoEnd) {
return this.$message.error('离场的开始时间不能小于且等于进场的结束时间')
}
this.instance.post(`api/appactivityinfo/addOrUpdate`,{
...this.form
}).then(res => {
if(res.code == 0) {
this.$message.success(this.id ? '编辑成功' : '新增成功')
this.cancel(true)
}
}).catch(err => {
console.log(err);
})
}
})
},
},
}
</script>
<style lang="scss" scope>
.activitiesAdd {
height: 100%;
:deep( .amap-logo ){
display: none!important;
}
:deep( .amap-copyright ){
display: none!important;
}
:deep( .el-date-editor .el-input ){
width: 100%;
}
.tips {
width: 100%;
border: 1px solid #f82;
background-color: #fff3e9;
color: #f82;
padding: 8px 16px;
box-sizing: border-box;
border-radius: 4px;
margin-bottom: 32px;
font-size: 13px;
}
.amap-container {
height: 380px;
}
}
.mapDialog {
.el-dialog__body {
padding: 0;
.ai-dialog__content {
padding: 0;
}
.ai-dialog__content--wrapper {
padding: 0 !important;
position: relative;
}
}
#map {
width: 100%;
height: 420px;
}
.searchPlaceInput {
position: absolute;
width: 250px;
top: 30px;
left: 25px;
}
#searchPlaceOutput {
position: absolute;
width: 250px;
left: 25px;
height: initial;
top: 80px;
background: white;
z-index: 250;
max-height: 300px;
overflow-y: auto;
.auto-item {
text-align: left;
font-size: 14px;
padding: 8px;
box-sizing: border-box;
}
}
}
</style>

View File

@@ -0,0 +1,294 @@
<template>
<ai-detail class="detail">
<template slot="title">
<ai-title title="帖子详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="帖子信息">
<template #content>
<div class="talk-info">
<div class="user">
<img :src="info.createUserAvatar" alt="">
<div class="info">
<h2>{{info.createUserName}}</h2>
<div class="time-flex">
<span class="area-name">{{info.publishDepartName}}</span>
<span>{{info.createTime}}</span>
</div>
</div>
</div>
<div class="content">
<span v-if="info.themeId">#{{info.themeInfo.title}}</span>{{info.content}}
</div>
<ai-uploader :instance="instance" disabled v-model="info.files">
</ai-uploader>
</div>
</template>
</ai-card>
<ai-card title="评论信息">
<template #content>
<div class="comment-list" v-if="commontList.length">
<div class="title">评论</div>
<div class="item" v-for="(item, index) in commontList" :key="index">
<div class="user">
<img :src="item.createUserAvatar" alt="">
<div class="info-flex">
<h2>{{item.createUserName}}</h2>
<span>{{item.createTime}}</span>
</div>
</div>
<div class="content-flex">
<p>{{item.content}}</p>
<div @click="delCommontOrReply('评论', item.id)">删除</div>
</div>
<div class="reply-list" v-if="item.replyList && item.replyList.length && item.isShowReply">
<div class="reply-item" v-for="(reply, indexs) in item.replyList" :key="indexs">
<div class="reply-user">
<img :src="item.createUserAvatar" alt="">
<div class="reply-name">
<span>{{reply.createUserName}}</span>回复<span>{{item.createUserName}}</span>
</div>
<span class="reply-time">{{reply.createTime}}</span>
</div>
<div class="content-flex">
<p>{{reply.content}}</p>
<div @click="delCommontOrReply('回复', reply.id)">删除</div>
</div>
</div>
</div>
<div class="reply-more" @click="item.isShowReply = !item.isShowReply" :class="[item.isShowReply ? 'active' : '']">
<span class="line"></span>{{item.isShowReply ? '收起' : `展开${item.replyList.length}条回复`}}
<i class="el-icon-arrow-down"></i>
</div>
</div>
</div>
<ai-empty v-else>暂无评论</ai-empty>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
commontList: [],
info: {},
}
},
computed: {
getAvatar(row){
return row.avatar||row.photo||'https://cdn.cunwuyun.cn/dvcp/h5/defaultAvatar.png'
}
},
created () {
this.getInfo()
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appneighborhoodassistance/commontList?id=${this.params.id}&size=100`).then(res => {
if (res.code == 0) {
res.data.records.map((item) => {
item.isShowReply = false
})
this.commontList = res.data.records
}
})
},
getInfo () {
this.instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${this.params.id}`).then(res => {
if (res.code == 0) {
if (res.data) {
this.info = res.data
}
}
})
},
cancel () {
this.$emit('change', {
type: 'List',
isRefresh: true
})
},
delCommontOrReply(text, id) {
this.$confirm(`确定删除该${text}`).then(() => {
this.instance.post(`/app/appneighborhoodassistance/delComment?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
}
}
</script>
<style scoped lang="scss">
.detail {
.talk-info {
.user {
display: flex;
margin-bottom: 8px;
img {
width: 60px;
height: 60px;
margin-right: 16px;
border-radius: 50%;
}
.info {
width: calc(100% - 76px);
h2 {
font-size: 20px;
line-height: 30px;
font-weight: 400;
}
.time-flex {
display: flex;
justify-content: space-between;
color: #999;
font-size: 14px;
line-height: 30px;
.area-name {
color: #666;
}
}
}
}
.content {
font-size: 16px;
line-height: 32px;
word-break: break-all;
span {
color: #26f;
}
}
}
.comment-list {
.title {
color: #333;
font-size: 16px;
font-weight: 700;
line-height: 40px;
margin-bottom: 8px;
}
.item {
border-bottom: 1px solid #ddd;
padding-bottom: 16px;
.user {
display: flex;
margin-bottom: 8px;
img {
width: 60px;
height: 60px;
margin-right: 16px;
border-radius: 50%;
}
.info-flex {
width: calc(100% - 76px);
display: flex;
justify-content: space-between;
line-height: 60px;
h2 {
font-size: 20px;
font-weight: 400;
}
span {
color: #999;
font-size: 14px;
}
}
}
.content-flex {
display: flex;
font-size: 16px;
line-height: 30px;
margin-bottom: 8px;
padding-left: 76px;
p {
width: calc(100% - 50px);
word-break: break-all;
}
div {
color: #26f;
width: 50px;
text-align: right;
cursor: pointer;
}
}
.reply-list {
padding-left: 100px;
.reply-item {
margin-bottom: 8px;
.reply-user {
font-size: 14px;
img {
width: 50px;
height: 50px;
border-radius: 50%;
vertical-align: middle;
}
.reply-name {
display: inline-block;
color: #333;
width: 300px;
span {
display: inline-block;
color: #666;
margin: 0 8px;
}
}
.reply-time {
color: #999;
}
}
.content-flex {
font-size: 14px;
line-height: 24px;
padding-left: 58px;
}
}
}
.reply-more {
font-size: 14px;
line-height: 28px;
color: #333;
.line {
display: inline-block;
width: 120px;
border-top: 1px solid #eee;
vertical-align: middle;
margin-right: 8px;
}
.el-icon-arrow-down {
transition: all ease 0.5s;
transform: rotate(0);
margin-left: 8px;
}
&.active .el-icon-arrow-down {
transform: rotate(180deg);
}
}
}
}
}
</style>

View File

@@ -0,0 +1,140 @@
<template>
<ai-list class="activitiesList">
<ai-title slot="title" title="精选动态" isShowBottomBorder />
<template #content>
<ai-search-bar>
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')" >创建活动</el-button>
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :total="page.total" :current.sync="page.current"
:size.sync="page.size" @getList="getList" :col-configs="colConfigs" :dict="dict">
<el-table-column slot="qrcode" width="200px" label="二维码" align="center">
<template slot-scope="{ row }">
<div class="qrcode">
<el-button type="text" @click="qrcode(row.qrCode, row.id)">{{ row.qrCode ? '预览' : '生成' }}</el-button>
</div>
</template>
</el-table-column>
<el-table-column slot="options" label="操作" fixed="right" align="center">
<template slot-scope="{ row }">
<el-button type="text" @click.native="toAdd(row.id)">详情</el-button>
<el-button type="text" :disabled="row.status ==2" @click.native="stopBtn(row.id)">结束</el-button>
<el-button type="text" @click.native="handleDelete(row.id)">删除</el-button>
</template>
</el-table-column>
</ai-table>
<div class="qrCode" v-viewer="{movable: true}" v-show="false">
<img :src="img">
</div>
</template>
</ai-list>
</template>
<script>
export default {
props: {
instance: Function,
dict: Object
},
data () {
return {
page: {
current: 1,
size: 10,
total: 0,
},
tableData: [],
img: '',
isLoading: false,
}
},
created () {
this.$dict.load('tfx_activityStatus').then(()=> {
this.getList()
})
},
computed: {
colConfigs() {
return [
{prop: "title", label: "活动名称", align: "left", showOverflowTooltip: true},
{prop: "createUserName", label: "创建人", align: "center"},
{prop: "intoBegintime", label: "开始结束时间", align: "center", width: "400px", render: (h, {row}) => h('p',{textAlign:'center'},
`${row.intoBegintime}${row.exitEndtime}`)},
{prop: "status", label: "活动状态", align: "center", dict:"tfx_activityStatus"},
{ slot: "qrcode"},
{ slot: "options", },
]
}
},
methods: {
getList() {
this.instance.post(`api/appactivityinfo/list`,null, {
params: {
...this.page,
}
}).then(res=> {
if(res?.data) {
this.tableData = res.data.records
this.page.total = res.data.total
}
})
},
toAdd(id) {
this.$emit('change', {
type: 'activitiesAdd',
params: {
id: id || '',
}
})
},
qrcode (qrcode, id) {
if (!qrcode) {
this.isLoading = true
this.instance.post(`api/appactivityinfo/generateQrCode?id=${id}&width=400&height=400`).then(res => {
if (res.code == 0) {
this.$message.success('二维码生成成功!')
this.getList()
}
this.isLoading = false
})
} else {
this.img = qrcode
this.$nextTick(() => {
setTimeout(() => {
const viewer = this.$el.querySelector('.qrCode').$viewer
viewer.view()
}, 600)
})
}
},
handleDelete(id) {
this.$confirm('确定删除该活动?').then(() => {
this.instance.post(`api/appactivityinfo/delete?ids=${id}`).then(res=>{
if(res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
// 结束
stopBtn(id) {
this.$confirm('确定要结束该活动吗?').then(() => {
this.instance.post(`api/appactivityinfo/stop?id=${id}`).then(res=>{
if(res.code == 0) {
this.$message.success('结束成功!')
this.getList()
}
})
})
},
}
}
</script>
<style lang="scss" scoped>
.activitiesList {
height: 100%;
}
</style>

View File

@@ -0,0 +1,70 @@
<template>
<div class="AppHelp">
<keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
</template>
<script>
import Detail from './components/Detail'
import List from './components/List'
import Add from './components/Add'
export default {
name: 'AppIntegratingAudit',
label: '积分审核',
props: {
instance: Function,
dict: Object
},
data () {
return {
component: 'List',
params: {},
include: []
}
},
components: {
Add,
List,
Detail
},
methods: {
onChange (data) {
if (data.type === 'Add') {
this.component = 'Add'
this.params = data.params
}
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
}
if (data.type === 'List') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
}
}
}
}
</script>
<style lang="scss">
.AppHelp {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,168 @@
<template>
<ai-detail class="content-add">
<template slot="title">
<ai-title :title="params.id ? '编辑帖子' : '我要发帖'" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="发帖信息">
<template #content>
<el-form class="ai-form" :model="form" label-width="120px" ref="form">
<el-form-item label="发布单位" prop="publishDepartName" style="width: 100%;" :rules="[{ required: true, message: '请选择单位', trigger: 'change' }]">
<ai-picker :instance="instance" multiple @pick="e => onUserChange(e)" dialogTitle="选择部门" action="/app/wxcp/wxdepartment/departList">
<div class="time-select">
<span class="dept-name" style="color:#999;" v-if="!form.publishDepartName">选择部门</span>
<span class="dept-name" v-else>{{form.publishDepartName}}</span>
<i class="el-icon-arrow-down"></i>
</div>
</ai-picker>
</el-form-item>
<el-form-item label="发布内容" prop="content" style="width: 100%;" :rules="[{required: true, message: '请输入发布内容', trigger: 'change'}]">
<!-- <ai-editor v-model="form.content" :instance="instance"/> -->
<el-input type="textarea" placeholder="请输入内容" v-model="form.content" rows="8" maxlength="500" :show-word-limit="true"></el-input>
</el-form-item>
<el-form-item label="图片" prop="files" style="width: 100%;">
<ai-uploader
:instance="instance"
v-model="form.files"
isShowTip
:limit="9">
</ai-uploader>
</el-form-item>
<el-form-item prop="themeId" style="width: 100%;" label="关联话题">
<ai-select v-model="form.themeId" :selectList="talkList" placeholder="请选择关联话题" />
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template #footer>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="confirm">提交</el-button>
</template>
</ai-detail>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'Add',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
form: {
themeId: '',
content: '',
files: [],
publishDepartName: '',
publishDepartIdList: [],
},
id: '',
department: [],
talkList: [],
isFlag: false
}
},
computed: {
...mapState(['user'])
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
this.getTalkList()
},
methods: {
getInfo (id) {
this.instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
this.form.publishDepartIdList = this.form.publishDepartId.split(',')
}
})
},
confirm () {
if(this.isFlag) return
this.$refs.form.validate((valid) => {
if (valid) {
this.isFlag = true
this.instance.post(`/app/appneighborhoodassistance/addOrUpdate`, {
...this.form,
publishDepartId: this.form.publishDepartIdList.join(',')
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 600)
}
})
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
},
onChange (e) {
if (e.length) {
this.form.publishDepartIdList = e.map(v => v.id)
this.form.publishDepartName = e.map(v => v.name).join(',')
} else {
this.form.publishDepartIdList = ''
this.form.publishDepartName = ''
}
},
onUserChange (e) {
this.deptList = e
this.onChange(e)
},
getTalkList() {
this.instance.post(`/app/appneighborhoodassistancetheme/list?size=100`).then(res => {
if (res.code == 0) {
this.talkList = []
res.data.records.map((item) => {
this.talkList.push({
dictName: item.title,
dictValue: item.id
})
})
}
})
},
}
}
</script>
<style scoped lang="scss">
.time-select {
padding: 0 16px;
height: 36px;
line-height: 36px;
border: 1px solid #d0d4dc;
border-radius: 4px;
display: flex;
justify-content: space-between;
cursor: pointer;
.el-icon-arrow-down {
line-height: 36px;
}
}
</style>

View File

@@ -0,0 +1,294 @@
<template>
<ai-detail class="detail">
<template slot="title">
<ai-title title="帖子详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="帖子信息">
<template #content>
<div class="talk-info">
<div class="user">
<img :src="info.createUserAvatar" alt="">
<div class="info">
<h2>{{info.createUserName}}</h2>
<div class="time-flex">
<span class="area-name">{{info.publishDepartName}}</span>
<span>{{info.createTime}}</span>
</div>
</div>
</div>
<div class="content">
<span v-if="info.themeId">#{{info.themeInfo.title}}</span>{{info.content}}
</div>
<ai-uploader :instance="instance" disabled v-model="info.files">
</ai-uploader>
</div>
</template>
</ai-card>
<ai-card title="评论信息">
<template #content>
<div class="comment-list" v-if="commontList.length">
<div class="title">评论</div>
<div class="item" v-for="(item, index) in commontList" :key="index">
<div class="user">
<img :src="item.createUserAvatar" alt="">
<div class="info-flex">
<h2>{{item.createUserName}}</h2>
<span>{{item.createTime}}</span>
</div>
</div>
<div class="content-flex">
<p>{{item.content}}</p>
<div @click="delCommontOrReply('评论', item.id)">删除</div>
</div>
<div class="reply-list" v-if="item.replyList && item.replyList.length && item.isShowReply">
<div class="reply-item" v-for="(reply, indexs) in item.replyList" :key="indexs">
<div class="reply-user">
<img :src="item.createUserAvatar" alt="">
<div class="reply-name">
<span>{{reply.createUserName}}</span>回复<span>{{item.createUserName}}</span>
</div>
<span class="reply-time">{{reply.createTime}}</span>
</div>
<div class="content-flex">
<p>{{reply.content}}</p>
<div @click="delCommontOrReply('回复', reply.id)">删除</div>
</div>
</div>
</div>
<div class="reply-more" @click="item.isShowReply = !item.isShowReply" :class="[item.isShowReply ? 'active' : '']">
<span class="line"></span>{{item.isShowReply ? '收起' : `展开${item.replyList.length}条回复`}}
<i class="el-icon-arrow-down"></i>
</div>
</div>
</div>
<ai-empty v-else>暂无评论</ai-empty>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
commontList: [],
info: {},
}
},
computed: {
getAvatar(row){
return row.avatar||row.photo||'https://cdn.cunwuyun.cn/dvcp/h5/defaultAvatar.png'
}
},
created () {
this.getInfo()
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appneighborhoodassistance/commontList?id=${this.params.id}&size=100`).then(res => {
if (res.code == 0) {
res.data.records.map((item) => {
item.isShowReply = false
})
this.commontList = res.data.records
}
})
},
getInfo () {
this.instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${this.params.id}`).then(res => {
if (res.code == 0) {
if (res.data) {
this.info = res.data
}
}
})
},
cancel () {
this.$emit('change', {
type: 'List',
isRefresh: true
})
},
delCommontOrReply(text, id) {
this.$confirm(`确定删除该${text}`).then(() => {
this.instance.post(`/app/appneighborhoodassistance/delComment?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
}
}
</script>
<style scoped lang="scss">
.detail {
.talk-info {
.user {
display: flex;
margin-bottom: 8px;
img {
width: 60px;
height: 60px;
margin-right: 16px;
border-radius: 50%;
}
.info {
width: calc(100% - 76px);
h2 {
font-size: 20px;
line-height: 30px;
font-weight: 400;
}
.time-flex {
display: flex;
justify-content: space-between;
color: #999;
font-size: 14px;
line-height: 30px;
.area-name {
color: #666;
}
}
}
}
.content {
font-size: 16px;
line-height: 32px;
word-break: break-all;
span {
color: #26f;
}
}
}
.comment-list {
.title {
color: #333;
font-size: 16px;
font-weight: 700;
line-height: 40px;
margin-bottom: 8px;
}
.item {
border-bottom: 1px solid #ddd;
padding-bottom: 16px;
.user {
display: flex;
margin-bottom: 8px;
img {
width: 60px;
height: 60px;
margin-right: 16px;
border-radius: 50%;
}
.info-flex {
width: calc(100% - 76px);
display: flex;
justify-content: space-between;
line-height: 60px;
h2 {
font-size: 20px;
font-weight: 400;
}
span {
color: #999;
font-size: 14px;
}
}
}
.content-flex {
display: flex;
font-size: 16px;
line-height: 30px;
margin-bottom: 8px;
padding-left: 76px;
p {
width: calc(100% - 50px);
word-break: break-all;
}
div {
color: #26f;
width: 50px;
text-align: right;
cursor: pointer;
}
}
.reply-list {
padding-left: 100px;
.reply-item {
margin-bottom: 8px;
.reply-user {
font-size: 14px;
img {
width: 50px;
height: 50px;
border-radius: 50%;
vertical-align: middle;
}
.reply-name {
display: inline-block;
color: #333;
width: 300px;
span {
display: inline-block;
color: #666;
margin: 0 8px;
}
}
.reply-time {
color: #999;
}
}
.content-flex {
font-size: 14px;
line-height: 24px;
padding-left: 58px;
}
}
}
.reply-more {
font-size: 14px;
line-height: 28px;
color: #333;
.line {
display: inline-block;
width: 120px;
border-top: 1px solid #eee;
vertical-align: middle;
margin-right: 8px;
}
.el-icon-arrow-down {
transition: all ease 0.5s;
transform: rotate(0);
margin-left: 8px;
}
&.active .el-icon-arrow-down {
transform: rotate(180deg);
}
}
}
}
}
</style>

View File

@@ -0,0 +1,159 @@
<template>
<ai-list class="notice">
<template slot="title">
<ai-title title="积分审核" isShowBottomBorder isShowArea :hideLevel="hideLevel-1" v-model="search.areaId" @change="changeArea">
</ai-title>
</template>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">我要发帖</el-button>
<el-date-picker
v-model="dateList"
@change="search.current = 1,getList()"
type="daterange"
size="small"
value-format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</template>
<template #right>
<el-input
v-model="search.createUserName"
class="search-input"
size="small"
v-throttle="() => {search.current = 1, getList()}"
placeholder="请输入发帖人"
clearable
@clear="search.current = 1, search.createUserName = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 6px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="options" width="180px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'List',
props: {
instance: Function,
dict: Object
},
data () {
return {
search: {
current: 1,
size: 10,
createUserName: '',
areaId: ''
},
total: 10,
colConfigs: [
{ prop: 'content', label: '内容', align: 'left', 'show-overflow-tooltip': true },
{ prop: 'commentCount', label: '评论数', align: 'center', width: '120' },
{ prop: 'appreciateCount', label: '点赞数', align: 'center', width: '120' },
{ prop: 'sharedCount', label: '分享数', align: 'center', width: '120' },
{ prop: 'createUserName', label: '发帖人', align: 'center', width: '120' },
{ prop: 'createUserAreaName', label: '所在地区', align: 'center', width: '120' },
{ prop: 'createTime', label: '创建时间', align: 'center', width: '180' },
{ slot: 'options'},
],
tableData: [],
dateList: [],
}
},
computed: {
...mapState(['user']),
hideLevel() {
return this.user.info.areaList?.length || 0
},
},
created() {
this.search.areaId = this.user.info.areaId
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appneighborhoodassistance/list`, null, {
params: {
...this.search,
createUserAreaId: this.search.areaId,
beginDate: this.dateList[0] || '',
endDate: this.dateList[1] || '',
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
changeArea () {
this.search.current = 1
this.$nextTick(() => {
this.getList()
})
},
remove (id) {
this.$confirm('确定删除该帖子?').then(() => {
this.instance.post(`/app/appneighborhoodassistance/delete?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toDetail (id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,70 @@
<template>
<div class="AppHelp">
<keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
</template>
<script>
import Detail from './components/Detail'
import List from './components/List'
import Add from './components/Add'
export default {
name: 'AppIntegratingRules',
label: '积分规则',
props: {
instance: Function,
dict: Object
},
data () {
return {
component: 'List',
params: {},
include: []
}
},
components: {
Add,
List,
Detail
},
methods: {
onChange (data) {
if (data.type === 'Add') {
this.component = 'Add'
this.params = data.params
}
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
}
if (data.type === 'List') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
}
}
}
}
</script>
<style lang="scss">
.AppHelp {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,168 @@
<template>
<ai-detail class="content-add">
<template slot="title">
<ai-title :title="params.id ? '编辑帖子' : '我要发帖'" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="发帖信息">
<template #content>
<el-form class="ai-form" :model="form" label-width="120px" ref="form">
<el-form-item label="发布单位" prop="publishDepartName" style="width: 100%;" :rules="[{ required: true, message: '请选择单位', trigger: 'change' }]">
<ai-picker :instance="instance" multiple @pick="e => onUserChange(e)" dialogTitle="选择部门" action="/app/wxcp/wxdepartment/departList">
<div class="time-select">
<span class="dept-name" style="color:#999;" v-if="!form.publishDepartName">选择部门</span>
<span class="dept-name" v-else>{{form.publishDepartName}}</span>
<i class="el-icon-arrow-down"></i>
</div>
</ai-picker>
</el-form-item>
<el-form-item label="发布内容" prop="content" style="width: 100%;" :rules="[{required: true, message: '请输入发布内容', trigger: 'change'}]">
<!-- <ai-editor v-model="form.content" :instance="instance"/> -->
<el-input type="textarea" placeholder="请输入内容" v-model="form.content" rows="8" maxlength="500" :show-word-limit="true"></el-input>
</el-form-item>
<el-form-item label="图片" prop="files" style="width: 100%;">
<ai-uploader
:instance="instance"
v-model="form.files"
isShowTip
:limit="9">
</ai-uploader>
</el-form-item>
<el-form-item prop="themeId" style="width: 100%;" label="关联话题">
<ai-select v-model="form.themeId" :selectList="talkList" placeholder="请选择关联话题" />
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template #footer>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="confirm">提交</el-button>
</template>
</ai-detail>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'Add',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
form: {
themeId: '',
content: '',
files: [],
publishDepartName: '',
publishDepartIdList: [],
},
id: '',
department: [],
talkList: [],
isFlag: false
}
},
computed: {
...mapState(['user'])
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
this.getTalkList()
},
methods: {
getInfo (id) {
this.instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
this.form.publishDepartIdList = this.form.publishDepartId.split(',')
}
})
},
confirm () {
if(this.isFlag) return
this.$refs.form.validate((valid) => {
if (valid) {
this.isFlag = true
this.instance.post(`/app/appneighborhoodassistance/addOrUpdate`, {
...this.form,
publishDepartId: this.form.publishDepartIdList.join(',')
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 600)
}
})
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
},
onChange (e) {
if (e.length) {
this.form.publishDepartIdList = e.map(v => v.id)
this.form.publishDepartName = e.map(v => v.name).join(',')
} else {
this.form.publishDepartIdList = ''
this.form.publishDepartName = ''
}
},
onUserChange (e) {
this.deptList = e
this.onChange(e)
},
getTalkList() {
this.instance.post(`/app/appneighborhoodassistancetheme/list?size=100`).then(res => {
if (res.code == 0) {
this.talkList = []
res.data.records.map((item) => {
this.talkList.push({
dictName: item.title,
dictValue: item.id
})
})
}
})
},
}
}
</script>
<style scoped lang="scss">
.time-select {
padding: 0 16px;
height: 36px;
line-height: 36px;
border: 1px solid #d0d4dc;
border-radius: 4px;
display: flex;
justify-content: space-between;
cursor: pointer;
.el-icon-arrow-down {
line-height: 36px;
}
}
</style>

View File

@@ -0,0 +1,294 @@
<template>
<ai-detail class="detail">
<template slot="title">
<ai-title title="帖子详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="帖子信息">
<template #content>
<div class="talk-info">
<div class="user">
<img :src="info.createUserAvatar" alt="">
<div class="info">
<h2>{{info.createUserName}}</h2>
<div class="time-flex">
<span class="area-name">{{info.publishDepartName}}</span>
<span>{{info.createTime}}</span>
</div>
</div>
</div>
<div class="content">
<span v-if="info.themeId">#{{info.themeInfo.title}}</span>{{info.content}}
</div>
<ai-uploader :instance="instance" disabled v-model="info.files">
</ai-uploader>
</div>
</template>
</ai-card>
<ai-card title="评论信息">
<template #content>
<div class="comment-list" v-if="commontList.length">
<div class="title">评论</div>
<div class="item" v-for="(item, index) in commontList" :key="index">
<div class="user">
<img :src="item.createUserAvatar" alt="">
<div class="info-flex">
<h2>{{item.createUserName}}</h2>
<span>{{item.createTime}}</span>
</div>
</div>
<div class="content-flex">
<p>{{item.content}}</p>
<div @click="delCommontOrReply('评论', item.id)">删除</div>
</div>
<div class="reply-list" v-if="item.replyList && item.replyList.length && item.isShowReply">
<div class="reply-item" v-for="(reply, indexs) in item.replyList" :key="indexs">
<div class="reply-user">
<img :src="item.createUserAvatar" alt="">
<div class="reply-name">
<span>{{reply.createUserName}}</span>回复<span>{{item.createUserName}}</span>
</div>
<span class="reply-time">{{reply.createTime}}</span>
</div>
<div class="content-flex">
<p>{{reply.content}}</p>
<div @click="delCommontOrReply('回复', reply.id)">删除</div>
</div>
</div>
</div>
<div class="reply-more" @click="item.isShowReply = !item.isShowReply" :class="[item.isShowReply ? 'active' : '']">
<span class="line"></span>{{item.isShowReply ? '收起' : `展开${item.replyList.length}条回复`}}
<i class="el-icon-arrow-down"></i>
</div>
</div>
</div>
<ai-empty v-else>暂无评论</ai-empty>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
commontList: [],
info: {},
}
},
computed: {
getAvatar(row){
return row.avatar||row.photo||'https://cdn.cunwuyun.cn/dvcp/h5/defaultAvatar.png'
}
},
created () {
this.getInfo()
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appneighborhoodassistance/commontList?id=${this.params.id}&size=100`).then(res => {
if (res.code == 0) {
res.data.records.map((item) => {
item.isShowReply = false
})
this.commontList = res.data.records
}
})
},
getInfo () {
this.instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${this.params.id}`).then(res => {
if (res.code == 0) {
if (res.data) {
this.info = res.data
}
}
})
},
cancel () {
this.$emit('change', {
type: 'List',
isRefresh: true
})
},
delCommontOrReply(text, id) {
this.$confirm(`确定删除该${text}`).then(() => {
this.instance.post(`/app/appneighborhoodassistance/delComment?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
}
}
</script>
<style scoped lang="scss">
.detail {
.talk-info {
.user {
display: flex;
margin-bottom: 8px;
img {
width: 60px;
height: 60px;
margin-right: 16px;
border-radius: 50%;
}
.info {
width: calc(100% - 76px);
h2 {
font-size: 20px;
line-height: 30px;
font-weight: 400;
}
.time-flex {
display: flex;
justify-content: space-between;
color: #999;
font-size: 14px;
line-height: 30px;
.area-name {
color: #666;
}
}
}
}
.content {
font-size: 16px;
line-height: 32px;
word-break: break-all;
span {
color: #26f;
}
}
}
.comment-list {
.title {
color: #333;
font-size: 16px;
font-weight: 700;
line-height: 40px;
margin-bottom: 8px;
}
.item {
border-bottom: 1px solid #ddd;
padding-bottom: 16px;
.user {
display: flex;
margin-bottom: 8px;
img {
width: 60px;
height: 60px;
margin-right: 16px;
border-radius: 50%;
}
.info-flex {
width: calc(100% - 76px);
display: flex;
justify-content: space-between;
line-height: 60px;
h2 {
font-size: 20px;
font-weight: 400;
}
span {
color: #999;
font-size: 14px;
}
}
}
.content-flex {
display: flex;
font-size: 16px;
line-height: 30px;
margin-bottom: 8px;
padding-left: 76px;
p {
width: calc(100% - 50px);
word-break: break-all;
}
div {
color: #26f;
width: 50px;
text-align: right;
cursor: pointer;
}
}
.reply-list {
padding-left: 100px;
.reply-item {
margin-bottom: 8px;
.reply-user {
font-size: 14px;
img {
width: 50px;
height: 50px;
border-radius: 50%;
vertical-align: middle;
}
.reply-name {
display: inline-block;
color: #333;
width: 300px;
span {
display: inline-block;
color: #666;
margin: 0 8px;
}
}
.reply-time {
color: #999;
}
}
.content-flex {
font-size: 14px;
line-height: 24px;
padding-left: 58px;
}
}
}
.reply-more {
font-size: 14px;
line-height: 28px;
color: #333;
.line {
display: inline-block;
width: 120px;
border-top: 1px solid #eee;
vertical-align: middle;
margin-right: 8px;
}
.el-icon-arrow-down {
transition: all ease 0.5s;
transform: rotate(0);
margin-left: 8px;
}
&.active .el-icon-arrow-down {
transform: rotate(180deg);
}
}
}
}
}
</style>

View File

@@ -0,0 +1,159 @@
<template>
<ai-list class="notice">
<template slot="title">
<ai-title title="积分规则" isShowBottomBorder isShowArea :hideLevel="hideLevel-1" v-model="search.areaId" @change="changeArea">
</ai-title>
</template>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">我要发帖</el-button>
<el-date-picker
v-model="dateList"
@change="search.current = 1,getList()"
type="daterange"
size="small"
value-format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</template>
<template #right>
<el-input
v-model="search.createUserName"
class="search-input"
size="small"
v-throttle="() => {search.current = 1, getList()}"
placeholder="请输入发帖人"
clearable
@clear="search.current = 1, search.createUserName = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 6px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="options" width="180px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'List',
props: {
instance: Function,
dict: Object
},
data () {
return {
search: {
current: 1,
size: 10,
createUserName: '',
areaId: ''
},
total: 10,
colConfigs: [
{ prop: 'content', label: '内容', align: 'left', 'show-overflow-tooltip': true },
{ prop: 'commentCount', label: '评论数', align: 'center', width: '120' },
{ prop: 'appreciateCount', label: '点赞数', align: 'center', width: '120' },
{ prop: 'sharedCount', label: '分享数', align: 'center', width: '120' },
{ prop: 'createUserName', label: '发帖人', align: 'center', width: '120' },
{ prop: 'createUserAreaName', label: '所在地区', align: 'center', width: '120' },
{ prop: 'createTime', label: '创建时间', align: 'center', width: '180' },
{ slot: 'options'},
],
tableData: [],
dateList: [],
}
},
computed: {
...mapState(['user']),
hideLevel() {
return this.user.info.areaList?.length || 0
},
},
created() {
this.search.areaId = this.user.info.areaId
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appneighborhoodassistance/list`, null, {
params: {
...this.search,
createUserAreaId: this.search.areaId,
beginDate: this.dateList[0] || '',
endDate: this.dateList[1] || '',
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
changeArea () {
this.search.current = 1
this.$nextTick(() => {
this.getList()
})
},
remove (id) {
this.$confirm('确定删除该帖子?').then(() => {
this.instance.post(`/app/appneighborhoodassistance/delete?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toDetail (id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,70 @@
<template>
<div class="AppHelp">
<keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
</template>
<script>
import Add from './components/Add'
import List from './components/List'
import Detail from './components/Detail'
export default {
name: 'AppIntegratingTask',
label: '积分任务',
props: {
instance: Function,
dict: Object
},
data () {
return {
component: 'List',
params: {},
include: []
}
},
components: {
Add,
List,
Detail
},
methods: {
onChange (data) {
if (data.type === 'Add') {
this.component = 'Add'
this.params = data.params
}
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
}
if (data.type === 'List') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
}
}
}
}
</script>
<style lang="scss">
.AppHelp {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,450 @@
<template>
<section class="activitiesAdd">
<ai-detail v-show="id && !isEdit">
<template slot="title">
<ai-title title="活动详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
</template>
<template slot="content">
<ai-card :title="info.title">
<template #right>
<span style="color:#2266FF;cursor: pointer;font-size: 12px;" class="iconfont iconEdit" v-if="isEdit==false && info.status==0" @click="update">修改</span>
</template>
<template #content v-if="isEdit == false">
<ai-wrapper>
<ai-info-item label="活动名称" :value="info.title"></ai-info-item>
<ai-info-item label="创建人" :value="info.createUserName"></ai-info-item>
<ai-info-item label="活动说明" isLine :value="info.detail"></ai-info-item>
<ai-info-item label="活动地点" :value="info.address"></ai-info-item>
<ai-info-item label="标绘地址" isLine><div id="mapDetail"></div></ai-info-item>
<ai-info-item label="活动状态">
{{ dict.getLabel('tfx_activityStatus',info.status) }}
</ai-info-item>
<ai-info-item label="打卡范围">{{ info.clockRange }}</ai-info-item>
<ai-info-item label="进场打卡时间">{{ info.intoBegintime }}{{ info.intoEndtime}}</ai-info-item>
<ai-info-item label="进场得积分">{{ info.intoIntegral }}</ai-info-item>
<ai-info-item label="离场打卡时间">{{ info.exitBegintime }}{{ info.exitEndtime}}</ai-info-item>
<ai-info-item label="离场得积分">{{ info.exitIntegral }}</ai-info-item>
</ai-wrapper>
</template>
</ai-card>
</template>
</ai-detail>
<ai-detail v-show="!id || isEdit==true">
<ai-title slot="title" :title="id? '编辑活动':'创建活动'" isShowBottomBorder isShowBack @onBackClick="cancel(true)"/>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<el-form class="ai-form" ref="form" :model="form" :rules="formRules" size="small" label-width="120px">
<el-form-item label="活动名称" prop="title" style="width: 100%">
<el-input v-model="form.title" placeholder="请输入" show-word-limit maxlength="64"></el-input>
</el-form-item>
<el-form-item label="活动说明" style="width: 100%">
<el-input type="textarea" :rows="5" v-model="form.detail" placeholder="请输入" show-word-limit maxlength="500"></el-input>
</el-form-item>
<el-form-item label="活动图片" prop="files" :rules="[{required: true, message: '请上传封面图片', trigger: 'change'}]" style="width: 100%;">
<ai-uploader
:instance="instance"
v-model="form.files"
:limit="9">
</ai-uploader>
</el-form-item>
<el-form-item prop="areaId" style="width: 100%;" label="选择地区" :rules="[{required: true, message: '请选择地区', trigger: 'change'}]">
<ai-area-select
clearable
@fullname="v => form.areaName = v"
:disabled-level="$store.state.user.info.areaList.length - 1"
always-show
:instance="instance"
v-model="form.areaId">
</ai-area-select>
</el-form-item>
<el-form-item label="活动地点" style="width: 100%;">
<el-input v-model="form.address" disabled>
<template slot="append">
<el-button @click="showMap = true">选择位置</el-button>
</template>
</el-input>
</el-form-item>
<el-form-item label="积分类型" prop="type" style="width: 100%">
<el-radio-group v-model="form.type">
<el-radio label="0">打卡得积分</el-radio>
<el-radio label="1">报名得积分</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="打卡范围" prop="clockRange" style="width: 100%">
<el-input type="number" v-model="form.clockRange" placeholder="请输入" >
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item :label="form.type === '0' ? '进场打卡时间' : '进场时间'" prop="intoTime">
<el-date-picker style="width: 100%" v-model="form.intoTime" type="datetimerange" start-placeholder="开始日期" :picker-options="timeOption"
end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" ></el-date-picker>
</el-form-item>
<el-form-item v-if="form.type === '0'" label="进场得积分" prop="intoIntegral">
<el-input v-model="form.intoIntegral" type="number" placeholder="请输入" style="width: 100%">
<template slot="append">积分</template>
</el-input>
</el-form-item>
<el-form-item :label="form.type === '1' ? '离场打卡时间' : '离场时间'" prop="exitTime">
<el-date-picker style="width: 100%" v-model="form.exitTime" type="datetimerange" start-placeholder="开始日期" :picker-options="timeOption"
end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
</el-form-item>
<el-form-item v-if="form.type === '0'" label="离场得积分" prop="exitIntegral">
<el-input v-model="form.exitIntegral" type="number" placeholder="请输入" style="width: 100%">
<template slot="append">积分</template>
</el-input>
</el-form-item>
<el-form-item v-if="form.type === '1'" label="报名得积分" prop="enrollIntegral">
<el-input v-model="form.enrollIntegral" type="number" placeholder="请输入" style="width: 100%">
<template slot="append">积分</template>
</el-input>
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template #footer>
<el-button class="delete-btn footer-btn" @click="cancel(false)">取消</el-button>
<el-button class="footer-btn" type="primary" @click="confirm()">保存</el-button>
</template>
</ai-detail>
<ai-dialog title="地图" :visible.sync="showMap" @opened="initMap" width="800px" class="mapDialog" @onConfirm="selectMap">
<div id="map"></div>
<el-form label-width="80px" style="padding: 10px 20px 0 20px;">
<el-row type="flex" justify="space-between">
<el-form-item label="经度">
<el-input disabled size="small" v-model="placeDetail.lng"></el-input>
</el-form-item>
<el-form-item label="纬度">
<el-input disabled size="small" v-model="placeDetail.lat"></el-input>
</el-form-item>
</el-row>
</el-form>
<el-input id="searchPlaceInput" size="medium" class="searchPlaceInput" clearable v-model="searchPlace" autocomplete="on" @change="placeSearch.search(searchPlace)" placeholder="请输入关键字">
<el-button type="primary" slot="append" @click="placeSearch.search(searchPlace)">搜索</el-button>
</el-input>
<div id="searchPlaceOutput" />
</ai-dialog>
</section>
</template>
<script>
import AMapLoader from '@amap/amap-jsapi-loader'
export default {
props: {
instance: Function,
dict: Object,
params: Object,
},
data() {
var validLocation = (rule, value, callback) => {
if(!this.form.lat || !this.form.lng) {
return callback(new Error('请标绘地理位置'))
} else {
callback()
}
}
return {
form: {
title: '',
detail: '',
lng: '',
lat: '',
type: '',
areaId: '',
enrollIntegral: '',
files: [],
address: '',
clockRange: '',
intoTime: [],
intoBegintime: '',
intoEndtime: '',
intoIntegral: '',
exitTime: [],
exitBegintime: '',
exitEndtime: '',
exitIntegral: '',
},
formRules: {
title: [{required: true, message: "请输入活动名称", trigger: "blur"}],
location: [{required: true, validator: validLocation, trigger: "blur"}],
clockRange: [{required: true, message: "请输入打卡范围", trigger: "blur"}],
intoTime: [{required: true, message: "请选择进场打卡时间", trigger: "blur"}],
intoIntegral: [{required: true, message: "请输入进场得积分", trigger: "blur"}],
exitTime: [{required: true, message: "请选择离场打卡时间", trigger: "blur"}],
exitIntegral: [{required: true, message: "请输入离场得积分", trigger: "blur"}],
},
id: '',
isEdit: false,
info: {},
mapDetail: null,
map: null,
placeSearch: null,
placeDetail: {
lng: '',
lat: '',
address: ''
},
showMap: false,
searchPlace: '',
timeOption: {
disabledDate(date) {
return date.getTime() < Date.now() - 24 * 60 * 60 * 1000
}
},
}
},
created() {
this.form.areaId = this.$store.state.user.info.areaId
this.$dict.load('tfx_activityStatus')
if(this.params && this.params.id) {
this.id = this.params.id
this.getDetail()
setTimeout(() => {
},500)
}
},
watch: {
'form.intoTime': {
handler(val) {
if(val) {
this.form.intoBegintime = val[0]
this.form.intoEndtime = val[1]
}
}
},
'form.exitTime': {
handler(val) {
if(val) {
this.form.exitBegintime = val[0]
this.form.exitEndtime = val[1]
}
}
}
},
methods: {
selectMap() {
this.form.lng = this.placeDetail.lng
this.form.lat = this.placeDetail.lat
this.form.address = this.placeDetail.address
this.showMap = false
},
initMap() {
AMapLoader.load({
key: '54a02a43d9828a8f9cd4f26fe281e74e',
version: '2.0',
plugins: ['AMap.PlaceSearch', 'AMap.AutoComplete', 'AMap.Geocoder'],
}).then((AMap) => {
this.map = new AMap.Map('map', {
resizeEnable: true,
zooms: [6, 20],
center:[104.067923463,30.6799428454],
zoom: 11,
})
this.placeSearch = new AMap.PlaceSearch({ map: this.map })
new AMap.AutoComplete({
input: 'searchPlaceInput',
output: 'searchPlaceOutput',
}).on('select', (e) => {
if (e?.poi) {
this.placeSearch.setCity(e.poi.adcode)
this.movePosition(e.poi.location)
}
})
this.map.on('click', (e) => {
new AMap.Geocoder().getAddress(e.lnglat, (sta, res) => {
if (res?.regeocode) {
this.placeDetail = {
lng: e.lnglat?.lng,
lat: e.lnglat?.lat,
address: res.regeocode.formattedAddress,
}
}
})
this.movePosition(e.lnglat)
})
})
},
movePosition(center) {
if (this.map) {
this.map.clearMap()
this.map.panTo(center)
this.map.add([
new AMap.Marker({
position: center,
clickable: true,
}),
])
this.map.setFitView()
}
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
},
getMap(lng,lat,address) {
AMapLoader.load({
key: '54a02a43d9828a8f9cd4f26fe281e74e',
version: '2.0',
plugins: ['AMap.PlaceSearch', 'AMap.AutoComplete', 'AMap.Geocoder'],
}).then((AMap) => {
this.mapDetail = new AMap.Map(document.getElementById("mapDetail"), {
resizeEnable: true,
zooms: [6, 20],
center:[104.067923463,30.6799428454],
zoom: 11,
})
let marker = new AMap.Marker({
position: new AMap.LngLat(lng,lat),
title: address
})
this.mapDetail.add(marker);
})
},
update() {
this.isEdit = true
this.getDetail()
},
getDetail() {
this.instance.post(`/app/appintegraltask/queryDetailById`,null, {
params: {id:this.id}
}).then((res) => {
if(res?.data) {
this.form = res.data
this.form.intoTime = [res.data.intoBegintime,res.data.intoEndtime]
this.form.exitTime = [res.data.exitBegintime,res.data.exitEndtime]
this.info = res.data
this.placeDetail.lng = res.data.lng
this.placeDetail.lat = res.data.lat
this.getMap(this.info.lng,this.info.lat,this.info.address)
}
})
},
selectCandidate(v) {
this.form.candidateUsers = v
},
selectVote(e) {
this.form.voteUsers = e
},
handleAreaSelect(v) {
this.form.areaName = v?.[0]?.label
},
confirm() {
this.$refs.form.validate((valid) => {
if (valid) {
if(new Date(this.form.intoBegintime).getTime() <= Date.now()){
return this.$message.error('进场打卡开始时间不能小于当前时间')
}
let intoEnd = new Date(this.form.intoEndtime).getTime()
let exitBegin = new Date(this.form.exitBegintime).getTime()
if(exitBegin <= intoEnd) {
return this.$message.error('离场的开始时间不能小于且等于进场的结束时间')
}
this.instance.post(`/app/appintegraltask/addOrUpdate`,{
...this.form
}).then(res => {
if(res.code == 0) {
this.$message.success(this.id ? '编辑成功' : '新增成功')
this.cancel(true)
}
}).catch(err => {
console.log(err);
})
}
})
},
},
}
</script>
<style lang="scss" scope>
.activitiesAdd {
height: 100%;
:deep( .amap-logo ){
display: none!important;
}
:deep( .amap-copyright ){
display: none!important;
}
:deep( .el-date-editor .el-input ){
width: 100%;
}
.tips {
width: 100%;
border: 1px solid #f82;
background-color: #fff3e9;
color: #f82;
padding: 8px 16px;
box-sizing: border-box;
border-radius: 4px;
margin-bottom: 32px;
font-size: 13px;
}
.amap-container {
height: 380px;
}
}
.mapDialog {
.el-dialog__body {
padding: 0;
.ai-dialog__content {
padding: 0;
}
.ai-dialog__content--wrapper {
padding: 0 !important;
position: relative;
}
}
#map {
width: 100%;
height: 420px;
}
.searchPlaceInput {
position: absolute;
width: 250px;
top: 30px;
left: 25px;
}
#searchPlaceOutput {
position: absolute;
width: 250px;
left: 25px;
height: initial;
top: 80px;
background: white;
z-index: 250;
max-height: 300px;
overflow-y: auto;
.auto-item {
text-align: left;
font-size: 14px;
padding: 8px;
box-sizing: border-box;
}
}
}
</style>

View File

@@ -0,0 +1,294 @@
<template>
<ai-detail class="detail">
<template slot="title">
<ai-title title="帖子详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="帖子信息">
<template #content>
<div class="talk-info">
<div class="user">
<img :src="info.createUserAvatar" alt="">
<div class="info">
<h2>{{info.createUserName}}</h2>
<div class="time-flex">
<span class="area-name">{{info.publishDepartName}}</span>
<span>{{info.createTime}}</span>
</div>
</div>
</div>
<div class="content">
<span v-if="info.themeId">#{{info.themeInfo.title}}</span>{{info.content}}
</div>
<ai-uploader :instance="instance" disabled v-model="info.files">
</ai-uploader>
</div>
</template>
</ai-card>
<ai-card title="评论信息">
<template #content>
<div class="comment-list" v-if="commontList.length">
<div class="title">评论</div>
<div class="item" v-for="(item, index) in commontList" :key="index">
<div class="user">
<img :src="item.createUserAvatar" alt="">
<div class="info-flex">
<h2>{{item.createUserName}}</h2>
<span>{{item.createTime}}</span>
</div>
</div>
<div class="content-flex">
<p>{{item.content}}</p>
<div @click="delCommontOrReply('评论', item.id)">删除</div>
</div>
<div class="reply-list" v-if="item.replyList && item.replyList.length && item.isShowReply">
<div class="reply-item" v-for="(reply, indexs) in item.replyList" :key="indexs">
<div class="reply-user">
<img :src="item.createUserAvatar" alt="">
<div class="reply-name">
<span>{{reply.createUserName}}</span>回复<span>{{item.createUserName}}</span>
</div>
<span class="reply-time">{{reply.createTime}}</span>
</div>
<div class="content-flex">
<p>{{reply.content}}</p>
<div @click="delCommontOrReply('回复', reply.id)">删除</div>
</div>
</div>
</div>
<div class="reply-more" @click="item.isShowReply = !item.isShowReply" :class="[item.isShowReply ? 'active' : '']">
<span class="line"></span>{{item.isShowReply ? '收起' : `展开${item.replyList.length}条回复`}}
<i class="el-icon-arrow-down"></i>
</div>
</div>
</div>
<ai-empty v-else>暂无评论</ai-empty>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
commontList: [],
info: {},
}
},
computed: {
getAvatar(row){
return row.avatar||row.photo||'https://cdn.cunwuyun.cn/dvcp/h5/defaultAvatar.png'
}
},
created () {
this.getInfo()
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appneighborhoodassistance/commontList?id=${this.params.id}&size=100`).then(res => {
if (res.code == 0) {
res.data.records.map((item) => {
item.isShowReply = false
})
this.commontList = res.data.records
}
})
},
getInfo () {
this.instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${this.params.id}`).then(res => {
if (res.code == 0) {
if (res.data) {
this.info = res.data
}
}
})
},
cancel () {
this.$emit('change', {
type: 'List',
isRefresh: true
})
},
delCommontOrReply(text, id) {
this.$confirm(`确定删除该${text}`).then(() => {
this.instance.post(`/app/appneighborhoodassistance/delComment?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
}
}
</script>
<style scoped lang="scss">
.detail {
.talk-info {
.user {
display: flex;
margin-bottom: 8px;
img {
width: 60px;
height: 60px;
margin-right: 16px;
border-radius: 50%;
}
.info {
width: calc(100% - 76px);
h2 {
font-size: 20px;
line-height: 30px;
font-weight: 400;
}
.time-flex {
display: flex;
justify-content: space-between;
color: #999;
font-size: 14px;
line-height: 30px;
.area-name {
color: #666;
}
}
}
}
.content {
font-size: 16px;
line-height: 32px;
word-break: break-all;
span {
color: #26f;
}
}
}
.comment-list {
.title {
color: #333;
font-size: 16px;
font-weight: 700;
line-height: 40px;
margin-bottom: 8px;
}
.item {
border-bottom: 1px solid #ddd;
padding-bottom: 16px;
.user {
display: flex;
margin-bottom: 8px;
img {
width: 60px;
height: 60px;
margin-right: 16px;
border-radius: 50%;
}
.info-flex {
width: calc(100% - 76px);
display: flex;
justify-content: space-between;
line-height: 60px;
h2 {
font-size: 20px;
font-weight: 400;
}
span {
color: #999;
font-size: 14px;
}
}
}
.content-flex {
display: flex;
font-size: 16px;
line-height: 30px;
margin-bottom: 8px;
padding-left: 76px;
p {
width: calc(100% - 50px);
word-break: break-all;
}
div {
color: #26f;
width: 50px;
text-align: right;
cursor: pointer;
}
}
.reply-list {
padding-left: 100px;
.reply-item {
margin-bottom: 8px;
.reply-user {
font-size: 14px;
img {
width: 50px;
height: 50px;
border-radius: 50%;
vertical-align: middle;
}
.reply-name {
display: inline-block;
color: #333;
width: 300px;
span {
display: inline-block;
color: #666;
margin: 0 8px;
}
}
.reply-time {
color: #999;
}
}
.content-flex {
font-size: 14px;
line-height: 24px;
padding-left: 58px;
}
}
}
.reply-more {
font-size: 14px;
line-height: 28px;
color: #333;
.line {
display: inline-block;
width: 120px;
border-top: 1px solid #eee;
vertical-align: middle;
margin-right: 8px;
}
.el-icon-arrow-down {
transition: all ease 0.5s;
transform: rotate(0);
margin-left: 8px;
}
&.active .el-icon-arrow-down {
transform: rotate(180deg);
}
}
}
}
}
</style>

View File

@@ -0,0 +1,173 @@
<template>
<ai-list class="activitiesList">
<ai-title
slot="title"
title="活动管理"
isShowBottomBorder
isShowArea
:hideLevel="$store.state.user.info.areaList.length - 1"
v-model="search.areaId"
:instance="instance"
@change="search.current = 1, getList()">
</ai-title>
<template #content>
<ai-search-bar>
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')" >创建活动</el-button>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:total="search.total"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList"
:col-configs="colConfigs"
:dict="dict">
<el-table-column slot="qrcode" width="200px" label="二维码" align="center">
<template slot-scope="{ row }">
<div class="qrcode">
<el-button type="text" @click="qrcode(row.qrCode, row.id)">{{ row.qrCode ? '预览' : '生成' }}</el-button>
</div>
</template>
</el-table-column>
<el-table-column slot="options" label="操作" fixed="right" align="center">
<template slot-scope="{ row }">
<el-button type="text" @click.native="toAdd(row.id)">详情</el-button>
<el-button type="text" :disabled="row.status ==2" @click.native="stopBtn(row.id)">结束</el-button>
<el-button type="text" @click.native="handleDelete(row.id)">删除</el-button>
</template>
</el-table-column>
</ai-table>
<div class="qrCode" v-viewer="{movable: true}" v-show="false">
<img :src="img">
</div>
</template>
</ai-list>
</template>
<script>
export default {
props: {
instance: Function,
dict: Object
},
data () {
return {
search: {
current: 1,
size: 10,
total: 0,
areaId: ''
},
tableData: [],
img: '',
isLoading: false,
}
},
created () {
this.search.areaId = this.$store.state.user.info.areaId
this.$dict.load('tfx_activityStatus').then(()=> {
this.getList()
})
},
computed: {
colConfigs() {
return [
{ prop: "title", label: "活动名称", align: "left", showOverflowTooltip: true },
{ prop: "createUserName", label: "创建人", align: "center" },
{
prop: "intoBegintime",
label: "开始结束时间",
align: "center",
width: "400px",
render: (h, {row}) => h('p',
{
textAlign: 'center'
},
`${row.intoBegintime}${row.exitEndtime}`)
},
{ prop: "status", label: "活动状态", align: "center", dict:"tfx_activityStatus" },
{ slot: "qrcode" },
{ slot: "options", },
]
}
},
methods: {
getList() {
this.instance.post(`/app/appintegraltask/list`,null, {
params: {
...this.search,
}
}).then(res=> {
if(res?.data) {
this.tableData = res.data.records
this.search.total = res.data.total
}
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || '',
}
})
},
qrcode (qrcode, id) {
if (!qrcode) {
this.isLoading = true
this.instance.post(`/app/appintegraltask/generateQrCode?id=${id}&width=400&height=400`).then(res => {
if (res.code == 0) {
this.$message.success('二维码生成成功!')
this.getList()
}
this.isLoading = false
})
} else {
this.img = qrcode
this.$nextTick(() => {
setTimeout(() => {
const viewer = this.$el.querySelector('.qrCode').$viewer
viewer.view()
}, 600)
})
}
},
handleDelete (id) {
this.$confirm('确定删除该活动?').then(() => {
this.instance.post(`/app/appintegraltask/delete?ids=${id}`).then(res=>{
if(res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
stopBtn (id) {
this.$confirm('确定要结束该活动吗?').then(() => {
this.instance.post(`/app/appintegraltask/stop?id=${id}`).then(res=>{
if(res.code == 0) {
this.$message.success('结束成功!')
this.getList()
}
})
})
}
}
}
</script>
<style lang="scss" scoped>
.activitiesList {
height: 100%;
}
</style>