index.vue 6.7 KB

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