index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. </view>
  24. <view class="logout_btn">
  25. <u-button type="warning" :plain="true" text="退出账号" size="large" @click="handleShowModal"></u-button>
  26. </view>
  27. <u-modal :show="showModal"
  28. @confirm="confirm"
  29. ref="uModal"
  30. :asyncClose="true"
  31. showCancelButton
  32. @cancel="showModal = false"
  33. cancelColor="#409eff"
  34. :confirmText="'退出登录'" confirmColor="#f8836c">
  35. <view class="modal_box">
  36. 确定要要出当前账号
  37. </view>
  38. </u-modal>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. showModal: false
  46. }
  47. },
  48. onLoad: function(opt) {
  49. },
  50. methods: {
  51. handleEditPassword(){
  52. uni.navigateTo({
  53. url : "/pages/changePw/index"
  54. });
  55. },
  56. toPersonal(){
  57. uni.navigateTo({
  58. url : "/pages/profile/index"
  59. })
  60. },
  61. handleShowModal() {
  62. this.showModal = true;
  63. },
  64. confirm() {
  65. // 停止电话监听
  66. this.$store.dispatch("call/stopPhoneListener").catch(error => {
  67. console.error('退出登录时停止电话监听失败:', error);
  68. });
  69. this.$store.dispatch("user/logout").then(()=>{
  70. uni.$u.toast("退出成功");
  71. setTimeout(()=>{
  72. this.showModal = false;
  73. uni.reLaunch({
  74. url: "/pages/login/index"
  75. })
  76. },1000)
  77. })
  78. }
  79. }
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. .modal_box{
  84. line-height: 100rpx;
  85. color: #aaa;
  86. }
  87. .logout_btn {
  88. width: 100%;
  89. position: absolute;
  90. left: 50%;
  91. transform: translate(-50%, 0%);
  92. bottom: 10%;
  93. ::v-deep .u-button {
  94. border: none;
  95. }
  96. }
  97. .option_list {
  98. margin-top: 30rpx;
  99. .option_item {
  100. display: flex;
  101. justify-content: space-between;
  102. align-items: center;
  103. height: 100rpx;
  104. border-bottom: 2rpx solid #dfdfdf;
  105. background-color: #fff;
  106. padding: 0 30rpx;
  107. &:last-child {
  108. border: none;
  109. }
  110. .item_left {
  111. display: flex;
  112. align-items: center;
  113. image {
  114. width: 32rpx;
  115. height: 32rpx;
  116. margin-right: 20rpx;
  117. }
  118. .label {
  119. font-size: 28rpx;
  120. color: #202020;
  121. }
  122. }
  123. .item-right {
  124. display: flex;
  125. justify-content: space-between;
  126. align-items: center;
  127. ::v-deep .u-icon__icon {
  128. font-size: 30rpx !important;
  129. }
  130. text {
  131. font-size: 24rpx;
  132. color: #999999;
  133. margin-right: 20rpx;
  134. }
  135. .copy_btn {
  136. display: flex;
  137. font-size: 24rpx;
  138. color: #108CFF;
  139. margin-right: 30rpx;
  140. }
  141. }
  142. }
  143. }
  144. </style>