This commit is contained in:
2020-07-18 21:12:14 +08:00
parent 1361db18a9
commit 33dc6cea60
214 changed files with 16596 additions and 3104 deletions

View File

@@ -27,7 +27,8 @@ DBCust.FilterGroup = {
custTypeList = "custTypeList", -- list 客户类型
dealFlagList = "dealFlagList", -- list 客户状态
loginNoList = "loginNoList", -- list 归属工号
taskList = "taskList" -- list 任务名称
taskList = "taskList", -- list 任务名称
followUpTypeList = "followUpTypeList" -- 跟进类型
}
DBCust.FieldType = {
@@ -37,7 +38,16 @@ DBCust.FieldType = {
number = "数字文本框",
dateTime = "时间文本框",
text = "普通文本框",
phone = "电话号码框"
phone = "电话号码框",
empty ="empty"
}
---@class _FieldMode
_FieldMode = {
inputOnly = 0, -- 纯输入
showOnly = 1, -- 纯展示模式
modifyOnly = 2, -- 修改模式
showAndModify = 3, -- 展示械式同时也可以modify
button = 4, -- 类似按钮的功能
}
DBCust.onGetFilter = function(data)

View File

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

View File

@@ -0,0 +1,53 @@
DBTextures = {}
local db = {}
function DBTextures.init()
InvokeEx.cancelInvoke(DBTextures.releaseTimeout)
InvokeEx.invoke(DBTextures.releaseTimeout, 60)
end
function DBTextures.clean()
InvokeEx.cancelInvoke(DBTextures.releaseTimeout)
for k, v in ipairs(db) do
GameObject.DestroyImmediate(v)
end
db = {}
end
function DBTextures.releaseTimeout()
for k, v in ipairs(db) do
if DateEx.nowMS - v.lastUseTime > 300000 then
GameObject.DestroyImmediate(v.texture)
db[k] = nil
end
end
end
---@return UnityEngine.UnityWebRequest
function DBTextures.getByUrl(url, callback, orgs)
local tt = db[url]
if tt then
tt.lastUseTime = DateEx.nowMS
db[url] = tt
Utl.doCallback(callback, tt.texture, orgs)
return nil
end
local request =
WWWEx.get(
url,
nil,
CLAssetType.texture,
function(content)
db[url] = {texture = content, lastUseTime = DateEx.nowMS}
Utl.doCallback(callback, content, orgs)
end,
nil,
orgs,
true,
1
)
return request
end
return DBTextures

View File

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

View File

@@ -241,6 +241,7 @@ NetProto.cmds = {
load_wfTicket_Settings = "load_WfTicket_Settings", -- 工单配置信息
selectProductInfo = "selectProductInfo", -- 商品列表
createWfInfo = "createWfInfo", -- 创建订单
create_followUp_task = "create_followUp_task", -- 创建跟进预约
}
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
@@ -566,5 +567,12 @@ NetProto.send.createWfInfo = function(workFlowInfo, callback, timeOutSec)
NetProto.sendSocket(content, callback, timeOutSec)
end
NetProto.send.create_followUp_task = function(followUpTaskJson, callback, timeOutSec)
local content = {}
content.action = NetProto.cmds.create_followUp_task
content.followUpTaskJson = followUpTaskJson
content.followUpTaskJson.groupId = NetProto.groupId
NetProto.sendSocket(content, callback, timeOutSec)
end
------------------------------------------------------
return NetProto

View File

@@ -261,7 +261,13 @@ Mp3PlayerByUrl = CS.Mp3PlayerByUrl
CLUICheckbox = CS.CLUICheckbox
---@type CLUIPopListPanel
CLUIPopListPanel = CS.CLUIPopListPanel
CLUIScrollViewWithEvent= CS.CLUIScrollViewWithEvent
CLUIScrollViewWithEvent = CS.CLUIScrollViewWithEvent
---@type MyGallery
MyGallery = CS.MyGallery
---@type NativeCamera
NativeCamera = CS.NativeCamera
---@type MyCamera
MyCamera = CS.MyCamera
-------------------------------------------------------
json = require("json.json")

View File

@@ -317,11 +317,13 @@ function hideTopPanel(p)
end
end
---@param go UnityEngine.GameObject
function SetActive(go, isActive)
if (go == nil) then
return
end
NGUITools.SetActive(go, isActive)
-- NGUITools.SetActive(go, isActive)
go:SetActive(isActive)
end
function getCC(transform, path, com)

View File

@@ -85,7 +85,7 @@ MyUtl.doCall = function(custId, phoneNo, cust)
hideHotWheel()
if content.success then
MyUtl.toastS("拨号成功!")
getPanelAsy("PanelNewFollow", onLoadedPanelTT, cust)
getPanelAsy("PanelNewFollowSimple", onLoadedPanelTT, cust)
end
end
)

View File

@@ -67,6 +67,7 @@ function _cell.uiEventDelegate(go)
local goName = go.name
if goName == "ButtonFollow" then
elseif goName == "ButtonTask" then
getPanelAsy("PanelNewFollowTask", onLoadedPanelTT, mData)
elseif goName == "ButtonContact" then
MyUtl.callCust(mData)
end

View File

@@ -0,0 +1,30 @@
-- 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
---@type UIWidget
uiobjs.widget = csSelf:GetComponent("UIWidget")
end
-- 显示,
-- 注意c#侧不会在调用show时调用refresh
function _cell.show(go, data)
mData = data
uiobjs.widget.height = mData.height or 40
end
-- 取得数据
function _cell.getData()
return mData
end
--------------------------------------------
return _cell

View File

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

View File

@@ -1,17 +1,20 @@
---@class _ParamFieldAttr
---@field id
---@field attrType
---@field ifMust boolean 1:true
---@field ifTime boolean 1:true
---@field cannotEdit
---@field attrName
---@field attrValue
---@field id
---@field checkMin
---@field checkMax
---@field popOptions
---@field popValues
---@field donotJoinKey boolean 是否要拼接key
---@field height numb 高度只有在emptyspace有用
---@class _ParamCellExtendFiled
---@field isEditMode boolean
---@field showMode _FieldMode
---@field attr _ParamFieldAttr
---@field onSelect function 当选择了poplist
---@field onClick function 当点击了输入框
@@ -39,10 +42,6 @@ function _cell.init(csObj)
uiobjs.spriteBg = getCC(transform, "Background", "UISprite")
end
-- if uiobjs.spriteBg then
-- uiobjs.spriteBg.width = NumEx.getIntPart(CSPMain.contentRect.z)
-- end
uiobjs.boxCollider = csSelf:GetComponent("BoxCollider")
---@type UIInput
uiobjs.input = csSelf:GetComponent("UIInput")
@@ -67,35 +66,6 @@ function _cell.show(go, data)
attr = mData.attr
attr.ifMust = attr.ifMust or 0
if data.isEditMode then
_cell.enabeldObj(uiobjs.boxCollider, true)
if uiobjs.Label then
uiobjs.Label.text = uiobjs.inputLabel
end
if uiobjs.input then
uiobjs.input.defaultText = uiobjs.inputLabel
end
_cell.enabeldObj(uiobjs.Label4, true)
_cell.enabeldObj(uiobjs.SpriteRight, true)
if uiobjs.ButtonReset then
uiobjs.ButtonReset.disabled = false
end
else
_cell.enabeldObj(uiobjs.boxCollider, false)
if uiobjs.Label then
uiobjs.Label.text = ""
end
if uiobjs.input then
uiobjs.input.defaultText = ""
end
_cell.enabeldObj(uiobjs.Label4, false)
_cell.enabeldObj(uiobjs.SpriteRight, false)
if uiobjs.ButtonReset then
uiobjs.ButtonReset.disabled = true
end
end
local jsonKey
if attr.donotJoinKey then
jsonKey = attr.id
@@ -114,7 +84,6 @@ function _cell.show(go, data)
uiobjs.checkbox.labeName.text = attr.attrName
end
_cell.enabeldObj(uiobjs.input, true)
if attr.attrType == DBCust.FieldType.text then
uiobjs.input.keyboardType = UIInput.KeyboardType.Default
elseif attr.attrType == DBCust.FieldType.number then
@@ -126,14 +95,15 @@ function _cell.show(go, data)
elseif attr.attrType == DBCust.FieldType.multext then
uiobjs.input.keyboardType = UIInput.KeyboardType.Default
elseif attr.attrType == DBCust.FieldType.dateTime then
_cell.enabeldObj(uiobjs.input, false)
local elementDate = csSelf:GetComponent("CLUIElementDate")
if elementDate then
elementDate.isSetTime = ((attr.ifTime and attr.ifTime == 1) and true or false)
end
elseif attr.attrType == DBCust.FieldType.checkbox then
_cell.enabeldObj(uiobjs.input, false)
local max = tonumber(attr.checkMax) or 0
uiobjs.checkbox.isMultMode = (max > 1) or (max == 0)
uiobjs.checkbox:init(attr)
elseif attr.attrType == DBCust.FieldType.popuplist then
_cell.enabeldObj(uiobjs.input, false)
if attr.popOptions then
uiobjs.popList:refreshItems(attr.popOptions, attr.popValues)
else
@@ -146,6 +116,9 @@ function _cell.show(go, data)
uiobjs.popList:refreshItems(array, array)
end
end
-- 设置展示的模式
_cell.setElementMode(mData.showMode or _FieldMode.inputOnly)
end
function _cell.enabeldObj(obj, val)
@@ -154,6 +127,123 @@ function _cell.enabeldObj(obj, val)
end
end
function _cell.setElementMode(mode)
local isPopList = uiobjs.popList
local isPopCheckbox = uiobjs.checkbox
---@type UIInput
local input = uiobjs.input
local inputOnGUI = csSelf:GetComponent("UIInputOnGUI")
local boxcollider = uiobjs.boxCollider
local ButtonReset = uiobjs.ButtonReset
if mode == _FieldMode.inputOnly then
_cell.enabeldObj(boxcollider, true)
_cell.enabeldObj(inputOnGUI, true)
_cell.enabeldObj(input, true)
if uiobjs.Label2 then
uiobjs.Label2.color = ColorEx.getColor(0xff999999)
end
if uiobjs.ButtonReset then
uiobjs.ButtonReset.disabled = false
end
if uiobjs.Label then
uiobjs.Label.text = uiobjs.inputLabel
end
if uiobjs.input then
uiobjs.input.defaultText = uiobjs.inputLabel
end
_cell.enabeldObj(uiobjs.Label4, true) -- multext
if
attr.attrType == DBCust.FieldType.dateTime or attr.attrType == DBCust.FieldType.checkbox or
attr.attrType == DBCust.FieldType.popuplist
then
_cell.enabeldObj(uiobjs.SpriteRight, true)
else
_cell.enabeldObj(uiobjs.SpriteRight, false)
end
elseif mode == _FieldMode.showOnly then
_cell.enabeldObj(boxcollider, false)
_cell.enabeldObj(inputOnGUI, false)
_cell.enabeldObj(input, false)
if uiobjs.Label2 then
uiobjs.Label2.color = ColorEx.getColor(0xff999999)
end
if uiobjs.ButtonReset then
uiobjs.ButtonReset.disabled = true
end
if uiobjs.Label then
uiobjs.Label.text = ""
end
if uiobjs.input then
uiobjs.input.defaultText = ""
end
_cell.enabeldObj(uiobjs.Label4, false)
_cell.enabeldObj(uiobjs.SpriteRight, false)
elseif mode == _FieldMode.modifyOnly then
_cell.enabeldObj(boxcollider, true)
_cell.enabeldObj(inputOnGUI, false)
_cell.enabeldObj(input, false)
if uiobjs.Label2 then
uiobjs.Label2.color = ColorEx.getColor(0xff999999)
end
if uiobjs.ButtonReset then
uiobjs.ButtonReset.disabled = true
end
if uiobjs.Label then
uiobjs.Label.text = uiobjs.inputLabel
end
if uiobjs.input then
uiobjs.input.defaultText = uiobjs.inputLabel
end
_cell.enabeldObj(uiobjs.Label4, true)
_cell.enabeldObj(uiobjs.SpriteRight, true)
elseif mode == _FieldMode.showAndModify then
_cell.enabeldObj(boxcollider, true)
_cell.enabeldObj(inputOnGUI, false)
_cell.enabeldObj(input, false)
if uiobjs.Label2 then
uiobjs.Label2.color = ColorEx.getColor(0xff999999)
end
if uiobjs.ButtonReset then
uiobjs.ButtonReset.disabled = true
end
if uiobjs.Label then
uiobjs.Label.text = ""
end
if uiobjs.input then
uiobjs.input.defaultText = ""
end
_cell.enabeldObj(uiobjs.Label4, false)
_cell.enabeldObj(uiobjs.SpriteRight, true)
elseif mode == _FieldMode.button then
_cell.enabeldObj(boxcollider, true)
_cell.enabeldObj(inputOnGUI, false)
_cell.enabeldObj(input, false)
if uiobjs.Label2 then
uiobjs.Label2.color = ColorEx.getColor(0xff363636)
end
if uiobjs.ButtonReset then
uiobjs.ButtonReset.disabled = true
end
if uiobjs.Label then
uiobjs.Label.text = ""
end
if uiobjs.input then
uiobjs.input.defaultText = ""
end
_cell.enabeldObj(uiobjs.Label4, false)
_cell.enabeldObj(uiobjs.SpriteRight, true)
end
-- 再次修正input
if
attr.attrType == DBCust.FieldType.dateTime or attr.attrType == DBCust.FieldType.checkbox or
attr.attrType == DBCust.FieldType.popuplist
then
_cell.enabeldObj(input, false)
end
end
-- 取得数据
function _cell.getData()
return mData
@@ -164,12 +254,12 @@ function _cell.uiEventDelegate(go)
-- 说明大文本框改变了
NGUITools.AddWidgetCollider(csSelf.gameObject, false)
uiobjs.Label4.enabled = (uiobjs.element.value == "" and true or false)
Utl.doCallback(mData.onMultTextInputChg, csSelf.gameObject)
Utl.doCallback(mData.onMultTextInputChg, uiobjs.element)
elseif
attr.attrType == DBCust.FieldType.number or attr.attrType == DBCust.FieldType.phone or
attr.attrType == DBCust.FieldType.text
then
Utl.doCallback(mData.onInputChange, csSelf.gameObject)
Utl.doCallback(mData.onInputChange, uiobjs.element)
end
end
@@ -178,9 +268,9 @@ function _cell.onNotifyLua(go)
attr.attrType == DBCust.FieldType.popuplist or attr.attrType == DBCust.FieldType.checkbox or
attr.attrType == DBCust.FieldType.dateTime
then
Utl.doCallback(mData.onSelect, csSelf.gameObject)
Utl.doCallback(mData.onSelect, uiobjs.element)
else
Utl.doCallback(mData.onClick, csSelf.gameObject)
Utl.doCallback(mData.onClick, uiobjs.element)
end
end

View File

@@ -15,6 +15,7 @@ local uiobjs = {}
local fieldsObjs = {}
local queue = CLLQueue.new()
local isLoading = false
local count = 0
-- 初始化,只调用一次
function _cell.init(csObj)
@@ -36,18 +37,6 @@ function _cell.show(go, data)
end
function _cell.refresh()
--[[
local taskId = tostring(cust.taskId)
if (not isFieldLoading) or taskId ~= oldtaskId then
isFieldLoading = true
oldtaskId = taskId
fields = DBCust.getFieldsByTask(taskId)
if fields and #fields > 0 then
showHotWheel()
_cell.initField(1, taskId)
end
end
]]
if queue:size() == 0 then
return
end
@@ -56,7 +45,9 @@ function _cell.refresh()
mData = queue:deQueue()
if mData.fields and #(mData.fields) > 0 then
showHotWheel()
_cell.initField(1)
for i, v in ipairs(mData.fields) do
_cell.initField(i)
end
else
_cell.onFinisInitFields()
end
@@ -73,6 +64,8 @@ function _cell.initField(index)
name = "InputMultText"
elseif fileAttr.attrType == DBCust.FieldType.checkbox then
name = "InputCheckboxs"
elseif fileAttr.attrType == DBCust.FieldType.empty then
name = "EmptySpace"
else
name = "InputText"
end
@@ -82,36 +75,45 @@ end
---@param go UnityEngine.GameObject
function _cell.onLoadField(name, go, orgs)
local index = orgs
go.transform.parent = transform
go.transform.localScale = Vector3.one
go.transform.localEulerAngles = Vector3.zero
---@type _ParamCellExtendFiled
local param = mData.fields[index]
local cell = go:GetComponent("CLCellLua")
SetActive(go, true)
if param.attr.attrType == DBCust.FieldType.multext then
-- 要设置一次
param.orgOnMultTextInputChg = param.onMultTextInputChg
param.onMultTextInputChg = _cell.onMultTextInputChg
end
cell:init(param, nil)
table.insert(fieldsObjs, cell)
uiobjs.Table:Reposition()
fieldsObjs[index] = cell
count = count + 1
Utl.doCallback(mData.onLoadOneField, cell)
if index == #(mData.fields) then
if count == #(mData.fields) then
_cell.onFinisInitFields()
else
_cell.initField(index + 1)
end
end
function _cell.onFinisInitFields()
isLoading = false
uiobjs.Table:Reposition()
for i, cell in ipairs(fieldsObjs) do
-- 在完成的时候时候再处理,是为了保证加进去的顺序不变
cell.transform.parent = transform
cell.transform.localScale = Vector3.one
cell.transform.localEulerAngles = Vector3.zero
SetActive(cell.gameObject, true)
uiobjs.Table:Reposition()
end
uiobjs.formRoot:setValue(mData.data)
uiobjs.Table.repositionNow = true
hideHotWheel()
Utl.doCallback(mData.onFinish, csSelf.gameObject)
_cell.refresh()
csSelf:invoke4Lua(
function()
Utl.doCallback(mData.onFinish, csSelf.gameObject)
isLoading = false
-- 再次处理
_cell.refresh()
end,
0.1
)
end
function _cell.release()
@@ -120,6 +122,7 @@ function _cell.release()
CLUIOtherObjPool.returnObj(v.gameObject)
end
fieldsObjs = {}
count = 0
end
function _cell.onMultTextInputChg(go)
@@ -139,5 +142,11 @@ function _cell.getData()
return mData
end
function _cell.OnDisable()
if #(fieldsObjs) > 0 then
printe("动态加载的字段没有释放")
end
end
--------------------------------------------
return _cell

View File

@@ -0,0 +1,69 @@
---@class _ParamCellImage
---@field path string
---@field onDelete function
-- xx单元
local _cell = {}
---@type Coolape.CLCellLua
local csSelf = nil
local transform = nil
---@type _ParamCellImage
local mData = nil
local uiobjs = {}
-- 初始化,只调用一次
function _cell.init(csObj)
csSelf = csObj
transform = csSelf.transform
---@type UITexture
uiobjs.texture = csSelf:GetComponent("UITexture")
end
-- 显示,
-- 注意c#侧不会在调用show时调用refresh
function _cell.show(go, data)
mData = data
local url
if startswith(mData.path, "/") then
url = joinStr("file://", mData.path)
else
url = mData.path
end
print(url)
if uiobjs.texture.mainTexture and uiobjs.texture.mainTexture.name == mData.path then
else
_cell.release()
DBTextures.getByUrl(url, _cell.onGetTextue, mData.path)
end
end
function _cell.onGetTextue(content, orgs)
if mData.path ~= orgs then
GameObject.DestroyImmediate(content)
content = nil
return
end
_cell.release()
content.name = orgs
uiobjs.texture.mainTexture = content
end
function _cell.release()
if uiobjs.texture.mainTexture ~= nil then
uiobjs.texture.mainTexture = nil
end
end
-- 取得数据
function _cell.getData()
return mData
end
function _cell.uiEventDelegate(go)
if go.name == "ButtonDel" then
Utl.doCallback(mData.onDelete, mData)
end
end
--------------------------------------------
return _cell

View File

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

View File

@@ -43,7 +43,7 @@ function CLLPStart.setLuasAtBegainning()
-- 日志监听
if ReporterMessageReceiver.self and ReporterMessageReceiver.self.gameObject then
-- if KKWhiteList.isWhiteName() then
ReporterMessageReceiver.self.gameObject:SetActive(false)
ReporterMessageReceiver.self.gameObject:SetActive(true)
-- else
-- ReporterMessageReceiver.self.gameObject:SetActive(false)
-- end

View File

@@ -80,6 +80,10 @@ function CSPMine.uiEventDelegate(go)
MyLocation.self:getMyLocation(CSPMine.onGetLocation)
elseif goName == "ButtonSetting" or goName == "ButtonMySetting" then
getPanelAsy("PanelSetting", onLoadedPanelTT)
elseif goName == "SpriteTopBg" then
getPanelAsy("PanelMyInfor", onLoadedPanelTT)
elseif goName == "ButtonAbout" then
getPanelAsy("PanelAbout", onLoadedPanelTT)
end
end

View File

@@ -154,9 +154,14 @@ function CSPTasks.setEventDelegate()
getPanelAsy("PanelCustList", onLoadedPanelTT)
end,
ButtonRecord = function()
getPanelAsy("PanelFollowList", onLoadedPanelTT)
end,
ButtonCustOcean = function()
end
end,
ButtonOrder = function()
getPanelAsy("PanelOrderList", onLoadedPanelTT)
end,
}
end
-- 处理ui上的事件例如点击等

View File

@@ -0,0 +1,136 @@
---@type IDBasePanel
local TRBasePanel = require("ui.panel.TRBasePanel")
---@class TRPAbout:TRBasePanel 邮件列表
local TRPAbout = class("TRPAbout", TRBasePanel)
local uiobjs = {}
-- 初始化,只会调用一次
function TRPAbout:init(csObj)
TRPAbout.super.init(self, csObj)
self:initFiledsAttr()
self:setEventDelegate()
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132 + 500, 0)
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
---@type UITable
uiobjs.Table = getCC(uiobjs.scrollView.transform, "Table", "UITable")
---@type CLUIFormRoot
uiobjs.TableForm = uiobjs.Table:GetComponent("CLUIFormRoot")
---@type Coolape.CLCellLua
uiobjs.TableLua = uiobjs.Table:GetComponent("CLCellLua")
end
function TRPAbout:initFiledsAttr()
---@type _ParamFieldAttr
local attr
self.baseFiledsAttr = {}
attr = {}
attr.attrName = "更新动态"
attr.id = "upgrade"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "服务协议"
attr.id = "serviceAgreement"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "发布评价"
attr.id = "assess"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
end
-- 设置数据
---@param paras _ParamTRPAbout
function TRPAbout:setData(paras)
self.mdata = {}
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPAbout:show()
---@type _ParamCellExtendFiledRoot
local fieldRootInfor = {}
fieldRootInfor.fields = {}
fieldRootInfor.data = self.mdata
fieldRootInfor.onFinish = self:wrapFunc(self.reposition)
for i, v in ipairs(self.baseFiledsAttr) do
---@type _ParamCellExtendFiled
local d = {}
d.attr = v
d.showMode = _FieldMode.button
d.onClick = self:wrapFunc(self.onClickField)
d.onSelect = self:wrapFunc(self.onSelectField)
table.insert(fieldRootInfor.fields, d)
end
uiobjs.TableLua:init(fieldRootInfor, nil)
end
---@param el CLUIElement
function TRPAbout:onClickField(el)
if el.jsonKey == "upgrade" then
-- 更新
elseif el.jsonKey == "serviceAgreement" then
-- 显示协议
elseif el.jsonKey == "assess" then
-- 评价(这个做起来麻烦)
end
end
function TRPAbout:onSelectField(go)
end
function TRPAbout:reposition()
uiobjs.Table:Reposition()
uiobjs.Table.repositionNow = true
uiobjs.scrollView:ResetPosition()
end
-- 刷新
function TRPAbout:refresh()
uiobjs.TableLua.luaTable.release()
end
-- 关闭页面
function TRPAbout:hide()
uiobjs.TableLua.luaTable.release()
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPAbout:procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
--[[
if cmd == xx then
end
]]
end
end
function TRPAbout:setEventDelegate()
self.EventDelegate = {}
end
-- 处理ui上的事件例如点击等
function TRPAbout:uiEventDelegate(go)
local func = self.EventDelegate[go.name]
if func then
func(go)
end
end
-- 当顶层页面发生变化时回调
function TRPAbout:onTopPanelChange(topPanel)
end
--------------------------------------------
return TRPAbout

View File

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

View File

@@ -246,6 +246,7 @@ function TRPCustDetail:setEventDelegate()
ButtonNewFollow = function()
end,
ButtonNewTask = function()
getPanelAsy("PanelNewFollowTask", onLoadedPanelTT, self.mdata)
end,
ButtonCall = function()
MyUtl.callCust(self.mdata)

View File

@@ -75,7 +75,7 @@ function TRPCustFilter:setData(paras)
end
d = {}
d.title = "任务类型"
d.title = "客户类型"
d.key = DBCust.FilterGroup.custTypeList
d.key2 = "custType"
d.list = DBCust.getFilter(DBCust.FilterGroup.custTypeList)

View File

@@ -0,0 +1,223 @@
---@type IDBasePanel
local TRBasePanel = require("ui.panel.TRBasePanel")
---@class TRPFollowList:TRBasePanel 邮件列表
local TRPFollowList = class("TRPFollowList", TRBasePanel)
local uiobjs = {}
-- 初始化,只会调用一次
function TRPFollowList:init(csObj)
TRPFollowList.super.init(self, csObj)
self:setEventDelegate()
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: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")
end
-- 设置数据
---@param paras _ParamTRPFollowList
function TRPFollowList:setData(paras)
self.mdata = paras
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPFollowList:show()
uiobjs.InputSeachKey.value = ""
self:refreshFilterBtnStatus()
self:showList({})
showHotWheel()
NetProto.send.list_customers(self.filterValue, "", 1)
end
function TRPFollowList:showList(list)
SetActive(uiobjs.ButtonHeadList.gameObject, false)
SetActive(uiobjs.ButtonEndList.gameObject, false)
uiobjs.Grid:setList(
list or {},
self:wrapFunc(self.initCell),
self:wrapFunc(self.onHeadList),
self:wrapFunc(self.onEndList)
)
uiobjs.scrollView:ResetPosition()
end
function TRPFollowList:appList(list)
SetActive(uiobjs.ButtonEndList.gameObject, false)
uiobjs.Grid:appendList(list)
end
function TRPFollowList:onShowRefreshFlg()
-- printe("TRPFollowList:onShowRefreshFlg")
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 395, 0)
SetActive(uiobjs.ButtonHeadList.gameObject, true)
end
function TRPFollowList:onhideRefreshFlg()
-- printe("TRPFollowList:onhideRefreshFlg")
SetActive(uiobjs.ButtonHeadList.gameObject, false)
end
function TRPFollowList:refreshList()
local queryKey = uiobjs.InputSeachKey.value
showHotWheel()
NetProto.send.list_customers(self.filterValue, queryKey, 1)
end
function TRPFollowList:onHeadList(head)
printw("到最顶端了")
-- uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 250, 0)
-- SetActive(uiobjs.ButtonHeadList.gameObject, true)
end
function TRPFollowList: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_customers(self.filterValue, queryKey, self.pageInfo.current_page + 1)
else
uiobjs.ButtonEndList.localPosition = tail.transform.localPosition + Vector3.up * -335
SetActive(uiobjs.ButtonEndList.gameObject, true)
end
end
function TRPFollowList:initCell(cell, data)
cell:init(data, self:wrapFunc(self.onClickCell))
end
function TRPFollowList:onClickCell(cell, data)
getPanelAsy("PanelCustDetail", onLoadedPanelTT, data)
end
function TRPFollowList: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 TRPFollowList: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 TRPFollowList:refresh()
end
-- 关闭页面
function TRPFollowList:hide()
self.filterValue = nil
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPFollowList:procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
if cmd == NetProto.cmds.list_customers 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 TRPFollowList:setEventDelegate()
self.EventDelegate = {
ButtonAddCust = function()
getPanelAsy("PanelNewCust", onLoadedPanelTT)
end,
ButtonFilter = function()
getPanelAsy(
"PanelCustFilter",
onLoadedPanelTT,
{
callback = self:wrapFunc(self.onSetFilter),
queryKey = uiobjs.InputSeachKey.value,
defautFilter = self.filters
}
)
end,
InputSeachKey = function()
local queryKey = uiobjs.InputSeachKey.value
NetProto.send.list_customers(self.filterValue, queryKey, 1)
end
}
end
function TRPFollowList: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 TRPFollowList: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_customers(self.filterValue, queryKey, 1)
else
-- 会触发input的onChange事件
end
end
-- 处理ui上的事件例如点击等
function TRPFollowList:uiEventDelegate(go)
local func = self.EventDelegate[go.name]
if func then
func()
end
end
-- 当顶层页面发生变化时回调
function TRPFollowList:onTopPanelChange(topPanel)
end
--------------------------------------------
return TRPFollowList

View File

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

View File

@@ -0,0 +1,264 @@
---@type IDBasePanel
local TRBasePanel = require("ui.panel.TRBasePanel")
---@class TRPMyInfor:TRBasePanel 邮件列表
local TRPMyInfor = class("TRPMyInfor", TRBasePanel)
local uiobjs = {}
-- 初始化,只会调用一次
function TRPMyInfor:init(csObj)
TRPMyInfor.super.init(self, csObj)
self:initFiledsAttr()
self:setEventDelegate()
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132 + 40 + 300, 0)
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
---@type UITable
uiobjs.Table = getCC(uiobjs.scrollView.transform, "Table", "UITable")
---@type CLUIFormRoot
uiobjs.TableForm = uiobjs.Table:GetComponent("CLUIFormRoot")
---@type Coolape.CLCellLua
uiobjs.TableLua = uiobjs.Table:GetComponent("CLCellLua")
---@type CLUIFormRoot
uiobjs.Top = getCC(self.transform, "Top", "CLUIFormRoot")
---@type UITexture
uiobjs.HeadIcon = getCC(uiobjs.Top.transform, "SpriteHeadBg/SpriteHeadIcon", "UITexture")
end
function TRPMyInfor:initFiledsAttr()
---@type _ParamFieldAttr
local attr
self.baseFiledsAttr = {}
attr = {}
attr.attrName = "姓名"
attr.id = "loginName"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "工号"
attr.id = "loginNo"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.cannotEdit = true
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "部门"
attr.id = ""
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.cannotEdit = true
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "角色"
attr.id = ""
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.cannotEdit = true
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrType = DBCust.FieldType.empty
attr.height = 40
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "邮箱"
attr.id = ""
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.cannotEdit = true
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "手机"
attr.id = ""
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.cannotEdit = true
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "分机号"
attr.id = ""
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.cannotEdit = true
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
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
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()
---@type _ParamCellExtendFiledRoot
local fieldRootInfor = {}
fieldRootInfor.fields = {}
fieldRootInfor.data = self.mdata
fieldRootInfor.onFinish = self:wrapFunc(self.reposition)
for i, v in ipairs(self.baseFiledsAttr) do
---@type _ParamCellExtendFiled
local d = {}
d.attr = v
if d.attr.id == "loginNo" then
d.showMode = _FieldMode.showOnly
else
d.showMode = _FieldMode.showAndModify
end
d.onClick = self:wrapFunc(self.onClickField)
d.onSelect = self:wrapFunc(self.onSelectField)
table.insert(fieldRootInfor.fields, d)
end
uiobjs.TableLua:init(fieldRootInfor, nil)
self:setHeadInfor()
end
function TRPMyInfor:setHeadInfor()
DBUser.getIcon(
self.mdata.loginNo,
function(content)
uiobjs.HeadIcon.mainTexture = content
end
)
end
function TRPMyInfor:onClickField(go)
---@type CLUIElement
local el = go:GetComponent("CLUIElement")
getPanelAsy(
"PanelModifyFiled",
onLoadedPanelTT,
{
label = el.labeName.text,
key = el.jsonKey,
value = el.value,
canNull = el.canNull,
callback = self:wrapFunc(self.onFinishSetField)
}
)
end
function TRPMyInfor:onFinishSetField(key, val)
if tostring(val) ~= tostring(self.mdata[key]) then
-- self:sendModifymsg(key, val, true)
--//TODO:
end
end
function TRPMyInfor:onSelectField(go)
end
function TRPMyInfor:reposition()
uiobjs.Table:Reposition()
uiobjs.Table.repositionNow = true
uiobjs.scrollView:ResetPosition()
end
-- 刷新
function TRPMyInfor:refresh()
end
-- 关闭页面
function TRPMyInfor:hide()
uiobjs.TableLua.luaTable.release()
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPMyInfor:procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
--[[
if cmd == xx then
end
]]
end
end
function TRPMyInfor:setEventDelegate()
self.EventDelegate = {
SpriteTopbg = function(go)
-- 修改头像
---@type UIPopupList
local popList = go:GetComponent("UIPopupList")
if popList.value == "1" then
-- 相机
local permission = MyCamera.getImage(self:wrapFunc(self.onGetImage))
if permission ~= NativeCamera.Permission.Granted then
CLUIUtl.showConfirm(
"没有使用相机的权限,打开设置允许使用相机",
function()
if not MyCamera.openSetting() then
MyUtl.toastW("打开权限设置失败")
end
end,
nil
)
end
elseif popList.value == "2" then
local permission = MyGallery.getImage(self:wrapFunc(self.onGetImage))
if permission ~= NativeGallery.Permission.Granted then
CLUIUtl.showConfirm(
"没有使用相册的权限,打开设置允许使用相册",
function()
if not MyGallery.openSetting() then
MyUtl.toastW("打开权限设置失败")
end
end,
nil
)
end
end
end
}
end
function TRPMyInfor:onGetImage(path)
if isNilOrEmpty(path) then
return
end
--//TODO:
end
-- 处理ui上的事件例如点击等
function TRPMyInfor:uiEventDelegate(go)
local func = self.EventDelegate[go.name]
if func then
func(go)
end
end
-- 当顶层页面发生变化时回调
function TRPMyInfor:onTopPanelChange(topPanel)
end
--------------------------------------------
return TRPMyInfor

View File

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

View File

@@ -137,7 +137,6 @@ function TRPNewCust:showExtentFiles(taskId)
---@type _ParamCellExtendFiledRoot
local param = {}
param.data = self.mdata and self.mdata.jsonStr or {}
-- param.isEditMode = true
param.onFinish = self:wrapFunc(self.setExtendFieldsMode)
param.fields = {}
local fields = DBCust.getFieldsByTask(taskId) or {}
@@ -146,7 +145,7 @@ function TRPNewCust:showExtentFiles(taskId)
for i, v in ipairs(fields) do
filedInfor = {}
filedInfor.attr = v
filedInfor.isEditMode = true
filedInfor.showMode = self.isNewCust and _FieldMode.inputOnly or _FieldMode.modifyOnly
if not self.isNewCust then
filedInfor.onClick = self:wrapFunc(self.onClickInputField4Extend)
filedInfor.onSelect = self:wrapFunc(self.onPopupFieldValChg4Extend)

View File

@@ -1,14 +1,14 @@
---@type IDBasePanel
local TRBasePanel = require("ui.panel.TRBasePanel")
---@class TRPNewFollow:TRBasePanel 邮件列表
local TRPNewFollow = class("TRPNewFollow", TRBasePanel)
---@class TRPNewFollowSimple:TRBasePanel 邮件列表
local TRPNewFollowSimple = class("TRPNewFollowSimple", TRBasePanel)
local uiobjs = {}
local stars = {}
-- 初始化,只会调用一次
function TRPNewFollow:init(csObj)
TRPNewFollow.super.init(self, csObj)
function TRPNewFollowSimple:init(csObj)
TRPNewFollowSimple.super.init(self, csObj)
self:initFiledsAttr()
self:setEventDelegate()
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132, 0)
@@ -25,7 +25,7 @@ function TRPNewFollow:init(csObj)
uiobjs.ButtonSave = getChild(self.transform, "Top/ButtonSave")
end
function TRPNewFollow:initFiledsAttr()
function TRPNewFollowSimple:initFiledsAttr()
---@type _ParamFieldAttr
local attr
self.baseFiledsAttr = {}
@@ -35,6 +35,9 @@ function TRPNewFollow:initFiledsAttr()
attr.attrType = DBCust.FieldType.popuplist
attr.ifMust = 0
attr.donotJoinKey = true
local popInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.followUpTypeList)
attr.popOptions = popInfor.options
attr.popValues = popInfor.values
table.insert(self.baseFiledsAttr, attr)
attr = {}
@@ -58,8 +61,8 @@ function TRPNewFollow:initFiledsAttr()
end
-- 设置数据
---@param paras _ParamTRPNewFollow
function TRPNewFollow:setData(paras)
---@param paras _ParamTRPNewFollowSimple
function TRPNewFollowSimple:setData(paras)
self.mdata = {}
self.mdata.custId = paras.custId
self.mdata.taskId = paras.taskId
@@ -68,19 +71,19 @@ function TRPNewFollow:setData(paras)
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPNewFollow:show()
function TRPNewFollowSimple:show()
self:refreshContent()
SetActive(uiobjs.ButtonSave.gameObject, self.isNewFollow)
uiobjs.scrollView:ResetPosition()
end
function TRPNewFollow:refreshContent()
function TRPNewFollowSimple:refreshContent()
self:showBaseFields()
self.csSelf:invoke4Lua(self:wrapFunc(self.reposition), 0.1)
end
function TRPNewFollow:showBaseFields()
function TRPNewFollowSimple:showBaseFields()
---@type _ParamCellExtendFiledRoot
local param = {}
param.data = self.mdata or {}
@@ -104,10 +107,9 @@ function TRPNewFollow:showBaseFields()
uiobjs.DetailRoot:init(param, nil)
end
function TRPNewFollow:onPopupFieldValChg(go)
function TRPNewFollowSimple:onPopupFieldValChg(go)
---@type CLUIElement
local el = go:GetComponent("CLUIElement")
printe(el.jsonKey)
if el.jsonKey == "dealFlag" then
if uiobjs.followUpContent and isNilOrEmpty(uiobjs.followUpContent.value) then
local popList = go:GetComponent("UIPopupList")
@@ -116,12 +118,12 @@ function TRPNewFollow:onPopupFieldValChg(go)
end
end
function TRPNewFollow:reposition()
function TRPNewFollowSimple:reposition()
uiobjs.DetailRootTabel.repositionNow = true
uiobjs.Table.repositionNow = true
end
function TRPNewFollow:setExtendFieldsMode(root)
function TRPNewFollowSimple:setExtendFieldsMode(root)
local elements = root:GetComponentsInChildren(typeof(CLUIElement), true)
for i = 0, elements.Length - 1 do
self:setElementMode(elements[i])
@@ -133,7 +135,7 @@ function TRPNewFollow:setExtendFieldsMode(root)
self:reposition()
end
function TRPNewFollow:setElementMode(el)
function TRPNewFollowSimple:setElementMode(el)
local isPopList = el:GetComponent("UIPopupList")
local isPopCheckbox = el:GetComponent("CLUICheckbox")
---@type UIInput
@@ -174,18 +176,18 @@ function TRPNewFollow:setElementMode(el)
end
-- 刷新
function TRPNewFollow:refresh()
function TRPNewFollowSimple:refresh()
end
-- 关闭页面
function TRPNewFollow:hide()
function TRPNewFollowSimple:hide()
if uiobjs.DetailRoot.luaTable then
uiobjs.DetailRoot.luaTable.release()
end
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPNewFollow:procNetwork(cmd, succ, msg, paras)
function TRPNewFollowSimple:procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
if cmd == NetProto.cmds.update_customer then
self:refreshContent()
@@ -193,7 +195,7 @@ function TRPNewFollow:procNetwork(cmd, succ, msg, paras)
end
end
function TRPNewFollow:setEventDelegate()
function TRPNewFollowSimple:setEventDelegate()
self.EventDelegate = {
ButtonSave = function()
local err = uiobjs.DetailFromRoot:checkValid()
@@ -217,7 +219,7 @@ function TRPNewFollow:setEventDelegate()
}
end
-- 处理ui上的事件例如点击等
function TRPNewFollow:uiEventDelegate(go)
function TRPNewFollowSimple:uiEventDelegate(go)
local func = self.EventDelegate[go.name]
if func then
func()
@@ -225,8 +227,8 @@ function TRPNewFollow:uiEventDelegate(go)
end
-- 当顶层页面发生变化时回调
function TRPNewFollow:onTopPanelChange(topPanel)
function TRPNewFollowSimple:onTopPanelChange(topPanel)
end
--------------------------------------------
return TRPNewFollow
return TRPNewFollowSimple

View File

@@ -0,0 +1,229 @@
---@type IDBasePanel
local TRBasePanel = require("ui.panel.TRBasePanel")
---@class TRPNewFollowTask:TRBasePanel
local TRPNewFollowTask = class("TRPNewFollowTask", TRBasePanel)
local uiobjs = {}
local stars = {}
-- 初始化,只会调用一次
function TRPNewFollowTask:init(csObj)
TRPNewFollowTask.super.init(self, csObj)
self:initFiledsAttr()
self:setEventDelegate()
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132, 0)
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
---@type UITable
uiobjs.Table = getCC(uiobjs.scrollView.transform, "Table", "UITable")
---@type CLUIFormRoot
uiobjs.DetailFromRoot = getCC(uiobjs.Table.transform, "DetailRoot", "CLUIFormRoot")
uiobjs.DetailRoot = getCC(uiobjs.Table.transform, "DetailRoot", "CLCellLua")
---@type UITable
uiobjs.DetailRootTabel = uiobjs.DetailRoot:GetComponent("UITable")
uiobjs.ButtonSave = getChild(self.transform, "Top/ButtonSave")
end
function TRPNewFollowTask:initFiledsAttr()
---@type _ParamFieldAttr
local attr
self.baseFiledsAttr = {}
attr = {}
attr.attrName = "跟进内容"
attr.id = "bookingNote"
attr.attrType = DBCust.FieldType.multext
attr.ifMust = 1
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "跟进时间"
attr.id = "FollowUpTime"
attr.attrType = DBCust.FieldType.dateTime
attr.ifTime = 1
attr.ifMust = 1
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "跟进人员"
attr.id = "loginNo"
attr.attrType = DBCust.FieldType.popuplist
attr.ifMust = 1
attr.donotJoinKey = true
local popList = DBCust.getFilter4Popup(DBCust.FilterGroup.loginNoList)
attr.popOptions = popList.options
attr.popValues = popList.values
table.insert(self.baseFiledsAttr, attr)
end
-- 设置数据
---@param paras _ParamTRPNewFollowTask
function TRPNewFollowTask:setData(paras)
self.mdata = {}
self.mdata.custId = paras.custId
self.mdata.taskId = paras.taskId
self.isNewFollow = true
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPNewFollowTask:show()
self:refreshContent()
SetActive(uiobjs.ButtonSave.gameObject, self.isNewFollow)
uiobjs.scrollView:ResetPosition()
end
function TRPNewFollowTask:refreshContent()
self:showBaseFields()
self.csSelf:invoke4Lua(self:wrapFunc(self.reposition), 0.1)
end
function TRPNewFollowTask:showBaseFields()
---@type _ParamCellExtendFiledRoot
local param = {}
param.data = self.mdata or {}
param.onFinish = self:wrapFunc(self.setExtendFieldsMode)
param.fields = {}
---@type _ParamCellExtendFiled
local filedInfor
for i, v in ipairs(self.baseFiledsAttr) do
-- 工单模板
filedInfor = {}
filedInfor.attr = v
filedInfor.isEditMode = true
if filedInfor.attr.attrType == DBCust.FieldType.multext then
filedInfor.onMultTextInputChg = self:wrapFunc(self.reposition)
end
filedInfor.onClick = nil
filedInfor.onSelect = self:wrapFunc(self.onPopupFieldValChg)
table.insert(param.fields, filedInfor)
end
uiobjs.DetailRoot:init(param, nil)
end
function TRPNewFollowTask:onPopupFieldValChg(go)
---@type CLUIElement
local el = go:GetComponent("CLUIElement")
if el.jsonKey == "dealFlag" then
if uiobjs.followUpContent and isNilOrEmpty(uiobjs.followUpContent.value) then
local popList = go:GetComponent("UIPopupList")
uiobjs.followUpContent.value = popList.selectedItem
end
end
end
function TRPNewFollowTask:reposition()
uiobjs.DetailRootTabel.repositionNow = true
uiobjs.Table.repositionNow = true
end
function TRPNewFollowTask:setExtendFieldsMode(root)
local elements = root:GetComponentsInChildren(typeof(CLUIElement), true)
for i = 0, elements.Length - 1 do
self:setElementMode(elements[i])
if elements[i].jsonKey == "followUpContent" then
---@type CLUIElement
uiobjs.followUpContent = elements[i]
end
end
self:reposition()
end
function TRPNewFollowTask:setElementMode(el)
local isPopList = el:GetComponent("UIPopupList")
local isPopCheckbox = el:GetComponent("CLUICheckbox")
---@type UIInput
local input = el:GetComponent("UIInput")
local inputOnGUI = el:GetComponent("UIInputOnGUI")
local boxcollider = el:GetComponent("BoxCollider")
local ButtonReset = getCC(el.transform, "ButtonReset", "MyInputReset")
if (not self.isNewFollow) and (el.jsonKey == "taskId" or el.jsonKey == "phoneNo") then
boxcollider.enabled = false
else
boxcollider.enabled = true
end
if ButtonReset then
ButtonReset.disabled = (not self.isNewFollow)
end
if input then
if isPopList or isPopCheckbox then
input.enabled = false
if inputOnGUI then
inputOnGUI.enabled = false
end
else
if self.isNewFollow then
input.enabled = true
if inputOnGUI then
inputOnGUI.enabled = true
end
else
input.enabled = false
if inputOnGUI then
inputOnGUI.enabled = false
end
end
end
end
end
-- 刷新
function TRPNewFollowTask:refresh()
end
-- 关闭页面
function TRPNewFollowTask:hide()
if uiobjs.DetailRoot.luaTable then
uiobjs.DetailRoot.luaTable.release()
end
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPNewFollowTask:procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
if cmd == NetProto.cmds.update_customer then
self:refreshContent()
end
end
end
function TRPNewFollowTask:setEventDelegate()
self.EventDelegate = {
ButtonSave = function()
local err = uiobjs.DetailFromRoot:checkValid()
if not isNilOrEmpty(err) then
MyUtl.toastW(err)
return
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)
end
end)
end
}
end
-- 处理ui上的事件例如点击等
function TRPNewFollowTask:uiEventDelegate(go)
local func = self.EventDelegate[go.name]
if func then
func()
end
end
-- 当顶层页面发生变化时回调
function TRPNewFollowTask:onTopPanelChange(topPanel)
end
--------------------------------------------
return TRPNewFollowTask

View File

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

View File

@@ -33,6 +33,11 @@ function TRPNewOrder:init(csObj)
uiobjs.InputNextLogino = getCC(uiobjs.StepRoot.transform, "InputNextLogino", "UIPopupList")
uiobjs.gridProjects = getCC(uiobjs.Table.transform, "InputSelectProduct/Products", "UIGrid")
uiobjs.gridProjectsPrefab = getChild(uiobjs.gridProjects.transform, "00000").gameObject
uiobjs.InputAttachment = getCC(uiobjs.Table.transform, "InputAttachment", "UIPopupList")
uiobjs.gridImages = getCC(uiobjs.InputAttachment.transform, "Grid", "UIGrid")
uiobjs.gridImagesPrefab = getChild(uiobjs.gridImages.transform, "00000").gameObject
-- uiobjs.elements = uiobjs.DetailRoot.gameObject:GetComponentsInChildren(typeof(CLUIElement), true)
uiobjs.ButtonSave = getChild(self.transform, "Top/ButtonSave")
end
@@ -138,7 +143,7 @@ function TRPNewOrder:setData(paras)
---@type _DBCust
self.cust = nil
else
--//TODO:初始值
-- 初始值
self.isNewOrder = true
---@type _DBCust
self.cust = paras
@@ -150,6 +155,7 @@ function TRPNewOrder:setData(paras)
local templateInfor = DBOrder.getTemplateInfor(self.mdata.templetId)
self.mdata.content = templateInfor.content
self.selectedProducts = {}
self.images = {}
end
end
@@ -171,6 +177,10 @@ end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPNewOrder:show()
SetActive(uiobjs.gridProjects.transform.parent.gameObject, false)
SetActive(uiobjs.StepFormRoot.gameObject, false)
SetActive(uiobjs.ExtendRoot.gameObject, false)
self:refreshContent()
SetActive(uiobjs.ButtonSave.gameObject, self.isNewOrder)
@@ -180,8 +190,6 @@ end
function TRPNewOrder:refreshContent()
self:showBaseFields()
self:showProducts()
local templetId = self.mdata and self.mdata.templetId or nil
self:showExtentFiles(templetId)
self.csSelf:invoke4Lua(self:wrapFunc(self.reposition), 0.1)
end
@@ -217,6 +225,8 @@ function TRPNewOrder:showBaseFields()
local param = {}
param.data = self.mdata or {}
param.onFinish = function(go)
local templetId = self.mdata and self.mdata.templetId or nil
self:showExtentFiles(templetId)
if self.cust then
uiobjs.DetailFromRoot:setValue(self.cust, true)
end
@@ -230,7 +240,7 @@ function TRPNewOrder:showBaseFields()
-- 工单模板
filedInfor = {}
filedInfor.attr = v
filedInfor.isEditMode = true
filedInfor.showMode = self.isNewOrder and _FieldMode.inputOnly or _FieldMode.modifyOnly
if filedInfor.attr.attrType == DBCust.FieldType.multext then
filedInfor.onMultTextInputChg = self:wrapFunc(self.reposition)
end
@@ -260,7 +270,7 @@ function TRPNewOrder:showExtentFiles(templetId)
for i, v in ipairs(fields) do
filedInfor = {}
filedInfor.attr = v
filedInfor.isEditMode = true
filedInfor.showMode = self.isNewOrder and _FieldMode.inputOnly or _FieldMode.modifyOnly
if filedInfor.attr.attrType == DBCust.FieldType.multext then
filedInfor.onMultTextInputChg = self:wrapFunc(self.reposition)
end
@@ -299,11 +309,16 @@ function TRPNewOrder:showExtentFiles(templetId)
local d = uiobjs.DetailFromRoot:getValue(true)
d.content = cfgInfor.content
uiobjs.DetailFromRoot:setValue(d)
-------
-- 附件
self:showImages()
-----------------------------------
uiobjs.StepRoot:Reposition()
end
function TRPNewOrder:reposition()
uiobjs.DetailRootTabel:Reposition()
uiobjs.Table:Reposition()
uiobjs.DetailRootTabel.repositionNow = true
uiobjs.Table.repositionNow = true
end
@@ -566,12 +581,75 @@ function TRPNewOrder:setEventDelegate()
{selectedProducts = self.selectedProducts, callback = self:wrapFunc(self.onGetSelectedProducts)}
)
end,
InputAttachment = function()
InputAttachment = function(go)
-- 添加附件
---@type UIPopupList
local popList = go:GetComponent("UIPopupList")
if popList.value == "1" then
-- 相机
local permission = MyCamera.getImage(self:wrapFunc(self.onGetImage))
if permission ~= NativeCamera.Permission.Granted then
CLUIUtl.showConfirm(
"没有使用相机的权限,打开设置允许使用相机",
function()
if not MyCamera.openSetting() then
MyUtl.toastW("打开权限设置失败")
end
end,
nil
)
end
elseif popList.value == "2" then
local permission = MyGallery.getImage(self:wrapFunc(self.onGetImage))
if permission ~= NativeGallery.Permission.Granted then
CLUIUtl.showConfirm(
"没有使用相册的权限,打开设置允许使用相册",
function()
if not MyGallery.openSetting() then
MyUtl.toastW("打开权限设置失败")
end
end,
nil
)
end
end
end
}
end
function TRPNewOrder:onGetImage(path)
if isNilOrEmpty(path) then
return
end
for i, v in ipairs(self.images) do
if v.path == path then
MyUtl.toast("已在列表中")
return
end
end
table.insert(self.images, {path = path, onDelete = self:wrapFunc(self.onDelImage)})
self:showImages()
end
function TRPNewOrder:showImages()
CLUIUtl.resetList4Lua(uiobjs.gridImages, uiobjs.gridImagesPrefab, self.images, self:wrapFunc(self.initImageCell))
end
function TRPNewOrder:initImageCell(cell, data)
cell:init(data, nil)
end
---@type _ParamCellImage
function TRPNewOrder:onDelImage(data)
for i, v in ipairs(self.images) do
if v.path == data.path then
table.remove(self.images, i)
break
end
end
self:showImages()
end
function TRPNewOrder:onGetSelectedProducts(list)
self.selectedProducts = list
self:showProducts()
@@ -581,7 +659,7 @@ end
function TRPNewOrder:uiEventDelegate(go)
local func = self.EventDelegate[go.name]
if func then
func()
func(go)
end
end

View File

@@ -0,0 +1,223 @@
---@type IDBasePanel
local TRBasePanel = require("ui.panel.TRBasePanel")
---@class TRPOrderList:TRBasePanel 邮件列表
local TRPOrderList = class("TRPOrderList", TRBasePanel)
local uiobjs = {}
-- 初始化,只会调用一次
function TRPOrderList:init(csObj)
TRPOrderList.super.init(self, csObj)
self:setEventDelegate()
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: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")
end
-- 设置数据
---@param paras _ParamTRPOrderList
function TRPOrderList:setData(paras)
self.mdata = paras
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPOrderList:show()
uiobjs.InputSeachKey.value = ""
self:refreshFilterBtnStatus()
self:showList({})
showHotWheel()
NetProto.send.list_customers(self.filterValue, "", 1)
end
function TRPOrderList:showList(list)
SetActive(uiobjs.ButtonHeadList.gameObject, false)
SetActive(uiobjs.ButtonEndList.gameObject, false)
uiobjs.Grid:setList(
list or {},
self:wrapFunc(self.initCell),
self:wrapFunc(self.onHeadList),
self:wrapFunc(self.onEndList)
)
uiobjs.scrollView:ResetPosition()
end
function TRPOrderList:appList(list)
SetActive(uiobjs.ButtonEndList.gameObject, false)
uiobjs.Grid:appendList(list)
end
function TRPOrderList:onShowRefreshFlg()
-- printe("TRPOrderList:onShowRefreshFlg")
uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 222, 0)
SetActive(uiobjs.ButtonHeadList.gameObject, true)
end
function TRPOrderList:onhideRefreshFlg()
-- printe("TRPOrderList:onhideRefreshFlg")
SetActive(uiobjs.ButtonHeadList.gameObject, false)
end
function TRPOrderList:refreshList()
local queryKey = uiobjs.InputSeachKey.value
showHotWheel()
NetProto.send.list_customers(self.filterValue, queryKey, 1)
end
function TRPOrderList:onHeadList(head)
printw("到最顶端了")
-- uiobjs.ButtonHeadList.transform.localPosition = Vector3(0, 250, 0)
-- SetActive(uiobjs.ButtonHeadList.gameObject, true)
end
function TRPOrderList: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_customers(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 TRPOrderList:initCell(cell, data)
cell:init(data, self:wrapFunc(self.onClickCell))
end
function TRPOrderList:onClickCell(cell, data)
getPanelAsy("PanelCustDetail", onLoadedPanelTT, data)
end
function TRPOrderList: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 TRPOrderList: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 TRPOrderList:refresh()
end
-- 关闭页面
function TRPOrderList:hide()
self.filterValue = nil
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPOrderList:procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
if cmd == NetProto.cmds.list_customers 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 TRPOrderList:setEventDelegate()
self.EventDelegate = {
ButtonAddCust = function()
getPanelAsy("PanelNewCust", onLoadedPanelTT)
end,
ButtonFilter = function()
getPanelAsy(
"PanelCustFilter",
onLoadedPanelTT,
{
callback = self:wrapFunc(self.onSetFilter),
queryKey = uiobjs.InputSeachKey.value,
defautFilter = self.filters
}
)
end,
InputSeachKey = function()
local queryKey = uiobjs.InputSeachKey.value
NetProto.send.list_customers(self.filterValue, queryKey, 1)
end
}
end
function TRPOrderList: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 TRPOrderList: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_customers(self.filterValue, queryKey, 1)
else
-- 会触发input的onChange事件
end
end
-- 处理ui上的事件例如点击等
function TRPOrderList:uiEventDelegate(go)
local func = self.EventDelegate[go.name]
if func then
func()
end
end
-- 当顶层页面发生变化时回调
function TRPOrderList:onTopPanelChange(topPanel)
end
--------------------------------------------
return TRPOrderList

View File

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