var b=(e,a,d)=>new Promise((y,u)=>{var n=c=>{try{o(d.next(c))}catch(h){u(h)}},t=c=>{try{o(d.throw(c))}catch(h){u(h)}},o=c=>c.done?y(c.value):Promise.resolve(c.value).then(n,t);o((d=d.apply(e,a)).next())});import{_ as N,c as f,w as r,ar as M,P as x,f as C,C as T,D,E as I,o as l,k as s,j as B,L as k,Q as m,q as E,p as i,M as v,N as g,t as _,i as V}from"./index-CZJgrp0v.js";import{g as j}from"./grade.rBF1MO5i.js";const z={name:"ScanResult",data(){return{loading:!0,errorMsg:"",info:{},isCopied:!1,copyTimer:null,recordId:""}},computed:{parsedQr(){var a;const e=(a=this.info)==null?void 0:a.qrContent;if(!e)return{};if(typeof e=="object")return e;try{return JSON.parse(e)||{}}catch(d){return{}}},certNumber(){var e;return this.parsedQr.certNumber||((e=this.info)==null?void 0:e.certificateUrl)||""},rows(){const e=this.parsedQr||{},a=[];return e.eventName&&a.push({label:"赛事名称",value:e.eventName}),e.eventGroup&&a.push({label:"项目与组别",value:e.eventGroup}),e.unitName&&a.push({label:"单位与姓名",value:e.unitName}),e.participantName&&a.push({label:"参赛者姓名",value:e.participantName}),e.awardName&&a.push({label:"奖项名称",value:e.awardName}),e.referee&&a.push({label:"裁判长",value:e.referee}),a}},onLoad(e){this.recordId=e.eventGradeRecordId||e.id||"",this.fetchData()},onUnload(){this.copyTimer&&clearTimeout(this.copyTimer)},methods:{fetchData(){return b(this,null,function*(){if(!this.recordId){this.loading=!1,this.errorMsg="未找到证书（缺少查询参数）";return}this.loading=!0,this.errorMsg="";try{const e=yield j(this.recordId);e.code===0?this.info=e.data||{}:e.code===404?this.errorMsg="未找到证书":e.code===500?this.errorMsg="服务器错误，请稍后再试":this.errorMsg=e.msg||"查询失败，请稍后再试"}catch(e){this.errorMsg="网络连接异常"}finally{this.loading=!1}})},retry(){this.fetchData()},mapText(e,a){return e[a]||a},copyNumber(){this.certNumber&&M({data:String(this.certNumber),success:()=>{this.isCopied=!0,this.copyTimer&&clearTimeout(this.copyTimer),this.copyTimer=setTimeout(()=>{this.isCopied=!1},2e3)},fail:()=>{x({title:"复制失败",icon:"none"})}})}}};function F(e,a,d,y,u,n){const t=B,o=E,c=T(I("uv-icon"),D),h=C("layout-default-uni");return l(),f(h,null,{default:r(()=>[s(t,{class:"scan-result-page"},{default:r(()=>[s(t,{class:"header-background"},{default:r(()=>[s(t,{class:"header-deco deco-1"}),s(t,{class:"header-deco deco-2"}),s(t,{class:"header-content"},{default:r(()=>[s(t,{class:"cert-icon"},{default:r(()=>[(l(),k("svg",{viewBox:"0 0 48 48",width:"40",height:"40",xmlns:"http://www.w3.org/2000/svg"},[m("path",{d:"M12 6h20l8 8v28a2 2 0 0 1-2 2H12a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",fill:"rgba(255,255,255,0.15)",stroke:"#ffffff","stroke-width":"2","stroke-linejoin":"round"}),m("path",{d:"M32 6v8h8",fill:"none",stroke:"#ffffff","stroke-width":"2","stroke-linejoin":"round"}),m("path",{d:"M17 24h14M17 30h14M17 36h9",stroke:"#ffffff","stroke-width":"2","stroke-linecap":"round"}),m("circle",{cx:"34",cy:"34",r:"5",fill:"#FFD54F",stroke:"#ffffff","stroke-width":"1.5"}),m("path",{d:"M34 31.5l1.2 2.4 2.6.4-1.9 1.8.5 2.6-2.4-1.3-2.4 1.3.5-2.6-1.9-1.8 2.6-.4z",fill:"#fff"})]))]),_:1}),s(o,{class:"header-title"},{default:r(()=>[i("证书查询结果")]),_:1})]),_:1})]),_:1}),s(t,{class:"content"},{default:r(()=>[u.loading?(l(),f(t,{key:0,class:"skeleton"},{default:r(()=>[s(t,{class:"sk-block sk-title"}),(l(),k(v,null,g(5,p=>s(t,{key:p,class:"sk-line-row"},{default:r(()=>[s(t,{class:"sk-line sk-label"}),s(t,{class:"sk-line sk-value"})]),_:2},1024)),64)),s(t,{class:"sk-block sk-cert"})]),_:1})):u.errorMsg?(l(),f(t,{key:1,class:"error-state"},{default:r(()=>[s(c,{name:"info-circle-fill",color:"#E54D42",size:"56"}),s(o,{class:"error-text"},{default:r(()=>[i(_(u.errorMsg),1)]),_:1}),s(t,{class:"retry-btn",onClick:n.retry},{default:r(()=>[i("重新查询")]),_:1},8,["onClick"])]),_:1})):!n.certNumber&&n.rows.length===0?(l(),f(t,{key:2,class:"error-state"},{default:r(()=>[s(c,{name:"empty",color:"#9aa7b8",size:"56"}),s(o,{class:"error-text"},{default:r(()=>[i("未找到证书信息")]),_:1})]),_:1})):(l(),f(t,{key:3,class:"info-card"},{default:r(()=>[(l(!0),k(v,null,g(n.rows,(p,w)=>(l(),f(t,{key:w,class:"info-row"},{default:r(()=>[s(o,{class:"info-label"},{default:r(()=>[i(_(p.label),1)]),_:2},1024),s(o,{class:"info-value"},{default:r(()=>[i(_(p.value),1)]),_:2},1024)]),_:2},1024))),128)),n.certNumber?(l(),f(t,{key:0,class:"cert-number-block","hover-class":"cert-number-hover",onClick:n.copyNumber},{default:r(()=>[s(o,{class:"cert-number-label"},{default:r(()=>[i("证书编号")]),_:1}),s(o,{class:"cert-number-value"},{default:r(()=>[i(_(n.certNumber),1)]),_:1}),u.isCopied?(l(),f(t,{key:0,class:"copy-success"},{default:r(()=>[i("已复制")]),_:1})):(l(),f(t,{key:1,class:"copy-tip"},{default:r(()=>[i("点击复制")]),_:1}))]),_:1},8,["onClick"])):V("",!0)]),_:1}))]),_:1})]),_:1})]),_:1})}const q=N(z,[["render",F],["__scopeId","data-v-5f7d24bc"]]);export{q as default};
