accountSecurity.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view style="background-color: $color-white !important;">
  3. <u-navbar :back-text="i18n('Back')" :back-text-style="backStyle" back-icon-color="#fff" title-color="#fff" :background="background" title-width="300" :title="i18n('AccountSecurity')"></u-navbar>
  4. <!-- 手机号 -->
  5. <!-- <list-cell iconColor="#333" title="手机号" @eventClick="navTo('/pages/profile/profileSetUp/changeMobileNumber')"></list-cell> -->
  6. <list-cell iconColor="#333" :title="i18n('phonenumber')" @eventClick="toSetPhone"></list-cell>
  7. <!-- 修改密码 -->
  8. <list-cell iconColor="#333" :title="i18n('ChangePassword')" @eventClick="navTo('/pages/profile/profileSetUp/changePassword')"></list-cell>
  9. <!-- 绑定邮箱 -->
  10. <list-cell iconColor="#333" :title="$i18n.locale=='zh'?'绑定邮箱':'BindEmail'" @eventClick="navTo('/pages/profile/profileSetUp/changeMailbox')"></list-cell>
  11. <!-- 设置语言 -->
  12. <!-- <list-cell iconColor="#333" :title="$i18n.locale=='zh'?'设置语言':'SetLanguage'" @eventClick="setLanguage" :tips="$i18n.locale=='zh'?i18n('Chinese'):i18n('English')"></list-cell> -->
  13. <!-- 注销账户 -->
  14. <!-- <list-cell iconColor="#333" title="注销账户" @eventClick="navTo('/pages/profile/profileSetUp/cancellationOfAccount')"></list-cell> -->
  15. <u-toast ref="uToast" />
  16. <uni-popup ref="popup" type="center">
  17. <uni-popup-dialog type="input" :content="$i18n.locale=='zh'?'确认切换为英文?':'Confirm to switch to Chinese?'" :duration="2000"
  18. :before-close="true" @close="close" @confirm="confirm">
  19. </uni-popup-dialog>
  20. </uni-popup>
  21. </view>
  22. </template>
  23. <script>
  24. import listCell from '@/components/JumpBox';
  25. import uniPopup from '@/components/uni-popup/uni-popup.vue'
  26. import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue'
  27. import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
  28. export default {
  29. components: {
  30. listCell,
  31. uniPopup,
  32. uniPopupMessage,
  33. uniPopupDialog
  34. },
  35. data() {
  36. return {
  37. isMobilePass: '',
  38. phone: '',
  39. salfPhone: '',
  40. isEmailPass: '',
  41. background: {
  42. backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
  43. },
  44. backStyle: {
  45. color: '#FFFFFF',
  46. },
  47. };
  48. },
  49. onShow() {
  50. this.getUserInfoById();
  51. },
  52. methods: {
  53. async getUserInfoById() {
  54. const result = await this.$myRequest({
  55. url: '/uc/securitySetting/getUserInfoById',
  56. });
  57. if (result) {
  58. var phone = result.data.userPreferredMobile;
  59. if (phone) {
  60. this.salfPhone = phone.substr(0, 3) + '****' + phone.substr(7);
  61. }
  62. this.isMobilePass = result.data.userMobileStatus;
  63. this.isEmailPass = result.data.userEmailStatus;
  64. }
  65. },
  66. toSetPhone() {
  67. if (this.isMobilePass == '0') {
  68. this.$mRouter.push({
  69. route: '/pages/profile/profileSetUp/changeMobileNumber'
  70. });
  71. } else {
  72. this.$mRouter.push({
  73. route: '/pages/profile/profileSetUp/BindMobileNumber'
  74. });
  75. }
  76. },
  77. navTo(route) {
  78. this.$mRouter.push({
  79. route
  80. });
  81. },
  82. i18n(data) {
  83. return this.$t('common.' + data);
  84. },
  85. async confirm(done) {
  86. let res = await this.$myRequest({
  87. url:'/uc/userCenter/settingLanguage',
  88. data:{language:this._i18n.locale=='zh'?'en':'zh'},
  89. })
  90. if(res.status==200){
  91. if (this.$i18n.locale == 'zh') {
  92. uni.setStorageSync("language", 'en')
  93. this._i18n.locale = 'en';
  94. } else {
  95. uni.setStorageSync("language", 'zh')
  96. this._i18n.locale = 'zh';
  97. }
  98. this.$refs.uToast.show({
  99. title: this._i18n.locale == 'zh'?'设置成功':'set language success',
  100. type: 'success',
  101. icon: false
  102. })
  103. }else{
  104. this.$refs.uToast.show({
  105. title: this._i18n.locale == 'zh'?'设置失败':'set language fail',
  106. type: 'error',
  107. icon: false
  108. })
  109. }
  110. done();
  111. },
  112. close(done) {
  113. done();
  114. },
  115. setLanguage(){
  116. this.$refs.popup.open();
  117. }
  118. }
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. page,
  123. body.pages-profile-profileSetUp-setUp uni-page-body {
  124. background-color: #fff !important;
  125. }
  126. </style>