2020-07-04 14:41:25 +08:00
|
|
|
|
-- xx界面
|
|
|
|
|
|
local CSPMine = {}
|
|
|
|
|
|
|
|
|
|
|
|
local csSelf = nil
|
|
|
|
|
|
local transform = nil
|
|
|
|
|
|
CSPMine.sizeAdjust = 1
|
|
|
|
|
|
CSPMine.contentRect = Vector4.zero
|
|
|
|
|
|
local objs = {}
|
2020-08-01 17:55:18 +08:00
|
|
|
|
local mdata = {}
|
2020-07-04 14:41:25 +08:00
|
|
|
|
|
|
|
|
|
|
-- 初始化,只会调用一次
|
|
|
|
|
|
function CSPMine.init(csObj)
|
|
|
|
|
|
csSelf = csObj
|
|
|
|
|
|
transform = csObj.transform
|
|
|
|
|
|
CSPMine.contentRect = MyUtl.getUIContent(csSelf, nil, nil, true)
|
|
|
|
|
|
|
|
|
|
|
|
objs.Content = getCC(transform, "PanelContent", "UIPanel")
|
2020-08-04 21:58:27 +08:00
|
|
|
|
MyUtl.setContentView(objs.Content, MyUtl.defaultBottomHeight + 370)
|
2020-07-11 17:07:30 +08:00
|
|
|
|
|
|
|
|
|
|
---@type CLUIFormRoot
|
|
|
|
|
|
objs.Top = getCC(transform, "Top", "CLUIFormRoot")
|
|
|
|
|
|
---@type UITexture
|
|
|
|
|
|
objs.HeadIcon = getCC(objs.Top.transform, "SpriteHeadBg/SpriteHeadIcon", "UITexture")
|
2020-07-04 14:41:25 +08:00
|
|
|
|
|
|
|
|
|
|
---@type UIScrollView
|
|
|
|
|
|
objs.scrollView = objs.Content:GetComponent("UIScrollView")
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 设置数据
|
|
|
|
|
|
function CSPMine.setData(paras)
|
2020-07-11 17:07:30 +08:00
|
|
|
|
-- 初始化顶部数据
|
2020-08-01 17:55:18 +08:00
|
|
|
|
-- local currGroup = Prefs.getCurrGroup(Prefs.getUserName())
|
|
|
|
|
|
-- local companyInfro = json.decode(currGroup)
|
|
|
|
|
|
-- local user = DBUser.getUserById(companyInfro.login_no)
|
|
|
|
|
|
-- headData.company_id = companyInfro.company_id
|
|
|
|
|
|
-- headData.company_name = companyInfro.company_name
|
|
|
|
|
|
-- if user then
|
|
|
|
|
|
-- headData.loginNo = user.loginNo
|
|
|
|
|
|
-- headData.loginName = user.loginName
|
|
|
|
|
|
-- headData.imageUrl = user.imageUrl
|
|
|
|
|
|
-- else
|
|
|
|
|
|
-- printe("账号信息未取得!")
|
|
|
|
|
|
-- end
|
2020-07-04 14:41:25 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh
|
|
|
|
|
|
function CSPMine.show()
|
2020-08-01 17:55:18 +08:00
|
|
|
|
mdata = DBUser.getMyInfor()
|
2020-07-11 17:07:30 +08:00
|
|
|
|
CSPMine.setHeadInfor()
|
2020-07-04 14:41:25 +08:00
|
|
|
|
objs.scrollView:ResetPosition()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2020-07-11 17:07:30 +08:00
|
|
|
|
function CSPMine.setHeadInfor()
|
2020-08-01 17:55:18 +08:00
|
|
|
|
objs.Top:setValue(mdata)
|
2020-07-11 17:07:30 +08:00
|
|
|
|
DBUser.getIcon(
|
2020-08-01 17:55:18 +08:00
|
|
|
|
mdata.loginNo,
|
2020-07-11 17:07:30 +08:00
|
|
|
|
function(content)
|
|
|
|
|
|
objs.HeadIcon.mainTexture = content
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
2020-07-04 14:41:25 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 刷新
|
|
|
|
|
|
function CSPMine.refresh()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 关闭页面
|
|
|
|
|
|
function CSPMine.hide()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 网络请求的回调;cmd:指命,succ:成功失败,msg:消息;paras:服务器下行数据
|
|
|
|
|
|
function CSPMine.procNetwork(cmd, succ, msg, paras)
|
2020-08-01 17:55:18 +08:00
|
|
|
|
if (succ == NetSuccess) then
|
|
|
|
|
|
if cmd == NetProto.cmds.personal_data_query then
|
|
|
|
|
|
CSPMine.show()
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2020-07-04 14:41:25 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 处理ui上的事件,例如点击等
|
|
|
|
|
|
function CSPMine.uiEventDelegate(go)
|
|
|
|
|
|
local goName = go.name
|
2020-07-11 17:07:30 +08:00
|
|
|
|
if goName == "ButtonMyCheck" then
|
2020-07-04 14:41:25 +08:00
|
|
|
|
showHotWheel()
|
|
|
|
|
|
-- CSPMine.onGetLocation(json.encode({code = 0, latitude = "116.404", longitude = "39.915"}))
|
|
|
|
|
|
MyLocation.self:getMyLocation(CSPMine.onGetLocation)
|
2020-07-11 17:07:30 +08:00
|
|
|
|
elseif goName == "ButtonSetting" or goName == "ButtonMySetting" then
|
|
|
|
|
|
getPanelAsy("PanelSetting", onLoadedPanelTT)
|
2020-07-18 21:12:14 +08:00
|
|
|
|
elseif goName == "SpriteTopBg" then
|
|
|
|
|
|
getPanelAsy("PanelMyInfor", onLoadedPanelTT)
|
|
|
|
|
|
elseif goName == "ButtonAbout" then
|
|
|
|
|
|
getPanelAsy("PanelAbout", onLoadedPanelTT)
|
2020-07-04 14:41:25 +08:00
|
|
|
|
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
|
2020-07-09 09:23:09 +08:00
|
|
|
|
MyUtl.toastW(location.msg)
|
2020-07-04 14:41:25 +08:00
|
|
|
|
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
|