Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
tower1229 committed Jul 31, 2017
1 parent 4e09190 commit 6290d79
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 186 deletions.
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<content src="view/root/temp.html"/>
<preference name="pageBounce" value="false"/>
<preference name="appBackground" value="rgba(0,0,0,0.0)"/>
<preference name="windowBackground" value="rgb(255,255,255)"/>
<preference name="windowBackground" value="rgba(0,0,0,0.0)"/>
<preference name="frameBackgroundColor" value="rgba(0,0,0,0.0)"/>
<preference name="hScrollBarEnabled" value="true"/>
<preference name="vScrollBarEnabled" value="false"/>
Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ <h4>配置</h4>
<p>ajax相关设置</p>
<table class="table">
<tr>
<td>type</td>
<td>method</td>
<td>
请求方式,默认<code>"get"</code>
请求方式,默认<code>"get"</code>,支持常规get,post,put,delete,head,options,trace,patch,额外增加payload
</td>
</tr>
<tr>
Expand Down
8 changes: 3 additions & 5 deletions res/temp/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<!-- if: ${icon} -->
${icon|raw}
<!-- else -->
&#xe6be;
&#xe6bd;
<!-- /if -->
</i>
</div>
<p class="_text">
<!-- if: ${text} -->
${text}
<!-- else -->
没有相关数据
暂无数据
<!-- /if -->
</p>
</div>
Expand All @@ -29,15 +29,13 @@
<!-- if: ${icon} -->
${icon|raw}
<!-- else -->
&#xe691;
&#xe60d;
<!-- /if -->
</i>
</div>
<p class="_text">
<!-- if: ${text} -->
${text}
<!-- else -->
没有相关数据
<!-- /if -->
</p>
<div class="btn btn-block btn-danger" id="goBack">
Expand Down
39 changes: 23 additions & 16 deletions sdk/core.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
app JS SDK
Version:2.2.3
update: ajax snapshoot / app.ready bugfix
date:2017-07-05
Version:2.3.0
update: ajax method add payload
date:2017-07-28
*
/*! Sea.js 2.2.1 | seajs.org/LICENSE.md */
!function(a,b){function c(a){return function(b){return{}.toString.call(b)=="[object "+a+"]"}}function d(){return A++}function e(a){return a.match(D)[0]}function f(a){for(a=a.replace(E,"/");a.match(F);)a=a.replace(F,"/");return a=a.replace(G,"$1/")}function g(a){var b=a.length-1,c=a.charAt(b);return"#"===c?a.substring(0,b):".js"===a.substring(b-2)||a.indexOf("?")>0||".css"===a.substring(b-3)||"/"===c?a:a+".js"}function h(a){var b=v.alias;return b&&x(b[a])?b[a]:a}function i(a){var b=v.paths,c;return b&&(c=a.match(H))&&x(b[c[1]])&&(a=b[c[1]]+c[2]),a}function j(a){var b=v.vars;return b&&a.indexOf("{")>-1&&(a=a.replace(I,function(a,c){return x(b[c])?b[c]:a})),a}function k(a){var b=v.map,c=a;if(b)for(var d=0,e=b.length;e>d;d++){var f=b[d];if(c=z(f)?f(a)||a:a.replace(f[0],f[1]),c!==a)break}return c}function l(a,b){var c,d=a.charAt(0);if(J.test(a))c=a;else if("."===d)c=f((b?e(b):v.cwd)+a);else if("/"===d){var g=v.cwd.match(K);c=g?g[0]+a.substring(1):a}else c=v.base+a;return 0===c.indexOf("//")&&(c=location.protocol+c),c}function m(a,b){if(!a)return"";a=h(a),a=i(a),a=j(a),a=g(a);var c=l(a,b);return c=k(c)}function n(a){return a.hasAttribute?a.src:a.getAttribute("src",4)}function o(a,b,c){var d=S.test(a),e=L.createElement(d?"link":"script");if(c){var f=z(c)?c(a):c;f&&(e.charset=f)}p(e,b,d,a),d?(e.rel="stylesheet",e.href=a):(e.async=!0,e.src=a),T=e,R?Q.insertBefore(e,R):Q.appendChild(e),T=null}function p(a,c,d,e){function f(){a.onload=a.onerror=a.onreadystatechange=null,d||v.debug||Q.removeChild(a),a=null,c()}var g="onload"in a;return!d||!V&&g?(g?(a.onload=f,a.onerror=function(){C("error",{uri:e,node:a}),f()}):a.onreadystatechange=function(){/loaded|complete/.test(a.readyState)&&f()},b):(setTimeout(function(){q(a,c)},1),b)}function q(a,b){var c=a.sheet,d;if(V)c&&(d=!0);else if(c)try{c.cssRules&&(d=!0)}catch(e){"NS_ERROR_DOM_SECURITY_ERR"===e.name&&(d=!0)}setTimeout(function(){d?b():q(a,b)},20)}function r(){if(T)return T;if(U&&"interactive"===U.readyState)return U;for(var a=Q.getElementsByTagName("script"),b=a.length-1;b>=0;b--){var c=a[b];if("interactive"===c.readyState)return U=c}}function s(a){var b=[];return a.replace(X,"").replace(W,function(a,c,d){d&&b.push(d)}),b}function t(a,b){this.uri=a,this.dependencies=b||[],this.exports=null,this.status=0,this._waitings={},this._remain=0}if(!a.seajs){var u=a.seajs={version:"2.2.1"},v=u.data={},w=c("Object"),x=c("String"),y=Array.isArray||c("Array"),z=c("Function"),A=0,B=v.events={};u.on=function(a,b){var c=B[a]||(B[a]=[]);return c.push(b),u},u.off=function(a,b){if(!a&&!b)return B=v.events={},u;var c=B[a];if(c)if(b)for(var d=c.length-1;d>=0;d--)c[d]===b&&c.splice(d,1);else delete B[a];return u};var C=u.emit=function(a,b){var c=B[a],d;if(c)for(c=c.slice();d=c.shift();)d(b);return u},D=/[^?#]*\//,E=/\/\.\//g,F=/\/[^/]+\/\.\.\//,G=/([^:/])\/\//g,H=/^([^/:]+)(\/.+)$/,I=/{([^{]+)}/g,J=/^\/\/.|:\//,K=/^.*?\/\/.*?\//,L=document,M=e(L.URL),N=L.scripts,O=L.getElementById("seajsnode")||N[N.length-1],P=e(n(O)||M);u.resolve=m;var Q=L.head||L.getElementsByTagName("head")[0]||L.documentElement,R=Q.getElementsByTagName("base")[0],S=/\.css(?:\?|$)/i,T,U,V=+navigator.userAgent.replace(/.*(?:AppleWebKit|AndroidWebKit)\/(\d+).*/,"$1")<536;u.request=o;var W=/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^\/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g,X=/\\\\/g,Y=u.cache={},Z,$={},_={},ab={},bb=t.STATUS={FETCHING:1,SAVED:2,LOADING:3,LOADED:4,EXECUTING:5,EXECUTED:6};t.prototype.resolve=function(){for(var a=this,b=a.dependencies,c=[],d=0,e=b.length;e>d;d++)c[d]=t.resolve(b[d],a.uri);return c},t.prototype.load=function(){var a=this;if(!(a.status>=bb.LOADING)){a.status=bb.LOADING;var c=a.resolve();C("load",c);for(var d=a._remain=c.length,e,f=0;d>f;f++)e=t.get(c[f]),e.status<bb.LOADED?e._waitings[a.uri]=(e._waitings[a.uri]||0)+1:a._remain--;if(0===a._remain)return a.onload(),b;var g={};for(f=0;d>f;f++)e=Y[c[f]],e.status<bb.FETCHING?e.fetch(g):e.status===bb.SAVED&&e.load();for(var h in g)g.hasOwnProperty(h)&&g[h]()}},t.prototype.onload=function(){var a=this;a.status=bb.LOADED,a.callback&&a.callback();var b=a._waitings,c,d;for(c in b)b.hasOwnProperty(c)&&(d=Y[c],d._remain-=b[c],0===d._remain&&d.onload());delete a._waitings,delete a._remain},t.prototype.fetch=function(a){function c(){u.request(g.requestUri,g.onRequest,g.charset)}function d(){delete $[h],_[h]=!0,Z&&(t.save(f,Z),Z=null);var a,b=ab[h];for(delete ab[h];a=b.shift();)a.load()}var e=this,f=e.uri;e.status=bb.FETCHING;var g={uri:f};C("fetch",g);var h=g.requestUri||f;return!h||_[h]?(e.load(),b):$[h]?(ab[h].push(e),b):($[h]=!0,ab[h]=[e],C("request",g={uri:f,requestUri:h,onRequest:d,charset:v.charset}),g.requested||(a?a[g.requestUri]=c:c()),b)},t.prototype.exec=function(){function a(b){return t.get(a.resolve(b)).exec()}var c=this;if(c.status>=bb.EXECUTING)return c.exports;c.status=bb.EXECUTING;var e=c.uri;a.resolve=function(a){return t.resolve(a,e)},a.async=function(b,c){return t.use(b,c,e+"_async_"+d()),a};var f=c.factory,g=z(f)?f(a,c.exports={},c):f;return g===b&&(g=c.exports),delete c.factory,c.exports=g,c.status=bb.EXECUTED,C("exec",c),g},t.resolve=function(a,b){var c={id:a,refUri:b};return C("resolve",c),c.uri||u.resolve(c.id,b)},t.define=function(a,c,d){var e=arguments.length;1===e?(d=a,a=b):2===e&&(d=c,y(a)?(c=a,a=b):c=b),!y(c)&&z(d)&&(c=s(""+d));var f={id:a,uri:t.resolve(a),deps:c,factory:d};if(!f.uri&&L.attachEvent){var g=r();g&&(f.uri=g.src)}C("define",f),f.uri?t.save(f.uri,f):Z=f},t.save=function(a,b){var c=t.get(a);c.status<bb.SAVED&&(c.id=b.id||a,c.dependencies=b.deps||[],c.factory=b.factory,c.status=bb.SAVED)},t.get=function(a,b){return Y[a]||(Y[a]=new t(a,b))},t.use=function(b,c,d){var e=t.get(d,y(b)?b:[b]);e.callback=function(){for(var b=[],d=e.resolve(),f=0,g=d.length;g>f;f++)b[f]=Y[d[f]].exec();c&&c.apply(a,b),delete e.callback},e.load()},t.preload=function(a){var b=v.preload,c=b.length;c?t.use(b,function(){b.splice(0,c),t.preload(a)},v.cwd+"_preload_"+d()):a()},u.use=function(a,b){return t.preload(function(){t.use(a,b,v.cwd+"_use_"+d())}),u},t.define.cmd={},a.define=t.define,u.Module=t,v.fetchedList=_,v.cid=d,u.require=function(a){var b=t.get(t.resolve(a));return b.status<bb.EXECUTING&&(b.onload(),b.exec()),b.exports};var cb=/^(.+?\/)(\?\?)?(seajs\/)+/;v.base=(P.match(cb)||["",P])[1],v.dir=P,v.cwd=M,v.charset="utf-8",v.preload=function(){var a=[],b=location.search.replace(/(seajs-\w+)(&|$)/g,"$1=1$2");return b+=" "+L.cookie,b.replace(/(seajs-\w+)=1/g,function(b,c){a.push(c)}),a}(),u.config=function(a){for(var b in a){var c=a[b],d=v[b];if(d&&w(d))for(var e in c)d[e]=c[e];else y(d)?c=d.concat(c):"base"===b&&("/"!==c.slice(-1)&&(c+="/"),c=l(c)),v[b]=c}return C("config",a),u}}}(this);
Expand Down Expand Up @@ -354,13 +354,9 @@ var apputil = (function(document, undefined) {

var exit = function(silent) {
var targetStor = appcfg.set.temporary.split(',');
for (var lst in window.localStorage){
targetStor.forEach(function(name){
if(name===lst){
return localStorage.removeItem(lst);
}
});
}
targetStor.forEach(function(name){
localStorage.removeItem(name);
});
api.closeWidget({
silent: !!silent,
animation: {
Expand Down Expand Up @@ -724,7 +720,7 @@ var apputil = (function(document, undefined) {
//delay,onclose,position
var opt = $.extend({
msg: msg,
duration: 1500,
duration: 1000,
location: 'bottom',
global: true
}, config || {});
Expand Down Expand Up @@ -881,6 +877,7 @@ var apputil = (function(document, undefined) {
top: top,
width: offset.width || offset.right - offset.left,
height: offset.height || offset.bottom - offset.top,
param: config.param,
bounces: config.bounce
}));
};
Expand Down Expand Up @@ -911,7 +908,7 @@ var apputil = (function(document, undefined) {
},
customRefreshHeader: 'UIPullRefreshFlash',
hScrollBarEnabled: false,
pageParam: config.param,
pageParam: $.isPlainObject(config.param) ? config.param : {},
bgColor: appcfg.set.bgColor,
bounces: !!config.bounce
});
Expand Down Expand Up @@ -1238,10 +1235,20 @@ var gh=((((ga*ga)>>>17)+ga*gb)>>>15)+gb*gb;var gl=(((gx&4294901760)*gx)|0)+(((gx
handleRes(snapshootVal, true);
}
}

opt.data = {
values: opt.data
};
//增加payload方式
if(opt.method==='payload'){
opt.method = 'post';
opt.headers = $.extend(opt.headers || {}, {
'Content-Type':'application/json; charset=utf-8'
});
opt.data = {
body: opt.data
};
}else{
opt.data = {
values: opt.data
};
}
api.ajax(opt, function(res, err) {
handleRes(res);
handleError(res, err);
Expand Down
6 changes: 3 additions & 3 deletions sdk/modules/datepicker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define(function(require, exports, module) {
"use strict";
seajs.importStyle('.date-selector-locked{height:100%!important;overflow:hidden!important}.date-selector-bg-delay{z-index:999!important}.date-selector-bg{position:fixed;top:0;left:0;background:rgba(75,75,75,0);height:100%;width:100%;overflow:hidden;transition:all .3s ease;-webkit-transition:all .3s ease;z-index:-1}.date-selector-bg-up{z-index:999!important;background:rgba(75,75,75,.65)!important}.date-selector-container{width:100%;height:250px;position:absolute;bottom:0;transform:translate3d(0,101%,0);-webkit-transform:translate3d(0,101%,0);left:0;background-color:#FFF;transition:transform .3s ease;-webkit-transition:-webkit-transform .3s ease;z-index:-1}.date-selector-container-up{transform:translate3d(0,0,0)!important;-webkit-transform:translate3d(0,0,0)!important}.date-selector-btn-box{display:block;position:absolute;text-align:center;width:100%;height:50px;line-height:50px;background:rgba(218,218,218,.7);z-index:10}.date-selector-btn-box .date-selector-btn{position:absolute;display:inline-block;margin:0 20px;color:#fff;right:0}.date-selector-btn-box .date-selector-btn:nth-child(1){left:0;right:initial}.date-selector-tab-box{display:inline-block;border-radius:10px;margin:9px 0;height:32px;box-sizing:border-box;line-height:30px;color:rgba(218,218,218,.7);background:#fff;border:1px solid #fff}.date-selector-tab-box .date-selector-tab{display:inline-block;padding:0 10px;transition:all .3s ease}.date-selector-tab-box .date-selector-tab:first-child{border-right:1px solid #fff}.date-selector-tab-box .date-selector-tab-active{color:#fff;border-radius:10px;background:rgba(219,219,219,1)}.date-selector-content-left{transform:translate3d(-100%,0,0)!important;-webkit-transform:translate3d(-100%,0,0)!important}.date-selector-content-right{transform:translate3d(100%,0,0)!important;-webkit-transform:translate3d(100%,0,0)!important}.date-selector-content{position:absolute;width:100%;background:#fff;font-size:0;top:50px;z-index:10;transform:translate3d(0,0,0);-webkit-transform:translate3d(0,0,0);transition:transform .3s ease;-webkit-transition:-webkit-transform .3s ease}.date-selector-content .date-selector{display:inline-block;height:200px;overflow:hidden;position:relative;z-index:-1;top:0;vertical-align:top}.date-selector-content .date-selector-left{width:33.33%}.date-selector-content .date-selector-right{width:50%}.date-selector-content ul::-webkit-scrollbar{display:none}.date-selector-content li{height:40px;text-align:center;font-size:16px;line-height:40px;list-style:none}.date-selector-content .date-selector-down-shadow,.date-selector-content .date-selector-up-shadow{width:100%;height:80px;position:absolute;pointer-events:none;background-image:linear-gradient(to bottom,#FFF,rgba(255,255,255,0));z-index:50}.date-selector-content .date-selector-up-shadow{top:0}.date-selector-content .date-selector-down-shadow{bottom:0;z-index:50;background-image:linear-gradient(to top,#FFF,rgba(255,255,255,0))}.date-selector-content .date-selector-line{width:95%;height:40px;position:absolute;top:80px;left:50%;pointer-events:none;box-sizing:border-box;border-top:1px solid #DCDCDC;border-bottom:1px solid #DCDCDC;transform:translate3d(-50%,0,0);-webkit-transform:translate3d(-50%,0,0)}',
seajs.importStyle('.date-selector-locked{height:100%!important;overflow:hidden!important}.date-selector-bg-delay{z-index:999!important}.date-selector-bg{position:fixed;top:0;left:0;background:rgba(75,75,75,0);height:100%;width:100%;overflow:hidden;transition:all .3s ease;-webkit-transition:all .3s ease;z-index:-1}.date-selector-bg-up{z-index:999!important;background:rgba(75,75,75,.65)!important}.date-selector-container{width:100%;height:250px;position:absolute;bottom:0;transform:translate3d(0,101%,0);-webkit-transform:translate3d(0,101%,0);left:0;background-color:#FFF;transition:transform .3s ease;-webkit-transition:-webkit-transform .3s ease;z-index:-1}.date-selector-container-up{transform:translate3d(0,0,0)!important;-webkit-transform:translate3d(0,0,0)!important}.date-selector-btn-box{display:block;position:absolute;text-align:center;width:100%;height:50px;line-height:50px;background:rgba(218,218,218,.7);z-index:10}.date-selector-btn-box .date-selector-btn{position:absolute;display:inline-block;margin:0 20px;right:0}.date-selector-btn-box .date-selector-btn:nth-child(1){left:0;right:initial}.date-selector-tab-box{display:inline-block;border-radius:10px;margin:9px 0;height:32px;box-sizing:border-box;line-height:30px;color:rgba(218,218,218,.7);background:#fff;border:1px solid #fff}.date-selector-tab-box .date-selector-tab{display:inline-block;padding:0 10px;transition:all .3s ease}.date-selector-tab-box .date-selector-tab:first-child{border-right:1px solid #fff}.date-selector-tab-box .date-selector-tab-active{color:#fff;border-radius:10px;background:rgba(219,219,219,1)}.date-selector-content-left{transform:translate3d(-100%,0,0)!important;-webkit-transform:translate3d(-100%,0,0)!important}.date-selector-content-right{transform:translate3d(100%,0,0)!important;-webkit-transform:translate3d(100%,0,0)!important}.date-selector-content{position:absolute;width:100%;background:#fff;font-size:0;top:50px;z-index:10;transform:translate3d(0,0,0);-webkit-transform:translate3d(0,0,0);transition:transform .3s ease;-webkit-transition:-webkit-transform .3s ease}.date-selector-content .date-selector{display:inline-block;height:200px;overflow:hidden;position:relative;z-index:-1;top:0;vertical-align:top}.date-selector-content .date-selector-left{width:33.33%}.date-selector-content .date-selector-right{width:50%}.date-selector-content ul::-webkit-scrollbar{display:none}.date-selector-content li{height:40px;text-align:center;font-size:16px;line-height:40px;list-style:none}.date-selector-content .date-selector-down-shadow,.date-selector-content .date-selector-up-shadow{width:100%;height:80px;position:absolute;pointer-events:none;background-image:linear-gradient(to bottom,#FFF,rgba(255,255,255,0));z-index:50}.date-selector-content .date-selector-up-shadow{top:0}.date-selector-content .date-selector-down-shadow{bottom:0;z-index:50;background-image:linear-gradient(to top,#FFF,rgba(255,255,255,0))}.date-selector-content .date-selector-line{width:95%;height:40px;position:absolute;top:80px;left:50%;pointer-events:none;box-sizing:border-box;border-top:1px solid #DCDCDC;border-bottom:1px solid #DCDCDC;transform:translate3d(-50%,0,0);-webkit-transform:translate3d(-50%,0,0)}',
module.uri);
/**
* Created by appian on 16/8/5.
Expand Down Expand Up @@ -192,7 +192,7 @@ define(function(require, exports, module) {
html += '<div class="date-selector-bg" id="date-selector-bg-' + _this.container + '">' +
'<div class="date-selector-container" id="date-selector-container-' + _this.container + '">' +
'<div class="date-selector-btn-box">' +
'<div class="date-selector-btn" id="date-selector-btn-cancel">返回</div>';
'<div class="date-selector-btn text-primary" id="date-selector-btn-cancel">返回</div>';

if (this.type == 1) {
html += '<div class="date-selector-tab-box">' +
Expand All @@ -201,7 +201,7 @@ define(function(require, exports, module) {
'</div>';
}

html += '<div class="date-selector-btn" id="date-selector-btn-save-' + _this.container + '">确定</div>' +
html += '<div class="date-selector-btn text-primary" id="date-selector-btn-save-' + _this.container + '">确定</div>' +
'</div>' +
'<div class="date-selector-content">';

Expand Down
4 changes: 2 additions & 2 deletions sdk/modules/multi-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ define(function(require, exports, module) {
html += '<div class="multi-picker-bg" id="multi-picker-bg-' + _this.container + '">'
+ '<div class="multi-picker-container" id="multi-picker-container-' + _this.container + '">'
+ '<div class="multi-picker-btn-box">'
+ '<div class="multi-picker-btn" id="multi-picker-btn-cancel">返回</div>'
+ '<div class="multi-picker-btn" id="multi-picker-btn-save-' + _this.container + '">确定</div>'
+ '<div class="multi-picker-btn text-primary" id="multi-picker-btn-cancel">返回</div>'
+ '<div class="multi-picker-btn text-primary" id="multi-picker-btn-save-' + _this.container + '">确定</div>'
+ '</div>'
+ '<div class="multi-picker-content">'
+ '<div class="multi-picker-up-shadow"></div>'
Expand Down
11 changes: 6 additions & 5 deletions sdk/modules/scroll-load.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* name: scroll-load
* version: 1.0.1
* updata: loadingTemplate允许为空
* data: 2017-04-27
* version: 1.0.2
* updata: 不合法调用返回null
* data: 2017-07-26
*/
define('scroll-load', function(require, exports, module) {
"use strict";
Expand Down Expand Up @@ -35,6 +35,7 @@ define('scroll-load', function(require, exports, module) {
$loading,
destory;
if (!$wrap.length) {
console.warn(opt.el + '不存在');
return null;
}
loadingId = $wrap.data('scroll-load-id') || base.getUUID();
Expand All @@ -60,10 +61,10 @@ define('scroll-load', function(require, exports, module) {
if (!opt.force) {
if (window.nomore) {
destory();
return $wrap;
return null;
}
if ($wrap.data('scroll-load-id')) {
return $wrap;
return null;
}
}
destory = function() {
Expand Down
Loading

0 comments on commit 6290d79

Please sign in to comment.