// pages/index/index.js
var stepList = ['立论阶段', '驳立论阶段', '质辩阶段','自由辩论','陈词阶段'];
var leftMove = 0 ; //左边初始偏移的角度
var rightMove = 0 ; //右边初始偏移的角度
Page({
data:{
currentStep:{}, //当前第一个阶段
currentStepList:[], //当前可利用阶段对象,包含第一个元素名字,第二个为描述,第三个为时间限制,都为数组,位置一一对应
leftAnimationData:{},
rightAnimationData:{}
},
onLoad:function(options){
// 页面初始化 options为页面跳转所带来的参数
},
onReady:function(){
// 页面渲染完成
},
onShow:function(){
// 页面显示
//在缓存中取出每一阶段的设置
var configs = wx.getStorageSync('configs');
var currentStepList = [];
var currentStepNameList = []; //阶段名字list
var currentStepDescList = [];// 阶段描述list
var currentStepTimeList = [];//阶段时间list
var currentStep = {};
var current = true;
for(var config in configs){
var step = configs[config];
if(step.state){
currentStepNameList.push(step.name);
currentStepDescList.push(step.desc);
currentStepTimeList.push(step.time);
if(current){
var desc = step.desc.replace(/@/g,step.time + '秒'); //时间描述替换
currentStep.name = step.name;
currentStep.desc = desc;
this.setData({
currentStep:currentStep
})
current = !current;
}
}
}
currentStepList.push(currentStepNameList);
currentStepList.push(currentStepDescList);
currentStepList.push(currentStepTimeList);
this.setData({
currentStepList:currentStepList
})
},
onHide:function(){
// 页面隐藏
},
onUnload:function(){
// 页面关闭
},
//改变阶段
changeStep:function(){
var page = this;
var currentStepList = this.data.currentStepList;
var currentStepNameList = currentStepList[0];//名字
var currentStepdescList = currentStepList[1];//描述
var currentStepTimeList = currentStepList[2];//时间
if( !currentStepNameList || currentStepNameList.length == 0){
wx.showModal({
title: '小提示',
content: '请至少开启一个阶段',
success: function(res) {
if (res.confirm) {
wx.navigateTo({
url: '/pages/config/config',
success: function(res){
// success
},
fail: function() {
// fail
},
complete: function() {
// complete
}
})
}
}
})
}
wx.showActionSheet({
itemList: currentStepNameList,
success: function(res) {
if (!res.cancel) {
var index = res.tapIndex;
var currentStep= {};
currentStep.name = currentStepNameList[index];
currentStep.desc = currentStepdescList[index].replace(/@/g,currentStepTimeList[index] + '秒');
page.setData({
currentStep:currentStep
})
}
}
})
},
//leftStart --正方
leftStart:function(){
var animation = this.createAnimation();
animation.rotate(leftMove+=100).step();
this.setData({
leftAnimationData:animation.export()
});
},
//rightStart 反方
rightStart:function(){
var animation = this.createAnimation();
animation.rotate(rightMove+=100).step();
this.setData({
rightAnimationData:animation.export()
});
},
//创建动画对象
createAnimation:function(){
var animation = wx.createAnimation({
duration: 1000,
timingFunction: 'linear', // "linear","ease","ease-in","ease-in-out","ease-out","step-start","step-end"
delay: 0,
transformOrigin: '50% 50% 0'
});
return animation;
}
})
没有合适的资源?快使用搜索试试~ 我知道了~
微信小程序 辩论倒计时小程序源码 作业设计demo 计算机专业参考
共18个文件
png:6个
js:4个
wxss:3个
需积分: 1 0 下载量 75 浏览量
2024-04-29
18:18:26
上传
评论
收藏 94KB ZIP 举报
温馨提示
辩论倒计时小程序是为辩论活动量身定制的时间管理工具,它允许用户根据不同的辩论阶段设置倒计时,确保辩论过程的流畅和时间的合理分配。 核心功能包括: 1. **自定义倒计时**:用户可以为辩论的各个环节设置不同的倒计时时间。 2. **阶段管理**:支持辩论的不同阶段,如开篇立论、交叉询问、总结陈词等。 3. **声音提示**:在倒计时结束时提供声音提示,方便辩手和观众知晓当前时间状态。 4. **简洁界面**:大字体显示剩余时间,清晰易读,减少干扰。 5. **操作简便**:一键启动/暂停倒计时,便于现场操作。 此外,该小程序还具备以下特点: - **实时更新**:倒计时实时更新,保证时间的准确性。 - **高兼容性**:适配多种设备和屏幕尺寸,确保良好的用户体验。 - **稳定性**:优化性能,确保在长时间的辩论活动中稳定运行。
资源推荐
资源详情
资源评论
收起资源包目录
辩论倒计时.zip (18个子文件)
辩论倒计时
timing
pages
index
index.wxml 973B
index.js 4KB
index.json 2B
index.wxss 752B
config
config.wxml 4KB
config.wxss 398B
config.js 2KB
config.json 48B
app.json 803B
assets
images
time-selected.png 882B
time.png 890B
config.png 864B
config-selected.png 871B
app.js 2KB
utils
util.js 460B
app.wxss 604B
1.png 31KB
2.png 54KB
共 18 条
- 1
资源评论
Xs_layla
- 粉丝: 1108
- 资源: 169
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功