diff --git a/app-wx/modules/user/views/default/pages/register-template.php b/app-wx/modules/user/views/default/pages/register-template.php
index 8e26eea..d8fc740 100644
--- a/app-wx/modules/user/views/default/pages/register-template.php
+++ b/app-wx/modules/user/views/default/pages/register-template.php
@@ -23,7 +23,7 @@ $baseUrl = Url::base(true);
background-repeat: no-repeat;
-webkit-background-size:cover;
-moz-background-size:cover;background-size:cover;position: relative}
- #register .upload-box .upload-item{background-image:url('=$baseUrl?>/i/upload-convert.png');background-size: 4.7rem auto;background-repeat: no-repeat;background-position: 1px 1px;}
+ #register .upload-box .upload-item{background-image:url('=$baseUrl?>/i/user/upload-convert.png');background-size: 4.7rem auto;background-repeat: no-repeat;background-position: 1px 1px;}
#register .upload-box .upload-input-cls{width: 100%;display: block;background: rgba(0,0,0,0);opacity: 0;height: 0;padding-bottom: 100%;}
#register .register-btn-cls{width:80%;border-radius: 2rem; padding:0.8rem 1rem;text-align:center;box-sizing: border-box;color:#fff;background:#FF8728;margin: 0 auto;font-size:1.13rem}
#register .count-down-cls{font-size:0.7rem;color:#999}
diff --git a/web/dist/js/order-app.js b/web/dist/js/order-app.js
index c5f6c13..df76db8 100644
--- a/web/dist/js/order-app.js
+++ b/web/dist/js/order-app.js
@@ -1 +1 @@
-define("order-app",["mk7/app"],function(n){var e=Dom7,r=function(){var n=e(".ui-loading-block");0==n.length&&(e(".view-main").html('
'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var n=document.getElementById("loader-inner"),e=document.createElement("p");e.className="notice",n&&(e.innerHTML='加载速度太慢?试试
重新加载',n.appendChild(e))},window.waitingTime))},i=!0;return n.name="order",n.routes={index:function(){return i=!1,r(),n.runController("index")},rank:function(){return i=!1,r(),n.runController("rank")},"cost-list":function(){return i=!1,r(),n.runController("cost-list")},repairing:function(){return i=!1,r(),n.runController("repairing")},"*":function(){return n.runController("index")}},n}),define("order/cost-list-controller",["mk7/controller","mk7/url","mk7/utils"],function(n,e,r){var n=(Dom7,Template7,new n);return n.run=function(){var n=this;n.setPageTitle("费用列表"),n.render()},n.bindEvents=function(){console.log("bindEvents")},n}),define("order/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(n,e,r){var n=(Dom7,Template7,new n);return n.run=function(){var n=this;n.setPageTitle("订单列表"),n.hideAllNonBaseMenuItem(window.$site),n.render()},n.bindEvents=function(){console.log("bindEvents")},n}),define("order/rank-controller",["mk7/controller","mk7/url","mk7/utils"],function(n,e,r){var n=(Dom7,Template7,new n);return n.run=function(){var n=this;n.setPageTitle("评价"),n.render()},n.bindEvents=function(){console.log("bindEvents")},n}),define("order/repairing-controller",["mk7/controller","mk7/url","mk7/utils"],function(n,e,r){var n=(Dom7,Template7,new n);return n.run=function(){var n=this;n.setPageTitle("维修单"),n.render()},n.bindEvents=function(){console.log("bindEvents")},n});
\ No newline at end of file
+define("order-app",["mk7/app"],function(t){var n=Dom7,e=function(){var t=n(".ui-loading-block");0==t.length&&(n(".view-main").html('
'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var t=document.getElementById("loader-inner"),n=document.createElement("p");n.className="notice",t&&(n.innerHTML='加载速度太慢?试试
重新加载',t.appendChild(n))},window.waitingTime))},i=!0;return t.name="order",t.routes={index:function(){return i=!1,e(),t.runController("index")},rank:function(){return i=!1,e(),t.runController("rank")},submit:function(){return i=!1,e(),t.runController("submit")},"*":function(){return t.runController("index")}},t}),define("order/cost-list-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,n,e){var t=(Dom7,Template7,new t);return t.run=function(){var t=this;t.setPageTitle("费用列表"),t.render()},t.bindEvents=function(){console.log("bindEvents")},t}),define("order/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,n,e){var t=(Dom7,Template7,new t);return t.run=function(){var t=this;t.setPageTitle("订单列表"),t.hideAllNonBaseMenuItem(window.$site),t.render()},t.bindEvents=function(){console.log("bindEvents")},t}),define("order/rank-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,n,e){var t=(Dom7,Template7,new t);return t.run=function(){var t=this;t.setPageTitle("评价"),t.render()},t.bindEvents=function(){console.log("bindEvents")},t}),define("order/repairing-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,n,e){var t=(Dom7,Template7,new t);return t.run=function(){var t=this;t.setPageTitle("维修单"),t.render()},t.bindEvents=function(){console.log("bindEvents")},t}),define("order/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(t,n,e,i){var r=Dom7,t=(Template7,new t),o="/user/default/upload-file",l="/order/default/submit",s=!0;return t.run=function(){var t=this;t.setPageTitle("录入维修单"),t.imgLimit=9,t.render()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.uploadImgEvent(),t.submitEvent()},t.uploadImgEvent=function(){var t=this;r("#submit #upload-btn").change(function(){if(""!=r(this).val()&&null!=r(this).val()){var l=r(this).parents("li");i.uploadFile({selector:"#upload-btn",url:n.to(o),processAppendTo:"#submit",success:function(n,i){try{if(n.success){var o=n.tmpUrl;r('
').insertBefore(l),t.imgLimit==r("#submit #image-list").find(".up-img").length&&r("#submit .upload-btn-li").hide()}else e.toast({content:n.message,closeDelay:5e3})}catch(s){console.log(s),e.toast({content:"出错",closeDelay:5e3})}}})}}),r("#submit #image-list").on("click",".del-img",function(n){r(this).parent().remove(),t.imgLimit>=r("#submit #image-list").find(".up-img").length&&r("#submit .upload-btn-li").show()})},t.submitEvent=function(){var t=this;r("#submit .submit-btn-cls").click(function(i){var o=e.trim(r("#submit .carNo").val()),a=e.trim(r("#submit .carModel").val()),u=e.trim(r("#submit .customer").val()),c=e.trim(r("#submit .phone").val()),m=e.trim(r("#submit .preRepair").val()),d=e.trim(r("#submit .repairPrice").val()),v=e.trim(r("#submit .finishDate").val());if(0==s)return!1;if(""==o)return e.toast({content:"车牌号必填"}),!1;if(""==a)return e.toast({content:"车辆型号必填"}),!1;if(""==u)return e.toast({content:"客户名称必填"}),!1;if(""==c)return e.toast({content:"客联系电话必填"}),!1;if(!e.isMobile(c)&&!uitls.isTelephone(c))return e.toast({content:"客联系电话有误"}),!1;if(""==m)return e.toast({content:"预估维修内容必填"}),!1;if(""==d)return e.toast({content:"预估维修费用必填"}),!1;if(""==v)return e.toast({content:"预估完成时间必填"}),!1;var f=t.getUploadImgs();if(0==f.length)return e.toast({content:"请上传图片"}),!1;s=!1;var p=t.csrf({carNo:o,carModel:a,customer:u,phone:c,preRepair:m,repairPrice:d,finishDate:v,images:f});e.httpPost(l,p,function(t){return s=!0,t.success?void(window.location.href=n.to("/")):(e.toast({content:message}),!1)},!0)})},t.getUploadImgs=function(){var t=r("#submit #image-list").find(".up-img"),n=[];return 0==t.length?[]:(r.each(t,function(t,e){var i=r(e).find(".upload-item");n.push(i.attr("data"))}),n)},t});
\ No newline at end of file
diff --git a/web/dist/js/user-app.js b/web/dist/js/user-app.js
index fad6c29..78c290e 100644
--- a/web/dist/js/user-app.js
+++ b/web/dist/js/user-app.js
@@ -1 +1 @@
-define("user-app",["mk7/app"],function(e){var n=Dom7,i=function(){var e=n(".ui-loading-block");0==e.length&&(n(".view-main").html('
'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var e=document.getElementById("loader-inner"),n=document.createElement("p");n.className="notice",e&&(n.innerHTML='加载速度太慢?试试
重新加载',e.appendChild(n))},window.waitingTime))},r=!0;return e.name="user",e.routes={index:function(){return r=!1,i(),e.runController("index")},register:function(){return r=!1,i(),e.runController("register")},"*":function(){return e.runController("index")}},e}),define("user/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,n,i){var e=(Dom7,Template7,new e);return e.run=function(){var e=this;e.setPageTitle("首页"),e.hideAllNonBaseMenuItem(window.$site),e.render()},e.bindEvents=function(){console.log("bindEvents")},e}),define("user/register-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,n,i){var e=(Dom7,Template7,new e);return e.run=function(){var e=this;e.setPageTitle("注册"),e.hideAllNonBaseMenuItem(window.$site),e.render()},e.bindEvents=function(){console.log("bindEvents")},e});
\ No newline at end of file
+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('
'),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='加载速度太慢?试试
重新加载',e.appendChild(t))},window.waitingTime))},o=!0;return e.name="user",e.routes={index:function(){return o=!1,n(),e.runController("index")},register:function(){return o=!1,n(),e.runController("register")},login:function(){return o=!1,n(),e.runController("login")},"*":function(){return e.runController("index")}},e}),define("user/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,t,n){var e=(Dom7,Template7,new e);return e.run=function(){var e=this;e.setPageTitle("首页"),e.hideAllNonBaseMenuItem(window.$site),e.render()},e.bindEvents=function(){console.log("bindEvents")},e}),define("user/login-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,t,n){var o=Dom7,e=(Template7,new e),i="/user/login/get-code",r="/user/login/login",l=!0,c=!0,s=null;return e.run=function(){var e=this;e.setPageTitle("登录"),e.codeDuration=60,e.render()},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.getCodeEvent(),e.gotoRegisterEvent(),e.loginEvent()},e.getCodeEvent=function(){var e=this;o("#login .get-code-cls").click(function(){if(0==l)return!1;clearInterval(s),l=!1;var r=e.csrf({action:"login"});n.httpGet(t.to(i),r,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),l=!0,!1;var i=t.codeDuration;e.codeDuration=i,s=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(o("#login .get-code-cls").html("获取验证码"),clearInterval(s),e.codeDuration=i,l=!0):o("#login .get-code-cls").html('
'+e.codeDuration+"s后重新获取")},1e3)})})},e.loginEvent=function(){var e=this;o("#login .login-btn").click(function(i){var l=n.trim(o("#login .mobile").val()),s=n.trim(o("#login .code").val());if(""==l)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(l))return n.toast({content:"手机号码不合格"}),!1;if(""==s)return n.toast({content:"验证码必填"}),!1;if(0==c)return!1;c=!1;var a=e.csrf({mobile:l,code:s});n.httpPost(t.to(r),a,function(e){return e.success?(c=!0,void(window.location.href=t.to("/"))):(n.toast({content:e.message,closeDelay:3e3}),c=!0,!1)})})},e.gotoRegisterEvent=function(){o("#login .register-btn").click(function(e){window.location.href=t.to("user/#register")})},e}),define("user/register-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(e,t,n,o){var i=Dom7,e=(Template7,new e),r="/user/login/register",l="/user/default/upload-file",c="/user/login/get-code",s=!0,a=!0,u=null;return e.run=function(){var e=this;e.setPageTitle("注册"),e.codeDuration=60,e.render()},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.uploadEvent(),e.getCodeEvent(),e.registerEvent(),e.gotoLoginEvent()},e.uploadEvent=function(){i("#register #upload-btn").change(function(){if(""!=i(this).val()&&null!=i(this).val()){var e=i(this).parent();o.uploadFile({selector:"#upload-btn",url:t.to(l),processAppendTo:"#register",success:function(t,o){try{if(t.success){var i=t.tmpUrl;e.css("background-image","url("+t.tmpMinUrl+")"),e.attr("data",t.tmpFile),e.attr("data-url",i)}else n.toast({content:t.message,closeDelay:5e3})}catch(r){n.toast({content:"出错",closeDelay:5e3})}}})}})},e.getCodeEvent=function(){var e=this;i("#register .get-code-cls").click(function(){if(0==s)return!1;clearInterval(u),s=!1;var o=e.csrf({action:"register"});n.httpGet(t.to(c),o,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),s=!0,!1;var o=t.codeDuration;e.codeDuration=o,u=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(i("#register .get-code-cls").html("获取验证码"),clearInterval(u),e.codeDuration=o,s=!0):i("#register .get-code-cls").html('
'+e.codeDuration+"s后重新获取")},1e3)})})},e.registerEvent=function(){var e=this;i("#register .register-btn").click(function(o){var l=n.trim(i("#register .name").val()),c=n.trim(i("#register .mobile").val()),s=n.trim(i("#register .code").val());if(""==l)return n.toast({content:"车厂名称必填"}),!1;if(""==c)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(c))return n.toast({content:"手机号码不合格"}),!1;if(""==s)return n.toast({content:"验证码必填"}),!1;var u=i("#register .upload-btn-cls").attr("data");if(void 0===u||null==u)return n.toast({content:"请上传营业执照"}),!1;if(0==a)return!1;a=!1;var d=e.csrf({name:l,mobile:c,code:s,img:u});n.httpPost(t.to(r),d,function(e){return e.success?void(window.location.href=t.to("/")):(n.toast({content:e.message,closeDelay:3e3}),a=!0,!1)})})},e.gotoLoginEvent=function(){i("#register .login-btn").click(function(e){window.location.href=t.to("user/#login")})},e});
\ No newline at end of file
diff --git a/web/i/login-bg.png b/web/i/login-bg.png
deleted file mode 100644
index 186193b..0000000
Binary files a/web/i/login-bg.png and /dev/null differ
diff --git a/web/i/login-corner.png b/web/i/login-corner.png
deleted file mode 100644
index a968f10..0000000
Binary files a/web/i/login-corner.png and /dev/null differ
diff --git a/web/i/order/trash.png b/web/i/order/trash.png
new file mode 100644
index 0000000..ea64dac
Binary files /dev/null and b/web/i/order/trash.png differ
diff --git a/web/i/order/upload-convert.png b/web/i/order/upload-convert.png
new file mode 100644
index 0000000..a9600ad
Binary files /dev/null and b/web/i/order/upload-convert.png differ
diff --git a/web/i/upload-convert.png b/web/i/upload-convert.png
deleted file mode 100644
index 5d4fb60..0000000
Binary files a/web/i/upload-convert.png and /dev/null differ
diff --git a/web/i/user/login-bg.png b/web/i/user/login-bg.png
new file mode 100644
index 0000000..186193b
Binary files /dev/null and b/web/i/user/login-bg.png differ
diff --git a/web/i/user/login-corner.png b/web/i/user/login-corner.png
new file mode 100644
index 0000000..a968f10
Binary files /dev/null and b/web/i/user/login-corner.png differ
diff --git a/web/i/user/upload-convert.png b/web/i/user/upload-convert.png
new file mode 100644
index 0000000..5d4fb60
Binary files /dev/null and b/web/i/user/upload-convert.png differ
diff --git a/web/src/js/order/app.js b/web/src/js/order/app.js
index e68b448..1c1dfec 100644
--- a/web/src/js/order/app.js
+++ b/web/src/js/order/app.js
@@ -44,15 +44,10 @@ define(
_autoLoading();
return app.runController('rank');
},
- 'cost-list': function () {
+ 'submit': function () {
fromOutside = false;
_autoLoading();
- return app.runController('cost-list');
- },
- 'repairing': function () {
- fromOutside = false;
- _autoLoading();
- return app.runController('repairing');
+ return app.runController('submit');
},
'*': function(){
return app.runController('index');
diff --git a/web/src/js/order/submit-controller.js b/web/src/js/order/submit-controller.js
new file mode 100644
index 0000000..a3c91d0
--- /dev/null
+++ b/web/src/js/order/submit-controller.js
@@ -0,0 +1,157 @@
+/**
+ * 录入维修单
+ */
+define(
+ "order/submit-controller",
+ [
+ 'mk7/controller',
+ 'mk7/url',
+ 'mk7/utils',
+ 'mk7/uploadjs',
+ ],
+
+ function(ctrl, url, utils, uploadjs) {
+
+ var $$ = Dom7;
+ var t7 = Template7;
+ var ctrl = new ctrl();
+
+ var uploadURL = '/user/default/upload-file';
+ var submitURL = '/order/default/submit';
+ var canSubmit = true;
+ ctrl.run = function () {
+ var me = this;
+ me.setPageTitle("录入维修单");
+ me.imgLimit = 9;
+ me.render();
+ }
+ ctrl.bindEvents = function () {
+ var me = this;
+ console.log("bindEvents");
+ me.uploadImgEvent();
+ me.submitEvent();
+ }
+ ctrl.uploadImgEvent = function() {
+ var me = this;
+
+ $$('#submit #upload-btn').change(function () {
+ if ('' == $$(this).val() || null == $$(this).val()) {
+ return;
+ }
+ var uploadParent = $$(this).parents('li');
+
+ uploadjs.uploadFile({
+ selector: '#upload-btn',
+ url: url.to(uploadURL),
+ processAppendTo: '#submit',
+ success: function (response, e) {
+ try {
+ if (response.success) {
+ var imgUrl = response.tmpUrl;
+
+ $$('
' + '
').insertBefore(uploadParent);
+ if (me.imgLimit == $$('#submit #image-list').find('.up-img').length) {
+ $$('#submit .upload-btn-li').hide();
+ }
+ } else {
+ utils.toast({content: response.message, closeDelay: 5000});
+ }
+ } catch (ex) {
+ console.log(ex)
+ utils.toast({content: '出错', closeDelay: 5000});
+ }
+ }
+ });
+ })
+
+ $$('#submit #image-list').on('click', '.del-img', function(e){
+ $$(this).parent().remove();
+ if (me.imgLimit >= $$('#submit #image-list').find('.up-img').length) {
+ $$('#submit .upload-btn-li').show();
+ }
+ })
+ }
+ ctrl.submitEvent = function() {
+ var me = this;
+ $$('#submit .submit-btn-cls').click(function(e) {
+
+ var carNo = utils.trim($$('#submit .carNo').val());
+ var carModel = utils.trim($$('#submit .carModel').val());
+ var customer = utils.trim($$('#submit .customer').val());
+ var phone = utils.trim($$('#submit .phone').val());
+ var preRepair = utils.trim($$('#submit .preRepair').val());
+ var repairPrice = utils.trim($$('#submit .repairPrice').val());
+ var finishDate = utils.trim($$('#submit .finishDate').val());
+ if (false == canSubmit) {
+ return false;
+ }
+ if ('' == carNo) {
+ utils.toast({content:'车牌号必填'});
+ return false;
+ }
+ if ('' == carModel) {
+ utils.toast({content:'车辆型号必填'});
+ return false;
+ }
+ if ('' == customer) {
+ utils.toast({content:'客户名称必填'});
+ return false;
+ }
+ if ('' == phone) {
+ utils.toast({content:'客联系电话必填'});
+ return false;
+ }
+ if (!utils.isMobile(phone) && !uitls.isTelephone(phone)) {
+ utils.toast({content:'客联系电话有误'});
+ return false;
+ }
+ if ('' == preRepair) {
+ utils.toast({content:'预估维修内容必填'});
+ return false;
+ }
+ if ('' == repairPrice) {
+ utils.toast({content:'预估维修费用必填'});
+ return false;
+ }
+ if ('' == finishDate) {
+ utils.toast({content:'预估完成时间必填'});
+ return false;
+ }
+ var imgs = me.getUploadImgs();
+ if (0 == imgs.length) {
+ utils.toast({content:'请上传车损照'});
+ return false;
+ }
+ canSubmit = false;
+ var sData = me.csrf({
+ carNo:carNo, carModel:carModel,customer:customer,phone:phone,
+ preRepair:preRepair, repairPrice:repairPrice,finishDate:finishDate, images:imgs
+ })
+ utils.httpPost(submitURL, sData, function(res) {
+ canSubmit = true;
+ if (!res.success) {
+ utils.toast({content:message});
+ return false;
+ } else {
+ window.location.href = url.to('/');
+ }
+ }, true);
+
+ })
+ }
+ ctrl.getUploadImgs = function() {
+ var images = $$('#submit #image-list').find('.up-img');
+ var returnImg = [];
+ if (images.length == 0 ) {
+ return [];
+ }
+ $$.each(images, function(i, n){
+ var img = $$(n).find('.upload-item');
+ returnImg.push(img.attr('data'))
+ })
+
+ return returnImg;
+ }
+ return ctrl;
+ }
+);
diff --git a/web/src/js/user/register-controller.js b/web/src/js/user/register-controller.js
index 703c542..6e2b17b 100644
--- a/web/src/js/user/register-controller.js
+++ b/web/src/js/user/register-controller.js
@@ -17,7 +17,7 @@ define(
var ctrl = new ctrl();
var registerUrl = '/user/login/register';
- var uploadURL = '/user/login/upload-file';
+ var uploadURL = '/user/default/upload-file';
var getCodeURL = '/user/login/get-code';
var loginURL = '/user/login/do-login';
var clickGetCode = true;
--
libgit2 0.21.0