chunk-15314337.7dec095c.js 5.4 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-15314337"],{2543:function(e,t,r){"use strict";r.d(t,"f",function(){return u}),r.d(t,"g",function(){return c}),r.d(t,"d",function(){return s}),r.d(t,"h",function(){return l}),r.d(t,"e",function(){return d}),r.d(t,"a",function(){return f}),r.d(t,"b",function(){return p}),r.d(t,"c",function(){return m});var n=r("b775"),o=r("4328"),a=r.n(o),i="/api-web";function u(e){return Object(n["a"])({url:i+"/goods/queryPage",method:"get",params:e})}function c(e){return Object(n["a"])({url:i+"/goods/get/".concat(e),method:"get"})}function s(e){return Object(n["a"])({url:i+"/goods/add",method:"post",data:a.a.stringify(e)})}function l(e){return Object(n["a"])({url:i+"/goods/update",method:"post",data:a.a.stringify(e)})}function d(e){return Object(n["a"])({url:i+"/goods/del/".concat(e),method:"post"})}function f(e){return Object(n["a"])({url:i+"/category/queryPage",method:"get",params:e})}function p(e){return Object(n["a"])({url:i+"/category/upset",method:"post",data:e})}function m(e){return Object(n["a"])({url:i+"/category/del",method:"post",data:a.a.stringify(e)})}},5185:function(e,t,r){"use strict";var n=r("cb7e"),o=r.n(n);o.a},"95c6":function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"m-container"},[r("h2",[r("el-page-header",{attrs:{content:("create"==e.pageType?"添加":"修改")+e.typeChange(e.type)},on:{back:e.onCancel}})],1),e._v(" "),r("div",{staticClass:"m-core"},[r("el-form",{ref:"form",staticStyle:{width:"100%"},attrs:{model:e.form,rules:e.rules,"label-width":"120px"}},[r("el-form-item",{attrs:{label:"品牌",prop:"brand"}},[r("el-input",{model:{value:e.form.brand,callback:function(t){e.$set(e.form,"brand",t)},expression:"form.brand"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"商品名称",prop:"name"}},[r("el-input",{model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"商品图片",prop:"image"}},[r("el-upload",{staticClass:"avatar-uploader",attrs:{action:"/api-web/uploadFile",headers:e.headers,"show-file-list":!1,"on-success":e.handleAvatarSuccess,"before-upload":e.beforeAvatarUpload}},[e.form.image?r("img",{staticClass:"avatar",attrs:{src:e.form.image}}):r("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1),e._v(" "),r("el-form-item",{attrs:{label:"商品描述",prop:"desc"}},[r("quill-editor",{ref:"myQuillEditor",attrs:{options:e.editorOption},on:{blur:function(t){return e.onEditorBlur(t)},focus:function(t){return e.onEditorFocus(t)},ready:function(t){return e.onEditorReady(t)}},model:{value:e.content,callback:function(t){e.content=t},expression:"content"}})],1),e._v(" "),r("el-form-item",[r("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.onSubmit("form")}}},[e._v("立即"+e._s("create"==e.pageType?"创建":"修改"))]),e._v(" "),r("el-button",{on:{click:function(t){return e.onReSet("form")}}},[e._v("重置")])],1)],1)],1)])},o=[],a=(r("7f7f"),r("2543")),i=r("4360"),u=r("5f87"),c=(r("a753"),r("8096"),r("14e1"),r("953d")),s={components:{quillEditor:c["quillEditor"]},data:function(){return{categoryList:[],type:this.$route.query.type,pageType:this.$route.query.pageType,organId:i["a"].getters.organ,headers:{Authorization:Object(u["a"])()},content:null,editorOption:{},form:{brand:null,name:null,type:null,goodsCategoryId:null,specification:null,marketPrice:null,groupPurchasePrice:null,discountPrice:null,image:null,desc:null},rules:{brand:[{required:!0,message:"请输入品牌",trigger:"blur"},{min:3,max:30,message:"长度在 3 到 30 个字符",trigger:"blur"}]}}},mounted:function(){console.log("this is current quill instance object",this.editor)},methods:{onSubmit:function(e){console.log(this.editorContent)},messageTips:function(e,t){200==t.code?(this.$message({message:e+"成功",type:"success"}),this.$router.push({path:"/contentManager/contentManager",query:{type:this.typeIndex(this.type)}})):this.$message.error(t.msg)},onCancel:function(){this.$router.push({path:"/contentManager/contentManager",query:{type:this.typeIndex(this.type)}})},onReSet:function(e){this.$refs[e].resetFields()},getList:function(){var e=this;if("create"==this.pageType)return!1;Object(a["g"])(this.$route.query.id).then(function(t){if(200==t.code){var r=t.data;e.form={id:r.id,brand:r.brand,name:r.name,type:r.type,goodsCategoryId:r.goodsCategoryId,specification:r.specification,marketPrice:r.marketPrice,groupPurchasePrice:r.groupPurchasePrice,discountPrice:r.discountPrice,image:r.image,desc:r.desc}}})},handleAvatarSuccess:function(e,t){this.form.image=e.data.url},beforeAvatarUpload:function(e){var t={"image/png":!0,"image/jpeg":!0},r=t[e.type],n=e.size/1024/1024<2;return r||this.$message.error("只能上传图片格式!"),n||this.$message.error("上传头像图片大小不能超过 2MB!"),r&&n},typeChange:function(e){var t={1:"精彩活动",2:"热门资讯",3:"活动列表"};return t[e]},typeIndex:function(e){var t={3:0,1:1,2:2};return t[e]},onEditorBlur:function(e){console.log("editor blur!",e)},onEditorFocus:function(e){console.log("editor focus!",e)},onEditorReady:function(e){console.log("editor ready!",e)},onEditorChange:function(e){var t=e.quill,r=e.html,n=e.text;console.log("editor change!",t,r,n),this.content=r}},computed:{editor:function(){return this.$refs.myQuillEditor.quill}}},l=s,d=(r("5185"),r("2877")),f=Object(d["a"])(l,n,o,!1,null,"3c79a2a8",null);t["default"]=f.exports},cb7e:function(e,t,r){}}]);