top-setting.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <span class="setting">
  3. <div
  4. :class="{'setting__shade--show':isShade}"
  5. class="setting__shade"
  6. @click="close"/>
  7. <div
  8. :class="{'setting__content--show':box}"
  9. class="setting__content">
  10. <div class="setting__header">版权信息</div>
  11. <div class="setting__body setting__about">
  12. <p>Version:PigX 3.7.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
  21. v-model="form"
  22. :option="option"/>
  23. </div>
  24. </el-scrollbar>
  25. </div>
  26. </span>
  27. </template>
  28. <script>
  29. import { mapState, mapGetters } from 'vuex'
  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. setTimeout(() => {
  56. this.init()
  57. }, 0)
  58. },
  59. methods: {
  60. close() {
  61. this.box = false
  62. this.$store.commit('SET_SHADE', false)
  63. },
  64. set(key) {
  65. const ele = this.find(key)
  66. this.$store.commit(ele.commit, eval(this.form[ele.key]))
  67. },
  68. find(key) {
  69. return this.list.filter(ele => ele.key === key)[0]
  70. },
  71. init() {
  72. this.list.forEach(ele => {
  73. this.form[ele.key] = this.validatenull(this[ele.key]) ? 'true' : this[ele.key] + ''
  74. this.set(ele.key)
  75. })
  76. },
  77. open() {
  78. this.box = true
  79. this.$store.commit('SET_SHADE', true)
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .setting {
  86. margin-left: 10px;
  87. &__icon {
  88. color:#fff;
  89. font-size: 20px;
  90. transform: rotate(90deg);
  91. }
  92. &__header {
  93. height: 42px;
  94. line-height: 42px;
  95. padding: 0 15px;
  96. border-bottom: 1px solid #f6f6f6;
  97. color: #333;
  98. border-radius: 2px 2px 0 0;
  99. font-size: 14px;
  100. small {
  101. margin-left: 8px;
  102. color: #999;
  103. }
  104. }
  105. &__body {
  106. padding: 10px 15px;
  107. line-height: 24px;
  108. }
  109. &__about {
  110. font-size: 14px;
  111. line-height: 30px;
  112. }
  113. &__shade {
  114. position: fixed;
  115. display: none;
  116. width: 100%;
  117. height: 100%;
  118. left: 0;
  119. right: 0;
  120. top: 0;
  121. bottom: 0;
  122. background-color: rgba(0, 0, 0, 0.3);
  123. z-index: 2048;
  124. &--show {
  125. display: block;
  126. }
  127. }
  128. &__form {
  129. width: 230px;
  130. margin: 0 auto;
  131. }
  132. &__content {
  133. box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.1);
  134. transition: all 0.3s;
  135. position: fixed;
  136. width: 320px;
  137. height: 100%;
  138. right: -450px;
  139. top: 0;
  140. z-index: 2048;
  141. background-color: #fff;
  142. &--show {
  143. right: 0;
  144. }
  145. }
  146. }
  147. </style>