1
0

index.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <com-head :options="[{ name: '系统设置', value: '2' }]" notContent> </com-head>
  3. <div class="body-layer" style="padding: 24px" v-loading="loading">
  4. <el-form :model="form" label-width="auto" style="max-width: 600px">
  5. <el-form-item label="系统标题">
  6. <el-input
  7. v-model="form.name"
  8. placeholder="请输入系统标题"
  9. :maxlength="100"
  10. show-word-limit
  11. />
  12. </el-form-item>
  13. <el-form-item label="系统主题色">
  14. <el-radio-group v-model="form.color">
  15. <el-radio :label="color" size="large" v-for="color in themeColors">
  16. <span class="radio-box" :style="{ 'background-color': '#' + color }"></span>
  17. </el-radio>
  18. </el-radio-group>
  19. </el-form-item>
  20. <el-form-item>
  21. <el-button type="primary" @click="onSubmit">提交</el-button>
  22. </el-form-item>
  23. </el-form>
  24. </div>
  25. </template>
  26. <script setup lang="ts">
  27. import comHead from "@/components/head/index.vue";
  28. import { setTheme, setTitle, systemData, themeColors } from "@/setSystem";
  29. import { reactive, ref } from "vue";
  30. // do not use same name with ref
  31. const form = reactive({
  32. ...systemData.value,
  33. });
  34. const loading = ref(false);
  35. const onSubmit = async () => {
  36. loading.value = true;
  37. await setTheme(form.color);
  38. await setTitle(form.name);
  39. loading.value = false;
  40. };
  41. </script>
  42. <style lang="scss" scoped>
  43. .radio-box {
  44. display: inline-block;
  45. width: 20px;
  46. height: 20px;
  47. vertical-align: middle;
  48. }
  49. </style>