提交 a883b16d 编写于 作者: guangjun.yang's avatar guangjun.yang

新需求等

上级 568778d2
此差异已折叠。
......@@ -95,12 +95,12 @@
</div>
<div class="" v-if="stepNum == 2">
<div class="model-btn">
<el-button v-if="idType == 1" :disabled="conditionSelect" type="primary" size="small" @click="addModule">添加空白模块</el-button>
<el-button :disabled="conditionSelect" type="primary" size="small" @click="addFromModule" style="margin-left:0;">从预设模块添加</el-button>
<el-button v-if="idType == 1" type="primary" size="small" @click="addModule">添加空白模块</el-button>
<el-button type="primary" size="small" @click="addFromModule" style="margin-left:0;">从预设模块添加</el-button>
</div>
<div class="tab-content">
<el-tabs type="card" v-model="firstTab" :closable="!conditionSelect" @tab-remove="removeTab">
<el-tab-pane v-for="(item,index) in componentList.moduleModelList" :key="index" :label="'模块' + parseInt(index + 1)" :name='"" + parseInt(index + 1)'>
<el-tabs type="card" closable v-model="firstTab" @tab-remove="removeTab">
<el-tab-pane class="sort-tabs" v-for="(item,index) in componentList.moduleModelList" :key="index" :label="'模块' + parseInt(index + 1)" :name='"" + parseInt(index + 1)'>
<div>
<el-form ref="moduleForm" :model="item" :rules="moduleRules" label-suffix=":" label-width="130px" style="width:100%;">
<el-row>
......@@ -243,6 +243,7 @@
<!-- 课程 -->
<div v-if="item2.type == 2">
<div class="partText" v-if="index2 > 0">{{item2.introduce}}</div>
<div class="sortable-course">
<el-row v-for="(item3,index3) in item2.partContentModelList" :key="index3">
<el-col :span="10" class="item-icon">
<span class="require">*</span>
......@@ -285,6 +286,7 @@
</el-form-item>
</el-col>
</el-row>
</div>
</div>
</div>
......@@ -357,12 +359,14 @@
</div>
</template>
<script>
import BreadCrumb from '../../components/breadcrumb.vue'
import { doUpload, getFilePath } from "../../utils/qiniu-util"
import BreadCrumb from '../../components/breadcrumb.vue';
import { doUpload, getFilePath } from "../../utils/qiniu-util";
// import { validateWord150 } from "../../utils/validate.js"
import { mapGetters } from 'vuex'
import { openLoading, closeLoading, isNotEmptyUtils, isEmptyList, isNotEmptyList } from '../../utils/utils'
import * as commonUtil from '../../utils/utils'
import { mapGetters } from 'vuex';
import { openLoading, closeLoading, isNotEmptyUtils, isEmptyList, isNotEmptyList } from '../../utils/utils';
import * as commonUtil from '../../utils/utils';
import Sortable from 'sortablejs'
let vm = null
// 判断组件是否重名
let validateRepeatWord = function(rule, value, callback, message) {
......@@ -549,10 +553,64 @@ export default {
// 挂载到Dom完成时
mounted: function() {
commonUtil.resizeHeight()
console.log('idType==>',vm.idType)
// setTimeout(() => {
// this.tabDrop();
// // this.courseDrop();
// }, 10000);
},
methods: {
// 模块可以拖动排序
tabDrop() {
this.$nextTick(function() {
const ele = document.querySelector('.tab-content .el-tabs__nav');
console.log('########ele', ele);
Sortable.create(ele, {
onEnd({ newIndex, oldIndex }) {
console.log(newIndex, oldIndex);
// componentList.moduleModelList
const currRow = vm.componentList.moduleModelList.splice(oldIndex, 1)[0];
vm.componentList.moduleModelList.splice(newIndex, 0, currRow);
vm.$forceUpdate();
console.log(currRow, vm.componentList.moduleModelList);
},
// onUpdate:function(event){
//           var newIndex = event.newIndex,
//             oldIndex = event.oldIndex
//             $li = ele.children[newIndex],
//             $oldLi = ele.children[oldIndex]
//           // 先删除移动的节点
//           ele.removeChild($li) 
//           // 再插入移动的节点到原有节点,还原了移动的操作
//           if(newIndex > oldIndex) {
//             ele.insertBefore($li,$oldLi)
//           } else {
//             ele.insertBefore($li,$oldLi.nextSibling)
//           }
//           // 更新items数组
//           var item = vm.items.splice(oldIndex,1);
// vm.items.splice(newIndex,0,item[0])
//           // 下一个tick就会走patch更新
//         }
})
});
},
// 课程可以拖动排序
courseDrop() {
const ele = document.querySelector('.sortable-course');
console.log('########ele', ele);
Sortable.create(ele, {
onEnd({ newIndex, oldIndex }) {
console.log(newIndex, oldIndex);
// const currRow = vm.tagsComponent.splice(oldIndex, 1)[0]
// vm.tagsComponent.splice(newIndex, 0, currRow)
}
})
// sortable-course
},
// 根据ID查询组件基本信息
componentBasicInfo() {
if(vm.componentId) {
......@@ -614,6 +672,7 @@ export default {
},
// 暂存(下一步)
storageAndNext(flag) {
debugger
if(vm.componentId) { // 编辑
vm.submitBasicData(flag,'portal/portalComponent/updatePortalComponent')
}else{ // 新增
......@@ -677,7 +736,8 @@ export default {
if(flag == 2) {
vm.stepNum = 2
//vm.getTemplateData()
vm.getModuleData()
vm.getModuleData();
vm.tabDrop();
// vm.getTestListData()
// vm.getCourseData()
} else {
......@@ -701,7 +761,8 @@ export default {
if(flag == 2) {
vm.stepNum = 2
//vm.getTemplateData()
vm.getModuleData()
vm.getModuleData();
vm.tabDrop();
// vm.getTestListData()
// vm.getCourseData()
} else {
......@@ -851,12 +912,14 @@ export default {
return (vm.componentStatus == 3 || vm.componentStatus == 4 );
},
fieldDisabled(item){
// return vm.conditionSelect || item.moduleType == 2 || (item.id != '' && item.openFlag == 2) || vm.idType == 2 || item.statusFlag
return vm.newconditionSelect || item.moduleType == 2 || vm.idType == 2 || (vm.componentStatus != 1 && vm.componentStatus != 2 && item.statusFlag);
return false;
// return vm.conditionSelect || item.moduleType == 2 || (item.id != '' && item.openFlag == 2) || vm.idType == 2 || item.statusFlag
// return vm.newconditionSelect || item.moduleType == 2 || vm.idType == 2 || (vm.componentStatus != 1 && vm.componentStatus != 2 && item.statusFlag);
},
newfieldDisabled(item) {
return false;
//conditionAnd && item.moduleType == 1 && (item.id == '' || (item.id != '' && item.status == 1)) && idType == 1
return vm.conditionAnd && ((vm.componentStatus == 1 || vm.componentStatus == 2) || ((vm.componentStatus != 1 || vm.componentStatus != 2) && !item.statusFlag)) && item.moduleType == 1 && vm.idType == 1
// return vm.conditionAnd && ((vm.componentStatus == 1 || vm.componentStatus == 2) || ((vm.componentStatus != 1 || vm.componentStatus != 2) && !item.statusFlag)) && item.moduleType == 1 && vm.idType == 1
},
// 选择是否启用状态
selectIsOpenStatus(index) {
......@@ -1008,7 +1071,8 @@ export default {
})
}
}
vm.templetIndex ++
vm.templetIndex ++;
this.courseDrop();
},
// 删除模板
deleteTemplate(index,index1) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册