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,IAAMA,GAAG,GAAG,wrBAAZ;;;;;;;;;;;;;;;ACSA,IAAMC,cAAc,GAClB,6EADF;;IAyBMC;;;;;;;;;;;;;wCAiBa;wBAQX,KAAKC;UANPC,UAFa,eAEbA;UACAC,QAHa,eAGbA;UACAC,kBAJa,eAIbA;UACAC,UALa,eAKbA;UACAC,UANa,eAMbA;UACAC,OAPa,eAObA;UAGAC,YAVa,GAeXD,OAfW,CAUbC;UACAC,aAXa,GAeXF,OAfW,CAWbE;UACAC,eAZa,GAeXH,OAfW,CAYbG;UACAC,UAba,GAeXJ,OAfW,CAabI;UACAC,wBAda,GAeXL,OAfW,CAcbK;UAGEC,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,KAAA,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,mBADL;AAELqB,cAAAA,MAAM,YAAKpB,oBAFN;AAGLqB,cAAAA,IAAI,YAAKpB,eAAe,CAAC,CAAD,QAHnB;AAILqB,cAAAA,GAAG,YAAKrB,eAAe,CAAC,CAAD;AAJlB;AAJT,WAAA,CADF;;;eAeAS,KAAA,CAAAC,aAAA,CAAA,IAAA,EAAA;AACEY,UAAAA,GAAG,EAAEhB,CAAC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