Commit 49c0c0e1 authored by wangwei's avatar wangwei

编写

parent 0443e947
......@@ -9,7 +9,6 @@ module.exports = {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
//本地代理设置
proxyTable: {
'/api': {
......
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel=stylesheet href=https://at.alicdn.com/t/font_746649_7dsnjecwkpg.css><title>singsing-new-admin</title><link href=/static/css/app.a88cda3170e79fad5b77ea9fc4558ca7.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.0856e2556bbad7b42ae6.js></script><script type=text/javascript src=/static/js/app.198829ffe3031ae877d3.js></script></body></html>
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel=stylesheet href=https://at.alicdn.com/t/font_746649_7dsnjecwkpg.css><title>singsing-new-admin</title><link href=/static/css/app.6f2621d664f9cddbf18b2ae0210d334f.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.0856e2556bbad7b42ae6.js></script><script type=text/javascript src=/static/js/app.84471d1558186ff4dc56.js></script></body></html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
{"version":3,"sources":["webpack:///webpack/bootstrap 67c52e82d92fe805ed60"],"names":["parentJsonpFunction","window","chunkIds","moreModules","executeModules","moduleId","chunkId","result","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","shift","__webpack_require__","s","installedModules","2","exports","module","l","m","c","d","name","getter","o","defineProperty","configurable","enumerable","get","n","__esModule","object","property","p","oe","err","console","error"],"mappings":"aACA,IAAAA,EAAAC,OAAA,aACAA,OAAA,sBAAAC,EAAAC,EAAAC,GAIA,IADA,IAAAC,EAAAC,EAAAC,EAAAC,EAAA,EAAAC,KACQD,EAAAN,EAAAQ,OAAoBF,IAC5BF,EAAAJ,EAAAM,GACAG,EAAAL,IACAG,EAAAG,KAAAD,EAAAL,GAAA,IAEAK,EAAAL,GAAA,EAEA,IAAAD,KAAAF,EACAU,OAAAC,UAAAC,eAAAC,KAAAb,EAAAE,KACAY,EAAAZ,GAAAF,EAAAE,IAIA,IADAL,KAAAE,EAAAC,EAAAC,GACAK,EAAAC,QACAD,EAAAS,OAAAT,GAEA,GAAAL,EACA,IAAAI,EAAA,EAAYA,EAAAJ,EAAAM,OAA2BF,IACvCD,EAAAY,IAAAC,EAAAhB,EAAAI,IAGA,OAAAD,GAIA,IAAAc,KAGAV,GACAW,EAAA,GAIA,SAAAH,EAAAd,GAGA,GAAAgB,EAAAhB,GACA,OAAAgB,EAAAhB,GAAAkB,QAGA,IAAAC,EAAAH,EAAAhB,IACAG,EAAAH,EACAoB,GAAA,EACAF,YAUA,OANAN,EAAAZ,GAAAW,KAAAQ,EAAAD,QAAAC,IAAAD,QAAAJ,GAGAK,EAAAC,GAAA,EAGAD,EAAAD,QAKAJ,EAAAO,EAAAT,EAGAE,EAAAQ,EAAAN,EAGAF,EAAAS,EAAA,SAAAL,EAAAM,EAAAC,GACAX,EAAAY,EAAAR,EAAAM,IACAhB,OAAAmB,eAAAT,EAAAM,GACAI,cAAA,EACAC,YAAA,EACAC,IAAAL,KAMAX,EAAAiB,EAAA,SAAAZ,GACA,IAAAM,EAAAN,KAAAa,WACA,WAA2B,OAAAb,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAL,EAAAS,EAAAE,EAAA,IAAAA,GACAA,GAIAX,EAAAY,EAAA,SAAAO,EAAAC,GAAsD,OAAA1B,OAAAC,UAAAC,eAAAC,KAAAsB,EAAAC,IAGtDpB,EAAAqB,EAAA,IAGArB,EAAAsB,GAAA,SAAAC,GAA8D,MAApBC,QAAAC,MAAAF,GAAoBA","file":"static/js/manifest.2ae2e69a05c33dfc65f8.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t2: 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 67c52e82d92fe805ed60"],"sourceRoot":""}
\ No newline at end of file
{"version":3,"sources":["webpack:///webpack/bootstrap c1b92cdad1648b6ae46c"],"names":["parentJsonpFunction","window","chunkIds","moreModules","executeModules","moduleId","chunkId","result","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","shift","__webpack_require__","s","installedModules","2","exports","module","l","m","c","d","name","getter","o","defineProperty","configurable","enumerable","get","n","__esModule","object","property","p","oe","err","console","error"],"mappings":"aACA,IAAAA,EAAAC,OAAA,aACAA,OAAA,sBAAAC,EAAAC,EAAAC,GAIA,IADA,IAAAC,EAAAC,EAAAC,EAAAC,EAAA,EAAAC,KACQD,EAAAN,EAAAQ,OAAoBF,IAC5BF,EAAAJ,EAAAM,GACAG,EAAAL,IACAG,EAAAG,KAAAD,EAAAL,GAAA,IAEAK,EAAAL,GAAA,EAEA,IAAAD,KAAAF,EACAU,OAAAC,UAAAC,eAAAC,KAAAb,EAAAE,KACAY,EAAAZ,GAAAF,EAAAE,IAIA,IADAL,KAAAE,EAAAC,EAAAC,GACAK,EAAAC,QACAD,EAAAS,OAAAT,GAEA,GAAAL,EACA,IAAAI,EAAA,EAAYA,EAAAJ,EAAAM,OAA2BF,IACvCD,EAAAY,IAAAC,EAAAhB,EAAAI,IAGA,OAAAD,GAIA,IAAAc,KAGAV,GACAW,EAAA,GAIA,SAAAH,EAAAd,GAGA,GAAAgB,EAAAhB,GACA,OAAAgB,EAAAhB,GAAAkB,QAGA,IAAAC,EAAAH,EAAAhB,IACAG,EAAAH,EACAoB,GAAA,EACAF,YAUA,OANAN,EAAAZ,GAAAW,KAAAQ,EAAAD,QAAAC,IAAAD,QAAAJ,GAGAK,EAAAC,GAAA,EAGAD,EAAAD,QAKAJ,EAAAO,EAAAT,EAGAE,EAAAQ,EAAAN,EAGAF,EAAAS,EAAA,SAAAL,EAAAM,EAAAC,GACAX,EAAAY,EAAAR,EAAAM,IACAhB,OAAAmB,eAAAT,EAAAM,GACAI,cAAA,EACAC,YAAA,EACAC,IAAAL,KAMAX,EAAAiB,EAAA,SAAAZ,GACA,IAAAM,EAAAN,KAAAa,WACA,WAA2B,OAAAb,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAL,EAAAS,EAAAE,EAAA,IAAAA,GACAA,GAIAX,EAAAY,EAAA,SAAAO,EAAAC,GAAsD,OAAA1B,OAAAC,UAAAC,eAAAC,KAAAsB,EAAAC,IAGtDpB,EAAAqB,EAAA,IAGArB,EAAAsB,GAAA,SAAAC,GAA8D,MAApBC,QAAAC,MAAAF,GAAoBA","file":"static/js/manifest.2ae2e69a05c33dfc65f8.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t2: 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap c1b92cdad1648b6ae46c"],"sourceRoot":""}
\ No newline at end of file
<template>
<el-dialog
:title="dialogObj.title"
:visible.sync="dialogObj.show"
>
<el-form ref="form" :model="form" label-width="120px">
<el-form-item label="老师">
<el-select v-model="form.teacher_id" placeholder="请选择">
<el-option
v-for="(data,index) in teacherList"
:key="index"
:label="data.teacher_name"
:value="data.teacher_id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="最大学员">
<el-input-number v-model="form.max_join_num"></el-input-number>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogObj.show = false">取 消</el-button>
<el-button type="primary" @click="onSave">确 定</el-button>
</span>
</el-dialog>
</template>
<script>
import {getPeriodsTeacherApi,getClassDetailApi,editClassApi,addClassApi} from "../../service/api";
export default {
props:[
'dialogObj'
],
data(){
return{
form:{
teacher_id:'',
max_join_num:''
},
teacherList:[]
}
},
methods:{
initPage(){
getPeriodsTeacherApi(this.dialogObj.periodsId).then(res=>{
this.teacherList = res
});
switch (this.dialogObj.type) {
case 0:
this.form = {
teacher_id:'',
max_join_num:''
};
break;
case 1:
getClassDetailApi(this.dialogObj.id).then(res=>{
this.form = {
teacher_id:res.teacher_id,
max_join_num:res.max_join_num
};
})
}
},
onSave(){
switch (this.dialogObj.type) {
case 0:
addClassApi(this.dialogObj.periodsId,this.form).then(res=>{
this.$message({
type: 'success',
message: '添加成功!'
});
this.$emit("reflash");
this.dialogObj.show = false;
});
break;
case 1:
editClassApi(this.dialogObj.id,this.form).then(res=>{
this.$message({
type: 'success',
message: '修改成功!'
});
this.$emit("reflash");
this.dialogObj.show = false;
})
}
}
},
watch:{
'dialogObj'(value){
this.initPage()
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
班级列表
<div class="form-block">
<el-form label-width="90px" inline>
<el-form-item label="期数">
<el-cascader
:options="goodsList"
:props="{value:'id',label:'name'}"
@active-item-change="handleItemChange"
@change="changePeriods"
>
</el-cascader>
</el-form-item>
<el-form-item label="老师">
<el-select v-model="teacher_id" placeholder="请选择">
<el-option
v-for="(data,index) in teacherList"
:key="index"
:label="data.teacher_name"
:value="data.teacher_id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="">
<el-button size="" @click="getClassList">
搜索
</el-button>
</el-form-item>
<el-form-item style="float: right">
<el-button @click="onAdd">+添加班级</el-button>
</el-form-item>
</el-form>
</div>
<div v-if="classList && classList.length > 0">
<el-form label-width="90px" inline>
<el-form-item label="期数">{{title.title}}</el-form-item>
<el-form-item label="开始时间">{{title.start_at}}</el-form-item>
<el-form-item label="结束时间">{{title.over_at}}</el-form-item>
<el-form-item label="可看课包数">{{title.watch_num }}</el-form-item>
<el-form-item label="已看课包数">{{title.has_watch_num }}</el-form-item>
</el-form>
</div>
<div>
<el-table
:data="classList"
style="width: 100%">
<el-table-column
prop="teacher_name"
label="班主任">
</el-table-column>
<el-table-column
prop="max_join_num"
label="最大人数">
</el-table-column>
<el-table-column
prop="created_at"
label="创建于">
</el-table-column>
<el-table-column
prop="join_num"
label="现有人数">
</el-table-column>
<el-table-column
width="200"
label="操作">
<template slot-scope="scope">
<el-button @click="editClass(scope.row)">编辑</el-button>
<el-button @click="delClass(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<class-dialog :dialogObj="dialogObj" @reflash="getClassList"></class-dialog>
<!--<page :total="total" v-model="nowPage"/>-->
</div>
</template>
<script>
export default {
import {getGoodsListApi,getPeriodsApi,getClassListApi,getPeriodsTeacherApi,delClassApi} from "../../service/api";
import classDialog from './dialog'
export default {
data(){
return {
periodsId:null,
goodsList:[],
teacher_id:'',
classList:[],
title:'',
teacherList:[],
dialogObj:{
show:false,
title:'添加班级',
periodsId:'',
type:0,
id:0
},
}
},
components:{
classDialog
},
mounted(){
this.initPage()
},
methods:{
initPage(){
getGoodsListApi().then(res=>{
res.list.forEach(i=>{
i.children = [];
});
this.goodsList = res.list;
if(!this.periods) {
getPeriodsApi({goods_id:this.goodsList[0].id}).then(res=>{
res.list.forEach(i=>{i.name = i.title});
this.goodsList[0].children = res.list;
this.periods = res.list[0]
})
}
if(this.periods){
getClassListApi()
}
});
},
changePeriods(data){
if(data.length>1){
let nowGoods = this.goodsList.find(i=>{return i.id === data[0]});
this.periods = nowGoods.children.find(i=>{return i.id === data[1]});
getPeriodsTeacherApi(this.periods.id).then(res=>{
this.teacherList = res
})
}
},
getClassList(){
getClassListApi(this.periods.id,{teacher_id:this.teacher_id}).then(res=>{
this.title = res.periods;
this.classList = res.list;
})
},
handleItemChange(val){
getPeriodsApi({goods_id:val[0]}).then(res=>{
res.list.forEach(i=>{i.name = i.title});
this.goodsList.find(i=>{return i.id === val[0]}).children = res.list
})
},
delClass(data){
this.$confirm('此操作将删除该班级?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delClassApi(data.id).then(res=>{
this.$message({
type: 'success',
message: '删除成功!'
});
});
this.getClassList()
});
},
onAdd(){
if(this.periods){
this.dialogObj = {
show:true,
title:'添加班级',
periodsId:this.periods.id,
type:0,
}
}else{
this.$message.error('请先选择期数');
}
},
editClass(data){
this.dialogObj = {
show:true,
title:'编辑班级',
periodsId:this.periods.id,
type:1,
id:data.id
}
}
}
}
</script>
<style scoped>
<style scoped lang="less">
.form-block{
padding: 10px;
}
</style>
......@@ -116,13 +116,19 @@
switch (this.editorObj.type) {
case 0:
addElementApi(this.form , '0').then(res=>{
this.$message({
type: 'success',
message: '添加成功!'
});
this.editorObj.show = false
});
break;
case 1:
editElementApi(this.form , this.editorObj.id).then(res=>{
this.$message({
type: 'success',
message: '修改成功!'
});
this.editorObj.show = false
});
}
......
<template>
<el-container>
<el-aside width="250px">
<el-menu
:default-active="index" v-loading="menuLoading">
<el-submenu v-for="data in leftList" :key="data.id" :index="data.name">
<template slot="title">
<span>{{data.name}}({{data.children | lengthNum}})
<div>
<el-container>
<el-aside width="250px">
<el-menu
:default-active="index" v-loading="menuLoading">
<div style="padding: 5px">
<el-button type="success" plain round size="mini" style="width: 100%" @click="addFist()">
+添加分类
</el-button>
</div>
<el-submenu v-for="data in leftList" :key="data.id" :index="data.name">
<template slot="title">
<span>
{{data.name}}({{data.children | lengthNum}})
<i class="iconfont icon-bianji" @click="editIndex(data)"></i>
<i class="iconfont icon-shanchu" @click="delIndex(data)"></i>
</span>
</template>
<el-submenu class="list2" :index="item.name" v-for="item in data.children" :key="item.id">
</template>
<el-submenu class="list2" :index="item.name" v-for="item in data.children" :key="item.id">
<span slot="title">
{{item.name}}
<div class="btn-block list2-btn">
<i class="iconfont icon-shangyi"></i>
<i class="iconfont icon-xiayi"></i>
<i class="iconfont icon-bianji"></i>
<i class="iconfont icon-shanchu"></i>
<i class="iconfont icon-shangyi" @click="upIndex(item,data.children)"></i>
<i class="iconfont icon-xiayi" @click="downIndex(item,data.children)"></i>
<i class="iconfont icon-bianji" @click="editIndex(item)"></i>
<i class="iconfont icon-shanchu" @click="delIndex(item)"></i>
</div>
</span>
<div @click="chooseId(i)" v-for="i in item.children" :key="i.name">
<el-menu-item class="list3" :index="i.name">
{{i.name}}
<div class="btn-block list3-btn">
<i class="iconfont icon-shangyi" @click="upIndex(i,item.children)"></i>
<i class="iconfont icon-xiayi" @click="downIndex(i,item.children)"></i>
<i class="iconfont icon-bianji" @click="editIndex(i,item.children)"></i>
<i class="iconfont icon-shanchu" @click="delIndex(i,item.children)"></i>
</div>
</el-menu-item>
</div>
<div @click="chooseId(i)" v-for="i in item.children" :key="i.name">
<el-menu-item class="list3" :index="i.name">
{{i.name}}
<div class="btn-block list3-btn">
<i class="iconfont icon-shangyi" @click="upIndex(i,item.children)"></i>
<i class="iconfont icon-xiayi" @click="downIndex(i,item.children)"></i>
<i class="iconfont icon-bianji" @click="editIndex(i)"></i>
<i class="iconfont icon-shanchu" @click="delIndex(i)"></i>
</div>
</el-menu-item>
</div>
</el-submenu>
<el-menu-item class="list3" index="new">
<el-button type="success" round size="mini" plain style="width: 100%" @click="addSec(data.id)">+添加</el-button>
</el-menu-item>
</el-submenu>
</el-submenu>
</el-menu>
</el-aside>
<el-main>
<that-list :id="id"></that-list>
</el-main>
</el-container>
</el-menu>
</el-aside>
<el-main>
<that-list :id="id"></that-list>
</el-main>
</el-container>
<menu-dialog :dialogObj="dialogObj" @reflash="getList"/>
</div>
</template>
<script>
import {getCategoryApi,sortCategoryApi} from "../../service/api";
import {getCategoryApi,sortCategoryApi,delCategoryApi} from "../../service/api";
import thatList from './list'
import menuDialog from './menuDialog'
export default {
data(){
return {
leftList:[],
index:'',
dialogObj:{
show:false,
type:0,
pid:0,
title:'新增一级分类',
category_id:''
},
menuLoading:false,
id:''
}
},
components:{
thatList
thatList,
menuDialog
},
filters:{
lengthNum:function (value) {
......@@ -75,6 +99,27 @@
this.$store.commit('mainCanShow');
this.menuLoading = false;
})
},
addFist(){
this.dialogObj={
show:true,
type:0,
pid:0,
title:'新增一级分类',
category_id:''
}
},
addSec(id){
this.dialogObj={
show:true,
type:0,
pid:id,
title:'新增二级分类',
category_id:''
}
},
onEdit(data){
},
upIndex(data,item){
let i = item.indexOf(data);
......@@ -104,10 +149,29 @@
}
},
editIndex(data){
alert(21)
this.dialogObj={
show:true,
type:1,
title:'编辑分类',
category_id:data.id,
that:data
}
},
delIndex(data){
alert(21)
this.$confirm('此操作将删除该分类?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delCategoryApi(data.id).then(res=>{
this.$message({
type: 'success',
message: '删除成功!'
});
});
this.getList()
});
},
chooseId(data){
this.id = data.id
......
......@@ -8,18 +8,6 @@
<img :src="data.cover">
</div>
<div class="btn">
<el-button
type=""
icon="el-icon-arrow-down"
circle size="mini"
@click="downLesson()">
</el-button>
<el-button
type=""
icon="el-icon-arrow-up"
circle size="mini"
@click="upLesson()">
</el-button>
<el-button
type=""
icon="el-icon-edit"
......@@ -30,7 +18,7 @@
type=""
icon="el-icon-delete"
circle size="mini"
@click="delLseeon()">
@click="delLseeon(data)">
</el-button>
</div>
<div class="name">
......@@ -44,7 +32,7 @@
</template>
<script>
import {getCateListApi} from "../../service/api";
import {getCateListApi,delElementApi} from "../../service/api";
import EditorDialog from './editorDialog'
export default {
name: "list",
......@@ -75,9 +63,22 @@
this.list = res.list
})
},
delLseeon(){
delLseeon(data){
this.$confirm('此操作将删除该课包?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delElementApi(data.id).then(res=>{
this.$message({
type: 'success',
message: '删除成功!'
});
});
this.getList();
});
},
onUp(){},
onAdd(){
this.editorObj = {
show:true,
......
<template>
<el-dialog :title="dialogObj.title"
:visible.sync="dialogObj.show">
<el-form label-width="80px">
<el-form-item label="名称">
<el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item label="封面">
<el-upload
class="upload-demo"
action="/api/public/upload"
:http-request="uploadFile"
list-type="picture-card"
multiple
:limit="1"
:file-list="imgList">
</el-upload>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogObj.show = false">取 消</el-button>
<el-button type="primary" @click="onSave()">确 定</el-button>
</span>
</el-dialog>
</template>
<script>
import {getCategoryApi,addCategoryApi,updateMenuApi,uploadFileApi} from "../../service/api";
export default {
name: "menuDialog",
data(){
return {
imgList:[],
form:{
name:'',
pid:'',
cover:'',
type:0
}
}
},
methods:{
initDialog(){
switch (this.dialogObj.type) {
case 0:
this.form = {
name:'',
pid:this.dialogObj.pid,
cover:'',
type:0
};
this.imgList = [];
break;
case 1:
this.form = {
name:this.dialogObj.that.name,
pid:this.dialogObj.that.pid,
cover:this.dialogObj.that.cover,
type:0
};
this.imgList[0]= {name:this.dialogObj.that.cover,url:this.dialogObj.that.cover,title:'',lable:''}
}
},
onSave(){
switch (this.dialogObj.type) {
case 0:
addCategoryApi(this.form).then(res=>{
this.$message({
type: 'success',
message: '添加成功!'
});
this.dialogObj.show = false;
this.$emit('reflash')
});
break;
case 1:
updateMenuApi(this.dialogObj.category_id,this.form).then(res=>{
this.$message({
type: 'success',
message: '修改成功!'
});
this.dialogObj.show = false;
this.$emit('reflash')
})
}
},
uploadFile(a){
this.$store.dispatch('setProgress',{type:'new',id:a.file.uid});
uploadFileApi({file:a.file,type:'local'}).then(res=>{
this.imgList[0]= {name:res.url,url:process.env.IMAGE_URL_HEAD + res.url,title:'',lable:''}
this.form.cover = this.imgList[0].url
})
}
},
props:[
'dialogObj'
],
watch:{
'dialogObj'(){
this.initDialog()
}
}
}
</script>
<style scoped>
</style>
......@@ -143,6 +143,12 @@ const getCategoryUrl = `${_baseUrl}api/admin/category/list/0`;
export const getCategoryApi = function (pid) {
return Vue.prototype.$fetch(getCategoryUrl,{'pid':pid})
};
// 添加教材菜单
const addCategoryUrl = `${_baseUrl}api/admin/category/add/0`;
export const addCategoryApi = function (json) {
return Vue.prototype.$post(addCategoryUrl,json)
};
//删除分类
const delCategoryUrl = `${_baseUrl}api/admin/category`;
export const delCategoryApi = function (id) {
......@@ -174,6 +180,11 @@ const editElementUrl = `${_baseUrl}api/admin/element/`;
export const editElementApi = function (json, id) {
return Vue.prototype.$put(`${editElementUrl}${id}`, json)
};
// 删除元素
const delElementUrl = `${_baseUrl}api/admin/element/`;
export const delElementApi = function (id) {
return Vue.prototype.$del(`${delElementUrl}${id}`)
}
// 获取单品列表
const getSingleListUrl = `${_baseUrl}api/admin/item/stock/list`;
export const getSingleListApi = function (name) {
......@@ -268,8 +279,6 @@ const getMediaListUrl = `${_baseUrl}api/admin/open/media/list`;
export const getMediaListApi = function (json) {
return Vue.prototype.$fetch(getMediaListUrl, json)
};
// 获取商品列表
// const getGoodsListUrl = `${_baseUrl}api/admin/goods/list`;
// 文件上传
const uploadFileUrl = `${_baseUrl}api/public/upload/zone`;
export const uploadFileApi = function (json) {
......@@ -347,3 +356,42 @@ const moveUrl = `${_baseUrl}api/admin/banner/sort`;
export const moveApi = function (upId, downId) {
return Vue.prototype.$patch(`${moveUrl}`, {banner_up_id: upId, banner_down_id: downId})
};
// 获取期数列表
const getPeriodsUrl = `${_baseUrl}api/admin/periods/list`;
export const getPeriodsApi = function (json) {
return Vue.prototype.$fetch(getPeriodsUrl,json)
};
// 获取班级列表
const getClassListUrl = `${_baseUrl}api/admin/periods/class/list/`;
export const getClassListApi = function (id,json) {
return Vue.prototype.$fetch(`${getClassListUrl}${id}`,json)
};
// 获取当前期数下的老师列表
const getPeriodsTeacherUrl = `${_baseUrl}api/admin/periods/teacher/list/`;
export const getPeriodsTeacherApi = function (id) {
return Vue.prototype.$fetch(`${getPeriodsTeacherUrl}${id}`)
};
// 删除班级
const delClassUrl = `${_baseUrl}api/admin/periods/class/`;
export const delClassApi = function (id) {
return Vue.prototype.$del(`${delClassUrl}${id}`)
};
// 添加班级
const addClassUrl = `${_baseUrl}api/admin/periods/class/add/`;
export const addClassApi = function (id,json) {
return Vue.prototype.$post(`${addClassUrl}${id}`,json)
};
// 修改班级
const editClassUrl = `${_baseUrl}api/admin/periods/class/info/`;
export const editClassApi = function (id,json) {
return Vue.prototype.$put(`${editClassUrl}${id}`,json)
};
// 获取班级详情
const getClassDetailUrl = `${_baseUrl}api/admin/periods/class/info/`;
export const getClassDetailApi = function (id, json) {
return Vue.prototype.$fetch(`${getClassDetailUrl}${id}`,json)
};
......@@ -28,7 +28,7 @@ export default [
list: [
{
value:'班级列表',
routerName:'resources',
routerName:'class',
path:'/class'
},
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment