openlearn-next 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AdminDirectoryView-Cai0cQqi.js → AdminDirectoryView-CD7tW4mc.js} +1 -1
- package/dist/assets/BatchPickerModal-Bt8Qx0Av.js +1 -0
- package/dist/assets/{ClassesView-Cxgfcrx1.js → ClassesView-B1B3wlkx.js} +2 -2
- package/dist/assets/CloudDriveModal-BSZaWIex.js +1 -0
- package/dist/assets/{ComputerLabView-CUCO2VIV.js → ComputerLabView-B6-twB0u.js} +1 -1
- package/dist/assets/CourseManagement-Bnezm9Vv.js +1 -0
- package/dist/assets/CourseWizardModal-BvfTvcQT.js +3 -0
- package/dist/assets/{CoursewareHubPanel-CAaf22Qm.js → CoursewareHubPanel-Cb1mAqHS.js} +1 -1
- package/dist/assets/{Dashboard-vSYAYoji.js → Dashboard-DQ91dQio.js} +2 -2
- package/dist/assets/ExportWeightModal-al1iIVxb.js +1 -0
- package/dist/assets/{HelpTour-ZgEkRnin.js → HelpTour-DwM9UBiA.js} +1 -1
- package/dist/assets/{HelpView-D3WIxMoB.js → HelpView-DLAKVpwf.js} +5 -5
- package/dist/assets/ImportLessonsModal-DwhvqzY_.js +1 -0
- package/dist/assets/{ImportModal-mkWuDoAN.js → ImportModal-CmUt1YeX.js} +1 -1
- package/dist/assets/InteractiveCoursewareViewer-DWnzq20c.js +1 -0
- package/dist/assets/{InteractiveWhiteboard-bmT1LKD6.js → InteractiveWhiteboard-CQ-4meYj.js} +12 -12
- package/dist/assets/{LazyCourseware-Bcxn_20f.js → LazyCourseware-g7b8EXR_.js} +1 -1
- package/dist/assets/{LazyWhiteboard-CJA7aRIM.js → LazyWhiteboard-B6rDWBFb.js} +1 -1
- package/dist/assets/{LessonEditorView-hdJblhmb.js → LessonEditorView-DixwX1Kw.js} +1 -1
- package/dist/assets/{LiveClassroomView-ByyIOLJC.js → LiveClassroomView-j93YOxSh.js} +1 -1
- package/dist/assets/NotificationDetailModal-CQ9PIqkD.js +1 -0
- package/dist/assets/{PluginView-B3ZolNGQ.js → PluginView-DCY4yi2h.js} +1 -1
- package/dist/assets/{ProcessLogsModal-8mVp07ic.js → ProcessLogsModal-B-PY780w.js} +1 -1
- package/dist/assets/QuizGeneratorModal-BvTcmD68.js +1 -0
- package/dist/assets/StudentAssignmentView-4R0WxStx.js +1 -0
- package/dist/assets/StudentLessonView-DZ0i9-tX.js +1 -0
- package/dist/assets/StudentPreviewModal-CfsB1dPY.js +1 -0
- package/dist/assets/StudentView-D7GtUiYR.js +2 -0
- package/dist/assets/SystemResourceLibraryModal-Ilnthwpw.js +1 -0
- package/dist/assets/TeacherView-DjnjsQ_3.js +2 -0
- package/dist/assets/{TimetableView-zce3okQn.js → TimetableView-BMsjwi-s.js} +3 -3
- package/dist/assets/index-D8x6bUeG.js +150 -0
- package/dist/assets/{index-CDTw8wSY.js → index-wdWIWwbg.js} +1 -1
- package/dist/assets/{vendor-icons-BvCtGbt1.js → vendor-icons-_c3xpwjZ.js} +1 -1
- package/dist/assets/vendor-motion-DjY2czvL.js +1 -0
- package/dist/index.html +1 -1
- package/dist/server.cjs +72 -20
- package/package.json +1 -1
- package/dist/assets/BatchPickerModal-CKQyeY6R.js +0 -1
- package/dist/assets/CloudDriveModal-TFWlPh8x.js +0 -1
- package/dist/assets/CourseManagement-DSCOjuIC.js +0 -1
- package/dist/assets/CourseWizardModal-B3QnFxvj.js +0 -3
- package/dist/assets/ExportWeightModal-BlS2auLs.js +0 -1
- package/dist/assets/ImportLessonsModal-BZZRDBRU.js +0 -1
- package/dist/assets/InteractiveCoursewareViewer-01PS40_x.js +0 -1
- package/dist/assets/NotificationDetailModal-dndFrE7p.js +0 -1
- package/dist/assets/QuizGeneratorModal-DpTFYbVJ.js +0 -1
- package/dist/assets/StudentAssignmentView-DDY7C092.js +0 -1
- package/dist/assets/StudentLessonView-BcQ7q4QF.js +0 -1
- package/dist/assets/StudentPreviewModal-ETJBF1Vc.js +0 -1
- package/dist/assets/StudentView-BOqPntx-.js +0 -1
- package/dist/assets/SystemResourceLibraryModal-tg8xnblT.js +0 -1
- package/dist/assets/TeacherView-CrbllHIm.js +0 -2
- package/dist/assets/index-BrEBeWAQ.js +0 -14
- package/dist/assets/index-eXp-qZdm.js +0 -129
- package/dist/assets/vendor-motion-Dz5URUo4.js +0 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./vendor-react-0Lg0vA-4.js";import{L as o}from"./LazyCourseware-g7b8EXR_.js";import{a9 as a,_ as x,X as c,a6 as d}from"./vendor-icons-_c3xpwjZ.js";import{M as m}from"./index-D8x6bUeG.js";import"./vendor-pdf-CVyNPGVr.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-charts-B7ViBL9w.js";function g({vfsNodes:r,currentVfsParent:n,setCurrentVfsParent:t,cloudDrivePreviewNode:l,setCloudDrivePreviewNode:i}){return e.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[e.jsxs("div",{className:"w-64 border-r border-gray-100 flex flex-col bg-gray-50 shrink-0",children:[e.jsx("div",{className:"p-3 border-b border-gray-200 flex items-center gap-2",children:e.jsxs("button",{onClick:()=>{t(null),i(null)},className:`text-sm font-medium w-full text-left flex items-center gap-2 p-2 rounded cursor-pointer ${n===null?"bg-indigo-100 text-indigo-800 font-bold":"text-gray-600 hover:bg-gray-200"}`,children:[e.jsx(a,{size:16})," Data Root"]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-2",children:[n&&e.jsxs("button",{onClick:()=>t(null),className:"flex items-center gap-2 p-2 text-xs text-indigo-600 w-full hover:bg-gray-200 rounded mb-2 font-medium cursor-pointer",children:[e.jsx(x,{className:"rotate-180",size:14})," Back to Root"]}),e.jsx("div",{className:"text-xs uppercase font-semibold text-gray-400 px-2 py-1 mb-1",children:"Current Path Nodes"}),r.filter(s=>s.type==="dir").map(s=>e.jsxs("button",{onClick:()=>{t(s.id),i(null)},className:"w-full text-left p-2 rounded text-sm text-gray-700 hover:bg-gray-200 flex items-center gap-2 group mb-1 cursor-pointer",children:[e.jsx(a,{size:14,className:"text-indigo-400 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:s.name})]},s.id))]})]}),e.jsx("div",{className:"flex-1 flex flex-col bg-white overflow-hidden min-w-0",children:l?e.jsxs("div",{className:"flex-1 flex flex-col h-full min-h-0",children:[e.jsxs("div",{className:"p-3 border-b border-gray-100 bg-gray-50 flex items-center gap-2 shrink-0",children:[e.jsx("button",{onClick:()=>i(null),className:"text-gray-500 hover:text-gray-700 cursor-pointer",children:e.jsx(c,{size:16})}),e.jsxs("span",{className:"text-sm font-medium text-gray-700",children:["Previewing: ",l.name]})]}),l.name.endsWith(".html")||l.name.endsWith(".htm")||l.content?.includes("<html")?e.jsx("div",{className:"flex-1 relative bg-gray-50",children:e.jsx(o,{coursewareId:l.id})}):e.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-white prose prose-sm max-w-none",children:e.jsx(m,{children:l.content})})]}):e.jsx("div",{className:"flex-1 p-6 overflow-y-auto",children:e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[r.length===0&&e.jsx("div",{className:"col-span-full h-32 flex items-center justify-center text-sm text-gray-400 italic",children:"This directory is empty."}),r.map(s=>e.jsxs("div",{onClick:()=>{s.type==="dir"?t(s.id):i({id:s.id,name:s.name,content:s.content||"*(Empty file)*"})},className:"border border-gray-200 hover:border-indigo-300 hover:shadow-md cursor-pointer rounded-xl p-4 flex flex-col gap-3 transition-all bg-white",children:[e.jsx("div",{className:"p-3 rounded-xl w-12 h-12 flex items-center justify-center shrink-0 shadow-sm bg-gray-50 border border-gray-100",children:s.type==="dir"?e.jsx(a,{size:24,className:"text-indigo-500"}):e.jsx(d,{size:24,className:"text-gray-500"})}),e.jsx("div",{className:"text-sm font-medium text-gray-800 break-words",children:s.name})]},s.id))]})})})]})}function v(r){return r.isOpen?e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-sm flex items-center justify-center p-6 z-50",children:e.jsxs("div",{className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-5xl h-[85vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/80 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(a,{size:20,className:"text-indigo-600"}),e.jsx("h2",{className:"font-semibold text-gray-800 text-lg",children:"Cloud Course Resource Browser"})]}),e.jsx("button",{onClick:r.onClose,className:"text-gray-400 hover:text-gray-600 font-bold p-1 hover:bg-gray-200 rounded transition-colors cursor-pointer",children:"×"})]}),e.jsx(g,{...r})]})}):null}export{v as CloudDriveModal,g as CloudDrivePanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e}from"./vendor-react-0Lg0vA-4.js";import{d as k,a6 as D,b2 as u,aW as M,aa as T,X as $,aD as A,x as O}from"./vendor-icons-BvCtGbt1.js";function q({computerLabs:o,onRefresh:m,lang:s}){const[S,h]=c.useState(!1),[p,b]=c.useState(null),[f,g]=c.useState(""),[i,y]=c.useState(5),[n,j]=c.useState(6),[N,l]=c.useState(""),[v,w]=c.useState(!1),[z,C]=c.useState(o.length>0?o[0].id:null),d=o.find(t=>t.id===(z||o[0]?.id)),L=()=>{g(""),y(5),j(6),l(""),b(null),h(!0)},E=t=>{g(t.room_number),y(t.rows),j(t.cols),l(""),b(t.id),h(!0)},P=async t=>{if(t.preventDefault(),!f.trim()){l(s==="zh"?"请输入机房编号/名称":"Please enter room name or number");return}if(i<=0||i>15){l(s==="zh"?"行数应在 1 至 15 之间":"Rows should be between 1 and 15");return}if(n<=0||n>15){l(s==="zh"?"列数应在 1 至 15 之间":"Columns should be between 1 and 15");return}try{w(!0),l("");const r=p?`/api/labs/${p}`:"/api/labs",a=await fetch(r,{method:p?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({room_number:f.trim(),rows:i,cols:n})});if(a.ok)m(),h(!1),b(null);else{const _=await a.json();l(_.error||"Server error saving lab")}}catch(r){l(r.message||"Network error")}finally{w(!1)}},R=async t=>{if(confirm(s==="zh"?"确定要删除该机房吗?删除后对应的座位分配也会被重置。":"Are you sure you want to delete this lab? Seat mappings will be cleared."))try{(await fetch(`/api/labs/${t}`,{method:"DELETE"})).ok&&(m(),z===t&&C(null))}catch(r){console.error(r)}};return e.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden",id:"lab_manager_root",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between pb-4 border-b border-gray-200 gap-4 shrink-0",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-xl font-bold text-gray-800 flex items-center gap-2",children:[e.jsx(k,{className:"text-indigo-600",size:24}),s==="zh"?"统一机房座位管理":"Unified Computer Lab Seating"]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:s==="zh"?"创建和维护物理机房编号及其行列排列规则。在此处配置机房,然后可在“班级详情”页面为班级学生分配具体的上机机位。":"Create and specify physical computer lab configurations. Once configured here, assign student seats inside each Class Details panel."})]}),e.jsxs("button",{onClick:L,className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-xl text-xs font-semibold flex items-center gap-1.5 shadow-sm transition-all focus:ring-2 focus:ring-indigo-500 cursor-pointer",children:[e.jsx(D,{size:14}),s==="zh"?"新增机房规则":"New Lab Config"]})]}),e.jsxs("div",{className:"flex-1 min-h-0 grid grid-cols-1 lg:grid-cols-12 gap-6 pt-5 overflow-hidden",children:[e.jsxs("div",{className:"lg:col-span-5 flex flex-col min-h-0 bg-white border border-gray-200 rounded-2xl shadow-xs overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 bg-gray-50 flex justify-between items-center shrink-0",children:[e.jsx("span",{className:"text-xs font-bold text-gray-700 uppercase tracking-wider block",children:s==="zh"?"机房列表":"Computer Labs"}),e.jsx("span",{className:"bg-gray-200 text-gray-700 font-bold px-2 py-0.5 rounded-full text-[10px]",children:o.length})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:o.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center text-gray-400 h-full",children:[e.jsx(k,{size:40,className:"mb-2 opacity-30"}),e.jsx("p",{className:"text-xs font-medium",children:s==="zh"?"暂无机房编号规则":"No Computer Labs configured yet."}),e.jsx("p",{className:"text-[10px] text-gray-500 mt-1",children:s==="zh"?"点击右上角按钮添加首个机房规格。":"Click the button above to add your first computer room."})]}):o.map(t=>{const r=d?.id===t.id;return e.jsxs("div",{onClick:()=>C(t.id),className:`p-3 rounded-xl border transition-all cursor-pointer flex items-center justify-between group ${r?"border-indigo-200 bg-indigo-50/50 shadow-xs":"border-gray-150 hover:border-gray-300 hover:bg-gray-50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${r?"bg-indigo-100 text-indigo-700":"bg-gray-100 text-gray-500 group-hover:bg-gray-200"}`,children:e.jsx(u,{size:16})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-bold text-gray-800",children:t.room_number}),e.jsxs("div",{className:"text-[10px] text-gray-400 font-mono mt-0.5",children:[t.rows," ",s==="zh"?"行":"Rows"," × ",t.cols," ",s==="zh"?"列":"Cols",e.jsx("span",{className:"mx-1.5",children:"•"}),t.rows*t.cols," ",s==="zh"?"个机位":"Seats"]})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity",children:[e.jsx("button",{onClick:x=>{x.stopPropagation(),E(t)},className:"p-1 text-gray-500 hover:text-indigo-600 hover:bg-white rounded transition-colors",title:s==="zh"?"编辑规则":"Edit Rule",children:e.jsx(M,{size:13})}),e.jsx("button",{onClick:x=>{x.stopPropagation(),R(t.id)},className:"p-1 text-gray-500 hover:text-rose-600 hover:bg-white rounded transition-colors",title:s==="zh"?"删除机房间":"Delete Lab",children:e.jsx(T,{size:14})})]})]},t.id)})})]}),e.jsx("div",{className:"lg:col-span-7 flex flex-col min-h-0 bg-white border border-gray-200 rounded-2xl shadow-xs overflow-hidden",children:S?e.jsxs("form",{onSubmit:P,className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 bg-gray-50 font-bold text-xs text-gray-700 uppercase tracking-wider shrink-0 flex items-center justify-between",children:[e.jsx("span",{children:p?s==="zh"?"编辑机房规则":"Edit Lab Seating":s==="zh"?"创建全新上机机房":"Create Computer Lab"}),e.jsx("button",{type:"button",onClick:()=>h(!1),className:"text-gray-400 hover:text-gray-600",children:e.jsx($,{size:16})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[N&&e.jsxs("div",{className:"p-3 bg-red-50 border border-red-200 text-red-700 text-xs rounded-xl flex items-center gap-1.5",children:[e.jsx(A,{size:14}),e.jsx("span",{children:N})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wide",children:s==="zh"?"机房编号 / 场所名称 *":"Lab Name / Number *"}),e.jsx("input",{type:"text",value:f,onChange:t=>g(t.target.value),placeholder:s==="zh"?"例如:305综合机房、软创中心、Lab A":"e.g. Lab 404, Software Sandbox, Suite C",className:"w-full text-xs p-2.5 border border-gray-300 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 rounded-xl mt-1.5",maxLength:32,required:!0})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wide",children:s==="zh"?"排列行数 (Rows) *":"Rows Direction *"}),e.jsx("input",{type:"number",value:i,onChange:t=>y(Math.max(1,parseInt(t.target.value)||1)),min:1,max:15,className:"w-full text-xs p-2.5 border border-gray-300 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 rounded-xl mt-1.5",required:!0}),e.jsx("span",{className:"text-[10px] text-gray-400 block mt-0.5",children:s==="zh"?"上下方向机位数 (最大15行)":"Horizontal sets count (Max 15)"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wide",children:s==="zh"?"排列列数 (Columns) *":"Columns Direction *"}),e.jsx("input",{type:"number",value:n,onChange:t=>j(Math.max(1,parseInt(t.target.value)||1)),min:1,max:15,className:"w-full text-xs p-2.5 border border-gray-300 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 rounded-xl mt-1.5",required:!0}),e.jsx("span",{className:"text-[10px] text-gray-400 block mt-0.5",children:s==="zh"?"左右方向机位数 (最大15列)":"Vertical sets count (Max 15)"})]})]}),e.jsxs("div",{className:"border border-dashed border-gray-200 bg-gray-50/50 p-4 rounded-xl",children:[e.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider block mb-2",children:s==="zh"?"布局网格缩略结构":"Layout Aspect Schema"}),e.jsxs("div",{className:"flex flex-col gap-1 items-center justify-center p-3 bg-white rounded-lg border border-gray-100 min-h-[120px]",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[Array.from({length:Math.min(i,6)}).map((t,r)=>e.jsxs("div",{className:"flex gap-1 justify-center",children:[Array.from({length:Math.min(n,8)}).map((x,a)=>e.jsx("div",{className:"w-4 h-4 rounded bg-indigo-100 border border-indigo-200 shrink-0"},a)),n>8&&e.jsx("div",{className:"w-4 text-[10px] text-gray-400 flex items-center justify-center",children:"..."})]},r)),i>6&&e.jsx("div",{className:"text-[10px] text-center text-gray-400 mt-1",children:"..."})]}),e.jsxs("span",{className:"text-[10px] text-gray-450 mt-3 font-medium",children:["配置容量:",i," × ",n," = ",i*n," 座位"]})]})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-100 shrink-0 flex items-center justify-end gap-2 bg-gray-50",children:[e.jsx("button",{type:"button",onClick:()=>h(!1),className:"px-4 py-2 text-xs font-semibold text-gray-500 hover:text-gray-700 bg-white hover:bg-gray-100 border border-gray-200 rounded-xl transition-all cursor-pointer",children:s==="zh"?"取消":"Cancel"}),e.jsxs("button",{type:"submit",disabled:v,className:"px-4 py-2 text-xs font-bold text-white bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 rounded-xl flex items-center gap-1 shadow-sm transition-all cursor-pointer",children:[e.jsx(O,{size:14}),e.jsx("span",{children:v?s==="zh"?"提交中...":"Saving...":s==="zh"?"提交保存":"Save Config"})]})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsx("div",{className:"p-4 border-b border-gray-100 bg-gray-50 font-bold text-xs text-gray-700 uppercase tracking-wider shrink-0",children:e.jsx("span",{children:s==="zh"?"物理排列布局预览":"Physical Classroom Layout Preview"})}),d?e.jsxs("div",{className:"flex-1 overflow-auto p-6 flex flex-col items-center justify-center bg-slate-950 text-white min-h-[300px]",children:[e.jsx("div",{className:"w-48 bg-slate-800 border border-slate-700 py-1.5 rounded text-center text-[10px] font-bold text-slate-400 uppercase tracking-widest mb-10 select-none shadow-md shrink-0",children:s==="zh"?"📽️ 讲台 / 主荧幕":"📽️ Classroom Teacher Stage / Screen"}),e.jsx("div",{className:"flex flex-col gap-3 py-4 max-w-full",children:Array.from({length:d.rows}).map((t,r)=>e.jsxs("div",{className:"flex gap-3 justify-center items-center",children:[e.jsxs("span",{className:"text-[10px] font-bold font-mono text-slate-500 w-6 text-right select-none pr-1",children:["R",r+1]}),Array.from({length:d.cols}).map((x,a)=>e.jsxs("div",{className:"group relative w-10 h-10 rounded-lg flex flex-col items-center justify-center bg-slate-800 border border-slate-700 hover:border-indigo-500 hover:bg-slate-750 font-mono text-[9px] font-semibold text-indigo-400 transition-all select-none shadow-sm cursor-help",children:[e.jsx(u,{size:14,className:"opacity-40"}),e.jsxs("span",{className:"text-[8px] text-slate-400 mt-0.5",children:[r+1,"-",a+1]}),e.jsx("div",{className:"absolute bottom-11 bg-indigo-950 text-white text-[9px] rounded px-2 py-1 hidden group-hover:block whitespace-nowrap z-30 font-sans border border-indigo-800 shadow-xl font-medium",children:s==="zh"?`第 ${r+1} 排,第 ${a+1} 列`:`Row ${r+1} / Column ${a+1}`})]},a))]},r))}),e.jsxs("div",{className:"mt-8 flex items-center justify-center gap-6 text-[10px] text-slate-400 shrink-0 select-none border-t border-slate-900 pt-4 w-full",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-3.5 h-3.5 rounded bg-slate-800 border border-slate-700 flex items-center justify-center p-0.5",children:e.jsx(u,{size:10,className:"text-indigo-400 opacity-40"})}),e.jsx("span",{children:s==="zh"?"预备上机位置 / 终端":"Empty seat console terminals"})]}),e.jsxs("div",{className:"font-mono text-slate-500",children:[s==="zh"?"总行数:":"Rows: ",e.jsx("span",{className:"text-indigo-400 font-bold",children:d.rows})," |",s==="zh"?" 总列数:":" Columns: ",e.jsx("span",{className:"text-indigo-400 font-bold",children:d.cols})," |",s==="zh"?" 配置席位:":" Total: ",e.jsx("span",{className:"text-white font-bold",children:d.rows*d.cols})]})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center p-8 text-gray-400 h-full",children:[e.jsx(u,{size:48,className:"opacity-20 mb-3"}),e.jsx("p",{className:"text-xs font-medium",children:s==="zh"?"请选择一个机房以预览其座位图":"Please select a lab config to preview details."})]})]})})]})]})}function H({computerLabs:o,onRefresh:m,lang:s}){return e.jsx(q,{computerLabs:o,onRefresh:m,lang:s})}export{H as ComputerLabView};
|
|
1
|
+
import{r as c,j as e}from"./vendor-react-0Lg0vA-4.js";import{d as k,a7 as D,b2 as u,aW as M,aa as T,X as $,aD as A,y as O}from"./vendor-icons-_c3xpwjZ.js";function q({computerLabs:o,onRefresh:m,lang:s}){const[S,h]=c.useState(!1),[p,b]=c.useState(null),[f,g]=c.useState(""),[i,y]=c.useState(5),[n,j]=c.useState(6),[N,l]=c.useState(""),[v,w]=c.useState(!1),[z,C]=c.useState(o.length>0?o[0].id:null),d=o.find(t=>t.id===(z||o[0]?.id)),L=()=>{g(""),y(5),j(6),l(""),b(null),h(!0)},E=t=>{g(t.room_number),y(t.rows),j(t.cols),l(""),b(t.id),h(!0)},P=async t=>{if(t.preventDefault(),!f.trim()){l(s==="zh"?"请输入机房编号/名称":"Please enter room name or number");return}if(i<=0||i>15){l(s==="zh"?"行数应在 1 至 15 之间":"Rows should be between 1 and 15");return}if(n<=0||n>15){l(s==="zh"?"列数应在 1 至 15 之间":"Columns should be between 1 and 15");return}try{w(!0),l("");const r=p?`/api/labs/${p}`:"/api/labs",a=await fetch(r,{method:p?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({room_number:f.trim(),rows:i,cols:n})});if(a.ok)m(),h(!1),b(null);else{const _=await a.json();l(_.error||"Server error saving lab")}}catch(r){l(r.message||"Network error")}finally{w(!1)}},R=async t=>{if(confirm(s==="zh"?"确定要删除该机房吗?删除后对应的座位分配也会被重置。":"Are you sure you want to delete this lab? Seat mappings will be cleared."))try{(await fetch(`/api/labs/${t}`,{method:"DELETE"})).ok&&(m(),z===t&&C(null))}catch(r){console.error(r)}};return e.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden",id:"lab_manager_root",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between pb-4 border-b border-gray-200 gap-4 shrink-0",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-xl font-bold text-gray-800 flex items-center gap-2",children:[e.jsx(k,{className:"text-indigo-600",size:24}),s==="zh"?"统一机房座位管理":"Unified Computer Lab Seating"]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:s==="zh"?"创建和维护物理机房编号及其行列排列规则。在此处配置机房,然后可在“班级详情”页面为班级学生分配具体的上机机位。":"Create and specify physical computer lab configurations. Once configured here, assign student seats inside each Class Details panel."})]}),e.jsxs("button",{onClick:L,className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-xl text-xs font-semibold flex items-center gap-1.5 shadow-sm transition-all focus:ring-2 focus:ring-indigo-500 cursor-pointer",children:[e.jsx(D,{size:14}),s==="zh"?"新增机房规则":"New Lab Config"]})]}),e.jsxs("div",{className:"flex-1 min-h-0 grid grid-cols-1 lg:grid-cols-12 gap-6 pt-5 overflow-hidden",children:[e.jsxs("div",{className:"lg:col-span-5 flex flex-col min-h-0 bg-white border border-gray-200 rounded-2xl shadow-xs overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 bg-gray-50 flex justify-between items-center shrink-0",children:[e.jsx("span",{className:"text-xs font-bold text-gray-700 uppercase tracking-wider block",children:s==="zh"?"机房列表":"Computer Labs"}),e.jsx("span",{className:"bg-gray-200 text-gray-700 font-bold px-2 py-0.5 rounded-full text-[10px]",children:o.length})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:o.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center text-gray-400 h-full",children:[e.jsx(k,{size:40,className:"mb-2 opacity-30"}),e.jsx("p",{className:"text-xs font-medium",children:s==="zh"?"暂无机房编号规则":"No Computer Labs configured yet."}),e.jsx("p",{className:"text-[10px] text-gray-500 mt-1",children:s==="zh"?"点击右上角按钮添加首个机房规格。":"Click the button above to add your first computer room."})]}):o.map(t=>{const r=d?.id===t.id;return e.jsxs("div",{onClick:()=>C(t.id),className:`p-3 rounded-xl border transition-all cursor-pointer flex items-center justify-between group ${r?"border-indigo-200 bg-indigo-50/50 shadow-xs":"border-gray-150 hover:border-gray-300 hover:bg-gray-50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${r?"bg-indigo-100 text-indigo-700":"bg-gray-100 text-gray-500 group-hover:bg-gray-200"}`,children:e.jsx(u,{size:16})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-bold text-gray-800",children:t.room_number}),e.jsxs("div",{className:"text-[10px] text-gray-400 font-mono mt-0.5",children:[t.rows," ",s==="zh"?"行":"Rows"," × ",t.cols," ",s==="zh"?"列":"Cols",e.jsx("span",{className:"mx-1.5",children:"•"}),t.rows*t.cols," ",s==="zh"?"个机位":"Seats"]})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity",children:[e.jsx("button",{onClick:x=>{x.stopPropagation(),E(t)},className:"p-1 text-gray-500 hover:text-indigo-600 hover:bg-white rounded transition-colors",title:s==="zh"?"编辑规则":"Edit Rule",children:e.jsx(M,{size:13})}),e.jsx("button",{onClick:x=>{x.stopPropagation(),R(t.id)},className:"p-1 text-gray-500 hover:text-rose-600 hover:bg-white rounded transition-colors",title:s==="zh"?"删除机房间":"Delete Lab",children:e.jsx(T,{size:14})})]})]},t.id)})})]}),e.jsx("div",{className:"lg:col-span-7 flex flex-col min-h-0 bg-white border border-gray-200 rounded-2xl shadow-xs overflow-hidden",children:S?e.jsxs("form",{onSubmit:P,className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 bg-gray-50 font-bold text-xs text-gray-700 uppercase tracking-wider shrink-0 flex items-center justify-between",children:[e.jsx("span",{children:p?s==="zh"?"编辑机房规则":"Edit Lab Seating":s==="zh"?"创建全新上机机房":"Create Computer Lab"}),e.jsx("button",{type:"button",onClick:()=>h(!1),className:"text-gray-400 hover:text-gray-600",children:e.jsx($,{size:16})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[N&&e.jsxs("div",{className:"p-3 bg-red-50 border border-red-200 text-red-700 text-xs rounded-xl flex items-center gap-1.5",children:[e.jsx(A,{size:14}),e.jsx("span",{children:N})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wide",children:s==="zh"?"机房编号 / 场所名称 *":"Lab Name / Number *"}),e.jsx("input",{type:"text",value:f,onChange:t=>g(t.target.value),placeholder:s==="zh"?"例如:305综合机房、软创中心、Lab A":"e.g. Lab 404, Software Sandbox, Suite C",className:"w-full text-xs p-2.5 border border-gray-300 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 rounded-xl mt-1.5",maxLength:32,required:!0})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wide",children:s==="zh"?"排列行数 (Rows) *":"Rows Direction *"}),e.jsx("input",{type:"number",value:i,onChange:t=>y(Math.max(1,parseInt(t.target.value)||1)),min:1,max:15,className:"w-full text-xs p-2.5 border border-gray-300 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 rounded-xl mt-1.5",required:!0}),e.jsx("span",{className:"text-[10px] text-gray-400 block mt-0.5",children:s==="zh"?"上下方向机位数 (最大15行)":"Horizontal sets count (Max 15)"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wide",children:s==="zh"?"排列列数 (Columns) *":"Columns Direction *"}),e.jsx("input",{type:"number",value:n,onChange:t=>j(Math.max(1,parseInt(t.target.value)||1)),min:1,max:15,className:"w-full text-xs p-2.5 border border-gray-300 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 rounded-xl mt-1.5",required:!0}),e.jsx("span",{className:"text-[10px] text-gray-400 block mt-0.5",children:s==="zh"?"左右方向机位数 (最大15列)":"Vertical sets count (Max 15)"})]})]}),e.jsxs("div",{className:"border border-dashed border-gray-200 bg-gray-50/50 p-4 rounded-xl",children:[e.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider block mb-2",children:s==="zh"?"布局网格缩略结构":"Layout Aspect Schema"}),e.jsxs("div",{className:"flex flex-col gap-1 items-center justify-center p-3 bg-white rounded-lg border border-gray-100 min-h-[120px]",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[Array.from({length:Math.min(i,6)}).map((t,r)=>e.jsxs("div",{className:"flex gap-1 justify-center",children:[Array.from({length:Math.min(n,8)}).map((x,a)=>e.jsx("div",{className:"w-4 h-4 rounded bg-indigo-100 border border-indigo-200 shrink-0"},a)),n>8&&e.jsx("div",{className:"w-4 text-[10px] text-gray-400 flex items-center justify-center",children:"..."})]},r)),i>6&&e.jsx("div",{className:"text-[10px] text-center text-gray-400 mt-1",children:"..."})]}),e.jsxs("span",{className:"text-[10px] text-gray-450 mt-3 font-medium",children:["配置容量:",i," × ",n," = ",i*n," 座位"]})]})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-100 shrink-0 flex items-center justify-end gap-2 bg-gray-50",children:[e.jsx("button",{type:"button",onClick:()=>h(!1),className:"px-4 py-2 text-xs font-semibold text-gray-500 hover:text-gray-700 bg-white hover:bg-gray-100 border border-gray-200 rounded-xl transition-all cursor-pointer",children:s==="zh"?"取消":"Cancel"}),e.jsxs("button",{type:"submit",disabled:v,className:"px-4 py-2 text-xs font-bold text-white bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 rounded-xl flex items-center gap-1 shadow-sm transition-all cursor-pointer",children:[e.jsx(O,{size:14}),e.jsx("span",{children:v?s==="zh"?"提交中...":"Saving...":s==="zh"?"提交保存":"Save Config"})]})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsx("div",{className:"p-4 border-b border-gray-100 bg-gray-50 font-bold text-xs text-gray-700 uppercase tracking-wider shrink-0",children:e.jsx("span",{children:s==="zh"?"物理排列布局预览":"Physical Classroom Layout Preview"})}),d?e.jsxs("div",{className:"flex-1 overflow-auto p-6 flex flex-col items-center justify-center bg-slate-950 text-white min-h-[300px]",children:[e.jsx("div",{className:"w-48 bg-slate-800 border border-slate-700 py-1.5 rounded text-center text-[10px] font-bold text-slate-400 uppercase tracking-widest mb-10 select-none shadow-md shrink-0",children:s==="zh"?"📽️ 讲台 / 主荧幕":"📽️ Classroom Teacher Stage / Screen"}),e.jsx("div",{className:"flex flex-col gap-3 py-4 max-w-full",children:Array.from({length:d.rows}).map((t,r)=>e.jsxs("div",{className:"flex gap-3 justify-center items-center",children:[e.jsxs("span",{className:"text-[10px] font-bold font-mono text-slate-500 w-6 text-right select-none pr-1",children:["R",r+1]}),Array.from({length:d.cols}).map((x,a)=>e.jsxs("div",{className:"group relative w-10 h-10 rounded-lg flex flex-col items-center justify-center bg-slate-800 border border-slate-700 hover:border-indigo-500 hover:bg-slate-750 font-mono text-[9px] font-semibold text-indigo-400 transition-all select-none shadow-sm cursor-help",children:[e.jsx(u,{size:14,className:"opacity-40"}),e.jsxs("span",{className:"text-[8px] text-slate-400 mt-0.5",children:[r+1,"-",a+1]}),e.jsx("div",{className:"absolute bottom-11 bg-indigo-950 text-white text-[9px] rounded px-2 py-1 hidden group-hover:block whitespace-nowrap z-30 font-sans border border-indigo-800 shadow-xl font-medium",children:s==="zh"?`第 ${r+1} 排,第 ${a+1} 列`:`Row ${r+1} / Column ${a+1}`})]},a))]},r))}),e.jsxs("div",{className:"mt-8 flex items-center justify-center gap-6 text-[10px] text-slate-400 shrink-0 select-none border-t border-slate-900 pt-4 w-full",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-3.5 h-3.5 rounded bg-slate-800 border border-slate-700 flex items-center justify-center p-0.5",children:e.jsx(u,{size:10,className:"text-indigo-400 opacity-40"})}),e.jsx("span",{children:s==="zh"?"预备上机位置 / 终端":"Empty seat console terminals"})]}),e.jsxs("div",{className:"font-mono text-slate-500",children:[s==="zh"?"总行数:":"Rows: ",e.jsx("span",{className:"text-indigo-400 font-bold",children:d.rows})," |",s==="zh"?" 总列数:":" Columns: ",e.jsx("span",{className:"text-indigo-400 font-bold",children:d.cols})," |",s==="zh"?" 配置席位:":" Total: ",e.jsx("span",{className:"text-white font-bold",children:d.rows*d.cols})]})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center p-8 text-gray-400 h-full",children:[e.jsx(u,{size:48,className:"opacity-20 mb-3"}),e.jsx("p",{className:"text-xs font-medium",children:s==="zh"?"请选择一个机房以预览其座位图":"Please select a lab config to preview details."})]})]})})]})]})}function H({computerLabs:o,onRefresh:m,lang:s}){return e.jsx(q,{computerLabs:o,onRefresh:m,lang:s})}export{H as ComputerLabView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,j as e}from"./vendor-react-0Lg0vA-4.js";import{p as h,a4 as P,a7 as v,ad as w,X as R,U as C,aB as V,aC as W,aa as Z,al as O,l as z}from"./vendor-icons-_c3xpwjZ.js";import{M as X}from"./index-D8x6bUeG.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-pdf-CVyNPGVr.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-charts-B7ViBL9w.js";function Q({lang:t,lessons:l,lessonsSearchQuery:d,setLessonsSearchQuery:c,lessonsSortOrder:k,setLessonsSortOrder:S,filteredLessons:x,onOpenImportLessons:D,onOpenCourseWizard:g,onViewCourse:u,onDeleteCourse:A,onCopyCourse:E,filterEnrollment:b,setFilterEnrollment:M,filterHasContent:p,setFilterHasContent:T,filterThisMonth:f,setFilterThisMonth:L,copyingLessonId:$}){const[r,m]=o.useState(null),[a,i]=o.useState(null),[y,j]=o.useState(!1),[F,N]=o.useState(!1),B=async s=>{m(s),i(null),N(!0);try{const n=await fetch(`/api/lessons/${s.id}/stats`);if(n.ok){const I=await n.json();i(I)}}catch{i({whiteboardCount:0,scheduleCount:0,enrollmentCount:0,assignmentCount:0})}finally{N(!1)}},U=async()=>{if(r){j(!0);try{await A(r.id),m(null),i(null)}finally{j(!1)}}};return e.jsxs("div",{className:"flex-1 flex flex-col gap-6 h-full overflow-y-auto",children:[e.jsxs("div",{className:"flex-1 bg-white border border-gray-200 rounded-xl shadow-sm flex flex-col min-h-0",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between shrink-0",children:[e.jsxs("h3",{className:"font-medium text-gray-700 flex items-center gap-2",children:[e.jsx(h,{size:16,className:"text-gray-400"}),t==="zh"?"课程与教学环节管理 (SQLite)":"Courses & Lessons Management"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{id:"import-lessons-csv-btn",onClick:D,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-indigo-50 hover:bg-indigo-100 text-indigo-700 border border-indigo-200 font-semibold rounded-lg shadow-3xs transition-all hover:shadow-xs hover:-translate-y-0.5 cursor-pointer",children:[e.jsx(P,{size:14}),t==="zh"?"批量导入课程 (CSV)":"Import Lessons (CSV)"]}),e.jsxs("button",{id:"add-course-wizard-btn",onClick:g,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-indigo-600 hover:bg-indigo-700 text-white font-semibold rounded-lg shadow-sm transition-all hover:shadow-md hover:-translate-y-0.5 cursor-pointer",children:[e.jsx(v,{size:14}),t==="zh"?"手动添加课程 (向导)":"Add Course Wizard"]})]})]}),l.length>0&&e.jsxs("div",{className:"px-5 py-3.5 border-b border-gray-100 bg-gray-50/50 flex flex-col sm:flex-row items-center justify-between gap-3 shrink-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 w-full sm:w-auto",children:[e.jsxs("div",{className:"relative w-full sm:w-64",children:[e.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-gray-400",children:e.jsx(w,{size:14})}),e.jsx("input",{type:"text",placeholder:"Search courses by title...",value:d,onChange:s=>c(s.target.value),className:"w-full pl-9 pr-8 py-1.5 text-xs bg-white border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 text-gray-800 shadow-sm"}),d&&e.jsx("button",{onClick:()=>c(""),className:"absolute inset-y-0 right-0 flex items-center pr-2.5 text-gray-400 hover:text-gray-600",children:e.jsx(R,{size:12,className:"bg-gray-100 hover:bg-gray-200 rounded-full p-0.5"})})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[11px] font-bold text-gray-400 uppercase tracking-wider",children:t==="zh"?"排序方式:":"Sort by:"}),e.jsxs("select",{value:k,onChange:s=>S(s.target.value),className:"bg-white border border-gray-200 text-xs text-gray-755 font-bold px-2.5 py-1.5 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 shadow-sm",id:"courses-sort-select",children:[e.jsx("option",{value:"recent",children:t==="zh"?"最新创建":"Most Recent"}),e.jsx("option",{value:"alphabetical",children:t==="zh"?"按名称 (A-Z)":"Alphabetical (A-Z)"}),e.jsx("option",{value:"enrollment",children:t==="zh"?"学生选课人次":"Student Enrollment Count"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{onClick:()=>M(!b),className:`px-2 py-1 text-[10px] font-bold rounded-md border transition-all cursor-pointer ${b?"bg-emerald-50 text-emerald-700 border-emerald-200":"bg-white text-gray-500 border-gray-200 hover:border-gray-300"}`,children:[e.jsx(C,{size:11,className:"inline mr-0.5 -mt-0.5"}),t==="zh"?"有人选":"Enrolled"]}),e.jsxs("button",{onClick:()=>T(!p),className:`px-2 py-1 text-[10px] font-bold rounded-md border transition-all cursor-pointer ${p?"bg-indigo-50 text-indigo-700 border-indigo-200":"bg-white text-gray-500 border-gray-200 hover:border-gray-300"}`,children:[e.jsx(h,{size:11,className:"inline mr-0.5 -mt-0.5"}),t==="zh"?"有内容":"Has Content"]}),e.jsx("button",{onClick:()=>L(!f),className:`px-2 py-1 text-[10px] font-bold rounded-md border transition-all cursor-pointer ${f?"bg-amber-50 text-amber-700 border-amber-200":"bg-white text-gray-500 border-gray-200 hover:border-gray-300"}`,children:t==="zh"?"本月":"This Month"})]}),e.jsxs("div",{className:"text-xs font-semibold text-gray-500",children:["Found ",e.jsx("span",{className:"text-indigo-650 font-bold",children:x.length})," of ",e.jsx("span",{className:"text-gray-700 font-bold",children:l.length})," course",l.length===1?"":"s"]})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:l.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-400 min-h-[300px]",children:[e.jsx(h,{size:48,className:"mb-4 opacity-30 text-indigo-500"}),e.jsx("h3",{className:"text-lg font-bold text-gray-800",children:t==="zh"?"暂无可用课程":"No Courses Available"}),e.jsx("p",{className:"mt-2 text-sm text-gray-500 text-center max-w-xs",children:t==="zh"?"系统中暂未部署任何课程。请通过下方按钮启动添加向导指南。":"There are no courses active in the system yet. Build your first curriculum!"}),e.jsxs("button",{id:"empty-add-course-btn",onClick:g,className:"mt-5 flex items-center gap-2 px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white font-bold rounded-xl shadow-md transition-all cursor-pointer",children:[e.jsx(v,{size:16}),t==="zh"?"使用向导指南来创建新课程":"Create Course via Wizard"]})]}):x.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-12 text-gray-450 text-center",children:[e.jsx(w,{size:44,className:"mb-3 opacity-30 text-gray-450"}),e.jsxs("h4",{className:"font-semibold text-gray-700 text-sm",children:['No Courses Match "',d,'"']}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 max-w-xs",children:"Double-check the spelling or try searching for another curriculum keyword."}),e.jsx("button",{onClick:()=>c(""),className:"mt-3 text-xs bg-indigo-50 hover:bg-indigo-100 text-indigo-700 border border-indigo-200 font-semibold px-3 py-1.5 rounded-lg transition-colors",children:"Clear Search Filter"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:x.map(s=>{const n=$===s.id;return e.jsxs("div",{className:`border border-gray-200 hover:border-indigo-300 rounded-xl p-4 flex flex-col bg-gray-50/50 hover:shadow-md transition-all ${n?"opacity-60 pointer-events-none":""}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[e.jsx("div",{className:"font-semibold text-gray-800 text-lg truncate cursor-pointer hover:text-indigo-600 transition-colors",title:s.title,onClick:()=>u(s.id),children:s.title}),e.jsxs("span",{className:"inline-flex items-center gap-1 bg-indigo-50 text-indigo-700 px-1.5 py-0.5 border border-indigo-100 rounded text-[10px] font-bold shrink-0",children:[e.jsx(C,{size:10,className:"text-indigo-500"}),s.enrollment_count||0]})]}),e.jsx("div",{className:"text-sm text-gray-500 line-clamp-3 mb-4 flex-1",children:e.jsx(X,{children:s.content})}),e.jsxs("div",{className:"flex justify-between items-center mt-auto",children:[e.jsxs("div",{className:"text-xs text-gray-400",children:["ID: ",s.id.substring(0,8),"..."]}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx("button",{onClick:()=>u(s.id),className:"p-1.5 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 rounded transition-colors cursor-pointer",title:t==="zh"?"查看编辑":"View & Edit",children:e.jsx(V,{size:15})}),e.jsx("button",{onClick:()=>E(s.id),className:"p-1.5 text-gray-400 hover:text-emerald-600 hover:bg-emerald-50 rounded transition-colors cursor-pointer",title:t==="zh"?"复制课程":"Copy Course",children:e.jsx(W,{size:14})}),e.jsx("button",{onClick:()=>B(s),className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded transition-colors cursor-pointer",title:t==="zh"?"删除课程":"Delete Course",children:e.jsx(Z,{size:14})})]})]})]},s.id)})})})]}),r&&e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-[2px] flex items-center justify-center z-[9999] p-4",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-2xl max-w-md w-full border border-gray-100 overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 bg-red-50 flex items-center gap-2",children:[e.jsx(O,{size:18,className:"text-red-600"}),e.jsx("h3",{className:"font-bold text-red-800 text-sm",children:t==="zh"?"确认删除课程":"Confirm Course Deletion"})]}),e.jsxs("div",{className:"p-5 space-y-3",children:[e.jsx("p",{className:"text-sm text-gray-700",children:t==="zh"?e.jsxs(e.Fragment,{children:["确定要删除课程 ",e.jsx("span",{className:"font-bold text-red-600",children:r.title})," 吗?"]}):e.jsxs(e.Fragment,{children:["Are you sure you want to delete ",e.jsx("span",{className:"font-bold text-red-600",children:r.title}),"?"]})}),e.jsx("p",{className:"text-xs text-red-600 font-medium",children:t==="zh"?"此操作不可撤销,将删除课程的所有关联数据。":"This action is irreversible and will delete all associated data."}),F?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 py-2",children:[e.jsx(z,{size:14,className:"animate-spin"}),t==="zh"?"正在统计关联数据...":"Counting related data..."]}):a?e.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 space-y-1.5 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:t==="zh"?"白板元素":"Whiteboard Elements"}),e.jsx("span",{className:"font-bold text-gray-800",children:a.whiteboardCount})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:t==="zh"?"排课记录":"Schedules"}),e.jsx("span",{className:"font-bold text-gray-800",children:a.scheduleCount})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:t==="zh"?"选课学生":"Enrollments"}),e.jsx("span",{className:"font-bold text-gray-800",children:a.enrollmentCount})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:t==="zh"?"作业任务":"Assignments"}),e.jsx("span",{className:"font-bold text-gray-800",children:a.assignmentCount})]})]}):null]}),e.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 bg-gray-50 flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>{m(null),i(null)},className:"px-4 py-2 text-xs font-medium text-gray-600 hover:bg-gray-100 border border-gray-200 rounded-lg transition-colors cursor-pointer",children:t==="zh"?"取消":"Cancel"}),e.jsxs("button",{onClick:U,disabled:y,className:"px-4 py-2 text-xs font-bold text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors cursor-pointer disabled:opacity-50 flex items-center gap-1.5",children:[y&&e.jsx(z,{size:12,className:"animate-spin"}),t==="zh"?"确认删除":"Confirm Delete"]})]})]})})]})}export{Q as CourseManagement};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{j as e,r as f}from"./vendor-react-0Lg0vA-4.js";import{m as A,M as P}from"./index-D8x6bUeG.js";import{p as y,f as j,i as W,a7 as L,g as I,D as v,_ as E,l as M}from"./vendor-icons-_c3xpwjZ.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-pdf-CVyNPGVr.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-charts-B7ViBL9w.js";function q(z){const{isCourseWizardOpen:w,setIsCourseWizardOpen:N,lang:t,wizardStep:o,setWizardStep:g,wizardIsSubmitting:x,wizardCourseTitle:p,setWizardCourseTitle:C,wizardCourseDescription:u,setWizardCourseDescription:k,wizardCourseCategory:n,setWizardCourseCategory:S,wizardCourseTimeline:i,setWizardCourseTimeline:c,wizardCourseContent:m,setWizardCourseContent:h,addToast:b,generateTemplateContent:T,handleDeployWizardCourse:D}=z;return e.jsx(e.Fragment,{children:w&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/50 backdrop-blur-sm flex items-center justify-center p-4 md:p-6 z-50 overflow-y-auto text-gray-850",children:e.jsxs(A.div,{initial:{opacity:0,y:15,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.98},className:"bg-white border text-gray-900 border-gray-250 rounded-2xl shadow-2xl w-full max-w-4xl flex flex-col overflow-hidden max-h-[92vh] font-sans text-left",children:[e.jsxs("div",{className:"p-4 md:p-5 border-b border-gray-100 flex items-center justify-between bg-slate-50 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-indigo-50 border border-indigo-100 rounded-lg text-indigo-650",children:e.jsx(y,{size:20,className:"animate-pulse"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-bold text-gray-850 text-base md:text-lg",children:t==="zh"?"⭐ 互动课程发布与时间轴向导":"⭐ Course Design Guide & Wizard"}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:t==="zh"?"遵循系统设计法,逐步构建您的学科专属教案与课堂时间轴流程。":"Follow best practices to define curriculum content, timeline segments, and deploy."})]})]}),e.jsx("button",{onClick:()=>N(!1),className:"text-gray-400 hover:text-gray-650 font-bold p-1 rounded-lg hover:bg-gray-150 transition-all text-xl leading-none",children:"×"})]}),e.jsx("div",{className:"px-6 py-4.5 border-b border-gray-50 bg-slate-50/50 flex items-center justify-between gap-2 shrink-0 select-none",children:[{step:1,zh:"1内容选题",en:"1 Background"},{step:2,zh:"2课堂脉络",en:"2 Timeslots"},{step:3,zh:"3编写大纲",en:"3 Syllabus"},{step:4,zh:"4总览部署",en:"4 Deploy"}].map((r,a)=>{const l=o===r.step,s=o>r.step;return e.jsxs(f.Fragment,{children:[e.jsxs("div",{onClick:()=>!x&&g(r.step),className:`flex items-center gap-2 cursor-pointer transition-all ${l?"text-indigo-650 font-boldScale":s?"text-emerald-600 font-medium":"text-gray-400 hover:text-gray-600"}`,children:[e.jsx("div",{className:`w-5 h-5 rounded-full flex items-center justify-center text-[10px] border ${l?"bg-indigo-600 border-indigo-600 text-white shadow-xs font-bold":s?"bg-emerald-50 border-emerald-500 text-emerald-600 font-bold":"bg-white border-gray-250 text-gray-500"}`,children:s?"✓":r.step}),e.jsx("span",{className:"text-xs font-semibold hidden sm:inline",children:t==="zh"?r.zh:r.en})]}),a<3&&e.jsx("div",{className:`flex-1 h-0.5 max-w-[40px] md:max-w-none transition-all ${o>r.step?"bg-emerald-500":"bg-gray-200"}`})]},r.step)})}),e.jsxs("div",{className:"flex-grow overflow-y-auto p-5 md:p-6 space-y-5",children:[o===1&&e.jsxs("div",{className:"space-y-4 animate-in fade-in duration-200 text-left",children:[e.jsxs("div",{className:"bg-indigo-50/70 py-3.5 px-4.5 rounded-xl border border-indigo-100 text-xs text-indigo-750 font-sans leading-relaxed flex items-start gap-2",children:[e.jsx(j,{size:16,className:"text-indigo-500 shrink-0 mt-0.5 animate-bounce"}),e.jsxs("div",{children:[e.jsx("strong",{children:t==="zh"?"设计理念:":"Instructional ConceptTip:"}),e.jsx("p",{className:"mt-0.5",children:t==="zh"?"一个高品质的课程往往始于明确的选题背景。选择适当的学科科目分类,系统不仅会按您的选择在后续步骤推荐量身定做的教案摸板,还可以一键预装适合该学科的课堂互动时间轴模板。":"Selecting a clear title and specific subject category helps pre-populate customized Markdown content outlines and specialized scheduling presets."})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 font-sans",children:[e.jsxs("div",{className:"md:col-span-2 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2",children:t==="zh"?"📍 课程/课件名称 *":"📍 Course Title *"}),e.jsx("input",{type:"text",required:!0,value:p,onChange:r=>C(r.target.value),placeholder:t==="zh"?"例:西方哲学:康德的三大批判、Python编程入门、高中物理电路并联原理":"e.g. Introduction to regressions, Western Philosophies, Lever Principles",className:"w-full px-4 py-3 border border-gray-250 rounded-xl focus:outline-none focus:ring-2 focus:ring-indigo-500 text-gray-800 text-sm shadow-xs"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2",children:t==="zh"?"🎯 课程设计简介与要点说明 (Objectives)":"🎯 Description & Lesson Objectives"}),e.jsx("textarea",{rows:4,value:u,onChange:r=>k(r.target.value),placeholder:t==="zh"?"在此处编写您的授课背景、面向学段及最关键的 2-3 个核心教学总目标。":"Write a short description stating learning outcomes and student prerequisite goals.",className:"w-full p-4 border border-gray-255 rounded-xl focus:outline-none focus:ring-2 focus:ring-indigo-500 text-gray-800 text-sm shadow-xs resize-none"})]})]}),e.jsxs("div",{className:"col-span-1 border-l border-gray-100 md:pl-6 space-y-4 text-left",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2",children:t==="zh"?"🎨 学部科目分类":"🎨 Subject Category"}),e.jsxs("select",{value:n,onChange:r=>{S(r.target.value)},className:"w-full bg-white border border-gray-250 text-gray-755 font-bold px-3 py-2.5 rounded-xl focus:outline-none focus:ring-2 focus:ring-indigo-500 shadow-xs text-sm cursor-pointer",children:[e.jsx("option",{value:"Mathematics",children:t==="zh"?"📐 基础数学与几何":"📐 Mathematics"}),e.jsx("option",{value:"ComputerScience",children:t==="zh"?"💻 计算机软件与人工智能":"💻 Computer Science"}),e.jsx("option",{value:"Literature",children:t==="zh"?"✍️ 语言文字与阅读理解":"✍️ Literature & Writing"}),e.jsx("option",{value:"Physics",children:t==="zh"?"⚡ 物理实验与自然探索":"⚡ Physics & Science"}),e.jsx("option",{value:"History",children:t==="zh"?"🏛️ 历史脉络与人地分析":"🏛️ History & Humanities"}),e.jsx("option",{value:"Art",children:t==="zh"?"🎨 交互设计与先锋创意艺术":"🎨 Visual Arts & Design"}),e.jsx("option",{value:"Other",children:t==="zh"?"🔮 交叉素养与综合学习":"🔮 General & Other"})]})]}),e.jsxs("div",{className:"bg-slate-50 p-4 rounded-xl border border-gray-100 space-y-2 select-none text-left",children:[e.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider block",children:t==="zh"?"科目时间轴专家建议":"SUBJECT HEURISTICS"}),e.jsxs("div",{className:"text-xs text-gray-600 leading-relaxed font-sans mt-1",children:[n==="Mathematics"&&(t==="zh"?"💡 数学:偏向理论推演。推荐 20分公式精讲 + 15分黑板实践互动,强化基础。":"💡 Math recommends: 20m Core Lecture + 15m Practice for theorem grounding."),n==="ComputerScience"&&(t==="zh"?"💡 计算机:偏重编码体验。推荐 15分白板代码推演 + 20分终端实验与分享。":"💡 CS recommends: 15m Algorithms + 20m Interactive workshops on virtual boards."),n==="Literature"&&(t==="zh"?"💡 语文文学:注重文本深度。推荐 10分范文研习 + 20分分组思辨,提升理解。":"💡 Lit recommends: 10m Reading Analysis + 20m Collaborative Discussions."),n==="Physics"&&(t==="zh"?"💡 科学类:逻辑导向。推荐 10分虚拟视频实验 + 20分机理讲解 + 10分钟随堂答卷。":"💡 Science recommends: 10m virtual showcase + 20m principles + 10m evaluation."),n==="History"&&(t==="zh"?"💡 历史人文:情景引入。推荐 15分人文画卷重塑 + 15分史实论驳辩论。":"💡 History recommends: 15m Context Mapping + 15m Interactive Debate panels."),n==="Art"&&(t==="zh"?"💡 视觉创意:自由度高。推荐 10分美术鉴赏 + 25分白板手绘画布互动体验。":"💡 Art recommends: 10m Aesthetics inspiration + 25m real-time board drawing."),n==="Other"&&(t==="zh"?"💡 其他科目:均分各小节时间,循序渐进,打造完整的教学循环闭环。":"💡 Generic: Divide evenly into sequential warm-up, core presentation and quiz.")]})]})]})]})]}),o===2&&e.jsxs("div",{className:"space-y-5 animate-in fade-in duration-200 text-left font-sans",children:[e.jsxs("div",{className:"bg-emerald-50/40 py-3.5 px-4.5 rounded-xl border border-emerald-100 text-xs text-emerald-850 leading-relaxed flex items-start gap-2 text-left",children:[e.jsx(W,{size:16,className:"text-emerald-555 shrink-0 mt-0.5 animate-pulse"}),e.jsxs("div",{children:[e.jsx("strong",{children:t==="zh"?"专家课堂时间轴预设:":"Dynamic Class Presets:"}),e.jsx("p",{className:"mt-0.5",children:t==="zh"?"好的教授节奏必须动静相宜。以下提供三种国际领先的精品课件时间节点设计,点击即可一键刷装配置。您也可以在下方自由增删和重新指定每个环节的长短!":"Curating temporal context maximizes classroom retention. Load from predefined templates or tweak the active steps on the dynamic table."})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2",children:t==="zh"?"💡 点击应用典型课堂框架模板 (Quick Apply)":"💡 Click to Auto-Apply Structure Presets"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[{id:"preset_standard",title:t==="zh"?"经典 5-20-15-5 讲授模式":"Traditional Dual-Lecture Paradigm",desc:t==="zh"?"由浅入深:先通过场景导入,后精讲,接着在白板配合大屏进行演练。":"Perfect dynamic for most standard classes.",segments:[{id:"seg-preset-1",title:"Course Orientation / 课堂导入",type:"intro",duration:"5m",color:"bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100",notes:"Warm up topic"},{id:"seg-preset-2",title:"Subject Core Lecture / 核心理论精讲",type:"lecture",duration:"20m",color:"bg-indigo-50 text-indigo-700 border-indigo-200 hover:bg-indigo-100",notes:"Main content slide"},{id:"seg-preset-3",title:"Interactive Lab Work / 随堂协同演练",type:"practice",duration:"15m",color:"bg-green-50 text-green-700 border-green-200 hover:bg-green-100",notes:"Exercises & questions"},{id:"seg-preset-4",title:"Wrap up / 课堂成果总结与答疑",type:"summary",duration:"5m",color:"bg-purple-50 text-purple-700 border-purple-200 hover:bg-purple-100",notes:"Check answer notes"}]},{id:"preset_seminar",title:t==="zh"?"主题讨论工作坊模式":"Active Discussion Workshop",desc:t==="zh"?"协同探究:教师5分钟破冰,学生15分钟小组演练,15分钟对决汇报,10分钟定级。":"Discussion and presentation heavy layout.",segments:[{id:"seg-preset-5",title:"Debate Scenario Brief / 讨论情境简述",type:"intro",duration:"5m",color:"bg-amber-50 text-amber-700 border-amber-200 hover:bg-amber-100",notes:"Define debate metrics"},{id:"seg-preset-6",title:"Cooperative Ideation / 精英白板协作设计",type:"practice",duration:"15m",color:"bg-green-50 text-green-700 border-green-200 hover:bg-green-100",notes:"Joint workspace analysis"},{id:"seg-preset-7",title:"Student Team Presentation / 各小组交互汇报",type:"lecture",duration:"15m",color:"bg-indigo-50 text-indigo-700 border-indigo-200 hover:bg-indigo-100",notes:"Group screen sharing"},{id:"seg-preset-8",title:"Review & Grade Feedback / 教师深度对标点评",type:"summary",duration:"10m",color:"bg-purple-50 text-purple-700 border-purple-200 hover:bg-purple-100",notes:"Score reviews"}]},{id:"preset_flipped",title:t==="zh"?"翻转课堂高强度训练":"Targeted Problem-Solving Sprint",desc:t==="zh"?"应试/解惑突破:10分钟温习,15分钟重难盲点攻坚,15分钟专项题演习。":"Perfect for exams and targeted training courses.",segments:[{id:"seg-preset-9",title:"Blind Spot Evaluation / 温史自学效果自测",type:"intro",duration:"10m",color:"bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100",notes:"Scan quiz"},{id:"seg-preset-10",title:"Advanced Principle Explores / 重难考点极限拆解",type:"lecture",duration:"15m",color:"bg-rose-50 text-rose-700 border-rose-200 hover:bg-rose-100",notes:"Analyse weak metrics"},{id:"seg-preset-11",title:"Mock Solving Battle / 核心精选题实操对抗",type:"practice",duration:"15m",color:"bg-emerald-50 text-emerald-700 border-emerald-200 hover:bg-emerald-100",notes:"Sprint workout"},{id:"seg-preset-12",title:"Anchor Recap / 知识网架构网节点固化",type:"summary",duration:"5m",color:"bg-purple-50 text-purple-700 border-purple-200 hover:bg-purple-100",notes:"Highlight checklist"}]}].map(r=>e.jsxs("button",{type:"button",onClick:()=>{c(r.segments),b(t==="zh"?"预设已刷装":"Preset Configured",t==="zh"?`已将《${r.title}》应用到您当前设计的课程中。`:`Assigned "${r.title}" timeslots.`,"success")},className:"bg-white border rounded-xl p-3 text-left transition-all hover:bg-indigo-50/20 hover:border-indigo-400 cursor-pointer active:scale-98",children:[e.jsx("div",{className:"font-bold text-gray-800 text-xs sm:text-sm",children:r.title}),e.jsx("div",{className:"text-[10px] text-gray-400 mt-1.5 leading-relaxed",children:r.desc})]},r.id))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 select-none",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider",children:t==="zh"?"📌 流程时间卡编辑 (拖拽或直接对表格字段赋值)":"📌 Custom Timeslot Table (Edit fields directly)"}),e.jsxs("button",{type:"button",onClick:()=>{const r={id:`seg-w-custom-${Date.now()}`,title:t==="zh"?`自理授课阶段 ${i.length+1}`:`Interactive Step ${i.length+1}`,type:"practice",duration:"10m",color:"bg-slate-50 text-slate-700 border-slate-200 hover:bg-slate-100",notes:""};c([...i,r])},className:"flex items-center gap-1 text-[11px] font-bold text-indigo-600 hover:text-indigo-800 cursor-pointer",children:[e.jsx(L,{size:12})," ",t==="zh"?"增设阶段":"Append Phase"]})]}),e.jsx("div",{className:"space-y-2 border border-gray-150 rounded-xl p-3.5 bg-gray-50/50",children:i.map((r,a)=>e.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-3 bg-white border border-gray-200 rounded-lg p-2.5 shadow-xs",children:[e.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[e.jsx("span",{className:"w-5 h-5 rounded-full bg-slate-100 flex items-center justify-center text-[10px] text-gray-500 font-bold shrink-0",children:a+1}),e.jsx("input",{type:"text",value:r.title,onChange:l=>{const s=[...i];s[a].title=l.target.value,c(s)},className:"font-bold text-xs text-gray-800 bg-transparent border-b border-transparent hover:border-gray-200 focus:border-indigo-500 py-0.5 px-1 focus:outline-none focus:bg-gray-50/50 rounded flex-1 sm:w-56",placeholder:"Phase Title"})]}),e.jsxs("div",{className:"flex items-center gap-2.5 w-full sm:w-auto justify-end sm:ml-auto",children:[e.jsxs("div",{className:"flex items-center gap-1 bg-slate-50 border border-gray-200 rounded px-2 py-0.5 shrink-0",children:[e.jsx("span",{className:"text-[10px] font-bold text-gray-400",children:"时长:"}),e.jsx("input",{type:"text",value:r.duration,onChange:l=>{const s=[...i];s[a].duration=l.target.value,c(s)},className:"w-8 text-[11px] text-gray-800 font-extrabold bg-transparent text-center focus:outline-none"})]}),e.jsxs("select",{value:r.type,onChange:l=>{const s=l.target.value,d=[...i];d[a].type=s,s==="intro"?d[a].color="bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100":s==="lecture"?d[a].color="bg-indigo-50 text-indigo-700 border-indigo-200 hover:bg-indigo-100":s==="practice"?d[a].color="bg-green-50 text-green-700 border-green-200 hover:bg-green-100":s==="summary"?d[a].color="bg-purple-50 text-purple-700 border-purple-200 hover:bg-purple-100":d[a].color="bg-gray-50 text-gray-700 border-gray-205 hover:bg-gray-100",c(d)},className:"bg-slate-50 border border-gray-200 text-[10px] font-bold text-gray-600 rounded p-1 focus:outline-none cursor-pointer",children:[e.jsx("option",{value:"intro",children:t==="zh"?"温习 / 导入":"Warm-up / Intro"}),e.jsx("option",{value:"lecture",children:t==="zh"?"主体 / 精讲":"Core Lecture"}),e.jsx("option",{value:"practice",children:t==="zh"?"交互白板练习":"Practice Workshop"}),e.jsx("option",{value:"summary",children:t==="zh"?"总结 / 定级":"Wrap-up / Recap"})]}),e.jsx("button",{type:"button",onClick:()=>{if(i.length<=1){alert(t==="zh"?"请保留至少一个核心环节!":"At least one segment must exist.");return}const l=i.filter((s,d)=>d!==a);c(l)},className:"text-gray-400 hover:text-rose-600 font-bold p-1 cursor-pointer text-sm select-none",title:"Delete this segment",children:"×"})]})]},r.id))}),e.jsxs("div",{className:"mt-2 text-[10px] text-right text-gray-500 font-mono select-none",children:[t==="zh"?"📈 环节累加公式:":"📈 Dynamic aggregation formula: ",e.jsx("span",{className:"text-gray-800 font-semibold",children:i.map(r=>r.duration).join(" + ")})]})]})]}),o===3&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 animate-in fade-in duration-200 font-sans text-left",children:[e.jsxs("div",{className:"space-y-3 flex flex-col h-full min-h-[360px] text-left",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-2",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider select-none shrink-0",children:t==="zh"?"✏️ 使用 Markdown 语法编写课时材料":"✏️ Lesson Materials (Markdown)"}),e.jsxs("button",{type:"button",onClick:()=>{const r=T(p,n);h(r),b(t==="zh"?"大纲模板生成成功":"Curriculum Loaded",t==="zh"?"针对所选择的模型和属性已一键刷装教案模板框架。":"Prepopulated Markdown structure.","success")},className:"flex items-center gap-1 text-xs bg-indigo-50 border border-indigo-100 text-indigo-755 hover:bg-indigo-100 px-3 py-1 rounded-lg transition-colors font-bold cursor-pointer",children:[e.jsx(j,{size:13,className:"text-indigo-500 animate-spin"}),t==="zh"?"✨ 一键生成专家级教学大纲模版":"✨ Autofill Outline Template"]})]}),e.jsx("textarea",{rows:14,value:m,onChange:r=>h(r.target.value),placeholder:t==="zh"?`# 西方哲学三大经典原理
|
|
2
|
+
|
|
3
|
+
在此输入您的具体内容讲解、白板图形绘制节点、以及课后实践任务大纲...`:"# Course curriculum content",className:"w-full flex-grow p-4 bg-slate-900 text-slate-100 border border-slate-700 rounded-xl focus:outline-none focus:ring-2 focus:ring-indigo-500 font-mono text-xs shadow-inner leading-relaxed text-left"})]}),e.jsxs("div",{className:"space-y-3 flex flex-col h-full border border-gray-150 rounded-xl bg-slate-50/50 p-4 text-left",children:[e.jsxs("span",{className:"block text-xs font-bold text-gray-400 uppercase tracking-wider select-none shrink-0",children:["🖥️ ",t==="zh"?"大纲资料实时交互渲染":"Syllabus Live Context rendering"]}),e.jsx("div",{className:"flex-grow overflow-y-auto bg-white border border-gray-150 rounded-lg p-4 text-xs font-sans text-gray-700 max-h-[380px] overflow-x-hidden text-left select-text",children:m.trim()?e.jsx("div",{className:"markdown-body",children:e.jsx(P,{children:m})}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-400 italic py-16",children:[e.jsx(y,{size:32,className:"mb-2 opacity-20 text-indigo-500"}),e.jsx("span",{children:t==="zh"?"教案空无内容,等待输入或一键填充模板...":"Waiting for materials..."})]})})]})]}),o===4&&e.jsxs("div",{className:"space-y-6 animate-in fade-in duration-200 text-center font-sans max-w-xl mx-auto py-3",children:[e.jsx("div",{className:"inline-flex p-3 bg-emerald-50 border border-emerald-100 text-emerald-500 rounded-full",children:e.jsx(I,{size:36,className:"animate-pulse text-emerald-555"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-extrabold text-gray-800 text-base md:text-lg",children:t==="zh"?"🚀 互动课程已精心筹备成功!":"🚀 Materials Generated successfully!"}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:t==="zh"?"设计与时间轴逻辑全部检验合格。请在下方核验新课卡片,确认无误一键部署入 SQLite 内核数据库。":"Curriculum parameters are ready to boot inside the Secure Host."})]}),e.jsxs("div",{className:"border border-indigo-200 rounded-2xl p-5 bg-linear-to-b from-indigo-50/20 to-white shadow-md text-left space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-indigo-50 pb-3 gap-2",children:[e.jsx("div",{className:"font-bold text-indigo-950 text-base sm:text-lg truncate",children:p||(t==="zh"?"未指定课程主题":"Blank Topic")}),e.jsx("span",{className:"inline-flex px-2 py-0.5 rounded text-[10px] font-extrabold bg-indigo-50 text-indigo-800 uppercase tracking-wide border border-indigo-150 shrink-0",children:n})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400 block tracking-wider text-[10px] font-bold",children:t==="zh"?"教研环节数":"TOTAL STEPS"}),e.jsxs("span",{className:"text-gray-800 font-extrabold text-sm block mt-1",children:[i.length," ",t==="zh"?"项教学环节":"slots"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400 block tracking-wider text-[10px] font-bold",children:t==="zh"?"发布载体引擎":"STORAGE MEDIUM"}),e.jsxs("div",{className:"flex items-center gap-1 text-emerald-650 font-extrabold text-sm mt-1",children:[e.jsx(v,{size:11,className:"text-emerald-500"}),e.jsx("span",{children:"SQLite DB"})]})]})]}),e.jsx("div",{className:"bg-slate-50 border border-gray-150 p-3 rounded-lg text-[11px] text-gray-600 line-clamp-2 italic leading-relaxed text-left",children:u||(t==="zh"?"无科目描述内容":"No description written.")}),e.jsxs("div",{className:"space-y-1.5 select-none",children:[e.jsx("span",{className:"text-[10px] font-extrabold text-gray-400 uppercase tracking-wider block",children:t==="zh"?"教学时间轴环流预览":"TIMELINE PROGRESS OVERVIEW"}),e.jsx("div",{className:"flex items-center gap-1 w-full overflow-x-auto py-1",children:i.map((r,a)=>e.jsxs(f.Fragment,{children:[e.jsxs("div",{className:`px-2 py-1 text-[10px] font-bold rounded border truncate max-w-[120px] ${r.color.split(" ")[0]}`,children:[r.title.split(" / ")[0]," (",r.duration,")"]}),a<i.length-1&&e.jsx(E,{size:11,className:"text-gray-300"})]},r.id))})]})]})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-105 bg-slate-50 flex justify-between items-center shrink-0",children:[e.jsx("span",{className:"text-[11px] font-bold font-mono text-gray-400 uppercase select-none",children:t==="zh"?"⚙️ SQLITE 写入预检通过":"⚙️ SQLITE VERIFICATION SUCCESS"}),e.jsxs("div",{className:"flex items-center gap-2",children:[o>1&&e.jsx("button",{type:"button",onClick:()=>g(r=>r-1),disabled:x,className:"px-4 py-2 text-xs font-semibold border border-gray-200 text-gray-700 bg-white hover:bg-gray-50 rounded-lg transition-colors cursor-pointer select-none",children:t==="zh"?"上一步":"Back"}),o<4?e.jsx("button",{type:"button",onClick:()=>{if(o===1&&!p.trim()){alert(t==="zh"?"请输入课程课题名称!":"Please type course title to proceed.");return}g(r=>r+1)},className:"px-4.5 py-2 text-xs font-bold bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg shadow-sm flex items-center gap-1 cursor-pointer select-none",children:t==="zh"?"继续前进":"Continue"}):e.jsx("button",{type:"button",onClick:D,disabled:x,className:"px-5 py-2 text-xs font-bold bg-emerald-600 hover:bg-emerald-700 text-white rounded-lg shadow-md flex items-center gap-1.5 cursor-pointer disabled:opacity-50 select-none animate-bounce",children:x?e.jsxs(e.Fragment,{children:[e.jsx(M,{size:13,className:"animate-spin"}),e.jsx("span",{children:t==="zh"?"写入底库中...":"Deploying..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(v,{size:13}),e.jsx("span",{children:t==="zh"?"部署并激活新课程":"Deploy & Activate"})]})})]})]})]})})})}export{q as CourseWizardModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as e}from"./vendor-react-0Lg0vA-4.js";import{F as k,X as M,ad as R,ae as V,a3 as q,r as J,g as O,J as X,af as B,h as G,aa as K}from"./vendor-icons-BvCtGbt1.js";const Q="@courseware-hub/plugin",W=h=>`${Q}.${h}`;function oe({onClose:h,lang:m}){const[p,T]=a.useState([]),[_,b]=a.useState(!1),[u,z]=a.useState(""),[g,P]=a.useState(""),[y,j]=a.useState(!1),[U,f]=a.useState(null),[n,D]=a.useState(null),[N,F]=a.useState([]),[Y,Z]=a.useState(null),[c,v]=a.useState(""),[w,S]=a.useState(60),[d,C]=a.useState(""),[ee,se]=a.useState(null),[te,ae]=a.useState(""),[re,le]=a.useState(60),i=a.useCallback(async(s,r)=>{const l=await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:W(s),payload:r??{}})});if(!l.ok){const $=await l.json();throw new Error($.error||"Command failed")}return(await l.json()).result},[]),o=a.useCallback(async()=>{b(!0);try{const s=await i("courseware.query",{status:g||void 0,search:u||void 0,limit:100});T(s?.items??[])}catch(s){console.error("Fetch courseware list failed:",s)}finally{b(!1)}},[i,g,u]);a.useEffect(()=>{o()},[o]);const L=async()=>{if(!(!c.trim()||!d.trim())){j(!0);try{await i("courseware.upload",{title:c.trim(),html_content:d,pass_score:w}),v(""),C(""),S(60),await o()}catch(s){alert(s.message)}finally{j(!1)}}},E=s=>{const r=s.target.files?.[0];if(!r)return;const l=new FileReader;l.onload=x=>C(x.target?.result??""),l.readAsText(r)},H=async(s,r)=>{const l=r==="published"?"draft":"published";try{await i("courseware.publish",{id:s,status:l}),await o()}catch(x){alert(x.message)}},I=async(s,r)=>{if(confirm(m==="zh"?`确认删除课件「${r}」及其所有版本和成绩数据?`:`Delete "${r}" and all versions/scores?`))try{await i("courseware.delete",{id:s}),await o()}catch(l){alert(l.message)}},A=async s=>{try{const r=await i("courseware.get_detail",{id:s}),l=await i("courseware.query_scores",{courseware_id:s});D(r),F(l?.items??[]),f(s)}catch(r){alert(r.message)}},t=(s,r)=>m==="zh"?s:r;return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl border border-gray-200 w-[90vw] max-w-5xl h-[85vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-600 rounded-xl",children:e.jsx(k,{size:20})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-gray-800",children:t("课件管理","Courseware Hub")}),e.jsx("p",{className:"text-xs text-gray-400",children:t("上传 HTML 课件 · 成绩采集 · 版本管理","Upload · Score Collection · Versioning")})]})]}),e.jsx("button",{onClick:h,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:e.jsx(M,{size:18,className:"text-gray-400"})})]}),U?e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[e.jsxs("button",{onClick:()=>f(null),className:"text-sm text-indigo-600 hover:underline mb-4 inline-flex items-center gap-1",children:["← ",t("返回列表","Back to list")]}),n&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-gray-50 rounded-xl p-5 border border-gray-100",children:[e.jsx("h3",{className:"font-bold text-gray-800 mb-3",children:n.title}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-2 text-sm",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-400",children:[t("版本","Version"),":"]})," ",e.jsx("span",{className:"font-mono text-gray-700",children:n.version})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-400",children:[t("状态","Status"),":"]})," ",e.jsx("span",{className:`font-bold ${n.status==="published"?"text-green-600":"text-amber-600"}`,children:n.status})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-400",children:[t("及格线","Pass Score"),":"]})," ",e.jsx("span",{className:"font-mono",children:n.pass_score})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-400",children:[t("提交数","Submissions"),":"]})," ",e.jsx("span",{className:"font-mono",children:n.stats?.submissions??0})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-400",children:[t("平均分","Avg Score"),":"]})," ",e.jsx("span",{className:"font-mono text-indigo-600 font-bold",children:n.stats?.avg_score??"-"})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-400",children:[t("通过率","Pass Rate"),":"]})," ",e.jsxs("span",{className:"font-mono",children:[n.stats?.pass_rate??"-","%"]})]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-bold text-gray-700 mb-3",children:t("成绩列表","Score List")}),N.length===0?e.jsx("p",{className:"text-sm text-gray-400 italic",children:t("暂无成绩记录","No scores yet")}):e.jsx("div",{className:"overflow-x-auto border border-gray-200 rounded-xl",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 text-gray-500 text-xs uppercase",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2 text-left",children:t("学生","Student")}),e.jsx("th",{className:"px-4 py-2 text-right",children:t("分数","Score")}),e.jsx("th",{className:"px-4 py-2 text-right",children:t("用时(秒)","Time(s)")}),e.jsx("th",{className:"px-4 py-2 text-right",children:t("提交时间","Submitted")})]})}),e.jsx("tbody",{className:"divide-y divide-gray-100",children:N.map(s=>e.jsxs("tr",{className:"hover:bg-gray-50",children:[e.jsx("td",{className:"px-4 py-2 font-medium text-gray-700",children:s.student_name||s.student_id}),e.jsxs("td",{className:`px-4 py-2 text-right font-mono font-bold ${s.score>=(n?.pass_score??60)?"text-green-600":"text-red-500"}`,children:[s.score,"/",s.total]}),e.jsx("td",{className:"px-4 py-2 text-right text-gray-500",children:s.time_spent}),e.jsx("td",{className:"px-4 py-2 text-right text-gray-400 text-xs",children:new Date(s.submitted_at).toLocaleString()})]},s.id))})]})})]})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"px-6 py-3 border-b border-gray-100 flex items-center gap-3 shrink-0 flex-wrap",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(R,{size:14,className:"absolute left-3 top-2.5 text-gray-400"}),e.jsx("input",{value:u,onChange:s=>z(s.target.value),placeholder:t("搜索课件...","Search courseware..."),className:"w-full pl-9 pr-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-1 focus:ring-indigo-500 outline-none"})]}),e.jsxs("select",{value:g,onChange:s=>P(s.target.value),className:"text-sm border border-gray-200 rounded-lg px-3 py-2 outline-none focus:ring-1 focus:ring-indigo-500 bg-white",children:[e.jsx("option",{value:"",children:t("全部状态","All Status")}),e.jsx("option",{value:"published",children:t("已发布","Published")}),e.jsx("option",{value:"draft",children:t("草稿","Draft")}),e.jsx("option",{value:"archived",children:t("已归档","Archived")})]}),e.jsx("button",{onClick:o,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",title:t("刷新","Refresh"),children:e.jsx(V,{size:16,className:"text-gray-400"})})]}),e.jsx("div",{className:"px-6 py-4 border-b border-gray-100 bg-indigo-50/30 shrink-0",children:e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("span",{className:"text-sm font-bold text-gray-600 shrink-0",children:[t("上传课件","Upload"),":"]}),e.jsx("input",{value:c,onChange:s=>v(s.target.value),placeholder:t("课件标题","Title"),className:"text-sm border border-gray-200 rounded-lg px-3 py-2 w-40 outline-none focus:ring-1 focus:ring-indigo-500"}),e.jsx("input",{type:"number",value:w,onChange:s=>S(Number(s.target.value)),placeholder:t("及格线","Pass"),className:"text-sm border border-gray-200 rounded-lg px-3 py-2 w-20 outline-none focus:ring-1 focus:ring-indigo-500"}),e.jsxs("label",{className:"text-sm px-3 py-2 border border-dashed border-gray-300 rounded-lg cursor-pointer hover:border-indigo-400 hover:bg-white transition-colors text-gray-500",children:[e.jsx(q,{size:14,className:"inline mr-1"}),d?t("已选择文件","File selected"):t("选择 HTML","Select HTML"),e.jsx("input",{type:"file",accept:".html,.htm",onChange:E,className:"hidden"})]}),e.jsx("button",{onClick:L,disabled:y||!c.trim()||!d.trim(),className:"px-4 py-2 bg-indigo-600 text-white text-sm font-bold rounded-lg hover:bg-indigo-700 disabled:opacity-40 transition-colors",children:y?t("上传中...","Uploading..."):t("上传","Upload")})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:_?e.jsx("div",{className:"text-center py-12 text-gray-400",children:t("加载中...","Loading...")}):p.length===0?e.jsxs("div",{className:"text-center py-12 text-gray-400",children:[e.jsx(k,{size:40,className:"mx-auto mb-3 opacity-30"}),e.jsx("p",{children:t("暂无课件,请上传您的第一个 HTML 课件","No courseware yet. Upload your first HTML courseware.")})]}):e.jsx("div",{className:"grid gap-4",children:p.map(s=>e.jsx("div",{className:"bg-white border border-gray-200 rounded-xl p-4 hover:border-indigo-200 transition-colors shadow-sm",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h4",{className:"font-bold text-gray-800 truncate",children:s.title}),e.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full font-bold ${s.status==="published"?"bg-green-50 text-green-650 border border-green-200":s.status==="archived"?"bg-gray-50 text-gray-500 border border-gray-200":"bg-amber-50 text-amber-650 border border-amber-200"}`,children:s.status==="published"?t("已发布","Published"):s.status==="archived"?t("已归档","Archived"):t("草稿","Draft")}),e.jsxs("span",{className:"text-[10px] text-gray-400 font-mono",children:["v",s.version]})]}),s.description&&e.jsx("p",{className:"text-xs text-gray-400 line-clamp-2 mb-2",children:s.description}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(J,{size:12}),t("提交","Subs"),": ",s.stats?.submissions??0]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O,{size:12}),t("均分","Avg"),": ",s.stats?.avg_score??"-"]}),s.security_warnings?.length>0&&e.jsxs("span",{className:"text-amber-500 flex items-center gap-1",title:s.security_warnings.join(", "),children:["⚠ ",s.security_warnings.length]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:()=>A(s.id),className:"p-1.5 hover:bg-gray-100 rounded-lg transition-colors",title:t("详情","Details"),children:e.jsx(X,{size:15,className:"text-gray-400"})}),e.jsx("button",{onClick:()=>H(s.id,s.status),className:"p-1.5 hover:bg-gray-100 rounded-lg transition-colors",title:s.status==="published"?t("下架","Unpublish"):t("发布","Publish"),children:s.status==="published"?e.jsx(B,{size:15,className:"text-amber-500"}):e.jsx(G,{size:15,className:"text-green-500"})}),e.jsx("button",{onClick:()=>I(s.id,s.title),className:"p-1.5 hover:bg-red-50 rounded-lg transition-colors",title:t("删除","Delete"),children:e.jsx(K,{size:15,className:"text-red-400"})})]})]})},s.id))})})]})]})})}export{oe as CoursewareHubPanel};
|
|
1
|
+
import{r as a,j as e}from"./vendor-react-0Lg0vA-4.js";import{F as k,X as M,ad as R,ae as V,a4 as q,r as O,g as X,N as B,af as G,h as J,aa as K}from"./vendor-icons-_c3xpwjZ.js";const Q="@courseware-hub/plugin",W=h=>`${Q}.${h}`;function oe({onClose:h,lang:m}){const[p,T]=a.useState([]),[_,b]=a.useState(!1),[u,z]=a.useState(""),[g,P]=a.useState(""),[y,j]=a.useState(!1),[U,f]=a.useState(null),[n,D]=a.useState(null),[N,F]=a.useState([]),[Y,Z]=a.useState(null),[c,v]=a.useState(""),[w,S]=a.useState(60),[d,C]=a.useState(""),[ee,se]=a.useState(null),[te,ae]=a.useState(""),[re,le]=a.useState(60),i=a.useCallback(async(s,r)=>{const l=await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:W(s),payload:r??{}})});if(!l.ok){const $=await l.json();throw new Error($.error||"Command failed")}return(await l.json()).result},[]),o=a.useCallback(async()=>{b(!0);try{const s=await i("courseware.query",{status:g||void 0,search:u||void 0,limit:100});T(s?.items??[])}catch(s){console.error("Fetch courseware list failed:",s)}finally{b(!1)}},[i,g,u]);a.useEffect(()=>{o()},[o]);const L=async()=>{if(!(!c.trim()||!d.trim())){j(!0);try{await i("courseware.upload",{title:c.trim(),html_content:d,pass_score:w}),v(""),C(""),S(60),await o()}catch(s){alert(s.message)}finally{j(!1)}}},E=s=>{const r=s.target.files?.[0];if(!r)return;const l=new FileReader;l.onload=x=>C(x.target?.result??""),l.readAsText(r)},H=async(s,r)=>{const l=r==="published"?"draft":"published";try{await i("courseware.publish",{id:s,status:l}),await o()}catch(x){alert(x.message)}},I=async(s,r)=>{if(confirm(m==="zh"?`确认删除课件「${r}」及其所有版本和成绩数据?`:`Delete "${r}" and all versions/scores?`))try{await i("courseware.delete",{id:s}),await o()}catch(l){alert(l.message)}},A=async s=>{try{const r=await i("courseware.get_detail",{id:s}),l=await i("courseware.query_scores",{courseware_id:s});D(r),F(l?.items??[]),f(s)}catch(r){alert(r.message)}},t=(s,r)=>m==="zh"?s:r;return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl border border-gray-200 w-[90vw] max-w-5xl h-[85vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-600 rounded-xl",children:e.jsx(k,{size:20})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-gray-800",children:t("课件管理","Courseware Hub")}),e.jsx("p",{className:"text-xs text-gray-400",children:t("上传 HTML 课件 · 成绩采集 · 版本管理","Upload · Score Collection · Versioning")})]})]}),e.jsx("button",{onClick:h,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:e.jsx(M,{size:18,className:"text-gray-400"})})]}),U?e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[e.jsxs("button",{onClick:()=>f(null),className:"text-sm text-indigo-600 hover:underline mb-4 inline-flex items-center gap-1",children:["← ",t("返回列表","Back to list")]}),n&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-gray-50 rounded-xl p-5 border border-gray-100",children:[e.jsx("h3",{className:"font-bold text-gray-800 mb-3",children:n.title}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-2 text-sm",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-400",children:[t("版本","Version"),":"]})," ",e.jsx("span",{className:"font-mono text-gray-700",children:n.version})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-400",children:[t("状态","Status"),":"]})," ",e.jsx("span",{className:`font-bold ${n.status==="published"?"text-green-600":"text-amber-600"}`,children:n.status})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-400",children:[t("及格线","Pass Score"),":"]})," ",e.jsx("span",{className:"font-mono",children:n.pass_score})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-400",children:[t("提交数","Submissions"),":"]})," ",e.jsx("span",{className:"font-mono",children:n.stats?.submissions??0})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-400",children:[t("平均分","Avg Score"),":"]})," ",e.jsx("span",{className:"font-mono text-indigo-600 font-bold",children:n.stats?.avg_score??"-"})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-400",children:[t("通过率","Pass Rate"),":"]})," ",e.jsxs("span",{className:"font-mono",children:[n.stats?.pass_rate??"-","%"]})]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-bold text-gray-700 mb-3",children:t("成绩列表","Score List")}),N.length===0?e.jsx("p",{className:"text-sm text-gray-400 italic",children:t("暂无成绩记录","No scores yet")}):e.jsx("div",{className:"overflow-x-auto border border-gray-200 rounded-xl",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 text-gray-500 text-xs uppercase",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2 text-left",children:t("学生","Student")}),e.jsx("th",{className:"px-4 py-2 text-right",children:t("分数","Score")}),e.jsx("th",{className:"px-4 py-2 text-right",children:t("用时(秒)","Time(s)")}),e.jsx("th",{className:"px-4 py-2 text-right",children:t("提交时间","Submitted")})]})}),e.jsx("tbody",{className:"divide-y divide-gray-100",children:N.map(s=>e.jsxs("tr",{className:"hover:bg-gray-50",children:[e.jsx("td",{className:"px-4 py-2 font-medium text-gray-700",children:s.student_name||s.student_id}),e.jsxs("td",{className:`px-4 py-2 text-right font-mono font-bold ${s.score>=(n?.pass_score??60)?"text-green-600":"text-red-500"}`,children:[s.score,"/",s.total]}),e.jsx("td",{className:"px-4 py-2 text-right text-gray-500",children:s.time_spent}),e.jsx("td",{className:"px-4 py-2 text-right text-gray-400 text-xs",children:new Date(s.submitted_at).toLocaleString()})]},s.id))})]})})]})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"px-6 py-3 border-b border-gray-100 flex items-center gap-3 shrink-0 flex-wrap",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(R,{size:14,className:"absolute left-3 top-2.5 text-gray-400"}),e.jsx("input",{value:u,onChange:s=>z(s.target.value),placeholder:t("搜索课件...","Search courseware..."),className:"w-full pl-9 pr-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-1 focus:ring-indigo-500 outline-none"})]}),e.jsxs("select",{value:g,onChange:s=>P(s.target.value),className:"text-sm border border-gray-200 rounded-lg px-3 py-2 outline-none focus:ring-1 focus:ring-indigo-500 bg-white",children:[e.jsx("option",{value:"",children:t("全部状态","All Status")}),e.jsx("option",{value:"published",children:t("已发布","Published")}),e.jsx("option",{value:"draft",children:t("草稿","Draft")}),e.jsx("option",{value:"archived",children:t("已归档","Archived")})]}),e.jsx("button",{onClick:o,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",title:t("刷新","Refresh"),children:e.jsx(V,{size:16,className:"text-gray-400"})})]}),e.jsx("div",{className:"px-6 py-4 border-b border-gray-100 bg-indigo-50/30 shrink-0",children:e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("span",{className:"text-sm font-bold text-gray-600 shrink-0",children:[t("上传课件","Upload"),":"]}),e.jsx("input",{value:c,onChange:s=>v(s.target.value),placeholder:t("课件标题","Title"),className:"text-sm border border-gray-200 rounded-lg px-3 py-2 w-40 outline-none focus:ring-1 focus:ring-indigo-500"}),e.jsx("input",{type:"number",value:w,onChange:s=>S(Number(s.target.value)),placeholder:t("及格线","Pass"),className:"text-sm border border-gray-200 rounded-lg px-3 py-2 w-20 outline-none focus:ring-1 focus:ring-indigo-500"}),e.jsxs("label",{className:"text-sm px-3 py-2 border border-dashed border-gray-300 rounded-lg cursor-pointer hover:border-indigo-400 hover:bg-white transition-colors text-gray-500",children:[e.jsx(q,{size:14,className:"inline mr-1"}),d?t("已选择文件","File selected"):t("选择 HTML","Select HTML"),e.jsx("input",{type:"file",accept:".html,.htm",onChange:E,className:"hidden"})]}),e.jsx("button",{onClick:L,disabled:y||!c.trim()||!d.trim(),className:"px-4 py-2 bg-indigo-600 text-white text-sm font-bold rounded-lg hover:bg-indigo-700 disabled:opacity-40 transition-colors",children:y?t("上传中...","Uploading..."):t("上传","Upload")})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:_?e.jsx("div",{className:"text-center py-12 text-gray-400",children:t("加载中...","Loading...")}):p.length===0?e.jsxs("div",{className:"text-center py-12 text-gray-400",children:[e.jsx(k,{size:40,className:"mx-auto mb-3 opacity-30"}),e.jsx("p",{children:t("暂无课件,请上传您的第一个 HTML 课件","No courseware yet. Upload your first HTML courseware.")})]}):e.jsx("div",{className:"grid gap-4",children:p.map(s=>e.jsx("div",{className:"bg-white border border-gray-200 rounded-xl p-4 hover:border-indigo-200 transition-colors shadow-sm",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h4",{className:"font-bold text-gray-800 truncate",children:s.title}),e.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full font-bold ${s.status==="published"?"bg-green-50 text-green-650 border border-green-200":s.status==="archived"?"bg-gray-50 text-gray-500 border border-gray-200":"bg-amber-50 text-amber-650 border border-amber-200"}`,children:s.status==="published"?t("已发布","Published"):s.status==="archived"?t("已归档","Archived"):t("草稿","Draft")}),e.jsxs("span",{className:"text-[10px] text-gray-400 font-mono",children:["v",s.version]})]}),s.description&&e.jsx("p",{className:"text-xs text-gray-400 line-clamp-2 mb-2",children:s.description}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O,{size:12}),t("提交","Subs"),": ",s.stats?.submissions??0]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(X,{size:12}),t("均分","Avg"),": ",s.stats?.avg_score??"-"]}),s.security_warnings?.length>0&&e.jsxs("span",{className:"text-amber-500 flex items-center gap-1",title:s.security_warnings.join(", "),children:["⚠ ",s.security_warnings.length]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:()=>A(s.id),className:"p-1.5 hover:bg-gray-100 rounded-lg transition-colors",title:t("详情","Details"),children:e.jsx(B,{size:15,className:"text-gray-400"})}),e.jsx("button",{onClick:()=>H(s.id,s.status),className:"p-1.5 hover:bg-gray-100 rounded-lg transition-colors",title:s.status==="published"?t("下架","Unpublish"):t("发布","Publish"),children:s.status==="published"?e.jsx(G,{size:15,className:"text-amber-500"}):e.jsx(J,{size:15,className:"text-green-500"})}),e.jsx("button",{onClick:()=>I(s.id,s.title),className:"p-1.5 hover:bg-red-50 rounded-lg transition-colors",title:t("删除","Delete"),children:e.jsx(K,{size:15,className:"text-red-400"})})]})]})},s.id))})})]})]})})}export{oe as CoursewareHubPanel};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{r as c,j as e}from"./vendor-react-0Lg0vA-4.js";import{A as V,m as
|
|
1
|
+
import{r as c,j as e}from"./vendor-react-0Lg0vA-4.js";import{A as V,m as O,E as X}from"./index-D8x6bUeG.js";import{am as J,X as H,Q as B,W as K,p as q,an as Y,g as Z,U as Q,f as ee,F as se,l as te,ao as le,a7 as ae,a9 as ne,ag as re,b as U,ap as G,y as ie,i as oe}from"./vendor-icons-_c3xpwjZ.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-pdf-CVyNPGVr.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-charts-B7ViBL9w.js";function de({classes:x,lessons:n,lang:g,onScheduleClass:z,onGenerateAssignment:A,onCreateLesson:E}){const[m,v]=c.useState(!1),[r,h]=c.useState("menu"),[y,N]=c.useState(""),[w,p]=c.useState(""),[C,T]=c.useState(""),[k,L]=c.useState(""),[D,F]=c.useState(""),[P,M]=c.useState(""),[S,I]=c.useState(""),[_,f]=c.useState(!1),[$,l]=c.useState(!1),[o,i]=c.useState(null),s={zh:{quickActions:"快捷操作指令",quickDesc:"无需切换页面,在此直接向教育总线或班级下发运行调度命令。",scheduleClass:"排课计划调度",scheduleDesc:"为班级分配课程段并指定授课时间",generateAssignment:"生成 AI 测验任务",generateDesc:"利用代理模型为班级定制专属能力题目",createLesson:"注册教学课件",createDesc:"发布新的富文本 Markdown 教材大纲",back:"返回上级",confirm:"确认并下发指令",classSelect:"选择目标班级",lessonSelect:"选择关联课件",dateSelect:"授课日期选择",assignmentTopic:"测验主题方向 / 核心知识点",assignmentTopicPlaceholder:"例: 一元二次方程,光合作用,牛顿运动定律等...",lessonTitle:"课件名称(大纲标题)",lessonTitlePlaceholder:"例: 量子力学初步 / 物理实验基础",lessonContent:"详细授课内容 (Markdown 支持)",successScheduled:"排课成功!总线已捕获日程数据。",successAssignment:"AI 测验任务成功生成,稍后同步。",successLesson:"新课件发布成功!画板白板可直接拖拽加载。",emptyClasses:"未检测到活跃班级",emptyLessons:"未检测到可用课件",loadingBus:"内核微服务运行中...",genericError:"网络或核指令总线调用失败,请重试"},en:{quickActions:"Quick Actions",quickDesc:"Deploy scheduler and class orchestration bus commands instantly from here.",scheduleClass:"Schedule Lesson Period",scheduleDesc:"Assign a lesson package and scheduled date to an active class",generateAssignment:"Generate AI Assignment",generateDesc:"Deploy agent workflows to design tailored student test cases",createLesson:"Register Lesson Curriculum",createDesc:"Publish new rich Markdown-based whiteboard syllabus",back:"Back",confirm:"Execute Command",classSelect:"Select Class",lessonSelect:"Select Lesson Template",dateSelect:"Choose Scheduled Date",assignmentTopic:"Assignment Topic / Target Knowledge",assignmentTopicPlaceholder:"e.g., Quadratic equations, Photosynthesis, Newtonian gravity...",lessonTitle:"Lesson Curriculum Title",lessonTitlePlaceholder:"e.g., Intro to Quantum Mechanics",lessonContent:"Whiteboard Curriculum Content (Markdown)",successScheduled:"Success! Dynamic class schedule updated.",successAssignment:"Success! AI is compiling custom quiz structures.",successLesson:"Success! Ready to orchestrate inside classroom sandbox.",emptyClasses:"No classes discovered",emptyLessons:"No lessons discovered",loadingBus:"Interfacing core services...",genericError:"System bus execute command failure, please retry"}}[g],a=()=>{N(""),p(""),T(""),L(""),F(""),M(""),I(""),i(null),l(!1),f(!1)},d=()=>{switch(r){case"schedule":return s.successScheduled;case"assignment":return s.successAssignment;case"lesson":return s.successLesson;default:return""}},b=t=>{a(),h(t),x.length>0&&(N(x[0].id),L(x[0].id)),n.length>0&&p(n[0].id),t==="lesson"&&I(`# 新课件名称
|
|
2
2
|
|
|
3
3
|
## 教学目标
|
|
4
4
|
- 掌握核心考点
|
|
5
5
|
- 熟练完成基础物理实验
|
|
6
6
|
|
|
7
7
|
## 课堂探究
|
|
8
|
-
这里写课本的主要讲授要点。`)},j=async t=>{t.preventDefault(),f(!0),i(null);try{let u=!1;if(r==="schedule"){if(!y||!w||!C){i("Please complete all form fields."),f(!1);return}u=await z(y,w,C)}else if(r==="assignment"){if(!k||!D.trim()){i("Please specify target class and a valid topic."),f(!1);return}u=await A(k,D.trim())}else if(r==="lesson"){if(!P.trim()||!S.trim()){i("Title and Content can not be empty."),f(!1);return}u=await E(P.trim(),S.trim())}u?(l(!0),setTimeout(()=>{l(!1),h("menu")},2200)):i(s.genericError)}catch(u){i(u.message||s.genericError)}finally{f(!1)}};return e.jsxs("div",{id:"quick-actions-fab-container",className:"absolute bottom-8 right-8 z-40 flex flex-col items-end",children:[e.jsx(V,{children:m&&e.jsxs($.div,{initial:{opacity:0,y:15,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:15,scale:.95},transition:{duration:.18},className:"mb-4 w-[360px] sm:w-[420px] bg-white border border-gray-200 rounded-2xl shadow-xl overflow-hidden flex flex-col focus:outline-none",id:"quick-actions-popup-card",children:[e.jsxs("div",{className:"bg-indigo-600 px-5 py-4 text-white flex items-center justify-between shadow-inner",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(X,{size:18,className:"animate-pulse"}),e.jsx("h3",{className:"font-bold text-sm tracking-wide",children:s.quickActions})]}),e.jsx("button",{onClick:()=>{v(!1),h("menu")},className:"text-white/80 hover:text-white hover:bg-white/15 p-1 rounded-full transition-all focus:outline-none",title:"Close Portal",children:e.jsx(H,{size:16})})]}),e.jsxs("div",{className:"p-5 max-h-[480px] overflow-y-auto bg-gray-50/50",children:[r==="menu"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-[11px] text-gray-500 leading-relaxed font-medium bg-indigo-50/50 border border-indigo-100 p-2.5 rounded-lg mb-4",children:s.quickDesc}),e.jsxs("div",{onClick:()=>b("schedule"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-indigo-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-schedule-class",children:[e.jsx("div",{className:"p-2.5 bg-indigo-50 text-indigo-600 rounded-lg group-hover:bg-indigo-600 group-hover:text-white transition-colors duration-200",children:e.jsx(B,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-indigo-600 transition-colors uppercase tracking-wider",children:s.scheduleClass}),e.jsx("p",{className:"text-[11px] text-gray-500 mt-1 leading-relaxed",children:s.scheduleDesc})]})]}),e.jsxs("div",{onClick:()=>b("assignment"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-purple-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-generate-assignment",children:[e.jsx("div",{className:"p-2.5 bg-purple-50 text-purple-600 rounded-lg group-hover:bg-purple-600 group-hover:text-white transition-colors duration-200",children:e.jsx(J,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-purple-600 transition-colors uppercase tracking-wider",children:s.generateAssignment}),e.jsx("p",{className:"text-[11px] text-gray-500 mt-1 leading-relaxed",children:s.generateDesc})]})]}),e.jsxs("div",{onClick:()=>b("lesson"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-emerald-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-create-lesson",children:[e.jsx("div",{className:"p-2.5 bg-emerald-50 text-emerald-600 rounded-lg group-hover:bg-emerald-600 group-hover:text-white transition-colors duration-200",children:e.jsx(q,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-emerald-600 transition-colors uppercase tracking-wider",children:s.createLesson}),e.jsx("p",{className:"text-[11px] text-gray-500 mt-1 leading-relaxed",children:s.createDesc})]})]})]}),r!=="menu"&&e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>h("menu"),className:"flex items-center gap-1.5 text-xs text-gray-500 hover:text-indigo-600 font-semibold mb-4 cursor-pointer focus:outline-none",id:"action-back-button",children:[e.jsx(K,{size:14}),e.jsx("span",{children:s.back})]}),O?e.jsxs($.div,{initial:{scale:.95},animate:{scale:1},className:"flex flex-col items-center justify-center py-10 text-center",children:[e.jsx(Y,{size:48,className:"text-green-500 animate-bounce mb-3"}),e.jsx("h4",{className:"font-bold text-green-800 text-sm",children:d()}),e.jsx("p",{className:"text-[11px] text-gray-400 mt-1",children:"Returning to action console..."})]}):e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[o&&e.jsxs("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-red-600 text-xs font-semibold",children:["⚠️ ",o]}),r==="schedule"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(Q,{size:12})," ",s.classSelect]}),x.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:s.emptyClasses}):e.jsx("select",{value:y,onChange:t=>N(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:x.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(q,{size:12})," ",s.lessonSelect]}),n.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:s.emptyLessons}):e.jsx("select",{value:w,onChange:t=>p(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:n.map(t=>e.jsx("option",{value:t.id,children:t.title},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(B,{size:12})," ",s.dateSelect]}),e.jsx("input",{type:"date",value:C,onChange:t=>T(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]})]}),r==="assignment"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(Q,{size:12})," ",s.classSelect]}),x.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:s.emptyClasses}):e.jsx("select",{value:k,onChange:t=>L(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:x.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(Z,{size:12})," ",s.assignmentTopic]}),e.jsx("input",{type:"text",value:D,onChange:t=>F(t.target.value),placeholder:s.assignmentTopicPlaceholder,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]})]}),r==="lesson"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(ee,{size:12})," ",s.lessonTitle]}),e.jsx("input",{type:"text",value:P,onChange:t=>M(t.target.value),placeholder:s.lessonTitlePlaceholder,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(q,{size:12})," ",s.lessonContent]}),e.jsx("textarea",{value:S,onChange:t=>I(t.target.value),rows:5,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 font-mono text-gray-700",required:!0})]})]}),e.jsx("button",{type:"submit",disabled:_||r==="schedule"&&(x.length===0||n.length===0)||r==="assignment"&&x.length===0,className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs py-2.5 px-4 rounded-xl flex items-center justify-center gap-2 cursor-pointer transition-all shadow-md active:scale-98 disabled:opacity-50",children:_?e.jsxs(e.Fragment,{children:[e.jsx(se,{size:14,className:"animate-spin"}),e.jsx("span",{children:s.loadingBus})]}):e.jsxs(e.Fragment,{children:[e.jsx(te,{size:13}),e.jsx("span",{children:s.confirm})]})})]})]})]})]})}),e.jsxs("button",{onClick:()=>{v(!m),h("menu")},className:"w-14 h-14 bg-indigo-600 hover:bg-indigo-700 text-white rounded-full flex items-center justify-center shadow-lg hover:shadow-indigo-200 hover:shadow-2xl transition-all duration-250 cursor-pointer active:scale-95 focus:outline-none relative group",title:"Trigger Education OS Quick Scheduler Command Panel",id:"quick-actions-fab-button",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-purple-400 opacity-20 group-hover:animate-ping"}),e.jsx($.div,{animate:{rotate:m?135:0},transition:{duration:.2},className:"flex items-center justify-center text-white",children:e.jsx(le,{size:24,strokeWidth:2.8})})]})]})}function fe(x){const{lang:n,t:g,lessons:z,classes:A,students:E,todaySchedules:m,approvals:v,processes:r,isApprovalsCollapsed:h,setIsApprovalsCollapsed:y,isProcessesCollapsed:N,setIsProcessesCollapsed:w,scoreOverrides:p,setScoreOverrides:C,handleApprove:T,handleReject:k,showLogs:L,setShowLogs:D,processLogsContent:F,showProcessLogs:P,fetchProcessLogs:M,setShowProcessLogs:S,addToast:I,handleQuickScheduleClass:_,handleQuickGenerateAssignment:f,handleQuickCreateLesson:O}=x;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-1 flex flex-col gap-6 h-full overflow-y-auto pr-2",children:[(()=>{const l=a=>{if(a.status==="cancelled"||a.status==="holiday")return!1;if(!a.time_slot)return!0;try{const d=a.time_slot.split("-");if(d.length<2)return!0;const b=d[1].trim(),[j,t]=b.split(":").map(Number),u=new Date,R=u.getHours(),W=u.getMinutes();return!(R>j||R===j&&W>=t)}catch{return!0}},o=m.filter(l),i=m.length-o.length;m.filter(a=>a.status==="cancelled"||a.status==="holiday");const s=o[0];return e.jsxs("div",{className:"bg-white border border-slate-200/80 rounded-2xl p-5 text-slate-800 shadow-sm flex flex-col md:flex-row justify-between items-stretch gap-6 transition-all duration-300",children:[e.jsx("div",{className:"flex-1 flex flex-col justify-between bg-slate-50/50 rounded-xl p-4.5 border border-slate-200/60 min-h-[160px]",children:s?e.jsxs("div",{className:"flex-1 flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"bg-amber-400 text-slate-950 text-[10px] font-extrabold px-2.5 py-0.5 rounded-full uppercase tracking-wider animate-pulse shadow-xs",children:n==="zh"?"下一堂面授课":"NEXT CLASS"}),e.jsx("span",{className:"font-mono text-xs text-indigo-700 font-bold bg-indigo-50 px-2 py-0.5 rounded-md border border-indigo-100/30",children:s.time_slot})]}),e.jsx("h3",{className:"text-lg md:text-xl font-extrabold tracking-tight mt-3 text-slate-800 line-clamp-2",title:s.lesson_title,children:s.lesson_title}),e.jsxs("p",{className:"text-xs text-slate-500 mt-2 font-medium",children:["📍 ",s.class_name," ",s.classroom&&` | 教室: ${s.classroom}`," ",s.teacher_name&&` | 教师: ${s.teacher_name}`]})]}),s.notes&&e.jsxs("div",{className:"mt-3 text-xs italic text-indigo-700 bg-indigo-50/60 p-2 rounded-lg border border-indigo-100/40 truncate",title:s.notes,children:["* ",s.notes]})]}):e.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center text-center py-6 select-none",children:[e.jsx("span",{className:"text-3xl animate-bounce",children:"☕"}),e.jsx("h3",{className:"text-base font-extrabold text-slate-850 mt-2",children:n==="zh"?"今日课程已全部结束":"All Classes Finished"}),e.jsx("p",{className:"text-xs text-slate-455 mt-1 max-w-[280px]",children:n==="zh"?"接下来暂无排定课次,您可以休息调整。":"No remaining schedules today. Take a rest!"})]})}),e.jsxs("div",{className:"w-full md:w-[300px] lg:w-[350px] flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-center border-b border-slate-200/80 pb-2",children:[e.jsxs("span",{className:"text-[11px] uppercase font-extrabold tracking-wider text-indigo-600 flex items-center gap-1.5",children:["📅 ",n==="zh"?"今日面授排课流":"TODAY'S SCHEDULES"]}),e.jsx("span",{className:"text-[10px] text-slate-500 font-medium",children:n==="zh"?`共 ${m.length} 节 | 已下课 ${i} 节`:`Total ${m.length} | Done ${i}`})]}),m.length===0?e.jsxs("div",{className:"flex-1 flex items-center justify-center text-xs font-bold text-slate-450 py-6",children:["☕ ",n==="zh"?"今日暂无排定课次":"No schedules configured."]}):e.jsx("div",{className:"space-y-2 max-h-[150px] overflow-y-auto pr-1",children:m.map(a=>{const d=s&&a.id===s.id,b=o.some(u=>u.id===a.id)&&!d,j=a.status==="cancelled"||a.status==="holiday",t=!d&&!b&&!j;return e.jsxs("div",{className:`flex items-center justify-between text-xs py-1 border-b border-slate-100 last:border-b-0 ${t?"opacity-50":j?"opacity-35 line-through":""}`,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"font-mono text-[10px] text-slate-500 shrink-0",children:a.time_slot}),e.jsx("span",{className:`font-bold truncate max-w-[120px] lg:max-w-[150px] ${d?"text-indigo-650":"text-slate-700"}`,title:a.lesson_title,children:a.lesson_title}),e.jsxs("span",{className:"text-[9px] text-slate-455 truncate max-w-[60px] lg:max-w-[80px]",children:["(",a.class_name,")"]})]}),e.jsxs("div",{className:"shrink-0 ml-2",children:[d&&e.jsx("span",{className:"bg-amber-400 text-slate-950 font-extrabold text-[8px] px-1.5 py-0.5 rounded uppercase scale-90 inline-block animate-pulse shadow-xs",children:"进行"}),t&&e.jsx("span",{className:"bg-slate-100 text-slate-500 text-[8px] px-1.5 py-0.5 rounded font-bold",children:"已完"}),b&&e.jsx("span",{className:"bg-indigo-50 text-indigo-700 text-[8px] px-1.5 py-0.5 rounded font-medium border border-indigo-100/50",children:"待上"}),j&&e.jsx("span",{className:"bg-rose-50 text-rose-600 text-[8px] px-1.5 py-0.5 rounded font-bold border border-rose-100/50",children:"停课"})]})]},a.id)})})]})]})})(),e.jsx(oe,{slot:"teacher.dashboard.widget"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5",children:[e.jsxs("div",{className:"bg-gradient-to-br from-indigo-50/60 to-indigo-100/10 border border-indigo-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-indigo-655 uppercase tracking-wider",children:n==="zh"?"课程数量":"Total Courses"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:z.length})]}),e.jsx("div",{className:"p-3 bg-indigo-500/10 text-indigo-600 rounded-xl",children:e.jsx(q,{size:24})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-pink-50/60 to-pink-100/10 border border-pink-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-pink-600 uppercase tracking-wider",children:n==="zh"?"班级数量":"Total Classes"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:A.length})]}),e.jsx("div",{className:"p-3 bg-pink-500/10 text-pink-600 rounded-xl",children:e.jsx(ae,{size:24})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-emerald-50/60 to-emerald-100/10 border border-emerald-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-emerald-650 uppercase tracking-wider",children:n==="zh"?"学生数量":"Total Students"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:E.length})]}),e.jsx("div",{className:"p-3 bg-emerald-500/10 text-emerald-600 rounded-xl",children:e.jsx(Q,{size:24})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 items-start",children:[e.jsxs("div",{className:"bg-white border border-rose-100 rounded-2xl shadow-sm flex flex-col transition-all duration-300",children:[e.jsxs("div",{onClick:()=>y(!h),className:"p-4 border-b border-rose-50 flex items-center justify-between cursor-pointer select-none hover:bg-rose-50/20 rounded-t-2xl transition-colors",children:[e.jsxs("h3",{className:"font-extrabold text-sm md:text-base text-rose-700 flex items-center gap-2",children:[e.jsx(ne,{size:18}),g.approvals,v.length>0&&e.jsx("span",{className:"bg-rose-100 text-rose-700 text-xs px-2 py-0.5 rounded-full font-bold ml-1",children:v.length})]}),e.jsx("div",{className:"text-rose-400 hover:text-rose-600 transition-colors",children:h?e.jsx(U,{size:18}):e.jsx(G,{size:18})})]}),!h&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 max-h-[350px]",children:v.length===0?e.jsx("div",{className:"text-center p-8 text-xs md:text-sm text-slate-400 font-medium",children:g.noApprovals}):v.map(l=>{let o={};try{o=JSON.parse(l.payload||"{}")}catch{}const i=l.command_type==="ai.apply_grade",s=p[l.id]!==void 0?p[l.id]:o.score||0;return e.jsxs("div",{className:"w-full p-4 rounded-xl text-sm bg-slate-55 border border-slate-100 mb-3 shadow-3xs flex flex-col gap-3 hover:border-rose-150 transition-colors",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-extrabold text-slate-800 mb-1",children:l.command_type==="ai.apply_grade"?"🎓 Evaluate Submission":l.command_type}),e.jsx("div",{className:"text-xs text-slate-500 font-mono mb-2 line-clamp-2 bg-white border border-slate-100 p-2 rounded-lg",title:l.payload,children:i?`Feedback: ${o.feedback}`:l.payload})]}),i&&e.jsxs("div",{className:"bg-white border border-slate-150 p-2 rounded-xl flex items-center justify-between gap-3",children:[e.jsx("label",{className:"text-xs font-bold text-slate-700",children:"Modify Score:"}),e.jsx("input",{type:"number",className:"w-20 border border-slate-200 rounded-lg px-2 py-1 text-xs focus:ring-2 focus:ring-indigo-500 outline-none transition-all",value:s,onChange:a=>C(d=>({...d,[l.id]:parseInt(a.target.value)||0}))})]}),e.jsxs("div",{className:"flex gap-2 justify-end mt-1",children:[e.jsxs("button",{onClick:()=>T(l.id,i&&p[l.id]!==void 0?{score:p[l.id]}:void 0),className:"p-1.5 px-3.5 bg-rose-600 hover:bg-rose-700 text-white rounded-lg font-bold text-xs flex items-center gap-1.5 shadow-sm transition-all animate-none",children:[e.jsx(re,{size:14})," ",g.approve]}),e.jsxs("button",{onClick:()=>k(l.id),className:"p-1.5 px-3.5 bg-slate-100 hover:bg-slate-200 text-slate-750 rounded-lg font-bold text-xs flex items-center gap-1.5 shadow-3xs transition-all",children:[e.jsx(H,{size:14})," ",g.reject]})]})]},l.id)})})]}),e.jsxs("div",{className:"bg-white border border-slate-200/60 rounded-2xl shadow-sm flex flex-col transition-all duration-300",children:[e.jsxs("div",{onClick:()=>w(!N),className:"p-4 border-b border-slate-100 flex items-center justify-between cursor-pointer select-none hover:bg-slate-50/20 rounded-t-2xl transition-colors",children:[e.jsxs("h3",{className:"font-extrabold text-sm md:text-base text-slate-700 flex items-center gap-2",children:[e.jsx(ie,{size:18,className:"text-indigo-500"}),g.processes,r.length>0&&e.jsx("span",{className:"bg-indigo-50 text-indigo-700 text-xs px-2 py-0.5 rounded-full font-bold ml-1",children:r.length})]}),e.jsx("div",{className:"text-slate-400 hover:text-slate-650 transition-colors",children:N?e.jsx(U,{size:18}):e.jsx(G,{size:18})})]}),!N&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 max-h-[350px]",children:r.length===0?e.jsx("div",{className:"text-center p-8 text-xs md:text-sm text-slate-400 font-medium",children:g.noProcesses}):r.map(l=>e.jsxs("div",{className:"w-full p-4 rounded-xl text-sm bg-slate-50 border border-slate-100 mb-3 shadow-3xs flex flex-col gap-2.5 hover:border-indigo-150 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-extrabold text-slate-800 truncate",title:l.name,children:l.name}),e.jsx("span",{className:`text-[10px] uppercase px-2 py-0.5 rounded-full font-bold ${l.status==="running"?"bg-blue-100 text-blue-700":l.status==="completed"?"bg-emerald-100 text-emerald-700":l.status==="failed"?"bg-rose-100 text-rose-700":"bg-slate-200 text-slate-700"}`,children:l.status})]}),e.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.jsxs("span",{className:"text-[10px] text-slate-400 font-mono",children:["PID: ",l.id]}),e.jsx("button",{onClick:()=>S(l.id),className:"text-xs font-bold text-indigo-650 hover:text-indigo-850 transition-colors",children:g.processLogs})]})]},l.id))})]})]})]}),e.jsx(de,{classes:A,lessons:z,lang:n,onScheduleClass:_,onGenerateAssignment:async(l,o)=>!!await f(l,o,o),onCreateLesson:async(l,o)=>!!await O(l,o)})]})}export{fe as Dashboard};
|
|
8
|
+
这里写课本的主要讲授要点。`)},j=async t=>{t.preventDefault(),f(!0),i(null);try{let u=!1;if(r==="schedule"){if(!y||!w||!C){i("Please complete all form fields."),f(!1);return}u=await z(y,w,C)}else if(r==="assignment"){if(!k||!D.trim()){i("Please specify target class and a valid topic."),f(!1);return}u=await A(k,D.trim())}else if(r==="lesson"){if(!P.trim()||!S.trim()){i("Title and Content can not be empty."),f(!1);return}u=await E(P.trim(),S.trim())}u?(l(!0),setTimeout(()=>{l(!1),h("menu")},2200)):i(s.genericError)}catch(u){i(u.message||s.genericError)}finally{f(!1)}};return e.jsxs("div",{id:"quick-actions-fab-container",className:"absolute bottom-8 right-8 z-40 flex flex-col items-end",children:[e.jsx(V,{children:m&&e.jsxs(O.div,{initial:{opacity:0,y:15,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:15,scale:.95},transition:{duration:.18},className:"mb-4 w-[360px] sm:w-[420px] bg-white border border-gray-200 rounded-2xl shadow-xl overflow-hidden flex flex-col focus:outline-none",id:"quick-actions-popup-card",children:[e.jsxs("div",{className:"bg-indigo-600 px-5 py-4 text-white flex items-center justify-between shadow-inner",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{size:18,className:"animate-pulse"}),e.jsx("h3",{className:"font-bold text-sm tracking-wide",children:s.quickActions})]}),e.jsx("button",{onClick:()=>{v(!1),h("menu")},className:"text-white/80 hover:text-white hover:bg-white/15 p-1 rounded-full transition-all focus:outline-none",title:"Close Portal",children:e.jsx(H,{size:16})})]}),e.jsxs("div",{className:"p-5 max-h-[480px] overflow-y-auto bg-gray-50/50",children:[r==="menu"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-[11px] text-gray-500 leading-relaxed font-medium bg-indigo-50/50 border border-indigo-100 p-2.5 rounded-lg mb-4",children:s.quickDesc}),e.jsxs("div",{onClick:()=>b("schedule"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-indigo-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-schedule-class",children:[e.jsx("div",{className:"p-2.5 bg-indigo-50 text-indigo-600 rounded-lg group-hover:bg-indigo-600 group-hover:text-white transition-colors duration-200",children:e.jsx(B,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-indigo-600 transition-colors uppercase tracking-wider",children:s.scheduleClass}),e.jsx("p",{className:"text-[11px] text-gray-500 mt-1 leading-relaxed",children:s.scheduleDesc})]})]}),e.jsxs("div",{onClick:()=>b("assignment"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-purple-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-generate-assignment",children:[e.jsx("div",{className:"p-2.5 bg-purple-50 text-purple-600 rounded-lg group-hover:bg-purple-600 group-hover:text-white transition-colors duration-200",children:e.jsx(K,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-purple-600 transition-colors uppercase tracking-wider",children:s.generateAssignment}),e.jsx("p",{className:"text-[11px] text-gray-500 mt-1 leading-relaxed",children:s.generateDesc})]})]}),e.jsxs("div",{onClick:()=>b("lesson"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-emerald-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-create-lesson",children:[e.jsx("div",{className:"p-2.5 bg-emerald-50 text-emerald-600 rounded-lg group-hover:bg-emerald-600 group-hover:text-white transition-colors duration-200",children:e.jsx(q,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-emerald-600 transition-colors uppercase tracking-wider",children:s.createLesson}),e.jsx("p",{className:"text-[11px] text-gray-500 mt-1 leading-relaxed",children:s.createDesc})]})]})]}),r!=="menu"&&e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>h("menu"),className:"flex items-center gap-1.5 text-xs text-gray-500 hover:text-indigo-600 font-semibold mb-4 cursor-pointer focus:outline-none",id:"action-back-button",children:[e.jsx(Y,{size:14}),e.jsx("span",{children:s.back})]}),$?e.jsxs(O.div,{initial:{scale:.95},animate:{scale:1},className:"flex flex-col items-center justify-center py-10 text-center",children:[e.jsx(Z,{size:48,className:"text-green-500 animate-bounce mb-3"}),e.jsx("h4",{className:"font-bold text-green-800 text-sm",children:d()}),e.jsx("p",{className:"text-[11px] text-gray-400 mt-1",children:"Returning to action console..."})]}):e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[o&&e.jsxs("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-red-600 text-xs font-semibold",children:["⚠️ ",o]}),r==="schedule"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(Q,{size:12})," ",s.classSelect]}),x.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:s.emptyClasses}):e.jsx("select",{value:y,onChange:t=>N(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:x.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(q,{size:12})," ",s.lessonSelect]}),n.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:s.emptyLessons}):e.jsx("select",{value:w,onChange:t=>p(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:n.map(t=>e.jsx("option",{value:t.id,children:t.title},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(B,{size:12})," ",s.dateSelect]}),e.jsx("input",{type:"date",value:C,onChange:t=>T(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]})]}),r==="assignment"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(Q,{size:12})," ",s.classSelect]}),x.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:s.emptyClasses}):e.jsx("select",{value:k,onChange:t=>L(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:x.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(ee,{size:12})," ",s.assignmentTopic]}),e.jsx("input",{type:"text",value:D,onChange:t=>F(t.target.value),placeholder:s.assignmentTopicPlaceholder,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]})]}),r==="lesson"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(se,{size:12})," ",s.lessonTitle]}),e.jsx("input",{type:"text",value:P,onChange:t=>M(t.target.value),placeholder:s.lessonTitlePlaceholder,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(q,{size:12})," ",s.lessonContent]}),e.jsx("textarea",{value:S,onChange:t=>I(t.target.value),rows:5,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 font-mono text-gray-700",required:!0})]})]}),e.jsx("button",{type:"submit",disabled:_||r==="schedule"&&(x.length===0||n.length===0)||r==="assignment"&&x.length===0,className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs py-2.5 px-4 rounded-xl flex items-center justify-center gap-2 cursor-pointer transition-all shadow-md active:scale-98 disabled:opacity-50",children:_?e.jsxs(e.Fragment,{children:[e.jsx(te,{size:14,className:"animate-spin"}),e.jsx("span",{children:s.loadingBus})]}):e.jsxs(e.Fragment,{children:[e.jsx(le,{size:13}),e.jsx("span",{children:s.confirm})]})})]})]})]})]})}),e.jsxs("button",{onClick:()=>{v(!m),h("menu")},className:"w-14 h-14 bg-indigo-600 hover:bg-indigo-700 text-white rounded-full flex items-center justify-center shadow-lg hover:shadow-indigo-200 hover:shadow-2xl transition-all duration-250 cursor-pointer active:scale-95 focus:outline-none relative group",title:"Trigger Education OS Quick Scheduler Command Panel",id:"quick-actions-fab-button",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-purple-400 opacity-20 group-hover:animate-ping"}),e.jsx(O.div,{animate:{rotate:m?135:0},transition:{duration:.2},className:"flex items-center justify-center text-white",children:e.jsx(ae,{size:24,strokeWidth:2.8})})]})]})}function fe(x){const{lang:n,t:g,lessons:z,classes:A,students:E,todaySchedules:m,approvals:v,processes:r,isApprovalsCollapsed:h,setIsApprovalsCollapsed:y,isProcessesCollapsed:N,setIsProcessesCollapsed:w,scoreOverrides:p,setScoreOverrides:C,handleApprove:T,handleReject:k,showLogs:L,setShowLogs:D,processLogsContent:F,showProcessLogs:P,fetchProcessLogs:M,setShowProcessLogs:S,addToast:I,handleQuickScheduleClass:_,handleQuickGenerateAssignment:f,handleQuickCreateLesson:$}=x;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-1 flex flex-col gap-6 h-full overflow-y-auto pr-2",children:[(()=>{const l=a=>{if(a.status==="cancelled"||a.status==="holiday")return!1;if(!a.time_slot)return!0;try{const d=a.time_slot.split("-");if(d.length<2)return!0;const b=d[1].trim(),[j,t]=b.split(":").map(Number),u=new Date,R=u.getHours(),W=u.getMinutes();return!(R>j||R===j&&W>=t)}catch{return!0}},o=m.filter(l),i=m.length-o.length;m.filter(a=>a.status==="cancelled"||a.status==="holiday");const s=o[0];return e.jsxs("div",{className:"bg-white border border-slate-200/80 rounded-2xl p-5 text-slate-800 shadow-sm flex flex-col md:flex-row justify-between items-stretch gap-6 transition-all duration-300",children:[e.jsx("div",{className:"flex-1 flex flex-col justify-between bg-slate-50/50 rounded-xl p-4.5 border border-slate-200/60 min-h-[160px]",children:s?e.jsxs("div",{className:"flex-1 flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"bg-amber-400 text-slate-950 text-[10px] font-extrabold px-2.5 py-0.5 rounded-full uppercase tracking-wider animate-pulse shadow-xs",children:n==="zh"?"下一堂面授课":"NEXT CLASS"}),e.jsx("span",{className:"font-mono text-xs text-indigo-700 font-bold bg-indigo-50 px-2 py-0.5 rounded-md border border-indigo-100/30",children:s.time_slot})]}),e.jsx("h3",{className:"text-lg md:text-xl font-extrabold tracking-tight mt-3 text-slate-800 line-clamp-2",title:s.lesson_title,children:s.lesson_title}),e.jsxs("p",{className:"text-xs text-slate-500 mt-2 font-medium",children:["📍 ",s.class_name," ",s.classroom&&` | 教室: ${s.classroom}`," ",s.teacher_name&&` | 教师: ${s.teacher_name}`]})]}),s.notes&&e.jsxs("div",{className:"mt-3 text-xs italic text-indigo-700 bg-indigo-50/60 p-2 rounded-lg border border-indigo-100/40 truncate",title:s.notes,children:["* ",s.notes]})]}):e.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center text-center py-6 select-none",children:[e.jsx("span",{className:"text-3xl animate-bounce",children:"☕"}),e.jsx("h3",{className:"text-base font-extrabold text-slate-850 mt-2",children:n==="zh"?"今日课程已全部结束":"All Classes Finished"}),e.jsx("p",{className:"text-xs text-slate-455 mt-1 max-w-[280px]",children:n==="zh"?"接下来暂无排定课次,您可以休息调整。":"No remaining schedules today. Take a rest!"})]})}),e.jsxs("div",{className:"w-full md:w-[300px] lg:w-[350px] flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-center border-b border-slate-200/80 pb-2",children:[e.jsxs("span",{className:"text-[11px] uppercase font-extrabold tracking-wider text-indigo-600 flex items-center gap-1.5",children:["📅 ",n==="zh"?"今日面授排课流":"TODAY'S SCHEDULES"]}),e.jsx("span",{className:"text-[10px] text-slate-500 font-medium",children:n==="zh"?`共 ${m.length} 节 | 已下课 ${i} 节`:`Total ${m.length} | Done ${i}`})]}),m.length===0?e.jsxs("div",{className:"flex-1 flex items-center justify-center text-xs font-bold text-slate-450 py-6",children:["☕ ",n==="zh"?"今日暂无排定课次":"No schedules configured."]}):e.jsx("div",{className:"space-y-2 max-h-[150px] overflow-y-auto pr-1",children:m.map(a=>{const d=s&&a.id===s.id,b=o.some(u=>u.id===a.id)&&!d,j=a.status==="cancelled"||a.status==="holiday",t=!d&&!b&&!j;return e.jsxs("div",{className:`flex items-center justify-between text-xs py-1 border-b border-slate-100 last:border-b-0 ${t?"opacity-50":j?"opacity-35 line-through":""}`,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"font-mono text-[10px] text-slate-500 shrink-0",children:a.time_slot}),e.jsx("span",{className:`font-bold truncate max-w-[120px] lg:max-w-[150px] ${d?"text-indigo-650":"text-slate-700"}`,title:a.lesson_title,children:a.lesson_title}),e.jsxs("span",{className:"text-[9px] text-slate-455 truncate max-w-[60px] lg:max-w-[80px]",children:["(",a.class_name,")"]})]}),e.jsxs("div",{className:"shrink-0 ml-2",children:[d&&e.jsx("span",{className:"bg-amber-400 text-slate-950 font-extrabold text-[8px] px-1.5 py-0.5 rounded uppercase scale-90 inline-block animate-pulse shadow-xs",children:"进行"}),t&&e.jsx("span",{className:"bg-slate-100 text-slate-500 text-[8px] px-1.5 py-0.5 rounded font-bold",children:"已完"}),b&&e.jsx("span",{className:"bg-indigo-50 text-indigo-700 text-[8px] px-1.5 py-0.5 rounded font-medium border border-indigo-100/50",children:"待上"}),j&&e.jsx("span",{className:"bg-rose-50 text-rose-600 text-[8px] px-1.5 py-0.5 rounded font-bold border border-rose-100/50",children:"停课"})]})]},a.id)})})]})]})})(),e.jsx(X,{slot:"teacher.dashboard.widget"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5",children:[e.jsxs("div",{className:"bg-gradient-to-br from-indigo-50/60 to-indigo-100/10 border border-indigo-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-indigo-655 uppercase tracking-wider",children:n==="zh"?"课程数量":"Total Courses"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:z.length})]}),e.jsx("div",{className:"p-3 bg-indigo-500/10 text-indigo-600 rounded-xl",children:e.jsx(q,{size:24})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-pink-50/60 to-pink-100/10 border border-pink-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-pink-600 uppercase tracking-wider",children:n==="zh"?"班级数量":"Total Classes"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:A.length})]}),e.jsx("div",{className:"p-3 bg-pink-500/10 text-pink-600 rounded-xl",children:e.jsx(ne,{size:24})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-emerald-50/60 to-emerald-100/10 border border-emerald-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-emerald-650 uppercase tracking-wider",children:n==="zh"?"学生数量":"Total Students"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:E.length})]}),e.jsx("div",{className:"p-3 bg-emerald-500/10 text-emerald-600 rounded-xl",children:e.jsx(Q,{size:24})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 items-start",children:[e.jsxs("div",{className:"bg-white border border-rose-100 rounded-2xl shadow-sm flex flex-col transition-all duration-300",children:[e.jsxs("div",{onClick:()=>y(!h),className:"p-4 border-b border-rose-50 flex items-center justify-between cursor-pointer select-none hover:bg-rose-50/20 rounded-t-2xl transition-colors",children:[e.jsxs("h3",{className:"font-extrabold text-sm md:text-base text-rose-700 flex items-center gap-2",children:[e.jsx(re,{size:18}),g.approvals,v.length>0&&e.jsx("span",{className:"bg-rose-100 text-rose-700 text-xs px-2 py-0.5 rounded-full font-bold ml-1",children:v.length})]}),e.jsx("div",{className:"text-rose-400 hover:text-rose-600 transition-colors",children:h?e.jsx(U,{size:18}):e.jsx(G,{size:18})})]}),!h&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 max-h-[350px]",children:v.length===0?e.jsx("div",{className:"text-center p-8 text-xs md:text-sm text-slate-400 font-medium",children:g.noApprovals}):v.map(l=>{let o={};try{o=JSON.parse(l.payload||"{}")}catch{}const i=l.command_type==="ai.apply_grade",s=p[l.id]!==void 0?p[l.id]:o.score||0;return e.jsxs("div",{className:"w-full p-4 rounded-xl text-sm bg-slate-55 border border-slate-100 mb-3 shadow-3xs flex flex-col gap-3 hover:border-rose-150 transition-colors",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-extrabold text-slate-800 mb-1",children:l.command_type==="ai.apply_grade"?"🎓 Evaluate Submission":l.command_type}),e.jsx("div",{className:"text-xs text-slate-500 font-mono mb-2 line-clamp-2 bg-white border border-slate-100 p-2 rounded-lg",title:l.payload,children:i?`Feedback: ${o.feedback}`:l.payload})]}),i&&e.jsxs("div",{className:"bg-white border border-slate-150 p-2 rounded-xl flex items-center justify-between gap-3",children:[e.jsx("label",{className:"text-xs font-bold text-slate-700",children:"Modify Score:"}),e.jsx("input",{type:"number",className:"w-20 border border-slate-200 rounded-lg px-2 py-1 text-xs focus:ring-2 focus:ring-indigo-500 outline-none transition-all",value:s,onChange:a=>C(d=>({...d,[l.id]:parseInt(a.target.value)||0}))})]}),e.jsxs("div",{className:"flex gap-2 justify-end mt-1",children:[e.jsxs("button",{onClick:()=>T(l.id,i&&p[l.id]!==void 0?{score:p[l.id]}:void 0),className:"p-1.5 px-3.5 bg-rose-600 hover:bg-rose-700 text-white rounded-lg font-bold text-xs flex items-center gap-1.5 shadow-sm transition-all animate-none",children:[e.jsx(ie,{size:14})," ",g.approve]}),e.jsxs("button",{onClick:()=>k(l.id),className:"p-1.5 px-3.5 bg-slate-100 hover:bg-slate-200 text-slate-750 rounded-lg font-bold text-xs flex items-center gap-1.5 shadow-3xs transition-all",children:[e.jsx(H,{size:14})," ",g.reject]})]})]},l.id)})})]}),e.jsxs("div",{className:"bg-white border border-slate-200/60 rounded-2xl shadow-sm flex flex-col transition-all duration-300",children:[e.jsxs("div",{onClick:()=>w(!N),className:"p-4 border-b border-slate-100 flex items-center justify-between cursor-pointer select-none hover:bg-slate-50/20 rounded-t-2xl transition-colors",children:[e.jsxs("h3",{className:"font-extrabold text-sm md:text-base text-slate-700 flex items-center gap-2",children:[e.jsx(oe,{size:18,className:"text-indigo-500"}),g.processes,r.length>0&&e.jsx("span",{className:"bg-indigo-50 text-indigo-700 text-xs px-2 py-0.5 rounded-full font-bold ml-1",children:r.length})]}),e.jsx("div",{className:"text-slate-400 hover:text-slate-650 transition-colors",children:N?e.jsx(U,{size:18}):e.jsx(G,{size:18})})]}),!N&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 max-h-[350px]",children:r.length===0?e.jsx("div",{className:"text-center p-8 text-xs md:text-sm text-slate-400 font-medium",children:g.noProcesses}):r.map(l=>e.jsxs("div",{className:"w-full p-4 rounded-xl text-sm bg-slate-50 border border-slate-100 mb-3 shadow-3xs flex flex-col gap-2.5 hover:border-indigo-150 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-extrabold text-slate-800 truncate",title:l.name,children:l.name}),e.jsx("span",{className:`text-[10px] uppercase px-2 py-0.5 rounded-full font-bold ${l.status==="running"?"bg-blue-100 text-blue-700":l.status==="completed"?"bg-emerald-100 text-emerald-700":l.status==="failed"?"bg-rose-100 text-rose-700":"bg-slate-200 text-slate-700"}`,children:l.status})]}),e.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.jsxs("span",{className:"text-[10px] text-slate-400 font-mono",children:["PID: ",l.id]}),e.jsx("button",{onClick:()=>S(l.id),className:"text-xs font-bold text-indigo-650 hover:text-indigo-850 transition-colors",children:g.processLogs})]})]},l.id))})]})]})]}),e.jsx(de,{classes:A,lessons:z,lang:n,onScheduleClass:_,onGenerateAssignment:async(l,o)=>!!await f(l,o,o),onCreateLesson:async(l,o)=>!!await $(l,o)})]})}export{fe as Dashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./vendor-react-0Lg0vA-4.js";import{m as z}from"./index-D8x6bUeG.js";import{ab as k,ac as C,R as S,T as $,a5 as q}from"./vendor-icons-_c3xpwjZ.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-pdf-CVyNPGVr.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-charts-B7ViBL9w.js";function E({isExportWeightModalOpen:p,setIsExportWeightModalOpen:x,lang:s,quizzesWeight:g,setQuizzesWeight:h,assignmentsWeight:m,setAssignmentsWeight:b,handleQuizzesWeightChange:f,handleAssignmentsWeightChange:j,customCategoryOverrides:u,setCustomCategoryOverrides:y,classDashboardMap:i,exportClassId:r,exportClassName:N,csvPreviewData:n,handleExportGrades:v}){return p?e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-sm flex items-center justify-center p-6 z-50",children:e.jsxs(z.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-2xl flex flex-col overflow-hidden max-h-[85vh]",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/80 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(k,{className:"text-indigo-600 font-sans",size:20}),e.jsx("h2",{className:"font-bold text-gray-800 text-lg font-sans",children:s==="zh"?"导出成绩权重设置":"Grade Export & Weighting Settings"})]}),e.jsx("button",{onClick:()=>x(!1),className:"text-gray-400 hover:text-gray-600 font-bold p-1 hover:bg-gray-200 rounded transition-colors text-lg",children:"×"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[e.jsx("div",{className:"bg-indigo-50 border border-indigo-150 rounded-xl p-4 text-indigo-800 text-xs font-sans leading-relaxed",children:s==="zh"?"您可以自定义测验与作业在期末成绩(平均分)中的计算权重。系统已根据测验名和内容自动对课程内容进行分类,您可以在下方手动微调分类。":"Customize the calculation weight of quizzes and assignments in the calculated average score. The system automatically classifies items, but you can manually override categorized groups below."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"font-bold text-sm text-gray-800 flex items-center gap-2 font-sans",children:[e.jsx(C,{size:16,className:"text-indigo-500 font-sans"}),s==="zh"?"定义成绩占比权重":"Define Weighting Percentages"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 bg-gray-50 p-4 rounded-xl border border-gray-100 font-sans",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-700",children:s==="zh"?"测验权重 (Quizzes)":"Quizzes Weight"}),e.jsxs("span",{className:"text-xs font-bold text-indigo-600 bg-indigo-50 px-2 py-0.5 rounded border border-indigo-100",children:[g,"%"]})]}),e.jsx("input",{type:"range",min:"0",max:"100",value:g,onChange:t=>f(Number(t.target.value)),className:"w-full h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-700",children:s==="zh"?"作业权重 (Assignments)":"Assignments Weight"}),e.jsxs("span",{className:"text-xs font-bold text-indigo-600 bg-indigo-50 px-2 py-0.5 rounded border border-indigo-100",children:[m,"%"]})]}),e.jsx("input",{type:"range",min:"0",max:"100",value:m,onChange:t=>j(Number(t.target.value)),className:"w-full h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{h(50),b(50)},className:"text-[10px] text-gray-500 hover:text-gray-700 bg-white border border-gray-200 hover:bg-gray-50 font-bold px-2.5 py-1 rounded transition-colors cursor-pointer",children:s==="zh"?"均衡配比 50/50":"Balance 50/50"}),e.jsx("button",{type:"button",onClick:()=>{h(40),b(60)},className:"text-[10px] text-gray-500 hover:text-gray-700 bg-white border border-gray-200 hover:bg-gray-50 font-bold px-2.5 py-1 rounded transition-colors cursor-pointer",children:s==="zh"?"推荐配比 40/60":"Recommend 40/60"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"font-bold text-sm text-gray-800 flex items-center justify-between font-sans",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(S,{size:16,className:"text-indigo-500"}),s==="zh"?"期末考核项目微调":"Item Categorization Overrides"]}),e.jsx("span",{className:"text-[10px] text-gray-400 font-medium font-sans",children:s==="zh"?`共 ${i[r]?.assignments?.length||0} 项`:`${i[r]?.assignments?.length||0} items total`})]}),e.jsxs("div",{className:"border border-gray-150 rounded-xl overflow-hidden divide-y divide-gray-100 max-h-60 overflow-y-auto bg-white shadow-inner",children:[(i[r]?.assignments||[]).map(t=>{const d=t.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"'),l=t.title&&(t.title.toLowerCase().includes("quiz")||t.title.toLowerCase().includes("test")||t.title.includes("测验")||t.title.includes("测试")),o=d||l?"quiz":"assignment",a=u[t.id]||o;return e.jsxs("div",{className:"p-3 flex items-center justify-between gap-4 font-sans hover:bg-gray-50/50 transition-colors",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-semibold text-xs text-gray-800 truncate",title:t.title,children:t.title}),e.jsx("div",{className:"text-[10px] text-gray-400 truncate mt-0.5",children:t.description||(s==="zh"?"无描述信息":"No description provided")})]}),e.jsxs("div",{className:"flex border border-gray-200 rounded-lg p-0.5 bg-gray-50 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>y(c=>({...c,[t.id]:"quiz"})),className:`px-2.5 py-1 text-[10px] font-bold rounded-md transition-all cursor-pointer ${a==="quiz"?"bg-indigo-600 text-white shadow":"text-gray-500 hover:text-gray-800 hover:bg-gray-100"}`,children:s==="zh"?"测验":"Quiz"}),e.jsx("button",{type:"button",onClick:()=>y(c=>({...c,[t.id]:"assignment"})),className:`px-2.5 py-1 text-[10px] font-bold rounded-md transition-all cursor-pointer ${a==="assignment"?"bg-emerald-600 text-white shadow":"text-gray-500 hover:text-gray-800 hover:bg-gray-100"}`,children:s==="zh"?"作业":"Assignment"})]})]},t.id)}),(!i[r]?.assignments||i[r].assignments.length===0)&&e.jsx("div",{className:"p-8 text-center text-xs text-gray-400 italic",children:s==="zh"?"此班级暂未创建任何考核项目":"No graded items exist in this class."})]})]}),n&&n.rows.length>0&&e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsxs("h3",{className:"font-bold text-sm text-gray-800 flex items-center justify-between font-sans",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx($,{size:16,className:"text-emerald-500"}),s==="zh"?"CSV 实时成绩表预览 (前5行数据)":"Live CSV Grade Preview (First 5 Rows)"]}),e.jsx("span",{className:"text-[10px] bg-emerald-50 text-emerald-700 border border-emerald-100 font-bold px-2 py-0.5 rounded shadow-xs font-sans",children:s==="zh"?`展示 5 / ${n.totalStudents} 名学生`:`Showing 5 of ${n.totalStudents} students`})]}),e.jsx("div",{className:"border border-gray-150 rounded-xl overflow-hidden bg-white shadow-xs max-w-full",children:e.jsx("div",{className:"overflow-x-auto max-h-56 overflow-y-auto",children:e.jsxs("table",{className:"w-full border-collapse text-left",children:[e.jsx("thead",{children:e.jsx("tr",{className:"bg-gray-50 border-b border-gray-150 sticky top-0 z-10",children:n.headers.map((t,d)=>{const l=t.includes("Average")||t.includes("Avg")||t.includes("Score"),o=t.includes("Weighted");return e.jsx("th",{className:`p-2.5 text-[10px] font-bold tracking-wider uppercase border-r border-gray-150 whitespace-nowrap font-sans font-semibold ${o?"text-indigo-700 bg-indigo-50/70 border-indigo-150 font-bold":l?"text-emerald-700 bg-emerald-50/70":"text-gray-500"}`,children:t},d)})})}),e.jsx("tbody",{className:"divide-y divide-gray-100",children:n.rows.map((t,d)=>e.jsx("tr",{className:"hover:bg-gray-50/50 transition-colors font-mono text-[10px]",children:t.map((l,o)=>{const a=n.headers[o]||"",c=a.includes("Weighted"),w=a.includes("Average")||a.includes("Avg")||a.includes("Score");return e.jsx("td",{className:`p-2 border-r border-gray-100 font-mono text-[10px] text-gray-700 whitespace-nowrap text-center ${c?"bg-indigo-50/30 font-bold text-indigo-700 border-indigo-100":w?"bg-emerald-50/10 font-semibold text-emerald-800":o<2?"text-left font-sans font-medium":""}`,children:l},o)})},d))})]})})}),e.jsx("p",{className:"text-[10px] text-gray-400 font-sans italic",children:s==="zh"?"* 改变上方权重占比或调整项目分类时,此预览与计算结果会立即实时刷新。":"* Calculations and layout values in this preview refresh dynamically as you tweak sliders and overrides."})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-100 bg-gray-50/85 flex justify-end gap-2.5 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>x(!1),className:"px-4 py-2 text-xs font-semibold border border-gray-300 text-gray-700 bg-white rounded-lg hover:bg-gray-100 transition-colors cursor-pointer",children:s==="zh"?"取消":"Cancel"}),e.jsxs("button",{type:"button",disabled:!i[r]?.assignments||i[r].assignments.length===0,onClick:()=>{v(r,N,g,m,u),x(!1)},className:"px-4 py-2 text-xs font-bold bg-indigo-600 text-white border border-indigo-700 rounded-lg hover:bg-indigo-700 hover:shadow shadow-sm transition-all flex items-center gap-1.5 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(q,{size:14}),s==="zh"?"导出 CSV 成绩表":"Export Grade Sheet"]})]})]})}):null}export{E as ExportWeightModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,j as e}from"./vendor-react-0Lg0vA-4.js";import{f as b,X as R,o as T,
|
|
1
|
+
import{r,j as e}from"./vendor-react-0Lg0vA-4.js";import{f as b,X as R,o as T,a3 as W,_ as B}from"./vendor-icons-_c3xpwjZ.js";function P({isOpen:x,onClose:l,lang:s,onSeedSuccess:z,onJumpTab:N}){const[n,h]=r.useState(0),[v,w]=r.useState(!1),[F,y]=r.useState(null),[I,S]=r.useState(null),[k,p]=r.useState({display:"none"}),[C,m]=r.useState({display:"none"}),L=r.useRef(null),d=[{targetId:"",title:s==="zh"?"欢迎来到 OpenLearn Next V2 平台!":"Welcome to OpenLearn Next V2!",content:s==="zh"?"本平台为数字课堂提供智能白板与教学插件生态托管。下面我们将通过 4 步带您快速完成初始化并体验一堂数字互动课程。":"Welcome! This platform provides interactive whiteboards and educational plugin hosting. Let's set up your first class in 4 quick steps."},{targetId:"nav_btn_admin_directory",title:s==="zh"?"第 1 步:一键初始化示例课程":"Step 1: Initialize Example Class",content:s==="zh"?"在开始授课前,我们需要一个授课班级。请点击下方的按钮,系统将自动在数据库中为您建立示例班级、添加 5 名演示学生(小明、小红等),并自动排定一节今日的白板创意编程示范课!":"Before teaching, we need a classroom session. Click the button below to seed a demo class, add 5 sample students (Xiao Ming, Xiao Hong, etc.), and schedule today's creative programming class!",actionable:!0},{targetId:"navigation_sidebar",title:s==="zh"?"第 2 步:了解系统导航菜单":"Step 2: Tour System Navigation",content:s==="zh"?"初始化成功后,您可以在「系统导航」的「班级管理」中查看学生名册及座位表,或在「课程管理」中编辑白板教案。在「插件中心」中,您还可以安装/停用丰富的第三方小工具。":'After setup, explore the sidebar! Use "Classes & Students" to manage student profiles, "Courses" to edit whiteboards, and "Plugins" to manage tools.'},{targetId:"nav_btn_live_class",title:s==="zh"?"第 3 步:进入互动课堂开启体验":"Step 3: Launch Live Classroom",content:s==="zh"?"一切就绪!点击下方的「一键开课并进入课堂」,系统将为您自动进入示范课堂并展开互动白板。您可以在白板上下发测验、进行实时统计,学生端也将实时接收广播。":'All set! Click "Launch Classroom" to enter the live room. You can draw on the whiteboard, push quizzes, and view live stats, while student clients auto-sync.'}],_=async()=>{w(!0);try{const i=await fetch("/api/admin/seed-demo",{method:"POST"});if(i.ok){const t=await i.json();t.success&&(S({classId:t.classId,className:"人工智能与创意编程示范班"}),z({classId:t.classId,scheduleId:t.scheduleId,lessonId:t.lessonId}),setTimeout(()=>{h(2)},1500))}else{const t=await i.json().catch(()=>({error:"未知错误"}));y(s==="zh"?`初始化失败:${t.error||"请检查服务器日志"}`:`Failed: ${t.error||"Check server logs"}`)}}catch(i){console.error("Failed to seed demo data:",i),y(s==="zh"?`网络错误:${i.message||"请检查服务器是否运行"}`:`Network error: ${i.message||"Check if server is running"}`)}finally{w(!1)}},E=()=>{localStorage.setItem("edu_os_tour_completed","true"),N("live_class"),l()};if(r.useEffect(()=>{if(!x)return;const i=d[n];if(!i||!i.targetId){p({display:"none"}),m({position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e4,width:"420px",maxWidth:"90vw"});return}const t=()=>{const j=document.getElementById(i.targetId);if(!j){p({display:"none"}),m({position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e4,width:"420px",maxWidth:"90vw"});return}const o=j.getBoundingClientRect(),c=6;p({display:"block",position:"fixed",top:`${o.top-c}px`,left:`${o.left-c}px`,width:`${o.width+c*2}px`,height:`${o.height+c*2}px`,boxShadow:"0 0 0 9999px rgba(15, 23, 42, 0.65)",border:"2px dashed #6366f1",borderRadius:"12px",zIndex:9999,pointerEvents:"none",transition:"all 0.25s cubic-bezier(0.4, 0, 0.2, 1)"});const u=360;let f=o.left+o.width+16,g=o.top;f+u>window.innerWidth&&(f=Math.max(16,o.left-u-16)),g+240>window.innerHeight&&(g=Math.max(16,window.innerHeight-250)),m({display:"block",position:"fixed",top:`${g}px`,left:`${f}px`,width:`${u}px`,zIndex:1e4,transition:"all 0.25s cubic-bezier(0.4, 0, 0.2, 1)"})};t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0);const $=setInterval(t,300);return()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0),clearInterval($)}},[x,n]),!x)return null;const a=d[n];return e.jsxs("div",{className:"fixed inset-0 overflow-hidden select-none",style:{zIndex:9998},children:[a&&!a.targetId&&e.jsx("div",{className:"fixed inset-0 bg-slate-900/65 backdrop-blur-2xs transition-opacity",onClick:l}),e.jsx("div",{style:k}),e.jsxs("div",{ref:L,style:C,className:"bg-white rounded-2xl border border-slate-150/60 shadow-2xl p-5 md:p-6 text-gray-900 font-sans flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsxs("h3",{className:"font-extrabold text-sm md:text-base text-gray-900 flex items-center gap-1.5 leading-tight",children:[e.jsx(b,{size:16,className:"text-indigo-500 animate-pulse shrink-0"}),a.title]}),e.jsx("button",{onClick:l,className:"text-gray-400 hover:text-gray-600 rounded-lg p-0.5 transition-colors cursor-pointer",children:e.jsx(R,{size:16})})]}),e.jsx("p",{className:"text-xs md:text-sm text-gray-600 leading-relaxed font-medium mb-5 whitespace-pre-wrap",children:a.content}),a.actionable&&e.jsx("div",{className:"bg-slate-50 border border-slate-200/80 rounded-xl p-3.5 mb-5 flex flex-col items-center justify-center",children:I?e.jsxs("div",{className:"flex items-center gap-2 text-emerald-600 text-xs font-bold animate-bounce",children:[e.jsx(T,{size:12,className:"fill-emerald-600"}),s==="zh"?"示范课程与学生名册初始化成功!":"Demo classes successfully initialized!"]}):e.jsx("button",{onClick:_,disabled:v,className:"w-full flex items-center justify-center gap-1.5 py-2.5 px-4 bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs md:text-sm rounded-lg hover:shadow-md transition-all cursor-pointer disabled:bg-indigo-400",children:v?e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsxs("svg",{className:"animate-spin h-4 w-4 text-white",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),s==="zh"?"正在创建数据库记录...":"Initializing DB records..."]}):e.jsxs(e.Fragment,{children:[e.jsx(b,{size:14,className:"animate-pulse"}),s==="zh"?"一键初始化示范数据":"Initialize Example Data"]})})})]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-slate-100 pt-4 shrink-0",children:[e.jsx("div",{className:"flex items-center gap-1.5",children:d.map((i,t)=>e.jsx("div",{className:`h-1.5 rounded-full transition-all duration-300 ${t===n?"w-4 bg-indigo-600":"w-1.5 bg-slate-200"}`},t))}),e.jsxs("div",{className:"flex items-center gap-2",children:[n>0?e.jsxs("button",{onClick:()=>h(i=>i-1),className:"flex items-center gap-1 px-3 py-1.5 border border-slate-200 rounded-lg text-xs font-semibold text-slate-600 hover:bg-slate-50 transition-colors cursor-pointer",children:[e.jsx(W,{size:12}),s==="zh"?"上一步":"Back"]}):e.jsx("button",{onClick:l,className:"px-3 py-1.5 border border-slate-200 rounded-lg text-xs font-semibold text-slate-500 hover:bg-slate-50 transition-colors cursor-pointer",children:s==="zh"?"跳过向导":"Skip Tour"}),n<d.length-1?e.jsxs("button",{onClick:()=>h(i=>i+1),className:"flex items-center gap-1 px-3 py-1.5 bg-slate-900 text-white rounded-lg text-xs font-semibold hover:bg-slate-800 transition-colors cursor-pointer",children:[s==="zh"?"下一步":"Next",e.jsx(B,{size:12})]}):e.jsxs("button",{onClick:E,className:"flex items-center gap-1 px-4 py-1.5 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg text-xs font-bold shadow-sm transition-colors cursor-pointer",children:[s==="zh"?"结束引导并开课":"Launch Classroom",e.jsx(b,{size:12})]})]})]})]})]})}export{P as HelpTour};
|