Commit 437528eb by doszhang

dos

parent 245f2c25
......@@ -47,8 +47,8 @@ if ($('div').length > 0) {
$('.page1').show();
$('input[name=name]').attr('placeholder', '姓名');
$('input[name=business]').attr('placeholder', '业务号');
$('input[name=name]').attr('placeholder', '姓名').attr('id', 'name');;
$('input[name=business]').attr('placeholder', '业务号').attr('type', 'number').attr('maxlength', 10);
$('.page1 .num').html('已有 <span class="numbig">' + window.num + '</span> 人发起承诺');
//上传canvas定义
......@@ -95,9 +95,15 @@ $(document).ready(function () {
});
$('.btn-retry').on('click', () => {
$('input[name=btn-upload]').click()
})
});
//署名输入框限制长度事件
$('.page1 input[name=name]').on('input propertychange', inputLength);
});
function inputLength() {
checkIt('name', 4);
}
function bindMc(mc, ctx, myCanvas, img, imgInfo) {
mc.get('pan').set({
direction: Hammer.DIRECTION_ALL
......@@ -253,4 +259,33 @@ function RandomNumBoth(Min, Max) {
var Rand = Math.random();
var num = Min + Math.round(Rand * Range); //四舍五入
return num;
}
function checkIt(bind, maxNum) {
if (agreeSuggestion) {
var v = document.getElementById(bind).value;
if (v == "") {
return [];
}
var len = 0; //中英字符长度计数
//计算
for (i = 0; i < v.length; i++) {
var c = v.charCodeAt(i);
if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) //英文字母状态
{
len++;
} else //中文状态
{
len += 2;
}
if (len >= maxNum) {
if (i != v.length - 1) {
$("#" + bind).val(v.substr(0, i + 1))
break;
}
}
}
} else {
$("#" + bind).val('');
}
}
\ 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 sign in to comment