index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-02-22 15:46:58
  6. * @Description: file content
  7. * @FilePath: \oms\pages\my\index.vue
  8. -->
  9. <template>
  10. <view class="home">
  11. <view class="nav">
  12. <view :style="{ paddingTop }">
  13. <view class="title" :style="[{ height }, { lineHeight: height }]">
  14. <view class="back" v-if="showBack" @click="$refs.manage.back()">
  15. <u-icon name="arrow-left" color="#ffffff" size="22"></u-icon>
  16. </view>
  17. <text>我的</text>
  18. </view>
  19. <view class="user-info flex flex-middle">
  20. <image class="user-img" :src="avatar || require('@/static/images/user.jpg')" mode="scaleToFill" />
  21. <view class="info flex1 flex-column flex_1">
  22. <u-text :lines="1" size="32rpx" color="#fff" :bold="true" :text="nickName"></u-text>
  23. <u-text :lines="1" size="24rpx" color="#fff" :text="postName"></u-text>
  24. <!-- <u-text :lines="1" size="24rpx" color="#fff" text="西南地区销售工程师"></u-text> -->
  25. <u-text :lines="1" size="24rpx" color="#fff" text="登出" @click="logOut()"></u-text>
  26. </view>
  27. <!-- <u-icon name="arrow-right" color="#ffffff" size="18"></u-icon> -->
  28. </view>
  29. </view>
  30. </view>
  31. <view class="main">
  32. <u-row>
  33. <u-col span="12">
  34. <view class="my-menu-item flex flex-middle">
  35. <image class="menu-icon" src="@/static/images/my-menu1.png" mode="scaleToFill" />
  36. <view class="flex_1"><u-text size="28rpx" color="#646464" text="我的资料"></u-text></view>
  37. <u-icon name="arrow-right" color="#969696" size="18"></u-icon>
  38. </view>
  39. </u-col>
  40. </u-row>
  41. <u-row>
  42. <u-col span="12">
  43. <view class="my-menu-item flex flex-middle">
  44. <image class="menu-icon" src="@/static/images/my-menu2.png" mode="scaleToFill" />
  45. <view class="flex_1"><u-text size="28rpx" color="#646464" text="企业信息"></u-text></view>
  46. <u-icon name="arrow-right" color="#969696" size="18"></u-icon>
  47. </view>
  48. </u-col>
  49. </u-row>
  50. <u-row>
  51. <u-col span="12">
  52. <view class="my-menu-item flex flex-middle">
  53. <image class="menu-icon" src="@/static/images/my-menu3.png" mode="scaleToFill" />
  54. <view class="flex_1"><u-text size="28rpx" color="#646464" text="意见反馈"></u-text></view>
  55. <u-icon name="arrow-right" color="#969696" size="18"></u-icon>
  56. </view>
  57. </u-col>
  58. </u-row>
  59. <u-row>
  60. <u-col span="12">
  61. <view class="my-menu-item flex flex-middle">
  62. <image class="menu-icon" src="@/static/images/my-menu4.png" mode="scaleToFill" />
  63. <view class="flex_1"><u-text size="28rpx" color="#646464" text="关于应用"></u-text></view>
  64. <u-icon name="arrow-right" color="#969696" size="18"></u-icon>
  65. </view>
  66. </u-col>
  67. </u-row>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import { mapGetters } from 'vuex'
  73. import to from 'await-to-js'
  74. import userApi from '../../api/system/user'
  75. export default {
  76. name: 'opsIndex',
  77. data() {
  78. return {
  79. height: '',
  80. paddingTop: '',
  81. }
  82. },
  83. computed: {
  84. ...mapGetters(['nickName', 'postName', 'avatar']),
  85. },
  86. created() {
  87. const navData = uni.getMenuButtonBoundingClientRect()
  88. console.log(navData)
  89. this.height = navData.height + 'px'
  90. this.paddingTop = navData.top + 'px'
  91. },
  92. mounted() {
  93. console.log(this.nickName, this.avatar)
  94. },
  95. methods: {
  96. async logOut() {
  97. const [err, res] = await to(userApi.logout())
  98. if (err) return
  99. if (res.code == 200) {
  100. uni.showToast({
  101. title: '登出成功',
  102. icon: 'none',
  103. complete: async () => {
  104. uni.removeStorageSync('opms_token')
  105. uni.reLaunch({
  106. url: '/pages/login/index',
  107. })
  108. },
  109. })
  110. }
  111. },
  112. },
  113. }
  114. </script>
  115. <style>
  116. page {
  117. background: #f2f3f5;
  118. }
  119. </style>
  120. <style lang="scss" scoped>
  121. .home {
  122. padding-top: 188rpx;
  123. .nav {
  124. position: absolute;
  125. left: 0;
  126. top: 0;
  127. width: 100%;
  128. height: 520rpx;
  129. background: #3e7ef8;
  130. .title {
  131. position: relative;
  132. text-align: center;
  133. font-size: 32rpx;
  134. font-weight: bold;
  135. color: #ffffff;
  136. }
  137. .user-info {
  138. padding: 40rpx 76rpx 0 66rpx;
  139. display: flex;
  140. .user-img {
  141. width: 116rpx;
  142. height: 116rpx;
  143. border-radius: 50%;
  144. margin-right: 32rpx;
  145. }
  146. .info {
  147. height: 116rpx;
  148. margin-right: 32rpx;
  149. }
  150. }
  151. }
  152. .main {
  153. position: absolute;
  154. top: 374rpx;
  155. width: 100%;
  156. height: calc(100vh - 374rpx);
  157. background: #ffffff;
  158. border-radius: 31rpx 31rpx 0 0;
  159. overflow: auto;
  160. padding: 18rpx 38rpx 64rpx 26rpx;
  161. .my-menu-item {
  162. padding: 28rpx 44rpx;
  163. border-bottom: 1px solid #cdcdcd;
  164. .menu-icon {
  165. width: 48rpx;
  166. height: 48rpx;
  167. border-radius: 50%;
  168. margin-right: 25rpx;
  169. }
  170. }
  171. }
  172. }
  173. </style>