炫酷纯音乐小程序的设计与实现

小程序已上线,里面有很多我珍藏的好听的纯音乐哦,扫码直接体验:

如若无法正常使用说明我的服务器已经到期。

小程序的完整源码下载地址:https://download.csdn.net/download/qq_37518622/12313970

很久没有维护了,最近重新修改了下又上线了,这里提供的代码不是最新的和线上版本有些区别,刚学小程序的时候写的代码很烂,希望还能够有点作用

代码中的图片等资源自己找下哦

关注微信公众号ClumsyRobot获取更多资源:


 

猜歌小程序界面如下:

1、主界面

2、猜歌界面

3、排行榜界面

4、收藏音乐界面

5、抽积分界面

 

代码如下:

主界面

<!--index.wxml-->
<view class="container"><view class='item'><button open-type="getUserInfo" bindgetuserinfo="jumpguess" class="button big gray rounded">知音</button></view><view class='item'><button open-type="getUserInfo" bindgetuserinfo="jumprank" class="button big blue rounded">排行榜</button></view><view class='item'><button open-type="getUserInfo" bindgetuserinfo="jumpcollect" class="button big green rounded">音库</button></view><view class='item'><button open-type="getUserInfo" bindgetuserinfo="jumpluck" class="button big purple rounded">抽积分</button></view><view class='item'><button bindtap='jumpintroduction' class="button big orange rounded"><text>说明</text></button></view>
</view>
/**index.wxss**/
.container{width: 100%;height: 100%;background: grey;background: -moz-linear-gradient(top, grey 0%, #943bea 100%);background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, grey), color-stop(100%, #943bea));background: -webkit-linear-gradient(top, grey 0%, #943bea 100%);background: -o-linear-gradient(top, grey 0%, #943bea 100%);background: -ms-linear-gradient(top, grey 0%, #943bea 100%);background: linear-gradient(to bottom, grey 0%, #943bea 100%);background-size: 100% 100%;padding-top: 50px;}.container .item{display: inline-block;width: 230px;margin-bottom: 50px;margin-left: 17%;
}
.button{font:15px Calibri, Arial, sans-serif;/* A semi-transparent text shadow */text-shadow:1px 1px 0 rgba(255,255,255,0.4);/* Overriding the default underline styling of the links */text-decoration:none !important;white-space:nowrap;display:block;position:relative;cursor:pointer;padding:10px 20px;background-repeat:no-repeat;/* The following two rules are fallbacks, in casethe browser does not support multiple backgrounds. */background-position:bottom left;background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png');/* Multiple backgrounds version. The background imagesare defined individually in color classes */background-position:bottom left, top right, 0 0, 0 0;background-clip:border-box;/* Applying a default border raidus of 8px */-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px;/* A 1px highlight inside of the button */-moz-box-shadow:0 0 1px #fff inset;-webkit-box-shadow:0 0 1px #fff inset;box-shadow:0 0 1px #fff inset;/* Animating the background positions with CSS3 *//* Currently works only in Safari/Chrome */-webkit-transition:background-position 1s;-moz-transition:background-position 1s;transition:background-position 1s;
}/*.button:hover{*/.button:active{/* Moving the button 1px to the bottom when clicked */bottom:-1px;background-position:top left;background-position:top left, bottom right, 0 0, 0 0;
}/* The three buttons sizes */.button.big		{ font-size:30px;}
.button.medium	{ font-size:18px;}
.button.small	{ font-size:13px;}/* A more rounded button */.button.rounded{-moz-border-radius:4em;-webkit-border-radius:4em;border-radius:4em;
}/* Defining four button colors *//* BlueButton */.blue.button{color:#0f4b6d !important;border:1px solid #84acc3 !important;/* A fallback background color */background-color: #48b5f2;/* Specifying a version with gradients according to */background-image:	url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'),-moz-radial-gradient(	center bottom, circle,rgba(89,208,244,1) 0,rgba(89,208,244,0) 100px),-moz-linear-gradient(#4fbbf7, #3faeeb);background-image:	url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'),-webkit-gradient(	radial, 50% 100%, 0, 50% 100%, 100,from(rgba(89,208,244,1)), to(rgba(89,208,244,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#4fbbf7), to(#3faeeb));
}.blue.button:hover{background-color:#63c7fe;background-image:	url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'),-moz-radial-gradient(	center bottom, circle,rgba(109,217,250,1) 0,rgba(109,217,250,0) 100px),-moz-linear-gradient(#63c7fe, #58bef7);background-image:	url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'),-webkit-gradient(	radial, 50% 100%, 0, 50% 100%, 100,from(rgba(109,217,250,1)), to(rgba(109,217,250,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#63c7fe), to(#58bef7));
}/* Green Button */.green.button{color:#345903 !important;border:1px solid #96a37b !important;	background-color: #79be1e;background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -moz-radial-gradient(center bottom, circle, rgba(162,211,30,1) 0,rgba(162,211,30,0) 100px),-moz-linear-gradient(#82cc27, #74b317);background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -webkit-gradient(radial, 50% 100%, 0, 50% 100%, 100, from(rgba(162,211,30,1)), to(rgba(162,211,30,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#82cc27), to(#74b317));
}.green.button:hover{background-color:#89d228;background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -moz-radial-gradient(center bottom, circle, rgba(183,229,45,1) 0,rgba(183,229,45,0) 100px),-moz-linear-gradient(#90de31, #7fc01e);background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -webkit-gradient(radial, 50% 100%, 0, 50% 100%, 100, from(rgba(183,229,45,1)), to(rgba(183,229,45,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#90de31), to(#7fc01e));
}/* Orange Button */.orange.button{color:#693e0a !important;border:1px solid #bea280 !important;	background-color: #e38d27;background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -moz-radial-gradient(center bottom, circle, rgba(232,189,45,1) 0,rgba(232,189,45,0) 100px),-moz-linear-gradient(#f1982f, #d4821f);background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -webkit-gradient(radial, 50% 100%, 0, 50% 100%, 100, from(rgba(232,189,45,1)), to(rgba(232,189,45,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#f1982f), to(#d4821f));
}.orange.button:hover{background-color:#ec9732;background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -moz-radial-gradient(center bottom, circle, rgba(241,192,52,1) 0,rgba(241,192,52,0) 100px),-moz-linear-gradient(#f9a746, #e18f2b);background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -webkit-gradient(radial, 50% 100%, 0, 50% 100%, 100, from(rgba(241,192,52,1)), to(rgba(241,192,52,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#f9a746), to(#e18f2b));
}.gray.button{color:#525252 !important;border:1px solid #a5a5a5 !important;	background-color: #a9adb1;background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -moz-radial-gradient(center bottom, circle, rgba(197,199,202,1) 0,rgba(197,199,202,0) 100px),-moz-linear-gradient(#c5c7ca, #92989c);background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -webkit-gradient(radial, 50% 100%, 0, 50% 100%, 100, from(rgba(197,199,202,1)), to(rgba(197,199,202,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#c5c7ca), to(#92989c));
}.gray.button:hover{background-color:#b6bbc0;background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -moz-radial-gradient(center bottom, circle, rgba(202,205,208,1) 0,rgba(202,205,208,0) 100px),-moz-linear-gradient(#d1d3d6, #9fa5a9);background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -webkit-gradient(radial, 50% 100%, 0, 50% 100%, 100, from(rgba(202,205,208,1)), to(rgba(202,205,208,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#d1d3d6), to(#9fa5a9));
}.purple.button{color:#525252 !important;border:1px solid #a5a5a5 !important;	background-color: #a020f0;background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -moz-radial-gradient(center bottom, circle, rgba(106,90,205,1) 0,rgba(106,90,205,0) 100px),-moz-linear-gradient(#8470FF, #7B68EE);background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -webkit-gradient(radial, 50% 100%, 0, 50% 100%, 100, from(rgba(255,236,139,1)), to(rgba(238,220,130,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#FFEC8B), to(#EEDC82));
}.purple.button:hover{background-color:#a020f0;background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -moz-radial-gradient(center bottom, circle, rgba(106,90,205,1) 0,rgba(106,90,205,0) 100px),-moz-linear-gradient(#8470FF, #7B68EE);background-image:url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), url('https://nanmatou.club/files/zhiyin/icons/button_bg.png'), -webkit-gradient(radial, 50% 100%, 0, 50% 100%, 100, from(rgba(255,236,139,1)), to(rgba(238,220,130,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#FFEC8B), to(#EEDC82));
}
//index.js
//获取应用实例
const app = getApp()
var index=0;
Page({data: {userInfo: {},hasUserInfo: false,canIUse: wx.canIUse('button.open-type.getUserInfo'),},jumpguess:function(e){app.globalData.userInfo = e.detail.userInfowx.navigateTo({url: '../guess/guess'})},jumprank: function (e) {app.globalData.userInfo = e.detail.userInfowx.navigateTo({url: '../ranklist/ranklist'})},jumpcollect: function (e) {app.globalData.userInfo = e.detail.userInfowx.navigateTo({url: '../collectList/collectList'})},jumpluck: function (e) {app.globalData.userInfo = e.detail.userInfowx.navigateTo({url: '../luck/luck'})},jumpintroduction: function (e) {wx.navigateTo({url: '../introduction/introduction'})},})

 

猜歌

 

<!--guess.wxml-->
<view class="container"><block><image class="play-icon {{isRotation?'rotation':''}}" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1524222813702&di=1b2468eebc105b308f8318da8e5a9b74&imgtype=0&src=http%3A%2F%2Fpic.qiantucdn.com%2F58pic%2F15%2F60%2F68%2F06T58PICw3s_1024.jpg" background-size="cover" bindtap='clickPlayIcon'></image><image class="tip-icon" src="https://nanmatou.club/files/zhiyin/icons/tip1.png" background-size="cover" bindtap='getTip'></image></block> <view class="footer"><view class="{{showVoiceIcon?'sendmessage':'sendmessage-hidden'}}"><image src='https://nanmatou.club/files/zhiyin/icons/record.png' bindtap='clickSmallRecordIcon'></image><input type="text" bindinput="answerInput" confirm-type="done" value='{{answerInput}}' placeholder="输入答案" maxlength='20' /><button type='primary' bindtap='submitAnswer' class="blue btn button">发送</button><input style='display:none' type="" bindinput="bindChange" confirm-type="done" placeholder="" /></view><view class="{{showVoiceIcon?'sendVoice':'sendVoice-hidden'}}"><view class="dot" bindtouchstart='startRecord' bindtouchend='endRecord'></view><view class="{{palseVisible?'':'pause-hidden'}}"><view class="pulse"></view><view class="pulse1"></view></view></view><!-- <audio src="{{src}}" id="music"></audio> --></view>
</view>
/**guess.wxss**/
.container {height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: space-between;padding-top: 100px;box-sizing: border-box;background-image: url('http://img.zcool.cn/community/01eacf5543e0210000019ae90753a1.jpg');background-size: cover;
} .container .play-icon {width: 256rpx;height: 256rpx;margin: 20rpx;border-radius: 50%;
}.container .tip-icon{width: 100rpx;height: 100rpx;position: absolute;top:10px;margin-left:40%;
}@-webkit-keyframes rotation {from {-webkit-transform: rotate(0deg);
}to {-webkit-transform: rotate(360deg);
}}.rotation {-webkit-transform: rotate(360deg);animation: rotation 8s linear infinite;-moz-animation: rotation 8s linear infinite;-webkit-animation: rotation 8s linear infinite;-o-animation: rotation 8s linear infinite;
}.footer{margin-top: 76%;width: 100%;
} 
.footer .sendmessage {background-image: url('https://nanmatou.club/files/zhiyin/icons/bg.jpg');opacity:0.7;width: 100%;/* bottom: 0rpx; */height: 45px;display: flex;flex-direction: row;padding-top: 15px;margin-top: -185px;
}.footer .sendmessage-hidden {background-image: url('https://nanmatou.club/files/zhiyin/icons/bg.jpg');opacity:0.7;width: 100%;/* bottom: 0rpx; */height: 45px;display: flex;flex-direction: row;padding-top: 15px;
}.footer .sendmessage image,.sendmessage-hidden image {width: 34px;height: 34px;background: #fff;color: #000;line-height: 40px;font-size: 14px;border-radius: 100%;margin-left: 3%;
}.footer .sendmessage input,.sendmessage-hidden input {width: 65%;height: 30px;background-color: white;line-height: 40px;font-size: 14px;border: none;margin-left: 7px;padding-left: 5px;box-shadow: 1px 1px 5px #B6B6B6;border-radius: 8px;text-shadow: 1px 1px 1px #9E3F3F;
}.footer .sendmessage button,.sendmessage-hidden button {width: 15%;height: 30px;background: lightblue;color: white;line-height: 30px;font-size: 10px;margin-left: 10px;-webkit-animation-name: bluePulse;-webkit-animation-duration: 2s;-webkit-animation-iteration-count: infinite;
} .footer .sendVoice {width: 100%;height: 165px;padding-top: 20px;padding-left: 34%;opacity: 1;background: rgba(255, 255, 255, 0.23);
}/* .footer .sendVoice image{width: 100px;height: 150px; margin-left: 3%;
} */.footer .sendVoice text{margin-top:5px;display: block;margin-left: 6%;
}.footer .sendVoice-hidden {display: none;
}@-webkit-keyframes bluePulse {from { background-color: #0D8BA5; -webkit-box-shadow: 0 0 9px #333; }50% { background-color: #00BFFF; -webkit-box-shadow: 0 0 18px #00BFFF; }to { background-color: #1392AA; -webkit-box-shadow: 0 0 9px #333; }
}audio{display: none;
}/*点击录音的CSS*/.footer .dot {position: absolute;width: 92px;height: 92px;margin-left: 2%;top: 420px;-webkit-border-radius: 50%;-moz-border-radius: 50%;border: 2px solid red;border-radius: 50%;z-index: 2;
}.footer .pulse {position: absolute;width: 320px;height: 320px;left: 3%;top: 302px;border: 6px solid red;-webkit-border-radius: 50%;-moz-border-radius: 50%;border-radius: 50%;z-index: 1;opacity: 0;-webkit-animation: warn 2s ease-out;-moz-animation: warn 2s ease-out;animation: warn 2s ease-out;-webkit-animation-iteration-count: infinite;-moz-animation-iteration-count: infinite;animation-iteration-count: infinite;box-shadow: 1px 1px 30px red;
}.footer .pulse1 {position: absolute;width: 320px;height: 320px;left: 3%;top: 302px;border: 6px solid red;-webkit-border-radius: 50%;-moz-border-radius: 50%;border-radius: 50%;z-index: 1;opacity: 0;-webkit-animation: warn1 2s ease-out;-moz-animation: warn1 2s ease-out;animation: warn1 2s ease-out;-webkit-animation-iteration-count: infinite;-moz-animation-iteration-count: infinite;animation-iteration-count: infinite;box-shadow: 1px 1px 30px red;
}.pause-hidden{display: none;
}
@keyframes warn{0% {transform: scale(0.3);-webkit-transform: scale(0.3);opacity: 0.0;}25% {transform: scale(0.3);-webkit-transform: scale(0.3);opacity: 0.1;}50% {transform: scale(0.5);-webkit-transform: scale(0.5);opacity: 0.3;}75% {transform: scale(0.8);-webkit-transform: scale(0.8);opacity: 0.5;}100% {transform: scale(1);-webkit-transform: scale(1);opacity: 0.0;}
}@keyframes warn1{0% {transform: scale(0.3);-webkit-transform: scale(0.3);opacity: 0.0;}25% {transform: scale(0.3);-webkit-transform: scale(0.3);opacity: 0.1;}50% {transform: scale(0.3);-webkit-transform: scale(0.3);opacity: 0.3;}75% {transform: scale(0.5);-webkit-transform: scale(0.5);opacity: 0.5;}100% {transform: scale(0.8);-webkit-transform: scale(0.8);opacity: 0.0;}
}

 

//guess.js
//获取应用实例
const app = getApp() 
var userId;//存储userId
var musicId;//musicId
var musicUrl;//music的地址
var answer;//答案
var chance;//答题机会
var needChance;//兑换机会数
var currentAnswer='当前没有播放音乐';//答案(音乐名)
var recordFlag=0;//录音标识
var hasNextMusic=true;//当前用户是否还未全部答出歌
// const innerAudioContext = wx.createInnerAudioContext()//音频上下文
const backgroundAudioManager = wx.getBackgroundAudioManager()
// innerAudioContext.onPlay(() => {
//   console.log('开始播放')
// })
// innerAudioContext.onError((res) => {
//   console.log("播放音乐时发生错误")
// })
//录音用的
const recorderManager = wx.getRecorderManager()const options = {duration: 60000,sampleRate: 16000,numberOfChannels: 1,format: 'mp3',encodeBitRate: 24000//frameSize: 50
}Page({data: {userInfo: {},hasUserInfo: false,canIUse: wx.canIUse('button.open-type.getUserInfo'),showVoiceIcon: false,//是否显示大录音图标palseVisible: false,answerInput: '',//清空文本框用的isRotation: false,//播放图标是否旋转},onLoad: function (options) {console.log("加载到信息:" + app.globalData.userInfo)if (app.globalData.userInfo) {this.setData({userInfo: app.globalData.userInfo,hasUserInfo: true})} else if (this.data.canIUse){// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回// 所以此处加入 callback 以防止这种情况app.userInfoReadyCallback = res => {this.setData({userInfo: res.userInfo,hasUserInfo: true})}} else {// 在没有 open-type=getUserInfo 版本的兼容处理wx.getUserInfo({success: res => {app.globalData.userInfo = res.userInfothis.setData({userInfo: res.userInfo,hasUserInfo: true})}    })}wx.getStorage({key: 'userId',success: function (res) {userId = res.data;console.log("首次加载页面时取到userId:" + res.data)},fail: function () {//do nothing}})},onUnload:function(){console.log("hide")backgroundAudioManager.stop();},//注册用户
registerUser: function(){wx.request({url: app.globalData.globalReqUrl+'/user/add',data: {avatarUrl: app.globalData.userInfo.avatarUrl,city: app.globalData.userInfo.city,country: app.globalData.userInfo.country,gender: app.globalData.userInfo.gender,nickname: app.globalData.userInfo.nickName,language: app.globalData.userInfo.language,province: app.globalData.userInfo.province},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {if (res.data.code != 4001) {userId = res.data.content;console.log("新增或清除本地数据的用户的ID是:" + userId)//设置缓存wx.setStorage({key: "userId",data: userId})wx.showToast({title: '初始化信息成功',icon: 'success',duration: 1000})}},fail: function () {console.log("新增用户的请求失败");}})
},//得到用户信息getUserInfoByStorage: function() {var that = this;console.log("获取到的授权信息为:"+app.globalData.userInfo)//先从本地存储取userId,如果没有的话就注册wx.getStorage({key: 'userId',success: function (res) {if (res.data == undefined || res.data == 'undefined'){that.registerUser();}else{userId = res.data;}console.log("从本地取到userId:" + res.data)},fail: function () {that.registerUser();}})},//监听输入框事件
answerInput: function (e) {this.setData({answer: e.detail.value})
},//随机出题
getRandomMusic: function(){wx.request({url: app.globalData.globalReqUrl+'/music/getRandomMusic',data: {userId: userId},header: {'content-type': 'application/x-www-form-urlencoded' // 默认值},method: 'POST',success: function (res) {if (res.data.content!=-1){musicId = res.data.content.id;musicUrl = res.data.content.url;currentAnswer = res.data.content.name;backgroundAudioManager.title = '壹曲觅知音'backgroundAudioManager.singer = '细肥尸丁'backgroundAudioManager.coverImgUrl = 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1524222813702&di=1b2468eebc105b308f8318da8e5a9b74&imgtype=0&src=http%3A%2F%2Fpic.qiantucdn.com%2F58pic%2F15%2F60%2F68%2F06T58PICw3s_1024.jpg'backgroundAudioManager.src = musicUrl// 设置了 src 之后会自动播放 console.log("音乐关键字:" + res.data.content.keywords)console.log("音乐URL:" + res.data.content.url)}else{hasNextMusic=false;wx.showToast({title: '乐库的音乐全部猜对了,敬请期待更多音乐',icon: 'none',duration: 2000})}},fail: function () {console.log("请求音乐失败")}})
},getUserChance:function(){var that = this;if (userId == undefined||userId=='undefined'){that.getUserInfoByStorage();console.log("getUserInfo时得到的userId:" + userId);}else{//先从本地存储取userId,如果没有的话就注册wx.getStorage({key: 'userId',success: function (res) {userId = res.data;console.log("点击播放按钮是加载到userID:" + userId)wx.request({url: app.globalData.globalReqUrl+'/user/getUserInfo',data: {id: userId},header: {'content-type': 'application/x-www-form-urlencoded' // 默认值},method: 'POST',success: function (res) {chance = res.data.content.chancesconsole.log("用户还有" + chance + "次机会")},fail: function () {console.log("更新用户机会失败")}})},fail: function () {that.registerUser();}})}},//点击发送按钮事件
submitAnswer: function(){var that = this;wx.getStorage({key: 'userId',success: function (res) {userId = res.data;console.log("从本地取到userId:" + res.data)console.log("发送的musicId是:" + musicId);console.log("发送的答案是:" + that.data.answer);answer = that.data.answer;that.setData({answerInput: ''});console.log(musicId)if(musicId!=undefined){that.answerByText();}else{wx.showToast({title: '请先播放音乐再识音',icon: 'none',duration: 1000})}},fail: function(){that.getUserInfoByStorage();if (musicId != undefined) {that.answerByText();}else{wx.showToast({title: '请先播放音乐再识音',icon: 'none',duration: 1000})}}});},answerByText: function () {var that = this;wx.request({url: app.globalData.globalReqUrl+'/user/answerByText',data: {userId: userId,musicId: musicId,answer: answer},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {console.log("文字结果:"+res.data)wx.showToast({title: res.data.msg,icon: 'success',duration: 2000})if (res.data.code == 1001) {//正确就换歌that.getRandomMusic();}if (res.data.code == 4003){that.registerUser();}},fail: function () {console.log("答题请求失败")},complete: function () {}})
},clickSmallRecordIcon: function () {var that = this;that.setData({showVoiceIcon: (!that.data.showVoiceIcon)})},clickPlayIcon: function(){console.log("点击播放按钮时得到:"+app.globalData.userInfo)var that = this;if (app.globalData.userInfo == undefined || app.globalData.userInfo==null){wx.showModal({content: '您没授予壹曲觅知音获得用户信息的权限,是否去设置打开?',confirmText: "确认",cancelText: "取消",success: function (res) {console.log(res);//点击“确认”时打开设置页面if (res.confirm) {console.log('用户点击确认')wx.openSetting({success: (res) => {wx.getUserInfo({success: res => {app.globalData.userInfo = res.userInfothat.getUserInfoByStorage();}})}})} else {console.log('用户取消授权')}}});}else{var that = this;console.log("是否在旋转状态"+that.data.isRotation)if (!that.data.isRotation) {// that.getUserChance();var that = this;if (userId == undefined || userId == 'undefined') {that.getUserInfoByStorage();console.log("有权限时点击播放按钮userId为undefined")}else{wx.request({url: app.globalData.globalReqUrl+'/user/getUserInfo',data: {id: userId},header: {'content-type': 'application/x-www-form-urlencoded' // 默认值},method: 'POST',success: function (res) {chance = res.data.content.chancesconsole.log("用户还有" + chance + "次机会")if (chance <= 0) {wx.showModal({title: '免费机会已用完',content: '是否使用积分兑换机会',success: function (res) {if (res.confirm) {wx.showActionSheet({itemList: ['10次机会', '5次机会', '3次机会', '2次机会', '1次机会'],success: function (res) {needChance = res.tapIndexthat.convertBanlanceToChance();},fail: function (res) {console.log(res.errMsg)}})} else if (res.cancel) {console.log('用户点击取消')}}})} else {that.setData({isRotation: (!that.data.isRotation),})that.getRandomMusic();}},fail: function () {console.log("更新用户机会失败")}})}} else {backgroundAudioManager.stop()//停止播放if(hasNextMusic){      wx.request({url: app.globalData.globalReqUrl+'/user/cutSong',data: {userId: userId},header: {'content-type': 'application/x-www-form-urlencoded' // 默认值},method: 'POST',success: function (res) {console.log("切歌"+res.data.msg) wx.showToast({title: '消耗了一次猜歌机会',icon: 'none',duration: 1000})},fail: function () {console.log("切歌请求失败")}})}that.setData({isRotation: (!that.data.isRotation),})}}},//录音键长按按钮startRecord: function (e) {console.log(recordFlag)if(recordFlag==0){recordFlag=recordFlag+1;}else{var that = this;// 设置询问wx.authorize({scope: 'scope.record',success(res) {recorderManager.start(options)wx.showLoading({title: '正在录音',})that.setData({palseVisible: true})},fail(res) {wx.showModal({content: '您没授予壹曲觅知音录音的权限,是否去设置打开?',confirmText: "确认",cancelText: "取消",success: function (res) {console.log(res);//点击“确认”时打开设置页面if (res.confirm) {console.log('用户点击确认')wx.openSetting({success: (res) => {}})} else {console.log('用户取消授权')}}});},})}},endRecord: function (e) {var that = this;wx.hideLoading()recorderManager.stop()that.setData({palseVisible: false})wx.showLoading({title: '正在解析',})setTimeout(function () {wx.hideLoading()}, 1000)recorderManager.onStop((res) => {var that = this;var tempFilePath = res.tempFilePath;wx.getStorage({key: 'userId',success: function (res) {userId = res.data;console.log("从本地取到userId:" + userId)console.log("发送的musicId是:" + musicId);console.log("发送的录音文件路径是:" + tempFilePath);if(musicId!=undefined){wx.uploadFile({url: app.globalData.globalReqUrl+'/user/answerByVoice',filePath: tempFilePath,name: 'file',formData: {userId: userId,musicId: musicId,},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {console.log(res.data)var temp = res.datavar msgStart = temp.lastIndexOf(':');var msgEnd = temp.lastIndexOf('"');var msg = temp.substring(msgStart + 2, msgEnd)var codeStart = temp.indexOf(":");var codeEnd = temp.indexOf(',');var code = temp.substring(codeStart + 1, codeEnd)console.log("语音回答后得到消息:" + msg)console.log("语音回答后得到代码:" + code)wx.showToast({title: msg,icon: 'none',duration: 1000})if (code == 1001) {console.log("语音答对了")that.getRandomMusic();}if (code == 4003) {that.registerUser();}},fail: function (res) {console.log("答题请求失败")}})}else{wx.showToast({title: '请先播放音乐再识音',icon: 'none',duration: 2000})}},fail: function () {console.log("获取localstorage失败")that.registerUser();},});})recorderManager.onError((res) => {console.log('录音时间太短:' + res.errMsg)wx.showToast({title: '录音时间太短',icon: 'none',duration: 1000})})},convertBanlanceToChance:function(){console.log(needChance)console.log(userId)wx.request({url: app.globalData.globalReqUrl+'/user/convertBanlanceToChance',data: {userId: userId,chanceNum: needChance},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {console.log(res.data.msg)wx.showToast({title: res.data.msg,icon: 'none',duration: 2000})},fail: function () {console.log("答题请求失败")}})},getTip: function(){var that = this;if (currentAnswer != '当前没有播放音乐'){wx.showModal({title: '获取答案',content: '是否使用5积分获取答案',success: function (res) {if (res.confirm) {wx.request({url: app.globalData.globalReqUrl+'/user/getTipByBalance',data: {userId: userId},header: {'content-type': 'application/x-www-form-urlencoded' // 默认值},method: 'POST',success: function (res) {if (res.data.code == 2001){that.setData({answerInput: currentAnswer,answer: currentAnswer});wx.showToast({title: currentAnswer,icon: 'success',duration: 2000})}else{wx.showToast({title: res.data.msg,icon: 'none',duration: 2000})}},fail: function () {console.log("更新用户机会失败")}})} else if (res.cancel) {console.log('用户获取答案取消')}}})}else{wx.showToast({title: currentAnswer,icon: 'none',duration: 2000})}}})

排行榜

<!--ranklist.wxml-->
<view class="container"><view class="header"><text class='text1' bindtap='moveTabR'>知音榜</text><text class='text2' bindtap='moveTabL'>积分榜</text><view class='bg {{tabPosition}}'></view><!-- <view class='tab'>积分榜</view> --></view><scroll-view class="list" scroll-y bindscrolltolower="{{hasReachBottom}}"><view wx:for-items="{{key}}" wx:key="item" wx:for-index="index"><view class="item"><text class="index">{{index+1}}</text><image class="avatar" src="{{item.avatarUrl}}"></image><view class="left"><text wx:if="{{item.gender==1}}" class="male">♂</text><text wx:elif="{{item.gender==2}}" class="female">♀</text><text wx:else class="unknow">ET</text><text class="nickname">{{item.nickname}}</text><text wx:if="{{item.city!=''}}" class="city">来自:{{item.city}}</text><text wx:else class="city">来自:外星</text></view><view class="right"><text class="solve">{{tabPosition=='transformL'?'获得 '+item.balance+' 积分':'知音 '+item.solveCount+' 首'}}</text><text wx:if="{{item.type==0}}" class="type">普通群众</text><text wx:elif="{{item.type==1}}" class="type">开发者好友</text><text wx:elif="{{item.type==2}}" class="type">普通VIP</text><text wx:elif="{{item.type==3}}" class="type">至尊VIP</text><text wx:else class="type">开发者</text></view></view></view></scroll-view><view class="list"><view class="me"><text class="index">{{me.rank==NaN?'∞':me.rank}}</text><image class="avatar" src="{{me.avatarUrl==undefined?'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1524222813702&di=1b2468eebc105b308f8318da8e5a9b74&imgtype=0&src=http%3A%2F%2Fpic.qiantucdn.com%2F58pic%2F15%2F60%2F68%2F06T58PICw3s_1024.jpg':me.avatarUrl}}"></image><view class="left"><text wx:if="{{me.gender==1}}" class="male">♂</text><text wx:elif="{{me.gender==2}}" class="female">♀</text><text wx:else class="unknow">ET</text><text class="nickname">{{me.nickname==undefined?'未授权用户':me.nickname}}</text><text wx:if="{{me.city.length>0}}" class="city">来自:{{me.city}}</text><text wx:else class="city">来自:外星</text></view><view class="right"><text wx:if="{{me.solveCount!=undefined&&me.balance!=undefined}}" class="solve">{{tabPosition=='transformL'?'获得 '+me.balance+' 积分':'知音 '+me.solveCount+' 首'}}</text><text wx:else class="solve">{{tabPosition=='transformL'?'获得 0 积分':'知音 0 首'}}</text><text wx:if="{{me.type==4}}" class="type">开发者</text><text wx:elif="{{me.type==1}}" class="type">开发者好友</text><text wx:elif="{{me.type==2}}" class="type">普通VIP</text><text wx:elif="{{me.type==3}}" class="type">至尊VIP</text><text wx:else class="type">普通用户</text></view></view></view>
</view>
 
/**ranklist.wxss**/
@import "../../bootstrap.wxss";
.container{width: 100%;height: 100%;background: #1DC7EA;background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #1DC7EA), color-stop(100%, #4091ff));background: -webkit-linear-gradient(top, #1DC7EA 0%, #4091ff 100%);background: -o-linear-gradient(top, #1DC7EA 0%, #4091ff 100%);background: -ms-linear-gradient(top, #1DC7EA 0%, #4091ff 100%);background: linear-gradient(to bottom, #1DC7EA 0%, #4091ff 100%);overflow-y:hidden;
}.header{height:45px;width: 91%;flex-direction:row;color: #FFFFFF;opacity: 1;background: rgba(255, 255, 255, 0.23);margin-top:10px;margin-bottom: 5px;border-radius: 10px;}
.header .text1{position: absolute;margin-left:13%; font-size: 27px;margin-top:3px;
}
.header .text2{position: absolute;margin-left:57%; font-size: 27px;margin-top:3px;
}
.header .bg{height:45px;width: 50%;display: inline-block;flex-direction:row;color: whitesmoke;opacity: 1;background: rgba(0, 255, 255, 0.63);border-radius: 10px;z-index: -1;}
.transformL{animation:moveToRight 1s forwards;
}
.transformR{animation:moveToLeft 1s forwards;
}
@keyframes moveToRight{0%{margin-left: 0%; }100%{margin-left: 50%; }
}
@keyframes moveToLeft{0%{margin-left: 50%;  }100%{margin-left: 0%; }
}.list{height:400px;
}
.footer{height: 30px;
}.list .item{width: 91%;height: 75px;display: flex;flex-direction:row;color: #FFFFFF;opacity: 1;background: rgba(255, 255, 255, 0.23);margin-top:10px;margin-bottom: 10px;border-radius: 10px;
}.list .me{width: 91%;height: 75px;display: flex;flex-direction:row;color: #FFEEEF;opacity: 1;background: rgba(0, 255, 255, 0.63);margin-top:10px;margin-bottom: 10px;border-radius: 10px;
}.list .index{margin-top: 23px;margin-left: 15px;margin-right: 10px;color: greenyellow;
}.list .avatar{width: 50px;height: 50px;display: flex;border-radius: 50%;align-items: center;justify-content: center;overflow: hidden;margin-top: 12px;
}.list .left{display: inline-block;margin-top: 10px;text-overflow:ellipsis;width: 130px;overflow:hidden;white-space:nowrap;
}.list .male{font-size: 20px;margin-top: 10px;margin-left: 5px;color: blue;
}.list .female{font-size: 20px;margin-top: 10px;margin-left: 5px;color: plum;
}.list .unknow{font-size: 20px;margin-top: 10px;margin-left: 5px;color: black
}.list .nickname{font-size: 20px;margin-top: 10px;margin-left: 1px;
}.list .city{margin-top: 5px;margin-left: 5px;display:block;font-size: 15px;
}.list .right{display: inline-block;position: absolute;margin-left: 60%;margin-top: 15px;
}.list .solve{font-size: 15px;display: block;
}.list .type{margin-top: 5px;display:block;font-size: 15px;color: gold;
}

 

 

 

 

 

//ranklist.js
const app = getApp()
var user;
var userId;
var users;
var page=1;
Page({data: {userInfo: {},hasUserInfo: false,canIUse: wx.canIUse('button.open-type.getUserInfo'),mode: 1,hasReachBottom: "lower",tabPosition:''},//事件处理函数bindViewTap: function() {wx.navigateTo({url: '../logs/logs'})},onLoad: function (options) {var that = this;that.getRankList();that.getUserInfoByStorage();},//得到排行榜数据getRankList:function(){var that =this;page=1;wx.request({url: app.globalData.globalReqUrl+'/user/getRankList',data: {pageNum: page,pageSize: 10,mode: that.data.mode},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {users = res.data.contentconsole.log('得到的用户数据为:' + users)that.setData({key: users,page: page});},fail: function () {console.log("请求用户失败")}})},appendRankList:function(){var that = this;// 页数+1  page = page + 1;console.log("当前页:" + page)wx.request({url: app.globalData.globalReqUrl+'/user/getRankList',data: {pageNum: page,pageSize: 10,mode: that.data.mode},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {console.log(res.data.content.length)if (res.data.content.length>0) {users = users.concat(res.data.content);console.log('追加了用户数据,数据长度:' + users.length)that.setData({key: users,page: page});} else {that.setData({hasReachBottom: 'reachBottom'})}// 隐藏加载框  wx.hideLoading();},fail: function () {console.log("请求用户失败")}})},lower: function () {console.log('上拉了')var that = this;// 显示加载图标  wx.showLoading({title: '玩命加载中',})that.appendRankList(); },  reachBottom: function(){wx.showToast({title: '已经到底部啦',icon: 'none',duration: 1000})},moveTabR: function(){var that = this;console.log("向左")page=1;that.setData({tabPosition: 'transformR',mode: 1,hasReachBottom: "lower" })that.getRankList();that.getUserInfoById();},moveTabL: function () {var that = this;console.log("向右")page=1;that.setData({tabPosition: 'transformL',mode: 2,hasReachBottom: "lower"})that.getRankList();that.getUserInfoById();},//得到用户信息getUserInfoByStorage: function () {var that = this;console.log("获取到的授权信息为:" + app.globalData.userInfo)//先从本地存储取userId,如果没有的话就注册wx.getStorage({key: 'userId',success: function (res) {console.log("从本地取到用户Id:" + res.data)userId = res.data;if (userId!=undefined&&userId!='undefined'){that.getUserInfoById();}},fail: function () {if (app.globalData.userInfo!=null){that.registerUser();}}})},//注册用户registerUser: function () {var that = this;wx.request({url: app.globalData.globalReqUrl+'/user/add',data: {avatarUrl: app.globalData.userInfo.avatarUrl,city: app.globalData.userInfo.city,country: app.globalData.userInfo.country,gender: app.globalData.userInfo.gender,nickname: app.globalData.userInfo.nickName,language: app.globalData.userInfo.language,province: app.globalData.userInfo.province},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {if (res.data.code != 4001) {userId = res.data.content;console.log("新增或清除本地数据的用户的ID是:" + userId)          //设置缓存wx.setStorage({key: "userId",data: userId})//得到单条用户信息wx.request({url: app.globalData.globalReqUrl+'/user/getUserInfoRanked',data: {id: userId,mode: that.data.mode},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {user = res.data.content;console.log("新增或清除本地数据的用户的数据是:" + user)that.setData({me: user});},fail: function () {console.log("新增用户的请求失败");}})}},fail: function () {console.log("新增用户的请求失败");}})},getUserInfoById: function(){var that = this;//得到单条用户信息wx.request({url: app.globalData.globalReqUrl+'/user/getUserInfoRanked',data: {id: userId,mode: that.data.mode},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {user = res.data.content;console.log("新增或清除本地数据的用户的数据是:" + user)that.setData({me: user});},fail: function () {console.log("新增用户的请求失败");}})}
})

 

 

音乐收藏

 

 

 

<!--collectList.wxml-->
<view class="container"><view class="header"><text class='text1' bindtap='moveTabR'>已知音</text><text class='text2' bindtap='moveTabL'>已收藏</text><view class='bg {{tabPosition}}'></view></view><scroll-view class="list" scroll-y bindscrolltolower="{{hasReachBottom}}">   <view wx:for-items="{{key}}" wx:key="item" wx:for-index="index"><view class="item"><text class="index">{{index+1}}</text><view class="left"><text class="songname">{{item.name}}</text><text class="author">{{item.author}}</text></view><view class="center"><text class="solve">已有 {{item.solveCount}} 知音</text><text class="rate">{{tabPosition=='transformR'?'知音率 '+item.correctRate+' %':'已被 '+item.collectCount+' 知音收藏'}}</text></view><view class="right"><image src='https://nanmatou.club/files/zhiyin/icons/play.png' class="image" data-id='{{index}}' data-src='{{item.url}}' data-songname='{{item.name}}' data-author='{{item.author}}' style='{{playing==index?"display:none;":""}}'   bindtap='playMusic'></image><image src='https://nanmatou.club/files/zhiyin/icons/pause.png' class="image" data-id='{{index}}' style='{{playing==index?"":"display:none;"}}' bindtap='pauseMusic'></image><image src='https://nanmatou.club/files/zhiyin/icons/heart.png' data-id='{{index}}' data-musicid='{{item.id}}' class='image {{item.collect==false?"notCollect":"collect"}}' bindtap='collectOrNot'></image></view></view></view></scroll-view>
</view>
 
/**collectList.wxss**/
@import "../../bootstrap.wxss";
.container{width: 100%;height: 100%;background: #87CB16;background: -moz-linear-gradient(top, #87CB16 0%, #6dc030 100%);background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #87CB16), color-stop(100%, #6dc030));background: -webkit-linear-gradient(top, #87CB16 0%, #6dc030 100%);background: -o-linear-gradient(top, #87CB16 0%, #6dc030 100%);background: -ms-linear-gradient(top, #87CB16 0%, #6dc030 100%);background: linear-gradient(to bottom, #87CB16 0%, #6dc030 100%);background-size: 150% 150%;
}.container .header{height:45px;width: 91%;flex-direction:row;color: #FFFFFF;opacity: 1;background: rgba(255, 255, 255, 0.23);margin-top:10px;margin-bottom: 5px;border-radius: 10px;
}.container .list{height: 600px;
}.header .text1{position: absolute;margin-left:13%; font-size: 27px;margin-top:3px;
}
.header .text2{position: absolute;margin-left:57%; font-size: 27px;margin-top:3px;
}
.header .bg{height:45px;width: 50%;display: inline-block;flex-direction:row;color: whitesmoke;opacity: 1;background: rgba(255, 215, 0, 0.63);border-radius: 10px;z-index: -1;}
.transformL{animation:moveToRight 1s forwards;
}
.transformR{animation:moveToLeft 1s forwards;
}
@keyframes moveToRight{0%{margin-left: 0%; }100%{margin-left: 50%; }
}
@keyframes moveToLeft{0%{margin-left: 50%;  }100%{margin-left: 0%; }
}.container .item{width: 91%;height: 75px;display: flex;flex-direction:row;color: #FFFFFF;opacity: 1;background: rgba(255, 255, 255, 0.23);margin-top:13px;margin-bottom: 10px;border-radius: 10px;
}.index{margin-top: 23px;margin-left: 15px;margin-right: 10px;color: greenyellow;
}.left{display: inline-block;margin-top: 10px;
}.songname{font-size: 17px;margin-top: 3px;margin-left: 1px;text-overflow:ellipsis;width: 100px;overflow:hidden;white-space:nowrap;display: block;
}.author{margin-top: 3px;margin-left: 5px;display:block;font-size: 15px;text-overflow:ellipsis;width: 100px;overflow:hidden;white-space:nowrap;
}.center{display: inline-block;position: absolute;margin-left: 40%;margin-top: 12px;
}.solve{width: 20px;height: 20px;font-size: 15px;
}.rate{margin-top: 5px;display:block;font-size: 15px;color: blueviolet
}.right{position: absolute;margin-left: 70%;margin-top: 25px;
}.image{margin-left: 5px;margin-right: 5px;width:20px;height:20px;
}.invisible{display: none;
}.collect{opacity: 0.4;
}.notCollect{opacity: 1;
}
//collectList.js
const app = getApp()
var musics;
var page=1;
var userId;
const backgroundAudioManager = wx.getBackgroundAudioManager()backgroundAudioManager.onEnded(function () {var index = parseInt(musics.length * Math.random())backgroundAudioManager.src = musics[index].url;console.log("随机播放了歌:" + musics[index].url);backgroundAudioManager.title = musics[index].namebackgroundAudioManager.singer = musics[index].authorbackgroundAudioManager.coverImgUrl = 'https://nanmatou.club/files/zhiyin/icons/logo.png'
})Page({data: {userInfo: {},hasUserInfo: false,canIUse: wx.canIUse('button.open-type.getUserInfo'),playState: 'play',tabPosition: 'transformR',hasReachBottom: "lower",},onLoad: function (options) {page=1;var that = this;that.getUserInfoByStorage();wx.onBackgroundAudioStop(function () {console.log('onBackgroundAudioStop')})},//得到用户信息getUserInfoByStorage: function () {var that = this;console.log("获取到的授权信息为:" + app.globalData.userInfo)//先从本地存储取userId,如果没有的话就注册wx.getStorage({key: 'userId',success: function (res) {console.log("从本地取到用户Id:" + res.data)userId = res.data;if(userId==undefined||userId=='undefined'){that.registerUser();}else{that.getSolveMusic();}},fail: function () {if (app.globalData.userInfo!=null){that.registerUser();}}})},//注册用户registerUser: function () {var that = this;wx.request({url: app.globalData.globalReqUrl+'/user/add',data: {avatarUrl: app.globalData.userInfo.avatarUrl,city: app.globalData.userInfo.city,country: app.globalData.userInfo.country,gender: app.globalData.userInfo.gender,nickname: app.globalData.userInfo.nickName,language: app.globalData.userInfo.language,province: app.globalData.userInfo.province},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {if (res.data.code != 4001) {userId = res.data.content;console.log("新增或清除本地数据的用户的ID是:" + userId)that.getSolveMusic();//设置缓存wx.setStorage({key: "userId",data: userId})}},fail: function () {console.log("新增用户的请求失败");}})},getSolveMusic:function(){var that = this;wx.request({url: app.globalData.globalReqUrl+'/user/getSolveList',data: {pageNum: page,pageSize: 10,userId: userId},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {musics = res.data.contentthat.setData({key: musics,page: page});},fail: function () {console.log("请求用户失败")}})},lower: function () {console.log('上拉了')var that = this;// 显示加载图标  wx.showLoading({title: '玩命加载中',})// 页数+1  page = page + 1;wx.request({url: app.globalData.globalReqUrl+'/user/getSolveList',data: {pageNum: page,pageSize: 10,userId: userId},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {console.log(res.data.content)if (res.data.content != undefined && res.data.content.length>0) {musics =musics.concat(res.data.content);that.setData({key: musics,page: page});}else{that.setData({hasReachBottom: 'reachBottom'})}wx.hideLoading(); // 隐藏加载框  },fail: function () {console.log("请求用户失败")}})},  reachBottom: function () {wx.showToast({title: '已经到底部啦',icon: 'none',duration: 1000})},playMusic: function(e){var that = this;//获取当前item的下标id  通过currentTarget.idvar dataset = e.currentTarget.dataset;var id = dataset.id;var src = dataset.src;var songname = dataset.songname;var author = dataset.author;that.setData({playing: id})backgroundAudioManager.title = songnamebackgroundAudioManager.singer = authorbackgroundAudioManager.coverImgUrl = 'https://nanmatou.club/files/zhiyin/icons/logo.png'if(that.data.playing!=-1){backgroundAudioManager.src = src// 设置了 src 之后会自动播放 console.log("播放了歌:"+src);}},pauseMusic: function (e) {var that = this;//获取当前item的下标id  通过currentTarget.idvar dataset = e.currentTarget.dataset;var id = dataset.id;that.setData({playing: -1//重置播放图标})backgroundAudioManager.pause();// console.log("当前播放位置:"+)},collectOrNot:function(e){var that = this;//获取当前item的下标id  通过currentTarget.idvar dataset = e.currentTarget.dataset;var id = dataset.id;var musicid = dataset.musicid;console.log("获取"+id)wx.request({url: app.globalData.globalReqUrl+'/user/collectOrRemoveMusic',data: {userId: userId,musicId: musicid},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {console.log("收藏结果:"+res.data.content)console.log(that.data.tabPosition)if (that.data.tabPosition =='transformR'){that.moveTabR();}else{that.moveTabL();}},fail: function () {console.log("请求用户失败")}})},moveTabR: function () {var that = this;console.log("向左")that.setData({tabPosition: 'transformR',hasReachBottom: 'lower'})page=1;that.getSolveMusic();},moveTabL: function () {var that = this;console.log("向右")that.setData({tabPosition: 'transformL',hasReachBottom: 'reachBottom'})if (userId != undefined || userId != 'undefined'){wx.request({url: app.globalData.globalReqUrl+'/user/getCollectMusic',data: {userId: userId},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {musics = res.data.contentconsole.log(musics)that.setData({key: musics,});},fail: function () {console.log("请求用户失败")}})}},})

 

抽积分

 

<!--luck.wxml -->
<view class="container">
<view class='note'>{{userBalance==null?'跪求∞积分(*^__^*) ':'您当前有 '+ userBalance+' 积分'}}</view>
<view class="container-out"><view class="circle" wx:for="{{circleList}}" style="top:{{item.topCircle}}rpx;left:{{item.leftCircle}}rpx;background-color: {{(index%2==0)?colorCircleFirst:colorCircleSecond}};"></view><view class="container-in"><view class="content-out" wx:for="{{awardList}}" style="top:{{item.topAward}}rpx;left:{{item.leftAward}}rpx;background-color: {{(index==indexSelect)?colorAwardSelect:colorAwardDefault}};"><text class="award-image">{{item.imageAward}}</text></view><view class="start-btn" bindtap="startGame" style=" background-color:{{isRunning?'#e7930a':'#ffe400'}}">START</view></view>
</view>
</view>
/**luck.wxss**/
.container{width: 100%;height: 610px;background: #7B68EE;overflow-y:hidden;
}
.container-out {height: 600rpx;width: 650rpx;background-color: #b136b9;margin: 0 auto;border-radius: 40rpx;box-shadow: 0 10px 0 #871a8e;position: relative;
}.container-in {width: 580rpx;height: 530rpx;background-color: #871a8e;border-radius: 40rpx;position: absolute;left: 0;right: 0;top: 0;bottom: 0;margin: auto;
}/**小圆球
box-shadow: inset 3px 3px 3px #fff2af;*/.circle {position: absolute;display: block;border-radius: 50%;height: 20rpx;width: 20rpx;
}.content-out {position: absolute;height: 150rpx;width: 166.6666rpx;background-color: #f5f0fc;border-radius: 15rpx;box-shadow: 0 5px 0 #d87fde;
}/**居中 加粗*/.start-btn {position: absolute;margin: auto;top: 0;left: 0;bottom: 0;right: 0;border-radius: 15rpx;height: 150rpx;width: 166.6666rpx;background-color: #ffe400;box-shadow: 0 5px 0 #e7930a;color: #f6251e;text-align: center;font-size: 45rpx;font-weight: bolder;line-height: 150rpx;
}.award-image {position: absolute;margin: auto;top: 25px;left: 10px;text-align: center;height: 140rpx;width: 130rpx;font-size: 30rpx;
}.note{text-align: center;margin-bottom: 5px;margin-top:230rpx;color: whitesmoke;
}

 

//luck.js
const app = getApp() 
var awardLength = 8;
var lucknum;
var lastLucktime;
var userId;
var userBalance;
var needModal=0;
Page({data: {circleList: [],//圆点数组awardList: [],//奖品数组colorCircleFirst: '#FFDF2F',//圆点颜色1colorCircleSecond: '#FE4D32',//圆点颜色2colorAwardDefault: '#F5F0FC',//奖品默认颜色colorAwardSelect: '#ffe400',//奖品选中颜色indexSelect: 0,//被选中的奖品indexisRunning: false,//是否正在抽奖imageAward: ['再接再厉','1积分','2积分','3积分','再接再厉','5积分','10积分','20积分',],//奖品图片数组},onLoad: function () {var _this = this;//圆点设置var leftCircle = 7.5;var topCircle = 7.5;var circleList = [];for (var i = 0; i < 24; i++) {if (i == 0) {topCircle = 15;leftCircle = 15;} else if (i < 6) {topCircle = 7.5;leftCircle = leftCircle + 102.5;} else if (i == 6) {topCircle = 15leftCircle = 620;} else if (i < 12) {topCircle = topCircle + 94;leftCircle = 620;} else if (i == 12) {topCircle = 565;leftCircle = 620;} else if (i < 18) {topCircle = 570;leftCircle = leftCircle - 102.5;} else if (i == 18) {topCircle = 565;leftCircle = 15;} else if (i < 24) {topCircle = topCircle - 94;leftCircle = 7.5;} else {return}circleList.push({ topCircle: topCircle, leftCircle: leftCircle });}_this.setData({circleList: circleList})//圆点闪烁setInterval(function () {if (_this.data.colorCircleFirst == '#FFDF2F') {_this.setData({colorCircleFirst: '#FE4D32',colorCircleSecond: '#FFDF2F',})} else {_this.setData({colorCircleFirst: '#FFDF2F',colorCircleSecond: '#FE4D32',})}}, 500)//奖品item设置var awardList = [];//间距,怎么顺眼怎么设置吧.var topAward = 25;var leftAward = 25;for (var j = 0; j < 8; j++) {if (j == 0) {topAward = 25;leftAward = 25;} else if (j < 3) {topAward = topAward;//166.6666是宽.15是间距.下同leftAward = leftAward + 166.6666 + 15;} else if (j < 5) {leftAward = leftAward;//150是高,15是间距,下同topAward = topAward + 150 + 15;} else if (j < 7) {leftAward = leftAward - 166.6666 - 15;topAward = topAward;} else if (j < 8) {leftAward = leftAward;topAward = topAward - 150 - 15;}var imageAward = this.data.imageAward[j];awardList.push({ topAward: topAward, leftAward: leftAward, imageAward: imageAward });}_this.setData({awardList: awardList})wx.getStorage({key: 'userId',success: function (res) {userId = res.data;console.log("首次加载页面时取到userId:" + res.data)},fail: function () {//do nothing}})},//开始游戏startGame: function () {var that = this;if (app.globalData.userInfo == undefined || app.globalData.userInfo == null) {wx.showModal({content: '您没授予壹曲觅知音获得用户信息的权限,是否去设置打开?',confirmText: "确认",cancelText: "取消",success: function (res) {console.log(res);//点击“确认”时打开设置页面if (res.confirm) {console.log('用户点击确认')wx.openSetting({success: (res) => {wx.getUserInfo({success: res => {app.globalData.userInfo = res.userInfothat.getUserInfoByStorage();}})}})} else {console.log('用户取消授权')}}});}else{if (this.data.isRunning) returnif (userId == undefined || userId == 'undefined') {that.getUserInfoByStorage();console.log("有权限时点击播放按钮userId为undefined")} else {wx.request({url: app.globalData.globalReqUrl+'/user/getUserInfo',data: {id: userId},header: {'content-type': 'application/x-www-form-urlencoded' // 默认值},method: 'POST',success: function (res) {lastLucktime = res.data.content.lastLucktime.timelucknum = res.data.content.lucknumuserBalance = res.data.content.balanceconsole.log('上次抽奖时间:'+lastLucktime)console.log('剩余抽奖次数:'+lucknum)var nowTime = new Date(new Date(new Date().toLocaleDateString()).getTime()).getTime();//如果还有机会次数并且if (lastLucktime < nowTime){console.log("小于了")that.setData({isRunning: true})var _this = this;var indexSelect = parseInt(awardLength * Math.random())var balance = 0;if (indexSelect == 0) {balance = 1;} else if (indexSelect == 1) {balance = 2;} else if (indexSelect == 2) {balance = 3;} else if (indexSelect == 4) {balance = 5;} else if (indexSelect == 5) {balance = 10;} else if (indexSelect == 6) {balance = 20;} else {balance = 0;}var i = 0;var timer = setInterval(function () {indexSelect++;//这里我只是简单粗暴用y=30*x+200函数做的处理.可根据自己的需求改变转盘速度i += 60;if (i > 1000) {//去除循环clearInterval(timer)//获奖提示if (balance != 0) {wx.request({url: app.globalData.globalReqUrl+'/user/drawluck',data: {balance: balance,userId: userId,isToday:false},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {},fail: function () {console.log("抽奖请求失败")}})wx.showModal({title: '恭喜您',content: '获得了' + balance + "积分",showCancel: false,//去掉取消按钮success: function (res) {if (res.confirm) {that.setData({isRunning: false,userBalance: userBalance-5+balance})}}})} else {wx.showModal({title: '很遗憾',content: '没有获得积分,再接再厉',showCancel: false,//去掉取消按钮success: function (res) {if (res.confirm) {that.setData({isRunning: false})}}})}}indexSelect = indexSelect % 8;that.setData({indexSelect: indexSelect})}, (200 + i))} else if (lastLucktime >= nowTime && lucknum>0){//如果是当日第二次抽奖console.log("大于了")that.setData({isRunning: true})var _this = this;var indexSelect = parseInt(awardLength * Math.random())var balance = 0;if (indexSelect == 0) {balance = 1;} else if (indexSelect == 1) {balance = 2;} else if (indexSelect == 2) {balance = 3;} else if (indexSelect == 4) {balance = 5;} else if (indexSelect == 5) {balance = 10;} else if (indexSelect == 6) {balance = 20;} else {balance = 0;}var i = 0;var timer = setInterval(function () {indexSelect++;//这里我只是简单粗暴用y=30*x+200函数做的处理.可根据自己的需求改变转盘速度i += 60;if (i > 1000) {//去除循环clearInterval(timer)//获奖提示if (balance != 0) {wx.request({url: app.globalData.globalReqUrl+'/user/drawluck',data: {balance: balance,userId: userId,isToday: true},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {},fail: function () {console.log("抽奖请求失败")}})wx.showModal({title: '恭喜您',content: '获得了' + balance + "积分",showCancel: false,//去掉取消按钮success: function (res) {if (res.confirm) {that.setData({isRunning: false,userBalance: userBalance-5+balance})}}})} else {wx.showModal({title: '很遗憾',content: '没有获得积分,再接再厉',showCancel: false,//去掉取消按钮success: function (res) {if (res.confirm) {that.setData({isRunning: false})}}})}}indexSelect = indexSelect % 8;that.setData({indexSelect: indexSelect})}, (200 + i))}else{console.log(needModal)if (needModal==0){needModal = needModal+1;wx.showModal({title: '今日抽奖次数已用完',content: '是否使用5积分兑换一次抽奖机会',success: function (res) {if (res.confirm) {that.getBalanceByBalance();} else if (res.cancel) {console.log('用户花积分抽奖取消')}}})}else{that.getBalanceByBalance();}}},fail: function () {console.log("更新用户机会失败")}})}}},getBalanceByBalance: function(){var that = this;if (userBalance >= 5) {that.setData({isRunning: true,userBalance: userBalance - 5})var _this = this;var indexSelect = parseInt(awardLength * Math.random())var balance = 0;if (indexSelect == 0) {balance = 1;} else if (indexSelect == 1) {balance = 2;} else if (indexSelect == 2) {balance = 3;} else if (indexSelect == 4) {balance = 5;} else if (indexSelect == 5) {balance = 10;} else if (indexSelect == 6) {balance = 20;} else {balance = 0;}var i = 0;var timer = setInterval(function () {indexSelect++;//这里我只是简单粗暴用y=30*x+200函数做的处理.可根据自己的需求改变转盘速度i += 60;if (i > 1000) {//去除循环clearInterval(timer)//获奖提示if (balance != 0) {wx.showModal({title: '恭喜您',content: '获得了' + balance + "积分",showCancel: false,//去掉取消按钮success: function (res) {if (res.confirm) {that.setData({isRunning: false,userBalance: userBalance - 5 + balance})}}})} else {wx.showModal({title: '很遗憾',content: '没有获得积分,再接再厉',showCancel: false,//去掉取消按钮success: function (res) {if (res.confirm) {that.setData({isRunning: false})}}})}wx.request({url: app.globalData.globalReqUrl+'/user/getBalanceByBalance',data: {balance: balance,userId: userId,},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {},fail: function () {console.log("抽奖请求失败")}})}indexSelect = indexSelect % 8;that.setData({indexSelect: indexSelect})}, (200 + i))} else {wx.showToast({title: '积分不足',icon: 'none',duration: 2000})}},//得到用户信息getUserInfoByStorage: function () {var that = this;console.log("获取到的授权信息为:" + app.globalData.userInfo)//先从本地存储取userId,如果没有的话就注册wx.getStorage({key: 'userId',success: function (res) {if (res.data == undefined || res.data == 'undefined') {that.registerUser();} else {userId = res.data;}console.log("从本地取到userId:" + res.data)},fail: function () {that.registerUser();}})},//注册用户registerUser: function () {wx.request({url: app.globalData.globalReqUrl+'/user/add',data: {avatarUrl: app.globalData.userInfo.avatarUrl,city: app.globalData.userInfo.city,country: app.globalData.userInfo.country,gender: app.globalData.userInfo.gender,nickname: app.globalData.userInfo.nickName,language: app.globalData.userInfo.language,province: app.globalData.userInfo.province},header: {'content-type': 'application/x-www-form-urlencoded'},method: 'POST',success: function (res) {if (res.data.code != 4001) {userId = res.data.content;console.log("新增或清除本地数据的用户的ID是:" + userId)//设置缓存wx.setStorage({key: "userId",data: userId})wx.showToast({title: '初始化信息成功',icon: 'success',duration: 1000})}},fail: function () {console.log("新增用户的请求失败");}})},
})

 

全局配置

 

app.js

//app.js
App({onLaunch: function () {// 展示本地存储能力var logs = wx.getStorageSync('logs') || []logs.unshift(Date.now())wx.setStorageSync('logs', logs)// 登录wx.login({success: res => {// 发送 res.code 到后台换取 openId, sessionKey, unionId}})// 获取用户信息wx.getSetting({success: res => {if (res.authSetting['scope.userInfo']) {// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框wx.getUserInfo({success: res => {// 可以将 res 发送给后台解码出 unionIdthis.globalData.userInfo = res.userInfo// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回// 所以此处加入 callback 以防止这种情况if (this.userInfoReadyCallback) {this.userInfoReadyCallback(res)}}})}}})},globalData: {userInfo: null,globalReqUrl:'https://nanmatou.club/zhiyin',globalResourceUrl: 'https://nanmatou.club/files/zhiyin'}
})

app.json

{"pages":["pages/index/index","pages/introduction/introduction","pages/ranklist/ranklist","pages/luck/luck","pages/guess/guess","pages/collectList/collectList"],"window":{"backgroundTextStyle":"dark","navigationBarBackgroundColor": "#fff","navigationBarTitleText": "壹曲觅知音","navigationBarTextStyle":"black"}
}

然后将bootstrap.css改编成bootstrap.wxss放在根目录

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/52213.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

听杰伦新歌发现QQ音乐元宇宙,权游角色关系可视化地图、VNote 工具(Typora:勿cue谢谢)、最新论文 | ShowMeAI资讯日报

ShowMeAI日报系列全新升级&#xff01;覆盖AI人工智能 工具&框架 | 项目&代码 | 博文&分享 | 数据&资源 | 研究&论文 等方向。点击查看 历史文章列表&#xff0c;在公众号内订阅话题 #ShowMeAI资讯日报&#xff0c;可接收每日最新推送。点击 专题合辑&…

MATLAB演奏音乐

演奏原理&#xff1a;sound(y,Fs) 以采样率 Fs 向扬声器发送音频信号 y。 Fs 指单位时间对音频信号采样的次数。采样频率的选择应该遵循奈奎斯特&#xff08;Harry Nyquist&#xff09;采样理论&#xff1a;如果对某一模拟信号进行采样&#xff0c;则采样后可还原的最高信号频率…

分离歌曲中的人声和背景音乐(tensorflow)

有没有好奇歌星们清唱的声音怎么样&#xff1f;这一讲&#xff0c;我们将歌曲的人声和背景音乐分离出来&#xff0c;使用的网络是RNN。接下来一一讲解怎么实现。 下载数据集 搞机器学习&#xff0c;首先想到的是怎么获取训练的数据&#xff0c;网上有开放的数据集MIR-1k&…

推荐一个在线实现音乐可视化的网站

场景&#xff1a; 可以录入麦克风、MP3等&#xff0c;实现音乐可视化 链接 https://www.uberviz.io/

7个好用到爆的音频、配乐素材网站,BGM都在这里了

现在只要有一部手机&#xff0c;人人都能成为视频创作者。一个好的视频不能缺少的就是内容、配乐&#xff0c;越来越注重版权的当下&#xff0c;音效素材使用不当造成侵权的案例层出不穷。为了避免侵权&#xff0c;找素材让很多创作者很头疼。 今天我就整理了7个可以免费下载&…

每个人都能制作的简易版QQ音乐(HTML+CSS+JQuery)

自制系列二它来了。 如果在制作过程中有如何问题你都可以私信我&#xff0c;我会答复你的。 今天中秋节&#xff0c;首先祝大家中秋节快乐&#xff01; 因为没什么礼物送给大家&#xff0c;所以在这里给大家安利一份简易版QQ音乐的制作&#xff0c;过程很简单&#xff0c;每…

音乐app、app原型、音乐原型、云音乐、听歌、电台、本地音乐、点赞、收藏、歌单广场、动态、社区、评论、歌词、歌手、主播、视频、云村、下载、翻唱、歌曲播放、订阅、频道、引导页、登录注册、axure原型

音乐app、app原型、音乐原型、云音乐、听歌、电台、本地音乐、点赞、收藏、歌单广场、动态、社区、评论、歌词、歌手、主播、视频、云村、下载、翻唱、歌曲播放、订阅、频道、引导页、登录注册、axure原型 Axure原型演示及下载地址&#xff1a; 登陆 (首次打开) (pmdaniu.com)…

音乐网站设计

设计内容&#xff1a; 音乐网站网站是一款提供在线播放音乐和下载音乐功能的网站&#xff0c;具有音乐排行榜、歌星排行榜、音乐分类三个板块&#xff0c;并提供查询功能&#xff0c;要求如下&#xff1a; ① 页面布局合理&#xff0c;色彩和谐&#xff0c;链接正确&#xff0c…

音乐app、音乐原型、在线音乐、云音乐、听歌、电台、本地音乐、点赞、收藏、歌单广场、动态、社区、评论、歌词、歌手、主播、视频、云村、下载、翻唱、歌曲播放、订阅、频道、引导页、登录注册、axure原型

音乐app、音乐原型、在线音乐、云音乐、听歌、电台、本地音乐、点赞、收藏、歌单广场、动态、社区、评论、歌词、歌手、主播、视频、云村、下载、翻唱、歌曲播放、订阅、频道、引导页、登录注册、axure原型、产品原型 Axure原型演示及下载地址&#xff1a;Axure Cloud - Gener…

【学习笔记】穿T恤听古典音乐

文章目录 1 走进古典音乐1.1 音乐中的自然法则1.2 音乐要素如何模仿1.3 模仿与超越 2 每一天的巴赫2.1 巴赫的故事与作品2.2 对位法2.3 数学之美 3 莫扎特&#xff1a;把日子过成歌剧3.1 《莫扎特传》序曲——唐璜3.2 历史地位与风格演变3.3 咏叹调与宣叙调3.4 《后宫诱逃》3.5…

如何找到能商用的背景纯音乐

很多时候&#xff0c;我们在网上下载的音乐都是不能商用的。如果要商用就必须向作者购买版权授权。对于一些自媒体、博主、小公司等&#xff0c;这将是一笔不菲的费用。那么&#xff0c;哪里有免费可商用的背景配乐吗&#xff1f; 有的&#xff0c;那就是版权协议为CC0的公共音…

设计师精选实用AI工具合集 | Midjourney 、GPT等...

作为一名设计师&#xff0c;我们都知道&#xff0c;在智能化技术的推动下及ChatGPT的突然爆火&#xff0c;越来越多的AI工具正在被设计师广泛应用于日常工作中。 在这里给设计师们介绍几款功能强大、易于使用的AI设计工具。 第一款&#xff0c;基于 GPT 的 Figma 配色生成插件…

比尔·盖茨退出微软董事会,回顾盖茨与微软的传奇故事

作者&#xff5c;年素清 责编&#xff5c;伍杏玲 出品&#xff5c;CSDN&#xff08;ID&#xff1a;CSDNnews&#xff09; 头图&#xff5c;视觉中国 微软于周五宣布&#xff0c;公司联合创始人兼技术顾问比尔盖茨&#xff08;Bill Gates&#xff09;辞去微软董事会职务。 对于这…

后盖茨的IT世界

本文应《中华读书报》之邀所写。 图1 Joel Spolsky的新书More Joelon Software中文版,人民邮电出版社即将出版图2 The Big Switch,中文版,中信出版社 比尔盖茨今以壮岁之年隐退&#xff0c;不再掌管微软帝国的日常工作&#xff0c;标志着一个时代的结束。过渡从两年前就开始…

电子计算机比尔盖茨和微软品牌,尉迟:比尔盖茨卖安全套 牌子不能叫微软

核心提示&#xff1a;真正的土豪通常有更重要的事做&#xff0c;比方说比尔盖茨。IT男跨界转行做安全套。预计是明年2015年推出上市。但是估计不能延续以前的品牌&#xff0c;叫“微软安全套”&#xff0c;这个要改。 凤凰卫视9月27日《笑逐言开》&#xff0c;以下为文字实录&a…

比尔盖茨为什么能成为世界首富?

说到比尔盖茨的财富&#xff0c;很多人可能首先想到的是比尔盖茨精明的投资&#xff0c;因为这些年他通过跟巴菲特学投资&#xff0c;光靠投资就带来了超过700亿美元的财富&#xff0c;而微软所带来的财富只占其总财富的1/8左右。 但我想说的是&#xff0c;投资确实给比尔盖茨带…

你见过比尔盖茨38年前写的MicrosoftBasic代码吗

你见过比尔盖茨38年前写的MicrosoftBasic代码吗 2016-11-15 06:07 编辑&#xff1a; suiling 分类&#xff1a;程序人生 来源&#xff1a;w3cschoolcn 1 2830 程序员比尔盖茨 招聘信息&#xff1a; iOS开发工程师移动APP研发工程师产品经理/Product ManagerUnity开发工程师…

比尔盖茨/UNIX之父/Donald Knuth/Dijkstra等全球IT大师的编程名言

这不是一个bug,这只是一个未列出来的特性。——匿名 ​​ ​ Dennis Ritchie

比尔·盖茨1978年写的古老程序曝光:IT人膜拜

官方网站 www.itilzj.com 官方文库: wenku.itilzj.com 比尔盖茨31岁&#xff0c;就成为世界首富。很多人好奇&#xff0c;作为世界第一大PC系统的创始人&#xff0c;抛弃世界首富的头衔&#xff0c;单单从程序员角度来讨论&#xff0c;比尔盖茨的代码水平如何&#xff1f; 其实…