master
laptoy 2 years ago
parent 9778628324
commit f70351fc73

@ -1,31 +0,0 @@
/*
* Eslint config file
* Documentation: https://eslint.org/docs/user-guide/configuring/
* Install the Eslint extension before using this feature.
*/
module.exports = {
env: {
es6: true,
browser: true,
node: true,
},
ecmaFeatures: {
modules: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
globals: {
wx: true,
App: true,
Page: true,
getCurrentPages: true,
getApp: true,
Component: true,
requirePlugin: true,
requireMiniProgram: true,
},
// extends: 'eslint:recommended',
rules: {},
}

@ -1,4 +1,5 @@
# music # music1
![](截图1.png)
![](截图2.png) ![](1.png)
![](截图3.png) ![](2.png)
![](3.png)

@ -1,19 +0,0 @@
// app.js
App({
onLaunch() {
// 展示本地存储能力
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
},
globalData: {
userInfo: null
}
})

@ -1,13 +1,7 @@
{ {
"pages":[ "pages":[
"pages/index/index", "pages/index/index",
"pages/logs/logs" "pages/test/test"
], ]
"window":{
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "音乐",
"navigationBarTextStyle": "black"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
} }

@ -1,10 +0,0 @@
/* *app.wxss*
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
} */

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

@ -1,11 +1,74 @@
// index.js
// 获取应用实例
const app = getApp()
Page({ Page({
/**
* 页面的初始数据
*/
data: { data: {
item:0, item:0,
tab:0, tab:0,
// 播放器列表数据
playlist:[{
id:1,
title:"晴天",
singer:'周杰伦',
src:'http://localhost:3000/1.mp3',
converImgUrl:'../images/yhm.png'
},{
id:2,
title:"反方向的钟",
singer:'周杰伦',
src:'http://localhost:3000/2.mp3',
converImgUrl:'../images/yhm.png'
},{
id:3,
title:"兰亭序",
singer:'周杰伦',
src:'http://localhost:3000/3.mp3',
converImgUrl:'../images/yhm.png'
},{
id:4,
title:"青花瓷",
singer:'周杰伦',
src:'http://localhost:3000/4.mp3',
converImgUrl:'../images/yhm.png'
},{
id:5,
title:"本草纲目",
singer:'周杰伦',
src:'http://localhost:3000/4.mp3',
converImgUrl:'../images/yhm.png'
},{
id:6,
title:"爱在西元前",
singer:'周杰伦',
src:'http://localhost:3000/4.mp3',
converImgUrl:'../images/yhm.png'
},{
id:7,
title:"花海",
singer:'周杰伦',
src:'http://localhost:3000/4.mp3',
converImgUrl:'../images/yhm.png'
},{
id:8,
title:"半岛铁盒",
singer:'周杰伦',
src:'http://localhost:3000/4.mp3',
converImgUrl:'../images/yhm.png'
},{
id:9,
title:"轨迹",
singer:'周杰伦',
src:'http://localhost:3000/4.mp3',
converImgUrl:'../images/yhm.png'
},{
id:10,
title:"搁浅",
singer:'周杰伦',
src:'http://localhost:3000/4.mp3',
converImgUrl:'../images/yhm.png'
}
],
state:'paused', state:'paused',
playIndex:0, playIndex:0,
play:{ play:{
@ -14,85 +77,112 @@ Page({
percent:0, percent:0,
title:'', title:'',
singer:'', singer:'',
coverImgUrl:'./images/cover.jpg', // converImgUrl:'../images/cover.jpg'
coverImgUrl:'../images/yhm.png'
} }
}, },
changeItem:function(e){
audioCtx:null,
changeItem(e){
this.setData({ this.setData({
item:e.target.dataset.item item : e.target.dataset.item
}) })
}, },
changeTab:function(e){ changeTab(e){
this.setData({ this.setData({
tab:e.detail.current tab:e.detail.current
}) })
}, },
// 事件处理函数
bindViewTap() { /**
wx.navigateTo({ * 生命周期函数--监听页面加载
url: '../logs/logs' */
}) onLoad: function (options) {
}, },
onLoad() {
if (wx.getUserProfile) { /**
this.setData({ * 生命周期函数--监听页面初次渲染完成
canIUseGetUserProfile: true */
}) onReady: function () {
} this.audioCtx = wx.createInnerAudioContext();
this.setMusic(0);
}, },
playlist:[{ setMusic(index){
id:1,title:'钢琴协奏曲',singer:'肖邦', var music = this .data.playlist[index];
src:'',coverImgUrl:'./images/cover.jpg' this.audioCtx.src = music.src;
},{
id:2,title:'奏鸣曲',singer:'莫扎特',
src:'',coverImgUrl:'./images/cover.jpg'
},{
id:2,title:'奏鸣曲',singer:'莫扎特',
src:'',coverImgUrl:'./images/cover.jpg'
},{
id:2,title:'欢乐颂',singer:'贝多芬',
src:'',coverImgUrl:'./images/cover.jpg'
},{
id:2,title:'爱之梦',singer:'李斯特',
src:'',coverImgUrl:'./images/cover.jpg'
}],
audioCtx:null,
onReady:function(){
this.audioCtx=wx.cteateInnerAudioContext()
this.setMusic(0)
} ,
setMusic:function(index){
var music=this.data.playlist[index]
this.audioCtx.src=music.src
this.setData({ this.setData({
playIndex:index, playIndex: index,
'play.title':music.title, 'play.title': music.title,
'play.singer':music.singer, 'play.singer': music.singer,
'play.coverImgUrl':music.coverImgUrl, 'play.coverImgUrl': music.coverImgUrl,
'play.currentTime':'00:00', 'play.currentTime': '00:00',
'play.percent':0 'play.duration': '00:00',
'play.percent': 0
}) })
}, },
getUserProfile(e) {
// 推荐使用wx.getUserProfile获取用户信息开发者每次通过该接口获取用户个人信息均需用户确认开发者妥善保管用户快速填写的头像昵称避免重复弹窗 // 播放
wx.getUserProfile({ play: function() {
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 this.audioCtx.play();
success: (res) => { this.setData({state: 'running'})
console.log(res)
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
}, },
getUserInfo(e) {
// 不推荐使用getUserInfo获取用户信息预计自2021年4月13日起getUserInfo将不再弹出弹窗并直接返回匿名的用户个人信息 // 暂停
console.log(e) pause: function () {
this.setData({ this.audioCtx.pause();
userInfo: e.detail.userInfo, this.setData({state: 'paused'});
hasUserInfo: true },
})
// 下一曲
next: function() {
var index = this.data.playIndex >= this.data.playlist.length - 1 ? 0 : this.data.playIndex + 1
this. setMusic(index)
if (this .data.state == 'running') {
this.play()
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
} }
}) })

@ -1,6 +1,5 @@
{ {
"navigationBarBackgroundColor": "#fff", "navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "音乐", "navigationBarTitleText": "音乐",
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black"
"usingComponents": {}
} }

@ -1,39 +1,37 @@
<!--index.wxml--> <!-- 顶部 -->
<!-- <swiper current-item-id="c">
<swiper item-id="a" style="background-color: #ccc">0</swiper>
<swiper item-id="b" style="background-color: #ddd">0</swiper>
<swiper item-id="c" style="background-color:#eee">0</swiper>
</swiper> -->
<view class="tab"> <view class="tab">
<view class="tab-item {{tab==0?'active':''}}" bindtap="changeItem" data-item="0">音乐推荐</view> <view class="tab-item {{tab == 0 ? 'active' : ''}}" bindtap="changeItem" data-item="0">音乐推荐</view>
<view class="tab-item {{tab==1?'active':''}}" bindtap="changeItem" data-item="1">播放器</view> <view class="tab-item {{tab == 1 ? 'active' : ''}}" bindtap="changeItem" data-item="1">播放器</view>
<view class="tab-item {{tab==2?'active':''}}" bindtap="changeItem" data-item="2">播放列表</view> <view class="tab-item {{tab == 2 ? 'active' : ''}}" bindtap="changeItem" data-item="2">播放列表</view>
</view> </view>
<!-- 播放器 -->
<view class="content"> <view class="content">
<swiper current="{{item}}" bindtap="changeTab"> <swiper current="{{item}}" bindchange="changeTab">
<swiper-item> <swiper-item>
<include src="info.wxml"/> <include src="info.wxml"/>
</swiper-item> </swiper-item>
<swiper-item> <swiper-item>
<include src="play.wxml"/> <include src="play.wxml"/>
</swiper-item> </swiper-item>
<swiper-item> <swiper-item>
<include src="playlist.wxml"/> <include src="playlist.wxml"/>
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
<!-- 底部播放器 -->
<view class="player"> <view class="player">
<image class="player-cover" src="{{play.coverImgUrl}}"/> <image class="player-cover" src="{{play.coverImgUrl}}" />
<view class="play-info"> <view class="player-info">
<view class="play-info-title">{{play.title}}</view> <view class="player-info-title">{{play.title}}</view>
<view class="play-info-singer">{{play.singer}}</view> <view class="player-info-singer">{{play.singer}}</view>
</view>
<view class="player-controls">
<!--切换到播放列表-->
<image src="../images/01.png" bindtap="changePage" data-page="2" />
<!--播放或暂停-->
<image wx:if="{{state == 'paused'}}" src="../images/02.png" bindtap="play" />
<image wx:else src="../images/02stop.png" bindtap="pause" />
<!--下一曲-->
<image src="../images/03.png" bindtap="next" />
</view>
</view> </view>
<view class="player-controls">
<image src="./images/01.png" bindtap="changePage" data-page='2'/>
<image src="./images/02.png"/>
<image src="./images/03.png"/>
</view>
</view>

@ -1,37 +1,35 @@
page {
page{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background: #17181a; background: #17181a;
color: #ccc; color: #ccc;
height: 100%; height: 100%;
} }
.tab{ .tab{
display: flex; display: flex;
} }
.tab-item{ .tab-item{
flex: 1; flex:1;
font-size: 10pt; font-size: 10pt;
text-align: center; text-align: center;
line-height: 72rpx; line-height: 72rpx;
border-bottom: 6rpx solid #eee; border-bottom: 6rpx solid #eee;
} }
.content{ .tab-item.active{
color: #c25b5b;
border-bottom-color: #c25b5b;
}
.content {
flex: 1; flex: 1;
} }
.content>swiper{ .content > swiper{
height: 100%; height: 100%;
} }
.player{ .player{
background: #222; background: #222;
border-top: 1px solid #252525; border-top:1px solid #252525;
height: 112rpx; height: 112rpx;
} }
.tab-item.active{
color:#c25b5b;
border-bottom-color: #c25b5b;
}
.content-info{ .content-info{
height: 100%; height: 100%;
} }
@ -40,19 +38,21 @@ page{
height: 0; height: 0;
color: transparent; color: transparent;
} }
.content-info-slide { .content-info-slide{
height: 302rpx; height: 302rpx;
margin-top: 20px; margin-bottom: 20px;
} }
.content-info-slide image{ .content-info-slide image{
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
/* 功能按钮 */
.content-info-portal{ .content-info-portal{
display: flex; display: flex;
margin-bottom: 15px; margin-bottom: 15px;
} }
.content-info-portal>view{ .content-info-portal > view{
flex: 1; flex: 1;
font-size: 11pt; font-size: 11pt;
text-align: center; text-align: center;
@ -63,65 +63,142 @@ height: 100%;
display: block; display: block;
margin: 20rpx auto; margin: 20rpx auto;
} }
::-webkit-scrollbar{
width:0; /* 热门音乐 */
height:0;
color:transparent;
}
.content-info-list{ .content-info-list{
font-size: 11pt; font-size: 11pt;
margin-bottom:20rpx; margin-bottom: 20rpx;
} }
.content-info-list>.list-title{ .content-info-list > .list-title{
margin: 20rpx 35rpx; margin: 20rpx 35rpx;
} }
.content-info-list>.list-inner{ .content-info-list > .list-inner{
display:flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
margin:0 20rpx; margin: 0 20rpx;
} }
.content-info-list>.list-inner>.list-item{ .content-info-list > .list-inner > .list-item{
flex: 1; flex: 1;
} }
.content-info-list>.list-inner>.list-item>image{ .content-info-list > .list-inner > .list-item > image{
display: block; display: block;
width:200rpx; width: 200rpx;
height:200rpx; height: 200rpx;
margin:0 auto; margin: 0 auto;
border-radius: 10rpx; border-radius: 10rpx;
border:1rpx solid #555; border: 1rpx solid #555;
} }
.content-info-list>.list-inner>.list-item>view{ .content-info-list > .list-inner > .list-item > view{
width:200rpx; width: 200rpx;
margin:10rpx auto; margin: 10rpx auto;
font-size: 10pt; font-size: 10pt;
} }
.player{ /*播放器*/
display:flex; .content-play {
display: flex;
justify-content: space-around;
flex-direction: column;
height: 100%;
text-align: center ;
}
.content-play-info > view{
color: #888;
font-size: 11pt;
}
/*操放进度和时间*/
.content-play-progress{
display: flex;
align-items: center;
margin:0 35rpx;
font-size: 9pt;
text-align: center;
}
.content-play-progress > view {
flex: 1;
}
/*显示专辑页面样式*/
.content-play-cover image {
animation: rotateImage 10s linear infinite;
width: 400rpx;
height: 400rpx;
border-radius: 50%;
border: 1px solid #333 ;
}
@keyframes rotateImage {
from {
transform: rotate(0deg);
}
to{
transform: rotate(360deg);
}
}
/* 播放进度和时间 */
.content-play-progress{
display: flex;
align-items: flex;
margin: 0 35rpx;
font-size: 9pt;
text-align: center;
}
.content-play-progress > view {
flex: 1;
}
/* 底部播放器 */
.player {
display: flex;
align-items: center; align-items: center;
background: #222; background: #222;
border-top: 1px solid #252525; border-top: 1px solid #252525 ;
height: 112rpx; height: 112rpx;
} }
.player-cover{ .player-cover {
width:80rpx; width: 80rpx;
height:80rpx; height: 80rpx;
margin-left: 15rpx; margin-left: 15rpx;
border-radius: 8rpx; border-radius: 8rpx;
border: 1px solid #333; border: 1px solid #333 ;
} }
.play-info{ .player-info {
flex:1; flex: 1;
font-size: 10pt; font-size: 10pt;
line-height: 38rpx; line-height: 38rpx;
margin-left: 20rpx; margin-left: 20rpx;
padding-bottom: 8rpx; padding-bottom: 8rpx;
} }
.play-info-singer{ .player-info-singer {
color:#888; color: #888;
} }
.player-controls image{ .player-controls image {
width:80rpx; width: 80rpx;
height: 80rpx; height: 80rpx;
margin-right:15rpx ; margin-right: 15rpx;
}
.content-playlist{
height: 100%;
}
/* 播放列表 */
.playlist-item {
display: flex;
align-items: center;
border-bottom: 1rpx solid #333 ;
height: 112rpx;
}
.playlist-cover {
width: 20rpx;
height: 80rpx;
margin-left:15rpx;
border-radius: 8rpx;
border: 1px solid#333 ;
}
.playlist-info {
flex: 1;
font-size: 10pt;
line-height: 38rpx;
margin-left: 20rpx;
padding-bottom: 8rpx;
}
.playlist-info-singer {
color:#888;
} }

@ -1,55 +1,58 @@
<!-- 轮播图 -->
<scroll-view class="content-info" scroll-y> <scroll-view class="content-info" scroll-y>
<view style="background: rgb(17, 17, 17);height: 1000px;"> <swiper class="content-info-slide" indicator-color="rgba(255,255,255,.5)" indicator-active-color="#fff" indicator-dots circular autoplay>
<swiper class="content-info-slide" indicator-color="rgba(255,255,255)" indicator-active-color="#fff" indicator-dots circular autoplay> <swiper-item>
<swiper-item> <image src="../images/banner1.jpg"/>
<image src="./images/banner.jpg"/> </swiper-item>
</swiper-item> <swiper-item>
<swiper-item> <image src="../images/banner2.jpg"/>
<image src="./images/banner.jpg"/> </swiper-item>
</swiper-item> <swiper-item>
<swiper-item> <image src="../images/banner3.jpg"/>
<image src="./images/banner.jpg"/> </swiper-item>
</swiper-item> </swiper>
</swiper> <!-- 功能按钮 -->
<view class="content-info-portal"> <view class="content-info-portal">
<view> <view>
<image src="./images/04.png"/> <image src="../images/04.png"/>
<text>私人FM</text> <text>私人FM</text>
</view> </view>
<view> <view>
<image src="./images/05.png"/> <image src="../images/05.png"/>
<text>每日歌曲推荐</text> <text>每日歌曲推荐</text>
</view> </view>
<view> <view>
<image src="./images/06.png"/> <image src="../images/06.png"/>
<text>云音乐听歌榜</text> <text>云音乐新歌榜</text>
</view> </view>
</view> </view>
<view class="content-info-list">
<view class="content-info-list"> <view class="list-title">推荐歌曲</view>
<view class="list-title">推荐歌曲</view> <view class="list-inner">
<view class="list-inner"> <view class="list-item">
<view class="list-item"> <image src="../images/mjz.png"/>
<image src="./images/cover.jpg"/><view>紫罗兰</view> <view>稻香</view>
</view> </view>
<view class="list-item"> <view class="list-item">
<image src="./images/cover.jpg"/><view>菩提树</view> <image src="../images/qlx.png"/>
</view> <view>七里香</view>
<view class="list-item"> </view>
<image src="./images/cover.jpg"/><view>五月之歌</view> <view class="list-item">
</view> <image src="../images/syydxb.png"/>
<view class="list-item"> <view>夜曲</view>
<image src="./images/cover.jpg"/><view>欢乐颂</view> </view>
</view> <view class="list-item">
<view class="list-item"> <image src="../images/mjz.png"/>
<image src="./images/cover.jpg"/><view>安魂曲</view> <view>花海</view>
</view> </view>
<view class="list-item"> <view class="list-item">
<image src="./images/cover.jpg"/><view>摇篮曲</view> <image src="../images/ylxb.png"/>
</view> <view>一路向北</view>
</view>
</view> <view class="list-item">
</view> <image src="../images/yhm.png"/>
</view> <view>以父之名</view>
<view>已到达底部</view> </view>
</view>
</view>
</scroll-view> </scroll-view>

@ -1,3 +1,20 @@
<view style="background: #ddd; color: #000;height: 100%;"> <!-- 播放器 -->
play <view class="content-play">
<!--显示音乐信息-->
<view class="content-play-info">
<text>{{play.title}}</text>
<view>—— {{play.singer}} ——</view>
</view>
<!-- 显示专辑封面 -->
<view class="content-play-cover">
<image src="{{play.coverImgUrl}}" sty1e="animation-play-state:{{state}}" />
</view>
<!--显示播放进度和时间-->
<view class="content-play-progress">
<text>{{play.currentTime}}</text>
<view>
<slider bindchange="sliderChange" activeColor="#d33a31" block-size="12" backgroundColor="#dadada" value="{{play. percent}}" />
</view>
<text>{{play.duration}}</text>
</view>
</view> </view>

@ -1,3 +1,12 @@
<view style="background: #eee; color: #000;height: 100%;"> <scroll-view cclass="content-playlist" scroll-y>
playllist <view class="playlist-item" wx:for="{{playlist}}" wx:key="id" bindtap="change" data-index="{{index}}">
</view> <image class="playlist-cover" src="{{item.converImgUrl}}" />
<view class="playlist-info">
<view class="playlist-info-title">{{item.title}}</view>
<view cclass="playlist-info-singer">{{item.singer}}</view>
</view>
<view class="playlist-controls">
<text wx:if="{{index==playIndex}}">正在播放</text>
</view>
</view>
</scroll-view>

@ -1,18 +0,0 @@
// logs.js
const util = require('../../utils/util.js')
Page({
data: {
logs: []
},
onLoad() {
this.setData({
logs: (wx.getStorageSync('logs') || []).map(log => {
return {
date: util.formatTime(new Date(log)),
timeStamp: log
}
})
})
}
})

@ -1,4 +0,0 @@
{
"navigationBarTitleText": "查看启动日志",
"usingComponents": {}
}

@ -1,6 +0,0 @@
<!--logs.wxml-->
<view class="container log-list">
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log">
<text class="log-item">{{index + 1}}. {{log.date}}</text>
</block>
</view>

@ -1,8 +0,0 @@
.log-list {
display: flex;
flex-direction: column;
padding: 40rpx;
}
.log-item {
margin: 10rpx;
}

@ -1,27 +0,0 @@
// pages/swiper.js
Component({
/**
* 组件的属性列表
*/
properties: {
imgUrls:Array,
},
/**
* 组件的初始数据
*/
data: {
currentIndex:0,
},
/**
* 组件的方法列表
*/
methods: {
swiperChange(e){
this.setData({
currentIndex:e.detail.cuurrent
});
}
}
})

@ -1,2 +0,0 @@
<!--pages/swiper.wxml-->
<text>pages/swiper.wxml</text>

@ -1 +0,0 @@
/* pages/swiper.wxss */

@ -0,0 +1,68 @@
// pages/test/test.js
Page({
/**
* 页面的初始数据
*/
data: {
},
scroll:function(e){
console.log(e.detail)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

@ -1,4 +1,3 @@
{ {
"component": true,
"usingComponents": {} "usingComponents": {}
} }

@ -0,0 +1,11 @@
<scroll-view scroll-x scroll-y style="height:200px" bindscroll="srcll">
<view style="width:200%;height:400px;background: #ccc"></view>
</scroll-view>
<view>缩放模式测试</view>
<image style="width:200px;height:200px;background-color:#eee;"
mode="scaleToFill" src="/image/test.jpj">
</image>
<view>裁剪模式测试</view>
<image style="width:200px;height:200px;background-color:#eee;"
mode="scaleToFill" src="/image/test.jpg">
</image>

@ -0,0 +1 @@
/* pages/test/test.wxss */

@ -42,7 +42,7 @@
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.19.4", "libVersion": "2.19.4",
"appid": "wx1f22c2b8f0b59fc1", "appid": "wx43b4be9b6b720b57",
"projectname": "miniprogram-92", "projectname": "miniprogram-92",
"condition": {}, "condition": {},
"editorSetting": { "editorSetting": {

@ -1,6 +1,6 @@
{ {
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "miniprogram-5", "projectname": "miniprogram-6",
"setting": { "setting": {
"compileHotReLoad": true "compileHotReLoad": true
} }

@ -1,7 +0,0 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}

@ -1,19 +0,0 @@
const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : `0${n}`
}
module.exports = {
formatTime
}
Loading…
Cancel
Save