index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view>
  3. <view style="color: #fff;">
  4. <tn-nav-bar :bottomShadow="false" backgroundColor="#26B3A0">账号安全</tn-nav-bar>
  5. <view :style="{height: tobheight+'px'}"></view>
  6. </view>
  7. <view class="user">
  8. <!-- 用户功能 -->
  9. <view class="com-item">
  10. <view class="com-wrap">
  11. <navigator class="cell" v-for="(item, index) in userList" :key="index"
  12. :url="hasLogin ? item.url : '/pages/user/signin'" @click="getroute">
  13. <view class="cell-left">
  14. <u-icon :name="item.icon"
  15. :color="item.icon=='grid-fill'?'rgb(255, 202, 40)':item.icon=='question-circle-fill'?'rgb(49, 201, 232)':item.icon=='setting-fill'?'rgb(90, 199, 37)':'#26B3A0'"
  16. size="22"></u-icon>
  17. <view class="cell-text">{{ item.title }}</view>
  18. </view>
  19. <u-icon name="arrow-right" color="#9e9e9e" size="18"></u-icon>
  20. </navigator>
  21. </view>
  22. </view>
  23. </view>
  24. <view @click="destroyAccount()" hover-class="hoversubmit" class="signinnow">注销账号
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import {
  30. mapMutations,
  31. mapActions,
  32. mapState,
  33. mapGetters
  34. } from 'vuex';
  35. import {
  36. loginOut
  37. } from '@/api/my/index.js'
  38. export default {
  39. data() {
  40. return {
  41. tobheight: 45,
  42. platform: this.$platform.get(),
  43. userList: [{
  44. title: '更换手机号',
  45. icon: 'phone-fill',
  46. path: 'collect-list',
  47. url: '/pages/user/accountSafe/updateMobile/index',
  48. },
  49. {
  50. title: '修改密码',
  51. icon: 'lock-fill',
  52. path: 'collect-list',
  53. url: '/pages/user/accountSafe/updatePwd/index?from=set'
  54. }
  55. ],
  56. }
  57. },
  58. computed: {
  59. ...mapGetters(['hasLogin'])
  60. },
  61. onLoad() {
  62. },
  63. methods: {
  64. async destroyAccount() {
  65. let res = await loginOut()
  66. console.log('注销账号返回值', res);
  67. if (res.code == 0) {
  68. uni.clearStorageSync()
  69. uni.showToast({
  70. title: '注销账号成功',
  71. icon: 'success',
  72. })
  73. setTimeout(() => {
  74. uni.reLaunch({
  75. url: '/pages/user/signin'
  76. })
  77. }, 1500)
  78. } else {
  79. uni.showToast({
  80. title: res.msg,
  81. icon: 'none',
  82. })
  83. }
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss">
  89. @import './index.scss';
  90. </style>