aboutMe.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <div class="about-me">
  3. <div class="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="">
  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">昵称:@{{userInfo.user_name}}</div>
  14. </div>
  15. <i class="arrow-icon el-icon-arrow-right"></i>
  16. </div>
  17. <ul class="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">{{item.type.toUpperCase()}}</div>
  24. <div class="code">{{item.account || '未绑定'}}</div>
  25. </div>
  26. <div class="opetate" v-if="item.account" @click="hanldeChange(item)">
  27. <i :class="item.is_visible === 0 ? 'unopen' : 'open'"></i>
  28. <p>{{item.is_visible === 0 ? '未公开' : '已公开'}}</p>
  29. </div>
  30. </li>
  31. </ul>
  32. <div class="login-out-btn" @click="loginOut">退出登录</div>
  33. </div>
  34. </template>
  35. <script>
  36. import { mapState } from 'vuex'
  37. import API from '@/api'
  38. export default {
  39. name: 'chatList',
  40. data () {
  41. return {
  42. }
  43. },
  44. computed: {
  45. ...mapState({
  46. userInfo: state => {
  47. return state.userInfo
  48. }
  49. })
  50. },
  51. methods: {
  52. loginOut () {
  53. this.$store.dispatch('doScatterLogout')
  54. },
  55. // 账号显示与隐藏
  56. hanldeChange (item) {
  57. let type = item.type
  58. let val = item.is_visible == 0 ? 1 : 0
  59. API.user.setVisible({
  60. type,
  61. is_visible: val
  62. }).then(({ data }) => {
  63. this.$store.dispatch('getUserInfo')
  64. })
  65. }
  66. },
  67. created () {
  68. this.$store.dispatch('getUserInfo')
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .top{
  74. padding: px2rem(50) px2rem(54);
  75. background-color: #ffffff;
  76. border-bottom: 1px solid #d8d8d8;
  77. position: relative;
  78. .avatar-wrap{
  79. display: inline-block;
  80. vertical-align: middle;
  81. }
  82. .user-avatar{
  83. width: px2rem(120);
  84. height: px2rem(120);
  85. border-radius: 4px;
  86. }
  87. .top-info{
  88. display: inline-block;
  89. vertical-align: middle;
  90. margin-left: px2rem(30);
  91. }
  92. .name{
  93. font-size: px2rem(42);
  94. color: #000000;
  95. margin-bottom: px2rem(30);
  96. }
  97. .code{
  98. color: #666666;
  99. font-size: px2rem(28);
  100. }
  101. .arrow-icon{
  102. position: absolute;
  103. color: #c8c8c8;
  104. top: px2rem(96);
  105. right: px2rem(24);
  106. font-size: px2rem(36);
  107. }
  108. }
  109. .account-list{
  110. background-color: #ffffff;
  111. margin: 18px 0;
  112. border-top: 1px solid #d8d8d8;
  113. border-bottom: 1px solid #d8d8d8;
  114. .list-item{
  115. display: flex;
  116. height: px2rem(130);
  117. &:last-child{
  118. .info{
  119. border-bottom: none;
  120. }
  121. .opetate{
  122. border-bottom: none;
  123. }
  124. }
  125. }
  126. .title{
  127. font-size: px2rem(30);
  128. color: #000000;
  129. margin-bottom: px2rem(22);
  130. }
  131. .code{
  132. font-size: px2rem(20);
  133. color: #999999;
  134. }
  135. .info{
  136. flex: 1;
  137. padding-top: px2rem(30);
  138. border-bottom: 1px solid #d8d8d8;
  139. }
  140. .opetate{
  141. width: px2rem(100);
  142. font-size: px2rem(20);
  143. color: #999999;
  144. padding-top: px2rem(32);
  145. border-bottom: 1px solid #d8d8d8;
  146. i{
  147. display: block;
  148. margin: 0 auto;
  149. }
  150. p{
  151. text-align: center;
  152. margin-top: px2rem(16);
  153. }
  154. .open{
  155. background: url('../../../assets/h5/open-icon.png') no-repeat;
  156. width: px2rem(39);
  157. height: px2rem(23);
  158. background-size: 100%;
  159. }
  160. .unopen{
  161. background: url('../../../assets/h5/unopen-icon.png') no-repeat;
  162. width: px2rem(40);
  163. height: px2rem(23);
  164. background-size: 100%;
  165. }
  166. }
  167. .icon-wrap{
  168. width: px2rem(106);
  169. line-height: px2rem(130);
  170. text-align: center;
  171. i{
  172. display: inline-block;
  173. vertical-align: middle;
  174. }
  175. }
  176. .eos-icon{
  177. background: url('../../../assets/h5/eos-icon.png') no-repeat;
  178. width: px2rem(47);
  179. height: px2rem(48);
  180. background-size: 100%;
  181. }
  182. .eth-icon{
  183. background: url('../../../assets/h5/eth-icon.png') no-repeat;
  184. width: px2rem(44);
  185. height: px2rem(39);
  186. background-size: 100%;
  187. }
  188. .tron-icon{
  189. background: url('../../../assets/h5/tron-icon.png') no-repeat;
  190. width: px2rem(34);
  191. height: px2rem(35);
  192. background-size: 100%;
  193. }
  194. }
  195. .login-out-btn{
  196. font-size: px2rem(28);
  197. color: #ea2d2d;
  198. text-align: center;
  199. height: px2rem(88);
  200. line-height: px2rem(88);
  201. border-top: 1px solid #d8d8d8;
  202. border-bottom: 1px solid #d8d8d8;
  203. background-color: #ffffff;
  204. }
  205. </style>