(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-user-userBg"],{"17d4":function(t,e,n){"use strict";n("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,n("d4b5");var i=n("af30"),a={data:function(){return{StatusBar:this.StatusBar,CustomBar:this.CustomBar,NavBar:this.StatusBar+this.CustomBar,AppStyle:this.$store.state.AppStyle,uid:0,userBg:"",userInfo:"",token:"",isLoading:0}},onPullDownRefresh:function(){},onShow:function(){i.localStorage.getItem("token")&&(this.token=i.localStorage.getItem("token")),this.userStatus(),this.getCacheInfo()},onLoad:function(){if(i.localStorage.getItem("userinfo")){var t=JSON.parse(i.localStorage.getItem("userinfo"));this.token=t.token}},methods:{back:function(){uni.navigateBack({delta:1})},getCacheInfo:function(){if(i.localStorage.getItem("userinfo")){var t=JSON.parse(i.localStorage.getItem("userinfo"));this.uid=t.uid,this.userInfo=t}},userEdit:function(){var t=this,e={uid:t.uid,name:t.userInfo.name,userBg:t.userBg};uni.showLoading({title:"加载中"}),t.$Net.request({url:t.$API.userEdit(),data:{params:JSON.stringify(t.$API.removeObjectEmptyKey(e)),token:t.token},header:{"Content-Type":"application/x-www-form-urlencoded"},method:"get",dataType:"json",success:function(e){setTimeout((function(){uni.hideLoading()}),1e3),uni.showToast({title:e.data.msg,icon:"none"}),1==e.data.code&&(uni.showToast({title:"操作成功！",icon:"none"}),setTimeout((function(){t.back()}),1e3))},fail:function(t){setTimeout((function(){uni.hideLoading()}),1e3),uni.showToast({title:"网络开小差了哦",icon:"none"}),uni.stopPullDownRefresh()}})},userStatus:function(){var t=this;t.$Net.request({url:t.$API.userStatus(),data:{token:t.token},header:{"Content-Type":"application/x-www-form-urlencoded"},method:"get",dataType:"json",success:function(e){1==e.data.code&&e.data.data.userBg&&(t.userBg=e.data.data.userBg);setTimeout((function(){t.isLoading=1,clearTimeout("timer")}),300)},fail:function(e){uni.showToast({title:"网络开小差了哦",icon:"none"});setTimeout((function(){t.isLoading=1,clearTimeout("timer")}),300)}})},upload:function(){var t=this;uni.chooseImage({count:1,sourceType:["album","camera"],sizeType:["original"],success:function(e){uni.showLoading({title:"加载中"});for(var n=e.tempFilePaths,i=0;i<n.length;i++)uni.uploadFile({url:t.$API.upload(),filePath:n[i],name:"file",formData:{token:t.token},success:function(e){1==n.length&&setTimeout((function(){uni.hideLoading()}),1e3);var i=JSON.parse(e.data);uni.showToast({title:i.msg,icon:"none"}),1==i.code&&(t.userBg=i.data.url)},fail:function(){setTimeout((function(){uni.hideLoading()}),1e3)}})}})}}};e.default=a},"7db6":function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return a})),n.d(e,"a",(function(){}));var i=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("v-uni-view",{staticClass:"user",class:t.$store.state.AppStyle,staticStyle:{"background-color":"#f6f6f6",height:"100vh"}},[i("v-uni-view",{staticClass:"header",style:[{height:t.CustomBar+"px"}]},[i("v-uni-view",{staticClass:"cu-bar bg-white",style:{height:t.CustomBar+"px","padding-top":t.StatusBar+"px"}},[i("v-uni-view",{staticClass:"action",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.back.apply(void 0,arguments)}}},[i("v-uni-text",{staticClass:"cuIcon-back"})],1),i("v-uni-view",{staticClass:"content text-bold",style:[{top:t.StatusBar+"px"}]},[t._v("主页背景")]),i("v-uni-view",{staticClass:"action",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.userEdit.apply(void 0,arguments)}}},[i("v-uni-button",{staticClass:"cu-btn round bg-blue"},[t._v("保存")])],1)],1)],1),i("v-uni-view",{style:[{padding:t.NavBar+"px 10px 0px 10px"}]}),i("v-uni-view",{staticClass:"upload-bg"},[i("v-uni-view",{staticClass:"upload-bg-main"},[""!=t.userBg&&t.userBg?i("v-uni-view",{staticClass:"upload-bg-box"},[i("v-uni-image",{attrs:{mode:"widthFix",src:t.userBg}}),i("v-uni-view",{staticClass:"reload-btn",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.upload.apply(void 0,arguments)}}},[t._v("更换")])],1):i("v-uni-view",{staticClass:"upload-bg-no",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.upload.apply(void 0,arguments)}}},[t._v("点击设置主页背景")])],1)],1),0==t.isLoading?i("v-uni-view",{staticClass:"loading"},[i("v-uni-view",{staticClass:"loading-main"},[i("v-uni-image",{attrs:{src:n("f408")}})],1)],1):t._e()],1)},a=[]},8250:function(t,e,n){"use strict";n.r(e);var i=n("7db6"),a=n("dbae");for(var o in a)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(o);var s=n("828b"),u=Object(s["a"])(a["default"],i["b"],i["c"],!1,null,"59d09cfa",null,!1,i["a"],void 0);e["default"]=u.exports},dbae:function(t,e,n){"use strict";n.r(e);var i=n("17d4"),a=n.n(i);for(var o in i)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(o);e["default"]=a.a}}]);