import{n as o,ad as a}from"./index-b54f5418.js";import"./three-dc46505d.js";var l=function(){var e=this,i=e.$createElement,t=e._self._c||i;return t("div",{staticClass:"headerOperation-container"},[t("div",{staticClass:"operate-history"},[t("vis-icon",{attrs:{code:"#iconbianjiantouzuo"},nativeOn:{click:function(s){return(function(){e.$store.commit("textureLibrary/backOffHistory")}).apply(null,arguments)}}}),t("vis-icon",{attrs:{code:"#iconbianjiantouyou"},nativeOn:{click:function(s){return(function(){e.$store.commit("textureLibrary/forwardHistory")}).apply(null,arguments)}}})],1),t("div",{staticClass:"operate-address"},e._l(e.addressList,function(s,r){return t("span",{key:r,staticClass:"address-sign-box",on:{click:function(f){return e.chouseFile(s)}}},[r>0?t("vis-icon",{style:{transform:"scale(0.6)"},attrs:{code:"#iconsanjiaojiantouyou"}}):e._e(),t("span",{staticClass:"address-title",domProps:{textContent:e._s(s.name)}})],1)}),0),t("div",{staticClass:"operate-operation"},[t("el-popover",{attrs:{placement:"bottom",width:"200",trigger:"click"},model:{value:e.classifyVisible,callback:function(s){e.classifyVisible=s},expression:"classifyVisible"}},[t("el-input",{staticClass:"popover-input",attrs:{size:"mini",placeholder:"输入分类名称"},model:{value:e.classifyName,callback:function(s){e.classifyName=s},expression:"classifyName"}}),t("div",{staticClass:"popover-operation"},[t("el-button",{attrs:{size:"mini",type:"text"},on:{click:e.addClassify}},[e._v(" 确定 ")])],1),t("vis-icon",{directives:[{name:"show",rawName:"v-show",value:e.canAddClassify,expression:"canAddClassify"},{name:"tooltip",rawName:"v-tooltip.top",value:"新增分类",expression:"'新增分类'",modifiers:{top:!0}}],attrs:{slot:"reference",code:"#iconjia1"},slot:"reference"})],1),e.canUpload?t("vis-icon",{directives:[{name:"tooltip",rawName:"v-tooltip.top",value:"上传",expression:"'上传'",modifiers:{top:!0}}],attrs:{code:"#iconshangchuan-fill"},nativeOn:{click:function(s){return e.upload.apply(null,arguments)}}}):e._e(),t("input",{ref:"uploadInput",staticStyle:{display:"none"},attrs:{type:"file",accept:e.ext,multiple:"multiple"},on:{change:e.fileHandler}})],1)])},c=[];const u={data(){return{classifyName:"",classifyVisible:!1,ext:[".jpg",".png",".jpeg",".hdr",".dds",".mp4",".wmv"]}},computed:{currentFloder(){return this.$store.getters["textureLibrary/currentFloder"]},canUpload(){const e=this.currentFloder.children;return this.currentFloder.parent?e.length&&!e[0].dir?!0:!e.length&&this.currentFloder.url!=="/":!1},canAddClassify(){const e=this.currentFloder.children;return e.length&&e[0].dir?!0:!e.length},addressList(){const e=[this.currentFloder],i=t=>{t.parent&&(e.unshift(t.parent),i(t.parent))};return i(this.currentFloder),e}},methods:{chouseFile(e){e.dir&&this.$store.commit("textureLibrary/currentFloder",e)},upload(){this.$refs.uploadInput.click()},async fileHandler(e){e.target.files;const i=this.currentFloder.id,t=[];for(const s of e.target.files)t.push(a.uploadTexture({classifyId:i,name:s.name,texture:await this.$tool.fileToBlob(s),ext:this.$tool.getFileExt(s.name),size:s.size}));Promise.all(t).then(s=>{this.$store.commit("textureLibrary/addChildren",s)}).finally(()=>{this.$refs.uploadInput.value=""})},addClassify(){this.classifyName.trim()?a.addClassify({name:this.classifyName.trim(),parentId:this.currentFloder.id}).then(e=>{this.$store.commit("textureLibrary/addChildren",e),this.classifyName="",this.classifyVisible=!1,this.$message.success("添加分类成功！")}):(this.classifyName="",this.classifyVisible=!1)}}},n={};var d=o(u,l,c,!1,p,"e1cd108c",null,null);function p(e){for(let i in n)this[i]=n[i]}const y=function(){return d.exports}();export{y as default};
