1234567891011 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/common/upload"],{635:function(e,t,n){"use strict";n.r(t);var i=n(636),r=n(638);for(var o in r)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var a,s=n(32),u=Object(s["default"])(r["default"],i["render"],i["staticRenderFns"],!1,null,null,null,!1,i["components"],a);u.options.__file="components/common/upload.vue",t["default"]=u.exports},636:function(e,t,n){"use strict";n.r(t);var i=n(637);n.d(t,"render",(function(){return i["render"]})),n.d(t,"staticRenderFns",(function(){return i["staticRenderFns"]})),n.d(t,"recyclableRender",(function(){return i["recyclableRender"]})),n.d(t,"components",(function(){return i["components"]}))},637:function(e,t,n){"use strict";var i;n.r(t),n.d(t,"render",(function(){return r})),n.d(t,"staticRenderFns",(function(){return a})),n.d(t,"recyclableRender",(function(){return o})),n.d(t,"components",(function(){return i}));try{i={uvUpload:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uv-upload/components/uv-upload/uv-upload")]).then(n.bind(null,778))}}}catch(s){if(-1===s.message.indexOf("Cannot find module")||-1===s.message.indexOf(".vue"))throw s;console.error(s.message),console.error("1. 排查组件名称拼写是否正确"),console.error("2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件")}var r=function(){var e=this,t=e.$createElement,n=(e._self._c,"insert"!==e.type?e.list.length:null);e.$mp.data=Object.assign({},{$root:{g0:n}})},o=!1,a=[];r._withStripped=!0},638:function(e,t,n){"use strict";n.r(t);var i=n(639),r=n.n(i);for(var o in i)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(o);t["default"]=r.a},639:function(e,t,n){"use strict";(function(e){var i=n(4);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(168)),o=i(n(11)),a=i(n(170)),s=i(n(46));n(640);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var l={name:"preview",props:{list:{type:Array,default:function(){return[]}},type:{type:String,default:"preview"},accept:{type:String,default:"image"}},data:function(){return{fileList:[]}},created:function(){var e=this;this.fileList=this.list.map((function(t){if(t.type)t["isImage"]=e.image(t.type.toLowerCase());else{var n=t.name.split(".");t["isImage"]=e.image(n[n.length-1].toLowerCase())}return t}))},methods:{image:function(e){return"jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg".indexOf(e)>-1},deletePic:function(t){var n=this;e.showModal({title:"有极提示",content:"是否删除该附件",success:function(e){e.confirm&&n.fileList.splice(t.index,1)}})},afterRead:function(e){var t=this;return(0,a.default)(r.default.mark((function n(){var i,o,a,s,u;return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:i=[].concat(e.file),o=t.fileList.length,i.map((function(e){t.fileList.push(c(c({},e),{},{status:"uploading",message:"上传中"}))})),a=0;case 4:if(!(a<i.length)){n.next=14;break}return n.next=7,t.uploadFilePromise(i[a].url);case 7:s=n.sent,u=t.fileList[o],t.fileList.splice(o,1,Object.assign(u,{status:"success",message:"",url:s.node.url,id:s.id,name:s.name})),o++;case 11:a++,n.next=4;break;case 14:case"end":return n.stop()}}),n)})))()},uploadFilePromise:function(t){return new Promise((function(n,i){e.uploadFile({url:s.default.baseUrl+"/file/filenode/-1",filePath:t,name:"uploadFile",success:function(e){setTimeout((function(){n(JSON.parse(e.data).data)}),1e3)}})}))},getFile:function(){return this.fileList.map((function(e){return{id:e.id,name:e.name,url:e.url,type:e.type}}))},clickFile:function(t,n,i){var r=this,o=this;return t.isImage?e.previewImage({urls:n,current:i,showmenu:!0,fail:function(){o.toast("预览图片失败")}}):t.isVideo?this.$refs.update.previewVideo(t):void e.showActionSheet({itemList:["预览","下载"],success:function(e){0===e.tapIndex?r.openFile(t):1===e.tapIndex&&r.download(t)}})},download:function(t){var n=this;e.showLoading({title:"正在下载"}),e.downloadFile({url:s.default.baseUrl+"/file/filenode/"+t.id+"/type/"+t.name,success:function(i){e.hideLoading();var r=e.getStorageSync("downliadFile")?JSON.parse(e.getStorageSync("downliadFile")):[];r.unshift({wxUrl:i.tempFilePath,userId:n.$store.getters.user.userId,type:t.type,size:i.dataLength,projectId:n.$store.getters.project.id||0,organizationId:n.$store.getters.project.id||0,fileName:t.name,date:n.$dayjs().format("YYYY-MM-DD HH:mm:ss")}),e.setStorageSync("downliadFile",JSON.stringify(r)),n.$toast("下载成功")},fail:function(t){e.hideLoading(),n.$toast("下载失败")}})},openFile:function(t){var n=this;e.showLoading({title:"正在打开"}),e.downloadFile({url:s.default.baseUrl+"/file/filenode/"+t.id+"/type/"+t.name,success:function(i){e.hideLoading(),e.openDocument({filePath:i.tempFilePath,fileType:t.type,success:function(e){},fail:function(e){n.$toast("打开失败")}})},fail:function(t){e.hideLoading(),n.$toast("打开失败")}})}}};t.default=l}).call(this,n(2)["default"])}}]);
- //# sourceMappingURL=../../../.sourcemap/mp-weixin/components/common/upload.js.map
- ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
- 'components/common/upload-create-component',
- {
- 'components/common/upload-create-component':(function(module, exports, __webpack_require__){
- __webpack_require__('2')['createComponent'](__webpack_require__(635))
- })
- },
- [['components/common/upload-create-component']]
- ]);
|