import{a as m,aB as v,r as w,f as o,aj as n,c,o as r,b as h,J as x,K as l,S as k,P as y}from"./vue.D1BjjNmv.js";import{E as i}from"./index.CL7yl-Wb.js";import{_ as b}from"./_plugin-vue_export-helper.DlAUqK2U.js";const C={class:"contract-preview"},B={class:"preview-content"},E=["src"],U=m({__name:"preview",setup(g){const p=v();w(!0);const t=o(()=>p.query.file),u=o(()=>{var e;return t.value&&((e=t.value.split(".").pop())==null?void 0:e.toLowerCase())||""}),s=o(()=>{if(!t.value)return"";const e=encodeURIComponent(t.value);switch(u.value){case"pdf":return t.value;case"doc":case"docx":return`https://view.officeapps.live.com/op/embed.aspx?src=${e}`;default:return i.warning("不支持的文件类型，将尝试直接预览"),t.value}}),d=()=>{const e=t.value;e?window.open(e,"_blank"):i.error("文件地址无效")};return(e,a)=>{const _=n("el-button"),f=n("el-empty");return r(),c("div",C,[h("div",B,[s.value?(r(),c("iframe",{key:0,src:s.value,class:"preview-iframe",frameborder:"0",width:"100%",height:"100%"},null,8,E)):(r(),x(f,{key:1,description:"文件地址无效"},{default:l(()=>[k(_,{type:"primary",onClick:d},{default:l(()=>a[0]||(a[0]=[y("下载文档")])),_:1})]),_:1}))])])}}}),R=b(U,[["__scopeId","data-v-399ce588"]]);export{R as default};
