居民学习记录

This commit is contained in:
yanran200730
2023-02-09 10:26:56 +08:00
parent ea5850fb70
commit 8d52238a6f
7 changed files with 555 additions and 23 deletions

View File

@@ -0,0 +1,106 @@
<template>
<ai-detail class="AppCertificateManage">
<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="title" :rules="[{required: true, message: '请输入证书名称', trigger: 'blur'}]">
<el-input size="small" v-model="form.title" clearable placeholder="请输入证书名称" :maxlength="200"></el-input>
</el-form-item>
<el-form-item prop="type" style="width: 100%" label="类型" :rules="[{required: true, message: '请选择类型', trigger: 'change'}]">
<el-radio-group v-model="form.type">
<el-radio label="1">单选题</el-radio>
<el-radio label="2">多选题</el-radio>
<el-radio label="3">判断题</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="上传证书" prop="pictureUrl" style="width: 100%;" :rules="[{required: true, message: '请上传证书', trigger: 'change'}]">
<ai-uploader
:instance="instance"
v-model="form.pictureUrl"
:limit="1">
</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>
export default {
name: 'Add',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
form: {
title: '',
content: '',
pictureUrl: [],
type: '1'
},
id: ''
}
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appcontentinfo/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/appcontentinfo/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">
.AppCertificateManage {
}
</style>

View File

@@ -0,0 +1,126 @@
<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>
<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, 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="120px" 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="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' },
{ prop: 'createUserName', label: '证书名称', align: 'center' },
{ prop: 'createUserName', label: '类型', align: 'center' },
{ prop: 'createUserName', label: '已颁发数量', align: 'center' },
{ prop: 'createUserName', label: '累积学习时(分钟)', align: 'center' },
{ prop: 'createUserName', label: '通过考试', align: 'center' }
],
tableData: []
}
},
created() {
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appmarketingactivityinfo/list`, null, {
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
remove (id) {
this.$confirm('确定删除该活动?').then(() => {
this.instance.post(`/app/appmarketingactivityinfo/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>