add file open

This commit is contained in:
2020-08-07 22:40:04 +08:00
parent c1e3f992aa
commit f9bedd2c62
115 changed files with 9835 additions and 1096 deletions

View File

@@ -15,7 +15,7 @@ function _cell.init(csObj)
uiobjs.Label = getCC(transform, "Label", "UILabel")
uiobjs.ButtonDel = getChild(transform, "ButtonDel").gameObject
uiobjs.SpriteIcon = getCC(transform, "SpriteIcon", "UISprite")
uiobjs.SpriteRight = getChild(transform, "SpriteRight").gameObject
uiobjs.ButtonDownload = getChild(transform, "ButtonDownload").gameObject
uiobjs.DownloadProgress = getChild(transform, "DownloadProgress")
uiobjs.DownloadProgressLb = getCC(uiobjs.DownloadProgress, "Label", "UILabel")
@@ -28,15 +28,19 @@ function _cell.show(go, data)
SetActive(uiobjs.ButtonDel, false)
uiobjs.Label.text = mData.name
if MyUtl.isImage(mData.name) then
--//TODO:
uiobjs.SpriteIcon.spriteName = "work_img-icon"
else
uiobjs.SpriteIcon.spriteName = "work_wenjian-icon"
end
SetActive(uiobjs.DownloadProgress.gameObject, false)
--//TODO:权限判断,如果有权限的可以考虑直接显示图片
if DBTextures.hadDownloaded(mData.name) then
SetActive(uiobjs.ButtonDownload, false)
SetActive(uiobjs.SpriteRight, true)
else
SetActive(uiobjs.ButtonDownload, true)
SetActive(uiobjs.SpriteRight, false)
end
end
@@ -62,6 +66,7 @@ function _cell.download()
if content and localPath then
-- 附件下载完成
MyUtl.toastS(joinStr("附件已保存本地:" .. localPath))
SetActive(uiobjs.SpriteRight, true)
else
SetActive(uiobjs.ButtonDownload, true)
end
@@ -77,17 +82,11 @@ function _cell.refreshProgress()
else
SetActive(uiobjs.DownloadProgress.gameObject, true)
local progressVal = www.downloadProgress or 0 -- downloadProgress uploadProgress
uiobjs.LabelPersent.text = joinStr(math.floor(progressVal * 100), "%")
uiobjs.DownloadProgressLb.text = joinStr(math.floor(progressVal * 100), "%")
end
csSelf:invoke4Lua(_cell.refreshProgress, 0.1)
end
function _cell.uiEventDelegate(go)
if go.name == "ButtonDownload" then
_cell.download()
end
end
--------------------------------------------
return _cell