;(function(){function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}var __vite_style__=document.createElement('style');__vite_style__.innerHTML="._colProtocol_wgzww_1{font-size:.32rem;padding:.4rem .37333rem;color:#999}._colProtocol_wgzww_1 ._protocolText_wgzww_6{color:var(--van-primary);line-height:.4rem}._colProtocol_wgzww_1 ._boxStyle_wgzww_10{background:transparent!important;width:.4rem;height:.4rem;border:transparent!important}._colProtocol_wgzww_1 .van-checkbox{display:inline-block;align-items:inherit;overflow:inherit}._colProtocol_wgzww_1 .van-checkbox__icon{height:.4rem;line-height:.4rem;display:inline-block;vertical-align:middle}._colProtocol_wgzww_1 .van-checkbox__label{line-height:.4rem}\n";document.head.appendChild(__vite_style__);System.register(['./vendor-legacy.031e1374.js','./index-legacy.f25f109a13.js','./index-legacy.f25f109a14.js','./icon_checkbox_default-legacy.e33240bc.js','./index-legacy.1bb96d98.js','./index-legacy.1cd7b6bb.js'],function(exports){'use strict';var defineComponent,createVNode,Checkbox,createTextVNode,Icon,Fragment,Popup,activeButtonIcon,inactiveButtonIcon,ColHeader,state,request;return{setters:[function(module){defineComponent=module.d;createVNode=module.a;Checkbox=module.a0;createTextVNode=module.j;Icon=module.u;Fragment=module.F;Popup=module.P;},function(){},function(){},function(module){activeButtonIcon=module.a;inactiveButtonIcon=module.i;},function(module){ColHeader=module.C;},function(module){state=module.s;request=module.r;}],execute:function execute(){var colProtocol="_colProtocol_wgzww_1";var protocolText="_protocolText_wgzww_6";var boxStyle="_boxStyle_wgzww_10";var styles={colProtocol:colProtocol,protocolText:protocolText,boxStyle:boxStyle};var ColProtocol=exports('C',defineComponent({name:'protocol',props:{showHeader:{type:Boolean,default:false},modelValue:{type:Boolean,default:false}},data:function data(){return{exists:true,checked:this.modelValue,popupStatus:false,protocolHTML:'',protocolPopup:null,baseUrl:state.platformType==='STUDENT'?'/api-student':'/api-teacher'};},mounted:function mounted(){var _this=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var res;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return request.get(_this.baseUrl+'/sysUserContractRecord/checkContractSign',{params:{contractType:'BUY_ORDER'}});case 3:res=_context.sent;// console.log(res)
_this.exists=res.data;_this.checked=_this.checked||_this.exists;_this.$emit('update:modelValue',_this.checked||_this.exists);_context.next=11;break;case 9:_context.prev=9;_context.t0=_context["catch"](0);case 11:_this.checked=_this.modelValue;// this.getContractDetail()
window.addEventListener('hashchange',_this.onHash,false);case 13:case"end":return _context.stop();}}},_callee,null,[[0,9]]);}))();},unmounted:function unmounted(){window.removeEventListener('hashchange',this.onHash,false);},watch:{checked:function checked(val){this.$emit('update:modelValue',val);}},methods:{getContractDetail:function getContractDetail(){var _this2=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee2(){var res;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.prev=0;console.log('getContractDetail');// 判断是否有协议内容
if(_this2.protocolHTML){_context2.next=8;break;}_context2.next=5;return request.get(_this2.baseUrl+'/sysUserContractRecord/queryContract',{params:{contractType:'BUY_ORDER'}});case 5:res=_context2.sent;_this2.protocolHTML=res.data;console.log(res);case 8:_this2.onPopupClose();_context2.next=13;break;case 11:_context2.prev=11;_context2.t0=_context2["catch"](0);case 13:case"end":return _context2.stop();}}},_callee2,null,[[0,11]]);}))();},onHash:function onHash(){this.popupStatus=false;},onPopupClose:function onPopupClose(){this.popupStatus=!this.popupStatus;// 打开弹窗
if(this.popupStatus){var route=this.$route;var times=0;for(var i in route.query){times+=1;}var origin=window.location.href;var url=times>0?'&pto='+ +new Date():'?pto='+ +new Date();history.pushState('','',"".concat(origin).concat(url));}else{window.history.go(-1);}if(this.protocolPopup){this.protocolPopup.scrollTop=0;}}},render:function render(){var _this3=this;return createVNode("div",{"class":styles.colProtocol},[!this.exists&&createVNode(Checkbox,{"modelValue":this.checked,"onUpdate:modelValue":function onUpdateModelValue($event){return _this3.checked=$event;}},{default:function _default(){return[createTextVNode("\u6211\u5DF2\u9605\u8BFB\u5E76\u540C\u610F")];},icon:function icon(props){return createVNode(Icon,{"class":styles.boxStyle,"name":props.checked?activeButtonIcon:inactiveButtonIcon,"size":"15"},null);}}),this.exists&&createVNode(Fragment,null,[createTextVNode("\u67E5\u770B")]),createVNode("span",{"onClick":this.getContractDetail,"class":styles.protocolText},[createTextVNode("\u300A\u9177\u4E50\u79C0\u5E73\u53F0\u670D\u52A1\u534F\u8BAE\u300B")]),createVNode(Popup,{"ref":this.protocolPopup,"show":this.popupStatus,"position":"bottom","style":{height:'100%'}},{default:function _default(){return[_this3.showHeader&&createVNode(ColHeader,{"title":"酷乐秀平台服务协议"},null),_this3.popupStatus&&createVNode("div",{"class":styles.protocolContent,"id":"mProtocol"},[createVNode("div",{"class":styles.protocolContent,"innerHTML":_this3.protocolHTML},null)])];}})]);}}));}};});})();
