import{n as c}from"./index.13f93d3a.js";const n={name:"me-create-doc",data(){return{form:{data:{name:"",is_private:!1},rules:{name:[{required:!0,trigger:"blur"}]}}}},methods:{onSubmit(){const{name:r,is_private:e}=this.form.data,t=this.$t("common.failure");this.$refs.form.validate(a=>{a&&this.$axios.post("/api/folder/add_folder",{name:r,is_private:e?1:0,type:this.type}).then(o=>{const{code:i,msg:s=t}=o.data;i==0?(this.$message.success(s),this.$router.push({path:"/me/profile"})):this.$message.error(s||t)}).catch(()=>{this.$message.error(t)})})}},computed:{type(){const{type:r}=this.$route.query;return parseInt(r)},disabled(){return!this.form.data.name}}};var l=function(){var e=this,t=e._self._c;return t("div",{staticClass:"me-create-doc"},[t("b",[e._v(e._s(e.$t("me.profile.createDocTitle")))]),t("div",{staticClass:"form"},[t("el-form",{ref:"form",attrs:{model:e.form.data,rules:e.form.rules}},[t("el-form-item",{staticClass:"name",attrs:{prop:"name",label:e.$t("common.title")}},[t("el-input",{attrs:{clearable:""},model:{value:e.form.data.name,callback:function(a){e.$set(e.form.data,"name",a)},expression:"form.data.name"}})],1),t("el-form-item",[t("el-checkbox",{model:{value:e.form.data.is_private,callback:function(a){e.$set(e.form.data,"is_private",a)},expression:"form.data.is_private"}},[e._v(" "+e._s(e.$t("me.profile.createDoc.secretTip1"))+" "),t("br"),e._v(" "+e._s(e.$t("me.profile.createDoc.secretTip2"))+" ")])],1)],1)],1),t("div",{staticClass:"button"},[t("router-link",{attrs:{to:"/me/profile"}},[t("el-button",{staticClass:"cancel",attrs:{type:"primary",round:""}},[e._v(e._s(e.$t("common.cancel")))])],1),t("el-button",{staticClass:"create",attrs:{type:"primary",disabled:e.disabled,round:""},on:{click:e.onSubmit}},[e._v(e._s(e.$t("common.create")))])],1)])},m=[],d=c(n,l,m,!1,null,"54d95bc0",null,null);const f=d.exports;export{f as default};
