增加弹框

master
chenzhi 5 years ago
parent d1428e1044
commit da8aee73c6

@ -134,16 +134,90 @@ class SsgController extends BaseController {
//注册
public function phoneRegister()
{
//获取手机号
{
//添加用户
C(api('Config/lists'));
$user = $_POST;
$promoteId =( $user['promote_id'] ? $user['promote_id'] : 0);
#判断数据是否为空
if (empty($user)) {
$this -> set_message(1001, "fail", "注册数据不能为空");
}
#验证短信验证码
$this -> sms_verify($user['account'], $user['code']);
$res = $this -> doRegister($user['account'],$user['password'],$user['account'],$promoteId,4,2);
if(empty($res)){
$this -> set_message(1017, "fail", "添加失败");
}
//添加自动登录
$_SESSION['user_id'] = $res;
$this -> set_message(1, "success", "添加成功");
}
//普通注册
public function userRegister()
{
$account = I("account");
$password = I("password");
$promoteId = I("promote_id", 0);
$res = $this -> doRegister($account,$password,'',$promoteId,4,1);
if(empty($res)){
$this -> set_message(1017, "fail", "添加失败");
}
//添加自动登录
$_SESSION['user_id'] = $res;
$this -> set_message(1, "success", "添加成功");
# code...
}
//消息返回
public function set_message($status=0,$return_code="fail",$return_msg="操作失败"){
$msg = array(
"status" => $status,
"return_code" => $return_code,
"return_msg" => $return_msg
);
$this->ajaxReturn($msg,'JSON');
exit();
}
//真正注册代码
public function doRegister()
public function doRegister($account,$password,$phone,$promote_id,$register_way,$register_type)
{
//验证账号
$is_user_info = M('user', 'tab_') -> where(['account' => $account]) -> find();
if (!empty($is_user_info)) {
$this -> set_message(1017, "fail", "用户名已存在");
}
//2.验证其他平台是否存在账号
$domain = C('UC_OTHER_WEB_URL');
if (!empty($domain)) {
$url = "http://{$domain}/Api/user/checkUserName?account={$account}";
$check_res = json_decode(file_get_contents($url), true);
if ($check_res['status'] == 0) {
$this -> set_message(1017, "fail", "用户名已存在");
}
}
$data = array(
'account' => $account,
'password' => think_ucenter_md5($password, UC_AUTH_KEY),
'phone' => $phone,
'head_img' =>'',
'promote_id' => $promote_id,
'promote_account' =>get_promote_account($promote_id),
'register_way' => $register_way,
'register_type' => $register_type,
'register_ip' => get_client_ip(),
'parent_id'=>get_fu_id($promote_id),
'parent_name'=>get_parent_name($promote_id),
'register_time'=>time(),
'check_time' => time(),
);
/* 添加用户 */
$res = M('user', 'tab_') ->add($data);
return $res;
# code...
}
@ -262,4 +336,28 @@ class SsgController extends BaseController {
$res = array("day" => $days, "hour" => $hours, "min" => $mins, "sec" => $secs);
return $res;
}
public function sms_verify($phone="" ,$code="",$type=2){
$result = R('Common/Sms/verify_sms_code',array($phone,$code,false));
if($result['code']==200) {
if($type==1){
$this->set_message(200,"success","正确");
}else{
return true;
}
} else {
switch ($result['code']) {
case 1021:{
$this->set_message(1010,"fail","验证码已失效,请重新获取");
};break;
case 1022:{
$this->set_message(1022,"fail","验证码不正确,请重新输入");
};break;
default:
$this->set_message($result['code'],"fail",$result['msg']);
}
}
}
}

@ -145,19 +145,19 @@
</div>
<div class="formitem">
<img src="__IMG__/ssg/login/password.png">
<input type="password" placeholder="请输入6-12位自字母组合密码" value="">
<input id="phonepassword" type="password" placeholder="请输入6-12位自字母组合密码" value="">
</div>
<div class="formitem" style="border: 0px;">
<div class="formitem" style="margin-right: .2rem;margin-top: 0px;width: 3.5rem;">
<img src="__IMG__/ssg/login/code.png">
<input type="text" placeholder="请输入短信验证码" value="" style="width:2.5rem;">
<input id="phonecode" type="text" placeholder="请输入短信验证码" value="" style="width:2.5rem;">
</div>
<div id="getPhoneCode" style="width:1.8rem;height: .6rem;color: white;background-color:#21B1EB;border-radius: .3rem;line-height: .6rem;font-size: .24rem;text-align: center;">
获取验证码
</div>
</div>
<!---按钮-->
<div
<div id="phonereg"
style="display: flex;width:100%;margin:.22rem auto 0;justify-content:center;align-items:center;font-size: .32rem;text-align: center;line-height:1.1rem;color: #fff;">
<div
style="background: url('__IMG__/ssg/login/bigbuttonbg.png') no-repeat top center/cover;width: 5.6rem;height: 1.4rem;">
@ -187,20 +187,20 @@
</div>
<div class="formitem" style="margin-top: 0px;">
<img src="__IMG__/ssg/login/user.png">
<input type="text" placeholder="请输入账号(6-12位字母数字组合)" value="">
<input id="regaccount" type="text" placeholder="请输入账号(6-12位字母数字组合)" value="">
</div>
<div class="formitem">
<img src="__IMG__/ssg/login/password.png">
<input type="password" placeholder="请输入6-12位自字母组合密码" value="">
<input id="regpassword" type="password" placeholder="请输入6-12位自字母组合密码" value="">
</div>
<div class="formitem">
<img src="__IMG__/ssg/login/password.png">
<input type="password" placeholder="请再次确认输入密码" value="">
<input id="regpassword2" type="password" placeholder="请再次确认输入密码" value="">
</div>
<!---按钮-->
<div
style="display: flex;width:100%;margin:.22rem auto 0;justify-content:center;align-items:center;font-size: .32rem;text-align: center;line-height:1.1rem;color: #fff;">
<div
<div id="userreg"
style="background: url('__IMG__/ssg/login/bigbuttonbg.png') no-repeat top center/cover;width: 5.6rem;height: 1.4rem;">
立即注册
</div>
@ -306,6 +306,45 @@
})
//倒计时
var codeflag = true;
//手机注册按钮
$("#phonereg").on("click",function(){
var phone = $('#phoneval').val();
var phonepassword = $('#phonepassword').val();
var phonecode = $('#phonecode').val();
var promoteId = $("#promote_id").val();
if(!checkPhone(phone)){
return false;
}
if(phonepassword.length < 6 || phonepassword.length > 15){
alert('密码长度6-15个字符');
return false;
}
if(phonecode == ''){
alert('请输入验证码');
return false;
}
$.ajax({
type: 'POST',
url: 'mobile.php?s=/Ssg/phoneRegister.html',
dataType: 'JSON',
data:{
account:phone,
password:phonepassword,
code:phonecode,
promote_id:promoteId
},
success: function (result) {
console.log(result)
if (result.return_code == 'fail') {
alert(result.return_msg);
} else {
//成功
alert("注册并登陆成功");
window.location.href = "mobile.php?s=/Ssg/index.html"
}
}
})
})
//获取手机验证码
$("#getPhoneCode").on("click",function(){
//获取手机
@ -345,6 +384,46 @@
}
setTimeout('countDown()',1000);
}
//普通注册
$("#userreg").on("click",function(){
var account = $('#regaccount').val();
var regpassword = $('#regpassword').val();
var regpassword2 = $("#regpassword2").val();
var promoteId = $("#promote_id").val();
if(account.length < 6 || account.length > 12){
alert('账号必须是6-12位字母数字组合');
return false;
}
if(regpassword.length < 6 || regpassword.length > 15){
alert('密码长度6-15个字符');
return false;
}
if(regpassword != regpassword2){
alert('两次密码不一样');
return false;
}
$.ajax({
type: 'POST',
url: 'mobile.php?s=/Ssg/userRegister.html',
dataType: 'JSON',
data:{
account:account,
password:regpassword,
promote_id:promoteId
},
success: function (result) {
console.log(result)
if (result.return_code == 'fail') {
alert(result.return_msg);
} else {
//成功
alert("注册并登陆成功");
window.location.href = "mobile.php?s=/Ssg/index.html"
}
}
})
})
//验证手机
function checkPhone(phone){
if(!(/^1[3456789]\d{9}$/.test(phone))){

@ -73,8 +73,23 @@ body{
</div>
</div>
</div>
<!-- 微信回调弹框 -->
<div id="alert_box" style="height: 100vh;background:rgba(41,41,41,.8);position:fixed;z-index:9999;top: 0px;width: 100%;">
<div style="top:50%;margin-top: -1.5rem;position: fixed;width: 6.3rem;left: 50%;margin-left: -3.2rem;background-color: #fff;border-radius:.3rem;">
<img onclick="closeAlert()" src="__IMG__/ssg/alipay/close.png" style="width: .3rem;height: .3rem;position: absolute;left: .3rem;top: .3rem;">
<div style="line-height:1.4rem;font-size:.32rem;text-align: center;">
请确认微信支付是否已完成
</div>
<a href="javascript:" style="line-height:1rem;font-size:.28rem;text-align: center;color: red;width: 100%;display: block;border-top: 1px solid #f5f5f5;border-bottom: 1px solid #f5f5f5;">
已完成支付
</a>
<a href="javascript:" style="line-height:1rem;font-size:.28rem;text-align: center;color: #A9A9A9;width: 100%;display: block;">
支付遇到问题,重新支付
</a>
</div>
</div>
<!-- 触屏订单通道 -->
<div class="m-order hidden" style="min-height: 100vh;">
<div class="m-order hidden">
<div style="padding: .3rem;">
<div style="width: 6.9rem;height: 1.7rem;background-color: #fff;border-radius:10px;margin: auto;font-size: .28rem;color:#292929;">
<div style="display: flex;height: .8rem; justify-content: space-between;align-items:center;padding: 0 .3rem;">
@ -86,7 +101,6 @@ body{
<div>{$price}元</div>
</div>
</div>
</div>
<div class="m-order-payinfo" style="width: 6.9rem;margin:auto;border-radius:10px;border: 0px;">
<div class="payinfo-tit" style="display: flex;justify-content: space-between;">
@ -140,5 +154,11 @@ body{
return false;
}
}
function closeAlert(){
$("#alert_box").hide();
}
function showAlert(){
$("#alert_box").show();
}
</script>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

Loading…
Cancel
Save