1 line
5.4 KiB
JavaScript
1 line
5.4 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-7f8d5b97"],{5787:function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"note"},[n("van-nav-bar",{attrs:{fixed:"","left-arrow":"","left-text":"返回","right-text":"新增",title:"笔记"},on:{"click-left":t.handleBack,"click-right":function(e){t.addFlag=!0}}}),n("van-search",{attrs:{placeholder:"请输入搜索关键词"},on:{input:t.handleSearch},model:{value:t.searchCode,callback:function(e){t.searchCode=e},expression:"searchCode"}}),n("van-list",{on:{load:t.getFolderList}},[t.list.length<1?n("van-empty",{attrs:{description:"暂无内容"}}):t._l(t.list,(function(e){return n("van-cell-group",{key:e.id,attrs:{inset:""},on:{click:function(n){return t.handleOpen(e)}}},[n("van-swipe-cell",{scopedSlots:t._u([{key:"right",fn:function(){return["folder"===e.type?n("van-button",{attrs:{square:"",text:"编辑",type:"primary"},on:{click:function(n){return t.$router.push("/addFolder?id="+e.id)}}}):t._e(),n("van-button",{attrs:{square:"",text:"删除",type:"danger"},on:{click:function(n){return t.handleDelete(e)}}})]},proxy:!0}],null,!0)},[n("van-cell",{attrs:{center:""}},[n("van-row",{attrs:{align:"center",type:"flex"}},["folder"===e.type?n("div",{staticClass:"folder"},[n("div",{staticClass:"name"},[n("div",[n("svg-icon",{attrs:{"icon-class":"文件夹"}}),n("span",[t._v(t._s(e.name))])],1),n("div",{staticClass:"time"},[t._v(t._s(e.updateTime||e.createTime))])]),n("div",{staticClass:"password"},[e.password?n("svg-icon",{staticClass:"password",attrs:{"icon-class":"验证码"}}):t._e()],1)]):t._e(),"note"===e.type?n("div",{staticClass:"note"},[n("div",{staticClass:"name"},[n("svg-icon",{attrs:{"icon-class":"编辑02"}}),t._v(" "+t._s(e.title)+" ")],1),n("div",{staticClass:"content"},[t._v(t._s(e.content&&e.content.replace(t.regex,"")))]),n("div",{staticClass:"create-time"},[t._v(t._s(e.updateTime||e.createTime))])]):t._e()])],1)],1)],1)}))],2),n("van-popup",{staticClass:"add-popup",attrs:{round:"",position:"top"},model:{value:t.addFlag,callback:function(e){t.addFlag=e},expression:"addFlag"}},[n("van-button",{attrs:{type:"info"},on:{click:function(e){return t.handleAdd(!0)}}},[t._v("新增笔记")]),n("van-button",{attrs:{type:"primary"},on:{click:function(e){return t.handleAdd(!1)}}},[t._v("新增文件夹")])],1)],1)},r=[],o=(n("b0c0"),n("d81d"),n("dfbe")),i={name:"Note",data:function(){return{addFlag:!1,list:[],params:this.getLocal("noteFolder")||[{parentId:0}],searchCode:"",regex:/(<([^>]+)>)/gi}},mounted:function(){},watch:{params:function(t){this.setLocal("noteFolder",t)}},methods:{handleAdd:function(t){t?this.$router.push("/addNote?folder="+this.params[this.params.length-1].parentId):this.$router.push("/addFolder?parentId="+this.params[this.params.length-1].parentId)},handleBack:function(){this.params.length>1?(this.params.pop(),this.getFolderList()):this.$router.go(-1)},handleOpen:function(t){"folder"===t.type?(this.params.push({parentId:t.id}),this.getFolderList()):"note"===t.type&&this.$router.push("/noteDetails?id="+t.id)},handleDelete:function(t){var e=this;"folder"===t.type?this.$dialog.confirm({message:"确认删除《".concat(t.name,"》文件夹?"),title:"删除"}).then((function(){Object(o["c"])(t.id).then((function(){e.getFolderList(),e.$toast("删除成功")}))})).catch((function(){})):"note"===t.type&&this.$dialog.confirm({message:"确认删除《".concat(t.title,"》笔记?"),title:"删除"}).then((function(){Object(o["d"])(t.id).then((function(){e.getFolderList(),e.$toast("删除成功")}))})).catch((function(){}))},handleSearch:function(){var t=this;this.searchTimer?(clearTimeout(this.searchTimer),this.searchTimer=setTimeout((function(){t.searchCode?(t.params.push({name:t.searchCode}),t.getFolderList()):(t.params=[{parentId:0}],t.getFolderList())}),500)):this.searchTimer=setTimeout((function(){t.searchCode?(t.params.push({name:t.searchCode}),t.getFolderList()):(t.params=[{parentId:0}],t.getFolderList())}),500)},getFolderList:function(){var t=this;this.listLoading=!0,Object(o["g"])(this.params[this.params.length-1]).then((function(e){t.list=e.rows.map((function(t){return t.title?t.type="note":t.type="folder",t})),t.listLoading=!1}))}}},s=i,c=(n("eca2"),n("2877")),d=Object(c["a"])(s,a,r,!1,null,"b3d307d4",null);e["default"]=d.exports},bdf8:function(t,e,n){},dfbe:function(t,e,n){"use strict";n.d(e,"f",(function(){return r})),n.d(e,"b",(function(){return o})),n.d(e,"d",(function(){return i})),n.d(e,"g",(function(){return s})),n.d(e,"h",(function(){return c})),n.d(e,"e",(function(){return d})),n.d(e,"a",(function(){return l})),n.d(e,"i",(function(){return u})),n.d(e,"c",(function(){return h}));var a=n("b775");function r(t){return Object(a["a"])({url:"/note/"+t,method:"get"})}function o(t){return Object(a["a"])({url:"/note",method:"post",data:t})}function i(t){return Object(a["a"])({url:"/note/"+t,method:"delete"})}function s(t){return Object(a["a"])({url:"/note/folder/list",method:"get",params:t})}function c(t){return Object(a["a"])({url:"/note/folder/treeList",method:"get",params:t})}function d(t){return Object(a["a"])({url:"/note/folder/"+t,method:"get"})}function l(t){return Object(a["a"])({url:"/note/folder",method:"post",data:t})}function u(t){return Object(a["a"])({url:"/note/folder",method:"put",data:t})}function h(t){return Object(a["a"])({url:"/note/folder/"+t,method:"delete"})}},eca2:function(t,e,n){"use strict";n("bdf8")}}]); |