迁移位置,并清除多余的报错

This commit is contained in:
aixianling
2023-04-03 16:28:12 +08:00
parent fdbe0c4c37
commit dd4ab4ec0d
11 changed files with 0 additions and 1 deletions

View File

@@ -0,0 +1,70 @@
<template>
<div class="AppActivity">
<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: 'AppActivity',
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">
.AppActivity {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,106 @@
<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 prop="title" style="width: 100%;" label="标题" :rules="[{required: true, message: '请输入活动标题', trigger: 'change'}]">
<el-input size="small" placeholder="请输入活动标题" v-model="form.title"></el-input>
</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-form-item>
<el-form-item label="附件" prop="files" style="width: 100%;">
<ai-uploader
:instance="instance"
v-model="form.files"
fileType="file"
:limit="9">
</ai-uploader>
</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: {
title: '',
content: '',
files: []
},
id: ''
}
},
computed: {
...mapState(['user'])
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appactivityinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
}
})
},
confirm () {
this.$refs.form.validate((valid) => {
if (valid) {
this.instance.post(`/app/appactivityinfo/addOrUpdate`, {
...this.form
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 600)
}
})
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,113 @@
<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>
<ai-wrapper
label-width="120px">
<ai-info-item label="活动标题" :value="info.title"></ai-info-item>
<ai-info-item label="活动内容" isLine>
<AiArticle :value="info.content"></AiArticle>
</ai-info-item>
<ai-info-item label="附件" isLine>
<AiFileList :fileList="info.files"></AiFileList>
</ai-info-item>
</ai-wrapper>
</template>
</ai-card>
<ai-card title="报名列表">
<template #content>
<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="90px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
</div>
</template>
</el-table-column> -->
</ai-table>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
colConfigs: [
{ prop: 'userName', label: '姓名', align: 'left', width: '200px' },
{ prop: 'userPhone', label: '手机号', align: 'center' },
{ prop: 'createTime', label: '报名时间', align: 'center' }
],
search: {
size: 10,
current: 1
},
tableData: [],
total: 0,
info: {}
}
},
created () {
this.getInfo()
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appactivityinfo/signUpList?activityId=${this.params.id}`, null, {
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
getInfo () {
this.instance.post(`/app/appactivityinfo/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
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,154 @@
<template>
<ai-list class="notice">
<template slot="title">
<ai-title title="活动管理" isShowBottomBorder>
</ai-title>
</template>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<ai-select
v-model="search.status"
clearable
placeholder="请选择活动状态"
:selectList="statusList"
@change="search.current = 1, getList()">
</ai-select>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
</template>
<template #right>
<el-input
v-model="search.title"
class="search-input"
size="small"
v-throttle="() => {search.current = 1, getList()}"
placeholder="请选择活动标题"
clearable
@clear="search.current = 1, search.province = '', 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="toAdd(row.id)">编辑</el-button>
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
<el-button type="text" @click="stop(row.id, row.status)">{{ row.status === '1' ? '关闭' : '开启' }}</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
export default {
name: 'List',
props: {
instance: Function,
dict: Object
},
data () {
return {
search: {
current: 1,
size: 10,
title: '',
status: ''
},
total: 10,
colConfigs: [
{ prop: 'title', label: '活动标题', align: 'left', width: '200px' },
{ prop: 'signUpCount', label: '报名人数', align: 'center', format: e => e },
{ prop: 'status', label: '活动状态', align: 'center', format: e => this.statusList.filter(v => v.dictValue === e)[0].dictName }
],
tableData: [],
statusList: [
{
dictValue: '1',
dictName: '进行中'
},
{
dictValue: '2',
dictName: '已结束'
}
]
}
},
created() {
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appactivityinfo/list`, null, {
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
stop (id, status) {
this.$confirm(status === '1' ? '确认关闭该活动?' : '确认开启该活动?').then(() => {
this.instance.post(`/app/appactivityinfo/stop?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('操作成功!')
this.getList()
}
})
})
},
remove (id) {
this.$confirm('确定删除该活动?').then(() => {
this.instance.post(`/app/appactivityinfo/delete?ids=${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>