systemSettings.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. import store from '@/store';
  21. export default {
  22. name: 'systemSettings',
  23. computed: {
  24. ...mapState({
  25. userInfo: (state) => state.user.userInfo,
  26. }),
  27. },
  28. data() {
  29. return {
  30. switchChecked: false,
  31. };
  32. },
  33. created() {
  34. // 0=企业微信,1=H5相机
  35. this.switchChecked = this.userInfo.photoMethod == 0 ? false : true;
  36. },
  37. methods: {
  38. change(value) {
  39. console.log(value);
  40. this.toastLoading(0, '加载中...', true);
  41. setPhotoMethod({ photoMethod: value ? 1 : 0 }).then((res) => {
  42. this.toastLoading().clear();
  43. if (res.code == 200) {
  44. this.$toast('设置成功');
  45. // 获取移动端获取用户信息接口
  46. store.dispatch('getUserInfo');
  47. }
  48. });
  49. },
  50. onClickLeft() {
  51. this.$router.go(-1);
  52. },
  53. },
  54. };
  55. </script>
  56. <style lang="scss" scoped>
  57. .systemSettings {
  58. width: 100%;
  59. height: 100%;
  60. .content {
  61. margin: 10px 16px;
  62. .module {
  63. margin-bottom: 10px;
  64. .title {
  65. font-size: 16px;
  66. padding: 10px 0;
  67. }
  68. .box {
  69. background: #fff;
  70. display: flex;
  71. align-items: center;
  72. justify-content: space-between;
  73. padding: 10px;
  74. font-size: 16px;
  75. }
  76. }
  77. }
  78. }
  79. </style>