(function(){"use strict";var e={2688:function(e,t,o){var s=o(5130),a=o(6768);const n={key:0,class:"forbidden-container",style:{width:"135%"}},i={key:1,id:"app"},r={class:"sidebar"},c={class:"main-content"},l={key:2,class:"forbidden-container",style:{width:"122%"}};function u(e,t,o,s,u,d){const h=(0,a.g2)("SideBar"),m=(0,a.g2)("router-view");return(0,a.uX)(),(0,a.CE)("div",null,[u.isMobile&&!u.forceDesktopMode?((0,a.uX)(),(0,a.CE)("div",n,[t[1]||(t[1]=(0,a.Lk)("h1",{class:"forbidden-title"},"此系统暂不支持手机访问",-1)),t[2]||(t[2]=(0,a.Lk)("p",{class:"forbidden-text"},"推荐使用电脑访问此系统。",-1)),(0,a.Lk)("button",{onClick:t[0]||(t[0]=(...e)=>d.enableDesktopMode&&d.enableDesktopMode(...e)),class:"forbidden-back-btn"},"使用电脑版样式访问")])):u.isAuthorized?((0,a.uX)(),(0,a.CE)("div",i,[(0,a.Lk)("aside",r,[(0,a.bF)(h)]),(0,a.Lk)("main",c,[(0,a.bF)(m)])])):((0,a.uX)(),(0,a.CE)("div",l,t[3]||(t[3]=[(0,a.Fv)('

您的访问被拒绝

只有在 NEU小站 完成 校园网或校园邮箱验证 并激活 东币系统 的用户才能访问课程评分系统。

请确保您已完成相关操作,然后重新尝试访问。

',4)])))])}function d(e,t,o,s,n,i){const r=(0,a.g2)("el-menu-item"),c=(0,a.g2)("el-menu");return(0,a.uX)(),(0,a.Wv)(c,{"default-active":i.activeMenu,class:"el-menu-vertical-demo","background-color":"#333","text-color":"#fff","active-text-color":"#ffd04b"},{default:(0,a.k6)((()=>[(0,a.bF)(r,{index:"1",onClick:t[0]||(t[0]=e=>i.goTo("home"))},{default:(0,a.k6)((()=>t[5]||(t[5]=[(0,a.Lk)("i",{class:"el-icon-house"},null,-1),(0,a.Lk)("span",null,"使用必看",-1)]))),_:1}),(0,a.bF)(r,{index:"2",onClick:t[1]||(t[1]=e=>i.goTo("rating"))},{default:(0,a.k6)((()=>t[6]||(t[6]=[(0,a.Lk)("i",{class:"el-icon-setting"},null,-1),(0,a.Lk)("span",null,"选修课评分",-1)]))),_:1}),(0,a.bF)(r,{index:"3",onClick:t[2]||(t[2]=e=>i.goTo("ratingforcomp"))},{default:(0,a.k6)((()=>t[7]||(t[7]=[(0,a.Lk)("i",{class:"el-icon-setting"},null,-1),(0,a.Lk)("span",null,"必修课评分",-1)]))),_:1}),(0,a.bF)(r,{index:"4",onClick:t[3]||(t[3]=e=>i.goTo("course-list"))},{default:(0,a.k6)((()=>t[8]||(t[8]=[(0,a.Lk)("i",{class:"el-icon-setting"},null,-1),(0,a.Lk)("span",null,"我的课程",-1)]))),_:1}),(0,a.bF)(r,{index:"5",onClick:t[4]||(t[4]=e=>i.goTo("chat"))},{default:(0,a.k6)((()=>t[9]||(t[9]=[(0,a.Lk)("i",{class:"el-icon-setting"},null,-1),(0,a.Lk)("span",null,"我的聊天",-1)]))),_:1}),t[10]||(t[10]=(0,a.Lk)("div",{class:"sidebar-footer"},[(0,a.Lk)("a",{href:"https://www.xn--xhq44jb2fzpc.com/",target:"_blank"},"点此返回NEU小站")],-1)),t[11]||(t[11]=(0,a.Lk)("div",{class:"footer-info"}," NEU小站课程评分系统 - v1.0.2 Beta ",-1))])),_:1},8,["default-active"])}o(4114);var h={name:"SideBar",computed:{activeMenu(){const e=this.$route.name;return"home"===e?"1":"rating"===e?"2":"ratingforcomp"===e?"3":"course-list"===e?"4":"chat"===e?"5":"1"}},methods:{goTo(e){this.$router.push({name:e})}}},m=o(1241);const g=(0,m.A)(h,[["render",d],["__scopeId","data-v-39a6589a"]]);var p=g,k={name:"App",data(){return{isAuthorized:!1,authChecked:!1,isMobile:!1,forceDesktopMode:!1}},components:{SideBar:p},mounted(){this.redirectToHTTPS(),this.checkIfMobile(),this.checkLoginStatus()},methods:{checkIfMobile(){const e=navigator.userAgent||navigator.vendor||window.opera,t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(e.toLowerCase()),o="true"===localStorage.getItem("forceDesktopMode");t&&!o?this.isMobile=!0:this.forceDesktopMode=o},enableDesktopMode(){this.forceDesktopMode=!0,localStorage.setItem("forceDesktopMode","true");const e=document.querySelector('meta[name="viewport"]');if(e)e.setAttribute("content","width=1024");else{const e=document.createElement("meta");e.name="viewport",e.content="width=1024",document.head.appendChild(e)}},async checkLoginStatus(){const e=document.cookie.split("; ").reduce(((e,t)=>{const[o,s]=t.split("=");return e[o]=decodeURIComponent(s),e}),{}).token;if(e)try{const t=await fetch("https://userlogin.xn--xhq44jb2fzpc.com/qvphone",{method:"GET",headers:{Authorization:e}}),o=await t.json();t.ok&&"验证成功,用户已绑定手机号并完成激活。"===o.message?this.isAuthorized=!0:console.warn("用户未通过验证:",o.message)}catch(t){console.error("Error during phone verification:",t)}finally{this.authChecked=!0}},redirectToHTTPS(){if("localhost"!==location.hostname&&"127.0.0.1"!==location.hostname&&"http:"===location.protocol){const e=`https://${location.host}${location.pathname}${location.search}`;window.location.replace(e)}}}};const C=(0,m.A)(k,[["render",u]]);var v=C,f=o(6762),b=(o(4188),o(973)),y=o(4232);const L={key:0},_={id:"homepage-title"},w={key:1};function E(e,t,o,s,n,i){return n.isLoaded?((0,a.uX)(),(0,a.CE)("div",L,[(0,a.Lk)("div",null,[(0,a.Lk)("h2",_,(0,y.v_)(n.greeting)+", "+(0,y.v_)(n.nickname)+"!",1),t[0]||(t[0]=(0,a.Fv)('

• 2025.01.24 更新:评论区支持删除自己的评论。

• 2025.01.05 更新:优化了“评分由低到高”排序的逻辑,会先展示有评分(评分不为0)的课程。

欢迎您使用NEU小站课程评分系统!

本系统采用全匿名方式,学生可以匿名对课程进行评分和发表评论。每人对每个课程只能评分一次,若需要多次评分,系统将记录用户最后一次提交的评分结果。为保护隐私,发表评论时不会显示用户在NEU小站的用户名,每次评论的昵称均由用户自行定义。

本系统中,课程分为两大类:选修课和必修课。选修课有8个小类:通识选修、人文选修、专业方向、体育、学科基础、暑期国际课、数学与自然科学、重修专栏。人文选修类包括采用“抢选”方式进行选课的所有选修课,以及“改革开放史”和“社会主义发展史”两门人文社会科学类的选修课。体育课单独作为一类,不属于人文选修类。重修课程的选课归为选修课的“重修专栏”类别,不属于必修课范畴。重修专栏可以分享任何类别课程,但仅限分享重修体验

必修课有5个小类:数学与自然科学、人文社会科学、学科基础、专业方向、实践。如上所述,本系统中重修的必修课程也属于选修课范畴。特别说明:军训课程属于实践类,系辅导员给分,在创建课程时课程教师请填写辅导员。

在创建课程时,请先了解课程的分类(可通过培养计划、选课系统等途径),以及课程的开课院系(在教务系统“我的考试”中可查看,以及“公共课表查询”中可查看)如果同一课程的任课教师不同,用户可以创建多个同名课程,例如“A老师-篮球”和“B老师-篮球”将被视为两个不同的课程。创建的课程卡片需经过管理员审核,审核进度可在“我的课程”中实时查看。

本系统鼓励同学们提供真实、有价值的评分。禁止发布带有侮辱性的人身攻击等恶意评论。管理员将对恶意用户进行封禁处理,确保评分系统的文明环境。

',8))])])):((0,a.uX)(),(0,a.CE)("div",w,t[1]||(t[1]=[(0,a.Lk)("p",null,"加载中,请稍后...",-1)])))}var x={data(){return{name:"Homepage",greeting:"",nickname:"",isLoaded:!1}},mounted(){this.setGreeting(),this.fetchNickname(),setTimeout((()=>{this.isLoaded=!0}),300)},methods:{setGreeting(){const e=(new Date).getHours();this.greeting=e<12?"早上好":e<14?"中午好":e<18?"下午好":"晚上好"},async fetchNickname(){const e=document.cookie.split("; ").reduce(((e,t)=>{const[o,s]=t.split("=");return e[o]=decodeURIComponent(s),e}),{}).token;if(e)try{const t=await fetch("https://userlogin.xn--xhq44jb2fzpc.com/avatar/nickname",{method:"GET",headers:{Authorization:e}});if(!t.ok){const e=await t.json();return void console.error("获取昵称失败:",e.message||"未知错误")}const o=await t.json();o.nickname?(this.nickname=o.nickname,console.log("Nickname successfully fetched:",o.nickname)):(this.nickname="默认昵称",console.log("Nickname field is missing. Using default nickname."))}catch(t){console.error("获取昵称时出错:",t)}else console.error("未找到JWT信息")}}};const P=(0,m.A)(x,[["render",E],["__scopeId","data-v-f470bd2a"]]);var S=P;const T={key:0,class:"loading-message"},M={key:1,class:"course-table"},W={key:0},j=["onClick"],$={class:"pagination-bar"},D=["onClick"],X={class:"add-course"},F={class:"input-section"},N=["value"];function U(e,t,o,n,i,r){const c=(0,a.g2)("CourseDetailModal");return(0,a.uX)(),(0,a.CE)("div",null,[t[9]||(t[9]=(0,a.Lk)("h2",null,"我添加的课程",-1)),i.isLoaded?((0,a.uX)(),(0,a.CE)("div",M,[(0,a.Lk)("table",null,[t[5]||(t[5]=(0,a.Lk)("thead",null,[(0,a.Lk)("tr",null,[(0,a.Lk)("th",null,"课程名"),(0,a.Lk)("th",null,"分类"),(0,a.Lk)("th",null,"教师"),(0,a.Lk)("th",null,"开课院系"),(0,a.Lk)("th",null,"提交时间"),(0,a.Lk)("th",null,"状态更新时间"),(0,a.Lk)("th",null,"审核状态")])],-1)),(0,a.Lk)("tbody",null,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(r.paginatedSubmissions,(e=>((0,a.uX)(),(0,a.CE)("tr",{key:e.submit_id},[(0,a.Lk)("td",null,[0===e.course_id?((0,a.uX)(),(0,a.CE)("span",W,(0,y.v_)(e.course_name),1)):((0,a.uX)(),(0,a.CE)("span",{key:1,class:"clickable-text",onClick:t=>r.loadCourseDetail(e.course_id)},(0,y.v_)(e.course_name),9,j))]),(0,a.Lk)("td",null,(0,y.v_)(r.getCategoryName(e.category_id)),1),(0,a.Lk)("td",null,(0,y.v_)(e.teachers),1),(0,a.Lk)("td",null,(0,y.v_)(r.getCollegeName(e.college)),1),(0,a.Lk)("td",null,(0,y.v_)(r.formatTime(e.create_time)),1),(0,a.Lk)("td",null,(0,y.v_)(r.formatTime(e.status_update_time)),1),(0,a.Lk)("td",null,(0,y.v_)(e.status),1)])))),128))])]),(0,a.Lk)("div",$,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(i.totalPages,(e=>((0,a.uX)(),(0,a.CE)("button",{key:e,onClick:t=>r.goToPage(e),class:(0,y.C4)({active:i.currentPage===e})},(0,y.v_)(e),11,D)))),128))])])):((0,a.uX)(),(0,a.CE)("div",T," 加载中,请稍后... ")),(0,a.Lk)("div",X,[t[8]||(t[8]=(0,a.Lk)("h2",null,"我要添加课程",-1)),(0,a.Lk)("div",F,[(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[0]||(t[0]=e=>i.newCourseName=e),type:"text",placeholder:"请输入课程名称"},null,512),[[s.Jo,i.newCourseName]]),(0,a.bo)((0,a.Lk)("select",{"onUpdate:modelValue":t[1]||(t[1]=e=>i.newCategoryId=e)},t[6]||(t[6]=[(0,a.Fv)('',14)]),512),[[s.u1,i.newCategoryId]]),(0,a.bo)((0,a.Lk)("select",{"onUpdate:modelValue":t[2]||(t[2]=e=>i.newCollege=e)},[t[7]||(t[7]=(0,a.Lk)("option",{value:"",disabled:""},"请选择开课院系",-1)),((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(r.filteredColleges,((e,t)=>((0,a.uX)(),(0,a.CE)("option",{key:t,value:t},(0,y.v_)(e),9,N)))),128))],512),[[s.u1,i.newCollege]]),(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[3]||(t[3]=e=>i.newTeachers=e),type:"text",placeholder:"请输入任课教师(多个教师之间用英文逗号,隔开)"},null,512),[[s.Jo,i.newTeachers]]),(0,a.Lk)("button",{onClick:t[4]||(t[4]=(...e)=>r.submitCourse&&r.submitCourse(...e))},"提交")])]),(0,a.bF)(c,{isVisible:i.showDetail,course:i.selectedCourse,onClose:r.closeCourseDetail},null,8,["isVisible","course","onClose"])])}o(4979);const I={key:0,class:"modal-overlay"},V={class:"modal-content"},A={class:"course-detail"},z={key:0,class:"share-modal"},O={key:1,class:"error-modal"},q={class:"rating-section"},R={class:"total-rating"},B={class:"progress-container"},Q={class:"stars"},J=["onMouseover","onClick"],K={class:"comment-section"},H={class:"sort-options"},G={key:0,class:"comments-list"},Y={class:"comment-meta"},Z={class:"comment-time",style:{"margin-left":"10px"}},ee=["onClick"],te={style:{"margin-top":"8px"}},oe={class:"comment-actions"},se={style:{color:"red"}},ae=["onClick"],ne=["onClick"],ie={key:1,class:"no-comments"},re={key:2,class:"chat-modal-overlay"},ce={class:"chat-modal-content"},le={class:"chat-modal-actions"},ue=["disabled"],de={key:3,class:"chat-modal-overlay"},he={class:"chat-modal-content"},me={class:"chat-modal-actions"},ge={class:"new-comment"};function pe(e,t,o,n,i,r){const c=(0,a.g2)("el-progress");return o.isVisible?((0,a.uX)(),(0,a.CE)("div",I,[(0,a.Lk)("div",V,[(0,a.Lk)("span",{class:"close",onClick:t[0]||(t[0]=(...e)=>r.closeModal&&r.closeModal(...e))},"×"),(0,a.Lk)("div",A,[(0,a.Lk)("h3",null,[(0,a.eW)((0,y.v_)(o.course.course_name)+" ",1),o.course.titles&&o.course.titles.length>0?((0,a.uX)(!0),(0,a.CE)(a.FK,{key:0},(0,a.pI)(o.course.titles,(e=>((0,a.uX)(),(0,a.CE)("span",{key:e.title,class:"course-title",style:(0,y.Tr)({borderColor:e.color,color:e.color})},(0,y.v_)(e.title),5)))),128)):(0,a.Q3)("",!0),(0,a.Lk)("button",{class:"share-btn",onClick:t[1]||(t[1]=(...e)=>r.shareCourse&&r.shareCourse(...e))},"分享给好友")]),(0,a.Lk)("p",null,[t[16]||(t[16]=(0,a.Lk)("strong",null,"分类:",-1)),(0,a.eW)(" "+(0,y.v_)(r.getCategoryName(o.course.category_id)),1)]),(0,a.Lk)("p",null,[t[17]||(t[17]=(0,a.Lk)("strong",null,"教师:",-1)),(0,a.eW)(" "+(0,y.v_)(o.course.teachers),1)]),(0,a.Lk)("p",null,[t[18]||(t[18]=(0,a.Lk)("strong",null,"开课院系:",-1)),(0,a.eW)(" "+(0,y.v_)(r.getCollegeName(o.course.college)),1)]),i.showShareModal?((0,a.uX)(),(0,a.CE)("div",z," 链接复制成功,快去分享给其他小伙伴吧! ")):(0,a.Q3)("",!0),i.showErrorModal?((0,a.uX)(),(0,a.CE)("div",O," 获取评论数据失败,正在刷新页面... ")):(0,a.Q3)("",!0),(0,a.Lk)("div",q,[(0,a.Lk)("h4",null,"课程实时平均分 ("+(0,y.v_)(o.course.rating_count)+"人评分)",1),(0,a.Lk)("div",R,(0,y.v_)(i.totalRating),1),(0,a.Lk)("div",B,[(0,a.bF)(c,{class:"progress",percentage:i.fiveStarPercent,status:"success","text-inside":""},{default:(0,a.k6)((()=>[(0,a.eW)("5星: "+(0,y.v_)(i.fiveStarPercent.toFixed(2))+"%",1)])),_:1},8,["percentage"]),(0,a.bF)(c,{class:"progress",percentage:i.fourStarPercent,status:"success","text-inside":""},{default:(0,a.k6)((()=>[(0,a.eW)("4星: "+(0,y.v_)(i.fourStarPercent.toFixed(2))+"%",1)])),_:1},8,["percentage"]),(0,a.bF)(c,{class:"progress",percentage:i.threeStarPercent,status:"warning","text-inside":""},{default:(0,a.k6)((()=>[(0,a.eW)("3星: "+(0,y.v_)(i.threeStarPercent.toFixed(2))+"%",1)])),_:1},8,["percentage"]),(0,a.bF)(c,{class:"progress",percentage:i.twoStarPercent,status:"warning","text-inside":""},{default:(0,a.k6)((()=>[(0,a.eW)("2星: "+(0,y.v_)(i.twoStarPercent.toFixed(2))+"%",1)])),_:1},8,["percentage"]),(0,a.bF)(c,{class:"progress",percentage:i.oneStarPercent,status:"exception","text-inside":""},{default:(0,a.k6)((()=>[(0,a.eW)("1星: "+(0,y.v_)(i.oneStarPercent.toFixed(2))+"%",1)])),_:1},8,["percentage"])]),(0,a.Lk)("div",Q,[((0,a.uX)(),(0,a.CE)(a.FK,null,(0,a.pI)(5,(e=>(0,a.Lk)("span",{key:e,class:(0,y.C4)({highlighted:e<=i.userRating}),onMouseover:t=>r.highlightStars(e),onMouseout:t[2]||(t[2]=(...e)=>r.resetStars&&r.resetStars(...e)),onClick:t=>r.confirmRating(e)}," ★ ",42,J))),64))])])]),(0,a.Lk)("div",K,[(0,a.Lk)("div",H,[(0,a.Lk)("label",null,[(0,a.bo)((0,a.Lk)("input",{type:"radio",value:"like_count","onUpdate:modelValue":t[3]||(t[3]=e=>i.sortBy=e),onChange:t[4]||(t[4]=(...e)=>r.fetchComments&&r.fetchComments(...e))},null,544),[[s.XL,i.sortBy]]),t[19]||(t[19]=(0,a.eW)(" 赞数最多优先"))]),(0,a.Lk)("label",null,[(0,a.bo)((0,a.Lk)("input",{type:"radio",value:"comment_time","onUpdate:modelValue":t[5]||(t[5]=e=>i.sortBy=e),onChange:t[6]||(t[6]=(...e)=>r.fetchComments&&r.fetchComments(...e))},null,544),[[s.XL,i.sortBy]]),t[20]||(t[20]=(0,a.eW)(" 最新评论优先"))])]),r.filteredComments?((0,a.uX)(),(0,a.CE)("div",G,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(i.comments,(e=>((0,a.uX)(),(0,a.CE)("div",{key:e.comment_id,class:"comment"},[(0,a.Lk)("div",Y,[(0,a.Lk)("strong",null,(0,y.v_)(e.nickname),1),(0,a.Lk)("span",Z,"发表于 "+(0,y.v_)(r.formatTime(e.comment_time)),1),(0,a.Lk)("span",{class:(0,y.C4)(["like-section",{liked:e.is_liked}]),onClick:t=>r.toggleLike(e)}," ❤ "+(0,y.v_)(e.like_count),11,ee)]),(0,a.Lk)("div",te,(0,y.v_)(e.comment_content),1),(0,a.Lk)("div",oe,[(0,a.Lk)("span",null,[t[21]||(t[21]=(0,a.eW)("评分: ")),(0,a.Lk)("strong",se,(0,y.v_)(e.rating),1)]),e.deleteable?((0,a.uX)(),(0,a.CE)("button",{key:0,onClick:t=>r.deleteComment(e.comment_id),class:"delete-btn"}," 删除 ",8,ae)):((0,a.uX)(),(0,a.CE)("button",{key:1,class:"chat-start-btn",onClick:t=>r.openChatModal(e.comment_id)}," 发起聊天 ",8,ne))])])))),128))])):((0,a.uX)(),(0,a.CE)("p",ie,"本课程暂无评论。")),i.isChatModalVisible?((0,a.uX)(),(0,a.CE)("div",re,[(0,a.Lk)("div",ce,[(0,a.Lk)("span",{class:"chat-close-btn",onClick:t[7]||(t[7]=(...e)=>r.closeChatModal&&r.closeChatModal(...e))},"×"),t[22]||(t[22]=(0,a.Lk)("h3",null,"发起聊天",-1)),(0,a.bo)((0,a.Lk)("textarea",{"onUpdate:modelValue":t[8]||(t[8]=e=>i.chatMessage=e),placeholder:"请输入聊天内容(至少6个字符)",class:"chat-textarea"},null,512),[[s.Jo,i.chatMessage]]),(0,a.Lk)("div",le,[(0,a.Lk)("button",{onClick:t[9]||(t[9]=(...e)=>r.submitChat&&r.submitChat(...e)),disabled:i.chatMessage.length<6},"发起",8,ue)])])])):(0,a.Q3)("",!0),i.isConversationExistsModalVisible?((0,a.uX)(),(0,a.CE)("div",de,[(0,a.Lk)("div",he,[(0,a.Lk)("span",{class:"chat-close-btn",onClick:t[10]||(t[10]=(...e)=>r.closeConversationExistsModal&&r.closeConversationExistsModal(...e))},"×"),t[23]||(t[23]=(0,a.Lk)("h3",null,"在此课程下,您与此用户已有会话!",-1)),(0,a.Lk)("div",me,[(0,a.Lk)("button",{onClick:t[11]||(t[11]=e=>r.navigateToConversation(i.existingConversationId))},"进入会话"),(0,a.Lk)("button",{onClick:t[12]||(t[12]=(...e)=>r.closeConversationExistsModal&&r.closeConversationExistsModal(...e))},"取消")])])])):(0,a.Q3)("",!0),(0,a.Lk)("div",ge,[(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[13]||(t[13]=e=>i.nickname=e),placeholder:"推荐您起个有意义的昵称,如:被x老师伤透了心"},null,512),[[s.Jo,i.nickname]]),(0,a.bo)((0,a.Lk)("textarea",{"onUpdate:modelValue":t[14]||(t[14]=e=>i.commentContent=e),placeholder:"我们推荐您分享本课程的课程内容、学习难度、考核方式和给分好坏,以帮助更多同学做出判断。支持删除自己的评论。",style:{resize:"none",height:"50px"}},null,512),[[s.Jo,i.commentContent]]),(0,a.Lk)("button",{onClick:t[15]||(t[15]=(...e)=>r.submitComment&&r.submitComment(...e))},"提交评论")])])])])):(0,a.Q3)("",!0)}var ke={props:{isVisible:{type:Boolean,required:!0},course:{type:Object,required:!0}},data(){return{userRating:0,totalRating:0,fiveStarPercent:0,fourStarPercent:0,threeStarPercent:0,twoStarPercent:0,oneStarPercent:0,comments:[],nickname:"",commentContent:"",sortBy:"like_count",showShareModal:!1,cachedEmail:null,isChatModalVisible:!1,isConversationExistsModalVisible:!1,chatMessage:"",currentCommentId:null,existingConversationId:null,showErrorModal:!1}},async mounted(){try{await Promise.all([this.fetchAndCacheEmail(),this.fetchRatingDistribution(),this.fetchUserRating()])}catch(e){console.error("Error loading data:",e)}},watch:{async course(e){if(e&&e.course_id)try{await Promise.all([this.fetchRatingDistribution(),this.fetchUserRating(),this.fetchComments()])}catch(t){console.error("Error fetching course details:",t)}}},computed:{filteredComments(){return this.comments.length>0?this.comments:null}},methods:{closeModal(){this.$emit("close")},getCategoryName(e){const t={1:"选修课-通识选修类",2:"选修课-人文选修类",3:"选修课-专业方向类",4:"选修课-体育类",5:"选修课-学科基础类",6:"选修课-暑期国际课",7:"选修课-数学与自然科学类",8:"选修课-重修专栏",9:"必修课-数学与自然科学类",10:"必修课-人文社会科学类",11:"必修课-学科基础类",12:"必修课-专业方向类",13:"必修课-实践类"};return t[e]||"未知分类"},async fetchRatingDistribution(){const e=await fetch(`https://coursesystem.xn--xhq44jb2fzpc.com/get-course-ratings-distribution?course_id=${this.course.course_id}`);if(e.ok){const t=await e.json();this.totalRating=t.total_rating||0,this.fiveStarPercent=100*t.five_stars,this.fourStarPercent=100*t.four_stars,this.threeStarPercent=100*t.three_stars,this.twoStarPercent=100*t.two_stars,this.oneStarPercent=100*t.one_star}else 404===e.status&&(this.totalRating=0,this.fiveStarPercent=0,this.fourStarPercent=0,this.threeStarPercent=0,this.twoStarPercent=0,this.oneStarPercent=0)},async fetchUserRating(){const e=this.getUserEmailFromCookie(),t=await fetch(`https://coursesystem.xn--xhq44jb2fzpc.com/get-user-rating?user_email=${e}&course_id=${this.course.course_id}`);if(200===t.status){const e=await t.json();this.userRating=e.rating}else this.userRating=0},highlightStars(e){this.userRating=e},resetStars(){this.fetchUserRating()},confirmRating(e){confirm(`您确定要给课程 "${this.course.course_name}" 评分:${e}.0 吗?如您之前有评分记录,此评分将覆盖之前的评分。`)&&this.submitRating(e)},async submitRating(e){const t=this.getUserEmailFromCookie(),o=await fetch("https://coursesystem.xn--xhq44jb2fzpc.com/submit-rating",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_email:t,course_id:this.course.course_id,rating:e})});o.ok&&(this.fetchRatingDistribution(),this.fetchUserRating())},async fetchComments(){try{const e=document.cookie.split("; ").find((e=>e.startsWith("token=")));if(!e)return this.showErrorModal=!0,void setTimeout((()=>{window.location.reload()}),2e3);const t=e.split("=")[1],o=await fetch(`https://coursesystem.xn--xhq44jb2fzpc.com/get-comments?course_id=${this.course.course_id}&sort_by=${this.sortBy}`,{headers:{Authorization:t}});if(403===o.status)return this.showErrorModal=!0,void setTimeout((()=>{window.location.reload()}),2e3);if(404===o.status)return void(this.comments=[]);if(!o.ok)throw new Error("获取评论失败");const s=await o.json();this.comments=s}catch(e){console.error("获取评论失败:",e),this.showErrorModal=!0,setTimeout((()=>{window.location.reload()}),2e3)}},async toggleLike(e){const t=this.getUserEmailFromCookie();e.is_liked?await fetch("https://coursesystem.xn--xhq44jb2fzpc.com/unlike-comment",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_email:t,comment_id:e.comment_id})}):await fetch("https://coursesystem.xn--xhq44jb2fzpc.com/like-comment",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_email:t,comment_id:e.comment_id})}),this.fetchComments()},async submitComment(){if(this.nickname.length<3||this.commentContent.length<6)return void alert("您的昵称请至少包含3个字符,评论请至少包含6个字符。");const e=this.getUserEmailFromCookie();await fetch("https://coursesystem.xn--xhq44jb2fzpc.com/submit-comment",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_email:e,course_id:this.course.course_id,nickname:this.nickname,comment_content:this.commentContent})}),this.fetchComments(),this.nickname="",this.commentContent=""},formatTime(e){const t=new Date(e),o=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0"),n=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0");return`${o}-${s}-${a} ${n}:${i}`},async fetchAndCacheEmail(){if(this.cachedEmail)return;const e=document.cookie.split("; "),t=e.find((e=>e.startsWith("token="))),o=t?t.split("=")[1]:"";if(o)try{const e=await fetch("https://userlogin.xn--xhq44jb2fzpc.com/verifyToken",{method:"POST",headers:{"Content-Type":"application/json",Authorization:o}}),t=await e.json();e.ok&&t.email?this.cachedEmail=t.email:console.error("JWT验证失败或未找到邮箱")}catch(s){console.error("JWT验证时出错:",s)}else console.error("未找到JWT信息")},getUserEmailFromCookie(){return this.cachedEmail?this.cachedEmail:(console.error("邮箱尚未缓存"),"")},base64Encode(e){return btoa(e)},shareCourse(){const e=this.course.course_name,t=this.base64Encode(this.course.course_id.toString());let o="";o=0!==this.totalRating?`我在NEU小站为课程【${e}】评分,当前评分【${this.totalRating}】,点击【https://course.xn--xhq44jb2fzpc.com/courses?c=${t}】加入评分吧!`:`我在NEU小站为课程【${e}】评分,点击【https://course.xn--xhq44jb2fzpc.com/courses?c=${t}】加入评分吧!`,this.copyToClipboard(o),this.showShareModal=!0,setTimeout((()=>{this.showShareModal=!1}),3e3)},copyToClipboard(e){const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)},getCollegeName(e){const t={59:"未填写",1:"材料科学与工程学院",2:"创新创业学院",3:"档案馆",4:"党委宣传部",5:"党委组织部",6:"发展规划与学科建设处",7:"佛山研究生创新学院",8:"工程训练中心",9:"工会",10:"工商管理学院",11:"国防教育学院",12:"国际教育学院",13:"后勤服务中心",14:"后勤管理处",15:"浑南管委会",16:"江河建筑学院",17:"尖子班",18:"教务处",19:"基础学院",20:"计划财经处",21:"机器人科学与工程学院",22:"计算机科学与工程学院",23:"计算中心",24:"纪委",25:"机械工程与自动化学院",26:"继续教育学院",27:"科技产业集团",28:"科学技术研究院",29:"理学院",30:"马克思主义学院",31:"民族教育学院",33:"人事处",34:"人文选修课群",35:"软件学院",36:"生命科学与健康学院",37:"体育部",38:"体育场馆管理中心",39:"团委",40:"图书馆",41:"外国语学院",42:"外联处",43:"网络教育学院",44:"未来技术学院",45:"文法学院",46:"校长办公室",47:"信息科学与工程学院",48:"新知识课群",49:"学生处",50:"学生创新中心",51:"学生指导服务中心",52:"研究生院",53:"冶金学院",54:"艺术学院",55:"医学与生物信息工程学院",56:"医院",57:"资产与实验室管理处",58:"资源与土木工程学院"};return t[e]||"未知院系"},openChatModal(e){this.currentCommentId=e,this.chatMessage="",this.isChatModalVisible=!0},closeChatModal(){this.isChatModalVisible=!1},closeConversationExistsModal(){this.isConversationExistsModalVisible=!1},async submitChat(){if(this.chatMessage.length<6)alert("聊天内容需至少6个字符");else try{const e=await fetch("https://coursesystem.xn--xhq44jb2fzpc.com/chat/start-conversation",{method:"POST",headers:{"Content-Type":"application/json",Authorization:document.cookie.split("; ").find((e=>e.startsWith("token="))).split("=")[1]},body:JSON.stringify({comment_id:this.currentCommentId,content:this.chatMessage})}),t=await e.json();e.ok&&"Conversation started successfully"===t.message?this.$router.push(`/chat?mid=${t.conversation_id}`):e.ok&&"Conversation already exists"===t.message?(this.existingConversationId=t.conversation_id,this.isConversationExistsModalVisible=!0):"Recipient account status is abnormal, cannot create a conversation"===t.error?alert("此账号状态异常,暂时无法发起聊天!"):"Cannot start a conversation with yourself!"===t.error?alert("不能向自己发起聊天!"):alert("发起会话失败,请稍后再试")}catch(e){console.error("Error starting conversation:",e),alert("发起会话失败,请稍后再试")}finally{this.closeChatModal()}},navigateToConversation(e){this.$router.push(`/chat?mid=${e}`),this.closeConversationExistsModal()},async deleteComment(e){const t=confirm("确定删除评论吗?");if(t)try{const t=document.cookie.split("; ").find((e=>e.startsWith("token="))).split("=")[1],o=await fetch("https://coursesystem.xn--xhq44jb2fzpc.com/delete-comment",{method:"POST",headers:{"Content-Type":"application/json",Authorization:t},body:JSON.stringify({comment_id:e})});if(o.ok)this.fetchComments();else{const e=await o.json();alert(e.error||"删除评论失败")}}catch(o){console.error("删除评论出错:",o),alert("删除评论失败")}}}};const Ce=(0,m.A)(ke,[["render",pe],["__scopeId","data-v-1964e6a9"]]);var ve=Ce,fe={components:{CourseDetailModal:ve},data(){return{submissions:[],newCourseName:"",newCategoryId:"",newTeachers:"",newCollege:"",currentPage:1,itemsPerPage:10,totalPages:1,isLoaded:!1,selectedCourse:null,showDetail:!1,cachedEmail:null,collegeMap:{59:"未填写",1:"材料科学与工程学院",2:"创新创业学院",3:"档案馆",4:"党委宣传部",5:"党委组织部",6:"发展规划与学科建设处",7:"佛山研究生创新学院",8:"工程训练中心",9:"工会",10:"工商管理学院",11:"国防教育学院",12:"国际教育学院",13:"后勤服务中心",14:"后勤管理处",15:"浑南管委会",16:"江河建筑学院",17:"尖子班",18:"教务处",19:"基础学院",20:"计划财经处",21:"机器人科学与工程学院",22:"计算机科学与工程学院",23:"计算中心",24:"纪委",25:"机械工程与自动化学院",26:"继续教育学院",27:"科技产业集团",28:"科学技术研究院",29:"理学院",30:"马克思主义学院",31:"民族教育学院",33:"人事处",34:"人文选修课群",35:"软件学院",36:"生命科学与健康学院",37:"体育部",38:"体育场馆管理中心",39:"团委",40:"图书馆",41:"外国语学院",42:"外联处",43:"网络教育学院",44:"未来技术学院",45:"文法学院",46:"校长办公室",47:"信息科学与工程学院",48:"新知识课群",49:"学生处",50:"学生创新中心",51:"学生指导服务中心",52:"研究生院",53:"冶金学院",54:"艺术学院",55:"医学与生物信息工程学院",56:"医院",57:"资产与实验室管理处",58:"资源与土木工程学院"}}},computed:{paginatedSubmissions(){const e=(this.currentPage-1)*this.itemsPerPage,t=e+this.itemsPerPage;return this.submissions.slice(e,t)},filteredColleges(){return Object.fromEntries(Object.entries(this.collegeMap).filter((([e])=>"59"!==e)))}},mounted(){setTimeout((async()=>{this.isLoaded=!0,await this.fetchAndCacheEmail(),this.fetchSubmissions()}),300);const e=this.$route.query.c;if(e)try{const t=atob(e);this.isPositiveInteger(t)&&(this.decodedParam=t,this.isValid=!0,this.loadCourseDetail(this.decodedParam))}catch(t){}},methods:{isPositiveInteger(e){const t=Number(e);return Number.isInteger(t)&&t>0},async fetchAndCacheEmail(){if(this.cachedEmail)return;const e=document.cookie.split("; "),t=e.find((e=>e.startsWith("token="))),o=t?t.split("=")[1]:"";if(o)try{const e=await fetch("https://userlogin.xn--xhq44jb2fzpc.com/verifyToken",{method:"POST",headers:{"Content-Type":"application/json",Authorization:o}}),t=await e.json();e.ok&&t.email?this.cachedEmail=t.email:console.error("JWT验证失败或未找到邮箱")}catch(s){console.error("JWT验证时出错:",s)}else console.error("未找到JWT信息")},async fetchSubmissions(){const e=this.getCookie("token");if(!e)return void alert("无法获取JWT,请重新登录。");const t=await fetch("https://coursesystem.xn--xhq44jb2fzpc.com/user/user-submissions",{method:"GET",headers:{"Content-Type":"application/json",Authorization:e}}),o=await t.json();200===t.status?(this.submissions=o,this.totalPages=Math.ceil(this.submissions.length/this.itemsPerPage)):alert(o.error||"查询投稿记录失败")},getCookie(e){const t=document.cookie.split(";");for(let o of t){const[t,s]=o.trim().split("=");if(t===e)return s}return null},goToPage(e){this.currentPage=e},async submitCourse(){if(this.newCourseName&&this.newCategoryId&&this.newTeachers&&this.newCollege){if(confirm("确认提交审核吗?")){const e=this.getCookie("token");if(!e)return void alert("无法获取JWT,请重新登录。");const t={course_name:this.newCourseName,category_id:this.newCategoryId,teachers:this.newTeachers,college:this.newCollege};await fetch("https://coursesystem.xn--xhq44jb2fzpc.com/user/submit-course",{method:"POST",headers:{"Content-Type":"application/json",Authorization:e},body:JSON.stringify(t)}),this.newCourseName="",this.newCategoryId="",this.newTeachers="",this.newCollege="",this.fetchSubmissions()}}else alert("请填写所有字段后提交!")},getCategoryName(e){const t={1:"选修课-通识选修类",2:"选修课-人文选修类",3:"选修课-专业方向类",4:"选修课-体育类",5:"选修课-学科基础类",6:"选修课-暑期国际课",7:"选修课-数学与自然科学类",8:"选修课-重修专栏",9:"必修课-数学与自然科学类",10:"必修课-人文社会科学类",11:"必修课-学科基础类",12:"必修课-专业方向类",13:"必修课-实践类"};return t[e]||"未知分类"},formatTime(e){const t=new Date(e),o=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0"),n=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0");return`${o}-${s}-${a} ${n}:${i}`},async loadCourseDetail(e){try{const t=await fetch(`https://coursesystem.xn--xhq44jb2fzpc.com/course-detail?course_id=${e}`),o=await t.json();this.selectedCourse=o,this.showDetail=!0}catch(t){console.error("Error loading course details:",t)}},closeCourseDetail(){this.showDetail=!1,this.selectedCourse=null},getCollegeName(e){const t={59:"未填写",1:"材料科学与工程学院",2:"创新创业学院",3:"档案馆",4:"党委宣传部",5:"党委组织部",6:"发展规划与学科建设处",7:"佛山研究生创新学院",8:"工程训练中心",9:"工会",10:"工商管理学院",11:"国防教育学院",12:"国际教育学院",13:"后勤服务中心",14:"后勤管理处",15:"浑南管委会",16:"江河建筑学院",17:"尖子班",18:"教务处",19:"基础学院",20:"计划财经处",21:"机器人科学与工程学院",22:"计算机科学与工程学院",23:"计算中心",24:"纪委",25:"机械工程与自动化学院",26:"继续教育学院",27:"科技产业集团",28:"科学技术研究院",29:"理学院",30:"马克思主义学院",31:"民族教育学院",33:"人事处",34:"人文选修课群",35:"软件学院",36:"生命科学与健康学院",37:"体育部",38:"体育场馆管理中心",39:"团委",40:"图书馆",41:"外国语学院",42:"外联处",43:"网络教育学院",44:"未来技术学院",45:"文法学院",46:"校长办公室",47:"信息科学与工程学院",48:"新知识课群",49:"学生处",50:"学生创新中心",51:"学生指导服务中心",52:"研究生院",53:"冶金学院",54:"艺术学院",55:"医学与生物信息工程学院",56:"医院",57:"资产与实验室管理处",58:"资源与土木工程学院"};return t[e]||"未知院系"}}};const be=(0,m.A)(fe,[["render",U],["__scopeId","data-v-7dae1a14"]]);var ye=be;const Le={key:0,class:"rating-page"},_e={class:"search-sort-bar"},we={class:"category-checkboxes"},Ee=["value"],xe={class:"course-cards"},Pe=["onClick"],Se={class:"card-type"},Te={class:"card-teachers"},Me={class:"card-college"},We={class:"card-ratecount"},je={key:0,class:"card-topcomment"},$e={key:1,class:"card-topcomment"},De={class:"card-rate"},Xe={class:"pagination-bar"},Fe=["onClick"],Ne=["disabled"],Ue={key:1};function Ie(e,t,o,n,i,r){const c=(0,a.g2)("CourseDetailModal");return i.isLoaded?((0,a.uX)(),(0,a.CE)("div",Le,[t[30]||(t[30]=(0,a.Lk)("h2",{class:"rating-note"},"每页最多展示12个课程,一次最多展示10个页码。点击星星进行评分,星星记录的是您的历史评分。",-1)),(0,a.Lk)("div",_e,[(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[0]||(t[0]=e=>i.searchQuery=e),type:"text",placeholder:"请输入课程名"},null,512),[[s.Jo,i.searchQuery]]),(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[1]||(t[1]=e=>i.teacherQuery=e),type:"text",style:{width:"450px"},placeholder:"请输入教师名,多个教师以英文逗号分隔,如“张三,李四”"},null,512),[[s.Jo,i.teacherQuery]]),(0,a.Lk)("div",we,[(0,a.Lk)("label",null,[(0,a.bo)((0,a.Lk)("input",{type:"checkbox","onUpdate:modelValue":t[2]||(t[2]=e=>i.selectedCategories=e),value:"1"},null,512),[[s.lH,i.selectedCategories]]),t[15]||(t[15]=(0,a.eW)(" 通识选修类"))]),(0,a.Lk)("label",null,[(0,a.bo)((0,a.Lk)("input",{type:"checkbox","onUpdate:modelValue":t[3]||(t[3]=e=>i.selectedCategories=e),value:"2"},null,512),[[s.lH,i.selectedCategories]]),t[16]||(t[16]=(0,a.eW)(" 人文选修类"))]),(0,a.Lk)("label",null,[(0,a.bo)((0,a.Lk)("input",{type:"checkbox","onUpdate:modelValue":t[4]||(t[4]=e=>i.selectedCategories=e),value:"3"},null,512),[[s.lH,i.selectedCategories]]),t[17]||(t[17]=(0,a.eW)(" 专业方向类"))]),(0,a.Lk)("label",null,[(0,a.bo)((0,a.Lk)("input",{type:"checkbox","onUpdate:modelValue":t[5]||(t[5]=e=>i.selectedCategories=e),value:"4"},null,512),[[s.lH,i.selectedCategories]]),t[18]||(t[18]=(0,a.eW)(" 体育类"))]),(0,a.Lk)("label",null,[(0,a.bo)((0,a.Lk)("input",{type:"checkbox","onUpdate:modelValue":t[6]||(t[6]=e=>i.selectedCategories=e),value:"5"},null,512),[[s.lH,i.selectedCategories]]),t[19]||(t[19]=(0,a.eW)(" 学科基础类"))]),(0,a.Lk)("label",null,[(0,a.bo)((0,a.Lk)("input",{type:"checkbox","onUpdate:modelValue":t[7]||(t[7]=e=>i.selectedCategories=e),value:"6"},null,512),[[s.lH,i.selectedCategories]]),t[20]||(t[20]=(0,a.eW)(" 暑期国际课"))]),(0,a.Lk)("label",null,[(0,a.bo)((0,a.Lk)("input",{type:"checkbox","onUpdate:modelValue":t[8]||(t[8]=e=>i.selectedCategories=e),value:"7"},null,512),[[s.lH,i.selectedCategories]]),t[21]||(t[21]=(0,a.eW)(" 数学与自然科学类"))]),(0,a.Lk)("label",null,[(0,a.bo)((0,a.Lk)("input",{type:"checkbox","onUpdate:modelValue":t[9]||(t[9]=e=>i.selectedCategories=e),value:"8"},null,512),[[s.lH,i.selectedCategories]]),t[22]||(t[22]=(0,a.eW)(" 重修专栏"))])]),(0,a.bo)((0,a.Lk)("select",{"onUpdate:modelValue":t[10]||(t[10]=e=>i.sortBy=e)},t[23]||(t[23]=[(0,a.Lk)("option",{value:"rating"},"评分由高到低",-1),(0,a.Lk)("option",{value:"rating-asc"},"评分由低到高",-1),(0,a.Lk)("option",{value:"rating_count"},"评分人数由多到少",-1)]),512),[[s.u1,i.sortBy]]),(0,a.bo)((0,a.Lk)("select",{"onUpdate:modelValue":t[11]||(t[11]=e=>i.selectedCollege=e)},[t[24]||(t[24]=(0,a.Lk)("option",{value:""},"不限院系",-1)),((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(r.filteredColleges,(([e,t])=>((0,a.uX)(),(0,a.CE)("option",{key:e,value:e},(0,y.v_)(t),9,Ee)))),128))],512),[[s.u1,i.selectedCollege]]),(0,a.Lk)("button",{onClick:t[12]||(t[12]=(...e)=>r.searchCourses&&r.searchCourses(...e))},"更新查询")]),(0,a.Lk)("div",xe,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(i.courses,(e=>((0,a.uX)(),(0,a.CE)("div",{key:e.course_id,class:"course-card",onClick:t=>r.showCourseDetail(e)},[(0,a.Lk)("h3",null,[(0,a.eW)((0,y.v_)(e.course_name)+" ",1),e.titles&&e.titles.length>0?((0,a.uX)(!0),(0,a.CE)(a.FK,{key:0},(0,a.pI)(e.titles,(e=>((0,a.uX)(),(0,a.CE)("span",{key:e.title,class:"course-title",style:(0,y.Tr)({borderColor:e.color,color:e.color})},(0,y.v_)(e.title),5)))),128)):(0,a.Q3)("",!0)]),(0,a.Lk)("p",Se,[t[25]||(t[25]=(0,a.Lk)("strong",null,"分类:",-1)),(0,a.eW)(" "+(0,y.v_)(r.getCategoryName(e.category_id)),1)]),(0,a.Lk)("p",Te,[t[26]||(t[26]=(0,a.Lk)("strong",null,"教师:",-1)),(0,a.eW)(" "+(0,y.v_)(e.teachers),1)]),(0,a.Lk)("p",Me,[t[27]||(t[27]=(0,a.Lk)("strong",null,"开课院系:",-1)),(0,a.eW)(" "+(0,y.v_)(r.getCollegeName(e.college)),1)]),(0,a.Lk)("p",We,[t[28]||(t[28]=(0,a.Lk)("strong",null,"评分人数:",-1)),(0,a.eW)(" "+(0,y.v_)(e.rating_count),1)]),e.top_comment?((0,a.uX)(),(0,a.CE)("p",je,'"'+(0,y.v_)(r.formatTopComment(e.top_comment))+'"',1)):((0,a.uX)(),(0,a.CE)("p",$e,"暂无评论")),(0,a.Lk)("p",De,[(0,a.eW)((0,y.v_)(e.rating),1),t[29]||(t[29]=(0,a.Lk)("span",{class:"unit"}," 分",-1))])],8,Pe)))),128))]),(0,a.Lk)("div",Xe,[(0,a.Lk)("button",{onClick:t[13]||(t[13]=e=>r.goToPage(1)),class:(0,y.C4)({active:1===i.currentPage})},"首页",2),((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(r.getPaginationPages(),(e=>((0,a.uX)(),(0,a.CE)("button",{key:e,onClick:t=>r.goToPage(e),class:(0,y.C4)({active:i.currentPage===e})},(0,y.v_)(e),11,Fe)))),128)),(0,a.Lk)("button",{onClick:t[14]||(t[14]=e=>r.goToPage(i.totalPages)),class:(0,y.C4)({active:i.currentPage===i.totalPages}),disabled:0===i.totalPages}," 尾页 ",10,Ne)]),(0,a.bF)(c,{isVisible:i.showDetail,course:i.selectedCourse,onClose:r.closeCourseDetail},null,8,["isVisible","course","onClose"])])):((0,a.uX)(),(0,a.CE)("div",Ue,t[31]||(t[31]=[(0,a.Lk)("p",{style:{color:"#666"}},"加载中,请稍后...",-1)])))}var Ve={components:{CourseDetailModal:ve},data(){return{searchQuery:"",teacherQuery:"",sortBy:"rating",sortOrder:"desc",selectedCategories:[],courses:[],currentPage:1,totalPages:1,showDetail:!1,selectedCourse:null,courseComments:[],isLoaded:!1,selectedCollege:"",allColleges:[],collegeMap:{59:"未填写",1:"材料科学与工程学院",2:"创新创业学院",3:"档案馆",4:"党委宣传部",5:"党委组织部",6:"发展规划与学科建设处",7:"佛山研究生创新学院",8:"工程训练中心",9:"工会",10:"工商管理学院",11:"国防教育学院",12:"国际教育学院",13:"后勤服务中心",14:"后勤管理处",15:"浑南管委会",16:"江河建筑学院",17:"尖子班",18:"教务处",19:"基础学院",20:"计划财经处",21:"机器人科学与工程学院",22:"计算机科学与工程学院",23:"计算中心",24:"纪委",25:"机械工程与自动化学院",26:"继续教育学院",27:"科技产业集团",28:"科学技术研究院",29:"理学院",30:"马克思主义学院",31:"民族教育学院",33:"人事处",34:"人文选修课群",35:"软件学院",36:"生命科学与健康学院",37:"体育部",38:"体育场馆管理中心",39:"团委",40:"图书馆",41:"外国语学院",42:"外联处",43:"网络教育学院",44:"未来技术学院",45:"文法学院",46:"校长办公室",47:"信息科学与工程学院",48:"新知识课群",49:"学生处",50:"学生创新中心",51:"学生指导服务中心",52:"研究生院",53:"冶金学院",54:"艺术学院",55:"医学与生物信息工程学院",56:"医院",57:"资产与实验室管理处",58:"资源与土木工程学院"}}},computed:{filteredColleges(){return Object.entries(this.collegeMap).filter((([e])=>"59"!==e))}},mounted(){setTimeout((()=>{this.isLoaded=!0,this.searchCourses()}),300),this.allColleges=Object.keys(this.collegeMap).map(Number)},methods:{async fetchCourses(){let e="rating-asc"===this.sortBy?"rating":this.sortBy;this.sortOrder="rating-asc"===this.sortBy?"asc":"desc";const t=0===this.selectedCategories.length?"1,2,3,4,5,6,7,8":this.selectedCategories.join(","),o=this.selectedCollege?`&college=${this.selectedCollege}`:"",s=await fetch(`https://coursesystem.xn--xhq44jb2fzpc.com/list/courses?search=${this.searchQuery}&teacher=${this.teacherQuery}&sortBy=${e}&sort=${this.sortOrder}&category=${t}${o}&page=${this.currentPage}`),a=await s.json();this.courses=a},async fetchTotalPages(){const e=0===this.selectedCategories.length?"1,2,3,4,5,6,7,8":this.selectedCategories.join(","),t=this.selectedCollege?`&college=${this.selectedCollege}`:"",o=await fetch(`https://coursesystem.xn--xhq44jb2fzpc.com/list/courses/pages?search=${this.searchQuery}&teacher=${this.teacherQuery}&category=${e}${t}`),s=await o.json();this.totalPages=s.totalPages},getPaginationPages(){const e=[],t=this.totalPages,o=this.currentPage,s=10;if(t<=s)for(let a=1;a<=t;a++)e.push(a);else{let s=Math.max(o-5,1),a=Math.min(o+4,t);o<=6&&(s=1,a=10),o>=t-4&&(s=t-9,a=t);for(let t=s;t<=a;t++)e.push(t)}return e},searchCourses(){this.currentPage=1,this.fetchCourses(),this.fetchTotalPages()},goToPage(e){e<1||e>this.totalPages||(this.currentPage=e,this.fetchCourses())},showCourseDetail(e){this.selectedCourse={...e},this.showDetail=!0},formatTopComment(e){if(!e)return"";let t=0,o="";for(let s=0;s255?1:.5;if(t+a>29)return o+"...";t+=a,o+=e[s]}return o},closeCourseDetail(){this.showDetail=!1,this.selectedCourse=null},getCategoryName(e){const t={1:"通识选修类",2:"人文选修类",3:"专业方向类",4:"体育类",5:"学科基础类",6:"暑期国际课",7:"数学与自然科学类",8:"重修专栏"};return t[e]||"未知分类"},getCollegeName(e){const t={59:"未填写",1:"材料科学与工程学院",2:"创新创业学院",3:"档案馆",4:"党委宣传部",5:"党委组织部",6:"发展规划与学科建设处",7:"佛山研究生创新学院",8:"工程训练中心",9:"工会",10:"工商管理学院",11:"国防教育学院",12:"国际教育学院",13:"后勤服务中心",14:"后勤管理处",15:"浑南管委会",16:"江河建筑学院",17:"尖子班",18:"教务处",19:"基础学院",20:"计划财经处",21:"机器人科学与工程学院",22:"计算机科学与工程学院",23:"计算中心",24:"纪委",25:"机械工程与自动化学院",26:"继续教育学院",27:"科技产业集团",28:"科学技术研究院",29:"理学院",30:"马克思主义学院",31:"民族教育学院",33:"人事处",34:"人文选修课群",35:"软件学院",36:"生命科学与健康学院",37:"体育部",38:"体育场馆管理中心",39:"团委",40:"图书馆",41:"外国语学院",42:"外联处",43:"网络教育学院",44:"未来技术学院",45:"文法学院",46:"校长办公室",47:"信息科学与工程学院",48:"新知识课群",49:"学生处",50:"学生创新中心",51:"学生指导服务中心",52:"研究生院",53:"冶金学院",54:"艺术学院",55:"医学与生物信息工程学院",56:"医院",57:"资产与实验室管理处",58:"资源与土木工程学院"};return t[e]||"未知院系"}}};const Ae=(0,m.A)(Ve,[["render",Ie],["__scopeId","data-v-e62c4cda"]]);var ze=Ae;const Oe={key:0,class:"rating-page"},qe={class:"search-sort-bar"},Re={class:"category-checkboxes"},Be={class:"select-container"},Qe=["value"],Je={class:"course-cards"},Ke=["onClick"],He={class:"card-type"},Ge={class:"card-teachers"},Ye={class:"card-college"},Ze={class:"card-ratecount"},et={key:0,class:"card-topcomment"},tt={key:1,class:"card-topcomment"},ot={class:"card-rate"},st={class:"pagination-bar"},at=["onClick"],nt=["disabled"],it={key:1};function rt(e,t,o,n,i,r){const c=(0,a.g2)("CourseDetailModal");return i.isLoaded?((0,a.uX)(),(0,a.CE)("div",Oe,[t[24]||(t[24]=(0,a.Lk)("h2",{class:"rating-note"},"每页最多展示12个课程,一次最多展示10个页码。点击星星进行评分,星星记录的是您的历史评分。",-1)),(0,a.Lk)("div",qe,[(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[0]||(t[0]=e=>i.searchQuery=e),type:"text",placeholder:"请输入课程名"},null,512),[[s.Jo,i.searchQuery]]),(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[1]||(t[1]=e=>i.teacherQuery=e),type:"text",style:{width:"450px"},placeholder:"请输入教师名,多个教师以英文逗号分隔,如“张三,李四”"},null,512),[[s.Jo,i.teacherQuery]]),(0,a.Lk)("div",Re,[(0,a.Lk)("label",null,[(0,a.bo)((0,a.Lk)("input",{type:"checkbox","onUpdate:modelValue":t[2]||(t[2]=e=>i.selectedCategories=e),value:"9"},null,512),[[s.lH,i.selectedCategories]]),t[12]||(t[12]=(0,a.eW)(" 数学与自然科学类"))]),(0,a.Lk)("label",null,[(0,a.bo)((0,a.Lk)("input",{type:"checkbox","onUpdate:modelValue":t[3]||(t[3]=e=>i.selectedCategories=e),value:"10"},null,512),[[s.lH,i.selectedCategories]]),t[13]||(t[13]=(0,a.eW)(" 人文社会科学类"))]),(0,a.Lk)("label",null,[(0,a.bo)((0,a.Lk)("input",{type:"checkbox","onUpdate:modelValue":t[4]||(t[4]=e=>i.selectedCategories=e),value:"11"},null,512),[[s.lH,i.selectedCategories]]),t[14]||(t[14]=(0,a.eW)(" 学科基础类"))]),(0,a.Lk)("label",null,[(0,a.bo)((0,a.Lk)("input",{type:"checkbox","onUpdate:modelValue":t[5]||(t[5]=e=>i.selectedCategories=e),value:"12"},null,512),[[s.lH,i.selectedCategories]]),t[15]||(t[15]=(0,a.eW)(" 专业方向类"))]),(0,a.Lk)("label",null,[(0,a.bo)((0,a.Lk)("input",{type:"checkbox","onUpdate:modelValue":t[6]||(t[6]=e=>i.selectedCategories=e),value:"13"},null,512),[[s.lH,i.selectedCategories]]),t[16]||(t[16]=(0,a.eW)(" 实践类"))])]),(0,a.Lk)("div",Be,[(0,a.bo)((0,a.Lk)("select",{class:"sortBySelect","onUpdate:modelValue":t[7]||(t[7]=e=>i.sortBy=e)},t[17]||(t[17]=[(0,a.Lk)("option",{value:"rating"},"评分由高到低",-1),(0,a.Lk)("option",{value:"rating-asc"},"评分由低到高",-1),(0,a.Lk)("option",{value:"rating_count"},"评分人数由多到少",-1)]),512),[[s.u1,i.sortBy]]),(0,a.bo)((0,a.Lk)("select",{"onUpdate:modelValue":t[8]||(t[8]=e=>i.selectedCollege=e)},[t[18]||(t[18]=(0,a.Lk)("option",{value:""},"不限院系",-1)),((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(r.filteredColleges,(([e,t])=>((0,a.uX)(),(0,a.CE)("option",{key:e,value:e},(0,y.v_)(t),9,Qe)))),128))],512),[[s.u1,i.selectedCollege]])]),(0,a.Lk)("button",{onClick:t[9]||(t[9]=(...e)=>r.searchCourses&&r.searchCourses(...e))},"更新查询")]),(0,a.Lk)("div",Je,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(i.courses,(e=>((0,a.uX)(),(0,a.CE)("div",{key:e.course_id,class:"course-card",onClick:t=>r.showCourseDetail(e)},[(0,a.Lk)("h3",null,[(0,a.eW)((0,y.v_)(e.course_name)+" ",1),e.titles&&e.titles.length>0?((0,a.uX)(!0),(0,a.CE)(a.FK,{key:0},(0,a.pI)(e.titles,(e=>((0,a.uX)(),(0,a.CE)("span",{key:e.title,class:"course-title",style:(0,y.Tr)({borderColor:e.color,color:e.color})},(0,y.v_)(e.title),5)))),128)):(0,a.Q3)("",!0)]),(0,a.Lk)("p",He,[t[19]||(t[19]=(0,a.Lk)("strong",null,"分类:",-1)),(0,a.eW)(" "+(0,y.v_)(r.getCategoryName(e.category_id)),1)]),(0,a.Lk)("p",Ge,[t[20]||(t[20]=(0,a.Lk)("strong",null,"教师:",-1)),(0,a.eW)(" "+(0,y.v_)(e.teachers),1)]),(0,a.Lk)("p",Ye,[t[21]||(t[21]=(0,a.Lk)("strong",null,"开课院系:",-1)),(0,a.eW)(" "+(0,y.v_)(r.getCollegeName(e.college)),1)]),(0,a.Lk)("p",Ze,[t[22]||(t[22]=(0,a.Lk)("strong",null,"评分人数:",-1)),(0,a.eW)(" "+(0,y.v_)(e.rating_count),1)]),e.top_comment?((0,a.uX)(),(0,a.CE)("p",et,'"'+(0,y.v_)(r.formatTopComment(e.top_comment))+'"',1)):((0,a.uX)(),(0,a.CE)("p",tt,"暂无评论")),(0,a.Lk)("p",ot,[(0,a.eW)((0,y.v_)(e.rating),1),t[23]||(t[23]=(0,a.Lk)("span",{class:"unit"}," 分",-1))])],8,Ke)))),128))]),(0,a.Lk)("div",st,[(0,a.Lk)("button",{onClick:t[10]||(t[10]=e=>r.goToPage(1)),class:(0,y.C4)({active:1===i.currentPage})},"首页",2),((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(r.getPaginationPages(),(e=>((0,a.uX)(),(0,a.CE)("button",{key:e,onClick:t=>r.goToPage(e),class:(0,y.C4)({active:i.currentPage===e})},(0,y.v_)(e),11,at)))),128)),(0,a.Lk)("button",{onClick:t[11]||(t[11]=e=>r.goToPage(i.totalPages)),class:(0,y.C4)({active:i.currentPage===i.totalPages}),disabled:0===i.totalPages}," 尾页 ",10,nt)]),(0,a.bF)(c,{isVisible:i.showDetail,course:i.selectedCourse,onClose:r.closeCourseDetail},null,8,["isVisible","course","onClose"])])):((0,a.uX)(),(0,a.CE)("div",it,t[25]||(t[25]=[(0,a.Lk)("p",{style:{color:"#666"}},"加载中,请稍后...",-1)])))}var ct={components:{CourseDetailModal:ve},data(){return{searchQuery:"",teacherQuery:"",sortBy:"rating",sortOrder:"desc",selectedCategories:[],courses:[],currentPage:1,totalPages:1,showDetail:!1,selectedCourse:null,courseComments:[],isLoaded:!1,selectedCollege:"",allColleges:[],collegeMap:{59:"未填写",1:"材料科学与工程学院",2:"创新创业学院",3:"档案馆",4:"党委宣传部",5:"党委组织部",6:"发展规划与学科建设处",7:"佛山研究生创新学院",8:"工程训练中心",9:"工会",10:"工商管理学院",11:"国防教育学院",12:"国际教育学院",13:"后勤服务中心",14:"后勤管理处",15:"浑南管委会",16:"江河建筑学院",17:"尖子班",18:"教务处",19:"基础学院",20:"计划财经处",21:"机器人科学与工程学院",22:"计算机科学与工程学院",23:"计算中心",24:"纪委",25:"机械工程与自动化学院",26:"继续教育学院",27:"科技产业集团",28:"科学技术研究院",29:"理学院",30:"马克思主义学院",31:"民族教育学院",33:"人事处",34:"人文选修课群",35:"软件学院",36:"生命科学与健康学院",37:"体育部",38:"体育场馆管理中心",39:"团委",40:"图书馆",41:"外国语学院",42:"外联处",43:"网络教育学院",44:"未来技术学院",45:"文法学院",46:"校长办公室",47:"信息科学与工程学院",48:"新知识课群",49:"学生处",50:"学生创新中心",51:"学生指导服务中心",52:"研究生院",53:"冶金学院",54:"艺术学院",55:"医学与生物信息工程学院",56:"医院",57:"资产与实验室管理处",58:"资源与土木工程学院"}}},computed:{filteredColleges(){return Object.entries(this.collegeMap).filter((([e])=>"59"!==e))}},mounted(){setTimeout((()=>{this.isLoaded=!0,this.searchCourses()}),300),this.allColleges=Object.keys(this.collegeMap).map(Number)},methods:{async fetchCourses(){let e="rating-asc"===this.sortBy?"rating":this.sortBy;this.sortOrder="rating-asc"===this.sortBy?"asc":"desc";const t=0===this.selectedCategories.length?"9,10,11,12,13":this.selectedCategories.join(","),o=this.selectedCollege?`&college=${this.selectedCollege}`:"",s=await fetch(`https://coursesystem.xn--xhq44jb2fzpc.com/list/courses?search=${this.searchQuery}&teacher=${this.teacherQuery}&sortBy=${e}&sort=${this.sortOrder}&category=${t}${o}&page=${this.currentPage}`),a=await s.json();this.courses=a},async fetchTotalPages(){const e=0===this.selectedCategories.length?"9,10,11,12,13":this.selectedCategories.join(","),t=this.selectedCollege?`&college=${this.selectedCollege}`:"",o=await fetch(`https://coursesystem.xn--xhq44jb2fzpc.com/list/courses/pages?search=${this.searchQuery}&teacher=${this.teacherQuery}&category=${e}${t}`),s=await o.json();this.totalPages=s.totalPages},getPaginationPages(){const e=[],t=this.totalPages,o=this.currentPage,s=10;if(t<=s)for(let a=1;a<=t;a++)e.push(a);else{let s=Math.max(o-5,1),a=Math.min(o+4,t);o<=6&&(s=1,a=10),o>=t-4&&(s=t-9,a=t);for(let t=s;t<=a;t++)e.push(t)}return e},searchCourses(){this.currentPage=1,this.fetchCourses(),this.fetchTotalPages()},goToPage(e){e<1||e>this.totalPages||(this.currentPage=e,this.fetchCourses())},showCourseDetail(e){this.selectedCourse={...e},this.showDetail=!0},formatTopComment(e){if(!e)return"";let t=0,o="";for(let s=0;s255?1:.5;if(t+a>29)return o+"...";t+=a,o+=e[s]}return o},closeCourseDetail(){this.showDetail=!1,this.selectedCourse=null},getCategoryName(e){const t={9:"数学与自然科学类",10:"人文社会科学类",11:"学科基础类",12:"专业方向类",13:"实践类"};return t[e]||"未知分类"},getCollegeName(e){const t={59:"未填写",1:"材料科学与工程学院",2:"创新创业学院",3:"档案馆",4:"党委宣传部",5:"党委组织部",6:"发展规划与学科建设处",7:"佛山研究生创新学院",8:"工程训练中心",9:"工会",10:"工商管理学院",11:"国防教育学院",12:"国际教育学院",13:"后勤服务中心",14:"后勤管理处",15:"浑南管委会",16:"江河建筑学院",17:"尖子班",18:"教务处",19:"基础学院",20:"计划财经处",21:"机器人科学与工程学院",22:"计算机科学与工程学院",23:"计算中心",24:"纪委",25:"机械工程与自动化学院",26:"继续教育学院",27:"科技产业集团",28:"科学技术研究院",29:"理学院",30:"马克思主义学院",31:"民族教育学院",33:"人事处",34:"人文选修课群",35:"软件学院",36:"生命科学与健康学院",37:"体育部",38:"体育场馆管理中心",39:"团委",40:"图书馆",41:"外国语学院",42:"外联处",43:"网络教育学院",44:"未来技术学院",45:"文法学院",46:"校长办公室",47:"信息科学与工程学院",48:"新知识课群",49:"学生处",50:"学生创新中心",51:"学生指导服务中心",52:"研究生院",53:"冶金学院",54:"艺术学院",55:"医学与生物信息工程学院",56:"医院",57:"资产与实验室管理处",58:"资源与土木工程学院"};return t[e]||"未知院系"}}};const lt=(0,m.A)(ct,[["render",rt],["__scopeId","data-v-dc11a4fe"]]);var ut=lt;const dt={class:"chat-page"},ht={class:"sidebar"},mt={class:"header"},gt={class:"status-text"},pt={key:0,class:"no-conversations"},kt=["onClick"],Ct={class:"conversation-name"},vt={key:0,class:"new-message-label"},ft={class:"conversation-updated-at"},bt={class:"conversation-last-message"},yt={class:"chat-container"},Lt={class:"conversation-info"},_t={class:"message-bubble"},wt={key:0},Et={class:"input-container"};function xt(e,t,o,s,n,i){const r=(0,a.g2)("el-scrollbar"),c=(0,a.g2)("el-button"),l=(0,a.g2)("el-input"),u=(0,a.g2)("el-tooltip"),d=(0,a.g2)("CourseDetailModal");return(0,a.uX)(),(0,a.CE)("div",dt,[(0,a.Lk)("div",ht,[(0,a.Lk)("h3",mt,[t[2]||(t[2]=(0,a.eW)(" 会话列表 ")),(0,a.Lk)("span",{class:(0,y.C4)(["connection-status",{connected:n.isConnected,disconnected:!n.isConnected}])},[(0,a.Lk)("span",{class:(0,y.C4)(["status-indicator",{connected:n.isConnected,disconnected:!n.isConnected}])},null,2),(0,a.Lk)("span",gt,(0,y.v_)(n.isConnected?"即时聊天已连接":"即时聊天已断开,正在重新连接..."),1)],2)]),(0,a.bF)(r,null,{default:(0,a.k6)((()=>[0===n.conversations.length?((0,a.uX)(),(0,a.CE)("div",pt," 还没有会话,快去通过评论发起聊天吧! ")):((0,a.uX)(!0),(0,a.CE)(a.FK,{key:1},(0,a.pI)(n.conversations,(e=>((0,a.uX)(),(0,a.CE)("div",{key:e.conversation_id,class:(0,y.C4)(["conversation-item",e.conversation_id===n.activeConversation?"active":""]),onClick:t=>i.selectConversation(e.conversation_id)},[(0,a.Lk)("div",Ct,[(0,a.eW)((0,y.v_)(e.course_name)+" ",1),(0,a.Lk)("span",{class:(0,y.C4)(["role-label",{owner:"owner"===e.role,member:"member"===e.role}])},(0,y.v_)("owner"===e.role?"我发起的":"我收到的"),3),e.is_read?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)("span",vt,"新消息"))]),(0,a.Lk)("small",ft,"更新时间: "+(0,y.v_)(i.formatDate(e.updated_at)),1),t[3]||(t[3]=(0,a.Lk)("br",null,null,-1)),(0,a.Lk)("small",bt,(0,y.v_)(e.latest_sender?"我:":"对方:")+(0,y.v_)(e.content||"还没有消息哦,快去通过某条课程评论发起聊天吧!"),1)],10,kt)))),128))])),_:1})]),(0,a.Lk)("div",yt,[(0,a.Lk)("div",Lt,[(0,a.Lk)("span",null,(0,y.v_)(null!==n.rating?"该用户对课程评分为 "+n.rating.toFixed(1):"该用户暂未对课程进行评分"),1),(0,a.bF)(c,{onClick:t[0]||(t[0]=e=>i.loadCourseDetail(n.selectedCourseId))},{default:(0,a.k6)((()=>t[4]||(t[4]=[(0,a.eW)("查看课程")]))),_:1})]),(0,a.bF)(r,{ref:"messageScrollbar",class:"message-list"},{default:(0,a.k6)((()=>[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(n.messages,((e,t)=>((0,a.uX)(),(0,a.CE)("div",{key:t,class:(0,y.C4)(["message",1===e.sender?"self":"other"])},[(0,a.Lk)("div",_t,[(0,a.Lk)("span",null,(0,y.v_)(e.content),1),(0,a.Lk)("div",{class:(0,y.C4)(["message-info",1===e.sender?"align-right":"align-left"])},[(0,a.Lk)("small",null,(0,y.v_)(i.formatDate(e.created_at)),1),1===e.sender?((0,a.uX)(),(0,a.CE)("small",wt,(0,y.v_)(e.is_read?"已读":"未读"),1)):(0,a.Q3)("",!0)],2)])],2)))),128))])),_:1},512),(0,a.Lk)("div",Et,[(0,a.bF)(l,{modelValue:n.newMessage,"onUpdate:modelValue":t[1]||(t[1]=e=>n.newMessage=e),type:"textarea",rows:"2",placeholder:"请输入您的消息,按Enter换行,Ctrl+Enter发送。",class:"locked-input",onKeydown:i.handleKeyDown},null,8,["modelValue","onKeydown"]),(0,a.bF)(u,{content:"Ctrl + Enter",placement:"top"},{default:(0,a.k6)((()=>[(0,a.bF)(c,{onClick:i.sendMessage,type:"primary"},{default:(0,a.k6)((()=>t[5]||(t[5]=[(0,a.eW)("发送")]))),_:1},8,["onClick"])])),_:1})])]),(0,a.bF)(d,{isVisible:n.showDetail,course:n.selectedCourse,onClose:i.closeCourseDetail},null,8,["isVisible","course","onClose"])])}var Pt=o(4373),St={components:{CourseDetailModal:ve},data(){return{userId:"",activeConversation:null,conversations:[],messages:[],newMessage:"",socket:null,rating:null,selectedCourse:null,selectedCourseId:0,showDetail:!1,isConnected:!1}},async activated(){await this.fetchConversations(),this.activeConversation&&await this.selectConversation(this.activeConversation)},async mounted(){try{const e=this.getCookie("token");if(!e)throw new Error("JWT not found in cookies");const t=JSON.parse(atob(e.split(".")[1]));this.userId=t.id,await this.fetchConversations(),this.checkAndSwitchConversation(),this.initializeWebSocket()}catch(e){console.error("Failed to initialize chat page:",e.message)}},beforeUnmount(){this.socket&&this.socket.close()},methods:{async fetchConversations(){try{const e=await Pt.A.get("/chat/conversations",{headers:{Authorization:this.getCookie("token")}});this.conversations=[...e.data.conversations]}catch(e){console.error("Failed to fetch conversations:",e)}},formatDate(e){const t=new Date(e);return t.toLocaleString()},async loadCourseDetail(e){try{const t=await fetch(`https://coursesystem.xn--xhq44jb2fzpc.com/course-detail?course_id=${e}`),o=await t.json();this.selectedCourse=o,this.showDetail=!0}catch(t){console.error("Error loading course details:",t)}},closeCourseDetail(){this.showDetail=!1,this.selectedCourse=null},initializeWebSocket(){const e=this.getCookie("token");if(!e)return void console.error("WebSocket initialization failed: No token found");const t=`${"https:"===window.location.protocol?"wss://coursesystem.xn--xhq44jb2fzpc.com":"ws://49.232.202.164:8080"}/chat?token=${e}`;console.log(`Attempting to connect to WebSocket at: ${t}`),this.socket=new WebSocket(t),this.socket.onopen=()=>{this.isConnected=!0,console.log("WebSocket connected")},this.socket.onmessage=async e=>{try{const t=JSON.parse(e.data);switch(console.log("Received WebSocket message:",t),t.type){case"new_conversation":await this.fetchConversations(),t.conversation_id===this.activeConversation&&await this.selectConversation(t.conversation_id);break;case"new_message":await this.fetchConversations(),t.conversation_id===this.activeConversation&&await this.selectConversation(t.conversation_id);break;case"message_read":if(t.conversation_id===this.activeConversation){const e=this.messages.findIndex((e=>e.message_id===t.message_id&&1===e.sender));-1!==e&&this.$set(this.messages[e],"is_read",!0)}break;case"conversation_read":t.conversation_id===this.activeConversation&&this.messages.forEach((e=>{1===e.sender&&t.message_ids.includes(e.message_id)&&(e.is_read=!0)}));break;default:console.warn(`Unknown WebSocket message type: ${t.type}`)}}catch(t){console.error("Error processing WebSocket message:",t)}},this.socket.onclose=e=>{this.isConnected=!1,console.warn(`WebSocket disconnected: Code ${e.code}, Reason: ${e.reason}`),this.reconnectWebSocket()},this.socket.onerror=e=>{console.error("WebSocket error:",e)}},reconnectWebSocket(){console.warn("Attempting to reconnect WebSocket..."),setTimeout((async()=>{try{this.initializeWebSocket();const e=new Promise(((e,t)=>{const o=setInterval((()=>{this.socket&&this.socket.readyState===WebSocket.OPEN&&(clearInterval(o),e())}),500);setTimeout((()=>{clearInterval(o),t(new Error("WebSocket reconnect timeout"))}),1e4)}));await e,this.isConnected=!0,console.log("WebSocket reconnected successfully"),await this.fetchConversations(),this.activeConversation&&await this.selectConversation(this.activeConversation)}catch(e){console.error("Failed to reconnect WebSocket:",e)}}),5e3)},async selectConversation(e){this.activeConversation=e;try{const t=this.conversations.find((t=>t.conversation_id===e));if(!t)throw new Error("Conversation not found");this.selectedCourseId=t.course_id;const o=await Pt.A.get("/chat/conversation-messages",{params:{conversation_id:e,course_name:t.course_name},headers:{Authorization:this.getCookie("token")}});this.messages=[...o.data.messages],this.rating=o.data.rating||null,this.$nextTick((()=>{this.scrollToBottom()})),await this.markMessagesAsRead()}catch(t){console.error("Failed to fetch conversation messages:",t)}},async markMessagesAsRead(){try{await Pt.A.post("/chat/read-conversation",{conversation_id:this.activeConversation},{headers:{Authorization:this.getCookie("token")}}),this.messages.forEach((e=>{0!==e.sender||e.is_read||(e.is_read=!0)}))}catch(e){console.error("Failed to mark messages as read:",e)}},async sendMessage(){if(!this.newMessage.trim())return;const e=this.newMessage;this.newMessage="";try{const t=await Pt.A.post("/chat/send-message",{conversation_id:this.activeConversation,content:e},{headers:{Authorization:this.getCookie("token")}});this.messages.push({message_id:t.data.message_id,content:e,sender:1,created_at:(new Date).toISOString(),is_read:!1}),this.$nextTick((()=>{this.scrollToBottom()})),await this.markMessagesAsRead(),await this.fetchConversations()}catch(t){console.error("Failed to send message:",t)}},scrollToBottom(){setTimeout((()=>{const e=this.$refs.messageScrollbar;if(e){const t=e.$el.querySelector(".el-scrollbar__wrap");t&&(t.scrollTop=t.scrollHeight)}}),50)},handleKeyDown(e){e.ctrlKey&&"Enter"===e.key&&this.sendMessage()},getCookie(e){const t=document.cookie.split("; ");for(let o=0;oe.conversation_id===t));o?await this.selectConversation(t):console.warn("Conversation not found for ID:",t)}}};const Tt=(0,m.A)(St,[["render",xt],["__scopeId","data-v-0f09629d"]]);var Mt=Tt;const Wt=[{path:"/",name:"home",meta:{title:"NEU小站课程评分系统 - v1.0.2测试版"},component:S},{path:"/courses",name:"course-list",meta:{title:"我的课程 - NEU小站课程评分系统 - v1.0.2测试版"},component:ye},{path:"/rating",name:"rating",meta:{title:"选修课列表 - NEU小站课程评分系统 - v1.0.2测试版"},component:ze},{path:"/ratingforcomp",name:"ratingforcomp",meta:{title:"必修课列表 - NEU小站课程评分系统 - v1.0.2测试版"},component:ut},{path:"/chat",name:"chat",meta:{title:"我的聊天 - NEU小站课程评分系统 - v1.0.2测试版"},component:Mt}],jt=(0,b.aE)({history:(0,b.LA)(),routes:Wt});jt.beforeEach(((e,t,o)=>{document.title=e.meta.title||"默认标题",o()}));var $t=jt;const Dt=(0,s.Ef)(v);Dt.use($t),Dt.use(f.A),Dt.mount("#app"),Pt.A.defaults.baseURL="https://coursesystem.xn--xhq44jb2fzpc.com/",Dt.config.globalProperties.$axios=Pt.A}},t={};function o(s){var a=t[s];if(void 0!==a)return a.exports;var n=t[s]={exports:{}};return e[s].call(n.exports,n,n.exports,o),n.exports}o.m=e,function(){var e=[];o.O=function(t,s,a,n){if(!s){var i=1/0;for(u=0;u=n)&&Object.keys(o.O).every((function(e){return o.O[e](s[c])}))?s.splice(c--,1):(r=!1,n0&&e[u-1][2]>n;u--)e[u]=e[u-1];e[u]=[s,a,n]}}(),function(){o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,{a:t}),t}}(),function(){o.d=function(e,t){for(var s in t)o.o(t,s)&&!o.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})}}(),function(){o.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()}(),function(){o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}}(),function(){var e={524:0};o.O.j=function(t){return 0===e[t]};var t=function(t,s){var a,n,i=s[0],r=s[1],c=s[2],l=0;if(i.some((function(t){return 0!==e[t]}))){for(a in r)o.o(r,a)&&(o.m[a]=r[a]);if(c)var u=c(o)}for(t&&t(s);l