2020-07-04 14:41:25 +08:00
|
|
|
|
MyUtl = {}
|
|
|
|
|
|
|
|
|
|
|
|
MyUtl.init = function(panel)
|
|
|
|
|
|
MyUtl.getUIContent(panel)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local _TopHeight_ = 132
|
|
|
|
|
|
local _BottomHeight_ = 147
|
|
|
|
|
|
local _ContentRect
|
|
|
|
|
|
local _sizeAdjust
|
|
|
|
|
|
MyUtl.getUIContent = function(panel, top, bottom, forceCal)
|
|
|
|
|
|
-- if _ContentRect and (not forceCal) then
|
|
|
|
|
|
-- return _ContentRect
|
|
|
|
|
|
-- end
|
|
|
|
|
|
top = top or _TopHeight_
|
|
|
|
|
|
bottom = bottom or _BottomHeight_
|
|
|
|
|
|
local sizeAdjust = UIRoot.GetPixelSizeAdjustment(panel.gameObject)
|
|
|
|
|
|
_sizeAdjust = sizeAdjust
|
|
|
|
|
|
_ContentRect =
|
|
|
|
|
|
Vector4(0, (bottom - top) / 2, Screen.width * sizeAdjust, Screen.height * sizeAdjust - (bottom + top))
|
|
|
|
|
|
return _ContentRect
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
MyUtl.setContentView = function(go, top, bottom)
|
|
|
|
|
|
local panel = go:GetComponent("UIPanel")
|
|
|
|
|
|
if panel then
|
|
|
|
|
|
panel.transform.localPosition = Vector3.zero
|
|
|
|
|
|
panel.clipOffset = Vector2.zero
|
|
|
|
|
|
panel.baseClipRegion = MyUtl.getUIContent(panel, top, bottom)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
MyUtl.getSizeAdjust = function()
|
|
|
|
|
|
return _sizeAdjust
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
---public 拨号
|
|
|
|
|
|
MyUtl.callCust = function(cust)
|
2020-07-08 08:01:34 +08:00
|
|
|
|
if type(cust.jsonStr) == "string" then
|
|
|
|
|
|
cust.jsonStr = json.decode(cust.jsonStr)
|
2020-07-04 14:41:25 +08:00
|
|
|
|
end
|
2020-07-08 08:01:34 +08:00
|
|
|
|
cust.jsonStr = cust.jsonStr or {}
|
2020-07-04 14:41:25 +08:00
|
|
|
|
local phones = ArrayList()
|
2020-07-09 08:50:24 +08:00
|
|
|
|
local phonesVal = ArrayList()
|
2020-07-04 14:41:25 +08:00
|
|
|
|
|
|
|
|
|
|
local taskId = tostring(cust.taskId)
|
|
|
|
|
|
local fields = DBCust.getFieldsByTask(taskId)
|
|
|
|
|
|
for i, attr in ipairs(fields) do
|
|
|
|
|
|
if attr.attrType == DBCust.FieldType.phone then
|
2020-07-08 08:01:34 +08:00
|
|
|
|
local phNo = cust.jsonStr[joinStr(attr.id, "_", attr.attrName)]
|
2020-07-04 14:41:25 +08:00
|
|
|
|
if not isNilOrEmpty(phNo) then
|
2020-07-09 08:50:24 +08:00
|
|
|
|
phones:Add(joinStr(attr.attrName, ": ", phNo))
|
|
|
|
|
|
phonesVal:Add(phNo)
|
2020-07-04 14:41:25 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
if phones.Count > 0 then
|
2020-07-09 08:50:24 +08:00
|
|
|
|
phones:Insert(0, joinStr("默认: ", cust.phoneNo))
|
|
|
|
|
|
phonesVal:Insert(0, cust.phoneNo)
|
2020-07-04 14:41:25 +08:00
|
|
|
|
CLUIPopListPanel.show(
|
|
|
|
|
|
phones,
|
2020-07-09 08:50:24 +08:00
|
|
|
|
phonesVal,
|
2020-07-04 14:41:25 +08:00
|
|
|
|
function(val, selectedItem)
|
|
|
|
|
|
if val then
|
|
|
|
|
|
MyUtl.doCall(cust.custId, val)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
else
|
|
|
|
|
|
MyUtl.doCall(cust.custId, cust.phoneNo)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
MyUtl.doCall = function(custId, phoneNo)
|
|
|
|
|
|
showHotWheel("拨号中...")
|
|
|
|
|
|
NetProto.send.bi_call(
|
|
|
|
|
|
custId,
|
|
|
|
|
|
phoneNo,
|
|
|
|
|
|
nil,
|
|
|
|
|
|
function(content)
|
|
|
|
|
|
hideHotWheel()
|
|
|
|
|
|
if content.success then
|
2020-07-09 09:23:09 +08:00
|
|
|
|
MyUtl.toastS("拨号成功!")
|
2020-07-04 14:41:25 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2020-07-09 08:50:24 +08:00
|
|
|
|
MyUtl.toast = function(msg, staySec)
|
|
|
|
|
|
CLToastRoot.toast(msg, CLToastRoot.Type.normal, staySec)
|
|
|
|
|
|
end
|
|
|
|
|
|
MyUtl.toastS = function(msg, staySec)
|
|
|
|
|
|
CLToastRoot.toast(msg, CLToastRoot.Type.success, staySec)
|
|
|
|
|
|
end
|
|
|
|
|
|
MyUtl.toastW = function(msg, staySec)
|
|
|
|
|
|
CLToastRoot.toast(msg, CLToastRoot.Type.warning, staySec)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
MyUtl.toastE = function(msg, staySec)
|
|
|
|
|
|
CLToastRoot.toast(msg, CLToastRoot.Type.error, staySec)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2020-07-04 14:41:25 +08:00
|
|
|
|
return MyUtl
|