|
@@ -4,7 +4,18 @@
|
|
|
<el-col :span="24">
|
|
|
<el-col :span="24" class="leftTop"> <span>|</span> <span>基本信息</span> </el-col>
|
|
|
<el-col :span="24" class="info">
|
|
|
- 基本信息
|
|
|
+ <el-form :model="form" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
|
|
+ <el-form-item label="用户名" prop="adminuser">
|
|
|
+ <el-input v-model="form.adminuser" placeholder="请输入用户名"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="手机号" prop="phone">
|
|
|
+ <el-input v-model="form.phone" placeholder="请输入用户名" disabled></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="submitForm('form')">保存</el-button>
|
|
|
+ <el-button @click="resetForm('form')">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -13,15 +24,63 @@
|
|
|
|
|
|
<script>
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: dock } = createNamespacedHelpers('dock');
|
|
|
+const { mapActions: authUser } = createNamespacedHelpers('authUser');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
|
components: {},
|
|
|
data: function() {
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ form: {},
|
|
|
+ rules: {
|
|
|
+ adminuser: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
|
|
|
+ phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.searchInfo();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...dock({ dockQuery: 'query', dockFetch: 'fetch', dockUpdate: 'update' }),
|
|
|
+ ...authUser({ authUserFetch: 'fetch', authUserUpdate: 'update' }),
|
|
|
+ async searchInfo() {
|
|
|
+ if (this.user.uid) {
|
|
|
+ let res = await this.dockQuery(this.user.uid);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ for (const val of res.data) {
|
|
|
+ this.$set(this, `form`, val);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async submitForm() {
|
|
|
+ let res = await this.dockUpdate(this.form);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let data = {};
|
|
|
+ data.id = this.user.uid;
|
|
|
+ data.name = this.form.adminuser;
|
|
|
+ let arr = await this.authUserUpdate(data);
|
|
|
+ if (this.$checkRes(arr)) {
|
|
|
+ console.log(arr);
|
|
|
+ this.$message({
|
|
|
+ message: '修改信息成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: '修改信息失败',
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.searchInfo();
|
|
|
+ },
|
|
|
+ resetForm() {
|
|
|
+ this.form.adminuser = '';
|
|
|
+ },
|
|
|
},
|
|
|
- created() {},
|
|
|
- methods: {},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
|
pageTitle() {
|