Commit cf6f01198b5b5bcd54f6de3b35770460ca5b3478
1 parent
c6c5008d
Exists in
master
app-wx(v0.1.0 build 4)
1. A 提交维修订单界面
Showing
22 changed files
with
388 additions
and
83 deletions
Show diff stats
app-wx/config/params.php
app-wx/modules/order/controllers/DefaultController.php
... | ... | @@ -4,6 +4,7 @@ namespace app\wx\modules\order\controllers; |
4 | 4 | |
5 | 5 | use Yii; |
6 | 6 | use stdClass; |
7 | +use yii\helpers\HtmlPurifier; | |
7 | 8 | |
8 | 9 | /** |
9 | 10 | * 控制器 |
... | ... | @@ -17,4 +18,28 @@ class DefaultController extends BaseController |
17 | 18 | { |
18 | 19 | return $this->render('index'); |
19 | 20 | } |
21 | + | |
22 | + /** | |
23 | + * @return string | |
24 | + */ | |
25 | + public function actionSubmit() | |
26 | + { | |
27 | + $e = new stdClass(); | |
28 | + $e->success = false; | |
29 | + $e->message = 'ok'; | |
30 | + $userId = 0; | |
31 | + $req = Yii::$app->request; | |
32 | + $carNo = HtmlPurifier::process($req->post('carNo'), ['HTML.Allowed' => '']); | |
33 | + $carModel = HtmlPurifier::process($req->post('carModel'), ['HTML.Allowed' => '']); | |
34 | + $customer = HtmlPurifier::process($req->post('customer'), ['HTML.Allowed' => '']); | |
35 | + $phone = HtmlPurifier::process($req->post('phone'), ['HTML.Allowed' => '']); | |
36 | + $preRepair = HtmlPurifier::process($req->post('preRepair'), ['HTML.Allowed' => '']); | |
37 | + $repairPrice = HtmlPurifier::process($req->post('repairPrice'), ['HTML.Allowed' => '']); | |
38 | + $finishDate = HtmlPurifier::process($req->post('finishDate'), ['HTML.Allowed' => '']); | |
39 | + $images = $req->post('images'); | |
40 | + | |
41 | + //echo $carNo.'_'.$carModel.'_'.$customer.'_'.$phone.'_'.$preRepair.'_'.$repairPrice.'_'.$finishDate.'_'.json_encode($images); | |
42 | + $e->success = true; | |
43 | + return $this->renderJson($e); | |
44 | + } | |
20 | 45 | } |
21 | 46 | \ No newline at end of file | ... | ... |
app-wx/modules/order/views/default/index.php
... | ... | @@ -22,6 +22,7 @@ function img($file, $path = '/i/') |
22 | 22 | |
23 | 23 | <?=$this->render('pages/index-template', ['asset' => $asset])?> |
24 | 24 | <?=$this->render('pages/rank-template', ['asset' => $asset])?> |
25 | +<?=$this->render('pages/submit-template', ['asset' => $asset])?> | |
25 | 26 | <?=$this->render('pages/cost-list-template', ['asset' => $asset])?> |
26 | 27 | <?=$this->render('pages/repairing-template', ['asset' => $asset])?> |
27 | 28 | ... | ... |
app-wx/modules/order/views/default/pages/submit-template.php
0 → 100644
... | ... | @@ -0,0 +1,124 @@ |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Url; | |
4 | + | |
5 | +$baseUrl = Url::base(true); | |
6 | +?> | |
7 | +<style> | |
8 | + #submit div,#submit ul,#submit li{padding:0;margin:0;list-style: none} | |
9 | + #submit input::-webkit-input-placeholder{ | |
10 | + color:#CCCACB | |
11 | + } | |
12 | + #submit input::input-placeholder{ | |
13 | + color:#CCCACB | |
14 | + } | |
15 | + #submit .submit-div-item{width:100%;display:block;padding:1rem;box-sizing: border-box} | |
16 | + #submit .s-li-item{} | |
17 | + #submit .submit-div-item .s-li-div{width:100%;padding-top:1rem;} | |
18 | + #submit .s-li-div .s-li-div-input-box{padding:0.5rem 0.2rem;width: 100%;line-height: 1.25rem;border:1px solid #DDDDDD;border-radius: 0.125rem;box-sizing: border-box} | |
19 | + #submit .s-li-div .s-li-div-input{font-size: 1rem;width:100%;border: 0;line-height: inherit} | |
20 | + #submit .s-li-label{color:#000000;font-size:1rem;line-height: 1.25rem;display: flex;align-items: center;padding:0.3rem 0;} | |
21 | + #submit .s-li-div .require-cls{color:#FC7621;display:flex;align-items: center;margin-left: 0.3rem;} | |
22 | + | |
23 | + #submit .upload-box{padding: 1rem;box-sizing: border-box;background:#fff;margin-top:1rem;} | |
24 | + #submit .upload-box .upload-title{line-height: 1.5rem;color:#000000;margin-bottom: 0.5rem;font-size:1rem;} | |
25 | + #submit .upload-box .note-cls{color:#555555;font-size:0.75rem} | |
26 | + #submit .img-box-cls{width:100%;} | |
27 | + #submit .img-box-cls .upload-li{width:25%;display:block;padding-right:0.2rem;padding-bottom: 0.2rem;float:left;box-sizing: border-box;position:relative} | |
28 | + #submit .upload-box .upload-item{width:100%;height:0;padding-bottom: 100%;overflow:hidden; | |
29 | + background-position: center center; | |
30 | + background-repeat: no-repeat; | |
31 | + -webkit-background-size:cover; | |
32 | + -moz-background-size:cover;background-size:cover;position: relative} | |
33 | + #submit .upload-box .upload-item{background-image:url('<?=$baseUrl?>/i/order/upload-convert.png');background-repeat: no-repeat;background-position: 1px 1px;} | |
34 | + #submit .upload-box .upload-input-cls{width: 100%;display: block;background: rgba(0,0,0,0);opacity: 0;height: 0;padding-bottom: 100%;} | |
35 | + #submit .upload-box .upload-btn-cls{background-size: 5rem auto;} | |
36 | + #submit .upload-box .del-img{position: absolute;top: 0;left: 0;width: 0.8rem;height: 0.9rem;background-image:url('<?=$baseUrl?>/i/order/trash.png');background-repeat: no-repeat;background-size: 0.8rem auto;background-color:#fff;border-radius: 0.2rem;} | |
37 | + #submit .submit-btn-box{width:100%;display: block;padding:2rem ;box-sizing: border-box} | |
38 | + #submit .submit-btn-box .submit-btn-cls{width:100%;background-color:#FF8728;color:#fff;border-radius: 2rem;padding:1rem; box-sizing: border-box;font-size: 1rem;text-align: center;margin:0 auto;} | |
39 | +</style> | |
40 | +<script id="submit-template" type="text/template"> | |
41 | + <div class="pages"> | |
42 | + <div class="page" id="submit"> | |
43 | + <div class="page-content"> | |
44 | + <div class="submit-div-item" style="background: #fff;"> | |
45 | + <ul class="s-ul"> | |
46 | + <li class="s-li-item"> | |
47 | + <div class="s-li-div" style="padding-top:0"> | |
48 | + <label class="s-li-label">车牌号码<span class="require-cls">*</span></label> | |
49 | + <div class="s-li-div-input-box"> | |
50 | + <input class="s-li-div-input carNo" type="text" value="" placeholder="请填写车牌号" /> | |
51 | + </div> | |
52 | + </div> | |
53 | + </li> | |
54 | + <li class="s-li-item"> | |
55 | + <div class="s-li-div"> | |
56 | + <label class="s-li-label">车辆型号<span class="require-cls">*</span></label> | |
57 | + <div class="s-li-div-input-box"> | |
58 | + <input class="s-li-div-input carModel" type="text" value="" placeholder="请填写车辆型号" /> | |
59 | + </div> | |
60 | + </div> | |
61 | + </li> | |
62 | + <li class="s-li-item"> | |
63 | + <div class="s-li-div"> | |
64 | + <label class="s-li-label">客户名称<span class="require-cls">*</span></label> | |
65 | + <div class="s-li-div-input-box"> | |
66 | + <input class="s-li-div-input customer" type="text" value="" placeholder="请填写客户名称" /> | |
67 | + </div> | |
68 | + </div> | |
69 | + </li> | |
70 | + <li class="s-li-item"> | |
71 | + <div class="s-li-div"> | |
72 | + <label class="s-li-label">联系电话<span class="require-cls">*</span></label> | |
73 | + <div class="s-li-div-input-box"> | |
74 | + <input class="s-li-div-input phone" type="text" value="" placeholder="请填写联系电话" /> | |
75 | + </div> | |
76 | + </div> | |
77 | + </li> | |
78 | + <li class="s-li-item"> | |
79 | + <div class="s-li-div"> | |
80 | + <label class="s-li-label">预估维修内容<span class="require-cls">*</span></label> | |
81 | + <div class="s-li-div-input-box"> | |
82 | + <input class="s-li-div-input preRepair" type="text" value="" placeholder="请填写预估维修内容" /> | |
83 | + </div> | |
84 | + </div> | |
85 | + </li> | |
86 | + <li class="s-li-item"> | |
87 | + <div class="s-li-div"> | |
88 | + <label class="s-li-label">预估维修费用<span class="require-cls">*</span></label> | |
89 | + <div class="s-li-div-input-box"> | |
90 | + <input class="s-li-div-input repairPrice" type="text" value="" placeholder="请填写预估维修费用" /> | |
91 | + </div> | |
92 | + </div> | |
93 | + </li> | |
94 | + <li class="s-li-item"> | |
95 | + <div class="s-li-div"> | |
96 | + <label class="s-li-label">预估完成时间<span class="require-cls">*</span></label> | |
97 | + <div class="s-li-div-input-box"> | |
98 | + <input class="s-li-div-input finishDate" type="text" value="" placeholder="请填写预估完成时间" /> | |
99 | + </div> | |
100 | + </div> | |
101 | + </li> | |
102 | + </ul> | |
103 | + </div> | |
104 | + | |
105 | + <div class="upload-box"> | |
106 | + <div class="upload-title">车损照片 <span class="note-cls">(最多9张)</span></div> | |
107 | + <div class="img-box-cls"> | |
108 | + <ul id ="image-list" style="overflow: hidden;margin-top:1rem"> | |
109 | + <li class="upload-li upload-btn-li"> | |
110 | + <div class="upload-item upload-btn-cls"> | |
111 | + <input type="file" id="upload-btn" class="upload-input-cls" name="file" accept="image/*"/> | |
112 | + </div> | |
113 | + </li> | |
114 | + </ul> | |
115 | + </div> | |
116 | + </div> | |
117 | + | |
118 | + <div class="submit-btn-box"> | |
119 | + <div class="submit-btn-cls">提交</div> | |
120 | + </div> | |
121 | + </div> | |
122 | + </div> | |
123 | + </div> | |
124 | +</script> | ... | ... |
app-wx/modules/user/controllers/DefaultController.php
... | ... | @@ -25,4 +25,70 @@ class DefaultController extends BaseController |
25 | 25 | { |
26 | 26 | return $this->render('index'); |
27 | 27 | } |
28 | + | |
29 | + /** | |
30 | + * 上传文件 | |
31 | + * @return string | |
32 | + */ | |
33 | + public function actionUploadFile() | |
34 | + { | |
35 | + $e = new stdClass(); | |
36 | + $e->success = false; | |
37 | + $e->message = 'ok'; | |
38 | + $userId = 0; | |
39 | + | |
40 | + if (empty($_FILES["file"])) { | |
41 | + $e->message = '文件为空'; | |
42 | + return $this->renderJson($e); | |
43 | + } | |
44 | + if (empty($_FILES["file"]['tmp_name'])) { | |
45 | + $e->message = '文件为空'; | |
46 | + return $this->renderJson($e); | |
47 | + } | |
48 | + $type = $_FILES["file"]["type"]; | |
49 | + $typeArr = explode('/', $type); | |
50 | + if ('image' !== $typeArr[0]) { | |
51 | + $e->message = '只能上传 png, jpg 等文件'; | |
52 | + return $this->renderJson($e); | |
53 | + } | |
54 | + | |
55 | + $dir = Yii::getAlias('@site') . "/tmp"; | |
56 | + $fileArr = explode('.', $_FILES["file"]['name']); | |
57 | + $tt = time(); | |
58 | + $filename = 'auto_'.$tt.md5($_FILES["file"]['name']).'.'.end($fileArr); | |
59 | + $minFileName = 'auto_'.$tt.md5($_FILES["file"]['name']).'_min'.'.'.end($fileArr); | |
60 | + $saveFilePath = $dir.'/'.$filename; | |
61 | + move_uploaded_file($_FILES["file"]['tmp_name'], $saveFilePath); | |
62 | + $tmpUrl = $tmpMinFile= $this->site->base_url.'/tmp/'.$filename; | |
63 | + $imgSource = $this->_imageCreateFromPath($saveFilePath); | |
64 | + if ($imgSource) { | |
65 | + ImageUtils::resizeImage($imgSource, 100, 100, $dir.'/'.$minFileName); | |
66 | + $tmpMinFile = $this->site->base_url.'/tmp/'.$minFileName; | |
67 | + } | |
68 | + | |
69 | + $e->success = true; | |
70 | + $e->tmpFile = $filename; | |
71 | + $e->tmpMinUrl = $tmpMinFile; | |
72 | + $e->tmpUrl = $tmpUrl; | |
73 | + $e->message = 'ok'; | |
74 | + | |
75 | + return $this->renderJson($e); | |
76 | + } | |
77 | + | |
78 | + /** | |
79 | + * @param $imgPath | |
80 | + * @return null|resource | |
81 | + */ | |
82 | + private function _imageCreateFromPath($imgPath) | |
83 | + { | |
84 | + list($width, $height, $type, $attr) = getimagesize($imgPath); | |
85 | + switch ($type) { | |
86 | + case 3: // png | |
87 | + return imagecreatefrompng($imgPath); | |
88 | + case 2: // jpeg | |
89 | + return imagecreatefromjpeg($imgPath); | |
90 | + default: | |
91 | + return null; | |
92 | + } | |
93 | + } | |
28 | 94 | } |
29 | 95 | \ No newline at end of file | ... | ... |
app-wx/modules/user/controllers/LoginController.php
... | ... | @@ -20,72 +20,6 @@ class LoginController extends BaseController |
20 | 20 | { |
21 | 21 | |
22 | 22 | /** |
23 | - * 上传文件 | |
24 | - * @return string | |
25 | - */ | |
26 | - public function actionUploadFile() | |
27 | - { | |
28 | - $e = new stdClass(); | |
29 | - $e->success = false; | |
30 | - $e->message = 'ok'; | |
31 | - $userId = 0; | |
32 | - | |
33 | - if (empty($_FILES["file"])) { | |
34 | - $e->message = '文件为空'; | |
35 | - return $this->renderJson($e); | |
36 | - } | |
37 | - if (empty($_FILES["file"]['tmp_name'])) { | |
38 | - $e->message = '文件为空'; | |
39 | - return $this->renderJson($e); | |
40 | - } | |
41 | - $type = $_FILES["file"]["type"]; | |
42 | - $typeArr = explode('/', $type); | |
43 | - if ('image' !== $typeArr[0]) { | |
44 | - $e->message = '只能上传 png, jpg 等文件'; | |
45 | - return $this->renderJson($e); | |
46 | - } | |
47 | - | |
48 | - $dir = Yii::getAlias('@site') . "/tmp"; | |
49 | - $fileArr = explode('.', $_FILES["file"]['name']); | |
50 | - $tt = time(); | |
51 | - $filename = 'auto_'.$tt.md5($_FILES["file"]['name']).'.'.end($fileArr); | |
52 | - $minFileName = 'auto_'.$tt.md5($_FILES["file"]['name']).'_min'.'.'.end($fileArr); | |
53 | - $saveFilePath = $dir.'/'.$filename; | |
54 | - move_uploaded_file($_FILES["file"]['tmp_name'], $saveFilePath); | |
55 | - $tmpUrl = $tmpMinFile= $this->site->base_url.'/tmp/'.$filename; | |
56 | - $imgSource = $this->_imageCreateFromPath($saveFilePath); | |
57 | - if ($imgSource) { | |
58 | - ImageUtils::resizeImage($imgSource, 100, 100, $dir.'/'.$minFileName); | |
59 | - $tmpMinFile = $this->site->base_url.'/tmp/'.$minFileName; | |
60 | - } | |
61 | - | |
62 | - $e->success = true; | |
63 | - $e->tmpFile = $filename; | |
64 | - $e->tmpMinUrl = $tmpMinFile; | |
65 | - $e->tmpUrl = $tmpUrl; | |
66 | - $e->message = 'ok'; | |
67 | - | |
68 | - return $this->renderJson($e); | |
69 | - } | |
70 | - | |
71 | - /** | |
72 | - * @param $imgPath | |
73 | - * @return null|resource | |
74 | - */ | |
75 | - private function _imageCreateFromPath($imgPath) | |
76 | - { | |
77 | - list($width, $height, $type, $attr) = getimagesize($imgPath); | |
78 | - switch ($type) { | |
79 | - case 3: // png | |
80 | - return imagecreatefrompng($imgPath); | |
81 | - case 2: // jpeg | |
82 | - return imagecreatefromjpeg($imgPath); | |
83 | - default: | |
84 | - return null; | |
85 | - } | |
86 | - } | |
87 | - | |
88 | - /** | |
89 | 23 | * @return string |
90 | 24 | */ |
91 | 25 | public function actionGetCode() |
... | ... | @@ -145,7 +79,10 @@ class LoginController extends BaseController |
145 | 79 | return $this->renderJson($e); |
146 | 80 | } |
147 | 81 | |
148 | - public function actionLogin2() | |
82 | + /** | |
83 | + * @return string | |
84 | + */ | |
85 | + public function actionLogin() | |
149 | 86 | { |
150 | 87 | $e = new stdClass(); |
151 | 88 | $e->success = false; | ... | ... |
app-wx/modules/user/views/default/index.php
app-wx/modules/user/views/default/pages/login-template.php
... | ... | @@ -9,7 +9,7 @@ $baseUrl = Url::base(true); |
9 | 9 | input{-webkit-appearance: none;} |
10 | 10 | #login{} |
11 | 11 | #login:after{content:'';bottom:0;height:7rem;width: 7rem;display:block;position: absolute; |
12 | - z-index: -1;background-image: url('<?=$baseUrl?>/i/login-corner.png');background-repeat: no-repeat;background-size: 100% auto } | |
12 | + z-index: -1;background-image: url('<?=$baseUrl?>/i/user/login-corner.png');background-repeat: no-repeat;background-size: 100% auto } | |
13 | 13 | #login .head-wrapper{display:block;padding: 0;box-sizing: border-box;} |
14 | 14 | #login .input-box-wrapper{background:#fff;width:100%;border-radius: 0.5rem;padding: 1rem 0 2rem 0;box-shadow: 0 2px 6px rgba(208, 203, 203, 0.3215686274509804)} |
15 | 15 | #login .input-list{padding:1rem 1rem;box-sizing: border-box;background: #fff;} |
... | ... | @@ -36,8 +36,8 @@ $baseUrl = Url::base(true); |
36 | 36 | <div class="pages"> |
37 | 37 | <div class="page" id="login" style="background: #fff"> |
38 | 38 | <div class="page-content"> |
39 | - <div class="head-wrapper" style="background-image:url('<?=$baseUrl?>/i/login-bg.png');background-repeat: no-repeat;background-size: 100% auto;"> | |
40 | - <img style="width:100%;opacity: 0" src="<?=$baseUrl?>/i/login-bg.png"/> | |
39 | + <div class="head-wrapper" style="background-image:url('<?=$baseUrl?>/i/user/login-bg.png');background-repeat: no-repeat;background-size: 100% auto;"> | |
40 | + <img style="width:100%;opacity: 0" src="<?=$baseUrl?>/i/user/login-bg.png"/> | |
41 | 41 | </div> |
42 | 42 | <div style="margin-top:-10rem;padding:0 1rem;box-sizing: border-box"> |
43 | 43 | <div class="input-box-wrapper"> | ... | ... |
app-wx/modules/user/views/default/pages/register-template.php
... | ... | @@ -23,7 +23,7 @@ $baseUrl = Url::base(true); |
23 | 23 | background-repeat: no-repeat; |
24 | 24 | -webkit-background-size:cover; |
25 | 25 | -moz-background-size:cover;background-size:cover;position: relative} |
26 | - #register .upload-box .upload-item{background-image:url('<?=$baseUrl?>/i/upload-convert.png');background-size: 4.7rem auto;background-repeat: no-repeat;background-position: 1px 1px;} | |
26 | + #register .upload-box .upload-item{background-image:url('<?=$baseUrl?>/i/user/upload-convert.png');background-size: 4.7rem auto;background-repeat: no-repeat;background-position: 1px 1px;} | |
27 | 27 | #register .upload-box .upload-input-cls{width: 100%;display: block;background: rgba(0,0,0,0);opacity: 0;height: 0;padding-bottom: 100%;} |
28 | 28 | #register .register-btn-cls{width:80%;border-radius: 2rem; padding:0.8rem 1rem;text-align:center;box-sizing: border-box;color:#fff;background:#FF8728;margin: 0 auto;font-size:1.13rem} |
29 | 29 | #register .count-down-cls{font-size:0.7rem;color:#999} | ... | ... |
web/dist/js/order-app.js
1 | -define("order-app",["mk7/app"],function(n){var e=Dom7,r=function(){var n=e(".ui-loading-block");0==n.length&&(e(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var n=document.getElementById("loader-inner"),e=document.createElement("p");e.className="notice",n&&(e.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',n.appendChild(e))},window.waitingTime))},i=!0;return n.name="order",n.routes={index:function(){return i=!1,r(),n.runController("index")},rank:function(){return i=!1,r(),n.runController("rank")},"cost-list":function(){return i=!1,r(),n.runController("cost-list")},repairing:function(){return i=!1,r(),n.runController("repairing")},"*":function(){return n.runController("index")}},n}),define("order/cost-list-controller",["mk7/controller","mk7/url","mk7/utils"],function(n,e,r){var n=(Dom7,Template7,new n);return n.run=function(){var n=this;n.setPageTitle("费用列表"),n.render()},n.bindEvents=function(){console.log("bindEvents")},n}),define("order/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(n,e,r){var n=(Dom7,Template7,new n);return n.run=function(){var n=this;n.setPageTitle("订单列表"),n.hideAllNonBaseMenuItem(window.$site),n.render()},n.bindEvents=function(){console.log("bindEvents")},n}),define("order/rank-controller",["mk7/controller","mk7/url","mk7/utils"],function(n,e,r){var n=(Dom7,Template7,new n);return n.run=function(){var n=this;n.setPageTitle("评价"),n.render()},n.bindEvents=function(){console.log("bindEvents")},n}),define("order/repairing-controller",["mk7/controller","mk7/url","mk7/utils"],function(n,e,r){var n=(Dom7,Template7,new n);return n.run=function(){var n=this;n.setPageTitle("维修单"),n.render()},n.bindEvents=function(){console.log("bindEvents")},n}); | |
2 | 1 | \ No newline at end of file |
2 | +define("order-app",["mk7/app"],function(t){var n=Dom7,e=function(){var t=n(".ui-loading-block");0==t.length&&(n(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var t=document.getElementById("loader-inner"),n=document.createElement("p");n.className="notice",t&&(n.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',t.appendChild(n))},window.waitingTime))},i=!0;return t.name="order",t.routes={index:function(){return i=!1,e(),t.runController("index")},rank:function(){return i=!1,e(),t.runController("rank")},submit:function(){return i=!1,e(),t.runController("submit")},"*":function(){return t.runController("index")}},t}),define("order/cost-list-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,n,e){var t=(Dom7,Template7,new t);return t.run=function(){var t=this;t.setPageTitle("费用列表"),t.render()},t.bindEvents=function(){console.log("bindEvents")},t}),define("order/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,n,e){var t=(Dom7,Template7,new t);return t.run=function(){var t=this;t.setPageTitle("订单列表"),t.hideAllNonBaseMenuItem(window.$site),t.render()},t.bindEvents=function(){console.log("bindEvents")},t}),define("order/rank-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,n,e){var t=(Dom7,Template7,new t);return t.run=function(){var t=this;t.setPageTitle("评价"),t.render()},t.bindEvents=function(){console.log("bindEvents")},t}),define("order/repairing-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,n,e){var t=(Dom7,Template7,new t);return t.run=function(){var t=this;t.setPageTitle("维修单"),t.render()},t.bindEvents=function(){console.log("bindEvents")},t}),define("order/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(t,n,e,i){var r=Dom7,t=(Template7,new t),o="/user/default/upload-file",l="/order/default/submit",s=!0;return t.run=function(){var t=this;t.setPageTitle("录入维修单"),t.imgLimit=9,t.render()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.uploadImgEvent(),t.submitEvent()},t.uploadImgEvent=function(){var t=this;r("#submit #upload-btn").change(function(){if(""!=r(this).val()&&null!=r(this).val()){var l=r(this).parents("li");i.uploadFile({selector:"#upload-btn",url:n.to(o),processAppendTo:"#submit",success:function(n,i){try{if(n.success){var o=n.tmpUrl;r('<li class="upload-li up-img"><div data="'+n.tmpFile+'" data-url="'+o+'" class="upload-item" style="background-image:url('+n.tmpMinUrl+')"></div><span class="del-img"></span></li>').insertBefore(l),t.imgLimit==r("#submit #image-list").find(".up-img").length&&r("#submit .upload-btn-li").hide()}else e.toast({content:n.message,closeDelay:5e3})}catch(s){console.log(s),e.toast({content:"出错",closeDelay:5e3})}}})}}),r("#submit #image-list").on("click",".del-img",function(n){r(this).parent().remove(),t.imgLimit>=r("#submit #image-list").find(".up-img").length&&r("#submit .upload-btn-li").show()})},t.submitEvent=function(){var t=this;r("#submit .submit-btn-cls").click(function(i){var o=e.trim(r("#submit .carNo").val()),a=e.trim(r("#submit .carModel").val()),u=e.trim(r("#submit .customer").val()),c=e.trim(r("#submit .phone").val()),m=e.trim(r("#submit .preRepair").val()),d=e.trim(r("#submit .repairPrice").val()),v=e.trim(r("#submit .finishDate").val());if(0==s)return!1;if(""==o)return e.toast({content:"车牌号必填"}),!1;if(""==a)return e.toast({content:"车辆型号必填"}),!1;if(""==u)return e.toast({content:"客户名称必填"}),!1;if(""==c)return e.toast({content:"客联系电话必填"}),!1;if(!e.isMobile(c)&&!uitls.isTelephone(c))return e.toast({content:"客联系电话有误"}),!1;if(""==m)return e.toast({content:"预估维修内容必填"}),!1;if(""==d)return e.toast({content:"预估维修费用必填"}),!1;if(""==v)return e.toast({content:"预估完成时间必填"}),!1;var f=t.getUploadImgs();if(0==f.length)return e.toast({content:"请上传图片"}),!1;s=!1;var p=t.csrf({carNo:o,carModel:a,customer:u,phone:c,preRepair:m,repairPrice:d,finishDate:v,images:f});e.httpPost(l,p,function(t){return s=!0,t.success?void(window.location.href=n.to("/")):(e.toast({content:message}),!1)},!0)})},t.getUploadImgs=function(){var t=r("#submit #image-list").find(".up-img"),n=[];return 0==t.length?[]:(r.each(t,function(t,e){var i=r(e).find(".upload-item");n.push(i.attr("data"))}),n)},t}); | |
3 | 3 | \ No newline at end of file | ... | ... |
web/dist/js/user-app.js
1 | -define("user-app",["mk7/app"],function(e){var n=Dom7,i=function(){var e=n(".ui-loading-block");0==e.length&&(n(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var e=document.getElementById("loader-inner"),n=document.createElement("p");n.className="notice",e&&(n.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',e.appendChild(n))},window.waitingTime))},r=!0;return e.name="user",e.routes={index:function(){return r=!1,i(),e.runController("index")},register:function(){return r=!1,i(),e.runController("register")},"*":function(){return e.runController("index")}},e}),define("user/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,n,i){var e=(Dom7,Template7,new e);return e.run=function(){var e=this;e.setPageTitle("首页"),e.hideAllNonBaseMenuItem(window.$site),e.render()},e.bindEvents=function(){console.log("bindEvents")},e}),define("user/register-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,n,i){var e=(Dom7,Template7,new e);return e.run=function(){var e=this;e.setPageTitle("注册"),e.hideAllNonBaseMenuItem(window.$site),e.render()},e.bindEvents=function(){console.log("bindEvents")},e}); | |
2 | 1 | \ No newline at end of file |
2 | +define("user-app",["mk7/app"],function(e){var t=Dom7,n=function(){var e=t(".ui-loading-block");0==e.length&&(t(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var e=document.getElementById("loader-inner"),t=document.createElement("p");t.className="notice",e&&(t.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',e.appendChild(t))},window.waitingTime))},o=!0;return e.name="user",e.routes={index:function(){return o=!1,n(),e.runController("index")},register:function(){return o=!1,n(),e.runController("register")},login:function(){return o=!1,n(),e.runController("login")},"*":function(){return e.runController("index")}},e}),define("user/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,t,n){var e=(Dom7,Template7,new e);return e.run=function(){var e=this;e.setPageTitle("首页"),e.hideAllNonBaseMenuItem(window.$site),e.render()},e.bindEvents=function(){console.log("bindEvents")},e}),define("user/login-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,t,n){var o=Dom7,e=(Template7,new e),i="/user/login/get-code",r="/user/login/login",l=!0,c=!0,s=null;return e.run=function(){var e=this;e.setPageTitle("登录"),e.codeDuration=60,e.render()},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.getCodeEvent(),e.gotoRegisterEvent(),e.loginEvent()},e.getCodeEvent=function(){var e=this;o("#login .get-code-cls").click(function(){if(0==l)return!1;clearInterval(s),l=!1;var r=e.csrf({action:"login"});n.httpGet(t.to(i),r,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),l=!0,!1;var i=t.codeDuration;e.codeDuration=i,s=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(o("#login .get-code-cls").html("获取验证码"),clearInterval(s),e.codeDuration=i,l=!0):o("#login .get-code-cls").html('<span class="count-down-cls">'+e.codeDuration+"s后重新获取</span>")},1e3)})})},e.loginEvent=function(){var e=this;o("#login .login-btn").click(function(i){var l=n.trim(o("#login .mobile").val()),s=n.trim(o("#login .code").val());if(""==l)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(l))return n.toast({content:"手机号码不合格"}),!1;if(""==s)return n.toast({content:"验证码必填"}),!1;if(0==c)return!1;c=!1;var a=e.csrf({mobile:l,code:s});n.httpPost(t.to(r),a,function(e){return e.success?(c=!0,void(window.location.href=t.to("/"))):(n.toast({content:e.message,closeDelay:3e3}),c=!0,!1)})})},e.gotoRegisterEvent=function(){o("#login .register-btn").click(function(e){window.location.href=t.to("user/#register")})},e}),define("user/register-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(e,t,n,o){var i=Dom7,e=(Template7,new e),r="/user/login/register",l="/user/default/upload-file",c="/user/login/get-code",s=!0,a=!0,u=null;return e.run=function(){var e=this;e.setPageTitle("注册"),e.codeDuration=60,e.render()},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.uploadEvent(),e.getCodeEvent(),e.registerEvent(),e.gotoLoginEvent()},e.uploadEvent=function(){i("#register #upload-btn").change(function(){if(""!=i(this).val()&&null!=i(this).val()){var e=i(this).parent();o.uploadFile({selector:"#upload-btn",url:t.to(l),processAppendTo:"#register",success:function(t,o){try{if(t.success){var i=t.tmpUrl;e.css("background-image","url("+t.tmpMinUrl+")"),e.attr("data",t.tmpFile),e.attr("data-url",i)}else n.toast({content:t.message,closeDelay:5e3})}catch(r){n.toast({content:"出错",closeDelay:5e3})}}})}})},e.getCodeEvent=function(){var e=this;i("#register .get-code-cls").click(function(){if(0==s)return!1;clearInterval(u),s=!1;var o=e.csrf({action:"register"});n.httpGet(t.to(c),o,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),s=!0,!1;var o=t.codeDuration;e.codeDuration=o,u=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(i("#register .get-code-cls").html("获取验证码"),clearInterval(u),e.codeDuration=o,s=!0):i("#register .get-code-cls").html('<span class="count-down-cls">'+e.codeDuration+"s后重新获取</span>")},1e3)})})},e.registerEvent=function(){var e=this;i("#register .register-btn").click(function(o){var l=n.trim(i("#register .name").val()),c=n.trim(i("#register .mobile").val()),s=n.trim(i("#register .code").val());if(""==l)return n.toast({content:"车厂名称必填"}),!1;if(""==c)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(c))return n.toast({content:"手机号码不合格"}),!1;if(""==s)return n.toast({content:"验证码必填"}),!1;var u=i("#register .upload-btn-cls").attr("data");if(void 0===u||null==u)return n.toast({content:"请上传营业执照"}),!1;if(0==a)return!1;a=!1;var d=e.csrf({name:l,mobile:c,code:s,img:u});n.httpPost(t.to(r),d,function(e){return e.success?void(window.location.href=t.to("/")):(n.toast({content:e.message,closeDelay:3e3}),a=!0,!1)})})},e.gotoLoginEvent=function(){i("#register .login-btn").click(function(e){window.location.href=t.to("user/#login")})},e}); | |
3 | 3 | \ No newline at end of file | ... | ... |
web/i/login-bg.png
171 KB
web/i/login-corner.png
5.65 KB
679 Bytes
4.31 KB
web/i/upload-convert.png
1.89 KB
171 KB
5.65 KB
1.89 KB
web/src/js/order/app.js
... | ... | @@ -44,15 +44,10 @@ define( |
44 | 44 | _autoLoading(); |
45 | 45 | return app.runController('rank'); |
46 | 46 | }, |
47 | - 'cost-list': function () { | |
47 | + 'submit': function () { | |
48 | 48 | fromOutside = false; |
49 | 49 | _autoLoading(); |
50 | - return app.runController('cost-list'); | |
51 | - }, | |
52 | - 'repairing': function () { | |
53 | - fromOutside = false; | |
54 | - _autoLoading(); | |
55 | - return app.runController('repairing'); | |
50 | + return app.runController('submit'); | |
56 | 51 | }, |
57 | 52 | '*': function(){ |
58 | 53 | return app.runController('index'); | ... | ... |
... | ... | @@ -0,0 +1,157 @@ |
1 | +/** | |
2 | + * 录入维修单 | |
3 | + */ | |
4 | +define( | |
5 | + "order/submit-controller", | |
6 | + [ | |
7 | + 'mk7/controller', | |
8 | + 'mk7/url', | |
9 | + 'mk7/utils', | |
10 | + 'mk7/uploadjs', | |
11 | + ], | |
12 | + | |
13 | + function(ctrl, url, utils, uploadjs) { | |
14 | + | |
15 | + var $$ = Dom7; | |
16 | + var t7 = Template7; | |
17 | + var ctrl = new ctrl(); | |
18 | + | |
19 | + var uploadURL = '/user/default/upload-file'; | |
20 | + var submitURL = '/order/default/submit'; | |
21 | + var canSubmit = true; | |
22 | + ctrl.run = function () { | |
23 | + var me = this; | |
24 | + me.setPageTitle("录入维修单"); | |
25 | + me.imgLimit = 9; | |
26 | + me.render(); | |
27 | + } | |
28 | + ctrl.bindEvents = function () { | |
29 | + var me = this; | |
30 | + console.log("bindEvents"); | |
31 | + me.uploadImgEvent(); | |
32 | + me.submitEvent(); | |
33 | + } | |
34 | + ctrl.uploadImgEvent = function() { | |
35 | + var me = this; | |
36 | + | |
37 | + $$('#submit #upload-btn').change(function () { | |
38 | + if ('' == $$(this).val() || null == $$(this).val()) { | |
39 | + return; | |
40 | + } | |
41 | + var uploadParent = $$(this).parents('li'); | |
42 | + | |
43 | + uploadjs.uploadFile({ | |
44 | + selector: '#upload-btn', | |
45 | + url: url.to(uploadURL), | |
46 | + processAppendTo: '#submit', | |
47 | + success: function (response, e) { | |
48 | + try { | |
49 | + if (response.success) { | |
50 | + var imgUrl = response.tmpUrl; | |
51 | + | |
52 | + $$('<li class="upload-li up-img"><div data="' + response.tmpFile + '" data-url="' + imgUrl + '" class="upload-item" style="background-image:url(' + response.tmpMinUrl + ')">' + '</div><span class="del-img"></span></li>').insertBefore(uploadParent); | |
53 | + if (me.imgLimit == $$('#submit #image-list').find('.up-img').length) { | |
54 | + $$('#submit .upload-btn-li').hide(); | |
55 | + } | |
56 | + } else { | |
57 | + utils.toast({content: response.message, closeDelay: 5000}); | |
58 | + } | |
59 | + } catch (ex) { | |
60 | + console.log(ex) | |
61 | + utils.toast({content: '出错', closeDelay: 5000}); | |
62 | + } | |
63 | + } | |
64 | + }); | |
65 | + }) | |
66 | + | |
67 | + $$('#submit #image-list').on('click', '.del-img', function(e){ | |
68 | + $$(this).parent().remove(); | |
69 | + if (me.imgLimit >= $$('#submit #image-list').find('.up-img').length) { | |
70 | + $$('#submit .upload-btn-li').show(); | |
71 | + } | |
72 | + }) | |
73 | + } | |
74 | + ctrl.submitEvent = function() { | |
75 | + var me = this; | |
76 | + $$('#submit .submit-btn-cls').click(function(e) { | |
77 | + | |
78 | + var carNo = utils.trim($$('#submit .carNo').val()); | |
79 | + var carModel = utils.trim($$('#submit .carModel').val()); | |
80 | + var customer = utils.trim($$('#submit .customer').val()); | |
81 | + var phone = utils.trim($$('#submit .phone').val()); | |
82 | + var preRepair = utils.trim($$('#submit .preRepair').val()); | |
83 | + var repairPrice = utils.trim($$('#submit .repairPrice').val()); | |
84 | + var finishDate = utils.trim($$('#submit .finishDate').val()); | |
85 | + if (false == canSubmit) { | |
86 | + return false; | |
87 | + } | |
88 | + if ('' == carNo) { | |
89 | + utils.toast({content:'车牌号必填'}); | |
90 | + return false; | |
91 | + } | |
92 | + if ('' == carModel) { | |
93 | + utils.toast({content:'车辆型号必填'}); | |
94 | + return false; | |
95 | + } | |
96 | + if ('' == customer) { | |
97 | + utils.toast({content:'客户名称必填'}); | |
98 | + return false; | |
99 | + } | |
100 | + if ('' == phone) { | |
101 | + utils.toast({content:'客联系电话必填'}); | |
102 | + return false; | |
103 | + } | |
104 | + if (!utils.isMobile(phone) && !uitls.isTelephone(phone)) { | |
105 | + utils.toast({content:'客联系电话有误'}); | |
106 | + return false; | |
107 | + } | |
108 | + if ('' == preRepair) { | |
109 | + utils.toast({content:'预估维修内容必填'}); | |
110 | + return false; | |
111 | + } | |
112 | + if ('' == repairPrice) { | |
113 | + utils.toast({content:'预估维修费用必填'}); | |
114 | + return false; | |
115 | + } | |
116 | + if ('' == finishDate) { | |
117 | + utils.toast({content:'预估完成时间必填'}); | |
118 | + return false; | |
119 | + } | |
120 | + var imgs = me.getUploadImgs(); | |
121 | + if (0 == imgs.length) { | |
122 | + utils.toast({content:'请上传车损照'}); | |
123 | + return false; | |
124 | + } | |
125 | + canSubmit = false; | |
126 | + var sData = me.csrf({ | |
127 | + carNo:carNo, carModel:carModel,customer:customer,phone:phone, | |
128 | + preRepair:preRepair, repairPrice:repairPrice,finishDate:finishDate, images:imgs | |
129 | + }) | |
130 | + utils.httpPost(submitURL, sData, function(res) { | |
131 | + canSubmit = true; | |
132 | + if (!res.success) { | |
133 | + utils.toast({content:message}); | |
134 | + return false; | |
135 | + } else { | |
136 | + window.location.href = url.to('/'); | |
137 | + } | |
138 | + }, true); | |
139 | + | |
140 | + }) | |
141 | + } | |
142 | + ctrl.getUploadImgs = function() { | |
143 | + var images = $$('#submit #image-list').find('.up-img'); | |
144 | + var returnImg = []; | |
145 | + if (images.length == 0 ) { | |
146 | + return []; | |
147 | + } | |
148 | + $$.each(images, function(i, n){ | |
149 | + var img = $$(n).find('.upload-item'); | |
150 | + returnImg.push(img.attr('data')) | |
151 | + }) | |
152 | + | |
153 | + return returnImg; | |
154 | + } | |
155 | + return ctrl; | |
156 | + } | |
157 | +); | ... | ... |
web/src/js/user/register-controller.js
... | ... | @@ -17,7 +17,7 @@ define( |
17 | 17 | var ctrl = new ctrl(); |
18 | 18 | |
19 | 19 | var registerUrl = '/user/login/register'; |
20 | - var uploadURL = '/user/login/upload-file'; | |
20 | + var uploadURL = '/user/default/upload-file'; | |
21 | 21 | var getCodeURL = '/user/login/get-code'; |
22 | 22 | var loginURL = '/user/login/do-login'; |
23 | 23 | var clickGetCode = true; | ... | ... |