Browse Source

答题防止连点

master
kola-web 2 months ago
parent
commit
a9dd6ff57b
  1. 4
      src/pages/my/index.ts
  2. 5
      src/pages/topic/index.ts
  3. 2
      src/pages/topic/index.wxml

4
src/pages/my/index.ts

@ -83,9 +83,7 @@ Page({ @@ -83,9 +83,7 @@ Page({
this.setData({
toastShow: false,
});
setTimeout(() => {
wx.showTabBar({});
}, 1000);
wx.showTabBar({});
},
handleTopic() {
wx.navigateTo({

5
src/pages/topic/index.ts

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
const app = getApp<IAppOption>();
const licia = require('miniprogram-licia');
Page({
data: {
@ -29,7 +30,7 @@ Page({ @@ -29,7 +30,7 @@ Page({
});
});
},
handleBtn(e) {
handleBtn: licia.debounce(function (e) {
const { index, id } = e.currentTarget.dataset;
const { question, nav } = this.data;
question[index].answer = id;
@ -38,7 +39,7 @@ Page({ @@ -38,7 +39,7 @@ Page({
nav: nav === question.length - 1 ? nav : nav + 1,
percentage: ((nav + 1) / question.length) * 100,
});
},
}, 200),
handlePrev() {
this.setData({
nav: this.data.nav - 1,

2
src/pages/topic/index.wxml

@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
class="btn {{questionItem.answer==='1' && 'active'}}"
bind:tap="handleBtn"
data-id="1"
data-index="{{index }}"
data-index="{{index}}"
>
非常了解
</view>

Loading…
Cancel
Save