设计平台课程系统调整
This commit is contained in:
parent
6f314ba150
commit
0cafd0c7f3
@ -3,9 +3,9 @@ export function getBaseUrl() {
|
||||
let BASE_API;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
|
||||
BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
|
||||
} else {
|
||||
BASE_API = process.env.VUE_APP_BASE_API;
|
||||
|
@ -29,7 +29,6 @@
|
||||
</template>
|
||||
<script>
|
||||
import { listPublishMap } from '@/api/jmap/map';
|
||||
// import { getTrainingSystemList} from '@/api/trainingPlatform';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
import { getSessionStorage, setSessionStorage, removeSessionStorage } from '@/utils/auth';
|
||||
import FilterCity from '@/views/components/filterCity';
|
||||
|
@ -23,28 +23,38 @@
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
<transition>
|
||||
<router-view />
|
||||
<router-view @refresh="refresh" />
|
||||
</transition>
|
||||
</div>
|
||||
<operate-menu ref="menu" :point="point" :node="node" @refresh="refresh" @changeRouter="changeRouter" />
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getLessonTree } from '@/api/jmap/lessondraft';
|
||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
||||
import OperateMenu from './operateMenu';
|
||||
export default {
|
||||
name: 'LessonDetail',
|
||||
components: {
|
||||
OperateMenu
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
treeList: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
disabled: this.showNode
|
||||
label: 'name'
|
||||
},
|
||||
name: '',
|
||||
lessonId: '',
|
||||
expandList: []
|
||||
expandList: [],
|
||||
point: {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
node: {
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -66,7 +76,6 @@ export default {
|
||||
this.lessonId = resp.data[0].id;
|
||||
this.treeList = resp.data;
|
||||
}
|
||||
|
||||
this.editLesson();
|
||||
});
|
||||
|
||||
@ -78,22 +87,41 @@ export default {
|
||||
return data.name.indexOf(value) !== -1;
|
||||
},
|
||||
editLesson() {
|
||||
this.$router.push( {path: `/design/lesson/details/edit/lessonEdit`, query: {id: this.treeList[0].id, skinCode: this.$route.query.skinCode}} );
|
||||
this.$router.push( {path: `/design/lesson/details/edit/lessonEdit`, query: {id: this.lessonId, skinCode: this.$route.query.skinCode, cityCode: this.$route.query.cityCode, mapId: this.$route.query.mapId}} );
|
||||
},
|
||||
showNode(obj) {
|
||||
return obj.type !== 'Training';
|
||||
createChapte() {
|
||||
this.$router.push({path: `/design/lesson/details/edit/chapterCreate`, query: {lessonId: this.lessonId, skinCode: this.$route.query.skinCode, cityCode: this.$route.query.cityCode, mapId: this.$route.query.mapId}});
|
||||
},
|
||||
updateChapte(node) {
|
||||
this.$router.push( {path: `/design/lesson/details/edit/chapterEdit`, query: {id: node.data.id, skinCode: this.$route.query.skinCode, lessonId: this.lessonId, cityCode: this.$route.query.cityCode, mapId: this.$route.query.mapId}});
|
||||
},
|
||||
showContextMenu(e, obj, node, vueElem) {
|
||||
if (obj && obj.type === 'TrainingType' || obj.type === 'Training') {
|
||||
if (obj && obj.type === 'Lesson' || obj.type === 'Chapter') {
|
||||
e.preventDefault();
|
||||
this.point = {
|
||||
x: e.clientX,
|
||||
y: e.clientY
|
||||
};
|
||||
this.node = node;
|
||||
const menu = DeviceMenu.Training;
|
||||
const menu = DeviceMenu.Lesson;
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
|
||||
}
|
||||
},
|
||||
changeRouter(params) {
|
||||
switch (params.event) {
|
||||
case '01':
|
||||
this.editLesson();
|
||||
break;
|
||||
case '02':
|
||||
this.createChapte();
|
||||
break;
|
||||
case '03':
|
||||
this.updateChapte(params.node);
|
||||
break;
|
||||
}
|
||||
},
|
||||
refresh() {
|
||||
this.initPageData();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -181,6 +181,14 @@ export default {
|
||||
return row.status ==='0'&& !this.hasRelease;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: this.$t('lesson.review'),
|
||||
handleClick: this.review,
|
||||
type: 'primary',
|
||||
showControl: (row) => {
|
||||
return row.status==='1';
|
||||
}
|
||||
},
|
||||
{
|
||||
name: this.$t('global.delete'),
|
||||
handleClick: this.deleteLesson,
|
||||
@ -200,7 +208,10 @@ export default {
|
||||
{
|
||||
name: '课程详情',
|
||||
handleClick: this.goDetail,
|
||||
type: 'primary'
|
||||
type: 'primary',
|
||||
showControl: (row) => {
|
||||
return row.status !=='1';
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -230,6 +241,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
loadInitData() {
|
||||
this.loading = true;
|
||||
getLessonTree(this.$route.params.skinCode).then(response=> {
|
||||
response.data.forEach(elem => {
|
||||
if (elem.children) {
|
||||
@ -279,9 +291,6 @@ export default {
|
||||
refresh() {
|
||||
this.$refs.queryListPage.refresh(true);
|
||||
},
|
||||
editLesson(row) {
|
||||
this.$router.push( {path: `${UrlConfig.design.lessonEdit}/lessonEdit`, query: {id: row.id, skinCode: row.code}} );
|
||||
},
|
||||
lessonCreate() {
|
||||
this.$router.push({ path: `${UrlConfig.design.lessonEdit}/lessonCreate`, query: {skinCode: this.$route.params.skinCode} });
|
||||
},
|
||||
@ -304,13 +313,6 @@ export default {
|
||||
this.$messageBox(this.$t('tip.failDelete'));
|
||||
});
|
||||
},
|
||||
createChapter(index, row) {
|
||||
if (row.type === 'Lesson') {
|
||||
this.$router.push({path: `${UrlConfig.design.lessonEdit}/chapterCreate`, query: {lessonId: row.id}});
|
||||
} else if (row.type === 'Chapter') {
|
||||
this.$router.push( {path: `${UrlConfig.design.lessonEdit}/chapterEdit`, query: {id: row.id, lessonId: row.parentId}} );
|
||||
}
|
||||
},
|
||||
treeSort(index, row) {
|
||||
this.$router.push({path: `${UrlConfig.design.lessonEdit}/treeSort`, query: row});
|
||||
},
|
||||
@ -340,9 +342,11 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
review(index, row) {
|
||||
this.$refs.lessonDetail.show(row.id);
|
||||
},
|
||||
goDetail(index, row) {
|
||||
// this.$refs.lessonDetail.show(row.id);
|
||||
this.$router.push({path: `/design/lesson/details`, query: {lessonId: row.id, skinCode: this.$route.params.skinCode}});
|
||||
this.$router.push({path: `/design/lesson/details`, query: {lessonId: row.id, skinCode: this.$route.params.skinCode, cityCode: this.$route.query.cityCode, mapId: this.$route.params.mapId}});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -72,7 +72,7 @@
|
||||
|
||||
<script>
|
||||
import { createLessonChapter, updateLessonChapter, getLessonDetail, getLessonChapterDetail } from '@/api/jmap/lessondraft';
|
||||
import localStore from 'storejs';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
import TrainList from './list';
|
||||
|
||||
export default {
|
||||
@ -134,7 +134,7 @@ export default {
|
||||
getChapter(data) {
|
||||
getLessonChapterDetail(data).then(response => {
|
||||
this.setChapterModel(response.data);
|
||||
}).catch(error => {
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('error.obtainChapterDataFailed'));
|
||||
});
|
||||
},
|
||||
@ -177,7 +177,7 @@ export default {
|
||||
if (this.isEdit) {
|
||||
this.getChapter(data);
|
||||
}
|
||||
}).catch(error => {
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('error.obtainCourseDetailsFailed'));
|
||||
});
|
||||
},
|
||||
@ -199,14 +199,14 @@ export default {
|
||||
updateLessonChapter(this.chapterModel).then(response => {
|
||||
this.$emit('refresh');
|
||||
this.$message.success(this.$t('tip.updateSuccessfully'));
|
||||
}).catch(error => {
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('error.refreshFailed'));
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
back() {
|
||||
this.$router.go(-1);
|
||||
this.$router.push({ path: `${UrlConfig.design.lessonHome}/${this.$route.query.mapId}/${this.$route.query.skinCode}`, query: {cityCode: this.$route.query.cityCode} });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -57,9 +57,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createLesson, updateLesson, getLessonDetail, delLesson } from '@/api/jmap/lessondraft';
|
||||
import { createLesson, updateLesson, getLessonDetail } from '@/api/jmap/lessondraft';
|
||||
import { getCommodityMapProduct } from '@/api/management/mapprd';
|
||||
import { getSkinCodeList } from '@/api/management/mapskin';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
|
||||
export default {
|
||||
name: 'CourseEdit',
|
||||
@ -182,13 +183,13 @@ export default {
|
||||
name: data.name,
|
||||
remarks: data.remarks
|
||||
};
|
||||
}).catch(error => {
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('error.obtainCourseInformationFailed'));
|
||||
});
|
||||
}
|
||||
},
|
||||
back() {
|
||||
this.$router.back();
|
||||
this.$router.push({ path: `${UrlConfig.design.lessonHome}/${this.$route.query.mapId}/${this.$route.query.skinCode}`, query: {cityCode: this.$route.query.cityCode} });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -46,6 +46,28 @@ export default {
|
||||
return this.$store.state.app.height - 125;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
$route() {
|
||||
const data = this.$route.query;
|
||||
switch (this.$route.params.type) {
|
||||
case 'lessonCreate':
|
||||
this.lessonCreate(data);
|
||||
break;
|
||||
case 'lessonEdit':
|
||||
this.lessonEdit(data);
|
||||
break;
|
||||
case 'chapterCreate':
|
||||
this.chapterCreate(data);
|
||||
break;
|
||||
case 'chapterEdit':
|
||||
this.chapterEdit(data);
|
||||
break;
|
||||
case 'treeSort':
|
||||
this.treeSort(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const data = this.$route.query;
|
||||
switch (this.$route.params.type) {
|
||||
@ -112,6 +134,7 @@ export default {
|
||||
});
|
||||
},
|
||||
refresh(filterSelect) {
|
||||
this.$emit('refresh');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
107
src/views/lesson/operateMenu.vue
Normal file
107
src/views/lesson/operateMenu.vue
Normal file
@ -0,0 +1,107 @@
|
||||
<template>
|
||||
<div>
|
||||
<pop-menu ref="popMenu" :menu="menu" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
||||
import PopMenu from '@/components/PopMenu';
|
||||
|
||||
export default {
|
||||
name: 'TrainingOperateMenu',
|
||||
components: {
|
||||
PopMenu
|
||||
},
|
||||
props: {
|
||||
point: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
node: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menuShow: false,
|
||||
menu: [],
|
||||
menuChapte: [
|
||||
{
|
||||
label: '更新章节',
|
||||
handler: this.updateChapter
|
||||
}
|
||||
],
|
||||
menuLesson: [
|
||||
{
|
||||
label: '创建章节',
|
||||
handler: this.createChapter
|
||||
},
|
||||
{
|
||||
label: '编辑课程',
|
||||
handler: this.editLesson
|
||||
}
|
||||
|
||||
]
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
node: function (val, old) {
|
||||
if (val && val.data) {
|
||||
switch (val.data.type) {
|
||||
case 'Lesson':
|
||||
this.menu = this.menuLesson;
|
||||
break;
|
||||
case 'Chapter':
|
||||
this.menu = this.menuChapte;
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
'$store.state.menuOperation.menuCount': function (val) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Lesson)) {
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else {
|
||||
this.doClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.closeEvent();
|
||||
},
|
||||
methods: {
|
||||
closeEvent() {
|
||||
const self = this;
|
||||
window.onclick = function (e) {
|
||||
self.doClose();
|
||||
};
|
||||
},
|
||||
doShow(point) {
|
||||
this.closeEvent();
|
||||
if (this.$refs && this.$refs.popMenu) {
|
||||
this.$refs.popMenu.resetShowPosition(point);
|
||||
}
|
||||
this.menuShow = true;
|
||||
},
|
||||
doClose() {
|
||||
if (this.$refs && this.$refs.popMenu) {
|
||||
this.$refs.popMenu.close();
|
||||
}
|
||||
this.menuShow = false;
|
||||
},
|
||||
updateChapter() {
|
||||
this.$emit('changeRouter', {event: '03', node: this.node});
|
||||
},
|
||||
createChapter() {
|
||||
this.$emit('changeRouter', {event: '02', node: this.node});
|
||||
},
|
||||
editLesson() {
|
||||
this.$emit('changeRouter', {event: '01', node: this.node});
|
||||
},
|
||||
refresh(filterSelect) {
|
||||
this.$emit('refresh', filterSelect);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -15,6 +15,7 @@
|
||||
:props="defaultProps"
|
||||
:filter-node-method="filterNode"
|
||||
highlight-current
|
||||
default-expand-all
|
||||
:default-expanded-keys="expandList"
|
||||
:span="22"
|
||||
@node-click="clickEvent"
|
||||
|
Loading…
Reference in New Issue
Block a user