index.vue 5.5 KB

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