PersonalInformation.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <div class="row allAlignment">
  3. <leftNav />
  4. <div>
  5. <hader />
  6. <messageCenter></messageCenter>
  7. <div class="user_box scroll">
  8. <div>
  9. <!-- <div class="headPortrait">
  10. <div
  11. class="row item-center"
  12. >头像设置</div>
  13. <div style="height:180px;background:#fff;padding:20px;" class="row">
  14. <div style="width:50%;">
  15. <p style="font-size:14px;margin-top:35px;color:#666;">建议上传110px*110px,若不设置则使用系统默认头像</p>
  16. <input
  17. type="file"
  18. id="file"
  19. @change="headPortraitChange($event)"
  20. style="display:none;"
  21. />
  22. <label
  23. for="file"
  24. class="btn"
  25. style="display:block;border:1px solid rgba(221,221,221,1);background:linear-gradient(180deg,rgba(245,245,245,1) 0%,rgba(238,238,238,1) 100%);width:120px;height:40px;color:#666;font-size:14px;margin-top:30px;"
  26. >上传图片</label>
  27. </div>
  28. <div style="width:50%;">
  29. <div class="row rightAlignment">
  30. <img :src="require('@/assets/img/userPortrait.png')" style="width:110px;height:110px;" />
  31. </div>
  32. <div class="row rightAlignment">
  33. <p
  34. class="row center"
  35. style="width:110px;color:#999;font-size:12px;"
  36. >{{serviceInfo.user_avatar?'您的头像':'默认头像'}}</p>
  37. </div>
  38. </div>
  39. </div>
  40. </div> -->
  41. <!-- 用户信息 -->
  42. <div class="userInfo">
  43. <div class="row item-center user_head">个人信息</div>
  44. <div class="userInfoBox " >
  45. <div class="row">
  46. <div>
  47. <div>
  48. <p class="title_text">分组</p>
  49. <p>{{user_info.group}}</p>
  50. </div>
  51. <div>
  52. <p class="title_text">工号</p>
  53. <p>{{user_info.user_job_number}}</p>
  54. </div>
  55. <div>
  56. <p class="title_text">姓名</p>
  57. <input class="text_input" v-model="user_info.fullname" type="text" />
  58. </div>
  59. </div>
  60. <div style="margin-left:200px">
  61. <div>
  62. <p class="title_text">昵称</p>
  63. <input class="text_input" v-model="user_info.user_name" type="text" />
  64. </div>
  65. <div>
  66. <p class="title_text">手机</p>
  67. <input class="text_input" v-model="user_info.phone" type="text" />
  68. </div>
  69. <div>
  70. <p class="title_text">邮箱</p>
  71. <input class="text_input" v-model="user_info.user_email" type="text" />
  72. </div>
  73. </div>
  74. </div>
  75. <div class="row allAlignment text_box">
  76. <div class="row item-center">
  77. <div style="width:84px;">
  78. <p class="title_text">个性签名</p>
  79. </div>
  80. <input style="width:400px;height:40px;" v-model="user_info.signature" type="text"/>
  81. </div>
  82. <div @click="save_user_info()" class="user_btn">
  83. <span>保存</span>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. <!-- 密码模块 -->
  89. <div class="userInfo">
  90. <div class="row item-center user_head" >密码设置</div>
  91. <div class="userInfoBox" >
  92. <div class="password_style">
  93. <div class="row itme-center">
  94. <div class="title_text">
  95. <span>原密码</span>
  96. </div>
  97. <!-- @blur=" " -->
  98. <div>
  99. <input class="text_input" v-model="originalPwd" type="password" />
  100. <span v-if="errorPwdState == 1" style="margin-left:10px;color:#f60">原密码不能未空</span>
  101. </div>
  102. </div>
  103. <div class="row">
  104. <div class="title_text">
  105. <span>新密码</span>
  106. </div>
  107. <div>
  108. <input class="text_input" v-model="password" type="password" />
  109. </div>
  110. </div>
  111. <div class="row allAlignment">
  112. <div class="row">
  113. <div class="title_text">
  114. <span>确认密码</span>
  115. </div>
  116. <div>
  117. <input class="text_input" v-model="confirmPwd" type="password" />
  118. <span v-if="errorPwdState ==2" style="margin-left: 10px;color:#f60">两次输入的新密码不相等,请重新输入</span>
  119. </div>
  120. <!-- <span v-if="errorTo.affirmPasswordInfoB" style="color:#f60">请先输入密码再确认</span> -->
  121. </div>
  122. <div @click="change_password()" class="row center" style="width:80px;height: 40px;background:rgba(83,153,245,1);color: #fff;border-radius:5px;">
  123. <span>修改</span>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. </template>
  134. <script>
  135. import "@/css/index.css";
  136. import leftNav from "@/components/leftNav";
  137. import hader from "@/components/hader";
  138. import messageCenter from "@/components/messageCenter";
  139. export default {
  140. name: "PersonalInformation",
  141. data() {
  142. return {
  143. account: "", //账号
  144. password: "", //密码
  145. confirmPwd: "", //确认密码
  146. originalPwd: "", //原密码
  147. user_info:'', //客服基本信息
  148. errorPwdState:100,//密码错误状态
  149. time: "",
  150. token: ""
  151. };
  152. },
  153. methods: {
  154. /******************修改密码******************/
  155. updatepwdAjax() {
  156. let obj = {
  157. headers: {
  158. apiToken: this.$md5("updatepwd" + "customer-service" + "services" + this.time[0] + "service"),
  159. userToken: this.token
  160. }
  161. };
  162. this.post("api"+ this.$ports.userInfo.updatepwd, {
  163. token:this.token,
  164. password:this.originalPwd,
  165. new_password:this.password,
  166. },obj).then(res => {
  167. if(res.data.code == 1){
  168. this.$notify({
  169. title: '成功',
  170. message: '密码修改成功',
  171. type: 'success'
  172. });
  173. this.$router.push('/login')
  174. }else{
  175. this.$notify.error({
  176. title: '错误',
  177. message: res.data.msg,
  178. type:'error'
  179. });
  180. }
  181. });
  182. },
  183. /********************修改用户信息*********************/
  184. userInfoAjax(){
  185. let obj = {
  186. headers: {
  187. apiToken: this.$md5("updateinfo" + "customer-service" + "services" + this.time[0] + "service"),
  188. userToken: this.token
  189. }
  190. };
  191. this.post("api"+ this.$ports.userInfo.updateinfo, {
  192. token:this.token,
  193. user_name:this.user_info.user_name,
  194. user_email:this.user_info.user_email,
  195. phone:this.user_info.phone,
  196. fullname:this.user_info.fullname,
  197. signature:this.user_info.signature,
  198. },obj).then(res => {
  199. this.$notify({
  200. title: '成功',
  201. message: '个人信息修改成功',
  202. type: 'success'
  203. });
  204. //console.log(res)
  205. });
  206. },
  207. /********************保存个人信息********************/
  208. save_user_info() {
  209. this.userInfoAjax();
  210. },
  211. // //
  212. /***********************更改密码*************************/
  213. change_password() {
  214. if(this.originalPwd.length == 0){
  215. this.errorPwdState = 1;
  216. return
  217. }
  218. if(this.confirmPwd != this.password){
  219. this.errorPwdState = 2;
  220. return
  221. }
  222. this.updatepwdAjax();
  223. }
  224. },
  225. mounted() {
  226. this.user_info = this.$store.getters.get_user_info;
  227. console.log(this.user_info);
  228. this.token = this.user_info.token;
  229. this.time = sessionStorage.getItem("time");
  230. },
  231. components: {
  232. leftNav,
  233. hader,
  234. messageCenter
  235. }
  236. };
  237. </script>
  238. <style scoped>
  239. .user_box {
  240. padding: 20px;
  241. /* height: 67%; */
  242. overflow-x: hidden;
  243. overflow-y: auto;
  244. background: #f6f8ff;
  245. }
  246. .headPortrait {
  247. border: 1px solid #d5e5ff;
  248. }
  249. .btn {
  250. text-align: center;
  251. line-height: 40px;
  252. border-radius: 5px;
  253. }
  254. .userInfo {
  255. border: 1px solid #d5e5ff;
  256. margin-top: 20px;
  257. }
  258. .userInfoBox{
  259. height:260px;
  260. background:#fff;
  261. padding:20px;
  262. font-size:14px;
  263. }
  264. .userInfoBox div div div{
  265. height: 55px;
  266. color: #666;
  267. display: flex;
  268. align-items: center;
  269. }
  270. input {
  271. border: 1px solid #ddd;
  272. color: #999;
  273. padding-left: 17px;
  274. }
  275. input:focus {
  276. outline: none;
  277. }
  278. .user_btn{
  279. width:80px;
  280. text-align: center;
  281. line-height: 40px;
  282. background:rgba(83,153,245,1);
  283. color: #fff;
  284. border-radius:5px;
  285. }
  286. .text_input{
  287. width:200px;
  288. height:40px;
  289. }
  290. .text_box{
  291. height: 55px;
  292. color: #666;
  293. display: flex;
  294. align-items: center;
  295. }
  296. .title_text{
  297. width:84px;
  298. }
  299. .user_head{
  300. height:50px;
  301. padding:0 20px;
  302. font-size:14px;
  303. color:#666;
  304. border-bottom:1px solid #D5E5FF;
  305. }
  306. .password_style div{
  307. line-height: 55px;
  308. color: #666;
  309. }
  310. </style>