1 line
2.6 KiB
JavaScript
1 line
2.6 KiB
JavaScript
(global["webpackChunkfitness_walk_nwnu"]=global["webpackChunkfitness_walk_nwnu"]||[]).push([["pages/my/index"],{1857:function(){},8273:function(e,n,t){"use strict";t(923);var a,r={uAvatar:function(){return Promise.all([t.e("common/vendor"),t.e("node-modules/uview-ui/components/u-avatar/u-avatar")]).then(t.bind(t,760))},uCellGroup:function(){return Promise.all([t.e("common/vendor"),t.e("node-modules/uview-ui/components/u-cell-group/u-cell-group")]).then(t.bind(t,2689))},uCell:function(){return Promise.all([t.e("common/vendor"),t.e("node-modules/uview-ui/components/u-cell/u-cell")]).then(t.bind(t,1867))}},o=function(){var e=this,n=e.$createElement;e._self._c},u=[],s=t(575),i=t(6766),c=t.n(i),l=t(1372)["default"],d=t(1687)["default"],f=l.cloud.database(),m={name:"index",computed:{firstName:function(){return this.user&&this.user.username?this.user.username.substring(0,1):""},user:function(){return this.$store.state.user}},methods:{updateAvatar:function(e){var n=this;return(0,s["default"])(c().mark(function t(){return c().wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(t.prev=0,console.log(n.user.avatar),!n.user.avatar){t.next=2;break}return t.next=1,f.collection("user_avatar").where({loginname:n.user.loginname}).update({data:{avatar:e}});case 1:t.next=3;break;case 2:return t.next=3,f.collection("user_avatar").add({data:{avatar:e,loginname:n.$store.state.user.loginname}});case 3:d.showToast({title:"头像更新成功",icon:"none"}),t.next=5;break;case 4:t.prev=4,t["catch"](0),d.showToast({title:"头像更新失败",icon:"none"});case 5:case"end":return t.stop()}},t,null,[[0,4]])}))()},onChooseAvatar:function(e){var n=this;return(0,s["default"])(c().mark(function t(){var a,r;return c().wrap(function(t){while(1)switch(t.prev=t.next){case 0:a=e.detail.avatarUrl,r="avatar/"+n.$store.state.user.loginname+".png",l.cloud.uploadFile({cloudPath:r,filePath:a,success:function(){var e=(0,s["default"])(c().mark(function e(t){return c().wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=1,n.updateAvatar(t.fileID);case 1:n.$store.commit("updateUser",{avatar:t.fileID}),console.log(t);case 2:case"end":return e.stop()}},e)}));function t(n){return e.apply(this,arguments)}return t}(),fail:function(e){d.showToast({title:"上传失败"}),console.log(e)}});case 1:case"end":return t.stop()}},t)}))()}},onLoad:function(e){console.log(this.$store.state.user)}},v=m,p=t(1857),h=t.n(p),w=(h(),t(8535)),g=(0,w["default"])(v,o,u,!1,null,"0b2a3023",null,!1,r,a),_=g.exports,b=t(1372)["default"],k=t(1687)["createPage"];b.__webpack_require_UNI_MP_PLUGIN__=t,k(_)}},function(e){var n=function(n){return e(e.s=n)};e.O(0,["common/vendor"],function(){return n(8273)});e.O()}]); |