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.

217 lines
4.3 KiB

  1. <template>
  2. <view class="main">
  3. <view :style="{height:iSMT+'px'}"></view>
  4. <view style="height:1.5vh;"></view>
  5. <view class="setting-list">
  6. <view class="setting-item">
  7. <text class="item-label">头像</text>
  8. <view class="item-right">
  9. <image src="/static/avatar.png" class="avatar" mode="aspectFill"></image>
  10. <uni-icons type="arrowright" size="16" class="arrow"></uni-icons>
  11. </view>
  12. </view>
  13. <view class="setting-item">
  14. <text class="item-label">昵称</text>
  15. <view class="item-right">
  16. <text class="item-text">DeepChart</text>
  17. <uni-icons type="arrowright" size="16" class="arrow"></uni-icons>
  18. </view>
  19. </view>
  20. <view class="setting-item">
  21. <text class="item-label">ID</text>
  22. <view class="item-right">
  23. <text class="item-text">{{ jwcode }}</text>
  24. <uni-icons type="arrowright" size="16" class="arrow"></uni-icons>
  25. </view>
  26. </view>
  27. <view class="setting-item">
  28. <text class="item-label">密码</text>
  29. <view class="item-right">
  30. <text class="item-text">qwertyuiop</text>
  31. <uni-icons type="eye" size="16" class="eye-icon"></uni-icons>
  32. </view>
  33. </view>
  34. <view class="setting-item" @click="goToPassword">
  35. <text class="item-label">修改密码</text>
  36. <uni-icons type="arrowright" size="16" class="arrow"></uni-icons>
  37. </view>
  38. <view class="setting-item">
  39. <text class="item-label">注销账号</text>
  40. <uni-icons type="arrowright" size="16" class="arrow"></uni-icons>
  41. </view>
  42. <view class="setting-item" @click="goToBind">
  43. <text class="item-label">绑定账号</text>
  44. <uni-icons type="arrowright" size="16" class="arrow"></uni-icons>
  45. </view>
  46. </view>
  47. <view style="height:1.5vh;"></view>
  48. <view class="logout" @click="showLogout = true">
  49. <text>退出登录</text>
  50. </view>
  51. <view class="logout-confirm" v-if="showLogout">
  52. <view class="logoutDialog">
  53. <view class="tips">是否退出登录</view>
  54. <view class="tips-button">
  55. <button class="confirm-btn" @click="handleConfirmLogout">确认</button>
  56. <button class="cancel-btn" @click="showLogout = false">取消</button>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </template>
  62. <script setup>
  63. import {
  64. ref,
  65. onMounted
  66. } from 'vue'
  67. import {useUserStore} from "../../stores/modules/userInfo"
  68. const iSMT = ref(0)
  69. const jwcode = ref('90047681')
  70. const showLogout = ref(false)
  71. const userStore = useUserStore()
  72. const handleConfirmLogout = () => {
  73. userStore.clearUserInfo()
  74. showLogout.value = false
  75. uni.showToast({
  76. title: '退出登录成功',
  77. icon: 'none',
  78. })
  79. }
  80. const goToBind = () =>{
  81. uni.navigateTo({
  82. url:'../setting/bind'
  83. })
  84. }
  85. const goToPassword = () =>{
  86. uni.navigateTo({
  87. url:'../setting/password'
  88. })
  89. }
  90. onMounted(() => {
  91. iSMT.value = uni.getSystemInfoSync().statusBarHeight;
  92. })
  93. </script>
  94. <style scoped>
  95. .setting-list {
  96. height: 49vh;
  97. background-color: #fff;
  98. }
  99. .setting-item {
  100. display: flex;
  101. align-items: center;
  102. height: 7vh;
  103. padding: 0 40rpx;
  104. border-bottom: 1rpx solid #eee;
  105. }
  106. .setting-item:last-child {
  107. border-bottom: none;
  108. }
  109. .item-label {
  110. font-size: 28rpx;
  111. flex: 1;
  112. }
  113. .item-right {
  114. display: flex;
  115. align-items: center;
  116. }
  117. .avatar {
  118. width: 60rpx;
  119. height: 60rpx;
  120. border-radius: 50%;
  121. margin-right: 20rpx;
  122. background-color: #999;
  123. }
  124. .item-text {
  125. margin-right: 20rpx;
  126. font-size: 28rpx;
  127. }
  128. .arrow,
  129. .eye-icon {
  130. color: #999;
  131. }
  132. .logout {
  133. display: flex;
  134. justify-content: center;
  135. align-items: center;
  136. height: 7vh;
  137. font-size: 28rpx;
  138. color: #f56c6c;
  139. background-color: white;
  140. }
  141. .logout-confirm {
  142. position: fixed;
  143. top: 0;
  144. left: 0;
  145. width: 100%;
  146. height: 100%;
  147. background-color: rgba(0, 0, 0, 0.5);
  148. display: flex;
  149. justify-content: center;
  150. align-items: center;
  151. z-index: 999;
  152. }
  153. .logoutDialog {
  154. width: 500rpx;
  155. background-color: #fff;
  156. border-radius: 12rpx;
  157. padding: 40rpx;
  158. display: flex;
  159. flex-direction: column;
  160. align-items: center;
  161. }
  162. .tips {
  163. font-size: 32rpx;
  164. margin-bottom: 40rpx;
  165. }
  166. .tips-button {
  167. display: flex;
  168. width: 100%;
  169. justify-content: space-between;
  170. }
  171. .confirm-btn,
  172. .cancel-btn {
  173. width: 180rpx;
  174. height: 60rpx;
  175. line-height: 60rpx;
  176. border-radius: 30rpx;
  177. font-size: 28rpx;
  178. }
  179. .confirm-btn {
  180. background-color: #fff;
  181. color: #000;
  182. border: 1rpx solid #ddd;
  183. }
  184. .cancel-btn {
  185. background-color: #000;
  186. color: #fff;
  187. border: none;
  188. }
  189. </style>