1 |
- {"version":3,"file":"index.js","sources":["../../src/components/Payment/assets/icon/popovers_list_huangguan.png","../../src/components/Payment/ConsumeListView/index.tsx"],"sourcesContent":["const img = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAABvklEQVQ4T62UTygEcRTHv29MIsqfk6OL5CYH5aKd9WfjwqxEnBzExYWTCEWJJGove5H8OTA1uwdCrOWAi83ZwUXJiSj5u+Z5s0msmd2SX81h+r33ee/7fW+G8E+H/srhqEcFCjphve1RzcaVK4j3mmoB5YxqQzdOxTji1wE2QZglb2jAEcT7/g4wr0rQugS1OYJ26nOg5nYDr4ZrR7yrl0FBAKBlqjEX3eRLwSXAmidvOJbSI47oF9LVKaCOkNc4/w7kSPOoFBqDwjpp4XA60LUkF8nzbsuERQt4ejtGdsYwiAYTYIV6STOD6UB3EpqXJC0u7zKxz0Mk3Zrj7lOLerJg5T9K+2lWhALiYx8xS9NbDZnUuPXy0wN/hYw3lnbPiNfE7HaSfTAloRqKWkya8WAnMrdmIBqfBqM/BehJAo+gKHMibdMGzUhqKUiZAHGVXJYLwPdpshPnRDRM4fl5+7uKL/0c1WXdOSie5Dh3wZcyoR7SQttO9z+M5MOWEsStFQmsTAoOwVK7qM64d5P6ayKJj9EqHBa5Q4kx2/ujqR1Exnsq493HH2muFN98oNtJ0g7s3Ul5/vwbSab+G+gDqFybE11pYkYAAAAASUVORK5CYII=\";\n export default img;","import React, { Component, MouseEvent } from 'react';\r\nimport classnames from 'classnames';\r\n\r\n// import { DEFAULT_AVATAR } from '@/constants';\r\nimport { addImageProcess } from '../Utils/utils';\r\nimport KingDomPic from '../assets/icon/popovers_list_huangguan.png';\r\n\r\nimport styles from './ConsumeListView.less';\r\n\r\nconst DEFAULT_AVATAR =\r\n '//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180820/Kgka4_oU1.jpeg';\r\n \r\ninterface dataItem {\r\n id?: string|number;\r\n user_avatar?: string;\r\n bill_price?: number;\r\n}\r\n\r\ninterface Props {\r\n isToggle: boolean;\r\n onToggleChange: Function;\r\n onConsumeItemClick: (e: MouseEvent, clickData: any) => any,\r\n dataSource: Array<dataItem>;\r\n listLength: number;\r\n showLength: number; \r\n options: {\r\n avatarSize: number,\r\n avatarMarginLeftAndRight: number,\r\n kingdomWidth: number,\r\n kingdomHeight: number,\r\n kingdomPosition: [number, number],\r\n },\r\n}\r\n\r\nclass ConsumeListView extends Component<Props, {}> {\r\n static defaultProps: Props = {\r\n isToggle: false,\r\n onToggleChange: () => {},\r\n onConsumeItemClick: () => {},\r\n dataSource: [],\r\n listLength: 0,\r\n showLength: 6,\r\n options: {\r\n avatarSize: 36,\r\n avatarMarginLeftAndRight: 6,\r\n kingdomWidth: 24,\r\n kingdomHeight: 22,\r\n kingdomPosition: [-6, -12],\r\n },\r\n }\r\n\r\n renderConsumeItem() {\r\n const {\r\n dataSource,\r\n isToggle,\r\n onConsumeItemClick,\r\n showLength,\r\n listLength,\r\n options,\r\n } = this.props;\r\n const {\r\n kingdomWidth,\r\n kingdomHeight,\r\n kingdomPosition,\r\n avatarSize,\r\n avatarMarginLeftAndRight,\r\n } = options;\r\n\r\n let renderData = dataSource;\r\n if (!isToggle && listLength > showLength) {\r\n renderData = dataSource.slice(0, showLength - 1);\r\n }\r\n\r\n return renderData.map((v: dataItem, i: number) => {\r\n let kingdom = null;\r\n if (i === 0) {\r\n kingdom = (\r\n <img\r\n className={styles.kingdomIcon}\r\n src={KingDomPic}\r\n alt=\"reward top user\"\r\n style={{\r\n width: `${kingdomWidth}px`,\r\n height: `${kingdomHeight}px`,\r\n left: `${kingdomPosition[0]}px`,\r\n top: `${kingdomPosition[1]}px`,\r\n }}\r\n />\r\n );\r\n }\r\n return (\r\n <li\r\n key={v.id}\r\n className={styles.consumeItem}\r\n style={{ margin: `0 ${avatarMarginLeftAndRight}px 10px` }}\r\n >\r\n {kingdom}\r\n <div\r\n className={styles.avatar}\r\n onClick={(e) => onConsumeItemClick(e, v)}\r\n style={{\r\n backgroundImage: `url(${addImageProcess(\r\n v.user_avatar || DEFAULT_AVATAR,\r\n {\r\n small: true,\r\n },\r\n )})`,\r\n width: `${avatarSize}px`,\r\n height: `${avatarSize}px`,\r\n }}\r\n />\r\n <span className={styles.gray}>\r\n {/* {intl.get('bilingually.gift.item', {\r\n nums: v.bill_price / 100,\r\n }) /* {item.num}另币 */}\r\n </span>\r\n </li>\r\n );\r\n });\r\n }\r\n\r\n renderToggleButton() {\r\n const {\r\n isToggle,\r\n onToggleChange,\r\n listLength,\r\n showLength,\r\n options,\r\n } = this.props;\r\n const { avatarSize, avatarMarginLeftAndRight } = options;\r\n\r\n if (listLength <= showLength) {\r\n return null;\r\n }\r\n\r\n return (\r\n <li\r\n onClick={() => onToggleChange()}\r\n className={classnames(styles.toggle, {\r\n [styles.expand]: isToggle,\r\n })}\r\n style={{\r\n width: `${avatarSize}px`,\r\n height: `${avatarSize}px`,\r\n lineHeight: `${avatarSize}px`,\r\n margin: `0 ${avatarMarginLeftAndRight}px 10px`,\r\n }}\r\n />\r\n );\r\n }\r\n\r\n render() {\r\n const { showLength, options } = this.props;\r\n const { avatarSize, avatarMarginLeftAndRight } = options;\r\n return (\r\n <div className={styles.wrapper}>\r\n <ul\r\n className={styles.consumelist}\r\n style={{\r\n width: `calc(${avatarMarginLeftAndRight * 2 +\r\n avatarSize}px * ${showLength})`,\r\n }}\r\n >\r\n {this.renderConsumeItem()}\r\n {this.renderToggleButton()}\r\n </ul>\r\n </div>\r\n );\r\n }\r\n}\r\n\r\nexport default ConsumeListView;\r\n"],"names":["img","DEFAULT_AVATAR","ConsumeListView","props","dataSource","isToggle","onConsumeItemClick","showLength","listLength","options","kingdomWidth","kingdomHeight","kingdomPosition","avatarSize","avatarMarginLeftAndRight","renderData","slice","map","v","i","kingdom","React","createElement","className","styles","kingdomIcon","src","KingDomPic","alt","style","width","height","left","top","key","id","consumeItem","margin","avatar","onClick","e","backgroundImage","addImageProcess","user_avatar","small","gray","onToggleChange","classnames","toggle","expand","lineHeight","wrapper","consumelist","renderConsumeItem","renderToggleButton","Component","defaultProps"],"mappings":";;;;;;;;;;;;;;AAAA,MAAMA,GAAG,GAAG,wrBAAZ;;;;;;;;;;;;;;;ACSA,IAAMC,cAAc,GAClB,6EADF;;IAyBMC;;;;;;;;;;;;;wCAiBa;AAAA,wBAQX,KAAKC,KARM;AAAA,UAEbC,UAFa,eAEbA,UAFa;AAAA,UAGbC,QAHa,eAGbA,QAHa;AAAA,UAIbC,kBAJa,eAIbA,kBAJa;AAAA,UAKbC,UALa,eAKbA,UALa;AAAA,UAMbC,UANa,eAMbA,UANa;AAAA,UAObC,OAPa,eAObA,OAPa;AAAA,UAUbC,YAVa,GAeXD,OAfW,CAUbC,YAVa;AAAA,UAWbC,aAXa,GAeXF,OAfW,CAWbE,aAXa;AAAA,UAYbC,eAZa,GAeXH,OAfW,CAYbG,eAZa;AAAA,UAabC,UAba,GAeXJ,OAfW,CAabI,UAba;AAAA,UAcbC,wBAda,GAeXL,OAfW,CAcbK,wBAda;UAiBXC,UAAU,GAAGX;;UACb,CAACC,QAAD,IAAaG,UAAU,GAAGD,YAAY;AACxCQ,QAAAA,UAAU,GAAGX,UAAU,CAACY,KAAX,CAAiB,CAAjB,EAAoBT,UAAU,GAAG,CAAjC,CAAb;;;aAGKQ,UAAU,CAACE,GAAX,CAAe,UAACC,CAAD,EAAcC,CAAd,EAA2B;YAC3CC,OAAO,GAAG;;YACVD,CAAC,KAAK,GAAG;AACXC,UAAAA,OAAO,GACLC,cAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AACEC,YAAAA,SAAS,EAAEC,MAAM,CAACC,WADpB;AAEEC,YAAAA,GAAG,EAAEC,GAFP;AAGEC,YAAAA,GAAG,EAAC,iBAHN;AAIEC,YAAAA,KAAK,EAAE;AACLC,cAAAA,KAAK,YAAKpB,YAAL,OADA;AAELqB,cAAAA,MAAM,YAAKpB,aAAL,OAFD;AAGLqB,cAAAA,IAAI,YAAKpB,eAAe,C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