<template>
  <!--
    	作者：luoyiming
    	时间：2020-06-20
    	描述：diy组件-参数设置-顶部设置栏
    -->
  <div>
    <div class="common-form">
      <span>{{ curItem.name }}</span>
    </div>
    <el-form size="small" :model="curItem" label-width="100px">
      <!--页面标题-->
      <el-form-item label="标题类型：">
        <el-radio-group v-model="curItem.params.title_type" @change="logechange">
           <el-radio :label="'text'">文本</el-radio>
          <el-radio :label="'image'">图片</el-radio>
        </el-radio-group>
      </el-form-item>
      <!--图片-->
      <el-form-item label="顶部logo：" v-if="curItem.params.title_type=='image'">
        <div class="diy-setpages-cover">
          <img  v-if="curItem.params.toplogo" v-img-url="curItem.params.toplogo" alt="" @click="$parent.onEditorSelectImage(curItem.params, 'toplogo')" :style="'background-color:'+curItem.style.titleBackgroundColor+' ;'">
          <div>建议尺寸高度 X × 60</div>
        </div>
      </el-form-item>
      <el-form-item label="顶部logo：" v-if="curItem.params.title_type=='text'">
         <el-input v-model="curItem.params.title"></el-input>
      </el-form-item>
      <el-form-item label="文字颜色："  v-if="curItem.params.title_type=='text'">
        <div class="d-s-c">
          <el-color-picker v-model="curItem.style.titleTextColor"></el-color-picker>
          <el-button type="button" style="margin-left: 10px;" @click.stop="$parent.onEditorResetColor(curItem.style, 'titleTextColor', '#ffffff')">重置</el-button>
        </div>
      </el-form-item>
      <!--页面名称-->
      <el-form-item label="页面名称：">
        <el-input v-model="curItem.params.name"></el-input>
        <p class="gray">页面名称仅用于后台查找</p>
      </el-form-item>
      <!--分享标题-->
      <el-form-item label="分享标题：">
        <el-input v-model="curItem.params.share_title"></el-input>
        <p class="gray">小程序端转发时显示的标题</p>
      </el-form-item>
      <el-form-item label="分享logo：">
        <div class="diy-notice-icon">
          <img v-img-url="curItem.params.share_img" alt="" @click="$parent.onEditorSelectImage(curItem.params, 'share_img')">
        </div>
        <div>公众号分享logo，建议尺寸80×80</div>
      </el-form-item>

      <!-- 背景颜色 -->
      <el-form-item label="背景颜色：">
        <div class="d-s-c">
          <el-color-picker v-model="curItem.style.titleBackgroundColor"></el-color-picker>
          <el-button type="button" style="margin-left: 10px;" @click.stop="$parent.onEditorResetColor(curItem.style, 'titleBackgroundColor', '#ffffff')">重置</el-button>
        </div>
      </el-form-item>
     
    </el-form>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        logo_type: 'image'
      };
    },
    props: ['curItem', 'selectedIndex', 'opts'],
    created() {

    },
    methods: {
      logechange(e){
        console.log(e)
         this.curItem.params.title_type=e;
      }
    }
  };
</script>

<style>
  .diy-setpages-cover>img{
    width: 60px;
    height: 60px;
  }
</style>
