accountSettings.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <v-page>
  3. <!-- 头部 -->
  4. <v-header :title="$t('accountSettings.a0')"></v-header>
  5. <!-- 中间 -->
  6. <view class=" m-y-sm rounded-md m-x-lg overflow-hidden box-shadow">
  7. <view
  8. class="p-y-xs per-bot p-x-md h-36 border-b border-gray-7 d-flex align-center justify-between bg-panel-3 ">
  9. <span class="color-light">{{$t('accountSettings.a1')}}</span>
  10. <view class="d-flex align-center">
  11. <van-icon name="user-circle-o" class="color-theme-1 fn-30" />
  12. </view>
  13. </view>
  14. <view class="per-bot p-x-md p-y-md border-b border-gray-7 d-flex align-center justify-between bg-panel-3">
  15. <span class="color-light">{{$t('accountSettings.a2')}}</span>
  16. <view class="d-flex align-center">
  17. <span>{{user.username}}</span>
  18. </view>
  19. </view>
  20. <view class="per-bot p-x-md p-y-md d-flex align-center justify-between bg-panel-3">
  21. <span class="color-light">{{$t('accountSettings.a3')}}</span>
  22. <view class="d-flex align-center">
  23. <span>{{user.account}}</span>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="m-x-lg rounded-md overflow-hidden box-shadow">
  28. <v-link to="/pages/safe/phone" tag="div"
  29. class="per-bot p-x-md border-b border-gray-7 p-y-md d-flex align-center justify-between bg-panel-3 ">
  30. <span class="color-light">{{$t('accountSettings.a4')}}</span>
  31. <view class="d-flex align-center">
  32. <span class="color-right">{{user.phone}}</span>
  33. <span class="color-theme-1 m-l-xs" v-if="user.phone">{{$t('accountSettings.a5')}}</span>
  34. <span class="color-theme-1 m-l-xs" v-else>{{$t('accountSettings.a6')}}</span>
  35. <van-icon class="p-l-xs" name="arrow" size="16" color="#646566" @click.stop />
  36. </view>
  37. </v-link>
  38. <v-link tag="div" to="/pages/safe/email"
  39. class="per-bot p-x-md p-y-md d-flex align-center justify-between bg-panel-3">
  40. <span class="color-light">{{$t('accountSettings.a7')}}</span>
  41. <view class="d-flex align-center">
  42. <span>{{user.email}}</span>
  43. <span class="color-theme-1 m-l-xs" v-if="user.email">{{$t('accountSettings.a5')}}</span>
  44. <span class="color-theme-1 m-l-xs" v-else>{{$t('accountSettings.a6')}}</span>
  45. <van-icon class="p-l-xs" name="arrow" size="16" color="#646566" @click.stop />
  46. </view>
  47. </v-link>
  48. </view>
  49. <view class="m-y-sm m-x-lg overflow-hidden rounded-md box-shadow">
  50. <view class="per-bot p-x-md p-y-md d-flex align-center justify-between bg-panel-3">
  51. <view class="color-light">{{$t('accountSettings.b2')}}</view>
  52. <view class="d-flex align-center">
  53. <v-lang />
  54. <van-icon class="p-l-xs" name="arrow" size="16" color="#646566" @click.stop />
  55. </view>
  56. </view>
  57. </view>
  58. <view class="m-x-lg rounded-md overflow-hidden box-shadow">
  59. <view @click="outLogin"
  60. class="per-bot p-x-md border-b border-gray-7 p-y-md d-flex align-center justify-between bg-panel-3 ">
  61. <span class="color-light">{{$t('accountSettings.a8')}}</span>
  62. <view class="d-flex align-center">
  63. <van-icon class="p-l-xs" name="arrow" size="16" color="#646566" @click.stop />
  64. </view>
  65. </view>
  66. <view @click="loginOut" class="per-bot p-x-md p-y-md d-flex align-center justify-between bg-panel-3">
  67. <span class="color-light">{{$t('accountSettings.a9')}}</span>
  68. <view class="d-flex align-center">
  69. <van-icon class="p-l-xs" name="arrow" size="16" color="#646566" @click.stop />
  70. </view>
  71. </view>
  72. </view>
  73. <!-- <view class="m-t-lg p-x-md fn-center">
  74. <van-button
  75. icon="exchange"
  76. class="w-max fn-lg m-b-md"
  77. color="#f05319"
  78. type="info"
  79. block
  80. @click="outLogin"
  81. >{{$t('accountSettings.a8')}}</van-button>
  82. <view class="m-t-md">
  83. <v-button block class="w-max color-light" plain @click="loginOut">{{$t('accountSettings.a9')}}</v-button>
  84. </view>
  85. </view> -->
  86. </v-page>
  87. </template>
  88. <script>
  89. import {
  90. mapState,
  91. mapGetters
  92. } from "vuex";
  93. import Member from "@/api/member";
  94. export default {
  95. data() {
  96. return {
  97. agreement: {},
  98. };
  99. },
  100. computed: {
  101. ...mapState({
  102. user: "user",
  103. }),
  104. ...mapGetters(['themeStyle'])
  105. },
  106. created() {
  107. this.clause()
  108. let isLogin = uni.getStorageSync("token");
  109. if(!isLogin){
  110. uni.redirectTo({
  111. url:'/pages/login/index'
  112. })
  113. }
  114. },
  115. methods: {
  116. // 获取协议
  117. clause() {
  118. Member.clause().then((res) => {
  119. this.agreement = res.data;
  120. });
  121. },
  122. changeNickname() {
  123. // this.$router.push({
  124. // path: "/changeNickname"
  125. // });
  126. uni.navigateTo({
  127. url:"/changeNickname"
  128. })
  129. },
  130. // 切换用户
  131. outLogin() {
  132. uni.removeStorageSync("token");
  133. uni.reLaunch({
  134. url:"/pages/login/index"
  135. })
  136. },
  137. // 退出登录
  138. loginOut() {
  139. Member.logout({}, {
  140. toast: true
  141. })
  142. .then(() => {
  143. this.outLogin();
  144. })
  145. .catch(() => {});
  146. },
  147. },
  148. };
  149. </script>
  150. <style lang="scss" scoped>
  151. .head-account {
  152. font-size: 20px;
  153. }
  154. </style>