加入亲友圈类型

master
罗家炜 2025-05-20 18:43:03 +08:00
parent 28778e3ec5
commit 578cb4bf69
4 changed files with 126 additions and 5 deletions

View File

@ -0,0 +1,105 @@
local FamilyChooseTimeView = {}
local M = FamilyChooseTimeView
function FamilyChooseTimeView.New(root, view)
setmetatable(M, { __index = root })
local self = setmetatable({}, { __index = M })
self.minTime = os.date("*t")
self.maxTime = os.date("*t")
self.minTime.hour = 0
self.minTime.min = 0
self.minTime.sec = 0
self.maxTime.hour = 23
self.maxTime.min = 59
self.maxTime.sec = 59
self._view_local = view
self._view_local:GetChild('left').onClick:Set(function()
self.currenTime.month = self.currenTime.month - 1
self:UpdateMonth()
end)
self._view_local:GetChild('right').onClick:Set(function()
self.currenTime.month = self.currenTime.month + 1
self:UpdateMonth()
end)
self.list = view:GetChild('list')
self.list:SetVirtual()
self.list.itemRenderer = function(index, obj)
obj.data = {}
obj.data.day = index + 1
obj.text = string.format("%02d", index + 1)
end
self.list.onClickItem:Set(function(context)
self.currenTime.day = context.data.data.day
print("lingmeng", os.time(self.minTime), os.time(self.maxTime), os.time(self.minTime) > os.time(self.maxTime))
if os.time(self.minTime) > os.time(self.maxTime) then
local y = self.currenTime.year
local m = self.currenTime.month
local d = self.currenTime.day
self.minTime.year = y
self.minTime.month = m
self.minTime.day = d
self.maxTime.year = y
self.maxTime.month = m
self.maxTime.day = d
self._callback_clickDay(1, string.format("%s-%02d-%02d", self.minTime.year, self.minTime.month,
self.minTime.day), string.format("%s-%02d-%02d", self.maxTime.year, self.maxTime.month,
self.maxTime.day))
else
self._callback_clickDay(0, string.format("%s-%02d-%02d", self.currenTime.year, self.currenTime.month,
self.currenTime.day))
end
end)
return self
end
function M:UpdateMonth()
if self.currenTime.month > 12 then
self.currenTime.month = 1
self.currenTime.year = self.currenTime.year + 1
elseif self.currenTime.month < 0 then
self.currenTime.month = 12
self.currenTime.year = self.currenTime.year - 1
end
self._view_local:GetChild('title').text = string.format("%s-%02d-%02d", self.currenTime.year, self.currenTime.month,
self.currenTime.day)
self.list.numItems = self:CalculateMonth()
end
function M:CalculateMonth()
if self.currenTime.month == 2 then
if (self.currenTime.year % 4 == 0 and self.currenTime.year % 100 ~= 0) or (self.currenTime.year % 400 == 0) then
return 28
else
return 29
end
elseif self.currenTime.month <= 7 then
return self.currenTime.month % 2 == 1 and 31 or 30
else
return self.currenTime.month % 2 == 0 and 31 or 30
end
end
function M:ChooseTime(type, callback)
if type == 0 then
self.currenTime = self.minTime
else
self.currenTime = self.maxTime
end
self:UpdateMonth()
self._callback_clickDay = callback
end
function M:GetBeginTime()
return os.time(self.minTime)
end
function M:GetEndTime()
return os.time(self.maxTime)
end
return M

View File

@ -20,8 +20,6 @@ function FamilyNumberRecord.New(root)
-- print(key .. ":" .. tostring(value)) -- print(key .. ":" .. tostring(value))
-- end -- end
-- end -- end
self.familyType.selectedIndex = 5
local group_id = self._group.id local group_id = self._group.id
local MJScore = 0 local MJScore = 0
local PKScore = 0 local PKScore = 0
@ -40,8 +38,8 @@ function FamilyNumberRecord.New(root)
local ctr_numberRecordRank = self._view:GetController('numberRecordRank') local ctr_numberRecordRank = self._view:GetController('numberRecordRank')
local ctr_chooseTime = self._view:GetController('showChooseTime') local ctr_chooseTime = self._view:GetController('showChooseTime')
self.familyType.selectedIndex = 5
self.familyChooseTimeView = FamilyChooseTimeView.New(self, self._view:GetChild('comp_chooseTime'))
self._viewList_numberRankRead = self._view:GetChild('comp_numberRecordByGameTypelooked'):GetChild('n3') self._viewList_numberRankRead = self._view:GetChild('comp_numberRecordByGameTypelooked'):GetChild('n3')
self._viewList_numberRankUnRead = self._view:GetChild('comp_numberRecordByGameType'):GetChild('n3') self._viewList_numberRankUnRead = self._view:GetChild('comp_numberRecordByGameType'):GetChild('n3')
self._viewList_numverRecord = self._view:GetChild('list_numverRecord') self._viewList_numverRecord = self._view:GetChild('list_numverRecord')
@ -68,9 +66,27 @@ function FamilyNumberRecord.New(root)
btn_chooseTimeBegin.onClick:Set(function() btn_chooseTimeBegin.onClick:Set(function()
ctr_chooseTime.selectedIndex = 1 ctr_chooseTime.selectedIndex = 1
self.familyChooseTimeView:ChooseTime(0, function(type, text1, text2)
ctr_chooseTime.selectedIndex = 0
if type == 0 then
btn_chooseTimeBegin.text = text1
else
btn_chooseTimeBegin.text = text1
btn_chooseTimeEnd.text = text2
end
end)
end) end)
btn_chooseTimeEnd.onClick:Set(function() btn_chooseTimeEnd.onClick:Set(function()
ctr_chooseTime.selectedIndex = 1 ctr_chooseTime.selectedIndex = 1
self.familyChooseTimeView:ChooseTime(1, function(type, text1, text2)
ctr_chooseTime.selectedIndex = 0
if type == 0 then
btn_chooseTimeEnd.text = text1
else
btn_chooseTimeBegin.text = text1
btn_chooseTimeEnd.text = text2
end
end)
end) end)
comp_gameTypeList.onClickItem:Set(function(context) comp_gameTypeList.onClickItem:Set(function(context)
input_IDSerach.text = "" input_IDSerach.text = ""

View File

@ -365,7 +365,7 @@ function M:JoinRoom(roomId)
local fgCtr = ControllerManager.GetController(NewGroupController) local fgCtr = ControllerManager.GetController(NewGroupController)
--后端似乎还未调通 --后端似乎还未调通
self:ClearNumTex() self:ClearNumTex()
fgCtr:FG_JoinGroup(roomId, function(res) fgCtr:FG_JoinGroup(tonumber(roomId), function(res)
if res.ReturnCode ~= 0 then if res.ReturnCode ~= 0 then
ViewUtil.ShowOneChooose("加入失败" .. res.ReturnCode) ViewUtil.ShowOneChooose("加入失败" .. res.ReturnCode)
else else