aboutMe.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <div class="about-me">
  3. <div class="pub-user-top" @click="$router.push('/editMe')" v-if="userInfo">
  4. <div class="avatar-wrap">
  5. <img class="user-avatar" v-if="userInfo.cover_photo" :src="userInfo.cover_photo" alt="" @click.stop="$showImgPreview(userInfo.cover_photo)">
  6. <div v-else class="user-avatar"
  7. :class="'avatar_bg' + userInfo.user_id % 9"
  8. :data-name="userInfo.nick_name.slice(0,2).toUpperCase()"
  9. ></div>
  10. </div>
  11. <div class="top-info">
  12. <div class="name">{{userInfo.nick_name}}</div>
  13. <div class="code">{{$t('h5.username')}}:@{{userInfo.user_name}}</div>
  14. </div>
  15. <i class="arrow-icon el-icon-arrow-right"></i>
  16. </div>
  17. <ul class="pub-account-list" v-if="userInfo">
  18. <li class="list-item" v-for="(item, key) in userInfo.binds" :key="key">
  19. <div class="icon-wrap">
  20. <i :class="`${item.type}-icon`"></i>
  21. </div>
  22. <div class="info">
  23. <div class="title-wrap">
  24. <h4>{{item.type.toUpperCase()}}</h4>
  25. <p>{{item.account || $t('h5.notBind')}}</p>
  26. </div>
  27. <div class="btn-unbind" v-if="item.account" @click.stop="unbindAccount(item.type)">{{$t('userinfo.unbind')}}</div>
  28. <el-button @click="bindAccount(item.type)" :disabled="item.type == 'eth' || item.type == 'tron'" v-else>{{$t('userinfo.bind')}}</el-button>
  29. <div class="opetate" v-if="item.account" @click.stop="hanldeChange(item)">
  30. <i :class="item.is_visible === 0 ? 'unopen' : 'open'"></i>
  31. <p>{{item.is_visible === 0 ? $t('userinfo.private') : $t('userinfo.public')}}</p>
  32. </div>
  33. </div>
  34. </li>
  35. <!-- <li class="list-item ext-psw" @click="handlePsw">
  36. <div class="icon-wrap">
  37. <i class="psw-icon"></i>
  38. </div>
  39. <div class="info">
  40. <div class="title">{{$t('public.pswSetting')}}</div>
  41. <i class="arrow-icon el-icon-arrow-right"></i>
  42. </div>
  43. </li> -->
  44. </ul>
  45. <div class="pub-bottom-btn ext-lang" @click="changeLang"><i class="icon-change"></i>{{curLang=="en"?$t('public.chinese'):$t('public.english')}}</div>
  46. <div class="pub-bottom-btn" @click="loginOut">{{$t('h5.logout')}}</div>
  47. </div>
  48. </template>
  49. <script>
  50. import { mapState } from 'vuex'
  51. import API from '@/api'
  52. import { changeLangMixin } from '@/mixins'
  53. import { bindAccountMixins } from '@/mixins/user'
  54. export default {
  55. name: 'chatList',
  56. mixins: [changeLangMixin, bindAccountMixins],
  57. data () {
  58. return {
  59. }
  60. },
  61. computed: {
  62. ...mapState({
  63. userInfo: state => {
  64. return state.userInfo
  65. }
  66. })
  67. },
  68. methods: {
  69. bindAccount (type) {
  70. switch (type) {
  71. case 'eos':
  72. this.bindEos()
  73. break
  74. case 'tg':
  75. this.bindTg()
  76. break
  77. }
  78. },
  79. loginOut () {
  80. this.$store.dispatch('doScatterLogout').then(() => {
  81. this.$router.replace({ name: 'login', query: { from: '/me' } })
  82. this.$store.commit('setUserInfo', null)
  83. this.$store.commit('initChatData')
  84. this.$store.commit('initGroupData')
  85. this.$store.commit('chatAppLogin', false)
  86. this.$store.commit('toApp', true)
  87. })
  88. },
  89. // 账号显示与隐藏
  90. hanldeChange (item) {
  91. let type = item.type
  92. let val = item.is_visible == 0 ? 1 : 0
  93. API.user.setVisible({
  94. type,
  95. is_visible: val
  96. }).then(({ data }) => {
  97. this.$store.dispatch('getUserInfo')
  98. })
  99. },
  100. handlePsw () {
  101. this.$router.push('/password')
  102. }
  103. },
  104. created () {
  105. this.$store.dispatch('getUserInfo')
  106. }
  107. }
  108. </script>