12345678910 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/DragImage/DragImage"],{"0ea8":function(t,e,i){"use strict";i.r(e);var n=i("b514"),a=i("9542");for(var s in a)"default"!==s&&function(t){i.d(e,t,(function(){return a[t]}))}(s);i("a51b");var o,r=i("f0c5"),h=Object(r["a"])(a["default"],n["b"],n["c"],!1,null,"e876b32a",null,!1,n["a"],o);e["default"]=h.exports},"7e25":function(t,e,i){"use strict";(function(t){function i(t,e){var i;if("undefined"===typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(i=n(t))||e&&t&&"number"===typeof t.length){i&&(t=i);var a=0,s=function(){};return{s:s,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,r=!0,h=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return r=t.done,t},e:function(t){h=!0,o=t},f:function(){try{r||null==i.return||i.return()}finally{if(h)throw o}}}}function n(t,e){if(t){if("string"===typeof t)return a(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var s={data:function(){return{assetsUrl:this.$util.assetsUrl,imageList:[],width:0,add:{x:0,y:0},colsValue:0,viewWidth:0,tempItem:null,timer:null,changeStatus:!0,preStatus:!0}},props:{list:{type:Array,default:function(){return[]}},number:{type:Number,default:6},imageWidth:{type:Number,default:230},cols:{type:Number,default:0},padding:{type:Number,default:10},scale:{type:Number,default:1.1},opacity:{type:Number,default:.7},custom:{type:Boolean,default:!1},chooseImage:{type:Boolean,default:!1}},watch:{list:function(t,e){this.init()}},computed:{areaHeight:function(){return this.imageList.length<this.number?Math.ceil((this.imageList.length+1)/this.colsValue)*this.viewWidth+"px":Math.ceil(this.imageList.length/this.colsValue)*this.viewWidth+"px"},childWidth:function(){return this.viewWidth-2*this.rpx2px(this.padding)+"px"}},created:function(){this.width=t.getSystemInfoSync().windowWidth,this.viewWidth=this.rpx2px(this.imageWidth)},mounted:function(){this.init()},methods:{init:function(){var e=this,n=t.createSelectorQuery().in(this);n.select(".area").boundingClientRect((function(t){e.colsValue=Math.floor(t.width/e.viewWidth),e.cols>0&&(e.colsValue=e.cols,e.viewWidth=t.width/e.cols),e.imageList=[];var n,a=i(e.list);try{for(a.s();!(n=a.n()).done;){var s=n.value;e.addProperties(s)}}catch(o){a.e(o)}finally{a.f()}})),n.exec()},onChange:function(t,e){var n=this;if(e&&(e.oldX=t.detail.x,e.oldY=t.detail.y,"touch"===t.detail.source)){e.moveEnd&&(e.offset=Math.sqrt(Math.pow(e.oldX-e.absX*this.viewWidth,2)+Math.pow(e.oldY-e.absY*this.viewWidth,2)));var a=Math.floor((t.detail.x+this.viewWidth/2)/this.viewWidth);if(a>=this.colsValue)return;var s=Math.floor((t.detail.y+this.viewWidth/2)/this.viewWidth),o=this.colsValue*s+a;if(e.index!=o&&o<this.imageList.length){this.changeStatus=!1;var r,h=i(this.imageList);try{var u=function(){var t=r.value;e.index>o&&t.index>=o&&t.index<e.index?n.change(t,1):e.index<o&&t.index<=o&&t.index>e.index?n.change(t,-1):t.id!=e.id&&(t.offset=0,t.x=t.oldX,t.y=t.oldY,setTimeout((function(){n.$nextTick((function(){t.x=t.absX*n.viewWidth,t.y=t.absY*n.viewWidth}))}),0))};for(h.s();!(r=h.n()).done;)u()}catch(l){h.e(l)}finally{h.f()}e.index=o,e.absX=a,e.absY=s}}},change:function(t,e){var i=this;t.index+=e,t.offset=0,t.x=t.oldX,t.y=t.oldY,t.absX=t.index%this.colsValue,t.absY=Math.floor(t.index/this.colsValue),setTimeout((function(){i.$nextTick((function(){t.x=t.absX*i.viewWidth,t.y=t.absY*i.viewWidth}))}),0)},touchstart:function(e){var i=this;t.vibrateShort(),e.disable=!1,this.imageList.forEach((function(t){t.zIndex=t.index+9})),e.zIndex=99,e.moveEnd=!0,this.tempItem=e,this.timer=setTimeout((function(){e.scale=i.scale,e.opacity=i.opacity,clearTimeout(i.timer),i.timer=null}),200)},touchend:function(t){var e=this;this.previewImage(t),t.scale=1,t.opacity=1,t.x=t.oldX,t.y=t.oldY,t.offset=0,t.moveEnd=!1,t.disable=!0,setTimeout((function(){e.$nextTick((function(){t.x=t.absX*e.viewWidth,t.y=t.absY*e.viewWidth,e.tempItem=null,e.changeStatus=!0}))}),0),this.sortList()},previewImage:function(e){if("object"!==typeof e)if(this.chooseImage){this.imageList[e].choosed=!this.imageList[e].choosed;for(var i=1,n=[],a=0;a<this.imageList.length;a++)this.imageList[a].choosed&&(this.imageList[a].chooseIndex=i,i++,n.push(this.imageList[a].mediaId));this.$emit("chooseEvent",n)}else{for(var s=[],o={},r=0;r<this.imageList.length;r++)o={url:"",type:""},"Img"===this.imageList[r].cate&&(o.type="image"),"Vdo"===this.imageList[r].cate&&(o.type="video"),o.url=this.imageList[r].src,s.push(o);t.previewMedia({sources:s,current:e,showmenu:!0,success:function(t){},fail:function(t){console.log(t)}})}},mouseenter:function(){},mouseleave:function(){},addImages:function(){var e=this;if(this.custom)this.$emit("addImage");else{var i=this.number-this.imageList.length;t.chooseImage({count:i,sourceType:["album","camera"],success:function(t){for(var n=i<=t.tempFilePaths.length?i:t.tempFilePaths.length,a=0;a<n;a++)e.addProperties(t.tempFilePaths[a])}})}},addImage:function(t){this.addProperties(t)},delImage:function(t,e){var n=this;this.imageList.splice(e,1);var a,s=i(this.imageList);try{var o=function(){var e=a.value;e.index>t.index&&(e.index-=1,e.x=e.oldX,e.y=e.oldY,e.absX=e.index%n.colsValue,e.absY=Math.floor(e.index/n.colsValue),n.$nextTick((function(){e.x=e.absX*n.viewWidth,e.y=e.absY*n.viewWidth})))};for(s.s();!(a=s.n()).done;)o()}catch(r){s.e(r)}finally{s.f()}this.add.x=this.imageList.length%this.colsValue*this.viewWidth+"px",this.add.y=Math.floor(this.imageList.length/this.colsValue)*this.viewWidth+"px",this.sortList(),this.$emit("delImage",e)},delImageMp:function(t,e){this.delImage(t,e)},sortList:function(){var t=this.imageList.slice();t.sort((function(t,e){return t.index-e.index}));for(var e=0;e<t.length;e++)t[e]=t[e].mediaId;this.$emit("sortImage",t)},addProperties:function(t){var e=this.imageList.length%this.colsValue,i=Math.floor(this.imageList.length/this.colsValue),n=e*this.viewWidth,a=i*this.viewWidth;this.imageList.push({src:t.urlThumbnail,mediaId:t.mediaId,cate:t.cate,x:n,y:a,oldX:n,oldY:a,absX:e,absY:i,scale:1,zIndex:9,opacity:1,index:this.imageList.length,id:this.guid(),disable:!0,offset:0,moveEnd:!1,choosed:!1}),this.add.x=this.imageList.length%this.colsValue*this.viewWidth+"px",this.add.y=Math.floor(this.imageList.length/this.colsValue)*this.viewWidth+"px"},nothing:function(){},rpx2px:function(t){return this.width*t/750},guid:function(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}}};e.default=s}).call(this,i("543d")["default"])},9542:function(t,e,i){"use strict";i.r(e);var n=i("7e25"),a=i.n(n);for(var s in n)"default"!==s&&function(t){i.d(e,t,(function(){return n[t]}))}(s);e["default"]=a.a},a51b:function(t,e,i){"use strict";var n=i("fe8d"),a=i.n(n);a.a},b514:function(t,e,i){"use strict";var n;i.d(e,"b",(function(){return a})),i.d(e,"c",(function(){return s})),i.d(e,"a",(function(){return n}));var a=function(){var t=this,e=t.$createElement;t._self._c},s=[]},fe8d:function(t,e,i){}}]);
- ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
- 'components/DragImage/DragImage-create-component',
- {
- 'components/DragImage/DragImage-create-component':(function(module, exports, __webpack_require__){
- __webpack_require__('543d')['createComponent'](__webpack_require__("0ea8"))
- })
- },
- [['components/DragImage/DragImage-create-component']]
- ]);
|