<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	// nginx proxy: proxy_set_header 	X-Scheme 	$scheme; 
	String scheme = request.getHeader("X-Scheme");
	if (scheme == null) {
		scheme = request.getScheme();
	}
	int port = request.getServerPort();
	String basePath = scheme + "://" + request.getServerName() + ((port == 80 || port == 443) ? "" : (":" + port)) + path + "/";
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<title>账户注册 - 优软云</title>
<meta name="description" content="" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="<%=basePath%>">
<link rel="shortcut icon" href="static/img/icon.png">
<link rel="stylesheet" type="text/css" href="static/lib/css/weui.min.css">
<link rel="stylesheet" type="text/css" href="static/lib/css/toastr.min.css">
<link rel="stylesheet" href="static/css/mobile/register.css" />
<meta name="referrer" content="origin" />
</head>
<body>
	<c:if test="${pageStep==1}"><%--${pageStep==1}--%>
	<div class="container">
		<div class="cell">
			<!-- Header -->
			<div class="hd">
				<h4>
					<img src="static/img/icon_brand.png" alt="" height="20px"/>
					<span>优软云</span>
				</h4>
			</div>

			<div class="bd x-login-form" id="form-wrap">
				<form class="x-form">
					<input type="hidden" name="pageToken" value="${pageToken}">
					<input type="hidden" name="pageStep" value="${pageStep}">
					<!-- Enterprise info form -->
					<div class="weui_cells_title">
						企业资料信息
					</div>
					<div class="weui_cells weui_cells_form">
                        <div class="weui_cell">
                            <div class="weui_cell_hd">
                                <label class="weui_label">企业名称</label>
                            </div>
                            <div class="weui_cell_bd weui_cell_primary">
                                <input type="text" class="weui_input " placeholder="必填,正式全称"
                                       name="name" required="required" x-help-by="name_help"
                                       x-error-by="name_err" x-maxlength="20"/>
                            </div>
                            <div style="display: none;">
                                <div id="name_help" class="x-text-help">
                                    <i class="glyphicon glyphicon-info-sign x-icon-left"></i>填写在工商局注册的企业名称
                                </div>
                                <div id="name_err" class="x-text-error" style="display: none">
                                    <i class="glyphicon glyphicon-info-sign x-icon-left"></i>请填写营业执照上的企业名称
                                </div>
                            </div>
                        </div>
                        <div class="weui_cell">
                            <div class="weui_cell_hd">
                                <label class="weui_label">企业简称</label>
                            </div>
                            <div class="weui_cell_bd weui_cell_primary">
                                <input type="text" class="weui_input " placeholder="必填,方便记住的简称"
                                       name="shortName" required="required" x-error-by="shortName_err" x-minlength="2" x-maxlength="40"/>
                            </div>
                            <div style="display: none;">
                                <div id="shortName_err" class="x-text-error">
                                    <i class="glyphicon glyphicon-info-sign x-icon-left"></i>请填写企业简称，汉字请控制2-40字以内
                                </div>
                            </div>
                        </div>
						<div class="weui_cell">
							<div class="weui_cell_hd">
								<label class="weui_label">营业执照号</label>
							</div>
							<div class="weui_cell_bd weui_cell_primary">
								<input type="text" class="weui_input " placeholder="必填,营业执照上的注册号"
								    name="businessCode" required="required" x-help-by="businessCode_help"
                                       x-error-by="businessCode_err"
                                       x-maxlength="60"/>
							</div>
							<div style="display: none;">
                                <div id="businessCode_help" class="x-text-help">
                                    <i class="glyphicon glyphicon-info-sign x-icon-left"></i>填写营业执照上的注册号
                                </div>
                                <div id="businessCode_err" class="x-text-error"
                                     style="display: none">
                                    <i class="glyphicon glyphicon-info-sign x-icon-left"></i>请填写营业执照上的注册号
                                </div>
							</div>
						</div>
					</div>
					
					<!-- Administrator account info form -->
					<div class="weui_cells_title">
						管理员账号信息
					</div>
					<div class="weui_cells weui_cells_form weui_cells_checkbox weui_cells_radio">
						<div class="weui_cell">
							<div class="weui_cell_hd">
								<label class="weui_label">姓名</label>
							</div>
							<div class="weui_cell_bd weui_cell_primary">
								<input type="text" class="weui_input " placeholder="必填,如:张三" required="required"
								name="adminName" x-maxlength="30" x-error-by="adminName_err"/>
							</div>
							<div style="display: none">
								<div id="adminName_err" class="x-text-error">
									<i class="glyphicon glyphicon-info-sign x-icon-left"></i>请填写管理员姓名
								</div>
							</div>
						</div>
						<div class="weui_cell">
							<div class="weui_cell_hd">
								<label class="weui_label">手机号</label>
							</div>
							<div class="weui_cell_bd weui_cell_primary">
								<input type="tel" class="weui_input " placeholder="必填,如:15818181818" required="required"
									   name="adminTel" x-pattern="^[\d-]{8,}$" x-error-by="adminTel_err"/>
							</div>
							<div style="display: none">
								<div id="adminTel_err" class="x-text-error">
									<i class="glyphicon glyphicon-info-sign x-icon-left"></i>填写格式例如：15818181818
								</div>
							</div>
						</div>
						<div class="weui_cell">
							<div class="weui_cell_hd">
								<label class="weui_label">邮箱</label>
							</div>
							<div class="weui_cell_bd weui_cell_primary">
								<input type="email" class="weui_input " placeholder="必填,如:zhangs@example.com" required="required"
								name="adminEmail" x-pattern="^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"
								x-help-by="adminEmail_help" x-error-by="adminEmail_err"/>
							</div>
							<div style="display: none">
								<div id="adminEmail_help" class="x-text-help">
									<i class="glyphicon glyphicon-info-sign x-icon-left"></i>您将通过该邮箱完成激活，请及时查收
								</div>
								<div id="adminEmail_err" class="x-text-error">
									<i class="glyphicon glyphicon-info-sign x-icon-left"></i>填写格式例如：zhangsan@example.com
								</div>
							</div>
						</div>
						<div class="weui_cell weui_vcode">
							<div class="weui_cell_hd">
								<label class="weui_label">验证码</label>
							</div>
							<div class="weui_cell_bd weui_cell_primary">
								<input type="text" class="weui_input" name="checkcode"
                                       required placeholder="手机收到的6位数字" x-pattern="^\d{6}$"
                                       x-help-by="checkcode_help" x-error-by="checkcode_err"
									   x-error-text="请填写收到的验证码" />
							</div>
							<div class="weui_cell_ft">
								<button class="weui_btn x-btn x-btn-checkcode" type="button" disabled="disabled">
									<span>获取验证码</span>
									<span class="x-timeout-word" style="display: none;">
										<span class="x-timeout-num">60</span>秒
									</span>
								</button>
							</div>
						</div>
                        <input type="hidden" name="checkcodeToken" required x-error-text="请先获取验证码，然后输入验证码">
					</div>
					
					<div class="weui_cells_tips">
						<i class="weui_icon_success_circle"></i> 
						<input type="checkbox" id="agree" name="agree" value="1" checked="checked" required="" style="display: none;" x-error-text="您还未同意服务协议">
						我已阅读并同意<a href="http://www.ubtob.com/help/agreement">《优软云服务协议》</a>
					</div>
	
					<div class="weui_btn_area">
						<button type="button" class="btn weui_btn x-btn-primary x-btn-submit">注册</button>
					</div>
				</form>
			</div>
		</div>
	</div>
	</c:if>

	<c:if test="${pageStep==3}"><%--${pageStep==2}--%>
	<div class="container">
		<form class="x-form">
			<div class="msg">
				<div class="weui_msg">
					<div class="weui_text_area">
						<h2 class="weui_msg_title"><i class="weui_icon_success"></i> 提交成功，请设置密码</h2>
					</div>
				</div>
			</div>

			<div class="weui_panel weui_panel_access">
				<div class="weui_panel_hd">我们已经默认为您开通了以下应用</div>
				<div class="weui_panel_bd">
					<a href="javascript:void(0);" class="weui_media_box weui_media_appmsg">
						<div class="weui_media_hd">
							<img class="weui_media_appmsg_thumb" src="static/img/demo/i8.png" alt="">
						</div>
						<div class="weui_media_bd">
							<h4 class="weui_media_title">B2B商务</h4>
							<p class="weui_media_desc">方便快捷的供应链商务平台。</p>
						</div>
					</a>
					<a href="javascript:void(0);" class="weui_media_box weui_media_appmsg">
						<div class="weui_media_hd">
							<img class="weui_media_appmsg_thumb" src="static/img/demo/i6.png" alt="">
						</div>
						<div class="weui_media_bd">
							<h4 class="weui_media_title">优软商城</h4>
							<p class="weui_media_desc">为世界电子产业创造价值的电子商城。</p>
						</div>
					</a>
					<a href="javascript:void(0);" class="weui_media_box weui_media_appmsg">
						<div class="weui_media_hd">
							<img class="weui_media_appmsg_thumb" src="static/img/demo/i_uu.png" alt="">
						</div>
						<div class="weui_media_bd">
							<h4 class="weui_media_title">UU互联</h4>
							<p class="weui_media_desc">集移动办公，即时沟通为一体的综合应用APP。</p>
						</div>
					</a>
				</div>
			</div>

			<c:if test="${empty password}">
				<div class="weui_cells weui_cells_form">
					<div class="weui_cells_title">请设置管理员账户的登录密码</div>
					<input type="hidden" name="pageToken" value="${pageToken}">
					<div class="weui_cell">
						<div class="weui_cell_hd">
							<label class="weui_label">登录账号</label>
						</div>
						<div class="weui_cell_bd weui_cell_primary">
							<input type="text" class="weui_input " name="adminTel" required="required"
								   value="${content.adminTel}" readonly="readonly" style="color: #333333;"/>
						</div>
					</div>
					<div class="weui_cell">
						<div class="weui_cell_hd">
							<label class="weui_label">账户密码</label>
						</div>
						<div class="weui_cell_bd weui_cell_primary">
							<input type="password" class="weui_input " name="password" id="password" required="required"
								   x-error-by="password_err" placeholder="6-20位长度的英文、数字"
								   x-maxlength="20" x-minlength="6" autofocus/>
						</div>
						<div style="display: none;">
							<div class="x-text-error" id="password_err" style="display: none">请输入位6-20长度的英文、数字作为密码</div>
						</div>
					</div>
					<div class="weui_cell">
						<div class="weui_cell_hd">
							<label class="weui_label">确认密码</label>
						</div>
						<div class="weui_cell_bd weui_cell_primary">
							<input type="password" class="weui_input " id="passwordConfirm"
								   class="form-control x-input" name="passwordConfirm"
								   required="required" placeholder="再次输入密码确认" x-maxlength="20"
								   x-minlength="6" x-error-by="passwordConfirm_err"/>
						</div>
						<div style="display: none;">
							<div class="x-text-error" id="passwordConfirm_err">请再次输入密码，两次密码需要一致</div>
						</div>
					</div>
				</div>
			</c:if>

			<c:if test="${not empty password}">
				<div class="weui_cells weui_cells_form">
					<div class="weui_cells_title">管理员手机号已注册，请输入原密码验证</div>
					<input type="hidden" name="pageToken" value="${pageToken}">
					<input name="useruu" type="hidden" value="${useruu}">
					<input name="usertel" type="hidden" value="${usertel}">
					<div class="weui_cell">
						<div class="weui_cell_hd">
							<label class="weui_label">登录账号</label>
						</div>
						<div class="weui_cell_bd weui_cell_primary">
							<input type="text" class="weui_input " name="adminTel" required="required"
								   value="${content.adminTel}" readonly="readonly" style="color: #333333;"/>
						</div>
					</div>
					<div class="weui_cell">
						<div class="weui_cell_hd">
							<label class="weui_label">账户密码</label>
						</div>
						<div class="weui_cell_bd weui_cell_primary">
							<input type="password" class="weui_input " id="oldPassword" class="form-control x-input"
								   name="oldPassword" required="required" placeholder="手机号已注册，请输入原密码" x-error-by="oldPassword_err"
								   x-help-by="password_help" x-maxlength="20" x-minlength="6" autofocus/>
						</div>
						<div style="display: none;">
							<div class="x-text-error" id="password_help" style="display: none">请输入6-20位长度的英文、数字</div>
							<div class="x-text-error" id="oldPassword_err" style="display: none">请输入原密码进行验证</div>
						</div>
					</div>
					<input type="hidden" id="password" class="form-control x-input"
						   name="password" required="required" x-error-by="passwordvalid_err"
						   x-help-by="password_help" x-maxlength="20" x-minlength="6" autofocus>
					<input type="hidden" id="passwordConfirm"
						   class="form-control x-input" name="passwordConfirm"
						   required="required" x-maxlength="20"
						   x-minlength="6" x-error-by="passwordConfirm_err">
				</div>
			</c:if>

			<div class="weui_btn_area">
				<button type="button" class="btn weui_btn x-btn-primary x-btn-submit">完成注册</button>
			</div>
		</form>
	</div>
	</c:if>

	<!-- loading -->
	<div id="loading" class="weui_loading_toast">
		<div class="weui_mask_transparent"></div>
		<div class="weui_toast">
			<div class="weui_loading">
				<div class="weui_loading_leaf weui_loading_leaf_0"></div>
				<div class="weui_loading_leaf weui_loading_leaf_1"></div>
				<div class="weui_loading_leaf weui_loading_leaf_2"></div>
				<div class="weui_loading_leaf weui_loading_leaf_3"></div>
				<div class="weui_loading_leaf weui_loading_leaf_4"></div>
				<div class="weui_loading_leaf weui_loading_leaf_5"></div>
				<div class="weui_loading_leaf weui_loading_leaf_6"></div>
				<div class="weui_loading_leaf weui_loading_leaf_7"></div>
				<div class="weui_loading_leaf weui_loading_leaf_8"></div>
				<div class="weui_loading_leaf weui_loading_leaf_9"></div>
				<div class="weui_loading_leaf weui_loading_leaf_10"></div>
				<div class="weui_loading_leaf weui_loading_leaf_11"></div>
			</div>
			<p class="weui_toast_content">加载中</p>
		</div>
	</div>

	<!-- imageDialog -->
	<div class="weui_dialog_alert" id="imgDialog" style="display: none;">
		<div class="weui_mask" style="background: rgba(0,0,0,1);"></div>
		<div class="weui_dialog_img">
			<img src="" alt="" width="100%"/>
		</div>
	</div>

	<!-- alert dialog -->
	<div class="weui_dialog_alert" id="alertDialog" style="display: none;">
		<div class="weui_mask"></div>
		<div class="weui_dialog">
			<div class="weui_dialog_hd"><strong class="weui_dialog_title">注册成功</strong></div>
			<div class="weui_dialog_bd">您已经成功注册，<span id="count">3</span>秒后自动跳转到登录页面！</div>
			<div class="weui_dialog_ft">
				<a href="javascript:;" class="weui_btn_dialog"></a>
			</div>
		</div>
	</div>

	<script src="static/lib/js/jquery.min.js"></script>
	<script src="static/lib/js/toastr.min.js"></script>
	<script src="static/js/upload.js"></script>
	<script src="static/js/base.js"></script>
	<script src="static/js/mobile/register.js"></script>

</body>
</html>