正在显示
10 个修改的文件
包含
471 行增加
和
58 行删除
@@ -10,6 +10,7 @@ namespace app\admin\controller; | @@ -10,6 +10,7 @@ namespace app\admin\controller; | ||
10 | 10 | ||
11 | 11 | ||
12 | use app\admin\model\HospitalModel; | 12 | use app\admin\model\HospitalModel; |
13 | +use app\admin\model\JobModel; | ||
13 | use app\admin\model\OfficeModel; | 14 | use app\admin\model\OfficeModel; |
14 | use cmf\controller\AdminBaseController; | 15 | use cmf\controller\AdminBaseController; |
15 | use think\db; | 16 | use think\db; |
@@ -210,6 +211,48 @@ class HospitalController extends AdminBaseController | @@ -210,6 +211,48 @@ class HospitalController extends AdminBaseController | ||
210 | return $this->fetch(); | 211 | return $this->fetch(); |
211 | } | 212 | } |
212 | } | 213 | } |
214 | + /** | ||
215 | + * @adminMenu( | ||
216 | + * 'name' => '职位管理', | ||
217 | + * 'parent' => 'default', | ||
218 | + * 'display'=> true, | ||
219 | + * 'hasView'=> true, | ||
220 | + * 'order' => 10000, | ||
221 | + * 'icon' => '', | ||
222 | + * 'remark' => '', | ||
223 | + * 'param' => '' | ||
224 | + * ) | ||
225 | + */ | ||
226 | + public function job(){ | ||
227 | + $Job=new JobModel(); | ||
228 | + $jobs=$Job->getJOb()->toArray(); | ||
229 | + $this->assign('jobs',$jobs); | ||
230 | + return $this->fetch(); | ||
231 | + } | ||
232 | + /** | ||
233 | + * @adminMenu( | ||
234 | + * 'name' => '职位添加', | ||
235 | + * 'parent' => 'default', | ||
236 | + * 'display'=> false, | ||
237 | + * 'hasView'=> false, | ||
238 | + * 'order' => 10000, | ||
239 | + * 'icon' => '', | ||
240 | + * 'remark' => '', | ||
241 | + * 'param' => '' | ||
242 | + * ) | ||
243 | + */ | ||
244 | + public function jobAdd(){ | ||
245 | + if (\request()->isAjax()){ | ||
246 | + $insert=input('name'); | ||
247 | + $Job=new JobModel(); | ||
248 | + $result=$Job->addJob($insert); | ||
249 | + if ($result==1){ | ||
250 | + $this->success('添加成功!'); | ||
251 | + } | ||
252 | + $this->error('添加失败!'); | ||
253 | + } | ||
254 | + return $this->fetch(); | ||
255 | + } | ||
213 | 256 | ||
214 | 257 | ||
215 | 258 |
@@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
9 | namespace app\admin\model; | 9 | namespace app\admin\model; |
10 | 10 | ||
11 | 11 | ||
12 | +use think\Db; | ||
12 | use think\Model; | 13 | use think\Model; |
13 | use traits\model\SoftDelete; | 14 | use traits\model\SoftDelete; |
14 | 15 | ||
@@ -87,10 +88,9 @@ class HospitalModel extends Model | @@ -87,10 +88,9 @@ class HospitalModel extends Model | ||
87 | */ | 88 | */ |
88 | public function getHospitalByPaltform($platform){ | 89 | public function getHospitalByPaltform($platform){ |
89 | $map['platform_id']=$platform; | 90 | $map['platform_id']=$platform; |
90 | - $info=view('platform_info')->field('hospital_name,hospital_id')->where($map)->select(); | 91 | + $info=db('platform_info_view')->field('hospital_name,hospital_id')->where($map)->select(); |
91 | return $info; | 92 | return $info; |
92 | } | 93 | } |
93 | - | ||
94 | /** | 94 | /** |
95 | * 通过 平台 医院获取科室 | 95 | * 通过 平台 医院获取科室 |
96 | * @param $platform 平台id | 96 | * @param $platform 平台id |
@@ -100,7 +100,8 @@ class HospitalModel extends Model | @@ -100,7 +100,8 @@ class HospitalModel extends Model | ||
100 | public function getOfficeByHP($platform,$hospital){ | 100 | public function getOfficeByHP($platform,$hospital){ |
101 | $map['platform_id']=$platform; | 101 | $map['platform_id']=$platform; |
102 | $map['hospital_id']=$hospital; | 102 | $map['hospital_id']=$hospital; |
103 | - $info=view('platform_info')->field('office_name,office_id')->where($map)->select(); | 103 | + |
104 | + $info=\db('platform_info_view')->field('office_name,office_id')->where($map)->select(); | ||
104 | return $info; | 105 | return $info; |
105 | } | 106 | } |
106 | 107 | ||
@@ -115,7 +116,9 @@ class HospitalModel extends Model | @@ -115,7 +116,9 @@ class HospitalModel extends Model | ||
115 | return $info; | 116 | return $info; |
116 | } | 117 | } |
117 | 118 | ||
119 | + public function getJob(){ | ||
118 | 120 | ||
121 | + } | ||
119 | 122 | ||
120 | 123 | ||
121 | 124 |
app/admin/model/JobModel.php
0 → 100644
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by PhpStorm. | ||
4 | + * auther: sgj | ||
5 | + * Date: 2018/12/4 | ||
6 | + * Time: 14:49 | ||
7 | + */ | ||
8 | + | ||
9 | +namespace app\admin\model; | ||
10 | +use think\Model; | ||
11 | +use traits\model\SoftDelete; | ||
12 | + | ||
13 | +class JobModel extends Model | ||
14 | +{ | ||
15 | + use SoftDelete; | ||
16 | + protected $deleteTime = 'delete_time'; | ||
17 | + protected $insert =['addtime']; | ||
18 | + | ||
19 | + public function getJob($jobId=''){ | ||
20 | + if (!empty($jobId)){ | ||
21 | + $map['id']=$jobId; | ||
22 | + }else{ | ||
23 | + $map=''; | ||
24 | + } | ||
25 | + $job=$this->where($map)->select(); | ||
26 | + return $job; | ||
27 | + } | ||
28 | + | ||
29 | + public function addJob($name){ | ||
30 | + $data['name']=$name; | ||
31 | + $return=$this->insert($data); | ||
32 | + return $return; | ||
33 | + } | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | +} |
app/admin/validate/RegisterValidate.php
0 → 100644
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by PhpStorm. | ||
4 | + * auther: sgj | ||
5 | + * Date: 2018/12/4 | ||
6 | + * Time: 16:21 | ||
7 | + */ | ||
8 | + | ||
9 | +namespace app\admin\validate; | ||
10 | + | ||
11 | +use think\Validate; | ||
12 | + | ||
13 | +class RegisterValidate extends Validate | ||
14 | +{ | ||
15 | + | ||
16 | + protected $rule = [ | ||
17 | + 'platform' => 'require|integer', | ||
18 | + 'hospital' => 'require|integer', | ||
19 | + 'office' => 'require|integer', | ||
20 | + 'user_name' => 'require', | ||
21 | + 'tel'=>'require|/^1[34578]\d{9}$/', | ||
22 | + 'job'=>'require|integer', | ||
23 | + 'province'=>'require', | ||
24 | + 'city'=>'require', | ||
25 | + 'town'=>'require', | ||
26 | + ]; | ||
27 | + | ||
28 | + protected $message = [ | ||
29 | + 'user_name.require' => '姓名不能为空', | ||
30 | + 'platform' => '平台信息错误', | ||
31 | + 'hospital' => '医院信息错误', | ||
32 | + 'office' => '科室信息错误', | ||
33 | + 'tel'=>'手机号错误', | ||
34 | + 'job'=>'职位必填', | ||
35 | + 'province'=>'省为必填项', | ||
36 | + 'city'=>'城市为必填项', | ||
37 | + ]; | ||
38 | + | ||
39 | +} |
@@ -9,10 +9,12 @@ | @@ -9,10 +9,12 @@ | ||
9 | namespace app\portal\controller; | 9 | namespace app\portal\controller; |
10 | 10 | ||
11 | use app\admin\model\HospitalModel; | 11 | use app\admin\model\HospitalModel; |
12 | +use app\admin\model\JobModel; | ||
12 | use app\user\model\UserModel; | 13 | use app\user\model\UserModel; |
13 | use cmf\controller\HomeBaseController; | 14 | use cmf\controller\HomeBaseController; |
14 | use EasyWeChat\Foundation\Application; | 15 | use EasyWeChat\Foundation\Application; |
15 | use cmf\controller\WeChatBaseController; | 16 | use cmf\controller\WeChatBaseController; |
17 | +use think\Log; | ||
16 | 18 | ||
17 | 19 | ||
18 | class IndexController extends WeChatBaseController | 20 | class IndexController extends WeChatBaseController |
@@ -30,10 +32,79 @@ class IndexController extends WeChatBaseController | @@ -30,10 +32,79 @@ class IndexController extends WeChatBaseController | ||
30 | 32 | ||
31 | public function register() | 33 | public function register() |
32 | { | 34 | { |
33 | - $Hospital=new HospitalModel(); | ||
34 | - $platform=$Hospital->getPlatment()->toArray(); | ||
35 | - $this->assign('platform',$platform); | ||
36 | - return $this->fetch(); | 35 | + /*检查用户是否注册成功*/ |
36 | + | ||
37 | + $Hospital = new HospitalModel(); | ||
38 | + $platform = $Hospital->getPlatment()->toArray(); | ||
39 | + $Job = new JobModel(); | ||
40 | + $jobs = $Job->getJob()->toArray(); | ||
41 | + $this->assign('jobs', $jobs); | ||
42 | + $this->assign('platform', $platform); | ||
43 | + return $this->fetch(); | ||
44 | + } | ||
45 | + | ||
46 | + public function registerPost(){ | ||
47 | + $info=input(); | ||
48 | + /*验证验证码*/ | ||
49 | + $check=cmf_check_verification_code($info['tel'], $info['verify_code'], $clear = false); | ||
50 | + if (!empty($check)){ | ||
51 | + $this->error($check); | ||
52 | + } | ||
53 | + /*验证器检查参数*/ | ||
54 | + $result = $this->validate($info, 'admin/Register'); | ||
55 | + if ($result !== true) { | ||
56 | + $this->error($result); | ||
57 | + } | ||
58 | + /*查找openid用户进行添加信息*/ | ||
59 | + $user_id=cmf_get_current_user_id(); | ||
60 | + if (empty($user_id)){ | ||
61 | + $this->error('内部错误'); | ||
62 | + }else{ | ||
63 | + /*添加相应的信息到用户表*/ | ||
64 | + $insert['paltform']=$info['platform']; | ||
65 | + $insert['hospital']=$info['hospital']; | ||
66 | + $insert['office']=$info['office']; | ||
67 | + $insert['job']=$info['job']; | ||
68 | + $insert['province']=$info['province']; | ||
69 | + $insert['city']=$info['city']; | ||
70 | + $insert['town']=$info['town']; | ||
71 | + $insert['mobile']=$info['tel']; | ||
72 | + $insert['user_login']=$info['user_name']; | ||
73 | + $User=new UserModel(); | ||
74 | + $result=$User->register($user_id,$insert); | ||
75 | + if ($result==1){ | ||
76 | + $this->success('注册成功!'); | ||
77 | + }else{ | ||
78 | + $this->error('注册失败!'); | ||
79 | + } | ||
80 | + } | ||
81 | + | ||
82 | + } | ||
83 | + | ||
84 | + /** | ||
85 | + * 发送短信验证码 | ||
86 | + * @param $tel | ||
87 | + */ | ||
88 | + public function sendVerifyCode(){ | ||
89 | + $tel=input('tel'); | ||
90 | + $code=cmf_get_verification_code($tel, $length = 6); | ||
91 | + $text='您好,您的验证为'.$code; | ||
92 | + $data = array( | ||
93 | + 'content' => $text, | ||
94 | + 'mobile' => $tel, | ||
95 | + 'productid' => '676767', | ||
96 | + 'xh' => '' | ||
97 | + ); | ||
98 | + $return=send_sms($data); | ||
99 | + $ret=explode(',',$return); | ||
100 | + if ($ret[0]=='1'){ | ||
101 | + cmf_verification_code_log($tel,$code); | ||
102 | + $this->success('验证码已经发送成功'); | ||
103 | + }else{ | ||
104 | + $info=date('Y-m-d H:i:s')." 短信发送失败 error:".$return; | ||
105 | + Log::write($info,'ERROR'); | ||
106 | + $this->error('短信发送失败!'); | ||
107 | + } | ||
37 | } | 108 | } |
38 | 109 | ||
39 | /** | 110 | /** |
@@ -52,5 +123,38 @@ class IndexController extends WeChatBaseController | @@ -52,5 +123,38 @@ class IndexController extends WeChatBaseController | ||
52 | return $this->fetch(); | 123 | return $this->fetch(); |
53 | } | 124 | } |
54 | 125 | ||
126 | + /** | ||
127 | + * 获取平台下的医院 | ||
128 | + * @throws \think\db\exception\DataNotFoundException | ||
129 | + * @throws \think\db\exception\ModelNotFoundException | ||
130 | + * @throws \think\exception\DbException | ||
131 | + */ | ||
132 | + public function getHospital(){ | ||
133 | + $platform=input('platform'); | ||
134 | + if(empty($platform)){ | ||
135 | + $this->error(); | ||
136 | + } | ||
137 | + $Hospital=new HospitalModel(); | ||
138 | + $hospital=$Hospital->getHospitalByPaltform($platform); | ||
139 | + $this->success('','',$hospital); | ||
140 | + } | ||
141 | + | ||
142 | + public function getOffice(){ | ||
143 | + $platform_id=input('platform_id'); | ||
144 | + $hospital_id=input('hospital_id'); | ||
145 | + | ||
146 | + if (empty($platform_id)||empty($hospital_id)){ | ||
147 | + $this->error('缺少参数'); | ||
148 | + } | ||
149 | + $Hospital=new HospitalModel(); | ||
150 | + $office=$Hospital->getOfficeByHP($platform_id,$hospital_id); | ||
151 | + | ||
152 | + $this->success('','',$office); | ||
153 | + } | ||
154 | + | ||
155 | + public function getJob(){ | ||
156 | + | ||
157 | + } | ||
158 | + | ||
55 | 159 | ||
56 | } | 160 | } |
@@ -338,6 +338,17 @@ class UserModel extends Model | @@ -338,6 +338,17 @@ class UserModel extends Model | ||
338 | return 0; | 338 | return 0; |
339 | } | 339 | } |
340 | 340 | ||
341 | + /** | ||
342 | + * 注册用户 | ||
343 | + * @param $user_id | ||
344 | + * @param $data | ||
345 | + * @return UserModel | ||
346 | + */ | ||
347 | + public function register($user_id,$data){ | ||
348 | + $map['id']=$user_id; | ||
349 | + $return=$this->where($map)->update($data); | ||
350 | + return $return; | ||
351 | + } | ||
341 | 352 | ||
342 | 353 | ||
343 | } | 354 | } |
1 | +<include file="public@header"/> | ||
2 | +</head> | ||
3 | +<body> | ||
4 | +<div class="wrap"> | ||
5 | + <ul class="nav nav-tabs"> | ||
6 | + <li class="active"><a href="">职位管理</a></li> | ||
7 | + <li><a href="{:url('jobAdd')}">添加职位</a></li> | ||
8 | + </ul> | ||
9 | + <form method="post" class="js-ajax-form margin-top-20"> | ||
10 | + <div class="table-actions"> | ||
11 | + <!--<button type="submit" class="btn btn-primary btn-sm js-ajax-submit">{:lang('SORT')}</button>--> | ||
12 | + </div> | ||
13 | + <table class="table table-hover table-bordered table-list"> | ||
14 | + <thead> | ||
15 | + <tr> | ||
16 | + <th width="50">ID</th> | ||
17 | + <th>标签名称</th> | ||
18 | + <th>状态</th> | ||
19 | + <th width="160">操作</th> | ||
20 | + </tr> | ||
21 | + </thead> | ||
22 | + <tbody> | ||
23 | + <foreach name="jobs" item="vo"> | ||
24 | + <tr> | ||
25 | + <td>{$vo.id}</td> | ||
26 | + <td>{$vo.name}</td> | ||
27 | + <td><a href="{:url('office',['id'=>$vo.id])}"></a></td> | ||
28 | + <td><a class="js-ajax-delete" href="{:url('jobDel',['id'=>$vo.id])}">删除</a></td> | ||
29 | + </tr> | ||
30 | + </foreach> | ||
31 | + </tbody> | ||
32 | + <tfoot> | ||
33 | + <tr> | ||
34 | + <th width="50">ID</th> | ||
35 | + <th>标签名称</th> | ||
36 | + <th>状态</th> | ||
37 | + <th width="160">操作</th> | ||
38 | + </tr> | ||
39 | + </tfoot> | ||
40 | + </table> | ||
41 | + <div class="table-actions"> | ||
42 | + <!--<button type="submit" class="btn btn-primary btn-sm js-ajax-submit">{:lang('SORT')}</button>--> | ||
43 | + </div> | ||
44 | + </form> | ||
45 | + <ul class="pagination">{$page|default=''}</ul> | ||
46 | +</div> | ||
47 | +<script src="__STATIC__/js/admin.js"></script> | ||
48 | +</body> | ||
49 | +</html> |
1 | +<include file="public@header"/> | ||
2 | +</head> | ||
3 | +<body> | ||
4 | +<div class="wrap js-check-wrap"> | ||
5 | + <ul class="nav nav-tabs"> | ||
6 | + <li ><a href="{:url('job')}">职位管理</a></li> | ||
7 | + <li class="active"><a href="">添加职位</a></li> | ||
8 | + </ul> | ||
9 | + <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('jobAdd')}"> | ||
10 | + | ||
11 | + <div class="form-group"> | ||
12 | + <label class="col-sm-2 control-label"><span class="form-required">*</span>职位名称:</label> | ||
13 | + <div class="col-md-6 col-sm-10"> | ||
14 | + <input type="text" class="form-control" name="name" value=""> | ||
15 | + </div> | ||
16 | + </div> | ||
17 | + | ||
18 | + <div class="col-sm-offset-2 col-sm-10"> | ||
19 | + <button type="submit" class="btn btn-primary js-ajax-submit">{:lang("SAVE")}</button> | ||
20 | + <a class="btn btn-default" href="__URL__">返回</a> | ||
21 | + </div> | ||
22 | + | ||
23 | + </form> | ||
24 | + | ||
25 | +</div> | ||
26 | +<script src="__STATIC__/js/admin.js"></script> | ||
27 | +</body> | ||
28 | +</html> |
@@ -121,6 +121,8 @@ | @@ -121,6 +121,8 @@ | ||
121 | </style> | 121 | </style> |
122 | 122 | ||
123 | <script type="application/javascript"> | 123 | <script type="application/javascript"> |
124 | + | ||
125 | + | ||
124 | $(document).ready(function () { | 126 | $(document).ready(function () { |
125 | $('.mask_box').hide() | 127 | $('.mask_box').hide() |
126 | $('.form_popup_box').hide() | 128 | $('.form_popup_box').hide() |
@@ -129,6 +131,36 @@ $(document).ready(function () { | @@ -129,6 +131,36 @@ $(document).ready(function () { | ||
129 | //获取短信验证码 | 131 | //获取短信验证码 |
130 | var validCode = true; | 132 | var validCode = true; |
131 | $(".getCode").click(function () { | 133 | $(".getCode").click(function () { |
134 | + /*验证信息*/ | ||
135 | + var phone_num = $('#phone_num').val(); | ||
136 | + if (phone_num == '') { | ||
137 | + $('.form_popup_box').show() | ||
138 | + $('.form_popup_box').text('手机号不能为空') | ||
139 | + $('.form_popup_box').delay(1000).hide(0); | ||
140 | + return; | ||
141 | + } | ||
142 | + | ||
143 | + | ||
144 | + $.ajax({ | ||
145 | + url:'{:url('sendVerifyCode')}', | ||
146 | + type:'POST', | ||
147 | + data:{ | ||
148 | + tel:phone_num | ||
149 | + }, | ||
150 | + success:function(res) { | ||
151 | + console.log(res) | ||
152 | + if (res.code==1){ | ||
153 | + $('.form_popup_box').show() | ||
154 | + $('.form_popup_box').text('验证码发送成功') | ||
155 | + $('.form_popup_box').delay(1000).hide(0); | ||
156 | + } else { | ||
157 | + $('.form_popup_box').show() | ||
158 | + $('.form_popup_box').text(res.msg) | ||
159 | + $('.form_popup_box').delay(1000).hide(0); | ||
160 | + } | ||
161 | + } | ||
162 | + }) | ||
163 | + | ||
132 | var time = 60; | 164 | var time = 60; |
133 | var $code = $(this); | 165 | var $code = $(this); |
134 | if (validCode) { | 166 | if (validCode) { |
@@ -152,76 +184,117 @@ $(document).ready(function () { | @@ -152,76 +184,117 @@ $(document).ready(function () { | ||
152 | </volist> | 184 | </volist> |
153 | ], { | 185 | ], { |
154 | onChange: function (res) { | 186 | onChange: function (res) { |
155 | - console.log(res) | 187 | + $('#hospital').val('') |
188 | + $('#department').val('') | ||
156 | }, | 189 | }, |
157 | onConfirm: function (res) { | 190 | onConfirm: function (res) { |
158 | - console.log('11111'); | ||
159 | - var platform=$('#platform').val(res[0].label) | ||
160 | - console.log(platform); | ||
161 | - console.log(res); | ||
162 | - } | ||
163 | - } | ||
164 | - ) | ||
165 | - }) | ||
166 | - $('.hospital_item').click(function () { | 191 | + var platform=$('#platform').val(res[0].label) |
192 | + $('#platform').data('data-id',res[0].value) | ||
193 | + var platform=res[0].value; | ||
194 | + $.ajax({ | ||
195 | + url:'{:url('getHospital','','',true)}', | ||
196 | + type:'POST', | ||
197 | + data:{ | ||
198 | + 'platform':platform, | ||
199 | + }, | ||
200 | + success:function(res){ | ||
201 | + $('.hospital_item').click(function () { | ||
167 | 202 | ||
168 | - console.log($('.platform_item').html()) | ||
169 | - weui.picker([ | 203 | + var hospital=new Array(); |
204 | + for(var i=0;i<res.data.length;i++){ | ||
205 | + var one=new Object(); | ||
206 | + one.value=res.data[i].hospital_id; | ||
207 | + one.label=res.data[i].hospital_name; | ||
208 | + hospital.push(one) | ||
209 | + } | ||
210 | + weui.picker( | ||
211 | + hospital | ||
212 | + , { | ||
213 | + onChange: function (res) { | ||
214 | + $('#department').val('') | ||
215 | + }, | ||
216 | + onConfirm: function (res) { | ||
217 | + $('#hospital').val(res[0].label) | ||
218 | + $('#hospital').data('data-id',res[0].value) | ||
219 | + console.log(res) | ||
220 | + var hospital_id=res[0].value; | ||
221 | + $.ajax({ | ||
222 | + url:'{:url('getOffice','','',true)}', | ||
223 | + type:'POST', | ||
224 | + data:{ | ||
225 | + 'platform_id':platform, | ||
226 | + 'hospital_id':hospital_id, | ||
227 | + }, | ||
228 | + success:function(res){ | ||
229 | + $('.department_item').click(function () { | ||
170 | 230 | ||
171 | - {label: '医院1', value: 0}, | ||
172 | - {label: '医院2', value: 1}, | ||
173 | - {label: '医院3', value: 2}, | 231 | + var office=new Array(); |
232 | + for(var i=0;i<res.data.length;i++){ | ||
233 | + var one=new Object(); | ||
234 | + one.value=res.data[i].office_id; | ||
235 | + one.label=res.data[i].office_name; | ||
236 | + office.push(one) | ||
237 | + } | ||
174 | 238 | ||
239 | + weui.picker(office, { | ||
240 | + onChange: function (res) { | ||
241 | + | ||
242 | + }, | ||
243 | + onConfirm: function (res) { | ||
244 | + $('#department').val(res[0].label) | ||
245 | + $('#department').data('data-id',res[0].value) | ||
246 | + } | ||
247 | + } | ||
248 | + ) | ||
249 | + }) | ||
250 | + | ||
251 | + } | ||
252 | + | ||
253 | + }) | ||
254 | + } | ||
255 | + } | ||
256 | + ) | ||
257 | + }) | ||
258 | + } | ||
259 | + }); | ||
175 | 260 | ||
176 | - ], { | ||
177 | - onChange: function (res) { | ||
178 | - console.log(res) | ||
179 | - }, | ||
180 | - onConfirm: function (res) { | ||
181 | - $('#hospital').val(res[0].label) | ||
182 | - } | ||
183 | - } | ||
184 | - ) | ||
185 | - }) | ||
186 | - $('.department_item').click(function () { | ||
187 | - weui.picker([ | ||
188 | - {label: '科室1', value: 0}, | ||
189 | - {label: '科室2', value: 1}, | ||
190 | - {label: '科室3', value: 2}, | ||
191 | - ], { | ||
192 | - onChange: function (res) { | ||
193 | - console.log(res) | ||
194 | - }, | ||
195 | - onConfirm: function (res) { | ||
196 | - $('#department').val(res[0].label) | ||
197 | } | 261 | } |
198 | } | 262 | } |
199 | ) | 263 | ) |
200 | }) | 264 | }) |
265 | + | ||
266 | + | ||
201 | $('.position_item').click(function () { | 267 | $('.position_item').click(function () { |
202 | weui.picker([ | 268 | weui.picker([ |
203 | - {label: '职务1', value: 0}, | ||
204 | - {label: '职务2', value: 1}, | ||
205 | - {label: '职务3', value: 2}, | 269 | + <volist name='jobs' id='vo'> |
270 | + {label: '{$vo.name}', value: {$vo.id}}, | ||
271 | + </volist> | ||
206 | ], { | 272 | ], { |
207 | onChange: function (res) { | 273 | onChange: function (res) { |
208 | console.log(res) | 274 | console.log(res) |
209 | }, | 275 | }, |
210 | onConfirm: function (res) { | 276 | onConfirm: function (res) { |
211 | $('#position').val(res[0].label) | 277 | $('#position').val(res[0].label) |
278 | + $('#position').data('data-id',res[0].value) | ||
212 | } | 279 | } |
213 | } | 280 | } |
214 | ) | 281 | ) |
215 | }) | 282 | }) |
216 | 283 | ||
217 | $('.register_btn').click(function () { | 284 | $('.register_btn').click(function () { |
285 | + var platform=$('#platform').data('data-id') | ||
286 | + var hospital=$('#hospital').data('data-id') | ||
287 | + var office=$('#department').data('data-id') | ||
288 | + var position=$('#position').data('data-id') | ||
289 | + | ||
290 | + | ||
218 | var user_name = $('#user_name').val() | 291 | var user_name = $('#user_name').val() |
219 | var phone_num = $('#phone_num').val() | 292 | var phone_num = $('#phone_num').val() |
220 | var verify_code = $('#verify_code').val() | 293 | var verify_code = $('#verify_code').val() |
221 | - var platform = $('#platform').val() | ||
222 | - var hospital = $('#hospital').val() | ||
223 | - var department = $('#department').val() | ||
224 | - var position = $('#position').val() | 294 | + // var platform = $('#platform').val() |
295 | + // var hospital = $('#hospital').val() | ||
296 | + // var department = $('#department').val() | ||
297 | + // var position = $('#position').val() | ||
225 | var province = $('#province').val() | 298 | var province = $('#province').val() |
226 | var city = $('#city').val() | 299 | var city = $('#city').val() |
227 | var town = $('#town').val() | 300 | var town = $('#town').val() |
@@ -235,7 +308,7 @@ $(document).ready(function () { | @@ -235,7 +308,7 @@ $(document).ready(function () { | ||
235 | $('.form_popup_box').delay(1000).hide(0); | 308 | $('.form_popup_box').delay(1000).hide(0); |
236 | } else if (verify_code == '') { | 309 | } else if (verify_code == '') { |
237 | $('.form_popup_box').show() | 310 | $('.form_popup_box').show() |
238 | - $('.form_popup_box').text('密码不能为空') | 311 | + $('.form_popup_box').text('验证码码不能为空') |
239 | $('.form_popup_box').delay(1000).hide(0); | 312 | $('.form_popup_box').delay(1000).hide(0); |
240 | } else if (platform == '') { | 313 | } else if (platform == '') { |
241 | $('.form_popup_box').show() | 314 | $('.form_popup_box').show() |
@@ -258,7 +331,7 @@ $(document).ready(function () { | @@ -258,7 +331,7 @@ $(document).ready(function () { | ||
258 | $('.form_popup_box').text('省份不能为空') | 331 | $('.form_popup_box').text('省份不能为空') |
259 | $('.form_popup_box').delay(1000).hide(0); | 332 | $('.form_popup_box').delay(1000).hide(0); |
260 | } else if (city == '请选择') { | 333 | } else if (city == '请选择') { |
261 | - $('.form_popup_box').show() | 334 | + |
262 | $('.form_popup_box').text('城市不能为空') | 335 | $('.form_popup_box').text('城市不能为空') |
263 | $('.form_popup_box').delay(1000).hide(0); | 336 | $('.form_popup_box').delay(1000).hide(0); |
264 | } else if (town == '请选择') { | 337 | } else if (town == '请选择') { |
@@ -266,11 +339,36 @@ $(document).ready(function () { | @@ -266,11 +339,36 @@ $(document).ready(function () { | ||
266 | $('.form_popup_box').text('区县不能为空') | 339 | $('.form_popup_box').text('区县不能为空') |
267 | $('.form_popup_box').delay(1000).hide(0); | 340 | $('.form_popup_box').delay(1000).hide(0); |
268 | } else { | 341 | } else { |
269 | - $('.success').show().delay(2000).hide(2) | ||
270 | - // $('.first').show().delay(2000).hide(2) | ||
271 | - // setTimeout(function () { | ||
272 | - // $('.success').show().delay(2000).hide(2) | ||
273 | - // },2000); | 342 | + $.ajax({ |
343 | + url:'{:url('registerPost')}', | ||
344 | + type:'POST', | ||
345 | + data:{ | ||
346 | + platform:platform, | ||
347 | + hospital:hospital, | ||
348 | + office:office, | ||
349 | + user_name:user_name, | ||
350 | + tel:phone_num, | ||
351 | + verify_code:verify_code, | ||
352 | + job:position, | ||
353 | + province:province, | ||
354 | + city:city, | ||
355 | + town:town, | ||
356 | + }, | ||
357 | + success:function(res) { | ||
358 | + console.log(res) | ||
359 | + if (res.code==1){ | ||
360 | + $('.success').show().delay(2000).hide(2); | ||
361 | + window.location.href='{:url('/')}' | ||
362 | + }else { | ||
363 | + $('.form_popup_box').show() | ||
364 | + $('.form_popup_box').text(res.msg) | ||
365 | + $('.form_popup_box').delay(1000).hide(0); | ||
366 | + } | ||
367 | + } | ||
368 | + }) | ||
369 | + | ||
370 | + | ||
371 | + | ||
274 | } | 372 | } |
275 | } | 373 | } |
276 | ) | 374 | ) |
@@ -205,7 +205,7 @@ class WeChatBaseController extends BaseController | @@ -205,7 +205,7 @@ class WeChatBaseController extends BaseController | ||
205 | */ | 205 | */ |
206 | public function checkWeChatUserLogin() | 206 | public function checkWeChatUserLogin() |
207 | { | 207 | { |
208 | - session('user.id',2); | 208 | + session('user.id',8); |
209 | $userId = cmf_get_current_user_id(); | 209 | $userId = cmf_get_current_user_id(); |
210 | 210 | ||
211 | if (empty($userId)) { | 211 | if (empty($userId)) { |
-
请 注册 或 登录 后发表评论