index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <view class=" page mine-container" :style="{height: `${windowHeight}px`}">
  3. <view class="page-back"></view>
  4. <view class="navgator justify-center align-center">
  5. <view class="nav-title">
  6. {{ $t('app.appName') }}
  7. </view>
  8. </view>
  9. <view class="content-section">
  10. <!--顶部个人信息栏-->
  11. <view class="user-info flex-row justify-start align-center">
  12. <image class="avatar" :src="userInfo?.avatar ? userInfo?.avatar : '/static/common/avata.gif'"></image>
  13. <view class="info flex-col align-center justify-start">
  14. <view class="text flex-row"> <span
  15. class="span">{{$t('user.username')}}:</span>{{ userInfo?.nickname }} </view>
  16. <view class="text flex-row"> <span class="span">{{$t('user.phone')}}:</span>{{ userInfo?.mobile }}
  17. </view>
  18. </view>
  19. </view>
  20. <!-- 菜单 -->
  21. <view class="menu-list">
  22. <view class="card-cell flex-row align-center justify-between" @click="navigateToChange">
  23. <image src="/static/user/anquanzhongxin.svg" mode="aspectFill"></image>
  24. <view class="cell-con flex-row align-center justify-between">
  25. <view class="cell-text flex-row align-center justify-start">
  26. <view class="title">
  27. {{ $t('user.securityCenter') }}
  28. </view>
  29. <view class="subtitle">
  30. {{ $t('user.modifyPhoneAndPassword') }}
  31. </view>
  32. </view>
  33. <uni-icons type="right" :color="'#CACCCF'" size="15" />
  34. </view>
  35. </view>
  36. <view class="card-cell flex-row align-center justify-between">
  37. <image src="/static/user/guanyuwomen.svg" mode="aspectFill"></image>
  38. <view class="cell-con flex-row align-center justify-between">
  39. <view class="cell-text flex-row align-center justify-start">
  40. <view class="title">
  41. {{ $t('user.aboutUs') }}
  42. </view>
  43. <view class="subtitle">
  44. {{ $t('user.currentVersion') + ' ' + version }}
  45. </view>
  46. </view>
  47. <uni-icons type="right" :color="'#CACCCF'" size="15" />
  48. </view>
  49. </view>
  50. <view class="card-cell flex-row align-center justify-between" @click="logout">
  51. <image src="/static/user/tuichu.svg" mode="aspectFill"></image>
  52. <view class="cell-con flex-row align-center justify-between">
  53. <view class="cell-text flex-row align-center justify-start">
  54. <view class="title">
  55. {{ $t('user.logout') }}
  56. </view>
  57. </view>
  58. <uni-icons type="right" :color="'#CACCCF'" size="15" />
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <script setup>
  66. import {
  67. onMounted,
  68. ref
  69. } from 'vue';
  70. import {
  71. useI18n
  72. } from 'vue-i18n'
  73. import {
  74. getLoginUserInfo
  75. } from "@/api/login";
  76. const {
  77. t
  78. } = useI18n({
  79. useScope: 'global'
  80. })
  81. import $store from '@/store';
  82. // const userStore = $store('user');
  83. //
  84. // const userInfo = ref(JSON.parse(getUserInfo()))
  85. // userInfo.value = JSON.parse(userInfo.value).user
  86. // console.log('useer---', userInfo.value)
  87. // const avatar = userInfo.value.avatar
  88. // const name = userInfo.value.nickname
  89. // const phone = userInfo.value.phone || ''
  90. const windowHeight = ref(0)
  91. uni.getSystemInfo({
  92. success: function(res) {
  93. windowHeight.value = res.windowHeight
  94. }
  95. })
  96. const navigateToChange = () => {
  97. uni.navigateTo({
  98. url: '/pages/user/change?info=' + JSON.stringify(userInfo.value)
  99. })
  100. }
  101. const userStore = $store('user')
  102. const logout = () => {
  103. uni.showModal({
  104. title: t('api.message'),
  105. content: `${t('login.logoutConfirm')}?`,
  106. success: async function(res) {
  107. if (res.confirm) {
  108. await userStore.LogOut();
  109. await uni.reLaunch({
  110. url: '/pages/user/login'
  111. })
  112. } else if (res.cancel) {
  113. console.log('用户点击取消');
  114. }
  115. }
  116. })
  117. }
  118. const userInfo = ref({})
  119. const version = ref('')
  120. onMounted(async () => {
  121. version.value = uni.getAppBaseInfo().appVersion
  122. userInfo.value = (await getLoginUserInfo()).data
  123. uni.$once('updateUserInfo', async () => {
  124. userInfo.value = (await getLoginUserInfo()).data
  125. })
  126. })
  127. </script>
  128. <style lang="scss" scoped>
  129. .page {
  130. padding: 10px !important;
  131. }
  132. .mine-container {
  133. width: 100%;
  134. height: 100%;
  135. position: relative;
  136. box-sizing: border-box;
  137. overflow: hidden;
  138. }
  139. .page-back {
  140. background-image: url("/static/common/1.png");
  141. background-repeat: no-repeat;
  142. background-size: 100% 100%;
  143. position: fixed;
  144. top: 0;
  145. left: 0;
  146. width: 100%;
  147. height: 350px;
  148. z-index: 0;
  149. }
  150. .navgator {
  151. position: fixed;
  152. top: 1.5625rem;
  153. left: 0;
  154. width: 100%;
  155. height: 55px;
  156. padding: 15px 0;
  157. z-index: 2;
  158. // background-image: url('/static/common/nav-back.png');
  159. }
  160. .nav-title {
  161. font-family: PingFang-SC, PingFang-SC;
  162. font-weight: bold;
  163. font-size: 16px;
  164. color: #FFFFFF;
  165. line-height: 22px;
  166. text-align: right;
  167. font-style: normal;
  168. }
  169. .content-section {
  170. position: relative;
  171. margin-top: 70px;
  172. width: 100%;
  173. height: calc(100% - 55px - 20px);
  174. overflow-y: auto;
  175. }
  176. .user-info {
  177. width: 100%;
  178. height: 80px;
  179. padding: 14px 20px;
  180. box-sizing: border-box;
  181. background: #FFFFFF;
  182. border-radius: 6px;
  183. font-size: 14px;
  184. color: #333333;
  185. .avatar {
  186. width: 52px;
  187. height: 52px;
  188. border-radius: 50%;
  189. margin-right: 18px;
  190. }
  191. .info {
  192. width: calc(100% - 52px - 18px);
  193. }
  194. }
  195. .text {
  196. height: 19px;
  197. width: 100%;
  198. .span {
  199. display: block;
  200. min-width: 70px;
  201. }
  202. }
  203. .menu-list {
  204. height: 274px;
  205. background: #FFFFFF;
  206. border-radius: 6px;
  207. margin-top: 10px;
  208. padding: 20px;
  209. box-sizing: border-box;
  210. }
  211. .card-cell {
  212. width: 100%;
  213. height: 50px;
  214. image {
  215. width: 32px;
  216. height: 32px;
  217. }
  218. }
  219. .cell-con {
  220. margin-left: 20px;
  221. margin-right: 10px;
  222. width: calc(100% - 32px - 20px - 10px);
  223. height: 100%;
  224. border-bottom: 0.5px solid #CACCCF;
  225. }
  226. .cell-text {
  227. font-weight: 500;
  228. .title {
  229. font-size: 14px;
  230. color: #333333;
  231. line-height: 20px;
  232. }
  233. .subtitle {
  234. font-size: 12px;
  235. color: #999999;
  236. line-height: 17px;
  237. margin-left: 10px;
  238. }
  239. .icon {
  240. width: 6px;
  241. height: 10px;
  242. }
  243. }
  244. </style>