This commit is contained in:
2020-08-01 17:55:18 +08:00
parent 29a8a1dae3
commit 4435098171
160 changed files with 21247 additions and 2405 deletions

View File

@@ -18,17 +18,17 @@ local firstCell
function CLLPPopTime.init(csObj)
csSelf = csObj
transform = csObj.transform
table.insert(hours, joinStr(NumEx.nStrForLen(23, 2), ""))
for i = 0, 22 do
table.insert(hours, joinStr(NumEx.nStrForLen(i, 2), ""))
end
-- table.insert(hours, joinStr(NumEx.nStrForLen(23, 2), "点"))
-- for i = 0, 22 do
-- table.insert(hours, joinStr(NumEx.nStrForLen(i, 2), "点"))
-- end
table.insert(minutes, joinStr(NumEx.nStrForLen(59, 2), ""))
table.insert(seconds, joinStr(NumEx.nStrForLen(59, 2), ""))
for i = 0, 58 do
table.insert(minutes, joinStr(NumEx.nStrForLen(i, 2), ""))
table.insert(seconds, joinStr(NumEx.nStrForLen(i, 2), ""))
end
-- table.insert(minutes, joinStr(NumEx.nStrForLen(59, 2), "分"))
-- table.insert(seconds, joinStr(NumEx.nStrForLen(59, 2), "秒"))
-- for i = 0, 58 do
-- table.insert(minutes, joinStr(NumEx.nStrForLen(i, 2), "分"))
-- table.insert(seconds, joinStr(NumEx.nStrForLen(i, 2), "秒"))
-- end
---@type UISprite
uiobjs.SpriteBg = getCC(transform, "Bottom/offset/SpriteBg", "UISprite")
local offset = getChild(transform, "Bottom/offset")
@@ -52,6 +52,52 @@ function CLLPPopTime.setData(paras)
hh = strs[1]
mm = strs[2]
ss = strs[3]
CLLPPopTime.setPopList(hh, mm, ss)
end
function CLLPPopTime.setPopList(hh, mm, ss)
hours = {}
local h = hh -1
if h < 0 then
h = 23
end
table.insert(hours, joinStr(NumEx.nStrForLen(h, 2), ""))
for i = 0, 22 do
h = hh + i
if h > 23 then
h = h - 24
end
table.insert(hours, joinStr(NumEx.nStrForLen(h, 2), ""))
end
minutes = {}
seconds = {}
local m = mm -1
if m < 0 then
m = 59
end
local s = ss -1
if s < 0 then
s = 59
end
table.insert(minutes, joinStr(NumEx.nStrForLen(m, 2), ""))
table.insert(seconds, joinStr(NumEx.nStrForLen(s, 2), ""))
for i = 0, 58 do
m = mm + i
if m > 59 then
m = m - 60
end
s = ss + i
if s > 59 then
s = s - 60
end
table.insert(minutes, joinStr(NumEx.nStrForLen(m, 2), ""))
table.insert(seconds, joinStr(NumEx.nStrForLen(s, 2), ""))
end
end
--当有通用背板显示时的回调

View File

@@ -1,383 +1,419 @@
--开始loading页面处理资源更新、及相关初始化
do
---@type json
local json = require("json.json")
---@type json
local json = require("json.json")
local DBUser = require("db.DBUser")
---@type Coolape.CLPanelLua
local csSelf = nil
local transform = nil
local gameObject = nil
local progressBar = nil
local progressBarTotal = nil
local lbprogressBarTotal = nil
local LabelTip = nil
local LabelVer = nil
local lbCustServer
local loadedPanelCount = 0
local server
local user
local bottom
local www4UpgradeCell = nil -- 更新时单个单元的www
-- 预先加载的页面(在热更新完成后,先把必要的公共页面先加载了,后面的处理可能会用到)
local beforeLoadPanels = {
"PanelHotWheel", -- 菊花
"PanelBackplate", -- 背板遮罩
"PanelConfirm", -- 确认提示页面
"PanelMask4Panel", -- 遮挡
"PanelWWWProgress" -- 显示网络请求资源的进度
}
local CLLPSplash = {}
function CLLPSplash.init(go)
csSelf = go
transform = csSelf.transform
gameObject = csSelf.gameObject
bottom = getChild(transform, "Bottom")
progressBar = getCC(bottom, "Progress Bar", "UISlider")
NGUITools.SetActive(progressBar.gameObject, false)
progressBarTotal = getChild(transform, "Bottom", "Progress BarTotal")
lbprogressBarTotal = getChild(progressBarTotal, "Thumb", "Label"):GetComponent("UILabel")
progressBarTotal = progressBarTotal:GetComponent("UISlider")
NGUITools.SetActive(progressBarTotal.gameObject, false)
LabelTip = getChild(bottom, "LabelTip")
LabelTip = LabelTip:GetComponent("UILabel")
NGUITools.SetActive(LabelTip.gameObject, false)
LabelVer = getChild(transform, "TopLeft", "LabelVer")
LabelVer = LabelVer:GetComponent("UILabel")
lbCustServer = getCC(transform, "TopLeft/LabelCustomerServer", "UILabel")
end
function CLLPSplash.show()
csSelf.panel.depth = 200
loadedPanelCount = 0
SetActive(progressBar.gameObject, false)
SetActive(progressBarTotal.gameObject, false)
-- load alert
CLLPSplash.addAlertHud()
-- 初始化需要提前加载的页面
loadedPanelCount = 0
for i, v in ipairs(beforeLoadPanels) do
CLPanelManager.getPanelAsy(v, CLLPSplash.onLoadPanelBefore)
end
-- Hide company panel
csSelf:invoke4Lua(CLLPSplash.hideFirstPanel, 1.5)
end
-- 关闭页面
function CLLPSplash.hide()
csSelf:cancelInvoke4Lua()
CLLPSplash.hideFirstPanel()
end
-- 刷新页面
function CLLPSplash.refresh()
LabelVer.text = joinStr(Localization.Get("Version"), __version__)
lbCustServer.text = ""
LabelTip.text = ""
end
-- 加载hud alert
function CLLPSplash.addAlertHud()
-- local onGetObj = function(name, AlertRoot, orgs)
-- AlertRoot.transform.parent = CLUIInit.self.uiPublicRoot
-- AlertRoot.transform.localPosition = Vector3.zero
-- AlertRoot.transform.localScale = Vector3.one
-- NGUITools.SetActive(AlertRoot, true)
-- end
-- CLUIOtherObjPool.borrowObjAsyn("ToastRoot", onGetObj)
getPanelAsy("ToastRoot", doShowPanel)
end
function CLLPSplash.hideFirstPanel()
do
return
end
---@type Coolape.CLPanelLua
local csSelf = nil
local transform = nil
local gameObject = nil
local progressBar = nil
local progressBarTotal = nil
local lbprogressBarTotal = nil
local LabelTip = nil
local LabelVer = nil
local lbCustServer
local loadedPanelCount = 0
local server
local user
local bottom
local p = CLPanelManager.getPanel(MyMain.self.firstPanel)
if (p ~= nil and p.gameObject.activeInHierarchy) then
CLPanelManager.hidePanel(p)
end
end
local www4UpgradeCell = nil -- 更新时单个单元的www
-- 预先加载的页面(在热更新完成后,先把必要的公共页面先加载了,后面的处理可能会用到)
local beforeLoadPanels = {
"PanelHotWheel", -- 菊花
"PanelBackplate", -- 背板遮罩
"PanelConfirm", -- 确认提示页面
"PanelMask4Panel", -- 遮挡
"PanelWWWProgress", -- 显示网络请求资源的进度
}
local CLLPSplash = {}
function CLLPSplash.init(go)
csSelf = go
transform = csSelf.transform
gameObject = csSelf.gameObject
bottom = getChild(transform, "Bottom")
progressBar = getCC(bottom, "Progress Bar", "UISlider")
NGUITools.SetActive(progressBar.gameObject, false)
progressBarTotal = getChild(transform, "Bottom", "Progress BarTotal")
lbprogressBarTotal = getChild(progressBarTotal, "Thumb", "Label"):GetComponent("UILabel")
progressBarTotal = progressBarTotal:GetComponent("UISlider")
NGUITools.SetActive(progressBarTotal.gameObject, false)
LabelTip = getChild(bottom, "LabelTip")
LabelTip = LabelTip:GetComponent("UILabel")
NGUITools.SetActive(LabelTip.gameObject, false)
LabelVer = getChild(transform, "TopLeft", "LabelVer")
LabelVer = LabelVer:GetComponent("UILabel")
lbCustServer = getCC(transform, "TopLeft/LabelCustomerServer", "UILabel")
function CLLPSplash.onLoadPanelBefore(p)
p:init()
loadedPanelCount = loadedPanelCount + 1
if
(p.name == "PanelConfirm" or p.name == "PanelHotWheel" or p.name == "PanelMask4Panel" or
p.name == "PanelWWWProgress")
then
p.transform.parent = CLUIInit.self.uiPublicRoot
p.transform.localScale = Vector3.one
end
function CLLPSplash.show()
csSelf.panel.depth = 200
loadedPanelCount = 0
SetActive(progressBar.gameObject, false)
SetActive(progressBarTotal.gameObject, false)
-- load alert
CLLPSplash.addAlertHud()
-- 初始化需要提前加载的页面
loadedPanelCount = 0
for i, v in ipairs(beforeLoadPanels) do
CLPanelManager.getPanelAsy(v, CLLPSplash.onLoadPanelBefore)
end
-- Hide company panel
csSelf:invoke4Lua(CLLPSplash.hideFirstPanel, 1.5)
if (p.name == "PanelWWWProgress") then
CLPanelManager.showPanel(p)
end
-- 关闭页面
function CLLPSplash.hide()
csSelf:cancelInvoke4Lua()
CLLPSplash.hideFirstPanel()
end
-- 刷新页面
function CLLPSplash.refresh()
LabelVer.text = joinStr(Localization.Get("Version"), __version__)
lbCustServer.text = ""
LabelTip.text = ""
end
-- 加载hud alert
function CLLPSplash.addAlertHud()
-- local onGetObj = function(name, AlertRoot, orgs)
-- AlertRoot.transform.parent = CLUIInit.self.uiPublicRoot
-- AlertRoot.transform.localPosition = Vector3.zero
-- AlertRoot.transform.localScale = Vector3.one
-- NGUITools.SetActive(AlertRoot, true)
-- end
-- CLUIOtherObjPool.borrowObjAsyn("ToastRoot", onGetObj)
getPanelAsy("ToastRoot", doShowPanel)
end
function CLLPSplash.hideFirstPanel()
do return end
---@type Coolape.CLPanelLua
local p = CLPanelManager.getPanel(MyMain.self.firstPanel)
if (p ~= nil and p.gameObject.activeInHierarchy) then
CLPanelManager.hidePanel(p)
CLLPSplash.onProgress(#(beforeLoadPanels), loadedPanelCount)
if (loadedPanelCount >= #(beforeLoadPanels)) then
-- 页面已经加载完成,处理热更新
if (not Application.isEditor) then
CLLPSplash.checkNewVersion()
else
csSelf:invoke4Lua(CLLPSplash.updateRes, 0.2)
end
end
end
function CLLPSplash.onLoadPanelBefore(p)
p:init()
loadedPanelCount = loadedPanelCount + 1
if (p.name == "PanelConfirm" or
p.name == "PanelHotWheel" or
p.name == "PanelMask4Panel" or
p.name == "PanelWWWProgress") then
p.transform.parent = CLUIInit.self.uiPublicRoot
p.transform.localScale = Vector3.one
end
if (p.name == "PanelWWWProgress") then
CLPanelManager.showPanel(p)
end
CLLPSplash.onProgress(#(beforeLoadPanels), loadedPanelCount)
if (loadedPanelCount >= #(beforeLoadPanels)) then
-- 页面已经加载完成,处理热更新
if (not Application.isEditor) then
CLLPSplash.checkNewVersion()
else
csSelf:invoke4Lua(CLLPSplash.updateRes, 0.2)
end
end
end
--[[
--[[
-- 更新版本
--{"ver":"1.0","force":true,"url":"http://"}
--]]
function CLLPSplash.checkNewVersion()
local oldVer = __version__
local onGetVer = function(content, orgs)
local map = JSON.DecodeMap(content)
local newVer = MapEx.getString(map, "ver")
if (tonumber(newVer) > tonumber(oldVer)) then
local doUpgradeApp = function()
CLLPSplash.upgradeGame(MapEx.getString(map, "url"))
end
if MapEx.getBool(map, "force") then
CLUIUtl.showConfirm(LGet("MsgHadNewVerApp"), true, "更新", doUpgradeApp, "", nil)
else
CLUIUtl.showConfirm(LGet("MsgHadNewVerApp"), false, "更新", doUpgradeApp, "忽略", CLLPSplash.updateRes)
end
else
CLLPSplash.updateRes()
function CLLPSplash.checkNewVersion()
local oldVer = __version__
local onGetVer = function(content, orgs)
local map = JSON.DecodeMap(content)
local newVer = MapEx.getString(map, "ver")
if (tonumber(newVer) > tonumber(oldVer)) then
local doUpgradeApp = function()
CLLPSplash.upgradeGame(MapEx.getString(map, "url"))
end
end
local onGetVerError = function(msg, orgs)
-- CLAlert.add(LGet("MsgCheckAppUpgradeFail"), Color.white, 1)
if MapEx.getBool(map, "force") then
CLUIUtl.showConfirm(LGet("MsgHadNewVerApp"), true, "更新", doUpgradeApp, "", nil)
else
CLUIUtl.showConfirm(LGet("MsgHadNewVerApp"), false, "更新", doUpgradeApp, "忽略", CLLPSplash.updateRes)
end
else
CLLPSplash.updateRes()
end
local chlCode = getChlCode()
local url = Utl.urlAddTimes(joinStr(CLVerManager.self.baseUrl, "/appVer.", chlCode, ".json"))
WWWEx.get(url, CLAssetType.text, onGetVer, onGetVerError, nil, true)
end
-- 更新安装游戏
function CLLPSplash.upgradeGame(url)
if not isNilOrEmpty(url ) then
Application.OpenURL(url)
end
local onGetVerError = function(msg, orgs)
-- CLAlert.add(LGet("MsgCheckAppUpgradeFail"), Color.white, 1)
CLLPSplash.updateRes()
end
-- 处理热更新
function CLLPSplash.updateRes()
if CLCfgBase.self.isDirectEntry then
-- 取得缓存的数据
user = json.decode(Prefs.getUserInfor())
server = json.decode(Prefs.getCurrServer())
CLLPSplash.checkHotUpgrade()
local chlCode = getChlCode()
local url = Utl.urlAddTimes(joinStr(CLVerManager.self.baseUrl, "/appVer.", chlCode, ".json"))
WWWEx.get(url, CLAssetType.text, onGetVer, onGetVerError, nil, true)
end
-- 更新安装游戏
function CLLPSplash.upgradeGame(url)
if not isNilOrEmpty(url) then
Application.OpenURL(url)
end
end
-- 处理热更新
function CLLPSplash.updateRes()
if CLCfgBase.self.isDirectEntry then
-- 取得缓存的数据
-- user = json.decode(Prefs.getUserInfor())
server = json.decode(Prefs.getCurrServer())
CLLPSplash.checkHotUpgrade()
else
if not CLCfgBase.self.hotUpgrade4EachServer then
-- 更新资源
print("更新资源")
CLLVerManager.init(CLLPSplash.onProgress, CLLPSplash.onFinishResUpgrade, true, "")
else
if not CLCfgBase.self.hotUpgrade4EachServer then
-- 更新资源
print("更新资源")
CLLVerManager.init(CLLPSplash.onProgress, CLLPSplash.onFinishResUpgrade, true, "")
else
--
CLLPSplash.accountLogin()
end
-- 选择服务器
CLLPSplash.selectServer(
function(result)
server = result
Prefs.setCurrServer(json.encode(server))
CLLPSplash.checkHotUpgrade()
end
)
end
end
end
function CLLPSplash.accountLogin()
-- getPanelAsy("PanelLogin", onLoadedPanelTT, {CLLPSplash.onAccountLogin, true})
CLLPSplash.selectServer = function(callback)
local onGetServers = function(content, orgs)
local content = json.decode(content)
local userName = Prefs.getUserName()
DBUser.isWhiteUser(
userName,
function(iswhite)
if iswhite then
getPanelAsy("PanelSelectServer", onLoadedPanelTT, {servers = content.data, callback = callback})
else
--//TODO:取得正式环境的信息
Utl.doCallback(callback)
end
end
)
end
local url = "" --//TODO:不要token验证传appid以便可以区分服务器
WWWEx.get(
url,
nil,
CLAssetType.text,
onGetServers,
function()
CLUIUtl.showConfirm(
"无法取得服务器,点击重试",
function()
CLLPSplash.selectServer(callback)
end
)
end,
nil,
true,
1
)
end
function CLLPSplash.accountLogin()
-- getPanelAsy("PanelLogin", onLoadedPanelTT, {CLLPSplash.onAccountLogin, true})
CLLPSplash.prepareStartGame()
end
function CLLPSplash.checkHotUpgrade()
if CLCfgBase.self.hotUpgrade4EachServer then
local resMd5 = ""
if CLPathCfg.self.platform == "IOS" then
resMd5 = server.iosVer
elseif CLPathCfg.self.platform == "Android" then
resMd5 = server.androidVer
end
-- 更新资源
CLLVerManager.init(CLLPSplash.onProgress, CLLPSplash.onFinishResUpgrade, true, resMd5)
else
CLLPSplash.prepareStartGame()
end
end
function CLLPSplash.onAccountLogin(_user, _server)
Prefs.setUserInfor(json.encode(_user))
Prefs.setCurrServer(json.encode(_server))
user = _user
server = _server
CLLPSplash.checkHotUpgrade()
--设置进度条
function CLLPSplash.onProgress(...)
local args = {...}
local all = args[1] -- 总量
local v = args[2] -- 当前值
if (#(args) >= 3) then
www4UpgradeCell = args[3]
else
www4UpgradeCell = nil
end
function CLLPSplash.checkHotUpgrade()
if CLCfgBase.self.hotUpgrade4EachServer then
local resMd5 = ""
if CLPathCfg.self.platform == "IOS" then
resMd5 = server.iosVer
else
resMd5 = server.androidVer
end
-- 更新资源
CLLVerManager.init(CLLPSplash.onProgress, CLLPSplash.onFinishResUpgrade, true, resMd5)
else
CLLPSplash.prepareStartGame()
end
end
if (progressBarTotal ~= nil) then
NGUITools.SetActive(progressBarTotal.gameObject, true)
NGUITools.SetActive(LabelTip.gameObject, true)
if (type(all) == "number") then
if (all > 0) then
local value = v / all
progressBarTotal.value = value
if (www4UpgradeCell ~= nil) then
-- 说明有单个资源
lbprogressBarTotal.text = joinStr(v, "/", all)
end
--设置进度条
function CLLPSplash.onProgress(...)
local args = { ... }
local all = args[1] -- 总量
local v = args[2] -- 当前值
if (#(args) >= 3) then
www4UpgradeCell = args[3]
else
www4UpgradeCell = nil
end
if (progressBarTotal ~= nil) then
NGUITools.SetActive(progressBarTotal.gameObject, true)
NGUITools.SetActive(LabelTip.gameObject, true)
if (type(all) == "number") then
if (all > 0) then
local value = v / all
progressBarTotal.value = value
if (www4UpgradeCell ~= nil) then
-- 说明有单个资源
lbprogressBarTotal.text = joinStr(v, "/", all)
end
-- 表明已经更新完成
if (value == 1) then
InvokeEx.cancelInvokeByUpdate(CLLPSplash.onProgressCell)
NGUITools.SetActive(progressBarTotal.gameObject, false)
NGUITools.SetActive(LabelTip.gameObject, false)
NGUITools.SetActive(progressBar.gameObject, false)
else
-- 单个资源的进度
CLLPSplash.onProgressCell()
end
else
-- 表明已经更新完成
if (value == 1) then
InvokeEx.cancelInvokeByUpdate(CLLPSplash.onProgressCell)
progressBarTotal.value = 0
NGUITools.SetActive(progressBarTotal.gameObject, false)
NGUITools.SetActive(LabelTip.gameObject, false)
NGUITools.SetActive(progressBar.gameObject, false)
else
-- 单个资源的进度
CLLPSplash.onProgressCell()
end
else
print(joinStr("all====", all))
InvokeEx.cancelInvokeByUpdate(CLLPSplash.onProgressCell)
progressBarTotal.value = 0
NGUITools.SetActive(progressBarTotal.gameObject, false)
NGUITools.SetActive(LabelTip.gameObject, false)
NGUITools.SetActive(progressBar.gameObject, false)
end
else
print(joinStr("all====", all))
end
end
end
-- 单个文件更新进度
function CLLPSplash.onProgressCell(...)
if (www4UpgradeCell ~= nil) then
NGUITools.SetActive(progressBar.gameObject, true)
progressBar.value = www4UpgradeCell.downloadProgress or 0
InvokeEx.invokeByUpdate(CLLPSplash.onProgressCell, 0.02)
else
NGUITools.SetActive(progressBar.gameObject, false)
InvokeEx.cancelInvokeByUpdate(CLLPSplash.onProgressCell)
end
-- 单个文件更新进度
function CLLPSplash.onProgressCell(...)
if (www4UpgradeCell ~= nil) then
NGUITools.SetActive(progressBar.gameObject, true)
progressBar.value = www4UpgradeCell.downloadProgress or 0
InvokeEx.invokeByUpdate(CLLPSplash.onProgressCell, 0.02)
else
NGUITools.SetActive(progressBar.gameObject, false)
InvokeEx.cancelInvokeByUpdate(CLLPSplash.onProgressCell)
end
end
-- 资源更新完成
function CLLPSplash.onFinishResUpgrade(upgradeProcSuccess)
print("CLLPSplash.onFinishResUpgrade")
if (not upgradeProcSuccess) then
print("UpgradeResFailed")
else
if (CLLVerManager.isHaveUpgrade()) then
-- 说明有更新,重新启动
if CLCfgBase.self.hotUpgrade4EachServer then
CLCfgBase.self.isDirectEntry = true
end
csSelf:cancelInvoke4Lua()
csSelf:invoke4Lua(CLLPSplash.reLoadGame, 0.1)
return
-- 资源更新完成
function CLLPSplash.onFinishResUpgrade(upgradeProcSuccess)
print("CLLPSplash.onFinishResUpgrade")
if (not upgradeProcSuccess) then
print("UpgradeResFailed")
else
if (CLLVerManager.isHaveUpgrade()) then
-- 说明有更新,重新启动
if CLCfgBase.self.hotUpgrade4EachServer then
CLCfgBase.self.isDirectEntry = true
end
end
if CLCfgBase.self.hotUpgrade4EachServer then
-- 准备开始游戏
CLLPSplash.prepareStartGame()
else
--SetActive(ButtonEntry, true)
CLLPSplash.accountLogin()
end
end
-- 重新启动lua
function CLLPSplash.reLoadGame()
--- 释放资源开始-------------------------------
local cleanRes = function()
if CLAlert ~= nil and CLAlert.csSelf ~= nil then
GameObject.DestroyImmediate(CLAlert.csSelf.gameObject, true)
end
pcall(doSomethingBeforeRestart)
pcall(releaseRes4GC, true)
end
--- 释放资源结束-------------------------------
pcall(cleanRes)
local panel = CLPanelManager.getPanel(CLMainBase.self.firstPanel)
if panel then
CLPanelManager.showPanel(panel)
end
CLMainBase.self:reStart()
end
-- 准备开始游戏
function CLLPSplash.prepareStartGame()
CLLPSplash.checkSignCode()
if (progressBar ~= nil) then
InvokeEx.cancelInvokeByUpdate(CLLPSplash.onProgressCell)
NGUITools.SetActive(progressBar.gameObject, false)
NGUITools.SetActive(progressBarTotal.gameObject, false)
NGUITools.SetActive(LabelTip.gameObject, false)
end
-- 播放背景音乐---------------
-- SoundEx.playMainMusic()
----------------------------
end
function CLLPSplash.checkSignCode()
-- 把热更新及加载ui完了后再做验证签名
if (not CLLPSplash.isSignCodeValid()) then
CLUIUtl.showConfirm(Localization.Get("MsgTheVerIsNotCorrect"), nil)
-- CLUIUtl.showConfirm("亲爱的玩家你所下载的版本可能是非官方版本请到xxx去下载。非常感谢", nil)
csSelf:cancelInvoke4Lua()
csSelf:invoke4Lua(CLLPSplash.reLoadGame, 0.1)
return
end
CLLPSplash.goNext()
end
-- 签名是否有效(Only 4 android)
function CLLPSplash.isSignCodeValid(...)
if isNilOrEmpty(CLCfgBase.self.singinMd5Code) then
return true
end
-- 取得签名串
local md5Code = Utl.getSingInCodeAndroid()
if CLCfgBase.self.hotUpgrade4EachServer then
-- 准备开始游戏
CLLPSplash.prepareStartGame()
else
--SetActive(ButtonEntry, true)
CLLPSplash.accountLogin()
end
end
if (isNilOrEmpty(md5Code)) then
if (string.lower(md5Code) ~= string.lower(CLCfgBase.self.singinMd5Code)) then
return false
end
-- 重新启动lua
function CLLPSplash.reLoadGame()
--- 释放资源开始-------------------------------
local cleanRes = function()
if CLAlert ~= nil and CLAlert.csSelf ~= nil then
GameObject.DestroyImmediate(CLAlert.csSelf.gameObject, true)
end
pcall(doSomethingBeforeRestart)
pcall(releaseRes4GC, true)
end
--- 释放资源结束-------------------------------
pcall(cleanRes)
local panel = CLPanelManager.getPanel(CLMainBase.self.firstPanel)
if panel then
CLPanelManager.showPanel(panel)
end
CLMainBase.self:reStart()
end
-- 准备开始游戏
function CLLPSplash.prepareStartGame()
CLLPSplash.checkSignCode()
if (progressBar ~= nil) then
InvokeEx.cancelInvokeByUpdate(CLLPSplash.onProgressCell)
NGUITools.SetActive(progressBar.gameObject, false)
NGUITools.SetActive(progressBarTotal.gameObject, false)
NGUITools.SetActive(LabelTip.gameObject, false)
end
-- 播放背景音乐---------------
-- SoundEx.playMainMusic()
----------------------------
end
function CLLPSplash.checkSignCode()
-- 把热更新及加载ui完了后再做验证签名
if (not CLLPSplash.isSignCodeValid()) then
CLUIUtl.showConfirm(Localization.Get("MsgTheVerIsNotCorrect"), nil)
-- CLUIUtl.showConfirm("亲爱的玩家你所下载的版本可能是非官方版本请到xxx去下载。非常感谢", nil)
return
end
CLLPSplash.goNext()
end
-- 签名是否有效(Only 4 android)
function CLLPSplash.isSignCodeValid(...)
if isNilOrEmpty(CLCfgBase.self.singinMd5Code) then
return true
end
-- 取得签名串
local md5Code = Utl.getSingInCodeAndroid()
function CLLPSplash.uiEventDelegate(go)
end
function CLLPSplash.goNext()
if CLCfgBase.self.isDirectEntry then
CLCfgBase.self.isDirectEntry = false
if (isNilOrEmpty(md5Code)) then
if (string.lower(md5Code) ~= string.lower(CLCfgBase.self.singinMd5Code)) then
return false
end
CLPanelManager.getPanelAsy("PanelStart", onLoadedPanel, { user, server })
end
-- 当按了返回键时关闭自己返值为true时关闭
function CLLPSplash.hideSelfOnKeyBack( )
return false
end
----------------------------------------------
return CLLPSplash
return true
end
function CLLPSplash.uiEventDelegate(go)
end
function CLLPSplash.goNext()
if CLCfgBase.self.isDirectEntry then
CLCfgBase.self.isDirectEntry = false
end
CLPanelManager.getPanelAsy("PanelStart", onLoadedPanel, {user, server})
end
-- 当按了返回键时关闭自己返值为true时关闭
function CLLPSplash.hideSelfOnKeyBack()
return false
end
----------------------------------------------
return CLLPSplash

View File

@@ -153,26 +153,22 @@ function CLLPStart.connectServer()
-- Net.self:connect(selectedServer.host, bio2number(selectedServer.port))
isLogined = true
CLLPStart.selectServer(
function()
NetProto.init(
function(success)
if success then
CLLPStart.showGuid()
else
CLUIUtl.showConfirm(
"与服务器失去联系",
false,
"重试",
CLLPStart.connectServer,
"退出",
function()
Application.Quit()
end
)
NetProto.init(
function(success)
if success then
CLLPStart.showGuid()
else
CLUIUtl.showConfirm(
"与服务器失去联系",
false,
"重试",
CLLPStart.connectServer,
"退出",
function()
Application.Quit()
end
end
)
)
end
end
)
end
@@ -266,25 +262,6 @@ CLLPStart.showGuid = function()
end
end
CLLPStart.selectServer = function(callback)
local userName = Prefs.getUserName()
if isNilOrEmpty(userName) then
Utl.doCallback(callback)
return
end
DBUser.isWhiteUser(
userName,
function(iswhite)
if iswhite then
getPanelAsy("PanelSelectServer", onLoadedPanelTT, {callback = callback})
else
Utl.doCallback(callback)
end
end
)
end
CLLPStart.hideSplash = function()
local p2 = CLPanelManager.getPanel("PanelSplash")
if (p2 ~= nil) then

View File

@@ -6,7 +6,7 @@ local transform = nil
CSPMine.sizeAdjust = 1
CSPMine.contentRect = Vector4.zero
local objs = {}
local headData = {}
local mdata = {}
-- 初始化,只会调用一次
function CSPMine.init(csObj)
@@ -29,30 +29,31 @@ 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
-- 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为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function CSPMine.show()
mdata = DBUser.getMyInfor()
CSPMine.setHeadInfor()
objs.scrollView:ResetPosition()
end
function CSPMine.setHeadInfor()
objs.Top:setValue(headData)
objs.Top:setValue(mdata)
DBUser.getIcon(
headData.loginNo,
mdata.loginNo,
function(content)
objs.HeadIcon.mainTexture = content
end
@@ -69,6 +70,11 @@ end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function CSPMine.procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
if cmd == NetProto.cmds.personal_data_query then
CSPMine.show()
end
end
end
-- 处理ui上的事件例如点击等

View File

@@ -8,8 +8,8 @@ CSPMsg.contentRect = Vector4.zero
local objs = {}
local defaulList = {
{icon="news_news_1", bgColor=0xfff1c40f,type=DBMessage.MsgType.Sys, name="公告"},
{icon="news_news_2", bgColor=0xff2990dc,type=DBMessage.MsgType.SysNotice, name="系统消息"},
{icon="news_news_3", bgColor=0xff1abc9c,type=DBMessage.MsgType.Task, name="待办任务"},
-- {icon="news_news_2", bgColor=0xff2990dc,type=DBMessage.MsgType.SysNotice, name="系统消息"},
-- {icon="news_news_3", bgColor=0xff1abc9c,type=DBMessage.MsgType.Task, name="待办任务"},
}
-- 初始化,只会调用一次

View File

@@ -13,7 +13,7 @@ function CSPTasks.init(csObj)
csSelf = csObj
transform = csObj.transform
CSPTasks.setEventDelegate()
CSPTasks.contentRect = MyUtl.getUIContent(csSelf, 360+220)
CSPTasks.contentRect = MyUtl.getUIContent(csSelf, 360 + 220)
uiobjs.Content = getCC(transform, "PanelContent", "UIPanel")
uiobjs.Content.transform.localPosition = Vector3.zero
@@ -21,8 +21,15 @@ function CSPTasks.init(csObj)
uiobjs.Content.baseClipRegion = CSPTasks.contentRect
uiobjs.TableContent = getCC(uiobjs.Content.transform, "Table", "UITable")
---@type UIGrid
local CustManageGrid = getCC(uiobjs.TableContent.transform, "CustManage/grid", "UIGrid")
CustManageGrid.cellWidth = NumEx.getIntPart((CSPTasks.contentRect.z - 100) / 4)
local SellManageGrid = getCC(uiobjs.TableContent.transform, "SellManage/grid", "UIGrid")
SellManageGrid.cellWidth = NumEx.getIntPart((CSPTasks.contentRect.z - 100) / 4)
---@type UIToggle
uiobjs.ToggleCust = getCC(uiobjs.TableContent.transform, "Statistics/grid/ToggleCust", "UIToggle")
uiobjs.ToggleOrder = getCC(uiobjs.TableContent.transform, "Statistics/grid/ToggleOrder", "UIToggle")
uiobjs.Statistics = getChild(uiobjs.TableContent.transform, "Statistics")
---@type UIScrollView
@@ -63,8 +70,8 @@ function CSPTasks.show()
end
-- uiobjs.TableTask:setList(list, nil)
uiobjs.ToggleCust:Set(true)
CSPTasks.showReportform("reportform1")
uiobjs.ToggleOrder:Set(true)
CSPTasks.showReportform("reportform2")
uiobjs.scrollView:ResetPosition()
end
@@ -165,7 +172,9 @@ function CSPTasks.setEventDelegate()
ButtonGoods = function()
getPanelAsy("PanelProductList", onLoadedPanelTT)
end,
ButtonTask = function()
getPanelAsy("PanelTaskList", onLoadedPanelTT)
end
}
end
-- 处理ui上的事件例如点击等

View File

@@ -0,0 +1,101 @@
---@type IDBasePanel
local TRBasePanel = require("ui.panel.TRBasePanel")
---@class TRPBatchGetCusts:TRBasePanel 邮件列表
local TRPBatchGetCusts = class("TRPBatchGetCusts", TRBasePanel)
local uiobjs = {}
-- 初始化,只会调用一次
function TRPBatchGetCusts:init(csObj)
TRPBatchGetCusts.super.init(self, csObj)
self:setEventDelegate()
---@type UIToggle
uiobjs.Toggle10 = getCC(self.transform, "Toggle10", "UIToggle")
end
-- 设置数据
---@param paras _ParamTRPBatchGetCusts
function TRPBatchGetCusts:setData(paras)
self.mdata = paras
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPBatchGetCusts:show()
uiobjs.Toggle10:Set(true)
end
-- 刷新
function TRPBatchGetCusts:refresh()
end
-- 关闭页面
function TRPBatchGetCusts:hide()
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPBatchGetCusts:procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
--[[
if cmd == xx then
end
]]
end
end
function TRPBatchGetCusts:setEventDelegate()
self.EventDelegate = {
Toggle10 = function(go)
---@type UIToggle
local toggle = go:GetComponent("UIToggle")
if toggle and toggle.value then
self.number = 10
end
end,
Toggle20 = function(go)
---@type UIToggle
local toggle = go:GetComponent("UIToggle")
if toggle and toggle.value then
self.number = 20
end
end,
Toggle100 = function(go)
---@type UIToggle
local toggle = go:GetComponent("UIToggle")
if toggle and toggle.value then
self.number = 100
end
end,
ButtonCancel = function()
hideTopPanel(self.csSelf)
end,
ButtonOkay = function()
showHotWheel()
local params = {
getNum = self.number,
oprType = "byNum"
}
NetProto.send.getFromGH(
params,
function(content)
if content.success then
hideTopPanel(self.csSelf)
end
end
)
end
}
end
-- 处理ui上的事件例如点击等
function TRPBatchGetCusts:uiEventDelegate(go)
local func = self.EventDelegate[go.name]
if func then
func(go)
end
end
-- 当顶层页面发生变化时回调
function TRPBatchGetCusts:onTopPanelChange(topPanel)
end
--------------------------------------------
return TRPBatchGetCusts

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f6153d69187e14c91938a886e2430f2a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -11,6 +11,7 @@ function TRPBindPhone:init(csObj)
MyUtl.setContentView(uiobjs.content)
---@type UIScrollView
uiobjs.scrollview = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
uiobjs.formRoot = getCC(uiobjs.scrollview.transform, "Table", "CLUIFormRoot")
self:setEventDelegate()
end

View File

@@ -18,6 +18,7 @@ function TRPComFilter:init(csObj)
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132 + 132 + 50, 190)
---@type UIScrollView
uiobjs.scrollview = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollview.dampenStrength = MyUtl.dampenStrength
uiobjs.Table = getCC(self.transform, "PanelContent/Grid", "UITable")
uiobjs.prefab = getChild(uiobjs.Table.transform, "00000").gameObject
uiobjs.InputSeachKey = getCC(self.transform, "Top/InputSeachKey", "UIInput")

View File

@@ -18,6 +18,7 @@ function TRPCustDetail:init(csObj)
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
---@type UITable
uiobjs.Table = getCC(uiobjs.scrollView.transform, "Table", "UITable")
@@ -79,6 +80,7 @@ function TRPCustDetail:prepareMoreData()
attr.donotJoinKey = true
table.insert(self.moreProcList, attr)
--[[
attr = {}
attr.id = "smsList"
attr.attrName = "短信记录"
@@ -96,6 +98,7 @@ function TRPCustDetail:prepareMoreData()
attr.height = 180
attr.donotJoinKey = true
table.insert(self.moreProcList, attr)
]]
--------------------------------------------
self.sysFields = {}
@@ -164,6 +167,7 @@ end
-- 设置数据
---@param paras _ParamTRPCustDetail
function TRPCustDetail:setData(paras)
---@type _DBCust
self.mdata = paras
self.mdata._phoneNo = MyUtl.hidePhone(self.mdata.phoneNo)
if type(self.mdata.jsonStr) == "string" then
@@ -248,6 +252,7 @@ function TRPCustDetail:showDetail()
CLUIUtl.resetList4Lua(uiobjs.starGrid2, uiobjs.starGridPrefab2, stars, self:wrapFunc(self.initStarCell))
uiobjs.Table:Reposition()
uiobjs.scrollView.restrictWithinPanel = true
uiobjs.scrollView.disableDragIfFits = true
uiobjs.scrollView:ResetPosition()
end
@@ -304,6 +309,11 @@ function TRPCustDetail:showRecords()
SetActive(uiobjs.OrderRoot.gameObject, false)
SetActive(uiobjs.Records.gameObject, true)
SetActive(uiobjs.MoreRoot.gameObject, false)
if self.records == nil or #(self.records.data) then
SetActive(uiobjs.ButtonEndList.gameObject, true)
else
SetActive(uiobjs.ButtonEndList.gameObject, false)
end
if self.records then
uiobjs.Records:setList(
self.records.data or {},
@@ -317,9 +327,7 @@ function TRPCustDetail:showRecords()
uiobjs.Records:setList({}, self:wrapFunc(self.initRecordCell))
end
uiobjs.Table:Reposition()
uiobjs.scrollView.disableDragIfFits = false
uiobjs.scrollView:ResetPosition()
self:reposition()
end
function TRPCustDetail:initRecordCell(cell, data)
@@ -350,6 +358,12 @@ function TRPCustDetail:showOrders()
SetActive(uiobjs.Records.gameObject, false)
SetActive(uiobjs.OrderRoot.gameObject, true)
SetActive(uiobjs.MoreRoot.gameObject, false)
if self.orders == nil or #(self.orders.data) then
SetActive(uiobjs.ButtonEndListOrder.gameObject, true)
else
SetActive(uiobjs.ButtonEndListOrder.gameObject, false)
end
if self.orders then
uiobjs.OrderRoot:setList(
self.orders.data or {},
@@ -419,17 +433,19 @@ function TRPCustDetail:showMore()
end
uiobjs.Table:Reposition()
uiobjs.scrollView.restrictWithinPanel = true
uiobjs.scrollView.disableDragIfFits = true
uiobjs.scrollView:ResetPosition()
end
---@param el CLUIElement
function TRPCustDetail:onClickMoreProc(el)
MyUtl.toastW("TODO:" .. el.jsonKey)
if el.jsonKey == "follows" then
-- 跟进记录
getPanelAsy("PanelFollowList", onLoadedPanelTT, {custId = self.mdata.custId})
elseif el.jsonKey == "followTasks" then
-- 预约记录
getPanelAsy("PanelTaskList", onLoadedPanelTT, {custId = self.mdata.custId})
elseif el.jsonKey == "smsList" then
-- 短信记录
elseif el.jsonKey == "opList" then

View File

@@ -0,0 +1,295 @@
---@type IDBasePanel
local TRBasePanel = require("ui.panel.TRBasePanel")
---@class TRPCustDetailSimple:TRBasePanel
local TRPCustDetailSimple = class("TRPCustDetailSimple", TRBasePanel)
local uiobjs = {}
-- 初始化,只会调用一次
function TRPCustDetailSimple:init(csObj)
TRPCustDetailSimple.super.init(self, csObj)
self:prepareMoreData()
self:setEventDelegate()
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132 + 400 + 40, 200)
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
---@type UITable
uiobjs.Table = getCC(uiobjs.scrollView.transform, "Table", "UITable")
uiobjs.Head = getCC(self.transform, "Top/SpriteHead", "CLUIFormRoot")
---@type UIPopupList
uiobjs.LabelStatus = getCC(uiobjs.Head.transform, "LabelStatus", "UIPopupList")
uiobjs.LabelType = getCC(uiobjs.Head.transform, "LabelType", "UIPopupList")
uiobjs.LabelLoginNo = getCC(uiobjs.Head.transform, "LabelLoginNo", "UIPopupList")
uiobjs.starGrid = getCC(uiobjs.Head.transform, "LabelStars/Grid", "UIGrid")
uiobjs.starGridPrefab = getChild(uiobjs.starGrid.transform, "00000").gameObject
---@type CLUIFormRoot
uiobjs.DetailRoot = getCC(uiobjs.Table.transform, "DetailRoot", "CLUIFormRoot")
uiobjs.InputTask = getCC(uiobjs.DetailRoot.transform, "InputTask", "UIPopupList")
uiobjs.InputCustType = getCC(uiobjs.DetailRoot.transform, "InputCustType", "UIPopupList")
uiobjs.InputStatus = getCC(uiobjs.DetailRoot.transform, "InputStatus", "UIPopupList")
uiobjs.InputFrom = getCC(uiobjs.DetailRoot.transform, "InputFrom", "UIPopupList")
uiobjs.InputLogin = getCC(uiobjs.DetailRoot.transform, "InputLogin", "UIPopupList")
uiobjs.starGrid2 = getCC(uiobjs.DetailRoot.transform, "InputStars/Grid", "UIGrid")
uiobjs.starGridPrefab2 = getChild(uiobjs.starGrid2.transform, "00000").gameObject
uiobjs.ExtendRoot = getCC(uiobjs.Table.transform, "ExtendRoot", "CLCellLua")
uiobjs.SysRoot = getCC(uiobjs.Table.transform, "SysRoot", "CLCellLua")
end
function TRPCustDetailSimple:prepareMoreData()
self.sysFields = {}
---@type _ParamFieldAttr
local attr = {}
attr.id = "loginNo"
attr.attrName = "创建人员"
attr.attrType = DBCust.FieldType.popuplist
attr.ifMust = 0
attr.height = 180
attr.donotJoinKey = true
local popInfor = DBUser.getPopList(DBUser.FilterGroup.user)
attr.popOptions = popInfor.options
attr.popValues = popInfor.values
table.insert(self.sysFields, attr)
---@type _ParamFieldAttr
attr = {}
attr.id = "groupId"
attr.attrName = "所属部门"
attr.attrType = DBCust.FieldType.popuplist
attr.ifMust = 0
attr.height = 180
attr.donotJoinKey = true
local popInfor = DBUser.getPopList(DBUser.FilterGroup.group)
attr.popOptions = popInfor.options
attr.popValues = popInfor.values
table.insert(self.sysFields, attr)
---@type _ParamFieldAttr
attr = {}
attr.id = "createTime"
attr.attrName = "创建时间"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.height = 180
attr.donotJoinKey = true
table.insert(self.sysFields, attr)
---@type _ParamFieldAttr
attr = {}
attr.id = "updateTime"
attr.attrName = "更新时间"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.height = 180
attr.donotJoinKey = true
table.insert(self.sysFields, attr)
---@type _ParamFieldAttr
attr = {}
attr.id = "lastFollowUpTime"
attr.attrName = "最后跟进"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.height = 180
attr.donotJoinKey = true
table.insert(self.sysFields, attr)
---@type _ParamFieldAttr
attr = {}
attr.id = "followupTime"
attr.attrName = "下次跟进"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.height = 180
attr.donotJoinKey = true
table.insert(self.sysFields, attr)
end
-- 设置数据
---@param paras _ParamTRPCustDetailSimple
function TRPCustDetailSimple:setData(paras)
---@type _DBCust
self.mdata = paras
self.mdata._phoneNo = MyUtl.hidePhone(self.mdata.phoneNo)
if type(self.mdata.jsonStr) == "string" then
self.mdata.jsonStr = json.decode(self.mdata.jsonStr)
end
end
---public 当有通用背板显示时的回调
---@param cs Coolape.CLPanelLua
function TRPCustDetailSimple:onShowFrame(cs)
if cs.frameObj then
---@type _BGFrame1Param
local d = {}
-- d.title = LGet(cs.titleKeyName)
d.title = self.mdata.companyName
d.panel = cs
cs.frameObj:init(d)
end
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPCustDetailSimple:show()
self.records = nil
self.orders = nil
local optionInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.dealFlagList)
uiobjs.LabelStatus:refreshItems(optionInfor.options, optionInfor.values)
uiobjs.InputStatus:refreshItems(optionInfor.options, optionInfor.values)
optionInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.custTypeList)
uiobjs.LabelType:refreshItems(optionInfor.options, optionInfor.values)
uiobjs.InputCustType:refreshItems(optionInfor.options, optionInfor.values)
optionInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.custFromList)
uiobjs.InputFrom:refreshItems(optionInfor.options, optionInfor.values)
optionInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.taskList)
uiobjs.InputTask:refreshItems(optionInfor.options, optionInfor.values)
local poplist = DBUser.getPopList(DBUser.FilterGroup.user)
uiobjs.InputLogin:refreshItems(poplist.options, poplist.values)
uiobjs.LabelLoginNo:refreshItems(poplist.options, poplist.values)
-- 设置星级
local stars = {}
for i = 1, 5 do
table.insert(stars, i <= (self.mdata.customerLabel or 0) and true or false)
end
CLUIUtl.resetList4Lua(uiobjs.starGrid, uiobjs.starGridPrefab, stars, self:wrapFunc(self.initStarCell))
self:showDetail()
end
function TRPCustDetailSimple:initStarCell(cell, data)
local sp = cell:GetComponent("UISprite")
if data then
sp.color = ColorEx.getColor(0xffFFC000)
CLUIUtl.setSpriteFit(sp, "cust_full_star")
else
sp.color = ColorEx.getColor(0xffd9d9d9)
CLUIUtl.setSpriteFit(sp, "cust_star")
end
end
function TRPCustDetailSimple:showDetail()
self:release()
SetActive(uiobjs.DetailRoot.gameObject, true)
SetActive(uiobjs.ExtendRoot.gameObject, true)
SetActive(uiobjs.SysRoot.gameObject, true)
uiobjs.DetailRoot:setValue(self.mdata)
-- uiobjs.ExtendRoot:init({data = self.mdata, isEditMode = false}, nil)
self:showExtentFiles(self.mdata.taskId)
self:showSysFiles()
-- 设置星级
local stars = {}
for i = 1, 5 do
table.insert(stars, i <= (self.mdata.customerLabel or 0) and true or false)
end
CLUIUtl.resetList4Lua(uiobjs.starGrid, uiobjs.starGridPrefab, stars, self:wrapFunc(self.initStarCell))
CLUIUtl.resetList4Lua(uiobjs.starGrid2, uiobjs.starGridPrefab2, stars, self:wrapFunc(self.initStarCell))
uiobjs.Table:Reposition()
uiobjs.scrollView.restrictWithinPanel = true
uiobjs.scrollView.disableDragIfFits = true
uiobjs.scrollView:ResetPosition()
end
function TRPCustDetailSimple:reposition()
uiobjs.Table:Reposition()
uiobjs.scrollView.disableDragIfFits = true
uiobjs.scrollView:ResetPosition()
end
---public 显示扩展字段
function TRPCustDetailSimple:showExtentFiles(taskId)
---@type _ParamCellExtendFiledRoot
local param = {}
param.data = self.mdata and self.mdata.jsonStr or {}
-- param.onFinish = self:wrapFunc(self.setExtendFieldsMode)
param.fields = {}
local fields = DBCust.getFieldsByTask(taskId) or {}
---@type _ParamCellExtendFiled
local filedInfor
for i, v in ipairs(fields) do
filedInfor = {}
filedInfor.attr = v
filedInfor.showMode = _FieldMode.showOnly
table.insert(param.fields, filedInfor)
end
uiobjs.ExtendRoot:init(param, nil)
end
---public 显示扩展字段
function TRPCustDetailSimple:showSysFiles()
---@type _ParamCellExtendFiledRoot
local param = {}
param.data = self.mdata
param.onFinish = self:wrapFunc(self.reposition)
param.fields = {}
local fields = self.sysFields
---@type _ParamCellExtendFiled
local filedInfor
for i, v in ipairs(fields) do
filedInfor = {}
filedInfor.attr = v
filedInfor.showMode = _FieldMode.showOnly
table.insert(param.fields, filedInfor)
end
uiobjs.SysRoot:init(param, nil)
end
-- 刷新
function TRPCustDetailSimple:refresh()
end
function TRPCustDetailSimple:release()
if uiobjs.ExtendRoot.luaTable then
uiobjs.ExtendRoot.luaTable.release()
end
if uiobjs.SysRoot.luaTable then
uiobjs.SysRoot.luaTable.release()
end
self.hasSetMoreProc = false
end
-- 关闭页面
function TRPCustDetailSimple:hide()
self:release()
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPCustDetailSimple:procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
end
end
function TRPCustDetailSimple:setEventDelegate()
self.EventDelegate = {
ButtonGet = function()
showHotWheel()
local params = {
ids = self.mdata.custId,
oprType = "byId"
}
NetProto.send.getFromGH(
params,
function(content)
if content.success then
hideTopPanel(self.csSelf)
end
end
)
end
}
end
-- 处理ui上的事件例如点击等
function TRPCustDetailSimple:uiEventDelegate(go)
local func = self.EventDelegate[go.name]
if func then
func()
end
end
-- 当顶层页面发生变化时回调
function TRPCustDetailSimple:onTopPanelChange(topPanel)
end
--------------------------------------------
return TRPCustDetailSimple

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 18e98cb359e864eceba463ac0d59d4bf
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -15,6 +15,7 @@ function TRPCustList:init(csObj)
uiobjs.ButtonFilterLb = getCC(uiobjs.ButtonFilterSp.transform, "Label", "UILabel")
---@type CLUIScrollViewWithEvent
uiobjs.scrollView = getCC(self.transform, "PanelContent", "CLUIScrollViewWithEvent")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
uiobjs.scrollView:init(
self:wrapFunc(self.onShowRefreshFlg),
self:wrapFunc(self.onhideRefreshFlg),
@@ -119,13 +120,16 @@ function TRPCustList:appList(list)
end
function TRPCustList:onShowRefreshFlg()
-- printe("TRPCustList:onShowRefreshFlg")
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 300, 0)
if uiobjs.Grid.list.Count > 0 then
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 300, 0)
else
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 100, 0)
end
SetActive(uiobjs.ButtonHeadList.gameObject, true)
end
function TRPCustList:onhideRefreshFlg()
-- printe("TRPCustList:onhideRefreshFlg")
SetActive(uiobjs.ButtonHeadList.gameObject, false)
-- uiobjs.scrollView:ResetPosition()
end
function TRPCustList:refreshList()
local queryKey = uiobjs.InputSeachKey.value

View File

@@ -12,6 +12,7 @@ function TRPCustListProc:init(csObj)
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132 + 30, 0)
---@type UIScrollView
uiobjs.scrollview = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
uiobjs.grid = getCC(self.transform, "PanelContent/Grid", "CLUILoopGrid")
end

View File

@@ -17,6 +17,7 @@ function TRPFollowFilter:init(csObj)
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132 + 132 + 50, 190)
---@type UIScrollView
uiobjs.scrollview = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
uiobjs.Table = getCC(self.transform, "PanelContent/Grid", "UITable")
uiobjs.prefab = getChild(uiobjs.Table.transform, "00000").gameObject
uiobjs.InputSeachKey = getCC(self.transform, "Top/InputSeachKey", "UIInput")

View File

@@ -10,11 +10,13 @@ function TRPFollowList:init(csObj)
self:initFilters()
self:setEventDelegate()
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132 + 132 + 40, 0)
---@type UIInput
uiobjs.InputSeachKey = getCC(self.transform, "Top/InputSeachKey", "UIInput")
uiobjs.ButtonFilterSp = getCC(self.transform, "Top/ButtonFilter", "UISprite")
uiobjs.ButtonFilterLb = getCC(uiobjs.ButtonFilterSp.transform, "Label", "UILabel")
---@type CLUIScrollViewWithEvent
uiobjs.scrollView = getCC(self.transform, "PanelContent", "CLUIScrollViewWithEvent")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
uiobjs.scrollView:init(
self:wrapFunc(self.onShowRefreshFlg),
self:wrapFunc(self.onhideRefreshFlg),
@@ -91,8 +93,14 @@ end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPFollowList:show()
uiobjs.InputSeachKey.value = ""
if self.mdata and self.mdata.custId then
uiobjs.InputSeachKey.collider.enabled = false
else
uiobjs.InputSeachKey.collider.enabled = true
end
self:refreshFilterBtnStatus()
self:showList({})
self.filterValue = self:getFilterStr()
showHotWheel()
NetProto.send.list_followUp_records(self.filterValue, "", 1)
end
@@ -120,13 +128,16 @@ function TRPFollowList:appList(list)
end
function TRPFollowList:onShowRefreshFlg()
-- printe("TRPFollowList:onShowRefreshFlg")
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 395, 0)
if uiobjs.Grid.list.Count > 0 then
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 395, 0)
else
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 100, 0)
end
SetActive(uiobjs.ButtonHeadList.gameObject, true)
end
function TRPFollowList:onhideRefreshFlg()
-- printe("TRPFollowList:onhideRefreshFlg")
SetActive(uiobjs.ButtonHeadList.gameObject, false)
-- uiobjs.scrollView:ResetPosition()
end
function TRPFollowList:refreshList()
local queryKey = uiobjs.InputSeachKey.value
@@ -158,7 +169,7 @@ function TRPFollowList:initCell(cell, data)
end
function TRPFollowList:onClickCell(cell, data)
getPanelAsy("PanelCustDetail", onLoadedPanelTT, data)
getPanelAsy("PanelNewFollow", onLoadedPanelTT, data)
end
function TRPFollowList:refreshFilterBtnStatus()
@@ -222,6 +233,7 @@ function TRPFollowList:setEventDelegate()
"PanelComFilter",
onLoadedPanelTT,
{
title = "跟进筛选",
callback = self:wrapFunc(self.onSetFilter),
queryKey = uiobjs.InputSeachKey.value,
defautFilter = self.filters,
@@ -237,20 +249,19 @@ function TRPFollowList:setEventDelegate()
end
function TRPFollowList:getFilterStr()
if not self.filters then
return ""
end
local ret = {}
if self.mdata and self.mdata.custId then
ret.custId = self.mdata.custId
end
if not self.filters then
return ret
end
for i, g in ipairs(self.filters) do
local list = {}
if g.list then
for j, f in ipairs(g.list) do
if f.selected and f.value ~= -1 then
if g.key == DBCust.FilterGroup.opportunityList or g.key == DBCust.FilterGroup.followUpTypeList then
table.insert(list, f.name)
else
table.insert(list, f.value)
end
table.insert(list, f.value)
end
end
ret[g.key2] = table.concat(list, ",")

View File

@@ -13,6 +13,7 @@ function TRPMyInfor:init(csObj)
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132 + 40 + 300, 0)
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
---@type UITable
uiobjs.Table = getCC(uiobjs.scrollView.transform, "Table", "UITable")
---@type CLUIFormRoot
@@ -34,7 +35,7 @@ function TRPMyInfor:initFiledsAttr()
attr.attrName = "姓名"
attr.id = "loginName"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.ifMust = 1
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
@@ -49,7 +50,7 @@ function TRPMyInfor:initFiledsAttr()
attr = {}
attr.attrName = "部门"
attr.id = ""
attr.id = "groupName"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.cannotEdit = true
@@ -58,7 +59,7 @@ function TRPMyInfor:initFiledsAttr()
attr = {}
attr.attrName = "角色"
attr.id = ""
attr.id = "roleName"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.cannotEdit = true
@@ -72,7 +73,7 @@ function TRPMyInfor:initFiledsAttr()
attr = {}
attr.attrName = "邮箱"
attr.id = ""
attr.id = "email"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.cannotEdit = true
@@ -91,7 +92,7 @@ function TRPMyInfor:initFiledsAttr()
attr = {}
attr.attrName = "分机号"
attr.id = ""
attr.id = "agentNo"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.cannotEdit = true
@@ -102,7 +103,7 @@ function TRPMyInfor:initFiledsAttr()
function(iswhite)
if iswhite then
attr = {}
attr.attrName = "关闭日志"
attr.attrName = "关闭日志(仅白名单))"
attr.id = "closeLog"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
@@ -111,7 +112,7 @@ function TRPMyInfor:initFiledsAttr()
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "打开日志"
attr.attrName = "打开日志(仅白名单)"
attr.id = "openLog"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
@@ -126,25 +127,11 @@ end
-- 设置数据
---@param paras _ParamTRPMyInfor
function TRPMyInfor:setData(paras)
self.mdata = {}
-- 初始化顶部数据
local currGroup = Prefs.getCurrGroup(Prefs.getUserName())
local companyInfro = json.decode(currGroup)
local user = DBUser.getUserById(companyInfro.login_no)
self.mdata.company_id = companyInfro.company_id
self.mdata.company_name = companyInfro.company_name
self.mdata.phoneNo = Prefs.getUserName()
if user then
self.mdata.loginNo = user.loginNo
self.mdata.loginName = user.loginName
self.mdata.imageUrl = user.imageUrl
else
printe("账号信息未取得!")
end
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPMyInfor:show()
self.mdata = DBUser.getMyInfor()
---@type _ParamCellExtendFiledRoot
local fieldRootInfor = {}
fieldRootInfor.fields = {}
@@ -154,7 +141,7 @@ function TRPMyInfor:show()
---@type _ParamCellExtendFiled
local d = {}
d.attr = v
if d.attr.id == "loginNo" then
if d.attr.id == "loginNo" or d.attr.id == "roleName" or d.attr.id == "groupName" or d.attr.id == "agentNo" then
d.showMode = _FieldMode.showOnly
else
d.showMode = _FieldMode.showAndModify
@@ -212,11 +199,28 @@ end
function TRPMyInfor:onFinishSetField(key, val)
if tostring(val) ~= tostring(self.mdata[key]) then
-- self:sendModifymsg(key, val, true)
MyUtl.toastW("TODO:修改数据")
self:sendModifymsg(key, val, true)
end
end
function TRPMyInfor:sendModifymsg(key, val, isExtend)
local content = {}
content.loginNo = self.mdata.loginNo
content[key] = val
showHotWheel()
NetProto.send.updateUserInfo(
content,
function(result, orgs)
hideHotWheel()
if result.success then
-- 更新本地数据
NetProto.send.personal_data_query()
MyUtl.toastS("修改成功")
end
end
)
end
function TRPMyInfor:onSelectField(go)
end
@@ -238,10 +242,9 @@ end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPMyInfor:procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
--[[
if cmd == xx then
if cmd == NetProto.cmds.personal_data_query then
self:show()
end
]]
end
end
@@ -296,7 +299,19 @@ function TRPMyInfor:onGetImage(path)
if isNilOrEmpty(path) then
return
end
--//TODO:
showHotWheel()
NetProto.uploadUserHeadIcon(
path,
function(content)
hideHotWheel()
if content and content.success then
NetProto.send.personal_data_query()
MyUtl.toastS("头像更改成功")
else
MyUtl.toastW("头像更改失败")
end
end
)
end
-- 处理ui上的事件例如点击等

View File

@@ -14,6 +14,7 @@ function TRPNewCust:init(csObj)
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132, 0)
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
---@type UITable
uiobjs.Table = getCC(uiobjs.scrollView.transform, "Table", "UITable")
---@type CLUIFormRoot

View File

@@ -14,6 +14,7 @@ function TRPNewFollow:init(csObj)
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132, 0)
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
---@type UITable
uiobjs.Table = getCC(uiobjs.scrollView.transform, "Table", "UITable")
---@type CLUIFormRoot
@@ -54,7 +55,7 @@ function TRPNewFollow:initFiledsAttr()
attr = {}
attr.attrName = "跟时时间"
attr.id = ""
attr.id = "recordingTime"
attr.attrType = DBCust.FieldType.dateTime
attr.ifMust = 1
attr.ifTime = 1
@@ -65,7 +66,7 @@ function TRPNewFollow:initFiledsAttr()
attr.attrName = "客户名称"
attr.id = "custName"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 1
attr.ifMust = 0
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
@@ -92,12 +93,22 @@ end
-- 设置数据
---@param paras _ParamTRPNewFollow
function TRPNewFollow:setData(paras)
self.mdata = {}
self.mdata.custId = paras.custId
self.mdata.taskId = paras.taskId
self.mdata.custName = paras.custName
if paras.recordingTime then
self.mdata = paras
self.isNewFollow = false
else
self.mdata = {}
self.mdata.custId = paras.custId
self.mdata.taskId = paras.taskId
self.mdata.custName = paras.custName
self.isNewFollow = true
self.mdata.opportunity = "0"
self.mdata.followUpType = "0"
self.mdata.recordingTime = DateEx.nowString()
self.mdata.dealFlag = "0"
self.isNewFollow = true
end
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
@@ -127,7 +138,11 @@ function TRPNewFollow:showBaseFields()
-- 工单模板
filedInfor = {}
filedInfor.attr = v
filedInfor.isEditMode = true
if self.isNewFollow then
filedInfor.showMode = _FieldMode.inputOnly
else
filedInfor.showMode = _FieldMode.showOnly
end
if filedInfor.attr.attrType == DBCust.FieldType.multext then
filedInfor.onMultTextInputChg = self:wrapFunc(self.reposition)
end

View File

@@ -14,6 +14,7 @@ function TRPNewFollowSimple:init(csObj)
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132, 0)
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
---@type UITable
uiobjs.Table = getCC(uiobjs.scrollView.transform, "Table", "UITable")
---@type CLUIFormRoot
@@ -66,7 +67,8 @@ function TRPNewFollowSimple:setData(paras)
self.mdata = {}
self.mdata.custId = paras.custId
self.mdata.taskId = paras.taskId
self.mdata.followUpType = "0"
self.mdata.dealFlag = "0"
self.isNewFollow = true
end

View File

@@ -1,6 +1,6 @@
---@type IDBasePanel
local TRBasePanel = require("ui.panel.TRBasePanel")
---@class TRPNewFollowTask:TRBasePanel
---@class TRPNewFollowTask:TRBasePanel
local TRPNewFollowTask = class("TRPNewFollowTask", TRBasePanel)
local uiobjs = {}
@@ -14,6 +14,7 @@ function TRPNewFollowTask:init(csObj)
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132, 0)
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
---@type UITable
uiobjs.Table = getCC(uiobjs.scrollView.transform, "Table", "UITable")
---@type CLUIFormRoot
@@ -39,7 +40,7 @@ function TRPNewFollowTask:initFiledsAttr()
attr = {}
attr.attrName = "预约时间"
attr.id = "FollowUpTime"
attr.id = "bookingTime"
attr.attrType = DBCust.FieldType.dateTime
attr.ifTime = 1
attr.ifMust = 1
@@ -61,12 +62,19 @@ end
-- 设置数据
---@param paras _ParamTRPNewFollowTask
function TRPNewFollowTask:setData(paras)
self.mdata = {}
self.mdata.custId = paras.custId
self.mdata.taskId = paras.taskId
self.mdata.loginNo = NetProto.loginNo
if paras and paras.taskId then
self.mdata = paras
self.isNewFollow = false
else
self.mdata = {}
self.mdata.custId = paras.custId
self.mdata.taskId = paras.taskId
self.mdata.loginNo = NetProto.loginNo
self.isNewFollow = true
self.mdata.bookingTime = DateEx.nowString()
self.isNewFollow = true
end
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
@@ -95,7 +103,11 @@ function TRPNewFollowTask:showBaseFields()
-- 工单模板
filedInfor = {}
filedInfor.attr = v
filedInfor.isEditMode = true
if self.isNewFollow then
filedInfor.showMode = _FieldMode.inputOnly
else
filedInfor.showMode = _FieldMode.showOnly
end
if filedInfor.attr.attrType == DBCust.FieldType.multext then
filedInfor.onMultTextInputChg = self:wrapFunc(self.reposition)
end
@@ -125,7 +137,7 @@ end
function TRPNewFollowTask:setExtendFieldsMode(root)
local elements = root:GetComponentsInChildren(typeof(CLUIElement), true)
for i = 0, elements.Length - 1 do
self:setElementMode(elements[i])
-- self:setElementMode(elements[i])
if elements[i].jsonKey == "followUpContent" then
---@type CLUIElement
uiobjs.followUpContent = elements[i]
@@ -204,13 +216,16 @@ function TRPNewFollowTask:setEventDelegate()
end
self.mdata = uiobjs.DetailFromRoot:getValue(self.mdata, true)
showHotWheel()
NetProto.send.create_followUp_task(self.mdata, function(content)
hideHotWheel()
if content.success then
MyUtl.toastS("创建成功")
hideTopPanel(self.csSelf)
NetProto.send.create_followUp_task(
self.mdata,
function(content)
hideHotWheel()
if content.success then
MyUtl.toastS("创建成功")
hideTopPanel(self.csSelf)
end
end
end)
)
end
}
end

View File

@@ -14,6 +14,7 @@ function TRPNewOrder:init(csObj)
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132, 0)
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
---@type UITable
uiobjs.Table = getCC(uiobjs.scrollView.transform, "Table", "UITable")
---@type CLUIFormRoot
@@ -149,7 +150,9 @@ function TRPNewOrder:setData(paras)
self.cust = paras
self.mdata = {}
local popInfor = DBOrder.getPopupList(DBOrder.PopListGroup.templateList)
self.mdata.templetId = popInfor.values[0]
if popInfor and #popInfor > 0 then
self.mdata.templetId = popInfor.values[0]
end
popInfor = DBOrder.getPopupList(DBOrder.PopListGroup.urgencyLevels)
self.mdata.urgency = popInfor.values[0]
local templateInfor = DBOrder.getTemplateInfor(self.mdata.templetId)
@@ -190,6 +193,8 @@ end
function TRPNewOrder:refreshContent()
self:showBaseFields()
self:showProducts()
-- 附件
self:showImages()
self.csSelf:invoke4Lua(self:wrapFunc(self.reposition), 0.1)
end
@@ -309,9 +314,6 @@ function TRPNewOrder:showExtentFiles(templetId)
local d = uiobjs.DetailFromRoot:getValue(true)
d.content = cfgInfor.content
uiobjs.DetailFromRoot:setValue(d)
-- 附件
self:showImages()
-----------------------------------
uiobjs.StepRoot:Reposition()
end
@@ -528,6 +530,16 @@ function TRPNewOrder:setEventDelegate()
MyUtl.toastW(err)
return
end
if self.images and #(self.images) > 0 then
for i, v in ipairs(self.images) do
if v.uploadInfor == nil then
MyUtl.toastW("附件还未全部上传成功")
return
end
end
end
local order = uiobjs.DetailFromRoot:getValue(true)
if self.cust then
order.phoneNo = self.cust.phoneNo
@@ -562,6 +574,15 @@ function TRPNewOrder:setEventDelegate()
end
end
order.wfType = "0" -- 0正常工单1退货工单
-- 附件
if self.images and #(self.images) > 0 then
order.wfOptions = {}
for i, v in ipairs(self.images) do
table.insert(order.wfOptions, v.uploadInfor)
end
end
-----------------------------------
showHotWheel()
NetProto.send.createWfInfo(
order,
@@ -641,7 +662,6 @@ function TRPNewOrder:onGetImage(path)
return
end
end
MyUtl.toastW("TODO:上传附件还没有做!!!!")
table.insert(self.images, {path = path, onDelete = self:wrapFunc(self.onDelImage)})
self:showImages()
end

View File

@@ -15,6 +15,7 @@ function TRPOceanList:init(csObj)
uiobjs.ButtonFilterLb = getCC(uiobjs.ButtonFilterSp.transform, "Label", "UILabel")
---@type CLUIScrollViewWithEvent
uiobjs.scrollView = getCC(self.transform, "PanelContent", "CLUIScrollViewWithEvent")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
uiobjs.scrollView:init(
self:wrapFunc(self.onShowRefreshFlg),
self:wrapFunc(self.onhideRefreshFlg),
@@ -59,9 +60,9 @@ function TRPOceanList:initFilters()
end
d = {}
d.title = "跟进阶段"
d.title = "客户状态"
d.key = DBCust.FilterGroup.dealFlagList
d.key2 = "payStatus"
d.key2 = "dealFlag"
d.list = DBCust.getFilter(DBCust.FilterGroup.dealFlagList)
if #(d.list) > 0 then
-- table.insert(d.list, 1, {name = "全部", value = -1})
@@ -108,13 +109,16 @@ function TRPOceanList:appList(list)
end
function TRPOceanList:onShowRefreshFlg()
-- printe("TRPOceanList:onShowRefreshFlg")
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 222, 0)
if uiobjs.Grid.list.Count > 0 then
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 222, 0)
else
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 100, 0)
end
SetActive(uiobjs.ButtonHeadList.gameObject, true)
end
function TRPOceanList:onhideRefreshFlg()
-- printe("TRPOceanList:onhideRefreshFlg")
SetActive(uiobjs.ButtonHeadList.gameObject, false)
-- uiobjs.scrollView:ResetPosition()
end
function TRPOceanList:refreshList()
local queryKey = uiobjs.InputSeachKey.value
@@ -146,8 +150,17 @@ function TRPOceanList:initCell(cell, data)
end
function TRPOceanList:onClickCell(cell, data)
--//TODO:
-- getPanelAsy("PanelOrderDetail", onLoadedPanelTT, data)
NetProto.send.get_customerById(
data.id,
function(content)
if content.success then
local cust = content.result
if cust then
getPanelAsy("PanelCustDetailSimple", onLoadedPanelTT, cust)
end
end
end
)
end
function TRPOceanList:refreshFilterBtnStatus()
@@ -198,9 +211,9 @@ function TRPOceanList:procNetwork(cmd, succ, msg, paras)
self:showList(result.data)
end
hideHotWheel()
elseif cmd == NetProto.cmds.update_customer then
uiobjs.Grid:refreshContentOnly()
elseif cmd == NetProto.cmds.save_customer then
elseif cmd == NetProto.cmds.getFromGH then
hideHotWheel()
MyUtl.toastS("获取客户成功")
self:refreshList()
end
end
@@ -220,6 +233,9 @@ function TRPOceanList:setEventDelegate()
}
)
end,
ButtonMultGetCust = function()
getPanelAsy("PanelBatchGetCusts", onLoadedPanelTT)
end,
InputSeachKey = function()
local queryKey = uiobjs.InputSeachKey.value
NetProto.send.pageGHQueryList(self.filterValue, queryKey, 1)

View File

@@ -28,6 +28,7 @@ function TRPOrderDetail:init(csObj)
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132 + 160 + 30, 0)
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
---@type UITable
uiobjs.Table = getCC(uiobjs.scrollView.transform, "Table", "UITable")
@@ -40,7 +41,8 @@ function TRPOrderDetail:init(csObj)
---@type Coolape.CLUILoopGrid
uiobjs.Records = getCC(uiobjs.Table.transform, "Records", "CLUILoopGrid")
uiobjs.ButtonEndList = getChild(uiobjs.Records.transform, "ButtonEndList")
uiobjs.AttachmentRoot = getCC(uiobjs.Table.transform, "AttachmentRoot", "CLCellLua")
uiobjs.AttachmentRoot = getCC(uiobjs.Table.transform, "AttachmentRoot", "UIGrid")
uiobjs.AttachmentPrefab = getChild(uiobjs.AttachmentRoot.transform, "00000").gameObject
uiobjs.FinanceRoot = getCC(uiobjs.Table.transform, "FinanceRoot", "CLCellLua")
---@type Coolape.CLUILoopGrid
@@ -148,6 +150,10 @@ function TRPOrderDetail:setData(paras)
if type(self.mdata.prodJson) == "string" then
self.mdata.prodJson = json.decode(self.mdata.prodJson)
end
if type(self.mdata.wfOptJson) == "string" then
self.mdata.wfOptJson = json.decode(self.mdata.wfOptJson)
end
end
---public 当有通用背板显示时的回调
@@ -267,10 +273,23 @@ function TRPOrderDetail:showAttachment()
SetActive(uiobjs.FinanceRoot.gameObject, false)
SetActive(uiobjs.SubOrders.gameObject, false)
MyUtl.toastW("TODO:还没有附件数据")
CLUIUtl.resetList4Lua(
uiobjs.AttachmentRoot,
uiobjs.AttachmentPrefab,
self.mdata.wfOptJson,
self:wrapFunc(self.initAttachmentCell)
)
self:reposition()
end
function TRPOrderDetail:initAttachmentCell(cell, data)
cell:init(data, self:wrapFunc(self.onClickAttachment))
end
function TRPOrderDetail:onClickAttachment(cell, data)
end
function TRPOrderDetail:showRecords()
self:release()
SetActive(uiobjs.DetailRoot.gameObject, false)

View File

@@ -15,6 +15,7 @@ function TRPOrderList:init(csObj)
uiobjs.ButtonFilterLb = getCC(uiobjs.ButtonFilterSp.transform, "Label", "UILabel")
---@type CLUIScrollViewWithEvent
uiobjs.scrollView = getCC(self.transform, "PanelContent", "CLUIScrollViewWithEvent")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
uiobjs.scrollView:init(
self:wrapFunc(self.onShowRefreshFlg),
self:wrapFunc(self.onhideRefreshFlg),
@@ -131,13 +132,16 @@ function TRPOrderList:appList(list)
end
function TRPOrderList:onShowRefreshFlg()
-- printe("TRPOrderList:onShowRefreshFlg")
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 222, 0)
if uiobjs.Grid.list.Count > 0 then
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 222, 0)
else
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 100, 0)
end
SetActive(uiobjs.ButtonHeadList.gameObject, true)
end
function TRPOrderList:onhideRefreshFlg()
-- printe("TRPOrderList:onhideRefreshFlg")
SetActive(uiobjs.ButtonHeadList.gameObject, false)
-- uiobjs.scrollView:ResetPosition()
end
function TRPOrderList:refreshList()
local queryKey = uiobjs.InputSeachKey.value

View File

@@ -13,6 +13,7 @@ function TRPProductDetail:init(csObj)
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132, 0)
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
---@type UITable
uiobjs.Table = getCC(uiobjs.scrollView.transform, "Table", "UITable")
---@type CLUIFormRoot

View File

@@ -15,6 +15,7 @@ function TRPProductList:init(csObj)
uiobjs.InputSeachKey = getCC(self.transform, "Top/InputSeachKey", "UIInput")
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
---@type Coolape.CLUILoopGrid
uiobjs.Grid = getCC(uiobjs.scrollView.transform, "Grid", "CLUILoopGrid")
@@ -36,11 +37,15 @@ function TRPProductList:show()
end
function TRPProductList:showList(products)
SetActive(uiobjs.ButtonEndList.gameObject, false)
local list = {}
for i, v in ipairs(products or {}) do
table.insert(list, {data = v, isSelected = false})
end
if #list > 0 then
SetActive(uiobjs.ButtonEndList.gameObject, false)
else
SetActive(uiobjs.ButtonEndList.gameObject, true)
end
uiobjs.Grid:setList(list, self:wrapFunc(self.initCell), nil, self:wrapFunc(self.onEndList))
uiobjs.scrollView:ResetPosition()
end

View File

@@ -71,6 +71,11 @@ function TRPResetPasswordStep1:setEventDelegate()
end
local d = uiobjs.formRoot:getValue(self.mData, true)
d.phoneNo = d.phone
if self.mData.isBindPhone then
d.loginNo = DBUser.getMyInfor().loginNo
d.oprType = "updatePho"
end
NetProto.sendVerMsg(
d,
function(data, orgs)

View File

@@ -98,7 +98,17 @@ function TRPResetPasswordStep2:setEventDelegate()
end
if self.mData.isBindPhone then
-- 绑定号码
MyUtl.toastW("TODO:绑定号码")
local data = uiobjs.formRoot:getValue(self.mData, true)
NetProto.send.updateUserPhone(
data,
function(content)
if content.success then
hideTopPanel(self.csSelf)
hideTopPanel()
MyUtl.toastS("绑定手机号成功")
end
end
)
else
local data = uiobjs.formRoot:getValue(self.mData, true)
data.isModify = self.mData.isModify

View File

@@ -15,6 +15,7 @@ function TRPSelectProduct:init(csObj)
uiobjs.InputSeachKey = getCC(self.transform, "Top/InputSeachKey", "UIInput")
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
---@type Coolape.CLUILoopGrid
uiobjs.Grid = getCC(uiobjs.scrollView.transform, "Grid", "CLUILoopGrid")

View File

@@ -9,6 +9,8 @@ function TRPSelectServer:init(csObj)
TRPSelectServer.super.init(self, csObj)
self:setEventDelegate()
uiobjs.grid = getCC(self.transform, "Grid", "UIGrid")
uiobjs.gridPrefab = getChild(uiobjs.grid, "00000").gameObject
end
-- 设置数据
@@ -19,6 +21,16 @@ end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPSelectServer:show()
CLUIUtl.resetList4Lua(uiobjs.grid, uiobjs.gridPrefab, self.mdata.servers, self:wrapFunc(self.init))
end
function TRPSelectServer:initCell(cell, data)
cell:init(data, self:wrapFunc(self.onClickCell))
end
function TRPSelectServer:onClickCell(cell, data)
hideTopPanel(self.csSelf)
Utl.doCallback(self.mdata.callback, data)
end
-- 刷新
@@ -41,21 +53,22 @@ end
function TRPSelectServer:setEventDelegate()
self.EventDelegate = {
ButtonServer = function()
hideTopPanel(self.csSelf)
NetProto.setSeverPublish()
Utl.doCallback(self.mdata.callback)
end,
ButtonServerDev = function()
hideTopPanel(self.csSelf)
NetProto.setSeverDev()
Utl.doCallback(self.mdata.callback)
end,
ButtonServerLoc = function()
hideTopPanel(self.csSelf)
NetProto.setSeverLocal()
Utl.doCallback(self.mdata.callback)
end
-- ButtonServer = function()
-- hideTopPanel(self.csSelf)
-- -- NetProto.setSeverPublish()
-- local server = {version = "11212222121"}
-- Utl.doCallback(self.mdata.callback, server)
-- end,
-- ButtonServerDev = function()
-- hideTopPanel(self.csSelf)
-- -- NetProto.setSeverDev()
-- Utl.doCallback(self.mdata.callback)
-- end,
-- ButtonServerLoc = function()
-- hideTopPanel(self.csSelf)
-- -- NetProto.setSeverLocal()
-- Utl.doCallback(self.mdata.callback)
-- end
}
end
-- 处理ui上的事件例如点击等
@@ -70,5 +83,9 @@ end
function TRPSelectServer:onTopPanelChange(topPanel)
end
-- 当按了返回键时关闭自己返值为true时关闭
function TRPSelectServer:hideSelfOnKeyBack()
return false
end
--------------------------------------------
return TRPSelectServer

View File

@@ -11,7 +11,7 @@ function TRPSetting:init(csObj)
MyUtl.setContentView(uiobjs.content)
---@type UIScrollView
uiobjs.scrollview = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
self:setEventDelegate()
uiobjs.LabelPhone = getCC(uiobjs.scrollview.transform, "Table/ButtonPhone/LabelPhone", "UILabel")
end

View File

@@ -12,10 +12,11 @@ function TRPSysMsgDetail:init(csObj)
self.uiobjs = {}
---@type UIScrollView
self.uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
self.uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
MyUtl.setContentView(self.uiobjs.scrollView, 132 + 100 + 56 + 25 + 30 + 45, 0)
self.uiobjs.LabelContent = getCC(self.uiobjs.scrollView.transform, "LabelContent", "UILabel")
self.uiobjs.LabelTitle = getCC(self.transform, "LabelTitle", "UILabel")
self.uiobjs.LabelTime = getCC(self.transform, "LabelTime", "UILabel")
self.uiobjs.LabelTitle = getCC(self.transform, "Top/LabelTitle", "UILabel")
self.uiobjs.LabelTime = getCC(self.transform, "Top/LabelTime", "UILabel")
end
-- 设置数据

View File

@@ -91,6 +91,11 @@ end
---@param data _DBMessage
function TRPSysMsgList:onClickCell(cell, data)
if data.NOTICETYPE == DBMessage.MsgType.Sys then
NetProto.send.readNotice(data.ID, function(content)
if content.success then
data.READFLAG = DBMessage.ReadFlag.readed
end
end)
getPanelAsy("PanelSysMsgDetail", onLoadedPanelTT, data)
elseif data.NOTICETYPE == DBMessage.MsgType.Task4Cust then
getPanelAsy("PanelCustListProc", onLoadedPanelTT, data)

View File

@@ -0,0 +1,346 @@
---@type IDBasePanel
local TRBasePanel = require("ui.panel.TRBasePanel")
---@class TRPTaskList:TRBasePanel
local TRPTaskList = class("TRPTaskList", TRBasePanel)
local uiobjs = {}
-- 初始化,只会调用一次
function TRPTaskList:init(csObj)
TRPTaskList.super.init(self, csObj)
self:setEventDelegate()
self:initFilters()
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132 + 132 + 40, 0)
uiobjs.InputSeachKey = getCC(self.transform, "Top/InputSeachKey", "UIInput")
uiobjs.ButtonFilterSp = getCC(self.transform, "Top/ButtonFilter", "UISprite")
uiobjs.ButtonFilterLb = getCC(uiobjs.ButtonFilterSp.transform, "Label", "UILabel")
---@type CLUIScrollViewWithEvent
uiobjs.scrollView = getCC(self.transform, "PanelContent", "CLUIScrollViewWithEvent")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
uiobjs.scrollView:init(
self:wrapFunc(self.onShowRefreshFlg),
self:wrapFunc(self.onhideRefreshFlg),
self:wrapFunc(self.refreshList)
)
---@type Coolape.CLUILoopGrid
uiobjs.Grid = getCC(uiobjs.scrollView.transform, "Grid", "CLUILoopGrid")
uiobjs.ButtonEndList = getChild(uiobjs.Grid.transform, "ButtonEndList")
uiobjs.ButtonEndListLb = getCC(uiobjs.ButtonEndList, "Label", "UILabel")
uiobjs.ButtonHeadList = getChild(uiobjs.Grid.transform, "ButtonHeadList")
---@type UIToggle
uiobjs.ToggleTody = getCC(self.transform, "Top/SpriteToggle/ToggleTody", "UIToggle")
end
function TRPTaskList:initFilters()
self.filters = {}
local d = {}
d.title = "订单分类"
d.key = DBOrder.PopListGroup.orderType
d.key2 = "myWfType"
d.list = DBOrder.getFilter(DBOrder.PopListGroup.orderType)
if #(d.list) > 0 then
-- table.insert(d.list, 1, {name = "全部", value = -1})
table.insert(self.filters, d)
end
d = {}
d.title = "订单状态"
d.key = DBOrder.PopListGroup.orderStatus
d.key2 = "status"
d.list = DBOrder.getFilter(DBOrder.PopListGroup.orderStatus)
if #(d.list) > 0 then
-- table.insert(d.list, 1, {name = "全部", value = -1})
table.insert(self.filters, d)
end
d = {}
d.title = "回款订单"
d.key = DBOrder.PopListGroup.payOrderStatus
d.key2 = "payStatus"
d.list = DBOrder.getFilter(DBOrder.PopListGroup.payOrderStatus)
if #(d.list) > 0 then
-- table.insert(d.list, 1, {name = "全部", value = -1})
table.insert(self.filters, d)
end
d = {}
d.title = "跟进人员"
d.key = "loginNos"
d.key2 = "createLoginNo"
d.list = DBUser.getFilters(DBUser.FilterGroup.user)
if d.list and #(d.list) > 0 then
-- table.insert(d.list, 1, {name = "全部", value = -1})
table.insert(self.filters, d)
end
d = {}
d.title = "所属部门"
d.key = DBUser.FilterGroup.group
d.key2 = "groupId"
d.list = DBUser.getFilters(DBUser.FilterGroup.group)
if #(d.list) > 0 then
-- table.insert(d.list, 1, {name = "全部", value = -1})
table.insert(self.filters, d)
end
end
function TRPTaskList:resetFilters()
for i, v in ipairs(self.filters) do
if v.list then
for j, f in ipairs(v.list) do
f.selected = false
end
else
v.value = ""
end
end
end
-- 设置数据
---@param paras _ParamTRPTaskList
function TRPTaskList:setData(paras)
self.mdata = paras
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPTaskList:show()
uiobjs.InputSeachKey.value = ""
self:resetFilters()
self:refreshFilterBtnStatus()
self:showList({})
if uiobjs.ToggleTody.value then
self.filterValue = {}
local date = DateEx.formatByMs(DateEx.nowMS, DateEx.fmt_yyyy_MM_dd)
self.filterValue.startTime = joinStr(date, " 00:00:00")
self.filterValue.endTime = joinStr(date, " 23:59:59")
if self.mdata and self.mdata.custId then
self.filterValue.custId = self.mdata.custId
end
NetProto.send.list_followUp_tasks(self.filterValue, "", 1)
else
uiobjs.ToggleTody:Set(true)
end
end
function TRPTaskList:showList(list)
list = list or {}
SetActive(uiobjs.ButtonHeadList.gameObject, false)
if #list > 0 then
SetActive(uiobjs.ButtonEndList.gameObject, false)
else
SetActive(uiobjs.ButtonEndList.gameObject, true)
end
uiobjs.Grid:setList(
list or {},
self:wrapFunc(self.initCell),
self:wrapFunc(self.onHeadList),
self:wrapFunc(self.onEndList)
)
uiobjs.scrollView:ResetPosition()
end
function TRPTaskList:appList(list)
SetActive(uiobjs.ButtonEndList.gameObject, false)
uiobjs.Grid:appendList(list)
end
function TRPTaskList:onShowRefreshFlg()
if uiobjs.Grid.list.Count > 0 then
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 222, 0)
else
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 100, 0)
end
SetActive(uiobjs.ButtonHeadList.gameObject, true)
end
function TRPTaskList:onhideRefreshFlg()
SetActive(uiobjs.ButtonHeadList.gameObject, false)
-- uiobjs.scrollView:ResetPosition()
end
function TRPTaskList:refreshList()
local queryKey = uiobjs.InputSeachKey.value
showHotWheel()
NetProto.send.list_followUp_tasks(self.filterValue, queryKey, 1)
end
function TRPTaskList:onHeadList(head)
printw("到最顶端了")
-- uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 250, 0)
-- SetActive(uiobjs.ButtonHeadList.gameObject, true)
end
function TRPTaskList:onEndList(tail)
printw("到最后了==" .. tail.name)
if self.pageInfo and self.pageInfo.current_page < self.pageInfo.total_pages then
local queryKey = uiobjs.InputSeachKey.value
showHotWheel()
-- 取得下一页
NetProto.send.list_followUp_tasks(self.filterValue, queryKey, self.pageInfo.current_page + 1)
else
uiobjs.ButtonEndList.localPosition = tail.transform.localPosition + Vector3.up * -235
SetActive(uiobjs.ButtonEndList.gameObject, true)
end
end
function TRPTaskList:initCell(cell, data)
cell:init(data, self:wrapFunc(self.onClickCell))
end
function TRPTaskList:onClickCell(cell, data)
getPanelAsy("PanelNewFollowTask", onLoadedPanelTT, data)
end
function TRPTaskList:refreshFilterBtnStatus()
if self:hadFilterVal() then
uiobjs.ButtonFilterLb.color = ColorEx.getColor(0xff2990dc)
uiobjs.ButtonFilterSp.color = ColorEx.getColor(0xff2990dc)
uiobjs.ButtonFilterSp.spriteName = "cust_funnel"
else
uiobjs.ButtonFilterLb.color = ColorEx.getColor(0xff999999)
uiobjs.ButtonFilterSp.color = ColorEx.getColor(0xff999999)
uiobjs.ButtonFilterSp.spriteName = "cust_screen"
end
end
function TRPTaskList:hadFilterVal()
for i, v in ipairs(self.filters or {}) do
for j, f in ipairs(v.list) do
if f.selected then
return true
end
end
end
return false
end
-- 刷新
function TRPTaskList:refresh()
end
-- 关闭页面
function TRPTaskList:hide()
self.filterValue = nil
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPTaskList:procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
if cmd == NetProto.cmds.list_followUp_tasks then
local result = paras.result or {}
self.pageInfo = result.meta
if self.pageInfo and self.pageInfo.current_page > 1 then
self:appList(result.data)
else
self:showList(result.data)
end
hideHotWheel()
elseif cmd == NetProto.cmds.update_customer then
uiobjs.Grid:refreshContentOnly()
elseif cmd == NetProto.cmds.save_customer then
self:refreshList()
end
end
end
function TRPTaskList:setEventDelegate()
self.EventDelegate = {
ButtonFilter = function()
getPanelAsy(
"PanelComFilter",
onLoadedPanelTT,
{
title = "订单筛选",
callback = self:wrapFunc(self.onSetFilter),
queryKey = uiobjs.InputSeachKey.value,
defautFilter = self.filters
}
)
end,
InputSeachKey = function()
local queryKey = uiobjs.InputSeachKey.value
NetProto.send.list_followUp_tasks(self.filterValue, queryKey, 1)
end,
ToggleTody = function(go)
local toggle = go:GetComponent("UIToggle")
if toggle.value then
self.filterValue = {}
if self.mdata and self.mdata.custId then
self.filterValue.custId = self.mdata.custId
end
local date = DateEx.formatByMs(DateEx.nowMS, DateEx.fmt_yyyy_MM_dd)
self.filterValue.startTime = joinStr(date, " 00:00:00")
self.filterValue.endTime = joinStr(date, " 23:59:59")
NetProto.send.list_followUp_tasks(self.filterValue, "", 1)
end
end,
ToggleNext = function(go)
local toggle = go:GetComponent("UIToggle")
if toggle.value then
self.filterValue = {}
if self.mdata and self.mdata.custId then
self.filterValue.custId = self.mdata.custId
end
local date = DateEx.formatByMs(DateEx.nowMS, DateEx.fmt_yyyy_MM_dd)
self.filterValue.startTime = joinStr(date, " 23:59:59")
NetProto.send.list_followUp_tasks(self.filterValue, "", 1)
end
end,
ToggleHis = function(go)
local toggle = go:GetComponent("UIToggle")
if toggle.value then
self.filterValue = {}
if self.mdata and self.mdata.custId then
self.filterValue.custId = self.mdata.custId
end
local date = DateEx.formatByMs(DateEx.nowMS, DateEx.fmt_yyyy_MM_dd)
self.filterValue.endTime = joinStr(date, " 00:00:00")
NetProto.send.list_followUp_tasks(self.filterValue, "", 1)
end
end
}
end
function TRPTaskList:getFilterStr()
if not self.filters then
return ""
end
local ret = {}
for i, g in ipairs(self.filters) do
local list = {}
for j, f in ipairs(g.list) do
if f.selected and f.value ~= -1 then
table.insert(list, f.value)
end
end
ret[g.key2] = table.concat(list, ",")
end
return ret
end
function TRPTaskList:onSetFilter(filters, queryKey)
local oldqueryKey = uiobjs.InputSeachKey.value
uiobjs.InputSeachKey.value = queryKey
self.filters = filters
self:refreshFilterBtnStatus()
local queryKey = uiobjs.InputSeachKey.value
queryKey = trim(queryKey)
showHotWheel()
self.filterValue = self:getFilterStr()
if oldqueryKey == queryKey then
NetProto.send.list_followUp_tasks(self.filterValue, queryKey, 1)
else
-- 会触发input的onChange事件
end
end
-- 处理ui上的事件例如点击等
function TRPTaskList:uiEventDelegate(go)
local func = self.EventDelegate[go.name]
if func then
func(go)
end
end
-- 当顶层页面发生变化时回调
function TRPTaskList:onTopPanelChange(topPanel)
end
--------------------------------------------
return TRPTaskList

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ba1ac9025b46845d49a2c47bda0b6ca6
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: