index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="style">
  5. <el-col :span="24" class="top">
  6. <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
  7. </el-col>
  8. <el-col :span="24" class="main">
  9. <person :form="form" @onSubmit="onSubmit"></person>
  10. </el-col>
  11. </el-col>
  12. </el-row>
  13. </div>
  14. </template>
  15. <script>
  16. import NavBar from '@/layout/common/topInfo.vue';
  17. import person from '@/layout/user/person.vue';
  18. import { mapState, createNamespacedHelpers } from 'vuex';
  19. const { mapActions: market } = createNamespacedHelpers('market');
  20. const { mapActions: expertsuser } = createNamespacedHelpers('expertsuser');
  21. export default {
  22. name: 'index',
  23. props: {},
  24. components: {
  25. NavBar,
  26. person, //个人信息维护
  27. },
  28. data: () => ({
  29. // 头部标题
  30. title: '',
  31. // meta为true
  32. isleftarrow: '',
  33. // 返回
  34. navShow: true,
  35. // 个人信息
  36. form: {},
  37. }),
  38. created() {
  39. this.searchInfo();
  40. },
  41. computed: {
  42. ...mapState(['user']),
  43. },
  44. methods: {
  45. ...market(['fetch', 'update']),
  46. ...expertsuser({ expertsuserFetch: 'fetch', expertsuserUpdate: 'update', expertsuserUpgrade: 'upgrade' }),
  47. async searchInfo() {
  48. if (this.user.role == '4' || this.user.role == '5' || this.user.role == '7') {
  49. let res = await this.fetch(this.user.userid);
  50. if (res.errcode === 0) {
  51. this.$set(this, `form`, res.data);
  52. }
  53. } else if (this.user.role == '6') {
  54. let res = await this.expertsuserFetch(this.user.userid);
  55. if (res.errcode === 0) {
  56. this.$set(this, `form`, res.data);
  57. }
  58. }
  59. },
  60. async onSubmit({ data }) {
  61. if (data.role == '4' || data.role == '5' || data.role == '7') {
  62. let res;
  63. let msg;
  64. res = await this.update(data);
  65. } else if (data.role == '6') {
  66. let res;
  67. let msg;
  68. res = await this.expertsuserUpdate(data);
  69. }
  70. this.$notify({
  71. message: '个人信息修改成功',
  72. type: 'success',
  73. });
  74. this.$router.push({ path: '/user/index' });
  75. },
  76. },
  77. mounted() {
  78. this.title = this.$route.meta.title;
  79. this.isleftarrow = this.$route.meta.isleftarrow;
  80. },
  81. };
  82. </script>
  83. <style lang="less" scoped>
  84. .style {
  85. width: 100%;
  86. min-height: 667px;
  87. position: relative;
  88. background-color: #f9fafc;
  89. }
  90. .top {
  91. height: 46px;
  92. overflow: hidden;
  93. position: relative;
  94. z-index: 999;
  95. }
  96. .main {
  97. min-height: 570px;
  98. }
  99. .foot {
  100. position: absolute;
  101. bottom: 0;
  102. }
  103. </style>