import{d as C,R as D,$ as P,f as y,c as u,P as h,F as I,ag as k,ah as G,r as S,o as l,m as p,bh as L,bi as R,b7 as T,q as s,B as _,bj as U,bk as q}from"./index.5f7ffb46.js";import{s as o,a as H}from"./signin-tips.6542f4eb.js";import{u as V,b as O}from"./index.da1fa078.js";import{C as N}from"./index.052b3caa.js";import{F as f}from"./index.6438a25f.js";import{P as v}from"./index.de1f78a6.js";import"./index.abd668f7.js";import"./Picker.148c9d83.js";import"./index.6bbd7daa.js";import"./use-tab-status.69b57a37.js";import"./index.99e0cf1f.js";import"./index.61ab9823.js";const $="_wxPopupDialog_1sfd3_1",j="_popupContainer_1sfd3_16",W="_title1_1sfd3_22",Y="_popupTips_1sfd3_29";var m={wxPopupDialog:$,popupContainer:j,title1:W,popupTips:Y},M=C({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 i=D(!1);return P(()=>{if(!y().weixin&&a.show){i.value=!0;return}}),()=>u(I,null,[u(h,{show:i.value,"onUpdate:show":d=>i.value=d,round:!0,style:{width:"88%"},closeOnClickOverlay:!1,class:m.wxPopupDialog},{default:()=>[u("div",{class:m.popupContainer},[u("p",{class:m.title1},[a.title]),u("p",{class:m.popupTips},[a.message])])]})])}});const w=[];for(let a=1;a<=40;a++)w.push({text:a+"\u73ED",value:a});var ne=C({name:"pre-register",setup(){const a=V(1e3,{controls:!0});a.pause();const i=k(),d=G(),e=S({loading:!0,orchestraId:d.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}],showPicker:!1,classPicker:!1,nameReg:/^[\u4E00-\u9FA5]+$/,openId:"",id:null,videoBrowseData:null,videoBrowsePoint:null,username:"",currentGrade:"",currentClass:"",intervalFnRef:null,applyStatus:!1,isPageHide:!1}),B=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"},b=async()=>{var t,r;try{if(e.applyStatus){l("\u5BB6\u957F\u4F1A\u8C03\u67E5\u95EE\u5377\u5DF2\u7ED3\u675F");return}if(B(e.username)){l(B(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 p.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}}),i.push({path:"/pre-register-video",query:{saveId:e.id,id:e.orchestraId,openId:e.openId}})}catch{(r=e.intervalFnRef)==null||r.resume(),a.resume()}},F=(t,r)=>{let c="";return r.forEach(n=>{n.value==t&&(c=n.text)}),c},x=async(t=10)=>{try{await p.post("/api-student/open/studentBrowseRecord/updateStat",{data:{id:e.id,pageBrowseTime:t}})}catch{}};P(async()=>{try{e.orchestraId||l("\u4FE1\u606F\u83B7\u53D6\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u8001\u5E08");const{data:t}=await p.get("/api-student/open/orchestra/detail/"+e.orchestraId);if((t.schoolSystem||"sixYearSystem")==="sixYearSystem"?(e.currentGradeList.push({text:"\u516D\u5E74\u7EA7",value:6}),e.currentGradeList.push({text:"\u521D\u4E00",value:7}),e.currentGradeList.push({text:"\u521D\u4E8C",value:8}),e.currentGradeList.push({text:"\u521D\u4E09",value:9})):(e.currentGradeList.push({text:"\u521D\u4E00",value:6}),e.currentGradeList.push({text:"\u521D\u4E8C",value:7}),e.currentGradeList.push({text:"\u521D\u4E09",value:8}),e.currentGradeList.push({text:"\u521D\u56DB",value:9})),!e.code)return;if(t.status!=="PRE_REGISTER"){l("\u5BB6\u957F\u4F1A\u8C03\u67E5\u95EE\u5377\u5DF2\u7ED3\u675F"),e.applyStatus=!0;return}const n=(await p.post("/api-student/open/studentBrowseRecord/add",{data:{orchestraId:e.orchestraId,code:e.code,openId:e.openId}})).data;e.currentClass=n.currentClass,e.currentGrade=n.currentGrade,e.openId=n.openId,e.username=n.username,e.videoBrowseData=n.videoBrowseData,e.videoBrowsePoint=n.videoBrowsePoint,e.id=n.id,sessionStorage.setItem("active-open-id",n.openId),a.resume(),e.intervalFnRef=O(()=>{a.counter.value=0,a.resume(),x()},1e4)}catch{}});const A=async t=>{try{const{data:r}=await p.get("/api-school/open/paramConfig/wechatAppId");r&&(U(),q(r,t))}catch{}};if(y().weixin){const t=sessionStorage.getItem("active-open-id");e.openId=t;const r=L();if(r)e.code=r;else{const c=window.location.origin+window.location.pathname+"#"+d.path+"?"+R.stringify({...d.query});return A(c),""}}const g=()=>{console.log(e.isPageHide,"showInfo"),e.isPageHide&&window.location.reload()};window.addEventListener("pageshow",g);const E=()=>{console.log(e.isPageHide,"showInfo"),e.isPageHide=!0};return window.addEventListener("pagehide",E),T(()=>{window.removeEventListener("pageshow",g),window.removeEventListener("pagehide",E)}),()=>u("div",{class:o["per-register-active"]},[u("div",{class:o.flowPath},[u("i",{class:o.flowPathTitle},null),u("div",{class:o.flowPathContent},[s("\u4E00\u3001\u8BF7\u6240\u6709\u5BB6\u957F\u8FDB\u884C"),u("span",null,[s("\u7B7E\u5230")]),u("br",null,null),s("\u4E8C\u3001"),u("span",null,[s("\u89C2\u770B")]),s("\u7BA1\u4E50\u56E2\u5BB6\u957F\u4F1A\u8BAE"),u("br",null,null),s("1\u3001\u5B66\u6821\u9886\u5BFC\u8BB2\u8BDD\uFF085\u5206\u949F\uFF09"),u("br",null,null),s("2\u3001\u57FA\u91D1\u4F1A\u8001\u5E08\u4ECB\u7ECD\u4E50\u56E2\u4E8B\u9879\uFF0820\u5206\u949F\uFF09"),u("br",null,null),u("p",{style:{"padding-left":"1em"}},[s("*\u4E50\u56E2\u7EC4\u5EFA\u80CC\u666F\u53CA\u653F\u7B56"),u("br",null,null),s("*\u4E50\u56E2\u53D1\u5C55\u89C4\u5212\u4E0E\u4E50\u5668\u77E5\u8BC6\u8BB2\u89E3"),u("br",null,null),s("*\u5B66\u6821/\u57FA\u91D1\u4F1A/\u5BB6\u957F\u5404\u65B9\u804C\u8D23\u4E0E\u6295\u5165"),u("br",null,null),s("*\u5165\u56E2\u6D41\u7A0B\u8BB2\u89E3")]),s("\u4E09\u3001\u4F1A\u540E\uFF0C\u5BB6\u957F\u53EF\u70B9\u51FB"),u("span",null,[s("\u201C\u4E50\u56E2\u62A5\u540D\u201D")]),s("\u6216\u626B\u7801\u8FDB\u884C\u6B63\u5F0F\u62A5\u540D")])]),u("div",{class:o.signin},[u("div",{class:o.tips},[u("img",{src:H,class:o.signinTips},null),u("p",null,[s("\u8BF7\u5148\u8FDB\u884C"),u("span",null,[s("\u7B7E\u5230")]),s("\uFF0C\u518D\u89C2\u770B"),u("span",null,[s("\u7BA1\u4E50\u56E2\u5BB6\u957F\u4F1A\u89C6\u9891")])])]),u(N,{class:o.cellGroup,border:!1},{default:()=>[u(f,{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),u(f,{label:"\u5E74\u7EA7",labelAlign:"top",placeholder:"\u8BF7\u9009\u62E9\u5E74\u7EA7",isLink:!0,readonly:!0,modelValue:F(e.currentGrade,e.currentGradeList),clickable:!1,onClick:()=>e.showPicker=!0},null),u(f,{label:"\u73ED\u7EA7",labelAlign:"top",placeholder:"\u8BF7\u9009\u62E9\u73ED\u7EA7",isLink:!0,readonly:!0,modelValue:F(e.currentClass,w),clickable:!1,onClick:()=>e.classPicker=!0},null),u(_,{class:o.submitBtn,onClick:b},null)]})]),u(M,null,null),u(h,{show:e.showPicker,"onUpdate:show":t=>e.showPicker=t,position:"bottom",round:!0},{default:()=>[u(v,{columns:e.currentGradeList,onCancel:()=>e.showPicker=!1,onConfirm:({selectedValues:t})=>{e.currentGrade=t[0],e.showPicker=!1}},null)]}),u(h,{show:e.classPicker,"onUpdate:show":t=>e.classPicker=t,position:"bottom",round:!0},{default:()=>[u(v,{columns:w,onCancel:()=>e.classPicker=!1,onConfirm:({selectedValues:t})=>{e.currentClass=t[0],e.classPicker=!1}},null)]})])}});export{ne as default};