add
This commit is contained in:
123
Assets/trCRM/upgradeRes4Dev/priority/lua/ui/panel/CSPMine.lua
Normal file
123
Assets/trCRM/upgradeRes4Dev/priority/lua/ui/panel/CSPMine.lua
Normal file
@@ -0,0 +1,123 @@
|
||||
-- xx界面
|
||||
local CSPMine = {}
|
||||
|
||||
local csSelf = nil
|
||||
local transform = nil
|
||||
CSPMine.sizeAdjust = 1
|
||||
CSPMine.contentRect = Vector4.zero
|
||||
local objs = {}
|
||||
|
||||
-- 初始化,只会调用一次
|
||||
function CSPMine.init(csObj)
|
||||
csSelf = csObj
|
||||
transform = csObj.transform
|
||||
CSPMine.contentRect = MyUtl.getUIContent(csSelf, nil, nil, true)
|
||||
|
||||
objs.Content = getCC(transform, "PanelContent", "UIPanel")
|
||||
objs.Content.transform.localPosition = Vector3.zero
|
||||
objs.Content.clipOffset = Vector2.zero
|
||||
objs.Content.baseClipRegion = CSPMine.contentRect
|
||||
|
||||
---@type UIScrollView
|
||||
objs.scrollView = objs.Content:GetComponent("UIScrollView")
|
||||
end
|
||||
|
||||
-- 设置数据
|
||||
function CSPMine.setData(paras)
|
||||
end
|
||||
|
||||
-- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh
|
||||
function CSPMine.show()
|
||||
objs.scrollView:ResetPosition()
|
||||
end
|
||||
|
||||
function CSPMine.onClickBottonBtn(cell)
|
||||
end
|
||||
|
||||
-- 刷新
|
||||
function CSPMine.refresh()
|
||||
end
|
||||
|
||||
-- 关闭页面
|
||||
function CSPMine.hide()
|
||||
end
|
||||
|
||||
-- 网络请求的回调;cmd:指命,succ:成功失败,msg:消息;paras:服务器下行数据
|
||||
function CSPMine.procNetwork(cmd, succ, msg, paras)
|
||||
--[[
|
||||
if(succ == 1) then
|
||||
if(cmd == "xxx") then
|
||||
-- TODO:
|
||||
end
|
||||
end
|
||||
--]]
|
||||
end
|
||||
|
||||
-- 处理ui上的事件,例如点击等
|
||||
function CSPMine.uiEventDelegate(go)
|
||||
local goName = go.name
|
||||
if (goName == "Button01") then
|
||||
--[[
|
||||
if isNilOrEmpty(__uid__) then
|
||||
getPanelAsy("PanelLogin", onLoadedPanelTT, {function (uid)
|
||||
if uid then
|
||||
getPanelAsy("PanelPasswordSave", onLoadedPanelTT)
|
||||
end
|
||||
end}
|
||||
)
|
||||
else
|
||||
-- 密码保护
|
||||
getPanelAsy("PanelPasswordSave", onLoadedPanelTT)
|
||||
end
|
||||
--]]
|
||||
getPanelAsy("PanelPasswordSave", onLoadedPanelTT)
|
||||
elseif goName == "ButtonQR" then
|
||||
showHotWheel()
|
||||
-- CSPMine.onGetLocation(json.encode({code = 0, latitude = "116.404", longitude = "39.915"}))
|
||||
MyLocation.self:getMyLocation(CSPMine.onGetLocation)
|
||||
end
|
||||
end
|
||||
|
||||
function CSPMine.onGetLocation(locInfor)
|
||||
printe(locInfor)
|
||||
local location = json.decode(locInfor)
|
||||
|
||||
local code = location.code
|
||||
if code == 0 then
|
||||
-- 116.404, 39.915
|
||||
local latitude = location.latitude
|
||||
local longitude = location.longitude
|
||||
local AddrStr = location.AddrStr
|
||||
local upgradeRes = "/upgradeRes"
|
||||
if (CLCfgBase.self.isEditMode) then
|
||||
upgradeRes = "/upgradeRes4Dev"
|
||||
end
|
||||
local url =
|
||||
joinStr(
|
||||
"trCrm",
|
||||
upgradeRes,
|
||||
"/priority/www/baidumap.html?latitude=",
|
||||
latitude,
|
||||
"&longitude=",
|
||||
longitude,
|
||||
"@AddrStr=",
|
||||
AddrStr
|
||||
)
|
||||
getPanelAsy("PanelWebView", onLoadedPanelTT, {url = url})
|
||||
else
|
||||
CLAlert.add(location.msg, Color.yellow, 1)
|
||||
if code == 8 or code == 9 or code == 5 then
|
||||
-- 打开gps
|
||||
MyLocation.self:guidSwitchGps()
|
||||
end
|
||||
end
|
||||
hideHotWheel()
|
||||
end
|
||||
|
||||
-- 当按了返回键时,关闭自己(返值为true时关闭)
|
||||
function CSPMine.hideSelfOnKeyBack()
|
||||
return false
|
||||
end
|
||||
|
||||
--------------------------------------------
|
||||
return CSPMine
|
||||
Reference in New Issue
Block a user