/*! For license information please see b14021f24a99c16a41f3ddce1a2c0358.js.LICENSE.txt */
"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([["sub-common/b14021f24a99c16a41f3ddce1a2c0358"],{"./src/components/uploadImage/index.tsx":function(e,a,n){var t=n("./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js");var r=n("./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js");var s=n("./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js");var o=n("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");var c=n("./node_modules/@tarojs/taro/index.js");var l=n.n(c);var u=n("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");var i=n("./node_modules/react/cjs/react.production.min.js");var d=n("./src/components/uploadImage/index.module.scss");var f=n("./src/use/useUploadImage.ts");var m=n("./src/common/format.js");var p=n("./src/components/popup/index.tsx");var v=n("./src/components/iconfont/iconfont.tsx");var h=n("./node_modules/react/cjs/react-jsx-runtime.production.min.js");var x=function PictureItem(e){var a=e.onChange,n=e.defaultList,c=e.onlyRead,x=c===void 0?false:c;var j=(0,f["default"])(),g=j.getWxPhoto,w=j.getChatPhoto;var b=(0,i.useState)([]),k=(0,o["default"])(b,2),_=k[0],I=k[1];var C=(0,i.useState)(false),y=(0,o["default"])(C,2),N=y[0],V=y[1];var P=(0,i.useState)([{id:1,name:"手机相册",check:false},{id:2,name:"从微信对话选择",check:false}]),z=(0,o["default"])(P,2),E=z[0],F=z[1];(0,i.useEffect)((function(){I(n||[])}),[n]);var S=function(){var e=(0,s["default"])((0,r["default"])().mark((function _callee(){return(0,r["default"])().wrap((function _callee$(e){while(1)switch(e.prev=e.next){case 0:V(true);case 1:case"end":return e.stop()}}),_callee)})));return function uploadImage(){return e.apply(this,arguments)}}();var T=function(){var e=(0,s["default"])((0,r["default"])().mark((function _callee2(e){var a;var n,s;return(0,r["default"])().wrap((function _callee2$(r){while(1)switch(r.prev=r.next){case 0:if(!(e==1)){r.next=6;break}r.next=3;return g("after-sale",5);case 3:n=r.sent;r.next=9;break;case 6:r.next=8;return w("after-sale",5);case 8:n=r.sent;case 9:s=[];(a=n)===null||a===void 0?void 0:a.forEach((function(e){s.push(e.url)}));I([].concat((0,t["default"])(_),s));V(false);case 13:case"end":return r.stop()}}),_callee2)})));return function handPic(a){return e.apply(this,arguments)}}();var U=function delImage(e){_.splice(e,1);I((function(){return(0,t["default"])(_)}))};(0,i.useEffect)((function(){a===null||a===void 0?void 0:a(_)}),[_]);var A=function showImage(){var e=_===null||_===void 0?void 0:_.map((function(e){return(0,m.formatImgUrl)(e,"!w800")}));l().previewImage({current:e[0],urls:e})};var B=function handItem(e){E.map((function(a){if(e.id==a.id){a.check=true}else{a.check=false}return a}));F((0,t["default"])(E));T(e.id)};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(u.View,{className:d["default"].image_main,children:[_===null||_===void 0?void 0:_.map((function(e,a){return(0,h.jsxs)(u.View,{className:d["default"].ImgItem,children:[(0,h.jsx)(u.Image,{mode:"aspectFill",src:(0,m.formatImgUrl)(e),onClick:A}),!x&&(0,h.jsx)(u.View,{onClick:function onClick(){return U(a)},children:(0,h.jsx)(v["default"],{name:"icon-guanbi",size:30,customClassName:d["default"].miconfont_close,color:"#ffffff"})})]},a)})),!x&&(0,h.jsx)(u.View,{className:d["default"].uploadImg,onClick:S,children:(0,h.jsx)(v["default"],{name:"icon-xinzeng",size:100,color:"#d8d8d8"})})]}),(0,h.jsx)(p["default"],{title:"选择方式",show:N,onClose:function onClose(){return V(false)},isFixed:true,children:(0,h.jsx)(u.View,{className:d["default"].bigBoxThree,children:E.map((function(e,a){return(0,h.jsx)(u.View,{className:d["default"].itemBox,onClick:function onClick(){return B(e)},children:e.name},a)}))})})]})};a["default"]=(0,i.memo)(x)}}]);