Files
tianrunCRM/Assets/trCRM/upgradeRes4Dev/priority/lua/ui/panel/TRPSysMsgDetail.lua
2020-08-04 21:58:27 +08:00

84 lines
2.7 KiB
Lua
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---@type IDBasePanel
local TRBasePanel = require("ui.panel.TRBasePanel")
---@class TRPSysMsgDetail:TRBasePanel
local TRPSysMsgDetail = class("TRPSysMsgDetail", TRBasePanel)
local uiobjs = {}
-- 初始化,只会调用一次
function TRPSysMsgDetail:init(csObj)
TRPSysMsgDetail.super.init(self, csObj)
self:setEventDelegate()
self.uiobjs = {}
---@type UIScrollView
self.uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
self.uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
MyUtl.setContentView(self.uiobjs.scrollView, MyUtl.defaultTopHeight + 100 + 56 + 25 + 30 + 45, 0)
self.uiobjs.LabelContent = getCC(self.uiobjs.scrollView.transform, "LabelContent", "UILabel")
self.uiobjs.LabelTitle = getCC(self.transform, "Top/LabelTitle", "UILabel")
self.uiobjs.LabelTime = getCC(self.transform, "Top/LabelTime", "UILabel")
end
-- 设置数据
---@param paras _ParamTRPSysMsgDetail
function TRPSysMsgDetail:setData(paras)
---@type _DBMessage
self.mdata = paras
end
---public 当有通用背板显示时的回调
---@param cs Coolape.CLPanelLua
function TRPSysMsgDetail:onShowFrame(cs)
if cs.frameObj then
---@type _BGFrame1Param
local d = {}
-- d.title = LGet(cs.titleKeyName)
d.title = self.mdata.PanelTitle or "公告详情"
d.panel = cs
cs.frameObj:init(d)
end
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPSysMsgDetail:show()
self.uiobjs.LabelContent.text = joinStr(" ", self.mdata.CONTENT)
self.uiobjs.LabelTime.text = self.mdata.CREATETIME and DateEx.formatByMs(tonumber(self.mdata.CREATETIME) * 1000) or ""
self.uiobjs.LabelTitle.text = self.mdata.TITLE
self.uiobjs.scrollView:ResetPosition()
end
-- 刷新
function TRPSysMsgDetail:refresh()
end
-- 关闭页面
function TRPSysMsgDetail:hide()
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPSysMsgDetail:procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
--[[
if cmd == xx then
end
]]
end
end
function TRPSysMsgDetail:setEventDelegate()
self.EventDelegate = {}
end
-- 处理ui上的事件例如点击等
function TRPSysMsgDetail:uiEventDelegate(go)
local func = self.EventDelegate[go.name]
if func then
func()
end
end
-- 当顶层页面发生变化时回调
function TRPSysMsgDetail:onTopPanelChange(topPanel)
end
--------------------------------------------
return TRPSysMsgDetail