This commit is contained in:
2020-07-24 22:12:55 +08:00
parent 3f114a6fca
commit 67a1f974bf
117 changed files with 14258 additions and 2325 deletions

View File

@@ -1,101 +1,122 @@
-- xx单元
do
local _cell = {}
local csSelf = nil;
local transform = nil;
local grid;
local dayPrefab = nil;
local mData = nil;
local csSelf = nil
local transform = nil
local grid
local dayPrefab = nil
local mData = nil
local dayList
-- 初始化,只调用一次
function _cell.init(csObj)
csSelf = csObj;
transform = csSelf.transform;
grid = getChild(transform, "Grid"):GetComponent("UIGrid");
dayPrefab = getChild(grid.transform, "00000").gameObject;
end
-- 显示,
-- 注意c#侧不会在调用show时调用refresh
function _cell.show(go, data)
csSelf = csObj
transform = csSelf.transform
grid = getChild(transform, "Grid"):GetComponent("UIGrid")
dayPrefab = getChild(grid.transform, "00000").gameObject
end
-- 注意c#侧不会在调用show时调用refresh
function _cell.refresh(data, pageIndex)
mData = data;
mData = data
if (mData == nil) then
mData = {}
local curYear, curMonth = PanelCalender.getData();
local curYear, curMonth = PanelCalender.getData()
if (pageIndex < 0) then
mData.year, mData.month = PanelCalender.getYYHH_ByaddMonth(curYear, curMonth, -6 + pageIndex);
mData.year, mData.month = PanelCalender.getYYHH_ByaddMonth(curYear, curMonth, -6 + pageIndex)
else
mData.year, mData.month = PanelCalender.getYYHH_ByaddMonth(curYear, curMonth, -6 + pageIndex);
mData.year, mData.month = PanelCalender.getYYHH_ByaddMonth(curYear, curMonth, -6 + pageIndex)
end
end
dayList = _cell.resetCalender(mData.year, mData.month)
CLUIUtl.resetList4Lua(grid, dayPrefab, dayList, _cell.initCellDay)
end
CLUIUtl.resetList4Lua(grid, dayPrefab,
_cell.resetCalender(mData.year, mData.month),
_cell.initCellDay);
function _cell.doRefresh()
CLUIUtl.resetList4Lua(grid, dayPrefab, dayList, _cell.initCellDay)
end
-- 取得数据
function _cell.getData()
return mData;
return mData
end
function _cell.initCellDay(cell, day)
local data = {}
data.day = day;
-- print(mData.year);
-- print(mData.month);
-- print(day);
-- print("=================");
if (mData.year == DateTime.Now.Year and
mData.month == DateTime.Now.Month and
day == DateTime.Now.Day) then
data.isToday = true;
PanelCalender.setDefalutSelectDate(cell, mData.year, mData.month, day);
local data
if cell.luaTable then
data = cell.luaTable.getData()
else
data.isToday = false;
data.isSelected = false;
data = {}
end
local selectedYear, selectedMonth, selectedDay = PanelCalender.getSelectDate();
if (mData.year == selectedYear and mData.month == selectedMonth and selectedDay == data.day) then
data.isSelected = true;
data.day = day
local selectedYear, selectedMonth, selectedDay = PanelCalender.getSelectDate()
if (mData.year == DateTime.Now.Year and mData.month == DateTime.Now.Month and day == DateTime.Now.Day) then
data.isToday = true
if selectedYear == nil then
PanelCalender.setDefalutSelectDate(cell, mData.year, mData.month, day)
end
else
data.isToday = false
data.isSelected = false
end
cell:init(data, _cell.onClickDay);
data.isSelected = false
local isDateRange, startDate, endDate = PanelCalender.getDateRangeDate()
if isDateRange then
local tmpDate =
tonumber(
joinStr(
NumEx.nStrForLen(mData.year, 4),
NumEx.nStrForLen(mData.month, 2),
NumEx.nStrForLen(data.day, 2)
)
)
if tmpDate and (startDate and tmpDate >= startDate) and (endDate and tmpDate <= endDate) then
data.isSelected = true
elseif tmpDate and (startDate and tmpDate == startDate) and endDate == nil then
data.isSelected = true
else
data.isSelected = false
end
else
if (mData.year == selectedYear and mData.month == selectedMonth and selectedDay == data.day) then
data.isSelected = true
PanelCalender.setDefalutSelectDate(cell, mData.year, mData.month, day)
end
end
cell:init(data, _cell.onClickDay)
end
function _cell.onClickDay(cell)
local d = cell.luaTable.getData();
local d = cell.luaTable.getData()
if (d.day == -1) then
return;
return
end
local selectedDay = cell.luaTable.getData().day;
local selectedMonth = mData.month;
local selectedYear = mData.year;
local selectedDay = cell.luaTable.getData().day
local selectedMonth = mData.month
local selectedYear = mData.year
PanelCalender.setSelectDate(cell, selectedYear, selectedMonth, selectedDay);
PanelCalender.setSelectDate(cell, selectedYear, selectedMonth, selectedDay)
end
function _cell.resetCalender(year, month)
local list = ArrayList();
local dayCount = DateEx.getMothDays(year, month);
local week = DateEx.getWeek(year, month, 1);
local list = ArrayList()
local dayCount = DateEx.getMothDays(year, month)
local week = DateEx.getWeek(year, month, 1)
for i = 0, week - 1 do
list:Add(-1);
list:Add(-1)
end
for i = week, dayCount - 1 + week do
-- print(i .. "-" .. week .. "+1");
list:Add(i - week + 1);
list:Add(i - week + 1)
end
for i = dayCount + week, 41 do
list:Add(-1);
list:Add(-1)
end
return list;
return list
end
--------------------------------------------
return _cell;
return _cell
end

View File

@@ -0,0 +1,44 @@
-- 单元
local uiCell = {}
local csSelf = nil
local transform = nil
local gameObject = nil
-- local Background = nil;
local Label = nil
local mData = nil
local centerObj
function uiCell.init(go)
gameObject = go
transform = go.transform
csSelf = gameObject:GetComponent("CLCellLua")
-- Background = getChild(transform, "Background"):GetComponent("UISprite");
Label = csSelf:GetComponent("UILabel")
end
function uiCell.setCenterObj(val)
centerObj = val
uiCell.refresh()
end
function uiCell.show(go, data)
mData = data
uiCell.refresh()
end
function uiCell.refresh(flag)
Label.text = isNilOrEmpty(mData) and "请选择" or mData
if centerObj and centerObj.centeredObject and centerObj.centeredObject.name == gameObject.name then
Label.color = ColorEx.getColor(0xff2990dc)
else
Label.color = ColorEx.getColor(0xff363636)
end
end
function uiCell.getData()
return mData
end
return uiCell

View File

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

View File

@@ -12,6 +12,7 @@
---@field popValues
---@field donotJoinKey boolean 是否要拼接key
---@field height numb 高度只有在emptyspace有用
---@field defaultText
---@class _ParamCellExtendFiled
---@field showMode _FieldMode
@@ -152,7 +153,7 @@ function _cell.setElementMode(mode)
uiobjs.Label.text = uiobjs.inputLabel
end
if uiobjs.input then
uiobjs.input.defaultText = uiobjs.inputLabel
uiobjs.input.defaultText = attr.defaultText or uiobjs.inputLabel
end
_cell.enabeldObj(uiobjs.Label4, true) -- multext
if
@@ -179,7 +180,7 @@ function _cell.setElementMode(mode)
uiobjs.Label.text = ""
end
if uiobjs.input then
uiobjs.input.defaultText = ""
uiobjs.input.defaultText = attr.defaultText or ""
end
_cell.enabeldObj(uiobjs.Label4, false)
_cell.enabeldObj(uiobjs.SpriteRight, false)
@@ -196,7 +197,7 @@ function _cell.setElementMode(mode)
uiobjs.Label.text = uiobjs.inputLabel
end
if uiobjs.input then
uiobjs.input.defaultText = uiobjs.inputLabel
uiobjs.input.defaultText = attr.defaultText or uiobjs.inputLabel
end
_cell.enabeldObj(uiobjs.Label4, true)
_cell.enabeldObj(uiobjs.SpriteRight, true)
@@ -213,7 +214,7 @@ function _cell.setElementMode(mode)
uiobjs.Label.text = ""
end
if uiobjs.input then
uiobjs.input.defaultText = ""
uiobjs.input.defaultText = attr.defaultText or ""
end
_cell.enabeldObj(uiobjs.Label4, false)
_cell.enabeldObj(uiobjs.SpriteRight, true)
@@ -230,7 +231,7 @@ function _cell.setElementMode(mode)
uiobjs.Label.text = ""
end
if uiobjs.input then
uiobjs.input.defaultText = ""
uiobjs.input.defaultText = attr.defaultText or ""
end
_cell.enabeldObj(uiobjs.Label4, false)
_cell.enabeldObj(uiobjs.SpriteRight, true)

View File

@@ -28,7 +28,7 @@ function _cell.show(go, data)
mData = data
local optionInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.dealFlagList)
uiobjs.LabelStatus:refreshItems(optionInfor.options, optionInfor.values)
local optionInfor = DBUser.getPopList()
local optionInfor = DBUser.getPopList(DBUser.FilterGroup.user)
uiobjs.LabelServerNo:refreshItems(optionInfor.options, optionInfor.values)
if tostring(mData.dealFlag) == "0" then

View File

@@ -11,13 +11,9 @@ local uiobjs = {}
function _cell.init(csObj)
csSelf = csObj
transform = csSelf.transform
-- uiobjs.LabelCompanyName = getCC(transform, "LabelCompanyName", "UILabel")
-- uiobjs.LabelTime = getCC(transform, "LabelTime", "UILabel")
---@type UIPopupList
uiobjs.LabelStatus = getCC(transform, "LabelStatus", "UIPopupList")
-- uiobjs.LabelCustName = getCC(transform, "LabelCustName", "UILabel")
-- uiobjs.SpriteStatus = getCC(transform, "SpriteStatus", "UISprite")
uiobjs.LabelServerNo = getCC(transform, "LabelServerNo", "UILabel")
uiobjs.LabelServerNo = getCC(transform, "LabelServerNo", "UIPopupList")
---@type CLUIFormRoot
uiobjs.formRoot = csSelf:GetComponent("CLUIFormRoot")
uiobjs.SpriteStatus = getChild(transform, "SpriteStatus")
@@ -28,12 +24,15 @@ end
-- 注意c#侧不会在调用show时调用refresh
function _cell.show(go, data)
mData = data
mData.money = mData.prodNum * mData.salePrice
mData._phoneNo = MyUtl.hidePhone(mData.phoneNo)
mData.lastFollowUpTime = isNilOrEmpty(mData.lastFollowUpTime) and "" or mData.lastFollowUpTime
local optionInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.dealFlagList)
local optionInfor = DBOrder.getPopupList(DBOrder.PopListGroup.orderStatus)
uiobjs.LabelStatus:refreshItems(optionInfor.options, optionInfor.values)
optionInfor = DBUser.getPopList(DBUser.FilterGroup.user)
uiobjs.LabelServerNo:refreshItems(optionInfor.options, optionInfor.values)
uiobjs.formRoot:setValue(mData)
if tostring(mData.dealFlag) == "0" then
if tostring(mData.status) == "0" then
SetActive(uiobjs.SpriteStatus.gameObject, true)
else
SetActive(uiobjs.SpriteStatus.gameObject, false)
@@ -44,11 +43,10 @@ end
function _cell.setHeadIcon()
---@type _DBUser
local user = DBUser.getUserById(mData.serviceNo)
local user = DBUser.getUserById(mData.upLoginNo)
if user then
uiobjs.LabelServerNo.text = user.loginName
DBUser.getIcon(
mData.serviceNo,
mData.upLoginNo,
function(texture)
if texture and texture.name == user.imageUrl then
uiobjs.SpriteHeadIcon.mainTexture = texture
@@ -63,16 +61,5 @@ function _cell.getData()
return mData
end
function _cell.uiEventDelegate(go)
local goName = go.name
if goName == "ButtonFollow" then
getPanelAsy("PanelNewFollow", onLoadedPanelTT, mData)
elseif goName == "ButtonTask" then
getPanelAsy("PanelNewFollowTask", onLoadedPanelTT, mData)
elseif goName == "ButtonContact" then
MyUtl.callCust(mData)
end
end
--------------------------------------------
return _cell