1 |
- {"version":3,"file":"utils-3a540bc8.js","sources":["../src/components/Payment/Utils/utils.ts"],"sourcesContent":["\r\nexport const IMAGE_PROCESS = '?x-oss-process=image/resize,h_350';\r\nexport const IMAGE_PROCESS_SMALL = '?x-oss-process=image/resize,h_100';\r\nexport const IMAGE_PROCESS_LARGE = '?x-oss-process=image/resize,h_500';\r\n\r\ninterface AddImageProcessOptions {\r\n small?: boolean;\r\n large?: boolean;\r\n custom?: boolean;\r\n width?: string;\r\n height?: string;\r\n}\r\n\r\nexport function addImageProcess(url: string, options: AddImageProcessOptions = { width: '36px', height: '36px' }) {\r\n // 防止重复添加导致的url不正确\r\n if (url && url.indexOf('x-oss-process') > -1) {\r\n return url;\r\n }\r\n if (options.small) {\r\n return url + IMAGE_PROCESS_SMALL;\r\n }\r\n if (options.large) {\r\n return url + IMAGE_PROCESS_LARGE;\r\n }\r\n if (options.custom) {\r\n return `${url}?x-oss-process=image/resize,limit_0,m_fill,w_${options.width},h_${options.height}`;\r\n }\r\n return url + IMAGE_PROCESS;\r\n}\r\n\r\nexport function formatMoney(input: any, fuzz = 2) {\r\n if (isNaN(+input)) {\r\n return input;\r\n }\r\n return (+input).toFixed(fuzz);\r\n}\r\n\r\ntype classSize = 'small'|'normal'|'large';\r\n\r\nexport function exportStyleSizeClass(styles: any, size: classSize) {\r\n return {\r\n [styles[size]]: true,\r\n }\r\n}"],"names":["IMAGE_PROCESS","IMAGE_PROCESS_SMALL","IMAGE_PROCESS_LARGE","addImageProcess","url","options","width","height","indexOf","small","large","custom","exportStyleSizeClass","styles","size"],"mappings":";;AACO,IAAMA,aAAa,GAAG,mCAAtB;AACA,IAAMC,mBAAmB,GAAG,mCAA5B;AACA,IAAMC,mBAAmB,GAAG,mCAA5B;AAUD,SAAUC,eAAV,CAA0BC,GAA1B,EAA0G;AAAA,MAAnEC,OAAmE,uEAAjC;AAAEC,IAAAA,KAAK,EAAE,MAAT;AAAiBC,IAAAA,MAAM,EAAE;AAAzB,GAAiC;;MAE1GH,GAAG,IAAIA,GAAG,CAACI,OAAJ,CAAY,eAAZ,IAA+B,CAAC,GAAG;WACrCJ;;;MAELC,OAAO,CAACI,OAAO;WACVL,GAAG,GAAGH;;;MAEXI,OAAO,CAACK,OAAO;WACVN,GAAG,GAAGF;;;MAEXG,OAAO,CAACM,QAAQ;qBACRP,6DAAmDC,OAAO,CAACC,qBAAWD,OAAO,CAACE;;;SAEnFH,GAAG,GAAGJ;;AAYT,SAAUY,oBAAV,CAA+BC,MAA/B,EAA4CC,IAA5C,EAA2D;6BAE5DD,MAAM,CAACC,IAAD,GAAS;;;;;"}
|