Commit 733b41fc5522d31e945c6d00cb29b6841f3b91d9
1 parent
e6152cb2
feat: hide select list when only one type
Showing
4 changed files
with
10 additions
and
8 deletions
pages/index/index.js
1 | //index.js | 1 | //index.js |
2 | //获取应用实例 | 2 | //获取应用实例 |
3 | const app = getApp(); | 3 | const app = getApp(); |
4 | -const selectedIndex = app.globalData.getSelectedTypeIndex(); | ||
5 | const typeList = app.globalData.getTypeList(); | 4 | const typeList = app.globalData.getTypeList(); |
5 | +const selectedIndex = typeList.length > 1 ? app.globalData.getSelectedTypeIndex() : 0; | ||
6 | 6 | ||
7 | let audio = null; | 7 | let audio = null; |
8 | 8 | ||
@@ -11,7 +11,7 @@ Page({ | @@ -11,7 +11,7 @@ Page({ | ||
11 | placeholder: '点击此处输入文字', | 11 | placeholder: '点击此处输入文字', |
12 | text: '', | 12 | text: '', |
13 | typeList, | 13 | typeList, |
14 | - selectedIndex: String(selectedIndex) ? selectedIndex : 5 | 14 | + selectedIndex: String(selectedIndex) ? selectedIndex : 0 |
15 | }, | 15 | }, |
16 | onLoad(){ | 16 | onLoad(){ |
17 | wx.showShareMenu(); | 17 | wx.showShareMenu(); |
pages/index/index.wxml
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | <button bindtap="gotoAudioList" class="goto-audio-list" type="primary" size="mini"> 下载 </button> | 16 | <button bindtap="gotoAudioList" class="goto-audio-list" type="primary" size="mini"> 下载 </button> |
17 | <button bindtap="clear" class="button" type="default" size="mini"> 清空 </button> | 17 | <button bindtap="clear" class="button" type="default" size="mini"> 清空 </button> |
18 | </view> | 18 | </view> |
19 | - <view class="type-view"> | 19 | + <view class="type-view" wx:if="{{typeList.length > 1}}"> |
20 | <button | 20 | <button |
21 | wx:for="{{typeList}}" | 21 | wx:for="{{typeList}}" |
22 | wx:key="desc" | 22 | wx:key="desc" |
pages/index/index.wxss
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | 2 | ||
3 | .text-view{ | 3 | .text-view{ |
4 | width: 100%; | 4 | width: 100%; |
5 | + margin-bottom: 20rpx; | ||
5 | text-align: center; | 6 | text-align: center; |
6 | } | 7 | } |
7 | .text-area{ | 8 | .text-area{ |
@@ -10,17 +11,19 @@ | @@ -10,17 +11,19 @@ | ||
10 | text-align: left; | 11 | text-align: left; |
11 | box-sizing: border-box; | 12 | box-sizing: border-box; |
12 | display: inline-block; | 13 | display: inline-block; |
13 | - border: 1rpx dashed #afafaf; | 14 | + border: 1px dashed #afafaf; |
14 | } | 15 | } |
15 | 16 | ||
16 | .button-view{ | 17 | .button-view{ |
17 | width: 100%; | 18 | width: 100%; |
18 | - margin-top: 20rpx; | 19 | + margin-bottom: 40rpx; |
19 | text-align: center; | 20 | text-align: center; |
20 | } | 21 | } |
21 | .button-view button{ | 22 | .button-view button{ |
22 | width: 95%; | 23 | width: 95%; |
23 | display: inline-block; | 24 | display: inline-block; |
25 | + vertical-align: top; | ||
26 | + margin-bottom: 20rpx; | ||
24 | height: 92rpx; | 27 | height: 92rpx; |
25 | line-height: 92rpx; | 28 | line-height: 92rpx; |
26 | font-size: 36rpx; | 29 | font-size: 36rpx; |
@@ -29,7 +32,6 @@ | @@ -29,7 +32,6 @@ | ||
29 | 32 | ||
30 | .type-view{ | 33 | .type-view{ |
31 | width: 95%; | 34 | width: 95%; |
32 | - margin-top: 40rpx; | ||
33 | margin-bottom: 40rpx; | 35 | margin-bottom: 40rpx; |
34 | display: flex; | 36 | display: flex; |
35 | justify-content: space-between; | 37 | justify-content: space-between; |
@@ -41,5 +43,5 @@ | @@ -41,5 +43,5 @@ | ||
41 | letter-spacing: 15rpx; | 43 | letter-spacing: 15rpx; |
42 | } | 44 | } |
43 | .ad-1{ | 45 | .ad-1{ |
44 | - margin-bottom: 10px; | 46 | + margin-bottom: 20rpx; |
45 | } | 47 | } |
46 | \ No newline at end of file | 48 | \ No newline at end of file |
pages/result/result.wxss
@@ -29,7 +29,7 @@ | @@ -29,7 +29,7 @@ | ||
29 | color: #999; | 29 | color: #999; |
30 | } | 30 | } |
31 | .ad-placeholder{ | 31 | .ad-placeholder{ |
32 | - min-height: 111px; | 32 | + min-height: 150px; |
33 | margin-bottom: 10px; | 33 | margin-bottom: 10px; |
34 | background: #efefef; | 34 | background: #efefef; |
35 | } | 35 | } |
36 | \ No newline at end of file | 36 | \ No newline at end of file |