mm
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
-- xx界面
|
||||
local CSPTasks = {}
|
||||
|
||||
---@type Coolape.CLPanelLua
|
||||
local csSelf = nil
|
||||
local transform = nil
|
||||
CSPTasks.sizeAdjust = 1
|
||||
CSPTasks.contentRect = Vector4.zero
|
||||
local uiobjs = {}
|
||||
local headData = {}
|
||||
local dragVal = Vector3.zero
|
||||
local isShowdDragFrefresh = false
|
||||
|
||||
-- 初始化,只会调用一次
|
||||
function CSPTasks.init(csObj)
|
||||
@@ -15,12 +18,16 @@ function CSPTasks.init(csObj)
|
||||
CSPTasks.setEventDelegate()
|
||||
CSPTasks.contentRect = MyUtl.getUIContent(csSelf, 360 + 220)
|
||||
|
||||
---@type UIPanel
|
||||
uiobjs.Content = getCC(transform, "PanelContent", "UIPanel")
|
||||
uiobjs.Content.transform.localPosition = Vector3.zero
|
||||
uiobjs.Content.clipOffset = Vector2.zero
|
||||
uiobjs.Content.baseClipRegion = CSPTasks.contentRect
|
||||
|
||||
uiobjs.TableContent = getCC(uiobjs.Content.transform, "Table", "UITable")
|
||||
---@type UILabel
|
||||
uiobjs.LabelDragRefresh = getCC(uiobjs.TableContent.transform, "LabelDragRefresh", "UILabel")
|
||||
SetActive(uiobjs.LabelDragRefresh.gameObject, false)
|
||||
|
||||
---@type UIGrid
|
||||
local CustManageGrid = getCC(uiobjs.TableContent.transform, "CustManage/grid", "UIGrid")
|
||||
@@ -59,21 +66,32 @@ function CSPTasks.setData(paras)
|
||||
end
|
||||
|
||||
-- 取得头像
|
||||
CSPTasks.refreshData()
|
||||
end
|
||||
|
||||
function CSPTasks.refreshData()
|
||||
NetProto.send.person_view_query()
|
||||
NetProto.send.sales_view_query()
|
||||
if CSPTasks.reportform then
|
||||
CSPTasks.reportform:init({forceRefresh = true}, nil)
|
||||
end
|
||||
end
|
||||
|
||||
-- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh
|
||||
function CSPTasks.show()
|
||||
local list = {}
|
||||
for i = 1, 100 do
|
||||
list[i] = i
|
||||
end
|
||||
-- uiobjs.TableTask:setList(list, nil)
|
||||
|
||||
uiobjs.ToggleOrder:Set(true)
|
||||
CSPTasks.showReportform("reportform2")
|
||||
uiobjs.scrollView:ResetPosition()
|
||||
csSelf:invoke4Lua(
|
||||
function()
|
||||
uiobjs.scrollView:ResetPosition()
|
||||
end,
|
||||
0.1
|
||||
)
|
||||
|
||||
uiobjs.Content.onClipMove = CSPTasks.onClipMove
|
||||
uiobjs.scrollView.onDragStarted = CSPTasks.onDragStart
|
||||
uiobjs.scrollView.onDragFinished = CSPTasks.onDragEnd
|
||||
end
|
||||
|
||||
function CSPTasks.onClickBottonBtn(cell)
|
||||
@@ -94,8 +112,34 @@ function CSPTasks.setHeadInfor()
|
||||
)
|
||||
end
|
||||
|
||||
function CSPTasks.onClipMove(panel)
|
||||
if (not isShowdDragFrefresh) and uiobjs.LabelDragRefresh.isVisible then
|
||||
isShowdDragFrefresh = true
|
||||
dragVal = uiobjs.Content.transform.localPosition
|
||||
end
|
||||
end
|
||||
|
||||
function CSPTasks.onDragStart()
|
||||
uiobjs.LabelDragRefresh.transform.localPosition = Vector3.zero
|
||||
SetActive(uiobjs.LabelDragRefresh.gameObject, true)
|
||||
dragVal = Vector3.zero
|
||||
isShowdDragFrefresh = false
|
||||
end
|
||||
function CSPTasks.onDragEnd()
|
||||
SetActive(uiobjs.LabelDragRefresh.gameObject, false)
|
||||
local offset = uiobjs.Content.transform.localPosition - dragVal
|
||||
if offset.y < -50 then
|
||||
-- 刷数据
|
||||
CSPTasks.refreshData()
|
||||
end
|
||||
if isShowdDragFrefresh then
|
||||
uiobjs.scrollView:ResetPosition()
|
||||
end
|
||||
end
|
||||
|
||||
-- 关闭页面
|
||||
function CSPTasks.hide()
|
||||
csSelf:cancelInvoke4Lua()
|
||||
if CSPTasks.reportform then
|
||||
CLUIOtherObjPool.returnObj(CSPTasks.reportform.gameObject)
|
||||
SetActive(CSPTasks.reportform.gameObject, false)
|
||||
|
||||
Reference in New Issue
Block a user