Skip to content

Commit 0ce1dcf

Browse files
committed
课件支持Scratch课程案例
修复若干BUG
1 parent 7c7bf67 commit 0ce1dcf

File tree

10 files changed

+195
-71
lines changed

10 files changed

+195
-71
lines changed
Lines changed: 21 additions & 12 deletions
Large diffs are not rendered by default.

api/db/update2.2.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
alter table teaching_course_unit
2+
add course_case varchar(256) default '' not null comment '课程作业案例' after course_video;
3+
INSERT INTO sys_permission ( id, parent_id, name, perms_type, component, url, sort_no, menu_type, is_leaf, is_route, keep_alive, create_by, del_flag, hidden, create_time, status, always_show, internal_or_external )
4+
VALUES ( '1384345850621280257', '1249217230806978561', 'Python', 1, 'layouts/IframePageView', '{{ window._CONFIG[''webURL''] }}/python/index.html', 2.0, 1, true, true, false, 'admin', 0, false, '2021-04-20 11:19:05', 1, false, true )
5+
6+
INSERT INTO sys_role_permission ( id, role_id, permission_id ) VALUES ( '1384346075054292993', 'f6817f48af4fb3af11b9e8bf182f618b', '1384345850621280257' )
7+
INSERT INTO sys_role_permission ( id, role_id, permission_id ) VALUES ( '1384346847716392961', '1252532277234982913', '1384345850621280257' )
8+
INSERT INTO sys_role_permission ( id, role_id, permission_id ) VALUES ( '1384346952469135361', '1252532323347161090', '1384345850621280257' )

api/jeecg-boot-module-system/src/main/java/org/jeecg/modules/teaching/entity/TeachingCourseUnit.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ public class TeachingCourseUnit implements Serializable {
8282
@Excel(name = "课程视频", width = 15)
8383
@ApiModelProperty(value = "课程视频")
8484
private java.lang.String courseVideo;
85+
/**课程案例*/
86+
@Excel(name = "课程案例", width = 15)
87+
@ApiModelProperty(value = "课程案例")
88+
private java.lang.String courseCase;
8589
/**课件PPT*/
8690
@Excel(name = "课件PPT", width = 15)
8791
@ApiModelProperty(value = "课件PPT")

web/public/scratch3/player.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<script src="../js/common.js"></script>
1212
<script>
1313
var workId = urlParams('workId')
14+
var workUrl = urlParams('workUrl')
1415
window.scratchConfig = {
1516
stageArea: {
1617
scale: 1,
@@ -44,11 +45,18 @@
4445
window.vm = vm
4546
},
4647
handleDefaultProjectLoaded: () => {
47-
getWorkInfo(workId, function (info) {
48-
window.scratch.loadProject(info.workFileUrl, () => {
48+
if(workUrl){
49+
window.scratch.loadProject(workUrl, () => {
4950
vm.runtime.start()
5051
})
51-
})
52+
}
53+
if(workId){
54+
getWorkInfo(workId, function (info) {
55+
window.scratch.loadProject(info.workFileUrl, () => {
56+
vm.runtime.start()
57+
})
58+
})
59+
}
5260
}
5361
}
5462
</script>

web/src/views/account/course/CourseListCard.vue

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,38 @@
33
<a-list :grid="{ gutter: 24, lg: 3, md: 1, sm: 1, xs: 1 }" :dataSource="dataSource">
44
<a-list-item slot="renderItem" slot-scope="item, index">
55
<a-card :hoverable="true">
6-
76
<!-- <template class="ant-card-extra" slot="extra">
87
<span class="create-time">{{item.createTime}}</span>
98
</template> -->
10-
119
<a-card-meta>
1210
<div style="margin-bottom: 3px" slot="title">{{ item.courseName }}</div>
1311
<div class="meta-cardInfo" slot="description">
14-
<router-link v-if="item.showType==1" :to="{ name: 'teaching-mineCourse-courseUnitMap', query: {id:item.id}}">
15-
<img :src="getQiniuFile(item.courseCover)" height="25px" alt="图片不存在" style="width:100%;height:100%;"/>
12+
<router-link
13+
v-if="item.showType == 1"
14+
:to="{ name: 'teaching-mineCourse-courseUnitMap', query: { id: item.id } }"
15+
>
16+
<img
17+
:src="getQiniuFile(item.courseCover)"
18+
height="25px"
19+
alt="封面不存在"
20+
style="width: 100%; height: 100%"
21+
/>
1622
</router-link>
17-
<router-link v-if="item.showType==2" :to="{ name: 'teaching-mineCourse-courseUnitCard', query: {id:item.id}}">
18-
<img :src="getQiniuFile(item.courseCover)" height="25px" alt="图片不存在" style="width:100%;height:100%;"/>
23+
<router-link
24+
v-if="item.showType == 2"
25+
:to="{ name: 'teaching-mineCourse-courseUnitCard', query: { id: item.id } }"
26+
>
27+
<img
28+
:src="getQiniuFile(item.courseCover)"
29+
height="25px"
30+
alt="封面不存在"
31+
style="width: 100%; height: 100%"
32+
/>
1933
</router-link>
2034
</div>
2135
</a-card-meta>
22-
<br>
36+
<br />
2337
<span v-html="item.courseDesc" class="article-content"></span>
24-
2538
</a-card>
2639
</a-list-item>
2740
</a-list>
@@ -34,15 +47,15 @@ export default {
3447
components: {},
3548
data() {
3649
return {
37-
dataSource: []
50+
dataSource: [],
3851
}
3952
},
4053
mounted() {
4154
this.getCourseList()
4255
},
4356
methods: {
44-
getCourseList: function() {
45-
getAction('/teaching/teachingCourse/mineCourse', {}).then(res => {
57+
getCourseList: function () {
58+
getAction('/teaching/teachingCourse/mineCourse', {}).then((res) => {
4659
if (res.success) {
4760
this.dataSource = res.result
4861
}
@@ -52,17 +65,17 @@ export default {
5265
this.loading = false
5366
})
5467
},
55-
getQiniuFile(text){
56-
if(!text){
57-
// this.$message.warning("未知的文件")
58-
return;
59-
}
60-
if(text.indexOf(",")>0){
61-
text = text.substring(0,text.indexOf(","))
62-
}
63-
return window._CONFIG['qn_base'] + text;
68+
getQiniuFile(text) {
69+
if (!text) {
70+
// this.$message.warning("未知的文件")
71+
return
6472
}
65-
}
73+
if (text.indexOf(',') > 0) {
74+
text = text.substring(0, text.indexOf(','))
75+
}
76+
return window._CONFIG['qn_base'] + text
77+
},
78+
},
6679
}
6780
</script>
6881

@@ -71,8 +84,8 @@ export default {
7184
.meta-cardInfo {
7285
zoom: 1;
7386
margin-top: 16px;
74-
.title{
75-
margin-right:20px;
87+
.title {
88+
margin-right: 20px;
7689
}
7790
img {
7891
width: 100%;
Lines changed: 55 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,99 @@
11
<template>
22
<div>
3-
<a-modal v-model="visible" :title="unit.unitName" onOk="handleOk" :footer="null" :maskClosable="false" :width="800">
4-
<template slot="footer">
5-
<a-button key="back" @click="handleCancel">关闭</a-button>
6-
</template>
7-
3+
<j-modal
4+
:visible="visible"
5+
:title="unit.unitName"
6+
@cancel="handleCancel"
7+
switchFullscreen
8+
:footer="null"
9+
:maskClosable="false"
10+
:width="800"
11+
>
812
<div class="video-area">
9-
<video :src="getQiniuFile(unit.courseVideo)" controls="true"></video>
13+
<a-tabs>
14+
<a-tab-pane key="video" tab="视频">
15+
<video :src="getQiniuFile(unit.courseVideo)" controls="true"></video>
16+
</a-tab-pane>
17+
<a-tab-pane key="scratch" tab="案例" v-if="unit.courseCase">
18+
<iframe id="player" :src="'/scratch3/player.html?workUrl=' + getQiniuFile(unit.courseCase)"></iframe>
19+
</a-tab-pane>
20+
</a-tabs>
1021
</div>
11-
<a-divider>本节课作业</a-divider>
22+
<a-divider>本节课资料</a-divider>
1223
<div>
1324
<a-row :gutter="24">
1425
<a-col :span="16">
1526
<a-card size="small" title="课程说明">
16-
<div v-html="unit.unitIntro ? unit.unitIntro.replace(/\n/g,'<br>') : ''"></div>
27+
<div v-html="unit.unitIntro ? unit.unitIntro.replace(/\n/g, '<br>') : ''"></div>
1728
</a-card>
1829
</a-col>
1930
<a-col :span="8">
2031
<a-collapse defaultActiveKey="0" :bordered="false">
2132
<template v-slot:expandIcon="props">
2233
<a-icon type="caret-right" :rotate="props.isActive ? 90 : 0" />
2334
</template>
24-
<a-collapse-panel :header="'课后作业'" :style="customStyle">
25-
<a target="_blank" :href="'/scratch'+(unit.courseWorkType===1?'2':'3')+'/index.html?unitId='+unit.id"><a-icon type="edit" />{{unit.unitName}} 去做作业</a>
35+
<a-collapse-panel :header="'课后作业'" :style="customStyle">
36+
<a
37+
target="_blank"
38+
:href="'/scratch' + (unit.courseWorkType === 1 ? '2' : '3') + '/index.html?unitId=' + unit.id"
39+
><a-icon type="edit" />{{ unit.unitName }} 去做作业</a
40+
>
2641
</a-collapse-panel>
27-
<a-collapse-panel :header="'课程资料'" :style="customStyle">
28-
<a target="_blank" :href="getQiniuFile(unit.coursePpt)"><a-icon type="edit" />{{unit.unitName}} 查看PPT</a>
42+
<a-collapse-panel :header="'课程资料'" :style="customStyle">
43+
<a target="_blank" :href="getQiniuFile(unit.coursePpt)"
44+
><a-icon type="edit" />{{ unit.unitName }} 查看资料</a
45+
>
2946
</a-collapse-panel>
3047
</a-collapse>
3148
</a-col>
3249
</a-row>
3350
</div>
34-
</a-modal>
51+
</j-modal>
3552
</div>
3653
</template>
3754
<script>
3855
export default {
3956
name: 'UnitViewModal',
4057
data() {
4158
return {
42-
customStyle:
43-
'background: #f7f7f7;border-radius: 4px;margin-bottom: 24px;border: 0;overflow: hidden',
59+
customStyle: 'background: #f7f7f7;border-radius: 4px;margin-bottom: 24px;border: 0;overflow: hidden',
4460
visible: false,
45-
unit: {}
61+
unit: {},
62+
scratchFrameHref: '',
4663
}
4764
},
4865
methods: {
4966
handleCancel(e) {
5067
this.visible = false
5168
},
52-
getQiniuFile(text){
53-
if(!text){
54-
// this.$message.warning("未知的文件")
55-
return;
56-
}
57-
if(text.indexOf(",")>0){
58-
text = text.substring(0,text.indexOf(","))
59-
}
60-
return window._CONFIG['qn_base'] + text;
69+
previewScratch(record) {
70+
this.scratchFrameHref = '/scratch3/player.html?workId=' + record.id
71+
},
72+
getQiniuFile(text) {
73+
if (!text) {
74+
// this.$message.warning("未知的文件")
75+
return
6176
}
62-
}
77+
if (text.indexOf(',') > 0) {
78+
text = text.substring(0, text.indexOf(','))
79+
}
80+
return window._CONFIG['qn_base'] + text
81+
},
82+
},
6383
}
6484
</script>
6585
<style lang="less" scoped>
66-
.video-area{
67-
video{
86+
.video-area {
87+
video {
6888
width: 100%;
6989
max-height: 500px;
7090
}
7191
}
92+
#player {
93+
border: none;
94+
width: 520px;
95+
height: 400px;
96+
margin: auto;
97+
display: block;
98+
}
7299
</style>

web/src/views/teaching/TeachingCourseList.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@
8383
<span slot="action" slot-scope="text, record">
8484
<a @click="handleEdit(record)">编辑</a>
8585
<a-divider type="vertical" />
86+
<a @click="handleUnit(record)">单元</a>
87+
<a-divider type="vertical" />
8688
<a-dropdown>
8789
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
8890
<a-menu slot="overlay">
@@ -190,6 +192,14 @@
190192
methods: {
191193
initDictConfig(){
192194
},
195+
handleUnit(record){
196+
this.$router.push({
197+
path: '/course/courseUnit',
198+
query: {
199+
courseId: record.id
200+
}
201+
})
202+
},
193203
}
194204
}
195205
</script>

web/src/views/teaching/TeachingCourseUnitList.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,18 @@
44
<div class="table-page-search-wrapper">
55
<a-form layout="inline" @keyup.enter.native="searchQuery">
66
<a-row :gutter="24">
7+
<a-col :xl="6" :lg="7" :md="8" :sm="24">
8+
<a-form-item label="课程包名">
9+
<j-dict-select-tag type="list" v-model="queryParam.courseId" dictCode="teaching_course,course_name,id" placeholder="请选择课程包"/>
10+
</a-form-item>
11+
</a-col>
712

13+
<a-col :xl="6" :lg="7" :md="8" :sm="24">
14+
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
15+
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
16+
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
17+
</span>
18+
</a-col>
819
</a-row>
920
</a-form>
1021
</div>
@@ -174,6 +185,14 @@
174185
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
175186
}
176187
},
188+
created(){
189+
let courseId = this.$route.query.courseId
190+
console.log(courseId);
191+
if(courseId){
192+
this.queryParam.courseId = courseId
193+
this.searchQuery()
194+
}
195+
},
177196
methods: {
178197
initDictConfig(){
179198
},

web/src/views/teaching/modules/TeachingCourseModal.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
</a-form-item>
2222
<a-form-item label="展示形式" :labelCol="labelCol" :wrapperCol="wrapperCol">
2323
<a-select placeholder="请选择展示形式" v-decorator="['showType', validatorRules.showType, {initialValue:'1'}]" @change="onShowTypeSelected">
24-
<a-select-option value="1">地图</a-select-option>
25-
<a-select-option value="2">卡片</a-select-option>
24+
<a-select-option :value="1">地图</a-select-option>
25+
<a-select-option :value="2">卡片</a-select-option>
2626
</a-select>
2727
</a-form-item>
2828
<a-form-item label="课程封面" :labelCol="labelCol" :wrapperCol="wrapperCol">

0 commit comments

Comments
 (0)