index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <view class="setting_wrap">
  3. <u-navbar title="我的设置" :autoBack="true" :placeholder="true" v-hideNav></u-navbar>
  4. <view class="option_list">
  5. <view class="option_item" @click="toPersonal">
  6. <view class="item_left">
  7. <image src="@/static/parson/icon-gezl.png" mode=""></image>
  8. <text class="label">个人资料</text>
  9. </view>
  10. <view class="item-right">
  11. <u-icon name="arrow-right" color="#aaa"></u-icon>
  12. </view>
  13. </view>
  14. <view class="option_item" @click="handleEditPassword">
  15. <view class="item_left">
  16. <image src="@/static/parson/updatePass.png" mode=""></image>
  17. <text class="label">修改密码</text>
  18. </view>
  19. <view class="item-right">
  20. <u-icon name="arrow-right" color="#aaa"></u-icon>
  21. </view>
  22. </view>
  23. <option-list></option-list>
  24. </view>
  25. <view class="logout_btn">
  26. <u-button type="warning" :plain="true" text="退出账号" size="large" @click="handleShowModal"></u-button>
  27. </view>
  28. <u-modal :show="showModal"
  29. @confirm="confirm"
  30. ref="uModal"
  31. :asyncClose="true"
  32. showCancelButton
  33. @cancel="showModal = false"
  34. cancelColor="#409eff"
  35. :confirmText="'退出登录'" confirmColor="#f8836c">
  36. <view class="modal_box">
  37. 确定要退出当前账号
  38. </view>
  39. </u-modal>
  40. </view>
  41. </template>
  42. <script>
  43. import OptionList from '@/pages/person/option/index.vue'
  44. export default {
  45. components: {
  46. OptionList
  47. },
  48. data() {
  49. return {
  50. }
  51. },
  52. methods: {
  53. handleEditPassword(){
  54. uni.navigateTo({
  55. url : "/pages/changePw/index"
  56. });
  57. },
  58. toPersonal(){
  59. uni.navigateTo({
  60. url : "/pages/profile/index"
  61. })
  62. },
  63. handleShowModal() {
  64. this.showModal = true;
  65. },
  66. confirm() {
  67. // 停止电话监听
  68. //#ifdef APP-PLUS
  69. this.$store.dispatch("call/stopPhoneListener", null, { root: true }).catch(error => {
  70. console.error('退出登录时停止电话监听失败:', error);
  71. });
  72. //#endif
  73. this.$store.dispatch("user/logout").then(()=>{
  74. uni.$u.toast("退出成功");
  75. setTimeout(()=>{
  76. this.showModal = false;
  77. uni.reLaunch({
  78. url: "/pages/login/index"
  79. })
  80. },1000)
  81. })
  82. },
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. .modal_box{
  88. line-height: 100rpx;
  89. color: #aaa;
  90. }
  91. .logout_btn {
  92. width: 100%;
  93. position: absolute;
  94. left: 50%;
  95. transform: translate(-50%, 0%);
  96. bottom: 10%;
  97. ::v-deep .u-button {
  98. border: none;
  99. }
  100. }
  101. .option_list {
  102. .option_item {
  103. display: flex;
  104. justify-content: space-between;
  105. align-items: center;
  106. height: 100rpx;
  107. border-bottom: 2rpx solid #dfdfdf;
  108. background-color: #fff;
  109. padding: 0 30rpx;
  110. &:last-child {
  111. border: none;
  112. }
  113. .item_left {
  114. display: flex;
  115. align-items: center;
  116. image {
  117. width: 32rpx;
  118. height: 32rpx;
  119. margin-right: 20rpx;
  120. }
  121. .label {
  122. font-size: 28rpx;
  123. color: #202020;
  124. }
  125. }
  126. .item-right {
  127. display: flex;
  128. justify-content: space-between;
  129. align-items: center;
  130. ::v-deep .u-icon__icon {
  131. font-size: 30rpx !important;
  132. }
  133. text {
  134. font-size: 24rpx;
  135. color: #999999;
  136. margin-right: 20rpx;
  137. }
  138. .copy_btn {
  139. display: flex;
  140. font-size: 24rpx;
  141. color: #108CFF;
  142. margin-right: 30rpx;
  143. }
  144. }
  145. }
  146. }
  147. </style>