| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- <style>
- .el-dialog {
- min-width: 400px;
- }
- .user-info {
- height: 210px;
- padding: 40px;
- position: relative;
- }
- .user-info .info-bg {
- position: absolute;
- right: 40px;
- top: 40px;
- height: 130px;
- width: 174px;
- }
- .user-text {
- padding: 40px 20px 20px;
- font-size: 24px;
- }
- .user-label {
- font-size: 16px;
- color: #999999;
- margin-bottom: 5px;
- }
- </style>
- <div id="app" v-cloak>
- <el-card shadow="never">
- <el-row>
- <el-col class="user-info" :span='12'>
- <div class="user-text">
- <div class="user-label">账号</div>
- <div>{{username}}</div>
- </div>
- </el-col>
- <el-col class="user-info" :span='12'>
- <div class="user-text">
- <div class="user-label">用户名</div>
- <div>{{account}}</div>
- </div>
- </el-col>
- </el-row>
- </el-card>
- </div>
- <script>
- new Vue({
- el: '#app',
- data() {
- var checkPhone = (rule, value, callback) => {
- if (!value) {
- return callback(new Error('手机号不能为空'));
- } else {
- const reg = /^(\+?0?86\-?)?1[345789]\d{9}$/
- if (reg.test(value)) {
- callback();
- } else {
- return callback(new Error('请输入正确的手机号'));
- }
- }
- };
- return {
- newList: {
- mobile: '',
- code: '',
- },
- changeMobile: false,
- sec: 60,
- check: false,
- beGet: false,
- btnloading: false,
- user: _baseUrl + '/resources/img/admin/user.png',
- mobile: _baseUrl + '/resources/img/admin/mobile.png',
- number: _baseUrl + '/resources/img/admin/number.png',
- end_at: _baseUrl + '/resources/img/admin/end_at.png',
- username: '',
- account: '',
- rules: {
- mobile: [
- {required: true, validator: checkPhone, trigger: 'blur'},
- ],
- code: [
- {required: true, message: '验证码不能为空', trigger: 'blur'},
- ]
- },
- };
- },
- created() {
- let self = this;
- self.btnLoading = true;
- request({
- params: {
- r: 'admin/account/info'
- },
- method: 'get',
- data: {}
- }).then(e => {
- if(e.data.code == 0){
- this.username = e.data.data.data.username;
- this.account = e.data.data.data.account;
- }
- }).catch(e => {
- console.log(e);
- });
- },
- methods: {
- getCode() {
- let self = this;
- if (!self.newList.mobile) {
- self.$message.error('请先填写手机号');
- return
- }
- // if(this.check) {
- // mobile = this.newMobile;
- // }else {
- // mobile = this.userinfo.mobile;
- // }
- self.$request({
- params: {
- r: 'admin/admin/sms-captcha'
- },
- method: 'post',
- data: {
- mobile: self.newList.mobile
- }
- }).then(e => {
- if (e.data.code === 0) {
- self.$message.success(e.data.msg);
- self.beGet = true;
- const timer = setInterval(() => {
- if (self.sec <= 0) {
- self.beGet = false;
- clearInterval(timer);
- return;
- }
- self.sec = this.sec - 1;
- }, 1000);
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- },
- change(formName) {
- let self = this;
- self.$refs[formName].validate((valid) => {
- if (valid) {
- this.btnloading = true;
- request({
- params: {
- r: 'admin/index/update-mobile',
- },
- data: {
- mobile: this.newList.mobile,
- captcha: this.newList.code
- },
- method: 'post',
- }).then(e => {
- self.btnloading = false;
- if(e.data.code == 0) {
- self.$message.success(e.data.msg);
- self.changeMobile = false;
- setTimeout(function(){
- location.reload();
- },300)
- }else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- self.btnloading = false;
- });
- }
- })
- }
- // checkCode() {
- // this.check = true;
- // this.code = '';
- // this.beGet = false;
- // this.sec = 60;
- // }
- },
- });
- </script>
|