"use strict";(self["webpackChunknewfront"]=self["webpackChunknewfront"]||[]).push([[552],{1552:function(t,e,a){a.r(e),a.d(e,{default:function(){return Q}});var s=a(6768),i=a(4232),o=a(5130);const n={class:"advice-page"},l={class:"container"},r={class:"tabs-container"},c={class:"tabs"},d={class:"content-area"},p={key:0,class:"card form-card"},u={class:"form-group"},h={class:"type-selector"},m={class:"type-description"},g={class:"form-group"},b={class:"form-label-row"},k={class:"input-mode-switch"},v={class:"form-actions"},f=["disabled"],L={key:1,class:"card list-card"},y={key:0,class:"loading-state"},C={key:1,class:"empty-state"},w={key:2,class:"advice-list"},T={class:"item-header"},x={class:"header-left"},E={class:"time"},A={class:"item-content"},U={key:0,class:"item-reply"},X={class:"reply-content"},z={key:3,class:"pagination"},P=["disabled"],_={class:"page-info"},M=["disabled"];function S(t,e,a,S,$,j){const B=(0,s.g2)("NavBar"),I=(0,s.g2)("MdEditor");return(0,s.uX)(),(0,s.CE)("div",n,[(0,s.bF)(B),(0,s.Lk)("div",l,[e[20]||(e[20]=(0,s.Lk)("div",{class:"header-section"},[(0,s.Lk)("h1",null,"建议与反馈"),(0,s.Lk)("p",{class:"subtitle"},"您的每一条建议都是我们进步的动力"),(0,s.Lk)("div",{class:"notice-box"},[(0,s.Lk)("span",{class:"notice-icon-circle"},"!"),(0,s.eW)(" 收到反馈后,我们将第一时间通过邮件告知您处理结果,请留意您的邮箱 ")])],-1)),(0,s.Lk)("div",r,[(0,s.Lk)("div",c,[(0,s.Lk)("div",{class:(0,i.C4)(["tab-item",{active:"add"===$.activeTab}]),onClick:e[0]||(e[0]=t=>$.activeTab="add")}," 我要提建议 ",2),(0,s.Lk)("div",{class:(0,i.C4)(["tab-item",{active:"list"===$.activeTab}]),onClick:e[1]||(e[1]=t=>j.switchTab("list"))}," 我提的建议 ",2)])]),(0,s.Lk)("div",d,["add"===$.activeTab?((0,s.uX)(),(0,s.CE)("div",p,[(0,s.Lk)("div",u,[e[14]||(e[14]=(0,s.Lk)("div",{class:"form-label-row"},[(0,s.Lk)("label",{class:"form-label"},"建议类型")],-1)),(0,s.Lk)("div",h,[(0,s.Lk)("label",{class:(0,i.C4)(["radio-label",{checked:0===$.form.type}])},[(0,s.bo)((0,s.Lk)("input",{type:"radio","onUpdate:modelValue":e[2]||(e[2]=t=>$.form.type=t),value:0},null,512),[[o.XL,$.form.type,void 0,{number:!0}]]),e[12]||(e[12]=(0,s.Lk)("span",{class:"radio-text"},"💡 功能建议",-1))],2),(0,s.Lk)("label",{class:(0,i.C4)(["radio-label",{checked:1===$.form.type}])},[(0,s.bo)((0,s.Lk)("input",{type:"radio","onUpdate:modelValue":e[3]||(e[3]=t=>$.form.type=t),value:1},null,512),[[o.XL,$.form.type,void 0,{number:!0}]]),e[13]||(e[13]=(0,s.Lk)("span",{class:"radio-text"},"🐛 BUG反馈",-1))],2)]),(0,s.Lk)("div",m,(0,i.v_)(0===$.form.type?"您希望开发新功能,或对现有功能有建议":"您发现了网站的BUG或缺陷"),1)]),(0,s.Lk)("div",g,[(0,s.Lk)("div",b,[e[16]||(e[16]=(0,s.Lk)("label",{class:"form-label"},"详细描述",-1)),(0,s.Lk)("div",k,[(0,s.Lk)("span",{class:(0,i.C4)(["mode-item",{active:"text"===$.inputType}]),onClick:e[4]||(e[4]=t=>$.inputType="text")}," 纯文本 ",2),e[15]||(e[15]=(0,s.Lk)("span",{class:"mode-divider"},"|",-1)),(0,s.Lk)("span",{class:(0,i.C4)(["mode-item",{active:"markdown"===$.inputType}]),onClick:e[5]||(e[5]=t=>$.inputType="markdown")}," 图文 ",2)])]),"text"===$.inputType?(0,s.bo)(((0,s.uX)(),(0,s.CE)("textarea",{key:0,"onUpdate:modelValue":e[6]||(e[6]=t=>$.form.content=t),class:"form-textarea",rows:"12",placeholder:"请详细描述您的建议..."},null,512)),[[o.Jo,$.form.content]]):((0,s.uX)(),(0,s.Wv)(I,{key:1,modelValue:$.form.content,"onUpdate:modelValue":e[7]||(e[7]=t=>$.form.content=t),theme:$.editorTheme,toolbars:$.editorToolbars,language:"zh-CN","preview-theme":"github",placeholder:$.editorPlaceholder,onOnUploadImg:j.handleImageUpload,style:{height:"400px"}},null,8,["modelValue","theme","toolbars","placeholder","onOnUploadImg"]))]),(0,s.Lk)("div",v,[(0,s.Lk)("button",{class:"btn-submit",onClick:e[8]||(e[8]=(...t)=>j.handleSubmit&&j.handleSubmit(...t)),disabled:$.submitting},(0,i.v_)($.submitting?"提交中...":"提交反馈"),9,f)])])):(0,s.Q3)("",!0),"list"===$.activeTab?((0,s.uX)(),(0,s.CE)("div",L,[$.loading?((0,s.uX)(),(0,s.CE)("div",y,e[17]||(e[17]=[(0,s.Lk)("div",{class:"spinner"},null,-1),(0,s.Lk)("p",null,"加载中...",-1)]))):0===$.list.length?((0,s.uX)(),(0,s.CE)("div",C,[e[18]||(e[18]=(0,s.Lk)("p",null,"暂无反馈记录",-1)),(0,s.Lk)("button",{class:"btn-link",onClick:e[9]||(e[9]=t=>$.activeTab="add")},"去提一条建议")])):((0,s.uX)(),(0,s.CE)("div",w,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)($.list,(t=>((0,s.uX)(),(0,s.CE)("div",{key:t.id,class:"advice-item"},[(0,s.Lk)("div",T,[(0,s.Lk)("div",x,[(0,s.Lk)("span",{class:(0,i.C4)(["badge",1===t.type?"badge-bug":"badge-feature"])},(0,i.v_)(1===t.type?"BUG反馈":"功能建议"),3),(0,s.Lk)("span",{class:(0,i.C4)(["status-badge",j.getStatusClass(t.status)])},(0,i.v_)(j.getStatusText(t.status)),3)]),(0,s.Lk)("span",E,(0,i.v_)(j.formatDate(t.created_at)),1)]),(0,s.Lk)("div",A,(0,i.v_)(t.content),1),t.reply?((0,s.uX)(),(0,s.CE)("div",U,[e[19]||(e[19]=(0,s.Lk)("div",{class:"reply-header"},[(0,s.Lk)("span",{class:"reply-icon"},"💬"),(0,s.Lk)("strong",null,"管理员回复:")],-1)),(0,s.Lk)("div",X,(0,i.v_)(t.reply),1)])):(0,s.Q3)("",!0)])))),128))])),!$.loading&&$.pagination.totalPages>1?((0,s.uX)(),(0,s.CE)("div",z,[(0,s.Lk)("button",{class:"page-btn",disabled:$.pagination.current<=1,onClick:e[10]||(e[10]=t=>j.changePage($.pagination.current-1))}," 上一页 ",8,P),(0,s.Lk)("span",_,(0,i.v_)($.pagination.current)+" / "+(0,i.v_)($.pagination.totalPages),1),(0,s.Lk)("button",{class:"page-btn",disabled:$.pagination.current>=$.pagination.totalPages,onClick:e[11]||(e[11]=t=>j.changePage($.pagination.current+1))}," 下一页 ",8,M)])):(0,s.Q3)("",!0)])):(0,s.Q3)("",!0)])])])}a(8111),a(1701);var $=a(4373),j=a(8704),B=a(4993),I=a(1697),N=a(3577),V={name:"Advice",components:{NavBar:I.A,MdEditor:N.A},mounted(){document.title="建议与反馈 - NEU小站"},data(){return{activeTab:"add",submitting:!1,loading:!1,form:{type:0,content:""},list:[],pagination:{current:1,pageSize:10,total:0,totalPages:0},inputType:"text",editorTheme:"light",editorPlaceholder:"请详细描述您的建议,支持直接把图片粘贴到编辑器中",editorToolbars:["bold","italic","underline","-","title","unorderedList","orderedList","-","image","table","=","revoke","next","-","preview","pageFullscreen","fullscreen"]}},methods:{getToken(){let t=j.A.get("token");if(!t){const e=document.cookie.match(/(^| )token=([^;]+)/);e&&(t=e[2])}return t},switchTab(t){this.activeTab=t,"list"===t&&this.fetchList(1)},async handleImageUpload(t,e){const a=this.getToken();if(a)try{const s=t.map((async t=>{if(t.size>2097152)throw new Error(`图片 ${t.name} 大小不能超过2MB!`);const e=t.name.split(".").pop().toLowerCase(),s=t.type,i=await fetch("https://userlogin.xn--xhq44jb2fzpc.com/submission/prepare-image-upload",{method:"POST",headers:{Authorization:a,"Content-Type":"application/json"},body:JSON.stringify({postfix:e,type:s})});if(!i.ok)throw new Error("准备上传失败");const{uploadUrl:o,path:n}=await i.json(),l=await fetch(o,{method:"PUT",body:t,headers:{"Content-Type":s,Authorization:a}});if(!l.ok)throw new Error(`文件 ${t.name} 上传失败`);return`https://download.xn--xhq44jb2fzpc.com/${n}`})),i=await Promise.all(s);e(i)}catch(s){console.error("图片上传失败:",s),this.$barMessage.error("图片上传失败:"+s.message)}else this.$barMessage.error("请先登录!")},handleSubmit(){this.form.content.trim()?B.A.confirm("确定要提交这条建议吗?","提交确认").then((()=>{this.submitAdvice()})).catch((()=>{})):this.$barMessage.warning("请输入建议内容")},async submitAdvice(){const t=this.getToken();if(t){this.submitting=!0;try{await $.A.post("https://newfront.xn--xhq44jb2fzpc.com/advice/add",this.form,{headers:{Authorization:t}}),this.$barMessage.success("建议提交成功,感谢您的反馈!"),this.form.content="",this.form.type=0,this.activeTab="list",this.fetchList(1)}catch(e){console.error(e);const t=e.response?.data?.error||"提交失败,请稍后重试";this.$barMessage.error(t)}finally{this.submitting=!1}}else this.$barMessage.error("请先登录")},async fetchList(t=1){const e=this.getToken();if(e){this.loading=!0;try{const a=await $.A.get("https://newfront.xn--xhq44jb2fzpc.com/advice/list",{params:{page:t},headers:{Authorization:e}}),{list:s,pagination:i}=a.data;this.list=s,this.pagination=i}catch(a){console.error(a),this.$barMessage.error("获取列表失败")}finally{this.loading=!1}}else this.$barMessage.error("请先登录")},changePage(t){this.fetchList(t)},formatDate(t){if(!t)return"";const e=new Date(t);return e.toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})},getStatusText(t){const e={0:"处理中",1:"已处理",2:"已关闭"};return e[t]||"未知状态"},getStatusClass(t){const e={0:"status-processing",1:"status-done",2:"status-closed"};return e[t]||""}}},q=a(1241);const O=(0,q.A)(V,[["render",S],["__scopeId","data-v-729e2998"]]);var Q=O}}]); //# sourceMappingURL=552.279f1785.js.map