newfront/dist/js/67.7a69b4a6.js
2026-01-05 21:38:01 +08:00

2 lines
11 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";(self["webpackChunknewfront"]=self["webpackChunknewfront"]||[]).push([[67],{9067:function(e,t,a){a.r(t),a.d(t,{default:function(){return G}});var s=a(1411),i=a(2515),o=a(1561);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"},m={class:"type-selector"},h={class:"type-description"},b={class:"form-group"},k={class:"type-selector"},g={key:0,class:"custom-email-input"},v={class:"form-group"},f={class:"form-label-row"},L={class:"input-mode-switch"},y={class:"form-actions"},C=["disabled"],T={key:1,class:"card list-card"},w={key:0,class:"loading-state"},x={key:1,class:"empty-state"},E={key:2,class:"advice-list"},U={class:"item-header"},X={class:"header-left"},A={class:"time"},$={class:"item-content"},z={key:0,class:"item-reply"},O={class:"reply-content"},M={key:3,class:"pagination"},P=["disabled"],S={class:"page-info"},_=["disabled"];function V(e,t,a,V,I,B){const j=(0,s.g2)("NavBar"),q=(0,s.g2)("MdEditor");return(0,s.uX)(),(0,s.CE)("div",n,[(0,s.bF)(j),(0,s.Lk)("div",l,[t[28]||(t[28]=(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"===I.activeTab}]),onClick:t[0]||(t[0]=e=>I.activeTab="add")}," 我要反馈 ",2),(0,s.Lk)("div",{class:(0,i.C4)(["tab-item",{active:"list"===I.activeTab}]),onClick:t[1]||(t[1]=e=>B.switchTab("list"))}," 我的反馈 ",2)])]),(0,s.Lk)("div",d,["add"===I.activeTab?((0,s.uX)(),(0,s.CE)("div",p,[(0,s.Lk)("div",u,[t[19]||(t[19]=(0,s.Lk)("div",{class:"form-label-row"},[(0,s.Lk)("label",{class:"form-label"},"反馈类型")],-1)),(0,s.Lk)("div",m,[(0,s.Lk)("label",{class:(0,i.C4)(["radio-label",{checked:0===I.form.type}])},[(0,s.bo)((0,s.Lk)("input",{type:"radio","onUpdate:modelValue":t[2]||(t[2]=e=>I.form.type=e),value:0},null,512),[[o.XL,I.form.type,void 0,{number:!0}]]),t[16]||(t[16]=(0,s.Lk)("span",{class:"radio-text"},"💡 功能建议",-1))],2),(0,s.Lk)("label",{class:(0,i.C4)(["radio-label",{checked:1===I.form.type}])},[(0,s.bo)((0,s.Lk)("input",{type:"radio","onUpdate:modelValue":t[3]||(t[3]=e=>I.form.type=e),value:1},null,512),[[o.XL,I.form.type,void 0,{number:!0}]]),t[17]||(t[17]=(0,s.Lk)("span",{class:"radio-text"},"🐛 BUG反馈",-1))],2),(0,s.Lk)("label",{class:(0,i.C4)(["radio-label",{checked:2===I.form.type}])},[(0,s.bo)((0,s.Lk)("input",{type:"radio","onUpdate:modelValue":t[4]||(t[4]=e=>I.form.type=e),value:2},null,512),[[o.XL,I.form.type,void 0,{number:!0}]]),t[18]||(t[18]=(0,s.Lk)("span",{class:"radio-text"},"❓ 使用问题",-1))],2)]),(0,s.Lk)("div",h,(0,i.v_)(B.getTypeDescription(I.form.type)),1)]),(0,s.Lk)("div",b,[t[22]||(t[22]=(0,s.Lk)("div",{class:"form-label-row"},[(0,s.Lk)("label",{class:"form-label"},"邮箱 (便于我们联系您)")],-1)),(0,s.Lk)("div",k,[(0,s.Lk)("label",{class:(0,i.C4)(["radio-label",{checked:"account"===I.emailOption}])},[(0,s.bo)((0,s.Lk)("input",{type:"radio","onUpdate:modelValue":t[5]||(t[5]=e=>I.emailOption=e),value:"account"},null,512),[[o.XL,I.emailOption]]),t[20]||(t[20]=(0,s.Lk)("span",{class:"radio-text"},"使用账号邮箱",-1))],2),(0,s.Lk)("label",{class:(0,i.C4)(["radio-label",{checked:"custom"===I.emailOption}])},[(0,s.bo)((0,s.Lk)("input",{type:"radio","onUpdate:modelValue":t[6]||(t[6]=e=>I.emailOption=e),value:"custom"},null,512),[[o.XL,I.emailOption]]),t[21]||(t[21]=(0,s.Lk)("span",{class:"radio-text"},"使用其他邮箱",-1))],2)]),"custom"===I.emailOption?((0,s.uX)(),(0,s.CE)("div",g,[(0,s.bo)((0,s.Lk)("input",{type:"text","onUpdate:modelValue":t[7]||(t[7]=e=>I.customEmail=e),class:"form-input",placeholder:"请输入您的邮箱地址,以便我们联系您"},null,512),[[o.Jo,I.customEmail]])])):(0,s.Q3)("",!0)]),(0,s.Lk)("div",v,[(0,s.Lk)("div",f,[t[24]||(t[24]=(0,s.Lk)("label",{class:"form-label"},"详细描述",-1)),(0,s.Lk)("div",L,[(0,s.Lk)("span",{class:(0,i.C4)(["mode-item",{active:"text"===I.inputType}]),onClick:t[8]||(t[8]=e=>I.inputType="text")}," 纯文本 ",2),t[23]||(t[23]=(0,s.Lk)("span",{class:"mode-divider"},"|",-1)),(0,s.Lk)("span",{class:(0,i.C4)(["mode-item",{active:"markdown"===I.inputType}]),onClick:t[9]||(t[9]=e=>I.inputType="markdown")}," 图文 ",2)])]),"text"===I.inputType?(0,s.bo)(((0,s.uX)(),(0,s.CE)("textarea",{key:0,ref:"feedbackInput","onUpdate:modelValue":t[10]||(t[10]=e=>I.form.content=e),class:"form-textarea",rows:"12",placeholder:"请详细描述您的反馈..."},null,512)),[[o.Jo,I.form.content]]):((0,s.uX)(),(0,s.Wv)(q,{key:1,modelValue:I.form.content,"onUpdate:modelValue":t[11]||(t[11]=e=>I.form.content=e),theme:I.editorTheme,toolbars:I.editorToolbars,language:"zh-CN","preview-theme":"github",placeholder:I.editorPlaceholder,onOnUploadImg:B.handleImageUpload,style:{height:"400px"}},null,8,["modelValue","theme","toolbars","placeholder","onOnUploadImg"]))]),(0,s.Lk)("div",y,[(0,s.Lk)("button",{class:"btn-submit",onClick:t[12]||(t[12]=(...e)=>B.handleSubmit&&B.handleSubmit(...e)),disabled:I.submitting},(0,i.v_)(I.submitting?"提交中...":"提交反馈"),9,C)])])):(0,s.Q3)("",!0),"list"===I.activeTab?((0,s.uX)(),(0,s.CE)("div",T,[I.loading?((0,s.uX)(),(0,s.CE)("div",w,t[25]||(t[25]=[(0,s.Lk)("div",{class:"spinner"},null,-1),(0,s.Lk)("p",null,"加载中...",-1)]))):0===I.list.length?((0,s.uX)(),(0,s.CE)("div",x,[t[26]||(t[26]=(0,s.Lk)("p",null,"暂无反馈记录",-1)),(0,s.Lk)("button",{class:"btn-link",onClick:t[13]||(t[13]=e=>I.activeTab="add")},"去提一条反馈")])):((0,s.uX)(),(0,s.CE)("div",E,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(I.list,(e=>((0,s.uX)(),(0,s.CE)("div",{key:e.id,class:"advice-item"},[(0,s.Lk)("div",U,[(0,s.Lk)("div",X,[(0,s.Lk)("span",{class:(0,i.C4)(["badge",B.getBadgeClass(e.type)])},(0,i.v_)(B.getTypeText(e.type)),3),(0,s.Lk)("span",{class:(0,i.C4)(["status-badge",B.getStatusClass(e.status)])},(0,i.v_)(B.getStatusText(e.status)),3)]),(0,s.Lk)("span",A,(0,i.v_)(B.formatDate(e.created_at)),1)]),(0,s.Lk)("div",$,(0,i.v_)(e.content),1),e.reply?((0,s.uX)(),(0,s.CE)("div",z,[t[27]||(t[27]=(0,s.Lk)("div",{class:"reply-header"},[(0,s.Lk)("span",{class:"reply-icon"},"💬"),(0,s.Lk)("strong",null,"管理员回复:")],-1)),(0,s.Lk)("div",O,(0,i.v_)(e.reply),1)])):(0,s.Q3)("",!0)])))),128))])),!I.loading&&I.pagination.totalPages>1?((0,s.uX)(),(0,s.CE)("div",M,[(0,s.Lk)("button",{class:"page-btn",disabled:I.pagination.current<=1,onClick:t[14]||(t[14]=e=>B.changePage(I.pagination.current-1))}," 上一页 ",8,P),(0,s.Lk)("span",S,(0,i.v_)(I.pagination.current)+" / "+(0,i.v_)(I.pagination.totalPages),1),(0,s.Lk)("button",{class:"page-btn",disabled:I.pagination.current>=I.pagination.totalPages,onClick:t[15]||(t[15]=e=>B.changePage(I.pagination.current+1))}," 下一页 ",8,_)])):(0,s.Q3)("",!0)])):(0,s.Q3)("",!0)])])])}a(4600),a(7670);var I=a(2062),B=a(2453),j=a(6707),q=a(8875),N=a(7562),D={name:"Advice",components:{NavBar:q.A,MdEditor:N.A},mounted(){document.title="建议与反馈 - NEU小站","pay"===this.$route.query.spec&&(this.form.type=2,this.form.content="我遇到了赞助支付问题:",this.$nextTick((()=>{const e=this.$refs.feedbackInput;e&&(e.scrollIntoView({behavior:"smooth",block:"center"}),e.focus(),"number"===typeof e.selectionStart&&(e.selectionStart=e.selectionEnd=e.value.length))})))},data(){return{activeTab:"add",submitting:!1,loading:!1,form:{type:0,content:""},emailOption:"account",customEmail:"",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 e=B.A.get("token");if(!e){const t=document.cookie.match(/(^| )token=([^;]+)/);t&&(e=t[2])}return e},switchTab(e){this.activeTab=e,"list"===e&&this.fetchList(1)},async handleImageUpload(e,t){const a=this.getToken();if(a)try{const s=e.map((async e=>{if(e.size>2097152)throw new Error(`图片 ${e.name} 大小不能超过2MB`);const t=e.name.split(".").pop().toLowerCase(),s=e.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:t,type:s})});if(!i.ok)throw new Error("准备上传失败");const{uploadUrl:o,path:n}=await i.json(),l=await fetch(o,{method:"PUT",body:e,headers:{"Content-Type":s,Authorization:a}});if(!l.ok)throw new Error(`文件 ${e.name} 上传失败`);return`https://download.xn--xhq44jb2fzpc.com/${n}`})),i=await Promise.all(s);t(i)}catch(s){console.error("图片上传失败:",s),this.$barMessage.error("图片上传失败:"+s.message)}else this.$barMessage.error("请先登录!")},handleSubmit(){if(this.form.content.trim()){if("custom"===this.emailOption){if(!this.customEmail)return void this.$barMessage.warning("请输入邮箱地址");const e=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;if(!e.test(this.customEmail))return void this.$barMessage.warning("请输入有效的邮箱地址")}j.A.confirm("确定要提交这条反馈吗?","提交确认").then((()=>{this.submitAdvice()})).catch((()=>{}))}else this.$barMessage.warning("请输入反馈内容")},async submitAdvice(){const e=this.getToken();if(e){this.submitting=!0;try{const t={...this.form};"custom"===this.emailOption&&(t.email=this.customEmail),await I.A.post("https://newfront.xn--xhq44jb2fzpc.com/advice/add",t,{headers:{Authorization:e}}),this.$barMessage.success("反馈提交成功,感谢您的反馈!"),this.form.content="",this.form.type=0,this.emailOption="account",this.customEmail="",this.activeTab="list",this.fetchList(1)}catch(t){console.error(t);const e=t.response?.data?.error||"提交失败,请稍后重试";this.$barMessage.error(e)}finally{this.submitting=!1}}else this.$barMessage.error("请先登录")},async fetchList(e=1){const t=this.getToken();if(t){this.loading=!0;try{const a=await I.A.get("https://newfront.xn--xhq44jb2fzpc.com/advice/list",{params:{page:e},headers:{Authorization:t}}),{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(e){this.fetchList(e)},formatDate(e){if(!e)return"";const t=new Date(e);return t.toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})},getStatusText(e){const t={0:"处理中",1:"已处理",2:"已关闭"};return t[e]||"未知状态"},getStatusClass(e){const t={0:"status-processing",1:"status-done",2:"status-closed"};return t[e]||""},getTypeDescription(e){const t={0:"您希望开发新功能,或对现有功能有建议",1:"您发现了网站的BUG或缺陷",2:"您在使用过程中遇到了疑问或困难或针对VIP相关权益有疑惑"};return t[e]||""},getTypeText(e){const t={0:"功能建议",1:"BUG反馈",2:"使用问题"};return t[e]||"未知类型"},getBadgeClass(e){const t={0:"badge-feature",1:"badge-bug",2:"badge-question"};return t[e]||""}}},Q=a(6968);const F=(0,Q.A)(D,[["render",V],["__scopeId","data-v-ec66443a"]]);var G=F}}]);
//# sourceMappingURL=67.7a69b4a6.js.map