赛事指南更新

This commit is contained in:
unknown 2022-06-17 17:43:30 +08:00
parent 6f9ed8c658
commit 68163b5354
4 changed files with 185 additions and 8 deletions

View File

@ -127,12 +127,22 @@ export default {
}, 1000);
this.loading = true;
},
initPage(){
var compId = this.$route.params.compId
var compInfo ={
compId
}
this.$api.getChartCount(compInfo).then((res)=>{
if (res.status == 0) {
this.apply_total_num = res.data.applyCount
this.submit_total_num = res.data.submitCount
}
})
}
},
mounted(){
this.apply_total_num = 666;
this.submit_total_num = 777;
this.initPage()
this.chart_title = "地方分赛区";
this.makeEcharts();

View File

@ -1,14 +1,14 @@
<template>
<div>
<div v-loading="contentLoading">
<div class="content-button">
<el-button plain class="edit-button">编辑</el-button>
<el-button plain class="edit-button" @click="goToEdit">编辑</el-button>
</div>
<div class="content">
<div class="card">
<div class="card-content">
<div>{{ content }}</div>
<div v-html="content"></div>
</div>
</div>
</div>
@ -17,21 +17,48 @@
</template>
<script>
import pageUtils from "@/utils/pageUtils";
import {Message} from "element-ui";
export default {
name: "Guide",
data(){
return{
content:'赛事指南赛事指南赛事指南赛事指南赛事指南赛事指南',
contentMd:'',
contentLoading: true,
}
},
methods:{
//
goToEdit(){
pageUtils.openPage(this.$router,"/" + this.$route.params.compId + "/guideEdit");
},
checkComp(){
this.$api.getPageData(this.$route.params.compId,'guide').then((res) => {
console.log(res);
//
if (res.data.show) {
this.content = res.data.content;
this.contentMd = res.data.contentMd;
this.contentLoading = false;
}else {
Message.warning("该页面不存在");
this.$router.push({
path: '/404'
});
}
})
}
},
mounted() {
this.checkComp();
},
}

View File

@ -0,0 +1,113 @@
<template>
<div class="edit-content">
<el-breadcrumb class="breadcrumb" separator="/">
<el-breadcrumb-item :to="{ path: '/' + this.$route.params.compId + '/guide' }">赛事指南</el-breadcrumb-item>
<el-breadcrumb-item>编辑</el-breadcrumb-item>
</el-breadcrumb>
<mavon-editor :ishljs="true" v-model="data" @save="save" :xss-options="xssOptions" @change="change"/>
<div class="button-group">
<el-button type="primary" @click="submit">提交</el-button>
<el-button @click="cancel">取消</el-button>
</div>
</div>
</template>
<script>
import pageUtils from "@/utils/pageUtils";
import {Message} from "element-ui";
export default {
name: "GuideEdit",
data(){
return{
data: "",
html:"",
xssOptions:{
whiteList: {
div: ['style'],
img:['src','width','height','style'],
a: ['href', 'title', 'target','style']
}
}
}
},
methods:{
save(value,render){
// valuemarkdown
// renderhtml
console.log(value);
console.log(render);
},
cancel(){
pageUtils.openPage(this.$router,"/" + this.$route.params.compId +"/guide")
},
change(value,render){
this.html = render;
},
initPage(){
pageUtils.checkComp(this.$router,this.$route.params.compId,this.$api);
this.$api.getPageData(this.$route.params.compId,'guide').then((res) => {
console.log(res);
//
if (res.data.show) {
this.data = res.data.contentMd;
}else {
Message.warning("该页面不存在");
this.$router.push({
path: '/404'
});
}
})
},
submit(){
console.log(this.data);
console.log(this.html);
let guideInfo = {
content : this.html,
contentMd : this.data,
compId : this.$route.params.compId
}
this.$api.guideContentUpdate(guideInfo)
.then((res) =>{
if (res.status === 0) {
Message.success("保存成功")
//
pageUtils.openPage(this.$router,"/" + this.$route.params.compId +"/guide")
}else if (res.status === 20){
Message.error("文件上传失败")
}else if (res.status === 10){
Message.error("系统错误")
}else {
Message.error("权限不足或其他错误")
}
})
.catch(function (res) {
alert(res);
});
}
},
mounted() {
this.initPage()
}
}
</script>
<style>
.button-group{
margin-top: 50px;
}
</style>
<style src="@/assets/css/common.css" scoped>
</style>

View File

@ -90,6 +90,18 @@ export const homeContentUpdate = data => {
})
};
export const guideContentUpdate = data => {
return axios({
headers:{
"Authorization": localStorage.getItem("systemToken")
},
url: '/guide/updateContentByCompId',
method: 'post',
data
})
};
export const getAllComp = () => {
return axios({
headers:{
@ -136,6 +148,19 @@ export const updateData = (type,data) => {
})
};
export const getChartCount = (data) => {
return axios({
url: '/comp/getChartCount',
method: 'post',
data
})
};
// 默认全部倒出
// 根据需要进行
export default {
@ -151,5 +176,7 @@ export default {
getAllComp,
initComp,
getCompById,
updateData
updateData,
getChartCount,
guideContentUpdate
}