赛季内容编辑

This commit is contained in:
fan 2024-03-07 14:42:35 +08:00
parent c3bb3266a4
commit 68584fd5fd
3 changed files with 99 additions and 1 deletions

View File

@ -348,3 +348,24 @@ export function finishContestExercise() {
method: 'PUT'
});
}
/** html
* @param {String} id 赛季id
* @param {String} data.htmlContent 内容
*/
export function editSeasonContent(id, data) {
return request({
url: `/api/exercise/race/season/${id}/html`,
method: 'post',
data
});
}
/** html
* @param {String} id 赛季id
*/
export function getSeasonContent(id) {
return request({
url: `/api/exercise/race/season/${id}/html`,
method: 'get'
});
}

View File

@ -2,16 +2,19 @@
<div>
<query-list-page ref="user" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<add-season ref="addSeason" @reloadTable="reloadTable" />
<edit-content ref="editContent" />
</div>
</template>
<script>
import { queryContestSeasonPaged, deleteContestSeason } from '@/api/contest';
import AddSeason from './add';
import EditContent from './editContent';
export default {
name: 'ContestSeasonManage',
components: {
AddSeason
AddSeason,
EditContent
},
data() {
return {
@ -80,6 +83,10 @@ export default {
title: '操 作',
width: '320',
buttons: [
{
name: '赛季内容编辑',
handleClick: this.doEditContent
},
{
name: '编辑',
handleClick: this.doEdit
@ -108,6 +115,9 @@ export default {
doEdit(index, row) {
this.$refs.addSeason.doShow(row);
},
doEditContent(index, row) {
this.$refs.editContent.doShow(row);
},
doDelete(index, row) {
this.$confirm('该操作将删除竞赛赛季,是否继续?', '提 示', {
confirmButtonText: '确 定',

View File

@ -0,0 +1,67 @@
<template>
<el-dialog v-dialogDrag v-loading="loading" title="编辑赛季内容" :visible.sync="dialogVisible" width="80%" :before-close="handleClose" center :close-on-click-modal="false">
<quill-editor
:ref="'contentInput'"
v-model="seasonContent"
style="width: 80%;margin-left: 10%;margin-top: 10px;"
:margin-bottom="20"
editor-type="default"
:no-handle-p="true"
:height="450"
placeholder="请输入"
/>
<span slot="footer" class="dialog-footer">
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { editSeasonContent, getSeasonContent } from '@/api/contest';
import QuillEditor from '@/components/QuillEditor/index';
export default {
name: 'EditContent',
components: {
QuillEditor
},
data() {
return {
dialogVisible: false,
seasonContent:'',
id: '',
loading: false
};
},
methods:{
doShow(row) {
this.dialogVisible = true;
if (row) {
this.loading = true;
this.id = row.id;
getSeasonContent(row.id).then(resp => {
this.seasonContent = resp.data.html || '';
this.loading = false;
}).catch(e => {
this.loading = false;
this.$message.error('获取内容数据失败!');
});
}
},
handleClose() {
this.id = '';
this.dialogVisible = false;
this.seasonContent = '';
this.loading = false;
},
doSave() {
editSeasonContent(this.id, {htmlContent: this.seasonContent}).then(resp => {
this.handleClose();
this.$message.success('修改内容成功!');
}).catch(e => {
this.$message.error('修改内容失败!');
});
}
}
};
</script>