

<div class="detailCon">
	<div class="hsHelp"></div>
	<div class="stateDiv">
		<label class="statLabel">{%label.phState%}{%label.colon%}</label>
		<label id="connectStat" class="statLabel">{%statusStr.disconcted%}</label>
	</div>
	<div class="actionBarDiv">
		<div class="actionTitleDiv">
			<label class="actionTitle">{%label.basicSet%}</label>
		</div>
		<div class="configDiv" id="configDiv">
			<ul class="line lineL">

				<!-- 模式选择 -->
				<li class="line lineD">
					<label class="des desA">{%label.mode%}</label>
					<span class="selCon">
						<span id="wanMode" class="select">
							<span class="value hsValueA"></span>
							<i class="arrow"></i>
						</span>
					</span>
				</li>

				<!-- ip addr -->
				<li class="line lineD">
					<label class="des desA">{%label.ipAddr%}</label>
					<label id="ip" class="infoLabel">0.0.0.0</label>
				</li>
				<!-- ip mask -->
				<li class="line lineD">
					<label class="des desA">{%label.mask%}</label>
					<label id="mask" class="infoLabel">0.0.0.0</label>
				</li>
				<!-- ip gateway -->
				<li class="line lineD gatewayWrap">
					<label class="des desA">{%label.gateway%}</label>
					<label id="gateway" class="infoLabel">0.0.0.0</label>
				</li>
				<!-- dns -->
				<li class="line lineD dnsWrap">
					<label class="des desA">{%label.dns%}</label>
					<label id="dns" class="infoLabel">0.0.0.0 , 0.0.0.0</label>
				</li>
			</ul>
		</div>
	</div>

	<!-- MTU -->
	<div class="actionBarDiv">
		<div class="actionTitleDiv">
			<label class="actionTitle">{%label.highSet%}</label>
		</div>
		<div class="configDiv" id="configDiv">
			<ul class="line">
				<li class="line lineC">
					<label class="des desA">{%label.mtu%}</label>
					<input id="mtu" class="text textA1" maxLength="4" />
				</li>
				<!-- 4G IPC 有线上网 -->
				<li class="line lineC" id="lteWiredWrap">
					<label class="des desA">{%label.internetWired%}</label>
					<span class="selCon IEPZD">
						<span id="internetWiredSel" class="select">
							<span class="value hsValueA"></span>
							<i class="arrow"></i>
						</span>
					</span>
				</li>
			</ul>
		</div>
	</div>
	<div class="funcBtnCon">
		<input id="save" type="button" value="{%btn.save%}" class="subBtn btnA" />
	</div>
</div>
<script type="text/javascript">function init(){function k(a,b){closeNoteAll();switch(a){case ENONE:return!1}return!0}function L(a,b){var c="";closeNoteAll();switch(a){case ENONE:return!1;case EINVMTU:c=errStr.dhcpcMtuErr;break;case EINVFDNSVR:c=errStr.primDnsErr;break;case EINVSDNSVR:c=errStr.seDnsErr;break;case EHOSTNAME:c=errStr.hostNameErr;break;case ENOLINK:c=errStr.wanLinkDown;break;default:c=errStr.unknown+a}showNote(b,c);closeToast();return!0}function M(a){if(!0!=k(a[ERR_CODE])){var b=a[n][v];id("mtu").value=b[C];D=a[uciNetwork.fileName][uciNetwork.dynData.wanStatus][uciNetwork.optName.proto];
p=a[w][E.main][N.listenHttpPort];statusStr.disconcted==d.innerHTML?$(d).addClass("connectStat"):$(d).removeClass("connectStat");F(a);q?(x=a[uciLteManager.fileName][uciLteManager.secName.infoData][uciLteManager.optName.internetWiredEn]==uciLteManager.optValue.enableVal.off?!0:!1)?(id("internetWiredSel").resetSel(uciLteManager.optValue.enableVal.off),$(".gatewayWrap").hide(),$(".dnsWrap").hide()):(id("internetWiredSel").resetSel(uciLteManager.optValue.enableVal.on),$(".gatewayWrap").show(),$(".dnsWrap").show()):
O&&(x=!0,$(".gatewayWrap").hide(),$(".dnsWrap").hide());showDetailCon()}}function F(a){var b=a[uciNetwork.fileName][uciNetwork.dynData.wanStatus];if(b[uciNetwork.optName.proto]!=uciProto.optValue.proto.dynIp)d.innerHTML=statusStr.disconcted,$(d).addClass("connectStatDis"),clearTimeout(e);else if(parseInt(b[uciNetwork.optName.phyStatus])==LINK_UP)switch(parseInt(b[uciNetwork.optName.linkStatus])){case LINK_DOWN:id("ip").innerHTML="0.0.0.0";id("mask").innerHTML="0.0.0.0";id("gateway").innerHTML="0.0.0.0";
id("dns").innerHTML="0.0.0.0 , 0.0.0.0";f=l;d.innerHTML=statusStr.disconcted;$(d).addClass("connectStatDis");break;case LINK_UP:id("ip").innerHTML=b.ipaddr||"0.0.0.0";id("gateway").innerHTML=b.gateway||"0.0.0.0";id("mask").innerHTML=b.netmask||"0.0.0.0";f=P;d.innerHTML=statusStr.concted;$(d).removeClass("connectStat");a=b.pri_dns||"0.0.0.0";b=b.snd_dns||"0.0.0.0";"0.0.0.0"==a&&"0.0.0.0"==b?id("dns").innerHTML=" "+label.dnsException:id("dns").innerHTML=a+" , "+b;break;case LINKING_DOWN:id("ip").innerHTML=
"0.0.0.0";id("mask").innerHTML="0.0.0.0";id("gateway").innerHTML="0.0.0.0";id("dns").innerHTML="0.0.0.0 , 0.0.0.0";f=l;d.innerHTML=statusStr.disconcting;$(d).removeClass("connectStat");break;case LINKING_UP:id("ip").innerHTML="0.0.0.0",id("mask").innerHTML="0.0.0.0",id("gateway").innerHTML="0.0.0.0",id("dns").innerHTML="0.0.0.0 , 0.0.0.0",f=l,d.innerHTML=statusStr.connting,$(d).removeClass("connectStat")}else id("ip").innerHTML="0.0.0.0",id("mask").innerHTML="0.0.0.0",id("gateway").innerHTML="0.0.0.0",
id("dns").innerHTML="0.0.0.0 , 0.0.0.0",f=l}function h(){var a={};a[uciNetwork.fileName]={};a[uciNetwork.fileName][KEY_NAME]=[uciNetwork.dynData.wanStatus];clearTimeout(e);$.queryP(a,function(a){F(a);e=$.setTimeout(h,f)})}function y(){showToast("other",{noteStr:label.dhcpFailed});D==r&&Q();closeToast()}function Q(){var a={};a[uciProto.fileName]={};a[uciProto.fileName][uciProto.secName.wan]={};a[uciProto.fileName][uciProto.secName.wan][uciProto.optName.type]=uciProto.optValue.proto.staticIp;showToast("other",
{noteStr:label.backToStaticIp});$.modify(a,function(a){if(!1==k(a))z(r),closeToast();else{var c=errStr.ipcNetGdipBackToStaticIp;clearTimeout(R);$.setTimeout(function(){showConfirm(c,function(a){!0==a?(s=0,G()):(d.innerHTML=statusStr.disconcted,$(d).addClass("connectStatDis"),showDetailCon(),z(r),closeToast())})},l)}})}function S(){var a="";p!=DEF_PORT&&(a=":"+p);window.location.href="http://"+A+a;clearTimeout(e);e=$.setTimeout(h,f)}function B(){var a={};a[uciNetwork.fileName]={};a[uciNetwork.fileName][uciNetwork.action.getDhcpIp]=
null;t++;$.action(a,function(a){H=!0;t=0;if(!1==k(a[ERR_CODE]))if(a[uciNetwork.optName.result]==uciNetwork.optValue.success){var c={};c[uciNetwork.fileName]={};c[uciNetwork.fileName][uciNetwork.action.releaseStaticIp]=null;$.action(c,function(c){!1==k(c[ERR_CODE])?(A=a[uciNetwork.optName.ipv4],clearTimeout(g),showToast("other",{noteStr:label.navigateToIp}),u=!0,$.setTimeout(function(){$.changeDomain(A+":"+p);lanDetecting(S)},2E3)):y()})}else a[uciNetwork.optName.result]==uciNetwork.optValue.timeout||
s>=I?(clearTimeout(g),u||y(),clearTimeout(e),e=$.setTimeout(h,f)):a[uciNetwork.optName.result]==uciNetwork.optValue.waiting&&(clearTimeout(g),s<I&&(s++,g=$.setTimeout(B,T)));else clearTimeout(g),u||y(),clearTimeout(e),e=$.setTimeout(h,f)});H||(clearTimeout(g),t<=U?g=$.setTimeout(B,V):(showToast("other",{noteStr:label.dhcpFailed}),$.setTimeout(closeToast,1E3),clearTimeout(e),e=$.setTimeout(h,f)))}function G(){var a={},b={},c={},g={};a[n]=b;b[J]=g;b[v]=c;b=id("mtu").value;t=0;u=!1;L(checkMtu(b,1500,
576),"mtu")||(b=hideLeadingZeros(b),id("mtu").value=b,c[C]=b,g[W]=uciProto.optValue.proto.dynIp,q&&(c=id("internetWiredSel").value,a[uciLteManager.fileName]={},a[uciLteManager.fileName][uciLteManager.secName.infoData]={},a[uciLteManager.fileName][uciLteManager.secName.infoData][uciLteManager.optName.internetWiredEn]=c),showToast("loading"),$.modify(a,function(a){!1==k(a[ERR_CODE])?(d.innerHTML=statusStr.connting,$(d).removeClass("connectStat"),showDetailCon(),showToast("success"),showToast("other",
{noteStr:label.dhcpGettingIp}),$.setTimeout(B,X),clearTimeout(e)):(clearTimeout(e),e=$.setTimeout(h,f))}))}function Y(a){(x="off"==a?!0:!1)?(id("internetWiredSel").resetSel(uciLteManager.optValue.enableVal.off),$(".gatewayWrap").hide(),$(".dnsWrap").hide()):(id("internetWiredSel").resetSel(uciLteManager.optValue.enableVal.on),$(".gatewayWrap").show(),$(".dnsWrap").show())}function z(a){a==Z?loadPage(K.dynIp,"wanCon"):a==r&&loadPage(K.staticIp,"wanCon")}var n=uciProto.fileName,J=uciProto.secName.wan,
v=uciProto.secName.dhcp,C=uciProto.optName.mtu,W=uciProto.optName.type,d=id("connectStat"),e,g,R,w=uciUhttpd.fileName,E=uciUhttpd.secName,N=uciUhttpd.optName,m=uciProto.optValue,Z=DEF_WAN_T=m.proto.dynIp,r=m.proto.staticIp,K={dynIp:"DynamicIp.htm",staticIp:"StaticIp.htm",pppoe:"PPPoE.htm"},U=60,I=28,H=!1,A,D,V=2E3,T=1E3,l=2E3,P=2E3,f=2E3,X=2E3,t=0,s=0,u=!1,p=DEF_PORT=80,x=!1,O=1==parseInt($.moduleSpec.lte)?!0:!1,q=1==parseInt($.moduleSpec.lte)&&$.lteCapability&&1==parseInt($.lteCapability[uciLteCapability.optName.internetWiredSupport]);
selectInit("wanMode",[{str:label.smartIp,value:m.proto.dynIp},{str:label.staticIp,value:m.proto.staticIp}],m.proto.dynIp,z);q?selectInit("internetWiredSel",[{str:label.internetWiredOff,value:"off"},{str:label.internetWiredOn,value:"on"}],"off",Y):$("#lteWiredWrap").hide();id("save").onclick=G;(function(){var a={};a[n]={};a[n][KEY_NAME]=[J,v];a[uciNetwork.fileName]={};a[uciNetwork.fileName][KEY_NAME]=[uciNetwork.dynData.wanStatus];a[w]={};a[w][NAME]=[E.main];q&&(a[uciLteManager.fileName]={},a[uciLteManager.fileName][KEY_NAME]=
[uciLteManager.secName.infoData]);$.query(a,M)})();e=$.setTimeout(h,f)}init();
</script><style type="text/css">li.line label.infoLabel{display:inline-block;font-size:13px;vertical-align:middle;color:#666;width:190px;height:32px;line-height:32px}input.textInput{width:190px}ul.line li.lineD,ul.line li.lineC{display:block}ul.lineL{margin-bottom:25px}</style>