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

问题文档修复

@@ -130,24 +130,24 @@ class Index extends Backend @@ -130,24 +130,24 @@ class Index extends Backend
130 } 130 }
131 if ($this->request->isPost()) { 131 if ($this->request->isPost()) {
132 $url = $this->request->get('url', 'index/forget'); 132 $url = $this->request->get('url', 'index/forget');
133 - $email = $this->request->post('email'); 133 + $mobile = $this->request->post('mobile');
134 $rule = [ 134 $rule = [
135 - 'email' => 'require|email', 135 + 'mobile' => 'require',
136 // '__token__' => 'require|token', 136 // '__token__' => 'require|token',
137 ]; 137 ];
138 $data = [ 138 $data = [
139 - 'email' => $email, 139 + 'mobile' => $mobile,
140 // '__token__' => $token, 140 // '__token__' => $token,
141 ]; 141 ];
142 - $validate = new Validate($rule, [], ['email' => __('email')]); 142 + $validate = new Validate($rule, [], ['mobile' => __('mobile')]);
143 $result = $validate->check($data); 143 $result = $validate->check($data);
144 if (!$result) { 144 if (!$result) {
145 $this->error($validate->getError(), $url, ['token' => $this->request->token()]); 145 $this->error($validate->getError(), $url, ['token' => $this->request->token()]);
146 } 146 }
147 - //根据email获取商户信息  
148 - $admin = Db::name('admin')->where(['email'=>$email])->find(); 147 + //根据mobile获取商户信息
  148 + $admin = Db::name('admin')->where(['mobile'=>$mobile])->find();
149 if(empty($admin)){ 149 if(empty($admin)){
150 - $this->error('当前email尚未绑定'); 150 + $this->error('当前手机号尚未绑定');
151 } 151 }
152 if(empty($admin['user_id'])){ 152 if(empty($admin['user_id'])){
153 $this->error('平台管理员忘记密码请联系总管理员'); 153 $this->error('平台管理员忘记密码请联系总管理员');
@@ -158,12 +158,12 @@ class Index extends Backend @@ -158,12 +158,12 @@ class Index extends Backend
158 //生成验证码 158 //生成验证码
159 $code = generateCode(6); 159 $code = generateCode(6);
160 //储存验证码 160 //储存验证码
161 - $admin_code = Db::name('admin_code')->where(['email'=>$email])->find(); 161 + $admin_code = Db::name('admin_code')->where(['mobile'=>$mobile])->find();
162 $arr['code'] = $code; 162 $arr['code'] = $code;
163 $arr['pasttime'] = time()+600; 163 $arr['pasttime'] = time()+600;
164 $arr['is_use'] = 0; 164 $arr['is_use'] = 0;
165 if(empty($admin_code)){ 165 if(empty($admin_code)){
166 - $arr['email'] = $email; 166 + $arr['mobile'] = $mobile;
167 $arr['createtime'] = time(); 167 $arr['createtime'] = time();
168 $result1 = Db::name('admin_code')->insert($arr); 168 $result1 = Db::name('admin_code')->insert($arr);
169 }else{ 169 }else{
@@ -173,13 +173,17 @@ class Index extends Backend @@ -173,13 +173,17 @@ class Index extends Backend
173 if(empty($result1)){ 173 if(empty($result1)){
174 $this->error('sql执行失败'); 174 $this->error('sql执行失败');
175 } 175 }
176 - //发送验证码  
177 - $this->send_ems($admin['email'],$code);  
178 - if ($result) {  
179 - $this->success('发送成功');  
180 - } else { 176 + $content = array(
  177 + 'content' => "【工品达】您的验证码是:" . $code . ",请于10分钟内使用,如非本人操作,可忽略此消息。",//短信内容
  178 + 'mobile' => $mobile,//手机号码
  179 + 'tKey' => time(),
  180 + );
  181 + $result2 = json_decode(send_sms2($content),true);
  182 + if ($result2['code'] != 200) {
  183 + Db::rollback();
181 $this->error('发送失败'); 184 $this->error('发送失败');
182 } 185 }
  186 + $this->success('发送成功');
183 /*AdminLog::setTitle(__('Login')); 187 /*AdminLog::setTitle(__('Login'));
184 $result = $this->auth->login($username, $password, $keeplogin ? 86400 : 0); 188 $result = $this->auth->login($username, $password, $keeplogin ? 86400 : 0);
185 if ($result === true) { 189 if ($result === true) {
@@ -199,7 +203,7 @@ class Index extends Backend @@ -199,7 +203,7 @@ class Index extends Backend
199 return $this->view->fetch(); 203 return $this->view->fetch();
200 } 204 }
201 205
202 - public function send_ems($receiver,$code){ 206 + /*public function send_ems($receiver,$code){
203 \think\Config::set('site', \think\Config::get('site')); 207 \think\Config::set('site', \think\Config::get('site'));
204 $email = new Email(); 208 $email = new Email();
205 $str = "验证码:$code,10分钟内有效。"; 209 $str = "验证码:$code,10分钟内有效。";
@@ -209,7 +213,7 @@ class Index extends Backend @@ -209,7 +213,7 @@ class Index extends Backend
209 ->message($str) 213 ->message($str)
210 ->send(); 214 ->send();
211 return $result; 215 return $result;
212 - } 216 + }*/
213 217
214 /** 218 /**
215 * 验证验证码是否正确 219 * 验证验证码是否正确
@@ -217,24 +221,24 @@ class Index extends Backend @@ -217,24 +221,24 @@ class Index extends Backend
217 public function verify_code(){ 221 public function verify_code(){
218 if ($this->request->isPost()) { 222 if ($this->request->isPost()) {
219 $url = $this->request->get('url', 'index/forget'); 223 $url = $this->request->get('url', 'index/forget');
220 - $email = $this->request->post('email'); 224 + $mobile = $this->request->post('mobile');
221 $code = $this->request->post('code'); 225 $code = $this->request->post('code');
222 $rule = [ 226 $rule = [
223 - 'email' => 'require|email', 227 + 'mobile' => 'require',
224 'code' => 'require', 228 'code' => 'require',
225 // '__token__' => 'require|token', 229 // '__token__' => 'require|token',
226 ]; 230 ];
227 $data = [ 231 $data = [
228 - 'email' => $email, 232 + 'mobile' => $mobile,
229 'code' => $code, 233 'code' => $code,
230 // '__token__' => $token, 234 // '__token__' => $token,
231 ]; 235 ];
232 - $validate = new Validate($rule, [], ['email' => __('email'), 'code' => '请输入验证码']); 236 + $validate = new Validate($rule, [], ['mobile' => __('mobile'), 'code' => '请输入验证码']);
233 $result = $validate->check($data); 237 $result = $validate->check($data);
234 if (!$result) { 238 if (!$result) {
235 $this->error($validate->getError(), $url, ['token' => $this->request->token()]); 239 $this->error($validate->getError(), $url, ['token' => $this->request->token()]);
236 } 240 }
237 - $admin_code = Db::name('admin_code')->where(['email'=>$email])->find(); 241 + $admin_code = Db::name('admin_code')->where(['mobile'=>$mobile])->find();
238 if(empty($admin_code)){ 242 if(empty($admin_code)){
239 $this->error('404'); 243 $this->error('404');
240 } 244 }
@@ -254,8 +258,8 @@ class Index extends Backend @@ -254,8 +258,8 @@ class Index extends Backend
254 //生成令牌(为了安全) 258 //生成令牌(为了安全)
255 $str = "Bronet"; 259 $str = "Bronet";
256 $auth_code = config('auth_code'); 260 $auth_code = config('auth_code');
257 - $token = rawurlencode(sha1(md5($str.$auth_code).md5($email)));  
258 - $this->success('验证通过',url('reset_password',['token'=>$token,'email'=>$email],false,true)); 261 + $token = rawurlencode(sha1(md5($str.$auth_code).md5($mobile)));
  262 + $this->success('验证通过',url('reset_password',['token'=>$token,'email'=>$mobile],false,true));
259 } 263 }
260 } 264 }
261 265
@@ -270,21 +274,21 @@ class Index extends Backend @@ -270,21 +274,21 @@ class Index extends Backend
270 if($this->request->isPost()){ 274 if($this->request->isPost()){
271 $password = $this->request->param('password'); 275 $password = $this->request->param('password');
272 $affirm_password = $this->request->param('affirm_password'); 276 $affirm_password = $this->request->param('affirm_password');
273 - $email = $this->request->param('email'); 277 + $mobile = $this->request->param('mobile');
274 $token = $this->request->param('token'); 278 $token = $this->request->param('token');
275 $rule = [ 279 $rule = [
276 'password' => 'require|length:3,30', 280 'password' => 'require|length:3,30',
277 'affirm_password' => 'require|length:3,30', 281 'affirm_password' => 'require|length:3,30',
278 - 'email' => 'require|email', 282 + 'mobile' => 'require',
279 'token' => 'require', 283 'token' => 'require',
280 ]; 284 ];
281 $data = [ 285 $data = [
282 'password' => $password, 286 'password' => $password,
283 'affirm_password' => $affirm_password, 287 'affirm_password' => $affirm_password,
284 - 'email' => $email, 288 + 'mobile' => $mobile,
285 'token' => $token, 289 'token' => $token,
286 ]; 290 ];
287 - $validate = new Validate($rule, [], ['password' => __('password'), 'affirm_password' => __('Password'), 'email' => __('email')]); 291 + $validate = new Validate($rule, [], ['password' => __('password'), 'affirm_password' => __('Password'), 'mobile' => __('mobile')]);
288 $result = $validate->check($data); 292 $result = $validate->check($data);
289 if (!$result) { 293 if (!$result) {
290 $this->error($validate->getError(), $url, ['token' => $this->request->token()]); 294 $this->error($validate->getError(), $url, ['token' => $this->request->token()]);
@@ -294,11 +298,11 @@ class Index extends Backend @@ -294,11 +298,11 @@ class Index extends Backend
294 } 298 }
295 $str = "Bronet"; 299 $str = "Bronet";
296 $auth_code = config('auth_code'); 300 $auth_code = config('auth_code');
297 - $token2 = rawurlencode(sha1(md5($str.$auth_code).md5($email))); 301 + $token2 = rawurlencode(sha1(md5($str.$auth_code).md5($mobile)));
298 if($token != $token2){ 302 if($token != $token2){
299 $this->error('令牌错误','','',''); 303 $this->error('令牌错误','','','');
300 } 304 }
301 - $admin = Db::name('admin')->where(['email'=>$email])->find(); 305 + $admin = Db::name('admin')->where(['email'=>$mobile])->find();
302 $password = md5(md5($password) . $admin['salt']); 306 $password = md5(md5($password) . $admin['salt']);
303 $result = Db::name('admin')->where(['id'=>$admin['id']])->update(['password'=>$password]); 307 $result = Db::name('admin')->where(['id'=>$admin['id']])->update(['password'=>$password]);
304 if(empty($result)){ 308 if(empty($result)){
@@ -308,10 +312,10 @@ class Index extends Backend @@ -308,10 +312,10 @@ class Index extends Backend
308 $this->success('重置成功',$url); 312 $this->success('重置成功',$url);
309 }else{ 313 }else{
310 $token = $this->request->param('token'); 314 $token = $this->request->param('token');
311 - $email = $this->request->param('email'); 315 + $mobile = $this->request->param('mobile');
312 $str = "Bronet"; 316 $str = "Bronet";
313 $auth_code = config('auth_code'); 317 $auth_code = config('auth_code');
314 - $token2 = rawurlencode(sha1(md5($str.$auth_code).md5($email))); 318 + $token2 = rawurlencode(sha1(md5($str.$auth_code).md5($mobile)));
315 if($token != $token2){ 319 if($token != $token2){
316 $this->error('令牌错误','','',''); 320 $this->error('令牌错误','','','');
317 } 321 }
  1 +<!DOCTYPE html>
  2 +<html lang="en">
  3 +<head>
  4 + {include file="common/meta" /}
  5 +
  6 + <style type="text/css">
  7 + body {
  8 + color:#999;
  9 + background:url('{$background}');
  10 + background-size:cover;
  11 + }
  12 + a {
  13 + color:#fff;
  14 + }
  15 + .login-panel{margin-top:150px;}
  16 + .login-screen {
  17 + max-width:400px;
  18 + padding:0;
  19 + margin:100px auto 0 auto;
  20 +
  21 + }
  22 + .login-screen .well {
  23 + border-radius: 3px;
  24 + -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  25 + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  26 + background: rgba(255,255,255, 0.2);
  27 + }
  28 + .login-screen .copyright {
  29 + text-align: center;
  30 + }
  31 + @media(max-width:767px) {
  32 + .login-screen {
  33 + padding:0 20px;
  34 + }
  35 + }
  36 + .profile-img-card {
  37 + width: 100px;
  38 + height: 100px;
  39 + margin: 10px auto;
  40 + display: block;
  41 + -moz-border-radius: 50%;
  42 + -webkit-border-radius: 50%;
  43 + border-radius: 50%;
  44 + }
  45 + .profile-name-card {
  46 + text-align: center;
  47 + }
  48 +
  49 + #login-form {
  50 + margin-top:20px;
  51 + }
  52 + #login-form .input-group {
  53 + margin-bottom:15px;
  54 + }
  55 +
  56 + </style>
  57 +</head>
  58 +<body>
  59 +<div class="container">
  60 + <div class="login-wrapper">
  61 + <div class="login-screen">
  62 + <div class="well">
  63 + <div class="login-form">
  64 + <p class="profile-name-card"></p>
  65 +
  66 + <form action="" method="post" id="login-form">
  67 + <div id="errtips" class="hide"></div>
  68 + {:token()}
  69 +
  70 + <div class="input-group">
  71 + <div class="input-group-addon"><span class="fa fa-envelope" aria-hidden="true"></span></div>
  72 + <input type="text" class="form-control" id="pd-form-email" placeholder="{:__('Mobile')}" name="mobile" value="" data-rule="{:__('Mobile')}:required;mobile" />
  73 + </div>
  74 +
  75 + {if $config.fastadmin.login_captcha}
  76 + <div class="input-group">
  77 + <div class="input-group-addon"><span class="glyphicon glyphicon-option-horizontal" aria-hidden="true"></span></div>
  78 + <input type="text" name="code" class="form-control" id="code" placeholder="{:__('Captcha')}"/>
  79 + <span class="input-group-addon" style="padding:0;border:none;cursor:pointer;">
  80 + <!--<img src="{:rtrim('__PUBLIC__', '/')}/index.php?s=/captcha" width="100" height="30" onclick="this.src = '{:rtrim('__PUBLIC__', '/')}/index.php?s=/captcha&r=' + Math.random();"/>-->
  81 + <button type="button" class="btn btn-default btn-small btn-block get_code" style="border:0;">发送验证码</button>
  82 + </span>
  83 + </div>
  84 + {/if}
  85 + <div class="form-group button">
  86 + <button type="button" class="btn btn-success btn-lg btn-block affirm">确认</button>
  87 + </div>
  88 + </form>
  89 + </div>
  90 + </div>
  91 + </div>
  92 + </div>
  93 +</div>
  94 +{include file="common/script" /}
  95 +</body>
  96 +</html>
@@ -90,9 +90,9 @@ @@ -90,9 +90,9 @@
90 <input type="checkbox" name="keeplogin" id="keeplogin" value="1" /> 90 <input type="checkbox" name="keeplogin" id="keeplogin" value="1" />
91 {:__('Keep login')} 91 {:__('Keep login')}
92 </label> 92 </label>
93 - <!--<label class="inline pull-right" style="cursor:pointer" onclick="window.location.href='{:url('forget')}'"> 93 + <label class="inline pull-right" style="cursor:pointer" onclick="window.location.href='{:url('forget')}'">
94 忘记密码? 94 忘记密码?
95 - </label>--> 95 + </label>
96 </div> 96 </div>
97 <div class="form-group"> 97 <div class="form-group">
98 <button type="submit" class="btn btn-success btn-lg btn-block">{:__('Sign in')}</button> 98 <button type="submit" class="btn btn-success btn-lg btn-block">{:__('Sign in')}</button>
  1 +<!DOCTYPE html>
  2 +<html lang="en">
  3 +<head>
  4 + {include file="common/meta" /}
  5 +
  6 + <style type="text/css">
  7 + body {
  8 + color:#999;
  9 + background:url('{$background}');
  10 + background-size:cover;
  11 + }
  12 + a {
  13 + color:#fff;
  14 + }
  15 + .login-panel{margin-top:150px;}
  16 + .login-screen {
  17 + max-width:400px;
  18 + padding:0;
  19 + margin:100px auto 0 auto;
  20 +
  21 + }
  22 + .login-screen .well {
  23 + border-radius: 3px;
  24 + -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  25 + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  26 + background: rgba(255,255,255, 0.2);
  27 + }
  28 + .login-screen .copyright {
  29 + text-align: center;
  30 + }
  31 + @media(max-width:767px) {
  32 + .login-screen {
  33 + padding:0 20px;
  34 + }
  35 + }
  36 + .profile-img-card {
  37 + width: 100px;
  38 + height: 100px;
  39 + margin: 10px auto;
  40 + display: block;
  41 + -moz-border-radius: 50%;
  42 + -webkit-border-radius: 50%;
  43 + border-radius: 50%;
  44 + }
  45 + .profile-name-card {
  46 + text-align: center;
  47 + }
  48 +
  49 + #login-form {
  50 + margin-top:20px;
  51 + }
  52 + #login-form .input-group {
  53 + margin-bottom:15px;
  54 + }
  55 +
  56 + </style>
  57 +</head>
  58 +<body>
  59 +<div class="container">
  60 + <div class="login-wrapper">
  61 + <div class="login-screen">
  62 + <div class="well">
  63 + <div class="login-form">
  64 + <p class="profile-name-card"></p>
  65 +
  66 + <form action="" method="post" id="login-form">
  67 + <div id="errtips" class="hide"></div>
  68 + {:token()}
  69 +
  70 + <div class="input-group">
  71 + <div class="input-group-addon"><span class="glyphicon glyphicon-lock" aria-hidden="true"></span></div>
  72 + <input type="password" class="form-control" id="pd-form-password" placeholder="{:__('Password')}" name="password" autocomplete="off" value="" data-rule="{:__('Password')}:required;password" />
  73 + </div>
  74 +
  75 + <div class="input-group">
  76 + <div class="input-group-addon"><span class="glyphicon glyphicon-lock" aria-hidden="true"></span></div>
  77 + <input type="password" class="form-control" id="pd-form-affirm_password" placeholder="{:__('确认密码')}" name="affirm_password" autocomplete="off" value="" data-rule="{:__('Password')}:required;password" />
  78 + </div>
  79 + <div class="form-group button">
  80 + <button type="submit" class="btn btn-success btn-lg btn-block affirm">确认修改</button>
  81 + </div>
  82 + </form>
  83 + </div>
  84 + </div>
  85 + </div>
  86 + </div>
  87 +</div>
  88 +{include file="common/script" /}
  89 +</body>
  90 +</html>
@@ -82,7 +82,7 @@ class Goods extends Frontend @@ -82,7 +82,7 @@ class Goods extends Frontend
82 if(!empty($collect)){ 82 if(!empty($collect)){
83 $is_collect = "1"; 83 $is_collect = "1";
84 } 84 }
85 - $userModel = new \app\index\model\User(); 85 + /*$userModel = new \app\index\model\User();
86 $encrypt = '2'; 86 $encrypt = '2';
87 $user = $userModel->findData(['id'=>$user_id]); 87 $user = $userModel->findData(['id'=>$user_id]);
88 if(!empty($user)){ 88 if(!empty($user)){
@@ -94,7 +94,7 @@ class Goods extends Frontend @@ -94,7 +94,7 @@ class Goods extends Frontend
94 if($encrypt == '2'){ 94 if($encrypt == '2'){
95 $data['store_phone'] = "***********"; 95 $data['store_phone'] = "***********";
96 $data['store_address'] = "***********"; 96 $data['store_address'] = "***********";
97 - } 97 + }*/
98 } 98 }
99 $data['is_collect'] = $is_collect; 99 $data['is_collect'] = $is_collect;
100 //获取评论 100 //获取评论
@@ -300,7 +300,7 @@ class Goods extends Frontend @@ -300,7 +300,7 @@ class Goods extends Frontend
300 $ids[] = $vo['id']; 300 $ids[] = $vo['id'];
301 } 301 }
302 } 302 }
303 - $data[$key]['distance'] = $distance; 303 + $data[$key]['distance'] = $encrypt == '1' ? $distance : '';
304 } 304 }
305 if(!empty($param['sort'])){ 305 if(!empty($param['sort'])){
306 if($param['sort'] == 2){ 306 if($param['sort'] == 2){
@@ -27,6 +27,7 @@ class Shop extends Frontend @@ -27,6 +27,7 @@ class Shop extends Frontend
27 } 27 }
28 28
29 public function detail(){ 29 public function detail(){
  30 + $province_id = $this->request->param('province_id',0,'intval');
30 $user_id = $this->auth->id; 31 $user_id = $this->auth->id;
31 $store_id = $this->request->param('store_id',0,'intval'); 32 $store_id = $this->request->param('store_id',0,'intval');
32 if(empty($store_id)){ 33 if(empty($store_id)){
@@ -45,7 +46,7 @@ class Shop extends Frontend @@ -45,7 +46,7 @@ class Shop extends Frontend
45 $userModel = new \app\index\model\User(); 46 $userModel = new \app\index\model\User();
46 $user = $userModel->findData(['id'=>$user_id]); 47 $user = $userModel->findData(['id'=>$user_id]);
47 if(!empty($user)){ 48 if(!empty($user)){
48 - if($user['is_svip'] == '1' || ($user['is_vip'] == '1' && in_array($user['province_id'],$user['province_ids']))){ 49 + if($user['is_svip'] == '1' || ($user['is_vip'] == '1' && in_array($province_id,$user['province_ids']))){
49 $encrypt = '1'; 50 $encrypt = '1';
50 } 51 }
51 } 52 }
@@ -57,7 +58,10 @@ class Shop extends Frontend @@ -57,7 +58,10 @@ class Shop extends Frontend
57 $data['address'] = "***********"; 58 $data['address'] = "***********";
58 } 59 }
59 $this->assign('data',$data); 60 $this->assign('data',$data);
60 - dump(collection($data)->toArray()); 61 +// dump(collection($data)->toArray());
  62 + if($this->request->isAjax()){
  63 + $this->success('SUCCESS','',$data);
  64 + }
61 return $this->fetch(); 65 return $this->fetch();
62 } 66 }
63 67
@@ -743,6 +743,10 @@ @@ -743,6 +743,10 @@
743 $(vo.property).each(function (key2, p) { 743 $(vo.property).each(function (key2, p) {
744 property += "<span class=\"myLable\">"+p+"</span>"; 744 property += "<span class=\"myLable\">"+p+"</span>";
745 }); 745 });
  746 + var distance = '';
  747 + if(vo.distance != ''){
  748 + distance = "("+vo.distance+"km)";
  749 + }
746 var str = "<tr onclick=\"window.location.href='{:url('index/goods/detail',array('goods_id'=>'GOODS_ID'))}'\">\n" + 750 var str = "<tr onclick=\"window.location.href='{:url('index/goods/detail',array('goods_id'=>'GOODS_ID'))}'\">\n" +
747 " <td>"+vo.id+"</td>\n" + 751 " <td>"+vo.id+"</td>\n" +
748 " <td><img src=\""+vo.thumbnail+"\" alt=\"\" style='width: 100px;height:100px'></td>\n" + 752 " <td><img src=\""+vo.thumbnail+"\" alt=\"\" style='width: 100px;height:100px'></td>\n" +
@@ -751,7 +755,7 @@ @@ -751,7 +755,7 @@
751 " <td onclick=\"window.event.stopPropagation();window.location.href='{:url('index/shop/detail',array('store_id'=>'STORE_ID'))}'\">"+vo.store_name+property+"\n" + 755 " <td onclick=\"window.event.stopPropagation();window.location.href='{:url('index/shop/detail',array('store_id'=>'STORE_ID'))}'\">"+vo.store_name+property+"\n" +
752 " <td>"+vo.brand+"</td>\n" + 756 " <td>"+vo.brand+"</td>\n" +
753 " <td>单价:¥"+vo.price+"</td>\n" + 757 " <td>单价:¥"+vo.price+"</td>\n" +
754 - " <td>"+vo.store_address+"("+vo.distance+"km)</td>\n" + 758 + " <td>"+vo.store_address+""+distance+"</td>\n" +
755 " </tr>"; 759 " </tr>";
756 goods_html += str.replace("GOODS_ID",vo.id).replace("STORE_ID",vo.store_id); 760 goods_html += str.replace("GOODS_ID",vo.id).replace("STORE_ID",vo.store_id);
757 console.log(goods_html); 761 console.log(goods_html);
@@ -317,8 +317,8 @@ @@ -317,8 +317,8 @@
317 </div> 317 </div>
318 <div class="infoBox"> 318 <div class="infoBox">
319 <p class="shopTitle">{$data.name}</p> 319 <p class="shopTitle">{$data.name}</p>
320 - <p class="contactNumber">联系电话:{$data.phone}</p>  
321 - <p class="shopAddress">店铺地址:{$data.address}</p> 320 + <p class="contactNumber">联系电话:</p>
  321 + <p class="shopAddress">店铺地址:</p>
322 <div class="shopIntroduceBox"> 322 <div class="shopIntroduceBox">
323 <p class="title">店铺简介:</p> 323 <p class="title">店铺简介:</p>
324 <p class="contentText"> {$data.content}</p> 324 <p class="contentText"> {$data.content}</p>
@@ -390,6 +390,8 @@ @@ -390,6 +390,8 @@
390 lat = r.point.lat; 390 lat = r.point.lat;
391 //初始化产品热卖 391 //初始化产品热卖
392 initGoodsList(); 392 initGoodsList();
  393 + //店铺详情
  394 + getStore();
393 }else{ 395 }else{
394 toast(res.msg); 396 toast(res.msg);
395 } 397 }
@@ -404,6 +406,24 @@ @@ -404,6 +406,24 @@
404 },{enableHighAccuracy: true}) 406 },{enableHighAccuracy: true})
405 } 407 }
406 408
  409 + //店铺详细信息
  410 + function getStore(){
  411 + $.ajax({
  412 + url:"{:url('index/shop/detail')}",
  413 + type:"POST",
  414 + data:{'store_id':store_id,'province_id':province_id},
  415 + success:function(res){
  416 + if(res.code == 1){
  417 + $('.contactNumber').text("联系电话:"+res.data.phone);
  418 + $('.shopAddress').text("店铺地址:"+res.data.address);
  419 + }
  420 + },
  421 + error:function(res){
  422 + toast('与服务器断开连接');
  423 + }
  424 + })
  425 + }
  426 +
407 //初始化商品列表 427 //初始化商品列表
408 function initGoodsList(page = 1, pageNum = 25){ 428 function initGoodsList(page = 1, pageNum = 25){
409 $.ajax({ 429 $.ajax({
@@ -379,6 +379,148 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi @@ -379,6 +379,148 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
379 }, function (data) { 379 }, function (data) {
380 $("input[name=captcha]").next(".input-group-addon").find("img").trigger("click"); 380 $("input[name=captcha]").next(".input-group-addon").find("img").trigger("click");
381 }); 381 });
  382 + },
  383 + forget: function () {
  384 + var lastlogin = localStorage.getItem("lastlogin");
  385 + if (lastlogin) {
  386 + lastlogin = JSON.parse(lastlogin);
  387 + $("#profile-img").attr("src", Backend.api.cdnurl(lastlogin.avatar));
  388 + $("#profile-name").val(lastlogin.username);
  389 + }
  390 +
  391 + //让错误提示框居中
  392 + Fast.config.toastr.positionClass = "toast-top-center";
  393 +
  394 + //本地验证未通过时提示
  395 + $("#login-form").data("validator-options", {
  396 + invalid: function (form, errors) {
  397 + $.each(errors, function (i, j) {
  398 + Toastr.error(j);
  399 + });
  400 + },
  401 + target: '#errtips'
  402 + });
  403 +
  404 + //为表单绑定事件
  405 + /*Form.api.bindevent($("#login-form"), function (data,res) {
  406 + /!*localStorage.setItem("lastlogin", JSON.stringify({
  407 + id: data.id,
  408 + username: data.username,
  409 + avatar: data.avatar
  410 + }));
  411 + location.href = Backend.api.fixurl(data.url);*!/
  412 + //显示验证码
  413 + Toastr.success('发送成功');
  414 + }, function (data,res) {
  415 + Toastr.error('发送失败');
  416 + $("input[name=captcha]").next(".input-group-addon").find("img").trigger("click");
  417 + });*/
  418 + //发送验证码
  419 + $('.get_code').click(function(){
  420 + var mobile = $('#pd-form-email').val();
  421 + var mobile_regular = /^1[3456789]\d{9}$/;
  422 + if(mobile == ''){
  423 + Toastr.error('请输入手机号');
  424 + return false;
  425 + }else if(!mobile_regular.test(mobile)){
  426 + Toastr.error('请输入正确手机号');
  427 + return false;
  428 + }
  429 + var that = $(this);
  430 + that.text('发送中...');
  431 + that.addClass('disabled');
  432 + that.attr('disabled',true);
  433 + $.ajax({
  434 + url:"index/forget",
  435 + type:"POST",
  436 + data:{'email':email},
  437 + success:function(res){
  438 + console.log(res);
  439 + if(res.code == 1){
  440 + that.text('重新发送');
  441 + that.removeClass('disabled');
  442 + that.attr('disabled',false);
  443 + Toastr.success('发送成功');
  444 + }else{
  445 + Toastr.error(res.msg);
  446 + }
  447 + },
  448 + error:function(res){
  449 + Toastr.error('发送失败');
  450 + }
  451 + })
  452 + })
  453 + //验证验证码是否正确
  454 + $('.affirm').click(function(){
  455 + var mobile = $('#pd-form-email').val();
  456 + var mobile_regular = /^1[3456789]\d{9}$/;
  457 + var code = $('#code').val()
  458 + if(mobile == ''){
  459 + Toastr.error('请输入手机号');
  460 + return false;
  461 + }else if(!mobile_regular.test(mobile)){
  462 + Toastr.error('请输入正确手机号');
  463 + return false;
  464 + }else if(code == ''){
  465 + Toastr.error('请输入验证码');
  466 + return false;
  467 + }
  468 + $.ajax({
  469 + url:"index/verify_code",
  470 + type:"POST",
  471 + data:{'mobile':mobile,'code':code},
  472 + success:function(res){
  473 + console.log(res);
  474 + if(res.code == 1){
  475 + Toastr.success('验证通过,请稍等...');
  476 + setTimeout(function(){
  477 + window.location.href = res.url;
  478 + },2000)
  479 + }else{
  480 + Toastr.error(res.msg);
  481 + }
  482 + },
  483 + error:function(res){
  484 + Toastr.error('发送失败');
  485 + }
  486 + })
  487 + })
  488 + },
  489 + reset_password: function () {
  490 + var lastlogin = localStorage.getItem("lastlogin");
  491 + if (lastlogin) {
  492 + lastlogin = JSON.parse(lastlogin);
  493 + $("#profile-img").attr("src", Backend.api.cdnurl(lastlogin.avatar));
  494 + $("#profile-name").val(lastlogin.username);
  495 + }
  496 +
  497 + //让错误提示框居中
  498 + Fast.config.toastr.positionClass = "toast-top-center";
  499 +
  500 + //本地验证未通过时提示
  501 + $("#login-form").data("validator-options", {
  502 + invalid: function (form, errors) {
  503 + $.each(errors, function (i, j) {
  504 + Toastr.error(j);
  505 + });
  506 + },
  507 + target: '#errtips'
  508 + });
  509 +
  510 + //为表单绑定事件
  511 + Form.api.bindevent($("#login-form"), function (data,res) {
  512 + /*localStorage.setItem("lastlogin", JSON.stringify({
  513 + id: data.id,
  514 + username: data.username,
  515 + avatar: data.avatar
  516 + }));
  517 + location.href = Backend.api.fixurl(data.url);*/
  518 + setTimeout(function(){
  519 + window.location.href = res.url;
  520 + },2000)
  521 + }, function (data,res) {
  522 + $("input[name=captcha]").next(".input-group-addon").find("img").trigger("click");
  523 + });
382 } 524 }
383 }; 525 };
384 526