index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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.commit("follow/SET_FORM", {});
  67. this.$store.commit("follow/SET_PARAMS", {});
  68. this.$store.dispatch("user/logout").then(()=>{
  69. uni.$u.toast("退出成功");
  70. setTimeout(()=>{
  71. this.showModal = false;
  72. uni.reLaunch({
  73. url: "/pages/login/index"
  74. })
  75. },1000)
  76. })
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. .modal_box{
  83. line-height: 100rpx;
  84. color: #aaa;
  85. }
  86. .logout_btn {
  87. width: 100%;
  88. position: absolute;
  89. left: 50%;
  90. transform: translate(-50%, 0%);
  91. bottom: 10%;
  92. ::v-deep .u-button {
  93. border: none;
  94. }
  95. }
  96. .option_list {
  97. margin-top: 30rpx;
  98. .option_item {
  99. display: flex;
  100. justify-content: space-between;
  101. align-items: center;
  102. height: 100rpx;
  103. border-bottom: 2rpx solid #dfdfdf;
  104. background-color: #fff;
  105. padding: 0 30rpx;
  106. &:last-child {
  107. border: none;
  108. }
  109. .item_left {
  110. display: flex;
  111. align-items: center;
  112. image {
  113. width: 32rpx;
  114. height: 32rpx;
  115. margin-right: 20rpx;
  116. }
  117. .label {
  118. font-size: 28rpx;
  119. color: #202020;
  120. }
  121. }
  122. .item-right {
  123. display: flex;
  124. justify-content: space-between;
  125. align-items: center;
  126. ::v-deep .u-icon__icon {
  127. font-size: 30rpx !important;
  128. }
  129. text {
  130. font-size: 24rpx;
  131. color: #999999;
  132. margin-right: 20rpx;
  133. }
  134. .copy_btn {
  135. display: flex;
  136. font-size: 24rpx;
  137. color: #108CFF;
  138. margin-right: 30rpx;
  139. }
  140. }
  141. }
  142. }
  143. </style>