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

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 orginLayer
local timeStamp = Time.realtimeSinceStartup
local timeSign = Util.MD5Encrypt(string.format("%s%s", timeStamp, LoginManager.sign))
--初始化组件(用于子类重写)
function this:InitComponent()
orginLayer = 0
@ -74,7 +77,10 @@ function this:BindEvent()
end)
end)
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)
Util.AddClick(this.UserBtn, function()
local user = PlayerPrefs.GetString(openIdkey, defaultOpenIdkey)
@ -324,7 +330,10 @@ function this.OnReceiveServerList(str)
if IsShowNotice then
this.loginMask:SetActive(true)
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)
end, 2.5, 1):Start()
end
@ -335,7 +344,10 @@ function this.OnReceiveServerList(str)
if IsShowNotice then
this.loginMask:SetActive(true)
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)
end, 2.5, 1):Start()
end

View File

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