From e49962aeb51d99832c2552d244f1fce4320582c8 Mon Sep 17 00:00:00 2001 From: chenzhen <19553350107@163.com> Date: Tue, 2 Dec 2025 09:34:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E8=8E=B7=E5=8F=96=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist-test/hcdbqb-management.html | 488 ++++++++++++++++++++++----------------- dist-test/login-management.html | 351 ++++++++++++++++++++++++++++ dist-test/main.js | 2 +- dist-test/management.js | 11 +- hcdbqb-management.html | 18 +- index.html | 9 +- 6 files changed, 660 insertions(+), 219 deletions(-) create mode 100644 dist-test/login-management.html diff --git a/dist-test/hcdbqb-management.html b/dist-test/hcdbqb-management.html index 7728b4a..082e1ae 100644 --- a/dist-test/hcdbqb-management.html +++ b/dist-test/hcdbqb-management.html @@ -1,222 +1,298 @@ - - - - 管理后台 - - - - - -
- - - - - - - - - - - - - - - - -
#姓名国家/地区代码电话号码微信ID邮箱添加时间是否联系备注操作
-
-
- 每页显示 - - 条 -
+ } + + #noteModal { + display: none; + position: fixed; + inset: 0; + background: rgba(0, 0, 0, 0.45); + align-items: center; + justify-content: center; + z-index: 9999; + } + + #noteModal .dialog { + background: #fff; + padding: 16px; + border-radius: 8px; + width: 90%; + max-width: 520px; + box-sizing: border-box; + } + + #noteModal textarea { + width: 100%; + min-width: 60%; + max-width: 100%; + min-height: 150px; + box-sizing: border-box; + padding: 8px; + border-radius: 6px; + border: 1px solid #ddd; + font-size: 14px; + } + + .toast { + position: fixed; + top: -20px; + left: 50%; + transform: translateX(-50%); + background: #4caf50; + color: #fff; + padding: 10px 16px; + border-radius: 6px; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); + font-size: 16px; + opacity: 0; + transition: all 0.3s ease; + z-index: 10000; + pointer-events: none; + } + + .toast.show { + opacity: 1; + top: 20px; + } + + table th, + table td { + text-align: center; + } + + /* 登录验证样式 */ + #loginCheckModal { + display: none; + position: fixed; + inset: 0; + background: rgba(0, 0, 0, 0.7); + align-items: center; + justify-content: center; + z-index: 99999; + } + + #loginCheckModal .dialog { + background: #fff; + padding: 30px; + border-radius: 12px; + width: 90%; + max-width: 400px; + text-align: center; + box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); + } + + #loginCheckModal h3 { + margin: 0 0 16px; + color: #e74c3c; + font-size: 20px; + } + + #loginCheckModal p { + margin: 0 0 24px; + color: #666; + line-height: 1.5; + } + + #loginCheckModal .btn { + padding: 10px 20px; + font-size: 16px; + } + + + + -
0
+ + +
+
+

访问被拒绝

+

您尚未登录或登录已过期,请先登录系统。

+ +
+
- +
+ + + + + + + + + + + + + + + + + + + +
#姓名WhatsApp国家/地区代码电话号码微信ID邮箱获客来源来源地址添加时间是否联系备注操作
+
+
+ 每页显示 + + 条
- -
-
-

编辑备注

- -
0
+ + +
+ +
+
+

编辑备注

+ +
- - -
+ "> + +
-
- - +
+
+ + + \ No newline at end of file diff --git a/dist-test/login-management.html b/dist-test/login-management.html new file mode 100644 index 0000000..8eb3416 --- /dev/null +++ b/dist-test/login-management.html @@ -0,0 +1,351 @@ + + + + + + + 系统登录 + + + + + + + + + + \ No newline at end of file diff --git a/dist-test/main.js b/dist-test/main.js index f1a26dc..03dcc30 100644 --- a/dist-test/main.js +++ b/dist-test/main.js @@ -1 +1 @@ -import{g as h,r as E}from"./member.js";const I=50,L=100,B=20,u=document.getElementById("registrationForm"),c=document.getElementById("successModal"),v=document.getElementById("closeModal"),a=document.getElementById("submitBtn"),g=document.getElementById("loadingOverlay"),i=document.getElementById("lectureImage");let r=!1;function p(){document.documentElement.style.scrollBehavior="auto";const e=document.getElementById("register");if(e){const t=document.querySelector("header").offsetHeight,n=e.offsetTop-t-20;window.scrollTo(0,n)}setTimeout(()=>{document.documentElement.style.scrollBehavior="smooth"},100)}async function w(){console.log("开始加载讲座图片...");try{const e={id:1};console.log("调用getImageApi,参数:",e);const t=await h(e);console.log("接口返回:",t),t.code===200&&t.data?(i.src=t.data,console.log("讲座图片加载成功:",t.data)):(console.warn("获取图片失败:",t.msg),i.src="https://hc.homilychart.com/hc/250121/img/kecheng.jpg")}catch(e){console.error("加载讲座图片失败:",e),i.src="https://hc.homilychart.com/hc/250121/img/kecheng.jpg"}}function b(){g.style.display="flex",a.disabled=!0,a.textContent="提交中...",r=!0}function M(){g.style.display="none",a.disabled=!1,a.textContent="提交注册",r=!1}function s(e){alert(e)}function A(e){const{name:t,tel:n,email:o}=e;return!t||t.length>I?(s("请输入有效的姓名(最多50个字符)"),document.getElementById("userNameInfo").focus(),!1):!n||n.length>B?(s("请输入有效的电话号码"),document.getElementById("userMobile").focus(),!1):!o||o.length>L?(s("请输入电子邮箱"),document.getElementById("userEmail").focus(),!1):/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)?!0:(s("请输入有效的电子邮箱地址"),document.getElementById("userEmail").focus(),!1)}async function H(e){if(e.preventDefault(),r)return;const t=document.getElementById("userNameInfo").value.trim(),n=document.getElementById("countryInfo").value,o=document.getElementById("userMobile").value.trim(),d=document.getElementById("userWechat").value.trim(),y=document.getElementById("userEmail").value.trim(),m={name:t,code:n,tel:o,wechat:d,email:y};if(A(m))try{b();const l=await E(m);l.code===200?(c.classList.remove("hidden"),u.reset()):s("注册失败: "+(l.msg||"未知错误"))}catch(l){console.error("请求失败:",l),s("网络错误,请稍后重试")}finally{M()}}function S(){document.getElementById("mobileMenu").classList.toggle("hidden");const t=document.getElementById("menuBtn").querySelector("i");t.classList.contains("fa-bars")?t.classList.replace("fa-bars","fa-times"):t.classList.replace("fa-times","fa-bars")}function N(){const e=document.querySelector("header");window.scrollY>50?(e.classList.add("py-2","shadow"),e.classList.remove("py-3")):(e.classList.add("py-3"),e.classList.remove("py-2","shadow"))}function f(){document.querySelectorAll(".animate-fade-in").forEach(t=>{const n=t.getBoundingClientRect().top,o=window.innerHeight;n{document.body.classList.add("content-visible")},50)});window.addEventListener("load",()=>{console.log("页面加载完成,开始调用loadLectureImage..."),w(),f(),document.getElementById("loadingOverlay").style.display="none"});u.addEventListener("submit",H);v.addEventListener("click",()=>{c.classList.add("hidden")});c.addEventListener("click",e=>{e.target===c&&c.classList.add("hidden")});document.getElementById("menuBtn").addEventListener("click",S);window.addEventListener("scroll",N);window.addEventListener("scroll",f); +import{g as I,r as L}from"./member.js";const w=50,p=100,B=20,u=document.getElementById("registrationForm"),c=document.getElementById("successModal"),v=document.getElementById("closeModal"),l=document.getElementById("submitBtn"),g=document.getElementById("loadingOverlay"),i=document.getElementById("lectureImage");let d=!1;function b(){document.documentElement.style.scrollBehavior="auto";const t=document.getElementById("register");if(t){const e=document.querySelector("header").offsetHeight,n=t.offsetTop-e-20;window.scrollTo(0,n)}setTimeout(()=>{document.documentElement.style.scrollBehavior="smooth"},100)}async function M(){console.log("开始加载讲座图片...");try{const t={id:1};console.log("调用getImageApi,参数:",t);const e=await I(t);console.log("接口返回:",e),e.code===200&&e.data?(i.src=e.data,console.log("讲座图片加载成功:",e.data)):(console.warn("获取图片失败:",e.msg),i.src="https://hc.homilychart.com/hc/250121/img/kecheng.jpg")}catch(t){console.error("加载讲座图片失败:",t),i.src="https://hc.homilychart.com/hc/250121/img/kecheng.jpg"}}function S(){g.style.display="flex",l.disabled=!0,l.textContent="提交中...",d=!0}function A(){g.style.display="none",l.disabled=!1,l.textContent="提交注册",d=!1}function s(t){alert(t)}function T(t){const{name:e,tel:n,email:o}=t;return!e||e.length>w?(s("请输入有效的姓名(最多50个字符)"),document.getElementById("userNameInfo").focus(),!1):!n||n.length>B?(s("请输入有效的电话号码"),document.getElementById("userMobile").focus(),!1):!o||o.length>p?(s("请输入电子邮箱"),document.getElementById("userEmail").focus(),!1):/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)?!0:(s("请输入有效的电子邮箱地址"),document.getElementById("userEmail").focus(),!1)}async function H(t){if(t.preventDefault(),d)return;const e=document.getElementById("userNameInfo").value.trim(),n=document.getElementById("countryInfo").value,o=document.getElementById("userMobile").value.trim(),m=document.getElementById("userWechat").value.trim(),y=document.getElementById("userEmail").value.trim(),h=await x(),E=await D(),a={name:e,code:n,tel:o,wechat:m,email:y,type:h,url:E};if(console.log("formData:",a),!!T(a))try{S();const r=await L(a);r.code===200?(c.classList.remove("hidden"),u.reset()):s("注册失败: "+(r.msg||"未知错误"))}catch(r){console.error("请求失败:",r),s("网络错误,请稍后重试")}finally{A()}}function P(){document.getElementById("mobileMenu").classList.toggle("hidden");const e=document.getElementById("menuBtn").querySelector("i");e.classList.contains("fa-bars")?e.classList.replace("fa-bars","fa-times"):e.classList.replace("fa-times","fa-bars")}function N(){const t=document.querySelector("header");window.scrollY>50?(t.classList.add("py-2","shadow"),t.classList.remove("py-3")):(t.classList.add("py-3"),t.classList.remove("py-2","shadow"))}function f(){document.querySelectorAll(".animate-fade-in").forEach(e=>{const n=e.getBoundingClientRect().top,o=window.innerHeight;n{document.body.classList.add("content-visible")},50)});window.addEventListener("load",()=>{console.log("页面加载完成,开始调用loadLectureImage..."),M(),f(),document.getElementById("loadingOverlay").style.display="none"});u.addEventListener("submit",H);v.addEventListener("click",()=>{c.classList.add("hidden")});c.addEventListener("click",t=>{t.target===c&&c.classList.add("hidden")});document.getElementById("menuBtn").addEventListener("click",P);window.addEventListener("scroll",N);window.addEventListener("scroll",f);function x(){const e=new URLSearchParams(window.location.search).get("type");return e==="video"?1:e==="live"?2:e==="article"?3:0}function D(){return new URLSearchParams(window.location.search).get("url")} diff --git a/dist-test/management.js b/dist-test/management.js index bbbcd49..f6dd62b 100644 --- a/dist-test/management.js +++ b/dist-test/management.js @@ -1,18 +1,23 @@ -import{u as w,e as B,a as E}from"./member.js";let o={pageSize:20,currentPage:1,total:0,items:[]};const f=document.getElementById("tableBody"),h=document.getElementById("pagination"),P=document.getElementById("totalCount");document.getElementById("currentPage");document.getElementById("showingRange");const m=document.getElementById("pageSizeSelect"),v=document.getElementById("gotoInput"),y=document.getElementById("noteModal"),l=document.getElementById("noteTextarea"),x=document.getElementById("noteCancelBtn"),M=document.getElementById("noteSaveBtn"),g=document.getElementById("toast");let u=null;function b(a){g.textContent=a,g.classList.add("show"),setTimeout(()=>g.classList.remove("show"),1e3)}async function I(a,e){try{const t=await E({page:a,page_size:e});if(typeof t.code<"u"&&t.code!==200)throw new Error(t.msg||"接口返回错误");console.log(t);const n=t.data||{};o.items=n.list,o.total=n.total}catch{alert("获取数据失败"),o.total=0}}function S(){const a=(o.currentPage-1)*o.pageSize,e=o.items||[];f.innerHTML=e.map((t,n)=>{const s=a+n+1,c=t.isRelated?"status-1":"status-0",d=t.isRelated?"已联系":"未联系";return` +import{u as B,e as L,a as E}from"./member.js";function r(){const n=localStorage.getItem("isLoggedIn")==="true",e=parseInt(localStorage.getItem("loginTime")),a=(new Date().getTime()-e)/(1e3*60*60);return!n||a>=24?(localStorage.removeItem("isLoggedIn"),localStorage.removeItem("loginTime"),!1):!0}function d(){const n=document.getElementById("loginCheckModal");n.style.display="flex"}function $(){window.location.href="login-management.html"}r()||d();document.getElementById("goToLoginBtn").addEventListener("click",$);let o={pageSize:20,currentPage:1,total:0,items:[]};const y=document.getElementById("tableBody"),w=document.getElementById("pagination"),v=document.getElementById("totalCount");document.getElementById("currentPage");document.getElementById("showingRange");const h=document.getElementById("pageSizeSelect"),x=document.getElementById("gotoInput"),b=document.getElementById("noteModal"),u=document.getElementById("noteTextarea"),M=document.getElementById("noteCancelBtn"),P=document.getElementById("noteSaveBtn"),f=document.getElementById("toast");let p=null;function I(n){f.textContent=n,f.classList.add("show"),setTimeout(()=>f.classList.remove("show"),1e3)}async function C(n,e){if(!r()){d();return}try{const t=await E({page:n,page_size:e});if(typeof t.code<"u"&&t.code!==200)throw new Error(t.msg||"接口返回错误");console.log(t);const a=t.data||{};o.items=a.list,o.total=a.total}catch{alert("获取数据失败"),o.total=0}}function S(){const n=(o.currentPage-1)*o.pageSize,e=o.items||[];y.innerHTML=e.map((t,a)=>{const s=n+a+1,c=t.isRelated?"status-1":"status-0",l=t.isRelated?"已联系":"未联系";return(t.code||"").replace(/\+/g,"")+(t.telephone||""),` ${s} ${i(t.name||"")} + + + ${i(t.code||"")} ${i(t.telephone||"")} ${i(t.wechat||"")} ${i(t.email||"")} + ${i(t.type===0?"其它":t.type===1?"视频":t.type===2?"直播":t.type===3?"帖子":"其它")} + ${i(t.url||"")} ${i(t.createdAt||"")} - + ${i(t.note||"")} - `}).join(""),P.textContent=o.total}f.addEventListener("click",async a=>{const e=a.target.closest('[data-action="toggle"]');if(e){const n=e.getAttribute("data-id");await $(n,e);return}const t=a.target.closest('[data-action="editNote"]');if(t){const n=t.getAttribute("data-id");L(n);return}});async function $(a,e){const t=o.items.find(c=>String(c.id)===String(a));if(!t)return;const n=t.isRelated,s=n?0:1;t.isRelated=s,e.textContent=s?"已联系":"未联系",e.classList.toggle("status-1",!!s),e.classList.toggle("status-0",!s);try{const c=await w({id:t.id,state:s});if(typeof c.code<"u"&&c.code!==200)throw new Error(c.msg||"更新失败");b("状态修改成功")}catch{t.isRelated=n,e.textContent=n?"已联系":"未联系",e.classList.toggle("status-1",!!n),e.classList.toggle("status-0",!n),alert("更新失败")}}function L(a){const e=o.items.find(t=>String(t.id)===String(a));e&&(u=a,l.value=e.note||"",y.style.display="flex",l.focus())}function r(){u=null,l.value="",y.style.display="none"}x.addEventListener("click",r);M.addEventListener("click",async()=>{if(!u)return r();const a=l.value.trim(),e=o.items.find(t=>String(t.id)===String(u));if(!e)return r();try{const t=await B({id:e.id,note:a});if(typeof t.code<"u"&&t.code!==200)throw new Error(t.msg||"保存失败");const n=e.note;e.note=a,S(),b("备注保存成功")}catch{alert("保存备注失败")}finally{r()}});function z(){const a=Math.max(1,Math.ceil(o.total/o.pageSize)),e=Math.min(Math.max(1,o.currentPage),a);o.currentPage=e;const t=N(e,a,2);let n="";n+=``,t.forEach(s=>{s==="..."?n+='...':n+=``}),n+=``,h.innerHTML=n}function N(a,e,t){const n=[],s=Math.max(1,a-t),c=Math.min(e,a+t);s>1&&(n.push(1),s>2&&n.push("..."));for(let d=s;d<=c;d++)n.push(d);return c{const e=a.target.closest("button");if(!e)return;const t=e.getAttribute("data-action");if(t==="prev")o.currentPage>1&&o.currentPage--;else if(t==="next"){const n=Math.max(1,Math.ceil(o.total/o.pageSize));o.currentPage{const a=parseInt(m.value,10);o.pageSize=a,o.currentPage=1,p(),v.value=""});async function p(){const a=Math.max(1,o.currentPage);o.currentPage=a,await I(o.currentPage,o.pageSize),S(),z()}function i(a){return String(a).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}p(); + `}).join(""),v.textContent=o.total}y.addEventListener("click",async n=>{if(!r()){d();return}const e=n.target.closest('[data-action="whatsapp"]');if(e){const s=e.getAttribute("data-id");T(s);return}const t=n.target.closest('[data-action="toggle"]');if(t){const s=t.getAttribute("data-id");await A(s,t);return}const a=n.target.closest('[data-action="editNote"]');if(a){const s=a.getAttribute("data-id");z(s);return}});function T(n){const e=o.items.find(c=>String(c.id)===String(n));if(!e)return;const a=(e.code||"").replace(/\+/g,"")+(e.telephone||""),s=`https://api.whatsapp.com/send?phone=${encodeURIComponent(a)}&text=${encodeURIComponent("hello欢迎来到赢在美股")}`;window.open(s,"_blank")}async function A(n,e){const t=o.items.find(c=>String(c.id)===String(n));if(!t)return;const a=t.isRelated,s=a?0:1;t.isRelated=s,e.textContent=s?"已联系":"未联系",e.classList.toggle("status-1",!!s),e.classList.toggle("status-0",!s);try{const c=await B({id:t.id,state:s});if(typeof c.code<"u"&&c.code!==200)throw new Error(c.msg||"更新失败");I("状态修改成功")}catch{t.isRelated=a,e.textContent=a?"已联系":"未联系",e.classList.toggle("status-1",!!a),e.classList.toggle("status-0",!a),alert("更新失败")}}function z(n){if(!r()){d();return}const e=o.items.find(t=>String(t.id)===String(n));e&&(p=n,u.value=e.note||"",b.style.display="flex",u.focus())}function g(){p=null,u.value="",b.style.display="none"}M.addEventListener("click",g);P.addEventListener("click",async()=>{if(!r()){d();return}if(!p)return g();const n=u.value.trim(),e=o.items.find(t=>String(t.id)===String(p));if(!e)return g();try{const t=await L({id:e.id,note:n});if(typeof t.code<"u"&&t.code!==200)throw new Error(t.msg||"保存失败");const a=e.note;e.note=n,S(),I("备注保存成功")}catch{alert("保存备注失败")}finally{g()}});function N(){const n=Math.max(1,Math.ceil(o.total/o.pageSize)),e=Math.min(Math.max(1,o.currentPage),n);o.currentPage=e;const t=k(e,n,2);let a="";a+=``,t.forEach(s=>{s==="..."?a+='...':a+=``}),a+=``,w.innerHTML=a}function k(n,e,t){const a=[],s=Math.max(1,n-t),c=Math.min(e,n+t);s>1&&(a.push(1),s>2&&a.push("..."));for(let l=s;l<=c;l++)a.push(l);return c{if(!r()){d();return}const e=n.target.closest("button");if(!e)return;const t=e.getAttribute("data-action");if(t==="prev")o.currentPage>1&&o.currentPage--;else if(t==="next"){const a=Math.max(1,Math.ceil(o.total/o.pageSize));o.currentPage{if(!r()){d();return}const n=parseInt(h.value,10);o.pageSize=n,o.currentPage=1,m(),x.value=""});async function m(){if(!r()){d();return}const n=Math.max(1,o.currentPage);o.currentPage=n,await C(o.currentPage,o.pageSize),S(),N()}function i(n){return String(n).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}r()?m():d(); diff --git a/hcdbqb-management.html b/hcdbqb-management.html index 5603f45..a24d79b 100644 --- a/hcdbqb-management.html +++ b/hcdbqb-management.html @@ -240,17 +240,18 @@ - - + + - - - - + + + + + - - + + @@ -415,6 +416,7 @@ +
#姓名#姓名 WhatsApp 国家/地区代码电话号码微信ID邮箱获客来源电话号码微信ID邮箱获客来源来源地址 添加时间是否联系备注是否联系备注 操作
${escapeHtml(item.wechat || "")} ${escapeHtml(item.email || "")} ${escapeHtml(item.type === 0 ? "其它" : item.type === 1 ? "视频" : item.type === 2 ? "直播" : item.type === 3 ? "帖子" : "其它")}${escapeHtml(item.url || "")} ${escapeHtml(item.createdAt || "")}