Quellcode durchsuchen

fix dropmenu can't show on ios device

wangxl vor 9 Jahren
Ursprung
Commit
3b1fbd5ca1

+ 2 - 1
display-server/web/biz/js/tag/WmDropmenu.js

@ -1,5 +1,6 @@
1 1
require(["domReady!","wmWebUI","jcl","mobile"],function(doc,WmWebUI,$,Mobile){
2
	$("#show").on("tap",function(){
2
//	$("#show").on("tap",function(){
3
	$("#show").tap(function(){
3 4
		var dropmenu=WmWebUI.select("dropmenu01");
4 5
		var that = $(this);
5 6
		if(dropmenu.invisible()){

+ 9 - 3
display-server/web/res/js/ui/wm-dropmenu.js

@ -68,8 +68,10 @@ define(["jcl","iScroll","wmWebUI"],function($,iScrol,WmWebUI){
68 68
		//设置 dropmenu
69 69
		//初始化(CSS已将它默认放到了界面之外,以下设置不会造成闪烁)
70 70
		this.menu.children("ul").css("top",(this.menu.height())*(-1) + "px");
71
		this.menu.children("ul").css("transition","transform 0.2s ease-out");
71
		this.menu.children("ul").css("transition","-webkit-transform 0.2s ease-out");
72
		this.menu.children("ul").css("-webkit-transition","transform 0.2s ease-out");
72 73
		this.btn.children(".e_ico-unfold").css("transition","transform 0.2s ease-out");
74
		this.btn.children(".e_ico-unfold").css("-webkit-transition","-webkit-transform 0.2s ease-out");
73 75
		this.menu.css("visibility","hidden");
74 76
		//位置
75 77
		this.menu.css("left",this.btn.offset().left + this.btn.width() - this.menu.width());//靠右要减去这两个 width(),靠左则不需要
@ -81,7 +83,7 @@ define(["jcl","iScroll","wmWebUI"],function($,iScrol,WmWebUI){
81 83
		this.initMenu();
82 84
		var that=this;
83 85
		//显隐
84
		this.btn.click(function(){
86
		this.btn.tap(function(){
85 87
			if(that.invisible()){
86 88
				that.show();
87 89
			}else{
@ -94,14 +96,18 @@ define(["jcl","iScroll","wmWebUI"],function($,iScrol,WmWebUI){
94 96
	};
95 97
	WmDropmenu.prototype.show=function(){
96 98
		this.openAction();
97
		this.menu.css("display","");
99
		this.menu.css("display","block");
98 100
		this.menu.children("ul").css("transform","translateY(" + this.menu.height() + "px)");
101
		this.menu.children("ul").css("-webkit-transform","translateY(" + this.menu.height() + "px)");
99 102
		this.btn.find(".e_ico-unfold").css("transform","rotate(180deg)");
103
		this.btn.find(".e_ico-unfold").css("-webkit-transform","rotate(180deg)");
100 104
	};
101 105
	WmDropmenu.prototype.hidden=function(){
102 106
		this.closeAction();
103 107
		this.menu.children("ul").css("transform","translateY(0)");
108
		this.menu.children("ul").css("-webkit-transform","translateY(0)");
104 109
		this.btn.find(".e_ico-unfold").css("transform","rotate(0)");
110
		this.btn.find(".e_ico-unfold").css("-webkit-transform","rotate(0)");
105 111
		this.menu.css("display","none");
106 112
	};
107 113
	WmDropmenu.prototype.removeAll=function(){

+ 3 - 1
display-server/web/template/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/web/template/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/web/template/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

BIN
display_pro.zip