作者 王晓刚
1 个管道 的构建 通过 耗费 0 秒

合并分支 'wangxiaogang' 到 'master'

补全信息页面



查看合并请求 !78
@@ -74,6 +74,22 @@ class ShareController extends WeChatBaseController @@ -74,6 +74,22 @@ class ShareController extends WeChatBaseController
74 $this->assign('data',$data); 74 $this->assign('data',$data);
75 return $this->fetch(); 75 return $this->fetch();
76 } 76 }
  77 + public function information_save(){
  78 + $param = $this->request->param();
  79 + if(empty($param['name'])){
  80 + $this->error('姓名不能为空');
  81 + }
  82 + if(empty($param['phone'])){
  83 + $this->error('手机号不能为空');
  84 + }
  85 + $user_id = cmf_get_current_user_id();
  86 + $result = Db::name('my_user')->where('uid',$user_id)->insert($param);
  87 + if(empty($result)){
  88 + $this->error('保存失败');
  89 + }else{
  90 + $this->success('保存成功');
  91 + }
  92 + }
77 93
78 /** 94 /**
79 * 分享链接 95 * 分享链接
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 手机号 42 手机号
43 </div> 43 </div>
44 <div class="log_two_input_contant"> 44 <div class="log_two_input_contant">
45 - <input type="text" placeholder="请输入手机号" value="{$data.phone}" maxlength="11" id="phone" onblur="checkPhone()" /> 45 + <input type="text" placeholder="请输入手机号" value="{$data.phone}" maxlength="11" id="phone" />
46 </div> 46 </div>
47 </div> 47 </div>
48 48
@@ -50,24 +50,43 @@ @@ -50,24 +50,43 @@
50 50
51 <!-- 保存 --> 51 <!-- 保存 -->
52 <div class="log_two_bottom_btn log_third_btn"> 52 <div class="log_two_bottom_btn log_third_btn">
53 - <a href="log_first.html">保存</a> 53 + <a class="save">保存</a>
54 </div> 54 </div>
55 <script src="__TMPL__/public/assets/js/jquery.js"></script> 55 <script src="__TMPL__/public/assets/js/jquery.js"></script>
56 <script src="__TMPL__/public/assets/js/base.js"></script> 56 <script src="__TMPL__/public/assets/js/base.js"></script>
57 57
58 <script> 58 <script>
59 function checkPhone() { 59 function checkPhone() {
60 - var name = $('#name').val();  
61 - if(name == ''){  
62 - alert("姓名不能为空");  
63 - return false  
64 - }  
65 - var phone = document.getElementById('phone').value;  
66 - if(!(/^1[34578]\d{9}$/.test(phone))) {  
67 - alert("手机号码有误,请重填");  
68 - return false;  
69 - } 60 +
70 } 61 }
  62 + $('.save').click(function(){
  63 + var name = $('#name').val();
  64 + if(name == ''){
  65 + alert("姓名不能为空");
  66 + return false
  67 + }
  68 + var phone = document.getElementById('phone').value;
  69 + if(!(/^1[34578]\d{9}$/.test(phone))) {
  70 + alert("手机号码有误,请重填");
  71 + return false;
  72 + }
  73 + $.ajax({
  74 + url:"{:url('information_save')}",
  75 + type:"GET",
  76 + data:{'name':name,'phone':phone},
  77 + success:function(res){
  78 + if(res.code == 1){
  79 + alert(res.msg);
  80 + window.location.href = "{:url('share/index')}";
  81 + }else{
  82 + alert(res.msg);
  83 + }
  84 + },
  85 + error:function(res){
  86 + alert('与服务器断开连接');
  87 + }
  88 + })
  89 + })
71 </script> 90 </script>
72 </body> 91 </body>
73 92