Skip to content

Commit f6a937b

Browse files
committed
build: Travis CI automatic compilation
1 parent 48342a8 commit f6a937b

File tree

8 files changed

+147
-18
lines changed

8 files changed

+147
-18
lines changed

dist/album/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/album/index.wxml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<wxs src="index.wxs" module="album"></wxs>
2-
<view class="container l-class" style="{{album.containerStyle(urls, multipleSize, gapRow, gapColumn)}}">
3-
<block wx:for="{{urls}}" wx:key="index">
4-
<image id="{{index}}" mut-bind:tap="onPreviewTap" class="{{album.blockClass(urls, horizontalScreen)}}" style="{{album.blockStyle(urls, horizontalScreen, shortSideValue, singleSize, multipleSize)}}" src="{{newType?item[key]:item}}" mode="{{urls.length === 1?singleMode:multipleMode}}"/>
2+
<view style="{{album.gridStyle(gapRow, gapColumn, multipleSize, everyRowNumber)}}">
3+
<block wx:for="{{showUrls}}" wx:key="index" class="child">
4+
<view class="imageContainer {{album.dimBack(isLong, index, maxNumber, previewFullImage)}}" style="{{album.blockStyle(urls, horizontalScreen, shortSideValue, singleSize, multipleSize)}}">
5+
<image class="{{album.dim(isLong, index, maxNumber, previewFullImage)}}}" id="{{index}}" bind:tap="onPreviewTap" style="{{album.blockStyle(urls, horizontalScreen, shortSideValue, singleSize, multipleSize)}}" src="{{newType?item[key]:item}}" mode="{{urls.length === 1?singleMode:multipleMode}}"/>
6+
<view wx:if="{{album.image(isLong, index, maxNumber, previewFullImage)}}" class="text">+{{urls.length-maxNumber}}</view>
7+
</view>
58
</block>
69
</view>

dist/album/index.wxs

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
var containerStyle = function (urls, multipleSize, gapRow, gapColumn) {
2-
urls.length === 2 || urls.length === 4 ? 'width:' + (2 * multipleSize + gapRow) + 'rpx;' : 'width:' + (3 * multipleSize + 2 * gapRow) + 'rpx;'
32
if (urls.length === 2 || urls.length === 4) {
43
return 'width:' + (2 * multipleSize + gapRow) + 'rpx; grid-row-gap:' + gapColumn + 'rpx; grid-column-gap:' + gapRow + 'rpx;grid-template-columns:repeat(auto-fit, ' + multipleSize + 'rpx);'
54
} else {
@@ -32,8 +31,49 @@ var blockStyle = function (urls, horizontalScreen, shortSideValue, singleSize, m
3231
}
3332
}
3433

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+
3571
module.exports = {
3672
containerStyle: containerStyle,
3773
blockClass: blockClass,
38-
blockStyle: blockStyle
74+
blockStyle: blockStyle,
75+
gridStyle: gridStyle,
76+
dimBack: dimBack,
77+
dim: dim,
78+
image: image,
3979
}

dist/album/index.wxss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.container{display:grid}.vertical{height:360rpx}
1+
.container{display:grid}.vertical{height:360rpx}.parent{display:inline-grid;grid-template-columns:repeat(auto-fill)}.child{box-sizing:border-box;background-color:#fff;flex:0 0 44%;height:100px;border:1px solid red;margin-top:4%;margin-left:2%;margin-right:2%}.dimback{background:#000}.dim{opacity:.6}.imageContainer{position:relative}.imageContainer:last-child>.text{color:#fff;font-weight:700;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:larger}

examples/dist/album/index.js

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ Component({
4444
key: {
4545
type: String,
4646
value: 'url'
47+
},
48+
maxNumber: {
49+
type: Number,
50+
value: 9
51+
},
52+
customRowNumber: {
53+
type: Boolean,
54+
value: false
55+
},
56+
everyRowNumber: {
57+
type: Number,
58+
value: 3
59+
},
60+
previewFullImage: {
61+
type: Boolean,
62+
value: true,
4763
}
4864
},
4965

@@ -59,6 +75,10 @@ Component({
5975
row: 0,
6076
// 图片排列几列
6177
colum: 0,
78+
// 用于显示的图片列表
79+
showUrls: [],
80+
// 传入的url长度是否大于maxNumber指定的数量
81+
isLong: false,
6282
},
6383

6484
/**
@@ -69,12 +89,29 @@ Component({
6989
// 在组件实例进入页面节点树时执行
7090

7191
//判断传入urls长度
72-
if (this.data.urls.length > 9) {
73-
const urls = this.data.urls.slice(0, 9);
92+
let urls = [];
93+
if (this.data.urls.length > this.data.maxNumber) {
94+
urls = this.data.urls.slice(0, this.data.maxNumber);
7495
this.setData({
75-
urls
96+
isLong: true,
7697
});
77-
console.warn('超过9张图片!');
98+
console.warn('图片数量超过maxNumber指定数量');
99+
} else {
100+
urls = this.data.urls;
101+
}
102+
this.setData({
103+
showUrls: urls
104+
});
105+
106+
if (!this.data.customRowNumber) {
107+
let urlLength = this.data.showUrls.length;
108+
if (urlLength > 1 && urlLength < 5) {
109+
this.setData({
110+
everyRowNumber: 2
111+
});
112+
} else(this.setData({
113+
everyRowNumber: 3
114+
}));
78115
}
79116

80117
this.preview();
@@ -137,7 +174,13 @@ Component({
137174

138175
onPreviewTap(e) {
139176
const index = e.currentTarget.id;
140-
const urls = this.data.urls;
177+
let urls;
178+
if (this.data.previewFullImage) {
179+
urls = this.data.urls;
180+
} else {
181+
urls = this.data.showUrls;
182+
}
183+
141184
let tempFilePath = '';
142185
let previewImageList = [];
143186
const newType = this.data.newType;

examples/dist/album/index.wxml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<wxs src="index.wxs" module="album"></wxs>
2-
<view class="container l-class" style="{{album.containerStyle(urls, multipleSize, gapRow, gapColumn)}}">
3-
<block wx:for="{{urls}}" wx:key="index">
4-
<image id='{{index}}' mut-bind:tap="onPreviewTap" class="{{album.blockClass(urls, horizontalScreen)}}" style="{{album.blockStyle(urls, horizontalScreen, shortSideValue, singleSize, multipleSize)}}" src="{{newType?item[key]:item}}" mode="{{urls.length === 1?singleMode:multipleMode}}" />
2+
<view style="{{album.gridStyle(gapRow, gapColumn, multipleSize, everyRowNumber)}}">
3+
<block wx:for="{{showUrls}}" wx:key="index" class="child">
4+
<view class="imageContainer {{album.dimBack(isLong, index, maxNumber, previewFullImage)}}" style="{{album.blockStyle(urls, horizontalScreen, shortSideValue, singleSize, multipleSize)}}">
5+
<image class="{{album.dim(isLong, index, maxNumber, previewFullImage)}}}" id='{{index}}' bind:tap="onPreviewTap" style="{{album.blockStyle(urls, horizontalScreen, shortSideValue, singleSize, multipleSize)}}" src="{{newType?item[key]:item}}" mode="{{urls.length === 1?singleMode:multipleMode}}" />
6+
<view wx:if="{{album.image(isLong, index, maxNumber, previewFullImage)}}" class="text">+{{urls.length-maxNumber}}</view>
7+
</view>
58
</block>
69
</view>

examples/dist/album/index.wxs

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
var containerStyle = function (urls, multipleSize, gapRow, gapColumn) {
2-
urls.length === 2 || urls.length === 4 ? 'width:' + (2 * multipleSize + gapRow) + 'rpx;' : 'width:' + (3 * multipleSize + 2 * gapRow) + 'rpx;'
32
if (urls.length === 2 || urls.length === 4) {
43
return 'width:' + (2 * multipleSize + gapRow) + 'rpx; grid-row-gap:' + gapColumn + 'rpx; grid-column-gap:' + gapRow + 'rpx;grid-template-columns:repeat(auto-fit, ' + multipleSize + 'rpx);'
54
} else {
@@ -32,8 +31,49 @@ var blockStyle = function (urls, horizontalScreen, shortSideValue, singleSize, m
3231
}
3332
}
3433

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+
3571
module.exports = {
3672
containerStyle: containerStyle,
3773
blockClass: blockClass,
38-
blockStyle: blockStyle
74+
blockStyle: blockStyle,
75+
gridStyle: gridStyle,
76+
dimBack: dimBack,
77+
dim: dim,
78+
image: image,
3979
}

examples/dist/album/index.wxss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.container{display:grid}.vertical{height:360rpx}
1+
.container{display:grid}.vertical{height:360rpx}.parent{display:inline-grid;grid-template-columns:repeat(auto-fill)}.child{box-sizing:border-box;background-color:#fff;flex:0 0 44%;height:100px;border:1px solid red;margin-top:4%;margin-left:2%;margin-right:2%}.dimback{background:#000}.dim{opacity:.6}.imageContainer{position:relative}.imageContainer:last-child>.text{color:#fff;font-weight:700;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:larger}

0 commit comments

Comments
 (0)