调整代码
This commit is contained in:
parent
6d665acbb5
commit
a49b195090
@ -4,8 +4,8 @@ export function getBaseUrl() {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// BASE_API = 'https://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.5: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;
|
||||
|
@ -47,6 +47,7 @@
|
||||
<el-button v-if="hasPermssion" type="primary" @click="distribute">{{ $t('exam.distributePermission') }}</el-button>
|
||||
<el-button v-if="hasPermssion" type="primary" @click="transfer">{{ $t('global.transferQRCode') }}</el-button>
|
||||
<el-button v-if="isAddRule" type="primary" @click="checkCourse">{{ $t('exam.viewCoursePapers') }}</el-button>
|
||||
<el-button type="primary" @click="backLessonList">返回课程列表</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
@ -195,6 +196,9 @@ export default {
|
||||
if (expand instanceof Array) {
|
||||
this.expandList = expand;
|
||||
}
|
||||
},
|
||||
backLessonList() {
|
||||
this.$router.push({ path: `${UrlConfig.trainingPlatform.examHome}/${this.$route.params.subSystem}`});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,12 +1,26 @@
|
||||
<template>
|
||||
<div>
|
||||
<transition>
|
||||
<router-view :style="{ position:'relative', left:widthLeft+'px', width: (width - widthLeft)+'px'}" :product-list="productList" />
|
||||
</transition>
|
||||
</div>
|
||||
<div>
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: (height-125) +'px' }">
|
||||
<el-tree
|
||||
ref="tree"
|
||||
:data="treeList"
|
||||
node-key="id"
|
||||
:props="defaultProps"
|
||||
highlight-current
|
||||
:span="22"
|
||||
:filter-node-method="filterNode"
|
||||
:default-expanded-keys="expandList"
|
||||
@node-click="clickEvent"
|
||||
/>
|
||||
</el-scrollbar>
|
||||
<transition>
|
||||
<router-view :style="{ position:'relative', left:widthLeft+'px', width: (width - widthLeft)+'px'}" :product-list="productList" />
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getLessonTree } from '@/api/jmap/lessondraft';
|
||||
export default {
|
||||
name: 'LessonDetail',
|
||||
data() {
|
||||
@ -14,8 +28,21 @@ export default {
|
||||
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
width() {
|
||||
return this.$store.state.app.width - 481 - this.widthLeft;
|
||||
},
|
||||
height() {
|
||||
return this.$store.state.app.height - 90;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initPageData();
|
||||
},
|
||||
methods: {
|
||||
|
||||
initPageData() {
|
||||
getLessonTree(this.$route.query.lessonId);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -1,168 +1,186 @@
|
||||
<template>
|
||||
<el-card class="map-list-main" v-loading="loading">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>{{$t('lesson.courseList')}}</span>
|
||||
<el-button type="text" @click="publishCreate" style="float: right; padding: 3px 0">{{$t('lesson.createNewCoursesFromRelease')}}</el-button>
|
||||
</div>
|
||||
<el-input :placeholder="this.$t('global.filteringKeywords')" v-model="filterText" clearable> </el-input>
|
||||
<el-scrollbar wrapClass="scrollbar-wrapper" :style="{height: (height - 55) + 'px'}">
|
||||
<el-tree ref="lessonTree" :data="treeData" :props="defaultProps" :filter-node-method="filterNode"
|
||||
@node-contextmenu="showContextMenu" draggable :allow-drop="allowDrop" :allow-drag="allowDrag"
|
||||
@node-drag-end="handleDragEnd" expand-on-click-node highlight-current @node-click="clickEvent" :span=22>
|
||||
<span slot-scope="{ node, data }">
|
||||
<span v-if="node.data.type === 'skin'" class="el-icon-news"></span>
|
||||
<span v-if="node.data.type === 'lesson'" class="el-icon-tickets"></span>
|
||||
<span v-if="node.data.type === 'chapter'" class="el-icon-document"></span>
|
||||
<span> {{ node.label }}</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
</el-scrollbar>
|
||||
<tree-operate-menu ref="treeOperateMenu" :point="point" :selected="selected" @refresh="refresh"
|
||||
@lessonCreate="lessonCreate" @chapterCreate="chapterCreate" @treeSort="treeSort"></tree-operate-menu>
|
||||
</el-card>
|
||||
<el-card v-loading="loading" class="map-list-main">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>{{ $t('lesson.courseList') }}</span>
|
||||
<el-button type="text" style="float: right; padding: 3px 0" @click="publishCreate">{{ $t('lesson.createNewCoursesFromRelease') }}</el-button>
|
||||
</div>
|
||||
<el-input v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable />
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: (height - 55) + 'px'}">
|
||||
<el-tree
|
||||
ref="lessonTree"
|
||||
:data="treeData"
|
||||
:props="defaultProps"
|
||||
:filter-node-method="filterNode"
|
||||
draggable
|
||||
:allow-drop="allowDrop"
|
||||
:allow-drag="allowDrag"
|
||||
expand-on-click-node
|
||||
highlight-current
|
||||
:span="22"
|
||||
@node-contextmenu="showContextMenu"
|
||||
@node-drag-end="handleDragEnd"
|
||||
@node-click="clickEvent"
|
||||
>
|
||||
<span slot-scope="{ node }">
|
||||
<span v-if="node.data.type === 'skin'" class="el-icon-news" />
|
||||
<span v-if="node.data.type === 'lesson'" class="el-icon-tickets" />
|
||||
<span v-if="node.data.type === 'chapter'" class="el-icon-document" />
|
||||
<span> {{ node.label }}</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
</el-scrollbar>
|
||||
<tree-operate-menu
|
||||
ref="treeOperateMenu"
|
||||
:point="point"
|
||||
:selected="selected"
|
||||
@refresh="refresh"
|
||||
@lessonCreate="lessonCreate"
|
||||
@chapterCreate="chapterCreate"
|
||||
@treeSort="treeSort"
|
||||
/>
|
||||
</el-card>
|
||||
</template>
|
||||
<script>
|
||||
import { getLessonTree, dragSortLessonChapter } from '@/api/jmap/lessondraft'
|
||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
||||
import TreeOperateMenu from './operateMenu';
|
||||
import FilterCity from '@/views/components/filterCity';
|
||||
import { getLessonTree, dragSortLessonChapter } from '@/api/jmap/lessondraft';
|
||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
||||
import TreeOperateMenu from './operateMenu';
|
||||
import FilterCity from '@/views/components/filterCity';
|
||||
|
||||
export default {
|
||||
name: 'TrainingOperate',
|
||||
components: {
|
||||
TreeOperateMenu,
|
||||
},
|
||||
props: {
|
||||
height: {
|
||||
type: Number
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
filterText: '',
|
||||
node: {},
|
||||
selected: {},
|
||||
menuoper: {},
|
||||
treeData: [],
|
||||
point: {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.$refs.lessonTree.filter(val);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.refresh();
|
||||
},
|
||||
methods: {
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.name.indexOf(value) !== -1;
|
||||
},
|
||||
allowDrop(draggingNode, dropNode, type) {
|
||||
if (draggingNode && draggingNode.data.type === 'chapter') {
|
||||
return dropNode && dropNode.data.type === 'chapter';
|
||||
} else if (draggingNode && draggingNode.data.type === 'training') {
|
||||
return dropNode && dropNode.data.type === 'training' && type !== 'inner' && draggingNode.parent == dropNode.parent;
|
||||
}
|
||||
},
|
||||
allowDrag(draggingNode) {
|
||||
return draggingNode && (draggingNode.data.type === 'chapter' || draggingNode.data.type === 'training');
|
||||
},
|
||||
handleDragEnd(draggingNode, dropNode, dropType, ev) {
|
||||
if (draggingNode && dropNode && dropType !== 'none') {
|
||||
let lesson = this.getLeesonId(dropNode);
|
||||
let lessonId = lesson.data.id;
|
||||
let model = {
|
||||
location: dropType,
|
||||
sourceId: draggingNode.data.id,
|
||||
sourceType: draggingNode.data.type,
|
||||
targetId: dropNode.data.id,
|
||||
targetType: dropNode.data.type,
|
||||
lessonId: lessonId,
|
||||
chapterId: dropNode.parent.data.id
|
||||
}
|
||||
let that = this;
|
||||
dragSortLessonChapter(model).then(response => {
|
||||
})
|
||||
}
|
||||
},
|
||||
getLeesonId(node) {
|
||||
if (null !== node.parent.parent) {
|
||||
return this.getLeesonId(node.parent);
|
||||
} else {
|
||||
return node;
|
||||
}
|
||||
},
|
||||
showContextMenu(e, obj, node, vueElem) {
|
||||
if (obj && (obj.type == 'lesson' || obj.type == 'chapter')) {
|
||||
e.preventDefault();
|
||||
this.point = {
|
||||
x: e.clientX,
|
||||
y: e.clientY
|
||||
}
|
||||
this.node = node;
|
||||
this.selected = obj;
|
||||
let menu = DeviceMenu.Lesson;
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
|
||||
}
|
||||
},
|
||||
clickEvent(obj, node, vueElem) {
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null });
|
||||
if (obj.type === 'skin') {
|
||||
this.$emit('lessonCreate', node);
|
||||
} else if (obj.type === 'lesson') {
|
||||
this.$emit('lessonEdit', node);
|
||||
} else if (obj.type === 'chapter') {
|
||||
this.$emit('chapterEdit', node);
|
||||
}
|
||||
},
|
||||
chapterCreate() {
|
||||
this.$emit('chapterCreate', this.node);
|
||||
},
|
||||
lessonCreate() {
|
||||
this.$emit('lessonCreate', this.node);
|
||||
},
|
||||
publishCreate() {
|
||||
this.$emit('publishCreate', this.node);
|
||||
},
|
||||
treeSort() {
|
||||
this.$emit('treeSort', this.node);
|
||||
},
|
||||
convertTreeData(list) {
|
||||
let tree = [];
|
||||
if (list && list.length) {
|
||||
/*去除列表的training节点*/
|
||||
list.forEach(elem => {
|
||||
elem.children = this.convertTreeData(elem.children);
|
||||
if (elem.type !== 'training') {
|
||||
tree.push(elem);
|
||||
}
|
||||
})
|
||||
}
|
||||
return tree;
|
||||
},
|
||||
refresh() {
|
||||
this.loading = true;
|
||||
getLessonTree().then(response => {
|
||||
this.treeData = this.convertTreeData(response.data);
|
||||
this.$nextTick(() => { this.loading = false; });
|
||||
}).catch(error => {
|
||||
this.$messageBox(this.$t('error.refreshFailed'));
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
export default {
|
||||
name: 'TrainingOperate',
|
||||
components: {
|
||||
TreeOperateMenu
|
||||
},
|
||||
props: {
|
||||
height: {
|
||||
type: Number
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
filterText: '',
|
||||
node: {},
|
||||
selected: {},
|
||||
menuoper: {},
|
||||
treeData: [],
|
||||
point: {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.$refs.lessonTree.filter(val);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.refresh();
|
||||
},
|
||||
methods: {
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.name.indexOf(value) !== -1;
|
||||
},
|
||||
allowDrop(draggingNode, dropNode, type) {
|
||||
if (draggingNode && draggingNode.data.type === 'chapter') {
|
||||
return dropNode && dropNode.data.type === 'chapter';
|
||||
} else if (draggingNode && draggingNode.data.type === 'training') {
|
||||
return dropNode && dropNode.data.type === 'training' && type !== 'inner' && draggingNode.parent == dropNode.parent;
|
||||
}
|
||||
},
|
||||
allowDrag(draggingNode) {
|
||||
return draggingNode && (draggingNode.data.type === 'chapter' || draggingNode.data.type === 'training');
|
||||
},
|
||||
handleDragEnd(draggingNode, dropNode, dropType, ev) {
|
||||
if (draggingNode && dropNode && dropType !== 'none') {
|
||||
const lesson = this.getLeesonId(dropNode);
|
||||
const lessonId = lesson.data.id;
|
||||
const model = {
|
||||
location: dropType,
|
||||
sourceId: draggingNode.data.id,
|
||||
sourceType: draggingNode.data.type,
|
||||
targetId: dropNode.data.id,
|
||||
targetType: dropNode.data.type,
|
||||
lessonId: lessonId,
|
||||
chapterId: dropNode.parent.data.id
|
||||
};
|
||||
dragSortLessonChapter(model).then(response => {
|
||||
});
|
||||
}
|
||||
},
|
||||
getLeesonId(node) {
|
||||
if (node.parent.parent !== null) {
|
||||
return this.getLeesonId(node.parent);
|
||||
} else {
|
||||
return node;
|
||||
}
|
||||
},
|
||||
showContextMenu(e, obj, node, vueElem) {
|
||||
if (obj && (obj.type == 'lesson' || obj.type == 'chapter')) {
|
||||
e.preventDefault();
|
||||
this.point = {
|
||||
x: e.clientX,
|
||||
y: e.clientY
|
||||
};
|
||||
this.node = node;
|
||||
this.selected = obj;
|
||||
const menu = DeviceMenu.Lesson;
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
|
||||
}
|
||||
},
|
||||
clickEvent(obj, node, vueElem) {
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null });
|
||||
if (obj.type === 'skin') {
|
||||
this.$emit('lessonCreate', node);
|
||||
} else if (obj.type === 'lesson') {
|
||||
this.$emit('lessonEdit', node);
|
||||
} else if (obj.type === 'chapter') {
|
||||
this.$emit('chapterEdit', node);
|
||||
}
|
||||
},
|
||||
chapterCreate() {
|
||||
this.$emit('chapterCreate', this.node);
|
||||
},
|
||||
lessonCreate() {
|
||||
this.$emit('lessonCreate', this.node);
|
||||
},
|
||||
publishCreate() {
|
||||
this.$emit('publishCreate', this.node);
|
||||
},
|
||||
treeSort() {
|
||||
this.$emit('treeSort', this.node);
|
||||
},
|
||||
convertTreeData(list) {
|
||||
const tree = [];
|
||||
if (list && list.length) {
|
||||
/* 去除列表的training节点*/
|
||||
list.forEach(elem => {
|
||||
elem.children = this.convertTreeData(elem.children);
|
||||
if (elem.type !== 'training') {
|
||||
tree.push(elem);
|
||||
}
|
||||
});
|
||||
}
|
||||
return tree;
|
||||
},
|
||||
refresh() {
|
||||
this.loading = true;
|
||||
getLessonTree().then(response => {
|
||||
this.treeData = this.convertTreeData(response.data);
|
||||
this.$nextTick(() => { this.loading = false; });
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('error.refreshFailed'));
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.el-tree-node.is-current>.el-tree-node__content {
|
||||
|
@ -31,7 +31,7 @@
|
||||
</el-scrollbar>
|
||||
</el-card>
|
||||
<div class="draft">
|
||||
<el-button type="primary" @click="goBack">{{$t('global.back')}}</el-button>
|
||||
<el-button type="primary" @click="goBack">{{ $t('global.back') }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -61,20 +61,21 @@ export default {
|
||||
let tree = [];
|
||||
if (data && list && list.length) {
|
||||
list.forEach(elem => {
|
||||
if (elem.children){
|
||||
elem.children.forEach( item => {
|
||||
if (data.id == item.id) {
|
||||
tree = [elem];
|
||||
}
|
||||
})
|
||||
}
|
||||
if (elem.children) {
|
||||
elem.children.forEach( item => {
|
||||
if (data.id == item.id) {
|
||||
tree = [elem];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
return tree;
|
||||
},
|
||||
initData(data) {
|
||||
getLessonTree({ mapId: '' }).then(response => {
|
||||
this.treeData = this.convertTreeData(response.data, data);
|
||||
getLessonTree(data.id).then(response => {
|
||||
// this.treeData = this.convertTreeData(response.data, data);
|
||||
this.treeData = response.data;
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('error.refreshFailed'));
|
||||
});
|
||||
@ -92,11 +93,11 @@ export default {
|
||||
return draggingNode && (draggingNode.data.type === 'chapter' || draggingNode.data.type === 'training');
|
||||
},
|
||||
getLeesonId(node) {
|
||||
if (node.parent.data.type === 'lesson'){
|
||||
return node.parent.data.id;
|
||||
}else {
|
||||
return this.getLeesonId(node.parent)
|
||||
}
|
||||
if (node.parent.data.type === 'lesson') {
|
||||
return node.parent.data.id;
|
||||
} else {
|
||||
return this.getLeesonId(node.parent);
|
||||
}
|
||||
},
|
||||
handleDragEnd(draggingNode, dropNode, dropType, ev) {
|
||||
if (draggingNode && dropNode && dropType !== 'none') {
|
||||
@ -116,9 +117,9 @@ export default {
|
||||
});
|
||||
}
|
||||
},
|
||||
goBack() {
|
||||
this.$router.go(-1);
|
||||
}
|
||||
goBack() {
|
||||
this.$router.go(-1);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -43,6 +43,7 @@
|
||||
<el-button type="success" @click="buy">{{ $t('teach.buy') }}</el-button>
|
||||
<el-button v-if="hasPermssion" type="primary" @click="distribute">{{ $t('teach.permissionDistribute') }}</el-button>
|
||||
<el-button v-if="hasPermssion" type="primary" @click="transfer">{{ $t('teach.authorityTransferred') }}</el-button>
|
||||
<el-button type="primary" @click="backLessonList">返回课程列表</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
@ -201,6 +202,9 @@ export default {
|
||||
}).catch(() => { });
|
||||
}
|
||||
}
|
||||
},
|
||||
backLessonList() {
|
||||
this.$router.push({ path: `${UrlConfig.trainingPlatform.teachHome}/${this.$route.params.subSystem}`});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -37,6 +37,7 @@
|
||||
<script>
|
||||
import { getSubSystemDetail } from '@/api/trainingPlatform';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
import localStore from 'storejs';
|
||||
|
||||
export default {
|
||||
name: 'TeachHome',
|
||||
|
@ -116,12 +116,12 @@ export default {
|
||||
getSubSystemInfo(obj.id).then(resp => {
|
||||
switch (resp.data.type) {
|
||||
case 'Exam':
|
||||
this.setLocalRoute(`${UrlConfig.trainingPlatform.course}/${obj.id}`);
|
||||
this.setLocalRoute(`${UrlConfig.trainingPlatform.examHome}/${obj.id}`);
|
||||
// this.$router.push({ path: `${UrlConfig.trainingPlatform.course}/${obj.id}`});
|
||||
this.$router.push({ path: `${UrlConfig.trainingPlatform.examHome}/${obj.id}`});
|
||||
break;
|
||||
case 'Lesson':
|
||||
this.setLocalRoute(`${UrlConfig.trainingPlatform.teachDetail}/${obj.id}`);
|
||||
this.setLocalRoute(`${UrlConfig.trainingPlatform.teachHome}/${obj.id}`);
|
||||
// this.$router.push({ path: `${UrlConfig.trainingPlatform.teachDetail}/${obj.id}`});
|
||||
this.$router.push({ path: `${UrlConfig.trainingPlatform.teachHome}/${obj.id}`});
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user