Commit 1de3211f597969db25ce6b679c563fab791f5dab
1 parent
0c34aba8
Exists in
master
app-wx(v0.1.0 build 15)
1.F 短信接口审核成功,配置参数
Showing
30 changed files
with
1043 additions
and
495 deletions
Show diff stats
app-wx/config/params.php
app-wx/controllers/BaseController.php
... | ... | @@ -3,19 +3,6 @@ |
3 | 3 | namespace app\wx\controllers; |
4 | 4 | |
5 | 5 | use Yii; |
6 | -use yii\helpers\Url; | |
7 | -use yii\web\BadRequestHttpException; | |
8 | -use yii\db\Query; | |
9 | -use app\wx\models\Engineer; | |
10 | -use common\helpers\WxHelper; | |
11 | -use common\helpers\ImageManager; | |
12 | -use common\exts\wechat\Log as WxLog; | |
13 | -use common\helpers\Log as AppLog; | |
14 | -use common\helpers\PerformanceUtils; | |
15 | -use common\models\SysSetting; | |
16 | -use domain\engineer\EngineerRole; | |
17 | -use domain\engineer\EngineerStatus; | |
18 | -use domain\engineer\EngineerSkillTagsRepository; | |
19 | 6 | use stdClass; |
20 | 7 | use function header; |
21 | 8 | use function in_array; |
... | ... | @@ -25,12 +12,8 @@ use function urlencode; |
25 | 12 | |
26 | 13 | |
27 | 14 | /** |
28 | - * 只有通过 微信 OAuth 验证后才能访问整个App, | |
29 | - * 这是所有应用控制器的基类 | |
30 | 15 | * Class BaseController |
31 | 16 | * @package app\wx\controllers |
32 | - * @author lee.li <34923862@qq.com> | |
33 | - * @date 2015/07/01 | |
34 | 17 | */ |
35 | 18 | class BaseController extends AppController |
36 | 19 | { |
... | ... | @@ -168,6 +151,7 @@ class BaseController extends AppController |
168 | 151 | $this->site->timestamp = time(); |
169 | 152 | $this->site->noncestr = 'noncestr'; |
170 | 153 | $this->site->signature = 'signature'; |
154 | + $this->site->servicePhone = Yii::$app->params['SERVICE_PHONE']; | |
171 | 155 | } |
172 | 156 | |
173 | 157 | /** | ... | ... |
app-wx/models/UserIdentity.php
... | ... | @@ -159,19 +159,28 @@ class UserIdentity extends UserModel |
159 | 159 | return $e; |
160 | 160 | } |
161 | 161 | $code = PhoneCodeHelper::getLoginCode($mobile); |
162 | + $testPhones = Yii::$app->params['testLoginPhones']; | |
162 | 163 | $sms = new SmsMessage(); |
163 | 164 | if ($code) { |
164 | 165 | // 发送短信 |
165 | - $sms->sendLoginCode($mobile, $code); | |
166 | + if (!in_array($mobile, $testPhones)) { | |
167 | + $sms->sendLoginCode($mobile, $code); | |
168 | + } | |
166 | 169 | $e->message = '您的登录码已经发送,请注意查收短信!'; |
167 | 170 | } else { |
168 | 171 | $code = PhoneCodeHelper::setLoginCode($mobile); |
169 | 172 | // 发送短信 |
170 | - $sms->sendLoginCode($mobile, $code); | |
173 | + if (!in_array($mobile, $testPhones)) { | |
174 | + $sms->sendLoginCode($mobile, $code); | |
175 | + } | |
171 | 176 | $e->message = '您的登录码已经发送,请注意查收短信!'; |
172 | 177 | } |
178 | + if (!in_array($mobile, $testPhones)) { | |
179 | + $e->code = ''; | |
180 | + } else { | |
181 | + $e->code = $code; | |
182 | + } | |
173 | 183 | $e->success = true; |
174 | - $e->code = $code; | |
175 | 184 | |
176 | 185 | return $e; |
177 | 186 | } |
... | ... | @@ -213,6 +222,7 @@ class UserIdentity extends UserModel |
213 | 222 | 'user_id' => $userEntity->id, |
214 | 223 | 'emergency_contact' => $rData['emergencyContact'], |
215 | 224 | 'emergency_person' => $rData['emergencyPerson'], |
225 | + 'address' => $rData['address'] | |
216 | 226 | ]; |
217 | 227 | $userProfile = UserProfile::create($pData); |
218 | 228 | PhoneCodeHelper::removeRegisterCode($mobile); |
... | ... | @@ -228,6 +238,8 @@ class UserIdentity extends UserModel |
228 | 238 | $userProfile->qa_charge_pic = $QAChargePicImage[0].$QAChargePicImage[1]; |
229 | 239 | $userProfile->save(); |
230 | 240 | $tran->commit(); |
241 | + // 因为注册完成之后要审核,必须把已经登录的退出去 | |
242 | + Yii::$app->user->logout(); | |
231 | 243 | $e->success = true; |
232 | 244 | $e->message = '注册完成,账号审核通过后即可使用'; |
233 | 245 | } catch (Exception $ex) { |
... | ... | @@ -248,6 +260,7 @@ class UserIdentity extends UserModel |
248 | 260 | $e = new stdClass(); |
249 | 261 | $e->success = false; |
250 | 262 | $e->message = ''; |
263 | + $e->code = ''; | |
251 | 264 | $userModel = UserModel::findOne(['mobile' => $mobile]); |
252 | 265 | $sms = new SmsMessage(); |
253 | 266 | if ($userModel) { |
... | ... | @@ -261,14 +274,15 @@ class UserIdentity extends UserModel |
261 | 274 | //发送短信 |
262 | 275 | $sms->sendRegCode($mobile, $code); |
263 | 276 | $e->message = '您的注册码已经发送,请注意查收短信!'; |
264 | - $e->code = $code; | |
277 | + | |
265 | 278 | } else { |
266 | 279 | $code = PhoneCodeHelper::setRegisterCode($mobile); |
267 | 280 | //发送短信 |
268 | 281 | $sms->sendRegCode($mobile, $code); |
269 | 282 | $e->message = '您的注册码已经发送,请注意查收短信!'; |
270 | - $e->code = $code; | |
271 | 283 | } |
284 | + $e->code = ''; | |
285 | + $e->success = true; | |
272 | 286 | |
273 | 287 | return $e; |
274 | 288 | } | ... | ... |
app-wx/modules/order/controllers/CustomerController.php
... | ... | @@ -2,12 +2,11 @@ |
2 | 2 | |
3 | 3 | namespace app\wx\modules\order\controllers; |
4 | 4 | |
5 | +use Yii; | |
6 | +use common\helpers\ImageManager; | |
5 | 7 | use common\helpers\Utils; |
6 | 8 | use domain\order\RepairOrderRate; |
7 | 9 | use domain\order\RepairOrderRateRepository; |
8 | -use Yii; | |
9 | - | |
10 | - | |
11 | 10 | use domain\order\RepairOrderRepository; |
12 | 11 | use domain\order\RepairOrderStatus; |
13 | 12 | |
... | ... | @@ -48,7 +47,10 @@ class CustomerController extends CustomerBaseController |
48 | 47 | $brokenImages = []; |
49 | 48 | $baseURL = Yii::$app->request->getHostInfo(); |
50 | 49 | foreach($brokenImageModels as $k => $v) { |
51 | - $brokenImages[] = $baseURL.'/'.$v->image_path; | |
50 | + $brokenImages[] = [ | |
51 | + 'url' => ImageManager::getUrl($v->image_path), | |
52 | + 'thumb' => ImageManager::getUrl($v->image_path, 'min') | |
53 | + ]; | |
52 | 54 | } |
53 | 55 | $totalPrice = $orderModel->order_price; |
54 | 56 | $rPlans = RepairOrderRepository::findOrderPlansAll(['repair_order_id' => $orderId]); |
... | ... | @@ -59,7 +61,10 @@ class CustomerController extends CustomerBaseController |
59 | 61 | $fImages = RepairOrderRepository::findOrderFinishImageAll(['repair_order_id' => $orderId]); |
60 | 62 | $finishImages = []; |
61 | 63 | foreach($fImages as $k => $image) { |
62 | - $finishImages[] = $baseURL.'/'.$image['image_path']; | |
64 | + $finishImages[] = [ | |
65 | + 'url' => ImageManager::getUrl($image['image_path']), | |
66 | + 'thumb' => ImageManager::getUrl($image['image_path'], 'min') | |
67 | + ]; | |
63 | 68 | } |
64 | 69 | $comments = []; |
65 | 70 | $hasComment = false; | ... | ... |
app-wx/modules/order/controllers/DefaultController.php
... | ... | @@ -7,6 +7,7 @@ use yii\helpers\HtmlPurifier; |
7 | 7 | use yii\base\Exception; |
8 | 8 | use yii\log\Logger; |
9 | 9 | |
10 | +use common\helpers\ImageManager; | |
10 | 11 | use domain\order\RepairOrder; |
11 | 12 | use domain\order\RepairOrderImages; |
12 | 13 | use domain\order\RepairOrderRepository; |
... | ... | @@ -17,8 +18,7 @@ use domain\order\RepairOrderRate; |
17 | 18 | use domain\order\RepairOrderRateRepository; |
18 | 19 | use domain\order\CarModelRepository; |
19 | 20 | use domain\system\SmsMessage; |
20 | -use domain\user\models\UserProfile as UserProfileModel; | |
21 | -use domain\user\UserProfile; | |
21 | +use domain\user\UserRepository; | |
22 | 22 | |
23 | 23 | use stdClass; |
24 | 24 | |
... | ... | @@ -38,30 +38,6 @@ class DefaultController extends BaseController |
38 | 38 | /** |
39 | 39 | * @return string |
40 | 40 | */ |
41 | - public function actionSubmit() | |
42 | - { | |
43 | - $e = new stdClass(); | |
44 | - $e->success = false; | |
45 | - $e->message = 'ok'; | |
46 | - $e->address = ''; | |
47 | - $userId = $this->getUserId(); | |
48 | - $userProfile = UserProfileModel::findOne(['user_id' => $userId]); | |
49 | - if ($userProfile) { | |
50 | - if (!empty($userProfile->address)) { | |
51 | - $e->address = $userProfile->address; | |
52 | - } | |
53 | - $e->success = true; | |
54 | - } else { | |
55 | - | |
56 | - $e->message = '找不到维修厂信息'; | |
57 | - } | |
58 | - | |
59 | - return $this->renderJson($e); | |
60 | - } | |
61 | - | |
62 | - /** | |
63 | - * @return string | |
64 | - */ | |
65 | 41 | public function actionDoSubmit() |
66 | 42 | { |
67 | 43 | $e = new stdClass(); |
... | ... | @@ -76,7 +52,6 @@ class DefaultController extends BaseController |
76 | 52 | $preRepair = HtmlPurifier::process($req->post('preRepair'), ['HTML.Allowed' => '']); |
77 | 53 | $predictPrice = HtmlPurifier::process($req->post('repairPrice'), ['HTML.Allowed' => '']); |
78 | 54 | $finishDate = HtmlPurifier::process($req->post('finishDate'), ['HTML.Allowed' => '']); |
79 | - $address = HtmlPurifier::process($req->post('address'), ['HTML.Allowed' => '']); | |
80 | 55 | $images = $req->post('images'); |
81 | 56 | |
82 | 57 | if (empty($carNo)) { |
... | ... | @@ -98,10 +73,17 @@ class DefaultController extends BaseController |
98 | 73 | } else { |
99 | 74 | $predict_finish_time = strtotime($finishDate.':00:00'); |
100 | 75 | } |
101 | - if (empty($address)) { | |
102 | - $e->message = '维修厂地址必填'; | |
103 | - return $this->renderJson($e); | |
76 | + $address = ''; | |
77 | + $maintainer = ''; | |
78 | + $tel = ''; | |
79 | + $userModel = UserRepository::findOne(['id' => $userId]); | |
80 | + if ($userModel) { | |
81 | + $maintainer = $userModel->name; | |
82 | + $tel = $userModel->mobile; | |
83 | + $profileModel = $userModel->profile; | |
84 | + $address = isset($profileModel)?$profileModel->address:''; | |
104 | 85 | } |
86 | + | |
105 | 87 | $data = [ |
106 | 88 | 'user_id' => $userId, |
107 | 89 | 'car_no' => $carNo, |
... | ... | @@ -111,6 +93,8 @@ class DefaultController extends BaseController |
111 | 93 | 'predict_fault' => $preRepair, |
112 | 94 | 'predict_price' => $predictPrice, |
113 | 95 | 'maintainer_address' => $address, |
96 | + 'maintainer_tel' => $tel, | |
97 | + 'maintainer_name' => $maintainer, | |
114 | 98 | 'predict_finish_time' => $predict_finish_time, |
115 | 99 | 'status' => RepairOrderStatus::WORKING, |
116 | 100 | ]; |
... | ... | @@ -119,11 +103,10 @@ class DefaultController extends BaseController |
119 | 103 | $repairOrder = RepairOrder::create($data); |
120 | 104 | $uuid = $repairOrder->uuid; |
121 | 105 | RepairOrderImages::createBrokenImages($repairOrder->id, $uuid, $images); |
122 | - UserProfile::updateAddress($userId, $address); | |
123 | 106 | $tran->commit(); |
124 | 107 | RepairOrderImages::mvBrokenImages($uuid, $images); |
125 | - //$sms = new SmsMessage(); | |
126 | - //$sms->sendSubmitInfo($phone, $finishDate); | |
108 | + | |
109 | + $this->sendSubmitSMS($repairOrder, $userId); | |
127 | 110 | $e->orderId = $uuid; |
128 | 111 | $e->success = true; |
129 | 112 | } catch(Exception $ex) { |
... | ... | @@ -138,6 +121,59 @@ class DefaultController extends BaseController |
138 | 121 | } |
139 | 122 | |
140 | 123 | /** |
124 | + * 下维修单短信 | |
125 | + * @param $orderModel | |
126 | + * @param $userId | |
127 | + * @return array | |
128 | + */ | |
129 | + private function sendSubmitSMS($orderModel, $userId) | |
130 | + { | |
131 | + /* | |
132 | + 您好,维修厂${maintainer}已进行维修,预计完成时间${dateTime},预估维修内容${repairPlan},预估维修费用${repairPrice},维修厂地址:${address},联系电话:${tel} | |
133 | + * */ | |
134 | + $smsVars = ['maintainer' => '', 'tel' => '', 'address' => '', 'dateTime' => '', 'repairPlan' => '', 'repairPrice' => '']; | |
135 | + $smsVars['maintainer'] = $orderModel->maintainer_name; | |
136 | + $smsVars['tel'] = $orderModel->maintainer_tel; | |
137 | + $smsVars['address'] = $orderModel->maintainer_address; | |
138 | + $smsVars['dateTime'] = date('Y年m月d日 H点', $orderModel->predict_finish_time); | |
139 | + $smsVars['repairPlan'] = $orderModel->predict_fault; | |
140 | + $smsVars['repairPrice'] = $orderModel->predict_price; | |
141 | + $phone = $orderModel->contact_mobile; | |
142 | + $sms = new SmsMessage(); | |
143 | + return $sms->sendSubmitInfo($phone, $smsVars); | |
144 | + } | |
145 | + | |
146 | + /** | |
147 | + * @param $orderModel | |
148 | + * @param $userId | |
149 | + */ | |
150 | + private function sendFinishSMS($orderModel, $userId) | |
151 | + { | |
152 | + /* | |
153 | + 您好,${maintainer}已对您的车维修完成,点击http://gkauto.jiwork.com/site/t?o=${code}可以给本次服务评分。如有意见请拨打投诉热线:${tel} | |
154 | + * */ | |
155 | + | |
156 | + $smsVars = ['maintainer' => '', 'code' => '', 'tel' => '']; | |
157 | + | |
158 | + $smsVars['tel'] = Yii::$app->params['SERVICE_PHONE']; | |
159 | + $smsVars['maintainer'] = $orderModel->maintainer_name; | |
160 | + $smsVars['code'] = $orderModel->short_uuid; | |
161 | + $phone = $orderModel->contact_mobile; | |
162 | + $sms = new SmsMessage(); | |
163 | + return $sms->sendFinishInfo($phone, $smsVars); | |
164 | + | |
165 | + } | |
166 | + | |
167 | + public function actionSms() | |
168 | + { | |
169 | + $userId = $this->getUserId(); | |
170 | + $orderModel = RepairOrderRepository::findOne(['id' => 12]); | |
171 | + //$result = $this->sendSubmitSMS($orderModel, $userId); | |
172 | + //var_dump($result); | |
173 | + //$this->sendFinishSMS($orderModel, $userId); | |
174 | + } | |
175 | + | |
176 | + /** | |
141 | 177 | * @return string |
142 | 178 | */ |
143 | 179 | public function actionOrderList() |
... | ... | @@ -218,7 +254,10 @@ class DefaultController extends BaseController |
218 | 254 | $brokenImages = []; |
219 | 255 | $baseURL = Yii::$app->request->getHostInfo(); |
220 | 256 | foreach($brokenImageModels as $k => $v) { |
221 | - $brokenImages[] = $baseURL.'/'.$v->image_path; | |
257 | + $brokenImages[] = [ | |
258 | + 'url' => ImageManager::getUrl($v->image_path), | |
259 | + 'thumb' => ImageManager::getUrl($v->image_path, 'min') | |
260 | + ]; | |
222 | 261 | } |
223 | 262 | $totalPrice = $orderModel->order_price; |
224 | 263 | $rPlans = RepairOrderRepository::findOrderPlansAll(['repair_order_id' => $orderId]); |
... | ... | @@ -229,7 +268,10 @@ class DefaultController extends BaseController |
229 | 268 | $fImages = RepairOrderRepository::findOrderFinishImageAll(['repair_order_id' => $orderId]); |
230 | 269 | $finishImages = []; |
231 | 270 | foreach($fImages as $k => $image) { |
232 | - $finishImages[] = $baseURL.'/'.$image['image_path']; | |
271 | + $finishImages[] = [ | |
272 | + 'url' => ImageManager::getUrl($image['image_path']), | |
273 | + 'thumb' => ImageManager::getUrl($image['image_path'], 'min') | |
274 | + ]; | |
233 | 275 | } |
234 | 276 | $hasComment = false; |
235 | 277 | $comments = []; |
... | ... | @@ -316,8 +358,8 @@ class DefaultController extends BaseController |
316 | 358 | $orderModel->save(); |
317 | 359 | $tran->commit(); |
318 | 360 | RepairFinishImages::mvFinishImages($orderModel->uuid, $images); |
319 | - //$sms = new SmsMessage(); | |
320 | - //$sms->sendFinishInfo($phone, $finishDate); | |
361 | + $this->sendFinishSMS($orderModel, $userId); | |
362 | + | |
321 | 363 | $e->success = true; |
322 | 364 | } catch (Exception $ex) { |
323 | 365 | $tran->rollBack(); | ... | ... |
app-wx/modules/order/views/default/pages/customer-order-template.php
... | ... | @@ -6,6 +6,7 @@ $baseUrl = Url::base(true); |
6 | 6 | body,div,p,span,input,ul,li{padding: 0;margin: 0} |
7 | 7 | input{-webkit-appearance: none;} |
8 | 8 | ul,li{list-style: none } |
9 | + .navbar-inner{background-color:#ff7b24} | |
9 | 10 | #customer-order .content-div { width:100%; background: #fff; display:inline-flex;padding-top: 1rem} |
10 | 11 | #customer-order .left-title-div {width:33%; font-size:1rem; font-weight:400; color:rgba(0,0,0,1); line-height:1.81rem;} |
11 | 12 | #customer-order .center-content-div {width:47%; font-size:1rem; font-weight:400; color:rgba(118,118,118,1); line-height:1.81rem;} |
... | ... | @@ -66,14 +67,14 @@ $baseUrl = Url::base(true); |
66 | 67 | #customer-order .content-wrapper .rate-btn-cls{color:#fff;border-radius: 1.5rem;padding:0.6rem 0.8rem;text-align: center;background:#FF8728;width:4rem;} |
67 | 68 | #customer-order .content-wrapper .comment-txt-cls{color:#000;font-size: 1rem;line-height: 1.5rem} |
68 | 69 | |
69 | - #customer-order #warranty-wrapper{position: absolute;top: 0;bottom: 0;width: 100%;z-index: 2;padding:3rem 2rem;box-sizing: border-box;background: rgba(0,0,0,0.3);} | |
70 | + #customer-order #warranty-wrapper{position: absolute;top: 0;bottom: 0;width: 100%;z-index: 2;padding:3rem 1rem;box-sizing: border-box;background: rgba(0,0,0,0.3);} | |
70 | 71 | #customer-order #warranty-wrapper .warranty-wrapper-inner{width:100%;background: #fff;height:100%;position: relative} |
71 | 72 | #customer-order #warranty-wrapper .paragraph-cls{width:100%;padding:0.5rem 1rem;box-sizing: border-box;margin:0.25rem 0 ;} |
72 | 73 | |
73 | 74 | #customer-order #warranty-wrapper .agree-btn{position: absolute;bottom:0;right:0;width:100%;color:#FF8728;background: #fff;padding:0.8rem 0.5rem;box-sizing: border-box;text-align: center} |
74 | 75 | |
75 | - #customer-order #warranty-wrapper h2{font-size: 1.0rem;font-weight: bold;} | |
76 | - #customer-order #warranty-wrapper p{line-height: 1.5rem;padding:0;margin: 0;} | |
76 | + #customer-order #warranty-wrapper h2{font-size: 0.875rem;font-weight: bold;color:#000} | |
77 | + #customer-order #warranty-wrapper p{line-height: 1.5rem;padding:0;margin: 0;color:#000} | |
77 | 78 | </style> |
78 | 79 | <script id="customer-order-template" type="text/template"> |
79 | 80 | <div class="pages"> |
... | ... | @@ -142,13 +143,13 @@ $baseUrl = Url::base(true); |
142 | 143 | </div> |
143 | 144 | |
144 | 145 | <div class="pic-image-div"> |
145 | - <div class="pic-image-list"> | |
146 | + <ul class="pic-image-list"> | |
146 | 147 | {{#each item.brokenImages}} |
147 | - <div class="img-cls"> | |
148 | - <div class="pic-class view-img-cls" data-url="{{this}}" style="background-image: url({{this}})"></div> | |
149 | - </div> | |
148 | + <li class="img-cls"> | |
149 | + <div class="pic-class view-img-cls" data-index="{{@index}}" data-url="{{this.url}}" style="background-image: url({{this.thumb}})"></div> | |
150 | + </li> | |
150 | 151 | {{/each}} |
151 | - </div> | |
152 | + </ul> | |
152 | 153 | </div> |
153 | 154 | </div> |
154 | 155 | |
... | ... | @@ -176,7 +177,7 @@ $baseUrl = Url::base(true); |
176 | 177 | <ul class="finish-image-ul"> |
177 | 178 | {{#each this.item.finishImages}} |
178 | 179 | <li class="finish-image-li"> |
179 | - <div class="finishImage view-img-cls" data-url="{{this}}" style="background-image:url('{{this}}')"> </div></li> | |
180 | + <div class="finishImage view-img-cls" data-index="{{@index}}" data-url="{{this.url}}" style="background-image:url('{{this.thumb}}')"> </div></li> | |
180 | 181 | {{/each}} |
181 | 182 | </ul> |
182 | 183 | </div> |
... | ... | @@ -222,8 +223,15 @@ $baseUrl = Url::base(true); |
222 | 223 | <div class="warranty-wrapper-inner"> |
223 | 224 | <div class="agree-btn">确定</div> |
224 | 225 | <div class="warranty-list-div" style="width:100%;height:calc(100% - 50px);;overflow-y: scroll"> |
226 | + <div style="padding:0 1rem;box-sizing: border-box"> | |
227 | + <h1 style="color:#f85a5a;font-size:1.25rem;text-align: center">维修厂质量保修承诺书</h1> | |
228 | + <div style="width: 100%;text-align: center;font-size: 0.65rem;margin-bottom: 0.5rem;">GK车管家发[2020] 001号</div> | |
229 | + <div style="width: 100%;display: block;background: #f85a5a;height: 0.125rem;"></div> | |
230 | + </div> | |
225 | 231 | <div class="paragraph-cls"> |
226 | - <h2>维修厂质量保修承诺书</h2> | |
232 | + <p style="line-height: 1.85rem">各位车主:<br> | |
233 | + 维修厂对维修质保做以下条款承诺 | |
234 | + </p> | |
227 | 235 | <p>一、更换的配件保证期为6个月或两万公里(超出其中一项即为超出保证期)。</p> |
228 | 236 | <p>二、在保证期内,凡属于更换的配件质量,维修工艺,装配调整等质量缺陷而引起车辆(或零部件)损坏,本店应予以免费保修。</p> |
229 | 237 | <p>三、特殊零部件的保修承诺<br/> |
... | ... | @@ -235,7 +243,7 @@ $baseUrl = Url::base(true); |
235 | 243 | <p>四、钣金喷漆质保期终身(腻子开裂,漆面失光,变色)本店予以免费维修。如有外力导致脱漆或开裂,本店不予以保修!</p> |
236 | 244 | |
237 | 245 | </div> |
238 | - | |
246 | + <div style="color:#000;text-align: right;padding:0 1rem;box-sizing: border-box"> 2020年1月</div> | |
239 | 247 | </div> |
240 | 248 | </div> |
241 | 249 | </div> | ... | ... |
app-wx/modules/order/views/default/pages/order-details-template.php
... | ... | @@ -6,6 +6,7 @@ $baseUrl = Url::base(true); |
6 | 6 | body,div,p,span,input{padding: 0;margin: 0} |
7 | 7 | input{-webkit-appearance: none;} |
8 | 8 | ul,li{list-style: none } |
9 | + .navbar-inner{background-color:#ff7b24} | |
9 | 10 | #order-details .content-div { width:100%; background: #fff; display:inline-flex;padding-top: 1rem} |
10 | 11 | #order-details .left-title-div {width:33%; font-size:1rem; font-weight:400; color:rgba(0,0,0,1); line-height:1.81rem;} |
11 | 12 | #order-details .center-content-div {width:47%; font-size:1rem; font-weight:400; color:rgba(118,118,118,1); line-height:1.81rem;} |
... | ... | @@ -35,7 +36,7 @@ $baseUrl = Url::base(true); |
35 | 36 | } |
36 | 37 | #order-details .pic-image-list .img-cls{width:25%;box-sizing: border-box;float:left;padding-top:0.3rem;padding-right:0.3rem;} |
37 | 38 | |
38 | - #order-details .pic-class { margin-right: 0.5rem width:100%;height:0;padding-bottom: 100%;overflow:hidden; | |
39 | + #order-details .pic-class { margin-right: 0.5rem; width:100%;height:0;padding-bottom: 100%;overflow:hidden; | |
39 | 40 | background-position: center center; |
40 | 41 | background-repeat: no-repeat; |
41 | 42 | -webkit-background-size:cover; |
... | ... | @@ -132,13 +133,13 @@ $baseUrl = Url::base(true); |
132 | 133 | <div class="left-title-div"><span class="padding-left-1rem">车损照片</span></div> |
133 | 134 | </div> |
134 | 135 | <div class="pic-image-div"> |
135 | - <div class="pic-image-list"> | |
136 | + <ul class="pic-image-list"> | |
136 | 137 | {{#each item.brokenImages}} |
137 | - <div class="img-cls"> | |
138 | - <div class="pic-class view-img-cls" data-url="{{this}}" style="background-image: url({{this}})"></div> | |
139 | - </div> | |
138 | + <li class="img-cls"> | |
139 | + <div class="pic-class view-img-cls" data-index="{{@index}}" data-url="{{this.url}}" style="background-image: url({{this.thumb}})"></div> | |
140 | + </li> | |
140 | 141 | {{/each}} |
141 | - </div> | |
142 | + </ul> | |
142 | 143 | </div> |
143 | 144 | </div> |
144 | 145 | {{#js_compare "'working' == this.item.status"}} |
... | ... | @@ -168,7 +169,7 @@ $baseUrl = Url::base(true); |
168 | 169 | <ul class="finish-image-ul"> |
169 | 170 | {{#each this.item.finishImages}} |
170 | 171 | <li class="finish-image-li"> |
171 | - <div class="finishImage view-img-cls" data-url="{{this}}" style="background-image:url('{{this}}')"> </div></li> | |
172 | + <div class="finishImage view-img-cls" data-index="{{@index}}" data-url="{{this.url}}" style="background-image:url('{{this.thumb}}')"> </div></li> | |
172 | 173 | {{/each}} |
173 | 174 | </ul> |
174 | 175 | </div> |
... | ... | @@ -207,4 +208,4 @@ $baseUrl = Url::base(true); |
207 | 208 | </div> |
208 | 209 | </div> |
209 | 210 | </div> |
210 | -</script> | |
211 | 211 | \ No newline at end of file |
212 | +</script> | ... | ... |
app-wx/modules/order/views/default/pages/rate-template.php
... | ... | @@ -4,17 +4,17 @@ $baseUrl = Url::base(true); |
4 | 4 | ?> |
5 | 5 | <style> |
6 | 6 | body,div,p,span,input{padding: 0;margin: 0} |
7 | - input{-webkit-appearance: none;} | |
7 | + input,textarea{-webkit-appearance: none;} | |
8 | 8 | #rate .content-div { background: #fff; height: auto;padding: 1rem} |
9 | - #rate .page-content{ background-color: #ECF0F2 }#rate .upload-box .upload-title | |
9 | + #rate .page-content{ background-color: #ECF0F2 } | |
10 | 10 | |
11 | - #rate .rate-title { height:1.06rem; font-size:1.06rem; font-weight:400; color:rgba(9,9,9,1); line-height:0.75rem;margin-right:1rem;} | |
11 | + #rate .rate-title{ height:1.06rem; font-size:1.06rem; font-weight:400; color:rgba(9,9,9,1); line-height:0.75rem;margin-right:1rem;} | |
12 | 12 | #rate .rate-title-two { height:1.06rem; font-size:1.06rem; font-weight:400; color:rgba(9,9,9,1); line-height:0.75rem; padding-top: 1rem;} |
13 | 13 | #rate .comment-div {margin-top: 0.3rem;display: flex;border:1px solid #DDD;line-height: 1.06rem} |
14 | 14 | #rate .star-row{display:flex;align-items: center;margin-bottom:0.4rem} |
15 | 15 | #rate .img-star {width: 1.4rem; height: 1.4rem; float: left; vertical-align: middle; margin-right: 0.8rem;background-image:url(<?= $baseUrl . "/i/order/rate/rate_no_select.png"?>);background-repeat: no-repeat;background-size: 1.4rem auto;} |
16 | 16 | #rate .star-on{background-image:url(<?= $baseUrl . "/i/order/rate/rate_star.png"?>);} |
17 | - #rate .text-content {width: 100%;height: 7.5rem; resize: none;line-height:inherit;padding: 0.5rem;font-size: 1rem} | |
17 | + #rate .text-content {width: 100%;height: 7.5rem;border:0; resize: none;line-height:inherit;padding: 0.5rem;font-size: 1rem} | |
18 | 18 | #rate .btn-box{width:100%;display: block;padding:1rem;box-sizing: border-box;margin-top:2rem;} |
19 | 19 | #rate .rate-text { font-size:0.94rem; font-weight:400; color:rgba(0,0,0,1); line-height:1.75rem;} |
20 | 20 | |
... | ... | @@ -37,8 +37,6 @@ $baseUrl = Url::base(true); |
37 | 37 | |
38 | 38 | #rate .submit-cls{background:#FF8728;color:#fff;border-radius: 1.2rem;box-sizing: border-box;padding:0.8rem 1rem;width:80%;margin: 0 auto;text-align: center} |
39 | 39 | |
40 | - | |
41 | - | |
42 | 40 | </style> |
43 | 41 | <script id="rate-template" type="text/template"> |
44 | 42 | <div class="pages"> |
... | ... | @@ -97,6 +95,7 @@ $baseUrl = Url::base(true); |
97 | 95 | </ul> |
98 | 96 | </div> |
99 | 97 | </div> |
98 | + <div style="display: block;padding:0.5rem 0;box-sizing: border-box">投诉监督电话:{{servicePhone}}</div> | |
100 | 99 | </div> |
101 | 100 | |
102 | 101 | <div class="btn-box"> | ... | ... |
app-wx/modules/order/views/default/pages/submit-template.php
... | ... | @@ -99,7 +99,7 @@ $baseUrl = Url::base(true); |
99 | 99 | </li> |
100 | 100 | <li class="s-li-item"> |
101 | 101 | <div class="s-li-div"> |
102 | - <label class="s-li-label">预估维修内容</label> | |
102 | + <label class="s-li-label">预估维修内容<span class="require-cls">*</span></label> | |
103 | 103 | <div class="s-li-div-input-box"> |
104 | 104 | <input class="s-li-div-input preRepair" type="text" value="" placeholder="请填写预估维修内容" /> |
105 | 105 | </div> |
... | ... | @@ -107,7 +107,7 @@ $baseUrl = Url::base(true); |
107 | 107 | </li> |
108 | 108 | <li class="s-li-item"> |
109 | 109 | <div class="s-li-div"> |
110 | - <label class="s-li-label">预估维修费用</label> | |
110 | + <label class="s-li-label">预估维修费用<span class="require-cls">*</span></label> | |
111 | 111 | <div class="s-li-div-input-box" style="position: relative"> |
112 | 112 | <input class="s-li-div-input repairPrice" type="number" value="" placeholder="请填写预估维修费用" /> |
113 | 113 | <span class="price-union-cls">元</span> |
... | ... | @@ -123,14 +123,7 @@ $baseUrl = Url::base(true); |
123 | 123 | </div> |
124 | 124 | </div> |
125 | 125 | </li> |
126 | - <li class="s-li-item"> | |
127 | - <div class="s-li-div"> | |
128 | - <label class="s-li-label">维修厂地址<span class="require-cls">*</span></label> | |
129 | - <div class="s-li-div-input-box"> | |
130 | - <input class="s-li-div-input maintainerAddress" type="text" value="" placeholder="请填写维修厂地址" /> | |
131 | - </div> | |
132 | - </div> | |
133 | - </li> | |
126 | + | |
134 | 127 | </ul> |
135 | 128 | </div> |
136 | 129 | ... | ... |
app-wx/modules/user/controllers/DefaultController.php
... | ... | @@ -33,19 +33,34 @@ class DefaultController extends BaseController |
33 | 33 | $e->message = 'ok'; |
34 | 34 | $userId = 0; |
35 | 35 | |
36 | + if (isset($_POST["uploadType"]) && 'base64' == $_POST["uploadType"]) { | |
37 | + $e = $this->uploadFileStr(); | |
38 | + } else { | |
39 | + $e = $this->uploadFile(); | |
40 | + } | |
41 | + return $this->renderJson($e); | |
42 | + } | |
43 | + | |
44 | + private function uploadFile() | |
45 | + { | |
46 | + $e = new stdClass(); | |
47 | + $e->success = false; | |
48 | + $e->message = 'ok'; | |
49 | + | |
36 | 50 | if (empty($_FILES["file"])) { |
37 | 51 | $e->message = '文件为空'; |
38 | - return $this->renderJson($e); | |
52 | + return $e; | |
39 | 53 | } |
54 | + | |
40 | 55 | if (empty($_FILES["file"]['tmp_name'])) { |
41 | 56 | $e->message = '文件为空'; |
42 | - return $this->renderJson($e); | |
57 | + return $e; | |
43 | 58 | } |
44 | 59 | $type = $_FILES["file"]["type"]; |
45 | 60 | $typeArr = explode('/', $type); |
46 | 61 | if ('image' !== $typeArr[0]) { |
47 | 62 | $e->message = '只能上传 png, jpg 等文件'; |
48 | - return $this->renderJson($e); | |
63 | + return $e; | |
49 | 64 | } |
50 | 65 | |
51 | 66 | $uploadInfo = ImageManager::uploadImg($_FILES["file"]); |
... | ... | @@ -59,7 +74,33 @@ class DefaultController extends BaseController |
59 | 74 | $e->tmpUrl = $tmpUrl; |
60 | 75 | $e->message = 'ok'; |
61 | 76 | |
62 | - return $this->renderJson($e); | |
77 | + return $e; | |
63 | 78 | } |
64 | 79 | |
80 | + private function uploadFileStr() | |
81 | + { | |
82 | + $e = new stdClass(); | |
83 | + $e->success = false; | |
84 | + $e->message = 'fail'; | |
85 | + $e->tmpFile = ''; | |
86 | + $e->tmpMinUrl = ''; | |
87 | + $e->tmpUrl = ''; | |
88 | + $imgData = $this->request->post("file"); | |
89 | + $imgData = str_replace('data:image/jpeg;base64,', '', $imgData); | |
90 | + $imageStr = base64_decode($imgData); | |
91 | + if ($imageStr) { | |
92 | + $uploadInfo = ImageManager::saveBase64ImgFileToLocal($imageStr); | |
93 | + $filename = $uploadInfo[0]; | |
94 | + $tmpUrl = $this->site->base_url.'/'.$uploadInfo[2]; | |
95 | + $tmpMinFile = $this->site->base_url.'/'.$uploadInfo[3]; | |
96 | + | |
97 | + $e->success = true; | |
98 | + $e->tmpFile = $filename; | |
99 | + $e->tmpMinUrl = $tmpMinFile; | |
100 | + $e->tmpUrl = $tmpUrl; | |
101 | + $e->message = 'ok'; | |
102 | + } | |
103 | + | |
104 | + return $e; | |
105 | + } | |
65 | 106 | } |
66 | 107 | \ No newline at end of file | ... | ... |
app-wx/modules/user/controllers/LoginController.php
... | ... | @@ -42,8 +42,7 @@ class LoginController extends BaseController |
42 | 42 | $code = $codeRe->code; |
43 | 43 | } |
44 | 44 | |
45 | - $e->success = true; | |
46 | - // 测试用 | |
45 | + // 测试用 - 正式启用的时候这里要关闭了 | |
47 | 46 | $e->testCode = $code; |
48 | 47 | |
49 | 48 | return $this->renderJson($e); |
... | ... | @@ -67,6 +66,7 @@ class LoginController extends BaseController |
67 | 66 | $QAChargePic = $this->request->post('QAChargePic'); |
68 | 67 | $emergencyContact = $this->request->post('emergencyContact'); |
69 | 68 | $emergencyPerson = $this->request->post('emergencyPerson'); |
69 | + $address = $this->request->post('address'); | |
70 | 70 | |
71 | 71 | if (empty($name)) { |
72 | 72 | $e->message = '车厂名称必填'; |
... | ... | @@ -91,7 +91,10 @@ class LoginController extends BaseController |
91 | 91 | $e->message = '紧急联系电话必填'; |
92 | 92 | return $this->renderJson($e); |
93 | 93 | } |
94 | - | |
94 | + if (empty($address)) { | |
95 | + $e->message = '维修厂地址必填'; | |
96 | + return $this->renderJson($e); | |
97 | + } | |
95 | 98 | if (empty($licensePic)) { |
96 | 99 | $e->message = '请上传营业执照'; |
97 | 100 | return $this->renderJson($e); |
... | ... | @@ -122,7 +125,7 @@ class LoginController extends BaseController |
122 | 125 | } |
123 | 126 | |
124 | 127 | $rData = [ |
125 | - 'name' => $name, 'emergencyContact' => $emergencyContact, 'emergencyPerson' => $emergencyPerson, | |
128 | + 'name' => $name, 'emergencyContact' => $emergencyContact, 'emergencyPerson' => $emergencyPerson, 'address' => $address, | |
126 | 129 | 'licensePic' => $licensePic, 'headPic' => $headPic, 'techChargePic' => $techChargePic ,'QAChargePic' => $QAChargePic |
127 | 130 | ]; |
128 | 131 | $regResult = UserIdentity::register($mobile, $rData); | ... | ... |
app-wx/modules/user/views/default/pages/register-template.php
... | ... | @@ -17,7 +17,7 @@ $baseUrl = Url::base(true); |
17 | 17 | #register .input-list .validation-code{display:flex;align-items: center} |
18 | 18 | #register .input-list .get-code-cls{width: 10rem;font-size: 1rem;display: flex;align-items: center;justify-content:center;color:#FF8728;padding:0.302rem 0.3rem;box-sizing: border-box;border-left:0;} |
19 | 19 | #register .upload-box{padding:0 2rem 1rem 2rem;box-sizing: border-box;overflow: hidden} |
20 | - #register .upload-box .upload-section{width:50%;margin-bottom:0.5rem;float:left} | |
20 | + #register .upload-box .upload-section{width:50%;margin-bottom:0.5rem;float:left;display: flex;justify-content: center;flex-direction: column;align-items: center} | |
21 | 21 | #register .upload-box .upload-title{line-height: 1.5rem;color:#BCBCBC;margin-bottom:0;} |
22 | 22 | #register .upload-box .upload-img-box{display: block;width: 50%;} |
23 | 23 | #register .upload-box .upload-item{width:100%;height:0;padding-bottom: 100%;overflow:hidden; |
... | ... | @@ -37,7 +37,7 @@ $baseUrl = Url::base(true); |
37 | 37 | #register input::input-placeholder{ |
38 | 38 | color:#BCBCBC |
39 | 39 | } |
40 | - #register .legal-agreement{padding:0.2rem 2rem;width: 100%;box-sizing: border-box;display:flex;align-items: center} | |
40 | + #register .legal-agreement{padding:0.2rem 2rem;width: 100%;box-sizing: border-box;display:flex;align-items: center;justify-content: center} | |
41 | 41 | #register .check-agreement{width:1rem;height: 1rem;display: block;border:1px solid #ccc;border-radius: 1rem;} |
42 | 42 | #register .legal-agreement .checked-active{border:1px solid #FF8728;background: #FF8728;position: relative} |
43 | 43 | #register .legal-agreement .checked-active:after{content: '';position: absolute;top: 4px;left: 3px;width: 0.50rem;height: 0.2rem;border-top: 0.125rem solid #fff;border-right: 0.125rem solid #fff;transform: rotate(135deg);} |
... | ... | @@ -46,14 +46,14 @@ $baseUrl = Url::base(true); |
46 | 46 | #register .agreement-cls:active, |
47 | 47 | #register .agreement-cls:visited{color:#FF8728;font-size:0.8rem;} |
48 | 48 | |
49 | - #register #agreement-wrapper{position: absolute;top: 0;bottom: 0;width: 100%;z-index: 2;padding:3rem 2rem;box-sizing: border-box;background: rgba(0,0,0,0.3);} | |
49 | + #register #agreement-wrapper{position: absolute;top: 0;bottom: 0;width: 100%;z-index: 2;padding:3rem 1rem;box-sizing: border-box;background: rgba(0,0,0,0.3);} | |
50 | 50 | #register #agreement-wrapper .agreement-wrapper-inner{width:100%;background: #fff;height:100%;position: relative} |
51 | 51 | #register #agreement-wrapper .paragraph-cls{width:100%;padding:0.5rem 1rem;box-sizing: border-box;margin:0.25rem 0 ;} |
52 | 52 | |
53 | 53 | #register #agreement-wrapper .agree-btn{position: absolute;bottom:0;right:0;width:100%;color:#FF8728;background: #fff;padding:0.8rem 0.5rem;box-sizing: border-box;text-align: center} |
54 | 54 | |
55 | - #register #agreement-wrapper h2{font-size: 1.0rem;font-weight: bold;} | |
56 | - #register #agreement-wrapper p{line-height: 1.5rem;padding:0;margin: 0;} | |
55 | + #register #agreement-wrapper h2{font-size: 0.9rem;font-weight: bol;color:#000} | |
56 | + #register #agreement-wrapper p{line-height: 1.5rem;padding:0;margin: 0;color:#000} | |
57 | 57 | </style> |
58 | 58 | <script id="register-template" type="text/template"> |
59 | 59 | <div class="pages"> |
... | ... | @@ -86,6 +86,10 @@ $baseUrl = Url::base(true); |
86 | 86 | <div class="input-row-cls"> |
87 | 87 | <label class="input-label-cls"></label><div class="input-div"><input class="input-cls emergency_contact" type="number" placeholder="紧急联系电话" /></div> |
88 | 88 | </div> |
89 | + <div class="input-row-cls"> | |
90 | + <label class="input-label-cls"></label><div class="input-div"><input class="input-cls address" type="text" placeholder="维修厂地址" /></div> | |
91 | + </div> | |
92 | + | |
89 | 93 | </div> |
90 | 94 | <div class="upload-box"> |
91 | 95 | <div class="upload-section"> |
... | ... | @@ -129,7 +133,7 @@ $baseUrl = Url::base(true); |
129 | 133 | |
130 | 134 | </div> |
131 | 135 | <div class="legal-agreement"> |
132 | - <span class="check-agreement"></span> <a href="javascript:void(0)" class="agreement-cls">《平台车管家服务条款》</a> | |
136 | + <span class="check-agreement"></span> <a href="javascript:void(0)" class="agreement-cls">《GK车管家服务条款》</a> | |
133 | 137 | </div> |
134 | 138 | <div class="action-box"> |
135 | 139 | <div class="register-btn-cls register-btn">注册</div> |
... | ... | @@ -144,6 +148,11 @@ $baseUrl = Url::base(true); |
144 | 148 | <div class="agreement-wrapper-inner"> |
145 | 149 | <div class="agree-btn">我同意</div> |
146 | 150 | <div class="agreement-list-div" style="width:100%;height:calc(100% - 50px);;overflow-y: scroll"> |
151 | + <div style="padding:0 1rem;box-sizing: border-box"> | |
152 | + <h1 style="color:#f85a5a;font-size:1.25rem;text-align: center">平安车主服务维修流程标准</h1> | |
153 | + <div style="width: 100%;text-align: center;font-size: 0.65rem;margin-bottom: 0.5rem;">GK车管家发[2020] 001号</div> | |
154 | + <div style="width: 100%;display: block;background: #f85a5a;height: 0.125rem;"></div> | |
155 | + </div> | |
147 | 156 | <div class="paragraph-cls"> |
148 | 157 | <h2>平安车主服务中心合作维修厂钣金工艺标准流程</h2> |
149 | 158 | <p>1.轻微钣金整形要求,板面平整,无明显坑洼,手感光滑,无高凸点,筋线流畅,车身左右对称标准无差异,板金件工作面需要作羽状边处理,裸露铁皮需要作磷化底漆处理。</p> |
... | ... | @@ -190,7 +199,7 @@ $baseUrl = Url::base(true); |
190 | 199 | <p>2、中度,重度钣喷(3件以上),需要更换零部件,外部釆购零部件,添加机电维修项目等,根椐维修厂车间生产情况和客户要求协商确认交车时间,征得客户同意。</p> |
191 | 200 | <p>3、超过时效未能完工交车的,需主动联系客户,征求客户意见和谅解,维修厂应免费提供客户代步车辆。</p> |
192 | 201 | </div> |
193 | - | |
202 | + <div style="color:#000;text-align: right;padding:0 1rem;box-sizing: border-box"> 2020年1月</div> | |
194 | 203 | </div> |
195 | 204 | </div> |
196 | 205 | </div> | ... | ... |
app-wx/views/widgets/js-site.php
... | ... | @@ -10,5 +10,6 @@ window.$site = { |
10 | 10 | noncestr: '<?=$site->noncestr?>',//noncestr |
11 | 11 | signature: '<?=$site->signature?>',//signature |
12 | 12 | user_bridge_url: '<?=$site->user_bridge_url?>', |
13 | - sn: '<?=$site->sn ?>' | |
13 | + sn: '<?=$site->sn ?>', | |
14 | + servicePhone: '<?=$site->servicePhone?>' | |
14 | 15 | } |
15 | 16 | \ No newline at end of file | ... | ... |
common/helpers/FileHelper.php
... | ... | @@ -133,7 +133,7 @@ class FileHelper |
133 | 133 | $tmpPastePath = 'tmp/'; |
134 | 134 | } |
135 | 135 | |
136 | - $somePath = Yii::getAlias('@app/wx') . "/web/".$tmpPastePath; | |
136 | + $somePath = $dir = Yii::getAlias('@site') . "/".$tmpPastePath; | |
137 | 137 | if (!is_dir($somePath)) { |
138 | 138 | mkdir($somePath, 0777, true); |
139 | 139 | } | ... | ... |
common/helpers/ImageManager.php
... | ... | @@ -122,4 +122,36 @@ class ImageManager |
122 | 122 | |
123 | 123 | return [$filename, $minFileName, $tmpUrl, $tmpMinFile]; |
124 | 124 | } |
125 | + | |
126 | + /** | |
127 | + * @param $imageStr | |
128 | + * @param string $tmpPath | |
129 | + * @return array | |
130 | + */ | |
131 | + public static function saveBase64ImgFileToLocal($imageStr) | |
132 | + { | |
133 | + $somePath = $dir = Yii::getAlias('@site') . "/tmp"; | |
134 | + if (!is_dir($somePath)) { | |
135 | + mkdir($somePath, 0777, true); | |
136 | + } | |
137 | + if (!is_writable($somePath)) { | |
138 | + chmod($somePath, 0777); | |
139 | + } | |
140 | + $tt = time(); | |
141 | + $image = imagecreatefromstring($imageStr); | |
142 | + $fileNameId = 'auto_'.$tt.md5(date('YmdHis').'_'.mt_rand(100000, 999999)); | |
143 | + $minFileName = $fileNameId.'_min.jpg'; | |
144 | + $filename = $fileNameId.'.jpg'; | |
145 | + $saveFilePath = $somePath."/" .$filename; | |
146 | + imagejpeg($image, $saveFilePath); | |
147 | + | |
148 | + $tmpUrl = $tmpMinFile = 'tmp/'.$filename; | |
149 | + $imgSource = self::_imageCreateFromPath($saveFilePath); | |
150 | + if ($imgSource) { | |
151 | + ImageUtils::resizeImage($imgSource, 100, 100, $dir.'/'.$minFileName); | |
152 | + $tmpMinFile = 'tmp/'.$minFileName; | |
153 | + } | |
154 | + | |
155 | + return [$filename, $minFileName, $tmpUrl, $tmpMinFile]; | |
156 | + } | |
125 | 157 | } |
126 | 158 | \ No newline at end of file | ... | ... |
composer.json
... | ... | @@ -18,7 +18,8 @@ |
18 | 18 | "yiisoft/yii2": "~2.0.6", |
19 | 19 | "yiisoft/yii2-bootstrap": "~2.0.0", |
20 | 20 | "yiisoft/yii2-swiftmailer": "~2.0.0", |
21 | - "php-amqplib/php-amqplib": "^2.9" | |
21 | + "php-amqplib/php-amqplib": "^2.9", | |
22 | + "alibabacloud/client": "^1.5" | |
22 | 23 | }, |
23 | 24 | "require-dev": { |
24 | 25 | "yiisoft/yii2-debug": "~2.0.0", | ... | ... |
composer.lock
... | ... | @@ -4,9 +4,139 @@ |
4 | 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", |
5 | 5 | "This file is @generated automatically" |
6 | 6 | ], |
7 | - "content-hash": "a48067fb03d4d29e121ae6c52d934bc1", | |
7 | + "content-hash": "446deeded6c58ced6c733ef16c4f2f6c", | |
8 | 8 | "packages": [ |
9 | 9 | { |
10 | + "name": "adbario/php-dot-notation", | |
11 | + "version": "2.2.0", | |
12 | + "source": { | |
13 | + "type": "git", | |
14 | + "url": "https://github.com/adbario/php-dot-notation.git", | |
15 | + "reference": "eee4fc81296531e6aafba4c2bbccfc5adab1676e" | |
16 | + }, | |
17 | + "dist": { | |
18 | + "type": "zip", | |
19 | + "url": "https://api.github.com/repos/adbario/php-dot-notation/zipball/eee4fc81296531e6aafba4c2bbccfc5adab1676e", | |
20 | + "reference": "eee4fc81296531e6aafba4c2bbccfc5adab1676e", | |
21 | + "shasum": "" | |
22 | + }, | |
23 | + "require": { | |
24 | + "ext-json": "*", | |
25 | + "php": ">=5.5" | |
26 | + }, | |
27 | + "require-dev": { | |
28 | + "phpunit/phpunit": "^4.0|^5.0|^6.0", | |
29 | + "squizlabs/php_codesniffer": "^3.0" | |
30 | + }, | |
31 | + "type": "library", | |
32 | + "autoload": { | |
33 | + "files": [ | |
34 | + "src/helpers.php" | |
35 | + ], | |
36 | + "psr-4": { | |
37 | + "Adbar\\": "src" | |
38 | + } | |
39 | + }, | |
40 | + "notification-url": "https://packagist.org/downloads/", | |
41 | + "license": [ | |
42 | + "MIT" | |
43 | + ], | |
44 | + "authors": [ | |
45 | + { | |
46 | + "name": "Riku Särkinen", | |
47 | + "email": "riku@adbar.io" | |
48 | + } | |
49 | + ], | |
50 | + "description": "PHP dot notation access to arrays", | |
51 | + "homepage": "https://github.com/adbario/php-dot-notation", | |
52 | + "keywords": [ | |
53 | + "ArrayAccess", | |
54 | + "dotnotation" | |
55 | + ], | |
56 | + "time": "2019-01-01T23:59:15+00:00" | |
57 | + }, | |
58 | + { | |
59 | + "name": "alibabacloud/client", | |
60 | + "version": "1.5.20", | |
61 | + "source": { | |
62 | + "type": "git", | |
63 | + "url": "https://github.com/aliyun/openapi-sdk-php-client.git", | |
64 | + "reference": "e18c5d79072417250f6faf0c1c8ca8bd3fd73f2b" | |
65 | + }, | |
66 | + "dist": { | |
67 | + "type": "zip", | |
68 | + "url": "https://api.github.com/repos/aliyun/openapi-sdk-php-client/zipball/e18c5d79072417250f6faf0c1c8ca8bd3fd73f2b", | |
69 | + "reference": "e18c5d79072417250f6faf0c1c8ca8bd3fd73f2b", | |
70 | + "shasum": "" | |
71 | + }, | |
72 | + "require": { | |
73 | + "adbario/php-dot-notation": "^2.2", | |
74 | + "clagiordano/weblibs-configmanager": "^1.0", | |
75 | + "danielstjules/stringy": "^3.1", | |
76 | + "ext-curl": "*", | |
77 | + "ext-json": "*", | |
78 | + "ext-libxml": "*", | |
79 | + "ext-mbstring": "*", | |
80 | + "ext-openssl": "*", | |
81 | + "ext-simplexml": "*", | |
82 | + "ext-xmlwriter": "*", | |
83 | + "guzzlehttp/guzzle": "^6.3", | |
84 | + "mtdowling/jmespath.php": "^2.4", | |
85 | + "php": ">=5.5" | |
86 | + }, | |
87 | + "require-dev": { | |
88 | + "composer/composer": "^1.8", | |
89 | + "drupal/coder": "^8.3", | |
90 | + "ext-dom": "*", | |
91 | + "ext-pcre": "*", | |
92 | + "ext-sockets": "*", | |
93 | + "ext-spl": "*", | |
94 | + "league/climate": "^3.2.4", | |
95 | + "mikey179/vfsstream": "^1.6", | |
96 | + "monolog/monolog": "^1.24", | |
97 | + "phpunit/phpunit": "^4.8.35|^5.4.3", | |
98 | + "psr/cache": "^1.0", | |
99 | + "symfony/dotenv": "^3.4", | |
100 | + "symfony/var-dumper": "^3.4" | |
101 | + }, | |
102 | + "suggest": { | |
103 | + "ext-sockets": "To use client-side monitoring" | |
104 | + }, | |
105 | + "type": "library", | |
106 | + "autoload": { | |
107 | + "psr-4": { | |
108 | + "AlibabaCloud\\Client\\": "src" | |
109 | + }, | |
110 | + "files": [ | |
111 | + "src/Functions.php" | |
112 | + ] | |
113 | + }, | |
114 | + "notification-url": "https://packagist.org/downloads/", | |
115 | + "license": [ | |
116 | + "Apache-2.0" | |
117 | + ], | |
118 | + "authors": [ | |
119 | + { | |
120 | + "name": "Alibaba Cloud SDK", | |
121 | + "email": "sdk-team@alibabacloud.com", | |
122 | + "homepage": "http://www.alibabacloud.com" | |
123 | + } | |
124 | + ], | |
125 | + "description": "Alibaba Cloud Client for PHP - Use Alibaba Cloud in your PHP project", | |
126 | + "homepage": "https://www.alibabacloud.com/", | |
127 | + "keywords": [ | |
128 | + "alibaba", | |
129 | + "alibabacloud", | |
130 | + "aliyun", | |
131 | + "client", | |
132 | + "cloud", | |
133 | + "library", | |
134 | + "sdk", | |
135 | + "tool" | |
136 | + ], | |
137 | + "time": "2019-12-30T01:59:20+00:00" | |
138 | + }, | |
139 | + { | |
10 | 140 | "name": "bower-asset/bootstrap", |
11 | 141 | "version": "v3.3.7", |
12 | 142 | "source": { |
... | ... | @@ -268,6 +398,110 @@ |
268 | 398 | "time": "2016-09-14T20:40:20+00:00" |
269 | 399 | }, |
270 | 400 | { |
401 | + "name": "clagiordano/weblibs-configmanager", | |
402 | + "version": "v1.0.7", | |
403 | + "source": { | |
404 | + "type": "git", | |
405 | + "url": "https://github.com/clagiordano/weblibs-configmanager.git", | |
406 | + "reference": "6ef4c27354368deb2f54b39bbe06601da8c873a0" | |
407 | + }, | |
408 | + "dist": { | |
409 | + "type": "zip", | |
410 | + "url": "https://api.github.com/repos/clagiordano/weblibs-configmanager/zipball/6ef4c27354368deb2f54b39bbe06601da8c873a0", | |
411 | + "reference": "6ef4c27354368deb2f54b39bbe06601da8c873a0", | |
412 | + "shasum": "" | |
413 | + }, | |
414 | + "require": { | |
415 | + "php": ">=5.4" | |
416 | + }, | |
417 | + "require-dev": { | |
418 | + "clagiordano/phpunit-result-printer": "^1", | |
419 | + "phpunit/phpunit": "^4.8" | |
420 | + }, | |
421 | + "type": "library", | |
422 | + "autoload": { | |
423 | + "psr-4": { | |
424 | + "clagiordano\\weblibs\\configmanager\\": "src/" | |
425 | + } | |
426 | + }, | |
427 | + "notification-url": "https://packagist.org/downloads/", | |
428 | + "license": [ | |
429 | + "LGPL-3.0-or-later" | |
430 | + ], | |
431 | + "authors": [ | |
432 | + { | |
433 | + "name": "Claudio Giordano", | |
434 | + "email": "claudio.giordano@autistici.org", | |
435 | + "role": "Developer" | |
436 | + } | |
437 | + ], | |
438 | + "description": "weblibs-configmanager is a tool library for easily read and access to php config array file and direct read/write configuration file / object", | |
439 | + "keywords": [ | |
440 | + "clagiordano", | |
441 | + "configuration", | |
442 | + "manager", | |
443 | + "tool", | |
444 | + "weblibs" | |
445 | + ], | |
446 | + "time": "2019-09-25T22:10:10+00:00" | |
447 | + }, | |
448 | + { | |
449 | + "name": "danielstjules/stringy", | |
450 | + "version": "3.1.0", | |
451 | + "source": { | |
452 | + "type": "git", | |
453 | + "url": "https://github.com/danielstjules/Stringy.git", | |
454 | + "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e" | |
455 | + }, | |
456 | + "dist": { | |
457 | + "type": "zip", | |
458 | + "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", | |
459 | + "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", | |
460 | + "shasum": "" | |
461 | + }, | |
462 | + "require": { | |
463 | + "php": ">=5.4.0", | |
464 | + "symfony/polyfill-mbstring": "~1.1" | |
465 | + }, | |
466 | + "require-dev": { | |
467 | + "phpunit/phpunit": "~4.0" | |
468 | + }, | |
469 | + "type": "library", | |
470 | + "autoload": { | |
471 | + "psr-4": { | |
472 | + "Stringy\\": "src/" | |
473 | + }, | |
474 | + "files": [ | |
475 | + "src/Create.php" | |
476 | + ] | |
477 | + }, | |
478 | + "notification-url": "https://packagist.org/downloads/", | |
479 | + "license": [ | |
480 | + "MIT" | |
481 | + ], | |
482 | + "authors": [ | |
483 | + { | |
484 | + "name": "Daniel St. Jules", | |
485 | + "email": "danielst.jules@gmail.com", | |
486 | + "homepage": "http://www.danielstjules.com" | |
487 | + } | |
488 | + ], | |
489 | + "description": "A string manipulation library with multibyte support", | |
490 | + "homepage": "https://github.com/danielstjules/Stringy", | |
491 | + "keywords": [ | |
492 | + "UTF", | |
493 | + "helpers", | |
494 | + "manipulation", | |
495 | + "methods", | |
496 | + "multibyte", | |
497 | + "string", | |
498 | + "utf-8", | |
499 | + "utility", | |
500 | + "utils" | |
501 | + ], | |
502 | + "time": "2017-06-12T01:10:27+00:00" | |
503 | + }, | |
504 | + { | |
271 | 505 | "name": "ezyang/htmlpurifier", |
272 | 506 | "version": "v4.9.3", |
273 | 507 | "source": { |
... | ... | @@ -315,62 +549,240 @@ |
315 | 549 | "time": "2017-06-03T02:28:16+00:00" |
316 | 550 | }, |
317 | 551 | { |
318 | - "name": "mdmsoft/yii2-admin", | |
319 | - "version": "2.9", | |
552 | + "name": "guzzlehttp/guzzle", | |
553 | + "version": "6.3.3", | |
320 | 554 | "source": { |
321 | 555 | "type": "git", |
322 | - "url": "https://github.com/mdmsoft/yii2-admin.git", | |
323 | - "reference": "59e65542b1dc1abcf14c62588ea4ae128e08036c" | |
556 | + "url": "https://github.com/guzzle/guzzle.git", | |
557 | + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" | |
324 | 558 | }, |
325 | 559 | "dist": { |
326 | 560 | "type": "zip", |
327 | - "url": "https://api.github.com/repos/mdmsoft/yii2-admin/zipball/59e65542b1dc1abcf14c62588ea4ae128e08036c", | |
328 | - "reference": "59e65542b1dc1abcf14c62588ea4ae128e08036c", | |
561 | + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", | |
562 | + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", | |
329 | 563 | "shasum": "" |
330 | 564 | }, |
331 | 565 | "require": { |
332 | - "yiisoft/yii2": "~2.0.7" | |
566 | + "guzzlehttp/promises": "^1.0", | |
567 | + "guzzlehttp/psr7": "^1.4", | |
568 | + "php": ">=5.5" | |
333 | 569 | }, |
334 | 570 | "require-dev": { |
335 | - "yiisoft/yii2-codeception": "~2.0" | |
571 | + "ext-curl": "*", | |
572 | + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", | |
573 | + "psr/log": "^1.0" | |
336 | 574 | }, |
337 | 575 | "suggest": { |
338 | - "yiisoft/yii2-bootstrap": "Used when using layout 'left-menu', 'right-menu' or 'top-menu'" | |
576 | + "psr/log": "Required for using the Log middleware" | |
339 | 577 | }, |
340 | - "type": "yii2-extension", | |
578 | + "type": "library", | |
341 | 579 | "extra": { |
342 | 580 | "branch-alias": { |
343 | - "dev-1.0.master": "1.0.x-dev", | |
344 | - "dev-master": "2.x-dev" | |
581 | + "dev-master": "6.3-dev" | |
582 | + } | |
583 | + }, | |
584 | + "autoload": { | |
585 | + "files": [ | |
586 | + "src/functions_include.php" | |
587 | + ], | |
588 | + "psr-4": { | |
589 | + "GuzzleHttp\\": "src/" | |
590 | + } | |
591 | + }, | |
592 | + "notification-url": "https://packagist.org/downloads/", | |
593 | + "license": [ | |
594 | + "MIT" | |
595 | + ], | |
596 | + "authors": [ | |
597 | + { | |
598 | + "name": "Michael Dowling", | |
599 | + "email": "mtdowling@gmail.com", | |
600 | + "homepage": "https://github.com/mtdowling" | |
601 | + } | |
602 | + ], | |
603 | + "description": "Guzzle is a PHP HTTP client library", | |
604 | + "homepage": "http://guzzlephp.org/", | |
605 | + "keywords": [ | |
606 | + "client", | |
607 | + "curl", | |
608 | + "framework", | |
609 | + "http", | |
610 | + "http client", | |
611 | + "rest", | |
612 | + "web service" | |
613 | + ], | |
614 | + "time": "2018-04-22T15:46:56+00:00" | |
615 | + }, | |
616 | + { | |
617 | + "name": "guzzlehttp/promises", | |
618 | + "version": "v1.3.1", | |
619 | + "source": { | |
620 | + "type": "git", | |
621 | + "url": "https://github.com/guzzle/promises.git", | |
622 | + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" | |
623 | + }, | |
624 | + "dist": { | |
625 | + "type": "zip", | |
626 | + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", | |
627 | + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", | |
628 | + "shasum": "" | |
629 | + }, | |
630 | + "require": { | |
631 | + "php": ">=5.5.0" | |
632 | + }, | |
633 | + "require-dev": { | |
634 | + "phpunit/phpunit": "^4.0" | |
635 | + }, | |
636 | + "type": "library", | |
637 | + "extra": { | |
638 | + "branch-alias": { | |
639 | + "dev-master": "1.4-dev" | |
640 | + } | |
641 | + }, | |
642 | + "autoload": { | |
643 | + "psr-4": { | |
644 | + "GuzzleHttp\\Promise\\": "src/" | |
345 | 645 | }, |
346 | - "asset-installer-paths": { | |
347 | - "npm-asset-library": "vendor/npm", | |
348 | - "bower-asset-library": "vendor/bower" | |
646 | + "files": [ | |
647 | + "src/functions_include.php" | |
648 | + ] | |
649 | + }, | |
650 | + "notification-url": "https://packagist.org/downloads/", | |
651 | + "license": [ | |
652 | + "MIT" | |
653 | + ], | |
654 | + "authors": [ | |
655 | + { | |
656 | + "name": "Michael Dowling", | |
657 | + "email": "mtdowling@gmail.com", | |
658 | + "homepage": "https://github.com/mtdowling" | |
659 | + } | |
660 | + ], | |
661 | + "description": "Guzzle promises library", | |
662 | + "keywords": [ | |
663 | + "promise" | |
664 | + ], | |
665 | + "time": "2016-12-20T10:07:11+00:00" | |
666 | + }, | |
667 | + { | |
668 | + "name": "guzzlehttp/psr7", | |
669 | + "version": "1.4.2", | |
670 | + "source": { | |
671 | + "type": "git", | |
672 | + "url": "https://github.com/guzzle/psr7.git", | |
673 | + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" | |
674 | + }, | |
675 | + "dist": { | |
676 | + "type": "zip", | |
677 | + "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", | |
678 | + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", | |
679 | + "shasum": "" | |
680 | + }, | |
681 | + "require": { | |
682 | + "php": ">=5.4.0", | |
683 | + "psr/http-message": "~1.0" | |
684 | + }, | |
685 | + "provide": { | |
686 | + "psr/http-message-implementation": "1.0" | |
687 | + }, | |
688 | + "require-dev": { | |
689 | + "phpunit/phpunit": "~4.0" | |
690 | + }, | |
691 | + "type": "library", | |
692 | + "extra": { | |
693 | + "branch-alias": { | |
694 | + "dev-master": "1.4-dev" | |
349 | 695 | } |
350 | 696 | }, |
351 | 697 | "autoload": { |
352 | 698 | "psr-4": { |
353 | - "mdm\\admin\\": "" | |
699 | + "GuzzleHttp\\Psr7\\": "src/" | |
700 | + }, | |
701 | + "files": [ | |
702 | + "src/functions_include.php" | |
703 | + ] | |
704 | + }, | |
705 | + "notification-url": "https://packagist.org/downloads/", | |
706 | + "license": [ | |
707 | + "MIT" | |
708 | + ], | |
709 | + "authors": [ | |
710 | + { | |
711 | + "name": "Michael Dowling", | |
712 | + "email": "mtdowling@gmail.com", | |
713 | + "homepage": "https://github.com/mtdowling" | |
714 | + }, | |
715 | + { | |
716 | + "name": "Tobias Schultze", | |
717 | + "homepage": "https://github.com/Tobion" | |
718 | + } | |
719 | + ], | |
720 | + "description": "PSR-7 message implementation that also provides common utility methods", | |
721 | + "keywords": [ | |
722 | + "http", | |
723 | + "message", | |
724 | + "request", | |
725 | + "response", | |
726 | + "stream", | |
727 | + "uri", | |
728 | + "url" | |
729 | + ], | |
730 | + "time": "2017-03-20T17:10:46+00:00" | |
731 | + }, | |
732 | + { | |
733 | + "name": "mtdowling/jmespath.php", | |
734 | + "version": "2.4.0", | |
735 | + "source": { | |
736 | + "type": "git", | |
737 | + "url": "https://github.com/jmespath/jmespath.php.git", | |
738 | + "reference": "adcc9531682cf87dfda21e1fd5d0e7a41d292fac" | |
739 | + }, | |
740 | + "dist": { | |
741 | + "type": "zip", | |
742 | + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/adcc9531682cf87dfda21e1fd5d0e7a41d292fac", | |
743 | + "reference": "adcc9531682cf87dfda21e1fd5d0e7a41d292fac", | |
744 | + "shasum": "" | |
745 | + }, | |
746 | + "require": { | |
747 | + "php": ">=5.4.0" | |
748 | + }, | |
749 | + "require-dev": { | |
750 | + "phpunit/phpunit": "~4.0" | |
751 | + }, | |
752 | + "bin": [ | |
753 | + "bin/jp.php" | |
754 | + ], | |
755 | + "type": "library", | |
756 | + "extra": { | |
757 | + "branch-alias": { | |
758 | + "dev-master": "2.0-dev" | |
354 | 759 | } |
355 | 760 | }, |
761 | + "autoload": { | |
762 | + "psr-4": { | |
763 | + "JmesPath\\": "src/" | |
764 | + }, | |
765 | + "files": [ | |
766 | + "src/JmesPath.php" | |
767 | + ] | |
768 | + }, | |
356 | 769 | "notification-url": "https://packagist.org/downloads/", |
357 | 770 | "license": [ |
358 | - "BSD-3-Clause" | |
771 | + "MIT" | |
359 | 772 | ], |
360 | 773 | "authors": [ |
361 | 774 | { |
362 | - "name": "Misbahul Munir", | |
363 | - "email": "misbahuldmunir@gmail.com" | |
775 | + "name": "Michael Dowling", | |
776 | + "email": "mtdowling@gmail.com", | |
777 | + "homepage": "https://github.com/mtdowling" | |
364 | 778 | } |
365 | 779 | ], |
366 | - "description": "RBAC Auth manager for Yii2 ", | |
780 | + "description": "Declaratively specify how to extract elements from a JSON document", | |
367 | 781 | "keywords": [ |
368 | - "admin", | |
369 | - "auth", | |
370 | - "rbac", | |
371 | - "yii" | |
782 | + "json", | |
783 | + "jsonpath" | |
372 | 784 | ], |
373 | - "time": "2018-11-12T12:35:44+00:00" | |
785 | + "time": "2016-12-03T22:08:25+00:00" | |
374 | 786 | }, |
375 | 787 | { |
376 | 788 | "name": "php-amqplib/php-amqplib", |
... | ... | @@ -412,7 +824,57 @@ |
412 | 824 | "PhpAmqpLib\\": "PhpAmqpLib/" |
413 | 825 | } |
414 | 826 | }, |
415 | - "notification-url": "https://packagist.org/downloads/" | |
827 | + "notification-url": "https://packagist.org/downloads/" | |
828 | + }, | |
829 | + { | |
830 | + "name": "psr/http-message", | |
831 | + "version": "1.0.1", | |
832 | + "source": { | |
833 | + "type": "git", | |
834 | + "url": "https://github.com/php-fig/http-message.git", | |
835 | + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" | |
836 | + }, | |
837 | + "dist": { | |
838 | + "type": "zip", | |
839 | + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", | |
840 | + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", | |
841 | + "shasum": "" | |
842 | + }, | |
843 | + "require": { | |
844 | + "php": ">=5.3.0" | |
845 | + }, | |
846 | + "type": "library", | |
847 | + "extra": { | |
848 | + "branch-alias": { | |
849 | + "dev-master": "1.0.x-dev" | |
850 | + } | |
851 | + }, | |
852 | + "autoload": { | |
853 | + "psr-4": { | |
854 | + "Psr\\Http\\Message\\": "src/" | |
855 | + } | |
856 | + }, | |
857 | + "notification-url": "https://packagist.org/downloads/", | |
858 | + "license": [ | |
859 | + "MIT" | |
860 | + ], | |
861 | + "authors": [ | |
862 | + { | |
863 | + "name": "PHP-FIG", | |
864 | + "homepage": "http://www.php-fig.org/" | |
865 | + } | |
866 | + ], | |
867 | + "description": "Common interface for HTTP messages", | |
868 | + "homepage": "https://github.com/php-fig/http-message", | |
869 | + "keywords": [ | |
870 | + "http", | |
871 | + "http-message", | |
872 | + "psr", | |
873 | + "psr-7", | |
874 | + "request", | |
875 | + "response" | |
876 | + ], | |
877 | + "time": "2016-08-06T14:39:51+00:00" | |
416 | 878 | }, |
417 | 879 | { |
418 | 880 | "name": "swiftmailer/swiftmailer", |
... | ... | @@ -469,6 +931,65 @@ |
469 | 931 | "time": "2017-05-01T15:54:03+00:00" |
470 | 932 | }, |
471 | 933 | { |
934 | + "name": "symfony/polyfill-mbstring", | |
935 | + "version": "v1.3.0", | |
936 | + "source": { | |
937 | + "type": "git", | |
938 | + "url": "https://github.com/symfony/polyfill-mbstring.git", | |
939 | + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" | |
940 | + }, | |
941 | + "dist": { | |
942 | + "type": "zip", | |
943 | + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", | |
944 | + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", | |
945 | + "shasum": "" | |
946 | + }, | |
947 | + "require": { | |
948 | + "php": ">=5.3.3" | |
949 | + }, | |
950 | + "suggest": { | |
951 | + "ext-mbstring": "For best performance" | |
952 | + }, | |
953 | + "type": "library", | |
954 | + "extra": { | |
955 | + "branch-alias": { | |
956 | + "dev-master": "1.3-dev" | |
957 | + } | |
958 | + }, | |
959 | + "autoload": { | |
960 | + "psr-4": { | |
961 | + "Symfony\\Polyfill\\Mbstring\\": "" | |
962 | + }, | |
963 | + "files": [ | |
964 | + "bootstrap.php" | |
965 | + ] | |
966 | + }, | |
967 | + "notification-url": "https://packagist.org/downloads/", | |
968 | + "license": [ | |
969 | + "MIT" | |
970 | + ], | |
971 | + "authors": [ | |
972 | + { | |
973 | + "name": "Nicolas Grekas", | |
974 | + "email": "p@tchwork.com" | |
975 | + }, | |
976 | + { | |
977 | + "name": "Symfony Community", | |
978 | + "homepage": "https://symfony.com/contributors" | |
979 | + } | |
980 | + ], | |
981 | + "description": "Symfony polyfill for the Mbstring extension", | |
982 | + "homepage": "https://symfony.com", | |
983 | + "keywords": [ | |
984 | + "compatibility", | |
985 | + "mbstring", | |
986 | + "polyfill", | |
987 | + "portable", | |
988 | + "shim" | |
989 | + ], | |
990 | + "time": "2016-11-14T01:06:16+00:00" | |
991 | + }, | |
992 | + { | |
472 | 993 | "name": "yiisoft/yii2", |
473 | 994 | "version": "2.0.12", |
474 | 995 | "source": { |
... | ... | @@ -1037,71 +1558,6 @@ |
1037 | 1558 | "time": "2016-04-29T12:21:54+00:00" |
1038 | 1559 | }, |
1039 | 1560 | { |
1040 | - "name": "guzzlehttp/psr7", | |
1041 | - "version": "1.4.2", | |
1042 | - "source": { | |
1043 | - "type": "git", | |
1044 | - "url": "https://github.com/guzzle/psr7.git", | |
1045 | - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" | |
1046 | - }, | |
1047 | - "dist": { | |
1048 | - "type": "zip", | |
1049 | - "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", | |
1050 | - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", | |
1051 | - "shasum": "" | |
1052 | - }, | |
1053 | - "require": { | |
1054 | - "php": ">=5.4.0", | |
1055 | - "psr/http-message": "~1.0" | |
1056 | - }, | |
1057 | - "provide": { | |
1058 | - "psr/http-message-implementation": "1.0" | |
1059 | - }, | |
1060 | - "require-dev": { | |
1061 | - "phpunit/phpunit": "~4.0" | |
1062 | - }, | |
1063 | - "type": "library", | |
1064 | - "extra": { | |
1065 | - "branch-alias": { | |
1066 | - "dev-master": "1.4-dev" | |
1067 | - } | |
1068 | - }, | |
1069 | - "autoload": { | |
1070 | - "psr-4": { | |
1071 | - "GuzzleHttp\\Psr7\\": "src/" | |
1072 | - }, | |
1073 | - "files": [ | |
1074 | - "src/functions_include.php" | |
1075 | - ] | |
1076 | - }, | |
1077 | - "notification-url": "https://packagist.org/downloads/", | |
1078 | - "license": [ | |
1079 | - "MIT" | |
1080 | - ], | |
1081 | - "authors": [ | |
1082 | - { | |
1083 | - "name": "Michael Dowling", | |
1084 | - "email": "mtdowling@gmail.com", | |
1085 | - "homepage": "https://github.com/mtdowling" | |
1086 | - }, | |
1087 | - { | |
1088 | - "name": "Tobias Schultze", | |
1089 | - "homepage": "https://github.com/Tobion" | |
1090 | - } | |
1091 | - ], | |
1092 | - "description": "PSR-7 message implementation that also provides common utility methods", | |
1093 | - "keywords": [ | |
1094 | - "http", | |
1095 | - "message", | |
1096 | - "request", | |
1097 | - "response", | |
1098 | - "stream", | |
1099 | - "uri", | |
1100 | - "url" | |
1101 | - ], | |
1102 | - "time": "2017-03-20T17:10:46+00:00" | |
1103 | - }, | |
1104 | - { | |
1105 | 1561 | "name": "myclabs/deep-copy", |
1106 | 1562 | "version": "1.6.1", |
1107 | 1563 | "source": { |
... | ... | @@ -1782,56 +2238,6 @@ |
1782 | 2238 | "time": "2016-12-08T20:27:08+00:00" |
1783 | 2239 | }, |
1784 | 2240 | { |
1785 | - "name": "psr/http-message", | |
1786 | - "version": "1.0.1", | |
1787 | - "source": { | |
1788 | - "type": "git", | |
1789 | - "url": "https://github.com/php-fig/http-message.git", | |
1790 | - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" | |
1791 | - }, | |
1792 | - "dist": { | |
1793 | - "type": "zip", | |
1794 | - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", | |
1795 | - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", | |
1796 | - "shasum": "" | |
1797 | - }, | |
1798 | - "require": { | |
1799 | - "php": ">=5.3.0" | |
1800 | - }, | |
1801 | - "type": "library", | |
1802 | - "extra": { | |
1803 | - "branch-alias": { | |
1804 | - "dev-master": "1.0.x-dev" | |
1805 | - } | |
1806 | - }, | |
1807 | - "autoload": { | |
1808 | - "psr-4": { | |
1809 | - "Psr\\Http\\Message\\": "src/" | |
1810 | - } | |
1811 | - }, | |
1812 | - "notification-url": "https://packagist.org/downloads/", | |
1813 | - "license": [ | |
1814 | - "MIT" | |
1815 | - ], | |
1816 | - "authors": [ | |
1817 | - { | |
1818 | - "name": "PHP-FIG", | |
1819 | - "homepage": "http://www.php-fig.org/" | |
1820 | - } | |
1821 | - ], | |
1822 | - "description": "Common interface for HTTP messages", | |
1823 | - "homepage": "https://github.com/php-fig/http-message", | |
1824 | - "keywords": [ | |
1825 | - "http", | |
1826 | - "http-message", | |
1827 | - "psr", | |
1828 | - "psr-7", | |
1829 | - "request", | |
1830 | - "response" | |
1831 | - ], | |
1832 | - "time": "2016-08-06T14:39:51+00:00" | |
1833 | - }, | |
1834 | - { | |
1835 | 2241 | "name": "psr/log", |
1836 | 2242 | "version": "1.0.2", |
1837 | 2243 | "source": { |
... | ... | @@ -2840,65 +3246,6 @@ |
2840 | 3246 | "time": "2017-06-01T21:01:25+00:00" |
2841 | 3247 | }, |
2842 | 3248 | { |
2843 | - "name": "symfony/polyfill-mbstring", | |
2844 | - "version": "v1.3.0", | |
2845 | - "source": { | |
2846 | - "type": "git", | |
2847 | - "url": "https://github.com/symfony/polyfill-mbstring.git", | |
2848 | - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" | |
2849 | - }, | |
2850 | - "dist": { | |
2851 | - "type": "zip", | |
2852 | - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", | |
2853 | - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", | |
2854 | - "shasum": "" | |
2855 | - }, | |
2856 | - "require": { | |
2857 | - "php": ">=5.3.3" | |
2858 | - }, | |
2859 | - "suggest": { | |
2860 | - "ext-mbstring": "For best performance" | |
2861 | - }, | |
2862 | - "type": "library", | |
2863 | - "extra": { | |
2864 | - "branch-alias": { | |
2865 | - "dev-master": "1.3-dev" | |
2866 | - } | |
2867 | - }, | |
2868 | - "autoload": { | |
2869 | - "psr-4": { | |
2870 | - "Symfony\\Polyfill\\Mbstring\\": "" | |
2871 | - }, | |
2872 | - "files": [ | |
2873 | - "bootstrap.php" | |
2874 | - ] | |
2875 | - }, | |
2876 | - "notification-url": "https://packagist.org/downloads/", | |
2877 | - "license": [ | |
2878 | - "MIT" | |
2879 | - ], | |
2880 | - "authors": [ | |
2881 | - { | |
2882 | - "name": "Nicolas Grekas", | |
2883 | - "email": "p@tchwork.com" | |
2884 | - }, | |
2885 | - { | |
2886 | - "name": "Symfony Community", | |
2887 | - "homepage": "https://symfony.com/contributors" | |
2888 | - } | |
2889 | - ], | |
2890 | - "description": "Symfony polyfill for the Mbstring extension", | |
2891 | - "homepage": "https://symfony.com", | |
2892 | - "keywords": [ | |
2893 | - "compatibility", | |
2894 | - "mbstring", | |
2895 | - "polyfill", | |
2896 | - "portable", | |
2897 | - "shim" | |
2898 | - ], | |
2899 | - "time": "2016-11-14T01:06:16+00:00" | |
2900 | - }, | |
2901 | - { | |
2902 | 3249 | "name": "symfony/yaml", |
2903 | 3250 | "version": "v3.3.1", |
2904 | 3251 | "source": { | ... | ... |
domain/system/SmsMessage.php
... | ... | @@ -37,7 +37,7 @@ class SmsMessage |
37 | 37 | } |
38 | 38 | |
39 | 39 | $result = AlibabaCloud::rpc() |
40 | - ->regionId("cn-hongkong") // 指定请求的区域,不指定则使用客户端区域、默认区域 | |
40 | + ->regionId("cn-hangzhou") // 指定请求的区域,不指定则使用客户端区域、默认区域 | |
41 | 41 | ->product('Dysmsapi') // 指定产品 |
42 | 42 | ->version('2017-05-25') // 指定产品版本 |
43 | 43 | ->action('SendSms') // 指定产品接口 |
... | ... | @@ -55,53 +55,71 @@ class SmsMessage |
55 | 55 | |
56 | 56 | } catch (ClientException $exception) { |
57 | 57 | AppLog::DEBUG('短信发送出错:' . $exception->getErrorMessage()); |
58 | + return false; | |
58 | 59 | } catch (ServerException $exception) { |
59 | 60 | AppLog::DEBUG('短信发送出错:' . $exception->getErrorMessage()); |
61 | + return false; | |
60 | 62 | } |
61 | 63 | } |
62 | 64 | |
63 | 65 | /** |
66 | + * @return string | |
67 | + */ | |
68 | + private function getSignName() | |
69 | + { | |
70 | + $smsConfig = Yii::$app->params['sms']; | |
71 | + return isset($smsConfig['smsSignName'])?$smsConfig['smsSignName']:''; | |
72 | + } | |
73 | + /** | |
64 | 74 | * 手机验证码 |
65 | 75 | * 模版内容: 验证码${code},您正在注册成为新用户,感谢您的支持! |
66 | 76 | * 申请说明: 用户注册验证码 |
67 | - * 模版CODE: SMS_179880510 | |
77 | + * 模版CODE: SMS_181866843 | |
68 | 78 | * @param $phone |
69 | 79 | * @param $code |
70 | 80 | * @param $signName |
71 | 81 | * @return mixed |
72 | 82 | */ |
73 | - public function sendRegCode($phone, $code, $signName = '科技') | |
83 | + public function sendRegCode($phone, $code) | |
74 | 84 | { |
75 | - //$this->send($phone, $signName, "SMS_179880510", ["code" => $code]); | |
76 | - return true; | |
85 | + //return true; | |
86 | + $signName = $this->getSignName(); | |
87 | + return $this->send($phone, $signName, "SMS_181866843", ["code" => $code]); | |
77 | 88 | } |
78 | 89 | |
79 | 90 | /** |
80 | 91 | * 登录验证码 |
81 | - * 模版内容: 模版CODE: SMS_180755775 | |
92 | + * 模版内容: 模版CODE: SMS_181866846 | |
82 | 93 | * 模版内容: 尊敬的用户,您的登录码为:${code},请勿泄漏于他人! |
83 | 94 | * @param $phone |
84 | 95 | * @return mixed |
85 | 96 | */ |
86 | - public function sendLoginCode($phone, $code, $signName = '科技') | |
97 | + public function sendLoginCode($phone, $code) | |
87 | 98 | { |
88 | - //$this->send($phone, $signName, "SMS_180755775", ["code" => $code]); | |
89 | - return true; | |
99 | + //return true; | |
100 | + $signName = $this->getSignName(); | |
101 | + return $this->send($phone, $signName, "SMS_181866846", ["code" => $code]); | |
90 | 102 | } |
91 | 103 | |
92 | 104 | /* |
93 | - * 【XX车管家】您好,xxxx厂已经进行维修,预计完成时间xxxx,预估维修内容xxxx,预估维修费用xxxx, 地址:XXXXXX, 联系电话;XXXXXXXX” | |
105 | + * 模版CODE: SMS_181867814 | |
106 | + * 您好,您的爱车已在${maintainer}维修厂维修,预计${dateTime}维修完成,预估维修内容:${repairPlan},预估维修费:${repairPrice},维修厂地址:${address},联系电话:${tel} | |
94 | 107 | * */ |
95 | - public function sendSubmitInfo($maintainer, $maintainerPhone, $preFinish, $address, $phone) | |
108 | + public function sendSubmitInfo($phone, $postData) | |
96 | 109 | { |
97 | - return true; | |
110 | + //return true; | |
111 | + $signName = $this->getSignName(); | |
112 | + return $this->send($phone, $signName, "SMS_181867814", $postData); | |
98 | 113 | } |
99 | 114 | |
100 | 115 | /* |
116 | + * 模版CODE: SMS_181851842 | |
101 | 117 | * 【XX车管家】您好,xxxx厂已对您的车维修完成,点击http://wwwwwww.com/xxx 可以给本次服务评分。如有意见请拨打投诉热线:4000xxxxxx” |
102 | 118 | * */ |
103 | - public function sendFinishInfo($maintainer, $url, $phone) | |
119 | + public function sendFinishInfo($phone, $postData) | |
104 | 120 | { |
105 | - return true; | |
121 | + //return true; | |
122 | + $signName = $this->getSignName(); | |
123 | + return $this->send($phone, $signName, "SMS_181851842", $postData); | |
106 | 124 | } |
107 | 125 | } |
108 | 126 | \ No newline at end of file | ... | ... |
web/admin/favicon.ico
No preview for this file type
web/assets/d0eeab2b/js/cmpts/uploadjs/uploadjs.js
1 | -define([],function(){var e={};return e.uploadFile=function(e){var o={selector:e.selector||"",url:e.url||"",processAppendTo:e.processAppendTo||"",timeout:e.timeout||6e3,beforeSend:function(e,o){},success:function(o,r){e.success&&e.success(o,r)},complete:function(o,r){e.complete&&e.complete(o,r)},process:function(e){},ontimeout:function(e){},error:function(o,r){e.error&&e.error(o,r)}};o.beforeSend=function(r,t){if(e.beforeSend)e.beforeSend(r,t);else{var n='<div id="process-bar" style="width:100%;position: absolute;top:0;bottom: 0;z-index: 222;display: flex;justify-content: center;flex-direction: column;"><div style="width: 70%;margin: 0 auto;height:1.5rem;background: #dcdcdc;"><div style="height:1.5rem;width:0%;line-height: 1.5rem;background:#4ae637;text-align:center" id="pro-bar">0%</div></div></div>';if(""!=o.processAppendTo){var s=document.querySelector(o.processAppendTo);if(!s)return"";var i=s.querySelector("#process-bar");s&&i&&s.removeChild(i),s.insertAdjacentHTML("beforeend",n)}}},o.process=function(r){if(e.process)e.process(r);else if(""!=o.processAppendTo){var t=document.querySelector(o.processAppendTo);if(!t)return"";var n=t.querySelector("#pro-bar");if(n){var s=100*r.loaded/r.total,i=Math.floor(s)+"%";n.style.width=i,n.innerHTML=i}}},o.ontimeout=function(o){e.ontimeout?e.ontimeout(o):console.log("time out")};var r=document.querySelector(o.selector).files[0],t=new FormData,n=new XMLHttpRequest;n.timeout=o.timeout,n.onload=function(e){var r=JSON.parse(this.response);o.success(r,e)},n.onloadend=function(e){if(""!=o.processAppendTo){var r=document.querySelector(o.processAppendTo);if(r){var t=r.querySelector("#process-bar");r&&r.removeChild(t)}}var n=JSON.parse(this.response);o.complete(n,e)},n.onerror=function(e){var r=JSON.parse(this.response);o.error(r,e)},n.ontimeout=function(e){console.log("request timeout"),o.ontimeout(e)},n.addEventListener("loadstart",function(e){o.beforeSend(e)}),n.open("post",o.url,!0),n.upload.onprogress=function(e){e.lengthComputable&&o.process(e)},t.append("file",r),n.send(t)},e}); | |
2 | 1 | \ No newline at end of file |
2 | +define([],function(){var e={};return e.uploadFile=function(e){function o(){var e='<div id="process-bar" style="width:100%;position: absolute;top:0;bottom: 0;z-index: 222;display: flex;justify-content: center;flex-direction: column;"><div style="width: 70%;margin: 0 auto;height:1.5rem;background: #dcdcdc;"><div style="height:1.5rem;width:0%;line-height: 1.5rem;background:#4ae637;text-align:center" id="pro-bar">0%</div></div></div>';if(""!=t.processAppendTo){var o=document.querySelector(t.processAppendTo);if(!o)return"";var r=o.querySelector("#process-bar");o&&r&&o.removeChild(r),o.insertAdjacentHTML("beforeend",e)}}var t={selector:e.selector||"",url:e.url||"",processAppendTo:e.processAppendTo||"",timeout:e.timeout||6e3,beforeSend:function(e,o){},success:function(o,t){e.success&&e.success(o,t)},complete:function(o,t){e.complete&&e.complete(o,t)},process:function(e){},ontimeout:function(e){},error:function(o,t){e.error&&e.error(o,t)}};t.beforeSend=function(t,r){e.beforeSend?e.beforeSend(t,r):o()},t.process=function(o){if(e.process)e.process(o);else if(""!=t.processAppendTo){var r=document.querySelector(t.processAppendTo);if(!r)return"";var n=r.querySelector("#pro-bar");if(n){var s=100*o.loaded/o.total,i=Math.floor(s)+"%";n.style.width=i,n.innerHTML=i}}},t.ontimeout=function(o){e.ontimeout?e.ontimeout(o):console.log("time out")};var r=document.querySelector(t.selector).files[0],n="",s=r.size/1024;t.uploadPost=function(e,o){var r=new FormData,n=new XMLHttpRequest;n.timeout=t.timeout,n.onload=function(e){var o=JSON.parse(""==this.response||null==this.response?"[]":this.response);t.success(o,e)},n.onloadend=function(e){if(""!=t.processAppendTo){var o=document.querySelector(t.processAppendTo);if(o){var r=o.querySelector("#process-bar");o&&o.removeChild(r)}}var n=JSON.parse(""==this.response||null==this.response?"[]":this.response);t.complete(n,e)},n.onerror=function(e){var o=JSON.parse(""==this.response||null==this.response?"[]":this.response);t.error(o,e)},n.ontimeout=function(e){console.log("request timeout"),t.ontimeout(e)},n.addEventListener("loadstart",function(e){t.beforeSend(e)}),n.open("post",t.url,!0),n.upload.onprogress=function(e){e.lengthComputable&&t.process(e)},r.append("uploadType",o),r.append("file",e),n.send(r)},t.compressAndUpload=function(e,r){var n=new FileReader,s=new Image,i=e,c=document.createElement("canvas"),a=c.getContext("2d");if(void 0!=i&&""!=i){if(0!=i.type.indexOf("image"))return!1;n.readAsDataURL(i),n.onload=function(e){s.src=e.target.result},o(),s.onload=function(){var e=this,o=((new Date).getTime(),e.width),n=e.height,s=1024,i=1024,u=o,d=n;(o>s||n>i)&&(o/n>s/i?(u=s,d=Math.round(s*(n/o))):(d=i,u=Math.round(i*(o/n)))),c.width=u,c.height=d,a.clearRect(0,0,u,d),a.drawImage(e,0,0,u,d);var p=c.toDataURL("image/jpeg",.7);t.uploadPost(p,r)}}},s<=1024?(n="file",t.uploadPost(r,n)):(n="base64",t.compressAndUpload(r,n))},e}); | |
3 | 3 | \ No newline at end of file | ... | ... |
web/dist/js/cmpts/uploadjs/uploadjs.js
1 | -define([],function(){var e={};return e.uploadFile=function(e){var o={selector:e.selector||"",url:e.url||"",processAppendTo:e.processAppendTo||"",timeout:e.timeout||6e3,beforeSend:function(e,o){},success:function(o,r){e.success&&e.success(o,r)},complete:function(o,r){e.complete&&e.complete(o,r)},process:function(e){},ontimeout:function(e){},error:function(o,r){e.error&&e.error(o,r)}};o.beforeSend=function(r,t){if(e.beforeSend)e.beforeSend(r,t);else{var n='<div id="process-bar" style="width:100%;position: absolute;top:0;bottom: 0;z-index: 222;display: flex;justify-content: center;flex-direction: column;"><div style="width: 70%;margin: 0 auto;height:1.5rem;background: #dcdcdc;"><div style="height:1.5rem;width:0%;line-height: 1.5rem;background:#4ae637;text-align:center" id="pro-bar">0%</div></div></div>';if(""!=o.processAppendTo){var s=document.querySelector(o.processAppendTo);if(!s)return"";var i=s.querySelector("#process-bar");s&&i&&s.removeChild(i),s.insertAdjacentHTML("beforeend",n)}}},o.process=function(r){if(e.process)e.process(r);else if(""!=o.processAppendTo){var t=document.querySelector(o.processAppendTo);if(!t)return"";var n=t.querySelector("#pro-bar");if(n){var s=100*r.loaded/r.total,i=Math.floor(s)+"%";n.style.width=i,n.innerHTML=i}}},o.ontimeout=function(o){e.ontimeout?e.ontimeout(o):console.log("time out")};var r=document.querySelector(o.selector).files[0],t=new FormData,n=new XMLHttpRequest;n.timeout=o.timeout,n.onload=function(e){var r=JSON.parse(this.response);o.success(r,e)},n.onloadend=function(e){if(""!=o.processAppendTo){var r=document.querySelector(o.processAppendTo);if(r){var t=r.querySelector("#process-bar");r&&r.removeChild(t)}}var n=JSON.parse(this.response);o.complete(n,e)},n.onerror=function(e){var r=JSON.parse(this.response);o.error(r,e)},n.ontimeout=function(e){console.log("request timeout"),o.ontimeout(e)},n.addEventListener("loadstart",function(e){o.beforeSend(e)}),n.open("post",o.url,!0),n.upload.onprogress=function(e){e.lengthComputable&&o.process(e)},t.append("file",r),n.send(t)},e}); | |
2 | 1 | \ No newline at end of file |
2 | +define([],function(){var e={};return e.uploadFile=function(e){function o(){var e='<div id="process-bar" style="width:100%;position: absolute;top:0;bottom: 0;z-index: 222;display: flex;justify-content: center;flex-direction: column;"><div style="width: 70%;margin: 0 auto;height:1.5rem;background: #dcdcdc;"><div style="height:1.5rem;width:0%;line-height: 1.5rem;background:#4ae637;text-align:center" id="pro-bar">0%</div></div></div>';if(""!=t.processAppendTo){var o=document.querySelector(t.processAppendTo);if(!o)return"";var r=o.querySelector("#process-bar");o&&r&&o.removeChild(r),o.insertAdjacentHTML("beforeend",e)}}var t={selector:e.selector||"",url:e.url||"",processAppendTo:e.processAppendTo||"",timeout:e.timeout||6e3,beforeSend:function(e,o){},success:function(o,t){e.success&&e.success(o,t)},complete:function(o,t){e.complete&&e.complete(o,t)},process:function(e){},ontimeout:function(e){},error:function(o,t){e.error&&e.error(o,t)}};t.beforeSend=function(t,r){e.beforeSend?e.beforeSend(t,r):o()},t.process=function(o){if(e.process)e.process(o);else if(""!=t.processAppendTo){var r=document.querySelector(t.processAppendTo);if(!r)return"";var n=r.querySelector("#pro-bar");if(n){var s=100*o.loaded/o.total,i=Math.floor(s)+"%";n.style.width=i,n.innerHTML=i}}},t.ontimeout=function(o){e.ontimeout?e.ontimeout(o):console.log("time out")};var r=document.querySelector(t.selector).files[0],n="",s=r.size/1024;t.uploadPost=function(e,o){var r=new FormData,n=new XMLHttpRequest;n.timeout=t.timeout,n.onload=function(e){var o=JSON.parse(""==this.response||null==this.response?"[]":this.response);t.success(o,e)},n.onloadend=function(e){if(""!=t.processAppendTo){var o=document.querySelector(t.processAppendTo);if(o){var r=o.querySelector("#process-bar");o&&o.removeChild(r)}}var n=JSON.parse(""==this.response||null==this.response?"[]":this.response);t.complete(n,e)},n.onerror=function(e){var o=JSON.parse(""==this.response||null==this.response?"[]":this.response);t.error(o,e)},n.ontimeout=function(e){console.log("request timeout"),t.ontimeout(e)},n.addEventListener("loadstart",function(e){t.beforeSend(e)}),n.open("post",t.url,!0),n.upload.onprogress=function(e){e.lengthComputable&&t.process(e)},r.append("uploadType",o),r.append("file",e),n.send(r)},t.compressAndUpload=function(e,r){var n=new FileReader,s=new Image,i=e,c=document.createElement("canvas"),a=c.getContext("2d");if(void 0!=i&&""!=i){if(0!=i.type.indexOf("image"))return!1;n.readAsDataURL(i),n.onload=function(e){s.src=e.target.result},o(),s.onload=function(){var e=this,o=((new Date).getTime(),e.width),n=e.height,s=1024,i=1024,u=o,d=n;(o>s||n>i)&&(o/n>s/i?(u=s,d=Math.round(s*(n/o))):(d=i,u=Math.round(i*(o/n)))),c.width=u,c.height=d,a.clearRect(0,0,u,d),a.drawImage(e,0,0,u,d);var p=c.toDataURL("image/jpeg",.7);t.uploadPost(p,r)}}},s<=1024?(n="file",t.uploadPost(r,n)):(n="base64",t.compressAndUpload(r,n))},e}); | |
3 | 3 | \ No newline at end of file | ... | ... |
web/dist/js/order-app.js
1 | -define("order-app",["mk7/app"],function(t){var e=Dom7,i=function(){var t=e(".ui-loading-block");0==t.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 t=document.getElementById("loader-inner"),e=document.createElement("p");e.className="notice",t&&(e.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',t.appendChild(e))},window.waitingTime))},n=!0;return t.name="order",t.routes={index:function(){return n=!1,i(),t.runController("index")},"index/:tab":function(e){n=!1,i();var a={tab:e};return t.runController("index",a)},submit:function(){return n=!1,i(),t.runController("submit")},"order-details/:id":function(e){n=!1,i();var a={id:e};return t.runController("order-details",a)},"customer-order/:id/:sn":function(e,a){n=!1,i();var r={id:e,sn:a};return t.runController("customer-order",r)},"rate/:id/:sn":function(e,a){n=!1,i();var r={id:e,sn:a};return t.runController("rate",r)},"cost-list/:id":function(e){n=!1,i();var a={id:e};return t.runController("cost-list",a)},"*":function(){return t.runController("index")}},t}),define("order/cost-list-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(t,e,i,n){var a=Dom7,t=(Template7,new t),r="/user/default/upload-file",o="/order/default/submit-repair-plans";return t.run=function(){var t=this;t.setPageTitle("费用列表"),t.id=t.params.id,t.imgLimit=9,t.canSubmit=!0,t.render()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.addEvent(),t.uploadImgEvent(),t.delPlanEvent(),t.inputPriceChangeEvent(),t.submitEvent()},t.addEvent=function(){var t=this;a("#cost-list .add-repair-plan").click(function(e){var i=a("#cost-list .cost-list-div"),n=t.planTpl(i.length+1);a(n).insertBefore(a("#cost-list .cost-total-list-div"))})},t.delPlanEvent=function(){var t=this;a("#cost-list").on("click",".del-plan",function(e){console.log("del plan event"),a(this).parents(".cost-list-div").remove(),a("#cost-list .total-plan-price").html(t.computedPrice())})},t.planTpl=function(t){var e='<div class="cost-list-div"><p class="item-title">第'+t+'项</p><div class="repair-item-cls"><input type="text" class="input-left input-cls" placeholder="填写维修内容" value=""><input type="number" class="input-right input-cls" placeholder="价格" value=""><span class="del-plan"></span></div></div>';return e},t.inputPriceChangeEvent=function(){var t=this;a("#cost-list").on("input propertychange",".input-cls",function(){var e=t.computedPrice();a("#cost-list .total-plan-price").html(e)})},t.computedPrice=function(){var t=a("#cost-list .input-right"),e=0;return a.each(t,function(t,i){e+=1*a(i).val()}),Math.round(e,2)},t.uploadImgEvent=function(){var t=this;a("#cost-list #upload-btn").change(function(){if(""!=a(this).val()&&null!=a(this).val()){var o=a(this).parents("li");n.uploadFile({selector:"#upload-btn",url:e.to(r),processAppendTo:"#cost-list",success:function(e,n){try{if(e.success){var r=e.tmpUrl;a('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+r+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')"></div><span class="del-img"></span></li>').insertBefore(o),t.imgLimit==a("#cost-list #image-list").find(".up-img").length&&a("#cost-list .upload-btn-li").hide()}else i.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),i.toast({content:"出错",closeDelay:5e3})}}})}}),a("#cost-list #image-list").on("click",".del-img",function(e){a(this).parent().remove(),t.imgLimit>=a("#cost-list #image-list").find(".up-img").length&&a("#cost-list .upload-btn-li").show()})},t.submitEvent=function(){var t=this;a("#cost-list .btn-submit").click(function(n){var r=a("#cost-list .content-div").find(".repair-item-cls"),s=[],l=!0,c=!0;if(a.each(r,function(t,e){var n=i.trim(a(e).find(".input-left").val()),r=i.trim(a(e).find(".input-right").val());""==n&&(l=!1),""!=r&&0!=r||(c=!1),s.push({content:n,price:r})}),!l)return i.toast({content:"维修清单有部分未填内容"}),!1;if(!c)return i.toast({content:"维修清单有部分未填价格"}),!1;var d=a("#cost-list #image-list").find(".upload-item"),u=[];if(a.each(d,function(t,e){u.push(a(e).attr("data"))}),!t.canSubmit)return!1;t.canSubmit=!1;var m=t.csrf({images:u,plans:s,id:t.id});i.httpPost(o,m,function(n){t.canSubmit=!0,n.success?window.location.replace(e.to("order#order-details/"+t.id)):i.toast({content:n.message})},!0)})},t}),define("order/customer-order-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,a=Template7,t=new t,r="order/customer/order-details";return t.run=function(){var t=this;t.id=t.params.id,t.sn=t.params.sn,t.success=!0,t.setPageTitle("维修单"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.goToComment(),t.popupImageLayer(),t.agreementEvent()},t.beforeRender=function(){var t=this;console.log("beforeRender"),t.success||(this.view="customer-order-error")},t.loadPage=function(){var t=this,n=t.csrf({id:t.id});i.httpPost(e.to(r),n,function(e){var i=e;t.success=e.success,t.render(i)},!0)},t.goToComment=function(){var t=this;n("#customer-order .rate-btn-cls").click(function(i){window.location.replace(e.to("order/customer#rate/"+t.id+"/"+t.sn))})},t.agreementEvent=function(){n("#customer-order").on("click",".warranty-btn",function(t){n("#warranty-wrapper").remove();var e=n("#customer-order"),i=n("script#warranty-template"),r=a.compile(i.html()),o=r({});e.append(o)}),n("#customer-order").on("click",".agree-btn",function(t){n("#warranty-wrapper").remove()})},t.popupImageLayer=function(){n("#customer-order").on("click",".view-img-cls",function(t){var e=n(this).attr("data-url");n("#img-mask").remove();var i='<div id="img-mask" style="z-index:2;background:#000;justify-content:center;position: absolute;bottom:0;top:0;width:100%;display:flex;flex-direction: column;align-items: center"><div style="width:100%;"> <img width="100%" src="'+e+'" /></div></div>';n("#customer-order").append(i)}),n("#customer-order").on("click","#img-mask, #img-mask img",function(t){t.preventDefault(),t.stopPropagation();var e=document.body.clientHeight,i=n("#img-mask img").height();console.log(e+"dddd"+i);var a=Math.abs(i-e);if(a>=0&&a<=20)n("#img-mask").remove();else{var r=n(t.target).attr("id");"img-mask"==r&&n("#img-mask").remove()}})},t}),define("order/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,a=Template7,t=new t,r="order/default/order-list";return t.run=function(){var t=this;t.setPageTitle("订单列表"),t.tab=t.params.tab,t.page=0,t.nodata="",t.loading=!1,t.pageCount=1,t.render({tab:t.tab}),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.tabEvent(),t.bindScrollEvent(),t.addEvent(),t.orderClickEvent()},t.tabEvent=function(){n(".tab-cls").click(function(t){var e=n(this).attr("data-href");window.location.replace(e)})},t.handleNodata=function(){var t=this;t.nodata="没有数据了";var e=n(".nodata");0==e.length&&n("#index .order-list").append('<div class="nodata">'+t.nodata+"</div>"),t.app.detachInfiniteScroll(".infinite-scroll"),n("#index .infinite-scroll-preloader").remove()},t.loadPage=function(){var t=this;if(t.loading=!0,t.page>=t.pageCount)return void t.handleNodata();var a={status:t.tab};a.page=t.page+1,a=t.csrf(a),n.ajax({method:"GET",url:e.to(r),data:a,dataType:"json",beforeSend:function(){t.showIndicator()},success:function(e){if(1==e.success&&(i.isDefined(e.page)&&(t.page=parseInt(e.page)),i.isDefined(e.page_count)&&(t.pageCount=parseInt(e.page_count)),t.renderItems(e.items,!0),t.page>=t.pageCount))return void t.handleNodata()},error:function(t){},complete:function(e){t.hideIndicator(),t.loading=!1}})},t.bindScrollEvent=function(){var t=this;t.app.attachInfiniteScroll("#index .infinite-scroll"),n("#index .infinite-scroll").on("infinite",function(){t.loading||t.nodata||t.loadPage()})},t.renderItems=function(t,e){var i=n("#index .order-list"),r=n("script#order-item-template"),o=a.compile(r.html()),s=o({list:t});0==e&&(i.html(""),i.append(s)),i.append(s)},t.addEvent=function(){n("#index .add-btn-cls").click(function(t){window.location.href=e.to("order/#submit")})},t.orderClickEvent=function(){n("#index").on("click",".order-item",function(t){var i=n(this).attr("data-id");window.location.href=e.to("order#order-details/"+i)})},t}),define("order/order-details-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,t=(Template7,new t),a="order/default/order-details";return t.run=function(){var t=this;t.id=t.params.id,t.success=!0,t.setPageTitle("维修单"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.finishBtnEvent(),t.popupImageLayer()},t.beforeRender=function(){var t=this;console.log("beforeRender"),t.success||(t.view="order-details-error")},t.loadPage=function(){var t=this,n=t.csrf({id:t.id});i.httpPost(e.to(a),n,function(e){var i=e;t.success=e.success,t.render(i)},!0)},t.finishBtnEvent=function(){var t=this;n("#order-details .finish-submit").click(function(i){window.location.href=e.to("order/#cost-list/"+t.id)})},t.agreementEvent=function(){},t.popupImageLayer=function(){n("#order-details").on("click",".view-img-cls",function(t){var e=n(this).attr("data-url");n("#img-mask").remove();var i='<div id="img-mask" style="z-index:2;background:#000;justify-content:center;position: absolute;bottom:0;top:0;width:100%;display:flex;flex-direction: column;align-items: center"><div style="width:100%;"> <img width="100%" src="'+e+'" /></div></div>';n("#order-details").append(i)}),n("#order-details").on("click","#img-mask, #img-mask img",function(t){t.preventDefault(),t.stopPropagation();var e=document.body.clientHeight,i=n("#img-mask img").height();console.log(e+"dddd"+i);var a=Math.abs(i-e);if(a>=0&&a<=20)n("#img-mask").remove();else{var r=n(t.target).attr("id");"img-mask"==r&&n("#img-mask").remove()}})},t}),define("order/rate-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(t,e,i,n){var a=Dom7,t=(Template7,new t),r="order/customer/submit-rate",o="/user/default/upload-file";return t.run=function(){var t=this;t.id=t.params.id,t.sn=t.params.sn,t.imgLimit=4,t.setPageTitle("评价"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.starClickEvent(),t.submitEvent(),t.uploadImgEvent()},t.loadPage=function(){var t=this;t.render()},t.starClickEvent=function(){a("#rate").on("click",".img-star",function(t){var e=a(this).attr("data-id"),i=a(this).parent(".star-div"),n=i.find(".img-star");a.each(n,function(t,n){var r=a(n).attr("data-id");if(1*r<=e){a(n).addClass("star-on");var o=i.find(".rate-text"),s=a(n).attr("data-txt");o.html(s)}else a(n).removeClass("star-on")})})},t.uploadImgEvent=function(){var t=this;a("#rate #upload-btn").change(function(){if(""!=a(this).val()&&null!=a(this).val()){var r=a(this).parents("li");n.uploadFile({selector:"#upload-btn",url:e.to(o),processAppendTo:"#rate",success:function(e,n){try{if(e.success){var o=e.tmpUrl;a('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+o+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')"></div><span class="del-img"></span></li>').insertBefore(r),t.imgLimit==a("#rate #image-list").find(".up-img").length&&a("#rate .upload-btn-li").hide()}else i.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),i.toast({content:"出错",closeDelay:5e3})}}})}}),a("#rate #image-list").on("click",".del-img",function(e){a(this).parent().remove(),t.imgLimit>=a("#rate #image-list").find(".up-img").length&&a("#rate .upload-btn-li").show()})},t.getUploadImgs=function(){var t=a("#rate #image-list").find(".up-img"),e=[];return 0==t.length?[]:(a.each(t,function(t,i){var n=a(i).find(".upload-item");e.push(n.attr("data"))}),e)},t.submitEvent=function(){var t=this;a("#rate .submit-btn").click(function(n){var o=i.trim(a("#rate .text-content").val()),s=a("#rate .quality-box .img-star"),l=0;a.each(s,function(t,e){a(e).hasClass("star-on")&&l++});var c=a("#rate .effect-box .img-star"),d=0;a.each(c,function(t,e){a(e).hasClass("star-on")&&d++});var u=a("#rate .service-box .img-star"),m=0;a.each(u,function(t,e){a(e).hasClass("star-on")&&m++});var p=t.getUploadImgs(),v=t.csrf({comment:o,id:t.id,qualityStar:l,effectStar:d,serviceStar:m,images:p});i.httpPost(e.to(r),v,function(n){n.success?window.location.replace(e.to("order/customer#customer-order/"+t.id+"/"+t.sn)):i.toast({content:n.message})},!0)})},t}),define("order/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs","mk7/picker"],function(t,e,n,a,r){var o=Dom7,s=Template7,t=new t,l="/user/default/upload-file",c="/order/default/submit",d="/order/default/do-submit",u=!0,m="";return t.run=function(){var t=this;t.setPageTitle("录入维修单"),t.imgLimit=9,t.render(),t.loadInit()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.uploadImgEvent(),t.submitEvent(),t.selectDateEvent(),t.openCarModel(),t.searchCarModel(),t.carModelClick()},t.loadInit=function(){var t=this,e={id:t.id};n.httpGet(c,e,function(t){t.success&&t.address&&(o("#submit .maintainerAddress").val(t.address),o("#submit .maintainerAddress").attr("readonly",!0))},!0)},t.uploadImgEvent=function(){var t=this;o("#submit #upload-btn").change(function(){if(""!=o(this).val()&&null!=o(this).val()){var i=o(this).parents("li");a.uploadFile({selector:"#upload-btn",url:e.to(l),processAppendTo:"#submit",success:function(e,a){try{if(e.success){var r=e.tmpUrl;o('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+r+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')"></div><span class="del-img"></span></li>').insertBefore(i),t.imgLimit==o("#submit #image-list").find(".up-img").length&&o("#submit .upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:5e3})}catch(s){n.toast({content:"出错",closeDelay:5e3})}}})}}),o("#submit #image-list").on("click",".del-img",function(e){o(this).parent().remove(),t.imgLimit>=o("#submit #image-list").find(".up-img").length&&o("#submit .upload-btn-li").show()})},t.submitEvent=function(){var t=this;o("#submit .submit-btn-cls").click(function(i){var a=n.trim(o("#submit .carNo").val()),r=n.trim(o("#submit .carModel").val()),s=n.trim(o("#submit .customer").val()),l=n.trim(o("#submit .phone").val()),c=n.trim(o("#submit .preRepair").val()),m=n.trim(o("#submit .repairPrice").val()),p=n.trim(o("#submit .finishDate").val()),v=n.trim(o("#submit .maintainerAddress").val());if(0==u)return!1;if(""==a)return n.toast({content:"车牌号必填"}),!1;if(""==r)return n.toast({content:"车辆型号必填"}),!1;if(""==s)return n.toast({content:"客户名称必填"}),!1;if(""==l)return n.toast({content:"客联系电话必填"}),!1;if(!n.isMobile(l)&&!n.isTelephone(l))return n.toast({content:"客联系电话有误"}),!1;if(""==p)return n.toast({content:"预估完成时间必填"}),!1;if(""==v)return n.toast({content:"维修厂地址必填"}),!1;var f=t.getUploadImgs();if(0==f.length)return n.toast({content:"请上传车损照"}),!1;u=!1;var g=t.csrf({carNo:a,carModel:r,customer:s,phone:l,preRepair:c,repairPrice:m,finishDate:p,images:f,address:v});n.httpPost(d,g,function(t){return u=!0,t.success?void window.location.replace(e.to("order#order-details/"+t.orderId)):(n.toast({content:t.message}),!1)},!0)})},t.getUploadImgs=function(){var t=o("#submit #image-list").find(".up-img"),e=[];return 0==t.length?[]:(o.each(t,function(t,i){var n=o(i).find(".upload-item");e.push(n.attr("data"))}),e)},t.selectDateEvent=function(){var t=this;o("#submit .finish-date-input").click(function(e){var i=o("#submit .finish-date-input").val();console.log(i),t.dateTimeSelector("#submit .finish-date-input",i)})},t.dateTimeSelector=function(t,e){var n=this,a=new Date,r=30,s=a.getFullYear(),l=a.getMonth(),c=a.getDate(),d=a.getHours(),u=s+"-"+(l+1)+"-"+c;if(""!=e&&null!=e&&void 0!==e){var p=e.split(" ");u=p[0],d=p[1]}var v=[];for(i=0;i<=r;i++){var f=new Date;f.setDate(a.getDate()+i);var g=f.getFullYear()+"-"+(f.getMonth()+1)+"-"+f.getDate();v.push(g)}var h=n.app.picker({input:t,toolbarTemplate:'<div class="toolbar"><div class="toolbar-inner"><div class="left">请选择用工时间</div><div class="right"><a href="javascript:void(0);" class="link submit-confirm-picker">确定</a></div></div></div>',value:[u,d],onChange:function(t,e,i){var n,a,r;if(e[0]instanceof Date)n=e[0].getFullYear(),a=e[0].getMonth(),r=e[0].getDate();else{var o=e[0].split("-");n=o[0],a=o[1]-1,r=o[2]}var s=new Date(n,a,r,e[1],0),l=new Date((new Date).getTime()+36e5);if(s<l){if(void 0===t.cols[0])return!1;var c=l.getHours(),d=l.getFullYear()+"-"+(l.getMonth()+1)+"-"+l.getDate(),u=new Date(l.getFullYear(),l.getMonth(),l.getDate(),l.getHours(),0);if(u-new Date<9e5){var m=new Date(u.getTime()+36e5);c=m.getHours(),d=m.getFullYear()+"-"+(m.getMonth()+1)+"-"+m.getDate()}t.cols[0].setValue(d),t.cols[2].setValue(c)}},formatValue:function(t,e,i){var n="";n=e[0]instanceof Date?e[0].getFullYear()+"-"+(e[0].getMonth()+1)+"-"+e[0].getDate():e[0];var a=n+" "+e[1];return a},cols:[{values:v,displayValues:function(){var t=[],e=new Date,i=e.getFullYear(),n=e.getMonth()+1,a=e.getDate();e.setDate(e.getDate()+1);for(var r=0;r<v.length;r++){var o=v[r],s=o.split("-"),l=s[1]+"月"+s[2]+"日";i==s[0]&&1*n==s[1]&&1*a==s[2]&&(l+="(今天)"),1*e.getFullYear()==s[0]&&1*e.getMonth()+1==s[1]&&1*e.getDate()==s[2]&&(l+="(明天)"),t.push(l)}return t}()},{divider:!0,content:" "},{values:function(){for(var t=[],e=0;e<=23;e++)t.push(e);return t}(),displayValues:function(){for(var t=[],e=0;e<=23;e++)t.push(e<10?"0"+e+"时":e+"时");return t}()},{divider:!0,content:" "}],onClose:function(e){if(h){var i=h.value,n=i[1]<10?"0"+i[1]:i[1];m=i[0]+" "+n,o(t).val(m),h.destroy()}}});h.open(),o(".submit-confirm-picker").on("click",function(e){e.preventDefault();var i=h.value,n=i[1]<10?"0"+i[1]:i[1];m=i[0]+" "+n,o(t).val(m),h.destroy()})},t.openCarModel=function(){o("#submit").on("click",".carModel",function(t){o("#search-wrapper").remove();var e=o("#submit"),i=o("script#search-car-model-template"),n=s.compile(i.html()),a=n({keyword:""});e.append(a)})},t.renderCarModelItem=function(t){var e=o("#search-wrapper .model-list"),i=o("script#search-car-model-item-template"),n=s.compile(i.html()),a=n({items:t});e.html(a)},t.searchCarModel=function(){var t=this;o("#submit").on("click",".model-search-btn",function(e){t.ajaxSearch()}),o("#submit").on("submit","#search-form",function(e){return e.preventDefault(),t.ajaxSearch(),!1})},t.ajaxSearch=function(){var t=this,i={keyword:o("#search-wrapper .search-input").val()};o.ajax({method:"POST",url:e.to("order/default/search-model"),data:i,dataType:"json",beforeSend:function(){t.showIndicator()},success:function(e){e.success?t.renderCarModelItem(e.items):t.renderCarModelItem([])},error:function(t){},complete:function(e){t.hideIndicator()}})},t.carModelClick=function(){o("#submit").on("click",".model-div-btn",function(t){var e=o(this).attr("data-value");o("#submit .carModel").val(e),o("#search-wrapper").remove()}),o("#submit").on("click",".closeBtn",function(t){o("#search-wrapper").remove()})},t}); | |
2 | 1 | \ No newline at end of file |
2 | +define("order-app",["mk7/app"],function(t){var e=Dom7,i=function(){var t=e(".ui-loading-block");0==t.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 t=document.getElementById("loader-inner"),e=document.createElement("p");e.className="notice",t&&(e.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',t.appendChild(e))},window.waitingTime))},n=!0;return t.name="order",t.routes={index:function(){return n=!1,i(),t.runController("index")},"index/:tab":function(e){n=!1,i();var a={tab:e};return t.runController("index",a)},submit:function(){return n=!1,i(),t.runController("submit")},"order-details/:id":function(e){n=!1,i();var a={id:e};return t.runController("order-details",a)},"customer-order/:id/:sn":function(e,a){n=!1,i();var r={id:e,sn:a};return t.runController("customer-order",r)},"rate/:id/:sn":function(e,a){n=!1,i();var r={id:e,sn:a};return t.runController("rate",r)},"cost-list/:id":function(e){n=!1,i();var a={id:e};return t.runController("cost-list",a)},"*":function(){return t.runController("index")}},t}),define("order/cost-list-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(t,e,i,n){var a=Dom7,t=(Template7,new t),r="/user/default/upload-file",o="/order/default/submit-repair-plans";return t.run=function(){var t=this;t.setPageTitle("费用列表"),t.id=t.params.id,t.imgLimit=9,t.canSubmit=!0,t.render()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.addEvent(),t.uploadImgEvent(),t.delPlanEvent(),t.inputPriceChangeEvent(),t.submitEvent()},t.addEvent=function(){var t=this;a("#cost-list .add-repair-plan").click(function(e){var i=a("#cost-list .cost-list-div"),n=t.planTpl(i.length+1);a(n).insertBefore(a("#cost-list .cost-total-list-div"))})},t.delPlanEvent=function(){var t=this;a("#cost-list").on("click",".del-plan",function(e){console.log("del plan event"),a(this).parents(".cost-list-div").remove(),a("#cost-list .total-plan-price").html(t.computedPrice())})},t.planTpl=function(t){var e='<div class="cost-list-div"><p class="item-title">第'+t+'项</p><div class="repair-item-cls"><input type="text" class="input-left input-cls" placeholder="填写维修内容" value=""><input type="number" class="input-right input-cls" placeholder="价格" value=""><span class="del-plan"></span></div></div>';return e},t.inputPriceChangeEvent=function(){var t=this;a("#cost-list").on("input propertychange",".input-cls",function(){var e=t.computedPrice();a("#cost-list .total-plan-price").html(e)})},t.computedPrice=function(){var t=a("#cost-list .input-right"),e=0;return a.each(t,function(t,i){e+=1*a(i).val()}),Math.round(e,2)},t.uploadImgEvent=function(){var t=this;a("#cost-list #upload-btn").change(function(){if(""!=a(this).val()&&null!=a(this).val()){var o=a(this).parents("li");n.uploadFile({selector:"#upload-btn",url:e.to(r),processAppendTo:"#cost-list",success:function(e,n){try{if(e.success){var r=e.tmpUrl;a('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+r+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')"></div><span class="del-img"></span></li>').insertBefore(o),t.imgLimit==a("#cost-list #image-list").find(".up-img").length&&a("#cost-list .upload-btn-li").hide()}else i.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),i.toast({content:"出错",closeDelay:5e3})}}})}}),a("#cost-list #image-list").on("click",".del-img",function(e){a(this).parent().remove(),t.imgLimit>=a("#cost-list #image-list").find(".up-img").length&&a("#cost-list .upload-btn-li").show()})},t.submitEvent=function(){var t=this;a("#cost-list .btn-submit").click(function(n){var r=a("#cost-list .content-div").find(".repair-item-cls"),s=[],l=!0,c=!0;if(a.each(r,function(t,e){var n=i.trim(a(e).find(".input-left").val()),r=i.trim(a(e).find(".input-right").val());""==n&&(l=!1),""!=r&&0!=r||(c=!1),s.push({content:n,price:r})}),!l)return i.toast({content:"维修清单有部分未填内容"}),!1;if(!c)return i.toast({content:"维修清单有部分未填价格"}),!1;var u=a("#cost-list #image-list").find(".upload-item"),d=[];if(a.each(u,function(t,e){d.push(a(e).attr("data"))}),!t.canSubmit)return!1;t.canSubmit=!1;var m=t.csrf({images:d,plans:s,id:t.id});i.httpPost(o,m,function(n){t.canSubmit=!0,n.success?window.location.replace(e.to("order#order-details/"+t.id)):i.toast({content:n.message})},!0)})},t}),define("order/customer-order-controller",["mk7/controller","mk7/url","mk7/utils","mk7/photo-browser"],function(t,e,i,n){var a=Dom7,r=Template7,t=new t,o="order/customer/order-details";return t.run=function(){var t=this;t.id=t.params.id,t.sn=t.params.sn,t.success=!0,t.setPageTitle("维修单"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.goToComment(),t.popupImageLayer(),t.agreementEvent()},t.beforeRender=function(){var t=this;console.log("beforeRender"),t.success||(this.view="customer-order-error")},t.loadPage=function(){var t=this,n=t.csrf({id:t.id});i.httpPost(e.to(o),n,function(e){var i=e;t.success=e.success,t.render(i)},!0)},t.goToComment=function(){var t=this;a("#customer-order .rate-btn-cls").click(function(i){window.location.replace(e.to("order/customer#rate/"+t.id+"/"+t.sn))})},t.agreementEvent=function(){a("#customer-order").on("click",".warranty-btn",function(t){a("#warranty-wrapper").remove();var e=a("#customer-order"),i=a("script#warranty-template"),n=r.compile(i.html()),o=n({});e.append(o)}),a("#customer-order").on("click",".agree-btn",function(t){a("#warranty-wrapper").remove()})},t.popupImageLayer=function(){var t=this;a("#customer-order").on("click",".view-img-cls",function(e){var i=a(this).parents("ul"),n=i.find(".view-img-cls"),r=[],o=a(this).attr("data-index");a.each(n,function(t,e){var i=a(e).attr("data-url");r.push(i)});var s=t.app.photoBrowser({photos:r,initialSlide:o});s.open()})},t}),define("order/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,a=Template7,t=new t,r="order/default/order-list";return t.run=function(){var t=this;t.setPageTitle("订单列表"),t.tab=t.params.tab,t.page=0,t.nodata="",t.loading=!1,t.pageCount=1,t.render({tab:t.tab}),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.tabEvent(),t.bindScrollEvent(),t.addEvent(),t.orderClickEvent()},t.tabEvent=function(){n(".tab-cls").click(function(t){var e=n(this).attr("data-href");window.location.replace(e)})},t.handleNodata=function(){var t=this;t.nodata="没有数据了";var e=n(".nodata");0==e.length&&n("#index .order-list").append('<div class="nodata">'+t.nodata+"</div>"),t.app.detachInfiniteScroll(".infinite-scroll"),n("#index .infinite-scroll-preloader").remove()},t.loadPage=function(){var t=this;if(t.loading=!0,t.page>=t.pageCount)return void t.handleNodata();var a={status:t.tab};a.page=t.page+1,a=t.csrf(a),n.ajax({method:"GET",url:e.to(r),data:a,dataType:"json",beforeSend:function(){t.showIndicator()},success:function(e){if(1==e.success&&(i.isDefined(e.page)&&(t.page=parseInt(e.page)),i.isDefined(e.page_count)&&(t.pageCount=parseInt(e.page_count)),t.renderItems(e.items,!0),t.page>=t.pageCount))return void t.handleNodata()},error:function(t){},complete:function(e){t.hideIndicator(),t.loading=!1}})},t.bindScrollEvent=function(){var t=this;t.app.attachInfiniteScroll("#index .infinite-scroll"),n("#index .infinite-scroll").on("infinite",function(){t.loading||t.nodata||t.loadPage()})},t.renderItems=function(t,e){var i=n("#index .order-list"),r=n("script#order-item-template"),o=a.compile(r.html()),s=o({list:t});0==e&&(i.html(""),i.append(s)),i.append(s)},t.addEvent=function(){n("#index .add-btn-cls").click(function(t){window.location.href=e.to("order/#submit")})},t.orderClickEvent=function(){n("#index").on("click",".order-item",function(t){var i=n(this).attr("data-id");window.location.href=e.to("order#order-details/"+i)})},t}),define("order/order-details-controller",["mk7/controller","mk7/url","mk7/utils","mk7/photo-browser"],function(t,e,i,n){var a=Dom7,t=(Template7,new t),r="order/default/order-details";return t.run=function(){var t=this;t.id=t.params.id,t.success=!0,t.setPageTitle("维修单"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.finishBtnEvent(),t.popupImageLayer()},t.beforeRender=function(){var t=this;console.log("beforeRender"),t.success||(t.view="order-details-error")},t.loadPage=function(){var t=this,n=t.csrf({id:t.id});i.httpPost(e.to(r),n,function(e){var i=e;t.success=e.success,t.render(i)},!0)},t.finishBtnEvent=function(){var t=this;a("#order-details .finish-submit").click(function(i){window.location.href=e.to("order/#cost-list/"+t.id)})},t.agreementEvent=function(){},t.popupImageLayer=function(){var t=this;a("#order-details").on("click",".view-img-cls",function(e){var i=a(this).parents("ul"),n=i.find(".view-img-cls"),r=[],o=a(this).attr("data-index");a.each(n,function(t,e){var i=a(e).attr("data-url");r.push(i)});var s=t.app.photoBrowser({photos:r,initialSlide:o});s.open()})},t}),define("order/rate-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(t,e,i,n){var a=Dom7,t=(Template7,new t),r="order/customer/submit-rate",o="/user/default/upload-file";return t.run=function(){var t=this;t.id=t.params.id,t.sn=t.params.sn,t.imgLimit=4,t.setPageTitle("评价"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.starClickEvent(),t.submitEvent(),t.uploadImgEvent()},t.loadPage=function(){var t=this;t.render({servicePhone:window.$site.servicePhone})},t.starClickEvent=function(){a("#rate").on("click",".img-star",function(t){var e=a(this).attr("data-id"),i=a(this).parent(".star-div"),n=i.find(".img-star");a.each(n,function(t,n){var r=a(n).attr("data-id");if(1*r<=e){a(n).addClass("star-on");var o=i.find(".rate-text"),s=a(n).attr("data-txt");o.html(s)}else a(n).removeClass("star-on")})})},t.uploadImgEvent=function(){var t=this;a("#rate #upload-btn").change(function(){if(""!=a(this).val()&&null!=a(this).val()){var r=a(this).parents("li");n.uploadFile({selector:"#upload-btn",url:e.to(o),processAppendTo:"#rate",success:function(e,n){try{if(e.success){var o=e.tmpUrl;a('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+o+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')"></div><span class="del-img"></span></li>').insertBefore(r),t.imgLimit==a("#rate #image-list").find(".up-img").length&&a("#rate .upload-btn-li").hide()}else i.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),i.toast({content:"出错",closeDelay:5e3})}}})}}),a("#rate #image-list").on("click",".del-img",function(e){a(this).parent().remove(),t.imgLimit>=a("#rate #image-list").find(".up-img").length&&a("#rate .upload-btn-li").show()})},t.getUploadImgs=function(){var t=a("#rate #image-list").find(".up-img"),e=[];return 0==t.length?[]:(a.each(t,function(t,i){var n=a(i).find(".upload-item");e.push(n.attr("data"))}),e)},t.submitEvent=function(){var t=this;a("#rate .submit-btn").click(function(n){var o=i.trim(a("#rate .text-content").val()),s=a("#rate .quality-box .img-star"),l=0;a.each(s,function(t,e){a(e).hasClass("star-on")&&l++});var c=a("#rate .effect-box .img-star"),u=0;a.each(c,function(t,e){a(e).hasClass("star-on")&&u++});var d=a("#rate .service-box .img-star"),m=0;a.each(d,function(t,e){a(e).hasClass("star-on")&&m++});var p=t.getUploadImgs(),v=t.csrf({comment:o,id:t.id,qualityStar:l,effectStar:u,serviceStar:m,images:p});i.httpPost(e.to(r),v,function(n){n.success?window.location.replace(e.to("order/customer#customer-order/"+t.id+"/"+t.sn)):i.toast({content:n.message})},!0)})},t}),define("order/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs","mk7/picker"],function(t,e,n,a,r){var o=Dom7,s=Template7,t=new t,l="/user/default/upload-file",c="/order/default/do-submit",u=!0,d="";return t.run=function(){var t=this;t.setPageTitle("录入维修单"),t.imgLimit=9,t.render(),t.loadInit()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.uploadImgEvent(),t.submitEvent(),t.selectDateEvent(),t.openCarModel(),t.searchCarModel(),t.carModelClick()},t.loadInit=function(){var t=this;({id:t.id})},t.uploadImgEvent=function(){var t=this;o("#submit #upload-btn").change(function(){if(""!=o(this).val()&&null!=o(this).val()){var i=o(this).parents("li");a.uploadFile({selector:"#upload-btn",url:e.to(l),processAppendTo:"#submit",success:function(e,a){try{if(e.success){var r=e.tmpUrl;o('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+r+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')"></div><span class="del-img"></span></li>').insertBefore(i),t.imgLimit==o("#submit #image-list").find(".up-img").length&&o("#submit .upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:5e3})}catch(s){n.toast({content:"出错",closeDelay:5e3})}}})}}),o("#submit #image-list").on("click",".del-img",function(e){o(this).parent().remove(),t.imgLimit>=o("#submit #image-list").find(".up-img").length&&o("#submit .upload-btn-li").show()})},t.submitEvent=function(){var t=this;o("#submit .submit-btn-cls").click(function(i){var a=n.trim(o("#submit .carNo").val()),r=n.trim(o("#submit .carModel").val()),s=n.trim(o("#submit .customer").val()),l=n.trim(o("#submit .phone").val()),d=n.trim(o("#submit .preRepair").val()),m=n.trim(o("#submit .repairPrice").val()),p=n.trim(o("#submit .finishDate").val());if(0==u)return!1;if(""==a)return n.toast({content:"车牌号必填"}),!1;if(""==r)return n.toast({content:"车辆型号必填"}),!1;if(""==s)return n.toast({content:"客户名称必填"}),!1;if(""==l)return n.toast({content:"客联系电话必填"}),!1;if(!n.isMobile(l)&&!n.isTelephone(l))return n.toast({content:"客联系电话有误"}),!1;if(""==d)return n.toast({content:"预估维修内容必填"}),!1;if(""==m)return n.toast({content:"预估维修费用必填"}),!1;if(""==p)return n.toast({content:"预估完成时间必填"}),!1;var v=t.getUploadImgs();if(0==v.length)return n.toast({content:"请上传车损照"}),!1;u=!1;var f=t.csrf({carNo:a,carModel:r,customer:s,phone:l,preRepair:d,repairPrice:m,finishDate:p,images:v});n.httpPost(c,f,function(t){return u=!0,t.success?void window.location.replace(e.to("order#order-details/"+t.orderId)):(n.toast({content:t.message}),!1)},!0)})},t.getUploadImgs=function(){var t=o("#submit #image-list").find(".up-img"),e=[];return 0==t.length?[]:(o.each(t,function(t,i){var n=o(i).find(".upload-item");e.push(n.attr("data"))}),e)},t.selectDateEvent=function(){var t=this;o("#submit .finish-date-input").click(function(e){var i=o("#submit .finish-date-input").val();t.dateTimeSelector("#submit .finish-date-input",i)})},t.dateTimeSelector=function(t,e){var n=this,a=new Date,r=30,s=a.getFullYear(),l=a.getMonth(),c=a.getDate(),u=a.getHours(),m=s+"-"+(l+1)+"-"+c;if(""!=e&&null!=e&&void 0!==e){var p=e.split(" ");m=p[0],u=p[1]}var v=[];for(i=0;i<=r;i++){var f=new Date;f.setDate(a.getDate()+i);var h=f.getFullYear()+"-"+(f.getMonth()+1)+"-"+f.getDate();v.push(h)}var g=n.app.picker({input:t,toolbarTemplate:'<div class="toolbar"><div class="toolbar-inner"><div class="left">请选择用工时间</div><div class="right"><a href="javascript:void(0);" class="link submit-confirm-picker">确定</a></div></div></div>',value:[m,u],onChange:function(t,e,i){var n,a,r;if(e[0]instanceof Date)n=e[0].getFullYear(),a=e[0].getMonth(),r=e[0].getDate();else{var o=e[0].split("-");n=o[0],a=o[1]-1,r=o[2]}var s=new Date(n,a,r,e[1],0),l=new Date((new Date).getTime()+36e5);if(s<l){if(void 0===t.cols[0])return!1;var c=l.getHours(),u=l.getFullYear()+"-"+(l.getMonth()+1)+"-"+l.getDate(),d=new Date(l.getFullYear(),l.getMonth(),l.getDate(),l.getHours(),0);if(d-new Date<9e5){var m=new Date(d.getTime()+36e5);c=m.getHours(),u=m.getFullYear()+"-"+(m.getMonth()+1)+"-"+m.getDate()}t.cols[0].setValue(u),t.cols[2].setValue(c)}},formatValue:function(t,e,i){var n="";n=e[0]instanceof Date?e[0].getFullYear()+"-"+(e[0].getMonth()+1)+"-"+e[0].getDate():e[0];var a=n+" "+e[1];return a},cols:[{values:v,displayValues:function(){var t=[],e=new Date,i=e.getFullYear(),n=e.getMonth()+1,a=e.getDate();e.setDate(e.getDate()+1);for(var r=0;r<v.length;r++){var o=v[r],s=o.split("-"),l=s[1]+"月"+s[2]+"日";i==s[0]&&1*n==s[1]&&1*a==s[2]&&(l+="(今天)"),1*e.getFullYear()==s[0]&&1*e.getMonth()+1==s[1]&&1*e.getDate()==s[2]&&(l+="(明天)"),t.push(l)}return t}()},{divider:!0,content:" "},{values:function(){for(var t=[],e=0;e<=23;e++)t.push(e);return t}(),displayValues:function(){for(var t=[],e=0;e<=23;e++)t.push(e<10?"0"+e+"时":e+"时");return t}()},{divider:!0,content:" "}],onClose:function(e){if(g){var i=g.value,n=i[1]<10?"0"+i[1]:i[1];d=i[0]+" "+n,o(t).val(d),g.destroy()}}});g.open(),o(".submit-confirm-picker").on("click",function(e){e.preventDefault();var i=g.value,n=i[1]<10?"0"+i[1]:i[1];d=i[0]+" "+n,o(t).val(d),g.destroy()})},t.openCarModel=function(){o("#submit").on("click",".carModel",function(t){o("#search-wrapper").remove();var e=o("#submit"),i=o("script#search-car-model-template"),n=s.compile(i.html()),a=n({keyword:""});e.append(a)})},t.renderCarModelItem=function(t){var e=o("#search-wrapper .model-list"),i=o("script#search-car-model-item-template"),n=s.compile(i.html()),a=n({items:t});e.html(a)},t.searchCarModel=function(){var t=this;o("#submit").on("click",".model-search-btn",function(e){t.ajaxSearch()}),o("#submit").on("submit","#search-form",function(e){return e.preventDefault(),t.ajaxSearch(),!1})},t.ajaxSearch=function(){var t=this,i={keyword:o("#search-wrapper .search-input").val()};o.ajax({method:"POST",url:e.to("order/default/search-model"),data:i,dataType:"json",beforeSend:function(){t.showIndicator()},success:function(e){e.success?t.renderCarModelItem(e.items):t.renderCarModelItem([])},error:function(t){},complete:function(e){t.hideIndicator()}})},t.carModelClick=function(){o("#submit").on("click",".model-div-btn",function(t){var e=o(this).attr("data-value");o("#submit .carModel").val(e),o("#search-wrapper").remove()}),o("#submit").on("click",".closeBtn",function(t){o("#search-wrapper").remove()})},t}); | |
3 | 3 | \ No newline at end of file | ... | ... |
web/dist/js/user-app.js
1 | -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))},r=!0;return e.name="user",e.routes={index:function(){return r=!1,n(),e.runController("index")},register:function(){return r=!1,n(),e.runController("register")},login:function(){return r=!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 r=Dom7,e=(Template7,new e),o="/user/login/get-code",i="/user/login/login",c=!0,s=!0,a=null;return e.run=function(){var e=this;return e.setPageTitle("登录"),e.codeDuration=60,isGuest?void e.render():(window.location.href=t.to("order/#index"),"")},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.getCodeEvent(),e.gotoRegisterEvent(),e.loginEvent()},e.getCodeEvent=function(){var e=this;r("#login .get-code-cls").click(function(){var i=n.trim(r("#login .mobile").val());if(""==i)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(i))return n.toast({content:"手机号码不合格"}),!1;if(0==c)return!1;clearInterval(a),c=!1;var s=e.csrf({action:"login",mobile:i});n.httpGet(t.to(o),s,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),c=!0,!1;n.toast({content:t.message}),t.testCode&&r("#login .code").val(t.testCode);var o=t.codeDuration;e.codeDuration=o,a=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(r("#login .get-code-cls").html("获取验证码"),clearInterval(a),e.codeDuration=o,c=!0):r("#login .get-code-cls").html('<span class="count-down-cls">'+e.codeDuration+"s后重新获取</span>")},1e3)})})},e.loginEvent=function(){var e=this;r("#login .login-btn").click(function(o){var c=n.trim(r("#login .mobile").val()),a=n.trim(r("#login .code").val());if(""==c)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(c))return n.toast({content:"手机号码不合格"}),!1;if(""==a)return n.toast({content:"验证码必填"}),!1;if(0==s)return!1;s=!1;var l=e.csrf({mobile:c,code:a});n.httpPost(t.to(i),l,function(e){return s=!0,e.success?void(window.location.href=t.to("order/#index")):(n.toast({content:e.message,closeDelay:3e3}),!1)})})},e.gotoRegisterEvent=function(){r("#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,r){var o=Dom7,i=Template7,e=new e,c="/user/login/register",s="/user/default/upload-file",a="/user/login/get-code",l=!0,u=!0,d=null;return e.run=function(){var e=this;return e.setPageTitle("注册"),e.codeDuration=60,isGuest?void e.render():(window.location.href=t.to("order/#index"),"")},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.uploadEvent(),e.getCodeEvent(),e.registerEvent(),e.gotoLoginEvent(),e.checkAgreement()},e.uploadEvent=function(){o("#register .upload-input-cls").change(function(){if(""!=o(this).val()&&null!=o(this).val()){var e=o(this).attr("id"),i=o(this).parent();r.uploadFile({selector:"#"+e,url:t.to(s),processAppendTo:"#register",success:function(e,t){try{if(e.success){var r=e.tmpUrl;i.css("background-image","url("+e.tmpMinUrl+")"),i.attr("data",e.tmpFile),i.attr("data-url",r)}else n.toast({content:e.message,closeDelay:5e3})}catch(o){n.toast({content:"出错",closeDelay:5e3})}}})}})},e.getCodeEvent=function(){var e=this;o("#register .get-code-cls").click(function(){var r=n.trim(o("#register .mobile").val());if(""==r)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(r))return n.toast({content:"手机号码不合格"}),!1;if(0==l)return!1;clearInterval(d),l=!1;var i=e.csrf({action:"register",mobile:r});n.httpGet(t.to(a),i,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),l=!0,!1;n.toast({content:t.message}),t.testCode&&o("#register .code").val(t.testCode);var r=t.codeDuration;e.codeDuration=r,d=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(o("#register .get-code-cls").html("获取验证码"),clearInterval(d),e.codeDuration=r,l=!0):o("#register .get-code-cls").html('<span class="count-down-cls">'+e.codeDuration+"s后重新获取</span>")},1e3)})})},e.registerEvent=function(){var e=this;o("#register .register-btn").click(function(r){var i=n.trim(o("#register .name").val()),s=n.trim(o("#register .mobile").val()),a=n.trim(o("#register .code").val()),l=n.trim(o("#register .emergency_contact").val()),d=n.trim(o("#register .emergency_person").val());if(""==i)return n.toast({content:"车厂名称必填"}),!1;if(""==s)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(s))return n.toast({content:"手机号码不合格"}),!1;if(""==a)return n.toast({content:"验证码必填"}),!1;if(""==d)return n.toast({content:"紧急联系人必填"}),!1;if(""==l)return n.toast({content:"紧急联系电话必填"}),!1;if(!n.isMobile(l)&&!n.isTelephone(l))return n.toast({content:"紧急联系电话不合格"}),!1;if(l==s)return n.toast({content:"紧急联系电话不能和注册手机一样"}),!1;var g=o("#register .licensePic").attr("data");if(void 0===g||null==g)return n.toast({content:"请上传营业执照"}),!1;var v=o("#register .headPic").attr("data");if(void 0===v||null==v)return n.toast({content:"请上传维修厂门头照"}),!1;var f=o("#register .techChargePic").attr("data");if(void 0===f||null==f)return n.toast({content:"请上传维修技术负责人证书"}),!1;var m=o("#register .QAChargePic").attr("data");if(void 0===m||null==m)return n.toast({content:"请上传质检负责人证书"}),!1;if(!o("#register .check-agreement").hasClass("checked-active"))return n.toast({content:"请阅读同意《平台车管家服务条款》"}),!1;if(0==u)return!1;u=!1;var h=e.csrf({name:i,mobile:s,code:a,emergencyContact:l,emergencyPerson:d,licensePic:g,headPic:v,techChargePic:f,QAChargePic:m});n.httpPost(t.to(c),h,function(e){if(!e.success)return n.toast({content:e.message,closeDelay:3e3}),u=!0,!1;var r=3e3;n.toast({content:e.message,closeDelay:r}),setTimeout(function(){window.location.href=t.to("order/#index")},r)})})},e.gotoLoginEvent=function(){o("#register .login-btn").click(function(e){window.location.href=t.to("user/#login")})},e.checkAgreement=function(){o("#register .check-agreement").click(function(e){o(this).hasClass("checked-active")?o(this).removeClass("checked-active"):o(this).addClass("checked-active")}),o("#register .agreement-cls").click(function(e){o("#agreement-wrapper").remove();var t=o("#register"),n=o("script#agreement-template"),r=i.compile(n.html()),c=r({});t.append(c)}),o("#register").on("click",".agree-btn",function(e){o("#agreement-wrapper").remove();var t=o("#register .check-agreement");t.hasClass("checked-active")||t.addClass("checked-active")})},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))},r=!0;return e.name="user",e.routes={index:function(){return r=!1,n(),e.runController("index")},register:function(){return r=!1,n(),e.runController("register")},login:function(){return r=!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 r=Dom7,e=(Template7,new e),o="/user/login/get-code",i="/user/login/login",c=!0,s=!0,a=null;return e.run=function(){var e=this;e.setPageTitle("登录"),e.codeDuration=60,!isGuest,e.render();const t=new Promise(function(e,t){setTimeout(function(){e("foo")},300)});t.then(function(e){console.log(e)}),console.log(t)},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.getCodeEvent(),e.gotoRegisterEvent(),e.loginEvent()},e.getCodeEvent=function(){var e=this;r("#login .get-code-cls").click(function(){var i=n.trim(r("#login .mobile").val());if(""==i)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(i))return n.toast({content:"手机号码不合格"}),!1;if(0==c)return!1;clearInterval(a),c=!1;var s=e.csrf({action:"login",mobile:i});n.httpGet(t.to(o),s,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),c=!0,!1;n.toast({content:t.message}),t.testCode&&r("#login .code").val(t.testCode);var o=t.codeDuration;e.codeDuration=o,a=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(r("#login .get-code-cls").html("获取验证码"),clearInterval(a),e.codeDuration=o,c=!0):r("#login .get-code-cls").html('<span class="count-down-cls">'+e.codeDuration+"s后重新获取</span>")},1e3)})})},e.loginEvent=function(){var e=this;r("#login .login-btn").click(function(o){var c=n.trim(r("#login .mobile").val()),a=n.trim(r("#login .code").val());if(""==c)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(c))return n.toast({content:"手机号码不合格"}),!1;if(""==a)return n.toast({content:"验证码必填"}),!1;if(0==s)return!1;s=!1;var l=e.csrf({mobile:c,code:a});n.httpPost(t.to(i),l,function(e){return s=!0,e.success?void(window.location.href=t.to("order/#index")):(n.toast({content:e.message,closeDelay:3e3}),!1)})})},e.gotoRegisterEvent=function(){r("#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,r){var o=Dom7,i=Template7,e=new e,c="/user/login/register",s="/user/default/upload-file",a="/user/login/get-code",l=!0,u=!0,d=null,g=!1;return e.run=function(){var e=this;e.setPageTitle("注册"),e.codeDuration=60,!isGuest,e.render()},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.uploadEvent(),e.getCodeEvent(),e.registerEvent(),e.gotoLoginEvent(),e.checkAgreement()},e.uploadEvent=function(){o("#register .upload-input-cls").change(function(e){if(""!=o(this).val()&&null!=o(this).val()){var i=e.target,c=(i.files[0],o(this).attr("id")),a=o(this).parent();r.uploadFile({selector:"#"+c,url:t.to(s),processAppendTo:"#register",success:function(e,t){try{if(e.success){var r=e.tmpUrl;a.css("background-image","url("+e.tmpMinUrl+")"),a.attr("data",e.tmpFile),a.attr("data-url",r)}else n.toast({content:e.message,closeDelay:5e3})}catch(o){n.toast({content:"出错",closeDelay:5e3})}}})}})},e.getCodeEvent=function(){var e=this;o("#register .get-code-cls").click(function(){var r=n.trim(o("#register .mobile").val());if(""==r)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(r))return n.toast({content:"手机号码不合格"}),!1;if(0==l)return!1;clearInterval(d),l=!1;var i=e.csrf({action:"register",mobile:r});n.httpGet(t.to(a),i,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),l=!0,!1;n.toast({content:t.message}),t.testCode&&o("#register .code").val(t.testCode);var r=t.codeDuration;e.codeDuration=r,d=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(o("#register .get-code-cls").html("获取验证码"),clearInterval(d),e.codeDuration=r,l=!0):o("#register .get-code-cls").html('<span class="count-down-cls">'+e.codeDuration+"s后重新获取</span>")},1e3)})})},e.registerEvent=function(){var e=this;o("#register .register-btn").click(function(r){var i=n.trim(o("#register .name").val()),s=n.trim(o("#register .mobile").val()),a=n.trim(o("#register .code").val()),l=n.trim(o("#register .emergency_contact").val()),d=n.trim(o("#register .emergency_person").val()),g=n.trim(o("#register .address").val());if(""==i)return n.toast({content:"车厂名称必填"}),!1;if(""==s)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(s))return n.toast({content:"手机号码不合格"}),!1;if(""==a)return n.toast({content:"验证码必填"}),!1;if(""==d)return n.toast({content:"紧急联系人必填"}),!1;if(""==l)return n.toast({content:"紧急联系电话必填"}),!1;if(!n.isMobile(l)&&!n.isTelephone(l))return n.toast({content:"紧急联系电话不合格"}),!1;if(l==s)return n.toast({content:"紧急联系电话不能和注册手机一样"}),!1;if(""==g)return n.toast({content:"维修厂地址必填"}),!1;var v=o("#register .licensePic").attr("data");if(void 0===v||null==v)return n.toast({content:"请上传营业执照"}),!1;var m=o("#register .headPic").attr("data");if(void 0===m||null==m)return n.toast({content:"请上传维修厂门头照"}),!1;var f=o("#register .techChargePic").attr("data");if(void 0===f||null==f)return n.toast({content:"请上传维修技术负责人证书"}),!1;var h=o("#register .QAChargePic").attr("data");if(void 0===h||null==h)return n.toast({content:"请上传质检负责人证书"}),!1;if(!o("#register .check-agreement").hasClass("checked-active"))return n.toast({content:"请阅读同意《平台车管家服务条款》"}),!1;if(0==u)return!1;u=!1;var p=e.csrf({name:i,mobile:s,code:a,emergencyContact:l,emergencyPerson:d,address:g,licensePic:v,headPic:m,techChargePic:f,QAChargePic:h});n.httpPost(t.to(c),p,function(e){if(!e.success)return n.toast({content:e.message,closeDelay:3e3}),u=!0,!1;var r=3e3;n.toast({content:e.message,closeDelay:r}),setTimeout(function(){window.location.href=t.to("order/#index")},r)})})},e.gotoLoginEvent=function(){o("#register .login-btn").click(function(e){window.location.href=t.to("user/#login")})},e.checkAgreement=function(){var e=this;o("#register .check-agreement").click(function(t){return 0==g?(e.showAgreement(),!1):void(o(this).hasClass("checked-active")?o(this).removeClass("checked-active"):o(this).addClass("checked-active"))}),o("#register .agreement-cls").click(function(t){e.showAgreement()}),o("#register").on("click",".agree-btn",function(e){o("#agreement-wrapper").remove(),g=!0;var t=o("#register .check-agreement");t.hasClass("checked-active")||t.addClass("checked-active")})},e.showAgreement=function(){o("#agreement-wrapper").remove();var e=o("#register"),t=o("script#agreement-template"),n=i.compile(t.html()),r=n({});e.append(r)},e}); | |
3 | 3 | \ No newline at end of file | ... | ... |
web/src/js/order/customer-order-controller.js
... | ... | @@ -7,9 +7,10 @@ define( |
7 | 7 | 'mk7/controller', |
8 | 8 | 'mk7/url', |
9 | 9 | 'mk7/utils', |
10 | + 'mk7/photo-browser' | |
10 | 11 | ], |
11 | 12 | |
12 | - function(ctrl, url, utils) { | |
13 | + function(ctrl, url, utils, photoBrowser) { | |
13 | 14 | |
14 | 15 | var $$ = Dom7; |
15 | 16 | var t7 = Template7; |
... | ... | @@ -73,31 +74,21 @@ define( |
73 | 74 | }) |
74 | 75 | } |
75 | 76 | ctrl.popupImageLayer = function() { |
77 | + var me = this; | |
76 | 78 | $$('#customer-order').on('click', '.view-img-cls', function(e) { |
77 | - var url = $$(this).attr('data-url'); | |
78 | - $$('#img-mask').remove(); | |
79 | - var imgContent = '<div id="img-mask" style="z-index:2;background:#000;justify-content:center;position: absolute;bottom:0;top:0;width:100%;display:flex;flex-direction: column;align-items: center"><div style="width:100%;"> <img width="100%" src="'+url+'" /></div></div>'; | |
80 | - $$('#customer-order').append(imgContent); | |
81 | - }) | |
82 | - | |
83 | - $$('#customer-order').on('click', '#img-mask, #img-mask img', function(e) { | |
84 | - e.preventDefault(); | |
85 | - e.stopPropagation() | |
86 | - | |
87 | - var bh = document.body.clientHeight; | |
88 | - var ih = $$('#img-mask img').height(); | |
89 | - console.log(bh+'dddd'+ih) | |
90 | - var interval = Math.abs(ih-bh); | |
91 | - if (interval >=0 && interval <= 20) { | |
92 | - $$('#img-mask').remove(); | |
93 | - } else { | |
94 | - var id = $$(e.target).attr('id'); | |
95 | - if('img-mask' == id) { | |
96 | - $$('#img-mask').remove(); | |
97 | - } | |
98 | - } | |
79 | + var parent = $$(this).parents('ul'); | |
80 | + var imagesT = parent.find('.view-img-cls'); | |
81 | + var photoBrowserPhotos = []; | |
82 | + var initialSlide = $$(this).attr('data-index'); | |
83 | + $$.each(imagesT, function(i, n) { | |
84 | + var nURL = $$(n).attr('data-url'); | |
85 | + photoBrowserPhotos.push(nURL) | |
86 | + }) | |
99 | 87 | |
88 | + var pBrowser = me.app.photoBrowser({photos:photoBrowserPhotos,initialSlide:initialSlide}); | |
89 | + pBrowser.open(); | |
100 | 90 | }) |
91 | + | |
101 | 92 | } |
102 | 93 | return ctrl; |
103 | 94 | } | ... | ... |
web/src/js/order/order-details-controller.js
... | ... | @@ -7,9 +7,10 @@ define( |
7 | 7 | 'mk7/controller', |
8 | 8 | 'mk7/url', |
9 | 9 | 'mk7/utils', |
10 | + 'mk7/photo-browser' | |
10 | 11 | ], |
11 | 12 | |
12 | - function(ctrl, url, utils) { | |
13 | + function(ctrl, url, utils, photoBrowser) { | |
13 | 14 | |
14 | 15 | var $$ = Dom7; |
15 | 16 | var t7 = Template7; |
... | ... | @@ -54,48 +55,22 @@ define( |
54 | 55 | }) |
55 | 56 | } |
56 | 57 | ctrl.agreementEvent = function() { |
57 | - //agreement-btn | |
58 | - /* | |
59 | - $$('#order-details .agreement-btn').click(function(e){ | |
60 | - $$('#agreement-wrapper').remove(); | |
61 | - var page = $$('#order-details'); | |
62 | - var ele = $$('script#agreement-template'); | |
63 | - var compiled = t7.compile(ele.html()); | |
64 | - var doms = compiled({}); | |
65 | - page.append(doms); | |
66 | - }) | |
67 | 58 | |
68 | - $$('#order-details').on('click','.agree-btn', function(e){ | |
69 | - $$('#agreement-wrapper').remove(); | |
70 | - }) | |
71 | - */ | |
72 | 59 | } |
73 | - ctrl.popupImageLayer = function(){ | |
60 | + ctrl.popupImageLayer = function() { | |
61 | + var me = this; | |
74 | 62 | $$('#order-details').on('click', '.view-img-cls', function(e) { |
75 | - var url = $$(this).attr('data-url'); | |
76 | - $$('#img-mask').remove(); | |
77 | - var imgContent = '<div id="img-mask" style="z-index:2;background:#000;justify-content:center;position: absolute;bottom:0;top:0;width:100%;display:flex;flex-direction: column;align-items: center"><div style="width:100%;"> <img width="100%" src="'+url+'" /></div></div>'; | |
78 | - $$('#order-details').append(imgContent); | |
79 | - }) | |
80 | - | |
81 | - $$('#order-details').on('click', '#img-mask, #img-mask img', function(e) { | |
82 | - e.preventDefault(); | |
83 | - e.stopPropagation() | |
84 | - | |
85 | - var bh = document.body.clientHeight; | |
86 | - var ih = $$('#img-mask img').height(); | |
87 | - console.log(bh+'dddd'+ih) | |
88 | - var interval = Math.abs(ih-bh); | |
89 | - if (interval >=0 && interval <= 20) { | |
90 | - $$('#img-mask').remove(); | |
91 | - | |
92 | - } else { | |
93 | - var id = $$(e.target).attr('id'); | |
94 | - if('img-mask' == id) { | |
95 | - $$('#img-mask').remove(); | |
96 | - } | |
97 | - } | |
63 | + var parent = $$(this).parents('ul'); | |
64 | + var imagesT = parent.find('.view-img-cls'); | |
65 | + var photoBrowserPhotos = []; | |
66 | + var initialSlide = $$(this).attr('data-index'); | |
67 | + $$.each(imagesT, function(i, n) { | |
68 | + var nURL = $$(n).attr('data-url'); | |
69 | + photoBrowserPhotos.push(nURL) | |
70 | + }) | |
98 | 71 | |
72 | + var pBrowser = me.app.photoBrowser({photos:photoBrowserPhotos,initialSlide:initialSlide}); | |
73 | + pBrowser.open(); | |
99 | 74 | }) |
100 | 75 | } |
101 | 76 | ... | ... |
web/src/js/order/rate-controller.js
... | ... | @@ -35,7 +35,7 @@ define( |
35 | 35 | } |
36 | 36 | ctrl.loadPage = function(){ |
37 | 37 | var me = this; |
38 | - me.render(); | |
38 | + me.render({servicePhone:window.$site.servicePhone}); | |
39 | 39 | } |
40 | 40 | ctrl.starClickEvent = function() { |
41 | 41 | $$('#rate').on('click', '.img-star',function(e) { |
... | ... | @@ -48,7 +48,6 @@ define( |
48 | 48 | $$(n).addClass('star-on'); |
49 | 49 | var rateText = parentBox.find('.rate-text'); |
50 | 50 | var txt = $$(n).attr('data-txt'); |
51 | - | |
52 | 51 | rateText.html(txt); |
53 | 52 | } else { |
54 | 53 | $$(n).removeClass('star-on'); | ... | ... |
web/src/js/order/submit-controller.js
... | ... | @@ -43,14 +43,7 @@ define( |
43 | 43 | ctrl.loadInit = function() { |
44 | 44 | var me = this; |
45 | 45 | var sData = {id:me.id} |
46 | - utils.httpGet(submitURL, sData, function(res) { | |
47 | - if (res.success) { | |
48 | - if (res.address) { | |
49 | - $$('#submit .maintainerAddress').val(res.address); | |
50 | - $$('#submit .maintainerAddress').attr('readonly', true); | |
51 | - } | |
52 | - } | |
53 | - }, true); | |
46 | + | |
54 | 47 | } |
55 | 48 | ctrl.uploadImgEvent = function() { |
56 | 49 | var me = this; |
... | ... | @@ -101,7 +94,7 @@ define( |
101 | 94 | var preRepair = utils.trim($$('#submit .preRepair').val()); |
102 | 95 | var repairPrice = utils.trim($$('#submit .repairPrice').val()); |
103 | 96 | var finishDate = utils.trim($$('#submit .finishDate').val()); |
104 | - var address = utils.trim($$('#submit .maintainerAddress').val()); | |
97 | + | |
105 | 98 | if (false == canSubmit) { |
106 | 99 | return false; |
107 | 100 | } |
... | ... | @@ -125,7 +118,7 @@ define( |
125 | 118 | utils.toast({content:'客联系电话有误'}); |
126 | 119 | return false; |
127 | 120 | } |
128 | - /* | |
121 | + | |
129 | 122 | if ('' == preRepair) { |
130 | 123 | utils.toast({content:'预估维修内容必填'}); |
131 | 124 | return false; |
... | ... | @@ -134,15 +127,12 @@ define( |
134 | 127 | utils.toast({content:'预估维修费用必填'}); |
135 | 128 | return false; |
136 | 129 | } |
137 | - */ | |
130 | + | |
138 | 131 | if ('' == finishDate) { |
139 | 132 | utils.toast({content:'预估完成时间必填'}); |
140 | 133 | return false; |
141 | 134 | } |
142 | - if ('' == address) { | |
143 | - utils.toast({content:'维修厂地址必填'}); | |
144 | - return false; | |
145 | - } | |
135 | + | |
146 | 136 | var imgs = me.getUploadImgs(); |
147 | 137 | if (0 == imgs.length) { |
148 | 138 | utils.toast({content:'请上传车损照'}); |
... | ... | @@ -151,8 +141,7 @@ define( |
151 | 141 | canSubmit = false; |
152 | 142 | var sData = me.csrf({ |
153 | 143 | carNo:carNo, carModel:carModel,customer:customer,phone:phone, |
154 | - preRepair:preRepair, repairPrice:repairPrice,finishDate:finishDate, images:imgs, | |
155 | - address:address | |
144 | + preRepair:preRepair, repairPrice:repairPrice,finishDate:finishDate, images:imgs | |
156 | 145 | }) |
157 | 146 | utils.httpPost(doSubmitURL, sData, function(res) { |
158 | 147 | canSubmit = true; |
... | ... | @@ -183,7 +172,7 @@ define( |
183 | 172 | var me = this |
184 | 173 | $$('#submit .finish-date-input').click(function(e) { |
185 | 174 | var cData = $$('#submit .finish-date-input').val(); |
186 | - console.log(cData) | |
175 | + //console.log(cData) | |
187 | 176 | me.dateTimeSelector('#submit .finish-date-input', cData); |
188 | 177 | }) |
189 | 178 | } | ... | ... |
web/src/js/user/login-controller.js
web/src/js/user/register-controller.js
... | ... | @@ -23,14 +23,15 @@ define( |
23 | 23 | var clickGetCode = true; |
24 | 24 | var registerClick = true; |
25 | 25 | var tt = null |
26 | + var hasCheckAgreement = false; | |
26 | 27 | ctrl.run = function () { |
27 | 28 | var me = this; |
28 | 29 | me.setPageTitle("注册"); |
29 | 30 | //me.hideAllNonBaseMenuItem(window.$site); |
30 | 31 | me.codeDuration = 60; |
31 | 32 | if (!isGuest) { |
32 | - window.location.href = url.to('order/#index'); | |
33 | - return ''; | |
33 | + //window.location.href = url.to('order/#index'); | |
34 | + //return ''; | |
34 | 35 | } |
35 | 36 | me.render(); |
36 | 37 | } |
... | ... | @@ -44,10 +45,13 @@ define( |
44 | 45 | me.checkAgreement(); |
45 | 46 | } |
46 | 47 | ctrl.uploadEvent = function() { |
47 | - $$('#register .upload-input-cls').change(function() { | |
48 | + $$('#register .upload-input-cls').change(function(e) { | |
48 | 49 | if ('' == $$(this).val() || null == $$(this).val()) { |
49 | 50 | return ; |
50 | 51 | } |
52 | + var target = e.target; | |
53 | + var fileObject = target.files[0]; | |
54 | + | |
51 | 55 | var id = $$(this).attr('id'); |
52 | 56 | var parent = $$(this).parent(); |
53 | 57 | uploadjs.uploadFile({ |
... | ... | @@ -126,6 +130,7 @@ define( |
126 | 130 | var code = utils.trim($$('#register .code').val()); |
127 | 131 | var emergencyContact = utils.trim($$('#register .emergency_contact').val()); |
128 | 132 | var emergencyPerson = utils.trim($$('#register .emergency_person').val()); |
133 | + var address = utils.trim($$('#register .address').val()); | |
129 | 134 | |
130 | 135 | if ('' == name) { |
131 | 136 | utils.toast({content:'车厂名称必填'}) |
... | ... | @@ -163,6 +168,11 @@ define( |
163 | 168 | return false; |
164 | 169 | } |
165 | 170 | |
171 | + if ('' == address) { | |
172 | + utils.toast({content:'维修厂地址必填'}) | |
173 | + return false; | |
174 | + } | |
175 | + | |
166 | 176 | var licensePic = $$('#register .licensePic').attr('data'); |
167 | 177 | if (undefined === licensePic || null == licensePic) { |
168 | 178 | utils.toast({content:'请上传营业执照'}) |
... | ... | @@ -196,6 +206,7 @@ define( |
196 | 206 | var pData = me.csrf({ |
197 | 207 | name:name, mobile:mobile,code:code, |
198 | 208 | emergencyContact:emergencyContact,emergencyPerson:emergencyPerson, |
209 | + address:address, | |
199 | 210 | licensePic:licensePic, |
200 | 211 | headPic:headPic, |
201 | 212 | techChargePic:techChargePic, |
... | ... | @@ -224,7 +235,12 @@ define( |
224 | 235 | }) |
225 | 236 | } |
226 | 237 | ctrl.checkAgreement = function() { |
238 | + var me = this; | |
227 | 239 | $$('#register .check-agreement').click(function(e) { |
240 | + if (false == hasCheckAgreement) { | |
241 | + me.showAgreement(); | |
242 | + return false; | |
243 | + } | |
228 | 244 | if($$(this).hasClass('checked-active')) { |
229 | 245 | $$(this).removeClass('checked-active'); |
230 | 246 | } else { |
... | ... | @@ -233,16 +249,12 @@ define( |
233 | 249 | }) |
234 | 250 | |
235 | 251 | $$('#register .agreement-cls').click(function(e){ |
236 | - $$('#agreement-wrapper').remove(); | |
237 | - var page = $$('#register'); | |
238 | - var ele = $$('script#agreement-template'); | |
239 | - var compiled = t7.compile(ele.html()); | |
240 | - var doms = compiled({}); | |
241 | - page.append(doms); | |
252 | + me.showAgreement(); | |
242 | 253 | }) |
243 | 254 | |
244 | 255 | $$('#register').on('click','.agree-btn', function(e){ |
245 | 256 | $$('#agreement-wrapper').remove(); |
257 | + hasCheckAgreement = true; | |
246 | 258 | var checkAgreement = $$('#register .check-agreement'); |
247 | 259 | if(!checkAgreement.hasClass('checked-active')) { |
248 | 260 | checkAgreement.addClass('checked-active'); |
... | ... | @@ -250,6 +262,14 @@ define( |
250 | 262 | |
251 | 263 | }) |
252 | 264 | } |
265 | + ctrl.showAgreement = function() { | |
266 | + $$('#agreement-wrapper').remove(); | |
267 | + var page = $$('#register'); | |
268 | + var ele = $$('script#agreement-template'); | |
269 | + var compiled = t7.compile(ele.html()); | |
270 | + var doms = compiled({}); | |
271 | + page.append(doms); | |
272 | + } | |
253 | 273 | return ctrl; |
254 | 274 | } |
255 | 275 | ); | ... | ... |
web/src/vendor/mk7/cmpts/uploadjs/uploadjs.js
... | ... | @@ -15,23 +15,27 @@ define( |
15 | 15 | ontimeout:function(e){}, |
16 | 16 | error:function(res, e){if(options.error){options.error(res, e)}} |
17 | 17 | } |
18 | + function appendProcess() { | |
19 | + var preUpload = '<div id="process-bar" style="width:100%;position: absolute;top:0;bottom: 0;z-index: 222;display: flex;justify-content: center;flex-direction: column;"><div style="width: 70%;margin: 0 auto;height:1.5rem;background: #dcdcdc;"><div style="height:1.5rem;width:0%;line-height: 1.5rem;background:#4ae637;text-align:center" id="pro-bar">0%</div></div></div>'; | |
20 | + if ('' != setting.processAppendTo) { | |
21 | + var appendObj = document.querySelector(setting.processAppendTo); | |
22 | + if (!appendObj) { | |
23 | + return ''; | |
24 | + } | |
25 | + var processBar = appendObj.querySelector('#process-bar'); | |
26 | + if (appendObj && processBar) { | |
27 | + appendObj.removeChild(processBar); | |
28 | + } | |
29 | + | |
30 | + appendObj.insertAdjacentHTML("beforeend", preUpload) | |
31 | + } | |
32 | + } | |
33 | + | |
18 | 34 | setting.beforeSend = function(res, e) { |
19 | 35 | if(options.beforeSend) { |
20 | 36 | options.beforeSend(res, e) |
21 | 37 | } else { |
22 | - var preUpload = '<div id="process-bar" style="width:100%;position: absolute;top:0;bottom: 0;z-index: 222;display: flex;justify-content: center;flex-direction: column;"><div style="width: 70%;margin: 0 auto;height:1.5rem;background: #dcdcdc;"><div style="height:1.5rem;width:0%;line-height: 1.5rem;background:#4ae637;text-align:center" id="pro-bar">0%</div></div></div>'; | |
23 | - if ('' != setting.processAppendTo) { | |
24 | - var appendObj = document.querySelector(setting.processAppendTo); | |
25 | - if (!appendObj) { | |
26 | - return ''; | |
27 | - } | |
28 | - var processBar = appendObj.querySelector('#process-bar'); | |
29 | - if (appendObj && processBar) { | |
30 | - appendObj.removeChild(processBar); | |
31 | - } | |
32 | - | |
33 | - appendObj.insertAdjacentHTML("beforeend", preUpload) | |
34 | - } | |
38 | + appendProcess(); | |
35 | 39 | |
36 | 40 | } |
37 | 41 | } |
... | ... | @@ -64,65 +68,136 @@ define( |
64 | 68 | } |
65 | 69 | |
66 | 70 | var fileObject = document.querySelector(setting.selector).files[0]; |
67 | - var formData = new FormData(); | |
68 | - var xhr = new XMLHttpRequest(); | |
69 | - xhr.timeout = setting.timeout; | |
70 | - xhr.onload = function(e) { | |
71 | - //console.log(this.response); | |
72 | - | |
73 | - var response = JSON.parse(this.response); | |
74 | - setting.success(response, e); | |
75 | - }; | |
76 | - xhr.onloadend = function(e) { | |
77 | - //console.log('request loadend'); | |
78 | - if ('' != setting.processAppendTo) { | |
79 | - var appendObj = document.querySelector(setting.processAppendTo); | |
80 | - if (appendObj) { | |
81 | - var processBar = appendObj.querySelector('#process-bar'); | |
71 | + var uploadType = ''; | |
72 | + var fileSize = fileObject.size/1024; | |
73 | + | |
74 | + setting.uploadPost = function (fileObject, uploadType) { | |
75 | + var formData = new FormData(); | |
76 | + var xhr = new XMLHttpRequest(); | |
77 | + xhr.timeout = setting.timeout; | |
78 | + xhr.onload = function(e) { | |
79 | + //console.log(this.response); | |
80 | + | |
81 | + var response = JSON.parse(('' == this.response || null == this.response)?"[]":this.response) | |
82 | + setting.success(response, e); | |
83 | + }; | |
84 | + xhr.onloadend = function(e) { | |
85 | + //console.log('request loadend'); | |
86 | + if ('' != setting.processAppendTo) { | |
87 | + var appendObj = document.querySelector(setting.processAppendTo); | |
82 | 88 | if (appendObj) { |
83 | - appendObj.removeChild(processBar); | |
89 | + var processBar = appendObj.querySelector('#process-bar'); | |
90 | + if (appendObj) { | |
91 | + appendObj.removeChild(processBar); | |
92 | + } | |
84 | 93 | } |
85 | 94 | } |
95 | + | |
96 | + var response = JSON.parse(('' == this.response || null == this.response)?"[]":this.response) | |
97 | + setting.complete(response, e); | |
98 | + }; | |
99 | + xhr.onerror = function(e) { | |
100 | + //console.log('request error'); | |
101 | + var response = JSON.parse(('' == this.response || null == this.response)?"[]":this.response) | |
102 | + setting.error(response, e); | |
103 | + }; | |
104 | + xhr.ontimeout = function(e) { | |
105 | + console.log('request timeout'); | |
106 | + setting.ontimeout(e); | |
107 | + }; | |
108 | + xhr.addEventListener('loadstart', function(e) { | |
109 | + setting.beforeSend(e); | |
110 | + }); | |
111 | + | |
112 | + xhr.open('post', setting.url, true) | |
113 | + | |
114 | + xhr.upload.onprogress = function (ex) { | |
115 | + if (ex.lengthComputable) { | |
116 | + setting.process(ex); | |
117 | + } | |
86 | 118 | } |
119 | + //console.log(uploadType) | |
120 | + formData.append('uploadType', uploadType) | |
121 | + formData.append('file', fileObject); | |
122 | + xhr.send(formData); | |
123 | + } | |
87 | 124 | |
88 | - var response = JSON.parse(this.response); | |
89 | - setting.complete(response, e); | |
90 | - }; | |
91 | - xhr.onerror = function(e) { | |
92 | - //console.log('request error'); | |
93 | - var response = JSON.parse(this.response); | |
94 | - setting.error(response, e); | |
95 | - }; | |
96 | - xhr.ontimeout = function(e) { | |
97 | - console.log('request timeout'); | |
98 | - setting.ontimeout(e); | |
99 | - }; | |
100 | - xhr.addEventListener('loadstart', function(e) { | |
101 | - setting.beforeSend(e); | |
102 | - }); | |
103 | - | |
104 | - xhr.open('post', setting.url, true) | |
105 | - /* | |
106 | - xhr.onreadystatechange = function () { | |
107 | - if(this.readyState == 4) { | |
108 | - stateChange(this.response); | |
109 | - } else { | |
110 | - var completeFun = arguments[3]; | |
111 | - if (completeFun) { | |
112 | - completeFun(this); | |
113 | - } | |
114 | - | |
115 | - } | |
116 | - } | |
117 | - */ | |
118 | - | |
119 | - xhr.upload.onprogress = function (ex) { | |
120 | - if (ex.lengthComputable) { | |
121 | - setting.process(ex); | |
125 | + setting.compressAndUpload = function(fileObject, uploadType) { | |
126 | + | |
127 | + // 压缩图片需要的一些元素和对象 | |
128 | + var reader = new FileReader(), | |
129 | + //创建一个img对象 | |
130 | + img = new Image(); | |
131 | + | |
132 | + // 选择的文件对象 | |
133 | + var file = fileObject; | |
134 | + var newObj = null; | |
135 | + | |
136 | + // 缩放图片需要的canvas | |
137 | + var canvas = document.createElement('canvas'); | |
138 | + var context = canvas.getContext('2d'); | |
139 | + | |
140 | + if(file == undefined || file == '') { | |
141 | + return ; | |
122 | 142 | } |
143 | + // 选择的文件是图片 | |
144 | + if(file.type.indexOf("image") == 0) { | |
145 | + reader.readAsDataURL(file); | |
146 | + } else { | |
147 | + return false; | |
148 | + } | |
149 | + | |
150 | + // 文件base64化,以便获知图片原始尺寸 | |
151 | + reader.onload = function(onloadEvent) { | |
152 | + img.src = onloadEvent.target.result; | |
153 | + }; | |
154 | + appendProcess(); | |
155 | + // base64地址图片加载完毕后 | |
156 | + img.onload = function() { | |
157 | + | |
158 | + var img = this; | |
159 | + var time = new Date().getTime(); | |
160 | + // 图片原始尺寸 | |
161 | + var originWidth = img.width; | |
162 | + var originHeight = img.height; | |
163 | + // 最大尺寸限制,可通过设置宽高来实现图片压缩程度 | |
164 | + var maxWidth = 1024, | |
165 | + maxHeight = 1024; | |
166 | + // 目标尺寸 | |
167 | + var targetWidth = originWidth, | |
168 | + targetHeight = originHeight; | |
169 | + // 图片尺寸超过限制 | |
170 | + if (originWidth > maxWidth || originHeight > maxHeight) { | |
171 | + if (originWidth / originHeight > maxWidth / maxHeight) { | |
172 | + // 更宽,按照宽度限定尺寸 | |
173 | + targetWidth = maxWidth; | |
174 | + targetHeight = Math.round(maxWidth * (originHeight / originWidth)); | |
175 | + } else { | |
176 | + targetHeight = maxHeight; | |
177 | + targetWidth = Math.round(maxHeight * (originWidth / originHeight)); | |
178 | + } | |
179 | + } | |
180 | + // canvas对图片进行缩放 | |
181 | + canvas.width = targetWidth; | |
182 | + canvas.height = targetHeight; | |
183 | + // 清除画布 | |
184 | + context.clearRect(0, 0, targetWidth, targetHeight); | |
185 | + // 图片压缩 | |
186 | + context.drawImage(img, 0, 0, targetWidth, targetHeight); | |
187 | + var newImage = canvas.toDataURL('image/jpeg', 0.7); //base64 格式 | |
188 | + | |
189 | + setting.uploadPost(newImage, uploadType); | |
190 | + } | |
191 | + | |
192 | + } | |
193 | + | |
194 | + if (fileSize <= 1024) { | |
195 | + uploadType = 'file' | |
196 | + setting.uploadPost(fileObject, uploadType); | |
197 | + } else { | |
198 | + uploadType = 'base64'; | |
199 | + setting.compressAndUpload(fileObject, uploadType) | |
123 | 200 | } |
124 | - formData.append('file', fileObject); | |
125 | - xhr.send(formData); | |
126 | 201 | |
127 | 202 | } |
128 | 203 | return object; | ... | ... |