|
| 1 | +var containerStyle = function (urls, multipleSize, gapRow, gapColumn) { |
| 2 | + if (urls.length === 2 || urls.length === 4) { |
| 3 | + return 'width:' + (2 * multipleSize + gapRow) + 'rpx; grid-row-gap:' + gapColumn + 'rpx; grid-column-gap:' + gapRow + 'rpx;grid-template-columns:repeat(auto-fit, ' + multipleSize + 'rpx);' |
| 4 | + } else { |
| 5 | + return 'width:' + (3 * multipleSize + 2 * gapRow) + 'rpx; grid-row-gap:' + gapColumn + 'rpx; grid-column-gap:' + gapRow + 'rpx;grid-template-columns:repeat(auto-fit, ' + multipleSize + 'rpx);' |
| 6 | + } |
| 7 | + |
| 8 | +} |
| 9 | + |
| 10 | +var blockClass = function (urls, horizontalScreen) { |
| 11 | + if (urls.length === 1) { |
| 12 | + if (horizontalScreen) { |
| 13 | + return 'l-single-image-class' |
| 14 | + } else { |
| 15 | + return 'vertical l-single-image-class' |
| 16 | + } |
| 17 | + } else { |
| 18 | + return 'l-multi-image-class' |
| 19 | + } |
| 20 | +} |
| 21 | + |
| 22 | +var blockStyle = function (urls, horizontalScreen, shortSideValue, singleSize, multipleSize) { |
| 23 | + if (urls.length === 1) { |
| 24 | + if (horizontalScreen) { |
| 25 | + return 'height:' + shortSideValue + 'rpx;width:' + singleSize + 'rpx;' |
| 26 | + } else { |
| 27 | + return 'width:' + shortSideValue + 'rpx;height:' + singleSize + 'rpx;' |
| 28 | + } |
| 29 | + } else { |
| 30 | + return 'height:' + multipleSize + 'rpx;width:' + multipleSize + 'rpx;' |
| 31 | + } |
| 32 | +} |
| 33 | + |
| 34 | +var gridStyle = function (gapRow, gapColumn, multipleSize, everyRowNumber) { |
| 35 | + return 'display:inline-grid;grid-template-columns: repeat(' + everyRowNumber + ',' + multipleSize + 'rpx);grid-row-gap:' + gapRow + 'rpx;grid-column-gap:' + gapColumn + 'rpx;' |
| 36 | +} |
| 37 | + |
| 38 | +var dimBack = function (isLong, index, maxNumber, previewFullImage) { |
| 39 | + if (previewFullImage) { |
| 40 | + if (isLong) { |
| 41 | + if (index == maxNumber - 1) { |
| 42 | + return 'dimback' |
| 43 | + } |
| 44 | + } |
| 45 | + } |
| 46 | + return '' |
| 47 | +} |
| 48 | + |
| 49 | +var dim = function (isLong, index, maxNumber, previewFullImage) { |
| 50 | + if (previewFullImage) { |
| 51 | + if (isLong) { |
| 52 | + if (index == maxNumber - 1) { |
| 53 | + return 'dim' |
| 54 | + } |
| 55 | + } |
| 56 | + } |
| 57 | + return '' |
| 58 | +} |
| 59 | + |
| 60 | +var image = function (isLong, index, maxNumber, previewFullImage) { |
| 61 | + if (previewFullImage) { |
| 62 | + if (isLong) { |
| 63 | + if (index == maxNumber - 1) { |
| 64 | + return true |
| 65 | + } |
| 66 | + } |
| 67 | + } |
| 68 | + return false |
| 69 | +} |
| 70 | + |
| 71 | +module.exports = { |
| 72 | + containerStyle: containerStyle, |
| 73 | + blockClass: blockClass, |
| 74 | + blockStyle: blockStyle, |
| 75 | + gridStyle: gridStyle, |
| 76 | + dimBack: dimBack, |
| 77 | + dim: dim, |
| 78 | + image: image, |
| 79 | +} |
0 commit comments