设计平台课程系统调整

This commit is contained in:
fan 2019-10-22 17:24:41 +08:00
parent 6f314ba150
commit 0cafd0c7f3
9 changed files with 199 additions and 36 deletions

View File

@ -3,9 +3,9 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // 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.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'; // 王兴杰 // BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
} else { } else {
BASE_API = process.env.VUE_APP_BASE_API; BASE_API = process.env.VUE_APP_BASE_API;

View File

@ -29,7 +29,6 @@
</template> </template>
<script> <script>
import { listPublishMap } from '@/api/jmap/map'; import { listPublishMap } from '@/api/jmap/map';
// import { getTrainingSystemList} from '@/api/trainingPlatform';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import { getSessionStorage, setSessionStorage, removeSessionStorage } from '@/utils/auth'; import { getSessionStorage, setSessionStorage, removeSessionStorage } from '@/utils/auth';
import FilterCity from '@/views/components/filterCity'; import FilterCity from '@/views/components/filterCity';

View File

@ -23,28 +23,38 @@
</el-scrollbar> </el-scrollbar>
</div> </div>
<transition> <transition>
<router-view /> <router-view @refresh="refresh" />
</transition> </transition>
</div> </div>
<operate-menu ref="menu" :point="point" :node="node" @refresh="refresh" @changeRouter="changeRouter" />
</el-card> </el-card>
</template> </template>
<script> <script>
import { getLessonTree } from '@/api/jmap/lessondraft'; import { getLessonTree } from '@/api/jmap/lessondraft';
import { DeviceMenu } from '@/scripts/ConstDic'; import { DeviceMenu } from '@/scripts/ConstDic';
import OperateMenu from './operateMenu';
export default { export default {
name: 'LessonDetail', name: 'LessonDetail',
components: {
OperateMenu
},
data() { data() {
return { return {
treeList: [], treeList: [],
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'name', label: 'name'
disabled: this.showNode
}, },
name: '', name: '',
lessonId: '', lessonId: '',
expandList: [] expandList: [],
point: {
x: 0,
y: 0
},
node: {
}
}; };
}, },
computed: { computed: {
@ -66,7 +76,6 @@ export default {
this.lessonId = resp.data[0].id; this.lessonId = resp.data[0].id;
this.treeList = resp.data; this.treeList = resp.data;
} }
this.editLesson(); this.editLesson();
}); });
@ -78,22 +87,41 @@ export default {
return data.name.indexOf(value) !== -1; return data.name.indexOf(value) !== -1;
}, },
editLesson() { 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) { createChapte() {
return obj.type !== 'Training'; 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) { showContextMenu(e, obj, node, vueElem) {
if (obj && obj.type === 'TrainingType' || obj.type === 'Training') { if (obj && obj.type === 'Lesson' || obj.type === 'Chapter') {
e.preventDefault(); e.preventDefault();
this.point = { this.point = {
x: e.clientX, x: e.clientX,
y: e.clientY y: e.clientY
}; };
this.node = node; this.node = node;
const menu = DeviceMenu.Training; const menu = DeviceMenu.Lesson;
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu }); 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();
} }
} }
}; };

View File

@ -181,6 +181,14 @@ export default {
return row.status ==='0'&& !this.hasRelease; 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'), name: this.$t('global.delete'),
handleClick: this.deleteLesson, handleClick: this.deleteLesson,
@ -200,7 +208,10 @@ export default {
{ {
name: '课程详情', name: '课程详情',
handleClick: this.goDetail, handleClick: this.goDetail,
type: 'primary' type: 'primary',
showControl: (row) => {
return row.status !=='1';
}
} }
] ]
} }
@ -230,6 +241,7 @@ export default {
}, },
methods: { methods: {
loadInitData() { loadInitData() {
this.loading = true;
getLessonTree(this.$route.params.skinCode).then(response=> { getLessonTree(this.$route.params.skinCode).then(response=> {
response.data.forEach(elem => { response.data.forEach(elem => {
if (elem.children) { if (elem.children) {
@ -279,9 +291,6 @@ export default {
refresh() { refresh() {
this.$refs.queryListPage.refresh(true); this.$refs.queryListPage.refresh(true);
}, },
editLesson(row) {
this.$router.push( {path: `${UrlConfig.design.lessonEdit}/lessonEdit`, query: {id: row.id, skinCode: row.code}} );
},
lessonCreate() { lessonCreate() {
this.$router.push({ path: `${UrlConfig.design.lessonEdit}/lessonCreate`, query: {skinCode: this.$route.params.skinCode} }); 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')); 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) { treeSort(index, row) {
this.$router.push({path: `${UrlConfig.design.lessonEdit}/treeSort`, query: 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) { 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, cityCode: this.$route.query.cityCode, mapId: this.$route.params.mapId}});
this.$router.push({path: `/design/lesson/details`, query: {lessonId: row.id, skinCode: this.$route.params.skinCode}});
} }
} }
}; };

View File

@ -72,7 +72,7 @@
<script> <script>
import { createLessonChapter, updateLessonChapter, getLessonDetail, getLessonChapterDetail } from '@/api/jmap/lessondraft'; import { createLessonChapter, updateLessonChapter, getLessonDetail, getLessonChapterDetail } from '@/api/jmap/lessondraft';
import localStore from 'storejs'; import { UrlConfig } from '@/router/index';
import TrainList from './list'; import TrainList from './list';
export default { export default {
@ -134,7 +134,7 @@ export default {
getChapter(data) { getChapter(data) {
getLessonChapterDetail(data).then(response => { getLessonChapterDetail(data).then(response => {
this.setChapterModel(response.data); this.setChapterModel(response.data);
}).catch(error => { }).catch(() => {
this.$messageBox(this.$t('error.obtainChapterDataFailed')); this.$messageBox(this.$t('error.obtainChapterDataFailed'));
}); });
}, },
@ -177,7 +177,7 @@ export default {
if (this.isEdit) { if (this.isEdit) {
this.getChapter(data); this.getChapter(data);
} }
}).catch(error => { }).catch(() => {
this.$messageBox(this.$t('error.obtainCourseDetailsFailed')); this.$messageBox(this.$t('error.obtainCourseDetailsFailed'));
}); });
}, },
@ -199,14 +199,14 @@ export default {
updateLessonChapter(this.chapterModel).then(response => { updateLessonChapter(this.chapterModel).then(response => {
this.$emit('refresh'); this.$emit('refresh');
this.$message.success(this.$t('tip.updateSuccessfully')); this.$message.success(this.$t('tip.updateSuccessfully'));
}).catch(error => { }).catch(() => {
this.$messageBox(this.$t('error.refreshFailed')); this.$messageBox(this.$t('error.refreshFailed'));
}); });
} }
}); });
}, },
back() { 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} });
} }
} }
}; };

View File

@ -57,9 +57,10 @@
</template> </template>
<script> <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 { getCommodityMapProduct } from '@/api/management/mapprd';
import { getSkinCodeList } from '@/api/management/mapskin'; import { getSkinCodeList } from '@/api/management/mapskin';
import { UrlConfig } from '@/router/index';
export default { export default {
name: 'CourseEdit', name: 'CourseEdit',
@ -182,13 +183,13 @@ export default {
name: data.name, name: data.name,
remarks: data.remarks remarks: data.remarks
}; };
}).catch(error => { }).catch(() => {
this.$messageBox(this.$t('error.obtainCourseInformationFailed')); this.$messageBox(this.$t('error.obtainCourseInformationFailed'));
}); });
} }
}, },
back() { 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} });
} }
} }
}; };

View File

@ -46,6 +46,28 @@ export default {
return this.$store.state.app.height - 125; 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() { mounted() {
const data = this.$route.query; const data = this.$route.query;
switch (this.$route.params.type) { switch (this.$route.params.type) {
@ -112,6 +134,7 @@ export default {
}); });
}, },
refresh(filterSelect) { refresh(filterSelect) {
this.$emit('refresh');
} }
} }
}; };

View 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>

View File

@ -15,6 +15,7 @@
:props="defaultProps" :props="defaultProps"
:filter-node-method="filterNode" :filter-node-method="filterNode"
highlight-current highlight-current
default-expand-all
:default-expanded-keys="expandList" :default-expanded-keys="expandList"
:span="22" :span="22"
@node-click="clickEvent" @node-click="clickEvent"