MePage.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div class="me-container">
  3. <div class="user-info" @click="showUserInfo">
  4. <image class="portrait" :src="user.portrait"></image>
  5. <text class="name">{{ user.displayName }}</text>
  6. <i></i>
  7. </div>
  8. <div class="about" @click="showAbout">
  9. <text>关于</text>
  10. <i></i>
  11. </div>
  12. <div class="about" @click="showApiTest">
  13. <text>API测试</text>
  14. <i></i>
  15. </div>
  16. <div class="about" @click="showConferencePortal">
  17. <text>打开会议入口</text>
  18. <i></i>
  19. </div>
  20. <button class="logout-button" @click="logout">退出登录</button>
  21. </div>
  22. </template>
  23. <script>
  24. import wfc from "../../wfc/client/wfc";
  25. import wfcUIKit from "../../wfc/uikit/wfcUIKit";
  26. import {clear} from "../util/storageHelper";
  27. import store from "../../store";
  28. export default {
  29. name: "MePage",
  30. data() {
  31. return {
  32. user: store.state.contact.selfUserInfo,
  33. }
  34. },
  35. methods: {
  36. showUserInfo() {
  37. store.setCurrentFriend(this.user)
  38. uni.navigateTo({
  39. url: '/pages/contact/UserDetailPage',
  40. success: () => {
  41. console.log('nav to UserDetailPage success');
  42. },
  43. fail: (err) => {
  44. console.log('nav to UserDetailPage err', err);
  45. }
  46. })
  47. },
  48. logout() {
  49. wfc.disconnect();
  50. clear();
  51. uni.reLaunch(
  52. {
  53. url:'/pages/login/login'
  54. }
  55. );
  56. },
  57. showAbout() {
  58. uni.navigateTo({
  59. url: '/pages/misc/WebViewPage?url=https://wildfirechat.cn/',
  60. fail: (e) => {
  61. console.log(e)
  62. }
  63. });
  64. },
  65. showApiTest(){
  66. uni.navigateTo({
  67. url: '/pages/misc/ApiTestPage',
  68. fail: (e) => {
  69. console.log(e)
  70. }
  71. });
  72. },
  73. showConferencePortal(){
  74. if (wfcUIKit.isSupportConference()){
  75. wfcUIKit.showConferencePortal();
  76. } else {
  77. uni.showToast({
  78. title: '当前插件,只支持音视频通话,不支持会议功能,请联系开发者',
  79. icon: 'none',
  80. });
  81. }
  82. }
  83. }
  84. }
  85. </script>
  86. <style scoped>
  87. .me-container {
  88. display: flex;
  89. flex-direction: column;
  90. align-items: center;
  91. width: 100%;
  92. height: 100vh;
  93. background: #fafafa;
  94. }
  95. .user-info {
  96. width: 100%;
  97. padding: 10px;
  98. height: 80px;
  99. display: flex;
  100. background: white;
  101. align-items: center;
  102. flex-direction: row;
  103. margin-bottom: 10px;
  104. }
  105. .user-info:active {
  106. background: #d6d6d6;
  107. }
  108. .user-info .portrait {
  109. width: 60px;
  110. height: 60px;
  111. border-radius: 5px;
  112. }
  113. .user-info .name {
  114. margin-left: 10px;
  115. }
  116. .about {
  117. width: 100%;
  118. padding: 15px 10px;
  119. background: white;
  120. }
  121. .about:active {
  122. background: #d6d6d6;
  123. }
  124. .logout-button {
  125. margin-top: 20px;
  126. }
  127. </style>