调整代码

This commit is contained in:
fan 2019-10-22 14:28:22 +08:00
parent 6d665acbb5
commit a49b195090
8 changed files with 244 additions and 189 deletions

View File

@ -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;

View File

@ -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}`});
}
}
};

View File

@ -1,5 +1,18 @@
<template>
<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>
@ -7,6 +20,7 @@
</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>

View File

@ -1,36 +1,55 @@
<template>
<el-card class="map-list-main" v-loading="loading">
<el-card v-loading="loading" class="map-list-main">
<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>
<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 :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>
<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>&nbsp;{{ 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>
<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 {
export default {
name: 'TrainingOperate',
components: {
TreeOperateMenu,
TreeOperateMenu
},
props: {
height: {
@ -53,7 +72,7 @@
x: 0,
y: 0
}
}
};
},
watch: {
filterText(val) {
@ -80,9 +99,9 @@
},
handleDragEnd(draggingNode, dropNode, dropType, ev) {
if (draggingNode && dropNode && dropType !== 'none') {
let lesson = this.getLeesonId(dropNode);
let lessonId = lesson.data.id;
let model = {
const lesson = this.getLeesonId(dropNode);
const lessonId = lesson.data.id;
const model = {
location: dropType,
sourceId: draggingNode.data.id,
sourceType: draggingNode.data.type,
@ -90,14 +109,13 @@
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) {
if (node.parent.parent !== null) {
return this.getLeesonId(node.parent);
} else {
return node;
@ -109,10 +127,10 @@
this.point = {
x: e.clientX,
y: e.clientY
}
};
this.node = node;
this.selected = obj;
let menu = DeviceMenu.Lesson;
const menu = DeviceMenu.Lesson;
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
}
},
@ -139,15 +157,15 @@
this.$emit('treeSort', this.node);
},
convertTreeData(list) {
let tree = [];
const tree = [];
if (list && list.length) {
/*去除列表的training节点*/
/* 去除列表的training节点*/
list.forEach(elem => {
elem.children = this.convertTreeData(elem.children);
if (elem.type !== 'training') {
tree.push(elem);
}
})
});
}
return tree;
},
@ -156,13 +174,13 @@
getLessonTree().then(response => {
this.treeData = this.convertTreeData(response.data);
this.$nextTick(() => { this.loading = false; });
}).catch(error => {
}).catch(() => {
this.$messageBox(this.$t('error.refreshFailed'));
this.loading = false;
});
}
}
}
};
</script>
<style>
.el-tree-node.is-current>.el-tree-node__content {

View File

@ -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){
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,10 +93,10 @@ export default {
return draggingNode && (draggingNode.data.type === 'chapter' || draggingNode.data.type === 'training');
},
getLeesonId(node) {
if (node.parent.data.type === 'lesson'){
if (node.parent.data.type === 'lesson') {
return node.parent.data.id;
}else {
return this.getLeesonId(node.parent)
} else {
return this.getLeesonId(node.parent);
}
},
handleDragEnd(draggingNode, dropNode, dropType, ev) {

View File

@ -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}`});
}
}
};

View File

@ -37,6 +37,7 @@
<script>
import { getSubSystemDetail } from '@/api/trainingPlatform';
import { UrlConfig } from '@/router/index';
import localStore from 'storejs';
export default {
name: 'TeachHome',

View File

@ -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;