/
home
/
maktab
/
admin
/
js
/
File Upload :
llllll
Current File: /home/maktab/admin/js/chunk-23e55498.544eff34.js
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-23e55498","chunk-34335f0a"],{"1a12":function(e,t,n){},2500:function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("a-spin",{attrs:{spinning:e.loading},on:{submit:e.handleSubmit}},[n("vx-card",{attrs:{title:e.id?"ویرایش تجربه":"افزودن تجربه"}},[n("a-form",{attrs:{form:e.form}},[n("div",{staticClass:"gap-5"},[n("a-form-item",{staticClass:"md:w-1/2",attrs:{label:"موضوع تجربه"}},[n("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),n("a-form-item",{staticClass:"md:col-span-2",attrs:{label:"متن تجربه"}},[n("a-textarea",{directives:[{name:"decorator",rawName:"v-decorator",value:e.input("body"),expression:"input('body')"}]})],1),n("a-form-item",{attrs:{label:"گالری تصاویر"}},[n("ImageList",{ref:"photo",staticClass:"mt-5",on:{ok:e.addId,remove:e.removeId}})],1)],1),n("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)},a=[],i=(n("ac6a"),n("20d6"),n("96cf"),n("1da1")),s=n("8143"),o=n("bb36"),u=n("df6e"),c=n("8855"),l={name:"index",components:{FileUploadInput:u["a"],ImageList:s["a"]},data:function(){return{ids:[],form:this.$form.createForm(this,{name:"coordinated"}),title:"",loading:!1,input:c["a"],pdf:void 0}},mounted:function(){var e=Object(i["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(i["a"])(regeneratorRuntime.mark((function e(t){var n,r,a=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,r=n.data,console.log(r),this.form.setFieldsValue(r),this.title=r.title,this.ids=r.file.map((function(e){return e.id})),r.file.forEach((function(e){a.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,r=e.full_src;this.$refs.photo.fileList.push({uid:t,status:"done",name:n,response:{id:t,image:r},url:r})},handleSubmit:function(e){var t=this;console.log("salam"),e.preventDefault(),this.form.validateFields(function(){var e=Object(i["a"])(regeneratorRuntime.mark((function e(n,r){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&&(r.pdf=t.pdf),0!==t.ids.length&&(r.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),r);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",r);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=l,p=n("2877"),f=Object(p["a"])(d,r,a,!1,null,"059c0442",null);t["default"]=f.exports},"3fab":function(e,t,n){},8143:function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"clearfix"},[n("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?n("div",[n("a-icon",{attrs:{type:"plus"}}),n("div",{staticClass:"ant-upload-text"},[e._v("\n بارگذاری\n ")])],1):e._e()]),n("a-modal",{attrs:{visible:e.previewVisible,footer:null},on:{cancel:e.handleCancel}},[n("img",{staticStyle:{width:"100%"},attrs:{alt:"example",src:e.previewImage}})])],1)},a=[],i=(n("96cf"),n("1da1")),s=n("bb36");function o(e){return new Promise((function(t,n){var r=new FileReader;r.readAsDataURL(e),r.onload=function(){return t(r.result)},r.onerror=function(e){return n(e)}}))}var u={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(i["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}}}},c=u,l=(n("cdc1"),n("2877")),d=Object(l["a"])(c,r,a,!1,null,null,null);t["a"]=d.exports},8855:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return i})),n.d(t,"c",(function(){return s})),n.d(t,"d",(function(){return o}));var r=n("2b0e");function a(e,t){return[e,{rules:[{required:void 0===t||t,message:"لطفا مقدار را وارد کنید"},{pattern:/^([\u0600-\u06FF\uFB8A\u067E\u0686\u06AF\u200C ])+$/,message:" مقدار وارد شده باید فارسی باشد "}]}]}function i(e,t){return[e,{rules:[{required:void 0===t||t,message:"لطفا مقدار را وارد کنید"}]}]}function s(e,t){var n;return n=t||!1,[e,{initialValue:!1,valuePropName:"checked",rules:[{required:n}]}]}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"nav.header-navbar.navbar.navbar-shadow",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,r=document.querySelector(t),a=63+n;r&&(a=r.getBoundingClientRect().height+n);var i=document.getElementById(e);i&&window.scrollTo({top:i.getBoundingClientRect().top-a,left:0,behavior:"smooth"})}r["default"].prototype.$myrules="salam"},b39c:function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("edit-experience")},a=[],i=n("2500"),s={name:"edit",components:{editExperience:i["default"]}},o=s,u=n("2877"),c=Object(u["a"])(o,r,a,!1,null,"0c82c174",null);t["default"]=c.exports},bd3f:function(e,t,n){"use strict";n("1a12")},cdc1:function(e,t,n){"use strict";n("3fab")},df6e:function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("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}},[n("a-button",{attrs:{disabled:e.uploaded}},[n("a-icon",{staticClass:"pl-2",attrs:{type:"upload"}}),e._v("\n\t\tبارگذاری فایل\n\t")],1)],1)},a=[],i=n("bb36"),s={name:"FileUploadInput",watch:{fileList:function(e){e.length>0&&(this.uploaded=!0)}},data:function(){return{uploaded:!1,fileList:[],url:"".concat(i["a"],"site/file")}},computed:{headers:function(){return{Authorization:"Bearer "+localStorage.getItem("accessToken")||!1}}},methods:{handleChange:function(e){var t=e.fileList,n=e.event,r=e.file;console.log(t),console.log(n),console.log(r),"done"===r.status&&r.response&&r.response.id&&(this.$emit("ok",r.response.id),this.uploaded=!0,this.$message.success("آپلود سند با موفقیت انجام شد")),"uploading"===r.status&&(this.uploaded=!0),"removed"===r.status&&(console.log("gggggg"),this.uploaded=!1),"error"===r.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,u=(n("bd3f"),n("2877")),c=Object(u["a"])(o,r,a,!1,null,null,null);t["a"]=c.exports}}]); //# sourceMappingURL=chunk-23e55498.544eff34.js.map
Copyright ©2k19 -
Hexid
|
Tex7ure