Files
tianrunCRM/Assets/trCRM/upgradeRes4Dev/priority/lua/ui/panel/CSPMine.lua
2020-07-09 09:23:09 +08:00

124 lines
3.5 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

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.

-- 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为调用refreshshow和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
MyUtl.toastW(location.msg)
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