top-setting.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <span class="setting">
  3. <div class="setting__shade"
  4. :class="{'setting__shade--show':isShade}"
  5. @click="close"></div>
  6. <i class="el-icon-more setting__icon"
  7. @click="open"></i>
  8. <div class="setting__content"
  9. :class="{'setting__content--show':box}">
  10. <div class="setting__header">版权信息</div>
  11. <div class="setting__body setting__about">
  12. <p>Version:PigX 2.2.0</p>
  13. <p>Copyright: Pig4Cloud ©2018-2025</p>
  14. </div>
  15. <div class="setting__header">设置
  16. <small>(滑动鼠标下面还有更多设置)</small>
  17. </div>
  18. <el-scrollbar style="height:500px">
  19. <div class="setting__body setting__form">
  20. <avue-form v-model="form"
  21. :option="option"></avue-form>
  22. </div>
  23. </el-scrollbar>
  24. </div>
  25. </span>
  26. </template>
  27. <script>
  28. import { mapState, mapGetters } from 'vuex'
  29. import { validatenull } from '@/util/validate'
  30. import { option, list } from '@/const/setting/'
  31. export default {
  32. data () {
  33. return {
  34. box: false,
  35. form: {},
  36. list: list,
  37. option: option(this)
  38. }
  39. },
  40. computed: {
  41. ...mapGetters(['isShade']),
  42. ...mapState({
  43. showTag: state => state.common.showTag,
  44. showDebug: state => state.common.showDebug,
  45. showLock: state => state.common.showLock,
  46. showColor: state => state.common.showColor,
  47. showFullScren: state => state.common.showFullScren,
  48. showCollapse: state => state.common.showCollapse,
  49. showSearch: state => state.common.showSearch,
  50. showMenu: state => state.common.showMenu,
  51. showTheme: state => state.common.showTheme
  52. })
  53. },
  54. created () {
  55. this.init();
  56. },
  57. methods: {
  58. close () {
  59. this.box = false;
  60. this.$store.commit('SET_SHADE', false);
  61. },
  62. set (key) {
  63. const ele = this.find(key);
  64. this.$store.commit(ele.commit, eval(this.form[ele.key]));
  65. },
  66. find (key) {
  67. return this.list.filter(ele => ele.key === key)[0]
  68. },
  69. init () {
  70. this.list.forEach(ele => {
  71. this.form[ele.key] = validatenull(this[ele.key]) ? 'true' : this[ele.key] + '';
  72. this.set(ele.key);
  73. })
  74. },
  75. open () {
  76. this.box = true;
  77. this.$store.commit('SET_SHADE', true);
  78. }
  79. }
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. .setting {
  84. margin-left: 10px;
  85. &__icon {
  86. color:#fff;
  87. font-size: 20px;
  88. transform: rotate(90deg);
  89. }
  90. &__header {
  91. height: 42px;
  92. line-height: 42px;
  93. padding: 0 15px;
  94. border-bottom: 1px solid #f6f6f6;
  95. color: #333;
  96. border-radius: 2px 2px 0 0;
  97. font-size: 14px;
  98. small {
  99. margin-left: 8px;
  100. color: #999;
  101. }
  102. }
  103. &__body {
  104. padding: 10px 15px;
  105. line-height: 24px;
  106. }
  107. &__about {
  108. font-size: 14px;
  109. line-height: 30px;
  110. }
  111. &__shade {
  112. position: fixed;
  113. display: none;
  114. width: 100%;
  115. height: 100%;
  116. left: 0;
  117. right: 0;
  118. top: 0;
  119. bottom: 0;
  120. background-color: rgba(0, 0, 0, 0.3);
  121. z-index: 2048;
  122. &--show {
  123. display: block;
  124. }
  125. }
  126. &__form {
  127. width: 230px;
  128. margin: 0 auto;
  129. }
  130. &__content {
  131. box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.1);
  132. transition: all 0.3s;
  133. position: fixed;
  134. width: 320px;
  135. height: 100%;
  136. right: -450px;
  137. top: 0;
  138. z-index: 2048;
  139. background-color: #fff;
  140. &--show {
  141. right: 0;
  142. }
  143. }
  144. }
  145. </style>