import{d as T,R as h,$ as A,f as E,c as s,P as f,F,ag as G,ah as _,r as D,o as l,m as d,bd as L,be as O,b3 as H,q as c,B as N,bf as U,bg as q}from"./index.332c7f08.js";import{s as r,a as V}from"./signin-tips.4edbed1d.js";import{u as M,b as $}from"./index.08e660c8.js";import{C as W}from"./index.324108a5.js";import{F as m}from"./index.1ed6273e.js";import{P as R}from"./index.656e257f.js";import"./index.91135ff9.js";import"./Picker.e56f94bd.js";import"./index.7c580591.js";import"./use-tab-status.9d769af8.js";import"./index.1e2dfe6e.js";import"./index.4aa8e076.js";const j="_wxPopupDialog_1sfd3_1",z="_popupContainer_1sfd3_16",J="_title1_1sfd3_22",K="_popupTips_1sfd3_29";var p={wxPopupDialog:j,popupContainer:z,title1:J,popupTips:K},Q=T({name:"o-wx-tip",props:{show:{type:Boolean,default:!0},title:{type:String,default:"\u6E29\u99A8\u63D0\u793A"},message:{type:String,default:"\u8BF7\u4F7F\u7528\u5FAE\u4FE1\u6253\u5F00"}},setup(a){const u=h(!1);return A(()=>{if(!E().weixin&&a.show){u.value=!0;return}}),()=>s(F,null,[s(f,{show:u.value,"onUpdate:show":i=>u.value=i,round:!0,style:{width:"88%"},closeOnClickOverlay:!1,class:p.wxPopupDialog},{default:()=>[s("div",{class:p.popupContainer},[s("p",{class:p.title1},[a.title]),s("p",{class:p.popupTips},[a.message])])]})])}});const g=[];for(let a=1;a<=40;a++)g.push({text:a+"\u73ED",value:a});var ie=T({name:"pre-register",setup(){const a=M(1e3,{controls:!0});a.pause();const u=G(),i=_(),e=D({loading:!0,orchestraId:i.query.id,code:null,currentGradeList:[{text:"\u4E00\u5E74\u7EA7",value:1},{text:"\u4E8C\u5E74\u7EA7",value:2},{text:"\u4E09\u5E74\u7EA7",value:3},{text:"\u56DB\u5E74\u7EA7",value:4},{text:"\u4E94\u5E74\u7EA7",value:5},{text:"\u516D\u5E74\u7EA7",value:6},{text:"\u4E03\u5E74\u7EA7",value:7},{text:"\u516B\u5E74\u7EA7",value:8},{text:"\u4E5D\u5E74\u7EA7",value:9}],showPicker:!1,classPicker:!1,nameReg:/^[\u4E00-\u9FA5]+$/,openId:"",id:null,videoBrowseData:null,videoBrowsePoint:null,username:"",currentGrade:"",currentClass:"",intervalFnRef:null,applyStatus:!1,isPageHide:!1,parentConferencesAgenda:""}),w=h(!1),v=h(""),b=["1715022312206573570","1715045889000656897","1715030463675944961","1715034224138985474","1715036209671098370","1715042256419889153","1715013540700561409"],C=t=>{if(t)if(e.nameReg.test(t)){if(t.length<2||t.length>15)return"\u5B66\u5458\u59D3\u540D\u5FC5\u987B\u4E3A2~15\u4E2A\u5B57"}else return"\u5B66\u5458\u59D3\u540D\u5FC5\u987B\u4E3A\u4E2D\u6587";else return"\u8BF7\u586B\u5199\u5B66\u751F\u771F\u5B9E\u59D3\u540D"},k=async()=>{var t,n;try{if(e.applyStatus){l("\u5BB6\u957F\u4F1A\u8C03\u67E5\u95EE\u5377\u5DF2\u7ED3\u675F");return}if(C(e.username)){l(C(e.username));return}if(!e.currentGrade){l("\u8BF7\u9009\u62E9\u5E74\u7EA7");return}if(!e.currentClass){l("\u8BF7\u9009\u62E9\u73ED\u7EA7");return}(t=e.intervalFnRef)==null||t.pause(),a.pause(),await d.post("/api-student/open/studentBrowseRecord/updateStat",{data:{id:e.id,pageBrowseTime:a.counter.value,username:e.username,currentGrade:e.currentGrade,currentClass:e.currentClass?Number(e.currentClass):null}}),u.push({path:"/pre-register-video",query:{saveId:e.id,id:e.orchestraId,openId:e.openId}})}catch{(n=e.intervalFnRef)==null||n.resume(),a.resume()}},P=(t,n)=>{let o="";return n.forEach(x=>{x.value==t&&(o=x.text)}),o},B=async(t=10)=>{try{await d.post("/api-student/open/studentBrowseRecord/updateStat",{data:{id:e.id,pageBrowseTime:t}})}catch{}};A(async()=>{try{e.orchestraId||l("\u4FE1\u606F\u83B7\u53D6\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u8001\u5E08");const{data:t}=await d.get("/api-student/open/orchestra/detail/"+e.orchestraId);if(e.parentConferencesAgenda=t.parentConferencesAgenda,!e.code)return;if(t.orchestraRegisterType==="ORCHESTRA"&&t.status!=="PRE_REGISTER"){l("\u5BB6\u957F\u4F1A\u8C03\u67E5\u95EE\u5377\u5DF2\u7ED3\u675F"),e.applyStatus=!0;return}if(t.orchestraRegisterType==="PARENT_CONFERENCES"&&t.status!=="PARENT_TEACHER_REGISTRATION"&&t.status!=="DOING"&&t.status!=="DONE"){l("\u5BB6\u957F\u4F1A\u8C03\u67E5\u95EE\u5377\u5DF2\u7ED3\u675F"),e.applyStatus=!0;return}if(e.orchestraId&&b.indexOf(e.orchestraId)!=-1){v.value="\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F",w.value=!0;return}const o=(await d.post("/api-student/open/studentBrowseRecord/add",{data:{orchestraId:e.orchestraId,code:e.code,openId:e.openId}})).data;e.currentClass=o.currentClass,e.currentGrade=o.currentGrade,e.openId=o.openId,e.username=o.username,e.videoBrowseData=o.videoBrowseData,e.videoBrowsePoint=o.videoBrowsePoint,e.id=o.id,sessionStorage.setItem("active-open-id",o.openId),a.resume(),e.intervalFnRef=$(()=>{a.counter.value=0,a.resume(),B()},1e4)}catch{}});const S=async t=>{try{const{data:n}=await d.get("/api-school/open/paramConfig/wechatAppId");n&&(U(),q(n,t))}catch{}};if(E().weixin){const t=sessionStorage.getItem("active-open-id");e.openId=t;const n=L();if(n)e.code=n;else{const o=window.location.origin+window.location.pathname+"#"+i.path+"?"+O.stringify({...i.query});return S(o),""}}const y=()=>{console.log(e.isPageHide,"showInfo"),e.isPageHide&&window.location.reload()};window.addEventListener("pageshow",y);const I=()=>{console.log(e.isPageHide,"showInfo"),e.isPageHide=!0};return window.addEventListener("pagehide",I),H(()=>{window.removeEventListener("pageshow",y),window.removeEventListener("pagehide",I)}),()=>s("div",{class:r["per-register-active"]},[s("div",{class:r.flowPath},[s("i",{class:r.flowPathTitle},null),s("div",{class:r.flowPathContent,innerHTML:e.parentConferencesAgenda},null)]),s("div",{class:r.signin},[s("div",{class:r.tips},[s("img",{src:V,class:r.signinTips},null),s("p",null,[c("\u8BF7\u5148\u8FDB\u884C"),s("span",null,[c("\u7B7E\u5230")]),c("\uFF0C\u518D\u89C2\u770B"),s("span",null,[c("\u7BA1\u4E50\u56E2\u5BB6\u957F\u4F1A\u89C6\u9891")])])]),s(W,{class:r.cellGroup,border:!1},{default:()=>[s(m,{label:"\u5B66\u751F\u59D3\u540D",labelAlign:"top",placeholder:"\u8BF7\u8F93\u5165\u5B66\u751F\u59D3\u540D",autocomplete:"off",modelValue:e.username,"onUpdate:modelValue":t=>e.username=t},null),s(m,{label:"\u5E74\u7EA7",labelAlign:"top",placeholder:"\u8BF7\u9009\u62E9\u5E74\u7EA7",isLink:!0,readonly:!0,modelValue:P(e.currentGrade,e.currentGradeList),clickable:!1,onClick:()=>e.showPicker=!0},null),s(m,{label:"\u73ED\u7EA7",labelAlign:"top",placeholder:"\u8BF7\u9009\u62E9\u73ED\u7EA7",isLink:!0,readonly:!0,modelValue:P(e.currentClass,g),clickable:!1,onClick:()=>e.classPicker=!0},null),s(N,{class:r.submitBtn,onClick:k},null)]})]),s(Q,null,null),s(f,{show:e.showPicker,"onUpdate:show":t=>e.showPicker=t,position:"bottom",round:!0},{default:()=>[s(R,{columns:e.currentGradeList,onCancel:()=>e.showPicker=!1,onConfirm:({selectedValues:t})=>{e.currentGrade=t[0],e.showPicker=!1}},null)]}),s(f,{show:e.classPicker,"onUpdate:show":t=>e.classPicker=t,position:"bottom",round:!0},{default:()=>[s(R,{columns:g,onCancel:()=>e.classPicker=!1,onConfirm:({selectedValues:t})=>{e.currentClass=t[0],e.classPicker=!1}},null)]}),s(f,{show:w.value,"onUpdate:show":t=>w.value=t,round:!0,style:{width:"88%"},closeOnClickOverlay:!1,class:r.wxPopupDialog},{default:()=>[s("div",{class:r.popupContainer},[s("p",{class:r.title},[c("\u6E29\u99A8\u63D0\u793A")]),s("p",{class:r.popupTips,innerHTML:v.value},null)])]})])}});export{ie as default};