webpackJsonp([15],{fBo7:function(e,t){},"g/QW":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r("SQ4B"),i=r("b9vf"),s=r("qI5z"),a=r("vGYV"),n=r("BO1k"),c=r.n(n),l=r("atWu"),u=r.n(l),p={name:"nProvinceCity",props:{provinceCode:{type:String,default:""},cityCode:{type:String,default:""},isModifyMode:{type:Boolean,default:!1}},created:function(){this.provinces=u.a.provinces},mounted:function(){this.province=this.provinceCode,this.provinceChanged(this.provinceCode)},data:function(){return{loadingCity:!1,province:"",city:"",provinces:[],cities:[]}},methods:{provinceChanged:function(e){if(""!==e){this.loadingCity=!0;var t=!0,r=!1,o=void 0;try{for(var i,s=c()(this.provinces);!(t=(i=s.next()).done);t=!0){var a=i.value;if(a.code===e){this.cities=a.cities,this.city="",this.loadingCity=!1;break}}}catch(e){r=!0,o=e}finally{try{!t&&s.return&&s.return()}finally{if(r)throw o}}}else this.cities=[],this.city="";this.$emit("selectChange",this.province,this.city)},cityChanged:function(e){this.$emit("selectChange",this.province,this.city)},buildCityArr:function(e){this.loadingCity=!0;var t=(this.provinces||[]).find(function(t){return t.code===e});this.cities=t&&t.cities||[],this.loadingCity=!1}},watch:{provinceCode:function(e){this.province=e,this.buildCityArr(e)},cityCode:function(e){this.city=e}}},d={render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"province-city"},[r("el-form-item",{staticClass:"page-form-item",staticStyle:{width:"calc(30% - 20px)","margin-right":"5%"},attrs:{"label-width":"0%",label:"",prop:"status"}},[r("el-select",{attrs:{placeholder:"请选择",disabled:e.isModifyMode},on:{change:e.provinceChanged},model:{value:e.province,callback:function(t){e.province=t},expression:"province"}},e._l(e.provinces,function(e){return r("el-option",{key:e.code,attrs:{label:e.name,value:e.code}})}),1)],1),e._v(" "),r("el-form-item",{staticClass:"page-form-item",staticStyle:{width:"calc(30% - 20px)","margin-right":"0px"},attrs:{"label-width":"0%",label:"",prop:"status"}},[r("el-select",{attrs:{loading:e.loadingCity,placeholder:"请选择",disabled:e.isModifyMode},on:{change:e.cityChanged},model:{value:e.city,callback:function(t){e.city=t},expression:"city"}},e._l(e.cities,function(e){return r("el-option",{key:e.code,attrs:{label:e.name,value:e.code}})}),1)],1)],1)},staticRenderFns:[]};var m={name:"Mine",data:function(){return{user:{},isModifyMode:!1,serviceType:[],userForm:{gender:"",birthday:new Date,photoUrl:"",userName:"",unit:"",personalCompetence:[],province:"",city:"",location:{}},pickerOptions:{disabledDate:function(e){return e.getTime()>Date.now()}},rules:{photoUrl:[{required:!0,message:"请上传头像",trigger:"blur"}],userName:[{required:!0,message:"请设置用户名",trigger:"change"}],gender:[{required:!0,message:"请选择性别",trigger:"blur"}]}}},components:{provincecity:r("VU/8")(p,d,!1,function(e){r("hdYE")},"data-v-2a8b55de",null).exports},methods:{submitUserInfo:function(){var e=this;this.$refs.userForm.validate(function(t){if(t){var r=Object(a.A)(e.userForm.province,e.userForm.city);console.log(r),void 0!==r&&(e.userForm.province=r.provinceCode,e.userForm.city=r.cityCode);var i=e.userForm;delete i.location,console.log(i),o.a.put("/api/personal/update/"+e.user.id,i).then(function(t){e.isModifyMode=!1,Object(s.a)("success","修改成功 "),r.reload()})}})},locationChange:function(e,t){(e||t)&&(this.userForm.province=e,this.userForm.city=t)},beforeFileUpload:function(e){if(e.size>5e6)return Object(s.a)("error","单个文件大小不能超过5M"),!1;var t=e.name,r=t.lastIndexOf(".");if(r<=0)return Object(s.a)("error","只能上传png/jpg/jpeg格式的文件"),!1;var o=t.substr(r);return".jpg"!==o&&".png"!==o&&".jpeg"!==o?(Object(s.a)("error","只能上传png/jpg/jpeg格式的文件"),!1):void 0},uploadFile:function(e){var t=this,r=new FormData;r.append("file",e.file),o.a.upload(i.a.FILE.UPLOAD_IMAGE.replace("{userId}",this.user.id),r,{headers:{"Content-Type":"multipart/form-data"}}).then(function(e){t.userForm.photoUrl=e.data,Object(s.a)("success","上传成功")}).catch(function(e){Object(s.a)("error",e.data)})},loadData:function(){var e=this;o.a.get("/api/personal/display/"+this.user.id).then(function(t){e.userForm.gender=t.userVO.gender?t.userVO.gender:"",e.userForm.photoUrl=t.userVO.photoUrl?t.userVO.photoUrl:"",e.userForm.birthday=t.userVO.birthday?t.userVO.birthday:new Date,e.userForm.userName=t.userVO.userName?t.userVO.userName:"",e.userForm.unit=t.userVO.unit?t.userVO.unit:"",e.userForm.province=t.userVO.province?t.userVO.province:"",e.userForm.city=t.userVO.city?t.userVO.city:"",e.userForm.personalCompetence=t.userVO.personalCompetence?t.userVO.personalCompetence:[],e.userForm.location=Object(a.z)(e.userForm.province,e.userForm.city),e.userForm.province=e.userForm.location&&e.userForm.location.provinceCode,e.userForm.city=e.userForm.location&&e.userForm.location.cityCode})},setUserInfo:function(){this.user=Object(a.K)("user")&&Object(a.K)("user").userVO},setServiceType:function(){var e=this;Object(a.r)().then(function(t){e.serviceType=t})}},mounted:function(){var e=this;this.$nextTick(function(){e.setUserInfo(),e.setServiceType(),e.loadData()})}},h={render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"right-mine"},[e._m(0),e._v(" "),r("div",{staticStyle:{"margin-bottom":"15px",width:"550px"}},[r("el-form",{ref:"userForm",staticClass:"demo-ruleForm",attrs:{model:e.userForm,rules:e.rules,"status-icon":"","label-width":"100px"}},[r("el-form-item",{attrs:{label:"头像",prop:"photoUrl"}},[r("el-upload",{staticClass:"avatar-uploader",staticStyle:{border:"lightgrey 1px solid"},attrs:{action:"https://jsonplaceholder.typicode.com/posts/","before-upload":e.beforeFileUpload,"http-request":e.uploadFile}},[e.userForm.photoUrl?r("img",{staticClass:"avatar",attrs:{src:e.userForm.photoUrl}}):r("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1),e._v(" "),r("el-form-item",{attrs:{label:"用户名",prop:"userName"}},[r("el-input",{attrs:{autocomplete:"off",disabled:!0},model:{value:e.userForm.userName,callback:function(t){e.$set(e.userForm,"userName",t)},expression:"userForm.userName"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"单位",prop:"unit"}},[r("el-input",{attrs:{autocomplete:"off"},model:{value:e.userForm.unit,callback:function(t){e.$set(e.userForm,"unit",t)},expression:"userForm.unit"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"性别",prop:"gender"}},[r("el-radio-group",{model:{value:e.userForm.gender,callback:function(t){e.$set(e.userForm,"gender",t)},expression:"userForm.gender"}},[r("el-radio",{attrs:{label:"男"}}),e._v(" "),r("el-radio",{attrs:{label:"女"}})],1)],1),e._v(" "),r("el-form-item",{attrs:{label:"生日",prop:"birthday"}},[r("el-date-picker",{staticStyle:{width:"100%"},attrs:{type:"date",placeholder:"选择日期","picker-options":e.pickerOptions},model:{value:e.userForm.birthday,callback:function(t){e.$set(e.userForm,"birthday",t)},expression:"userForm.birthday"}})],1),e._v(" "),r("el-form-item",{staticStyle:{width:"160%"},attrs:{label:"省市",prop:"address"}},[null!==e.userForm.location?r("provincecity",{ref:"addFormProvince",attrs:{provinceCode:null!==e.userForm.location?e.userForm.location&&e.userForm.location.provinceCode:"3200",cityCode:null!==e.userForm.location?e.userForm.location&&e.userForm.location.cityCode:"3201"},on:{selectChange:e.locationChange}}):e._e()],1),e._v(" "),r("el-form-item",{staticStyle:{width:"160%"},attrs:{label:"个人能力"}},[r("el-checkbox-group",{model:{value:e.userForm.personalCompetence,callback:function(t){e.$set(e.userForm,"personalCompetence",t)},expression:"userForm.personalCompetence"}},e._l(e.serviceType,function(t){return r("el-checkbox",{key:t.code,attrs:{label:t.code,name:t.code}},[e._v(e._s(t.name))])}),1)],1),e._v(" "),r("el-form-item",[r("el-button",{staticClass:"pull-left",attrs:{type:"primary",size:"small"},on:{click:e.submitUserInfo}},[e._v("提交修改")])],1)],1)],1)])},staticRenderFns:[function(){var e=this.$createElement,t=this._self._c||e;return t("div",{staticClass:"right-mine-title"},[t("span",{staticStyle:{"font-size":"18px","font-weight":"bold"}},[this._v("基本设置")])])}]};var f=r("VU/8")(m,h,!1,function(e){r("fBo7")},"data-v-70a7effc",null);t.default=f.exports},hdYE:function(e,t){}});