<template>
  <div>
    <el-form :model="property" :label-position="labelPosition" label-width="72px">
      <SerailNumber :property="property" />

      <el-form-item label="标签颜色" :style="cssVars">
        <el-select v-model="property.label_color" class="label-color">
          <el-option
            v-for="(color, i) in labelColorList"
            :key="i"
            :label="color.label"
            :value="color.value"
            :style="{ color: color.value === 'random' ? '#000' : color.value }"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="标签字体">
        <el-select v-model="property.label_font">
          <el-option label="中文" value="chinese" />
        </el-select>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import SettingMixin from '@/views/book/courseware/create/components/common/SettingMixin';
import { getLabelProperty, labelColorList } from '@/views/book/courseware/data/label';

export default {
  name: 'LabelSetting',
  mixins: [SettingMixin],
  data() {
    return {
      labelColorList,
      labelPosition: 'left',
      property: getLabelProperty(),
    };
  },
  computed: {
    cssVars() {
      let _color = this.property.label_color;
      return {
        '--color1': _color === 'random' ? '#000' : _color,
      };
    },
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
@use '@/styles/mixin.scss' as *;

.el-form {
  @include setting-base;

  .label-color {
    :deep .el-input__inner {
      color: var(--color1) !important;
    }
  }
}
</style>
