Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

防止多次点击刷屏操作 #52

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

spm2020spring
Copy link
Member

多次点击发表评论,系统提示请勿刷屏

By

张欢欣  
黄文心  
梁怡萱  
刘庐庐  

多次点击发表评论,系统提示请勿刷屏
@@ -130,8 +131,21 @@ <h2 class="card-title">{{ article.title }}</h2><!--title-->
<textarea class="form-control" rows="3" name="body" placeholder="write something here..." required="required"></textarea>
</div>

<button class="btn btn-primary" type="submit" style="float:right">comment</button>
<button id="btn" class="btn btn-primary" type="submit" style="float:right" onClick="prevent()">comment</button>
Copy link
Member Author

@spm2020spring spm2020spring Jan 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1500h

Why do you have the prevent() method, which is not defined anywhere?

Could you remove onClick="prevent() if it is no longer needed?

-Hui

// 第一种 通过点击事件
var clicktag = 1;
btn.onclick = function () {
if (clicktag == 3) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1500h

Why do you choose 3, instead of 4 or 5?

-Hui

btn.onclick = function () {
if (clicktag == 3) {
alert("请勿频繁点击!");
setTimeout(function () { clicktag = 0 }, 5000);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1500h

Probably you want to use a bigger number than 5000, as a more serious warning.

-Hui

@spm2020spring
Copy link
Member Author

@1500h

Could you show that your changes work when the software is running.

-Hui

@1500h
Copy link

1500h commented Jan 5, 2021 via email

@1500h
Copy link

1500h commented Jan 5, 2021 via email

@1500h
Copy link

1500h commented Jan 5, 2021 via email

@1500h
Copy link

1500h commented Jan 5, 2021 via email

@spm2020spring
Copy link
Member Author

spm2020spring commented Jan 6, 2021

@1500h

Thanks. Could you delete onClick="prevent()" and change to 5000 to 60000? Push a new commit after you will have made these changes.

-Hui

删除了onClick="prevent()",更改了等待时间
@1500h
Copy link

1500h commented Jan 6, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants