This commit is contained in:
2020-08-17 11:13:33 +08:00
parent 19e730574b
commit 21eb68aeab
93 changed files with 6713 additions and 143 deletions

View File

@@ -73,9 +73,10 @@ function CLLMainLua.setAndroidStatusBar()
return
end
local mode = SystemInfo.deviceModel
if string.find(string.upper(mode), "HUAWEI")
and "HUAWEI BAC-TL00" ~= mode -- 齐川的手机
then
if string.find(string.upper(mode), "HUAWEI") and "HUAWEI BAC-TL00" ~= mode then -- 齐川的手机
AndroidStatusBar.setFlags(AndroidStatusBar.WINDOW_FLAG_FORCE_NOT_FULLSCREEN)
AndroidStatusBar.setColor(AndroidStatusBar.DEFAULT_BACKGROUND_COLOR)
elseif "OPPO PCCM00" == mode then
AndroidStatusBar.setFlags(AndroidStatusBar.WINDOW_FLAG_FORCE_NOT_FULLSCREEN)
AndroidStatusBar.setColor(AndroidStatusBar.DEFAULT_BACKGROUND_COLOR)
else

View File

@@ -1,4 +1,4 @@
DBTextures = {}
DBAttachment = {} -- 附件相关
local db = {}
local dbUploadStatus = {}
@@ -6,14 +6,16 @@ local isUploading = {}
local isDownoading = {}
local downloadCallback = {}
local downloadDir = Utl.chgToSDCard(Path.Combine(Application.persistentDataPath, CLPathCfg.self.basePath, "download"))
local _TimeOutSec = 6 * 60 * 60 * 1000
local invokeSec = 60
function DBTextures.init()
InvokeEx.cancelInvoke(DBTextures.releaseTimeout)
InvokeEx.invoke(DBTextures.releaseTimeout, 60)
function DBAttachment.init()
InvokeEx.cancelInvoke(DBAttachment.releaseTimeout)
InvokeEx.invoke(DBAttachment.releaseTimeout, invokeSec)
end
function DBTextures.clean()
InvokeEx.cancelInvoke(DBTextures.releaseTimeout)
function DBAttachment.clean()
InvokeEx.cancelInvoke(DBAttachment.releaseTimeout)
for k, v in ipairs(db) do
GameObject.DestroyImmediate(v)
end
@@ -29,17 +31,33 @@ function DBTextures.clean()
dbUploadStatus = {}
end
function DBTextures.releaseTimeout()
function DBAttachment.releaseTimeout()
for k, v in ipairs(db) do
if DateEx.nowMS - v.lastUseTime > 300000 then
if DateEx.nowMS - v.lastUseTime > 3000000 then
GameObject.DestroyImmediate(v.texture)
db[k] = nil
end
end
-- 删掉超时的文件
local files = FileEx.GetFiles(downloadDir)
local count = files.Length
for i = 0, count - 1 do
---@type System.IO.FileInfo
local fi = FileInfo(files[i])
if fi then
local diff = (DateTime.Now:ToFileTime() - fi.LastAccessTime:ToFileTime()) / 10000
if diff > _TimeOutSec then
FileEx.Delete(files[i])
end
end
end
InvokeEx.invoke(DBAttachment.releaseTimeout, invokeSec)
end
---@return UnityEngine.UnityWebRequest
function DBTextures.getByUrl(url, callback, orgs)
function DBAttachment.getByUrl(url, callback, orgs)
local tt = db[url]
if tt then
tt.lastUseTime = DateEx.nowMS
@@ -65,7 +83,7 @@ function DBTextures.getByUrl(url, callback, orgs)
return request
end
function DBTextures.upload(path, uploadPath, finishCallback)
function DBAttachment.upload(path, uploadPath, finishCallback)
local key = joinStr(path, "_", uploadPath)
if (not dbUploadStatus[key]) and (not isUploading[key]) then
local www =
@@ -91,7 +109,7 @@ function DBTextures.upload(path, uploadPath, finishCallback)
end
end
function DBTextures.cancelUpload(path, uploadPath)
function DBAttachment.cancelUpload(path, uploadPath)
local key = joinStr(path, "_", uploadPath)
local www = isUploading[key]
if www then
@@ -102,7 +120,7 @@ function DBTextures.cancelUpload(path, uploadPath)
end
end
function DBTextures.hadDownloaded(name)
function DBAttachment.hadDownloaded(name)
local localPath = Path.Combine(downloadDir, name)
if File.Exists(localPath) then
return true, localPath
@@ -110,7 +128,7 @@ function DBTextures.hadDownloaded(name)
return false, localPath
end
function DBTextures.download(name, url, callback)
function DBAttachment.download(name, url, callback)
downloadCallback[name] = callback
if isDownoading[name] then
return isDownoading[name]
@@ -153,4 +171,4 @@ function DBTextures.download(name, url, callback)
return www
end
return DBTextures
return DBAttachment

View File

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

View File

@@ -4,14 +4,14 @@ require "db.DBCust"
require "db.DBStatistics"
require "db.DBUser"
require "db.DBOrder"
require "db.DBTextures"
require "db.DBAttachment"
---@class DBRoot
DBRoot = {}
DBRoot.db = {}
DBRoot.init = function()
DBMessage.init()
DBTextures.init()
DBAttachment.init()
NetProto.setReceiveCMDCallback(DBRoot.onReceiveData)
end
@@ -20,7 +20,7 @@ DBRoot.clean = function()
DBMessage.clean()
DBCust.clean()
DBStatistics.clean()
DBTextures.clean()
DBAttachment.clean()
end
DBRoot.funcs = {

View File

@@ -3,6 +3,8 @@
---@field loginName
---@field groupId
---@field imageUrl string 头像
---@field char string 首字母
DBUser = {}
local db = {}
local icons = {}
@@ -22,13 +24,17 @@ function DBUser.clean()
rolePermission = {}
end
function DBUser.onGetUsers(list, groupList, permissions)
function DBUser.onGetUsers(userlist, groupList, permissions)
local options = ArrayList()
local values = ArrayList()
db.filters = {}
local name
db.filters[DBUser.FilterGroup.user] = {}
for i, v in ipairs(list) do
--------------------------------------------
for i, v in ipairs(userlist) do
v.PY = CLUIFormUtl.GetChineseSpell(v.loginName) -- 拼音首字母
v.PYFirst = v.PY[1] -- 设置首字母
if v.loginName == "系统生成" then
name = joinStr(v.loginNo, "_", v.loginName)
else
@@ -62,6 +68,20 @@ function DBUser.onGetUsers(list, groupList, permissions)
for i, v in ipairs(permissions) do
rolePermission[v] = true
end
DBUser.wrapUserList(userlist, groupList)
end
function DBUser.wrapUserList(userlist, groupList)
table.sort(
userlist,
function(a, b)
return string.byte(a.PY) < string.byte(b.PY)
end
)
-- for i, v in ipairs(userlist) do
-- printe(v.PY)
-- end
end
function DBUser.getFilters(group)

View File

@@ -280,7 +280,8 @@ MyFileOpen = CS.MyFileOpen
TextureFormat = CS.UnityEngine.TextureFormat
---@type UnityEngine.ImageConversion
ImageConversion = CS.UnityEngine.ImageConversion
---@type System.IO.FileInfo
FileInfo = CS.System.IO.FileInfo
-------------------------------------------------------
-------------------------------------------------------

View File

@@ -35,6 +35,7 @@ MyUtl.setContentView = function(go, top, bottom)
panel.clipOffset = Vector2.zero
panel.baseClipRegion = MyUtl.getUIContent(panel, top, bottom)
end
return panel.baseClipRegion
end
MyUtl.getSizeAdjust = function()
@@ -77,7 +78,7 @@ MyUtl.callCust = function(cust)
MyUtl.doCall(cust.custId, cust.phoneNo, cust)
end
end
---public 云拨号
MyUtl.doCall = function(custId, phoneNo, cust)
showHotWheel("拨号中...")
NetProto.send.bi_call(
@@ -94,6 +95,16 @@ MyUtl.doCall = function(custId, phoneNo, cust)
)
end
---public 调用系统拨打电话
MyUtl.callCustByNative = function(phoneNo, cust)
if CLUIFormUtl.callPhone then
CLUIFormUtl.callPhone(phoneNo)
else
Application.OpenURL(joinStr( "tel:", phoneNo))
end
getPanelAsy("PanelNewFollowSimple", onLoadedPanelTT, cust)
end
MyUtl.toast = function(msg, staySec)
CLToastRoot.toast(msg, CLToastRoot.Type.normal, staySec)
end

View File

@@ -35,7 +35,7 @@ function _cell.show(go, data)
SetActive(uiobjs.DownloadProgress.gameObject, false)
--//TODO:权限判断,如果有权限的可以考虑直接显示图片
if DBTextures.hadDownloaded(mData.name) then
if DBAttachment.hadDownloaded(mData.name) then
SetActive(uiobjs.ButtonDownload, false)
SetActive(uiobjs.SpriteRight, true)
else
@@ -57,7 +57,7 @@ function _cell.download()
isDownLoading = true
SetActive(uiobjs.ButtonDownload, false)
www =
DBTextures.download(
DBAttachment.download(
mData.name,
mData.url,
function(content, localPath)

View File

@@ -38,7 +38,7 @@ function _cell.show(go, data)
if uiobjs.texture.mainTexture and uiobjs.texture.mainTexture.name == mData.path then
else
_cell.release()
DBTextures.getByUrl(url, _cell.onGetTextue, mData.path)
DBAttachment.getByUrl(url, _cell.onGetTextue, mData.path)
end
SetActive(uiobjs.success.gameObject, false)
@@ -48,7 +48,7 @@ end
function _cell.upload()
SetActive(uiobjs.Failed.gameObject, false)
www =
DBTextures.upload(
DBAttachment.upload(
mData.path,
DBOrder.getUploadPath(),
function(content)
@@ -107,7 +107,7 @@ end
function _cell.uiEventDelegate(go)
if go.name == "ButtonDel" then
csSelf:cancelInvoke4Lua(_cell.refreshProgress)
DBTextures.cancelUpload(mData.path, DBOrder.getUploadPath())
DBAttachment.cancelUpload(mData.path, DBOrder.getUploadPath())
www = nil
Utl.doCallback(mData.onDelete, mData)
elseif go.name == "ButtonReload" then

View File

@@ -21,6 +21,8 @@ end
-- 注意c#侧不会在调用show时调用refresh
function _cell.show(go, data)
mData = data
mData._callerno = MyUtl.hidePhone(mData.callerno)
mData._destno = MyUtl.hidePhone(mData.destno)
uiobjs.formRoot:setValue(mData)
if not isNilOrEmpty(mData.recordfile) then
SetActive(uiobjs.ButtonPlayVoice.gameObject, true)

View File

@@ -0,0 +1,33 @@
-- xx单元
local _cell = {}
---@type Coolape.CLCellLua
local csSelf = nil
local transform = nil
local mData = nil
local uiobjs = {}
-- 初始化,只调用一次
function _cell.init(csObj)
csSelf = csObj
transform = csSelf.transform
--[[
上的组件getChild(transform, "offset", "Progress BarHong"):GetComponent("UISlider");
--]]
end
-- 显示,
-- 注意c#侧不会在调用show时调用refresh
function _cell.show(go, data)
mData = data
--[[
TODO:
--]]
end
-- 取得数据
function _cell.getData()
return mData
end
--------------------------------------------
return _cell

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0c5a5751e2f924a6abdab89e00841a0f
guid: 7b643c7c6e0b84e33b2df87e36f47099
DefaultImporter:
externalObjects: {}
userData:

View File

@@ -0,0 +1,103 @@
-- xx界面
local CLLPSendSms = {}
---@type Coolape.CLPanelLua
local csSelf = nil
---@type UnityEngine.Transform
local transform = nil
local uiobjs = {}
---@type _DBCust
local mdata
-- 初始化,只会调用一次
function CLLPSendSms.init(csObj)
csSelf = csObj
transform = csObj.transform
---@type CLUIFormRoot
uiobjs.offset = getCC(transform, "Bottom/offset", "CLUIFormRoot")
uiobjs.InputContentCell = getCC(uiobjs.offset.transform, "InputContent", "CLCellLua")
local attr = {}
attr.attrName = "短信内容"
attr.id = "body"
attr.attrType = DBCust.FieldType.multext
attr.ifMust = 1
attr.donotJoinKey = true
---@type _ParamCellExtendFiled
local param = {}
param.attr = attr
uiobjs.InputContentCell:init(param, nil)
end
-- 设置数据
function CLLPSendSms.setData(paras)
mdata = paras
end
--当有通用背板显示时的回调
function CLLPSendSms.onShowFrame()
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function CLLPSendSms.show()
uiobjs.offset:setValue({})
end
-- 刷新
function CLLPSendSms.refresh()
end
-- 关闭页面
function CLLPSendSms.hide()
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function CLLPSendSms.procNetwork(cmd, succ, msg, paras)
--[[
if(succ == NetSuccess) then
if(cmd == "xxx") then
-- TODO:
end
end
--]]
end
-- 处理ui上的事件例如点击等
function CLLPSendSms.uiEventDelegate(go)
local goName = go.name
if goName == "ButtonClose" then
hideTopPanel(csSelf)
elseif goName == "ButtonYunSend" then
local err = uiobjs.offset:checkValid()
if not isNilOrEmpty(err) then
MyUtl.toastW(err)
return
end
local data = uiobjs.offset:getValue(true)
MyUtl.toastW("//TODO:云发短信的接口")
elseif goName == "ButtonNativeSend" then
local err = uiobjs.offset:checkValid()
if not isNilOrEmpty(err) then
MyUtl.toastW(err)
return
end
local data = uiobjs.offset:getValue(true)
Application.OpenURL(joinStr("sms:", mdata.phoneNo, "?body=", data.body))
end
end
-- 当顶层页面发生变化时回调
function CLLPSendSms.onTopPanelChange(topPanel)
end
-- 当按了返回键时关闭自己返值为true时关闭
function CLLPSendSms.hideSelfOnKeyBack()
if NetProto and csSelf then
NetProto.removePanelListener(csSelf)
end
return true
end
--------------------------------------------
return CLLPSendSms

View File

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

View File

@@ -168,8 +168,8 @@ end
-- 更新安装游戏
function CLLPSplash.upgradeGame(url)
if not isNilOrEmpty(url) then
-- Application.OpenURL(url)
MyUtl.installNewApk(url)
Application.OpenURL(url)
-- MyUtl.installNewApk(url)
end
end

View File

@@ -48,6 +48,9 @@ function TRPConnect.procNetwork(cmd, succ, msg, paras)
if (cmd == "connect") then
-- socket正常
require "db.DBRoot"
if DBRoot then
DBRoot.clean()
end
DBRoot.init()
TRPConnect.getDataFromServer()
end
@@ -66,9 +69,6 @@ end
---public 从服务器取得数据
function TRPConnect.getDataFromServer()
if DBRoot then
DBRoot.clean()
end
NetProto.send.filter_customers(
function(content)
if content.success then

View File

@@ -536,7 +536,7 @@ function TRPCustDetail:procNetwork(cmd, succ, msg, paras)
uiobjs.OrderRoot:appendList(result.data)
end
end
elseif cmd == NetProto.cmds.update_customer then
elseif cmd == NetProto.cmds.update_customer or cmd == NetProto.cmds.create_followUp_record then
if self.currToggle == 1 then
self:showDetail()
uiobjs.Head:setValue(self.mdata)
@@ -548,6 +548,14 @@ function TRPCustDetail:procNetwork(cmd, succ, msg, paras)
if self.currToggle == 3 then
self:showOrders()
end
elseif cmd == NetProto.cmds.get_customerById then
if self.mdata.custId == paras.result.custId then
self.mdata = paras.result
if self.currToggle == 1 then
self:showDetail()
uiobjs.Head:setValue(self.mdata)
end
end
end
end
end

View File

@@ -221,7 +221,7 @@ function TRPCustList:procNetwork(cmd, succ, msg, paras)
hideHotWheel()
elseif cmd == NetProto.cmds.update_customer then
uiobjs.Grid:refreshContentOnly()
elseif cmd == NetProto.cmds.save_customer then
elseif cmd == NetProto.cmds.save_customer or cmd == NetProto.cmds.create_followUp_record then
self:refreshList()
elseif cmd == NetProto.cmds.delCustomerInfo or cmd == NetProto.cmds.backToGH then
self:refreshList()

View File

@@ -49,6 +49,7 @@ function TRPMoreProc4Cust:setEventDelegate()
hideTopPanel(self.csSelf)
end,
ButtonSendSM = function()
getPanelAsy("PanelSendSms", onLoadedPanelTT, self.mdata)
end,
ButtonMovetoOcean = function()
MyUtl.confirm(

View File

@@ -265,6 +265,7 @@ function TRPNewFollow:setEventDelegate()
-- 刷新预约的状态
self.bookingData.bookingDone = "1"
end
NetProto.send.get_customerById(self.cust.custId)
MyUtl.toastS("保存成功")
hideTopPanel(self.csSelf)
end

View File

@@ -294,7 +294,7 @@ function TRPOrderDetail:initAttachmentCell(cell, data)
end
function TRPOrderDetail:onClickAttachment(cell, data)
local had, path = DBTextures.hadDownloaded(data.name)
local had, path = DBAttachment.hadDownloaded(data.name)
if had then
CLUIUtl.showConfirm(
joinStr("附件已保存本地:", path),

View File

@@ -26,6 +26,8 @@ end
---@param paras _ParamTRPPlaySoundRecord
function TRPPlaySoundRecord:setData(paras)
self.mdata = paras
self.mdata._callerno = MyUtl.hidePhone(self.mdata.callerno)
self.mdata._destno = MyUtl.hidePhone(self.mdata.destno)
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh

View File

@@ -114,5 +114,10 @@ end
function TRPSelectCompany:onTopPanelChange(topPanel)
end
-- 当按了返回键时关闭自己返值为true时关闭
function TRPSelectCompany:hideSelfOnKeyBack()
return false
end
--------------------------------------------
return TRPSelectCompany

View File

@@ -0,0 +1,201 @@
---@type IDBasePanel
local TRBasePanel = require("ui.panel.TRBasePanel")
---@class TRPUserList:TRBasePanel 邮件列表
local TRPUserList = class("TRPUserList", TRBasePanel)
local _charList = {
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"#"
}
local uiobjs = {}
-- 初始化,只会调用一次
function TRPUserList:init(csObj)
TRPUserList.super.init(self, csObj)
self:setEventDelegate()
self:initFilters()
MyUtl.setContentView(
getChild(self.transform, "PanelContent"),
MyUtl.defaultTopHeight + MyUtl.defaultTopHeight + 160 + 40,
0
)
uiobjs.InputSeachKey = getCC(self.transform, "Top/InputSeachKey", "UIInput")
---@type CLUIScrollViewWithEvent
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
---@type Coolape.CLUILoopTable
uiobjs.Grid = getCC(uiobjs.scrollView.transform, "Grid", "CLUILoopTable")
uiobjs.indexGrid = getChild(self.transform, "AnchorTopRight/PanelScrollBar/Grid"):GetComponent("UIGrid")
uiobjs.indexPrefab = getChild(uiobjs.indexGrid.transform, "00000").gameObject
end
-- 设置数据
---@param paras _ParamTRPUserList
function TRPUserList:setData(paras)
self.mdata = paras or {}
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPUserList:show()
uiobjs.InputSeachKey.value = ""
local bottomHeight = 0
if self.mdata.isSelectMode then
bottomHeight = 180
end
local v4 =
MyUtl.setContentView(
getChild(self.transform, "PanelContent"),
MyUtl.defaultTopHeight + MyUtl.defaultTopHeight + 160 + 40,
bottomHeight
)
uiobjs.indexGrid.cellHeight = NumEx.getIntPart(v4.w / 27)
self:showList({})
end
function TRPUserList: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)
)
self:reposition()
self.csSelf:invoke4Lua(self.reposition, 0.1)
end
function TRPUserList:reposition()
uiobjs.scrollView:ResetPosition()
end
function TRPUserList:appList(list)
SetActive(uiobjs.ButtonEndList.gameObject, false)
uiobjs.Grid:appendList(list)
end
function TRPUserList:initCell(cell, data)
cell:init(data, self:wrapFunc(self.onClickCell))
end
function TRPUserList:onClickCell(cell, data)
-- getPanelAsy("PanelOrderDetail", onLoadedPanelTT, data)
end
function TRPUserList:setIndexs()
local onClickCell = function(cell)
local d = cell.luaTable.getData()
local index = d.index
if (index >= 0) then
local userList = GLData.userList
local listPart1 = {}
for i = index, #userList do
table.insert(listPart1, userList[i])
end
CLLPUserList.setList(listPart1)
local listPart2 = {}
for i = 1, index - 1 do
table.insert(listPart2, userList[i])
end
uiobjs.Grid:insertList(listPart2, false, true)
end
end
local initCell = function(cell, data)
local label = getChild(cell.transform, "Label"):GetComponent("UILabel")
local boxCollider = cell:GetComponent("BoxCollider")
boxCollider.center = Vector3(0, -uiobjs.indexGrid.cellHeight / 2, 0)
boxCollider.size = Vector3(uiobjs.indexGrid.cellWidth, uiobjs.indexGrid.cellHeight, 0)
local d = GLData.userCharMap[data]
cell:init(d, onClickCell)
label.text = data
end
CLUIUtl.resetList4Lua(uiobjs.indexGrid, uiobjs.indexPrefab, _charList, initCell)
end
-- 刷新
function TRPUserList:refresh()
end
-- 关闭页面
function TRPUserList:hide()
self.filterValue = nil
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPUserList:procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
if cmd == NetProto.cmds.workFlowQuery 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 TRPUserList:setEventDelegate()
self.EventDelegate = {
InputSeachKey = function()
local queryKey = uiobjs.InputSeachKey.value
NetProto.send.workFlowQuery(self.filterValue, queryKey, 1)
end
}
end
-- 处理ui上的事件例如点击等
function TRPUserList:uiEventDelegate(go)
local func = self.EventDelegate[go.name]
if func then
func()
end
end
-- 当顶层页面发生变化时回调
function TRPUserList:onTopPanelChange(topPanel)
end
--------------------------------------------
return TRPUserList

View File

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