import{d as r,a as o,a0 as n,j as s,u as p,F as u,P as h}from"./vendor.a0144ce9.js";/* empty css                *//* empty css                */import{a as d,i as m}from"./icon_checkbox_default.2fe5d57e.js";import{C as f}from"./index.fc7d34d1.js";import{s as w,r as c}from"./index.3d95a92c.js";const x="_colProtocol_wgzww_1",y="_protocolText_wgzww_6",C="_boxStyle_wgzww_10";var e={colProtocol:x,protocolText:y,boxStyle:C},B=r({name:"protocol",props:{showHeader:{type:Boolean,default:!1},modelValue:{type:Boolean,default:!1}},data(){return{exists:!0,checked:this.modelValue,popupStatus:!1,protocolHTML:"",protocolPopup:null,baseUrl:w.platformType==="STUDENT"?"/api-student":"/api-teacher"}},async mounted(){try{const t=await c.get(this.baseUrl+"/sysUserContractRecord/checkContractSign",{params:{contractType:"BUY_ORDER"}});this.exists=t.data,this.checked=this.checked||this.exists,this.$emit("update:modelValue",this.checked||this.exists)}catch{}this.checked=this.modelValue,window.addEventListener("hashchange",this.onHash,!1)},unmounted(){window.removeEventListener("hashchange",this.onHash,!1)},watch:{checked(t){this.$emit("update:modelValue",t)}},methods:{async getContractDetail(){try{if(console.log("getContractDetail"),!this.protocolHTML){const t=await c.get(this.baseUrl+"/sysUserContractRecord/queryContract",{params:{contractType:"BUY_ORDER"}});this.protocolHTML=t.data,console.log(t)}this.onPopupClose()}catch{}},onHash(){this.popupStatus=!1},onPopupClose(){if(this.popupStatus=!this.popupStatus,this.popupStatus){const t=this.$route;let a=0;for(let g in t.query)a+=1;const l=window.location.href,i=a>0?"&pto="+ +new Date:"?pto="+ +new Date;history.pushState("","",`${l}${i}`)}else window.history.go(-1);this.protocolPopup&&(this.protocolPopup.scrollTop=0)}},render(){return o("div",{class:e.colProtocol},[!this.exists&&o(n,{modelValue:this.checked,"onUpdate:modelValue":t=>this.checked=t},{default:()=>[s("\u6211\u5DF2\u9605\u8BFB\u5E76\u540C\u610F")],icon:t=>o(p,{class:e.boxStyle,name:t.checked?d:m,size:"15"},null)}),this.exists&&o(u,null,[s("\u67E5\u770B")]),o("span",{onClick:this.getContractDetail,class:e.protocolText},[s("\u300A\u9177\u4E50\u79C0\u5E73\u53F0\u670D\u52A1\u534F\u8BAE\u300B")]),o(h,{ref:this.protocolPopup,show:this.popupStatus,position:"bottom",style:{height:"100%"}},{default:()=>[this.showHeader&&o(f,{title:"\u9177\u4E50\u79C0\u5E73\u53F0\u670D\u52A1\u534F\u8BAE"},null),this.popupStatus&&o("div",{class:e.protocolContent,id:"mProtocol"},[o("div",{class:e.protocolContent,innerHTML:this.protocolHTML},null)])]})])}});export{B as C};
