|
@ -519,7 +519,8 @@ define(["zepto"],function($){
|
519
|
519
|
if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@")
|
520
|
520
|
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]")
|
521
|
521
|
.replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) {
|
522
|
|
|
|
522
|
|
|
523
|
console.log("########data");
|
523
|
524
|
//先尝试使用浏览器内部JSON解析器
|
524
|
525
|
return window.JSON && window.JSON.parse ?
|
525
|
526
|
window.JSON.parse( data ) :
|
|
@ -580,7 +581,8 @@ define(["zepto"],function($){
|
580
|
581
|
str=str.replace(/\\\":(null|undefined)(,|})/g,"\\\":\\\"\\\"$2"); //处理KEY值里放IData或IDataset的toString串里的空值
|
581
|
582
|
str=str.replace(/\\\":(true|false)(,|})/g,"\\\":\\\"$1\\\"$2"); //处理KEY值里放IData或IDataset的toString串里的布尔值
|
582
|
583
|
str=str.replace(/\\\":(-)?([0-9\.]+)(,|})/g,"\\\":\\\"$1$2\\\"$3"); //处理KEY值里放IData或IDataset的toString串里的数值
|
583
|
|
str=str.replace(/\\\"/g,"!~b~!"); //把字符串中原有的 \" 替换,处理KEY值里放IData或IDataset的toString串的情况
|
|
584
|
//ybf326
|
|
585
|
//str=str.replace(/\\\"/g,"!~b~!"); //把字符串中原有的 \" 替换,处理KEY值里放IData或IDataset的toString串的情况
|
584
|
586
|
|
585
|
587
|
str=str.replace(/:(null|undefined)(,|})/g,":\"\"$2"); //将null或undefined替换为空字符
|
586
|
588
|
str=str.replace(/:(true|false)(,|})/g,":\"$1\"$2"); //将true|false替换为字符串
|
|
@ -617,9 +619,10 @@ define(["zepto"],function($){
|
617
|
619
|
case "\n":
|
618
|
620
|
out +="\u005Cn";
|
619
|
621
|
break;
|
620
|
|
case "\"":
|
|
622
|
//ybf326
|
|
623
|
/*case "\"":
|
621
|
624
|
out +="!~a~!";
|
622
|
|
break;
|
|
625
|
break;*/
|
623
|
626
|
default:
|
624
|
627
|
out += chr;
|
625
|
628
|
break;
|
|
@ -627,14 +630,14 @@ define(["zepto"],function($){
|
627
|
630
|
}
|
628
|
631
|
str = out;
|
629
|
632
|
|
|
633
|
//ybf326
|
|
634
|
/*
|
630
|
635
|
//第一次替换处理JSON格式的双引号字符
|
631
|
636
|
str=str.replace(/{!~a~!/g,"{\""); //处理 {"
|
632
|
637
|
str=str.replace(/!~a~!}/g,"\"}"); //处理 "}
|
633
|
638
|
str=str.replace(/!~a~!,!~a~!/g,"\",\""); //处理 ","
|
634
|
639
|
str=str.replace(/!~a~!:!~a~!/g,"\":\""); //处理 ":"
|
635
|
|
str=str.replace(/!~a~!:\[!~a~!/g,"\":[\""); //处理 ":["
|
636
|
640
|
str=str.replace(/!~a~!:\[/g,"\":["); //处理 ":[
|
637
|
|
str=str.replace(/!~a~!\],!~a~!/g,"\"],\""); //处理 "],"
|
638
|
641
|
str=str.replace(/\],!~a~!/g,"],\""); //处理 ],"
|
639
|
642
|
str=str.replace(/!~a~!:{/g,"\":{"); //处理 ":{
|
640
|
643
|
str=str.replace(/},!~a~!/g,"},\""); //处理 },"
|
|
@ -643,6 +646,7 @@ define(["zepto"],function($){
|
643
|
646
|
str=str.replace(/\u005C!~a~!/g,"\u005C\""); //本身就有\的还原
|
644
|
647
|
str=str.replace(/!~a~!/g,"\u005C\""); //其它的加上\符号
|
645
|
648
|
str=str.replace(/!~b~!/g,"\u005C\""); //恢复 !~b~! 为 \"
|
|
649
|
*/
|
646
|
650
|
|
647
|
651
|
//str=str.replace(/\r/g,"\u005Cr");
|
648
|
652
|
//str=str.replace(/\n/g,"\u005Cn");
|
|
@ -680,6 +684,10 @@ define(["zepto"],function($){
|
680
|
684
|
case "\"":
|
681
|
685
|
out +="\u005C\"";
|
682
|
686
|
break;
|
|
687
|
//ybf326
|
|
688
|
case "\\":
|
|
689
|
out += "\u005C\u005C";
|
|
690
|
break;
|
683
|
691
|
default:
|
684
|
692
|
out += chr;
|
685
|
693
|
break;
|
|
@ -713,7 +721,9 @@ define(["zepto"],function($){
|
713
|
721
|
},
|
714
|
722
|
parseString:function(str){
|
715
|
723
|
str=$.parseJsonString(str);
|
716
|
|
(new Function("this.parseObject(" +str+")")).apply(this);
|
|
724
|
console.log("#####this.parseObject");
|
|
725
|
return window.JSON && window.JSON.parse ? this.parseObject(window.JSON.parse(str))
|
|
726
|
: (new Function("this.parseObject(" +str+")")).apply(this);
|
717
|
727
|
//if(typeof(o)=="object")this.parseObject(o);
|
718
|
728
|
},
|
719
|
729
|
parseObject:function(obj){
|
|
@ -802,7 +812,9 @@ define(["zepto"],function($){
|
802
|
812
|
},
|
803
|
813
|
parseString:function(str){
|
804
|
814
|
str=$.parseJsonString(str);
|
805
|
|
(new Function("this.parseArray(" +str+")")).apply(this);
|
|
815
|
console.log("#####this.parseArray");
|
|
816
|
return window.JSON && window.JSON.parse ? this.parseArray(window.JSON.parse(str)) :
|
|
817
|
(new Function("this.parseArray(" +str+")")).apply(this);
|
806
|
818
|
},
|
807
|
819
|
parseArray:function(o){
|
808
|
820
|
for(var i=0;i<o.length;i++){
|
|
@ -287,8 +287,12 @@ define(["require"],function(require) {
|
287
|
287
|
},getContacts:function(callback,err){
|
288
|
288
|
storageCallback("getContacts",callback);
|
289
|
289
|
execute("getContacts",[], err);
|
290
|
|
},openBrowser:function(url,err){
|
291
|
|
execute("openBrowser",[url],err);
|
|
290
|
},openKeyboard:function(value,err){
|
|
291
|
execute("openKeyboard",[value],err);
|
|
292
|
},setScreeLock:function(dataAction,param,indexPage,err){
|
|
293
|
execute("setScreeLock",[dataAction,param,indexPage],err);
|
|
294
|
},screeUnlock:function(screenUnlockType, forgetPageAction, err){
|
|
295
|
execute("screeUnlock",[screenUnlockType, forgetPageAction],err);
|
292
|
296
|
}
|
293
|
297
|
};
|
294
|
298
|
})();
|
|
@ -203,6 +203,21 @@ define(["browserTool","jcl"],function(browserTool,Wade) {
|
203
|
203
|
this.selectFirst = function(dbName,table,columns,conds,callback,err){
|
204
|
204
|
alert("等待实现");
|
205
|
205
|
};
|
|
206
|
// 设置手势锁
|
|
207
|
this.setScreeLock = function(dataAction,param,indexPage,err) {
|
|
208
|
alert("等待实现");
|
|
209
|
}
|
|
210
|
// 解锁
|
|
211
|
this.screeUnlock = function(screenUnlockType, forgetPageAction, err){
|
|
212
|
alert("等待实现");
|
|
213
|
}
|
|
214
|
// 打开小键盘
|
|
215
|
this.openKeyboard = function(value,err){
|
|
216
|
alert("等待实现");
|
|
217
|
}
|
|
218
|
this.openNative = function(data,err){
|
|
219
|
alert("等待实现");
|
|
220
|
}
|
206
|
221
|
}
|
207
|
222
|
|
208
|
223
|
return Mobile;
|
|
@ -166,6 +166,21 @@ define(["wadeMobile","clientTool"],function(WadeMobile,clientTool) {
|
166
|
166
|
this.selectFirst = function(dbName,sql,bindArgs,callback,err){
|
167
|
167
|
WadeMobile.selectFirst(dbName,sql,bindArgs,callback,err);
|
168
|
168
|
};
|
|
169
|
// 设置手势锁
|
|
170
|
this.setScreeLock = function(dataAction,param,indexPage,err) {
|
|
171
|
WadeMobile.setScreeLock(dataAction,param.toString(),indexPage,err);
|
|
172
|
}
|
|
173
|
// 解锁
|
|
174
|
this.screeUnlock = function(screenUnlockType, forgetPageAction, err){
|
|
175
|
WadeMobile.screeUnlock(screenUnlockType, forgetPageAction, err);
|
|
176
|
}
|
|
177
|
// 打开小键盘
|
|
178
|
this.openKeyboard = function(value,err){
|
|
179
|
WadeMobile.openKeyboard(value,err);
|
|
180
|
}
|
|
181
|
this.openNative = function(data,err){
|
|
182
|
WadeMobile.openNative(data.toString(),err);
|
|
183
|
}
|
169
|
184
|
};
|
170
|
185
|
|
171
|
186
|
return Mobile;
|
|
@ -16,7 +16,7 @@ require.config({
|
16
|
16
|
'iScroll5' : 'base/iscroll5',
|
17
|
17
|
'hammer' : 'base/hammer',
|
18
|
18
|
'o' : 'frame/o',
|
19
|
|
'oEvent' : 'frame/o-event',
|
|
19
|
//'oEvent' : 'frame/o-event',
|
20
|
20
|
'oInput' : 'frame/o-input',
|
21
|
21
|
'tap' : 'frame/tap',
|
22
|
22
|
'browserTool' : 'mobile/browser-toolkit',
|
|
@ -43,7 +43,9 @@ require.config({
|
43
|
43
|
'wmProgress' : 'ui/wm-progress',
|
44
|
44
|
'wmSegment' : 'ui/wm-segment',
|
45
|
45
|
'wmDialog' : 'ui/wm-dialog',
|
46
|
|
'wmDropmenu' : 'ui/wm-dropmenu'
|
|
46
|
'wmDialog2' : 'ui/wm-dialog2',
|
|
47
|
'wmDropmenu' : 'ui/wm-dropmenu',
|
|
48
|
'wmRefresh' : 'ui/wm-refresh'
|
47
|
49
|
|
48
|
50
|
},
|
49
|
51
|
deps: [],
|
|
@ -0,0 +1,80 @@
|
|
1
|
/*引入util对应的js文件*/
|
|
2
|
define(['util'], function(){
|
|
3
|
var isClose = true;
|
|
4
|
/*WmNavBar对象定义*/
|
|
5
|
function WmDialog2(id){
|
|
6
|
this.listeners = new Array(); //存储监听事件
|
|
7
|
this.id = id;
|
|
8
|
/*常用对象*/
|
|
9
|
this.box = (function(obj){
|
|
10
|
if(typeof(obj)=="object"){
|
|
11
|
obj = $(obj);
|
|
12
|
}else if(typeof(obj)=="string"){
|
|
13
|
obj = $("#"+obj);
|
|
14
|
}else{
|
|
15
|
alert("没有匹配类型");
|
|
16
|
return null;
|
|
17
|
}
|
|
18
|
return obj;
|
|
19
|
})(id);
|
|
20
|
this.negativeButton = this.box.find(".s-dialog-cancle");
|
|
21
|
this.positiveButton = this.box.find(".s-dialog-ok");
|
|
22
|
this.title = this.box.find('.s-dialog-title');
|
|
23
|
this.mainView = this.box.find('.s-dialog-mainview');
|
|
24
|
|
|
25
|
var that = this;
|
|
26
|
this.negativeButton.tap(function(){
|
|
27
|
that.hide();
|
|
28
|
});
|
|
29
|
}
|
|
30
|
|
|
31
|
WmDialog2.prototype.show = function(){
|
|
32
|
this.box.addClass('s-dialog-show');
|
|
33
|
}
|
|
34
|
|
|
35
|
WmDialog2.prototype.hide = function(){
|
|
36
|
this.box.removeClass('s-dialog-show');
|
|
37
|
}
|
|
38
|
|
|
39
|
WmDialog2.prototype.setPositiveAction = function(action,isHide){
|
|
40
|
var that = this;
|
|
41
|
if(this.positiveButton.length != 0){
|
|
42
|
this.positiveButton.tap(function(){
|
|
43
|
if(typeof(action) == "function") {
|
|
44
|
action();
|
|
45
|
}
|
|
46
|
if(isHide){
|
|
47
|
that.hide();
|
|
48
|
}
|
|
49
|
});
|
|
50
|
}
|
|
51
|
}
|
|
52
|
|
|
53
|
WmDialog2.prototype.setNegativeAction = function(action,isHide){
|
|
54
|
var that = this;
|
|
55
|
if(this.negativeButton.length != 0){
|
|
56
|
this.negativeButton.tap(function(){
|
|
57
|
if(typeof(action) == "function") {
|
|
58
|
action();
|
|
59
|
}
|
|
60
|
if(isHide){
|
|
61
|
that.hide();
|
|
62
|
}
|
|
63
|
});
|
|
64
|
}
|
|
65
|
}
|
|
66
|
|
|
67
|
WmDialog2.prototype.setTitle = function(title){
|
|
68
|
this.title.text(title);
|
|
69
|
}
|
|
70
|
/*设置内容*/
|
|
71
|
WmDialog2.prototype.setContentView = function(str,setBy) {
|
|
72
|
if (setBy == "html") {
|
|
73
|
this.mainView.html($("#" + str).html());
|
|
74
|
} else {
|
|
75
|
this.mainView.html("<div>" + str + "</div>");
|
|
76
|
}
|
|
77
|
}
|
|
78
|
|
|
79
|
return WmDialog2;
|
|
80
|
});
|
|
@ -1,4 +1,14 @@
|
1
|
1
|
<script src="res/js/base/require.js"></script>
|
2
|
2
|
<script src="res/js/require-config.js" ></script>
|
3
|
3
|
<script src="biz/js/common/require-config.js" ></script>
|
4
|
|
|
|
4
|
<link rel="stylesheet" type="text/css" href="res/css/base.css"/>
|
|
5
|
<!--注:由于html页面会被加密,不能使用双斜杠作为注释符号-->
|
|
6
|
<script language="javascript">
|
|
7
|
/*自定义增加每个页面需要执行的公共逻辑*/
|
|
8
|
require(["domReady!","mobile","jcl","tap"],function(doc, Mobile, $) {
|
|
9
|
/*每个页面的back样式都需要执行回退*/
|
|
10
|
$(".c_navBar").find(".back").tap(function(){
|
|
11
|
Mobile.back();
|
|
12
|
});
|
|
13
|
});
|
|
14
|
</script>
|
|
@ -1,14 +0,0 @@
|
1
|
|
<script src="res/js/base/require.js"></script>
|
2
|
|
<script src="res/js/require-config.js" ></script>
|
3
|
|
<script src="biz/js/common/require-config.js" ></script>
|
4
|
|
<link rel="stylesheet" type="text/css" href="res/css/base.css"/>
|
5
|
|
<!--注:由于html页面会被加密,不能使用双斜杠作为注释符号-->
|
6
|
|
<script language="javascript">
|
7
|
|
/*自定义增加每个页面需要执行的公共逻辑*/
|
8
|
|
require(["domReady!","mobile","jcl","tap"],function(doc, Mobile, $) {
|
9
|
|
/*每个页面的back样式都需要执行回退*/
|
10
|
|
$(".c_navBar").find(".back").tap(function(){
|
11
|
|
Mobile.back();
|
12
|
|
});
|
13
|
|
});
|
14
|
|
</script>
|
|
@ -0,0 +1,63 @@
|
|
1
|
local Class = require("util.Class")
|
|
2
|
local Tag = require("engine.Tag")
|
|
3
|
local WmDialog = Class(Tag)
|
|
4
|
|
|
5
|
function WmDialog:createNew(obj,htmlbuff)
|
|
6
|
self.htmlbuff=htmlbuff
|
|
7
|
end
|
|
8
|
|
|
9
|
function WmDialog:doStartTag(attr)
|
|
10
|
if not (attr.id and attr.title) then
|
|
11
|
monitor:error("WmDialog组件 id、title属性不能为空 ")
|
|
12
|
return nil
|
|
13
|
end
|
|
14
|
self.attr = attr
|
|
15
|
self.htmlbuff:append('<div class="c_dialog" id="'..attr.id..'">')
|
|
16
|
self.htmlbuff:append('<div class="wrapper">')
|
|
17
|
self.htmlbuff:append('<div class="title">')
|
|
18
|
self.htmlbuff:append('<div class="text">'..attr.title..'</div>')
|
|
19
|
self.htmlbuff:append('<a href="#nogo" class="close"></a>')
|
|
20
|
self.htmlbuff:append('</div>')
|
|
21
|
self.htmlbuff:append('<div class="content">')
|
|
22
|
if attr.contentText then
|
|
23
|
self.htmlbuff:append(attr.contentText)
|
|
24
|
end
|
|
25
|
end
|
|
26
|
|
|
27
|
function WmDialog:doEndTag()
|
|
28
|
local attr = self.attr
|
|
29
|
self.htmlbuff:append('</div>')
|
|
30
|
self.htmlbuff:append([[
|
|
31
|
<div class="submit">
|
|
32
|
<ul>
|
|
33
|
<li><span class="e_button e_button-cancel">取消</span></li>
|
|
34
|
<li><span class="e_button e_button-ok" id="btn">确定</span></li>
|
|
35
|
</ul>
|
|
36
|
</div>]])
|
|
37
|
self.htmlbuff:append('</div></div>')
|
|
38
|
self.htmlbuff:append('')
|
|
39
|
|
|
40
|
self.htmlbuff:append('<script type="text/javascript">')
|
|
41
|
self.htmlbuff:append('require(["wmDialog","wmWebUI"],function(WmDialog,WmWebUI) {')
|
|
42
|
self.htmlbuff:append('var dialog_'..attr.id..' = new WmDialog("'..attr.id..'");')
|
|
43
|
if attr.contentId then
|
|
44
|
self.htmlbuff:append(' dialog_'..attr.id..'.setContent("'..attr.contentId..'","html");')
|
|
45
|
end
|
|
46
|
if attr.cancelAction then
|
|
47
|
self.htmlbuff:append(' dialog_'..attr.id..'.cancelAction(function(){ return '..attr.cancelAction..'.apply(window,arguments);});')
|
|
48
|
end
|
|
49
|
if attr.submitAction then
|
|
50
|
self.htmlbuff:append(' dialog_'..attr.id..'.submitAction(function(){ return '..attr.submitAction..'.apply(window,arguments);});')
|
|
51
|
end
|
|
52
|
if attr.hideAction then
|
|
53
|
self.htmlbuff:append(' dialog_'..attr.id..'.setHideAction(function(){ return '..attr.hideAction..'.apply(window,arguments);});')
|
|
54
|
end
|
|
55
|
if attr.showAction then
|
|
56
|
self.htmlbuff:append(' dialog_'..attr.id..'.setShowAction(function(){ return '..attr.showAction..'.apply(window,arguments);});')
|
|
57
|
end
|
|
58
|
self.htmlbuff:append('WmWebUI.store("'..attr.id..'",dialog_'..attr.id..');')
|
|
59
|
self.htmlbuff:append('})')
|
|
60
|
self.htmlbuff:append('</script>')
|
|
61
|
end
|
|
62
|
|
|
63
|
return WmDialog
|
|
@ -0,0 +1,107 @@
|
|
1
|
local Class = require("util.Class")
|
|
2
|
local Tag = require("engine.Tag")
|
|
3
|
local WmDialog2 = Class(Tag)
|
|
4
|
|
|
5
|
function WmDialog2:createNew(obj,htmlbuff)
|
|
6
|
self.htmlbuff=htmlbuff
|
|
7
|
end
|
|
8
|
|
|
9
|
function WmDialog2:doStartTag(attr)
|
|
10
|
if not (attr.id and attr.title) then
|
|
11
|
monitor:error("WmDialog2组件 id、title属性不能为空 ")
|
|
12
|
return nil
|
|
13
|
end
|
|
14
|
|
|
15
|
self.attr = attr
|
|
16
|
self.htmlbuff:append('<div class="s-dialog s-dialog-slip" id="'..attr.id..'">')
|
|
17
|
self.htmlbuff:append('<div class="s-dialog-content">')
|
|
18
|
self.htmlbuff:append('<h3 class="s-dialog-title">'..attr.title..'</h3>')
|
|
19
|
self.htmlbuff:append('<div class="s-dialog-mainview">')
|
|
20
|
--this is the content area
|
|
21
|
|
|
22
|
|
|
23
|
end
|
|
24
|
|
|
25
|
function WmDialog2:doEndTag()
|
|
26
|
local attr = self.attr
|
|
27
|
|
|
28
|
self.htmlbuff:append('</div>')
|
|
29
|
|
|
30
|
self.htmlbuff:append('<div class="s-dialog-buttons">')
|
|
31
|
|
|
32
|
local n_action = nil
|
|
33
|
local p_action = nil
|
|
34
|
local p_closeDialg = 'true'
|
|
35
|
if (not attr.negativeAction) and (not attr.positiveAction) then
|
|
36
|
self.htmlbuff:append('<button class="s-dialog-cancle">确定</button>')
|
|
37
|
else
|
|
38
|
if attr.negativeAction then
|
|
39
|
local negative = string.split(attr.negativeAction,",")
|
|
40
|
local n_text = negative[1]
|
|
41
|
n_action = negative[2]
|
|
42
|
|
|
43
|
if n_text then
|
|
44
|
self.htmlbuff:append('<button class="s-dialog-cancle">'..n_text..'</button>')
|
|
45
|
end
|
|
46
|
end
|
|
47
|
|
|
48
|
if attr.positiveAction then
|
|
49
|
local positive = string.split(attr.positiveAction,",")
|
|
50
|
local p_text = positive[1]
|
|
51
|
p_action = positive[2]
|
|
52
|
|
|
53
|
if positive[3] then
|
|
54
|
p_closeDialg = positive[3]
|
|
55
|
end
|
|
56
|
|
|
57
|
if p_text then
|
|
58
|
self.htmlbuff:append('<button class="s-dialog-ok">'..p_text..'</button>')
|
|
59
|
end
|
|
60
|
end
|
|
61
|
|
|
62
|
|
|
63
|
end
|
|
64
|
|
|
65
|
self.htmlbuff:append('</div>')
|
|
66
|
|
|
67
|
self.htmlbuff:append('</div>')
|
|
68
|
self.htmlbuff:append('</div>')
|
|
69
|
|
|
70
|
|
|
71
|
self.htmlbuff:append('<script type="text/javascript">')
|
|
72
|
self.htmlbuff:append('require(["wmDialog2","wmWebUI"],function(WmDialog2,WmWebUI) {')
|
|
73
|
self.htmlbuff:append('var dialog_'..attr.id..' = new WmDialog2("'..attr.id..'");')
|
|
74
|
|
|
75
|
if n_action then
|
|
76
|
self.htmlbuff:append('dialog_'..attr.id..'.setNegativeAction('..n_action..',true);')
|
|
77
|
end
|
|
78
|
|
|
79
|
if p_action then
|
|
80
|
self.htmlbuff:append('dialog_'..attr.id..'.setPositiveAction('..p_action..','..p_closeDialg..');')
|
|
81
|
end
|
|
82
|
|
|
83
|
if attr.contentview then
|
|
84
|
local contentView = string.split(attr.contentview,",")
|
|
85
|
local id = contentView[1]
|
|
86
|
local type = contentView[2]
|
|
87
|
|
|
88
|
self.htmlbuff:append('dialog_'..attr.id..'.setContentView("'..id..'","'..type..'");')
|
|
89
|
end
|
|
90
|
|
|
91
|
self.htmlbuff:append('WmWebUI.store("'..attr.id..'",dialog_'..attr.id..');')
|
|
92
|
self.htmlbuff:append('})')
|
|
93
|
self.htmlbuff:append('</script>')
|
|
94
|
end
|
|
95
|
|
|
96
|
function string.split(str, delimiter)
|
|
97
|
if str==nil or str=='' or delimiter==nil then
|
|
98
|
return nil
|
|
99
|
end
|
|
100
|
local result = {}
|
|
101
|
for match in (str..delimiter):gmatch("(.-)"..delimiter) do
|
|
102
|
table.insert(result, match)
|
|
103
|
end
|
|
104
|
return result
|
|
105
|
end
|
|
106
|
|
|
107
|
return WmDialog2
|
|
@ -0,0 +1,132 @@
|
|
1
|
local Class = require("util.Class")
|
|
2
|
local Tag = require("engine.Tag")
|
|
3
|
local WmDropmenu = Class(Tag)
|
|
4
|
|
|
5
|
--htmlbuff
|
|
6
|
function WmDropmenu:createNew(obj,htmlbuff)
|
|
7
|
self.htmlbuff = htmlbuff
|
|
8
|
self.actions = {}
|
|
9
|
end
|
|
10
|
|
|
11
|
--attr所有属性
|
|
12
|
function WmDropmenu:doStartTag(attr)
|
|
13
|
--属性初始化
|
|
14
|
attr.closeAction = attr.closeAction
|
|
15
|
attr.openAction = attr.oppenAction
|
|
16
|
self.attr = attr
|
|
17
|
self.htmlbuff:append('<div id="')
|
|
18
|
self.htmlbuff:append(attr.id)
|
|
19
|
self.htmlbuff:append('">','\n')
|
|
20
|
self.htmlbuff:append([[
|
|
21
|
<div class="fn">
|
|
22
|
<span class="e_button"><span>]])
|
|
23
|
self.htmlbuff:append(attr.label)
|
|
24
|
self.htmlbuff:append([[</span><span class="e_ico-unfold"></span></span>
|
|
25
|
</div>
|
|
26
|
<div class="c_dropmenu">
|
|
27
|
<ul>
|
|
28
|
]])
|
|
29
|
end
|
|
30
|
|
|
31
|
function WmDropmenu:doEndTag()
|
|
32
|
self.htmlbuff:append([[
|
|
33
|
</ul>
|
|
34
|
</div>
|
|
35
|
</div>
|
|
36
|
]])
|
|
37
|
|
|
38
|
self.htmlbuff:append([[
|
|
39
|
<script type="text/javascript">
|
|
40
|
require(["wmDropmenu"],function(WmDropmenu) {
|
|
41
|
var wmDropmenu=new WmDropmenu("]])
|
|
42
|
self.htmlbuff:append(self.attr.id)
|
|
43
|
self.htmlbuff:append('");','\n')
|
|
44
|
self.htmlbuff:append([[
|
|
45
|
wmDropmenu.create();
|
|
46
|
]])
|
|
47
|
|
|
48
|
if self.attr.openAction then
|
|
49
|
self.htmlbuff:append([[
|
|
50
|
wmDropmenu.setOpenAction(function(){
|
|
51
|
]])
|
|
52
|
self.htmlbuff:append(self.attr.openAction,'\n')
|
|
53
|
self.htmlbuff:append('});','\n')
|
|
54
|
end
|
|
55
|
if self.attr.closeAction then
|
|
56
|
self.htmlbuff:append([[
|
|
57
|
wmDropmenu.setCloseAction(function(){
|
|
58
|
]])
|
|
59
|
self.htmlbuff:append(self.attr.closeAction,'\n')
|
|
60
|
self.htmlbuff:append('});','\n')
|
|
61
|
end
|
|
62
|
|
|
63
|
self.htmlbuff:append(' var items = wmDropmenu.getDropmenuItems();','\n')
|
|
64
|
for k,v in pairs(self.actions) do
|
|
65
|
if v~=-1 then
|
|
66
|
self.htmlbuff:append('items[')
|
|
67
|
self.htmlbuff:append(k-1)
|
|
68
|
self.htmlbuff:append('].setAction(function(){')
|
|
69
|
self.htmlbuff:append(v)
|
|
70
|
self.htmlbuff:append('});','\n')
|
|
71
|
end
|
|
72
|
end
|
|
73
|
self.htmlbuff:append([[
|
|
74
|
});
|
|
75
|
</script>
|
|
76
|
]])
|
|
77
|
end
|
|
78
|
|
|
79
|
function WmDropmenu:addActions(action)
|
|
80
|
table.insert(self.actions, action)
|
|
81
|
end
|
|
82
|
|
|
83
|
return WmDropmenu
|
|
84
|
|
|
85
|
--[[
|
|
86
|
require(["wmDropmenu","util"],function(WmDropmenu) {
|
|
87
|
var wmDropmenu=new WmDropmenu(dropmenu01);
|
|
88
|
wmDropmenu.create();
|
|
89
|
wmDropmenu.setLabel("下拉菜单01");
|
|
90
|
wmDropmenu.setCloseAction(function(){
|
|
91
|
console.log("closeAction");
|
|
92
|
});
|
|
93
|
wmDropmenu.setOpenAction(function(){
|
|
94
|
console.log("openAction");
|
|
95
|
console.log(wmDropmenu.getLabel());
|
|
96
|
});
|
|
97
|
var items=wmDropmenu.getItems();
|
|
98
|
for(var i=0;i<items.length;i++){
|
|
99
|
console.log("index:"+items[i].getIndex());
|
|
100
|
console.log("parent:"+items[i].getParent());
|
|
101
|
items[i].setAction(function(obj){
|
|
102
|
alert(obj.html());
|
|
103
|
});
|
|
104
|
}
|
|
105
|
console.log("length:"+items.length);
|
|
106
|
items[2].remove();
|
|
107
|
console.log("length:"+items.length);
|
|
108
|
for(var i=0;i<items.length;i++){
|
|
109
|
//alert(items[i].html());
|
|
110
|
}
|
|
111
|
//wmDropmenu.removeAll();
|
|
112
|
var item1=wmDropmenu.push("111");
|
|
113
|
item1.setAction(function(obj){
|
|
114
|
alert("我是新来的1");
|
|
115
|
});
|
|
116
|
var item2=wmDropmenu.push("22222");
|
|
117
|
item2.setAction(function(obj){
|
|
118
|
alert("我是新来的2");
|
|
119
|
});
|
|
120
|
item1.remove();
|
|
121
|
//wmDropmenu.getItems()[0].remove();
|
|
122
|
$("#testbtn").setAction(function(){
|
|
123
|
if(wmDropmenu.Invisible()){
|
|
124
|
wmDropmenu.show();
|
|
125
|
}else{
|
|
126
|
wmDropmenu.hidden();
|
|
127
|
}
|
|
128
|
});
|
|
129
|
});
|
|
130
|
|
|
131
|
]]
|
|
132
|
|
|
@ -0,0 +1,19 @@
|
|
1
|
local Class = require("util.Class")
|
|
2
|
local Tag = require("engine.Tag")
|
|
3
|
local WmDropmenuItem = Class(Tag)
|
|
4
|
|
|
5
|
function WmDropmenuItem:createNew(obj,htmlbuff)
|
|
6
|
self.htmlbuff = htmlbuff
|
|
7
|
end
|
|
8
|
|
|
9
|
function WmDropmenuItem:doStartTag(attr)
|
|
10
|
self.parent:addActions(attr.action or -1);
|
|
11
|
self.htmlbuff:append('<li ontap>')
|
|
12
|
|
|
13
|
end
|
|
14
|
|
|
15
|
function WmDropmenuItem:doEndTag()
|
|
16
|
self.htmlbuff:append('</li>');
|
|
17
|
end
|
|
18
|
|
|
19
|
return WmDropmenuItem
|
|
@ -0,0 +1,96 @@
|
|
1
|
local Class = require("util.Class")
|
|
2
|
local Tag = require("engine.Tag")
|
|
3
|
local WmNavBar = Class(Tag)
|
|
4
|
|
|
5
|
function WmNavBar:createNew(obj,htmlbuff)
|
|
6
|
self.htmlbuff=htmlbuff
|
|
7
|
monitor:debug("------------------------")
|
|
8
|
-- monitor:debug("htmlbuff length:"..#self.htmlbuff)
|
|
9
|
self.bottoms = {}
|
|
10
|
end
|
|
11
|
|
|
12
|
function WmNavBar:doStartTag(attr)
|
|
13
|
self.id = attr.id
|
|
14
|
self.bottoms = {}
|
|
15
|
self.htmlbuff:append('<div class="c_navBar" id="'.. self.id ..'">')
|
|
16
|
end
|
|
17
|
|
|
18
|
function WmNavBar:doEndTag()
|
|
19
|
self.htmlbuff:append('</div>')
|
|
20
|
self.htmlbuff:append('<script type="text/javascript">')
|
|
21
|
self.htmlbuff:append('require(["wmNavBar"],function(WmNavBar) {')
|
|
22
|
self.htmlbuff:append('var navbar_'..self.id..' = new WmNavBar("'..self.id..'");')
|
|
23
|
local groupCount = 0
|
|
24
|
for i=1,#self.bottoms do
|
|
25
|
local attr = self.bottoms[i]
|
|
26
|
if attr.action and attr.action~="" then
|
|
27
|
if attr.type == "icon" then
|
|
28
|
local icons = self.Split(attr.icons, ",");
|
|
29
|
local actions = self.Split(attr.action, ",");
|
|
30
|
for i=1,#icons do
|
|
31
|
if icons[i]~="" then
|
|
32
|
self:setAction(icons[i],actions[i])
|
|
33
|
end
|
|
34
|
end
|
|
35
|
elseif attr.type == "tab" then
|
|
36
|
local actions = self.Split(attr.action, ",");
|
|
37
|
for i=1,#actions do
|
|
38
|
self.htmlbuff:append('navbar_'..self.id..'.setTabItemAction('..(i-1)..',function(){ return '..actions[i]..'.apply(window,arguments);});')
|
|
39
|
end
|
|
40
|
elseif attr.type == "tabgroup" then
|
|
41
|
if groupCount==0 then
|
|
42
|
self.htmlbuff:append('navbar_'..self.id..'.initTabGroup();')
|
|
43
|
end
|
|
44
|
local actions = self.Split(attr.action, ",");
|
|
45
|
for i=1,#actions do
|
|
46
|
self.htmlbuff:append('navbar_'..self.id..'.setTabGroupItemAction('..groupCount..','..(i-1)..',function(){ return '..actions[i]..'.apply(window,arguments);});')
|
|
47
|
end
|
|
48
|
groupCount = groupCount+1
|
|
49
|
else
|
|
50
|
self:setAction(attr.type,attr.action)
|
|
51
|
end
|
|
52
|
end
|
|
53
|
end
|
|
54
|
self.htmlbuff:append('WmWebUI.store("'..self.id..'",navbar_'..self.id..');')
|
|
55
|
self.htmlbuff:append('});')
|
|
56
|
self.htmlbuff:append('</script>')
|
|
57
|
end
|
|
58
|
|
|
59
|
function WmNavBar:setAction(type,action)
|
|
60
|
if action and action~="" then
|
|
61
|
action = 'function(){ return '..action..'.apply(window,arguments);}'
|
|
62
|
if type == "back" then
|
|
63
|
self.htmlbuff:append('navbar_'..self.id..'.setBackAction('..action..');')
|
|
64
|
elseif type == "add" then
|
|
65
|
self.htmlbuff:append('navbar_'..self.id..'.setAddAction('..action..');')
|
|
66
|
elseif type == "delete" then
|
|
67
|
self.htmlbuff:append('navbar_'..self.id..'.setDelAction('..action..');')
|
|
68
|
elseif type == "date" then
|
|
69
|
self.htmlbuff:append('navbar_'..self.id..'.setDateAction('..action..');')
|
|
70
|
elseif type == "search" then
|
|
71
|
self.htmlbuff:append('navbar_'..self.id..'.setSearchAction('..action..');')
|
|
72
|
end
|
|
73
|
end
|
|
74
|
end
|
|
75
|
function WmNavBar:addBottom(bottom)
|
|
76
|
table.insert(self.bottoms, bottom)
|
|
77
|
end
|
|
78
|
|
|
79
|
function WmNavBar.Split(szFullString, szSeparator)
|
|
80
|
local nFindStartIndex = 1
|
|
81
|
local nSplitIndex = 1
|
|
82
|
local nSplitArray = {}
|
|
83
|
while true do
|
|
84
|
local nFindLastIndex = string.find(szFullString, szSeparator, nFindStartIndex)
|
|
85
|
if not nFindLastIndex then
|
|
86
|
nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, string.len(szFullString))
|
|
87
|
break
|
|
88
|
end
|
|
89
|
nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, nFindLastIndex - 1)
|
|
90
|
nFindStartIndex = nFindLastIndex + string.len(szSeparator)
|
|
91
|
nSplitIndex = nSplitIndex + 1
|
|
92
|
end
|
|
93
|
return nSplitArray
|
|
94
|
end
|
|
95
|
|
|
96
|
return WmNavBar
|
|
@ -0,0 +1,84 @@
|
|
1
|
local Class = require("util.Class")
|
|
2
|
local Tag = require("engine.Tag")
|
|
3
|
local WmNavBarItem = Class(Tag)
|
|
4
|
|
|
5
|
function WmNavBarItem:createNew(obj,htmlbuff)
|
|
6
|
self.htmlbuff=htmlbuff
|
|
7
|
end
|
|
8
|
|
|
9
|
function WmNavBarItem:doStartTag(attr)
|
|
10
|
if attr.type == "back" then
|
|
11
|
self.htmlbuff:append('<div class="left"><div class="back"><span class="e_ico-back"></span>')
|
|
12
|
if attr.title then
|
|
13
|
self.htmlbuff:append('<span class="text">'..attr.title..'</span>')
|
|
14
|
end
|
|
15
|
self.htmlbuff:append('</div></div>')
|
|
16
|
elseif attr.type == "add" or attr.type == "delete" or attr.type == "date" then
|
|
17
|
if attr.position then
|
|
18
|
self.htmlbuff:append('<div class="'..attr.position..'">')
|
|
19
|
else
|
|
20
|
self.htmlbuff:append('<div class="right">')
|
|
21
|
end
|
|
22
|
self.htmlbuff:append('<button><span class="e_ico-'..attr.type..'"></span>')
|
|
23
|
if attr.text then
|
|
24
|
self.htmlbuff:append(attr.text)
|
|
25
|
end
|
|
26
|
self.htmlbuff:append('</button></div>')
|
|
27
|
elseif attr.type == "title" then
|
|
28
|
self.htmlbuff:append('<div class="center"><div class="title">'..attr.text..'</div></div>')
|
|
29
|
elseif attr.type == "icon" then
|
|
30
|
if attr.position then
|
|
31
|
self.htmlbuff:append('<div class="'..attr.position..'">')
|
|
32
|
else
|
|
33
|
self.htmlbuff:append('<div class="right">')
|
|
34
|
end
|
|
35
|
self.htmlbuff:append('<div class="icon">')
|
|
36
|
local icons = self.parent.Split(attr.icons, ",");
|
|
37
|
for i=1,#icons do
|
|
38
|
if icons[i]~="" then
|
|
39
|
self.htmlbuff:append('<span class="e_ico-'..icons[i]..'"></span>')
|
|
40
|
end
|
|
41
|
end
|
|
42
|
self.htmlbuff:append('</div></div>')
|
|
43
|
elseif attr.type == "tab" then
|
|
44
|
if attr.position then
|
|
45
|
self.htmlbuff:append('<div class="'..attr.position..'">')
|
|
46
|
end
|
|
47
|
self.htmlbuff:append('<div class="tab"><ul>')
|
|
48
|
local items = self.parent.Split(attr.items, ",");
|
|
49
|
for i=1,#items do
|
|
50
|
if i==1 then
|
|
51
|
self.htmlbuff:append('<li class="on">'..items[i]..'</li>')
|
|
52
|
else
|
|
53
|
if items[i]~="" then
|
|
54
|
self.htmlbuff:append('<li>'..items[i]..'</li>')
|
|
55
|
end
|
|
56
|
end
|
|
57
|
end
|
|
58
|
self.htmlbuff:append('</ul></div>')
|
|
59
|
if attr.position then
|
|
60
|
self.htmlbuff:append('</div>')
|
|
61
|
end
|
|
62
|
elseif attr.type == "tabgroup" then
|
|
63
|
self.htmlbuff:append('<div class="'..attr.position..'">')
|
|
64
|
self.htmlbuff:append('<div class="buttonList">')
|
|
65
|
self.htmlbuff:append('<div class="tip">'..attr.text..'<span class="e_ico-unfold"></span></div>')
|
|
66
|
self.htmlbuff:append('<div class="option" style="display:none;"><ul>')
|
|
67
|
local items = self.parent.Split(attr.items, ",");
|
|
68
|
for i=1,#items do
|
|
69
|
if items[i]~="" then
|
|
70
|
self.htmlbuff:append('<li>'..items[i]..'</li>')
|
|
71
|
end
|
|
72
|
end
|
|
73
|
self.htmlbuff:append('</ul></div></div></div>')
|
|
74
|
end
|
|
75
|
|
|
76
|
self.parent:addBottom(attr)
|
|
77
|
|
|
78
|
end
|
|
79
|
|
|
80
|
function WmNavBarItem:doEndTag()
|
|
81
|
|
|
82
|
end
|
|
83
|
|
|
84
|
return WmNavBarItem
|
|
@ -0,0 +1,55 @@
|
|
1
|
local Class = require("util.Class")
|
|
2
|
local Tag = require("engine.Tag")
|
|
3
|
local WmProgress = Class(Tag)
|
|
4
|
|
|
5
|
function WmProgress:createNew(obj,htmlbuff)
|
|
6
|
self.htmlbuff=htmlbuff
|
|
7
|
end
|
|
8
|
|
|
9
|
function WmProgress:doStartTag(attr)
|
|
10
|
|
|
11
|
if not (attr.id and attr.progress) then
|
|
12
|
monitor:error("WmProgress组件 id、progress属性不能为空 ")
|
|
13
|
return nil
|
|
14
|
end
|
|
15
|
|
|
16
|
self.htmlbuff:append('<div class="e_progress" id="'..attr.id..'">')
|
|
17
|
if attr.pastTip then
|
|
18
|
self.htmlbuff:append([[
|
|
19
|
<div class="e_progressUse">
|
|
20
|
<div class="e_progressUseValue"></div>
|
|
21
|
<div class="e_progressUseTip">]]..attr.pastTip..[[</div>
|
|
22
|
</div>
|
|
23
|
]])
|
|
24
|
end
|
|
25
|
self.htmlbuff:append('<div class="e_progressBar"><span></span></div>')
|
|
26
|
if attr.totalTip then
|
|
27
|
self.htmlbuff:append('<div class="e_progressTotal">'..attr.totalTip..'</div>')
|
|
28
|
end
|
|
29
|
if attr.spaceTip then
|
|
30
|
self.htmlbuff:append([[
|
|
31
|
<div class="e_progressSurplus">
|
|
32
|
<div class="e_progressSurplusTip">]]..attr.spaceTip..[[</div>
|
|
33
|
<div class="e_progressSurplusValue"></div>
|
|
34
|
</div>
|
|
35
|
]])
|
|
36
|
end
|
|
37
|
self.htmlbuff:append('</div>\n')
|
|
38
|
|
|
39
|
self.htmlbuff:append('<script type="text/javascript">')
|
|
40
|
self.htmlbuff:append('require(["wmProgress"],function(WmProgress) {')
|
|
41
|
self.htmlbuff:append('var progress_'..attr.id..' = new WmProgress("'..attr.id..'");')
|
|
42
|
self.htmlbuff:append('progress_'..attr.id..'.setProgress("'..attr.progress..'");')
|
|
43
|
if attr.level then
|
|
44
|
self.htmlbuff:append('progress_'..attr.id..'.setLevel("'..attr.level..'");')
|
|
45
|
end
|
|
46
|
self.htmlbuff:append('WmWebUI.store("'..attr.id..'",progress_'..attr.id..');')
|
|
47
|
self.htmlbuff:append('})')
|
|
48
|
self.htmlbuff:append('</script>')
|
|
49
|
end
|
|
50
|
|
|
51
|
function WmProgress:doEndTag()
|
|
52
|
|
|
53
|
end
|
|
54
|
|
|
55
|
return WmProgress
|
|
@ -0,0 +1,65 @@
|
|
1
|
local Class = require("util.Class")
|
|
2
|
local Tag = require("engine.Tag")
|
|
3
|
local WmRefresh = Class(Tag)
|
|
4
|
|
|
5
|
function WmRefresh:createNew(obj,htmlbuff)
|
|
6
|
self.htmlbuff=htmlbuff
|
|
7
|
end
|
|
8
|
|
|
9
|
function WmRefresh:doStartTag(attr)
|
|
10
|
if not (attr.id) then
|
|
11
|
monitor:error("WmRefresh组件 id属性不能为空 ")
|
|
12
|
return nil
|
|
13
|
end
|
|
14
|
|
|
15
|
self.attr = attr
|
|
16
|
self.htmlbuff:append('<div class="c-refresh-container" id="'..attr.id..'">')
|
|
17
|
self.htmlbuff:append('<div id="c-refresh-wrapper" style="height:200px;">')
|
|
18
|
self.htmlbuff:append('<div id="c-refresh-scroller">')
|
|
19
|
self.htmlbuff:append('<div id="pullDown">')
|
|
20
|
self.htmlbuff:append('<span class="pullDownIcon"></span><span class="pullDownLabel">下拉刷新...</span>')
|
|
21
|
self.htmlbuff:append('</div>')
|
|
22
|
self.htmlbuff:append('<div class="c_list">')
|
|
23
|
--this is the content area
|
|
24
|
|
|
25
|
|
|
26
|
end
|
|
27
|
|
|
28
|
function WmRefresh:doEndTag()
|
|
29
|
local attr = self.attr
|
|
30
|
|
|
31
|
self.htmlbuff:append('</div>')
|
|
32
|
|
|
33
|
self.htmlbuff:append('<div id="pullUp">')
|
|
34
|
self.htmlbuff:append('<span class="pullUpIcon"></span><span class="pullUpLabel">上拉加载更多...</span>')
|
|
35
|
self.htmlbuff:append('</div> </div> </div> </div>')
|
|
36
|
|
|
37
|
self.htmlbuff:append('<script type="text/javascript">')
|
|
38
|
self.htmlbuff:append('require([ "wmRefresh","wmWebUI" ], function(WmRefresh,WmWebUI) {')
|
|
39
|
self.htmlbuff:append('var refresh_'..attr.id..' = new WmRefresh("'..attr.id..'");')
|
|
40
|
|
|
41
|
if attr.pullDownAction then
|
|
42
|
self.htmlbuff:append('refresh_'..attr.id..'.setPullDownAction('..attr.pullDownAction..');')
|
|
43
|
end
|
|
44
|
|
|
45
|
if attr.pullUpAction then
|
|
46
|
self.htmlbuff:append('refresh_'..attr.id..'.setPullUpAction('..attr.pullUpAction..');')
|
|
47
|
end
|
|
48
|
|
|
49
|
self.htmlbuff:append('WmWebUI.store("'..attr.id..'",refresh_'..attr.id..');')
|
|
50
|
self.htmlbuff:append('})')
|
|
51
|
self.htmlbuff:append('</script>')
|
|
52
|
end
|
|
53
|
|
|
54
|
function string.split(str, delimiter)
|
|
55
|
if str==nil or str=='' or delimiter==nil then
|
|
56
|
return nil
|
|
57
|
end
|
|
58
|
local result = {}
|
|
59
|
for match in (str..delimiter):gmatch("(.-)"..delimiter) do
|
|
60
|
table.insert(result, match)
|
|
61
|
end
|
|
62
|
return result
|
|
63
|
end
|
|
64
|
|
|
65
|
return WmRefresh
|
|
@ -0,0 +1,59 @@
|
|
1
|
local Class = require("util.Class")
|
|
2
|
local Tag = require("engine.Tag")
|
|
3
|
local WmSegment = Class(Tag)
|
|
4
|
|
|
5
|
function WmSegment:createNew(obj,htmlbuff)
|
|
6
|
self.htmlbuff=htmlbuff
|
|
7
|
end
|
|
8
|
|
|
9
|
function WmSegment:doStartTag(attr)
|
|
10
|
local texts = self.Split(attr.texts, ",")
|
|
11
|
local values = self.Split(attr.values, ",")
|
|
12
|
self.htmlbuff:append('<span class="e_segment" id="'..attr.id..'"><span class="e_segmentWrapper">')
|
|
13
|
for i=1,#texts do
|
|
14
|
self.htmlbuff:append('<span class="e_segmentLi" segValue="'..values[i]..'">'..texts[i]..'</span>')
|
|
15
|
end
|
|
16
|
self.htmlbuff:append('</span></span>\n')
|
|
17
|
self.htmlbuff:append('<input type="hidden" id="'..attr.name..'" name="'..attr.name..'" value="" />')
|
|
18
|
|
|
19
|
|
|
20
|
self.htmlbuff:append('<script type="text/javascript">\n')
|
|
21
|
self.htmlbuff:append('require(["wmSegment"],function(WmSegment) {\n')
|
|
22
|
self.htmlbuff:append('var segment_'..attr.id..' = new WmSegment("'..attr.id..'","'..attr.name..'",false);\n')
|
|
23
|
if attr.selected then
|
|
24
|
self.htmlbuff:append('segment_'..attr.id..'.activeItem("'..attr.selected..'");\n')
|
|
25
|
else
|
|
26
|
self.htmlbuff:append('segment_'..attr.id..'.activeItemIndex(0);\n')
|
|
27
|
end
|
|
28
|
if attr.action then
|
|
29
|
self.htmlbuff:append('segment_'..attr.id..'.setAction(function(){ return '..attr.action..'.apply(window,arguments);})\n')
|
|
30
|
else
|
|
31
|
self.htmlbuff:append('segment_'..attr.id..'.setAction();\n')
|
|
32
|
end
|
|
33
|
self.htmlbuff:append('WmWebUI.store("'..attr.id..'",segment_'..attr.id..');\n')
|
|
34
|
self.htmlbuff:append('})\n')
|
|
35
|
self.htmlbuff:append('</script>')
|
|
36
|
end
|
|
37
|
|
|
38
|
function WmSegment:doEndTag()
|
|
39
|
|
|
40
|
end
|
|
41
|
|
|
42
|
function WmSegment.Split(szFullString, szSeparator)
|
|
43
|
local nFindStartIndex = 1
|
|
44
|
local nSplitIndex = 1
|
|
45
|
local nSplitArray = {}
|
|
46
|
while true do
|
|
47
|
local nFindLastIndex = string.find(szFullString, szSeparator, nFindStartIndex)
|
|
48
|
if not nFindLastIndex then
|
|
49
|
nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, string.len(szFullString))
|
|
50
|
break
|
|
51
|
end
|
|
52
|
nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, nFindLastIndex - 1)
|
|
53
|
nFindStartIndex = nFindLastIndex + string.len(szSeparator)
|
|
54
|
nSplitIndex = nSplitIndex + 1
|
|
55
|
end
|
|
56
|
return nSplitArray
|
|
57
|
end
|
|
58
|
|
|
59
|
return WmSegment
|
|
@ -0,0 +1,54 @@
|
|
1
|
local Class = require("util.Class")
|
|
2
|
local Tag = require("engine.Tag")
|
|
3
|
local WmToolTip = Class(Tag)
|
|
4
|
|
|
5
|
function WmToolTip:createNew(obj,htmlbuff)
|
|
6
|
self.htmlbuff=htmlbuff
|
|
7
|
end
|
|
8
|
|
|
9
|
|
|
10
|
function WmToolTip:doStartTag(attr)
|
|
11
|
self.id = attr.id
|
|
12
|
local align = ""
|
|
13
|
if attr.align=="right" then
|
|
14
|
align = "c_toolTip-arrowRight"
|
|
15
|
elseif attr.align=="left" then
|
|
16
|
align = "c_toolTip-arrowLeft"
|
|
17
|
end
|
|
18
|
local position = ""
|
|
19
|
if attr.position=="up" then
|
|
20
|
position = "c_toolTip-positionBottom"
|
|
21
|
end
|
|
22
|
self.htmlbuff:append('<div class="c_toolTip '..align..' '..position..'" id="'.. self.id ..'" >')
|
|
23
|
self.htmlbuff:append('<div class="pointer"></div>')
|
|
24
|
self.htmlbuff:append('<div class="content" >')
|
|
25
|
self.htmlbuff:append('<div class="ico"><span class="e_ico-swipe"></span></div>')
|
|
26
|
local textAlign = ""
|
|
27
|
if attr.textAlign == "center" then
|
|
28
|
textAlign = "e_center"
|
|
29
|
end
|
|
30
|
self.htmlbuff:append('<div class="detail '..textAlign..'">'..attr.text..'</div>')
|
|
31
|
if attr.buttonText then
|
|
32
|
self.htmlbuff:append('<div class="submit"><span class="e_button">'..attr.buttonText..'</span></div>')
|
|
33
|
end
|
|
34
|
self.htmlbuff:append('</div></div>')
|
|
35
|
self.htmlbuff:append('<script type="text/javascript">')
|
|
36
|
self.htmlbuff:append('require(["wmToolTip","wmWebUI"],function(WmToolTip,WmWebUI) {')
|
|
37
|
self.htmlbuff:append('var tooltip_'..self.id..' = new WmToolTip("'..self.id..'");')
|
|
38
|
if attr.action then
|
|
39
|
self.htmlbuff:append('tooltip_'..self.id..'.setCloseAction(function(){ return '..attr.action..'.apply(window,arguments);});')
|
|
40
|
else
|
|
41
|
self.htmlbuff:append('tooltip_'..self.id..'.setCloseAction();')
|
|
42
|
end
|
|
43
|
self.htmlbuff:append('tooltip_'..self.id..'.setBaseElement("'..attr.baseId..'");')
|
|
44
|
self.htmlbuff:append('tooltip_'..self.id..'.show();')
|
|
45
|
self.htmlbuff:append('WmWebUI.store("'..attr.id..'",tooltip_'..attr.id..');')
|
|
46
|
self.htmlbuff:append('})')
|
|
47
|
self.htmlbuff:append('</script>')
|
|
48
|
end
|
|
49
|
|
|
50
|
function WmToolTip:doEndTag()
|
|
51
|
|
|
52
|
end
|
|
53
|
|
|
54
|
return WmToolTip
|
|
@ -1,18 +0,0 @@
|
1
|
|
<!DOCTYPE html>
|
2
|
|
<html>
|
3
|
|
<head>
|
4
|
|
<meta charset="utf-8">
|
5
|
|
<meta name="viewport"
|
6
|
|
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
7
|
|
<!--1,引入CSS文件 -->
|
8
|
|
{%>template/common/Head.html%}
|
9
|
|
<script type="text/javascript" src="biz/js/VerifyCodeImage.js"></script>
|
10
|
|
<title>验证码图片demo</title>
|
11
|
|
</head>
|
12
|
|
<body>
|
13
|
|
<div>
|
14
|
|
<img id="verifyIMG" alt="点击更换验证码"
|
15
|
|
src="data:image/png;base64, {%VERIFY_IMG%}">
|
16
|
|
</div>
|
17
|
|
</body>
|
18
|
|
</html>
|
|
@ -7,7 +7,7 @@ import android.os.Bundle;
|
7
|
7
|
import android.os.Handler;
|
8
|
8
|
|
9
|
9
|
import com.wade.mobile.common.keyboard.KeyboardConstants;
|
10
|
|
import com.wade.mobile.common.keyboard.keyboardActivity;
|
|
10
|
import com.wade.mobile.common.keyboard.KeyboardActivity;
|
11
|
11
|
import com.wade.mobile.frame.IWadeMobile;
|
12
|
12
|
import com.wade.mobile.frame.plugin.Plugin;
|
13
|
13
|
import com.wade.mobile.util.EscapeUnescape;
|
|
@ -25,7 +25,7 @@ public class MobileKeyboard extends Plugin {
|
25
|
25
|
functionName = param.getString(0);
|
26
|
26
|
KeyboardConstants.handler = handler;
|
27
|
27
|
|
28
|
|
Intent intent = new Intent(context, keyboardActivity.class);
|
|
28
|
Intent intent = new Intent(context, KeyboardActivity.class);
|
29
|
29
|
startActivityForResult(intent, KEYBORAD);
|
30
|
30
|
}
|
31
|
31
|
|
|
@ -201,9 +201,7 @@ public class MobileNetWork extends Plugin {
|
201
|
201
|
|
202
|
202
|
private String requestBizData(String dataAction, IData param) throws Exception {
|
203
|
203
|
Map<String,String> postData = transPostData(dataAction, param);
|
204
|
|
String encode = MobileConfig.getInstance().getEncode();
|
205
|
|
String dataUrl = HttpTool.toQueryString(postData);
|
206
|
|
dataUrl = HttpTool.urlEncode(dataUrl, encode);
|
|
204
|
String dataUrl = HttpTool.toQueryStringWithEncode(postData);
|
207
|
205
|
String result = HttpTool.httpRequest(MobileConfig.getInstance().getRequestUrl(),
|
208
|
206
|
dataUrl, Constant.HTTP_POST);
|
209
|
207
|
if (ServerDataConfig.isEncrypt(dataAction)) {
|
|
@ -220,12 +218,10 @@ public class MobileNetWork extends Plugin {
|
220
|
218
|
MobileSecurity.init(context);
|
221
|
219
|
/* 参数加密处理 */
|
222
|
220
|
String key = MobileSecurity.getDesKey();
|
223
|
|
key = key.replace("+", "-");//将+号全部转换成-号
|
224
|
221
|
postData.put(Constant.Server.KEY, key);
|
225
|
222
|
|
226
|
223
|
if(dataParam!=null){
|
227
|
224
|
String encryptData = MobileSecurity.requestEncrypt(dataParam.toString());
|
228
|
|
encryptData = encryptData.replace("+", "-");
|
229
|
225
|
postData.put(Constant.Server.DATA, encryptData);
|
230
|
226
|
}
|
231
|
227
|
} else {
|