setting.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view>
  3. <u-navbar title="设置" :title-bold="checked" :title-size="checked ? 38 : 30"></u-navbar>
  4. <u-cell-group>
  5. <u-cell-item title="修改手机号" :title-style="checked ? titleStyle : {}" v-model="userPhone" @click="gotoUrl('pages/user/phone')"
  6. :value-style="checked ? {fontSize:'16px'} : {}">
  7. </u-cell-item>
  8. <u-cell-item title="注销账号" :title-style="checked ? titleStyle : {}" value="注销后无法恢复,请谨慎操作"
  9. :value-style="checked ? {color:'#ff3300',fontSize:'16px'} : valueStyle" @click="gotoUrl('pages/user/logout')">
  10. </u-cell-item>
  11. </u-cell-group>
  12. <view class="switcher-mode">
  13. <view class="oldTextjp2" oldstyle="font-weight:bold;font-size:18px">
  14. 长辈模式
  15. <text class="oldTextjp2" oldstyle="font-weight:normal;font-size:16px;">字体更大更清晰</text>
  16. </view>
  17. <view class="switch-box" >
  18. <u-switch v-model="checked" class="switch" active-color="#00E266" @change="checkedChange"></u-switch>
  19. </view>
  20. </view>
  21. <view class="logout-btn oldTextjp" oldstyle="font-size:18px" @click="signOut">
  22. 退出帐号
  23. </view>
  24. <view>
  25. <u-modal v-model="show" @confirm="confirm":show-cancel-button="true" ref="uModal" :asyncClose="true" :title="title" :content="content"></u-modal>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import * as userApi from '@/apis/user.js'
  31. export default {
  32. data() {
  33. return {
  34. show: false,
  35. title: '退出账号',
  36. content: '是否退出当前账号?',
  37. userId: '',
  38. userPhone: '',
  39. checked:false,
  40. valueStyle: {
  41. color:'#ff3300',
  42. },
  43. titleStyle: {
  44. fontWeight: 'bold',
  45. fontSize: '18px',
  46. }
  47. }
  48. },
  49. onReady() {
  50. if(this.carhelp.getPersonInfo()) {
  51. this.userId = this.carhelp.getPersonInfo().id;
  52. var phone = this.carhelp.getPersonInfo().phone;
  53. var phone1 = phone.slice(0,3);
  54. var phone2 = phone.slice(-4);
  55. this.userPhone = phone1 + '****' + phone2;
  56. this.checked = this.carhelp.get("getElderModeClass");
  57. }
  58. },
  59. methods: {
  60. checkedChange() {
  61. this.carhelp.set("getElderModeClass", this.checked);
  62. },
  63. signOut() {
  64. this.show = true;
  65. },
  66. confirm() {
  67. uni.showLoading({
  68. title: "加载中",
  69. mask: true,
  70. })
  71. userApi.logout().then((res) => {
  72. uni.hideLoading();
  73. this.show = false;
  74. this.carhelp.logoff()
  75. uni.redirectTo({
  76. url: '/pages/login/login'
  77. })
  78. }).catch(error => {
  79. uni.showToast({
  80. title: error,
  81. icon: "none"
  82. })
  83. })
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .logout-btn{
  90. background-color: #fff;
  91. padding: 12px 0;
  92. text-align: center;
  93. margin-top: 12px;
  94. }
  95. .switcher-mode{
  96. background-color: #fff;
  97. height: 44px;
  98. line-height: 44px;
  99. display: flex;
  100. justify-content: space-between;
  101. padding: 0 14px;
  102. text{
  103. font-size: 12px;
  104. color: rgba(119, 119, 119, 100);
  105. margin-left: 8px;
  106. }
  107. .switch-box{
  108. padding-top: 8px;
  109. }
  110. .switch{
  111. width: 40px;
  112. height: 22px;
  113. }
  114. /deep/.u-switch__node{
  115. width: 20px !important;
  116. height: 20px !important;
  117. }
  118. }
  119. </style>