You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
3.5 KiB

  1. <template>
  2. <view class="main">
  3. <view :style="{height:iSMT+'px'}"></view>
  4. <view class="top">
  5. <view class="top-list">
  6. <text>语言</text>
  7. <text class="language">{{settingRes.language}}</text>
  8. <uni-icons type="arrowright" size="16" class="arrow" />
  9. </view>
  10. <view class="top-list" @click="goToFont">
  11. <text>字体大小</text>
  12. <uni-icons type="arrowright" size="16" class="arrow" />
  13. </view>
  14. <view class="top-list" @click="goToTheme">
  15. <text>主题切换</text>
  16. <uni-icons type="arrowright" size="16" class="arrow" />
  17. </view>
  18. </view>
  19. <view class="center">
  20. <view class="center-list" @click="goToMessage">
  21. <text>消息推送</text>
  22. <uni-icons type="arrowright" size="16" class="arrow" />
  23. </view>
  24. </view>
  25. <view class="bottom">
  26. <view class="bottom-list" @click="goToServer">
  27. <text>切换服务器</text>
  28. <uni-icons type="arrowright" size="16" class="arrow" />
  29. </view>
  30. <view class="bottom-list" @click="clearCache">
  31. <text>清理缓存</text>
  32. <text class="cache">{{ cache }}M</text>
  33. <uni-icons type="arrowright" size="16" class="arrow" />
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script setup>
  39. import {
  40. ref,
  41. onMounted
  42. } from 'vue'
  43. import {getUserInfo} from "@/api/member";
  44. const iSMT = ref(0)
  45. const cache = ref('45.5')
  46. const settingRes = ref({})
  47. const settingPromise = getUserInfo()
  48. settingPromise.then(res => {
  49. if (res.code === 200){
  50. settingRes.value.language = res.data.language;
  51. settingRes.value.fontSize = res.data.fontSize;
  52. settingRes.value.theme = res.data.theme;
  53. settingRes.value.serverSelection = res.data.serverSelection;
  54. console.log('用户信息', res.data)
  55. }else {
  56. console.log('用户信息请求失败:', res.message);
  57. }
  58. })
  59. const goToFont = () => {
  60. uni.navigateTo({
  61. url: '/pages/setting/font'
  62. })
  63. }
  64. const goToTheme = () => {
  65. uni.navigateTo({
  66. url: '/pages/setting/theme'
  67. })
  68. }
  69. const goToMessage = () => {
  70. uni.navigateTo({
  71. url: '/pages/setting/message'
  72. })
  73. }
  74. const goToServer = () => {
  75. uni.navigateTo({
  76. url: '/pages/setting/server'
  77. })
  78. }
  79. const clearCache = () => {
  80. cache.value = 0
  81. uni.showToast({
  82. title: '清理成功',
  83. icon: 'success',
  84. duration: 1500
  85. })
  86. }
  87. onMounted(() => {
  88. // 状态栏高度
  89. iSMT.value = uni.getSystemInfoSync().statusBarHeight;
  90. console.log('看看高度', iSMT.value)
  91. })
  92. </script>
  93. <style>
  94. .top {
  95. margin-top: 1.5vh;
  96. height: 21vh;
  97. background-color: white;
  98. }
  99. .top-list {
  100. width: 630rpx;
  101. height: 7vh;
  102. display: flex;
  103. align-items: center;
  104. margin: 0 40rpx;
  105. padding: 0 10rpx;
  106. border-bottom: 1rpx solid #eee;
  107. }
  108. .top-list:last-child {
  109. border-bottom: none;
  110. }
  111. .language {
  112. margin-left: 70%;
  113. font-size: 14px;
  114. color: rgb(203, 203, 203);
  115. }
  116. .arrow {
  117. margin-left: auto;
  118. }
  119. .center {
  120. background-color: white;
  121. height: 7vh;
  122. display: flex;
  123. align-items: center;
  124. margin-top: 1vh;
  125. }
  126. .center-list {
  127. width: 630rpx;
  128. margin: 0rpx 40rpx;
  129. display: flex;
  130. padding: 0 10rpx;
  131. }
  132. .center-list > .arrow {
  133. margin-right: 0;
  134. }
  135. .bottom {
  136. height: 13.5vh;
  137. background-color: white;
  138. margin-top: 1vh;
  139. }
  140. .bottom-list {
  141. width: 630rpx;
  142. height: 7vh;
  143. display: flex;
  144. align-items: center;
  145. margin: 0 40rpx;
  146. padding: 0 10rpx;
  147. border-bottom: 1rpx solid #eee;
  148. }
  149. .cache {
  150. margin-left: 55%;
  151. font-size: 14px;
  152. color: rgb(203, 203, 203);
  153. }
  154. .bottom-list:last-child {
  155. border-bottom: none;
  156. }
  157. </style>