{"id":869,"date":"2026-10-19T12:50:25","date_gmt":"2026-10-19T04:50:25","guid":{"rendered":"http:\/\/www.yanhuyw.com\/?p=869"},"modified":"2026-10-19T14:10:07","modified_gmt":"2026-10-19T06:10:07","slug":"869","status":"publish","type":"post","link":"https:\/\/www.yanhuyw.com\/index.php\/2026\/10\/19\/869\/","title":{"rendered":"\u5bb6\u957f\u7aef\u67e5\u8be2"},"content":{"rendered":"\n<style data-wp-block-html=\"css\">\n* { margin: 0; padding: 0; box-sizing: border-box; }\nbody { font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; background: #f8fafc; color: #1f2937; }\n.wrap { max-width: 640px; margin: 0 auto; padding: 16px; min-height: 100vh; }\nheader { text-align: center; padding: 24px 0 16px; }\nheader h1 { font-size: 24px; color: #1e40af; }\nheader .sub { color: #64748b; font-size: 13px; margin-top: 4px; }\n.card { background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }\n.form-group { margin-bottom: 14px; }\n.form-group label { display: block; font-size: 13px; font-weight: 500; color: #475569; margin-bottom: 6px; }\n.form-group input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 15px; outline: none; }\n.form-group input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }\n.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 11px 20px; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; background: #2563eb; color: #fff; transition: background 0.2s; }\n.btn:hover { background: #1d4ed8; }\n.btn:disabled { background: #93c5fd; cursor: not-allowed; }\n.err { color: #dc2626; font-size: 13px; min-height: 18px; margin-top: 10px; text-align: center; }\n.score-row { display: flex; gap: 10px; margin-bottom: 6px; }\n.score-box { flex: 1; text-align: center; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 4px; }\n.score-box .num { font-size: 22px; font-weight: 700; color: #1e40af; }\n.score-box .lbl { font-size: 12px; color: #64748b; margin-top: 2px; }\n.stu-line { text-align: center; margin-bottom: 14px; }\n.stu-line .name { font-size: 18px; font-weight: 700; color: #1e293b; }\n.stu-line .grp { font-size: 12px; color: #94a3b8; margin-top: 2px; }\n.card h3 { font-size: 15px; color: #1e293b; margin-bottom: 14px; }\n.dim-item { margin-bottom: 12px; }\n.dim-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }\n.dim-name { font-weight: 500; color: #374151; }\n.dim-val { font-weight: 600; color: #2563eb; }\n.dim-bar { height: 8px; background: #f1f5f9; border-radius: 6px; overflow: hidden; }\n.dim-fill { height: 100%; background: linear-gradient(90deg, #60a5fa, #2563eb); border-radius: 6px; transition: width 0.4s; }\n.star-tag { display: inline-block; background: #fef3c7; color: #b45309; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px; margin-left: 6px; }\n.log-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 2px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }\n.log-item:last-child { border-bottom: none; }\n.log-reason { color: #374151; }\n.log-time { display: block; font-size: 11px; color: #94a3b8; margin-top: 2px; }\n.log-val { font-weight: 700; flex-shrink: 0; margin-left: 10px; }\n.pos { color: #16a34a; }\n.neg { color: #dc2626; }\n.empty { text-align: center; color: #94a3b8; font-size: 13px; padding: 20px 0; }\nfooter { text-align: center; color: #94a3b8; font-size: 12px; padding: 8px 0 24px; line-height: 1.8; }\n.back-btn { background: none; border: none; color: #2563eb; font-size: 13px; cursor: pointer; margin-top: 10px; }\n\n<\/style>\n\n<script data-wp-block-html=\"js\">\n\/\/ \u4e0e\u6559\u5e08\u7aef api \u76ee\u5f55\u4fdd\u6301\u76f8\u5bf9\u8def\u5f84\u4e00\u81f4\n    const API = 'https:\/\/www.yanhuyw.com\/jifen\/api\/view.php';\n\n    function esc(s) {\n      const d = document.createElement('div');\n      d.textContent = String(s == null ? '' : s);\n      return d.innerHTML;\n    }\n\n    async function doQuery() {\n      const name = document.getElementById('q-name').value.trim();\n      const code = document.getElementById('q-code').value.trim();\n      const errEl = document.getElementById('q-err');\n      const btn = document.getElementById('q-btn');\n      errEl.textContent = '';\n      if (!name || !code) { errEl.textContent = '\u8bf7\u8f93\u5165\u5b66\u751f\u59d3\u540d\u548c\u67e5\u8be2\u7801'; return; }\n      btn.disabled = true;\n      btn.textContent = '\u67e5\u8be2\u4e2d\u2026';\n      try {\n        const res = await fetch(API, {\n          method: 'POST',\n          headers: { 'Content-Type': 'application\/json' },\n          body: JSON.stringify({ name: name, code: code })\n        });\n        const r = await res.json();\n        if (!r.ok) { errEl.textContent = r.msg || '\u67e5\u8be2\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u518d\u8bd5'; return; }\n        renderResult(r);\n      } catch (e) {\n        errEl.textContent = '\u7f51\u7edc\u5f02\u5e38\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5';\n      } finally {\n        btn.disabled = false;\n        btn.textContent = '\ud83d\udd0d \u67e5\u8be2\u8868\u73b0';\n      }\n    }\n\n    function renderResult(r) {\n      const stu = r.student || {};\n      document.getElementById('r-name').textContent = stu.name || '';\n      document.getElementById('r-group').textContent = stu.groupName ? ('\u6240\u5c5e\u5c0f\u7ec4\uff1a' + stu.groupName) : '';\n      document.getElementById('r-total').textContent = stu.totalScore != null ? stu.totalScore : 0;\n      document.getElementById('r-month').textContent = stu.monthScore != null ? stu.monthScore : 0;\n      document.getElementById('r-week').textContent = stu.weekScore != null ? stu.weekScore : 0;\n\n      \/\/ \u516d\u7ef4\u8868\u73b0\uff1a\u6761\u5f62\u6309\u6700\u9ad8\u7ef4\u5ea6\u5f52\u4e00\u5316\n      const dims = r.dims || [];\n      const maxScore = Math.max.apply(null, dims.map(function(d) { return Math.max(0, d.score); }).concat([1]));\n      const topDim = dims.length && dims[0].score > 0 ? dims[0] : null;\n      document.getElementById('r-dims').innerHTML = dims.map(function(d) {\n        const w = Math.round(Math.max(0, d.score) \/ maxScore * 100);\n        const star = (topDim && d.key === topDim.key) ? '<span class=\"star-tag\">\ud83c\udfc5 \u7a81\u51fa<\/span>' : '';\n        return '<div class=\"dim-item\">' +\n          '<div class=\"dim-head\"><span class=\"dim-name\">' + esc(d.name) + star + '<\/span>' +\n          '<span class=\"dim-val\">' + (d.score > 0 ? '+' : '') + d.score + ' \u5206 \u00b7 ' + d.count + ' \u6b21<\/span><\/div>' +\n          '<div class=\"dim-bar\"><div class=\"dim-fill\" style=\"width:' + w + '%\"><\/div><\/div>' +\n          '<\/div>';\n      }).join('') || '<div class=\"empty\">\u6682\u65e0\u7ef4\u5ea6\u6570\u636e<\/div>';\n\n      \/\/ \u6700\u8fd1\u8868\u73b0\u8bb0\u5f55\n      const logs = r.logs || [];\n      document.getElementById('r-logs').innerHTML = logs.map(function(l) {\n        const v = Number(l.value) || 0;\n        const cls = v > 0 ? 'pos' : 'neg';\n        const sign = v > 0 ? '+' : '';\n        return '<div class=\"log-item\"><span><span class=\"log-reason\">' + esc(l.reason) + '<\/span>' +\n          '<span class=\"log-time\">' + esc(l.time) + '<\/span><\/span>' +\n          '<span class=\"log-val ' + cls + '\">' + sign + v + '<\/span><\/div>';\n      }).join('') || '<div class=\"empty\">\u6682\u65e0\u8868\u73b0\u8bb0\u5f55<\/div>';\n\n      document.getElementById('query-card').style.display = 'none';\n      document.getElementById('result').style.display = 'block';\n      window.scrollTo(0, 0);\n    }\n\n    function backToQuery() {\n      document.getElementById('result').style.display = 'none';\n      document.getElementById('query-card').style.display = 'block';\n      document.getElementById('q-code').value = '';\n    }\n<\/script>\n\n<div class=\"wrap\">\n    <header>\n      <h1>\ud83d\udccb \u5b66\u751f\u5728\u6821\u8868\u73b0\u67e5\u8be2<\/h1>\n      <div class=\"sub\">\u6570\u636e\u7531\u73ed\u4e3b\u4efb\u5b9e\u65f6\u66f4\u65b0 \u00b7 \u4ec5\u53ef\u67e5\u770b\u672c\u4eba\u4fe1\u606f<\/div>\n    <\/header>\n\n    <div class=\"card\" id=\"query-card\">\n      <div class=\"form-group\">\n        <label>\u5b66\u751f\u59d3\u540d<\/label>\n        <input type=\"text\" id=\"q-name\" placeholder=\"\u8bf7\u8f93\u5165\u5b69\u5b50\u59d3\u540d\" onkeydown=\"if(event.key==='Enter')doQuery()\">\n      <\/div>\n      <div class=\"form-group\">\n        <label>\u67e5\u8be2\u7801<\/label>\n        <input type=\"text\" id=\"q-code\" placeholder=\"4 \u4f4d\u67e5\u8be2\u7801\uff08\u5411\u73ed\u4e3b\u4efb\u7d22\u53d6\uff09\" maxlength=\"10\" onkeydown=\"if(event.key==='Enter')doQuery()\">\n      <\/div>\n      <button class=\"btn\" id=\"q-btn\" onclick=\"doQuery()\">\ud83d\udd0d \u67e5\u8be2\u8868\u73b0<\/button>\n      <div class=\"err\" id=\"q-err\"><\/div>\n    <\/div>\n\n    <div id=\"result\" style=\"display:none;\">\n      <div class=\"card\">\n        <div class=\"stu-line\">\n          <div class=\"name\" id=\"r-name\"><\/div>\n          <div class=\"grp\" id=\"r-group\"><\/div>\n        <\/div>\n        <div class=\"score-row\">\n          <div class=\"score-box\"><div class=\"num\" id=\"r-total\">0<\/div><div class=\"lbl\">\u603b\u79ef\u5206<\/div><\/div>\n          <div class=\"score-box\"><div class=\"num\" id=\"r-month\">0<\/div><div class=\"lbl\">\u672c\u6708<\/div><\/div>\n          <div class=\"score-box\"><div class=\"num\" id=\"r-week\">0<\/div><div class=\"lbl\">\u672c\u5468<\/div><\/div>\n        <\/div>\n      <\/div>\n      <div class=\"card\">\n        <h3>\ud83c\udf1f \u516d\u7ef4\u8868\u73b0<\/h3>\n        <div id=\"r-dims\"><\/div>\n      <\/div>\n      <div class=\"card\">\n        <h3>\ud83d\udcdc \u6700\u8fd1\u8868\u73b0\u8bb0\u5f55<\/h3>\n        <div id=\"r-logs\"><\/div>\n      <\/div>\n      <div style=\"text-align:center;\">\n        <button class=\"back-btn\" onclick=\"backToQuery()\">\u2190 \u67e5\u8be2\u5176\u4ed6\u5b66\u751f<\/button>\n      <\/div>\n    <\/div>\n\n    <footer>\n      \u8bf7\u59a5\u5584\u4fdd\u7ba1\u67e5\u8be2\u7801\uff0c\u52ff\u544a\u77e5\u4ed6\u4eba<br>\n      \u5982\u6709\u7591\u95ee\u8bf7\u8054\u7cfb\u73ed\u4e3b\u4efb\n    <\/footer>\n  <\/div>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udccb \u5b66\u751f\u5728\u6821\u8868\u73b0\u67e5\u8be2 \u6570\u636e\u7531\u73ed\u4e3b\u4efb\u5b9e\u65f6\u66f4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":808,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[12,1],"tags":[],"class_list":["post-869","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.yanhuyw.com\/index.php\/wp-json\/wp\/v2\/posts\/869","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yanhuyw.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yanhuyw.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yanhuyw.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yanhuyw.com\/index.php\/wp-json\/wp\/v2\/comments?post=869"}],"version-history":[{"count":3,"href":"https:\/\/www.yanhuyw.com\/index.php\/wp-json\/wp\/v2\/posts\/869\/revisions"}],"predecessor-version":[{"id":872,"href":"https:\/\/www.yanhuyw.com\/index.php\/wp-json\/wp\/v2\/posts\/869\/revisions\/872"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.yanhuyw.com\/index.php\/wp-json\/wp\/v2\/media\/808"}],"wp:attachment":[{"href":"https:\/\/www.yanhuyw.com\/index.php\/wp-json\/wp\/v2\/media?parent=869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yanhuyw.com\/index.php\/wp-json\/wp\/v2\/categories?post=869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yanhuyw.com\/index.php\/wp-json\/wp\/v2\/tags?post=869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}