1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-7af221bf"],{3191:function(t,e,o){"use strict";o.d(e,"d",(function(){return s})),o.d(e,"c",(function(){return i})),o.d(e,"a",(function(){return n})),o.d(e,"e",(function(){return r})),o.d(e,"b",(function(){return l}));var a=o("b775");function s(t){return Object(a["a"])({url:"/home/index",method:"get",params:t})}function i(t){return Object(a["a"])({url:"/home/read",method:"get",params:{id:t}})}function n(t){return Object(a["a"])({url:"/home/save",method:"post",data:t})}function r(t){return Object(a["a"])({url:"/home/update?id="+t.id,method:"post",data:t})}function l(t){return Object(a["a"])({url:"/home/delete?id="+t,method:"get"})}},47267:function(t,e,o){},"70a2":function(t,e,o){"use strict";var a=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.uploadImage}},[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.coverImg.length>1,expression:"coverImg.length>1"}],staticClass:"image-preview-wrapper"},[o("img",{attrs:{src:t.coverImg}}),o("div",{staticClass:"image-preview-action"},[o("i",{staticClass:"el-icon-delete",on:{click:t.rmImage}})])])])],1)},s=[],i=o("b775");function n(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object(i["a"])({url:"/upload/upload?uploadWx=".concat(e),method:"post",data:t})}var r={name:"SingleImageUpload3",props:{value:{type:String,default:""},wxUpload:{type:String,default:""}},data:function(){return{tempUrl:"",dataObj:{token:"",key:""},imgUrl:this.value}},computed:{coverImg:function(){return this.value}},methods:{rmImage:function(){this.emitInput("")},emitInput:function(t){this.$emit("input",t)},handleImageSuccess:function(t){this.emitInput(this.imgUrl)},beforeUpload:function(t){var e="image/jpeg"===t.type||"image/jpg",o=t.size/1024/1024<5;return e||this.$message.error("上传文件只能是图片格式!"),o||this.$message.error("上传文件大小不能超过 5MB!"),e&&o},uploadImage:function(t){var e=this;console.log(this.wxUpload),console.log(this.wxUpload.length);var o=new FormData;o.append("image",t.file),n(o,this.wxUpload.length>1).then((function(o){console.log("上传图片成功"),e.imgUrl=o.data.url,e.wxUpload.length>1&&e.$emit("wxMedia",e.wxUpload+"%llz%"+o.data.mediaId),t.onSuccess()})).catch((function(e){console.log("图片上传失败"),t.onError()}))}}},l=r,c=(o("f158"),o("2877")),u=Object(c["a"])(l,a,s,!1,null,"0c37ee6a",null);e["a"]=u.exports},"9b06":function(t,e,o){"use strict";var a=o("b5ed"),s=o.n(a);s.a},a6e1:function(t,e,o){"use strict";var a=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:{"label-position":t.labelPosition,model:t.postForm,rules:t.rules}},[o("div",{staticClass:"createPost-main-container"},[o("el-form-item",{attrs:{prop:"img_url",label:"图片"}},[o("Upload",{model:{value:t.postForm.img_url,callback:function(e){t.$set(t.postForm,"img_url",e)},expression:"postForm.img_url"}})],1),o("el-form-item",{attrs:{prop:"sort",label:"排序(倒序)"}},[o("el-input",{staticStyle:{width:"160px"},attrs:{placeholder:"",type:"number"},model:{value:t.postForm.sort,callback:function(e){t.$set(t.postForm,"sort",e)},expression:"postForm.sort"}})],1),o("el-form-item",{attrs:{prop:"status",label:"状态"}},[[o("el-radio-group",{model:{value:t.postForm.status,callback:function(e){t.$set(t.postForm,"status",e)},expression:"postForm.status"}},[o("el-radio",{attrs:{label:0}},[t._v("隐藏")]),o("el-radio",{attrs:{label:1}},[t._v("显示")])],1)]],2),o("el-form-item",{attrs:{prop:"type",label:"类型"}},[[o("el-radio-group",{model:{value:t.postForm.type,callback:function(e){t.$set(t.postForm,"type",e)},expression:"postForm.type"}},[o("el-radio",{attrs:{label:1}},[t._v("首页图片")]),o("el-radio",{attrs:{label:2}},[t._v("合作图片")]),o("el-radio",{attrs:{label:3}},[t._v("问答图片")]),o("el-radio",{attrs:{label:4}},[t._v("如何合作图片")])],1)]],2),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)},s=[],i=o("70a2"),n=o("3191"),r={status:1,img_url:"",type:1,sort:1,id:void 0},l={name:"ArticleDetail",components:{Upload:i["a"]},props:{isEdit:{type:Boolean,default:!1}},data:function(){return{postForm:Object.assign({},r),loading:!1,userListOptions:[],rules:{},tempRoute:{},labelPosition:"top"}},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(n["c"])(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;Object(n["a"])(t.postForm).then((function(e){t.$notify({title:"新增",message:"创建成功",type:"success",duration:2e3}),t.loading=!1,t.listLoading=!1,t.$router.push("/home/list")}))}))},updateArticle:function(){var t=this;console.log(this.postForm),Object(n["e"])(this.postForm).then((function(e){t.$notify({title:"修改",message:"修改成功",type:"success",duration:2e3}),t.loading=!1,t.listLoading=!1,t.$router.push("/home/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"})}}},c=l,u=(o("9b06"),o("2877")),m=Object(u["a"])(c,a,s,!1,null,"5f659a08",null);e["a"]=m.exports},b5ed:function(t,e,o){},d668:function(t,e,o){"use strict";o.r(e);var a=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("article-detail",{attrs:{"is-edit":!1}})},s=[],i=o("a6e1"),n={name:"CreateArticle",components:{ArticleDetail:i["a"]}},r=n,l=o("2877"),c=Object(l["a"])(r,a,s,!1,null,null,null);e["default"]=c.exports},f158:function(t,e,o){"use strict";var a=o("47267"),s=o.n(a);s.a}}]);
|