From ad2bb74efa07dd4dcfdd8cd83d714e8e8eef0776 Mon Sep 17 00:00:00 2001 From: pxskm4tvn <2836285168@qq.com> Date: Thu, 10 Oct 2024 01:02:03 +0800 Subject: [PATCH] ADD file via upload --- second.js | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 second.js diff --git a/second.js b/second.js new file mode 100644 index 0000000..b3b11db --- /dev/null +++ b/second.js @@ -0,0 +1,53 @@ +// pages/Second/Second.js +var app = getApp() +var Paths = ['曾恬灵','龙思怡', '杨光正 ', '张嘉威', '李玲', '程方磊','陈佳慧','张定坚','吴世胜','黄益民','刘燕玲','赵金改']; //随机滚动的名字序列 +var Index = 0; //初试默认为0 + +Page({ + /** + * 页面的初始数据 + */ + data: { + Path:Paths[0], + title:'Start', //设按钮文字为Start + isRunning:false, + userInfo:{}, + }, + + bindViewTap:function(){ + wx.navigateTo({ + url: '../logs/logs', + }) + }, + change:function(e){ + Index++; + //当Index>6时,Index=0,即当滚动到最后一个名字时,从头开始滚动,这个数值根据Paths中名字的个数改变 + if (Index>6){ + Index=0; + } + this.setData( { + Path:Paths[Index] + } + ) + }, + guess:function(e){ + let isRunning = this.data.isRunning; + if(!isRunning){ + this.setData( { + title:'Stop', //按钮上的字变为Stop + isRunning:true + } ); + this.timer=setInterval((function(){ + this.change() + }).bind(this),50 ); //名字滚动的频率 + } + else{ this.setData( + { + title:'Start', //按钮上的字变为StART + isRunning:false + } + ); + this.timer&&clearInterval(this.timer); + } + } + }) \ No newline at end of file