index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <view class="mine-container" :style="{height: `${windowHeight}px`}">
  3. <navInfo :title="'个人中心'"></navInfo>
  4. <view class="bgTopImg">
  5. <image slot="right" :src="`${urls}/navBg@2x.png`" class="bgTopImg"></image>
  6. </view>
  7. <!--顶部个人信息栏-->
  8. <view class="header-section">
  9. <view class="flex padding justify-between">
  10. <view class="flex align-center">
  11. </view>
  12. <view @click="handleToInfo" class="flex align-center">
  13. </view>
  14. </view>
  15. </view>
  16. <view class="content-section">
  17. <view class="mine-actions grid col-3 text-center">
  18. <view class="photo">
  19. <image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round"
  20. style="border: 3px solid #4CB2B6;width: 160rpx;height: 160rpx;">
  21. </view>
  22. <view v-if="name" @click="handleToInfo" class="user-info">
  23. <view class="u_title"> 昵称:{{ name }}
  24. </view>
  25. <view style="height: 2rpx;background-color: #E5E5E5;margin-top: 40rpx;width: 92%;margin-left:4%;">
  26. </view>
  27. </view>
  28. <u-cell-group :border="false" customStyle="margin-top:30rpx">
  29. <u-cell :border="false" :icon="bianjiziliao" title="编辑资料" isLink @click.native="handleToEditInfo">
  30. </u-cell>
  31. <u-cell :border="false" :icon="danweixinxi" @click.native="goUnit" isLink title="单位信息" v-if="!isStreet"></u-cell>
  32. <u-cell :border="false" :icon="jianchajilu" @click.native="auditRecord" isLink title="工作记录" v-if="!isStreet">
  33. </u-cell>
  34. <u-cell :border="false" :icon="jianchajilu" @click.native="goInstuct" isLink title="操作说明">
  35. </u-cell>
  36. </u-cell-group>
  37. <view v-if="name" class="user-info" style="padding-bottom: 40rpx;">
  38. <u-button @click="handleLogout" type="primary" shape="circle" size="default" color="#4CB2B6"
  39. text="退出登录">
  40. </u-button>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. // #ifdef H5
  49. import navInfo from '@/pagesA/components/my-nav/nav'
  50. // #endif
  51. import storage from '@/utils/storage'
  52. import {
  53. getUserProfile
  54. } from "@/api/system/user"
  55. import config from '@/config'
  56. const baseUrlImg=config.baseUrlImg
  57. export default {
  58. components: {
  59. // #ifdef H5
  60. navInfo
  61. // #endif
  62. },
  63. data() {
  64. return {
  65. urls:baseUrlImg,
  66. jianchajilu:`${baseUrlImg}/jianchajilu.png`,
  67. bianjiziliao: `${baseUrlImg}/bianjiziliao.png`,
  68. danweixinxi:`${baseUrlImg}/danweixinxi.png`,
  69. name: this.$store.state.user.name,
  70. version: getApp().globalData.config.appInfo.version,
  71. isStreet:null
  72. }
  73. },
  74. computed: {
  75. avatar() {
  76. return this.$store.state.user.avatar
  77. },
  78. windowHeight() {
  79. return uni.getSystemInfoSync().windowHeight - 50
  80. }
  81. },
  82. onShow() {
  83. this.getUser()
  84. this.isStreet = uni.getStorageSync('getUserInfo_key').streetInfo; //登录用户的街道id
  85. },
  86. methods: {
  87. getUser() {
  88. getUserProfile().then(response => {
  89. // this.name= response.data
  90. this.name = response.data.username
  91. })
  92. },
  93. handleToInfo() {
  94. this.$tab.navigateTo('/pages/mine/info/index')
  95. },
  96. handleToEditInfo() {
  97. uni.navigateTo({
  98. url: '/pages/mine/info/edit'
  99. })
  100. },
  101. goUnit() {
  102. uni.navigateTo({
  103. url: '/pagesA/fire/unit_info/index'
  104. })
  105. },
  106. auditRecord() {
  107. uni.navigateTo({
  108. url:`/pagesB/fire/check_record/index?my=onlymy`
  109. })
  110. },
  111. goInstuct(){
  112. uni.navigateTo({
  113. url:`/pages/mine/instruct/instruct`
  114. })
  115. },
  116. handleToSetting() {
  117. this.$tab.navigateTo('/pages/mine/setting/index')
  118. },
  119. handleToLogin() {
  120. this.$tab.reLaunch('/pages/login')
  121. },
  122. handleToAvatar() {
  123. this.$tab.navigateTo('/pages/mine/avatar/index')
  124. },
  125. handleLogout() {
  126. this.$modal.confirm('确定注销并退出系统吗?').then(() => {
  127. this.$store.dispatch('LogOut').then(() => {
  128. this.$tab.reLaunch('/pages/index')
  129. // this.$tab.reLaunch('/pages/work/index')
  130. })
  131. })
  132. },
  133. handleHelp() {
  134. this.$tab.navigateTo('/pages/mine/help/index')
  135. },
  136. handleAbout() {
  137. this.$tab.navigateTo('/pages/mine/about/index')
  138. },
  139. handleJiaoLiuQun() {
  140. this.$modal.showToast('微信搜索 naidaguo 后,添加好友后拉你进技术交流群')
  141. },
  142. handleBuilding() {
  143. this.$modal.showToast('模块建设中~')
  144. }
  145. }
  146. }
  147. </script>
  148. <style lang="scss" scoped>
  149. page {
  150. background-color: #f5f6f7;
  151. }
  152. .mine-container {
  153. width: 100%;
  154. height: 100%;
  155. .header-section {
  156. /*#ifdef H5*/
  157. padding: 15px 15px 100rpx 15px;
  158. /* #endif */
  159. /* #ifdef MP-WEIXIN*/
  160. padding: 15px 15px 240rpx 15px;
  161. /* #endif */
  162. color: white;
  163. .login-tip {
  164. font-size: 18px;
  165. margin-left: 10px;
  166. }
  167. .cu-avatar {
  168. border: 2px solid #eaeaea;
  169. .icon {
  170. font-size: 40px;
  171. }
  172. }
  173. }
  174. .content-section {
  175. position: relative;
  176. top: -100rpx;
  177. .user-info {
  178. margin-top: 40px;
  179. width: 100%;
  180. .u_title {
  181. font-size: 18px;
  182. text-align: center;
  183. line-height: 40rpx;
  184. }
  185. }
  186. .mine-actions {
  187. margin: 60rpx 15px;
  188. padding: 20px 0px;
  189. border-radius: 30px;
  190. background-color: white;
  191. position: relative;
  192. text-align: center;
  193. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63);
  194. .photo {
  195. position: absolute;
  196. left: 50%;
  197. top: -80rpx;
  198. transform: translate(-120rpx);
  199. }
  200. .action-item {
  201. .icon {
  202. font-size: 28px;
  203. }
  204. .text {
  205. display: block;
  206. font-size: 13px;
  207. }
  208. }
  209. }
  210. }
  211. }
  212. /deep/.u-cell__title {
  213. flex: none !important;
  214. }
  215. /deep/.u-cell__left-icon-wrap[data-v-913eaa32],
  216. .u-cell__left-icon-wrap.data-v-913eaa32 {
  217. margin-right: 14px;
  218. }
  219. /deep/.u-button[data-v-3bf2dba7],
  220. /deep/.u-button.data-v-3bf2dba7,/deep/.u-button {
  221. width: 48% !important;
  222. }
  223. </style>