upgrade
This commit is contained in:
8
Assets/trCRM/upgradeRes4Dev/priority/lua/call.meta
Normal file
8
Assets/trCRM/upgradeRes4Dev/priority/lua/call.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c210528f1598d4214a62b6007734f57d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
226
Assets/trCRM/upgradeRes4Dev/priority/lua/call/CLLCallListner.lua
Normal file
226
Assets/trCRM/upgradeRes4Dev/priority/lua/call/CLLCallListner.lua
Normal file
@@ -0,0 +1,226 @@
|
||||
-- 去电监听
|
||||
CLLCallListner = {}
|
||||
local Permission
|
||||
if CLPathCfg.self.platform == "Android" then
|
||||
Permission = CS.UnityEngine.Android.Permission
|
||||
end
|
||||
|
||||
---@type CallListner
|
||||
local csSelf = CallListner.self
|
||||
local transform = nil
|
||||
local dataUploadQueue = Queue()
|
||||
local isWaiting4IncomeCall = false
|
||||
local endIncomeCallParms
|
||||
|
||||
local permissions = {
|
||||
"android.permission.RECORD_AUDIO",
|
||||
"android.permission.CALL_PHONE",
|
||||
"android.permission.WRITE_EXTERNAL_STORAGE",
|
||||
"android.permission.READ_EXTERNAL_STORAGE",
|
||||
"android.permission.READ_PHONE_STATE",
|
||||
"android.permission.READ_CALL_LOG",
|
||||
"android.permission.WRITE_CALL_LOG"
|
||||
}
|
||||
|
||||
-- 初始化,只会调用一次
|
||||
function CLLCallListner.init(csObj)
|
||||
csSelf = csObj
|
||||
transform = csObj.transform
|
||||
end
|
||||
|
||||
function CLLCallListner.checkAndSetUserPermission(callback)
|
||||
if not CLLCallListner.hadUserPermission() then
|
||||
CLLCallListner.checkUserPermission()
|
||||
InvokeEx.invoke(CLLCallListner.checkAndSetUserPermission, callback, 2)
|
||||
else
|
||||
Utl.doCallback(callback)
|
||||
end
|
||||
end
|
||||
|
||||
function CLLCallListner.ready2Call(callback, custPhone)
|
||||
local soundRecordFile = CLLRecordMgr.getSoundRecordFile()
|
||||
local orgs = Hashtable()
|
||||
orgs.callback = callback
|
||||
orgs.soundRecordFile = soundRecordFile
|
||||
orgs.phone = custPhone
|
||||
orgs.created_time = DateEx.nowString()
|
||||
orgs.answered_time = DateEx.nowString()
|
||||
|
||||
csSelf:ready2Call(soundRecordFile, JSON.JsonEncode(orgs))
|
||||
end
|
||||
|
||||
function CLLCallListner.waite4Callback(ors)
|
||||
isWaiting4IncomeCall = true
|
||||
endIncomeCallParms = ors
|
||||
csSelf:waite4Callback(ors)
|
||||
end
|
||||
|
||||
function CLLCallListner.hadUserPermission()
|
||||
-- return csSelf:hadUserPermission()
|
||||
if CLPathCfg.self.platform == "Android" and Permission then
|
||||
for i, v in ipairs(permissions) do
|
||||
if not Permission.HasUserAuthorizedPermission(v) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function CLLCallListner.checkUserPermission()
|
||||
if CLPathCfg.self.platform == "Android" and Permission then
|
||||
for i, v in ipairs(permissions) do
|
||||
if not Permission.HasUserAuthorizedPermission(v) then
|
||||
Permission.RequestUserPermission(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--电话接通
|
||||
function CLLCallListner.onConectedOutGoingCall(recordFile)
|
||||
print("CLLCallListner.onConectedOutGoingCall===" .. recordFile)
|
||||
end
|
||||
|
||||
function CLLCallListner.prepareMedia(soundUrl, onPrepareMedia, onMediaComplet, onMediaSeek, onMediaError, orgs)
|
||||
orgs.onPrepareMedia = onPrepareMedia
|
||||
orgs.onMediaComplet = onMediaComplet
|
||||
orgs.onMediaSeek = onMediaSeek
|
||||
orgs.onMediaError = onMediaError
|
||||
csSelf:prepareMedia(soundUrl, JSON.JsonEncode(orgs))
|
||||
end
|
||||
|
||||
function CLLCallListner.play()
|
||||
csSelf:playMedia()
|
||||
end
|
||||
|
||||
function CLLCallListner.pause()
|
||||
csSelf:pauseMedia()
|
||||
end
|
||||
|
||||
function CLLCallListner.stop()
|
||||
csSelf:stopMedia()
|
||||
end
|
||||
|
||||
function CLLCallListner.destroyMedia()
|
||||
csSelf:destroyMedia()
|
||||
end
|
||||
|
||||
function CLLCallListner.seekMedia(progress)
|
||||
csSelf:seekMedia(progress)
|
||||
end
|
||||
|
||||
function CLLCallListner.getMediaProgress()
|
||||
return csSelf:getMediaProgress()
|
||||
end
|
||||
|
||||
-- function CLLCallListner.Update()
|
||||
-- if (dataUploadQueue.Count > 0) then
|
||||
-- local d = dataUploadQueue:Dequeue()
|
||||
-- CLLCallListner.doCallbackProc(d)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
----------------------------------------------------------
|
||||
-- 当通话结速
|
||||
function CLLCallListner.onEndOutGoingCall(jsonStr)
|
||||
print("CLLCallListner.onEndOutGoingCall=====" .. jsonStr)
|
||||
CLLCallListner.procEndCall(jsonStr)
|
||||
end
|
||||
|
||||
function CLLCallListner.onEndincomeCall(jsonStr)
|
||||
print("CLLCallListner.onEndincomeCall=====" .. jsonStr)
|
||||
CLLCallListner.procEndCallIncoming(jsonStr)
|
||||
end
|
||||
|
||||
function CLLCallListner.procEndCallIncoming(jsonStr)
|
||||
-- local data = json.decode(jsonStr)
|
||||
-- if (data == nil) then
|
||||
-- return
|
||||
-- end
|
||||
-- local orgsStr = data.orgs
|
||||
-- local orgs = (not isNilOrEmpty(orgsStr)) and json.decode(orgsStr) or nil
|
||||
local data = {}
|
||||
data.orgs = (not isNilOrEmpty(endIncomeCallParms)) and json.decode(endIncomeCallParms) or nil
|
||||
local incomingNumber = data.code
|
||||
if true then --//TODO:判断打进来的电话是否是回拨号码
|
||||
if isWaiting4IncomeCall then
|
||||
CLLCallListner.doCallbackProc(data)
|
||||
end
|
||||
isWaiting4IncomeCall = false
|
||||
end
|
||||
end
|
||||
|
||||
function CLLCallListner.procEndCall(jsonStr)
|
||||
local data = json.decode(jsonStr)
|
||||
if (data == nil) then
|
||||
return
|
||||
end
|
||||
local orgsStr = data.orgs
|
||||
local orgs = json.decode(orgsStr)
|
||||
orgs.over_time = DateEx.nowString()
|
||||
data.orgs = orgs
|
||||
CLLCallListner.doCallbackProc(data)
|
||||
end
|
||||
|
||||
function CLLCallListner.doCallbackProc(data)
|
||||
local orgs = data.orgs
|
||||
local callback = getLuaFunc(orgs.callback)
|
||||
if (callback ~= nil) then
|
||||
callback(orgs)
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
function CLLCallListner.onMediaPrepared(jsonStr)
|
||||
local data = json.decode(jsonStr)
|
||||
if (data == nil) then
|
||||
return
|
||||
end
|
||||
local mediaLen = data.code
|
||||
local orgsStr = data.orgs
|
||||
local orgs = json.decode(orgsStr)
|
||||
orgs.mediaLen = mediaLen
|
||||
orgs.callback = orgs.onPrepareMedia
|
||||
data.orgs = orgs
|
||||
dataUploadQueue:Enqueue(data)
|
||||
end
|
||||
|
||||
function CLLCallListner.onMediaComplet(jsonStr)
|
||||
local data = json.decode(jsonStr)
|
||||
if (data == nil) then
|
||||
return
|
||||
end
|
||||
local orgsStr = data.orgs
|
||||
local orgs = json.decode(orgsStr)
|
||||
orgs.callback = orgs.onMediaComplet
|
||||
data.orgs = orgs
|
||||
dataUploadQueue:Enqueue(data)
|
||||
end
|
||||
|
||||
function CLLCallListner.onMediaError(jsonStr)
|
||||
local data = json.decode(jsonStr)
|
||||
if (data == nil) then
|
||||
return
|
||||
end
|
||||
local orgsStr = data.orgs
|
||||
local orgs = json.decode(orgsStr)
|
||||
orgs.callback = orgs.onMediaError
|
||||
data.orgs = orgs
|
||||
dataUploadQueue:Enqueue(data)
|
||||
end
|
||||
|
||||
function CLLCallListner.onMediaSeek(jsonStr)
|
||||
local data = json.decode(jsonStr)
|
||||
if (data == nil) then
|
||||
return
|
||||
end
|
||||
local orgsStr = data.orgs
|
||||
local orgs = json.decode(orgsStr)
|
||||
orgs.callback = orgs.onMediaSeek
|
||||
data.orgs = orgs
|
||||
dataUploadQueue:Enqueue(data)
|
||||
end
|
||||
]]
|
||||
--------------------------------------------
|
||||
return CLLCallListner
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8e057cacf5ed44d49298c665577783d
|
||||
timeCreated: 1487389984
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
202
Assets/trCRM/upgradeRes4Dev/priority/lua/call/CLLRecordMgr.lua
Normal file
202
Assets/trCRM/upgradeRes4Dev/priority/lua/call/CLLRecordMgr.lua
Normal file
@@ -0,0 +1,202 @@
|
||||
-- 录音管理
|
||||
CLLRecordMgr = {}
|
||||
|
||||
local csSelf = RecordManager.self
|
||||
local isBegainUpload = false
|
||||
|
||||
local SoundRecordRoot = PStr.b():a(CLPathCfg.self.basePath):a("/SoundRecords/"):e()
|
||||
local SoundRecordFinishPath = PStr.b():a(SoundRecordRoot):a("Finished/"):e()
|
||||
local SoundRecordUploadPath = PStr.b():a(SoundRecordRoot):a("Upload/"):e()
|
||||
local isFinishUpload = false
|
||||
local isUploading = false
|
||||
local isInited = false
|
||||
local finishUploadQueue = Queue()
|
||||
|
||||
function CLLRecordMgr.getLocalRecord(recordName)
|
||||
local filePath = ""
|
||||
|
||||
filePath = PStr.b():a(CLLRecordMgr.getSoundRecordFinishPath()):a(recordName):e()
|
||||
if (File.Exists(filePath)) then
|
||||
return filePath
|
||||
end
|
||||
|
||||
filePath = PStr.b():a(CLLRecordMgr.getSoundRecordUploadPath()):a(recordName):e()
|
||||
if (File.Exists(filePath)) then
|
||||
return filePath
|
||||
end
|
||||
|
||||
filePath = PStr.b():a(CLLRecordMgr.getSoundRecordBasePath()):a(recordName):e()
|
||||
if (File.Exists(filePath)) then
|
||||
return filePath
|
||||
end
|
||||
end
|
||||
|
||||
function CLLRecordMgr.getData()
|
||||
return finishUploadQueue
|
||||
end
|
||||
|
||||
function CLLRecordMgr.init()
|
||||
--csSelf.host = Prefs.getHost();
|
||||
--csSelf.user = "app";
|
||||
--csSelf.password = "app";
|
||||
--csSelf.remotePath = "/";
|
||||
csSelf.url = "http://39.106.144.191:29002/httpService/uploadMp3"
|
||||
end
|
||||
|
||||
function CLLRecordMgr.begainUpload()
|
||||
if (isBegainUpload) then
|
||||
return
|
||||
end
|
||||
isBegainUpload = true
|
||||
CLLRecordMgr.uploadAll()
|
||||
end
|
||||
|
||||
function CLLRecordMgr.canUpload()
|
||||
local netState = Utl.getNetState()
|
||||
if isUploading then
|
||||
CLAlert.add("正在上传其它录音文件,请稍后再试!", Color.white, 1)
|
||||
return false
|
||||
elseif netState == "None" then
|
||||
CLAlert.add("网络不可用,无法上传!", Color.white, 1)
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function CLLRecordMgr.uploadAll()
|
||||
local netState = Utl.getNetState()
|
||||
if
|
||||
((netState == "WiFi" and (not Prefs.getisWifiRecord())) or
|
||||
(netState ~= "WiFi" and (not Prefs.getisMobileRecord())) or
|
||||
isUploading)
|
||||
then
|
||||
-- 只有wifi情况下上传
|
||||
csSelf:cancelInvoke4Lua(CLLRecordMgr.uploadAll)
|
||||
csSelf:invoke4Lua(CLLRecordMgr.uploadAll, nil, 5, true)
|
||||
return
|
||||
end
|
||||
|
||||
local localDir = CLLRecordMgr.getSoundRecordUploadPath()
|
||||
if (not Directory.Exists(localDir)) then
|
||||
return
|
||||
end
|
||||
local fileList = Directory.GetFiles(localDir)
|
||||
if (fileList ~= nil and fileList.Length > 0) then
|
||||
isUploading = true
|
||||
CLLRecordMgr.upLoad(fileList[0])
|
||||
else
|
||||
csSelf:cancelInvoke4Lua(CLLRecordMgr.uploadAll)
|
||||
csSelf:invoke4Lua(CLLRecordMgr.uploadAll, nil, 5, true)
|
||||
end
|
||||
end
|
||||
|
||||
-- 把录音文件移动到需要更新的目录中
|
||||
function CLLRecordMgr.moveRecord2Upload(soundFile)
|
||||
local recordName = Path.GetFileName(soundFile)
|
||||
local fromPath = PStr.b():a(CLLRecordMgr.getSoundRecordBasePath()):a(recordName):e()
|
||||
local desPath = PStr.b():a(CLLRecordMgr.getSoundRecordUploadPath()):a(recordName):e()
|
||||
FileEx.CreateDirectory(Path.GetDirectoryName(desPath))
|
||||
File.Move(fromPath, desPath)
|
||||
end
|
||||
|
||||
function CLLRecordMgr.upLoad(soudFile)
|
||||
isUploading = true
|
||||
CLLRecordMgr.init()
|
||||
print(soudFile)
|
||||
local recordName = Path.GetFileName(soudFile)
|
||||
local recordFile = PStr.b():a(CLLRecordMgr.getSoundRecordUploadPath()):a(recordName):e()
|
||||
if (File.Exists(recordFile)) then
|
||||
csSelf:upload(recordFile, CLLRecordMgr.onFinishUpload)
|
||||
else
|
||||
isUploading = false
|
||||
print("The file not exist.==" .. recordFile)
|
||||
end
|
||||
end
|
||||
|
||||
function CLLRecordMgr.onFinishUpload(ret, soundFile)
|
||||
print("CLLRecordMgr.onFinishUpload==" .. soundFile)
|
||||
isUploading = false
|
||||
|
||||
if (ret) then
|
||||
local m = JSON.DecodeMap(ret)
|
||||
if m.error == 0 then
|
||||
finishUploadQueue:Enqueue(Path.GetFileName(soundFile))
|
||||
end
|
||||
end
|
||||
isFinishUpload = true
|
||||
end
|
||||
|
||||
function CLLRecordMgr.getProgress(recordName)
|
||||
return csSelf:progress(Path.GetFileName(recordName))
|
||||
end
|
||||
|
||||
function CLLRecordMgr.Update()
|
||||
if (finishUploadQueue.Count > 0) then
|
||||
local uploadedRecord = finishUploadQueue:Dequeue()
|
||||
--通知服务器
|
||||
if (uploadedRecord ~= nil and uploadedRecord ~= "") then
|
||||
-- local soundName = Path.GetFileName(uploadedRecord);
|
||||
CLLNet.upgradeRecord(uploadedRecord)
|
||||
|
||||
-- Move path
|
||||
local fromPath = PStr.b():a(CLLRecordMgr.getSoundRecordUploadPath()):a(uploadedRecord):e()
|
||||
local desPath = PStr.b():a(CLLRecordMgr.getSoundRecordFinishPath()):a(uploadedRecord):e()
|
||||
FileEx.CreateDirectory(Path.GetDirectoryName(desPath))
|
||||
print("fromPath==" .. fromPath)
|
||||
print("desPath==" .. desPath)
|
||||
File.Move(fromPath, desPath)
|
||||
end
|
||||
end
|
||||
if (isFinishUpload) then
|
||||
isFinishUpload = false
|
||||
csSelf:cancelInvoke4Lua(CLLRecordMgr.uploadAll)
|
||||
csSelf:invoke4Lua(CLLRecordMgr.uploadAll, nil, 2, true)
|
||||
end
|
||||
end
|
||||
|
||||
function CLLRecordMgr.getSoundRecordBasePath()
|
||||
local sdCard = "/sdcard/"
|
||||
local basePath = PStr.b():a(sdCard):a(SoundRecordRoot):e()
|
||||
return basePath
|
||||
end
|
||||
|
||||
function CLLRecordMgr.getSoundRecordUploadPath()
|
||||
local sdCard = "/sdcard/"
|
||||
local basePath = PStr.b():a(sdCard):a(SoundRecordUploadPath):e()
|
||||
return basePath
|
||||
end
|
||||
|
||||
function CLLRecordMgr.getSoundRecordFinishPath()
|
||||
local sdCard = "/sdcard/"
|
||||
local basePath = PStr.b():a(sdCard):a(SoundRecordFinishPath):e()
|
||||
return basePath
|
||||
end
|
||||
|
||||
-- 取得录音文件名
|
||||
function CLLRecordMgr.getSoundRecordFile()
|
||||
local sdCard = "/sdcard/"
|
||||
if (sdCard == "" or (not Directory.Exists(sdCard))) then
|
||||
CLAlert.add("无法记录通话录音,请确认是否有SD卡", Color.white, 1)
|
||||
return ""
|
||||
end
|
||||
local basePath = PStr.b():a(sdCard):a(SoundRecordRoot):e()
|
||||
|
||||
local ret = PStr.b():a(basePath):a("app_"):a(Utl.uuid):a("_"):a(DateEx.nowMS):a(".mp3"):e()
|
||||
FileEx.CreateDirectory(Path.GetDirectoryName(ret))
|
||||
return ret
|
||||
end
|
||||
|
||||
function CLLRecordMgr.delRecords()
|
||||
local fileList = Directory.GetFiles(CLLRecordMgr.getSoundRecordBasePath())
|
||||
for i = 0, fileList.Length - 1 do
|
||||
FileEx.Delete(fileList[i])
|
||||
end
|
||||
fileList = Directory.GetFiles(CLLRecordMgr.getSoundRecordFinishPath())
|
||||
for i = 0, fileList.Length - 1 do
|
||||
FileEx.Delete(fileList[i])
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------
|
||||
return CLLRecordMgr
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f160e626a759c49e1ad86c524a24e782
|
||||
timeCreated: 1487643335
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -40,15 +40,17 @@ function DBAttachment.releaseTimeout()
|
||||
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])
|
||||
if Directory.Exists(downloadDir) then
|
||||
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
|
||||
end
|
||||
|
||||
@@ -91,6 +91,15 @@ DBCust.onGetFilter = function(data)
|
||||
]]
|
||||
end
|
||||
|
||||
DBCust.getTaskName = function(taskId)
|
||||
local list = DBCust.getFilter(DBCust.FilterGroup.taskList)
|
||||
for i, v in ipairs(list) do
|
||||
if tostring(v.value) == tostring(taskId) then
|
||||
return v.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
DBCust.getFieldsByTask = function(taskValue)
|
||||
if not taskValue then
|
||||
return {}
|
||||
|
||||
@@ -306,6 +306,7 @@ NetProto.cmds = {
|
||||
get_customerById = "get_customerById", -- 取得客户
|
||||
readNotice = "readNotice", -- 已读公告
|
||||
authorizedPhone = "authorizedPhone", -- 认证手机号
|
||||
preUpdatePho = "preUpdatePho", -- 绑定号码之前验证
|
||||
}
|
||||
---------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------
|
||||
@@ -757,5 +758,13 @@ NetProto.send.authorizedPhone = function(data, callback, timeOutSec)
|
||||
content.groupId = NetProto.groupId
|
||||
NetProto.sendSocket(content, callback, timeOutSec)
|
||||
end
|
||||
|
||||
NetProto.send.preUpdatePho = function(phoneNo, callback, timeOutSec)
|
||||
local content = {}
|
||||
content.action = NetProto.cmds.preUpdatePho
|
||||
content.phone = phoneNo
|
||||
content.groupId = NetProto.groupId
|
||||
NetProto.sendSocket(content, callback, timeOutSec)
|
||||
end
|
||||
------------------------------------------------------
|
||||
return NetProto
|
||||
|
||||
@@ -282,6 +282,8 @@ TextureFormat = CS.UnityEngine.TextureFormat
|
||||
ImageConversion = CS.UnityEngine.ImageConversion
|
||||
---@type System.IO.FileInfo
|
||||
FileInfo = CS.System.IO.FileInfo
|
||||
---@type CallListner
|
||||
CallListner = CS.CallListner
|
||||
-------------------------------------------------------
|
||||
|
||||
-------------------------------------------------------
|
||||
|
||||
@@ -79,7 +79,7 @@ MyUtl.callCust = function(cust)
|
||||
end
|
||||
end
|
||||
---public 云拨号
|
||||
MyUtl.doCall = function(custId, phoneNo, cust)
|
||||
MyUtl.doCall = function(custId, phoneNo, cust, callback)
|
||||
showHotWheel("拨号中...")
|
||||
NetProto.send.bi_call(
|
||||
custId,
|
||||
@@ -88,19 +88,64 @@ MyUtl.doCall = function(custId, phoneNo, cust)
|
||||
function(content)
|
||||
hideHotWheel()
|
||||
if content.success then
|
||||
MyUtl.toastS("拨号成功!")
|
||||
getPanelAsy("PanelNewFollowSimple", onLoadedPanelTT, cust)
|
||||
CLLCallListner.waite4Callback()
|
||||
local orgs = {}
|
||||
orgs.callback = "MyUtl.onEndincomingCall"
|
||||
orgs.custList = cust and {cust} or content.result
|
||||
orgs.phoneNo = phoneNo
|
||||
CLLCallListner.waite4Callback(json.encode(orgs))
|
||||
|
||||
MyUtl.toastS("拨号成功,注意接听回拨电话!")
|
||||
Utl.doCallback(callback)
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
MyUtl.onEndincomingCall = function(data)
|
||||
local custList = data.custList
|
||||
if custList and #custList > 0 then
|
||||
if #custList == 1 then
|
||||
getPanelAsy("PanelNewFollowSimple", onLoadedPanelTT, custList[1])
|
||||
else
|
||||
---@type _ParamCLLPPopList2
|
||||
local params = {}
|
||||
params.title = joinStr("新建跟进:", data.phoneNo)
|
||||
params.list = {}
|
||||
---@param _cust _DBCust
|
||||
for i, _cust in ipairs(custList) do
|
||||
table.insert(
|
||||
params.list,
|
||||
{
|
||||
index = i,
|
||||
name = joinStr("任务:", DBCust.getTaskName(_cust.taskId)),
|
||||
subname = joinStr("客户:", _cust.custName)
|
||||
}
|
||||
)
|
||||
end
|
||||
params.callback = function(d)
|
||||
local index = d.index
|
||||
getPanelAsy("PanelNewFollowSimple", onLoadedPanelTT, custList[index])
|
||||
end
|
||||
getPanelAsy("PanelPopList2", onLoadedPanelTT, params)
|
||||
end
|
||||
else
|
||||
MyUtl.confirm(
|
||||
joinStr("是否将号码【", data.phoneNo, "】创建为客户?"),
|
||||
function()
|
||||
getPanelAsy("PanelNewCust", onLoadedPanelTT, {phoneNo = data.phoneNo})
|
||||
end,
|
||||
"创建为客户"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
---public 调用系统拨打电话
|
||||
MyUtl.callCustByNative = function(phoneNo, cust)
|
||||
if CLUIFormUtl.callPhone then
|
||||
CLUIFormUtl.callPhone(phoneNo)
|
||||
else
|
||||
Application.OpenURL(joinStr( "tel:", phoneNo))
|
||||
Application.OpenURL(joinStr("tel:", phoneNo))
|
||||
end
|
||||
getPanelAsy("PanelNewFollowSimple", onLoadedPanelTT, cust)
|
||||
end
|
||||
@@ -129,8 +174,8 @@ function MyUtl.setIsHidePhone(val)
|
||||
end
|
||||
|
||||
MyUtl.hidePhone = function(phone)
|
||||
if not phone then
|
||||
return
|
||||
if isNilOrEmpty(phone) then
|
||||
return ""
|
||||
end
|
||||
if not MyUtl.isHidePhone then
|
||||
return phone
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
-- 单元
|
||||
local uiCell = {}
|
||||
|
||||
local csSelf = nil
|
||||
local transform = nil
|
||||
local gameObject = nil
|
||||
-- local Background = nil;
|
||||
-- local Label = nil
|
||||
-- local LabelSubName = nil
|
||||
local formRoot
|
||||
|
||||
|
||||
local mData = nil
|
||||
|
||||
function uiCell.init(go)
|
||||
gameObject = go
|
||||
transform = go.transform
|
||||
csSelf = gameObject:GetComponent("CLCellLua")
|
||||
|
||||
-- Background = getChild(transform, "Background"):GetComponent("UISprite");
|
||||
-- Label = csSelf:GetComponent("UILabel")
|
||||
-- LabelSubName = getCC(transform, "LabelSubName", "UILabel")
|
||||
formRoot = csSelf:GetComponent("CLUIFormRoot")
|
||||
end
|
||||
|
||||
function uiCell.show(go, data)
|
||||
mData = data
|
||||
formRoot:setValue(mData)
|
||||
-- Label.text = isNilOrEmpty(mData.name) and "请选择" or mData.name
|
||||
-- LabelSubName.text = mData.subname or ""
|
||||
end
|
||||
|
||||
function uiCell.refresh(flag)
|
||||
end
|
||||
|
||||
function uiCell.getData()
|
||||
return mData
|
||||
end
|
||||
return uiCell
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ddebd8217d787461a85217c3cab0a57f
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,38 @@
|
||||
-- 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
|
||||
uiobjs.formRoot = csSelf:GetComponent("CLUIFormRoot")
|
||||
uiobjs.LabelPhoneNo = getCC(transform, "LabelPhoneNo", "UILabel")
|
||||
uiobjs.SpriteType = getCC(transform, "SpriteType", "UISprite")
|
||||
end
|
||||
|
||||
-- 显示,
|
||||
-- 注意,c#侧不会在调用show时,调用refresh
|
||||
function _cell.show(go, data)
|
||||
mData = data
|
||||
uiobjs.formRoot:setValue(mData)
|
||||
if mData.calltype == "out" then
|
||||
uiobjs.SpriteType.spriteName = "call_outgoingcall"
|
||||
uiobjs.LabelPhoneNo.text = MyUtl.hidePhone(mData.destno)
|
||||
else
|
||||
uiobjs.SpriteType.spriteName = "call_comingcall"
|
||||
uiobjs.LabelPhoneNo.text = MyUtl.hidePhone(mData.callerno)
|
||||
end
|
||||
end
|
||||
|
||||
-- 取得数据
|
||||
function _cell.getData()
|
||||
return mData
|
||||
end
|
||||
|
||||
--------------------------------------------
|
||||
return _cell
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cff72ed0ba8a64dc7a4009ff849d8161
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -125,6 +125,7 @@ function _cell.release()
|
||||
isLoading = false
|
||||
fieldsObjs = {}
|
||||
count = 0
|
||||
hideHotWheel()
|
||||
end
|
||||
|
||||
function _cell.onMultTextInputChg(go)
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
---@class _ParamCLLPPopList2
|
||||
---@field title
|
||||
---@field list
|
||||
---@field callback
|
||||
|
||||
-- xx界面
|
||||
local CLLPPopList2 = {}
|
||||
|
||||
---@type Coolape.CLPanelLua
|
||||
local csSelf = nil
|
||||
---@type UnityEngine.Transform
|
||||
local transform = nil
|
||||
local uiobjs = {}
|
||||
---@type _ParamCLLPPopList2
|
||||
local mdata
|
||||
|
||||
-- 初始化,只会调用一次
|
||||
function CLLPPopList2.init(csObj)
|
||||
csSelf = csObj
|
||||
transform = csObj.transform
|
||||
---@type UISprite
|
||||
uiobjs.SpriteBg = getCC(transform, "Bottom/offset/SpriteBg", "UISprite")
|
||||
uiobjs.list = getChild(transform, "Bottom/offset/List")
|
||||
---@type Coolape.CLUILoopGrid
|
||||
uiobjs.grid = getCC(uiobjs.list.transform, "Content/Grid", "CLUILoopGrid")
|
||||
uiobjs.LabelTitle = getCC(transform, "Bottom/offset/LabelTitle", "UILabel")
|
||||
end
|
||||
|
||||
-- 设置数据
|
||||
function CLLPPopList2.setData(paras)
|
||||
mdata = paras
|
||||
end
|
||||
|
||||
--当有通用背板显示时的回调
|
||||
function CLLPPopList2.onShowFrame()
|
||||
end
|
||||
|
||||
-- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh
|
||||
function CLLPPopList2.show()
|
||||
uiobjs.LabelTitle.text = mdata.title
|
||||
local count = #(mdata.list)
|
||||
if count == 1 then
|
||||
uiobjs.SpriteBg.height = 340
|
||||
uiobjs.list.localPosition = Vector3(0, -340, 0)
|
||||
elseif count == 2 then
|
||||
uiobjs.SpriteBg.height = 510
|
||||
uiobjs.list.localPosition = Vector3(0, -170, 0)
|
||||
else
|
||||
uiobjs.SpriteBg.height = 680
|
||||
uiobjs.list.localPosition = Vector3.zero
|
||||
end
|
||||
uiobjs.grid:setList(mdata.list, CLLPPopList2.initCell)
|
||||
end
|
||||
|
||||
function CLLPPopList2.initCell(cell, data)
|
||||
cell:init(data, CLLPPopList2.onclickCell)
|
||||
end
|
||||
|
||||
function CLLPPopList2.onclickCell(cell, data)
|
||||
Utl.doCallback(mdata.callback, data)
|
||||
hideTopPanel(csSelf)
|
||||
end
|
||||
|
||||
-- 刷新
|
||||
function CLLPPopList2.refresh()
|
||||
end
|
||||
|
||||
-- 关闭页面
|
||||
function CLLPPopList2.hide()
|
||||
end
|
||||
|
||||
-- 网络请求的回调;cmd:指命,succ:成功失败,msg:消息;paras:服务器下行数据
|
||||
function CLLPPopList2.procNetwork(cmd, succ, msg, paras)
|
||||
--[[
|
||||
if(succ == NetSuccess) then
|
||||
if(cmd == "xxx") then
|
||||
-- TODO:
|
||||
end
|
||||
end
|
||||
--]]
|
||||
end
|
||||
|
||||
-- 处理ui上的事件,例如点击等
|
||||
function CLLPPopList2.uiEventDelegate(go)
|
||||
local goName = go.name
|
||||
|
||||
if goName == "ButtonClose" or goName == "SpriteBg" then
|
||||
hideTopPanel(csSelf)
|
||||
end
|
||||
end
|
||||
|
||||
-- 当顶层页面发生变化时回调
|
||||
function CLLPPopList2.onTopPanelChange(topPanel)
|
||||
end
|
||||
|
||||
-- 当按了返回键时,关闭自己(返值为true时关闭)
|
||||
function CLLPPopList2.hideSelfOnKeyBack()
|
||||
if NetProto and csSelf then
|
||||
NetProto.removePanelListener(csSelf)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--------------------------------------------
|
||||
return CLLPPopList2
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbeb7d495338f41a185db41382a82f27
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -66,7 +66,7 @@ end
|
||||
-- 处理ui上的事件,例如点击等
|
||||
function CLLPSendSms.uiEventDelegate(go)
|
||||
local goName = go.name
|
||||
if goName == "ButtonClose" then
|
||||
if goName == "ButtonClose" or goName == "SpriteBg" then
|
||||
hideTopPanel(csSelf)
|
||||
elseif goName == "ButtonYunSend" then
|
||||
local err = uiobjs.offset:checkValid()
|
||||
|
||||
@@ -53,6 +53,11 @@ function CLLPStart.setLuasAtBegainning()
|
||||
if ReporterMessageReceiver.self and ReporterMessageReceiver.self.gameObject then
|
||||
ReporterMessageReceiver.self.gameObject:SetActive(true)
|
||||
end
|
||||
else
|
||||
NetProto.isDebug = false
|
||||
if ReporterMessageReceiver.self and ReporterMessageReceiver.self.gameObject then
|
||||
ReporterMessageReceiver.self.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
@@ -72,6 +77,13 @@ function CLLPStart.setLuasAtBegainning()
|
||||
CLUIFormUtl.setSoftInputMode("SOFT_INPUT_ADJUST_PAN")
|
||||
Screen.sleepTimeout = CS.UnityEngine.SleepTimeout.SystemSetting
|
||||
|
||||
CallListner.self:setLua()
|
||||
|
||||
CLLCallListner.checkAndSetUserPermission(
|
||||
function()
|
||||
CallListner.self:init()
|
||||
end
|
||||
)
|
||||
-- 添加屏蔽字
|
||||
--MyMain.self:invoke4Lua(CLLPStart.addShieldWords, 1)
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ function TRPAbout:init(csObj)
|
||||
uiobjs.TableForm = uiobjs.Table:GetComponent("CLUIFormRoot")
|
||||
---@type Coolape.CLCellLua
|
||||
uiobjs.TableLua = uiobjs.Table:GetComponent("CLCellLua")
|
||||
uiobjs.LabelVer = getCC(self.transform, "Top/LabelVer", "UILabel")
|
||||
end
|
||||
|
||||
function TRPAbout:initFiledsAttr()
|
||||
@@ -58,6 +59,7 @@ end
|
||||
|
||||
-- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh
|
||||
function TRPAbout:show()
|
||||
uiobjs.LabelVer.text = joinStr("Version:", __version__)
|
||||
---@type _ParamCellExtendFiledRoot
|
||||
local fieldRootInfor = {}
|
||||
fieldRootInfor.fields = {}
|
||||
|
||||
@@ -32,7 +32,6 @@ end
|
||||
-- 刷新
|
||||
function TRPBindPhone:refresh()
|
||||
local user = DBUser.getMyInfor()
|
||||
printe("user.ifPhoAuth")
|
||||
SetActive(uiobjs.ButtonAuth, user.ifPhoAuth ~= "Y" or false)
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
---@type IDBasePanel
|
||||
local TRBasePanel = require("ui.panel.TRBasePanel")
|
||||
---@class TRPCallLogDetail:TRBasePanel 邮件列表
|
||||
local TRPCallLogDetail = class("TRPCallLogDetail", TRBasePanel)
|
||||
|
||||
local uiobjs = {}
|
||||
-- 初始化,只会调用一次
|
||||
function TRPCallLogDetail:init(csObj)
|
||||
TRPCallLogDetail.super.init(self, csObj)
|
||||
|
||||
self:setEventDelegate()
|
||||
|
||||
MyUtl.setContentView(getChild(self.transform, "PanelContent"), MyUtl.defaultTopHeight, 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")
|
||||
uiobjs.detail = getCC(uiobjs.Table.transform, "detail", "CLCellLua")
|
||||
uiobjs.ButtonNewCust = getChild(self.transform, "ButtonNewCust").gameObject
|
||||
uiobjs.ButtonCustDetail = getChild(self.transform, "ButtonCustDetail").gameObject
|
||||
end
|
||||
|
||||
-- 设置数据
|
||||
---@param paras _ParamTRPCallLogDetail
|
||||
function TRPCallLogDetail:setData(paras)
|
||||
self.mdata = paras
|
||||
end
|
||||
|
||||
-- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh
|
||||
function TRPCallLogDetail:show()
|
||||
uiobjs.detail:init(self.mdata, nil)
|
||||
if not isNilOrEmpty(self.mdata.custId) then
|
||||
SetActive(uiobjs.ButtonNewCust, false)
|
||||
SetActive(uiobjs.ButtonCustDetail, true)
|
||||
else
|
||||
SetActive(uiobjs.ButtonNewCust, true)
|
||||
SetActive(uiobjs.ButtonCustDetail, false)
|
||||
end
|
||||
uiobjs.scrollView:ResetPosition()
|
||||
end
|
||||
|
||||
-- 刷新
|
||||
function TRPCallLogDetail:refresh()
|
||||
end
|
||||
|
||||
-- 关闭页面
|
||||
function TRPCallLogDetail:hide()
|
||||
end
|
||||
|
||||
-- 网络请求的回调;cmd:指命,succ:成功失败,msg:消息;paras:服务器下行数据
|
||||
function TRPCallLogDetail:procNetwork(cmd, succ, msg, paras)
|
||||
if (succ == NetSuccess) then
|
||||
--[[
|
||||
if cmd == xx then
|
||||
end
|
||||
]]
|
||||
end
|
||||
end
|
||||
|
||||
function TRPCallLogDetail:setEventDelegate()
|
||||
self.EventDelegate = {
|
||||
ButtonNewCust = function()
|
||||
local parma
|
||||
if self.mdata.calltype == "out" then
|
||||
parma = {phoneNo = self.mdata.destno}
|
||||
else
|
||||
parma = {phoneNo = self.mdata.callerno}
|
||||
end
|
||||
getPanelAsy("PanelNewCust", onLoadedPanel, parma)
|
||||
end,
|
||||
ButtonCustDetail = function()
|
||||
NetProto.send.get_customerById(
|
||||
self.mdata.custId,
|
||||
function(content)
|
||||
hideHotWheel()
|
||||
if content.success then
|
||||
local cust = content.result
|
||||
if cust then
|
||||
---@type _ParamTRPCustDetail
|
||||
local param = {}
|
||||
param.cust = cust
|
||||
param.bookingData = nil
|
||||
param.needShowMore = true
|
||||
getPanelAsy("PanelCustDetail", onLoadedPanelTT, param)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
}
|
||||
end
|
||||
-- 处理ui上的事件,例如点击等
|
||||
function TRPCallLogDetail:uiEventDelegate(go)
|
||||
local func = self.EventDelegate[go.name]
|
||||
if func then
|
||||
func()
|
||||
end
|
||||
end
|
||||
|
||||
-- 当顶层页面发生变化时回调
|
||||
function TRPCallLogDetail:onTopPanelChange(topPanel)
|
||||
end
|
||||
|
||||
--------------------------------------------
|
||||
return TRPCallLogDetail
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7f1b65a2061747ccb18fc4bb1b35503
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -549,6 +549,7 @@ function TRPCustDetail:procNetwork(cmd, succ, msg, paras)
|
||||
self:showOrders()
|
||||
end
|
||||
elseif cmd == NetProto.cmds.get_customerById then
|
||||
-- hideHotWheel()
|
||||
if self.mdata.custId == paras.result.custId then
|
||||
self.mdata = paras.result
|
||||
if self.currToggle == 1 then
|
||||
|
||||
@@ -9,7 +9,11 @@ function TRPCustList:init(csObj)
|
||||
TRPCustList.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")
|
||||
@@ -30,7 +34,19 @@ end
|
||||
|
||||
function TRPCustList:initFilters()
|
||||
self.filters = {}
|
||||
local d = {}
|
||||
local d
|
||||
|
||||
d = {}
|
||||
d.title = "客户状态"
|
||||
d.key = DBCust.FilterGroup.dealFlagList
|
||||
d.key2 = "dealFlag"
|
||||
d.list = DBCust.getFilter(DBCust.FilterGroup.dealFlagList)
|
||||
if #(d.list) > 0 then
|
||||
-- table.insert(d.list, 1, {name = "全部", value = -1})
|
||||
table.insert(self.filters, d)
|
||||
end
|
||||
|
||||
d = {}
|
||||
d.title = "归属工号"
|
||||
d.key = DBCust.FilterGroup.loginNoList
|
||||
d.key2 = "loginNos"
|
||||
@@ -60,16 +76,6 @@ function TRPCustList:initFilters()
|
||||
table.insert(self.filters, d)
|
||||
end
|
||||
|
||||
d = {}
|
||||
d.title = "客户状态"
|
||||
d.key = DBCust.FilterGroup.dealFlagList
|
||||
d.key2 = "dealFlag"
|
||||
d.list = DBCust.getFilter(DBCust.FilterGroup.dealFlagList)
|
||||
if #(d.list) > 0 then
|
||||
-- table.insert(d.list, 1, {name = "全部", value = -1})
|
||||
table.insert(self.filters, d)
|
||||
end
|
||||
|
||||
d = {}
|
||||
d.title = "客户类型"
|
||||
d.key = DBCust.FilterGroup.custTypeList
|
||||
|
||||
@@ -1,23 +1,44 @@
|
||||
local TRPMakeCall = {}
|
||||
|
||||
---@type Coolape.CLPanelLua
|
||||
local csSelf = nil
|
||||
local transform = nil
|
||||
---@type UIInput
|
||||
local InputNumber
|
||||
local grid
|
||||
local cursorPosition = -1
|
||||
local currRecordName
|
||||
local LabelTitle
|
||||
local ButtonDel
|
||||
local uiobjs = {}
|
||||
|
||||
-- 初始化,只会调用一次
|
||||
function TRPMakeCall.init(csObj)
|
||||
csSelf = csObj
|
||||
transform = csObj.transform
|
||||
grid = getChild(transform, "AnchorBottom/grid"):GetComponent("UIGrid")
|
||||
|
||||
|
||||
MyUtl.setContentView(getChild(transform, "PanelContent"), 298, MyUtl.defaultBottomHeight)
|
||||
uiobjs.InputSeachKey = getCC(transform, "Top/InputSeachKey", "UIInput")
|
||||
|
||||
---@type CLUIScrollViewWithEvent
|
||||
uiobjs.scrollView = getCC(transform, "PanelContent", "CLUIScrollViewWithEvent")
|
||||
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
|
||||
uiobjs.scrollView:init(TRPMakeCall.onShowRefreshFlg, TRPMakeCall.onhideRefreshFlg, TRPMakeCall.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 TweenPosition
|
||||
uiobjs.bottomOffset = getCC(transform, "AnchorBottom/offset", "TweenPosition")
|
||||
grid = getChild(uiobjs.bottomOffset.transform, "grid"):GetComponent("UIGrid")
|
||||
|
||||
local contentRect = MyUtl.getUIContent(csSelf)
|
||||
grid.cellWidth = NumEx.getIntPart((contentRect.z - 100) / 3)
|
||||
|
||||
InputNumber = getChild(transform, "AnchorBottom/InputNumber"):GetComponent("UIInput")
|
||||
InputNumber = getChild(uiobjs.bottomOffset.transform, "InputNumber"):GetComponent("UIInput")
|
||||
ButtonDel = getChild(InputNumber.transform, "ButtonDel").gameObject
|
||||
local prefabCell = getChild(grid.transform, "00000").gameObject
|
||||
local list = {1, 2, 3, 4, 5, 6, 7, 8, 9, "*", 0, "#"}
|
||||
CLUIUtl.resetList4Lua(
|
||||
@@ -25,9 +46,14 @@ function TRPMakeCall.init(csObj)
|
||||
prefabCell,
|
||||
list,
|
||||
function(cell, data)
|
||||
cell:init(data, TRPMakeCall.onClickCell)
|
||||
cell:init(data, TRPMakeCall.onClickNumCell)
|
||||
end
|
||||
)
|
||||
|
||||
uiobjs.ButtonShow = getChild(transform, "AnchorBottom/ButtonShow").gameObject
|
||||
uiobjs.ButtonHide = getChild(uiobjs.bottomOffset.transform, "ButtonHide").gameObject
|
||||
|
||||
TRPMakeCall.showList()
|
||||
end
|
||||
|
||||
-- 设置数据
|
||||
@@ -38,12 +64,88 @@ end
|
||||
function TRPMakeCall.show()
|
||||
UIInput.selection = InputNumber
|
||||
InputNumber.value = ""
|
||||
SetActive(ButtonDel, false)
|
||||
cursorPosition = -1
|
||||
|
||||
-- uiobjs.bottomOffset:ResetToBeginning()
|
||||
SetActive(uiobjs.bottomOffset.gameObject, true)
|
||||
SetActive(uiobjs.ButtonShow, false)
|
||||
NetProto.send.query_cust_calllog(uiobjs.InputSeachKey.value, nil, 1)
|
||||
end
|
||||
|
||||
function TRPMakeCall.onClickNumCell(cell, data)
|
||||
UIInput.selection = InputNumber
|
||||
InputNumber:Insert(data)
|
||||
end
|
||||
|
||||
function TRPMakeCall.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 {}, TRPMakeCall.initCell, TRPMakeCall.onHeadList, TRPMakeCall.onEndList)
|
||||
|
||||
TRPMakeCall.reposition()
|
||||
csSelf:invoke4Lua(TRPMakeCall.reposition, 0.1)
|
||||
end
|
||||
|
||||
function TRPMakeCall.reposition()
|
||||
uiobjs.scrollView:ResetPosition()
|
||||
end
|
||||
|
||||
function TRPMakeCall.appList(list)
|
||||
SetActive(uiobjs.ButtonEndList.gameObject, false)
|
||||
uiobjs.Grid:appendList(list)
|
||||
end
|
||||
|
||||
function TRPMakeCall.onShowRefreshFlg()
|
||||
if uiobjs.Grid.list.Count > 0 then
|
||||
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 166, 0)
|
||||
else
|
||||
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 100, 0)
|
||||
end
|
||||
SetActive(uiobjs.ButtonHeadList.gameObject, true)
|
||||
end
|
||||
function TRPMakeCall.onhideRefreshFlg()
|
||||
SetActive(uiobjs.ButtonHeadList.gameObject, false)
|
||||
if uiobjs.Grid.list.Count == 0 then
|
||||
uiobjs.scrollView:ResetPosition()
|
||||
end
|
||||
end
|
||||
function TRPMakeCall.refreshList()
|
||||
local queryKey = uiobjs.InputSeachKey.value
|
||||
showHotWheel()
|
||||
NetProto.send.query_cust_calllog(uiobjs.InputSeachKey.value, nil, 1)
|
||||
end
|
||||
|
||||
function TRPMakeCall.onHeadList(head)
|
||||
printw("到最顶端了")
|
||||
-- uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 250, 0)
|
||||
-- SetActive(uiobjs.ButtonHeadList.gameObject, true)
|
||||
end
|
||||
|
||||
function TRPMakeCall.onEndList(tail)
|
||||
printw("到最后了==" .. tail.name)
|
||||
if TRPMakeCall.pageInfo and TRPMakeCall.pageInfo.current_page < TRPMakeCall.pageInfo.total_pages then
|
||||
local queryKey = uiobjs.InputSeachKey.value
|
||||
showHotWheel()
|
||||
-- 取得下一页
|
||||
NetProto.send.query_cust_calllog(uiobjs.InputSeachKey.value, nil, TRPMakeCall.pageInfo.current_page + 1)
|
||||
else
|
||||
uiobjs.ButtonEndList.localPosition = tail.transform.localPosition + Vector3.up * -170
|
||||
SetActive(uiobjs.ButtonEndList.gameObject, true)
|
||||
end
|
||||
end
|
||||
|
||||
function TRPMakeCall.initCell(cell, data)
|
||||
cell:init(data, TRPMakeCall.onClickCell)
|
||||
end
|
||||
|
||||
function TRPMakeCall.onClickCell(cell, data)
|
||||
UIInput.selection = InputNumber
|
||||
InputNumber:Insert(data)
|
||||
getPanelAsy("PanelCallLogDetail", onLoadedPanelTT, data)
|
||||
end
|
||||
|
||||
-- 刷新
|
||||
@@ -53,21 +155,21 @@ end
|
||||
-- 关闭页面
|
||||
function TRPMakeCall.hide()
|
||||
UIInput.selection = nil
|
||||
csSelf:cancelInvoke4Lua()
|
||||
end
|
||||
|
||||
-- 网络请求的回调;cmd:指命,succ:成功失败,msg:消息;paras:服务器下行数据
|
||||
function TRPMakeCall.procNetwork(cmd, succ, msg, paras)
|
||||
if (succ == 0) then
|
||||
if (cmd == "8888") then
|
||||
-- 回拨已调用成功
|
||||
local orgs = Hashtable()
|
||||
orgs.callback = "TRPMakeCall.onEndIncomingCall"
|
||||
orgs.id = msg
|
||||
CLLCallListner.waite4Callback(JSON.JsonEncode(orgs))
|
||||
CLUIUtl.showConfirm("云呼叫中,请准备接听电话", nil)
|
||||
elseif cmd == "1018" then
|
||||
-- 保存通话记录完成
|
||||
CLLRecordMgr.moveRecord2Upload(currRecordName)
|
||||
if succ == NetSuccess then
|
||||
if cmd == NetProto.cmds.query_cust_calllog then
|
||||
local result = paras.result or {}
|
||||
TRPMakeCall.pageInfo = result.meta
|
||||
if TRPMakeCall.pageInfo and TRPMakeCall.pageInfo.current_page > 1 then
|
||||
TRPMakeCall.appList(result.data)
|
||||
else
|
||||
TRPMakeCall.showList(result.data)
|
||||
end
|
||||
hideHotWheel()
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -76,46 +178,61 @@ end
|
||||
function TRPMakeCall.uiEventDelegate(go)
|
||||
local goName = go.name
|
||||
if (goName == "ButtonCancel") then
|
||||
CLPanelManager.hideTopPanel()
|
||||
hideTopPanel()
|
||||
elseif goName == "InputNumber" then
|
||||
cursorPosition = InputNumber.cursorPosition
|
||||
if isNilOrEmpty(InputNumber.value) then
|
||||
SetActive(ButtonDel, false)
|
||||
else
|
||||
SetActive(ButtonDel, true)
|
||||
end
|
||||
elseif goName == "ButtonCall" then
|
||||
-- CLLCallListner.ready2Call("TRPMakeCall.onEndCall", InputNumber.value)
|
||||
-- MyUtl.callPhone(InputNumber.value)
|
||||
if InputNumber.value == nil or InputNumber.value == "" then
|
||||
CLAlert.add("请输入要呼叫的号码", Color.white, 1)
|
||||
MyUtl.toastW("请输入要呼叫的号码")
|
||||
return
|
||||
end
|
||||
CLLCallListner.ready2Call("TRPMakeCall.onEndCall", InputNumber.value)
|
||||
MyUtl.callPhone(InputNumber.value)
|
||||
elseif goName == "ButtonCallYun" then
|
||||
if InputNumber.value == nil or InputNumber.value == "" then
|
||||
CLAlert.add("请输入要呼叫的号码", Color.white, 1)
|
||||
MyUtl.toastW("请输入要呼叫的号码")
|
||||
return
|
||||
end
|
||||
local selfPhoneNum = Prefs.getSelfPhoneNum()
|
||||
showHotWheel()
|
||||
CLLNet.callCust2(selfPhoneNum, InputNumber.value)
|
||||
MyUtl.doCall(
|
||||
nil,
|
||||
InputNumber.value,
|
||||
nil,
|
||||
function()
|
||||
InputNumber.value = ""
|
||||
end
|
||||
)
|
||||
elseif goName == "ButtonDel" then
|
||||
TRPMakeCall.DoBackspace()
|
||||
elseif goName == "ButtonShow" then
|
||||
SetActive(uiobjs.ButtonShow, false)
|
||||
-- uiobjs.bottomOffset:Play(true)
|
||||
SetActive(uiobjs.bottomOffset.gameObject, true)
|
||||
elseif goName == "ButtonHide" then
|
||||
SetActive(uiobjs.ButtonShow, true)
|
||||
-- uiobjs.bottomOffset:Play(false)
|
||||
SetActive(uiobjs.bottomOffset.gameObject, false)
|
||||
end
|
||||
end
|
||||
|
||||
-- 当结束通话
|
||||
function TRPMakeCall.onEndCall(orgs)
|
||||
local func = function(remark)
|
||||
local data = Hashtable()
|
||||
data.remark = remark
|
||||
data.caller_number = Prefs.getSelfPhoneNum()
|
||||
data.destination_number = orgs.phone
|
||||
data.created_time = orgs.created_time
|
||||
data.answered_time = orgs.answered_time
|
||||
data.over_time = orgs.over_time
|
||||
data.recording_file_name = Path.GetFileName(orgs.soundRecordFile)
|
||||
showHotWheel()
|
||||
CLLNet.saveCall(data)
|
||||
end
|
||||
currRecordName = Path.GetFileName(orgs.soundRecordFile)
|
||||
function TRPMakeCall.onPressButtonDel()
|
||||
csSelf:invoke4Lua(TRPMakeCall.invokeBackspace, 0.25)
|
||||
end
|
||||
|
||||
CLPanelManager.getPanelAsy("PanelEndCallRemark", onLoadedPanelTT, func)
|
||||
function TRPMakeCall.onReleaseButtonDel()
|
||||
csSelf:cancelInvoke4Lua(TRPMakeCall.invokeBackspace)
|
||||
end
|
||||
|
||||
function TRPMakeCall.invokeBackspace()
|
||||
TRPMakeCall.DoBackspace()
|
||||
if not isNilOrEmpty(InputNumber.value) then
|
||||
csSelf:invoke4Lua(TRPMakeCall.invokeBackspace, 0.05)
|
||||
end
|
||||
end
|
||||
|
||||
-- 当结束回播通话
|
||||
@@ -130,7 +247,7 @@ end
|
||||
|
||||
-- 当按了返回键时,关闭自己(返值为true时关闭)
|
||||
function TRPMakeCall.hideSelfOnKeyBack()
|
||||
return true
|
||||
return false
|
||||
end
|
||||
|
||||
function TRPMakeCall.DoBackspace()
|
||||
|
||||
@@ -46,6 +46,8 @@ function TRPNewCust:setData(paras)
|
||||
else
|
||||
self.isNewCust = true
|
||||
self.mdata = {}
|
||||
self.mdata.phoneNo = paras and paras.phoneNo or "" -- 可能已经把手机号带过来了
|
||||
self.mdata._phoneNo = self.mdata.phoneNo
|
||||
self.mdata.dealFlag = "0"
|
||||
self.mdata.custType = "0"
|
||||
self.mdata.custFrom = "0"
|
||||
|
||||
@@ -79,20 +79,37 @@ function TRPResetPasswordStep1:setEventDelegate()
|
||||
d.oprType = "updatePho"
|
||||
elseif self.mData.isAuth then
|
||||
end
|
||||
NetProto.sendVerMsg(
|
||||
d,
|
||||
function(data, orgs)
|
||||
if data.code == NetSuccess then
|
||||
getPanelAsy("PanelResetPasswordStep2", onLoadedPanelTT, d)
|
||||
|
||||
if self.mData.isBindPhone then
|
||||
NetProto.send.preUpdatePho(
|
||||
d.phoneNo,
|
||||
function(content)
|
||||
if content.success then
|
||||
self:goNext(d)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
)
|
||||
else
|
||||
self:goNext(d)
|
||||
end
|
||||
end,
|
||||
ButtonDelPhoneNum = function()
|
||||
uiobjs.InputPhoneNum.value = ""
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
function TRPResetPasswordStep1:goNext(d)
|
||||
NetProto.sendVerMsg(
|
||||
d,
|
||||
function(data, orgs)
|
||||
if data.code == NetSuccess then
|
||||
getPanelAsy("PanelResetPasswordStep2", onLoadedPanelTT, d)
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
-- 处理ui上的事件,例如点击等
|
||||
function TRPResetPasswordStep1:uiEventDelegate(go)
|
||||
local func = self.EventDelegate[go.name]
|
||||
|
||||
Reference in New Issue
Block a user