index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <div id="index">
  3. <admin-frame :usePage="false" topType="2" :leftArrow="false">
  4. <template v-slot:info>
  5. <van-col span="24" class="one">
  6. <van-col span="24" class="image">
  7. <van-image :src="icon"></van-image>
  8. </van-col>
  9. <van-col span="24" class="other">
  10. <van-col span="24" class="otherInfo">
  11. {{ userInfo.name }}
  12. </van-col>
  13. <van-col span="24" class="otherInfo">
  14. {{ userInfo.phone }}
  15. </van-col>
  16. </van-col>
  17. </van-col>
  18. <van-col span="24" class="two">
  19. <van-cell title="基本信息" @click="btn('basic')" is-link />
  20. <van-cell title="关联用户" @click="btn('user')" is-link />
  21. <van-cell title="退出登录" @click="logout" is-link />
  22. {{ user }}
  23. </van-col>
  24. </template>
  25. </admin-frame>
  26. </div>
  27. </template>
  28. <script>
  29. import adminFrame from '@/layout/common/admin-frame.vue';
  30. import { mapState, createNamespacedHelpers } from 'vuex';
  31. export default {
  32. name: 'index',
  33. props: {},
  34. components: {
  35. adminFrame,
  36. },
  37. data: function () {
  38. return {
  39. icon: require('@a/icon.jpg'),
  40. userInfo: {},
  41. };
  42. },
  43. created() {
  44. console.log(this.user);
  45. if (this.user) this.$set(this, `userInfo`, this.user);
  46. },
  47. methods: {
  48. btn(type) {
  49. this.$router.push({ path: `/exchange/center/${type}/index` });
  50. },
  51. logout() {
  52. let token = localStorage.removeItem('token');
  53. let openid = sessionStorage.removeItem('openid');
  54. if (token == undefined && openid == undefined) {
  55. this.$notify({
  56. message: '退出成功',
  57. type: 'success',
  58. });
  59. this.$router.push({ path: '/login', query: { path: '/exchange/center/index', type: '1' } });
  60. }
  61. },
  62. },
  63. computed: {
  64. ...mapState(['user']),
  65. },
  66. metaInfo() {
  67. return { title: this.$route.meta.title };
  68. },
  69. watch: {
  70. test: {
  71. deep: true,
  72. immediate: true,
  73. handler(val) {},
  74. },
  75. },
  76. };
  77. </script>
  78. <style lang="less" scoped>
  79. .one {
  80. margin: 0 0 8px 0;
  81. background: url('~@/assets/userbj.jpg');
  82. background-repeat: no-repeat;
  83. background-size: 100% 100%;
  84. .image {
  85. text-align: center;
  86. padding: 10px 0 10px 0;
  87. .van-image {
  88. width: 66px;
  89. height: 66px;
  90. /deep/.van-image__img {
  91. border-radius: 90px;
  92. }
  93. }
  94. }
  95. .other {
  96. text-align: center;
  97. .otherInfo {
  98. font-size: 16px;
  99. color: #000;
  100. font-weight: bold;
  101. margin: 0 0 5px 0;
  102. }
  103. }
  104. }
  105. .two {
  106. background: #fff;
  107. }
  108. </style>