index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. showModal: false
  51. }
  52. },
  53. onLoad: function(opt) {
  54. },
  55. methods: {
  56. handleEditPassword(){
  57. uni.navigateTo({
  58. url : "/pages/changePw/index"
  59. });
  60. },
  61. toPersonal(){
  62. uni.navigateTo({
  63. url : "/pages/profile/index"
  64. })
  65. },
  66. handleShowModal() {
  67. this.showModal = true;
  68. },
  69. confirm() {
  70. // 停止电话监听
  71. this.$store.dispatch("call/stopPhoneListener").catch(error => {
  72. console.error('退出登录时停止电话监听失败:', error);
  73. });
  74. this.$store.dispatch("user/logout").then(()=>{
  75. uni.$u.toast("退出成功");
  76. setTimeout(()=>{
  77. this.showModal = false;
  78. uni.reLaunch({
  79. url: "/pages/login/index"
  80. })
  81. },1000)
  82. })
  83. }
  84. }
  85. }
  86. </script>
  87. <style lang="scss" scoped>
  88. .modal_box{
  89. line-height: 100rpx;
  90. color: #aaa;
  91. }
  92. .logout_btn {
  93. width: 100%;
  94. position: absolute;
  95. left: 50%;
  96. transform: translate(-50%, 0%);
  97. bottom: 10%;
  98. ::v-deep .u-button {
  99. border: none;
  100. }
  101. }
  102. .option_list {
  103. .option_item {
  104. display: flex;
  105. justify-content: space-between;
  106. align-items: center;
  107. height: 100rpx;
  108. border-bottom: 2rpx solid #dfdfdf;
  109. background-color: #fff;
  110. padding: 0 30rpx;
  111. &:last-child {
  112. border: none;
  113. }
  114. .item_left {
  115. display: flex;
  116. align-items: center;
  117. image {
  118. width: 32rpx;
  119. height: 32rpx;
  120. margin-right: 20rpx;
  121. }
  122. .label {
  123. font-size: 28rpx;
  124. color: #202020;
  125. }
  126. }
  127. .item-right {
  128. display: flex;
  129. justify-content: space-between;
  130. align-items: center;
  131. ::v-deep .u-icon__icon {
  132. font-size: 30rpx !important;
  133. }
  134. text {
  135. font-size: 24rpx;
  136. color: #999999;
  137. margin-right: 20rpx;
  138. }
  139. .copy_btn {
  140. display: flex;
  141. font-size: 24rpx;
  142. color: #108CFF;
  143. margin-right: 30rpx;
  144. }
  145. }
  146. }
  147. }
  148. </style>