初始化
This commit is contained in:
130
packages/wechat/AppProjectActivities/AppProjectActivities.vue
Normal file
130
packages/wechat/AppProjectActivities/AppProjectActivities.vue
Normal file
@@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<ai-list v-if="!isShowDetail">
|
||||
<template slot="title">
|
||||
<ai-title title="专题活动" :isShowBottomBorder="false" :instance="instance" :isShowArea="false">
|
||||
</ai-title>
|
||||
</template>
|
||||
<template slot="tabs">
|
||||
<el-tabs v-model="currIndex">
|
||||
<el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label">
|
||||
<component :ref="String(i)" :is="tab.comp" v-if="currIndex === String(i)" @change="onChange" :instance="instance" :dict="dict" :permissions="permissions"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</template>
|
||||
</ai-list>
|
||||
<component v-else :is="componentName" @change="onChange" :params="params" :instance="instance" :dict="dict" :permissions="permissions"></component>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Event from './components/Event'
|
||||
import Comments from './components/Comments'
|
||||
import Add from './components/Add'
|
||||
import Detail from './components/Detail'
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'AppProjectActivities',
|
||||
label: '专题活动',
|
||||
|
||||
components: {
|
||||
Add,
|
||||
Detail,
|
||||
Event,
|
||||
Comments
|
||||
},
|
||||
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
permissions: Function
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
|
||||
tabs () {
|
||||
const tabList = [
|
||||
{label: '内容管理', name: 'Event', comp: Event, permission: 'app_appvillageinfo'},
|
||||
{label: '评论管理', name: 'Comments', comp: Comments, permission: 'app_appvillageinfocomment'}
|
||||
].filter(item => {
|
||||
return this.permissions(item.permission)
|
||||
})
|
||||
|
||||
return tabList
|
||||
}
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
activeName: 'Event',
|
||||
currIndex: '0',
|
||||
componentName: '',
|
||||
params: {},
|
||||
isHasPermiss: true,
|
||||
isShowDetail: false
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
},
|
||||
|
||||
methods: {
|
||||
areaChange () {
|
||||
console.log(this.$refs[this.currIndex])
|
||||
this.$refs[this.currIndex][0].getList()
|
||||
},
|
||||
|
||||
onChange (data) {
|
||||
if (data.type === 'detail') {
|
||||
this.componentName = 'Detail'
|
||||
this.isShowDetail = true
|
||||
this.params = data.params
|
||||
}
|
||||
|
||||
if (data.type === 'add') {
|
||||
this.componentName = 'Add'
|
||||
this.isShowDetail = true
|
||||
this.params = data.params
|
||||
}
|
||||
|
||||
if (data.type === 'list') {
|
||||
this.isShowDetail = false
|
||||
|
||||
this.$nextTick(() => {
|
||||
if (data.isRefresh) {
|
||||
// this.$refs[this.currIndex].getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.no-permission__wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
padding-bottom: 100px;
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
|
||||
h2 {
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
i {
|
||||
font-style: normal;
|
||||
color: #2771ff;
|
||||
}
|
||||
|
||||
.no-permission {
|
||||
width: 120px;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
148
packages/wechat/AppProjectActivities/components/Add.vue
Normal file
148
packages/wechat/AppProjectActivities/components/Add.vue
Normal file
@@ -0,0 +1,148 @@
|
||||
<template>
|
||||
<ai-detail class="add-detail">
|
||||
<template slot="title">
|
||||
<ai-title :title="params.id ? '编辑活动' : '添加活动'" :isShowBack="true" @onBackClick="cancel"
|
||||
:isShowBottomBorder="true"></ai-title>
|
||||
</template>
|
||||
<template slot="content">
|
||||
<ai-card title="标题信息">
|
||||
<template #content>
|
||||
<el-form :model="form" label-width="120px" ref="form">
|
||||
<el-form-item label="标题" prop="title" :rules="[{required: true, message: '请输入标题', trigger: 'blur'}]">
|
||||
<el-input v-model="form.title" clearable placeholder="请输入..." size="small" maxlength="30"
|
||||
show-word-limit></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="活动" prop="type" :rules="[{required: true, message: '请选择活动', trigger: 'blur'}]">
|
||||
<ai-select
|
||||
v-model="form.type"
|
||||
placeholder="请选择活动"
|
||||
:selectList="$dict.getDict('activityAirticleType')"
|
||||
></ai-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="摘要" prop="description" :rules="[{required: true, message: '请输入摘要', trigger: 'blur'}]">
|
||||
<el-input v-model="form.description" clearable placeholder="请输入..." size="small" maxlength="50"
|
||||
show-word-limit></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="正文" prop="content" :rules="[{required: true, message: '请输入正文', trigger: 'blur'}]">
|
||||
<ai-editor v-model="form.content" :instance="instance"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="封面" prop="thumbUrl">
|
||||
<ai-uploader
|
||||
:isShowTip="true"
|
||||
:instance="instance"
|
||||
v-model="form.thumbUrl"
|
||||
:limit="1"
|
||||
:cropOps="cropOps"
|
||||
is-crop>
|
||||
</ai-uploader>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
</ai-card>
|
||||
</template>
|
||||
<template slot="footer">
|
||||
<el-button class="delete-btn footer-btn" @click="cancel(false)">取消</el-button>
|
||||
<el-button type="primary" size="small" v-if="!params.id" @click="onSubmit(2)">发布</el-button>
|
||||
<el-button size="small" @click="onSubmit(1)">保存</el-button>
|
||||
</template>
|
||||
</ai-detail>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState} from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'Add',
|
||||
|
||||
props: {
|
||||
dict: Object,
|
||||
params: Object,
|
||||
instance: Function,
|
||||
areaId: String
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
title: '',
|
||||
type: '',
|
||||
description: "",
|
||||
content: '',
|
||||
thumbUrl: []
|
||||
},
|
||||
isDetail: true,
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
cropOps(){
|
||||
return {
|
||||
width: "336px",
|
||||
height: "210px"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
if (!!this.params.id) {
|
||||
this.getInfo()
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
getInfo() {
|
||||
this.instance.post(`/app/appactivity/queryDetailById?id=${this.params.id}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.form = {
|
||||
...res.data
|
||||
}
|
||||
this.form.thumbUrl = res.data.thumbUrl ? JSON.parse(res.data.thumbUrl) : []
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onSubmit(index) {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
if (!this.id) {
|
||||
if (index == 2) {
|
||||
this.form.status = 1
|
||||
} else {
|
||||
this.form.status = 0
|
||||
}
|
||||
}
|
||||
this.instance.post(`/app/appactivity/addOrUpdate`, {
|
||||
...this.form,
|
||||
areaId: this.areaId,
|
||||
thumbUrl: this.form.thumbUrl.length ? JSON.stringify([{
|
||||
url: this.form.thumbUrl[0].url
|
||||
}]) : ''
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(this.params.id ? '编辑成功' : ( index==1 ? "保存成功" : "发布成功"))
|
||||
setTimeout(() => {
|
||||
this.cancel(true)
|
||||
}, 800)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
cancel(isRefresh) {
|
||||
this.$emit('change', {
|
||||
type: 'list',
|
||||
isRefresh: isRefresh ? true : false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.add-detail {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
130
packages/wechat/AppProjectActivities/components/Comments.vue
Normal file
130
packages/wechat/AppProjectActivities/components/Comments.vue
Normal file
@@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<ai-list class="comments" :isTabs="true">
|
||||
<template slot="content">
|
||||
<div class="ai-table">
|
||||
<ai-table
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
@getList="getList">
|
||||
<el-table-column prop="type" slot="options" label="评论明细">
|
||||
<div slot-scope="scope">
|
||||
<el-row type="flex" justify="space-between">
|
||||
<p class="comment_p">来自《{{ scope.row.title }}》</p>
|
||||
<span title="删除" style="cursor: pointer;color: #26f;user-select: none;" @click="remove(scope.row.id)">删除</span>
|
||||
</el-row>
|
||||
<div style="display: flex;">
|
||||
<b slot="label">回复内容:</b>
|
||||
<ai-audio single-play v-if="scope.row.audioFile" :src="scope.row.audioFile"/>
|
||||
<div v-html="scope.row.content" style="white-space: pre-wrap;"></div>
|
||||
</div>
|
||||
<p style="float:left;padding-right:8px;"><span style="font-weight:bold;padding-right:8px;">回复人:</span>{{ scope.row.createUser }}
|
||||
</p>
|
||||
<p style="float:left;">{{ scope.row.createDate }}</p>
|
||||
</div>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
</div>
|
||||
</template>
|
||||
</ai-list>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'JoinEvent',
|
||||
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
areaId: String,
|
||||
permissions: Function
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
|
||||
colConfigs() {
|
||||
return [
|
||||
{ slot: 'options' }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
status: ''
|
||||
},
|
||||
total: 0,
|
||||
ids: [],
|
||||
tableData: [],
|
||||
orderDetail: {}
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.getList()
|
||||
},
|
||||
|
||||
methods: {
|
||||
getList () {
|
||||
this.instance.post(`/app/appactivitycomment/list`, null, {
|
||||
params: {
|
||||
...this.search,
|
||||
areaId: this.areaId
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.data) {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
remove (id) {
|
||||
this.$confirm('确定删除该数据?').then(() => {
|
||||
this.instance.post(`/app/appactivitycomment/delete?ids=${id}`).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功!')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.join-event {
|
||||
::v-deep th {
|
||||
font-weight: bold!important;
|
||||
}
|
||||
}
|
||||
|
||||
.table-btn {
|
||||
margin-right: 16px;
|
||||
font-size: 14px;
|
||||
color: #2266FF;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
&:last-child:hover {
|
||||
color: #f46;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
100
packages/wechat/AppProjectActivities/components/Detail.vue
Normal file
100
packages/wechat/AppProjectActivities/components/Detail.vue
Normal file
@@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<ai-detail class="event-detail">
|
||||
<template #title>
|
||||
<ai-title title="活动详情" :isShowBack="true" @onBackClick="onBack" isShowBottomBorder>
|
||||
</ai-title>
|
||||
</template>
|
||||
<template #content>
|
||||
<ai-card :title="info.title" titlePosition="center">
|
||||
<template #title>
|
||||
<h2>{{ info.title }}</h2>
|
||||
<p class="subTitle">活动:{{ dict.getLabel("activityAirticleType",info.type)}}</p>
|
||||
</template>
|
||||
<template #content>
|
||||
<p class="wrap">摘要:{{info.description}}</p>
|
||||
<ai-article :value="info.content"></ai-article>
|
||||
<ai-file-list v-if="info.files && info.files.length" :fileList="info.files"
|
||||
:fileOps="{name: 'fileName', size: 'postfix'}"></ai-file-list>
|
||||
</template>
|
||||
</ai-card>
|
||||
<ai-card title="封面信息" v-if="info.thumbUrl">
|
||||
<template slot="content">
|
||||
<ai-wrapper label-width="40px">
|
||||
<ai-info-item label="封面">
|
||||
<img class="cover" :src="info.thumbUrl[0].url" v-viewer>
|
||||
</ai-info-item>
|
||||
</ai-wrapper>
|
||||
</template>
|
||||
</ai-card>
|
||||
</template>
|
||||
</ai-detail>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Viewer from 'v-viewer' ;
|
||||
import Vue from 'vue' ;
|
||||
|
||||
Vue.use(Viewer);
|
||||
export default {
|
||||
name: 'detail',
|
||||
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
permissions: Function,
|
||||
params: Object
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
info: {}
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.dict.load("activityAirticleType").then(() => this.getInfo())
|
||||
},
|
||||
|
||||
methods: {
|
||||
getInfo() {
|
||||
this.instance.post(`/app/appactivity/queryDetailById?id=${this.params.id}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.info = res.data
|
||||
if (res.data.thumbUrl) {
|
||||
this.info.thumbUrl = JSON.parse(res.data.thumbUrl)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onBack() {
|
||||
this.$emit('change', {
|
||||
type: 'list'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.cover {
|
||||
display: block;
|
||||
width: 320px;
|
||||
height: 180px;
|
||||
}
|
||||
|
||||
.wrap {
|
||||
font-size: 16px;
|
||||
color: #2D4C86;
|
||||
line-height: 32px;
|
||||
background: #F5F6F9;
|
||||
box-sizing: border-box;
|
||||
padding: 24px 40px;
|
||||
}
|
||||
|
||||
.subTitle {
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
}
|
||||
</style>
|
||||
197
packages/wechat/AppProjectActivities/components/Event.vue
Normal file
197
packages/wechat/AppProjectActivities/components/Event.vue
Normal file
@@ -0,0 +1,197 @@
|
||||
<template>
|
||||
<ai-list class="join-event" :isTabs="true">
|
||||
<template slot="content">
|
||||
<ai-search-bar>
|
||||
<template slot="left">
|
||||
<el-button :disabled="!permissions('app_appactivity_edit')" icon="iconfont iconAdd" type="primary" size="small" @click="add">添加</el-button>
|
||||
</template>
|
||||
<template slot="right">
|
||||
<el-input
|
||||
placeholder="请输入标题"
|
||||
size="small"
|
||||
clearable
|
||||
v-model="search.title"
|
||||
@keyup.enter.native="search.current = 1, getList()"
|
||||
@clear="search.current = 1, search.title = '', getList()"
|
||||
suffix-icon="iconfont iconSearch" />
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<div class="ai-table">
|
||||
<ai-table
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
@getList="getList">
|
||||
<el-table-column slot="options" label="操作" align="center" width="250" fixed="right">
|
||||
<template slot-scope="{ row }">
|
||||
<div class="table-options">
|
||||
<el-button
|
||||
type="text"
|
||||
@click="publish(row)"
|
||||
:title="row.status === '1' ? '取消发布' : '发布'"
|
||||
:disabled="!permissions('app_appvillageinfo_edit')">
|
||||
{{ row.status === '1' ? '取消发布' : '发布' }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
title="详情"
|
||||
@click="toDetail(row.id)"
|
||||
:disabled="!permissions('app_appactivity_detail')">
|
||||
详情
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
title="编辑"
|
||||
@click="toAdd(row.id)"
|
||||
:disabled="!permissions('app_appactivity_edit')">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="remove(row.id)"
|
||||
type="text"
|
||||
title="删除"
|
||||
:disabled="!permissions('app_appactivity_del')">
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
</div>
|
||||
</template>
|
||||
</ai-list>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'ReportEvent',
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
areaId: String,
|
||||
permissions: Function
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
|
||||
colConfigs() {
|
||||
return [
|
||||
{ prop: 'title', label: '标题'},
|
||||
{ prop: 'type', label: '活动名称',render:(h,{row})=>[<span>{this.dict.getLabel('activityAirticleType', row.type)}</span>]},
|
||||
{ prop: 'readCount', label: '浏览数', align: 'center' },
|
||||
{ prop: 'commentCount', label: '评论数', align: 'center' },
|
||||
{ prop: 'createDate', label: '创建时间'},
|
||||
{ prop: 'status', label: '发布状态',render:(h,{row})=>[<span>{this.dict.getLabel('villInfoStatus', row.status)}</span>]},
|
||||
{ slot: 'options', label: '操作' }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
title: ''
|
||||
},
|
||||
total: 0,
|
||||
ids: [],
|
||||
tableData: [],
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.dict.load("activityAirticleType",'villInfoStatus').then(() => this.getList())
|
||||
},
|
||||
|
||||
methods: {
|
||||
getList () {
|
||||
this.instance.post(`/app/appactivity/list`, null, {
|
||||
params: {
|
||||
...this.search,
|
||||
areaId: this.areaId
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.data) {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
publish (params) {
|
||||
this.$confirm(`是否${params.status === '1' ? '取消发布' : '发布'}该条数据?`).then(() => {
|
||||
this.instance.post(`/app/appactivity/updateCountYardstatus`, {
|
||||
id: params.id,
|
||||
status: params.status === '1' ? 0 : 1
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success(`${params.status === '1' ? '取消发布' : '发布'}成功!`)
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
toAdd (id) {
|
||||
this.$emit('change', {
|
||||
type: 'add',
|
||||
params: {
|
||||
id
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
add () {
|
||||
this.$emit('change', {
|
||||
type: 'add',
|
||||
params: {
|
||||
id: ''
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
toEdit (id) {
|
||||
this.$emit('change', {
|
||||
type: 'add',
|
||||
params: {
|
||||
type: 'ReportAdd',
|
||||
id
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
toDetail (id) {
|
||||
this.$emit('change', {
|
||||
type: 'detail',
|
||||
params: {
|
||||
type: 'eventDetail',
|
||||
id
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
remove (id) {
|
||||
this.$confirm('确定删除该数据?').then(() => {
|
||||
this.instance.post(`/app/appactivity/delete?ids=${id}`).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功!')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.join-event {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user