<template>
  <div>
    <el-form :model="property" label-width="72px" label-position="left">
      <SerailNumber :property="property" />
      <el-form-item label="功能">
        <el-select v-model="property.fun_type" placeholder="请选择">
          <el-option v-for="{ value, label } in funList" :key="value" :label="label" :value="value" />
        </el-select>
      </el-form-item>
      <el-form-item label="拼音">
        <el-radio-group v-model="property.is_enable_pinyin">
          <el-radio v-for="{ value, label } in showList" :key="value" :label="value">
            {{ label }}
          </el-radio>
        </el-radio-group>
      </el-form-item>
      <el-divider />
      <el-form-item label="读音">
        <el-radio-group v-model="property.is_enable_voice">
          <el-radio v-for="{ value, label } in showList" :key="value" :label="value">
            {{ label }}
          </el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="读音" v-if="isEnable(property.is_enable_voice)">
        <el-select v-model="property.audio_generation_method" placeholder="请选择">
          <el-option v-for="{ value, label } in audioGenerationMethodList" :key="value" :label="label" :value="value" />
        </el-select>
      </el-form-item>

      <el-divider />
      <el-form-item label="录音作答">
        <el-radio-group v-model="property.is_enable_voice_answer">
          <el-radio v-for="{ value, label } in switchOption" :key="value" :label="value" :value="value">
            {{ label }}
          </el-radio>
        </el-radio-group>
      </el-form-item>

      <el-divider />
      <el-form-item label="汉字框">
        <el-radio-group v-model="property.frame_type">
          <el-radio v-for="{ value, label } in frameList" :key="value" :label="value" :value="value">
            {{ label }}
          </el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="框颜色">
        <el-color-picker v-model="property.frame_color"></el-color-picker>
      </el-form-item>
      <template v-if="property.fun_type === 'write'">
        <el-divider />
        <el-form-item label="描红">
          <el-radio-group v-model="property.is_enable_miao">
            <el-radio v-for="{ value, label } in switchOption" :key="value" :label="value" :value="value">
              {{ label }}
            </el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- <el-form-item label="错误提示" v-if="isEnable(property.is_enable_miao)">
          <el-radio-group v-model="property.is_enable_error">
            <el-radio v-for="{ value, label } in switchOption" :key="value" :label="value" :value="value">
              {{ label }}
            </el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="笔迹回放" v-else> -->
        <el-form-item label="笔迹回放" v-if="!isEnable(property.is_enable_miao)">
          <el-radio-group v-model="property.is_enable_play_back">
            <el-radio v-for="{ value, label } in switchOption" :key="value" :label="value" :value="value">
              {{ label }}
            </el-radio>
          </el-radio-group>
        </el-form-item>
      </template>
    </el-form>
  </div>
</template>

<script>
import SettingMixin from '@/views/book/courseware/create/components/common/SettingMixin';

import {
  getCharacterBaseProperty,
  arrangeTypeList,
  audioPositionList,
  audioGenerationMethodList,
  switchOption,
  funList,
  showList,
  isEnable,
  frameList,
} from '@/views/book/courseware/data/characterBase';

export default {
  name: 'CharacterBaseSetting',
  mixins: [SettingMixin],
  data() {
    return {
      property: getCharacterBaseProperty(),
      arrangeTypeList,
      audioPositionList,
      audioGenerationMethodList,
      switchOption,
      isEnable,
      funList,
      showList,
      frameList,
    };
  },
  methods: {},
};
</script>

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

.el-form {
  @include setting-base;
}
</style>
