/
home
/
maktab
/
admin
/
js
/
File Upload :
llllll
Current File: /home/maktab/admin/js/chunk-315faf97.33293631.js
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-315faf97","chunk-05a2a881"],{"0147":function(e,t,n){},"0ae6":function(e,t,n){"use strict";n("0147")},2500:function(e,t,n){"use strict";n.r(t);var a=function(){var e=this,t=e._self._c;return t("a-spin",{attrs:{spinning:e.loading},on:{submit:e.handleSubmit}},[t("vx-card",{attrs:{title:e.id?"ویرایش تجربه":"افزودن تجربه"}},[t("a-form",{attrs:{form:e.form}},[t("div",{staticClass:"gap-5"},[t("a-form-item",{staticClass:"md:w-1/2",attrs:{label:"موضوع تجربه"}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:e.input("title"),expression:"input('title')"}],attrs:{placeholder:"موضوع"},model:{value:e.title,callback:function(t){e.title=t},expression:"title"}})],1),t("a-form-item",{staticClass:"md:col-span-2",attrs:{label:"متن تجربه"}},[t("a-textarea",{directives:[{name:"decorator",rawName:"v-decorator",value:e.input("body"),expression:"input('body')"}]})],1),t("a-form-item",{attrs:{label:"گالری تصاویر"}},[t("ImageList",{ref:"photo",staticClass:"mt-5",on:{ok:e.addId,remove:e.removeId}})],1)],1),t("a-button",{staticClass:"px-10",staticStyle:{"margin-top":"3em"},attrs:{type:"primary","html-type":"submit"}},[e._v("\n "+e._s(e.id?"ویرایش تجربه ":"ثبت تجربه ")+"\n ")])],1)],1)],1)},i=[],r=(n("ac6a"),n("20d6"),n("96cf"),n("1da1")),s=n("8143"),o=n("bb36"),c=n("df6e"),l=n("8855"),u={name:"index",components:{FileUploadInput:c["a"],ImageList:s["a"]},data:function(){return{ids:[],form:this.$form.createForm(this,{name:"coordinated"}),title:"",loading:!1,input:l["a"],pdf:void 0}},mounted:function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!this.id){e.next=5;break}return this.loading=!0,e.next=4,this.fetchInf(this.id);case 4:this.loading=!1;case 5:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),computed:{id:function(){return this.$route.params.id}},methods:{pdfUploaded:function(e){this.pdf=e},pdfRemoved:function(){this.pdf=void 0},addId:function(e){this.ids.push(e)},removeId:function(e){this.ids.splice(this.ids.findIndex((function(t){return t===e})),1)},fetchInf:function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(t){var n,a,i=this;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,o["b"].get("/api/experience/".concat(t));case 3:n=e.sent,a=n.data,console.log(a),this.form.setFieldsValue(a),this.title=a.title,this.ids=a.file.map((function(e){return e.id})),a.file.forEach((function(e){i.pushImg(e)})),e.next=16;break;case 12:e.prev=12,e.t0=e["catch"](0),console.log(e.t0),this.$message.error("خطا در دریافت اطلاعات");case 16:case"end":return e.stop()}}),e,this,[[0,12]])})));function t(t){return e.apply(this,arguments)}return t}(),pushImg:function(e){var t=e.id,n=e.title,a=e.full_src;this.$refs.photo.fileList.push({uid:t,status:"done",name:n,response:{id:t,image:a},url:a})},handleSubmit:function(e){var t=this;console.log("salam"),e.preventDefault(),this.form.validateFields(function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(n,a){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(n){e.next=39;break}if(void 0!==t.pdf&&(a.pdf=t.pdf),0!==t.ids.length&&(a.files=t.ids),!t.id){e.next=23;break}return e.prev=4,t.loading=!0,e.next=8,o["b"].put("api/experience/".concat(t.id),a);case 8:return t.$message.success("اطلاعات با موفقیت به روز رسانی شد"),e.next=11,t.$router.push({name:"experiences-list"});case 11:t.$emit("ok"),e.next=18;break;case 14:e.prev=14,e.t0=e["catch"](4),console.log(e.t0),422===e.t0.response.status?t.$message.error("شماره همراه توسط شخص دیگری در حال استفاده است"):t.$message.error("خطا در ثبت اطلاعات");case 18:return e.prev=18,t.loading=!1,e.finish(18);case 21:e.next=39;break;case 23:return e.prev=23,t.loading=!0,e.next=27,o["b"].post("api/experience",a);case 27:return t.$message.success("اطلاعات با موفقیت ثبت شد"),e.next=30,t.$router.push({name:"experiences-list"});case 30:e.next=36;break;case 32:e.prev=32,e.t1=e["catch"](23),console.log(e.t1),422===e.t1.status?t.$message.error("شماره همراه توسط شخص دیگری در حال استفاده است"):t.$message.error("خطا در ثبت اطلاعات");case 36:return e.prev=36,t.loading=!1,e.finish(36);case 39:case"end":return e.stop()}}),e,null,[[4,14,18,21],[23,32,36,39]])})));return function(t,n){return e.apply(this,arguments)}}())}}},d=u,p=n("2877"),f=Object(p["a"])(d,a,i,!1,null,"059c0442",null);t["default"]=f.exports},"3c0b":function(e,t,n){},8143:function(e,t,n){"use strict";var a=function(){var e=this,t=e._self._c;return t("div",{staticClass:"clearfix"},[t("a-upload",{attrs:{action:e.url,headers:e.headers,"list-type":"picture-card","file-list":e.fileList,data:e.getData,remove:e.handleRemove},on:{preview:e.handlePreview,change:e.handleChange}},[e.fileList.length<10?t("div",[t("a-icon",{attrs:{type:"plus"}}),t("div",{staticClass:"ant-upload-text"},[e._v("\n بارگذاری\n ")])],1):e._e()]),t("a-modal",{attrs:{visible:e.previewVisible,footer:null},on:{cancel:e.handleCancel}},[t("img",{staticStyle:{width:"100%"},attrs:{alt:"example",src:e.previewImage}})])],1)},i=[],r=(n("96cf"),n("1da1")),s=n("bb36");function o(e){return new Promise((function(t,n){var a=new FileReader;a.readAsDataURL(e),a.onload=function(){return t(a.result)},a.onerror=function(e){return n(e)}}))}var c={data:function(){return{url:"".concat(s["a"],"site/file"),previewVisible:!1,previewImage:"",fileList:[]}},computed:{headers:function(){return{Authorization:"Bearer "+localStorage.getItem("accessToken")||!1}}},methods:{handleCancel:function(){this.previewVisible=!1},handlePreview:function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t.url||t.preview){e.next=4;break}return e.next=3,o(t.originFileObj);case 3:t.preview=e.sent;case 4:this.previewImage=t.url||t.preview,this.previewVisible=!0;case 6:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}(),handleChange:function(e){var t=e.fileList,n=e.file;"done"===n.status&&n.response&&n.response.id&&this.$emit("ok",n.response.id),this.fileList=t},handleRemove:function(e){console.log("remove",e.response.id),this.$emit("remove",e.response.id)},getData:function(){return{has_thumb:1,has_watermark:0,subject:1,title:1,type:3}}}},l=c,u=(n("a741"),n("2877")),d=Object(u["a"])(l,a,i,!1,null,null,null);t["a"]=d.exports},a741:function(e,t,n){"use strict";n("3c0b")},b39c:function(e,t,n){"use strict";n.r(t);var a=function(){var e=this,t=e._self._c;return t("edit-experience")},i=[],r=n("2500"),s={name:"edit",components:{editExperience:r["default"]}},o=s,c=n("2877"),l=Object(c["a"])(o,a,i,!1,null,"0c82c174",null);t["default"]=l.exports},df6e:function(e,t,n){"use strict";var a=function(){var e=this,t=e._self._c;return t("a-upload",{attrs:{name:"file",multiple:!1,action:e.url,headers:e.headers,remove:e.handleRemove,"file-list":e.fileList,data:e.getData},on:{change:e.handleChange}},[t("a-button",{attrs:{disabled:e.uploaded}},[t("a-icon",{staticClass:"pl-2",attrs:{type:"upload"}}),e._v("\n\t\tبارگذاری فایل\n\t")],1)],1)},i=[],r=n("bb36"),s={name:"FileUploadInput",watch:{fileList:function(e){e.length>0&&(this.uploaded=!0)}},data:function(){return{uploaded:!1,fileList:[],url:"".concat(r["a"],"site/file")}},computed:{headers:function(){return{Authorization:"Bearer "+localStorage.getItem("accessToken")||!1}}},methods:{handleChange:function(e){var t=e.fileList,n=e.event,a=e.file;console.log(t),console.log(n),console.log(a),"done"===a.status&&a.response&&a.response.id&&(this.$emit("ok",a.response.id),this.uploaded=!0,this.$message.success("آپلود سند با موفقیت انجام شد")),"uploading"===a.status&&(this.uploaded=!0),"removed"===a.status&&(console.log("gggggg"),this.uploaded=!1),"error"===a.status&&this.$message.error("خطا در بارگذاری اطلاعات"),this.fileList=t},handleRemove:function(e){this.$emit("remove",e)},getData:function(){return{has_thumb:1,has_watermark:0,subject:1,title:"pdf",type:4}}}},o=s,c=(n("0ae6"),n("2877")),l=Object(c["a"])(o,a,i,!1,null,null,null);t["a"]=l.exports}}]); //# sourceMappingURL=chunk-315faf97.33293631.js.map
Copyright ©2k19 -
Hexid
|
Tex7ure