/**/
export default {
template: `
文件类型:
{{info.ext}}
打开方式:
{{extApp}}更改
位置:
{{info.path}}
复制
外链:
{{info.link}}
复制
大小:
{{info.sizeName}}({{info.size}}字节)
{{isTrash?"删除":"创建"}}时间:
{{info.createdAt}}
修改时间:
{{info.updatedAt}}
此卡片敬请期待
此卡片敬请期待
确定
取消
应用
`,
props: ['win'],
data(){
return {
info:{},
extApp:"未知应用",
isTrash:false,
isSystemApp:false
}
},
methods: {
initData:async function (){
var that = this;
if(that.win.data.filePath.startsWith("{trash:")){
that.isTrash = true;
}
var desktop = webos.el.findParentComponent(that,"desktop-component");
var systemMap = desktop.systemAppMap();
if(systemMap[that.win.data.filePath]){
var key = that.win.data.filePath;
that.info = {filterName:systemMap[key],thumbnail:"modules/win11/imgs/icon/"+key+".png",path:"桌面",type:1,name:systemMap[key]+".webosapp",size:0,ext:"webosapp"};
that.isSystemApp = true;
}else{
that.info = await webos.fileSystem.fileInfo(that.win.data.filePath);
}
if(that.info && that.info.name){
var win = webos.el.findParentComponent(that,"window-component");
win.$props["win"].data.name = that.info.name+"属性";
}
await webos.fileSystem.fileIconCalc(that.info);
if(!that.info.thumbnail){
that.info.thumbnail = that.win.data.fileIcon;
}
if(that.info.type == 1){
that.info.sizeName = that.getSizeName(that.info.size);
if(that.info.ext.toLowerCase() != "webosapp" && !that.isTrash){
that.info.link = await webos.fileSystem.zl(that.win.data.filePath);
}
if(that.info.ext){
if(that.info.ext.toLowerCase() != "webosapp"){
var sz = ["edit","open"];
if(webos.util.isMedia(that.info.ext)){
sz = ["open","edit"];
}
let app = await webos.util.userOpenApp(that.info.ext,sz);
if(app){
that.extApp = app.appName;
}
}else{
that.extApp = "应用程序";
}
}
}
},
copyUrl:function (url){
if(utils.copyText(url)){
webos.message.success("复制成功");
}
},
getSizeName:function (size){
var sz = ["B","KB","MB","GB","TB","PB"];
var sizeAction = function(data){
if(data.size>=1024){
return sizeAction({size:data.size/1024,dw:data.dw+1});
}else{
return data.size.toFixed(2)+sz[data.dw];
}
}
return sizeAction({size:size,dw:0});
},
changeAppOpen:function (){
webos.message.error("此功能敬请期待");
},
closeWinAction:function (){
var that = this;
var winCom = webos.el.findParentComponent(that,"window-component");
winCom.windowAction(4);
}
},
created:async function () {
}
}