This commit is contained in:
yanran200730
2021-12-20 09:35:46 +08:00
8 changed files with 1911 additions and 0 deletions

View File

@@ -0,0 +1,222 @@
<template>
<section class="AppFoundingHundred">
<ai-list v-if="showList">
<template #title>
<ai-title title="党史课堂" isShowBottomBorder>
<template #rightBtn>
<ai-party :instance="instance" v-model="organizationId" :topOrgId="topOrgId" size="small"
@origin="changeParty"/>
</template>
</ai-title>
</template>
<template #content>
<ai-search-bar>
<template slot="left">
<el-button type="primary" icon="iconfont iconAdd" @click="handleAdd">添加</el-button>
</template>
<template slot="right">
<el-input placeholder="课程主题" v-model="search.title" size="small" suffix-icon="iconfont iconSearch"></el-input>
<el-button type="primary" icon="iconfont iconSearch" size="small" @click="page.current=1,getList()">查询</el-button>
<el-button icon="el-icon-refresh-right" size="small" @click="page.current=1,search={},getList()">重置</el-button>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
stripe
:total="total"
:current.sync="page.current"
:size.sync="page.size"
style="margin-top: 10px;"
@getList="getList">
<el-table-column slot="options" label="操作" align="center">
<div slot-scope="{row}">
<el-button type="text" icon="iconfont iconChange" :title="row.status==0?'发布':'取消发布'"
@click="handleChange(row)"/>
<el-button type="text" icon="iconfont iconAdd" title="添加"
@click="handleAddSeries(row)"/>
<el-button type="text" icon="iconfont iconShow" title="详情"
@click="handleDetail(row)"/>
<el-button type="text" icon="iconfont iconEdit" title="编辑"
@click="handleEdit(row)"/>
<el-button type="text" icon="iconfont iconDelete" title="删除"
@click="handleDelete(row)"/>
</div>
</el-table-column>
</ai-table>
</template>
</ai-list>
<component :is="comp" v-else :row="row" :instance="instance" :dict="dict" :permissions="permissions" @back="back"
:isEdit="isEdit" :organizationId="organizationId" :organizationName="organizationName"></component>
</section>
</template>
<script>
import partyClassAdd from "./components/partyClassAdd";
import seriesManage from "./components/seriesManage";
import {mapState} from "vuex";
export default {
name: "AppPartyHistoryClass",
label: "党史课堂",
components: {partyClassAdd, seriesManage},
props: {
instance: Function,
dict: Object,
permissions: Function
},
data() {
return {
comp: "",
tableData: [],
total: 0,
row: {},
showList: true,
search: {},
topOrgId: "",
partyList: [],
treeData: [],
organizationId: "",
organizationName: "",
isEdit: false,
page: {
current: 1,
size: 10
}
}
},
computed: {
...mapState(["user"]),
colConfigs() {
return [
{label: "课程主题", prop: "title"},
{
label: "更新状态",
render: (h, {row}) => [ < span > {this.dict.getLabel('classroomUpdateStatus', row.updateStatus)} < /span>]
},
{label: "更新时间", prop: "updateDate"},
{label: "发布时间", prop: "createDate"},
{
label: "发布状态",
render: (h, {row}) => [ < span > {this.dict.getLabel('newsCenterStatus', row.status)} < /span>]
},
{label: "发布组织", prop: "organizationName"},
{slot: "options"}
];
}
},
methods: {
handleChange(row) {
this.$confirm(`是否确定要${row.status==0?'发布':'取消发布'}?`).then(_ => {
this.instance.post("/app/apppartyclassroom/addOrUpdate", {
id: row.id,
status: row.status == 0 ? 1 : 0
}).then(res=>{
if(res.code==0){
this.$message.success(`${row.status == 0?'发布成功':'取消发布成功'}`);
this.getList();
}
})
})
},
handleAddSeries(row) {
this.showList = false;
this.comp = "seriesManage";
this.row = row;
},
handleDelete({id}){
this.$confirm("确定要删除吗?").then(_=>{
this.instance.post("/app/apppartyclassroom/delete", null, {
params: {
ids:id
}
}).then(res => {
if (res.code==0) {
this.$message.success("删除成功");
this.getList();
}
})
})
},
handleEdit(row) {
this.showList = false;
this.isEdit = true;
this.comp = "partyClassAdd";
this.row = row;
},
handleDetail(row) {
this.showList = false;
this.isEdit = false;
this.comp = "partyClassAdd";
this.row = row;
},
changeParty(e) {
if (!e.length) return
this.organizationName = e[0]?.name;
this.resetSearch();
},
resetSearch() {
this.page.current = 1;
this.getList();
},
// 查询所有单位 树形结构
searchSysAll(id) {
this.instance.post('/admin/partyOrganization/queryAllChildren', null, {
params: {
id: id
}
}).then((res) => {
if (res?.data) {
res.data = res.data.map(a => {
return {...a, label: a.name}
});
this.treeData = res.data.filter(e => e.id == this.user.info.organizationId);
this.treeData.map(t => this.addChild(t, res.data));
}
})
},
// 点击树节点
handleNodeClick(data) {
this.partyList = data;
},
back() {
this.comp = "";
this.showList = true;
this.isEdit = false;
},
handleAdd() {
this.comp = "partyClassAdd";
this.showList = false;
this.isEdit = true;
this.row = {};
},
getList() {
this.instance.post("/app/apppartyclassroom/list", null, {
params: {
...this.page,
...this.search,
}
}).then(res => {
if (res?.data) {
this.tableData = res.data.records;
this.total = res.data.total;
}
})
}
},
created() {
this.topOrgId = this.user.info?.organizationId;
this.searchSysAll(this.user.info?.organizationId);
this.organizationId = this.user.info?.organizationId;
this.organizationName = this.user.info?.organizationName;
this.dict.load("classroomUpdateStatus",'newsCenterStatus');
this.getList();
}
}
</script>
<style lang="scss" scoped>
.AppFoundingHundred {
height: 100%;
}
</style>

View File

@@ -0,0 +1,257 @@
<template>
<section class="add_Party" :class="{isDetail:!isEdit}">
<ai-detail>
<ai-title slot="title" :title="detailTitle" isShowBottomBorder isShowBack @onBackClick="$emit('back')">
</ai-title>
<template #content>
<div class="detail-content" v-if="isEdit">
<el-form :model="form" label-width="120px" ref="ruleForm" :rules="rules">
<el-form-item label="课程主题" prop="title">
<el-input size="small" v-model="form.title" clearable placeholder="请输入..." maxlength="100"
show-word-limit/>
</el-form-item>
<el-form-item label="更新状态" prop="updateStatus">
<ai-select v-model="form.updateStatus" :selectList="dict.getDict('classroomUpdateStatus')"/>
</el-form-item>
<el-form-item label="发布组织" prop="organizationName">
<el-input size="small" v-model="form.organizationName" clearable placeholder="请输入..." maxlength="100"
show-word-limit/>
</el-form-item>
<el-form-item label="封面" prop="thumbUrl">
<ai-uploader
:instance="instance"
v-model="form.thumbUrl"
:limit="1"
:cropOps="cropOps"
is-crop>
<template slot="tips">图片比例1.61</template>
</ai-uploader>
</el-form-item>
<el-form-item label="课程简介" prop="content">
<ai-editor v-model="form.content" :instance="instance"/>
</el-form-item>
</el-form>
</div>
<!--详情-->
<div class="village_detail" v-else>
<img class="cover" :src="form.thumbUrl[0].url" v-if="form.thumbUrl && form.thumbUrl.length">
<ai-wrapper label-width="100px" :columnsNumber="2">
<ai-info-item label="课程主题" isLine>{{form.title}}</ai-info-item>
<ai-info-item label="更新状态">{{dict.getLabel("classroomUpdateStatus",form.updateStatus)}}</ai-info-item>
<ai-info-item label="更新集数">{{form.episodeNum}}</ai-info-item>
<ai-info-item label="最后更新时间">{{form.updateDate}}</ai-info-item>
<ai-info-item label="发布组织">{{form.organizationName}}</ai-info-item>
<ai-info-item label="课程简介" isLine>
<div v-html="form.content" style="margin-right: 80px"/>
</ai-info-item>
</ai-wrapper>
</div>
</template>
<template #footer>
<template v-if="isEdit">
<el-button size="small" @click="$emit('back')">取消</el-button>
<el-button type="primary" size="small" @click="saveAdd(0)">保存
</el-button>
<el-button type="primary" size="small" @click="saveAdd(1)">保存并发布
</el-button>
</template>
</template>
</ai-detail>
</section>
</template>
<script>
export default {
name: "partyClassAdd",
props: {
instance: Function,
dict: Object,
permissions: Function,
row: Object,
isEdit: Boolean,
organizationId: String,
},
computed: {
detailTitle() {
return this.isEdit ? '编辑党史课堂' : '党史课堂详情'
}
},
data() {
return {
form: {
organizationId: '',
title: '',
type: '',
content: '',
thumbUrl: []
},
rules: {
title: [{required: true, message: "请填写标题"}],
organizationName: [{required: true, message: "请输入发布组织"}],
updateStatus: [{required: true, message: "请选择更新状态", trigger: "change"}],
thumbUrl: [{required: true, message: "请上传封面", trigger: "change"}],
content: [{required: true, message: "请选择正文"}],
},
isDetail: true,
count: 0,
cropOps: {
width: "336px",
height: "210px"
}
}
},
methods: {
downLoad(url) {
window.open(url);
},
// 保存
saveAdd(status) {
if (this.count != 0) {
this.$message.error('文件正在上传中');
return
}
this.$refs.ruleForm.validate(v => {
if (v) {
this.instance.post('/app/apppartyclassroom/addOrUpdate', {
...this.form,
status,
style: 1,
thumbUrl: this.form.thumbUrl.length ? JSON.stringify([{
url: this.form.thumbUrl[0].url
}]) : ''
}).then((res) => {
if (res && res.code == 0) {
this.row?.id ? this.$message.success('修改成功') : this.$message.success('添加成功');
this.$emit("back");
}
})
}
})
},
// 详情
checkDetaiList(id) {
id && this.instance.post('/app/apppartyclassroom/queryDetailById', null, {
params: {id}
}).then((res) => {
if (res?.data) {
this.form = res.data;
this.form.thumbUrl = res.data.thumbUrl ? JSON.parse(res.data.thumbUrl) : []
}
})
},
},
created() {
this.form.organizationId = this.organizationId;
this.dict.load('classroomUpdateStatus')
this.checkDetaiList(this.row?.id);
},
}
</script>
<style scoped lang="scss">
.cover {
display: block;
width: 300px;
height: 140px;
margin: 20px auto;
}
.add_Party {
height: 100%;
position: relative;
background: #fff;
display: flex;
flex-direction: column;
.detail-content {
padding-bottom: 80px;
}
.el-form {
width: 760px;
margin: 18px auto 64px;
// overflow-x: auto;
// overflow-y: auto;
padding-right: 3px !important;
.el-form-item {
margin-bottom: 18px;
}
.upload-tip {
position: absolute;
text-align: left;
left: 100px;
top: 5px;
li {
color: #888;
font-size: 12px;
line-height: 14px;
}
b {
color: red;
font-size: 14px
}
}
}
.village_detail {
margin-top: 16px;
margin-bottom: 16px;
width: 760px;
overflow-y: auto;
border: 1px solid #eee;
border-radius: 4px;
display: flex;
flex-direction: column;
background: #fff;
.village_title {
padding: 24px;
border-bottom: 1px solid #eee;
h3, p {
text-align: center;
}
}
.village_file {
display: flex;
border-bottom: 1px solid #eee;
padding: 8px 20px;
span {
width: 60px;
}
div {
flex: 1;
}
.fileSty {
color: #999;
font-size: 14px;
cursor: pointer;
margin-bottom: 4px;
}
.fileSty:hover {
color: #5088FF;
}
}
.village_cont {
flex: 1;
padding: 30px 20px;
}
}
&.isDetail {
::v-deep .ai-detail__content {
background: #f3f6f9;
}
}
}
</style>

View File

@@ -0,0 +1,276 @@
<template>
<section class="add_Party" :class="{isDetail:!isEdit}">
<ai-detail>
<ai-title slot="title" :title="detailTitle" isShowBottomBorder isShowBack @onBackClick="$emit('back')">
</ai-title>
<template #content>
<div class="detail-content" v-if="isEdit">
<el-form :model="form" label-width="120px" ref="ruleForm" :rules="rules">
<el-form-item label="单集名称" prop="title">
<el-input size="small" v-model="form.title" clearable placeholder="请输入..." maxlength="100"
show-word-limit/>
</el-form-item>
<el-form-item label="单集顺序" prop="num">
<el-row type="flex" justify="space-between">
<div style="width: 540px">
<el-input size="small" v-model="form.num" clearable placeholder="请输入..." maxlength="100"
show-word-limit/>
</div>
<span>已更新至{{episodeNum}}</span>
</el-row>
</el-form-item>
<el-form-item label="视频" prop="videoUrl">
<el-input size="small" v-model="form.videoUrl" clearable placeholder="请输入..." maxlength="300"
show-word-limit/>
</el-form-item>
</el-form>
</div>
<!--详情-->
<div class="village_detail" v-else>
<div class="village_title">
<h3>{{ form.title }}</h3>
<p style="font-size: 14px;color: #999;">{{ form.createDate|timeVal }} {{ form.organizationName }}</p>
</div>
<div class="village_file" v-if="form.files && form.files.length">
<span>附件</span>
<div>
<p v-for="(item,i) in form.files" :key="i" class="fileSty" @click="downLoad(item.accessUrl)">
{{ item.fileName }}{{ item.postfix }}
</p>
</div>
</div>
<img class="cover" :src="form.thumbUrl[0].url" v-if="form.thumbUrl && form.thumbUrl.length">
<div class="village_cont" v-html="form.content"/>
</div>
</template>
<template #footer>
<template v-if="isEdit">
<el-button size="small" @click="$emit('back')">取消</el-button>
<el-button type="primary" size="small" @click="saveAdd(0)">保存
</el-button>
<el-button type="primary" size="small" @click="saveAdd(1)">保存并发布
</el-button>
</template>
</template>
</ai-detail>
</section>
</template>
<script>
export default {
name: "seriesAdd",
props: {
instance: Function,
dict: Object,
permissions: Function,
row: Object,
parentRow: Object,
isEdit: Boolean
},
computed: {
detailTitle() {
return this.isEdit ? '编辑剧集' : '新增剧集'
}
},
data() {
return {
form: {
organizationId: '',
organizationName: '',
title: '',
num: '',
videoUrl: "",
},
rules: {
title: [{required: true, message: "请填写单集名称"}],
num: [{required: true, message: "请填写单集顺序"}],
videoUrl: [{required: true, message: "请填写视频地址"}],
},
isDetail: true,
episodeNum: 0,
cropOps: {
width: "336px",
height: "210px"
}
}
},
methods: {
downLoad(url) {
window.open(url);
},
// 保存
saveAdd(status) {
this.$refs.ruleForm.validate(v => {
if (v) {
this.instance.post('/app/apppartyclassroomepisode/addOrUpdate', {
...this.form,
status,
classroomId: this.parentRow?.id,
id: !!this.row.id ? this.row.id : null
}).then((res) => {
if (res && res.code == 0) {
this.row?.id ? this.$message.success('修改成功') : this.$message.success('添加成功');
this.$emit("back");
}
})
}
})
},
// 详情
checkDetaiList(id) {
id && this.instance.post('/app/apppartyclassroom/queryLargestNum', null, {
params: {id}
}).then((res) => {
if (res?.data) {
this.episodeNum = res.data;
}
})
},
getDetail() {
this.instance.post('/app/apppartyclassroomepisode/queryDetailById', null, {
params: {
id: this.row?.id
}
}).then((res) => {
if (res?.data) {
this.form.title = res.data.title;
this.form.num = res.data.num;
this.form.videoUrl = res.data.videoUrl;
}
})
},
handleDelete(ids) {
this.$confirm('确定删除该文章吗').then(() => {
this.instance.post('/app/apppartyhistory/delete', null, {
params: {ids}
}).then(res => {
if (res?.code == 0) {
this.isAdd = false;
this.isDetailEdit = false;
this.$message.success('删除成功');
if ((this.total - 1) % this.searchObj.size == 0) {
this.searchObj.current -= 1
}
this.searchVillageList();
}
})
}).catch(() => 0)
},
},
created() {
this.form.organizationId = this.organizationId;
this.form.organizationName = this.organizationName;
this.checkDetaiList(this.parentRow?.id);
if (this.row?.id) {
this.getDetail();
}
},
}
</script>
<style scoped lang="scss">
.cover {
display: block;
width: 300px;
height: 140px;
margin: 20px auto;
}
.add_Party {
height: 100%;
position: relative;
background: #fff;
display: flex;
flex-direction: column;
.detail-content {
padding-bottom: 80px;
}
.el-form {
width: 760px;
margin: 18px auto 64px;
// overflow-x: auto;
// overflow-y: auto;
padding-right: 3px !important;
.el-form-item {
margin-bottom: 18px;
}
.upload-tip {
position: absolute;
text-align: left;
left: 100px;
top: 5px;
li {
color: #888;
font-size: 12px;
line-height: 14px;
}
b {
color: red;
font-size: 14px
}
}
}
.village_detail {
margin-top: 16px;
width: 760px;
overflow-y: auto;
border: 1px solid #eee;
border-radius: 4px;
display: flex;
flex-direction: column;
background: #fff;
.village_title {
padding: 24px;
border-bottom: 1px solid #eee;
h3, p {
text-align: center;
}
}
.village_file {
display: flex;
border-bottom: 1px solid #eee;
padding: 8px 20px;
span {
width: 60px;
}
div {
flex: 1;
}
.fileSty {
color: #999;
font-size: 14px;
cursor: pointer;
margin-bottom: 4px;
}
.fileSty:hover {
color: #5088FF;
}
}
.village_cont {
flex: 1;
padding: 30px 20px;
}
}
&.isDetail {
::v-deep .ai-detail__content {
background: #f3f6f9;
}
}
}
</style>

View File

@@ -0,0 +1,186 @@
<template>
<section class="AppFoundingHundred">
<ai-list isTabs v-if="showList">
<template #title>
<ai-title title="剧集管理" isShowBottomBorder :isShowBack="true" @onBackClick="$emit('back')"></ai-title>
</template>
<template #content>
<ai-search-bar>
<template slot="left">
<el-button type="primary" icon="iconfont iconAdd" @click="handleAdd">添加</el-button>
</template>
<!-- <template slot="right">-->
<!-- <el-input placeholder="课程主题" size="small" suffix-icon="iconfont iconSearch"></el-input>-->
<!-- <el-button type="primary" icon="iconfont iconSearch" size="small">查询</el-button>-->
<!-- <el-button icon="el-icon-refresh-right" size="small">重置</el-button>-->
<!-- </template>-->
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
stripe
:total="total"
:current.sync="page.current"
:size.sync="page.size"
style="margin-top: 10px;"
@getList="getList">
<el-table-column slot="options" label="操作" align="center">
<div slot-scope="{row}">
<el-button type="text" icon="iconfont iconChange" :title="row.status==1?'取消发布':'发布'"
@click="handleChange(row)"/>
<el-button type="text" icon="iconfont iconMediaPlayer_Play" title="播放"
@click="handlePlay(row)"/>
<el-button type="text" icon="iconfont iconEdit" title="编辑"
@click="handleEdit(row)"/>
<el-button type="text" icon="iconfont iconDelete" title="删除"
@click="handleDelete(row)"/>
</div>
</el-table-column>
</ai-table>
</template>
</ai-list>
<component :is="comp" v-else :row="currentRow" :parentRow="row" :instance="instance" :dict="dict" :permissions="permissions"
@back="back"
:isEdit="isEdit"></component>
<el-dialog
title="播放"
:visible.sync="dialog"
@close="$refs['video'].pause()"
@closed="videoUrl=''"
width="800px">
<video controls autoplay width="100%" height="100%" ref="video">
<source :src="videoUrl" type="video/mp4">
<source :src="videoUrl" type="video/webm">
</video>
<span slot="footer">
<el-button @click="dialog=false">关闭</el-button>
</span>
</el-dialog>
</section>
</template>
<script>
import seriesAdd from "./seriesAdd";
export default {
name: "seriesManage",
components: {seriesAdd},
props: {
instance: Function,
dict: Object,
permissions: Function,
row: Object,
},
data() {
return {
comp: "",
tableData: [],
total: 0,
currentRow: {},
dialog: false,
videoUrl: "",
showList: true,
search: {},
isEdit: false,
page: {
current: 1,
size: 10
}
}
},
computed: {
colConfigs() {
return [
{label: "单集名称", prop: "title"},
{label: "单集顺序", prop: "num"},
{label: "发布状态", render:(h,{row})=>[<span>{this.dict.getLabel('newsCenterStatus',row.status)}</span>]},
{label: "创建时间", prop: "createDate"},
{slot: "options"}
];
}
},
methods: {
handleChange(row) {
this.$confirm(`是否确实要${row.status == 0?'发布':'取消发布'}?`).then(_ => {
this.instance.post("/app/apppartyclassroomepisode/addOrUpdate", {
id: row.id,
classroomId: this.row?.id,
status: row.status == 0 ? 1 : 0
}).then(res => {
if (res.code == 0) {
this.$message.success(`${row.status==0?'发布':'取消发布'}成功`);
this.getList();
}
})
})
},
handleEdit(row) {
this.showList = false;
this.isEdit = true;
this.comp = "seriesAdd";
this.currentRow = row;
},
handlePlay(row) {
this.dialog = true;
this.videoUrl = row.videoUrl;
this.$nextTick(_=>{
const video = this.$refs["video"];
video.src = row.videoUrl;
video.play();
})
},
handleDelete({id}) {
this.$confirm("是否确定要删除?").then(_ => {
this.instance.post("/app/apppartyclassroomepisode/delete", null, {
params: {
ids: id
}
}).then(res => {
if (res.code == 0) {
this.$message.success("删除成功");
this.getList();
}
})
})
},
back() {
this.comp = "";
this.showList = true;
this.isEdit = false;
this.getList();
this.currentRow = {};
},
handleAdd() {
this.comp = "seriesAdd";
this.showList = false;
this.isEdit = true;
this.currentRow = {};
},
getList() {
this.instance.post("/app/apppartyclassroomepisode/list", null, {
params: {
...this.page,
classroomId: this.row?.id
}
}).then(res => {
if (res?.data) {
this.tableData = res.data.records;
this.total = res.data.total;
}
})
}
},
created() {
this.currentRow = {};
this.getList();
this.dict.load("newsCenterStatus")
}
}
</script>
<style lang="scss" scoped>
.AppFoundingHundred {
width: 100%;
height: 100%;
}
</style>

View File

@@ -0,0 +1,228 @@
<template>
<section class="AppFoundingHundred">
<ai-list v-if="showList">
<template #title>
<ai-title title="党史教育" isShowBottomBorder>
<template #rightBtn>
<ai-party :instance="instance" v-model="organizationId" :topOrgId="topOrgId" size="small"
@origin="changeParty"/>
</template>
</ai-title>
</template>
<template #content>
<ai-search-bar>
<template slot="left">
<el-button type="primary" icon="iconfont iconAdd" @click="handleAdd">添加</el-button>
<el-select placeholder="类型" size="small" v-model="search.style" clearable
@change="page.current=1,getList()">
<el-option
v-for="(item,index) in dict.getDict('partyEducationType')"
:key="index"
:label="item.dictName"
:value="item.dictValue">
</el-option>
</el-select>
<el-select placeholder="发布状态" size="small" clearable v-model="search.status"
@change="page.current=1,getList()">
<el-option
v-for="(item,index) in dict.getDict('newsCenterStatus')"
:key="index"
:label="item.dictName"
:value="item.dictValue">
</el-option>
</el-select>
</template>
<template slot="right">
<el-input placeholder="标题" size="small" suffix-icon="iconfont iconSearch" v-model="search.title"></el-input>
<el-button type="primary" icon="iconfont iconSearch" size="small" @click="page.current=1,getList()">查询
</el-button>
<el-button icon="el-icon-refresh-right" size="small" @click="page.current=1,search={},getList()">重置</el-button>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
stripe
:total="total"
:current.sync="page.current"
:size.sync="page.size"
style="margin-top: 10px;"
@getList="getList">
<el-table-column slot="options" label="操作" align="center">
<div slot-scope="{row}">
<el-button type="text" icon="iconfont iconChange" :title="row.status==1?'取消发布':'发布'"
@click="handleChange(row)"/>
<el-button type="text" icon="iconfont iconShow" title="详情"
@click="handleDetail(row)"/>
<el-button type="text" icon="iconfont iconEdit" title="编辑"
@click="handleEdit(row)"/>
<el-button type="text" icon="iconfont iconDelete" title="删除"
@click="handleDelete(row.id)"/>
</div>
</el-table-column>
</ai-table>
</template>
</ai-list>
<component :is="comp" v-else :row="row" :instance="instance" :dict="dict" :permissions="permissions" @back="back"
:isEdit="isEdit" :organizationId="organizationId" :organizationName="organizationName"></component>
</section>
</template>
<script>
import partyAdd from "./components/partyAdd";
import {mapState} from "vuex";
export default {
name: "AppPartyHistoryEducation",
label: "党史教育",
components: {partyAdd},
props: {
instance: Function,
dict: Object,
permissions: Function
},
data() {
return {
comp: "",
tableData: [],
total: 0,
row: {},
showList: true,
search: {},
isEdit: false,
topOrgId: "",
partyList: [],
treeData: [],
organizationId: "",
organizationName: "",
page: {
current: 1,
size: 10
}
}
},
computed: {
...mapState(["user"]),
colConfigs() {
return [
{label: "类型", render: (h, {row}) => [<span>{this.dict.getLabel('partyEducationType', row.style)}</span>]},
{label: "标题", prop: "title"},
{label: "发布状态", render: (h, {row}) => [<span>{this.dict.getLabel('newsCenterStatus', row.status)}</span>]},
{label: "发布时间", prop: "createDate"},
{label: "发布人", prop: "createUser"},
{label: "发布组织", prop: "organizationName"},
{slot: "options"}
];
}
},
methods: {
handleDetail(row) {
this.row = row;
this.showList = false;
this.comp = "partyAdd";
},
changeParty(e) {
if (!e.length) return
this.organizationName = e[0]?.name;
this.resetSearch();
},
handleEdit(row) {
this.row = row;
this.showList = false;
this.isEdit = true;
this.comp = "partyAdd";
},
resetSearch() {
this.page.current = 1;
this.getList();
},
handleDelete(id) {
this.$confirm("是否确定要删除?").then(_ => {
this.instance.post("/app/apppartyeducation/delete", null, {
params: {
ids: id,
}
}).then(res => {
if (res.code == 0) {
this.$message.success("删除成功");
this.getList();
}
})
})
},
handleChange(row) {
this.$confirm(`是否确定要${row.status == 0 ? '发布' : '取消发布'}`).then(_ => {
this.instance.post("/app/apppartyeducation/updateCountYardstatus", {
id: row.id,
status: row.status == 0 ? 1 : 0
}).then(res => {
if (res.code == 0) {
this.$message.success(`${row.status == 0 ? '发布' : '取消发布'}成功`);
this.getList();
}
})
})
},
back() {
this.comp = "";
this.showList = true;
this.isEdit = false;
this.getList();
},
handleAdd() {
this.comp = "partyAdd";
this.showList = false;
this.isEdit = true;
this.row = {};
},
// 查询所有单位 树形结构
searchSysAll(id) {
this.instance.post('/admin/partyOrganization/queryAllChildren', null, {
params: {
id: id
}
}).then((res) => {
if (res?.data) {
res.data = res.data.map(a => {
return {...a, label: a.name}
});
this.treeData = res.data.filter(e => e.id == this.user.info.organizationId);
this.treeData.map(t => this.addChild(t, res.data));
}
})
},
// 点击树节点
handleNodeClick(data) {
this.partyList = data;
},
getList() {
this.instance.post("/app/apppartyeducation/list", null, {
params: {
...this.page,
...this.search,
}
}).then(res => {
if (res?.data) {
this.tableData = res.data.records;
this.total = res.data.total;
}
})
}
},
created() {
this.topOrgId = this.user.info.organizationId;
this.searchSysAll(this.user.info.organizationId);
this.organizationId = this.user.info.organizationId;
this.organizationName = this.user.info.organizationName;
this.dict.load("newsCenterStatus", "partyEducationType");
this.getList();
}
}
</script>
<style lang="scss" scoped>
.AppFoundingHundred {
height: 100%;
}
</style>

View File

@@ -0,0 +1,290 @@
<template>
<section class="add_Party" :class="{isDetail:!isEdit}">
<ai-detail>
<ai-title slot="title" :title="detailTitle" isShowBottomBorder isShowBack @onBackClick="$emit('back')">
<!-- <template #rightBtn v-if="$route.query.id&&!isEdit">-->
<!-- <el-button size="small" type="primary" icon="iconfont iconEdit"-->
<!-- @click="$router.push({...$route,hash:'#add'})">编辑-->
<!-- </el-button>-->
<!-- <el-button size="small" icon="iconfont iconDelete" type="danger" plain-->
<!-- @click="handleDelete($route.query.id)">删除-->
<!-- </el-button>-->
<!-- </template>-->
</ai-title>
<template #content>
<div class="detail-content" v-if="isEdit">
<el-form :model="form" label-width="120px" ref="ruleForm" :rules="rules">
<el-form-item label="标题" prop="title">
<el-input size="small" v-model="form.title" clearable placeholder="请输入..." maxlength="100"
show-word-limit/>
</el-form-item>
<el-form-item label="类型" prop="style">
<ai-select v-model="form.style" :selectList="dict.getDict('partyEducationType')" @change="handleChange"/>
</el-form-item>
<el-form-item label="发布组织" prop="organizationName">
<el-input size="small" v-model="form.organizationName" clearable placeholder="请输入..." maxlength="100"
show-word-limit/>
</el-form-item>
<!-- <el-form-item label="音频" prop="audioUrl" v-if="['0','1'].includes(form.style)">-->
<!-- <el-input v-model="form.audioUrl" placeholder="请输入..." size="small"></el-input>-->
<!-- </el-form-item>-->
<el-form-item label="正文" prop="content">
<ai-editor v-model="form.content" :instance="instance"/>
</el-form-item>
<el-form-item label="缩略图">
<ai-uploader
:instance="instance"
v-model="form.thumbUrl"
:limit="1"
:cropOps="cropOps"
is-crop>
<template slot="tips">图片比例1.61</template>
</ai-uploader>
</el-form-item>
<el-form-item label="发布日期" prop="publishDate" v-if="form.style==2">
<el-date-picker
size="small"
v-model="form.publishDate"
placeholder="请选择"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-form>
</div>
<!--详情-->
<div class="village_detail" v-else>
<div class="village_title">
<h3>{{ form.title }}</h3>
<el-row type="flex" justify="space-between">
<el-col :span="8" style="font-size: 14px;color: #333333">
类型{{dict.getLabel('partyEducationType',form.style)}}
</el-col>
<el-col :span="8" style="font-size: 14px;color: #333333">
发文组织{{form.organizationName}}
</el-col>
<el-col :span="8" style="font-size: 14px;color: #333333">
<span v-if="form.publishDate">发文日期{{form.publishDate}}</span>
</el-col>
</el-row>
</div>
<img class="cover" :src="form.thumbUrl[0].url" v-if="form.thumbUrl && form.thumbUrl.length">
<div class="village_cont" v-html="form.content"/>
</div>
</template>
<template #footer v-if="isEdit">
<el-button size="small" @click="$emit('back')">取消</el-button>
<el-button type="primary" size="small" @click="saveAdd(0)">保存</el-button>
<el-button type="primary" size="small" @click="saveAdd(1)">保存并发布</el-button>
</template>
</ai-detail>
</section>
</template>
<script>
export default {
name: "partyAdd",
props: {
instance: Function,
dict: Object,
permissions: Function,
row: Object,
isEdit: Boolean,
},
computed: {
detailTitle() {
return this.isEdit ? '编辑党史教育' : '党史教育详情'
}
},
data() {
return {
form: {
organizationName: '',
// audioUrl: "",
publishDate: "",
title: '',
style: '',
content: '',
thumbUrl: []
},
rules: {
title: [{required: true, message: "请填写标题"}],
style: [{required: true, message: "请选择类型", trigger: "change"}],
organizationName: [{required: true, message: "请输入发布组织"}],
content: [{required: true, message: "请输入正文"}],
publishDate: [{required: true, message: "请选发布日期", trigger: "change"}],
},
isDetail: true,
count: 0,
cropOps: {
width: "336px",
height: "210px"
}
}
},
methods: {
handleChange(e) {
if (e == 1 || e == 2) {
this.form.publishDate = "";
}
// if (e == 2) {
// this.form.audioUrl == "";
// }
},
// 保存
saveAdd(status) {
this.$refs.ruleForm.validate(v => {
if (v) {
this.instance.post('/app/apppartyeducation/addOrUpdate', {
...this.form,
status,
thumbUrl: this.form.thumbUrl.length ? JSON.stringify([{
url: this.form.thumbUrl[0].url
}]) : ''
}).then((res) => {
if (res && res.code == 0) {
this.row?.id ? this.$message.success('修改成功') : this.$message.success('添加成功');
this.$emit("back");
}
})
}
})
},
// 详情
checkDetaiList(id) {
id && this.instance.post('/app/apppartyeducation/queryDetailById', null, {
params: {id}
}).then((res) => {
if (res?.data) {
this.form = res.data;
this.form.thumbUrl = res.data.thumbUrl ? JSON.parse(res.data.thumbUrl) : []
}
})
},
handleDelete(ids) {
this.$confirm('确定删除该文章吗').then(() => {
this.instance.post('/app/apppartyhistory/delete', null, {
params: {ids}
}).then(res => {
if (res?.code == 0) {
this.isAdd = false;
this.isDetailEdit = false;
this.$message.success('删除成功');
}
})
})
},
},
created() {
this.dict.load('partyEducationType')
this.checkDetaiList(this.row?.id);
},
}
</script>
<style scoped lang="scss">
.cover {
display: block;
width: 300px;
height: 140px;
margin: 20px auto;
}
.add_Party {
height: 100%;
position: relative;
background: #fff;
display: flex;
flex-direction: column;
.detail-content {
padding-bottom: 80px;
}
.el-form {
width: 760px;
margin: 18px auto 64px;
// overflow-x: auto;
// overflow-y: auto;
padding-right: 3px !important;
.el-form-item {
margin-bottom: 18px;
}
.upload-tip {
position: absolute;
text-align: left;
left: 100px;
top: 5px;
li {
color: #888;
font-size: 12px;
line-height: 14px;
}
b {
color: red;
font-size: 14px
}
}
}
.village_detail {
margin-top: 16px;
width: 760px;
overflow-y: auto;
border: 1px solid #eee;
border-radius: 4px;
display: flex;
flex-direction: column;
background: #fff;
.village_title {
padding: 24px;
border-bottom: 1px solid #eee;
h3, p {
text-align: center;
}
}
.village_file {
display: flex;
border-bottom: 1px solid #eee;
padding: 8px 20px;
span {
width: 60px;
}
div {
flex: 1;
}
.fileSty {
color: #999;
font-size: 14px;
cursor: pointer;
margin-bottom: 4px;
}
.fileSty:hover {
color: #5088FF;
}
}
.village_cont {
flex: 1;
padding: 30px 20px;
}
}
&.isDetail {
::v-deep .ai-detail__content {
background: #f3f6f9;
}
}
}
</style>

View File

@@ -0,0 +1,189 @@
<template>
<section class="AppFoundingHundred">
<ai-list v-if="showList">
<template #title>
<ai-title title="党史题库" isShowBottomBorder>
<template #rightBtn>
<ai-party :instance="instance" v-model="organizationId" :topOrgId="topOrgId" size="small"
@origin="changeParty"/>
</template>
</ai-title>
</template>
<template #content>
<ai-search-bar>
<template slot="left">
<el-button type="primary" icon="iconfont iconAdd" @click="handleAdd">添加</el-button>
</template>
<!-- <template slot="right">-->
<!-- <el-input placeholder="标题" size="small" suffix-icon="iconfont iconSearch"></el-input>-->
<!-- <el-button type="primary" icon="iconfont iconSearch" size="small">查询</el-button>-->
<!-- <el-button icon="el-icon-refresh-right" size="small">重置</el-button>-->
<!-- </template>-->
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
stripe
:total="total"
:current.sync="page.current"
:size.sync="page.size"
style="margin-top: 10px;"
@getList="getList">
<el-table-column slot="options" label="操作" align="center">
<div slot-scope="{row}">
<!-- <el-button type="text" icon="iconfont iconChange" :title="row.status==1?'取消发布':'发布'"-->
<!-- @click="handleUpdateCountYardstatus(row)"/>-->
<el-button type="text" icon="iconfont iconShow" title="详情"
@click="handleDetail(row)"/>
<el-button type="text" icon="iconfont iconEdit" title="编辑"
@click="handleEdit(row)"/>
<el-button type="text" icon="iconfont iconDelete" title="删除"
@click="handleDelete(row)"/>
</div>
</el-table-column>
</ai-table>
</template>
</ai-list>
<component :is="comp" v-else :row="row" :instance="instance" :dict="dict" :permissions="permissions" @back="back"
:isEdit="isEdit" :organizationId="organizationId" :organizationName="organizationName"></component>
</section>
</template>
<script>
import questionBankAdd from "./components/questionBankAdd";
import {mapState} from "vuex";
export default {
name: "AppQuestionBank",
label: "党史题库",
components: {questionBankAdd},
props: {
instance: Function,
dict: Object,
permissions: Function,
},
data() {
return {
comp: "",
tableData: [],
total: 0,
row: {},
showList: true,
search: {},
isEdit: false,
topOrgId: "",
partyList: [],
treeData: [],
organizationId: "",
organizationName: "",
page: {
current: 1,
size: 10
}
}
},
computed: {
...mapState(["user"]),
colConfigs() {
return [
{label: "类型", render: (h, {row}) => [< span> {row.type == 1 ? '单选题' : '多选题'} < /span>]},
{label: "题目", prop: "title"},
{label: "创建时间", prop: "createDate"},
{slot: "options"}
];
}
},
methods: {
handleDetail(row) {
this.comp = "questionBankAdd";
this.showList = false;
this.isEdit = false;
this.row = row;
},
changeParty(e) {
if (!e.length) return
this.organizationName = e[0]?.name;
this.search.current = 1;
this.getList();
},
// 查询所有单位 树形结构
searchSysAll(id) {
this.instance.post('/admin/partyOrganization/queryAllChildren', null, {
params: {
id: id
}
}).then((res) => {
if (res?.data) {
res.data = res.data.map(a => {
return {...a, label: a.name}
});
this.treeData = res.data.filter(e => e.id == this.user.info.organizationId);
this.treeData.map(t => this.addChild(t, res.data));
}
})
},
// 点击树节点
handleNodeClick(data) {
this.partyList = data;
},
handleDelete({id}) {
this.$confirm("是否确定要删除?").then(_ => {
this.instance.post("/app/apppartyquestion/delete", null, {
params: {
ids: id
}
}).then(res => {
if (res.code == 0) {
this.$message.success("删除成功");
this.getList();
}
})
})
},
handleEdit(row) {
this.comp = "questionBankAdd";
this.showList = false;
this.isEdit = true;
this.row = row;
},
back() {
this.comp = "";
this.showList = true;
this.isEdit = false;
this.row = {};
this.getList();
},
handleAdd() {
this.comp = "questionBankAdd";
this.showList = false;
this.isEdit = true;
this.row = {};
},
getList() {
this.instance.post("/app/apppartyquestion/list", null, {
params: {
...this.page
}
}).then(res => {
if (res?.data) {
this.tableData = res.data.records;
this.total = res.data.total;
}
})
}
},
created() {
this.topOrgId = this.user.info.organizationId;
this.searchSysAll(this.user.info.organizationId);
this.organizationId = this.user.info.organizationId;
this.organizationName = this.user.info.organizationName;
this.getList();
}
}
</script>
<style lang="scss" scoped>
.AppFoundingHundred {
height: 100%;
}
</style>

View File

@@ -0,0 +1,263 @@
<template>
<section class="add_Party" :class="{isDetail:!isEdit}">
<ai-detail>
<ai-title slot="title" :title="detailTitle" isShowBottomBorder isShowBack @onBackClick="$emit('back')">
</ai-title>
<template #content>
<div class="detail-content" v-if="isEdit">
<el-form :model="form" label-width="120px" ref="ruleForm" :rules="rules">
<el-form-item label="题目描述" prop="title">
<el-input size="small" v-model="form.title" type="textarea" :rows="6" clearable placeholder="请输入..."
maxlength="1000"
show-word-limit/>
</el-form-item>
<el-form-item label="题目类型" prop="type">
<el-radio-group v-model="form.type" @change="radioChange">
<el-radio label="1">单选题</el-radio>
<el-radio label="2">多选题</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="题目选项" prop="items">
<el-row type="flex" justify="space-between" v-for="(question,index) in form.items" :key="index">
<label>{{map(index)}}</label>
<div style="width: 500px">
<el-form-item :prop="'items.' + index + '.content'"
:rules="[{ required: true, message: '选项不能为空', trigger: 'blur' }]">
<el-input placeholder="请输入选项内容" size="small" v-model="question.content" clearable></el-input>
</el-form-item>
</div>
<el-checkbox :value="question.checked" @change="handleChange(index)">设为答案</el-checkbox>
<el-button type="text" icon="iconfont iconDelete" style="margin-top: 6px;"
:disabled="form.items.length<=1" @click="handleDel(index)"></el-button>
</el-row>
<el-button type="text" @click="handleAdd" v-if="form.items && form.items.length<7">添加选项</el-button>
</el-form-item>
<el-form-item label="答案解析" prop="analysis">
<ai-editor v-model="form.analysis" :instance="instance"/>
</el-form-item>
</el-form>
</div>
<!--详情-->
<div class="village_detail" v-else>
<div style="text-align: left;margin-bottom: 16px;">{{form.title}}</div>
<ai-wrapper :columnsNumber="2" label-width="80px">
<ai-info-item label="题目类型:">{{form.type==1?'单选题':'多选题'}}</ai-info-item>
<ai-info-item label="正确答案:">
<span
style="color: #2EA222;">{{form.items && form.items.filter(e=>e.checked).map(e=>e.sort).join(',')}}</span>
</ai-info-item>
<ai-info-item label="题目选项:" isLine>
<div v-for="(item,index) in form.items" :key="index" style="margin-bottom: 8px">
{{item.sort}}.{{item.content}}
</div>
</ai-info-item>
<ai-info-item label="答案解析:" isLine>
<span v-html="form.analysis"></span>
</ai-info-item>
</ai-wrapper>
</div>
</template>
<template #footer>
<template v-if="isEdit">
<el-button size="small" @click="$emit('back')">取消</el-button>
<el-button type="primary" size="small" @click="saveAdd(1)">保存
</el-button>
</template>
</template>
</ai-detail>
</section>
</template>
<script>
export default {
name: "questionBankAdd",
props: {
instance: Function,
dict: Object,
permissions: Function,
row: Object,
isEdit: Boolean,
organizationId: String,
organizationName: String,
},
computed: {
detailTitle() {
return this.isEdit ? '编辑党史题库' : '党史题库详情'
}
},
data() {
return {
form: {
organizationId: '',
organizationName: '',
title: '',
type: '1',
analysis: '',
items: [{
content: "",
sort: "A",
checked: false,
}]
},
rules: {
title: [{required: true, message: "请填写标题"}],
type: [{required: true, message: "请选择类型"}],
items: [{required: true, message: ""}],
analysis: [{required: true, message: "请填写答案解析"}],
},
fileList: [],
isDetail: true,
count: 0,
cropOps: {
width: "336px",
height: "210px"
}
}
},
methods: {
radioChange(){
this.form.items = [...this.form.items.map(e=>({...e,checked:false}))];
},
handleChange(index) {
if (this.form.type == 1) {
this.form.items = [...this.form.items.map(e=>({...e,checked:false}))];
this.form.items[index].checked = !this.form.items[index].checked;
}else {
this.form.items[index].checked = !this.form.items[index].checked;
}
},
handleDel(index) {
this.form.items.splice(index, 1);
},
handleAdd() {
this.form.items.push({
content: "",
sort: this.map(this.form.items.length),
checked: false,
})
},
map(index) {
return {
"0": "A",
"1": "B",
"2": "C",
"3": "D",
"4": "E",
"5": "F",
"6": "G",
}[index]
},
downLoad(url) {
window.open(url);
},
saveAdd() {
this.$refs.ruleForm.validate(v => {
if (v) {
if (this.form.items.length < 2) {
return this.$message.error("题目选项至少保留两项");
}
const flag = this.form.items.filter(e=>e.checked).length==0
if(flag){
return this.$message.error("请设置题目选项答案");
}
this.instance.post('/app/apppartyquestion/addOrUpdate', {
...this.form,
items: this.form.items?.map(e => ({...e, checked: e.checked ? 1 : 0})),
id: this.row?.id
}).then((res) => {
if (res && res.code == 0) {
this.row?.id ? this.$message.success('修改成功') : this.$message.success('添加成功');
this.$emit("back");
}
})
}
})
},
// 详情
checkDetaiList(id) {
id && this.instance.post('/app/apppartyquestion/queryDetailById', null, {
params: {id}
}).then((res) => {
if (res?.data) {
const items = res.data.items?.map(e => ({...e, checked: e.checked != 0}));
this.form = {...res.data, items};
}
})
},
},
created() {
this.form.organizationId = this.organizationId;
this.form.organizationName = this.organizationName;
this.dict.load('partyHistoryType0', 'partyPublicCommentStatus')
this.checkDetaiList(this.row?.id);
},
}
</script>
<style scoped lang="scss">
.cover {
display: block;
width: 300px;
height: 140px;
margin: 20px auto;
}
.add_Party {
height: 100%;
position: relative;
background: #fff;
display: flex;
flex-direction: column;
.detail-content {
padding-bottom: 80px;
}
.el-form {
width: 760px;
margin: 18px auto 64px;
padding-right: 3px !important;
.el-form-item {
margin-bottom: 18px;
}
.upload-tip {
position: absolute;
text-align: left;
left: 100px;
top: 5px;
li {
color: #888;
font-size: 12px;
line-height: 14px;
}
b {
color: red;
font-size: 14px
}
}
}
.village_detail {
margin-top: 16px;
width: 760px;
overflow-y: auto;
border: 1px solid #eee;
border-radius: 4px;
display: flex;
flex-direction: column;
background: #fff;
box-sizing: border-box;
padding: 16px;
}
&.isDetail {
::v-deep .ai-detail__content {
background: #f3f6f9;
}
}
}
</style>