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.

221 lines
4.4 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. uni.navigateTo({
  80. url: '/pages/start/login/login'
  81. })
  82. }
  83. const goToBind = () =>{
  84. uni.navigateTo({
  85. url:'../setting/bind'
  86. })
  87. }
  88. const goToPassword = () =>{
  89. uni.navigateTo({
  90. url:'../setting/password'
  91. })
  92. }
  93. onMounted(() => {
  94. iSMT.value = uni.getSystemInfoSync().statusBarHeight;
  95. })
  96. </script>
  97. <style scoped>
  98. .setting-list {
  99. height: 49vh;
  100. background-color: #fff;
  101. }
  102. .setting-item {
  103. display: flex;
  104. align-items: center;
  105. height: 7vh;
  106. padding: 0 40rpx;
  107. border-bottom: 1rpx solid #eee;
  108. }
  109. .setting-item:last-child {
  110. border-bottom: none;
  111. }
  112. .item-label {
  113. font-size: 28rpx;
  114. flex: 1;
  115. }
  116. .item-right {
  117. display: flex;
  118. align-items: center;
  119. }
  120. .avatar {
  121. width: 60rpx;
  122. height: 60rpx;
  123. border-radius: 50%;
  124. margin-right: 20rpx;
  125. background-color: #999;
  126. }
  127. .item-text {
  128. margin-right: 20rpx;
  129. font-size: 28rpx;
  130. }
  131. .arrow,
  132. .eye-icon {
  133. color: #999;
  134. }
  135. .logout {
  136. display: flex;
  137. justify-content: center;
  138. align-items: center;
  139. height: 7vh;
  140. font-size: 28rpx;
  141. color: #f56c6c;
  142. background-color: white;
  143. }
  144. .logout-confirm {
  145. position: fixed;
  146. top: 0;
  147. left: 0;
  148. width: 100%;
  149. height: 100%;
  150. background-color: rgba(0, 0, 0, 0.5);
  151. display: flex;
  152. justify-content: center;
  153. align-items: center;
  154. z-index: 999;
  155. }
  156. .logoutDialog {
  157. width: 500rpx;
  158. background-color: #fff;
  159. border-radius: 12rpx;
  160. padding: 40rpx;
  161. display: flex;
  162. flex-direction: column;
  163. align-items: center;
  164. }
  165. .tips {
  166. font-size: 32rpx;
  167. margin-bottom: 40rpx;
  168. }
  169. .tips-button {
  170. display: flex;
  171. width: 100%;
  172. justify-content: space-between;
  173. }
  174. .confirm-btn,
  175. .cancel-btn {
  176. width: 180rpx;
  177. height: 60rpx;
  178. line-height: 60rpx;
  179. border-radius: 30rpx;
  180. font-size: 28rpx;
  181. }
  182. .confirm-btn {
  183. background-color: #fff;
  184. color: #000;
  185. border: 1rpx solid #ddd;
  186. }
  187. .cancel-btn {
  188. background-color: #000;
  189. color: #fff;
  190. border: none;
  191. }
  192. </style>