课程相关

dev_202412
yujialong 2 months ago
parent 9356e4debe
commit 9ea6496254
  1. 5
      src/assets/css/main.css
  2. 1
      src/assets/img/empty.svg
  3. 14
      src/router/index.js
  4. 1028
      src/views/course/content/index.vue
  5. 303
      src/views/course/content/source.vue
  6. 63
      src/views/course/detail.vue
  7. 6
      src/views/course/list.vue
  8. 118
      src/views/resourse/index.vue

@ -504,4 +504,9 @@ li {
line-height: 1.8;
cursor: pointer;
}
}
.el-drawer__header > :first-child {
font-size: 16px;
font-weight: 600;
color: #333;
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.7 KiB

@ -79,19 +79,15 @@ let router = new Router({
},
{
path: '/curriculum',
component: () => import('../views/course/Curriculum.vue'),
component: () => import('../views/course/list'),
},
{
path: '/addcurriculum',
component: () => import('../views/course/AddCurriculum.vue'),
path: '/curriculum/detail',
component: () => import('../views/course/detail'),
},
{
path: '/curriculum/add',
component: () => import('../views/course/Add'),
},
{
path: '/contentSettings',
component: () => import('../views/course/contentSettings.vue'),
path: '/curriculum/content',
component: () => import('../views/course/content'),
},
{
path: '/data',

File diff suppressed because it is too large Load Diff

@ -0,0 +1,303 @@
<template>
<el-drawer title="添加系统资源" :visible.sync="sourceVisible" size="1200px" :close-on-click-modal="false"
custom-class="source-dia" @closed="closeDia">
<div class="overflow">
<div class="left">
<el-input style="width: 300px" placeholder="请输入资源名称" prefix-icon="el-icon-search" v-model="keyword"
clearable></el-input>
<div class="tabs mgb20">
<a class="item" v-for="(item, i) in tabs" :key="i" :class="{ active: i == active }" @click="tabChange(i)">{{
item
}}</a>
</div>
<div class="course">
<div class="item">
<div class="line">
<i class="el-icon-caret-right arrow"></i>
<el-checkbox class="check" v-model="checked"></el-checkbox>
<img class="cover" src="" alt="">
<span class="course-name"></span>
</div>
<div class="chapters">
<div class="line">
<i class="el-icon-caret-right arrow"></i>
<el-checkbox class="check" v-model="checked"></el-checkbox>
<span class="chapter-name"></span>
</div>
</div>
</div>
</div>
</div>
<div class="right">
<template v-if="checked.length">
<div class="flex-between">
<p class="total">已选资源{{ checked.length }}</p>
<el-button type="text" @click="batchDelChecked">批量移除</el-button>
</div>
<el-input placeholder="请输入资源名称" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input>
<div :class="['lines']">
<template v-for="(item, i) in checked">
<div v-if="item.stemText.includes(checkedKeyword) || item.knowledgePointName.includes(checkedKeyword)"
:key="i" class="line">
<div class="check-left">
<el-checkbox v-model="item.check"></el-checkbox>
<span class="serial">{{ i + 1 }}</span>
<el-tooltip effect="dark" :content="item.stemText" placement="top-start">
<p class="checked-name ellipsis">{{ item.stemText }}</p>
</el-tooltip>
</div>
<i class="el-icon-delete action-icon" @click="delChecked(item)"></i>
</div>
</template>
</div>
</template>
<div v-else class="empty">
<img class="icon" src="@/assets/img/empty.svg" alt="">
<p>暂无数据</p>
</div>
</div>
</div>
<div class="btns">
<el-button @click="sourceVisible = false">取消</el-button>
<el-button type="primary" :loading="submiting" @click="submit">确定</el-button>
</div>
</el-drawer>
</template>
<script>
import Setting from '@/setting'
import Util from '@/libs/util'
export default {
props: ['visible'],
data () {
return {
sourceVisible: false,
active: 'tab1',
tabs: {
tab1: '教学课程',
tab2: '精品课程',
tab3: '文件素材',
},
keyword: '',
searchTimer: null,
course: [],
page: 1,
pageSize: 10,
total: 0,
checked: [],
submiting: false,
loaded: 0,
};
},
watch: {
'keyword': function (val) {
clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(this.initQuesBank, 500)
},
visible () {
this.sourceVisible = this.visible
this.visible && this.init()
}
},
mounted () {
},
methods: {
//
init () {
this.getCourse()
},
//
async getCourse () {
const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理')
const { page } = await this.$post(this.api.curriculumList, {
pageNum: this.page,
pageSize: this.pageSize,
supplierId: sid ? sid.supplierId : ''
})
this.course = page.records
this.total = page.total
},
initData () {
this.page = 1;
this.getData();
},
tabChange (index) {
this.active = index
},
//
async batchDelChecked (val) {
try {
const checked = this.checked.filter(e => e.check)
if (checked.length) {
checked.map(e => {
const cur = this.ques.find(n => n.questionVersionId === e.questionVersionId)
if (cur) {
cur.check = false
}
})
this.quesAllCheck = false
this.checkedAllCheck = false
this.checked = this.checked.filter(e => !e.check)
} else {
Util.warningMsg('请选择数据')
}
} catch (e) { }
},
//
async delChecked (item) {
try {
const cur = this.ques.find(e => e.questionVersionId === item.questionVersionId)
if (cur) cur.check = false
this.checked.splice(this.checked.findIndex(e => e.questionVersionId === item.questionVersionId), 1)
} catch (e) { }
},
//
async submit () {
try {
const res = await this.$post(this.api.selectQuestionsByTypeAndDifficulty, list)
let invalid = 0
let hasQues = 0
list.map((e, i) => {
if (+e.count !== res.list[i].questions.length) invalid = 1
if (e.examQuestions.length) hasQues = 1
e.score = 0
})
this.sourceVisible = false
this.$parent.calcDifficult()
this.submiting = false
} catch (e) {
this.submiting = false
}
},
//
closeDia () {
this.$emit('update:visible', false)
}
}
};
</script>
<style lang="scss" scoped>
/deep/.source-dia {
.el-drawer__header {
padding-bottom: 20px;
margin-bottom: 0;
border-bottom: 1px solid #eee;
}
.overflow {
display: flex;
}
.btns {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: 14px 0;
text-align: center;
background-color: #fff;
box-shadow: 4px -2px 6px 0px rgba(198, 198, 198, 0.3500);
}
.empty {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;
font-size: 14px;
text-align: center;
color: #a3a3a3;
}
.left {
width: 700px;
height: calc(100vh - 125px);
padding: 0 20px;
overflow: auto;
padding: 15px;
margin-right: 20px;
border-right: 1px solid #eee;
box-sizing: border-box;
.course {
.item {
padding: 10px;
margin-bottom: 10px;
background-color: #f9f9f9;
}
}
.line {
display: flex;
align-items: center;
}
.arrow {
font-size: 16px;
color: #333;
cursor: pointer;
}
.check {
margin: 0 10px;
}
.cover {
width: 100px;
max-height: 80px;
}
.course-name {
font-size: 16px;
color: #333;
}
.chapter-name {
font-size: 14px;
color: #ccc;
}
}
.right {
flex: 1;
.line {
display: flex;
padding: 5px 0;
color: #333;
}
.serial {
width: 32px;
margin: 0 12px;
text-align: center;
white-space: nowrap;
}
.checked-name {
width: calc(100% - 210px);
margin-right: 20px;
}
.action-icon {
font-size: 14px;
}
}
}
</style>

@ -215,7 +215,7 @@
</div>
<div v-if="step !== 4" class="btns">
<el-button v-if="step === 2 || step === 3" type="primary" @click="prev">上一步</el-button>
<el-button v-else type="primary" @click="save(1)">下一步</el-button>
<el-button v-if="step < 3" type="primary" @click="save(1)">下一步</el-button>
<el-button type="primary" @click="save()">保存</el-button>
<el-button @click="back">返回</el-button>
</div>
@ -461,18 +461,8 @@ export default {
getInfoData () {
this.$post(`${this.api.curriculumDetail}?cid=${this.cid}`).then(({ data }) => {
if (data.supplier) data.supplier = data.supplier.split(',').map(e => +e)
if (data.categoryId) {
this.$get(this.api.courseProfessionalClass, { disciplineId: data.categoryId }).then(res => {
this.ProfessionalClassList = res.list;
}).catch(res => { });
}
if (data.professionalCategoryId) {
this.$get(this.api.courseProfessional, { professionalClassId: data.professionalCategoryId }).then(res => {
this.ProfessionalList = res.list;
}).catch(res => { });
}
this.form = data
this.$nextTick(() => {
this.form = data;
const pList = data.practiceConfig
const { systemsAll } = this
pList.map(e => {
@ -486,11 +476,16 @@ export default {
})
this.assessmentData = aList
const cList = data.competitionConfig
cList.map(e => {
if (!systemsAll.find(n => n.systemId == e.systemId)) e.disabled = true
this.form.curriculumDisciplines.forEach(e => {
this.$set(e, 'professionalClassList', [])
this.$set(e, 'professionalList', [])
e.categoryId && this.getProfessionalClassData(e)
e.professionalCategoryId && this.getProfessionalData(e)
if (!e.categoryId) this.$set(e, 'categoryId', '')
if (!e.professionalCategoryId) this.$set(e, 'professionalCategoryId', '')
if (!e.professionalId) this.$set(e, 'professionalId', '')
})
this.matches = cList
});
}).catch(err => {
});
@ -845,7 +840,7 @@ export default {
this.step--
},
async save (next) {
const { step } = this
const { step, cid } = this
//
if (step === 1) {
this.$refs.form.validate(async (valid) => {
@ -861,27 +856,21 @@ export default {
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
if (this.cid) {
this.$post(this.api.modifyCourse, form).then((res) => {
this.$message.success("编辑成功");
}).catch((res) => {
this.submiting = false
this.loadIns.close()
});
} else {
this.$post(this.api.createCurriculum, form).then(({ cid }) => {
this.loadIns.close()
if (next) {
this.step = 2
this.cid = cid
this.$router.replace('add?cid=' + cid)
} else {
this.back()
try {
const res = await this.$post(this.api[cid ? 'modifyCourse' : 'createCurriculum'], form)
this.loadIns.close()
if (next) {
this.step = 2
if (!cid) {
this.cid = res.cid
this.$router.replace('detail?cid=' + res.cid)
}
}).catch((res) => {
this.submiting = false
this.loadIns.close()
})
} else {
this.back()
}
} finally {
this.submiting = false
this.loadIns.close()
}
}
})

@ -218,17 +218,17 @@ export default {
//
addcourse () {
this.setReferrer()
this.$router.push("/curriculum/add");
this.$router.push("/curriculum/detail");
},
//
edit (row) {
this.setReferrer()
this.$router.push(`/curriculum/add?cid=${row.cid}`);
this.$router.push(`/curriculum/detail?cid=${row.cid}`);
},
//
config (row) {
this.setReferrer()
this.$router.push(`/contentSettings?cid=${row.cid}&name=${row.curriculumName}`);
this.$router.push(`/curriculum/content?cid=${row.cid}&name=${row.curriculumName}`);
},
//
handleDelete (row) {

@ -64,10 +64,10 @@
<el-table-column prop="founderName" label="编辑人" width="130" align="center"></el-table-column>
<el-table-column label="操作" align="center" width="280">
<template slot-scope="scope">
<el-button type="text" @click="copy(scope.row)">编辑</el-button>
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
<el-button type="text" @click="copy(scope.row)">下载</el-button>
<el-button type="text" @click="manage(scope.row)" v-auth>预览</el-button>
<el-button type="text" @click="delData(scope.row)" v-auth>删除</el-button>
<el-button type="text" @click="del(scope.row)" v-auth>删除</el-button>
</template>
</el-table-column>
</el-table>
@ -77,25 +77,16 @@
</el-pagination>
</div>
<el-dialog title="修改当前阶段结束时间" :visible.sync="modifyVisible" width="900px" :close-on-click-modal="false">
<el-table :data="curRow.playingStages" class="table" ref="table" header-align="center">
<el-table-column prop="stageName" label="阶段名称" min-width="100" align="center"></el-table-column>
<el-table-column label="竞赛起止时间" width="300" align="center">
<template slot-scope="scope">
{{ scope.row.startTime + ' ~ ' + scope.row.endTime }}
</template>
</el-table-column>
<el-table-column label="结束时间调整为" align="center" width="280">
<template slot-scope="scope">
<el-date-picker popper-class="no-atTheMoment" v-model="scope.row.newEndTime" placeholder="请选择结束时间"
type="datetime" :picker-options="pickerOptions">
</el-date-picker>
</template>
</el-table-column>
</el-table>
<el-dialog title="修改资源名称" :visible.sync="sectionNameVisible" width="540px" :close-on-click-modal="false">
<el-form @submit.native.prevent>
<el-form-item>
<el-input placeholder="请输入资源名称" v-model="sectionForm.sectionName" maxlength="50"
@keyup.enter.native="sectionNameSubmit()"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="modifyVisible = false"> </el-button>
<el-button size="small" type="primary" @click="modifySubmit"> </el-button>
<el-button @click="sectionNameVisible = false">取消</el-button>
<el-button type="primary" @click="sectionNameSubmit">确定</el-button>
</span>
</el-dialog>
</div>
@ -241,6 +232,12 @@ export default {
},
loading: false,
now: '',
sectionNameVisible: false,
sectionForm: {
sectionName: ''
},
};
},
watch: {
@ -309,14 +306,6 @@ export default {
})
this.matchData = data.records
this.now = await Util.getNow()
clearInterval(this.timer)
this.handleBeganStage()
this.timer = setInterval(() => {
this.now = new Date(this.now.setSeconds(this.now.getSeconds() + 1))
this.handleBeganStage()
}, 1000)
this.total = data.total
this.$refs.table.clearSelection()
this.loading = false
@ -338,28 +327,6 @@ export default {
}
})
},
//
async handleBeganStage () {
this.matchData.map(e => {
if (!e.playingStages) {
this.$set(e, 'playingStages', [])
} else {
e.playingStages = []
}
//
if (this.now >= new Date(e.playStartTime) && this.now <= new Date(e.playEndTime)) {
//
if (e.competitionStageList) {
for (const n of e.competitionStageList) {
//
if (this.now >= new Date(n.startTime) && this.now <= new Date(n.endTime)) {
e.playingStages.push(n)
}
}
}
}
})
},
initData () {
this.page = 1;
this.getData();
@ -372,6 +339,12 @@ export default {
this.setReferrer()
this.$router.push("/addMatch");
},
edit (row, chapterId) {
this.chapterId = chapterId;
this.sectionId = row.id;
this.sectionForm.sectionName = row.name;
this.sectionNameVisible = true;
},
//
copy (row) {
this.$confirm('确定要复制吗', "提示", {
@ -382,30 +355,6 @@ export default {
this.initData()
}).catch(() => { })
},
//
editEndTime (row) {
this.modifyVisible = true
row.newEndTime = ''
this.curRow = row
},
//
modifySubmit () {
const row = this.curRow
const data = []
row.competitionStageList.map(e => {
const stage = row.playingStages.find(n => n.contentId === e.contentId && n.newEndTime)
if (stage && stage.newEndTime) stage.endTime = this.formatDate('yyyy-MM-dd hh:mm:ss', stage.newEndTime)
data.push(stage || e)
})
this.$post(this.api.editCompetitionContent, {
competitionContents: data
}).then(async res => {
await this.$post(`${this.api.refreshPageNotification}?content=1`)
Util.successMsg('修改成功')
this.modifyVisible = false
this.getData()
}).catch(err => { })
},
//
manage (row) {
this.setReferrer()
@ -420,8 +369,8 @@ export default {
sourceChange (val) {
this.initData()
},
delData (row) {
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", {
del (row) {
this.$confirm("删除后用户将无法再查看和使用此资源,确定删除?", "提示", {
type: "warning"
})
.then(() => {
@ -476,6 +425,23 @@ export default {
await this.$post(`${this.api.refreshPageNotification}?content=1`)
},
sectionNameSubmit () {
if (!this.sectionForm.sectionName) return this.$message.warning("请填写资源名称");
let data = {
id: this.sectionId,
cid: this.id,
chapterId: this.chapterId,
name: this.sectionForm.sectionName
};
this.$put(this.api.editSubsection, data).then(res => {
this.$message.success("修改成功");
this.sectionNameVisible = false;
this.getData();
})
.catch(err => {
});
},
}
};
</script>

Loading…
Cancel
Save