/* * 创业帮公用方法 */ // 验证手机号码格式 const verificationphonenumber = (phonenumber) =>{ const reg = /^((13[0-9])|(14(0|[5-7]|9))|(15([0-3]|[5-9]))|(16(2|[5-7]))|(17[0-8])|(18[0-9])|(19([0-3]|[5-9])))\d{8}$/; return reg.test(phonenumber); }; // 验证邮箱格式 const verificationemail = (email) =>{ const reg = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/; return reg.test(email); }; // 社会信用代码 const verificationCreditCode = (creditCode) =>{ const reg = /^(([0-9A-Za-z]{15})|([0-9A-Za-z]{18})|([0-9A-Za-z]{20}))$/; return reg.test(creditCode); } // 身份证号验证 const verificationIdCardNumber = (idNumber) =>{ const reg = /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/; return reg.test(idNumber); } // 中文姓名验证 const verificationName = (name) =>{ const reg = /^(?:[\u4e00-\u9fa5·]{2,16})$/; return reg.test(name); } // // 验证手机号码格式 // const verificationIdnumber = (idnumber) =>{ // const reg = /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/; // return reg.test(idnumber); // }; // 验证银行卡格式 const verificationbankcardId = (bankcardId) =>{ const reg = /^[1-9]\d{9,29}$/; return reg.test(bankcardId); }; // 提示函数 const tips = (tips,position = "bottom") => { vant.Toast({message: tips,position}); }; //- 手机号码验证 const verification = (mobilenumber) => { if(mobilenumber === '') { tips('请输入手机号码!'); return true; } if(!verificationphonenumber(mobilenumber)){ tips('手机号码格式错误!'); return true; }; }; // 密码校验 const verificationpassword = function(pwd){ if(pwd.length < 6 || pwd.length > 16) { tips('密码长度应为6~16位'); return true; } }; // 验证码校验 const verificationmobilecode = function(code){ if(code.length !== 6) { tips('短信验证码长度应为6位'); return true; } }; // 按钮防抖 const undebounce = function(func,delay = 300) { let timer; return function() { const args = arguments; const that = this; if (timer) clearTimeout(timer); timer = setTimeout(() => { func.apply(that,args) }, delay) } }; // 保留两位小数 Vue.filter('tofixed2', function (value) { return value.toFixed(2); }); const tofixed2 = function (value) { return value.toFixed(2); }; // 隐藏中间位 const hidemiddlenum = function (str,frontLen,endLen = 0) { var len = str.length-frontLen-endLen; var xing = ''; for (var i=0;i -1, /*IE内核*/ presto: u.indexOf('Presto') > -1, /*opera内核*/ webKit: u.indexOf('AppleWebKit') > -1, /*苹果、谷歌内核*/ gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,/*火狐内核*/ mobile: !!u.match(/AppleWebKit.*Mobile.*/), /*是否为移动终端*/ ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), /*ios终端*/ android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, /*android终端或者uc浏览器*/ iPhone: u.indexOf('iPhone') > -1 , /*是否为iPhone或者QQHD浏览器*/ iPad: u.indexOf('iPad') > -1, /*是否iPad*/ webApp: u.indexOf('Safari') == -1, /*是否web应该程序,没有头部与底部*/ weixin: u.toLowerCase().indexOf('micromessenger') > -1 /*是否是微信*/ }; }(), language:(navigator.browserLanguage || navigator.language).toLowerCase() }; // 扫描二维码函数 const scan = function (value,fn) { value = PublicLib.getCookieInfo("ScanContent") && JSON.parse(PublicLib.getCookieInfo("ScanContent")).scan if(value !== '') { fn(); } PublicLib.putCookieInfo('ScanContent', ''); }; // 加密函数 const encryption = function(val){ return PublicLib.encryptByDES(val); }; function deviceDetection() { const ua = navigator.userAgent let osVersion = '' let device = '' try { if (/android/i.test(ua)) { device = 'android' osVersion = ua.match(/Android\s+([\d.]+)/i)[0].replace('Android ', '') } else if (/ipad|iphone|ipod/i.test(ua)) { device = 'ios' osVersion = ua.match(/OS\s+([\d_]+)/i)[0].replace(/_/g, '.').replace('OS ', '') } } catch (err) { /* istanbul ignore next line */ console.error(err) } return { osVersion, device } }; // 判断是否为刘海屏 function isFringe() { const { device } = deviceDetection() // const { screen } = global return device === 'ios' && ((screen.width === 375 && screen.height === 812) || (screen.width === 414 && screen.height === 896) || (screen.width === 375 && screen.height === 812) || (screen.width === 390 && screen.height === 844) || (screen.width === 428 && screen.height === 926)) }; if(isFringe()){ document.querySelector('body').className += ' bangs'; if(document.querySelector('.iphonetitle')){ document.querySelector('.iphonetitle').className += ' topBangs'; }; }else{ document.querySelector('body').className += ' unbangs'; if(document.querySelector('.iphonetitle')){ document.querySelector('.iphonetitle').className += ' untopBangs'; }; }; Host = 'http://bs.kexiaoshuang.com/'; const showHost = 'http://bs.kexiaoshuang.com'; isWeb = true; // 超级管理员姓名 *(*) // 超级管理员身份证件号码 *(*) // 联系手机 ** // 联系邮箱 ** // 营业执照照片 ** // 统一社会信用代码 ** // 商户名称 *CertMerchantName // 个体户经营者/法人姓名 *CertLegalPerson(*) // 身份证人像面照片 *IdCardCopy // 身份证国徽面照片 *IdCardNational // 身份证姓名 *IdCardName(*) // 身份证号码 *IdCardNumber(*) // 身份证有效期开始时间 *yyyy-mm-dd CardPeriodBegin // 身份证有效期结束时间 *yyyy-mm-dd CardPeriodEnd // 商户简称 *MerchantShortname // 客服电话 *ServicePhone // 门店名称 *BizStoreName // 门店省市编码 *BizAddressCode // 门店地址 *BizStoreAddress // 门店门头照片 *StoreEntrancePic // 店内环境照片 *IndoorPic // 所属行业 *QualificationType // 主体类型 *SubjectType // 账户类型 *BankAccountType // 开户名称 * AccountName // 开户银行 *AccountBank // 开户银行省市编码 *BankAddressCode // 开户银行联行号 * // 开户银行全称(含支行) BankName // 银行账号 *AccountNumber