index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <view class="page_container">
  3. <view class="self_info_row"></view>
  4. <view class="info_card">
  5. <my-avatar :src="selfInfo.faceURL" :desc="selfInfo.nickname" size="46" />
  6. <view class="id_row">
  7. <text class="nickname">{{ selfInfo.nickname }}</text>
  8. <view class="id_row_copy" @click="copy">
  9. <text class="id">{{ selfInfo.userID }}</text>
  10. <image
  11. style="width: 32rpx; height: 32rpx"
  12. src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/id_copy.png"
  13. mode=""
  14. />
  15. </view>
  16. </view>
  17. <view class="qr" @click="toSelfQr">
  18. <img src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/self_info_qr.png" alt="" />
  19. <img src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/common_right.png" alt="" />
  20. </view>
  21. </view>
  22. <view class="action_box">
  23. <view
  24. @click="profileMenuClick(item)"
  25. class="profile_menu_item"
  26. v-for="item in profileMenus"
  27. :key="item.idx"
  28. >
  29. <view class="menu_left">
  30. <image style="width: 48rpx; height: 48rpx" :src="item.icon" mode="" />
  31. <text>{{ item.title }}</text>
  32. </view>
  33. <u-icon name="arrow-right" size="16" color="#999"></u-icon>
  34. </view>
  35. </view>
  36. <u-toast ref="uToast"></u-toast>
  37. </view>
  38. </template>
  39. <script>
  40. import IMSDK from "openim-uniapp-polyfill";
  41. import { callingModule, meetingModule } from "../../../util/imCommon";
  42. import MyAvatar from "../../../components/MyAvatar/index.vue";
  43. export default {
  44. components: {
  45. MyAvatar,
  46. },
  47. data() {
  48. return {
  49. profileMenus: [
  50. {
  51. idx: 0,
  52. title: "我的信息",
  53. icon: "https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/profile_menu_info.png",
  54. },
  55. {
  56. idx: 2,
  57. title: "账号设置",
  58. icon: "https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/profile_menu_account.png",
  59. },
  60. {
  61. idx: 3,
  62. title: "关于我们",
  63. icon: "https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/profile_menu_about.png",
  64. },
  65. {
  66. idx: 4,
  67. title: "退出登录",
  68. icon: "https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/profile_menu_logout.png",
  69. },
  70. ],
  71. };
  72. },
  73. computed: {
  74. selfInfo() {
  75. return this.$store.getters.storeSelfInfo;
  76. },
  77. },
  78. methods: {
  79. copy() {
  80. uni.setClipboardData({
  81. showToast: false,
  82. data: this.selfInfo.userID,
  83. success: function () {
  84. uni.showToast({
  85. icon: "none",
  86. title: "复制成功",
  87. });
  88. },
  89. });
  90. },
  91. logoutConfirm() {
  92. IMSDK.asyncApi(IMSDK.IMMethods.Logout, IMSDK.uuid())
  93. .then(() => {
  94. callingModule?.endCall();
  95. meetingModule?.endCall();
  96. uni.removeStorage({
  97. key: "IMToken",
  98. });
  99. uni.removeStorage({
  100. key: "BusinessToken",
  101. });
  102. })
  103. .catch((err) => console.log(err))
  104. .finally(() => {
  105. uni.$u.route("/pages/login/index");
  106. });
  107. },
  108. profileMenuClick({ idx }) {
  109. switch (idx) {
  110. case 0:
  111. uni.navigateTo({
  112. url: "/pages/profile/selfInfo/index",
  113. });
  114. break;
  115. case 1:
  116. uni.navigateTo({
  117. url: "/pages/profile/messageNotification/index",
  118. });
  119. break;
  120. case 2:
  121. uni.navigateTo({
  122. url: "/pages/profile/accountSetting/index",
  123. });
  124. break;
  125. case 3:
  126. uni.navigateTo({
  127. url: "/pages/profile/about/index",
  128. });
  129. break;
  130. case 4:
  131. uni.showModal({
  132. title: "提示",
  133. content: "确定要退出当前账号吗?",
  134. confirmText: "确认",
  135. cancelText: "取消",
  136. success: (res) => {
  137. if (res.confirm) {
  138. this.logoutConfirm();
  139. }
  140. },
  141. });
  142. break;
  143. default:
  144. break;
  145. }
  146. },
  147. toSelfQr() {
  148. uni.navigateTo({
  149. url: `/pages/common/userOrGroupQrCode/index`,
  150. });
  151. },
  152. },
  153. };
  154. </script>
  155. <style lang="scss" scoped>
  156. .page_container {
  157. background-color: #f8f9fa;
  158. .self_info_row {
  159. display: flex;
  160. flex-direction: column;
  161. justify-content: flex-end;
  162. align-items: center;
  163. width: 100%;
  164. height: 276rpx;
  165. background-image: url("@https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/profile_top_bg.png");
  166. background-repeat: round;
  167. }
  168. .info_card {
  169. width: 640rpx;
  170. height: 196rpx;
  171. border-radius: 6px;
  172. background: #fff;
  173. margin: -120rpx auto 0 auto;
  174. padding: 0 36rpx;
  175. color: #0c1c33;
  176. display: flex;
  177. align-items: center;
  178. .id_row {
  179. @include vCenterBox();
  180. display: flex;
  181. height: 46px;
  182. margin-left: 16rpx;
  183. flex-direction: column;
  184. align-items: flex-start;
  185. justify-content: space-between;
  186. flex: 1;
  187. font-size: 28rpx;
  188. &_copy {
  189. @include vCenterBox();
  190. }
  191. .nickname {
  192. @include nomalEllipsis();
  193. max-width: 400rpx;
  194. font-weight: 500;
  195. font-size: 34rpx;
  196. }
  197. .id {
  198. color: #8e9ab0;
  199. }
  200. }
  201. img {
  202. width: 18px;
  203. height: 18px;
  204. }
  205. }
  206. .action_box {
  207. margin: 24rpx 24rpx 0 24rpx;
  208. background: #fff;
  209. border-radius: 6px;
  210. }
  211. .profile_menu_item {
  212. @include btwBox();
  213. padding: 24rpx 36rpx;
  214. .menu_left {
  215. @include vCenterBox();
  216. color: $uni-text-color;
  217. image {
  218. margin-right: 24rpx;
  219. }
  220. }
  221. }
  222. }
  223. </style>