require('../../../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_tool/pages/cloudNote/index/index"],{480:function(t,e,n){"use strict";(function(t,e){var a=n(4);n(26);a(n(25));var o=a(n(481));t.__webpack_require_UNI_MP_PLUGIN__=n,e(o.default)}).call(this,n(1)["default"],n(2)["createPage"])},481:function(t,e,n){"use strict";n.r(e);var a=n(482),o=n(484);for(var r in o)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(r);n(486);var i,c=n(34),u=Object(c["default"])(o["default"],a["render"],a["staticRenderFns"],!1,null,null,null,!1,a["components"],i);u.options.__file="pages_tool/pages/cloudNote/index/index.vue",e["default"]=u.exports},482:function(t,e,n){"use strict";n.r(e);var a=n(483);n.d(e,"render",(function(){return a["render"]})),n.d(e,"staticRenderFns",(function(){return a["staticRenderFns"]})),n.d(e,"recyclableRender",(function(){return a["recyclableRender"]})),n.d(e,"components",(function(){return a["components"]}))},483:function(t,e,n){"use strict";var a;n.r(e),n.d(e,"render",(function(){return o})),n.d(e,"staticRenderFns",(function(){return i})),n.d(e,"recyclableRender",(function(){return r})),n.d(e,"components",(function(){return a}));var o=function(){var t=this,e=t.$createElement,n=(t._self._c,t.items.length);t.$mp.data=Object.assign({},{$root:{g0:n}})},r=!1,i=[];o._withStripped=!0},484:function(t,e,n){"use strict";n.r(e);var a=n(485),o=n.n(a);for(var r in a)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(r);e["default"]=o.a},485:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=getApp(),a={data:function(){return{items:[]}},onShow:function(){this.setData({items:[]});var t=this;n.globalData.hotapp.wxlogin((function(e){t.onLoadData()}))},onPullDownRefresh:function(){t.showToast({title:"正在同步数据",icon:"loading"});var e=this.items,a=this;n.globalData.checkVersion((function(o){if(o){var r={prefix:n.globalData.hotapp.getPrefix("item")};n.globalData.hotapp.searchkey(r,(function(o){0==o.ret&&n.globalData.updateVersion((function(r){r&&(e=a.syncServerDatatoLocal(e,o.data.items),e.forEach((function(t,e,a){a[e]=n.globalData.formatItem(t),a[e].state=2})),a.setData({items:e}),t.setStorageSync("items",e),a.syncLocalDataToServer(e))}))}))}else a.syncLocalDataToServer(e)}))},methods:{onNewItem:function(e){t.navigateTo({url:"../create/index"})},onEditItem:function(e){t.navigateTo({url:"../edit/index?key="+e.currentTarget.dataset.key})},onLoadData:function(){var t=this;n.globalData.getItems((function(e){t.setData({items:e})}))},syncLocalDataToServer:function(e){var a=this;e.forEach((function(e,o,r){n.globalData.hotapp.replaceOpenIdKey(e.key,(function(i){i&&(e.key=i,1==e.state&&n.globalData.hotapp.post(e.key,e.value,(function(o){0==o.ret&&(e.state=2,e=n.globalData.formatItem(e),a.setData({items:r}),t.setStorageSync("items",r))})),3==e.state&&n.globalData.hotapp.del(e.key,(function(e){0!=e.ret&&103!=e.ret||(r.splice(o,1),a.setData({items:r}),t.setStorageSync("items",r))})))}))}))},syncServerDatatoLocal:function(t,e){var a=new Array;t.forEach((function(t){a[t.key]=t}));var o=new Array;e.forEach((function(t){o[t.key]=t})),e.forEach((function(t){var e=a[t.key];e||(a[t.key]=t),e&&3!=e.state&&(t.state=2,t=n.globalData.formatItem(t),a[t.key]=t)})),t.forEach((function(t,e,n){var r=o[t.key];r||2!=t.state||(console.log(t),delete a[t.key])}));var r=new Array;for(var i in a)r.push(a[i]);return r.sort((function(t,e){return t.create_time<e.create_time})),console.log(r),r}}};e.default=a}).call(this,n(2)["default"])},486:function(t,e,n){"use strict";n.r(e);var a=n(487),o=n.n(a);for(var r in a)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(r);e["default"]=o.a},487:function(t,e,n){}},[[480,"common/runtime","common/vendor"]]]);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/pages_tool/pages/cloudNote/index/index.js.map