setting.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div id="pages">
  3. <mu-appbar style="width: 100%;" color="primary" :title="$t('System setup')">
  4. <router-link to="/" slot="left">
  5. <mu-icon value="arrow_back"></mu-icon>
  6. </router-link>
  7. </mu-appbar>
  8. <div class="">
  9. <div class="row">
  10. <mu-list>
  11. <mu-list-item button :ripple="false">
  12. <mu-list-item-title>{{$t("Alarm sound")}}</mu-list-item-title>
  13. <mu-list-item-action>
  14. <mu-switch v-model="voiceState"></mu-switch>
  15. </mu-list-item-action>
  16. </mu-list-item>
  17. <mu-divider></mu-divider>
  18. <mu-list-item button :ripple="false">
  19. <mu-list-item-title>{{$t("Alarm flicker")}}</mu-list-item-title>
  20. <mu-list-item-action>
  21. <mu-switch v-model="alertState"></mu-switch>
  22. </mu-list-item-action>
  23. </mu-list-item>
  24. <div class="grip"></div>
  25. <mu-list-item button :ripple="false" @click="openAlertDialog">
  26. <mu-list-item-title>{{$t("Quit landing")}}</mu-list-item-title>
  27. </mu-list-item>
  28. </mu-list>
  29. </div>
  30. </div>
  31. <mu-dialog width="600" max-width="80%" :esc-press-close="false"
  32. :overlay-close="false" :open.sync="openAlert">
  33. {{$t("Confirm to exit the current account")}}?
  34. <mu-button slot="actions" flat color="info" @click="closeAlertDialog">{{$t("cancel")}}</mu-button>
  35. <mu-button slot="actions" flat color="warning" @click="logout">{{$t("confirm")}}</mu-button>
  36. </mu-dialog>
  37. </div>
  38. </template>
  39. <script>
  40. import axios from 'axios';
  41. let qs = require('qs');
  42. import Global from '../Global.js'
  43. export default {
  44. data() {
  45. return {
  46. lists: [],
  47. voiceState: false,
  48. alertState: false,
  49. openAlert: false
  50. }
  51. },
  52. mounted() {
  53. localStorage.voiceState = localStorage.voiceState || false;
  54. localStorage.alertState = localStorage.alertState || false;
  55. this.voiceState = JSON.parse(localStorage.voiceState);
  56. this.alertState = JSON.parse(localStorage.alertState);
  57. },
  58. watch: {
  59. voiceState: function (val) {
  60. localStorage.voiceState = val;
  61. },
  62. alertState: function (val) {
  63. localStorage.alertState = val;
  64. },
  65. },
  66. methods: {
  67. openAlertDialog() {
  68. this.openAlert = true;
  69. },
  70. closeAlertDialog() {
  71. this.openAlert = false;
  72. },
  73. // 退出
  74. logout() {
  75. this.openAlert = false;
  76. const that = this;
  77. localStorage.token = '';
  78. that.$router.push({path: '/login'});
  79. },
  80. },
  81. }
  82. </script>
  83. <style scoped>
  84. #pages {
  85. width: 100%;
  86. top: 0;
  87. bottom: 0;
  88. height: 100%;
  89. overflow: hidden;
  90. display: block;
  91. margin: 0 auto;
  92. background: #f2f2f2;
  93. }
  94. /*mu-header*/
  95. .mu-primary-color {
  96. line-height: 60px;
  97. height: 60px;
  98. background: url("../static/images/comm/headerBg.png") top center no-repeat;
  99. background-size: 100%;
  100. }
  101. /deep/ .mu-appbar-left {
  102. padding-top: 15px;
  103. }
  104. /deep/ .material-icons {
  105. color: #fff;
  106. }
  107. /deep/ .mu-appbar-title {
  108. text-align: center;
  109. }
  110. .mu-button {
  111. display: block;
  112. margin: 0 auto;
  113. }
  114. .row {
  115. width: 100%;
  116. overflow: hidden;
  117. display: block;
  118. margin: 0 auto;
  119. }
  120. .mu-switch-checked {
  121. color: #FFCC00;
  122. }
  123. .grip {
  124. width: 100%;
  125. overflow: hidden;
  126. display: block;
  127. margin: 0 auto;
  128. height: 10px;
  129. }
  130. /deep/ .mu-item-wrapper {
  131. background: #fff;
  132. font-size: 16px;
  133. color: #000;
  134. }
  135. </style>