|
- --
-
- local DaiLiView = class("DaiLiView", cc.UIView)
-
- function DaiLiView:ctor()
- DaiLiView.super.ctor(self)
- local ui = loadUI("res/ui/ui_dating/ui_dailizhaomu.ui")
- self.ui = ui
- self:addChild(ui)
- self:init()
- end
-
- function DaiLiView:init()
- self.ui.Items.Button:registerClick(function ()
- self:onClickClose()
- end)
-
- local wetchatInfo = loadUserInfo("wetchat") or 0
-
- -- 模板
- self.itemTemplate = self.ui.Items.Layout_Item
- self.itemTemplate:setVisible(false)
-
- self:updateView()
-
- --[[local arr = toStringArray(",")(wetchatInfo)
-
- if arr and table.nums(arr) > 0 then
- for k,v in pairs(arr) do
- local item = self.itemTemplate:getCopied()
- item.Items = getUIItems(item);
-
- item.Items.Text_ID:setText(tostring(v))
- self.ui.Items.Layout_2:addChild(item);
- end
- end--]]
-
- self:bindEvent(app.php, "getwetChatConfigResponse", handler(self, self.updateView))
- end
-
- function DaiLiView:updateView()
- -- 容器
- self.ui.Items.Layout_2:removeAllChildren()
-
- -- 数据
- local dailis = app.php.daili[0] or app.php.daili[-1] or {}
- local txt = ""
- local showNum = 0
- for k,v in pairs(dailis) do
- --[[if txt == "" then
- txt = txt..v
- else
- txt = txt.." , "..v
- end--]]
- local item = self.itemTemplate:getCopied()
- item.Items = getUIItems(item);
-
- item.Items.Button_copy:registerClick(function ()
- playBtnEffect()
- if v and type(v) == "string" then
- copyStringToClipboard(v)
- else
- copyStringToClipboard("")
- end
- --showTooltip("复制成功!")
- app.plugin:gotoWeiXin()
- end)
-
- item.Items.Text_ID:setText(tostring(v))
- local srcSize = item.Items.ImageView_2:getSize()
- local width = item.Items.Text_ID:getSize().width
- item.Items.ImageView_2:setSize(cc.size(width + 10,srcSize.height))
-
- self.ui.Items.Layout_2:addChild(item);
- showNum = showNum + 1
- end
- if showNum >2 then
- --self.ui.Items.ImageView:loadTexture("res/ui/zy_dating/daili/daili_di2.png" ,0)
- end
- end
-
- function DaiLiView:onClickClose()
- playBtnCloseEffect()
- app:dispatchEvent({name = GAME_EVENT.ACTIVITY_CLOSE})
- self:removeFromParent()
- end
-
- return DaiLiView
|