index.cc99aa12.js 2.7 KB

1
  1. import{d as p,g as a,w as c,j as o,z as l,M as n,F as h,aR as u}from"./index.e6d6174e.js";import{C as d}from"./index.3d7e5752.js";import"./index.d92a5aca.js";import{a as m,i as y}from"./icon_checkbox_default.2fe5d57e.js";import{a as w}from"./icon_checkbox-tenant.06c74bc2.js";import{C as f}from"./index.045f03fd.js";const T="_colProtocol_wgzww_1",C="_protocolText_wgzww_6",g="_boxStyle_wgzww_10";var e={colProtocol:T,protocolText:C,boxStyle:g};const x={BUY_ORDER:"\u300A\u9177\u4E50\u79C0\u5E73\u53F0\u670D\u52A1\u534F\u8BAE\u300B",REGISTER:"\u300A\u9177\u4E50\u79C0\u5E73\u53F0\u6CE8\u518C\u534F\u8BAE\u300B"};var b=p({name:"protocol",props:{showHeader:{type:Boolean,default:!1},modelValue:{type:Boolean,default:!1},prototcolType:{type:String,default:"BUY_ORDER"}},data(){return{exists:!0,checked:this.modelValue,popupStatus:!1,protocolHTML:"",protocolPopup:null,baseUrl:a.platformType==="STUDENT"?"/api-student":"/api-teacher"}},async mounted(){try{const t=await c.get(this.baseUrl+"/sysUserContractRecord/checkContractSign",{params:{contractType:this.prototcolType}});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:this.prototcolType}});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 s=0;for(const S in t.query)s+=1;const r=window.location.href,i=s>0?"&pto="+ +new Date:"?pto="+ +new Date;history.pushState("","",`${r}${i}`)}else window.history.go(-1);this.protocolPopup&&(this.protocolPopup.scrollTop=0)}},render(){return o("div",{class:e.colProtocol},[!this.exists&&o(d,{modelValue:this.checked,"onUpdate:modelValue":t=>this.checked=t},{default:()=>[l("\u6211\u5DF2\u9605\u8BFB\u5E76\u540C\u610F")],icon:t=>o(n,{class:e.boxStyle,name:t.checked?a.projectType==="tenant"?w:m:y,size:"15"},null)}),this.exists&&o(h,null,[l("\u67E5\u770B")]),o("span",{onClick:this.getContractDetail,class:e.protocolText},[x[this.prototcolType]]),o(u,{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};