1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-1e88a026"],{"093a":function(t,e,o){"use strict";o.d(e,"c",(function(){return a})),o.d(e,"d",(function(){return n})),o.d(e,"a",(function(){return s})),o.d(e,"e",(function(){return r})),o.d(e,"b",(function(){return c}));var i=o("b775");function a(t){return Object(i["a"])({url:"/video/index",method:"get",params:t})}function n(t){return Object(i["a"])({url:"/video/read",method:"get",params:{id:t}})}function s(t){return Object(i["a"])({url:"/video/save",method:"post",data:t})}function r(t){return Object(i["a"])({url:"/video/update?id="+t.id,method:"post",data:t})}function c(t){return Object(i["a"])({url:"/video/delete?id="+t,method:"get"})}},"12ef":function(t,e,o){"use strict";var i=o("6186"),a=o.n(i);a.a},3123:function(t,e,o){"use strict";o.d(e,"a",(function(){return a})),o.d(e,"b",(function(){return n}));var i=o("b775");function a(t){return Object(i["a"])({url:"/upload/upload",method:"post",data:t})}function n(t){return Object(i["a"])({url:"/upload/uploadVideo",method:"post",data:t})}},6186:function(t,e,o){},"7bb9":function(t,e,o){"use strict";o.r(e);var i=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("article-detail",{attrs:{"is-edit":!0}})},a=[],n=o("be67"),s={name:"EditForm",components:{ArticleDetail:n["a"]}},r=s,c=o("2877"),l=Object(c["a"])(r,i,a,!1,null,null,null);e["default"]=l.exports},"828d":function(t,e,o){"use strict";o.d(e,"a",(function(){return a}));var i=o("b775");function a(t){return Object(i["a"])({url:"/vue-element-admin/search/user",method:"get",params:{name:t}})}},a9e3:function(t,e,o){"use strict";var i=o("83ab"),a=o("da84"),n=o("94ca"),s=o("6eeb"),r=o("5135"),c=o("c6b6"),l=o("7156"),u=o("c04e"),d=o("d039"),m=o("7c73"),p=o("241c").f,f=o("06cf").f,h=o("9bf2").f,g=o("58a8").trim,v="Number",b=a[v],_=b.prototype,F=c(m(_))==v,w=function(t){var e,o,i,a,n,s,r,c,l=u(t,!1);if("string"==typeof l&&l.length>2)if(l=g(l),e=l.charCodeAt(0),43===e||45===e){if(o=l.charCodeAt(2),88===o||120===o)return NaN}else if(48===e){switch(l.charCodeAt(1)){case 66:case 98:i=2,a=49;break;case 79:case 111:i=8,a=55;break;default:return+l}for(n=l.slice(2),s=n.length,r=0;r<s;r++)if(c=n.charCodeAt(r),c<48||c>a)return NaN;return parseInt(n,i)}return+l};if(n(v,!b(" 0o1")||!b("0b1")||b("+0x1"))){for(var y,I=function(t){var e=arguments.length<1?0:t,o=this;return o instanceof I&&(F?d((function(){_.valueOf.call(o)})):c(o)!=v)?l(new b(w(e)),o,I):w(e)},O=i?p(b):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),x=0;O.length>x;x++)r(b,y=O[x])&&!r(I,y)&&h(I,y,f(b,y));I.prototype=_,_.constructor=I,s(a,v,I)}},be67:function(t,e,o){"use strict";var i=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"createPost-container"},[o("el-form",{ref:"postForm",staticClass:"form-container",attrs:{model:t.postForm,rules:t.rules}},[o("div",{staticClass:"createPost-main-container"},[o("el-row",[o("el-col",{attrs:{span:24}},[o("el-form-item",{staticStyle:{"margin-bottom":"40px"},attrs:{prop:"title"}},[o("MDinput",{attrs:{maxlength:50,name:"name",required:""},model:{value:t.postForm.title,callback:function(e){t.$set(t.postForm,"title",e)},expression:"postForm.title"}},[t._v(" 短视频标题 ")])],1)],1)],1),o("el-row",[o("div",{staticStyle:{"margin-bottom":"10px"}},[t._v("短视频描述")]),o("el-form-item",{attrs:{label:"",prop:"desc"}},[o("el-input",{attrs:{type:"textarea"},model:{value:t.postForm.desc,callback:function(e){t.$set(t.postForm,"desc",e)},expression:"postForm.desc"}})],1)],1),o("el-row",[o("div",{staticStyle:{"margin-bottom":"10px"}},[t._v("封面图")]),o("el-form-item",{staticStyle:{"margin-bottom":"30px"},attrs:{prop:"cover_img"}},[o("Upload",{model:{value:t.postForm.cover_img,callback:function(e){t.$set(t.postForm,"cover_img",e)},expression:"postForm.cover_img"}})],1)],1),o("el-row",[o("div",{staticStyle:{"margin-bottom":"10px"}},[t._v("短视频")]),o("el-form-item",{attrs:{prop:"video_url"}},[o("VideoUpload",{model:{value:t.postForm.video_url,callback:function(e){t.$set(t.postForm,"video_url",e)},expression:"postForm.video_url"}})],1)],1),o("el-row",[t.isEdit?t._e():o("el-button",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],attrs:{type:"success"},on:{click:t.submitForm}},[t._v(" 提交 ")]),t.isEdit?o("el-button",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],attrs:{type:"success"},on:{click:t.updateArticle}},[t._v(" 修改 ")]):t._e()],1)],1)])],1)},a=[],n=(o("d81d"),o("b0c0"),o("70a2")),s=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"upload-container"},[o("el-upload",{staticClass:"image-uploader",attrs:{data:t.dataObj,multiple:!1,"show-file-list":!1,"on-success":t.handleImageSuccess,drag:"",action:"#","http-request":t.uploadVideoHandle}},[o("i",{staticClass:"el-icon-upload"}),o("div",{staticClass:"el-upload__text"},[t._v(" 将文件拖到此处,或"),o("em",[t._v("点击上传")])])]),o("div",{staticClass:"image-preview"},[o("div",{directives:[{name:"show",rawName:"v-show",value:t.imageUrl.length>1,expression:"imageUrl.length>1"}],staticClass:"image-preview-wrapper",staticStyle:{"line-height":"0"}},[o("video",{staticStyle:{width:"375px"},attrs:{src:t.imageUrl,controls:""}})])]),o("i",{directives:[{name:"show",rawName:"v-show",value:t.imageUrl.length>1,expression:"imageUrl.length>1"}],staticClass:"el-icon-delete",staticStyle:{"font-size":"36px",margin:"0 10px"},on:{click:t.rmImage}})],1)},r=[],c=o("3123"),l={name:"SingleVideoUpload",props:{value:{type:String,default:""}},data:function(){return{tempUrl:"",dataObj:{token:"",key:""}}},computed:{imageUrl:function(){return this.value}},methods:{rmImage:function(){this.emitInput("")},emitInput:function(t){this.$emit("input",t)},handleImageSuccess:function(){this.emitInput(this.imgUrl)},beforeUpload:function(){},uploadVideoHandle:function(t){var e=this,o=new FormData;o.append("file",t.file),Object(c["b"])(o).then((function(o){console.log("上传视频成功"),e.imgUrl=o.data.url,t.onSuccess()})).catch((function(e){console.log("视频上传失败"),t.onError()}))}}},u=l,d=(o("12ef"),o("2877")),m=Object(d["a"])(u,s,r,!1,null,"72c3534b",null),p=m.exports,f=o("1aba"),h=o("093a"),g=o("828d"),v={status:"draft",title:"",content:"",desc:"",video_url:"",cover_img:"",display_time:void 0,id:void 0,platforms:["a-platform"],comment_disabled:!1,importance:0},b={name:"ArticleDetail",components:{MDinput:f["a"],Upload:n["a"],VideoUpload:p},props:{isEdit:{type:Boolean,default:!1}},data:function(){var t=function(t,e,o){console.log(t),""===e?o(new Error(t.field+"为必传项")):o()};return{postForm:Object.assign({},v),loading:!1,userListOptions:[],rules:{cover_img:[{message:"封面图不为空",validator:t}],title:[{message:"标题不为空",validator:t}],desc:[{message:"描述不为空",validator:t}],video_url:[{message:"短视频不为空",validator:t}]},tempRoute:{}}},computed:{contentShortLength:function(){return this.postForm.content_short.length},displayTime:{get:function(){return+new Date(this.postForm.display_time)},set:function(t){this.postForm.display_time=new Date(t)}}},created:function(){if(this.isEdit){var t=this.$route.params&&this.$route.params.id;this.fetchData(t)}this.tempRoute=Object.assign({},this.$route)},methods:{fetchData:function(t){var e=this;Object(h["d"])(t).then((function(t){e.postForm=t.data.info})).catch((function(t){console.log(t)}))},setPageTitle:function(){var t="Edit Article";document.title="".concat(t," - ").concat(this.postForm.id)},submitForm:function(){var t=this;this.$refs.postForm.validate((function(e){if(!e)return console.log("error submit!!"),!1;t.loading=!0,console.log(t.postForm),Object(h["a"])(t.postForm).then((function(e){t.$notify({title:"成功",message:"发布短视频成功",type:"success",duration:2e3}),t.postForm.status="published",t.loading=!1,t.listLoading=!1,t.$router.push("/video/list")}))}))},updateArticle:function(){var t=this;console.log(this.postForm),Object(h["e"])(this.postForm).then((function(e){t.$notify({title:"修改",message:"修改短视频成功",type:"success",duration:2e3}),t.postForm.status="published",t.loading=!1,t.listLoading=!1,t.$router.push("/video/list")}))},draftForm:function(){0!==this.postForm.content.length&&0!==this.postForm.title.length?(this.$message({message:"保存成功",type:"success",showClose:!0,duration:1e3}),this.postForm.status="draft"):this.$message({message:"请填写必要的标题和内容",type:"warning"})},getRemoteUserList:function(t){var e=this;Object(g["a"])(t).then((function(t){t.data.items&&(e.userListOptions=t.data.items.map((function(t){return t.name})))}))}}},_=b,F=(o("cb81"),Object(d["a"])(_,i,a,!1,null,"1fce8187",null));e["a"]=F.exports},cb81:function(t,e,o){"use strict";var i=o("daa0"),a=o.n(i);a.a},daa0:function(t,e,o){}}]);
|