默认提交
Showing
3 changed files
with
34 additions
and
11 deletions
... | @@ -6,7 +6,7 @@ import { | ... | @@ -6,7 +6,7 @@ import { |
6 | import Dialog from '../../ui/vant-weapp/dialog/dialog'; | 6 | import Dialog from '../../ui/vant-weapp/dialog/dialog'; |
7 | import Poster from '../../miniprogram_dist/poster/poster'; | 7 | import Poster from '../../miniprogram_dist/poster/poster'; |
8 | 8 | ||
9 | const back = wx.getBackgroundAudioManager(); | 9 | const innerAudio = wx.createInnerAudioContext(); |
10 | 10 | ||
11 | let app = getApp(); | 11 | let app = getApp(); |
12 | Page({ | 12 | Page({ |
... | @@ -74,6 +74,12 @@ Page({ | ... | @@ -74,6 +74,12 @@ Page({ |
74 | authorizeVisible: true | 74 | authorizeVisible: true |
75 | }) | 75 | }) |
76 | }, | 76 | }, |
77 | onHide() { | ||
78 | |||
79 | }, | ||
80 | onUnload() { | ||
81 | this.pauseBgm(); | ||
82 | }, | ||
77 | onLoad(options) { | 83 | onLoad(options) { |
78 | this.setData({ | 84 | this.setData({ |
79 | options | 85 | options |
... | @@ -135,23 +141,34 @@ Page({ | ... | @@ -135,23 +141,34 @@ Page({ |
135 | let { | 141 | let { |
136 | detailData | 142 | detailData |
137 | } = this.data; | 143 | } = this.data; |
144 | |||
145 | innerAudio.src = detailData.musicUrl; | ||
146 | innerAudio.seek(0); | ||
147 | innerAudio.play(); | ||
148 | innerAudio.onEnded(() => { | ||
149 | _this.playBgm(); | ||
150 | }) | ||
138 | this.setData({ | 151 | this.setData({ |
139 | isPlayingBgm: true, | 152 | isPlayingBgm: true, |
140 | }) | 153 | }) |
141 | back.title = "背景音乐"; | ||
142 | back.src = detailData.musicUrl; | ||
143 | back.onEnded(() => { | ||
144 | _this.playBgm(); | ||
145 | }) | ||
146 | }, | 154 | }, |
147 | 155 | ||
148 | pauseBgm() { | 156 | pauseBgm() { |
149 | wx.pauseBackgroundAudio() | 157 | innerAudio.pause(); |
158 | innerAudio.offEnded(() => {}) | ||
150 | this.setData({ | 159 | this.setData({ |
151 | isPlayingBgm: false, | 160 | isPlayingBgm: false, |
152 | }) | 161 | }) |
153 | }, | 162 | }, |
154 | 163 | ||
164 | onBgmHandler() { | ||
165 | if (this.data.isPlayingBgm) { | ||
166 | this.pauseBgm(); | ||
167 | } else { | ||
168 | this.playBgm(); | ||
169 | } | ||
170 | }, | ||
171 | |||
155 | onShowMoreHandler() { | 172 | onShowMoreHandler() { |
156 | this.setData({ | 173 | this.setData({ |
157 | isMore: true | 174 | isMore: true |
... | @@ -659,7 +676,7 @@ Page({ | ... | @@ -659,7 +676,7 @@ Page({ |
659 | } catch (error) {} | 676 | } catch (error) {} |
660 | let memberList = result.memberList; | 677 | let memberList = result.memberList; |
661 | // hardcode数据 | 678 | // hardcode数据 |
662 | // for (let index = 0; index < 18; index++) { | 679 | // for (let index = 0; index < 4; index++) { |
663 | // memberList.push({ | 680 | // memberList.push({ |
664 | // blessCode: "4144feba2b904ba89585d90e8618a863", | 681 | // blessCode: "4144feba2b904ba89585d90e8618a863", |
665 | // blessMemberCode: "747e8e314d0e46679be17fb495975439", | 682 | // blessMemberCode: "747e8e314d0e46679be17fb495975439", | ... | ... |
... | @@ -5,8 +5,12 @@ | ... | @@ -5,8 +5,12 @@ |
5 | font-size: 36rpx; | 5 | font-size: 36rpx; |
6 | } | 6 | } |
7 | 7 | ||
8 | .van-popup { | 8 | .van-popup {} |
9 | |||
10 | .poster-popup { | ||
11 | .van-popup { | ||
9 | background-color: transparent !important; | 12 | background-color: transparent !important; |
13 | } | ||
10 | } | 14 | } |
11 | 15 | ||
12 | // 用户头像 | 16 | // 用户头像 |
... | @@ -36,6 +40,7 @@ | ... | @@ -36,6 +40,7 @@ |
36 | @extend .bb; | 40 | @extend .bb; |
37 | padding: 36px 24px; | 41 | padding: 36px 24px; |
38 | font-size: 38px; | 42 | font-size: 38px; |
43 | // background-color: #ffffff; | ||
39 | 44 | ||
40 | &-item { | 45 | &-item { |
41 | margin-bottom: 48px; | 46 | margin-bottom: 48px; |
... | @@ -176,6 +181,7 @@ | ... | @@ -176,6 +181,7 @@ |
176 | width: 660px; | 181 | width: 660px; |
177 | display: flex; | 182 | display: flex; |
178 | justify-content: flex-start; | 183 | justify-content: flex-start; |
184 | // justify-content: center; | ||
179 | flex-wrap: wrap; | 185 | flex-wrap: wrap; |
180 | margin: 36px auto 0; | 186 | margin: 36px auto 0; |
181 | height: 450px; | 187 | height: 450px; | ... | ... |
... | @@ -146,7 +146,7 @@ | ... | @@ -146,7 +146,7 @@ |
146 | </view> | 146 | </view> |
147 | </view> | 147 | </view> |
148 | <!-- 背景音乐 --> | 148 | <!-- 背景音乐 --> |
149 | <image bindtap="onBgmHandler" src="../../image/icon/icon-music.png" class="music {{isPlayingBgm?'ani-rotation-music':''}}" mode="widthFix"></image> | 149 | <image wx:if="{{detailData.musicUrl}}" bindtap="onBgmHandler" src="../../image/icon/icon-music.png" class="music {{isPlayingBgm?'ani-rotation-music':''}}" mode="widthFix"></image> |
150 | <!-- <audio src="{{detailData.musicUrl}}" id="myAudio"></audio> --> | 150 | <!-- <audio src="{{detailData.musicUrl}}" id="myAudio"></audio> --> |
151 | <!-- 修改用户信息 --> | 151 | <!-- 修改用户信息 --> |
152 | <van-dialog close-on-click-overlay use-slot title="修改信息" confirm-button-text="确认修改" show="{{ updateUserInfoDialogVisible }}" show-cancel-button bind:confirm="onUpdateUserInfoHander"> | 152 | <van-dialog close-on-click-overlay use-slot title="修改信息" confirm-button-text="确认修改" show="{{ updateUserInfoDialogVisible }}" show-cancel-button bind:confirm="onUpdateUserInfoHander"> |
... | @@ -189,7 +189,7 @@ | ... | @@ -189,7 +189,7 @@ |
189 | <van-popup show="{{ authorizeVisible }}"> | 189 | <van-popup show="{{ authorizeVisible }}"> |
190 | <authorize-comp bind:evtcomp="evtcomp"></authorize-comp> | 190 | <authorize-comp bind:evtcomp="evtcomp"></authorize-comp> |
191 | </van-popup> | 191 | </van-popup> |
192 | <van-popup bind:click-overlay="onHidePosterHandler" show="{{ posterVisible }}"> | 192 | <van-popup class="poster-popup" bind:click-overlay="onHidePosterHandler" show="{{ posterVisible }}"> |
193 | <image bindtap="onPreviewImageHandler" class="poster" mode="widthFix" src="{{imageUrl}}" /> | 193 | <image bindtap="onPreviewImageHandler" class="poster" mode="widthFix" src="{{imageUrl}}" /> |
194 | <view bindtap="saveImageToPhotosAlbum" class="save-btn">一键保存</view> | 194 | <view bindtap="saveImageToPhotosAlbum" class="save-btn">一键保存</view> |
195 | </van-popup> | 195 | </van-popup> | ... | ... |
-
Please register or sign in to post a comment