解决注册页面倒计时点击完之后无法再次倒计时问题

This commit is contained in:
Dragon
2022-12-02 16:35:50 +08:00
parent 972af47fb1
commit a49abd0cfc
2 changed files with 4 additions and 3 deletions

View File

@@ -40,6 +40,6 @@
<script src="../../common/js/layer.js"></script> <script src="../../common/js/layer.js"></script>
<script src="../../common/js/crypto-js.js"></script> <script src="../../common/js/crypto-js.js"></script>
<script src="./js/des.js"></script> <script src="./js/des.js"></script>
<script src="./js/index.js"></script> <script src="./js/index.js?v=1"></script>
</html> </html>

View File

@@ -23,7 +23,7 @@ const toastMsg = (content = '操作完成', time = 2) => {
var browser = checkVersion(); var browser = checkVersion();
const urlPrefix = getUrlPrefix(); const urlPrefix = getUrlPrefix();
var getUrl = getQueryString(); var getUrl = getQueryString();
var time = 59; var time = 5;
var isClick = true; var isClick = true;
if (EnvCheck() == 'test') {//degBug if (EnvCheck() == 'test') {//degBug
new VConsole(); new VConsole();
@@ -69,6 +69,7 @@ function getCode (num, phone, code) {
}, },
success: function (res) { success: function (res) {
if (res.code == 200) { if (res.code == 200) {
time = 59
timerFun() timerFun()
hideLoading(layerIndex) hideLoading(layerIndex)
toastMsg(res.message) toastMsg(res.message)
@@ -124,6 +125,7 @@ $('.box .code .num').click(function () {
var num = Number($('.box .phone .num').text().match(/\d+/)[0]); var num = Number($('.box .phone .num').text().match(/\d+/)[0]);
var phone = Number($('.box .phone input').val()); var phone = Number($('.box .phone input').val());
var code = Number($('.box .code input').val()); var code = Number($('.box .code input').val());
//
if (isClick) { if (isClick) {
if (phone == '') { if (phone == '') {
toastMsg('請輸入手機號'); toastMsg('請輸入手機號');
@@ -152,7 +154,6 @@ function timerFun () {
clearInterval(timer); clearInterval(timer);
$('.box .code .num').text('獲取驗證碼'); $('.box .code .num').text('獲取驗證碼');
isClick = true; isClick = true;
time = 59
} else { } else {
$('.box .code .num').text(`${time}秒後重新獲取`); $('.box .code .num').text(`${time}秒後重新獲取`);
time--; time--;