guest-reception-system/dist_rootowned_old/js/TeacherMine.DtwnBQU9.js

2 lines
5.4 KiB
JavaScript

import{_ as S}from"./logo.C0Q7FAT1.js";import{_ as j}from"./right-arrow.Ca_LZHAz.js";import{d as O,a1 as T,o as c,p as d,q as t,E as m,A as B,O as F,D as W,b as v,w as x,u as _,B as w,r as u,Q as b,s as r,z as q,Y as z,G as h,a2 as N,a3 as Z}from"./.pnpm.CF2hm8if.js";import{_ as A}from"./index.Bg6AlVg6.js";const G={class:"teacher-mine box-border min-h-full bg-[#F5F5F5] px-15 pt-15"},H={class:"relative overflow-hidden rounded-12 bg-[linear-gradient(135deg,#e8f1ff_0%,#f5f8ff_100%)] px-18 py-20"},Q={class:"relative flex items-center gap-12"},U={class:"min-w-0 flex-1"},V={class:"truncate text-[4.5rem] font-500 leading-none text-[#000]"},Y={class:"mt-10 truncate text-[3rem] leading-none text-[#999]"},$={class:"mt-12 overflow-hidden rounded-12 bg-white p-15"},J={class:"mt-20 flex items-stretch"},K={class:"din-bold text-[6rem] font-700 leading-none text-[#000]"},X={class:"mt-4 text-[3.25rem] leading-none text-[#666]"},ee={class:"mt-12 overflow-hidden rounded-12 bg-white p-15"},te={class:"mt-20 flex justify-center"},ne={class:"flex h-156 w-156 items-center justify-center"},se=["src"],y="https://example.com/invite?ref=teacher",oe=200,ae=40,ie="/images/logo.png",re=O({__name:"TeacherMine",setup(le){const k=q(),g=u("王刚"),C=u("深泉外国语学校招生老师"),E=u([{label:"已邀约",value:256},{label:"已到访",value:174},{label:"已缴费",value:32}]),i=u(""),I=o=>new Promise((e,n)=>{const s=new Image;s.crossOrigin="anonymous",s.onload=()=>e(s),s.onerror=n,s.src=o}),L=async(o,e)=>{const n=await I(o),s=document.createElement("canvas");s.width=e,s.height=e;const a=s.getContext("2d");if(!a)throw new Error("2D context unavailable");a.beginPath(),a.arc(e/2,e/2,e/2,0,Math.PI*2),a.closePath(),a.clip();const l=Math.max(e/n.width,e/n.height),p=n.width*l,f=n.height*l;return a.drawImage(n,(e-p)/2,(e-f)/2,p,f),s.toDataURL("image/png")},R=async()=>{const o=Math.min(Math.max(Math.round(window.devicePixelRatio||1),1),3),e=oe*o,n=ae*o,s={text:y,width:e,height:e,correctLevel:b.CorrectLevel.H,quietZone:0,onRenderingEnd:(a,l)=>{i.value=l}};try{const a=await L(ie,n);Object.assign(s,{logo:a,logoWidth:n,logoHeight:n,logoBackgroundTransparent:!0})}catch{}try{new b(document.createElement("div"),s)}catch{i.value="",r("邀约码生成失败")}},D=()=>{k.push({name:"teacher-invitation-data"})},M=async()=>{if(!h.isWeCom){r("请在企业微信中打开后分享给家长");return}try{await N({title:`${g.value}老师邀请您参观`,desc:"点击填写学生信息,预约到校参观",link:y,imgUrl:`${window.location.origin}/images/logo.png`})}catch{r("请点击右上角菜单分享给家长")}},P=async()=>{if(!i.value){r("邀约码尚未生成");return}if(h.isWeCom||h.isWeChat){try{await Z({current:i.value,urls:[i.value]})}catch{r("请长按二维码保存到相册")}return}const o=document.createElement("a");o.href=i.value,o.download="invitation-qrcode.png",o.click()};return T(R),(o,e)=>(c(),d("main",G,[t("section",H,[e[1]||(e[1]=t("div",{class:"teacher-mine__watermark pointer-events-none absolute right-0 top-0 h-60 w-210","aria-hidden":"true"},null,-1)),t("div",Q,[e[0]||(e[0]=t("img",{class:"h-[12rem] w-[12rem] shrink-0 rounded-full bg-white object-cover",src:S,alt:"学校头像"},null,-1)),t("div",U,[t("p",V,m(g.value)+"老师,辛苦了",1),t("p",Y,m(C.value),1)])])]),t("section",$,[t("div",{class:"flex items-center"},[e[3]||(e[3]=t("img",{src:"https://lw-zk.oss-cn-hangzhou.aliyuncs.com/inviteReception/icon_yaoyueshuju.png",class:"h-16 w-16 shrink-0 rounded-4","aria-hidden":"true"},null,-1)),e[4]||(e[4]=t("h2",{class:"ml-8 flex-1 text-[4.25rem] font-600 leading-none text-[#000]"},"邀约数据",-1)),t("button",{class:"flex items-center gap-5 border-0 bg-transparent p-0 text-[3.25rem] leading-none text-[#666]",type:"button",onClick:D},[...e[2]||(e[2]=[t("span",null,"详情",-1),t("img",{class:"h-14 w-7",src:j,alt:"","aria-hidden":"true"},null,-1)])])]),t("div",J,[(c(!0),d(B,null,F(E.value,(n,s)=>(c(),d("div",{key:n.label,class:z(["flex flex-1 flex-col items-center",{"border-l border-solid border-[#EEF0F2]":s>0}])},[t("span",K,m(n.value),1),t("span",X,m(n.label),1)],2))),128))])]),t("section",ee,[e[7]||(e[7]=t("div",{class:"flex items-center"},[t("img",{src:"https://lw-zk.oss-cn-hangzhou.aliyuncs.com/inviteReception/icon_erweima.png",class:"h-16 w-16 shrink-0 rounded-4","aria-hidden":"true"}),t("h2",{class:"ml-8 flex-1 text-[4.25rem] font-600 leading-none text-[#000]"},"我的邀约码")],-1)),t("div",te,[t("div",ne,[i.value?(c(),d("img",{key:0,class:"block h-156 w-156",src:i.value,alt:"我的邀约二维码"},null,8,se)):W("",!0)])]),v(_(w),{class:"teacher-mine__button mt-15!",block:"",type:"primary",onClick:M},{default:x(()=>[...e[5]||(e[5]=[t("span",{class:"flex items-center justify-center gap-5"},[t("img",{src:"https://lw-zk.oss-cn-hangzhou.aliyuncs.com/inviteReception/icon_weixin.png",alt:"",class:"w-16 h-16"}),t("span",{class:"text-[3.75rem] font-500"},"分享给家长")],-1)])]),_:1}),v(_(w),{class:"teacher-mine__button mt-15!",block:"",plain:"",type:"primary",onClick:P},{default:x(()=>[...e[6]||(e[6]=[t("span",{class:"flex items-center justify-center gap-8"},[t("img",{src:"https://lw-zk.oss-cn-hangzhou.aliyuncs.com/inviteReception/icon_baocun.png",alt:"",class:"w-16 h-16"}),t("span",{class:"text-[3.75rem]"},"保存图片")],-1)])]),_:1}),e[8]||(e[8]=t("p",{class:"m-0 mt-12 text-center text-[3rem] leading-none text-[#c9cdd4]"},"扫码提交的邀约将计入你的数据",-1))])]))}}),he=A(re,[["__scopeId","data-v-2c45dfd0"]]);export{he as default};