(function(t){function e(e){for(var c,n,r=e[0],l=e[1],a=e[2],h=0,d=[];h-1&&(e.children[i]=c,ct["a"].success("编辑成功"))}else if(o.type!==c.type){if(o.type===e.type){var n=e.children.findIndex((function(t){return t.title===o.title}));e.children.splice(n,1)}c.type===e.type&&(e.children.push(c),ct["a"].success("编辑成功"))}}else e.type===c.type&&(e.children.push(c),ct["a"].success("新增成功"));return e}));localStorage.setItem("BOOKMARK",JSON.stringify(i)),e.emit("fresh"),l()}}))};function l(){n.value.resetFields(),e.emit("closeViews",!1)}return Object(X["eb"])((function(){return t.detail}),(function(e){e&&Object(X["A"])((function(){s.ruleForm=Object(H["a"])({},t.detail)}))}),{deep:!0}),Object(H["a"])(Object(H["a"])({},Object(Q["r"])(s)),{},{closeViews:l,submitForm:r,refruleForm:n,rules:i,BOOKMARK:c})},methods:{}};o("c790");st.render=ot,st.__scopeId="data-v-562e6412";var it=st,nt=Object(c["hb"])("data-v-f6f4d2d2");Object(c["I"])("data-v-f6f4d2d2");var rt={class:"dialog-footer"},lt=Object(c["n"])("取 消"),at=Object(c["n"])("确 定");Object(c["G"])();var ut=nt((function(t,e,o,s,i,n){var r=Object(c["O"])("el-input"),l=Object(c["O"])("el-form-item"),a=Object(c["O"])("el-col"),u=Object(c["O"])("el-row"),h=Object(c["O"])("el-form"),d=Object(c["O"])("el-button"),g=Object(c["O"])("el-dialog");return Object(c["F"])(),Object(c["k"])(g,{"custom-class":"my-dialog",title:"用户登录",visible:o.isLoginVisible,width:"400px"},{footer:nt((function(){return[Object(c["o"])("span",rt,[Object(c["o"])(d,{onClick:s.closeViews,size:"small"},{default:nt((function(){return[lt]})),_:1},8,["onClick"]),Object(c["o"])(d,{type:"primary",onClick:s.submitForm,size:"small"},{default:nt((function(){return[at]})),_:1},8,["onClick"])])]})),default:nt((function(){return[Object(c["o"])(h,{"status-icon":"",ref:"refruleForm",rules:s.rules,model:t.ruleForm,"label-width":"60px",size:"small"},{default:nt((function(){return[Object(c["o"])(u,null,{default:nt((function(){return[Object(c["o"])(a,{span:24},{default:nt((function(){return[Object(c["o"])(l,{label:"邮箱",prop:"email"},{default:nt((function(){return[Object(c["o"])(r,{modelValue:t.ruleForm.email,"onUpdate:modelValue":e[1]||(e[1]=function(e){return t.ruleForm.email=e}),placeholder:"请输入邮箱"},null,8,["modelValue"])]})),_:1})]})),_:1}),Object(c["o"])(a,{span:24},{default:nt((function(){return[Object(c["o"])(l,{label:"密码",prop:"password"},{default:nt((function(){return[Object(c["o"])(r,{modelValue:t.ruleForm.password,"onUpdate:modelValue":e[2]||(e[2]=function(e){return t.ruleForm.password=e}),"show-password":"",placeholder:"请输入密码"},null,8,["modelValue"])]})),_:1})]})),_:1})]})),_:1})]})),_:1},8,["rules","model"])]})),_:1},8,["visible"])})),ht=o("852e"),dt=o.n(ht),gt=o("c72e"),pt=o.n(gt),mt=function(t,e){return new Promise((function(o,c){pt.a.User.logIn(t,e).then((function(t){o(t)})).catch((function(t){c(t)}))}))},bt=function(t,e){return new Promise((function(o,c){pt.a.User.loginWithEmail(e,t).then((function(t){o(t)})).catch((function(t){c(t)}))}))},ft=function(t,e){return new Promise((function(o,c){pt.a.User.logOut(t,e).then((function(t){o(t)}))}))},vt=function(t,e){return new Promise((function(o,c){var s=new pt.a.User;s.setUsername(t),s.setPassword(e),s.signUp().then((function(t){o(t)}),(function(t){c(t)}))}))},jt=function(t){return new Promise((function(e,o){var c=new pt.a.User;c.loginWithAuthData({openid:t.openid,access_token:t.access_token,expires_in:t.expires_in},"weixin").then((function(t){e(t)})).catch((function(t){o(t)}))}))},yt={login:mt,logout:ft,register:vt,loginEmail:bt,getInfo:jt},Ot={model:{value:"isLoginVisible",events:"closeViews"},props:{isLoginVisible:{type:Boolean,default:!1}},setup:function(t,e){var o=Object(Q["j"])({ruleForm:{username:"",password:""}}),c={password:[{required:!0,message:"请输入密码",trigger:"blur"}],email:[{type:"email",required:!0,message:"请输入正确的邮箱",trigger:"blur"}]},s=Object(Q["k"])(null),i=function(){s.value.validate((function(t){if(t){var c=Object(H["a"])({},o.ruleForm);yt.login(c.email,c.password).then((function(t){dt.a.set("userInfo",JSON.stringify(t)),e.emit("setUser"),ct["a"].success("登录成功"),n()})).catch((function(t){210===t.code?ct["a"].error("账号或密码不正确"):211===t.code&&yt.register(c.email,c.password).then((function(t){dt.a.set("userInfo",JSON.stringify(t)),e.emit("setUser"),ct["a"].success("注册成功"),n()}))}))}}))};function n(){s.value.resetFields(),e.emit("closeViews",!1)}return Object(H["a"])(Object(H["a"])({},Object(Q["r"])(o)),{},{closeViews:n,submitForm:i,refruleForm:s,rules:c})},methods:{}};o("2b42");Ot.render=ut,Ot.__scopeId="data-v-f6f4d2d2";var wt=Ot,kt=o("cffa"),St=(o("7db0"),function(t,e){return new Promise((function(o,c){var s=pt.a.Object.extend(t),i=pt.a.User.current(),n=new s;n.set("formDatas",e.formDatas),n.set("user",i),n.save().then((function(t){o(t)}),(function(t){c(t)}))}))}),xt=function(t,e){return new Promise((function(o,c){var s=new pt.a.Query(t),i=pt.a.User.current();for(var n in e)e[n]&&s.equalTo(n,e[n]);s.equalTo("user",i),s.find().then((function(t){o(t)}),(function(t){c(t)}))}))};o("3ca3"),o("ddb0"),o("2b3d");function Vt(t){var e=[],o=function t(e,o){var c=e.children;if(c&&c.length>0)for(var s=0;s1&&void 0!==arguments[1]?arguments[1]:[],s=Object(W["a"])(e);try{for(s.s();!(o=s.n()).done;){var i=o.value;Array.isArray(i.children)?t(i.children,c):c.push(i)}}catch(n){s.e(n)}finally{s.f()}return c},e=Object(Q["j"])({activeIndex:0,data:[],bookMark:[],searchVal:"",allData:[],isDetailVisible:!1,isLoginVisible:!1,detail:{},userInfo:{username:"未登录"}}),o=function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};dt.a.get("userInfo")&&(e.userInfo=JSON.parse(dt.a.get("userInfo"))),e.userInfo.objectId?xt("BOOKMARK").then((function(t){t.length>0?Rt=JSON.parse(t[0].attributes.formDatas):(localStorage.setItem("BOOKMARK",JSON.stringify(Z)),Rt=JSON.parse(JSON.stringify(Z)))})).catch((function(){localStorage.setItem("BOOKMARK",JSON.stringify(Z)),Rt=JSON.parse(JSON.stringify(Z))})).finally((function(){o(),e.data=Rt,e.bookMark=Rt[0].children,e.allData=t(Rt)})):(localStorage.getItem("BOOKMARK")?Rt=JSON.parse(localStorage.getItem("BOOKMARK")):(localStorage.setItem("BOOKMARK",JSON.stringify(Z)),Rt=JSON.parse(JSON.stringify(Z))),e.data=Rt,e.bookMark=Rt[0].children,e.allData=t(Rt),o())},c=function(){dt.a.get("userInfo")?e.userInfo=JSON.parse(dt.a.get("userInfo")):e.userInfo={username:"未登录"},o()};c(),Object(X["eb"])((function(){return e.searchVal}),(function(){e.bookMark=e.allData.filter((function(t){return t.title.toLowerCase().indexOf(e.searchVal.toLowerCase())>-1}))}));var s=function(t,o){e.bookMark=t.children,e.activeIndex=o},i=function(t){return window.open(t.url,"_target")};function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"add",c=Object(H["a"])({},t);e.detail="modify"===o?Object.assign(c,{type:Rt[e.activeIndex].type,flag:"modify"}):Object.assign({},{type:Rt[e.activeIndex].type,flag:"add"}),e.isDetailVisible=!0}var r=function(){e.isLoginVisible=!0},l=function(t){return e.isDetailVisible=t},a=function(t){return e.isLoginVisible=t},u=function(){var t=Object(G["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,o((function(){e.data=Rt,e.bookMark=Rt[e.activeIndex].children}));case 2:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),h=function(t){for(var o=JSON.parse(localStorage.getItem("BOOKMARK")),c=Object.assign(t,{type:Rt[e.activeIndex].type}),s=0;s-1&&(o[s].children.splice(i,1),localStorage.setItem("BOOKMARK",JSON.stringify(o)),ct["a"].success("删除成功"),u())}},d=function(){ct["b"].confirm("确认要退出登录?","温馨提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){var t={username:"",password:""};yt.logout(t.username,t.password).then((function(t){dt.a.remove("userInfo"),c()})),Object(ct["a"])({type:"success",message:"已退出登录"})}))},g=function(){e.userInfo.objectId?d():r()},p=function(){if(e.userInfo.objectId){var t=document.getElementById("file");t.dispatchEvent(new MouseEvent("click"));var o=document.getElementById("mybookmark");document.getElementById("file").addEventListener("change",(function(){var t=document.getElementById("file").files[0],e=new FileReader;e.readAsText(t,"utf-8"),e.onload=function(){o.innerHTML=e.result;var t=JSON.stringify(Vt(o));if(t){var c={formDatas:t};m(c)}}}))}else ct["a"].warning("请先登录")},m=function(t){St("BOOKMARK",t).then((function(t){ct["a"].success("导入成功"),o()}))};return Object(H["a"])(Object(H["a"])({deleteClick:h},Object(Q["r"])(e)),{},{selectType:s,navigate:i,add:n,closeViews:l,closeLoginViews:a,search:u,importBookmark:p,exportBookmark:Jt,loginClick:g,setUsername:c})},methods:{beforeEnter:function(t){t.style.opacity=0,t.style.height=0},enter:function(t,e){kt["a"].to(t,{opacity:1,height:"1.6em",delay:.15*t.dataset.index,onComplete:e})},leave:function(t,e){kt["a"].to(t,{opacity:0,height:0,delay:.15*t.dataset.index,onComplete:e})}}};o("1423");It.render=q,It.__scopeId="data-v-5ebba4d0";var Ct=It;o("7dd6");pt.a.init({appId:"BwLrCgdVyLs52mJO1HcrXakI-gzGzoHsz",appKey:"25gNwzw4dV7IAh7i0IzDnYvV",serverURL:"https://bwlrcgdv.lc-cn-n1-shared.com"});var Mt=Object(c["j"])(Ct);Mt.use(ct["c"]),Mt.mount("#app")},"945b":function(t,e,o){},a5f7:function(t,e,o){t.exports=o.p+"img/logo.f38dc2e8.svg"},b23c:function(t,e,o){},b3c0:function(t,e,o){t.exports=o.p+"img/add.ca18f050.svg"},c790:function(t,e,o){"use strict";o("f175")},e8ed:function(t,e,o){t.exports=o.p+"img/blog.f57ba53d.svg"},f175:function(t,e,o){},fe3c:function(t,e,o){t.exports=o.p+"img/file.807fb7b5.svg"}}); //# sourceMappingURL=app.7e6249a2.js.map