Commit df34ee8a71ca028d5b18565f2e885186e877bbb6
1 parent
4daadf17
Exists in
master
1.对接API接口相关代码优化。
Showing
10 changed files
with
27 additions
and
9 deletions
Show diff stats
app-wx/modules/smart/controllers/DefaultController.php
... | ... | @@ -306,7 +306,7 @@ class DefaultController extends BaseController |
306 | 306 | $path = $filename_root . '/tmp'; |
307 | 307 | $size = filesize($path . '/' . $filename); |
308 | 308 | $mbSize = round($size/(1024 * 1024), 2); |
309 | - if ($mbSize > 2) { | |
309 | + if ($mbSize > 5) { | |
310 | 310 | // 删除服务器文件 |
311 | 311 | @unlink($path . '/' . $filename); |
312 | 312 | $e->message = '文件大小不能大于2M!'; | ... | ... |
app-wx/web/dist/js/check-app.js
1 | -define("check-app",["mk7/app"],function(n){var t=Dom7,e=function(){var n=t(".ui-loading-block");0==n.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 n=document.getElementById("loader-inner"),t=document.createElement("p");t.className="notice",n&&(t.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',n.appendChild(t))},window.waitingTime))},o=!0;return n.name="check",n.routes={index:function(){return o=!1,e(),n.runController("index")},"*":function(){return o=!1,e(),n.runController("index")},"scan-count/:uuid/:scancount":function(t,i){return o=!1,e(),n.runController("scan-count",{uuid:t,scancount:i})},"warning/:uuid":function(t){return o=!1,e(),n.runController("warning",{uuid:t})},"submit/:uuid":function(t){return o=!1,e(),n.runController("submit",{uuid:t})},"error/:uuid":function(t){return o=!1,e(),n.runController("error",{uuid:t})},"success/:uuid":function(t){return o=!1,e(),n.runController("success",{uuid:t})},"info/:uuid/:number_code":function(t,i){return o=!1,e(),n.runController("info",{uuid:t,number_code:i})}},n}),define("check/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7;Template7;return n.run=function(){var n=this;n.setPageTitle("验证结果"),n.render()},n.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)})},n}),define("check/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7,a=(Template7,1),r=0,s=2,u=0;return n.run=function(){var n=this;n.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["openLocation","getLocation","scanQRCode"]}),n.scanQrcode(),n.render(),c(".scan-button").attr("disabled","disabled"),c(".scan-button").text("正在调起扫码……")},n.bindEvents=function(){var n=this;c(".scan-button").click(function(){n.scanQrcode()})},n.scanQrcode=function(){var n=this;i.ready(function(){i.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(o){var i=o.resultStr,d=c.parseUrlQuery(i);if(null!=d&&void 0!==d&&null!=d.uuid&&void 0!==d.uuid){if(d.uuid.indexOf("@")==-1)return e.toast({content:"该智能防伪二维码无效"}),!1;var d=d.uuid.split("@"),l=t.to("check#warning/"+d[0]),m=t.to("check#scan-count/"+d[0]+"/"+u);c.ajax({method:"POST",url:t.to("check/default/check-active"),data:{uuid:d[0]},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){u=n.scan_count,m=t.to("check#scan-count/"+d[0]+"/"+u),n.success==a?window.location.href=m:n.success==r?window.location.href=l:n.success==s?e.toast({content:"该智能防伪二维码无效"}):e.toast({content:"该智能防伪二维码无效"})},error:function(n){},complete:function(t){n.hideIndicator()}})}else e.toast({content:"请扫描智能防伪二维码"})}}),setTimeout(function(){c(".scan-button").removeAttr("disabled"),c(".scan-button").text("点击扫描标签")},1e3)})},n}),define("check/info-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7;Template7;return i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["previewImage"]}),n.run=function(){var n=this;n.setPageTitle("隐私信息"),n.loadData(n.params.uuid,n.params.number_code),n.popstate()},n.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)}),c(".image_button").click(function(){var n=c(this).attr("data-url");return e.isEmpty(n)?(e.toast({content:"该图片不存在",closeDelay:3e3}),!1):(c(".scan-image-div").html('<img src="'+n+'" class="scan-image"/>'),void c(".scan-image").click(function(){var n=[],t=c("#info").find(".image_button");c.each(t,function(t,e){var o=c(e).attr("data-url");n.push(o)});var e=c(this).attr("src");i.previewImage({current:e,urls:n})}))}),c(".scan-image").click(function(){var n=[],t=c("#info").find(".image_button");c.each(t,function(t,e){var o=c(e).attr("data-url");n.push(o)});var e=c(this).attr("src");i.previewImage({current:e,urls:n})}),c(".vedio_button").click(function(){var n=c(this).attr("data-url");if(e.isEmpty(n))return e.toast({content:"该视频不存在",closeDelay:3e3}),!1;var t="<video class='scan-image' style='border: 1px solid #cce1f1;object-fit: fill;height:15rem;' alt='商品视频' ";t+="controls='controls'> <source src='"+n+"' type='video/mp4'>您的浏览器不支持 video 标签。</video>",c(".scan-image-div").html(t)})},n.loadData=function(n,o){var i=this;c.ajax({method:"POST",url:t.to("check/default/get-info"),data:{uuid:n,number_code:o},dataType:"json",beforeSend:function(){i.showIndicator()},success:function(n){try{n.success?i.render(n.data):e.toast({content:n.message,closeDelay:3e3})}catch(t){e.toast({content:"出错",closeDelay:3e3})}},error:function(n){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){i.hideIndicator()}})},n.popstate=function(){window.addEventListener("popstate",function(n){window.location.href=t.to("check#index")},!1)},n}),define("check/scan-count-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7,a=(Template7,0),r="";return n.run=function(){var n=this;a=parseInt(n.params.scancount),r=n.params.uuid,n.setPageTitle("验证标签"),n.render(),c(".count-num").html(a)},n.bindEvents=function(){c(".scan-button").click(function(){""!=r&&void 0!=r?window.location.href=t.to("check#submit/"+r):window.location.href=t.to("check#index")})},n}),define("check/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7,a=(Template7,"");return n.run=function(){var n=this;a=n.params.uuid,n.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["chooseImage","previewImage","uploadImage","getLocalImgData"]}),n.render()},n.bindEvents=function(){var n=this;c(".scan-image").click(function(){n.uploadImg(c(this))}),c(".scan-button").click(function(){var o=c(".scan-image").attr("data");return e.isEmpty(o)?(e.toast({content:"请拍照文件上传后再试!"}),!1):void c.ajax({method:"POST",url:t.to("check/default/check-actived"),data:{upload_file:o,uuid:a},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){try{n.success?1==n.code?window.location.href=t.to("check#success/"+a):e.toast({content:n.message,closeDelay:3e3}):window.location.href=t.to("check#error/"+a)}catch(o){e.toast({content:"出错",closeDelay:3e3})}},error:function(n){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(t){n.hideIndicator()}})})},n.uploadImg=function(n){var t=this;i.ready(function(){i.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(e){e.localIds.length>0&&t.upload(e.localIds,n)}})})},n.upload=function(n,o){var r=this;return void 0==n[0]?"":void i.uploadImage({localId:n[0],isShowProgressTips:1,success:function(n){c.ajax({method:"POST",url:t.to("check/default/update-serviceid"),data:{service_id:n.serverId,uuid:a},dataType:"json",beforeSend:function(){r.showIndicator()},success:function(n){try{if(n.success){var t=n.img_path;o.attr("data",t),o.attr("src",n.show_path)}else e.toast({content:n.message,closeDelay:3e3})}catch(i){e.toast({content:"出错",closeDelay:3e3})}},error:function(n){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){r.hideIndicator()}})},fail:function(n){r.app.alert(JSON.stringify(n))}})},n}),define("check/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7,a=(Template7,"");return n.run=function(){var n=this;a=n.params.uuid,n.setPageTitle("验证结果"),n.render()},n.bindEvents=function(){var n=this;c(".btn-submit").click(function(){var o=c(".input-num").val();return e.isEmpty(o)?(e.toast({content:"请填写提取码"}),c(".input-num").focus(),!1):e.isEmpty(a)?(e.toast({content:"缺少必要参数请退出重试"}),!1):void c.ajax({method:"POST",url:t.to("check/default/get-info"),data:{uuid:a,number_code:o},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){try{n.success?window.location.href=t.to("check#info/"+a+"/"+o):e.toast({content:n.message,closeDelay:3e3})}catch(i){e.toast({content:"出错",closeDelay:3e3})}},error:function(n){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(t){n.hideIndicator()}})})},n}),define("check/warning-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7,a=(Template7,"");return n.run=function(){var n=this;a=n.params.uuid,n.setPageTitle("验证标签"),n.render()},n.bindEvents=function(){c(".scan-jump-button").click(function(){""!=a&&void 0!=a?window.location.href=t.to("smart#enter/"+a):window.location.href=t.to("check#index")})},n}); | |
2 | 1 | \ No newline at end of file |
2 | +define("check-app",["mk7/app"],function(t){var n=Dom7,e=function(){var t=n(".ui-loading-block");0==t.length&&(n(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var t=document.getElementById("loader-inner"),n=document.createElement("p");n.className="notice",t&&(n.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',t.appendChild(n))},window.waitingTime))},o=!0;return t.name="check",t.routes={index:function(){return o=!1,e(),t.runController("index")},"*":function(){return o=!1,e(),t.runController("index")},"scan-count/:uuid/:scancount":function(n,i){return o=!1,e(),t.runController("scan-count",{uuid:n,scancount:i})},"warning/:uuid":function(n){return o=!1,e(),t.runController("warning",{uuid:n})},"submit/:uuid":function(n){return o=!1,e(),t.runController("submit",{uuid:n})},"error/:uuid":function(n){return o=!1,e(),t.runController("error",{uuid:n})},"success/:uuid":function(n){return o=!1,e(),t.runController("success",{uuid:n})},"info/:uuid/:number_code":function(n,i){return o=!1,e(),t.runController("info",{uuid:n,number_code:i})}},t}),define("check/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7;Template7;return t.run=function(){var t=this;t.setPageTitle("验证结果"),t.render()},t.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)})},t}),define("check/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7,a=(Template7,1),r=0,s=2,u=0;return t.run=function(){var t=this;t.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["openLocation","getLocation","scanQRCode"]}),t.scanQrcode(),t.render(),c(".scan-button").attr("disabled","disabled"),c(".scan-button").text("正在调起扫码……")},t.bindEvents=function(){var t=this;c(".scan-button").click(function(){t.scanQrcode()})},t.scanQrcode=function(){var t=this;i.ready(function(){i.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(o){var i=o.resultStr;if(""==i||void 0==i||i.indexOf("http://smart.zhoundlee.com")<0)return e.toast({content:"该智能防伪二维码无效"}),!1;var d=c.parseUrlQuery(i);if(null!=d&&void 0!==d&&null!=d.uuid&&void 0!==d.uuid){if(d.uuid.indexOf("@")==-1)return e.toast({content:"该智能防伪二维码无效"}),!1;var d=d.uuid.split("@"),l=n.to("check#warning/"+d[0]),m=n.to("check#scan-count/"+d[0]+"/"+u);c.ajax({method:"POST",url:n.to("check/default/check-active"),data:{uuid:d[0]},dataType:"json",beforeSend:function(){t.showIndicator()},success:function(t){u=t.scan_count,m=n.to("check#scan-count/"+d[0]+"/"+u),t.success==a?window.location.href=m:t.success==r?window.location.href=l:t.success==s?e.toast({content:"该智能防伪二维码无效"}):e.toast({content:"该智能防伪二维码无效"})},error:function(t){},complete:function(n){t.hideIndicator()}})}else e.toast({content:"请扫描智能防伪二维码"})}}),setTimeout(function(){c(".scan-button").removeAttr("disabled"),c(".scan-button").text("点击扫描标签")},1e3)})},t}),define("check/info-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7;Template7;return i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["previewImage"]}),t.run=function(){var t=this;t.setPageTitle("隐私信息"),t.loadData(t.params.uuid,t.params.number_code),t.popstate()},t.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)}),c(".image_button").click(function(){var t=c(this).attr("data-url");return e.isEmpty(t)?(e.toast({content:"该图片不存在",closeDelay:3e3}),!1):(c(".scan-image-div").html('<img src="'+t+'" class="scan-image"/>'),void c(".scan-image").click(function(){var t=[],n=c("#info").find(".image_button");c.each(n,function(n,e){var o=c(e).attr("data-url");t.push(o)});var e=c(this).attr("src");i.previewImage({current:e,urls:t})}))}),c(".scan-image").click(function(){var t=[],n=c("#info").find(".image_button");c.each(n,function(n,e){var o=c(e).attr("data-url");t.push(o)});var e=c(this).attr("src");i.previewImage({current:e,urls:t})}),c(".vedio_button").click(function(){var t=c(this).attr("data-url");if(e.isEmpty(t))return e.toast({content:"该视频不存在",closeDelay:3e3}),!1;var n="<video class='scan-image' style='border: 1px solid #cce1f1;object-fit: fill;height:15rem;' alt='商品视频' ";n+="controls='controls'> <source src='"+t+"' type='video/mp4'>您的浏览器不支持 video 标签。</video>",c(".scan-image-div").html(n)})},t.loadData=function(t,o){var i=this;c.ajax({method:"POST",url:n.to("check/default/get-info"),data:{uuid:t,number_code:o},dataType:"json",beforeSend:function(){i.showIndicator()},success:function(t){try{t.success?i.render(t.data):e.toast({content:t.message,closeDelay:3e3})}catch(n){e.toast({content:"出错",closeDelay:3e3})}},error:function(t){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(t){i.hideIndicator()}})},t.popstate=function(){window.addEventListener("popstate",function(t){window.location.href=n.to("check#index")},!1)},t}),define("check/scan-count-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7,a=(Template7,0),r="";return t.run=function(){var t=this;a=parseInt(t.params.scancount),r=t.params.uuid,t.setPageTitle("验证标签"),t.render(),c(".count-num").html(a)},t.bindEvents=function(){c(".scan-button").click(function(){""!=r&&void 0!=r?window.location.href=n.to("check#submit/"+r):window.location.href=n.to("check#index")})},t}),define("check/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7,a=(Template7,"");return t.run=function(){var t=this;a=t.params.uuid,t.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["chooseImage","previewImage","uploadImage","getLocalImgData"]}),t.render()},t.bindEvents=function(){var t=this;c(".scan-image").click(function(){t.uploadImg(c(this))}),c(".scan-button").click(function(){var o=c(".scan-image").attr("data");return e.isEmpty(o)?(e.toast({content:"请拍照文件上传后再试!"}),!1):void c.ajax({method:"POST",url:n.to("check/default/check-actived"),data:{upload_file:o,uuid:a},dataType:"json",beforeSend:function(){t.showIndicator()},success:function(t){try{t.success?1==t.code?window.location.href=n.to("check#success/"+a):e.toast({content:t.message,closeDelay:3e3}):window.location.href=n.to("check#error/"+a)}catch(o){e.toast({content:"出错",closeDelay:3e3})}},error:function(t){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){t.hideIndicator()}})})},t.uploadImg=function(t){var n=this;i.ready(function(){i.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(e){e.localIds.length>0&&n.upload(e.localIds,t)}})})},t.upload=function(t,o){var r=this;return void 0==t[0]?"":void i.uploadImage({localId:t[0],isShowProgressTips:1,success:function(t){c.ajax({method:"POST",url:n.to("check/default/update-serviceid"),data:{service_id:t.serverId,uuid:a},dataType:"json",beforeSend:function(){r.showIndicator()},success:function(t){try{if(t.success){var n=t.img_path;o.attr("data",n),o.attr("src",t.show_path)}else e.toast({content:t.message,closeDelay:3e3})}catch(i){e.toast({content:"校验失败,请换个图片再试!",closeDelay:3e3})}},error:function(t){e.toast({content:"校验失败,请换个图片再试!"})},complete:function(t){r.hideIndicator()}})},fail:function(t){r.app.alert(JSON.stringify(t))}})},t}),define("check/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7,a=(Template7,"");return t.run=function(){var t=this;a=t.params.uuid,t.setPageTitle("验证结果"),t.render()},t.bindEvents=function(){var t=this;c(".btn-submit").click(function(){var o=c(".input-num").val();return e.isEmpty(o)?(e.toast({content:"请填写提取码"}),c(".input-num").focus(),!1):e.isEmpty(a)?(e.toast({content:"缺少必要参数请退出重试"}),!1):void c.ajax({method:"POST",url:n.to("check/default/get-info"),data:{uuid:a,number_code:o},dataType:"json",beforeSend:function(){t.showIndicator()},success:function(t){try{t.success?window.location.href=n.to("check#info/"+a+"/"+o):e.toast({content:t.message,closeDelay:3e3})}catch(i){e.toast({content:"出错",closeDelay:3e3})}},error:function(t){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){t.hideIndicator()}})})},t}),define("check/warning-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(t,n,e,o,i){var t=new t,c=Dom7,a=(Template7,"");return t.run=function(){var t=this;a=t.params.uuid,t.setPageTitle("验证标签"),t.render()},t.bindEvents=function(){c(".scan-jump-button").click(function(){""!=a&&void 0!=a?window.location.href=n.to("smart#enter/"+a):window.location.href=n.to("check#index")})},t}); | |
3 | 3 | \ No newline at end of file | ... | ... |
app-wx/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){var o={selector:e.selector||"",url:e.url||"",processAppendTo:e.processAppendTo||"",timeout:e.timeout||18e4,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}); | |
3 | 3 | \ No newline at end of file | ... | ... |
app-wx/web/dist/js/smart-app.js
1 | -define("smart/actived-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活标签"),e.render()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e}),define("smart-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))},i=!0;return e.name="smart",e.routes={index:function(){return i=!1,n(),e.runController("index")},"enter/:uuid":function(t){i=!1,n();var o={uuid:t};return e.runController("enter",o)},"*":function(){return i=!1,n(),e.runController("index")},actived:function(){return i=!1,n(),e.runController("actived")},error:function(){return i=!1,n(),e.runController("error")},success:function(){return i=!1,n(),e.runController("success")},"error-url":function(){return i=!1,n(),e.runController("error-url")}},e}),define("smart/enter-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin","mk7/uploadjs"],function(e,t,n,i,o,r){var e=new e,s=Dom7,a=(Template7,"smart/default/upload-img"),l="smart/default/upload-vedio",c="smart/default/submit",d=3,u=1,m="",f=!1;return e.run=function(){var e=this;e.setPageTitle("激活标签"),o.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["chooseImage","previewImage","uploadImage","getLocalImgData"]}),m=e.params.uuid,e.hideAllNonBaseMenuItem(window.$site),e.render(),e.loadAddress()},e.bindEvents=function(){var e=this;s("#upload-btn").change(function(e){if(""!=s(this).val()&&null!=s(this).val()){var t=e.currentTarget.files[0].name,i=t.lastIndexOf("."),o=t.substr(i+1);if("jpg"!=o&&"gif"!=o&&"png"!=o&&"jpeg"!=o&&"ico"!=o&&"bmp"!=o)return n.toast({content:"该文件不能作为商品图片",closeDelay:3e3}),!1;if(d==s("#image-list").find(".up-img").length)return n.toast({content:"最多只能上传三张商品图片",closeDelay:3e3}),!1;var l=s(this).parents("li");r.uploadFile({selector:"#upload-btn",url:a,processAppendTo:"#enter",success:function(e,t){try{if(e.success){var i=e.tmpUrl,o="";0==s("#image-list").find(".convert-img").length&&(o='<div class="convert-img">封面</div>'),s('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+i+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')">'+o+'</div><span class="del-img"></span></li>').insertBefore(l),d==s("#image-list").find(".up-img").length&&s(".upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:5e3})}catch(r){console.log(r),n.toast({content:"出错",closeDelay:5e3})}},error:function(e,t){n.toast({content:"文件上传失败",closeDelay:5e3})}})}}),s("#upload-vedio-btn").change(function(e){if(""!=s(this).val()&&null!=s(this).val()){var t=e.currentTarget.files[0].name,i=t.lastIndexOf(".");t.substr(i+1);if(u==s("#vedio-list").find(".up-vedio-img").length)return n.toast({content:"只能上传一个商品视频",closeDelay:3e3}),!1;var o=s(this).parents("li");r.uploadFile({selector:"#upload-vedio-btn",url:l,processAppendTo:"#enter",success:function(e,t){try{if(e.success){var i=e.tmpUrl,r="";0==s("#vedio-list").find(".convert-img").length&&(r='<div class="convert-img">封面</div>'),s('<li class="upload-vedio-li up-vedio-img"><div data="'+e.tmpFile+'" data-url="'+i+'" class="upload-vedio-item" style="background-image:url('+e.tmpMinUrl+')">'+r+'</div><span class="del-vedio-img"></span></li>').insertBefore(o),u==s("#vedio-list").find(".up-vedio-img").length&&s(".upload-vedio-btn-li").hide()}else n.toast({content:e.message,closeDelay:5e3})}catch(a){console.log(a),n.toast({content:"出错",closeDelay:5e3})}},error:function(e,t){n.toast({content:"文件上传失败",closeDelay:5e3})}})}}),s("#enter").on("click",".del-img",function(e){s(this).parent().remove(),d>=s("#image-list").find(".up-img").length&&s(".upload-btn-li").show()}),s("#enter").on("click",".del-vedio-img",function(e){s(this).parent().remove(),u>=s("#vedio-list").find(".up-vedio-img").length&&s(".upload-vedio-btn-li").show()}),s("#enter").on("click","#dropdown-address",function(e){s(".address-input").val(s(this).html())}),s("#enter").on("click",".submit-btn",function(){if(n.isEmpty(m))return n.toast({content:"进入方式不对,请从新扫码激活",closeDelay:3e3}),!1;var i=s(".upload-vedio-item").attr("data"),o="";s(".upload-item").each(function(){var e=s(this).attr("data");n.isEmpty(e)||(o+=s(this).attr("data")+",")}),""!=o&&(o=o.substring(0,o.length-1));var r=s(".address-input").val(),a=s(".logistics_number").val(),l=s(".content-cls").val(),d=s(".phone-number").val(),u=s(".phone-number-header").val();if(!(n.isEmpty(i)&&n.isEmpty(o)&&n.isEmpty(r)&&n.isEmpty(a)&&n.isEmpty(l))){if(n.isEmpty(u))return n.toast({content:"请填写国家区号",closeDelay:3e3}),s(".phone-number-header").focus(),!1;if("86"==u&&!n.isMobile(d))return n.toast({content:"请填写正确手机号码",closeDelay:3e3}),s(".phone-number").focus(),!1}s(".submit-btn").attr("disabled","disabled"),s.ajax({method:"POST",url:c,data:{file_data:o,vedio_data:i,address:r,content:l,phone:d,logistics_number:a,phone_header:u,uuid:m},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){e.success?(s(".submit-btn").removeAttr("disabled"),window.location.href=t.to("smart#success")):window.location.href=t.to("smart#error")},error:function(e){n.alert(e.responseText)},complete:function(t){s(".submit-btn").removeAttr("disabled"),e.hideIndicator()}})})},e.uploadImg=function(e){var t=this;o.ready(function(){o.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(n){n.localIds.length>0&&t.upload(n.localIds,e)}})})},e.upload=function(e,i){var r=this;return void 0==e[0]?"":void o.uploadImage({localId:e[0],isShowProgressTips:1,success:function(e){s.ajax({method:"POST",url:t.to("smart/default/update-serviceid"),data:{service_id:e.serverId},dataType:"json",beforeSend:function(){r.showIndicator()},success:function(e){try{if(e.success){var t=e.img_path,o="";0==s("#image-list").find(".convert-img").length&&(o='<div class="convert-img">封面</div>'),s('<li class="upload-li up-img"><div data="'+e.img_path+'" data-url="'+t+'" class="upload-item" style="background-image:url('+e.show_path+')">'+o+'</div><span class="del-img"></span></li>').insertBefore(i),d==s("#image-list").find(".up-img").length&&s(".upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:3e3})}catch(r){n.toast({content:"出错",closeDelay:3e3})}},error:function(e){alert(e.responseText),n.toast({content:"提交出错,请联系系统管理员"+e.responseText})},complete:function(e){r.hideIndicator()}})},fail:function(e){r.app.alert(JSON.stringify(e))}})},e.loadAddress=function(){var e=this;s.ajax({method:"POST",url:t.to("smart/default/select-address"),data:{},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){try{e.success&&""!=e.address&&(f=!0,s("#dropdown-address").html(e.address),s(".address-input").focus(function(e){f&&s("#dropdown-address").show()}),s(".address-input").blur(function(e){f&&s("#dropdown-address").hide()}))}catch(t){}},error:function(e){},complete:function(t){e.hideIndicator()}})},e}),define("smart/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活结果"),e.render(),e.setTimer()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e.setTimer=function(){var e=4,i=window.setInterval(function(){return 0==e?(window.location.href=t.to("smart#index"),void(n.isEmpty(i)||clearInterval(i))):(r("#timerDiv").html(e+"秒后跳转到激活扫码页"),void e--)},1e3)},e}),define("smart/error-url-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活标签"),e.render()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e}),define("smart/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7,s=(Template7,1),a=0,l=2;return e.run=function(){var e=this;e.setPageTitle("智能防伪扫码"),o.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["openLocation","getLocation","scanQRCode"]}),e.scanQrcode(),e.render(),r(".scan-button").attr("disabled","disabled"),r(".scan-button").text("正在调起扫码……")},e.bindEvents=function(){var e=this;r(".scan-button").click(function(){e.scanQrcode()})},e.scanQrcode=function(){var e=this;o.ready(function(){o.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(i){var o=i.resultStr,c=r.parseUrlQuery(o);if(null!=c&&void 0!==c&&null!=c.uuid&&void 0!==c.uuid){if(c.uuid.indexOf("@")==-1)return n.toast({content:"该智能防伪二维码无效"}),!1;var c=c.uuid.split("@"),d=t.to("smart#enter/"+c[0]),u=t.to("smart#actived"),m=t.to("smart#error-url");r.ajax({method:"POST",url:t.to("smart/default/check-active"),data:{uuid:c[0]},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){e.success==s?window.location.href=u:e.success==a?window.location.href=d:e.success==l?window.location.href=m:window.location.href=m},error:function(e){},complete:function(t){e.hideIndicator()}})}else n.toast({content:"请扫描智能防伪二维码"})}}),setTimeout(function(){r(".scan-button").removeAttr("disabled"),r(".scan-button").text("点击扫描标签")},1e3)})},e}),define("smart/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活结果"),e.render(),e.setTimer()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e.setTimer=function(){var e=4,i=window.setInterval(function(){return 0==e?(window.location.href=t.to("smart#index"),void(n.isEmpty(i)||clearInterval(i))):(r("#timerDiv").html(e+"秒后跳转到激活扫码页"),void e--)},1e3)},e}); | |
2 | 1 | \ No newline at end of file |
2 | +define("smart/actived-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活标签"),e.render()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e}),define("smart-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))},i=!0;return e.name="smart",e.routes={index:function(){return i=!1,n(),e.runController("index")},"enter/:uuid":function(t){i=!1,n();var o={uuid:t};return e.runController("enter",o)},"*":function(){return i=!1,n(),e.runController("index")},actived:function(){return i=!1,n(),e.runController("actived")},error:function(){return i=!1,n(),e.runController("error")},success:function(){return i=!1,n(),e.runController("success")},"error-url":function(){return i=!1,n(),e.runController("error-url")}},e}),define("smart/enter-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin","mk7/uploadjs"],function(e,t,n,i,o,r){var e=new e,s=Dom7,a=(Template7,"smart/default/upload-img"),l="smart/default/upload-vedio",c="smart/default/submit",d=3,u=1,m="",f=!1;return e.run=function(){var e=this;e.setPageTitle("激活标签"),o.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["chooseImage","previewImage","uploadImage","getLocalImgData"]}),m=e.params.uuid,e.hideAllNonBaseMenuItem(window.$site),e.render(),e.loadAddress()},e.bindEvents=function(){var e=this;s("#upload-btn").change(function(e){if(""!=s(this).val()&&null!=s(this).val()){var t=e.currentTarget.files[0].name,i=e.currentTarget.files[0].size,o=t.lastIndexOf("."),l=t.substr(o+1);if("jpg"!=l&&"gif"!=l&&"png"!=l&&"jpeg"!=l&&"ico"!=l&&"bmp"!=l)return n.toast({content:"该文件不能作为商品图片",closeDelay:3e3}),!1;if(i>5242880)return n.toast({content:"图片大小不能超过5M",closeDelay:3e3}),!1;if(d==s("#image-list").find(".up-img").length)return n.toast({content:"最多只能上传三张商品图片",closeDelay:3e3}),!1;var c=s(this).parents("li");r.uploadFile({selector:"#upload-btn",url:a,processAppendTo:"#enter",success:function(e,t){try{if(e.success){var i=e.tmpUrl,o="";0==s("#image-list").find(".convert-img").length&&(o='<div class="convert-img">封面</div>'),s('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+i+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')">'+o+'</div><span class="del-img"></span></li>').insertBefore(c),d==s("#image-list").find(".up-img").length&&s(".upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:5e3})}catch(r){console.log(r),n.toast({content:"出错",closeDelay:5e3})}},error:function(e,t){n.toast({content:"文件上传失败",closeDelay:5e3})}})}}),s("#upload-vedio-btn").change(function(e){if(""!=s(this).val()&&null!=s(this).val()){var t=e.currentTarget.files[0].name,i=e.currentTarget.files[0].size,o=t.lastIndexOf(".");t.substr(o+1);if(u==s("#vedio-list").find(".up-vedio-img").length)return n.toast({content:"只能上传一个商品视频",closeDelay:3e3}),!1;if(i>10485760)return n.toast({content:"图片大小不能超过10M",closeDelay:3e3}),!1;var a=s(this).parents("li");r.uploadFile({selector:"#upload-vedio-btn",url:l,processAppendTo:"#enter",success:function(e,t){try{if(e.success){var i=e.tmpUrl,o="";0==s("#vedio-list").find(".convert-img").length&&(o='<div class="convert-img">封面</div>'),s('<li class="upload-vedio-li up-vedio-img"><div data="'+e.tmpFile+'" data-url="'+i+'" class="upload-vedio-item" style="background-image:url('+e.tmpMinUrl+')">'+o+'</div><span class="del-vedio-img"></span></li>').insertBefore(a),u==s("#vedio-list").find(".up-vedio-img").length&&s(".upload-vedio-btn-li").hide()}else n.toast({content:e.message,closeDelay:5e3})}catch(r){console.log(r),n.toast({content:"出错",closeDelay:5e3})}},error:function(e,t){n.toast({content:"文件上传失败",closeDelay:5e3})}})}}),s("#enter").on("click",".del-img",function(e){s(this).parent().remove(),d>=s("#image-list").find(".up-img").length&&s(".upload-btn-li").show()}),s("#enter").on("click",".del-vedio-img",function(e){s(this).parent().remove(),u>=s("#vedio-list").find(".up-vedio-img").length&&s(".upload-vedio-btn-li").show()}),s("#enter").on("click","#dropdown-address",function(e){s(".address-input").val(s(this).html())}),s("#enter").on("click",".submit-btn",function(){if(n.isEmpty(m))return n.toast({content:"进入方式不对,请从新扫码激活",closeDelay:3e3}),!1;var i=s(".upload-vedio-item").attr("data"),o="";s(".upload-item").each(function(){var e=s(this).attr("data");n.isEmpty(e)||(o+=s(this).attr("data")+",")}),""!=o&&(o=o.substring(0,o.length-1));var r=s(".address-input").val(),a=s(".logistics_number").val(),l=s(".content-cls").val(),d=s(".phone-number").val(),u=s(".phone-number-header").val();if(!(n.isEmpty(i)&&n.isEmpty(o)&&n.isEmpty(r)&&n.isEmpty(a)&&n.isEmpty(l))){if(n.isEmpty(u))return n.toast({content:"请填写国家区号",closeDelay:3e3}),s(".phone-number-header").focus(),!1;if("86"==u&&!n.isMobile(d))return n.toast({content:"请填写正确手机号码",closeDelay:3e3}),s(".phone-number").focus(),!1}s(".submit-btn").attr("disabled","disabled"),s.ajax({method:"POST",url:c,data:{file_data:o,vedio_data:i,address:r,content:l,phone:d,logistics_number:a,phone_header:u,uuid:m},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){e.success?(s(".submit-btn").removeAttr("disabled"),window.location.href=t.to("smart#success")):window.location.href=t.to("smart#error")},error:function(e){n.alert(e.responseText)},complete:function(t){s(".submit-btn").removeAttr("disabled"),e.hideIndicator()}})})},e.uploadImg=function(e){var t=this;o.ready(function(){o.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(n){n.localIds.length>0&&t.upload(n.localIds,e)}})})},e.upload=function(e,i){var r=this;return void 0==e[0]?"":void o.uploadImage({localId:e[0],isShowProgressTips:1,success:function(e){s.ajax({method:"POST",url:t.to("smart/default/update-serviceid"),data:{service_id:e.serverId},dataType:"json",beforeSend:function(){r.showIndicator()},success:function(e){try{if(e.success){var t=e.img_path,o="";0==s("#image-list").find(".convert-img").length&&(o='<div class="convert-img">封面</div>'),s('<li class="upload-li up-img"><div data="'+e.img_path+'" data-url="'+t+'" class="upload-item" style="background-image:url('+e.show_path+')">'+o+'</div><span class="del-img"></span></li>').insertBefore(i),d==s("#image-list").find(".up-img").length&&s(".upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:3e3})}catch(r){n.toast({content:"出错",closeDelay:3e3})}},error:function(e){alert(e.responseText),n.toast({content:"提交出错,请联系系统管理员"+e.responseText})},complete:function(e){r.hideIndicator()}})},fail:function(e){r.app.alert(JSON.stringify(e))}})},e.loadAddress=function(){var e=this;s.ajax({method:"POST",url:t.to("smart/default/select-address"),data:{},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){try{e.success&&""!=e.address&&(f=!0,s("#dropdown-address").html(e.address),s(".address-input").focus(function(e){f&&s("#dropdown-address").show()}),s(".address-input").blur(function(e){f&&s("#dropdown-address").hide()}))}catch(t){}},error:function(e){},complete:function(t){e.hideIndicator()}})},e}),define("smart/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活结果"),e.render(),e.setTimer()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e.setTimer=function(){var e=4,i=window.setInterval(function(){return 0==e?(window.location.href=t.to("smart#index"),void(n.isEmpty(i)||clearInterval(i))):(r("#timerDiv").html(e+"秒后跳转到激活扫码页"),void e--)},1e3)},e}),define("smart/error-url-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活标签"),e.render()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e}),define("smart/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7,s=(Template7,1),a=0,l=2;return e.run=function(){var e=this;e.setPageTitle("智能防伪扫码"),o.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["openLocation","getLocation","scanQRCode"]}),e.scanQrcode(),e.render(),r(".scan-button").attr("disabled","disabled"),r(".scan-button").text("正在调起扫码……")},e.bindEvents=function(){var e=this;r(".scan-button").click(function(){e.scanQrcode()})},e.scanQrcode=function(){var e=this;o.ready(function(){o.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(i){var o=i.resultStr;if(""==o||void 0==o||o.indexOf("http://smart.zhoundlee.com")<0)return n.toast({content:"该智能防伪二维码无效"}),!1;var c=r.parseUrlQuery(o);if(null!=c&&void 0!==c&&null!=c.uuid&&void 0!==c.uuid){if(c.uuid.indexOf("@")==-1)return n.toast({content:"该智能防伪二维码无效"}),!1;var c=c.uuid.split("@"),d=t.to("smart#enter/"+c[0]),u=t.to("smart#actived"),m=t.to("smart#error-url");r.ajax({method:"POST",url:t.to("smart/default/check-active"),data:{uuid:c[0]},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){e.success==s?window.location.href=u:e.success==a?window.location.href=d:e.success==l?window.location.href=m:window.location.href=m},error:function(e){},complete:function(t){e.hideIndicator()}})}else n.toast({content:"请扫描智能防伪二维码"})}}),setTimeout(function(){r(".scan-button").removeAttr("disabled"),r(".scan-button").text("点击扫描标签")},1e3)})},e}),define("smart/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活结果"),e.render(),e.setTimer()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e.setTimer=function(){var e=4,i=window.setInterval(function(){return 0==e?(window.location.href=t.to("smart#index"),void(n.isEmpty(i)||clearInterval(i))):(r("#timerDiv").html(e+"秒后跳转到激活扫码页"),void e--)},1e3)},e}); | |
3 | 3 | \ No newline at end of file | ... | ... |
app-wx/web/src/js/check/index-controller.js
... | ... | @@ -52,6 +52,10 @@ define( |
52 | 52 | desc: 'scanQRCode desc', |
53 | 53 | success: function (res) { |
54 | 54 | var result = res.resultStr; |
55 | + if (result == "" || result == undefined || result.indexOf('http://smart.zhoundlee.com') < 0) { | |
56 | + utils.toast({content:'该智能防伪二维码无效'}); | |
57 | + return false; | |
58 | + } | |
55 | 59 | var resultArr = $$.parseUrlQuery(result); |
56 | 60 | //这个二维码必须传到后台去做验证才对, |
57 | 61 | if(resultArr != null && resultArr!==undefined && resultArr['uuid']!=null && resultArr['uuid']!==undefined) { | ... | ... |
app-wx/web/src/js/check/submit-controller.js
... | ... | @@ -119,11 +119,11 @@ define( |
119 | 119 | utils.toast({content:res.message, closeDelay:3000}); |
120 | 120 | } |
121 | 121 | } catch(ex) { |
122 | - utils.toast({content:'出错', closeDelay:3000}); | |
122 | + utils.toast({content:'校验失败,请换个图片再试!', closeDelay:3000}); | |
123 | 123 | } |
124 | 124 | }, |
125 | 125 | error : function(res){ |
126 | - utils.toast({content:"提交出错,请联系系统管理员"}); | |
126 | + utils.toast({content:"校验失败,请换个图片再试!"}); | |
127 | 127 | }, |
128 | 128 | complete : function(res){ |
129 | 129 | me.hideIndicator(); | ... | ... |
app-wx/web/src/js/smart/enter-controller.js
... | ... | @@ -49,12 +49,17 @@ define( |
49 | 49 | } |
50 | 50 | |
51 | 51 | var filename = e.currentTarget.files[0].name; |
52 | + var filesize = e.currentTarget.files[0].size; | |
52 | 53 | var index = filename.lastIndexOf("."); |
53 | 54 | var suffix = filename.substr(index+1); |
54 | 55 | if ("jpg" != suffix && "gif" != suffix && "png" != suffix && "jpeg" != suffix && "ico" != suffix && "bmp" != suffix) { |
55 | 56 | utils.toast({content:'该文件不能作为商品图片', closeDelay:3000}); |
56 | 57 | return false; |
57 | 58 | } |
59 | + if (filesize > 5242880) { | |
60 | + utils.toast({content:'图片大小不能超过5M', closeDelay:3000}); | |
61 | + return false; | |
62 | + } | |
58 | 63 | |
59 | 64 | if (imgLimit == $$('#image-list').find('.up-img').length) { |
60 | 65 | utils.toast({content:'最多只能上传三张商品图片', closeDelay:3000}); |
... | ... | @@ -100,6 +105,7 @@ define( |
100 | 105 | } |
101 | 106 | |
102 | 107 | var filename = e.currentTarget.files[0].name; |
108 | + var filesize = e.currentTarget.files[0].size; | |
103 | 109 | var index = filename.lastIndexOf("."); |
104 | 110 | var suffix = filename.substr(index+1); |
105 | 111 | /*if ("mp4" != suffix && "mov" != suffix) { |
... | ... | @@ -111,6 +117,10 @@ define( |
111 | 117 | utils.toast({content:'只能上传一个商品视频', closeDelay:3000}); |
112 | 118 | return false; |
113 | 119 | } |
120 | + if (filesize > 10485760) { | |
121 | + utils.toast({content:'图片大小不能超过10M', closeDelay:3000}); | |
122 | + return false; | |
123 | + } | |
114 | 124 | var uploadParent = $$(this).parents('li'); |
115 | 125 | |
116 | 126 | uploadjs.uploadFile({ | ... | ... |
app-wx/web/src/js/smart/index-controller.js
... | ... | @@ -51,6 +51,10 @@ define( |
51 | 51 | desc: 'scanQRCode desc', |
52 | 52 | success: function (res) { |
53 | 53 | var result = res.resultStr; |
54 | + if (result == "" || result == undefined || result.indexOf('http://smart.zhoundlee.com') < 0) { | |
55 | + utils.toast({content:'该智能防伪二维码无效'}); | |
56 | + return false; | |
57 | + } | |
54 | 58 | var resultArr = $$.parseUrlQuery(result); |
55 | 59 | //这个二维码必须传到后台去做验证才对, |
56 | 60 | if(resultArr != null && resultArr!==undefined && resultArr['uuid']!=null && resultArr['uuid']!==undefined) { | ... | ... |
app-wx/web/src/vendor/mk7/cmpts/uploadjs/uploadjs.js
... | ... | @@ -9,7 +9,7 @@ define( |
9 | 9 | selector:options.selector || '', |
10 | 10 | url:options.url || '', |
11 | 11 | processAppendTo: options.processAppendTo || '', |
12 | - timeout:options.timeout || 6000, | |
12 | + timeout:options.timeout || 180000, | |
13 | 13 | beforeSend:function(res, e){}, |
14 | 14 | success:function(res, e){if(options.success){options.success(res, e)}}, |
15 | 15 | complete:function(res, e){if(options.complete){options.complete(res, e)}}, | ... | ... |
common/helpers/CheckActiveHelper.php
... | ... | @@ -78,8 +78,8 @@ class CheckActiveHelper |
78 | 78 | curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data); |
79 | 79 | |
80 | 80 | // 超时时间 |
81 | - curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60); | |
82 | - curl_setopt($curl, CURLOPT_TIMEOUT, 60); | |
81 | + curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 180); | |
82 | + curl_setopt($curl, CURLOPT_TIMEOUT, 180); | |
83 | 83 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); |
84 | 84 | // 返回内容 |
85 | 85 | $callbcak = curl_exec($curl); | ... | ... |