systemSettings.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div class="systemSettings">
  3. <van-nav-bar class="navBar" title="设置" left-arrow @click-left="onClickLeft" />
  4. <div class="content">
  5. <div class="module">
  6. <div class="title">拜访设置</div>
  7. <div class="box">
  8. <div class="label">设置</div>
  9. <div class="value">
  10. <van-switch v-model="switchChecked" size="20" @change="change" />
  11. </div>
  12. </div>
  13. </div>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import { mapState } from 'vuex';
  19. import { setPhotoMethod } from '@/api/week';
  20. export default {
  21. name: 'systemSettings',
  22. computed: {
  23. ...mapState({
  24. userInfo: (state) => state.user.userInfo,
  25. }),
  26. },
  27. data() {
  28. return {
  29. switchChecked: false,
  30. };
  31. },
  32. created() {
  33. this.switchChecked = this.userInfo.photoMethod == 0 ? false : true;
  34. },
  35. methods: {
  36. change(value) {
  37. console.log(value);
  38. this.toastLoading(0, '加载中...', true);
  39. setPhotoMethod({ photoMethod: value ? 1 : 0 }).then((res) => {
  40. this.toastLoading().clear();
  41. if (res.code == 200) {
  42. this.$toast('设置成功');
  43. }
  44. });
  45. },
  46. onClickLeft() {
  47. this.$router.go(-1);
  48. },
  49. },
  50. };
  51. </script>
  52. <style lang="scss" scoped>
  53. .systemSettings {
  54. width: 100%;
  55. height: 100%;
  56. .content {
  57. margin: 10px 16px;
  58. .module {
  59. margin-bottom: 10px;
  60. .title {
  61. font-size: 16px;
  62. padding: 10px 0;
  63. }
  64. .box {
  65. background: #fff;
  66. display: flex;
  67. align-items: center;
  68. justify-content: space-between;
  69. padding: 10px;
  70. font-size: 16px;
  71. }
  72. }
  73. }
  74. }
  75. </style>