text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-f3441414"],{1256:function(e,t,a){"use strict";var r=a("2830"),s=a.n(r);s.a},2830:function(e,t,a){},3021:function(e,t,a){"use strict";a.r(t);var r=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{attrs:{id:"course-details"}},[e._m(0),e._v(" "),a("el-form",{ref:"form",attrs:{model:e.courseData,"label-width":"100px",size:"medium"}},[a("el-form-item",{attrs:{label:"课程名称"}},[a("el-input",{model:{value:e.courseData.name,callback:function(t){e.$set(e.courseData,"name",t)},expression:"courseData.name"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"课程价格"}},[a("el-input",{model:{value:e.courseData.price,callback:function(t){e.$set(e.courseData,"price",t)},expression:"courseData.price"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"课程级别"}},[a("el-select",{attrs:{placeholder:"请选择课程级别"},model:{value:e.courseData.level,callback:function(t){e.$set(e.courseData,"level",t)},expression:"courseData.level"}},e._l(e.courseLevel,function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.level}})}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"选择教师"}},[a("el-select",{attrs:{placeholder:"请选择授课教师"},model:{value:e.courseData.teaId,callback:function(t){e.$set(e.courseData,"teaId",t)},expression:"courseData.teaId"}},e._l(e.teacherList,function(e,t){return a("el-option",{key:t,attrs:{label:e.nickName,value:e.teaId}})}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"课程简介"}},[a("el-input",{attrs:{type:"textarea"},model:{value:e.courseData.intro,callback:function(t){e.$set(e.courseData,"intro",t)},expression:"courseData.intro"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"课程描述"}},[a("el-input",{attrs:{type:"textarea"},model:{value:e.courseData.desc,callback:function(t){e.$set(e.courseData,"desc",t)},expression:"courseData.desc"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"课程图片"}},[a("el-upload",{staticClass:"upload-demo",attrs:{action:e.uploadUrl,name:"imgFile","on-success":e.upImgSuccess,multiple:""}},[a("el-button",{attrs:{size:"small",type:"primary"}},[e._v("点击上传")]),e._v(" "),e.courseData.img_url?a("img",{staticClass:"course-img",attrs:{src:e.baseUrl+e.courseData.img_url,alt:""}}):e._e()],1)],1),e._v(" "),a("el-form-item",{attrs:{label:"关联path"}},[a("el-select",{attrs:{placeholder:"请选择活动区域"},model:{value:e.courseData.markId,callback:function(t){e.$set(e.courseData,"markId",t)},expression:"courseData.markId"}},e._l(e.pathArr,function(e,t){return a("el-option",{key:t,attrs:{value:e.pathId,label:e.pathName}})}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"关联标签"}},[a("el-select",{model:{value:e.courseData.pathId,callback:function(t){e.$set(e.courseData,"pathId",t)},expression:"courseData.pathId"}},e._l(e.tagList,function(e,t){return a("el-option",{key:t,attrs:{value:e.id,label:e.title}})}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"添加课程资料"}},[a("el-switch",{model:{value:e.metrial,callback:function(t){e.metrial=t},expression:"metrial"}})],1),e._v(" "),e.metrial?a("el-form-item",{attrs:{label:"资料名称"}},[a("el-input",{model:{value:e.courseData.metrial_name,callback:function(t){e.$set(e.courseData,"metrial_name",t)},expression:"courseData.metrial_name"}})],1):e._e(),e._v(" "),e.metrial?a("el-form-item",{attrs:{label:"资料地址"}},[a("el-input",{model:{value:e.courseData.metrial_url,callback:function(t){e.$set(e.courseData,"metrial_url",t)},expression:"courseData.metrial_url"}})],1):e._e()],1),e._v(" "),a("el-form",{attrs:{"label-width":"100px",size:"medium"}},[a("el-form-item",[-1==e.id?a("el-button",{attrs:{type:"primary"},on:{click:e.onSubmit}},[e._v("创建")]):a("el-button",{attrs:{type:"primary"},on:{click:e.onUpdate}},[e._v("更新")]),e._v(" "),a("el-button",{on:{click:e.onCancel}},[e._v("取消")])],1)],1)],1)},s=[function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{attrs:{id:"course-header"}},[a("h4",{staticClass:"clearfix"},[e._v("\n      基本课程信息\n      ")])])}],o=(a("7364"),a("52c1"),a("96bb")),u=a("a935"),c=a("b775");function l(e){return Object(c["a"])({url:BASE_API+"course/add",method:"post",data:e})}function i(e){return Object(c["a"])({url:BASE_API+"course/updateCourse",method:"post",data:e})}var n=a("d28d"),m={data:function(){return{uploadUrl:BASE_API+"path/addImg",baseUrl:CDN_URL,id:this.$route.params.id,fileList:[],pathArr:[],metrial:!1,teacherList:[],courseLevel:[{name:"初级",level:1},{name:"中级",level:2},{name:"高级",level:3}],courseData:{name:"",price:"",level:"",intro:"",desc:"",img_url:"",pathId:"",metrial_name:"",metrial_url:"",teacherid:"",courseId:"",markId:""},tagList:[]}},methods:{upImgSuccess:function(e){console.log(e),this.courseData.img_url=e.data.relativePath},goChapter:function(){this.$router.push("/course/chapter")},onSubmit:function(){var e=this;console.log("submit!");var t={title:this.courseData.name,courseImage:this.courseData.img_url,pathId:this.courseData.pathId,describe:this.courseData.desc,price:this.courseData.price,duration:this.courseData.duration,preCourseIntro:this.courseData.intro,courseUrl:this.courseData.courseUrl,resId:this.courseData.metrial_url,resName:this.courseData.metrial_name,teaId:this.courseData.teaId,level:this.courseData.level,markId:this.courseData.markId};l(t).then(function(t){console.log(t),1*t.errno===101?(e.$message({message:"创建成功",type:"success"}),e.$router.push("/course/list")):e.$message.error(t.errmsg)})},onUpdate:function(){var e=this,t={title:this.courseData.name,courseImage:this.courseData.img_url,pathId:this.courseData.pathId,describe:this.courseData.desc,price:this.courseData.price,duration:this.courseData.duration,preCourseIntro:this.courseData.intro,courseUrl:this.courseData.courseUrl,resId:this.courseData.metrial_url,resName:this.courseData.metrial_name,courseId:this.id,teaId:this.courseData.teaId,level:this.courseData.level,markId:this.courseData.markId};i(t).then(function(t){console.log(t),1*t.errno===101?(e.$message({message:"更新成功",type:"success"}),e.$router.push("/course/list")):e.$message.error(t.errmsg)})},onCancel:function(){this.$router.push("/course/list")},getImg:function(e){console.log(e);e.target.files[0]},handlePreview:function(){},handleRemove:function(){},beforeRemove:function(){},handleExceed:function(){},pathData:function(){var e=this;Object(o["a"])().then(function(t){console.log(t),console.log(t.data.pathList),e.pathArr=t.data.pathList,e.teacherList=t.data.teacherList})},updateData:function(){var e=this,t={courseId:this.$route.params.id};Object(u["a"])(t).then(function(t){e.courseData.name=t.data.course.title,e.courseData.price=t.data.course.price,e.courseData.level=t.data.course.level,e.courseData.intro=t.data.course.preCourseIntro,e.courseData.desc=t.data.course.describe,e.courseData.metrial_name=t.data.course.resName,e.courseData.metrial_url=t.data.course.resId,e.courseData.teaId=t.data.course.teacher.teaId,e.courseData.pathId=t.data.course.pathId,e.courseData.img_url=t.data.course.image})},getDetails:function(){},getTagList:function(e){var t=this;this.listLoading=!0,Object(n["d"])().then(function(e){1*e.errno===101?(t.listLoading=!1,t.tagList=e.data):t.$message.error(e.errmsg)})}},created:function(){this.id,1*this.id!==-1&&this.updateData(),this.getTagList(),this.pathData()}},d=m,p=(a("1256"),a("6691")),h=Object(p["a"])(d,r,s,!1,null,"00cc886e",null);t["default"]=h.exports},"96bb":function(e,t,a){"use strict";a.d(t,"a",function(){return s});var r=a("b775");function s(e){return Object(r["a"])({url:BASE_API+"course/addUI",method:"get",params:e})}},a935:function(e,t,a){"use strict";a.d(t,"a",function(){return s});var r=a("b775");function s(e){return Object(r["a"])({url:BASE_API+"course/updateUI",method:"post",data:e})}},d28d:function(e,t,a){"use strict";a.d(t,"a",function(){return s}),a.d(t,"b",function(){return o}),a.d(t,"e",function(){return u}),a.d(t,"c",function(){return c}),a.d(t,"d",function(){return l});var r=a("b775");function s(e){return Object(r["a"])({url:BASE_API+"mark/add",method:"post",params:e})}function o(e){return Object(r["a"])({url:BASE_API+"mark/delete",method:"post",params:e})}function u(e){return Object(r["a"])({url:BASE_API+"mark/update",method:"post",params:e})}function c(e){return Object(r["a"])({url:BASE_API+"mark/getMarkById",method:"post",params:e})}function l(e){return Object(r["a"])({url:BASE_API+"mark/getMarkList",method:"get",params:e})}}}]);