(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-50b41631"],{9963:function(e,t,r){"use strict";r.r(t);var s=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"mainArea"},[r("div",[r("CCard",[r("CCardBody",{staticClass:"m-1"},[r("h1",{staticStyle:{"margin-bottom":"30px"}},[r("CIcon",{staticStyle:{width:"40px",height:"40px","margin-right":"30px","vertical-align":"bottom"},attrs:{size:"custom",name:"cil-user"}}),e._v("账号设置")],1),r("el-divider"),r("h3",[e._v("基本信息")]),e._v(" "),r("span",{staticStyle:{"margin-left":"20px;"}},[e._v("修改您的用户名、密码、电话等基本信息")]),r("el-divider"),r("div",{staticClass:"formArea"},[r("h5",[e._v("展示名称")]),r("p",{staticStyle:{color:"rgb(153,153,153)"}},[e._v("其他成员将会看到您的用户昵称,绝大多数的用户会将昵称设置为自己的姓名,方便团队协作中辨认身份。")]),r("CInput",{attrs:{placeholder:"用户名"},model:{value:e.userInfo.username,callback:function(t){e.$set(e.userInfo,"username",t)},expression:"userInfo.username"}}),r("h5",[e._v("修改分组")]),r("CInput",{attrs:{placeholder:"学校"},model:{value:e.userInfo.group,callback:function(t){e.$set(e.userInfo,"group",t)},expression:"userInfo.group"}}),r("h5",[e._v("修改密码")]),r("p",{staticStyle:{color:"rgb(153,153,153)"}},[e._v("修改您的登录密码,为了保障您的信息安全,我们建议您至少每隔3个月修改一次密码。")]),r("CInput",{attrs:{placeholder:"请输入新密码",type:"password",horizontal:""},model:{value:e.newPassword,callback:function(t){e.newPassword=t},expression:"newPassword"}}),r("h5",[e._v("手机号码")]),r("p",{staticStyle:{color:"rgb(153,153,153)"}},[e._v("如果您没有设置手机号,建议您及时设置。")]),r("CInput",{attrs:{placeholder:"手机号码"},model:{value:e.userInfo.tel,callback:function(t){e.$set(e.userInfo,"tel",t)},expression:"userInfo.tel"}}),r("el-divider"),r("CInput",{attrs:{placeholder:"请输入原密码,点击保存更新信息",type:"password",horizontal:""},model:{value:e.password,callback:function(t){e.password=t},expression:"password"}}),r("CButton",{staticStyle:{width:"80px","margin-top":"20px"},attrs:{block:"",color:"primary"},on:{click:e.updateProf}},[e._v("保存")])],1)],1)],1)],1)])},n=[],o=r("c24f"),a={name:"AccountSetting",data:function(){return{userName:"",password:"",telephone:"18851111391",userId:"",userInfo:{username:"",phone:"",group:""},newPassword:""}},beforeMount:function(){this.userId=localStorage.getItem("userId"),this.userName=localStorage.getItem("userName"),this.getUserInfo()},computed:{},watch:{},methods:{updateProf:function(){var e=this;if(""!=this.password){var t=new FormData;t.append("username",this.userName),t.append("password",this.password),Object(o["c"])(t).then((function(t){if(console.log("验证密码是否正确",t),t.identify){var r=new FormData;r.append("username",e.userInfo.username),r.append("tel",e.userInfo.tel),r.append("group",e.userInfo.group),""!=e.newPassword?(console.log("使用新的密码",e.newPassword),r.append("password",e.newPassword)):(console.log("使用老密码",e.newPassword),r.append("password",e.password)),Object(o["e"])(e.userId,r).then((function(t){e.$message.success("更新个人信息成功"),setTimeout((function(){return e.getUserInfo()}),1e3),localStorage.setItem("userName",e.userInfo.username),setTimeout((function(){e.$router.go(0)}),1e3)}))}else e.$message.error("更改失败请稍后尝试")}))}else this.$message.warning("请输入原密码!")},getUserInfo:function(){var e=this;Object(o["a"])(this.userId).then((function(t){e.userInfo=t,e.userName=t.username,console.log(t,"获取用户信息")}))}}},u=a,c=(r("9d87"),r("2877")),i=Object(c["a"])(u,s,n,!1,null,"3fbe8a30",null);t["default"]=i.exports},"9d87":function(e,t,r){"use strict";r("f98f")},b775:function(e,t,r){"use strict";var s=r("bc3a"),n=r.n(s),o=r("5c96");r("c0d6");n.a.defaults.withCredentials=!0;var a=n.a.create({baseURL:"/api",withCredentials:!0,timeout:1e5});a.interceptors.response.use((function(e){var t=e.data;return t}),(function(e){return console.log("err"+e),e.response.data.length>1e3?Object(o["Message"])({message:"服务器出错",type:"error",duration:3e3}):Object(o["Message"])({message:e.response.data,type:"error",duration:2e4}),Promise.reject(e)})),a.interceptors.request.use((function(e){var t=window.localStorage.getItem("accessToken");return t?(e.headers.accessToken=t,e):e})),t["a"]=a},c24f:function(e,t,r){"use strict";r.d(t,"c",(function(){return n})),r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return a})),r.d(t,"e",(function(){return u})),r.d(t,"d",(function(){return c}));var s=r("b775");function n(e){return Object(s["a"])({url:"/v1/users/login",method:"POST",data:e})}function o(e){return Object(s["a"])({url:"/v1/users/",method:"GET",params:{user_id:e}})}function a(e){return Object(s["a"])({url:"/v1/users/".concat(e),method:"GET"})}function u(e,t){return Object(s["a"])({url:"/v1/users/".concat(e,"/edit"),method:"POST",data:t})}function c(e){return Object(s["a"])({url:"/v1/users/",method:"POST",data:e})}},f98f:function(e,t,r){}}]);