123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <template>
- <div id="index">
- <el-row>
- <el-col :span="24" class="style">
- <el-col :span="24" class="top">
- <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
- </el-col>
- <el-col :span="24" class="main">
- <person :form="form" @onSubmit="onSubmit"></person>
- </el-col>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- import NavBar from '@/layout/common/topInfo.vue';
- import person from '@/layout/user/person.vue';
- import { mapState, createNamespacedHelpers } from 'vuex';
- const { mapActions: market } = createNamespacedHelpers('market');
- const { mapActions: expertsuser } = createNamespacedHelpers('expertsuser');
- export default {
- name: 'index',
- props: {},
- components: {
- NavBar,
- person, //个人信息维护
- },
- data: () => ({
- // 头部标题
- title: '',
- // meta为true
- isleftarrow: '',
- // 返回
- navShow: true,
- // 个人信息
- form: {},
- }),
- created() {
- this.searchInfo();
- },
- computed: {
- ...mapState(['user']),
- },
- methods: {
- ...market(['fetch', 'update']),
- ...expertsuser({ expertsuserFetch: 'fetch', expertsuserUpdate: 'update', expertsuserUpgrade: 'upgrade' }),
- async searchInfo() {
- if (this.user.role == '4' || this.user.role == '5' || this.user.role == '7') {
- let res = await this.fetch(this.user.userid);
- if (res.errcode === 0) {
- this.$set(this, `form`, res.data);
- }
- } else if (this.user.role == '6') {
- let res = await this.expertsuserFetch(this.user.userid);
- if (res.errcode === 0) {
- this.$set(this, `form`, res.data);
- }
- }
- },
- async onSubmit({ data }) {
- if (data.role == '4' || data.role == '5' || data.role == '7') {
- let res;
- let msg;
- res = await this.update(data);
- } else if (data.role == '6') {
- let res;
- let msg;
- res = await this.expertsuserUpdate(data);
- }
- this.$notify({
- message: '个人信息修改成功',
- type: 'success',
- });
- this.$router.push({ path: '/user/index' });
- },
- },
- mounted() {
- this.title = this.$route.meta.title;
- this.isleftarrow = this.$route.meta.isleftarrow;
- },
- };
- </script>
- <style lang="less" scoped>
- .style {
- width: 100%;
- min-height: 667px;
- position: relative;
- background-color: #f9fafc;
- }
- .top {
- height: 46px;
- overflow: hidden;
- position: relative;
- z-index: 999;
- }
- .main {
- min-height: 570px;
- }
- .foot {
- position: absolute;
- bottom: 0;
- }
- </style>
|