-- xx界面 local CSPMine = {} local csSelf = nil local transform = nil CSPMine.sizeAdjust = 1 CSPMine.contentRect = Vector4.zero local objs = {} local headData = {} -- 初始化,只会调用一次 function CSPMine.init(csObj) csSelf = csObj transform = csObj.transform CSPMine.contentRect = MyUtl.getUIContent(csSelf, nil, nil, true) objs.Content = getCC(transform, "PanelContent", "UIPanel") MyUtl.setContentView(objs.Content, 147 + 370) ---@type CLUIFormRoot objs.Top = getCC(transform, "Top", "CLUIFormRoot") ---@type UITexture objs.HeadIcon = getCC(objs.Top.transform, "SpriteHeadBg/SpriteHeadIcon", "UITexture") ---@type UIScrollView objs.scrollView = objs.Content:GetComponent("UIScrollView") end -- 设置数据 function CSPMine.setData(paras) -- 初始化顶部数据 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 end -- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh function CSPMine.show() CSPMine.setHeadInfor() objs.scrollView:ResetPosition() end function CSPMine.setHeadInfor() objs.Top:setValue(headData) DBUser.getIcon( headData.loginNo, function(content) objs.HeadIcon.mainTexture = content end ) end -- 刷新 function CSPMine.refresh() end -- 关闭页面 function CSPMine.hide() end -- 网络请求的回调;cmd:指命,succ:成功失败,msg:消息;paras:服务器下行数据 function CSPMine.procNetwork(cmd, succ, msg, paras) end -- 处理ui上的事件,例如点击等 function CSPMine.uiEventDelegate(go) local goName = go.name if goName == "ButtonMyCheck" then showHotWheel() -- CSPMine.onGetLocation(json.encode({code = 0, latitude = "116.404", longitude = "39.915"})) MyLocation.self:getMyLocation(CSPMine.onGetLocation) elseif goName == "ButtonSetting" or goName == "ButtonMySetting" then getPanelAsy("PanelSetting", onLoadedPanelTT) 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