【公告】打开公告前获取公告信息

dev_chengFeng
ZhangBiao 2020-11-17 10:44:55 +08:00
parent 383f20aa32
commit d433d2a690
2 changed files with 38 additions and 27 deletions

View File

@ -22,6 +22,9 @@ local LoginRoot_Version = VersionManager:GetVersionInfo("version")
local LoginRoot_PackageVersion = VersionManager:GetVersionInfo("packageVersion") local LoginRoot_PackageVersion = VersionManager:GetVersionInfo("packageVersion")
local orginLayer local orginLayer
local timeStamp = Time.realtimeSinceStartup
local timeSign = Util.MD5Encrypt(string.format("%s%s", timeStamp, LoginManager.sign))
--初始化组件(用于子类重写) --初始化组件(用于子类重写)
function this:InitComponent() function this:InitComponent()
orginLayer = 0 orginLayer = 0
@ -74,7 +77,10 @@ function this:BindEvent()
end) end)
end) end)
Util.AddClick(this.btnNotice, function() Util.AddClick(this.btnNotice, function()
UIManager.OpenPanel(UIName.NoticePopup) RequestPanel.Show(Language[11128])
networkMgr:SendGetHttp(LoginRoot_Url .. "jl_loginserver/getNotice?timestamp="..timeStamp.."&sign=".. timeSign,function (str)
UIManager.OpenPanel(UIName.NoticePopup,str)
end, nil, nil, nil)
end) end)
Util.AddClick(this.UserBtn, function() Util.AddClick(this.UserBtn, function()
local user = PlayerPrefs.GetString(openIdkey, defaultOpenIdkey) local user = PlayerPrefs.GetString(openIdkey, defaultOpenIdkey)
@ -324,7 +330,10 @@ function this.OnReceiveServerList(str)
if IsShowNotice then if IsShowNotice then
this.loginMask:SetActive(true) this.loginMask:SetActive(true)
Timer.New(function() Timer.New(function()
UIManager.OpenPanel(UIName.NoticePopup) RequestPanel.Show(Language[11128])
networkMgr:SendGetHttp(LoginRoot_Url .. "jl_loginserver/getNotice?timestamp="..timeStamp.."&sign=".. timeSign,function (str)
UIManager.OpenPanel(UIName.NoticePopup,str)
end, nil, nil, nil)
this.loginMask:SetActive(false) this.loginMask:SetActive(false)
end, 2.5, 1):Start() end, 2.5, 1):Start()
end end
@ -335,7 +344,10 @@ function this.OnReceiveServerList(str)
if IsShowNotice then if IsShowNotice then
this.loginMask:SetActive(true) this.loginMask:SetActive(true)
Timer.New(function() Timer.New(function()
UIManager.OpenPanel(UIName.NoticePopup) RequestPanel.Show(Language[11128])
networkMgr:SendGetHttp(LoginRoot_Url .. "jl_loginserver/getNotice?timestamp="..timeStamp.."&sign=".. timeSign,function (str)
UIManager.OpenPanel(UIName.NoticePopup,str)
end, nil, nil, nil)
this.loginMask:SetActive(false) this.loginMask:SetActive(false)
end, 2.5, 1):Start() end, 2.5, 1):Start()
end end

View File

@ -31,8 +31,8 @@ end
--界面打开时调用(用于子类重写) --界面打开时调用(用于子类重写)
function NoticePopup:OnOpen(...) function NoticePopup:OnOpen(...)
this.GetNotice(...)
this.GetNotice()
end end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写) --界面打开或者重新打开后,界面刷新时调用(用于子类重写)
@ -50,31 +50,30 @@ function NoticePopup:OnDestroy()
end end
function this.GetNotice() function this.GetNotice(str)
local timeStamp = Time.realtimeSinceStartup -- local timeStamp = Time.realtimeSinceStartup
local timeSign = Util.MD5Encrypt(string.format("%s%s", timeStamp, LoginManager.sign)) -- local timeSign = Util.MD5Encrypt(string.format("%s%s", timeStamp, LoginManager.sign))
RequestPanel.Show(Language[11128]) -- RequestPanel.Show(Language[11128])
networkMgr:SendGetHttp(LoginRoot_Url .. "jl_loginserver/getNotice?timestamp="..timeStamp.."&sign=".. timeSign, -- networkMgr:SendGetHttp(LoginRoot_Url .. "jl_loginserver/getNotice?timestamp="..timeStamp.."&sign=".. timeSign,function (str)
function (str) -- end, nil, nil, nil)
RequestPanel.Hide() RequestPanel.Hide()
if str == nil then if str == nil then
return return
end end
--Log(str) --Log(str)
local json = require 'cjson' local json = require 'cjson'
local data = json.decode(str) local data = json.decode(str)
--Log("data.parms.title:"..data.parms.title) --Log("data.parms.title:"..data.parms.title)
--Log("data.parms.content:"..data.parms.content) --Log("data.parms.content:"..data.parms.content)
if data.parms then if data.parms then
this.TitleText.text=data.parms.title this.TitleText.text=data.parms.title
this.ContentText.text=string.gsub(data.parms.content, "\\n", "\n") this.ContentText.text=string.gsub(data.parms.content, "\\n", "\n")
else else
this.TitleText.text=Language[11129] this.TitleText.text=Language[11129]
this.ContentText.text=Language[11130] this.ContentText.text=Language[11130]
end end
end, nil, nil, nil)
end end
return NoticePopup return NoticePopup