<template>
  <div>
    <el-form ref="form" :model="form" :rules="fileAddRules" label-width="120px">
      <el-form-item label="标题：">
        <el-input v-model="form.name" />
      </el-form-item>
      <el-form-item v-if="type === 1" label="文件路径：">
        <file-upload
          :limit="20"
          :is-check="false"
          :file-list="fileList"
          :tip="'支持上传pdf、docx、pptx文件格式'"
          @success="UploadSuccess($event)"
          @remove="HandleRemove($event)"
        />
      </el-form-item>
      <el-form-item v-if="type === 2" label="视频路径：">
        <file-upload
          :limit="20"
          :is-check="false"
          :file-list="fileList"
          :tip="'支持上传pdf、docx、pptx文件格式'"
          @success="UploadSuccess($event)"
          @remove="HandleRemove($event)"
        />
      </el-form-item>
      <el-form-item v-if="type === 3" label="图片路径：">
        <image-upload
          :limit="6"
          :image-list="fileList"
          @success="handleImageSuccess($event, 'textRelateds')"
          @remove="handleImageRemove($event, 'textRelateds')"
        />
      </el-form-item>
      <el-form-item v-if="type === 4" label="文本内容：">
        <editor-input />
      </el-form-item>
      <el-form-item v-if="type === 5" label="话术内容：">
        <el-input
          v-model="form.textarea2"
          type="textarea"
          :autosize="{ minRows: 2, maxRows: 4}"
          placeholder="请输入内容"
        />
      </el-form-item>
      <el-form-item label="用户阶段：">
        <el-select v-model="form.userClass" placeholder="用户阶段">
          <el-option
            v-for="(i, index) in userClass"
            :key="index"
            :label="i.value"
            :value="i.id"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="标签：">
        <el-select v-model="form.userType" placeholder="标签">
          <el-option
            v-for="(i, index) in userType"
            :key="index"
            :label="i.value"
            :value="i.id"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm('form')">提交</el-button>
        <el-button @click="$router.back()">返回</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import ImageUpload from '@/components/UploadImage/index.vue'
import FileUpload from '@/views/serviceSettlement/components/UploadFile.vue'
import databaseMixin from '../../mixins/index'
import EditorInput from '@/components/Editor/index.vue'

export default {
  components: {
    ImageUpload,
    FileUpload,
    EditorInput
  },
  mixins: [databaseMixin],
  data() {
    return {
      form: {
        infoType: 1
      },
      fileList: []
    }
  },
  methods: {
    HandleRemove() {},
    UploadSuccess() {},
    handleImageSuccess() {},
    handleImageRemove() {},
    submitForm(form) {}
  }
}
</script>

<style lang="scss" scoped>
::v-deep .el-input,
::v-deep .el-textarea__inner {
  width: 500px;
}
::v-deep .el-form {
  width: 650px;
  margin: 20px auto;
}
</style>
