课程换成产品

Branch_d40a2540
yujialong 1 year ago
parent f0b9757e66
commit fea0e6ff64
  1. 30
      src/pages/match/add/set.vue
  2. 504
      src/pages/match/add/step3.vue
  3. 20
      src/pages/product/show/index.vue
  4. 19
      src/pages/project/list/index.vue

@ -41,10 +41,9 @@
<el-select v-model="form.cid" <el-select v-model="form.cid"
@change="courseChange"> @change="courseChange">
<el-option v-for="item in curriculumList" <el-option v-for="item in curriculumList"
:key="item.associatedProduct" :key="item.cid"
:label="item.productName" :label="item.curriculumName"
:value="item.associatedProduct :value="item.cid">
">
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
@ -101,10 +100,10 @@
label="创建时间" label="创建时间"
align="center"></el-table-column> align="center"></el-table-column>
<!-- <el-table-column label="操作" align="center"> <!-- <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 background <el-pagination background
@ -164,16 +163,10 @@ export default {
// //
getCourse () { getCourse () {
this.loadIns = Loading.service() this.loadIns = Loading.service()
this.$post(this.api.listOfGoods, { this.$get(this.api.curriculumList).then(({ data }) => {
hotTag: 1, const list = data
isShelves: 0, this.curriculumList = data
sort: 0, if (!this.form.cid && list.length) this.form.cid = list[0].cid
pageNum: 1,
pageSize: 1000
}).then(({ page }) => {
const list = page.records
this.curriculumList = list
if (!this.form.cid && list.length) this.form.cid = list[0].associatedProduct
this.courseChange() this.courseChange()
}).catch(err => { }).catch(err => {
this.loadIns.close() this.loadIns.close()
@ -219,7 +212,6 @@ export default {
form, form,
curStep curStep
}) })
this.$parent.pass = 1
this.$router.push(`/project/list?show=1`) this.$router.push(`/project/list?show=1`)
}, },
// //

@ -1,146 +1,158 @@
<template> <template>
<div> <div>
<el-card shadow="hover" <div v-show="!setVisible"
class="m-b-20"> class="page">
<div> <div class="page-content">
<p class="m-b-20">比赛名称</p> <div class="p-title">比赛内容设置</div>
{{ form.stageName }} <el-form label-width="170px"
</div> label-suffix=":"
</el-card> size="small"
<el-card shadow="hover" :disabled="!editing && id">
class="m-b-20"> <div v-for="(item, i) in form"
<div> :key="i"
<p class="m-b-20">比赛时间</p> class="step">
<div class="date-inputs"> <div class="title">
起止时间 <span>{{ item.stageName }}{{ nums[i] }}阶段 | {{ methods.find(e => e.id === item.method).name }} </span>
<div style="display: inline-flex;align-items: center;"> <el-button v-if="item.method !== 2"
<el-date-picker v-model="form.time" type="primary"
type="datetimerange" @click="toSet(i)">设置</el-button>
range-separator="~" </div>
start-placeholder="开始日期" <el-form-item class="req"
end-placeholder="结束日期" prop="time"
format="yyyy-MM-dd HH:mm:ss" label="比赛时间">
value-format="yyyy-MM-dd HH:mm:ss" <span v-if="item.method !== 2 && item.startTime">{{ item.startTime + ' ' + item.endTime }}</span>
@change="timeChange"> <div style="display: flex;align-items: center;"
</el-date-picker> v-if="item.method === 2">
<el-alert style="width: auto;padding: 4px 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"
</div> @change="timeChange">
</div> </el-date-picker>
</el-card> <el-alert style="width: auto;padding: 0px 16px;margin-left: 10px;"
<el-card shadow="hover" :title="'(请设置在 ' + step1.playStartTime + ' ~ ' + step1.playEndTime + '间)'"
class="mgr20 m-b-20"> type="error"
<div> :closable="false"
<p class="m-b-20">课程</p> effect="dark">
<div class="inline-input"> </el-alert>
<el-select v-model="form.cid" </div>
@change="courseChange"> </el-form-item>
<el-option v-for="item in curriculumList" <template v-if="item.method === 2">
:key="item.cid" <el-form-item class="req"
:label="item.curriculumName" label="比赛地点">
:value="item.cid"> <el-input v-model="item.offlineAddress"
</el-option> style="width: 80%"></el-input>
</el-select> </el-form-item>
</div> <el-form-item class="req"
</div> label="比赛内容">
</el-card> <el-input v-model="item.contentDescription"
<el-card shadow="hover" type="textarea"
class="m-b-20"> style="width: 80%"></el-input>
<div class="flex-between m-b-20"> </el-form-item>
<span>实训项目</span> <el-form-item class="req"
<div style="display: inline-flex;"> label="评分规则">
<div> <el-input v-model="item.scoreRule"
<el-input placeholder="请输入项目名称" type="textarea"
prefix-icon="el-icon-search" style="width: 80%"></el-input>
v-model.trim="keyword" </el-form-item>
clearable></el-input> </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-button style="margin-left: 5px" </el-form>
type="primary"
round
@click="toProject">自定义实验项目</el-button>
</div>
</div>
<!-- 实训项目表格 -->
<el-table :data="projects"
class="table"
stripe
header-align="center">
<el-table-column width="60"
label="选择"
align="center">
<template slot-scope="scope">
<el-radio v-model="form.projectId"
:label="scope.row.projectId">&nbsp;</el-radio>
</template>
</el-table-column>
<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">
<el-button type="text" @click="showProject(scope.row)">查看</el-button>
</template>
</el-table-column> -->
</el-table>
<div class="pagination">
<el-pagination background
:page-size="pageSize"
@current-change="handleCurrentChange"
layout="total,prev, pager, next"
:total="total"></el-pagination>
</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>
<set v-if="setVisible"
:form.sync="form[curStep]"
:step1.sync="step1"
@hideSet="hideSet" />
</div> </div>
</template> </template>
<script> <script>
import util from "@/libs/util"; import util from "@/libs/util";
import { Loading } from 'element-ui' import set from './set'
export default { export default {
props: ['form', 'step1'], props: ['setupId', 'competitionId', 'editing'],
data () { data () {
return { return {
loadIns: null, id: this.$route.query.id,
curriculumList: [], updateTime: 0,
keyword: '', step1: this.$parent.$refs.step1.form,
projects: [], cache: this.$store.state.match.cache,
page: 1, nums: ['一', '二', '三'],
pageSize: 5, methods: [
total: 0, {
sysId: '', id: 0,
permissionsKeys: ['练习', '考核', '竞赛'], name: '实操'
timeInvalid: false },
{
id: 1,
name: '理论'
},
{
id: 2,
name: '线下'
}
],
originForm: {
cid: '',
mallId: '',
contentDescription: '',
endTime: '',
scoreRule: '',
stageId: '',
startTime: '',
systemId: '',
offlineAddress: '',
offlineButton: 0,
onlineAddress: '',
onlineButton: 0,
time: []
},
form: [],
setVisible: false,
curStep: 0,
pass: 0
}; };
}, },
components: {
set
},
watch: { watch: {
// , // ,
form: { form: {
@ -149,70 +161,55 @@ export default {
}, },
deep: true deep: true
}, },
keyword: function (val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.initData();
}, 500);
}
}, },
mounted () { mounted () {
this.getCourse() this.handleForm()
}, },
methods: { methods: {
// //
getCourse () { resumeData () {
this.loadIns = Loading.service() if (this.cache) {
this.$get(this.api.curriculumList).then(({ data }) => { this.curStep = this.cache.curStep
const list = data if (this.cache.form) this.form = this.cache.form
this.curriculumList = data this.setVisible = true
if (!this.form.cid && list.length) this.form.cid = list[0].cid this.$store.commit('match/setCache', null)
this.courseChange() }
}).catch(err => {
this.loadIns.close()
});
},
//
courseChange (val) {
const { systemId } = this.curriculumList.find(e => e.cid == this.form.cid)
this.sysId = systemId
if (val) this.loadIns = Loading.service()
this.getProject()
},
//
getProject () {
this.$post(this.api.getProjectAssessmentByCompetition, {
pageNum: this.page,
pageSize: this.pageSize,
cid: this.form.cid,
projectName: this.keyword,
systemId: this.sysId,
permissions: 2
}).then(({ data }) => {
this.projects = data.records
this.total = data.total
this.loadIns.close()
}).catch(err => {
this.loadIns.close()
});
}, },
initData () { // form
this.page = 1; handleForm () {
this.getProject(); // id
this.$post(`${this.api.queryCompetitionStageBySetupId}?setupId=${this.setupId}`).then(res => {
res.competitionStages.map(e => {
const form = e.competitionContent || JSON.parse(JSON.stringify(this.originForm))
if (form.startTime) {
form.time = [form.startTime, form.endTime]
} else {
form.time = []
}
form.offlineButton = !!form.offlineButton
form.onlineButton = !!form.onlineButton
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 => { })
}, },
handleCurrentChange (val) { //
this.page = val; toSet (i) {
this.getProject(); this.curStep = i
this.$parent.showBtns = false
this.setVisible = true
}, },
// //
toProject () { hideSet (form) {
const { form, curStep } = this.$parent if (form) this.form[this.curStep] = form
form[curStep] = this.form this.setVisible = false
this.$store.commit('match/setCache', { this.$parent.showBtns = true
form,
curStep
})
this.$router.push(`/project/list?show=1`)
}, },
// //
timeChange (val) { timeChange (val) {
@ -220,12 +217,8 @@ export default {
const startTime = new Date(val[0]) const startTime = new Date(val[0])
const endTime = new Date(val[1]) const endTime = new Date(val[1])
const { playStartTime, playEndTime } = this.step1 const { playStartTime, playEndTime } = this.step1
if (startTime < new Date(playStartTime) || endTime > new Date(playEndTime)) { if (startTime < new Date(playStartTime) || endTime > new Date(playEndTime)) return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
this.timeInvalid = true const { form, curStep } = this
return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
}
this.timeInvalid = false
const { form, curStep } = this.$parent
for (const i in form) { for (const i in form) {
// //
if (i !== curStep) { if (i !== curStep) {
@ -239,29 +232,124 @@ export default {
} }
} }
}, },
//
publish () {
this.competitionId && this.$post(`${this.api.publishCompetition}?competitionId=${this.competitionId}&publishStatus=1`).then(res => { }).catch(err => { })
},
// //
save () { save (status, next = 0, releaseType, cb) {
const { form } = this const { form } = this
if (!form.time.length) return util.warningMsg('请选择比赛时间') if (!form.length) {
const { playStartTime, playEndTime } = this.step1 this.$parent.hideLoad()
if (new Date(form.time[0]) < new Date(playStartTime) || new Date(form.time[1]) > new Date(playEndTime)) return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。') util.successMsg('保存成功')
if (!form.cid) return util.warningMsg('请选择课程') this.$emit('next', next)
if (!form.projectId) return util.warningMsg('请选择项目') return
const { systemId, systemName, projectName } = this.projects.find(e => e.projectId == form.projectId) }
if (systemId) form.systemId = systemId //
if (projectName) form.projectName = projectName if (status) {
if (systemName) form.systemName = systemName let invalid = 0
form.startTime = form.time[0] const { playStartTime, playEndTime } = this.step1
form.endTime = form.time[1] for (const e of form) {
this.$emit('hideSet', this.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
util.errorMsg('请输入比赛内容')
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
}
//
for (const e of form) {
e.offlineButton = e.offlineButton ? 1 : 0
e.onlineButton = e.onlineButton ? 1 : 0
}
this.$parent.showLoad()
this.$post(this.api[form[0].contentId ? 'editCompetitionContent' : 'addCompetitionContent'], {
competitionContents: form
}).then(res => {
this.$parent.hideLoad()
//
status && this.publish(status)
util.successMsg((status ? '发布' : '保存') + '成功')
this.$emit('next', next, cb)
}).catch(err => {
this.$parent.hideLoad()
})
}, },
//
back () {
this.$emit('hideSet')
}
} }
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.step {
padding-bottom: 10px;
background-color: #f9f9f9;
.title {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 15px;
margin-bottom: 10px;
background-color: #ededed;
}
}
.line {
margin-bottom: 10px;
}
/deep/.req {
.el-form-item__label {
&:before {
content: '*';
margin-right: 5px;
font-size: 18px;
vertical-align: middle;
color: #f00;
}
}
}
</style> </style>

@ -89,6 +89,9 @@
<button v-else-if="isCourse || withLink" <button v-else-if="isCourse || withLink"
class="btn entry" class="btn entry"
@click="toStation">进入实验</button> @click="toStation">进入实验</button>
<button v-else-if="isValueModule"
class="btn entry"
@click="toSystem">进入系统</button>
</div> </div>
</div> </div>
<div class="course"> <div class="course">
@ -234,10 +237,11 @@ export default {
}; };
}, },
computed: { computed: {
// //
withLink () { withLink () {
const links = this.form.mallNonAssociatedLinks const links = this.form.mallNonAssociatedLinks
return this.form.mall.isAssociatedProduct && links && links.length const id = this.form.classificationIds
return (this.form.mall.isAssociatedProduct || (id && id[0] == 5)) && links && links.length
}, },
// //
isCourse () { isCourse () {
@ -258,6 +262,12 @@ export default {
return isCourse return isCourse
} }
return false return false
},
//
isValueModule () {
let id = this.form.classificationIds
if (id) return id[0] == 3
return false
} }
}, },
mounted () { mounted () {
@ -313,7 +323,7 @@ export default {
}, },
// //
toTrail () { toTrail () {
window.open('https://f.wps.cn/g/VekixBcm/') window.open('https://f.wps.cn/g/0sJLI4NA/')
}, },
// //
toStation () { toStation () {
@ -325,6 +335,10 @@ export default {
this.linkVisible = true this.linkVisible = true
} }
}, },
//
toSystem () {
this.$router.push(`/match`)
},
// //
getHot () { getHot () {
this.$post(this.api.listOfGoods, { this.$post(this.api.listOfGoods, {

@ -52,26 +52,7 @@
popper-class="course-cas" popper-class="course-cas"
@expand-change="curChange" @expand-change="curChange"
@change="curChange"></el-cascader> @change="curChange"></el-cascader>
<!-- <el-select v-model="queryData.cid" @change="courseChange">
<el-option
v-for="item in curriculumList"
:key="item.cid"
:label="item.curriculumName"
:value="item.cid">
</el-option>
</el-select> -->
</li> </li>
<!-- <li>
<label>系统</label>
<el-select v-model="systemId" placeholder="请选择" @change="initData">
<el-option
v-for="item in systemList"
:key="item.id"
:label="item.label"
:value="item.id"
></el-option>
</el-select>
</li> -->
<li> <li>
<el-input placeholder="请输入项目名称" <el-input placeholder="请输入项目名称"
prefix-icon="el-icon-search" prefix-icon="el-icon-search"

Loading…
Cancel
Save