作者 anyv

Merge branch 'master' of http://114.215.101.231:8099/anyv/xkeasy

@@ -34,6 +34,7 @@ class ShareController extends WeChatBaseController @@ -34,6 +34,7 @@ class ShareController extends WeChatBaseController
34 } 34 }
35 if(empty($my_user['phone'])){ 35 if(empty($my_user['phone'])){
36 $this->error('跳转补全信息页面','','',''); 36 $this->error('跳转补全信息页面','','','');
  37 + $this->redirect('information');
37 } 38 }
38 //判断有没有生成过 39 //判断有没有生成过
39 if(!file_exists('./upload/poster/poster_'.$user_id.".png")){ 40 if(!file_exists('./upload/poster/poster_'.$user_id.".png")){
@@ -67,6 +68,28 @@ class ShareController extends WeChatBaseController @@ -67,6 +68,28 @@ class ShareController extends WeChatBaseController
67 $this->assign('share_image',$share_image); 68 $this->assign('share_image',$share_image);
68 return $this->fetch(); 69 return $this->fetch();
69 } 70 }
  71 + public function information(){
  72 + $user_id = cmf_get_current_user_id();
  73 + $data = Db::name('my_user')->where(['uid'=>$user_id])->find();
  74 + $this->assign('data',$data);
  75 + return $this->fetch();
  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)->update($param);
  87 + if(empty($result)){
  88 + $this->error('保存失败');
  89 + }else{
  90 + $this->success('保存成功');
  91 + }
  92 + }
70 93
71 /** 94 /**
72 * 分享链接 95 * 分享链接
  1 +<!DOCTYPE html>
  2 +<html lang="en">
  3 +
  4 + <head>
  5 + <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  6 + <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
  7 + <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  8 + <title>学考无忧-补全信息</title>
  9 + <link rel="stylesheet" href="__TMPL__/public/assets/css/reset.css" />
  10 + <link rel="stylesheet" href="__TMPL__/public/assets/css/log.css" />
  11 + <style type="text/css">
  12 + /*log_third页面*/
  13 +
  14 + .log_third_btn {
  15 + position: fixed;
  16 + bottom: 0rem;
  17 + }
  18 + </style>
  19 + </head>
  20 +
  21 + <body>
  22 + <div class="log_top_co">
  23 + <!-- 顶部 -->
  24 + <div class=" order_top log_top_co">
  25 + <a href="">
  26 + <img src="__TMPL__/public/assets/images/left.png" alt="" />
  27 + </a>
  28 + <p>补全信息</p>
  29 + </div>
  30 + </div>
  31 + <div class="log_two_input">
  32 + <div class="log_two_input_one">
  33 + <div class="log_two_input_title">
  34 + 姓名
  35 + </div>
  36 + <div class="log_two_input_contant">
  37 + <input type="text" id="name" value="{$data.name}" placeholder="请输入姓名" />
  38 + </div>
  39 + </div>
  40 + <div class="log_two_input_one">
  41 + <div class="log_two_input_title">
  42 + 手机号
  43 + </div>
  44 + <div class="log_two_input_contant">
  45 + <input type="text" placeholder="请输入手机号" value="{$data.phone}" maxlength="11" id="phone" />
  46 + </div>
  47 + </div>
  48 +
  49 + </div>
  50 +
  51 + <!-- 保存 -->
  52 + <div class="log_two_bottom_btn log_third_btn">
  53 + <a class="save">保存</a>
  54 + </div>
  55 + <script src="__TMPL__/public/assets/js/jquery.js"></script>
  56 + <script src="__TMPL__/public/assets/js/base.js"></script>
  57 +
  58 + <script>
  59 + function checkPhone() {
  60 +
  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 + })
  90 + </script>
  91 + </body>
  92 +
  93 +</html>