This commit is contained in:
2020-08-06 22:56:33 +08:00
parent d8127ddae2
commit 113faa50ce
50 changed files with 1480 additions and 855 deletions

View File

@@ -14,6 +14,12 @@ DBUser.FilterGroup = {
group = "group"
}
function DBUser.clean()
db = {}
poplist = {}
rolePermission = {}
end
function DBUser.onGetUsers(list, groupList, permissions)
local options = ArrayList()
local values = ArrayList()
@@ -66,14 +72,18 @@ end
function DBUser.refreshUserInfor(loginNo, loginName)
local infor = DBUser.getPopList(DBUser.FilterGroup.user)
for i, v in ipairs(infor.values or {}) do
if v == loginNo then
infor.options[i] = loginName
break
if infor and infor.values then
local count = infor.values.Count
for i = 0, count - 1 do
local v = infor.values[i]
if v == loginNo then
infor.options[i] = loginName
break
end
end
end
local list = DBUser.getFilters(DBUser.FilterGroup.user)
local list = DBUser.getFilters(DBUser.FilterGroup.user) or {}
for i, v in ipairs(list or {}) do
if v.value == loginNo then
v.name = loginNo

View File

@@ -13,7 +13,6 @@ local port = 29004
local baseUrl = joinStr("http://", host, ":", port, "/open_api/")
local socketUrl = joinStr("ws://", host, ":", port, "/tr_socket/websocket/")
NetProto.setSever = function(_host, _port)
host = _host
port = _port
@@ -84,12 +83,15 @@ local dispatch = function(content, params)
for k, p in pairs(PanelListener) do
ListenerQueue:enQueue(p)
end
---@type Coolape.CLPanelLua
local p
while (ListenerQueue:size() > 0) do
---@type coolape.Coolape.CLPanelBase
p = ListenerQueue:deQueue()
if p then
if p and (not p:IsNull()) and p.gameObject.activeInHierarchy then
p:procNetwork(cmd, code, msg, map)
else
NetProto.removePanelListener(p)
end
end
end
@@ -212,14 +214,14 @@ end
---@param p Coolape.CLPanelBase
function NetProto.addPanelListener(p)
if p then
PanelListener[p] = p
PanelListener[p.name] = p
end
end
---@param p Coolape.CLPanelBase
function NetProto.removePanelListener(p)
if p then
PanelListener[p] = nil
PanelListener[p.name] = nil
end
end
@@ -300,7 +302,7 @@ NetProto.cmds = {
updateUserInfo = "updateUserInfo", -- 更新用户信息
updateUserPhone = "updateUserPhone", -- 更新用户手机号
get_customerById = "get_customerById", -- 取得客户
readNotice = "readNotice", -- 已读公告
readNotice = "readNotice" -- 已读公告
}
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
@@ -616,7 +618,7 @@ NetProto.send.selectProductInfo = function(searchKey, page, callback, timeOutSec
NetProto.sendSocket(content, callback, timeOutSec)
end
NetProto.send.createWfInfo = function(workFlowInfo, callback, timeOutSec)
NetProto.send.createWfInfo = function(workFlowInfo, wfOptions, callback, timeOutSec)
local content = {}
content.action = NetProto.cmds.createWfInfo
local user = DBUser.getUserById(NetProto.loginNo)
@@ -625,6 +627,7 @@ NetProto.send.createWfInfo = function(workFlowInfo, callback, timeOutSec)
content.loginNo = NetProto.loginNo
content.groupId = NetProto.groupId
content.workFlowInfo = workFlowInfo
content.wfOptions = wfOptions
NetProto.sendSocket(content, callback, timeOutSec)
end

View File

@@ -75,6 +75,9 @@ end
-- 当按了返回键时关闭自己返值为true时关闭
function CLLPPopList.hideSelfOnKeyBack()
if NetProto and csSelf then
NetProto.removePanelListener(csSelf)
end
return true
end

View File

@@ -211,6 +211,9 @@ end
-- 当按了返回键时关闭自己返值为true时关闭
function CLLPPopTime.hideSelfOnKeyBack()
if NetProto and csSelf then
NetProto.removePanelListener(csSelf)
end
return true
end

View File

@@ -93,6 +93,9 @@ end
-- 当按了返回键时关闭自己返值为true时关闭
function CLLPWebView.hideSelfOnKeyBack()
if NetProto and csSelf then
NetProto.removePanelListener(csSelf)
end
return true
end

View File

@@ -48,6 +48,10 @@ function CSPMain.setBottomBtns()
CLUIUtl.resetList4Lua(objs.bottomGrid, objs.bottomCellPrefab, bottomBtns, CSPMain.initBottomBtn)
end
function CSPMain.refreshBtns()
CLUIUtl.resetList4Lua(objs.bottomGrid, objs.bottomCellPrefab, bottomBtns, CSPMain.initBottomBtn2)
end
function CSPMain.initBottomBtn(cell, data)
data.width = objs.bottomGrid.cellWidth
cell:init(data, CSPMain.onClickBottonBtn)
@@ -56,6 +60,10 @@ function CSPMain.initBottomBtn(cell, data)
end
end
function CSPMain.initBottomBtn2(cell, data)
cell:init(data, CSPMain.onClickBottonBtn)
end
function CSPMain.onClickBottonBtn(cell, data)
cell.luaTable.setSelected(true)
objs.LabelTitle.text = data.name
@@ -77,13 +85,11 @@ end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function CSPMain.procNetwork(cmd, succ, msg, paras)
--[[
if(succ == 1) then
if(cmd == "xxx") then
-- TODO:
end
if (succ == NetSuccess) then
if cmd == NetProto.cmds.readNotice then
CSPMain.refreshBtns()
end
--]]
end
end
-- 处理ui上的事件例如点击等

View File

@@ -27,6 +27,9 @@ end
-- 当按了返回键时关闭自己返值为true时关闭
function TRBasePanel:hideSelfOnKeyBack()
if NetProto and self.csSelf then
NetProto.removePanelListener(self.csSelf)
end
return true
end

View File

@@ -38,6 +38,8 @@ function TRPCustDetailSimple:init(csObj)
uiobjs.starGridPrefab2 = getChild(uiobjs.starGrid2.transform, "00000").gameObject
uiobjs.ExtendRoot = getCC(uiobjs.Table.transform, "ExtendRoot", "CLCellLua")
uiobjs.SysRoot = getCC(uiobjs.Table.transform, "SysRoot", "CLCellLua")
uiobjs.ButtonGet = getChild(self.transform, "AnchorBottom/offset/ButtonGet").gameObject
end
function TRPCustDetailSimple:prepareMoreData()
@@ -107,8 +109,9 @@ end
-- 设置数据
---@param paras _ParamTRPCustDetailSimple
function TRPCustDetailSimple:setData(paras)
self.isShowButtonGet = paras.isShowButtonGet
---@type _DBCust
self.mdata = paras
self.mdata = paras.cust
self.mdata._phoneNo = MyUtl.hidePhone(self.mdata.phoneNo)
if type(self.mdata.jsonStr) == "string" then
self.mdata.jsonStr = json.decode(self.mdata.jsonStr)
@@ -130,6 +133,12 @@ end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPCustDetailSimple:show()
SetActive(uiobjs.ButtonGet, self.isShowButtonGet or false)
if self.isShowButtonGet then
MyUtl.setContentView(getChild(self.transform, "PanelContent"), MyUtl.defaultTopHeight + 400 + 40, 200)
else
MyUtl.setContentView(getChild(self.transform, "PanelContent"), MyUtl.defaultTopHeight + 400 + 40, 0)
end
self.records = nil
self.orders = nil
local optionInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.dealFlagList)

View File

@@ -307,6 +307,11 @@ function TRPMyInfor:onGetImage(path)
function(content)
hideHotWheel()
if content and content.success then
local user = DBUser.getUserById(self.mdata.loginNo)
if user then
user.imageUrl = joinStr("file://", path)
self:setHeadInfor()
end
NetProto.send.personal_data_query()
MyUtl.toastS("头像更改成功")
else

View File

@@ -396,7 +396,7 @@ function TRPNewCust:setEventDelegate()
cust,
function(content)
if content.success then
getPanelAsy("PanelCustDetail", onLoadedPanel, cust)
getPanelAsy("PanelCustDetail", onLoadedPanel, content.result)
end
hideHotWheel()
end

View File

@@ -24,6 +24,7 @@ function TRPNewFollow:init(csObj)
uiobjs.DetailRootTabel = uiobjs.DetailRoot:GetComponent("UITable")
uiobjs.ButtonSave = getChild(self.transform, "Top/ButtonSave")
uiobjs.ButtonCustDetail = getChild(self.transform, "ButtonCustDetail")
end
---public 当有通用背板显示时的回调
@@ -130,6 +131,18 @@ end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPNewFollow:show()
if self.isNewFollow then
SetActive(uiobjs.ButtonCustDetail.gameObject, false)
else
---@type Coolape.CLPanelLua
local panel = CLPanelManager.getPanel("PanelCustDetail")
if panel and panel.gameObject.activeInHierarchy then
SetActive(uiobjs.ButtonCustDetail.gameObject, false)
else
SetActive(uiobjs.ButtonCustDetail.gameObject, true)
end
end
self:refreshContent()
SetActive(uiobjs.ButtonSave.gameObject, self.isNewFollow)
@@ -245,6 +258,25 @@ function TRPNewFollow:setEventDelegate()
end,
InputTask = function()
self:showExtentFiles(uiobjs.InputTask.value)
end,
ButtonCustDetail = function()
showHotWheel()
NetProto.send.get_customerById(
self.mdata.custId,
function(content)
hideHotWheel()
if content.success then
local cust = content.result
if cust then
getPanelAsy(
"PanelCustDetailSimple",
onLoadedPanelTT,
{cust = cust, isShowButtonGet = false}
)
end
end
end
)
end
}
end

View File

@@ -11,7 +11,7 @@ function TRPNewFollowTask:init(csObj)
TRPNewFollowTask.super.init(self, csObj)
self:initFiledsAttr()
self:setEventDelegate()
MyUtl.setContentView(getChild(self.transform, "PanelContent"), MyUtl.defaultTopHeight, 0)
MyUtl.setContentView(getChild(self.transform, "PanelContent"), MyUtl.defaultTopHeight, 190)
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
@@ -24,6 +24,7 @@ function TRPNewFollowTask:init(csObj)
uiobjs.DetailRootTabel = uiobjs.DetailRoot:GetComponent("UITable")
uiobjs.ButtonSave = getChild(self.transform, "Top/ButtonSave")
uiobjs.ButtonCustDetail = getChild(self.transform, "ButtonCustDetail")
end
function TRPNewFollowTask:initFiledsAttr()
@@ -94,9 +95,20 @@ function TRPNewFollowTask:onShowFrame(cs)
end
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPNewFollowTask:show()
if self.isNewFollow then
SetActive(uiobjs.ButtonCustDetail.gameObject, false)
else
---@type Coolape.CLPanelLua
local panel = CLPanelManager.getPanel("PanelCustDetail")
if panel and panel.gameObject.activeInHierarchy then
SetActive(uiobjs.ButtonCustDetail.gameObject, false)
else
SetActive(uiobjs.ButtonCustDetail.gameObject, true)
end
end
self:refreshContent()
SetActive(uiobjs.ButtonSave.gameObject, self.isNewFollow)
@@ -244,6 +256,25 @@ function TRPNewFollowTask:setEventDelegate()
end
end
)
end,
ButtonCustDetail = function()
showHotWheel()
NetProto.send.get_customerById(
self.mdata.custId,
function(content)
hideHotWheel()
if content.success then
local cust = content.result
if cust then
getPanelAsy(
"PanelCustDetailSimple",
onLoadedPanelTT,
{cust = cust, isShowButtonGet = false}
)
end
end
end
)
end
}
end

View File

@@ -576,16 +576,17 @@ function TRPNewOrder:setEventDelegate()
order.wfType = "0" -- 0正常工单1退货工单
-- 附件
local wfOptions = {}
if self.images and #(self.images) > 0 then
order.wfOptions = {}
for i, v in ipairs(self.images) do
table.insert(order.wfOptions, v.uploadInfor)
table.insert(wfOptions, v.uploadInfor)
end
end
-----------------------------------
showHotWheel()
NetProto.send.createWfInfo(
order,
wfOptions,
function(content)
if content.success then
MyUtl.toastS("订单创建成功")

View File

@@ -9,7 +9,11 @@ function TRPOceanList:init(csObj)
TRPOceanList.super.init(self, csObj)
self:setEventDelegate()
self:initFilters()
MyUtl.setContentView(getChild(self.transform, "PanelContent"), MyUtl.defaultTopHeight + MyUtl.defaultTopHeight + 40, 0)
MyUtl.setContentView(
getChild(self.transform, "PanelContent"),
MyUtl.defaultTopHeight + MyUtl.defaultTopHeight + 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")
@@ -165,7 +169,7 @@ function TRPOceanList:onClickCell(cell, data)
if content.success then
local cust = content.result
if cust then
getPanelAsy("PanelCustDetailSimple", onLoadedPanelTT, cust)
getPanelAsy("PanelCustDetailSimple", onLoadedPanelTT, {cust = cust, isShowButtonGet = true})
end
end
end

View File

@@ -65,7 +65,8 @@ function TRPSelectProduct:initCell(cell, data)
end
function TRPSelectProduct:onClickCell(cell, data)
getPanelAsy("PanelProductDetail", onLoadedPanelTT, data.data)
-- getPanelAsy("PanelProductDetail", onLoadedPanelTT, data.data)
cell.luaTable.selected(not data.isSelected)
end
function TRPSelectProduct:onEndList(tail)

View File

@@ -71,6 +71,9 @@ function TRPSetting:setEventDelegate()
function()
Prefs.setCurrGroup(Prefs.getUserName(), "")
Prefs.setUserPsd("")
if DBUser then
DBUser.clean()
end
hideTopPanel(self.csSelf)
hideTopPanel()
hideTopPanel()
@@ -91,7 +94,10 @@ function TRPSetting:setEventDelegate()
pcall(releaseRes4GC, true)
end
--- 释放资源结束-------------------------------
if DBUser then
DBUser.clean()
end
--//TODO: 还要把已经下载了的附件也删除掉
pcall(cleanRes)

View File

@@ -91,15 +91,18 @@ 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
self.uiobjs.LoopTable:refreshContentOnly()
if data.READFLAG == DBMessage.ReadFlag.unread then
-- 通知已读了
NetProto.send.readNotice(
data.ID,
function(content)
if content.success then
data.READFLAG = DBMessage.ReadFlag.readed
self.uiobjs.LoopTable:refreshContentOnly()
end
end
end
)
)
end
getPanelAsy("PanelSysMsgDetail", onLoadedPanelTT, data)
elseif data.NOTICETYPE == DBMessage.MsgType.Task4Cust then
getPanelAsy("PanelCustListProc", onLoadedPanelTT, data)