Browse Source

add WmDialog2 and WmRefresh tag

wangxl 9 years ago
parent
commit
ed0cb35f18

+ 3 - 1
display-server/etc/lua/defineTagConfig.lua

@ -13,5 +13,7 @@ return{
13 13
  ["wm-slider"] = "tag.WmSlider",
14 14
  ["wm-slider-item"] = "tag.WmSliderItem",
15 15
  ["wm-dropmenu"] = "tag.WmDropmenu",
16
  ["wm-dropmenu-item"] = "tag.WmDropmenuItem"
16
  ["wm-dropmenu-item"] = "tag.WmDropmenuItem",
17
  ["wm-dialog2"] = "tag.WmDialog2",
18
  ["wm-refresh"] = "tag.WmRefresh"
17 19
}

+ 107 - 0
display-server/etc/lua/tag/WmDialog2.lua

@ -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

+ 65 - 0
display-server/etc/lua/tag/WmRefresh.lua

@ -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

+ 6 - 0
display-server/etc/server-page.xml

@ -75,4 +75,10 @@
75 75
    <action name="IChartBar2d01" template="template/webapp/chart/ichart/IChartBar2d01.html"></action>
76 76
    <action name="IChartColumn3d01" template="template/webapp/chart/ichart/IChartColumn3d01.html"></action>
77 77
    <action name="IChartPie2d01" template="template/webapp/chart/ichart/IChartPie2d01.html"></action>
78
    
79
    <action name="WmDialog2Src" template="template/webapp/tag/WmDialog2Src.html"></action>
80
    <action name="WmDialog2" template="template/webapp/tag/WmDialog2.html"></action>
81
    
82
    <action name="WmRefreshSrc" template="template/webapp/tag/WmRefreshSrc.html"></action>
83
    <action name="WmRefresh" template="template/webapp/tag/WmRefresh.html"></action>
78 84
</pages>

+ 174 - 1
display-server/web/res/css/base.css

@ -921,4 +921,177 @@ input[type="checkbox"]:checked { opacity:1; }
921 921
.l_page-current-2 { left:-100%;}
922 922
.l_page-current-3 { left:-200%;}
923 923
.l_page-current-4 { left:-400%;}
924
.l_page-current-5 { left:-500%;}
924
.l_page-current-5 { left:-500%;}
925

926
/* custome dialog */
927
.s-dialog {
928
	position: fixed;
929
	top: 50%;
930
	left: 50%;
931
	width: 80%;
932
	min-width: 320px;
933
	height: auto;
934
	z-index: 2000;
935
	visibility: hidden;
936
	-webkit-backface-visibility: hidden;
937
	-moz-backface-visibility: hidden;
938
	backface-visibility: hidden;
939
	-webkit-transform: translateX(-50%) translateY(-50%);
940
	-moz-transform: translateX(-50%) translateY(-50%);
941
	-ms-transform: translateX(-50%) translateY(-50%);
942
	transform: translateX(-50%) translateY(-50%);
943
}
944

945
.s-dialog-show {
946
	visibility: visible;
947
}
948

949
.s-dialog-content {
950
	color: #fff;
951
	background: #0085d0;
952
	position: relative;
953
	border-radius: 3px;
954
	margin: 0 auto;
955
}
956

957
.s-dialog-content h3 {
958
	margin: 0;
959
	padding: 0.4em;
960
	text-align: center;
961
	font-size: 2.4em;
962
	font-weight: 300;
963
	opacity: 0.8;
964
	background: rgba(0,0,0,0.1);
965
	border-radius: 3px 3px 0 0;
966
}
967

968
.s-dialog-content > div {
969
	padding: 15px 40px 30px;
970
	margin: 0;
971
	font-weight: 300;
972
	font-size: 1.15em;
973
}
974

975
.s-dialog .s-dialog-mainview{
976
	min-height: 1.15rem;
977
}
978

979
.s-dialog-content > .s-dialog-buttons{
980
	text-align: center;
981
	margin:0 auto;
982
}
983

984
.s-dialog-buttons button {
985
	border: none;
986
	padding: 3% 3%;
987
	background: #0085ff;
988
	color: #fff;
989
	letter-spacing: 1px;
990
	cursor: pointer;
991
	border-radius: 2px;
992
	display: inline-block;
993
	margin: 0 0.05rem;
994
	font-size: 0.8em;
995
	box-shadow: 7px 7px 5px #216AAD;
996
	width:45%;
997
}
998

999
.s-dialog-buttons button:hover {
1000
	background: #216AAD;
1001
}
1002

1003
.s-dialog-buttons .s-dialog-ok{
1004
	background: #92E818;
1005
	box-shadow: 7px 7px 5px #78C30D;
1006
}
1007
.s-dialog-buttons .s-dialog-ok:hover{
1008
	background: #78C30D;
1009
}
1010

1011
.s-dialog-slip .s-dialog-content {
1012
	-webkit-transform: translateY(20%);
1013
	-moz-transform: translateY(20%);
1014
	-ms-transform: translateY(20%);
1015
	transform: translateY(20%);
1016
	
1017
	opacity: 0;
1018
	-webkit-transition: all 0.3s;
1019
	-moz-transition: all 0.3s;
1020
	transition: all 0.3s;
1021
}
1022

1023
.s-dialog-show.s-dialog-slip .s-dialog-content {				
1024
	-webkit-transform: translateY(0);
1025
	-moz-transform: translateY(0);
1026
	-ms-transform: translateY(0);
1027
	transform: translateY(0);
1028
	
1029
	opacity: 1;
1030
}
1031

1032
/*8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
1033
8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
1034
8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
1035
8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
1036
8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888*/
1037

1038
.c-refresh-container { position:absolute !important; top:0.62rem; bottom:0px; width:100%;}
1039

1040
[id*="c-refresh-wrapper"] { position:relative; overflow:auto;}
1041
.m_wrapper { height:100%; overflow:auto; position:relative;}
1042

1043

1044
/*下拉刷新*/
1045
#pullDown, #pullUp {
1046
	background:#fff;
1047
	height:2.22em;
1048
	line-height:2.22em;
1049
	padding:0.28em 0.56em;
1050
	border-bottom:1px solid #ccc;
1051
	font-weight:bold;
1052
	color:#888;
1053
}
1054
#pullDown .pullDownIcon, #pullUp .pullUpIcon  {
1055
	display:block; float:left;
1056
	width:2.22em; height:2.22em;
1057
	background:url(../img/pull.png) 0 0 no-repeat;
1058
	-webkit-background-size:100% 100%; background-size:100% 100%;
1059
	-webkit-transition-property:-webkit-transform;
1060
	-webkit-transition-duration:250ms;	
1061
}
1062
#pullDown .pullDownIcon {
1063
	-webkit-transform:rotate(0deg) translateZ(0);
1064
}
1065
#pullUp .pullUpIcon  {
1066
	-webkit-transform:rotate(-180deg) translateZ(0);
1067
}
1068

1069
#pullDown.flip .pullDownIcon {
1070
	-webkit-transform:rotate(-180deg) translateZ(0);
1071
}
1072

1073
#pullUp.flip .pullUpIcon {
1074
	-webkit-transform:rotate(0deg) translateZ(0);
1075
}
1076

1077
#pullDown.loading .pullDownIcon, #pullUp.loading .pullUpIcon {
1078
	background-image:url(../img/pullLoading.png);
1079
	-webkit-transform:rotate(0deg) translateZ(0);
1080
	-webkit-transition-duration:0ms;
1081

1082
	-webkit-animation-name:loading;
1083
	-webkit-animation-duration:2s;
1084
	-webkit-animation-iteration-count:infinite;
1085
	-webkit-animation-timing-function:linear;
1086
}
1087
@-webkit-keyframes loading {
1088
	from { -webkit-transform:rotate(0deg) translateZ(0); }
1089
	to { -webkit-transform:rotate(360deg) translateZ(0); }
1090
}
1091

1092

1093

1094

1095

1096

1097


BIN
display-server/web/res/img/pull.png


BIN
display-server/web/res/img/pullLoading.png


+ 3 - 1
display-server/web/res/js/require-config.js

@ -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: [],

+ 80 - 0
display-server/web/res/js/ui/wm-dialog2.js

@ -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
});

+ 115 - 1
display-server/web/res/js/ui/wm-refresh.js

@ -1,3 +1,117 @@
1
define(["jcl","iScroll","wmWebUI"], function($,iScrol,WmWebUI){
1
define(["iScroll"], function(iScroll){
2 2
	
3
	function WmRefresh(id){
4
		this.id = id;
5
		this.pullDownAction = null;
6
		this.pullUpAction = null;
7
		this.init();
8
		
9
	}
10
	
11
	/**
12
	* 下拉刷新 (自定义实现此方法)
13
	* myScroll.refresh();		// 数据加载完成后,调用界面更新方法
14
	*/
15
	
16
	WmRefresh.prototype.setPullDownAction = function(action){
17
		if(typeof(action) == "function") {
18
			this.pullDownAction = action;
19
		}
20
		
21
	}
22
	
23
	/**
24
	* 滚动翻页 (自定义实现此方法)
25
	* myScroll.refresh();		// 数据加载完成后,调用界面更新方法
26
	*/
27
	
28
	WmRefresh.prototype.setPullUpAction = function(action){
29
		if(typeof(action) == "function") {
30
			this.pullUpAction = action;
31
		}
32
	}
33

34
	/**
35
	* 初始化iScroll控件
36
	*/
37
	WmRefresh.prototype.init = function() { 
38
		var pullDownEl, pullDownOffset,
39
		pullUpEl, pullUpOffset;
40
		var that = this;
41
		var maxHeight = document.getElementById(that.id).offsetHeight + "px";
42
		document.getElementById("c-refresh-wrapper").style.height = maxHeight;
43
		pullDownEl = document.getElementById('pullDown');
44
		pullDownOffset = pullDownEl.offsetHeight;
45
		pullUpEl = document.getElementById('pullUp');	
46
		pullUpOffset = pullUpEl.offsetHeight;
47
		var myScroll = new iScroll('c-refresh-wrapper', {
48
		//	scrollbarClass: 'myScrollbar', /* 重要样式 */
49
			useTransition: true, /* 此属性不知用意,本人从true改为false */
50
			topOffset: pullDownOffset,
51
			onRefresh: function () {
52
				console.log(this.maxScrollY);
53
				if (pullDownEl.className.match('loading')) {
54
					pullDownEl.className = '';
55
					pullDownEl.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
56
				} else if (pullUpEl.className.match('loading')) {
57
					pullUpEl.className = '';
58
					pullUpEl.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
59
				}
60
			},
61
			onScrollMove: function () {
62
				if (this.y > 5 && !pullDownEl.className.match('flip')) {
63
					pullDownEl.className = 'flip';
64
					pullDownEl.querySelector('.pullDownLabel').innerHTML = '松手开始更新...';
65
					this.minScrollY = 0;
66
				} else if (this.y < 5 && pullDownEl.className.match('flip')) {
67
					pullDownEl.className = '';
68
					pullDownEl.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
69
					this.minScrollY = -pullDownOffset;
70
				} else{
71
					var c_height = document.getElementById("c-refresh-wrapper").offsetHeight;
72
					var s_height = document.getElementById("c-refresh-scroller").offsetHeight;
73
					var distance;
74
					if (c_height > s_height) {
75
						distance = - (1.5 * pullUpOffset);
76
					}else{
77
						distance = this.maxScrollY - pullUpOffset;
78
					}
79

80
					if (this.y < distance && !pullUpEl.className.match('flip')) {
81
						pullUpEl.className = 'flip';
82
						pullUpEl.querySelector('.pullUpLabel').innerHTML = '松手开始更新...';
83
						this.maxScrollY = this.maxScrollY;
84
					} else if (this.y > distance && pullUpEl.className.match('flip')) {
85
						pullUpEl.className = '';
86
						pullUpEl.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
87
						// this.maxScrollY = pullUpOffset;
88
					}
89
				}
90
			},
91
			onScrollEnd: function () {
92
				if (pullDownEl.className.match('flip')) {
93
					pullDownEl.className = 'loading';
94
					pullDownEl.querySelector('.pullDownLabel').innerHTML = '加载中...';
95
					if(that.pullDownAction){
96
						that.pullDownAction(myScroll);	
97
					}else{
98
						console.log("未定义下拉刷新方法");
99
						myScroll.refresh();	
100
					}
101
					
102
				} else if (pullUpEl.className.match('flip')) {
103
					pullUpEl.className = 'loading';
104
					pullUpEl.querySelector('.pullUpLabel').innerHTML = '加载中...';
105
					if(that.pullUpAction){
106
						that.pullUpAction(myScroll);	
107
					}else{
108
						console.log("未定义上拉加载更多");
109
						myScroll.refresh();	
110
					}
111
				}
112
			}
113
		});
114
	}
115
		
116
	return WmRefresh;
3 117
})

+ 82 - 0
display-server/web/template/webapp/tag/WmDialog2.html

@ -0,0 +1,82 @@
1
<!DOCTYPE HTML>
2
<html class="s_bs">
3
<head>
4
	<meta charset="utf-8" />
5
	<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" />
6
	<title>web UI 组件</title>
7
	{%>template/common/head.html%}
8
</head>
9
<body>
10
11
<div class="c_navBar">
12
	<div class="back">
13
		<span class="e_ico-back"></span>
14
		<div class="text">WmDialog</div>
15
	</div>
16
</div>
17
18
<div class="m_content m_content-nofooter" id="content">
19
	<div class="c_title">弹窗中可以放置任意组件以保证弹窗的多样性</div>
20
	<div class="c_list">
21
		<ul>
22
			<li>
23
				<div class="content">
24
					<div class="main">
25
						<div class="title">进度显示</div>
26
					</div>
27
					<div class="fn fn-2" id="testButton_1">测试</div>
28
				</div>
29
			</li>
30
			<li>
31
				<div class="content">
32
					<div class="main">
33
						<div class="title">待选选项</div>
34
					</div>
35
					<div class="fn fn-2">测试</div>
36
				</div>
37
			</li>
38
			<li>
39
				<div class="content">
40
					<div class="main">
41
						<div class="title">确认对话框</div>
42
					</div>
43
					<div class="fn fn-2">测试</div>
44
				</div>
45
			</li>
46
			<li>
47
				<div class="content">
48
					<div class="main">
49
						<div class="title">数据展示</div>
50
					</div>
51
					<div class="fn fn-2">测试</div>
52
				</div>
53
			</li>
54
		</ul>
55
	</div>
56
</div>
57
<wm-dialog2 id="testDialog" title="弹弹弹" positiveAction="submit,openAction,false" negativeAction="close,closeAction" contentview="outer-div,html">
58
   <div id="outer-div">
59
		I am an outer div;
60
	</div>
61
</wm-dialog2>
62
63
64
</body>
65
<script>
66
	function testSubmitAction() { alert("提交成功!")}
67
	function testCancelAction() { alert("惨了,要被取消了!")}
68
	//设置关闭/打开动作
69
	function closeAction() {
70
		alert("弹出窗口被关闭了");
71
	}
72
	function openAction() {
73
		alert("弹出窗口被打开了");
74
	}
75
	require(['util'], function() {
76
		$("#testButton_1").tap(function(){
77
			var dialog2 = WmWebUI.select("testDialog");
78
			dialog2.show()
79
		});
80
	});
81
</script>
82
</html>

+ 100 - 0
display-server/web/template/webapp/tag/WmDialog2Src.html

@ -0,0 +1,100 @@
1
<!DOCTYPE HTML>
2
<html class="s_bs">
3
<head>
4
<meta charset="utf-8" />
5
<meta name="viewport"
6
	content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" />
7
<title>web UI 组件</title> {%>template/common/Head.html%}
8
</head>
9
<body>
10
11
	<div class="c_navBar">
12
		<div class="back">
13
			<span class="e_ico-back"></span>
14
			<div class="text">WmDialogSrc</div>
15
		</div>
16
	</div>
17
18
	<div class="m_content m_content-nofooter" id="content">
19
		<div class="c_title">弹窗中可以放置任意组件以保证弹窗的多样性</div>
20
		<div class="c_list">
21
			<ul>
22
				<li>
23
					<div class="content">
24
						<div class="main">
25
							<div class="title">进度显示</div>
26
						</div>
27
						<div class="fn fn-2" id="testButton_1">测试</div>
28
					</div>
29
				</li>
30
				<li>
31
					<div class="content">
32
						<div class="main">
33
							<div class="title">待选选项</div>
34
						</div>
35
						<div class="fn fn-2">测试</div>
36
					</div>
37
				</li>
38
				<li>
39
					<div class="content">
40
						<div class="main">
41
							<div class="title">确认对话框</div>
42
						</div>
43
						<div class="fn fn-2">测试</div>
44
					</div>
45
				</li>
46
				<li>
47
					<div class="content">
48
						<div class="main">
49
							<div class="title">数据展示</div>
50
						</div>
51
						<div class="fn fn-2">测试</div>
52
					</div>
53
				</li>
54
			</ul>
55
		</div>
56
	</div>
57
	<div class="s-dialog s-dialog-slip" id="mydialog">
58
		<div class="s-dialog-content">
59
			<h3 class="s-dialog-title">标题</h3>
60
			<div class="s-dialog-mainview">
61
				池塘边的榕树上<br />
62
				知了在声声叫着夏天<br />
63
				操场边的秋千上<br />
64
				只有蝴蝶停在上面<br />
65
				黑板上老师的粉笔<br />
66
				还在拼命叽叽喳喳写个不停<br />
67
				等待着下课<br />
68
				等待着放学<br />
69
				等待游戏的童年
70
			</div>
71
			<div class="s-dialog-buttons">
72
				<button class="s-dialog-cancle">取消</button> 
73
				<button class="s-dialog-ok">确定</button>
74
			</div>
75
		</div>
76
	</div>
77
	
78
	<div id="outer-div">
79
		I am an outer div;
80
	</div>
81
</body>
82
<script>
83
	
84
	require([ "wmDialog2" ], function(WmDialog2) {
85
		var dialog2 = new WmDialog2("mydialog");
86
		var name = 'Shelomi';
87
		dialog2.setTitle(name);
88
		dialog2.setNegativeAction(function (){
89
			alert(name);
90
		},true);
91
		dialog2.setPositiveAction(function (){
92
			alert(name);
93
		},true);
94
		dialog2.setContentView("outer-div","html");
95
		$("#testButton_1").tap(function() {
96
			dialog2.show();
97
		})
98
	});
99
</script>
100
</html>

+ 65 - 0
display-server/web/template/webapp/tag/WmRefresh.html

@ -0,0 +1,65 @@
1
<!DOCTYPE HTML>
2
<html class="s_bs">
3
<head>
4
	<meta charset="utf-8" />
5
	<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" />
6
	<title>web UI 组件</title>
7
	{%>template/common/Head.html%}
8
</head>
9
<body>
10
11
<div class="c_navBar">
12
	<div class="back">
13
		<span class="e_ico-back"></span>
14
		<div class="text">WmRefreshSrc</div>
15
	</div>
16
</div>
17
18
<wm-refresh id="c_refresh" pullDownAction="pullDownAction" pullUpAction="pullUpAction">
19
				
20
	第一行<br/>
21
	第一行<br/>
22
	第一行<br/>
23
	第一行<br/>
24
	第一行<br/>
25
	第一行<br/>
26
	第一行<br/>
27
	第一行<br/>
28
	<ul class="ul" id="thelist"></ul>
29
</wm-refresh>
30
			
31
32
</body>
33
<script>
34
var generatedCount = 0
35
function pullDownAction (scroller) {
36
	setTimeout(function () {	
37
		var el, li, i;
38
		el = document.getElementById('thelist');
39
		for (i=0; i<10; i++) {
40
			li = document.createElement('li');
41
			li.className = "li";
42
			li.innerText = 'Generated row ' + (++generatedCount);
43
			el.insertBefore(li, el.childNodes[0]);
44
		}
45
		scroller.refresh();		
46
	}, 1000);	
47
}
48
49
50
function pullUpAction (scroller) {
51
	setTimeout(function () {	
52
		var el, li, i;
53
		el = document.getElementById('thelist');
54
		for (i=0; i<10; i++) {
55
			li = document.createElement('li');
56
			li.className = "li";
57
			li.innerText = 'Generated row ' + (++generatedCount);
58
			el.appendChild(li, el.childNodes[0]);
59
		}
60
		scroller.refresh();		
61
	}, 1000);	
62
}
63
64
</script>
65
</html>

+ 81 - 0
display-server/web/template/webapp/tag/WmRefreshSrc.html

@ -0,0 +1,81 @@
1
<!DOCTYPE HTML>
2
<html class="s_bs">
3
<head>
4
	<meta charset="utf-8" />
5
	<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" />
6
	<title>web UI 组件</title>
7
	{%>template/common/Head.html%}
8
</head>
9
<body>
10
11
<div class="c_navBar">
12
	<div class="back">
13
		<span class="e_ico-back"></span>
14
		<div class="text">WmRefreshSrc</div>
15
	</div>
16
</div>
17
18
<div class="c-refresh-container" id="c-refresh">
19
	<div id="c-refresh-wrapper" style="height:200px;">
20
		<div id="c-refresh-scroller">
21
			<div id="pullDown">
22
				<span class="pullDownIcon"></span><span class="pullDownLabel">下拉刷新...</span>
23
			</div>
24
			<div class="c_list">
25
				
26
				第一行<br/>
27
				第一行<br/>
28
				第一行<br/>
29
				第一行<br/>
30
				第一行<br/>
31
				第一行<br/>
32
				第一行<br/>
33
				第一行<br/>
34
				<ul class="ul" id="thelist"></ul>
35
			</div>
36
			<div id="pullUp">
37
				<span class="pullUpIcon"></span><span class="pullUpLabel">上拉加载更多...</span>
38
			</div>
39
		</div>
40
	</div>
41
</div>
42
43
</body>
44
<script>
45
var generatedCount = 0
46
function pullDownAction (scroller) {
47
	setTimeout(function () {	
48
		var el, li, i;
49
		el = document.getElementById('thelist');
50
		for (i=0; i<10; i++) {
51
			li = document.createElement('li');
52
			li.className = "li";
53
			li.innerText = 'Generated row ' + (++generatedCount);
54
			el.insertBefore(li, el.childNodes[0]);
55
		}
56
		scroller.refresh();		
57
	}, 1000);	
58
}
59
60
61
function pullUpAction (scroller) {
62
	setTimeout(function () {	
63
		var el, li, i;
64
		el = document.getElementById('thelist');
65
		for (i=0; i<10; i++) {
66
			li = document.createElement('li');
67
			li.className = "li";
68
			li.innerText = 'Generated row ' + (++generatedCount);
69
			el.appendChild(li);
70
		}
71
		scroller.refresh();		
72
	}, 1000);	
73
}
74
	require([ "wmRefresh" ], function(WmRefresh) {
75
		
76
		var refresh = new WmRefresh("c-refresh");
77
		refresh.setPullDownAction(pullDownAction);
78
		refresh.setPullUpAction(pullUpAction);
79
	})
80
</script>
81
</html>

BIN
display_pro.zip