Skip to content

Commit

Permalink
1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tower1229 committed May 9, 2018
1 parent 89ca92d commit f7c7592
Show file tree
Hide file tree
Showing 17 changed files with 192 additions and 202 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hybridstart",
"version": "1.2.1",
"version": "1.2.2",
"description": "A hybrid application development framework",
"main": "lib/index.js",
"directories": {
Expand Down
12 changes: 1 addition & 11 deletions sdk/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,7 @@ define(function(require, exports, module) {
});
}
}
if (platform === 'ios') {
if (parseFloat(version) >= 9) {
$body.on('click', '.item-radio', function() {
var $view = $(this).parent();
$view.css('visibility', 'hidden');
setTimeout(function() {
$view.css('visibility', 'visible');
}, 0);
});
}
}

//自动加载data-src
app.window.on('resume', function(){
$.each($('[data-src]'), function(i, ele){
Expand Down
23 changes: 18 additions & 5 deletions sdk/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -957,8 +957,11 @@ var apputil = (function(document, undefined) {
z: 0
}
}, config || {});
//IOS不允许传递包含function的对象
var cbTemp = opt.callback;
delete opt.callback;
api.animation(opt, function(ret, err) {
typeof opt.callback === 'function' && opt.callback(ret, err);
typeof cbTemp === 'function' && cbTemp(ret, err);
});
return opt.name;
}
Expand Down Expand Up @@ -1166,10 +1169,11 @@ var gh=((((ga*ga)>>>17)+ga*gb)>>>15)+gb*gb;var gl=(((gx&4294901760)*gx)|0)+(((gx

//返回结果处理
var tempSucc = opt.success;
var tempErr = opt.error;
var handleError = function(res, err) {
if (!res) {
if (typeof(opt['error']) === 'function') {
opt['error'](err);
if (typeof(tempErr) === 'function') {
tempErr(err);
} else {
app.loading.hide();
catchAjaxError(err.code, err.statusCode);
Expand All @@ -1191,11 +1195,15 @@ var gh=((((ga*ga)>>>17)+ga*gb)>>>15)+gb*gb;var gl=(((gx&4294901760)*gx)|0)+(((gx
if(opt.snapshoot && !fromSnap){
app.storage.val(urlkey, res);
}
tempSucc(res);
typeof(tempSucc)==='function' && tempSucc(res);
}
}
//清理数据
delete opt.success;
delete opt.error;
delete opt.callback;
delete opt.beforeCheck;
delete opt.beforeSubmit;
delete opt.type;
delete opt.tiptype;
delete opt.tipSweep;
Expand Down Expand Up @@ -1280,8 +1288,13 @@ var gh=((((ga*ga)>>>17)+ga*gb)>>>15)+gb*gb;var gl=(((gx&4294901760)*gx)|0)+(((gx
values: opt.data
};
}
//console.log(JSON.stringify(opt))
// var aaaaalist = [];
// for(var x in opt){
// aaaaalist.push(x)
// }
// console.log(aaaaalist.join(' '))
api.ajax(opt, function(res, err) {
//console.log(JSON.stringify(res))
handleRes(res);
handleError(res, err);
});
Expand Down
23 changes: 11 additions & 12 deletions sdk/modules/validform/validform.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,8 +542,8 @@ define('validform', function(require, exports, module) {
return true;
}
};
if (ajaxsetup.success) {
var temp_suc = ajaxsetup.success;
if (ajaxsetup.callback) {
var temp_suc = ajaxsetup.callback;
ajaxsetup.success = function(data) {
localconfig.success(data);
temp_suc(data, inputobj);
Expand Down Expand Up @@ -672,8 +672,8 @@ define('validform', function(require, exports, module) {
sweep: settings.tipSweep
}, "byajax");

if (ajaxsetup.success) {
var temp_suc = ajaxsetup.success;
if (ajaxsetup.callback) {
var temp_suc = ajaxsetup.callback;
ajaxsetup.success = function(data) {
settings.callback && settings.callback(data);
curform[0].validform_ajax = null;
Expand Down Expand Up @@ -748,14 +748,13 @@ define('validform', function(require, exports, module) {
}
};
ajaxsetup = $.extend({}, localconfig, ajaxsetup);
setTimeout(function(){
try{
curform[0].validform_ajax = ajaxRequest(ajaxsetup);
}catch(e){
//ios报错兼容
curform[0].validform_ajax = {abort:null};
}
},100)
try{
curform[0].validform_ajax = ajaxRequest(ajaxsetup);
}catch(e){
//ios报错兼容
console.log('validform.js:' + e.message);
curform[0].validform_ajax = {abort:null};
}
return null;
} else {
if (!settings.postonce) {
Expand Down
21 changes: 12 additions & 9 deletions view/common/chooseList/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@
<!-- for: ${data} as ${store} -->
<!-- if: ${store.hasSub} != 1 -->
<!-- if: ${store.multi} -->
<label class="item item-radio radio-primary chooseListHookMulti" data-id="${store.id}">
<input type="radio">
<div class="item item-checkbox radio-primary chooseListHookMulti" data-id="${store.id}">
<label class="checkbox checkbox-primary">
<input type="checkbox" name="checkbox">
</label>
${store.name}
</label>
<!-- else -->
<div class="item chooseListHook" data-id="${store.id}">
${store.name}
<!-- if: ${store.note} -->
<div class="item-note">${store.note}</div>
<!-- /if -->
</div>
<!-- else -->
<label class="item item-radio radio-primary chooseListHook" data-id="${store.id}">
<input type="radio" name="radio">
${store.name}
<!-- if: ${store.note} -->
<div class="item-note">${store.note}</div>
<!-- /if -->
</label>
<!-- /if -->
<!-- else -->
<label class="item item-icon-right" data-id="${store.id}">
Expand Down
29 changes: 12 additions & 17 deletions view/common/chooseList/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ define(function(require) {
var doRend = render({
el: '#storeList',
callback: function(){
app.loading.hide()
app.window.evaluate({
script: 'app.loading.hide()'
});
}
});

Expand All @@ -44,7 +46,9 @@ define(function(require) {
if (res.status === 'Y') {
dataRender(res, getMore);
} else {
app.loading.hide();
app.window.evaluate({
script: 'app.loading.hide()'
});
$('#storeList')[0].innerHTML = '';
app.toast(res.msg, {
color: 'danger',
Expand Down Expand Up @@ -96,9 +100,6 @@ define(function(require) {
var thisObj = getListById($(this).data('id'), extParam.data);
$.extend(choosenItem, thisObj);
app.storage.val('choosenItem',JSON.stringify(choosenItem));
app.window.evaluate({
script: 'submitChoose()'
});
}
}).on('touchstart','.chooseListHookMulti',function(){
//多选
Expand All @@ -109,28 +110,22 @@ define(function(require) {
$(this).data('acting',false);
}).on('touchend', '.chooseListHookMulti',function(){
if($(this).data('acting')){
if(this.className.indexOf(' active')!==-1){
var _catchData = choosenItem.data, _catchId = $(this).data('id');
var cacheClass = this.className;
this.className = cacheClass.replace(/\s*active/g, '');
if(this.querySelector('input:checked')){
var _catchData = choosenItem.data,
_catchId = $(this).data('id');
$.each(_catchData,function(i,e){
if(e.id==_catchId){
_catchData.splice(i,1);
return false;
}
});
choosenItem.data = _catchData;
}else{
this.className = (this.className + ' active');
choosenItem.data.push({
part_id:$(this).data('id'),
name:$(this).data('name'),
code:$(this).data('code'),
spec:$(this).data('spec'),
units:$(this).data('units'),
part_flag:$(this).data('flag'),
img:$(this).data('img')
id:$(this).data('id')
});
}

app.storage.val('choosenItem',JSON.stringify(choosenItem));
}
}).on('click','.item-icon-right',function(){
Expand Down
7 changes: 2 additions & 5 deletions view/common/chooseList/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ define(function(require) {
var $ = app.util;
var extParam = app.getParam();

if(extParam && extParam.multi){
$('#ok')[0].style.display = 'block';
}
var submitChoose = function(){
var choosenItem = app.storage.val('choosenItem');
setTimeout(function(){
Expand All @@ -24,10 +21,10 @@ define(function(require) {
},0);
};
//选好了
$('#ok').on('click',function(){
$('#ok').on('click', function(){
submitChoose();
});
window.submitChoose = submitChoose;

//loading
app.loading.show();

Expand Down
2 changes: 1 addition & 1 deletion view/common/chooseList/temp.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<i class="radio-icon ion">&#xe651;</i>
</div>
<div class="title" id="headTitle">选择</div>
<div class="btn hide" id="ok">
<div class="btn" id="ok">
<i class="ion">&#xe645;</i>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion view/demo/ajax/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ define(function(require) {
case "cache":
app.ajax({
url: "http://spider.dcloud.net.cn/api/banner/36kr",
checkData: false,
cache: true,
success: function(res) {
app.loading.hide();
Expand Down
5 changes: 4 additions & 1 deletion view/demo/chooseList/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ define(function(require) {
}
}, 'common', 'chooseList');
});

//接收返回事件
app.subscribe('choosenItem',function(choosenItem){
console.log(choosenItem)
});


});
2 changes: 1 addition & 1 deletion view/demo/index/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
tabList (多标签列表)
</div>
<div class="item" active="1,demo,list2detail">
list2detail (列表到详细页)
list2detail (列表跳详细极致优化)
</div>
<div class="item" active="1,demo,scoll-list">
scoll-list (下拉刷新+滚动加载)
Expand Down
Loading

0 comments on commit f7c7592

Please sign in to comment.