info.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <style>
  2. .el-dialog {
  3. min-width: 400px;
  4. }
  5. .user-info {
  6. height: 210px;
  7. padding: 40px;
  8. position: relative;
  9. }
  10. .user-info .info-bg {
  11. position: absolute;
  12. right: 40px;
  13. top: 40px;
  14. height: 130px;
  15. width: 174px;
  16. }
  17. .user-text {
  18. padding: 40px 20px 20px;
  19. font-size: 24px;
  20. }
  21. .user-label {
  22. font-size: 16px;
  23. color: #999999;
  24. margin-bottom: 5px;
  25. }
  26. </style>
  27. <div id="app" v-cloak>
  28. <el-card shadow="never">
  29. <el-row>
  30. <el-col class="user-info" :span='12'>
  31. <div class="user-text">
  32. <div class="user-label">账号</div>
  33. <div>{{username}}</div>
  34. </div>
  35. </el-col>
  36. <el-col class="user-info" :span='12'>
  37. <div class="user-text">
  38. <div class="user-label">用户名</div>
  39. <div>{{account}}</div>
  40. </div>
  41. </el-col>
  42. </el-row>
  43. </el-card>
  44. </div>
  45. <script>
  46. new Vue({
  47. el: '#app',
  48. data() {
  49. var checkPhone = (rule, value, callback) => {
  50. if (!value) {
  51. return callback(new Error('手机号不能为空'));
  52. } else {
  53. const reg = /^(\+?0?86\-?)?1[345789]\d{9}$/
  54. if (reg.test(value)) {
  55. callback();
  56. } else {
  57. return callback(new Error('请输入正确的手机号'));
  58. }
  59. }
  60. };
  61. return {
  62. newList: {
  63. mobile: '',
  64. code: '',
  65. },
  66. changeMobile: false,
  67. sec: 60,
  68. check: false,
  69. beGet: false,
  70. btnloading: false,
  71. user: _baseUrl + '/resources/img/admin/user.png',
  72. mobile: _baseUrl + '/resources/img/admin/mobile.png',
  73. number: _baseUrl + '/resources/img/admin/number.png',
  74. end_at: _baseUrl + '/resources/img/admin/end_at.png',
  75. username: '',
  76. account: '',
  77. rules: {
  78. mobile: [
  79. {required: true, validator: checkPhone, trigger: 'blur'},
  80. ],
  81. code: [
  82. {required: true, message: '验证码不能为空', trigger: 'blur'},
  83. ]
  84. },
  85. };
  86. },
  87. created() {
  88. let self = this;
  89. self.btnLoading = true;
  90. request({
  91. params: {
  92. r: 'admin/account/info'
  93. },
  94. method: 'get',
  95. data: {}
  96. }).then(e => {
  97. if(e.data.code == 0){
  98. this.username = e.data.data.data.username;
  99. this.account = e.data.data.data.account;
  100. }
  101. }).catch(e => {
  102. console.log(e);
  103. });
  104. },
  105. methods: {
  106. getCode() {
  107. let self = this;
  108. if (!self.newList.mobile) {
  109. self.$message.error('请先填写手机号');
  110. return
  111. }
  112. // if(this.check) {
  113. // mobile = this.newMobile;
  114. // }else {
  115. // mobile = this.userinfo.mobile;
  116. // }
  117. self.$request({
  118. params: {
  119. r: 'admin/admin/sms-captcha'
  120. },
  121. method: 'post',
  122. data: {
  123. mobile: self.newList.mobile
  124. }
  125. }).then(e => {
  126. if (e.data.code === 0) {
  127. self.$message.success(e.data.msg);
  128. self.beGet = true;
  129. const timer = setInterval(() => {
  130. if (self.sec <= 0) {
  131. self.beGet = false;
  132. clearInterval(timer);
  133. return;
  134. }
  135. self.sec = this.sec - 1;
  136. }, 1000);
  137. } else {
  138. self.$message.error(e.data.msg);
  139. }
  140. }).catch(e => {
  141. console.log(e);
  142. });
  143. },
  144. change(formName) {
  145. let self = this;
  146. self.$refs[formName].validate((valid) => {
  147. if (valid) {
  148. this.btnloading = true;
  149. request({
  150. params: {
  151. r: 'admin/index/update-mobile',
  152. },
  153. data: {
  154. mobile: this.newList.mobile,
  155. captcha: this.newList.code
  156. },
  157. method: 'post',
  158. }).then(e => {
  159. self.btnloading = false;
  160. if(e.data.code == 0) {
  161. self.$message.success(e.data.msg);
  162. self.changeMobile = false;
  163. setTimeout(function(){
  164. location.reload();
  165. },300)
  166. }else {
  167. self.$message.error(e.data.msg);
  168. }
  169. }).catch(e => {
  170. self.btnloading = false;
  171. });
  172. }
  173. })
  174. }
  175. // checkCode() {
  176. // this.check = true;
  177. // this.code = '';
  178. // this.beGet = false;
  179. // this.sec = 60;
  180. // }
  181. },
  182. });
  183. </script>