PersonCenter.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <div class="personCon">
  3. <MiniTitle>
  4. <div slot="mini" class="miniTit">个人中心</div>
  5. </MiniTitle>
  6. <div class="conPerson">
  7. <div class="personCenter">
  8. <h4>基本信息</h4>
  9. <div class="detailInfo">
  10. <el-row>
  11. <el-col :span="2">
  12. <div class="" ref="perfect" v-bind:class="{title: isActive}">姓名:</div>
  13. </el-col>
  14. <el-col :span="21">
  15. <div class="" v-if="person">{{linkman}}</div>
  16. <el-input placeholder="请输入姓名" v-if="personNo" clearable v-model="linkman"></el-input>
  17. </el-col>
  18. </el-row>
  19. <el-row>
  20. <el-col :span="2">
  21. <div class="" v-bind:class="{title: isActive}">所属部门:</div>
  22. </el-col>
  23. <el-col :span="21">
  24. <div class="" v-if="person">{{dept}}</div>
  25. <el-input placeholder="请输入所属部门" v-if="personNo" clearable v-model="dept"></el-input>
  26. </el-col>
  27. </el-row>
  28. <el-row>
  29. <el-col :span="2">
  30. <div class="" v-bind:class="{title: isActive}">所属岗位:</div>
  31. </el-col>
  32. <el-col :span="21">
  33. <div class="" v-if="person">{{position}}</div>
  34. <el-input placeholder="请输入所在岗位" v-if="personNo" clearable v-model="position"></el-input>
  35. </el-col>
  36. </el-row>
  37. <el-row>
  38. <el-col :span="2">
  39. <div class="" v-bind:class="{title: isActive}">手机号:</div>
  40. </el-col>
  41. <el-col :span="21">
  42. <div class="" v-if="person">{{phone}}</div>
  43. <el-input placeholder="请输入手机号" v-if="personNo" maxlength="11" clearable v-model="phone"></el-input>
  44. </el-col>
  45. </el-row>
  46. <el-row>
  47. <el-col :span="2">
  48. <div class="" v-bind:class="{title: isActive}">邮箱:</div>
  49. </el-col>
  50. <el-col :span="21">
  51. <div class="" v-if="person">{{email}}</div>
  52. <el-input placeholder="请输入邮箱" v-if="personNo" clearable v-model="email"></el-input>
  53. </el-col>
  54. </el-row>
  55. <!--<button type="success" class="adminChange" @click="adminChange()" v-if="this.personNo==false">修改</button>
  56. <button type="success" class="adminChange2" @click="changeQue()" v-else-if="this.personNo == true">确定</button>-->
  57. </div>
  58. <div class="txtHeight"></div>
  59. </div>
  60. <div class="safChange">
  61. <h4>账号安全</h4>
  62. <div class="leftCon">
  63. <p class="radio"><i class="el-icon-circle-check-outline"></i>登录密码</p>
  64. <!-- <el-radio v-model="radio" label="1" class="radio">登录密码</el-radio> -->
  65. <p class="text">安全性高的密码可以使账号更安全。建议您定期更换密码,设置一个不能由纯数字、字母组成且长度在6位~16位的密码</p>
  66. </div>
  67. <div class="rigCon">
  68. <i class="el-icon-circle-check-outline"></i><span >已设置</span><span class="changeTxt" @click="changeText()">修改</span>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </template>
  74. <script>
  75. import api from '../../api/admin.js';
  76. import MiniTitle from '../common/MiniTile.vue'
  77. export default {
  78. name: 'user-information',
  79. components: {
  80. MiniTitle
  81. },
  82. data: function() {
  83. return {
  84. radio: '',
  85. radio2: '',
  86. personNo: false,
  87. person: true,
  88. username: null,
  89. phone: null,
  90. linkman: null,
  91. email: null,
  92. isActive: false,
  93. dept: null,
  94. position: null
  95. }
  96. },
  97. created: function() {
  98. this.getUserInfo();
  99. },
  100. methods: {
  101. getUserInfo() {
  102. //获取当前账户信息
  103. api.getPersonInfo().then((res) => {
  104. if (res.data.code == '0') {
  105. const data = res.data.data;
  106. if (data.phone !== '' || data.phone !== null || data.phone !== 0 ? this.phone = data.phone :
  107. this.phone = '待完善');
  108. if (data.linkman !== '' || data.linkman !== null || data.linkman !== 0 ? this.linkman = data.linkman : this.linkman =
  109. '待完善');
  110. if (data.dept !== '' || data.dept !== null || data.dept !== 0 ? this.dept = data.dept : this.dept = '待完善');
  111. if (data.position !== '' || data.position !== null || data.position !== 0 ? this.position = data.position :
  112. this.position = '待完善');
  113. if (data.email !== '' || data.email !== null || data.email !== 0 ? this.email = data.email : this.email = '待完善')
  114. ;
  115. }
  116. }).catch((error) => {
  117. console.log(error)
  118. });
  119. },
  120. adminChange() {
  121. this.personNo = true;
  122. this.person = false;
  123. this.isActive = true;
  124. },
  125. changeQue() {
  126. const myreg = /^1[0-9]{10}$/;
  127. const params = {
  128. "linkman": this.linkman, //req
  129. "dept": this.dept, //req
  130. "position": this.position,
  131. "phone": this.phone,
  132. "email": this.email,
  133. };
  134. if(this.phone == ''){
  135. this.$message.error("手机号不能为空");
  136. }else if(!myreg.test(this.phone)){
  137. this.$message.error("请输入正确的手机号")
  138. }else{
  139. api.updatePersonInfo(params).then((res) => {
  140. console.log(res.data.code)
  141. if (res.data.code == '0') {
  142. this.$message({
  143. showClose: true,
  144. message: '修改成功!',
  145. type: 'success',
  146. duration: 1000,
  147. onClose: function() {
  148. this.personNo = false;
  149. this.person = true;
  150. this.getUserInfo();
  151. }.bind(this)
  152. });
  153. }
  154. }).catch((error) => {
  155. console.log(error);
  156. });
  157. }
  158. },
  159. changeText() {
  160. console.log('000')
  161. this.$router.push({
  162. path: 'LT-GRZX/CHANGE'
  163. });
  164. }
  165. }
  166. }
  167. </script>
  168. <style lang="less">
  169. .conPerson {
  170. .personCenter {
  171. margin-left: 20px !important;
  172. background-color: #fff;
  173. margin-right: 20px !important;
  174. margin-top: 20px !important;
  175. height: auto;
  176. box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.13);
  177. position: relative;
  178. h4 {
  179. font-size: 14px;
  180. padding-top: 20px;
  181. margin-left: 30px;
  182. }
  183. .title {
  184. margin-top: 4px;
  185. }
  186. .txtHeight {
  187. height: 30px;
  188. }
  189. .detailInfo {
  190. .el-col {
  191. margin-top: 35px;
  192. color: #424243;
  193. font-size: 12px;
  194. }
  195. .el-col-2 {
  196. text-align: right;
  197. width: 10%;
  198. }
  199. .el-col-21 {
  200. margin-left: 30px;
  201. width: 175px;
  202. }
  203. }
  204. .adminChange {
  205. width: 80px;
  206. height: 30px;
  207. background: #22ccc8;
  208. font-size: 12px;
  209. color: #fff;
  210. border-radius: 3px;
  211. border: 0;
  212. outline: none;
  213. cursor: pointer;
  214. position: absolute;
  215. right: 30px;
  216. top: 10px;
  217. }
  218. .adminChange2 {
  219. width: 80px;
  220. height: 30px;
  221. background: #ffb03b;
  222. font-size: 12px;
  223. color: #fff;
  224. border-radius: 3px;
  225. border: 0;
  226. outline: none;
  227. cursor: pointer;
  228. position: absolute;
  229. right: 30px;
  230. top: 10px;
  231. }
  232. .el-input__inner {
  233. width: 175px;
  234. height: 30px;
  235. line-height: 30px;
  236. font-size: 12px;
  237. }
  238. .el-input__icon {
  239. line-height: 25px;
  240. }
  241. }
  242. .safChange {
  243. height: 150px;
  244. background: #fff;
  245. margin: 20px 20px 0 20px;
  246. box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.13);
  247. h4 {
  248. font-size: 14px;
  249. padding-top: 20px;
  250. margin-left: 30px;
  251. padding-bottom: 20px;
  252. }
  253. .el-radio__label {
  254. font-size: 12px !important;
  255. }
  256. .leftCon {
  257. float: left;
  258. background: #fff;
  259. margin-left: 30px;
  260. .radio {
  261. margin-bottom: 15px;
  262. font-size: 12px;
  263. color: #606266;
  264. }
  265. .text {
  266. font-size: 12px;
  267. color: #606266;
  268. }
  269. }
  270. .rigCon {
  271. float: right;
  272. margin-right: 30px;
  273. font-size: 12px;
  274. color: #606266;
  275. .radio2 {
  276. margin-right: 30px;
  277. }
  278. .changeTxt {
  279. cursor: pointer;
  280. margin-left: 30px;
  281. &:hover {
  282. color: #409EFF;
  283. }
  284. }
  285. }
  286. .el-radio {
  287. cursor: auto;
  288. }
  289. .el-radio__inner {
  290. cursor: auto;
  291. }
  292. .el-radio__inner:hover {
  293. border-color: #9b9b9b;
  294. }
  295. .el-radio__input {
  296. cursor: auto;
  297. }
  298. .el-radio__input.is-checked .el-radio__inner {
  299. border-color: #9b9b9b;
  300. background: #fff;
  301. }
  302. .el-radio__input.is-checked+.el-radio__label {
  303. color: #606266;
  304. }
  305. }
  306. }
  307. .personCon{
  308. .miniTit{
  309. font-size: 14px;
  310. font-weight: bold;
  311. margin-left: 20px;
  312. }
  313. }
  314. </style>