safe-manage.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <view class="safe-manage">
  3. <custom-nav noback="noback" transparent="transparent" ref="ltm" title=" " />
  4. <view class="content">
  5. <!-- <navigator url="../address-manage/address-manage" class="app-item">
  6. <text>地址管理</text>
  7. <text class="cuIcon-right"></text>
  8. </navigator> -->
  9. <!-- <navigator url="../updata-psw/updata-psw" class="app-item">
  10. <text>修改密码</text>
  11. <text class="cuIcon-right"></text>
  12. </navigator> -->
  13. <navigator url="../change-phone/change-phone" class="app-item">
  14. <text>手机换绑</text>
  15. <text class="cuIcon-right"></text>
  16. </navigator>
  17. <view class="app-item" @tap="logout">
  18. <text>退出登录</text>
  19. <text class="cuIcon-right"></text>
  20. </view>
  21. <!-- <navigator url="../apply-return/apply-return" class="app-item">
  22. <text>申请退货</text>
  23. <text class="cuIcon-right"></text>
  24. </navigator> -->
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import {
  30. _API_Logout
  31. } from '@/apis/verify.js'
  32. export default {
  33. data() {
  34. return {
  35. title: '安全中心'
  36. }
  37. },
  38. methods: {
  39. logout() {
  40. uni.showModal({
  41. title: '提示',
  42. content: '确定要退出登录吗?',
  43. success: (res) => {
  44. if (res.confirm) {
  45. uni.showLoading({
  46. mask: true
  47. })
  48. _API_Logout().then(() => {
  49. if (this.$store.state.app.token) {
  50. this.$store.commit('app/LOGOUT')
  51. // window.history.replaceState({}, '', '/api/gzh/#/pages/login-reg/login-reg')
  52. // location.reload()
  53. this.toWxchatLogin("/pages/login-reg/login-reg", null)
  54. } else {
  55. this.$store.commit('app/LOGOUT')
  56. this.toWxchatLogin("/pages/login-reg/login-reg", null)
  57. }
  58. })
  59. }
  60. }
  61. })
  62. },
  63. toWxchatLogin(url, state) {
  64. url = url || "/pages/index/index"
  65. state = state || "cli"
  66. const redirect_uri = encodeURIComponent(`${this.$config.redirect_uri}/api/gzh#${url}`)
  67. const auth = () => window.location.href =
  68. `${this.$config.wxURL}?appid=${this.$config.appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`
  69. auth()
  70. },
  71. }
  72. }
  73. </script>
  74. <style lang="scss">
  75. .safe-manage {
  76. @include page();
  77. }
  78. </style>