index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. this.height = navData.height + 'px'
  89. this.paddingTop = navData.top + 'px'
  90. },
  91. mounted() {
  92. },
  93. methods: {
  94. async logOut() {
  95. const [err, res] = await to(userApi.logout())
  96. if (err) return
  97. if (res.code == 200) {
  98. uni.showToast({
  99. title: '登出成功',
  100. icon: 'none',
  101. complete: async () => {
  102. uni.removeStorageSync('opms_token')
  103. uni.reLaunch({
  104. url: '/pages/login/index',
  105. })
  106. },
  107. })
  108. }
  109. },
  110. },
  111. }
  112. </script>
  113. <style>
  114. page {
  115. background: #f2f3f5;
  116. }
  117. </style>
  118. <style lang="scss" scoped>
  119. .home {
  120. padding-top: 188rpx;
  121. .nav {
  122. position: absolute;
  123. left: 0;
  124. top: 0;
  125. width: 100%;
  126. height: 520rpx;
  127. background: #3e7ef8;
  128. .title {
  129. position: relative;
  130. text-align: center;
  131. font-size: 32rpx;
  132. font-weight: bold;
  133. color: #ffffff;
  134. }
  135. .user-info {
  136. padding: 40rpx 76rpx 0 66rpx;
  137. display: flex;
  138. .user-img {
  139. width: 116rpx;
  140. height: 116rpx;
  141. border-radius: 50%;
  142. margin-right: 32rpx;
  143. }
  144. .info {
  145. height: 116rpx;
  146. margin-right: 32rpx;
  147. }
  148. }
  149. }
  150. .main {
  151. position: absolute;
  152. top: 374rpx;
  153. width: 100%;
  154. height: calc(100vh - 374rpx);
  155. background: #ffffff;
  156. border-radius: 31rpx 31rpx 0 0;
  157. overflow: auto;
  158. padding: 18rpx 38rpx 64rpx 26rpx;
  159. .my-menu-item {
  160. padding: 28rpx 44rpx;
  161. border-bottom: 1px solid #cdcdcd;
  162. .menu-icon {
  163. width: 48rpx;
  164. height: 48rpx;
  165. border-radius: 50%;
  166. margin-right: 25rpx;
  167. }
  168. }
  169. }
  170. }
  171. </style>