赛事修改

fixLog
yujialong 1 year ago
parent 0c93095d1e
commit 90ed1f142d
  1. 2
      src/setting.js
  2. 38
      src/utils/editor.js
  3. 474
      src/views/match/add/set.vue
  4. 590
      src/views/match/add/step3.vue
  5. 4
      src/views/shop/addProduct/index.vue
  6. 336
      src/views/system/manageLog - 副本.vue

@ -10,7 +10,7 @@ let host = `${location.origin}/`
if (isDev) { if (isDev) {
jumpPath = 'http://192.168.31.125:8087/' // 本地调试-需要启动本地判分点系统 jumpPath = 'http://192.168.31.125:8087/' // 本地调试-需要启动本地判分点系统
host = 'http://121.37.12.51/' host = 'http://121.37.12.51/'
// host = 'https://huorantech.cn/' host = 'https://huorantech.cn/'
// host = 'http://192.168.31.152:9000/'// 榕 // host = 'http://192.168.31.152:9000/'// 榕
// host = 'http://192.168.31.51:9000/'// 赓 // host = 'http://192.168.31.51:9000/'// 赓
} else if (isPro) { } else if (isPro) {

@ -315,10 +315,46 @@ export default {
powerpaste_allow_local_images: true, powerpaste_allow_local_images: true,
powerpaste_word_import: 'clean', powerpaste_word_import: 'clean',
powerpaste_html_import: 'clean', powerpaste_html_import: 'clean',
extraPlugins: 'uploadimage',
imageUploadUrl: Api.fileUploadNakadai,
init_instance_callback: function (editor) {
editor.on('paste', (evt) => {
// 监听粘贴事件
// 实现图片粘贴上传
const items = (evt.clipboardData || window.clipboardData).items
if (items[0].type.indexOf('image') !== -1) {
const file = items[0].getAsFile()
const form = new FormData()
form.append('file', file)
// 自定义上传图片的方法
Axios({
method: 'post',
url: Api.fileUploadNakadai,
data: form,
headers: {
'Content-Type': 'multipart/form-data',
token: Util.local.get(Setting.tokenKey)
},
}).then(({ data }) => {
// 使用指令,在当前鼠标标光的位置插入元素
// img元素的src就是远程图片的链接地址
editor.execCommand(
"mceReplaceContent",
true,
`<img style="max-width:500px;" src="${data.filesResult.fileUrl}" >`
);
}).catch(res => {})
// 阻止默认事件,防止粘贴的图片进入富文本编辑器中
evt.preventDefault();
} else {
console.log('粘贴的不是图片,不能上传')
}
})
},
// 自定义上传 // 自定义上传
images_upload_handler: function (blobInfo, succFun, failFun) { images_upload_handler: function (blobInfo, succFun, failFun) {
const form = new FormData() const form = new FormData()
form.append('file', blobInfo.blob()), form.append('file', blobInfo.blob())
Axios({ Axios({
method: 'post', method: 'post',
url: Api.fileUploadNakadai, url: Api.fileUploadNakadai,

@ -1,256 +1,278 @@
<template> <template>
<div> <div>
<el-card shadow="hover" class="m-b-20"> <el-card shadow="hover"
<div> class="m-b-20">
<p class="m-b-20">比赛名称</p> <div>
{{ form.stageName }} <p class="m-b-20">比赛名称</p>
</div> {{ form.stageName }}
</el-card> </div>
<el-card shadow="hover" class="m-b-20"> </el-card>
<div> <el-card shadow="hover"
<p class="m-b-20">比赛时间</p> class="m-b-20">
<div class="date-inputs"> <div>
起止时间 <p class="m-b-20">比赛时间</p>
<div style="display: inline-flex;align-items: center;"> <div class="date-inputs">
<el-date-picker 起止时间
v-model="form.time" <div style="display: inline-flex;align-items: center;">
type="datetimerange" <el-date-picker v-model="form.time"
range-separator="~" type="datetimerange"
start-placeholder="开始日期" range-separator="~"
end-placeholder="结束日期" start-placeholder="开始日期"
format="yyyy-MM-dd HH:mm:ss" end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"
@change="timeChange"> value-format="yyyy-MM-dd HH:mm:ss"
</el-date-picker> @change="timeChange">
<el-alert </el-date-picker>
style="width: auto;padding: 4px 16px;margin-left: 10px;" <el-alert style="width: auto;padding: 4px 16px;margin-left: 10px;"
:title="'(请设置在 ' + step1.playStartTime + ' ~ ' + step1.playEndTime + '间)'" :title="'(请设置在 ' + step1.playStartTime + ' ~ ' + step1.playEndTime + '间)'"
type="error" type="error"
:closable="false" :closable="false"
effect="dark"> effect="dark">
</el-alert> </el-alert>
</div>
</div>
</div> </div>
</el-card> </div>
<el-card shadow="hover" class="mgr20 m-b-20"> </div>
</el-card>
<el-card shadow="hover"
class="mgr20 m-b-20">
<div>
<p class="m-b-20">课程</p>
<div class="inline-input">
<el-select v-model="form.mallId"
@change="courseChange">
<el-option v-for="(item, i) in curriculumList"
:key="i"
:label="item.productName"
:value="item.mallId">
</el-option>
</el-select>
</div>
</div>
</el-card>
<el-card shadow="hover"
class="m-b-20">
<div class="flex-between m-b-20">
<span>实训项目</span>
<div style="display: inline-flex;">
<div> <div>
<p class="m-b-20">课程</p> <el-input placeholder="请输入项目名称"
<div class="inline-input"> prefix-icon="el-icon-search"
<el-select v-model="form.cid" @change="courseChange"> v-model.trim="keyword"
<el-option clearable></el-input>
v-for="item in curriculumList"
:key="item.cid"
:label="item.curriculumName"
:value="item.cid">
</el-option>
</el-select>
</div>
</div>
</el-card>
<el-card shadow="hover" class="m-b-20">
<div class="flex-between m-b-20">
<span>实训项目</span>
<div style="display: inline-flex;">
<div>
<el-input placeholder="请输入项目名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input>
</div>
<el-button style="margin-left: 5px" type="primary" round @click="toProject">自定义实验项目</el-button>
</div>
</div> </div>
<!-- 实训项目表格 --> <el-button style="margin-left: 5px"
<el-table :data="projects" class="table" stripe header-align="center"> type="primary"
<el-table-column width="60" label="选择" align="center"> round
<template slot-scope="scope"> @click="toProject">自定义实验项目</el-button>
<el-radio v-model="form.projectId" :label="scope.row.projectId">&nbsp;</el-radio> </div>
</template> </div>
</el-table-column> <!-- 实训项目表格 -->
<el-table-column prop="projectName" label="项目名称" align="center"></el-table-column> <el-table :data="projects"
<el-table-column prop="auth" label="项目权限" align="center"> class="table"
<template slot-scope="scope"> stripe
{{ permissionsKeys[scope.row.permissions] }} header-align="center">
</template> <el-table-column width="60"
</el-table-column> label="选择"
<el-table-column prop="founder" label="创建人" align="center"> align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.founder ? '老师创建' : '系统内置' }} <el-radio v-model="form.projectId"
</template> :label="scope.row.projectId">&nbsp;</el-radio>
</el-table-column> </template>
<el-table-column prop="createTime" label="创建时间" align="center"></el-table-column> </el-table-column>
<!-- <el-table-column label="操作" align="center"> <el-table-column prop="projectName"
label="项目名称"
align="center"></el-table-column>
<el-table-column prop="auth"
label="项目权限"
align="center">
<template slot-scope="scope">
{{ permissionsKeys[scope.row.permissions] }}
</template>
</el-table-column>
<el-table-column prop="founder"
label="创建人"
align="center">
<template slot-scope="scope">
{{ scope.row.founder ? '老师创建' : '系统内置' }}
</template>
</el-table-column>
<el-table-column prop="createTime"
label="创建时间"
align="center"></el-table-column>
<!-- <el-table-column label="操作" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showProject(scope.row)">查看</el-button> <el-button type="text" @click="showProject(scope.row)">查看</el-button>
</template> </template>
</el-table-column> --> </el-table-column> -->
</el-table> </el-table>
<div class="pagination"> <div class="pagination">
<el-pagination <el-pagination background
background :page-size="pageSize"
:page-size="pageSize" @current-change="handleCurrentChange"
@current-change="handleCurrentChange" layout="total,prev, pager, next"
layout="total,prev, pager, next" :total="total"></el-pagination>
:total="total"
></el-pagination>
</div>
</el-card>
<div style="text-align: center">
<el-button @click="back">返回</el-button>
<el-button type="primary" @click="save">保存</el-button>
</div> </div>
</el-card>
<div style="text-align: center">
<el-button @click="back">返回</el-button>
<el-button type="primary"
@click="save">保存</el-button>
</div> </div>
</div>
</template> </template>
<script> <script>
import util from "@/libs/util"; import util from "@/libs/util";
import { Loading } from 'element-ui' import { Loading } from 'element-ui'
export default { export default {
props: ['form', 'step1'], props: ['form', 'step1'],
data() { data () {
return { return {
loadIns: null, loadIns: null,
curriculumList: [], curriculumList: [],
keyword: '', keyword: '',
projects: [], projects: [],
page: 1, page: 1,
pageSize: 5, pageSize: 5,
total: 0, total: 0,
sysId: '', sysId: '',
permissionsKeys: ['练习', '考核', '竞赛'], permissionsKeys: ['练习', '考核', '竞赛'],
timeInvalid: false timeInvalid: false
}; };
},
watch: {
// ,
form: {
handler () {
this.updateTime++
},
deep: true
}, },
watch: { keyword: function (val) {
// , clearTimeout(this.searchTimer);
form: { this.searchTimer = setTimeout(() => {
handler(){ this.initData();
this.updateTime++ }, 500);
}, }
deep:true },
}, mounted () {
keyword: function(val) { this.getCourse()
clearTimeout(this.searchTimer); },
this.searchTimer = setTimeout(() => { methods: {
this.initData(); //
}, 500); getCourse () {
} this.loadIns = Loading.service()
this.$post(this.api.listOfGoods, {
pageNum: 1,
pageSize: 10000,
hotTag: 1,
sort: 0,
isAssociatedProduct: 1,
}).then(({ page }) => {
const list = page.records
this.curriculumList = page.records
if (!this.form.mallId && list.length) this.form.mallId = list[0].mallId
this.courseChange()
}).catch(err => {
this.loadIns.close()
});
}, },
mounted() { //
this.getCourse() courseChange (val) {
const { systemId, associatedProduct } = this.curriculumList.find(e => e.mallId == this.form.mallId)
this.sysId = systemId
this.form.cid = associatedProduct
if (val) this.loadIns = Loading.service()
this.getProject()
}, },
methods: { //
// getProject () {
getCourse() { this.$post(this.api.getProjectAssessmentByCompetition, {
this.loadIns = Loading.service() pageNum: this.page,
const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理') pageSize: this.pageSize,
this.$post(this.api.curriculumList, { cid: this.form.cid,
isShelves: 1, projectName: this.keyword,
pageNum: 1, systemId: this.sysId,
pageSize: 10000, permissions: 2
supplierId: sid ? sid.supplierId : '' }).then(({ data }) => {
}).then(({ page }) => { this.projects = data.records
const list = page.records this.total = data.total
this.curriculumList = page.records this.loadIns.close()
if (!this.form.cid && list.length) this.form.cid = list[0].cid }).catch(err => {
this.courseChange() this.loadIns.close()
}).catch(err => { });
this.loadIns.close() },
}); initData () {
}, this.page = 1;
// this.getProject();
courseChange(val) { },
const { systemId } = this.curriculumList.find(e => e.cid == this.form.cid) handleCurrentChange (val) {
this.sysId = systemId this.page = val;
if (val) this.loadIns = Loading.service() this.getProject();
this.getProject() },
}, //
// toProject () {
getProject() { const { form, curStep } = this.$parent
this.$post(this.api.getProjectAssessmentByCompetition, { form[curStep] = this.form
pageNum: this.page, this.$store.commit('setCompetitionCache', {
pageSize: this.pageSize, form,
cid: this.form.cid, curStep
projectName: this.keyword, })
systemId: this.sysId, const item = this.curriculumList.find(e => e.cid == this.form.cid) || {} // id
permissions: 2 let systemId = item.sysId || '1'
}).then(({ data }) => { systemId = systemId.split(',')[0] // id
this.projects = data.records this.$router.push(`/projectList?systemId=${systemId}&show=1&name=${item.sysName.split(',')[0]}`)
this.total = data.total },
this.loadIns.close() //
}).catch(err => { timeChange (val) {
this.loadIns.close() if (val.length) {
}); const startTime = new Date(val[0])
}, const endTime = new Date(val[1])
initData() { const { playStartTime, playEndTime } = this.step1
this.page = 1; if (startTime < new Date(playStartTime) || endTime > new Date(playEndTime)) {
this.getProject(); this.timeInvalid = true
}, return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
handleCurrentChange(val) { }
this.page = val; this.timeInvalid = false
this.getProject();
},
//
toProject() {
const { form, curStep } = this.$parent const { form, curStep } = this.$parent
form[curStep] = this.form for (const i in form) {
this.$store.commit('setCompetitionCache', { //
form, if (i !== curStep) {
curStep const time1 = new Date(form[i].startTime)
}) const time2 = new Date(form[i].endTime)
const item = this.curriculumList.find(e => e.cid == this.form.cid) || {} // id if ((startTime >= time1 && startTime <= time2) || (endTime >= time1 && endTime <= time2)) {
let systemId = item.sysId || '1' util.warningMsg('请注意,所设置的时间与已设置的阶段时间重合。')
systemId = systemId.split(',')[0] // id break
this.$router.push(`/projectList?systemId=${systemId}&show=1&name=${item.sysName.split(',')[0]}`)
},
//
timeChange(val) {
if (val.length) {
const startTime = new Date(val[0])
const endTime = new Date(val[1])
const { playStartTime, playEndTime } = this.step1
if (startTime < new Date(playStartTime) || endTime > new Date(playEndTime)) {
this.timeInvalid = true
return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
}
this.timeInvalid = false
const { form, curStep } = this.$parent
for (const i in form) {
//
if (i !== curStep) {
const time1 = new Date(form[i].startTime)
const time2 = new Date(form[i].endTime)
if ((startTime >= time1 && startTime <= time2) || (endTime >= time1 && endTime <= time2)) {
util.warningMsg('请注意,所设置的时间与已设置的阶段时间重合。')
break
}
} }
} }
} }
},
//
save() {
const { form } = this
if (!form.time.length) return util.warningMsg('请选择比赛时间')
const { playStartTime, playEndTime } = this.step1
if (new Date(form.time[0]) < new Date(playStartTime) || new Date(form.time[1]) > new Date(playEndTime)) return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
if (!form.cid) return util.warningMsg('请选择课程')
if (!form.projectId) return util.warningMsg('请选择项目')
const { systemId, systemName, projectName } = this.projects.find(e => e.projectId == form.projectId)
if (systemId) form.systemId = systemId
if (projectName) form.projectName = projectName
if (systemName) form.systemName = systemName
form.startTime = form.time[0]
form.endTime = form.time[1]
this.$emit('hideSet', this.form)
},
//
back() {
this.$emit('hideSet')
} }
},
//
save () {
const { form } = this
if (!form.time.length) return util.warningMsg('请选择比赛时间')
const { playStartTime, playEndTime } = this.step1
if (new Date(form.time[0]) < new Date(playStartTime) || new Date(form.time[1]) > new Date(playEndTime)) return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
if (!form.cid) return util.warningMsg('请选择课程')
if (!form.projectId) return util.warningMsg('请选择项目')
const { systemId, systemName, projectName } = this.projects.find(e => e.projectId == form.projectId)
if (systemId) form.systemId = systemId
if (projectName) form.projectName = projectName
if (systemName) form.systemName = systemName
form.startTime = form.time[0]
form.endTime = form.time[1]
this.$emit('hideSet', this.form)
},
//
back () {
this.$emit('hideSet')
} }
}
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
</style> </style>

@ -1,319 +1,355 @@
<template> <template>
<div> <div>
<div v-show="!setVisible" class="page"> <div v-show="!setVisible"
<div class="page-content"> class="page">
<div class="p-title">比赛内容设置</div> <div class="page-content">
<el-form label-width="170px" label-suffix=":" size="small" :disabled="!editing && id"> <div class="p-title">比赛内容设置</div>
<div v-for="(item, i) in form" :key="i" class="step"> <el-form label-width="170px"
<div class="title"> label-suffix=":"
<span>{{ item.stageName }}{{ nums[i] }}阶段 | {{ methods.find(e => e.id === item.method).name }} </span> size="small"
<el-button v-if="item.method !== 2" type="primary" @click="toSet(i)">设置</el-button> :disabled="!editing && id">
</div> <div v-for="(item, i) in form"
<el-form-item class="req" prop="time" label="比赛时间"> :key="i"
<span v-if="item.method !== 2 && item.startTime">{{ item.startTime + ' ' + item.endTime }}</span> class="step">
<div style="display: flex;align-items: center;" v-if="item.method === 2"> <div class="title">
<el-date-picker <span>{{ item.stageName }}{{ nums[i] }}阶段 | {{ methods.find(e => e.id === item.method).name }} </span>
v-model="item.time" <el-button v-if="item.method !== 2"
type="datetimerange" type="primary"
range-separator="~" @click="toSet(i)">设置</el-button>
start-placeholder="开始日期" </div>
end-placeholder="结束日期" <el-form-item class="req"
format="yyyy-MM-dd HH:mm:ss" prop="time"
value-format="yyyy-MM-dd HH:mm:ss" label="比赛时间">
@change="timeChange"> <span v-if="item.method !== 2 && item.startTime">{{ item.startTime + ' ' + item.endTime }}</span>
</el-date-picker> <div style="display: flex;align-items: center;"
<el-alert v-if="item.method === 2">
style="width: auto;padding: 0px 16px;margin-left: 10px;" <el-date-picker v-model="item.time"
:title="'(请设置在 ' + step1.playStartTime + ' ~ ' + step1.playEndTime + '间)'" type="datetimerange"
type="error" range-separator="~"
:closable="false" start-placeholder="开始日期"
effect="dark"> end-placeholder="结束日期"
</el-alert> format="yyyy-MM-dd HH:mm:ss"
</div> value-format="yyyy-MM-dd HH:mm:ss"
</el-form-item> @change="timeChange">
<template v-if="item.method === 2"> </el-date-picker>
<el-form-item class="req" label="比赛地点"> <el-alert style="width: auto;padding: 0px 16px;margin-left: 10px;"
<el-input v-model="item.offlineAddress" style="width: 80%"></el-input> :title="'(请设置在 ' + step1.playStartTime + ' ~ ' + step1.playEndTime + '间)'"
</el-form-item> type="error"
<el-form-item class="req" label="比赛内容"> :closable="false"
<el-input v-model="item.contentDescription" type="textarea" style="width: 80%"></el-input> effect="dark">
</el-form-item> </el-alert>
<el-form-item class="req" label="评分规则">
<el-input v-model="item.scoreRule" type="textarea" style="width: 80%"></el-input>
</el-form-item>
</template>
<template v-else>
<el-form-item class="req" prop="cid" label="课程系统">
{{ item.systemName }}
</el-form-item>
<el-form-item class="req" prop="assessmentId" label="已选择考核">
{{ item.projectName }}
</el-form-item>
<el-form-item class="req" prop="resultAnnouncementTime" label="比赛地点">
<div class="line">
<el-checkbox v-model="item.onlineButton">线上</el-checkbox>
<el-input v-model="item.onlineAddress" clearable placeholder="请输入比赛网址" :disabled="!item.onlineButton" style="width: 400px;margin-left: 10px"></el-input>
</div>
<div class="line">
<el-checkbox v-model="item.offlineButton">线下</el-checkbox>
<el-input v-model="item.offlineAddress" clearable placeholder="请输入地址" :disabled="!item.offlineButton" style="width: 400px;margin-left: 10px"></el-input>
</div>
</el-form-item>
</template>
</div> </div>
</el-form> </el-form-item>
<template v-if="item.method === 2">
<el-form-item class="req"
label="比赛地点">
<el-input v-model="item.offlineAddress"
style="width: 80%"></el-input>
</el-form-item>
<el-form-item class="req"
label="比赛内容">
<el-input v-model="item.contentDescription"
type="textarea"
style="width: 80%"></el-input>
</el-form-item>
<el-form-item class="req"
label="评分规则">
<el-input v-model="item.scoreRule"
type="textarea"
style="width: 80%"></el-input>
</el-form-item>
</template>
<template v-else>
<el-form-item class="req"
prop="cid"
label="课程系统">
{{ item.systemName }}
</el-form-item>
<el-form-item class="req"
prop="assessmentId"
label="已选择考核">
{{ item.projectName }}
</el-form-item>
<el-form-item class="req"
prop="resultAnnouncementTime"
label="比赛地点">
<div class="line">
<el-checkbox v-model="item.onlineButton">线上</el-checkbox>
<el-input v-model="item.onlineAddress"
clearable
placeholder="请输入比赛网址"
:disabled="!item.onlineButton"
style="width: 400px;margin-left: 10px"></el-input>
</div>
<div class="line">
<el-checkbox v-model="item.offlineButton">线下</el-checkbox>
<el-input v-model="item.offlineAddress"
clearable
placeholder="请输入地址"
:disabled="!item.offlineButton"
style="width: 400px;margin-left: 10px"></el-input>
</div>
</el-form-item>
</template>
</div> </div>
</div> </el-form>
</div>
<set v-if="setVisible" :form.sync="form[curStep]" :step1.sync="step1" @hideSet="hideSet" />
</div> </div>
<set v-if="setVisible"
:form.sync="form[curStep]"
:step1.sync="step1"
@hideSet="hideSet" />
</div>
</template> </template>
<script> <script>
import util from "@/libs/util"; import util from "@/libs/util";
import set from './set' import set from './set'
export default { export default {
props: ['setupId', 'competitionId', 'editing'], props: ['setupId', 'competitionId', 'editing'],
data() { data () {
return { return {
id: this.$route.query.id, id: this.$route.query.id,
updateTime: 0, updateTime: 0,
step1: this.$parent.$refs.step1.form, step1: this.$parent.$refs.step1.form,
cache: this.$store.state.competitionCache, cache: this.$store.state.competitionCache,
nums: ['一', '二', '三'], nums: ['一', '二', '三'],
methods: [ methods: [
{ {
id: 0, id: 0,
name: '实操' name: '实操'
},
{
id: 1,
name: '理论'
},
{
id: 2,
name: '线下'
}
],
originForm: {
cid: '',
contentDescription: '',
endTime: '',
scoreRule: '',
stageId: '',
startTime: '',
systemId: '',
offlineAddress: '',
offlineButton: 0,
onlineAddress: '',
onlineButton: 0,
time: []
},
form: [],
setVisible: false,
curStep: 0,
};
},
components: {
set
},
watch: {
// ,
form: {
handler(){
this.updateTime++
}, },
deep:true {
}, id: 1,
}, name: '理论'
mounted() { },
this.handleForm() {
}, id: 2,
methods: { name: '线下'
//
resumeData() {
if (this.cache) {
this.curStep = this.cache.curStep
if (this.cache.form) this.form = this.cache.form
this.setVisible = true
this.$store.commit('setCompetitionCache', null)
} }
],
originForm: {
cid: '',
mallId: '',
contentDescription: '',
endTime: '',
scoreRule: '',
stageId: '',
startTime: '',
systemId: '',
offlineAddress: '',
offlineButton: 0,
onlineAddress: '',
onlineButton: 0,
time: []
}, },
// form form: [],
handleForm() { setVisible: false,
// id curStep: 0,
this.$post(`${this.api.queryCompetitionStageBySetupId}?setupId=${this.setupId}`).then(res => { };
res.competitionStages.map(e => { },
const form = e.competitionContent || JSON.parse(JSON.stringify(this.originForm)) components: {
if (form.startTime) { set
form.time = [form.startTime, form.endTime] },
} else { watch: {
form.time = [] // ,
} form: {
form.offlineButton = !!form.offlineButton handler () {
form.onlineButton = !!form.onlineButton this.updateTime++
form.method = e.method
form.stageId = e.stageId
form.stageName = e.stageName
this.form.push(form)
})
this.resumeData()
this.$nextTick(() => {
this.updateTime = 0
})
}).catch(res => {})
}, },
// deep: true
toSet(i) { },
this.curStep = i },
this.$parent.showBtns = false mounted () {
this.handleForm()
},
methods: {
//
resumeData () {
if (this.cache) {
this.curStep = this.cache.curStep
if (this.cache.form) this.form = this.cache.form
this.setVisible = true this.setVisible = true
}, this.$store.commit('setCompetitionCache', null)
// }
hideSet(form) { },
if (form) this.form[this.curStep] = form // form
this.setVisible = false handleForm () {
this.$parent.showBtns = true // id
}, this.$post(`${this.api.queryCompetitionStageBySetupId}?setupId=${this.setupId}`).then(res => {
// res.competitionStages.map(e => {
timeChange(val) { const form = e.competitionContent || JSON.parse(JSON.stringify(this.originForm))
if (val.length) { if (form.startTime) {
const startTime = new Date(val[0]) form.time = [form.startTime, form.endTime]
const endTime = new Date(val[1]) } else {
const { playStartTime, playEndTime } = this.step1 form.time = []
if (startTime < new Date(playStartTime) || endTime > new Date(playEndTime)) return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。') }
const { form, curStep } = this if (!form.mallId) form.mallId = ''
for (const i in form) { form.offlineButton = !!form.offlineButton
// form.onlineButton = !!form.onlineButton
if (i !== curStep) { form.method = e.method
const time1 = new Date(form[i].startTime) form.stageId = e.stageId
const time2 = new Date(form[i].endTime) form.stageName = e.stageName
if ((startTime >= time1 && startTime <= time2) || (endTime >= time1 && endTime <= time2)) { this.form.push(form)
util.warningMsg('请注意,所设置的时间与已设置的阶段时间重合。') })
break this.resumeData()
} this.$nextTick(() => {
this.updateTime = 0
})
}).catch(res => { })
},
//
toSet (i) {
this.curStep = i
this.$parent.showBtns = false
this.setVisible = true
},
//
hideSet (form) {
if (form) this.form[this.curStep] = form
this.setVisible = false
this.$parent.showBtns = true
},
//
timeChange (val) {
if (val.length) {
const startTime = new Date(val[0])
const endTime = new Date(val[1])
const { playStartTime, playEndTime } = this.step1
if (startTime < new Date(playStartTime) || endTime > new Date(playEndTime)) return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
const { form, curStep } = this
for (const i in form) {
//
if (i !== curStep) {
const time1 = new Date(form[i].startTime)
const time2 = new Date(form[i].endTime)
if ((startTime >= time1 && startTime <= time2) || (endTime >= time1 && endTime <= time2)) {
util.warningMsg('请注意,所设置的时间与已设置的阶段时间重合。')
break
} }
} }
} }
}, }
// },
publish() { //
this.competitionId && this.$post(`${this.api.publishCompetition}?competitionId=${this.competitionId}&publishStatus=1`).then(res => {}).catch(err => {}) publish () {
}, this.competitionId && this.$post(`${this.api.publishCompetition}?competitionId=${this.competitionId}&publishStatus=1`).then(res => { }).catch(err => { })
// },
save(status, next = 0) { //
const { form } = this save (status, next = 0) {
if (!form.length) { const { form } = this
this.$parent.hideLoad() if (!form.length) {
util.successMsg('保存成功') this.$parent.hideLoad()
this.$emit('next', next) util.successMsg('保存成功')
return this.$emit('next', next)
} return
// }
if (status) { //
let invalid = 0 if (status) {
const { playStartTime, playEndTime } = this.step1 let invalid = 0
for (const e of form) { const { playStartTime, playEndTime } = this.step1
if (!e.time.length) { for (const e of form) {
if (!e.time.length) {
invalid = 1
util.errorMsg('请选择比赛时间')
break
}
if (new Date(e.time[0]) < new Date(playStartTime) || new Date(e.time[1]) > new Date(playEndTime)) {
invalid = 1
util.errorMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
break
}
e.startTime = e.time[0]
e.endTime = e.time[1]
if (e.method !== 2 && !e.cid) {
invalid = 1
util.errorMsg('请选择课程')
break
}
if (e.method === 2) { // 线
if (!e.offlineAddress) {
invalid = 1
util.errorMsg('请输入比赛地点')
break
}
if (!e.contentDescription) {
invalid = 1 invalid = 1
util.errorMsg('请选择比赛时间') util.errorMsg('请输入比赛内容')
break break
} }
if (new Date(e.time[0]) < new Date(playStartTime) || new Date(e.time[1]) > new Date(playEndTime)) { if (!e.scoreRule) {
invalid = 1 invalid = 1
util.errorMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。') util.errorMsg('请输入评分规则')
break break
} }
e.startTime = e.time[0] } else {
e.endTime = e.time[1] if (e.onlineButton && !e.onlineAddress) {
if (e.method !== 2 && !e.cid) {
invalid = 1 invalid = 1
util.errorMsg('请选择课程') util.errorMsg('请输入线上地点')
break break
} }
if (e.method === 2) { // 线 if (e.offlineButton && !e.offlineAddress) {
if (!e.offlineAddress) { invalid = 1
invalid = 1 util.errorMsg('请输入线下地点')
util.errorMsg('请输入比赛地点') break
break }
} if (!e.onlineAddress && !e.offlineAddress) {
if (!e.contentDescription) { invalid = 1
invalid = 1 util.errorMsg('请输入比赛地点')
util.errorMsg('请输入比赛内容') break
break
}
if (!e.scoreRule) {
invalid = 1
util.errorMsg('请输入评分规则')
break
}
} else {
if (e.onlineButton && !e.onlineAddress) {
invalid = 1
util.errorMsg('请输入线上地点')
break
}
if (e.offlineButton && !e.offlineAddress) {
invalid = 1
util.errorMsg('请输入线下地点')
break
}
if (!e.onlineAddress && !e.offlineAddress) {
invalid = 1
util.errorMsg('请输入比赛地点')
break
}
} }
} }
if (invalid) return
} }
// if (invalid) return
for (const e of form) { }
e.offlineButton = e.offlineButton ? 1 : 0 //
e.onlineButton = e.onlineButton ? 1 : 0 for (const e of form) {
} e.offlineButton = e.offlineButton ? 1 : 0
this.$parent.showLoad() e.onlineButton = e.onlineButton ? 1 : 0
this.$post(this.api[form[0].contentId ? 'editCompetitionContent' : 'addCompetitionContent'], { }
competitionContents: form this.$parent.showLoad()
}).then(res => { this.$post(this.api[form[0].contentId ? 'editCompetitionContent' : 'addCompetitionContent'], {
this.$parent.hideLoad() competitionContents: form
// }).then(res => {
status && this.publish(status) this.$parent.hideLoad()
util.successMsg((status ? '发布' : '保存') + '成功') //
this.$emit('next', next) status && this.publish(status)
}).catch(err => { util.successMsg((status ? '发布' : '保存') + '成功')
this.$parent.hideLoad() this.$emit('next', next)
}) }).catch(err => {
}, this.$parent.hideLoad()
} })
},
}
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.step { .step {
padding-bottom: 10px; padding-bottom: 10px;
background-color: #f9f9f9; background-color: #f9f9f9;
.title { .title {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 10px 15px; padding: 10px 15px;
margin-bottom: 10px; margin-bottom: 10px;
background-color: #ededed; background-color: #ededed;
} }
} }
.line { .line {
margin-bottom: 10px; margin-bottom: 10px;
} }
/deep/.req { /deep/.req {
.el-form-item__label { .el-form-item__label {
&:before { &:before {
content: '*'; content: '*';
margin-right: 5px; margin-right: 5px;
font-size: 18px; font-size: 18px;
vertical-align: middle; vertical-align: middle;
color: #f00; color: #f00;
}
} }
}
} }
</style> </style>

@ -37,8 +37,8 @@
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 关联产品选择了否才显示产品链接 --> <!-- 关联产品选择了否或者产品分类是数据前瞻才显示产品链接 -->
<el-col v-if="form.mall.isAssociatedProduct" <el-col v-if="form.mall.isAssociatedProduct || form.classificationIds == 5"
:span="14" :span="14"
:offset="5"> :offset="5">
<el-form-item label="产品链接"> <el-form-item label="产品链接">

@ -0,0 +1,336 @@
<template>
<div>
<el-card shadow="hover"
class="mgb20">
<div class="flex-between">
<div class="per_title"
v-preventReClick
@click="$router.back()">
<i class="el-icon-arrow-left"></i>
<span class="per_back">返回</span>
<span class="per_school">{{ platformName }}日志管理</span>
</div>
</div>
</el-card>
<div class="page">
<div class="inner">
<div class="tool">
<div class="filters">
<h6>日志更新</h6>
<div class="filter">
<label>版本查询</label>
<el-select v-model="versionName"
size="small"
placeholder="请选择版本"
filterable
@change="verChange">
<el-option v-for="item in vers"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
<div>
<el-button type="primary"
@click="add"
v-auth="'/system:日志更新:管理:新增日志'">新增日志</el-button>
</div>
</div>
<el-timeline class="timeline">
<el-timeline-item placement="top"
v-for="(item, i) in listData"
:key="i"
:class="['item' + i, {draft: item.draft}]">
<p class="sign">{{ item.draft ? '未发布' : item.draftTime }}</p>
<div class="ver">
<div>
{{ item.versionName + (item.draft ? '(草稿)' : '') }}
<span class="action">
<i class="el-icon-edit-outline"
@click="edit(item)"
v-auth="'/system:日志更新:管理:编辑日志'"></i>
<i class="el-icon-delete"
@click="del(item)"
v-auth="'/system:日志更新:管理:删除日志'"></i>
</span>
</div>
<div>
<template v-if="!i && item.withdrawNum !== 1 && item.draft !== 1">
<span class="withdraw"
v-if="item.withdraw && item.open">已撤回</span>
<el-button v-else
style="margin-right: 10px"
type="primary"
size="small"
@click="revoke(item)">撤销</el-button>
</template>
<el-switch v-model="item.open"
:active-value="0"
:inactive-value="1"
@change="switchOff($event, item)"
v-auth="'/system:日志更新:管理:开启日志'"></el-switch>
</div>
</div>
<ul class="detail">
<li v-for="(item, i) in item.logContents"
:key="i">
<p v-if="!isNaN(item.type)"
class="name"><img :src="require('@/assets/img/' + funcList.find(e => e.id === item.type).icon + '.png')"
alt=""> {{ funcList.find(e => e.id === item.type).name }}</p>
<div class="val">
<p class=""
v-for="(item, i) in item.content"
:key="i">{{ item }}</p>
</div>
</li>
</ul>
</el-timeline-item>
</el-timeline>
</div>
</div>
</div>
</template>
<script>
import Setting from '@/setting'
export default {
data () {
return {
platformId: this.$route.query.platformId,
platformName: '',
versionName: '',
vers: [],
listData: [],
funcList: [
{
id: 0,
name: '新功能',
icon: 'func'
},
{
id: 1,
name: '修复',
icon: 'bug'
},
{
id: 2,
name: '优化',
icon: 'optimize'
}
]
};
},
mounted () {
this.getData()
},
methods: {
//
getData () {
this.$get(`${this.api.platformLogList}?platformId=${this.platformId}&versionName=${this.versionName}`).then(res => {
const { logList } = res
this.listData = logList
if (logList.length) {
const vers = []
const platformName = Setting.platformList.find(e => e.id === logList[0].platformId).name
this.platformName = platformName
logList.map((e, i) => {
e.logContents.map(n => {
n.content = n.content.split('\n')
})
vers.push({
id: i,
name: e.versionName
})
})
this.vers = vers
}
}).catch(res => { })
},
//
add () {
if (this.listData.find(e => e.draft)) {
this.$confirm("当前有未发布的版本,是否要新增版本?", "提示", {
type: "warning"
}).then(() => {
this.$router.push(`/addLog?platformId=${this.platformId}`)
}).catch(() => { })
} else {
this.$router.push(`/addLog?platformId=${this.platformId}`)
}
},
//
edit (item) {
this.$router.push(`/addLog?platformId=${this.platformId}&id=${item.logId}&draft=${item.draft}`)
},
//
del (item) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
this.$post(`${this.api.logDel}?logId=${item.logId}`).then(res => {
this.$message.success("删除成功")
this.getData()
}).catch(res => { })
}).catch(() => { })
},
//
revoke (item) {
this.$confirm("确定要撤销吗?", "提示", {
type: "warning"
}).then(() => {
this.$get(`${this.api.logWithdrawal}?platformId=${this.platformId}&logId=${item.logId}`).then(res => {
this.$message.success('撤销成功')
this.getData()
}).catch(res => { })
}).catch(() => { })
},
changeStatus (logId, open, draft) {
this.$post(this.api.listUpdate, {
logId,
open,
draft
}).then(res => {
this.$message.success(open ? '禁用成功' : '启用成功')
this.getData()
}).catch(res => { })
},
//
switchOff (val, row) {
const logId = row.logId
if (row.draft && !val) {
this.$confirm('是否要发布该日志?', '提示', {
type: 'success'
}).then(() => {
this.changeStatus(logId, val, 0)
}).catch(() => {
this.changeStatus(logId, val, 1)
})
} else {
this.changeStatus(logId, val, row.draft)
}
},
//
verChange (i) {
window.scrollTo({
top: document.querySelector(`.item${i}`).offsetTop,
behavior: 'smooth'
})
}
}
};
</script>
<style lang="scss" scoped>
.page {
min-height: calc(100vh - 300px);
padding: 24px 0;
.inner {
width: 900px;
margin: 0 auto;
}
}
.tool {
padding-bottom: 20px;
margin-bottom: 0;
border-bottom: 1px solid #f0f0f0;
}
.filters {
display: inline-flex;
align-items: center;
h6 {
margin-right: 100px;
font-size: 18px;
}
}
/deep/.timeline {
padding-left: 20%;
overflow: hidden;
.el-timeline-item__node--normal {
top: 30px;
}
.el-timeline-item__wrapper {
top: 15px;
padding-left: 40px;
}
.el-timeline-item__tail {
height: 250%;
border-left-width: 1px;
}
.sign {
position: relative;
display: inline-block;
margin-left: -22%;
font-size: 14px;
color: #9076ff;
}
.draft {
.ver,
.sign {
color: #b1b1b1;
}
}
.ver {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 10px;
margin: -19px 0 20px;
font-size: 18px;
color: #9076ff;
border-bottom: 1px dashed #bfbfbf;
}
.withdraw {
margin-right: 10px;
font-size: 13px;
color: #979797;
}
.action {
margin-left: 15px;
i {
margin-left: 8px;
font-size: 14px;
color: #9076ff;
cursor: pointer;
&:hover {
opacity: 0.9;
}
}
}
.detail {
li {
margin-bottom: 20px;
}
.name {
display: flex;
align-items: center;
margin-bottom: 5px;
font-size: 15px;
font-weight: 600;
img {
width: 20px;
margin-right: 5px;
}
}
.val {
font-size: 14px;
line-height: 1.8;
white-space: pre-wrap;
p {
position: relative;
color: #6a6a6a;
&:before {
content: '';
display: inline-block;
width: 5px;
height: 5px;
margin: 0 10px 0 5px;
vertical-align: middle;
border-radius: 20px;
background-color: #c5b8ff;
}
}
}
}
}
</style>
Loading…
Cancel
Save