import{d as J,n as m,L as Y,a3 as T,P as ee,r,b as k,o as v,c as te,e as t,j as s,w as x,i as g,g as i,f as A,h as w,I as oe,B as se,S as B,K as c,a5 as ae,a6 as le,_ as re}from"./index-4789ca0a.js";import{T as C}from"./index-296c76cc.js";import{E as L}from"./el-message-box-ecaf3f80.js";const P=y=>(ae("data-v-bb2961b2"),y=y(),le(),y),de={class:"card-header"},ne={class:"type-it-container"},ie={class:"button-container"},ue={class:"form-container"},_e=P(()=>i("div",null," SSID可以简单地理解为无线网络的名称。修改SSID时，请在本框中输入一个最多不超过32个字符的字符串，该字符串由数字、字母(a-z、A-Z)、特殊字符(!#()+-./%=?@^_{|}~)和空格，且开头和结尾不能是空格。 ",-1)),ce=P(()=>i("div",null," 启用后，设备将会广播其无线网络标识(SSID)。这样附近的计算机或其他无线客户端即可搜索到本路由器的无线信号并连接到该设备。 ",-1)),fe=P(()=>i("div",null,[i("b",null,"OPEN："),w("无数据加密。这可能会导致网络被他人滥用，因此不推荐使用此方式。 ")],-1)),me=P(()=>i("div",{style:{"margin-top":"5px"}},[i("b",null,"WPA2(AES)-PSK："),w("WPA2(AES)-PSK 是 Wi-Fi 网络安全存取 (WPA) 的安全保护版本，该版本施行了802.11i 无线安全标准。 ")],-1)),pe=P(()=>i("div",{style:{"margin-top":"5px"}},[i("b",null,"WPA-PSK/WPA2-PSK："),w("WPA 预共享密钥 (WPA-PSK)。WPA2-PSK 是 Wi-Fi 网络安全存取 (WPA) 的安全保护版本，该版本施行了802.11i 无线安全标准。 ")],-1)),Se=P(()=>i("div",null," 密码的有效字符包含：0-9 a-z A-Z ! # ( ) + - . / % = ? @ ^ _ { | } ~ ",-1)),Pe=J({name:"QuickSettings",__name:"index",setup(y){let I=m(!1);const M=m();let z=m({}),U=m({});const a=Y();let p=m(!1),u=m(!0);const b=m(["1"]),q=_=>{},e=T({ssid:"",Pass:"",SafeMode:"",resource:"",ShowSsidOnLcd:"",show_qrcode_flag:"",NoForwarding:"",MAX_Access_num:"",cipher:"",security_shared_mode:""});let d=[];ee(()=>{z.value=a.state.NetWork,U.value=a.state.NetInfo,p.value=a.state.NetWork.wifi_cur_state=="1";/*!! 操作符将其转换为布尔值*/if(I.value==!1&&a.state.NetWork.SSID1&&a.state.NetInfo.AuthMode){u.value=!1;let _=a.state.NetInfo.HideSSID?a.state.NetInfo.HideSSID:a.state.NetInfo.m_HideSSID;e.resource=_=="1"?"隐藏":"广播",e.ssid=a.state.NetWork.SSID1!=""?a.state.NetWork.SSID1:a.state.NetInfo.m_SSID,e.Pass=atob(a.state.NetInfo.WPAPSK1_encode!=""?a.state.NetInfo.WPAPSK1_encode:a.state.NetInfo.m_WPAPSK1_encode),e.SafeMode=a.state.NetInfo.AuthMode!=""?a.state.NetInfo.AuthMode:a.state.NetInfo.m_AuthMode!=""?a.state.NetInfo.m_AuthMode:"WPA2PSK",e.ShowSsidOnLcd=a.state.NetWork.show_ssid_on_lcd=="yes"?"是":"否",e.show_qrcode_flag=a.state.NetWork.show_qrcode_flag,e.NoForwarding=a.state.NetWork.NoForwarding,e.MAX_Access_num=a.state.NetInfo.MAX_Access_num,(e.ssid!=""||e.Pass!="")&&(I.value=!0,d=[],d.push(e.ssid),d.push(e.Pass),d.push(e.SafeMode),d.push(e.resource),d.push(e.ShowSsidOnLcd),d.push(e.show_qrcode_flag),d.push(e.NoForwarding),d.push(e.MAX_Access_num))}});function X(_){u.value=!0,L.confirm("该操作将会断开网络，你确定要继续执行该操作吗？",{confirmButtonText:"继续",cancelButtonText:"取消",type:"warning"}).then(()=>{B({goformId:"SET_WIFI_INFO",wifiEnabled:_==!0?"1":"0"}).then(o=>{o.result=="success"?setTimeout(()=>{I.value=!1,u.value=!1,c("成功发送请求",{type:"success"})},2e3):(u.value=!1,c("操作失败",{type:"error"}))}).catch(o=>{c("请求失败",{type:"error"}),u.value=!1})}).catch(()=>{u.value=!1,c("取消执行",{type:"info"})})}const Z=T({ssid:[{validator:(_,o,n)=>{if(!o)return n(new Error("请输入SSID"));var f=/^[a-zA-Z0-9!#()+\-./%=?@^_{|}~](?:[a-zA-Z0-9!#()+\-./%=?@^_{|}~ ]{0,30}[a-zA-Z0-9!#()+\-./%=?@^_{|}~])?$/;f.test(o)?n():(n(new Error("SSID格式错误")),b.value=["1"])},trigger:"blur"}],validatePass:[{validator:(_,o,n)=>{if(!o)return n(new Error("请输入密码"));var f=/^[0-9a-zA-Z!#()+\-./%=?@^_{|}~]{1,20}$/;if(!f.test(o))n(new Error("密码格式错误")),b.value=["4"];else{if(e.Pass!==""&&!M.value)return;n()}},trigger:"blur"}],SafeMode:[{validator:(_,o,n)=>{o?n():n(new Error("请选择安全模式"))},trigger:"blur"}]}),H=_=>{_&&(_.clearValidate(),_.validate(o=>{if(o){const n=btoa(e.Pass);e.SafeMode=="WPA2PSK"||e.SafeMode=="WPA3Personal"||e.SafeMode=="WPA2WPA3"?e.cipher=1:e.cipher=2,e.SafeMode=="WPAPSK"||e.SafeMode=="WPA2PSK"||e.SafeMode=="WPAPSKWPA2PSK"||e.SafeMode=="WPA3Personal"||e.SafeMode=="WPA2WPA3"?e.security_shared_mode=e.cipher:e.SafeMode=="SHARED"?e.security_shared_mode="WEP":e.security_shared_mode="NONE";let f={goformId:"SET_WIFI_SSID1_SETTINGS",ssid:e.ssid,broadcastSsidEnabled:e.resource=="广播"?"0":"1",MAX_Access_num:e.MAX_Access_num,security_mode:e.SafeMode,cipher:e.cipher,NoForwarding:e.NoForwarding,show_qrcode_flag:e.show_qrcode_flag,show_ssid_on_lcd:e.ShowSsidOnLcd=="是"?"yes":"no",security_shared_mode:e.security_shared_mode};if(e.SafeMode!="OPEN"&&(f.passphrase=n),e.ssid==d[0]&&e.Pass==d[1]&&e.SafeMode==d[2]&&e.resource==d[3]&&e.ShowSsidOnLcd==d[4]){c("未修改内容",{type:"warning"});return}L.confirm("你确定要继续执行该操作吗？",{confirmButtonText:"继续",cancelButtonText:"取消",type:"warning"}).then(()=>{u.value=!0,B(f).then(h=>{h.result=="success"?setTimeout(()=>{I.value=!1,u.value=!1,c("成功发送请求",{type:"success"})},2e3):(u.value=!1,c("操作失败",{type:"error"}))}).catch(h=>{u.value=!1,c("请求失败",{type:"error"})})}).catch(()=>{u.value=!1,c("取消执行",{type:"info"})})}else return c("请检查表单内容",{type:"error"}),!1}))};return(_,o)=>{const n=r("el-switch"),f=r("el-tag"),h=r("el-input"),S=r("el-form-item"),N=r("el-radio"),E=r("el-radio-group"),V=r("el-option"),R=r("el-select"),K=r("el-button"),$=r("el-form"),D=r("el-card"),F=r("el-col"),W=r("el-collapse-item"),j=r("el-collapse"),G=r("el-row"),Q=k("loading"),O=k("motion");return v(),te("div",null,[t(G,{gutter:24},{default:s(()=>[x((v(),g(F,{xs:24,sm:24,md:16,lg:16,xl:16,class:"mb-[5px]",initial:{opacity:0,y:100},enter:{opacity:1,y:0,transition:{delay:200}}},{default:s(()=>[x((v(),g(D,{shadow:"never"},{header:s(()=>[i("div",de,[i("div",ne,[t(A(C),{className:"type-it1",values:["WIFI设置"],cursor:!1,speed:60})]),i("div",ie,[t(f,{class:"ml-2"},{default:s(()=>[w(" wifi状态："),t(n,{size:"small",modelValue:A(p),"onUpdate:modelValue":o[0]||(o[0]=l=>oe(p)?p.value=l:p=l),onChange:X},null,8,["modelValue"])]),_:1})])])]),default:s(()=>[i("div",ue,[t($,{ref_key:"ruleFormRef",ref:M,model:e,"status-icon":"",rules:Z,"label-width":"120px",class:"demo-ruleForm","label-position":"left"},{default:s(()=>[t(S,{label:"网络名称(SSID) ",prop:"ssid"},{default:s(()=>[t(h,{id:"ssid",modelValue:e.ssid,"onUpdate:modelValue":o[1]||(o[1]=l=>e.ssid=l),type:"text",autocomplete:"off"},null,8,["modelValue"])]),_:1}),t(S,{label:"SSID 广播"},{default:s(()=>[t(E,{modelValue:e.resource,"onUpdate:modelValue":o[2]||(o[2]=l=>e.resource=l)},{default:s(()=>[t(N,{border:"",label:"隐藏"}),t(N,{border:"",label:"广播"})]),_:1},8,["modelValue"])]),_:1}),t(S,{label:"安全模式",prop:"SafeMode"},{default:s(()=>[t(R,{modelValue:e.SafeMode,"onUpdate:modelValue":o[3]||(o[3]=l=>e.SafeMode=l),"fit-input-width":!0,style:{width:"100%"}},{default:s(()=>[t(V,{label:"OPEN",value:"OPEN"}),t(V,{label:"WPA2(AES)-PSK",value:"WPA2PSK"}),t(V,{label:"WPA-PSK/WPA2-PSK",value:"WPAPSKWPA2PSK"})]),_:1},8,["modelValue"])]),_:1}),e.SafeMode!="OPEN"?(v(),g(S,{key:0,label:"密码",prop:"Pass"},{default:s(()=>[t(h,{modelValue:e.Pass,"onUpdate:modelValue":o[4]||(o[4]=l=>e.Pass=l),modelModifiers:{number:!0},type:"password","show-password":!0},null,8,["modelValue"])]),_:1})):se("",!0),t(S,{label:"LCD显示"},{default:s(()=>[t(E,{modelValue:e.ShowSsidOnLcd,"onUpdate:modelValue":o[5]||(o[5]=l=>e.ShowSsidOnLcd=l)},{default:s(()=>[t(N,{border:"",label:"是"}),t(N,{border:"",label:"否"})]),_:1},8,["modelValue"])]),_:1}),t(S,{class:"form-buttons"},{default:s(()=>[t(K,{type:"primary",onClick:o[6]||(o[6]=l=>H(M.value)),disabled:!A(p)},{default:s(()=>[w("应用")]),_:1},8,["disabled"])]),_:1}),t(K,{style:{visibility:"hidden"}})]),_:1},8,["model","rules"])])]),_:1})),[[Q,A(u)]])]),_:1})),[[O]]),x((v(),g(F,{xs:24,sm:24,md:8,lg:8,xl:8,class:"mb-[5px]",initial:{opacity:0,y:100},enter:{opacity:1,y:0,transition:{delay:200}}},{default:s(()=>[t(D,{shadow:"never"},{header:s(()=>[t(A(C),{className:"type-it2",values:["格式要求及选项说明"],cursor:!1,speed:60})]),default:s(()=>[t(j,{modelValue:b.value,"onUpdate:modelValue":o[7]||(o[7]=l=>b.value=l),onChange:q},{default:s(()=>[t(W,{title:"网络名称(SSID)",name:"1"},{default:s(()=>[_e]),_:1}),t(W,{title:"SSID 广播",name:"2"},{default:s(()=>[ce]),_:1}),t(W,{title:"安全模式",name:"3"},{default:s(()=>[fe,me,pe]),_:1}),t(W,{title:"密码",name:"4"},{default:s(()=>[Se]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})),[[O]])]),_:1})])}}});const be=re(Pe,[["__scopeId","data-v-bb2961b2"]]);export{be as default};
