index.vue 3.0 KB

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