// ===== 登录门禁 + 修改密码 ===== var ST_KEY="qw_employee_token"; var EMP_PWD_KEY="qw_emp_passwords"; var DEV_KEY="qw_device_id"; function getDeviceId(){ var id=localStorage.getItem(DEV_KEY); if(!id){id="dev_"+Math.random().toString(36).substring(2,10)+"_"+Date.now();localStorage.setItem(DEV_KEY,id)} return id; } function getEmpPasswords(){ try{return JSON.parse(localStorage.getItem(EMP_PWD_KEY)||"{}")}catch(e){return{}} } function saveEmpPasswords(p){localStorage.setItem(EMP_PWD_KEY,JSON.stringify(p))} function hasCustomPwd(empNo){var p=getEmpPasswords();return p[empNo]&&p[empNo]!=="123"} function getCustomPwd(empNo){var p=getEmpPasswords();return p[empNo]||null} function getToken(){ try{ var raw=localStorage.getItem(ST_KEY); if(!raw)return null; var t=JSON.parse(raw); if(Date.now()-t.ts>7*24*60*60*1000){localStorage.removeItem(ST_KEY);return null} return t; }catch(e){return null} } function hashPwd(pwd){ var h=0; for(var i=0;i🏪' +'

企旺快服 · 员工成长

' +'
品牌旺IP陪跑系统 · 请选择身份登录
' +'前往员工登录页 →' +''; } function checkLogin(){ var t=getToken(); if(!t){showLoginGate();return} var empNo=t.emp_no; if(!empNo){showLoginGate();return} document.getElementById("pwdBar").style.display="flex"; document.getElementById("changePwdInfo").innerHTML="当前用户:"+empNo+" "+t.emp_name+""; } function openChangePwd(){ var t=getToken(); if(!t){showToast("请先登录","error");return} document.getElementById("cpOldPwd").value=""; document.getElementById("cpNewPwd").value=""; document.getElementById("cpNewPwd2").value=""; document.getElementById("cpErr").style.display="none"; document.getElementById("changePwdModal").classList.add("show"); } function closeChangePwd(){ document.getElementById("changePwdModal").classList.remove("show"); } function changePassword(){ var t=getToken(); if(!t){showToast("请先登录","error");return} var oldPwd=document.getElementById("cpOldPwd").value; var newPwd=document.getElementById("cpNewPwd").value; var newPwd2=document.getElementById("cpNewPwd2").value; var errEl=document.getElementById("cpErr"); errEl.style.display="none"; var empNo=t.emp_no; var defaultPwd=t.emp_defaultPwd||"123"; var currentPwd=hasCustomPwd(empNo)?getCustomPwd(empNo):defaultPwd; if(hashPwd(oldPwd)!==hashPwd(currentPwd)){ errEl.textContent="当前密码错误";errEl.style.display="block";return; } if(newPwd.length<4){ errEl.textContent="新密码至少4位";errEl.style.display="block";return; } if(newPwd!==newPwd2){ errEl.textContent="两次输入的新密码不一致";errEl.style.display="block";return; } var p=getEmpPasswords(); p[empNo]=newPwd; saveEmpPasswords(p); closeChangePwd(); showToast("✅ 密码修改成功","success"); }
德可旺 · 员工成长
德可旺 · 员工成长