my.nvue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="page">
  3. <view class="status-bar" :style="{height: statusBarHeight + 'px'}"></view>
  4. <!-- 用户信息区 -->
  5. <view class="user-header">
  6. <view class="user-info">
  7. <text class="user-name">{{name || '未登录'}}</text>
  8. <text class="user-detail">AppId:{{appid}}</text>
  9. <text class="user-detail">手机号:{{phone}}</text>
  10. </view>
  11. <image class="avatar" src="/static/my/avator.png" mode="aspectFill" @click="toInfo"></image>
  12. </view>
  13. <!-- 菜单列表 -->
  14. <view class="menu-list">
  15. <view class="menu-item" @click="goPage('/pages/device/mycases/mycases')">
  16. <image class="menu-icon" src="/static/my/icon3.png" mode="aspectFill"></image>
  17. <text class="menu-text">个性化方案</text>
  18. <image class="menu-arrow" src="/static/my/arrowright.png" mode="aspectFill"></image>
  19. </view>
  20. <view class="menu-item" @click="goPage('/pages/my/msg/msg')">
  21. <image class="menu-icon" src="/static/my/icon6.png" mode="aspectFill"></image>
  22. <view class="menu-text-wrap">
  23. <text class="menu-text" style="margin-left:0;">系统消息</text>
  24. <view class="msg-dot" v-if="msgNum > 0"></view>
  25. </view>
  26. <image class="menu-arrow" src="/static/my/arrowright.png" mode="aspectFill"></image>
  27. </view>
  28. <view class="menu-item" @click="goPage('/pages/my/version/version')">
  29. <image class="menu-icon" src="/static/my/icon2.png" mode="aspectFill"></image>
  30. <text class="menu-text">版本升级</text>
  31. <image class="menu-arrow" src="/static/my/arrowright.png" mode="aspectFill"></image>
  32. </view>
  33. <view class="menu-item" @click="goPage('/pages/my/questions/questions')">
  34. <image class="menu-icon" src="/static/my/icon5.png" mode="aspectFill"></image>
  35. <text class="menu-text">帮助</text>
  36. <image class="menu-arrow" src="/static/my/arrowright.png" mode="aspectFill"></image>
  37. </view>
  38. <view class="menu-item" @click="goPage('/pages/my/history/history')">
  39. <image class="menu-icon" src="/static/my/icon1.png" mode="aspectFill"></image>
  40. <text class="menu-text">使用记录</text>
  41. <image class="menu-arrow" src="/static/my/arrowright.png" mode="aspectFill"></image>
  42. </view>
  43. <view class="menu-item" @click="onLogout">
  44. <image class="menu-icon" src="/static/my/icon4.png" mode="aspectFill"></image>
  45. <text class="menu-text">退出登录</text>
  46. <image class="menu-arrow" src="/static/my/arrowright.png" mode="aspectFill"></image>
  47. </view>
  48. </view>
  49. <!-- 退出确认弹窗 -->
  50. <customPopup :isShow="isShowDrawer" @closePop="isShowDrawer=false">
  51. <view class="popup-content">
  52. <text class="popup-title">确定退出登录?</text>
  53. <view class="popup-btns">
  54. <text class="btn-cancel" @click="isShowDrawer=false">取消</text>
  55. <text class="btn-confirm" @click="logoutConfirm">退出登录</text>
  56. </view>
  57. </view>
  58. </customPopup>
  59. </view>
  60. </template>
  61. <script>
  62. import customPopup from '@/components/customPopup/customPopup.nvue'
  63. export default {
  64. components: {
  65. customPopup
  66. },
  67. data() {
  68. return {
  69. statusBarHeight: 44,
  70. isShowDrawer: false,
  71. name: '用户',
  72. phone: '138****8888',
  73. appid: '',
  74. msgNum: 0
  75. }
  76. },
  77. onShow() {
  78. const sysInfo = uni.getSystemInfoSync()
  79. this.statusBarHeight = sysInfo.statusBarHeight || 44
  80. this.init()
  81. },
  82. methods: {
  83. init() {
  84. // TODO: 获取用户信息接口
  85. // 暂用本地存储数据
  86. const phone = uni.getStorageSync('phone') || ''
  87. if (phone) {
  88. this.phone = phone
  89. }
  90. },
  91. toInfo() {
  92. uni.navigateTo({ url: '/pages/my/info/info' })
  93. },
  94. goPage(url) {
  95. uni.navigateTo({ url })
  96. },
  97. onLogout() {
  98. this.isShowDrawer = true
  99. },
  100. logoutConfirm() {
  101. uni.setStorageSync('token', '')
  102. uni.setStorageSync('phone', '')
  103. this.isShowDrawer = false
  104. uni.reLaunch({ url: '/pages/login/login' })
  105. }
  106. }
  107. }
  108. </script>
  109. <style>
  110. .page {
  111. flex: 1;
  112. background-image: linear-gradient(to bottom, #389588, #38958800);
  113. }
  114. .status-bar {
  115. background-color: rgba(0,0,0,0);
  116. }
  117. /* 用户头部 */
  118. .user-header {
  119. flex-direction: row;
  120. justify-content: space-between;
  121. padding-left: 38rpx;
  122. padding-right: 38rpx;
  123. padding-top: 62rpx;
  124. padding-bottom: 62rpx;
  125. }
  126. .user-info {
  127. flex: 1;
  128. }
  129. .user-name {
  130. font-size: 48rpx;
  131. color: #FFFFFF;
  132. margin-bottom: 8rpx;
  133. }
  134. .user-detail {
  135. font-size: 32rpx;
  136. color: #FFFFFF;
  137. padding-left: 30rpx;
  138. line-height: 66rpx;
  139. }
  140. .avatar {
  141. width: 150rpx;
  142. height: 150rpx;
  143. border-radius: 150rpx;
  144. }
  145. /* 菜单列表 */
  146. .menu-list {
  147. background-color: #FFFFFF;
  148. border-top-left-radius: 30rpx;
  149. border-top-right-radius: 30rpx;
  150. padding-top: 40rpx;
  151. flex: 1;
  152. }
  153. .menu-item {
  154. flex-direction: row;
  155. align-items: center;
  156. height: 104rpx;
  157. margin-left: 38rpx;
  158. margin-right: 38rpx;
  159. border-bottom-width: 1px;
  160. border-bottom-color: #EEF1F4;
  161. border-bottom-style: solid;
  162. }
  163. .menu-icon {
  164. width: 48rpx;
  165. height: 48rpx;
  166. margin-left: 32rpx;
  167. }
  168. .menu-text {
  169. flex: 1;
  170. font-size: 32rpx;
  171. color: #545F71;
  172. margin-left: 40rpx;
  173. }
  174. .menu-text-wrap {
  175. flex: 1;
  176. flex-direction: row;
  177. align-items: center;
  178. margin-left: 40rpx;
  179. }
  180. .msg-dot {
  181. width: 16rpx;
  182. height: 16rpx;
  183. background-color: #F65252;
  184. border-radius: 16rpx;
  185. margin-left: 10rpx;
  186. }
  187. .menu-arrow {
  188. width: 40rpx;
  189. height: 40rpx;
  190. margin-right: 16rpx;
  191. }
  192. /* 弹窗 */
  193. .popup-content {
  194. align-items: center;
  195. }
  196. .popup-title {
  197. font-size: 32rpx;
  198. color: #545F71;
  199. text-align: center;
  200. margin-top: 80rpx;
  201. margin-bottom: 80rpx;
  202. }
  203. .popup-btns {
  204. flex-direction: row;
  205. justify-content: space-around;
  206. width: 680rpx;
  207. }
  208. .btn-cancel {
  209. width: 306rpx;
  210. height: 88rpx;
  211. background-color: #F3F3F3;
  212. border-radius: 20rpx;
  213. font-size: 32rpx;
  214. color: #545F71;
  215. text-align: center;
  216. line-height: 88rpx;
  217. }
  218. .btn-confirm {
  219. width: 306rpx;
  220. height: 88rpx;
  221. background-color: #F65252;
  222. border-radius: 20rpx;
  223. font-size: 32rpx;
  224. color: #FFFFFF;
  225. text-align: center;
  226. line-height: 88rpx;
  227. }
  228. </style>