制作属于自己的一个微信小程序音乐播放器
生活随笔
收集整理的這篇文章主要介紹了
制作属于自己的一个微信小程序音乐播放器
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.首先導入大佬封裝的js 方法(調用音樂api)
展示(項目下載在最下方):
2.調用js 方法!
3.json文件
{"usingComponents": {"i-icon": "../../dist/icon/index","i-toast": "../../dist/toast/index"},"navigationBarTitleText": "音樂播放" }4.wxml
<!--pages/showplayer/index.wxml--><view class="applicationcontext-page"style="height:{{pageHeight}}px"><view class="showplery-page"><image class="showplery-image-page" src="{{musicInforList.picUrl}}"aanimation="{{animation}}" mode="scaleToFill"></image></view><view class="bottom-up-page"><view class="icon-page-y"><i-icon type="like" color="black" size="25"/></view><view class="icon-page-y"><i-icon type="keyboard" color="black" size="25"/></view> <view class="yuan-page"style="margin-left:20%;"><i-icon type="switch" color="black" size="20"/></view></view><view class="bottom-dwon-page"><view class="icon-page-y-b"><i-icon type="share" color="black" size="25"/></view><view class="yuan-page-b"bindtap="lastOneTap"><image class="icon-imagesty" src="../../resource/ios-arrow-dropleft.png"></image></view><view class="yuan-page-b"><image class="icon-imagesty" src="{{playericon}}"bindtap="stopAndStartMusicTap"data-bol></image></view><view class="yuan-page-b"bindtap="nextOneTap"><image class="icon-imagesty" src="../../resource/ios-arrow-dropright.png"></image></view> <view class="icon-page-y-b"bindtap="showMusicListTap"><i-icon type="createtask" color="black" size="25"/></view></view><view class="show-textinfor-musicinfor">{{musicInforList.name}} - {{musicInforList.artistsName}}</view> </view><view class="show-textinfor"style="top:60px">{{parse.showText(kphc)}} </view><!--蒙版--> <view class="mask-page" hidden="{{showMask}}"bindtap="maskTap"> </view><view class="musicList-page"hidden="{{showCouponListHide}}"><view class="musicList-page-head"><view class="musicList-page-body-list-left-infor">音樂列表({{musicListInformation.length}})</view><view class="musicList-page-body-list-icon"style="padding-right:3%"><i-icon type="trash_fill" size="20"/></view></view><view class="musicList-page-body"><scroll-view scroll-y><view class="musicList-page-body-list"wx:for="{{musicListInformation}}" wx:for-item='musicItem' wx:for-index='musicIndex' wx:key='{{musicIndex}}'><view class="musicList-page-body-list-left-infor"bindtap="musicMusicTap"data-index="{{musicIndex}}"> <view class="musicList-page-body-list-name">{{musicItem.name}}</view><view class="musicList-page-body-list-artistsname">-{{musicItem.artistsName}}</view></view><view class="musicList-page-body-list-icon"><i-icon type="close" size="17"/></view></view></scroll-view></view> </view><wxs module='parse'>module.exports={showText:function(res){if(res!=null && res!=''){return res;}else{return "天上天下,唯我獨尊,自觀自在,守本真心。"; }}} </wxs>5.css 樣式
/* pages/showplayer/index.wxss */ .applicationcontext-page{width: 100%;display: flex;flex-flow: column;background-image: url("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1574497461493&di=7bb0bee6e3c47fe1f90f7a2f28418791&imgtype=0&src=http%3A%2F%2Fwww.51pptmoban.com%2Fd%2Ffile%2F2012%2F06%2F06%2Fc6c6423a3661cc6e8ffcf47e52af4230.jpg");background-repeat: no-repeat no-repeat; }.showplery-page{display: flex;align-items: center;justify-content: center;width: 100%;height: 85%; }@keyframes iconRotate{0% {transform: rotate(0deg);}50% {transform: rotate(180deg);}100% {transform: rotate(360deg);} }.showplery-image-page{width: 500rpx;height: 500rpx;border-radius: 50% 50%;animation: iconRotate 20s linear infinite;}.bottom-up-page{display: flex;align-items: center;flex-flow: nowrap;width: 100%;height: 7.5%;background-color: #A15718;border-bottom: 1rpx solid #BD782D; }.bottom-dwon-page{display: flex;align-items: center;border-left-width: nowrap;width: 100%;height: 7.5%;background-color: #A15718; }.yuan-page{width:50rpx;height: 50rpx;border-radius: 50% 50%;border: 1rpx solid black;display: flex;justify-content: center;align-items: center;margin-left: 11%; }.icon-page-y{margin-left:20%; }.icon-page-y-b{margin-left: 11%; }.icon-imagesty{width: 100%;height: 100%; }.yuan-page-b{width:60rpx;height: 60rpx;border-radius: 50% 50%;display: flex;justify-content: center;align-items: center;margin-left: 10%; }@keyframes wordsLoop {0% {transform: translateX(200px);-webkit-transform: translateX(200px);}100% {transform: translateX(-100%);-webkit-transform: translateX(-100%);} }@-webkit-keyframes wordsLoop {0% {transform: translateX(200px);-webkit-transform: translateX(200px);}100% {transform: translateX(-100%);-webkit-transform: translateX(-100%);} }.show-textinfor{position: absolute;animation:20s wordsLoop linear infinite normal;font-size: 27rpx;color: white;font-weight: bold; }.show-textinfor-musicinfor{position: absolute;bottom: 350rpx;font-size: 33rpx;font-weight: bold;width: 100%;display: flex;justify-content: center;align-items: center;color: white; }.mask-page{width:100%;height: 100%;background:black;z-index: 2;opacity:0.7;position: fixed; bottom: 0rpx; }.musicList-page{width: 100%;height: 700rpx;background-color:#A15718; z-index: 3;position: fixed; bottom: 0rpx;border-radius: 30rpx 30rpx 0 0; }.musicList-page-head{width: 100%;height: 80rpx;display: flex;align-items: center;font-size: 25rpx;font-weight: bold;color: white;padding-left: 20rpx;border-bottom: 1rpx solid #BD782D;flex-flow: nowrap; }.musicList-page-body{width: 100%;height: 620rpx;display: flex; }.musicList-page-body-list{width: 100%;height: 80rpx;display: flex;align-items: center;color: white;flex-flow: nowrap; }.musicList-page-body-list-name{margin-left: 20rpx;font-weight: bold;font-size: 27rpx; }.musicList-page-body-list-artistsname{font-weight: bold;font-size: 23rpx;color: #ccc; }.musicList-page-body-list-icon{width:15%;display: flex;justify-content: center;align-items: center; }.musicList-page-body-list-left-infor{width:85%;display: flex;flex-flow: nowrap;align-items: center; }點擊下載項目地址
技術交流可聯系博主QQ:930210782
總結
以上是生活随笔為你收集整理的制作属于自己的一个微信小程序音乐播放器的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 小程序商城制作一个需要多少钱?一般包括哪
- 下一篇: nefuoj1487时空乱流