Commit 3ff7d4c1 authored by lalalala's avatar lalalala

微调

parent 5b3ea80f
......@@ -24,23 +24,15 @@ Page({
})
})
},
handleLongPress(e) {
// let timeCount = this.data.timeCount;
// timeCount == 1 && this.setBgUrl('a1');
// timeCount > 1 && timeCount <= 4&& this.setBgUrl('a2');
// timeCount > 4 && timeCount <= 6&& this.setBgUrl('a3');
// timeCount > 6 && timeCount <= 9&& this.setBgUrl('a3');
// timeCount > 9 && timeCount <= 12&& this.setBgUrl('a1');
},
handleTouchStart(e) {
handleTouchStart(e) { // 长按开始
let _this = this;
let timeCount = _this.data.timeCount;
let timer = setInterval(() => {
timeCount += 1
timeCount == 1 && this.setBgUrl('a1');
timeCount > 1 && timeCount <= 4&& this.setBgUrl('a2');
timeCount > 4 && timeCount <= 6&& this.setBgUrl('a3');
timeCount > 6 && timeCount <= 9&& this.setBgUrl('a4');
timeCount > 1 && timeCount <= 4 && this.setBgUrl('a2');
timeCount > 4 && timeCount <= 6 && this.setBgUrl('a3');
timeCount > 6 && timeCount <= 9 && this.setBgUrl('a4');
timeCount > 9 && timeCount < 12 && this.setBgUrl('a1');
if(timeCount == 12) {
timeCount = 0
......@@ -57,15 +49,14 @@ Page({
timer: timer
})
},
handleTouchEnd(e) {
let _this = this;
handleTouchEnd(e) { // 长按结束
this.data.timer && clearInterval(this.data.timer)
this.setData({
timeCount: 0
})
this.setBgUrl('a0');
},
setBgUrl(state) {
setBgUrl(state) { // 设置背景图片
let _this = this;
this.setData({
bgUrl: _this.data.bgImageObj[state]
......
......@@ -2,7 +2,7 @@
<view class="container log-list">
<view class="game-content">
<image class="game-content-bg" src="{{bgUrl}}"></image>
<image class="game-content-dice" src="{{diceUrl}}" bindlongpress="handleLongPress" bindtouchstart="handleTouchStart"
<image class="game-content-dice" src="{{diceUrl}}" bindtouchstart="handleTouchStart"
bindtouchend="handleTouchEnd" ></image>
</view>
</view>
// pages/news/news.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<!--pages/news/news.wxml-->
<text>pages/news/news.wxml</text>
/* pages/news/news.wxss */
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment