You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.1 KiB

// pages/shouye/shouye.js
// var app = getApp()
var Paths = ['曾恬灵','龙思怡', '杨光正 ', '张嘉威', '李玲', '程方磊','陈佳慧','张定坚','吴世胜','黄益民','刘燕玲','赵金改'];
var Index = 0;
Page({
/**
* 页面的初始数据
*/
data: {
Path:Paths[0],
title:'开始',
isRunning:false,
userInfo:{},
},
change:function(e){
let Index = Math.ceil(Math.random()*5)//运用random随机数自动随机生成index的下标
this.setData( {
Path:Paths[Index]
}
)
},
guess:function(e){
let isRunning = this.data.isRunning;
if(!isRunning){
this.setData( {
title:'停',
isRunning:true
} );
this.timer=setInterval((function(){
this.change()
}).bind(this),50 );
}
else{ this.setData(
{
title:'开始', //按钮上的字变为StART
isRunning:false
}
);
this.timer&&clearInterval(this.timer);
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})