<template>
  <div class="app-container">
     <el-tabs v-model="activeName" @tab-click="handleClick" >
      <el-tab-pane label="商城配置" name="store.config">
          <el-form ref="form1" :model="form1" :rules="rules1" label-width="180px">
            <el-form-item   label="搜索关键字" prop="hotSearch">
                <el-input  v-model="form1.hotSearch"  label="请输入搜索关键字,多个用,号分隔"></el-input>
            </el-form-item>
             <el-form-item   label="资质证明" prop="certs">
                <Material v-model="photoArr" type="image" :num="10" :width="150" :height="150" />
            </el-form-item>
            <el-form-item  label="货到付款支付比例" prop="payRate">
              <el-tooltip class="item" effect="dark" content="货到付款支付比例(%)" placement="top-end">
                <el-input-number  v-model="form1.payRate"   ></el-input-number>
              </el-tooltip>
            </el-form-item>
            <el-form-item  label="待支付订单取消时间" prop="unPayTime">
              <el-tooltip class="item" effect="dark" content="待支付订单取消时间(分钟)" placement="top-end">
                <el-input-number  v-model="form1.unPayTime" :min="1"    ></el-input-number>
              </el-tooltip>

            </el-form-item>
            <el-form-item  label="公司推广佣金比例" prop="tuiMoneyRate">
              <el-tooltip class="item" effect="dark" content="公司推广佣金比例(%)" placement="top-end">
                <el-input-number  v-model="form1.tuiMoneyRate" :min="1" :max="100"    ></el-input-number>
              </el-tooltip>
            </el-form-item>
            <el-form-item  label="服务费" prop="serviceFee">
              <el-tooltip class="item" effect="dark" content="服务费(元)" placement="top-end">
                <el-input-number  v-model="form1.serviceFee" :min="0"   ></el-input-number>
              </el-tooltip>
            </el-form-item>
            <el-form-item  label="成本售价比例" prop="salesPriceRate">
              <el-tooltip class="item" effect="dark" content="成本售价比例(%)" placement="top-end">
                <el-input-number  v-model="form1.salesPriceRate" :min="1" :max="300"    ></el-input-number>
              </el-tooltip>
            </el-form-item>
            <el-form-item  label="公司制单金额最低比例" prop="createMoneyRate">
              <el-tooltip class="item" effect="dark" content="公司制单金额最低比例(%)" placement="top-end">
                <el-input-number  v-model="form1.createMoneyRate" :min="1" :max="100"    ></el-input-number>
              </el-tooltip>
            </el-form-item>
            <el-form-item  label="申请售后有效天数" prop="storeAfterSalesDay">
              <el-tooltip class="item" effect="dark" content="确认收货后申请售后天数" placement="top-end">
                <el-input-number  v-model="form1.storeAfterSalesDay" :min="0" :max="100"    ></el-input-number>
              </el-tooltip>
            </el-form-item>
            <el-form-item  label="退货收货人" prop="refundConsignee">
              <el-tooltip class="item" effect="dark" content="退货收货人" placement="top-end">
                <el-input style="width:200px"  v-model="form1.refundConsignee"   ></el-input>
              </el-tooltip>
            </el-form-item>
            <el-form-item  label="退货手机号" prop="refundPhoneNumber">
              <el-tooltip class="item" effect="dark" content="退货手机号" placement="top-end">
                <el-input  style="width:200px"  v-model="form1.refundPhoneNumber"   ></el-input>
              </el-tooltip>
            </el-form-item>
            <el-form-item  label="退货地址" prop="refundAddress">
              <el-tooltip class="item" effect="dark" content="退货地址" placement="top-end">
                <el-input    v-model="form1.refundAddress"   ></el-input>
              </el-tooltip>
            </el-form-item>
            <el-form-item label="会员海报图片" prop="userPosterImage">
              <ImageUpload v-model="form1.userPosterImage" type="image" :num="10" :width="150" :height="150" :limit="1"/>
            </el-form-item>
           <div   class="footer">
              <el-button type="primary" @click="submitForm1">提  交</el-button>
            </div>
          </el-form>
      </el-tab-pane>

       <el-tab-pane label="企业理念" name="store.concept">
         <el-form ref="form3" :model="form7" :rules="rules7" label-width="160px">
           <el-form-item   label="企业理念图片" prop="images">
             <Material v-model="images" type="image" :num="10" :width="150" :height="150" />
           </el-form-item>
           <el-form-item label="企业理念视频" prop="videoUrl">
             <div>
               <el-upload
                 ref="upload"
                 class="upload-demo"
                 :action="uploadUrl"
                 :on-success="handleSuccess"
                 :before-upload="beforeUpload"
                 :limit="1"
                 :accept="videoAccept"
               >
                 <el-button size="small" type="primary">点击上传视频</el-button>
               </el-upload>
               <video :src="form7.videoUrl" controls style="max-width: 400px; max-height: 400px;"></video>
             </div>
           </el-form-item>
           <div  class="footer">
             <el-button type="primary" @click="submitForm7">提  交</el-button>
           </div>
         </el-form>
       </el-tab-pane>

      <el-tab-pane label="云存储桶配置" name="sys.oss.cloudStorage">
          <el-form ref="form2" :model="form2" :rules="rules2" label-width="140px">
            <el-form-item label="类型" prop="type">
               <el-radio-group v-model="form2.type">
                <el-radio :label="1">七牛云</el-radio>
                <el-radio :label="2">阿里云</el-radio>
                <el-radio :label="3">腾讯云</el-radio>
                <el-radio :label="4">华为云</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item v-if="form2.type==1" label="七牛绑定的域名" prop="qiniuDomain">
                <el-input  v-model="form2.qiniuDomain"  label="请输入七牛绑定的域名"></el-input>
            </el-form-item>
             <el-form-item v-if="form2.type==1" label="七牛路径前缀" prop="qiniuPrefix">
                <el-input  v-model="form2.qiniuPrefix" label="请输入七牛路径前缀"></el-input>
            </el-form-item>
             <el-form-item v-if="form2.type==1" label="七牛ACCESS_KEY" prop="qiniuAccessKey">
                <el-input  v-model="form2.qiniuAccessKey" label="请输入七牛ACCESS_KEY"></el-input>
            </el-form-item>
            <el-form-item v-if="form2.type==1" label="七牛SecretKey" prop="qiniuSecretKey">
                <el-input  v-model="form2.qiniuSecretKey" label="七牛SecretKey不能为空"></el-input>
            </el-form-item>
            <el-form-item v-if="form2.type==1" label="七牛空间名" prop="qiniuBucketName">
                <el-input  v-model="form2.qiniuBucketName" label="七牛空间名不能为空"></el-input>
            </el-form-item>
             <el-form-item v-if="form2.type==2" label="阿里云绑定的域名" prop="aliyunDomain">
                <el-input  v-model="form2.aliyunDomain" label="阿里云绑定的域名不能为空"></el-input>
            </el-form-item>
             <el-form-item v-if="form2.type==2" label="阿里云路径前缀" prop="aliyunPrefix">
                <el-input  v-model="form2.aliyunPrefix" label="阿里云路径前缀不能为空"></el-input>
            </el-form-item>
             <el-form-item v-if="form2.type==2" label="阿里云EndPoint" prop="aliyunEndPoint">
                <el-input  v-model="form2.aliyunEndPoint" label="阿里云EndPoint不能为空"></el-input>
            </el-form-item>
             <el-form-item v-if="form2.type==2" label="阿里云AccessKeyId" prop="aliyunAccessKeyId">
                <el-input  v-model="form2.aliyunAccessKeyId" label="阿里云AccessKeyId不能为空"></el-input>
            </el-form-item>
            <el-form-item v-if="form2.type==2" label="阿里云AccessKeySecret" prop="aliyunAccessKeySecret">
                <el-input  v-model="form2.aliyunAccessKeySecret" label="阿里云AccessKeySecret不能为空"></el-input>
            </el-form-item>
             <el-form-item v-if="form2.type==2" label="阿里云BucketName" prop="aliyunBucketName">
                <el-input  v-model="form2.aliyunBucketName" label="阿里云BucketName不能为空"></el-input>
            </el-form-item>
              <el-form-item v-if="form2.type==3" label="腾讯云绑定的域名" prop="qcloudDomain">
                <el-input  v-model="form2.qcloudDomain" label="腾讯云绑定的域名格式不正确"></el-input>
            </el-form-item>
              <el-form-item v-if="form2.type==3" label="腾讯云前缀" prop="qcloudPrefix">
                <el-input  v-model="form2.qcloudPrefix" label="腾讯云前缀不能为空"></el-input>
            </el-form-item>

             <el-form-item v-if="form2.type==3" label="腾讯云SecretId" prop="qcloudSecretId">
                <el-input  v-model="form2.qcloudSecretId" label="腾讯云SecretId不能为空"></el-input>
            </el-form-item>
             <el-form-item v-if="form2.type==3" label="腾讯云SecretKey" prop="qcloudSecretKey">
                <el-input  v-model="form2.qcloudSecretKey" label="腾讯云SecretKey不能为空"></el-input>
            </el-form-item>
             <el-form-item v-if="form2.type==3" label="腾讯云BucketName" prop="qcloudBucketName">
                <el-input  v-model="form2.qcloudBucketName" label="腾讯云BucketName不能为空"></el-input>
            </el-form-item>
             <el-form-item v-if="form2.type==3" label="所属地区" prop="qcloudRegion">
                <el-input  v-model="form2.qcloudRegion" label="所属地区不能为空"></el-input>
            </el-form-item>

            <el-form-item v-if="form2.type==4" label="华为云绑定的域名" prop="huaweiDomain">
              <el-input  v-model="form2.huaweiDomain" label="华为云绑定的域名格式不正确"></el-input>
            </el-form-item>
            <el-form-item v-if="form2.type==4" label="华为云Endpoint" prop="huaweiBucketName">
              <el-input  v-model="form2.huaweiEndpoint" label="华为云Endpoint不能为空"></el-input>
            </el-form-item>

            <el-form-item v-if="form2.type==4" label="华为云AK" prop="huaweiAK">
              <el-input  v-model="form2.huaweiAK" label="华为云AK不能为空"></el-input>
            </el-form-item>
            <el-form-item v-if="form2.type==4" label="华为云SK" prop="huaweiSK">
              <el-input  v-model="form2.huaweiSK" label="华为云SK不能为空"></el-input>
            </el-form-item>
            <el-form-item v-if="form2.type==4" label="华为云BucketName" prop="huaweiBucketName">
              <el-input  v-model="form2.huaweiBucketName" label="华为云BucketName不能为空"></el-input>
            </el-form-item>
             <div   class="footer">
              <el-button type="primary" @click="submitForm2">提  交</el-button>
            </div>
          </el-form>
      </el-tab-pane>
      <el-tab-pane label="积分配置" name="store.integral">
          <el-form ref="form3" :model="form3" :rules="rules3" label-width="160px">
            <el-form-item  label="积分抵用比例" prop="integralRatio">
              <el-tooltip class="item" effect="dark" content="1积分抵多少金额" placement="top-end">
                <el-input-number  v-model="form3.integralRatio"   ></el-input-number>
              </el-tooltip>
            </el-form-item>
            <el-form-item  label="满多少可以抵扣" prop="integralFull">
              <el-tooltip class="item" effect="dark" content="消费必须满一定额度才可使用,0代表无限制" placement="top-end">
                <el-input-number  v-model="form3.integralFull" ></el-input-number>
              </el-tooltip>
            </el-form-item>
            <el-form-item  label="单次最大抵扣积分" prop="integralMax">
              <el-tooltip class="item" effect="dark" content="限制一次只能使用多少积分,0代表无限制" placement="top-end">
                <el-input-number  v-model="form3.integralMax" ></el-input-number>
              </el-tooltip>
            </el-form-item>
           <div   class="footer">
              <el-button type="primary" @click="submitForm3">提  交</el-button>
            </div>
          </el-form>
      </el-tab-pane>
      <el-tab-pane label="签到配置" name="store.sign">
        <el-form ref="form4" :model="form4" label-width="160px">
              <el-table
                border
                :data="form4.sign"
                style="width: 100%">
                <el-table-column
                  prop="day"
                  label="名称"
                  >
                </el-table-column>
                <el-table-column
                  prop="signNum"
                  label="获得积分"
                  >
                </el-table-column>
                <el-table-column
                  prop="sort"
                  label="排序"
                  >
                </el-table-column>
                <el-table-column
                  label="操作"
                  width="100">
                  <template slot-scope="scope">
                    <el-button type="text" size="small" @click="handleSignEdit(scope.row)">编辑</el-button>
                  </template>
                </el-table-column>
              </el-table>
              <div   class="footer" style="margin-top:10px;">
              <el-button type="primary" @click="submitForm4">提  交</el-button>
            </div>
         </el-form>
      </el-tab-pane>

      <el-tab-pane label="用户协议" name="store.agreement">
          <el-form ref="form5" :model="form5" :rules="rules5" label-width="100px">
            <el-form-item label="用户协议" prop="userAgreement">
              <editor ref="myeditor1"       @on-text-change="updateText1" />
            </el-form-item>
            <el-form-item label="隐私政策" prop="privacyPolicy">
              <editor ref="myeditor2"    @on-text-change="updateText2" />
            </el-form-item>
            <div class="footer">
              <el-button type="primary" @click="submitForm5">提  交</el-button>
            </div>
          </el-form>
      </el-tab-pane>
       <el-tab-pane label="支付配置" name="store.pay">
         <el-form ref="form6" :model="form6"  label-width="160px">
           <el-form-item label="支付类型" prop="type">
             <el-radio-group v-model="form6.type">
               <el-radio label="wx">微信支付</el-radio>
               <el-radio label="hf">汇付</el-radio>
             </el-radio-group>
           </el-form-item>
           <el-form-item   label="appId" prop="appId">
             <el-input   v-model="form6.appId"  label="请输入appId"></el-input>
           </el-form-item>
           <el-form-item  v-if="form6.type=='wx'" label="微信商户号" prop="wxMchId">
             <el-input   v-model="form6.wxMchId"  label="请输入微信商户号"></el-input>
           </el-form-item>
           <el-form-item v-if="form6.type=='wx'" label="微信商户密钥" prop="wxMchKey">
             <el-input  v-model="form6.wxMchKey" label="请输入商户密钥"></el-input>
           </el-form-item>
           <el-form-item v-if="form6.type=='wx'" label="微信商户V3密钥" prop="wxMchKey">
             <el-input  v-model="form6.wxApiV3Key" label="请输入商户V3密钥"></el-input>
           </el-form-item>

           <el-form-item  v-if="form6.type=='hf'" label="汇付产品号" prop="hfProductId">
             <el-input   v-model="form6.hfProductId"  label="汇付产品号"></el-input>
           </el-form-item>
           <el-form-item v-if="form6.type=='hf'" label="系统号" prop="hfSysId">
             <el-input  v-model="form6.hfSysId" label="系统号Key"></el-input>
           </el-form-item>
           <el-form-item v-if="form6.type=='hf'" label="商户号" prop="huifuId">
             <el-input  v-model="form6.huifuId" label="商户号"></el-input>
           </el-form-item>
           <el-form-item v-if="form6.type=='hf'" label="服务商私钥" prop="hfRsaPrivateKey">
             <el-input  v-model="form6.hfRsaPrivateKey" label="服务商私钥"></el-input>
           </el-form-item>
           <el-form-item v-if="form6.type=='hf'" label="汇付公钥" prop="hfRsaPublicKey">
             <el-input  v-model="form6.hfRsaPublicKey" label="汇付公钥"></el-input>
           </el-form-item>
           <el-form-item v-if="form6.type=='hf'" label="汇付支付回调地址" prop="hfPayNotifyUrl">
             <el-input  v-model="form6.hfPayNotifyUrl" label="汇付支付回调地址"></el-input>
           </el-form-item>
           <el-form-item v-if="form6.type=='hf'" label="大额支付回调地址" prop="hfPayOnlineNotifyUrl">
             <el-input  v-model="form6.hfPayOnlineNotifyUrl" label="汇付支付回调地址"></el-input>
           </el-form-item>
           <el-form-item v-if="form6.type=='hf'" label="汇付退款回调地址" prop="hfRefundNotifyUrl">
             <el-input  v-model="form6.hfRefundNotifyUrl" label="汇付退款回调地址"></el-input>
           </el-form-item>
           <el-form-item v-if="form6.type=='hf'" label="汇付大额退款回调地址" prop="hfOnlineRefundNotifyUrl">
             <el-input  v-model="form6.hfOnlineRefundNotifyUrl" label="汇付分账回调地址"></el-input>
           </el-form-item>
           <div   class="footer">
             <el-button type="primary" @click="submitform6">提  交</el-button>
           </div>
         </el-form>
       </el-tab-pane>
       <el-tab-pane label="点播配置" name="course.config">
         <el-form ref="form18" :model="form18" label-width="120px">
           <el-form-item label="可答题进度(%)">
             <el-tooltip class="item" effect="dark" content="课程可答题进度(%)" placement="top-end">
               <el-input-number  v-model="form18.answerRate" :min="1" :max="100"    ></el-input-number>
             </el-tooltip>
           </el-form-item>
           <el-form-item label="短链有效期(天)">
             <el-tooltip class="item" effect="dark" content="短链有效期(天)" placement="top-end">
               <el-input-number  v-model="form18.videoLinkExpireDate" :min="1"    ></el-input-number>
             </el-tooltip>
           </el-form-item>
           <el-form-item label="答题允许错误次数(次)">
             <el-tooltip class="item" effect="dark" content="课程答题允许错误次数(次)" placement="top-end">
               <el-input-number  v-model="form18.answerErrorCount" :min="1"     ></el-input-number>
             </el-tooltip>
           </el-form-item>
           <el-form-item label="最大缓冲时长(秒)">
             <el-tooltip class="item" effect="dark" content="当前播放时间之后缓冲秒数(秒)" placement="top-end">
               <el-input-number  v-model="form18.maxBufferLength" :min="1"    ></el-input-number>
             </el-tooltip>
           </el-form-item>
           <el-form-item label="每十分钟获取积分">
             <el-tooltip class="item" effect="dark" content="每十分钟获取多少积分" placement="top-end">
               <el-input-number  v-model="form18.videoIntegral" :min="1"    ></el-input-number>
             </el-tooltip>
           </el-form-item>
           <el-form-item label="答题获得积分">
             <el-tooltip class="item" effect="dark" content="答题获得积分" placement="top-end">
               <el-input-number  v-model="form18.answerIntegral" :min="1"    ></el-input-number>
             </el-tooltip>
           </el-form-item>
           <el-form-item label="通用看课域名">
             <el-tooltip class="item" effect="dark" content="看课域名" placement="top-end">
               <el-input style="width: 300px"  v-model="form18.realLinkDomainName"     ></el-input>
             </el-tooltip>
           </el-form-item>
           <el-form-item label="注册域名">
             <el-tooltip class="item" effect="dark" content="注册域名" placement="top-end">
               <el-input style="width: 300px"  v-model="form18.registerDomainName" ></el-input>
             </el-tooltip>
           </el-form-item>
           <el-form-item label="主域名">
             <el-tooltip class="item" effect="dark" content="所有销售的看课二级域名根据此主域名来发放" placement="top-end">
               <el-input style="width: 200px"  v-model="form18.courseDomainName" label="看课主域名"></el-input>
             </el-tooltip>
           </el-form-item>
           <el-form-item label="看课默认线路">
             <el-radio-group v-model="form18.defaultLine">
               <el-radio label="0">线路一</el-radio>
               <el-radio label="1">线路二</el-radio>
             </el-radio-group>
           </el-form-item>
           <el-form-item label="网页授权域名">
             <el-tooltip class="item" effect="dark" content="公众号网页授权域名" placement="top-end">
               <el-input  v-model="form18.authDomainName"  ></el-input>
             </el-tooltip>
           </el-form-item>
           <el-form-item label="公众号appId">
             <el-tooltip class="item" effect="dark" content="授权公众号appId" placement="top-end">
               <el-input  v-model="form18.mpAppId"  ></el-input>
             </el-tooltip>
           </el-form-item>

           <el-form-item label="小程序appid">
             <el-tooltip class="item" effect="dark" content="小程序appid" placement="top-end">
               <el-input  v-model="form18.miniprogramAppid"  ></el-input>
             </el-tooltip>
           </el-form-item>
           <el-form-item label="小程序page路径">
             <el-tooltip class="item" effect="dark" content="小程序消息打开后的路径" placement="top-end">
               <el-input  v-model="form18.miniprogramPage"  ></el-input>
             </el-tooltip>
           </el-form-item>

           <el-form-item label="奖励类型">
             <el-radio-group v-model="form18.rewardType">
               <el-radio label="1">红包</el-radio>
               <el-radio label="2">积分</el-radio>
             </el-radio-group>
           </el-form-item>

           <el-form-item label="红包金额" v-if="form18.rewardType == 1">
             <el-tooltip class="item" effect="dark" content="课程默认红包金额" placement="top-end">
               <el-input-number  v-model="form18.redPackageMoney" :min="0.01" ></el-input-number>
             </el-tooltip>
           </el-form-item>


           <el-form-item label="禁止发送时间段">
             <el-row v-for="(item, index) in form18.disabledTimeList" style="margin-top: 10px">
               <el-time-picker
                 class="custom-input"
                 v-model="item.startDisabledTime"
                 value-format="HH:mm"
                 format="HH:mm"
                 placeholder="开始时间"
                 style="width: 130px;height: 20px;">
               </el-time-picker>
               <el-time-picker
                 class="custom-input"
                 v-model="item.endDisabledTime"
                 value-format="HH:mm"
                 format="HH:mm"
                 placeholder="结束时间"
                 style="width: 130px;height: 20px;margin-left: 10px">
               </el-time-picker>
               <el-button type="danger" icon="el-icon-delete" circle style="margin-left: 20px" @click="removeDisabledTime(index)"></el-button>
             </el-row>
             <el-button @click="addDisabledTime" style="margin-top: 10px">添加时间段</el-button>
           </el-form-item>

           <el-form-item label="红包模式">
             <el-radio-group v-model="form18.redPacketMode">
               <el-radio label="1">总公司</el-radio>
               <el-radio label="2">分公司</el-radio>
             </el-radio-group>
           </el-form-item>
           <div class="line"></div>
           <div style="float:right;margin-right:20px">
             <el-button type="primary" @click="submitForm18">提交</el-button>
           </div>
         </el-form>
       </el-tab-pane>
       <el-tab-pane label="红包商户配置" name="redPacket.config" >
         <el-form ref="form19" :model="form19"  label-width="150px">
           <el-form-item   label="红包接口类型" prop="isNew">
             <el-radio-group v-model="form19.isNew">
               <el-radio label="0">商家转账到零钱(旧)</el-radio>
               <el-radio label="1">商家转账(新)</el-radio>
             </el-radio-group>
           </el-form-item>
           <el-form-item   label="公众号appid" prop="appId">
             <el-input   v-model="form19.appId"  label="请输入appId"></el-input>
           </el-form-item>
           <el-form-item   label="小程序appid" prop="appId">
             <el-input   v-model="form19.miniappId"  label="请输入appId"></el-input>
           </el-form-item>
           <el-form-item   label="商户号" prop="mchId">
             <el-input   v-model="form19.mchId"  label="请输入mchId"></el-input>
           </el-form-item>
           <el-form-item   label="商户密钥" prop="mchKey">
             <el-input   v-model="form19.mchKey"  label="mchKey"></el-input>
           </el-form-item>
           <el-form-item   label="p12证书路径" prop="keyPath">
             <el-input   v-model="form19.keyPath"  label="请输入keyPath"></el-input>
           </el-form-item>
           <el-form-item   label="apiV3密钥" prop="apiV3Key">
             <el-input   v-model="form19.apiV3Key"  label="请输入apiV3Key"></el-input>
           </el-form-item>
           <el-form-item   label="公钥ID" prop="publicKeyId">
             <el-input   v-model="form19.publicKeyId"  label="请输入公钥ID"></el-input>
           </el-form-item>
           <el-form-item   label="公钥证书" prop="publicKeyPath">
             <el-input   v-model="form19.publicKeyPath"  label="请输入publicKeyPath"></el-input>
           </el-form-item>
           <el-form-item   label="key路径" prop="privateKeyPath">
             <el-input   v-model="form19.privateKeyPath"  label="请输入"></el-input>
           </el-form-item>
           <el-form-item   label="cert路径" prop="privateCertPath">
             <el-input   v-model="form19.privateCertPath"  label="请输入"></el-input>
           </el-form-item>
           <el-form-item   label="回调地址" prop="notifyUrl">
             <el-input   v-model="form19.notifyUrl"  label="请输入"></el-input>
           </el-form-item>

           <div class="footer">
             <el-button type="primary" @click="submitForm19">提  交</el-button>
           </div>
         </el-form>
       </el-tab-pane>
       <el-tab-pane label="布局配置" name="store.appShow" >
         <div >
           <el-table border :data="form10">
             <el-table-column prop="name" label="模块名称" width="300">
               <template slot-scope="scope"> <el-input    v-model="scope.row.name"   ></el-input></template>
             </el-table-column>
             <el-table-column prop="sort"label="排序号" width="300">
               <template slot-scope="scope"><el-input-number  v-model="scope.row.sort" :min="0" :max="100"    ></el-input-number>  </template>
             </el-table-column>
             <el-table-column prop="isShow" label="是否展示" width="100">
               <template slot-scope="scope">  <el-switch
                 v-model="scope.row.isShow"
                 active-color="#13ce66"
                 inactive-color="#ff4949">
               </el-switch> </template>
             </el-table-column>
           </el-table>
           <div class="footer">
             <el-button type="primary" @click="submitForm10">提  交</el-button>
           </div>
         </div>
       </el-tab-pane>
       <el-tab-pane label="企微配置" name="qw.config">
         <el-form ref="form11" :model="form11" :rules="rules11" label-width="180px">
           <el-form-item   label="是否开启重粉" prop="isRepeat">
             <el-switch v-model="form11.ooo
" />
           </el-form-item>
           <el-form-item   label="是否重项目" prop="isProject">
             <el-switch v-model="form11.isProject" />
           </el-form-item>
           <div   class="footer">
             <el-button type="primary" @click="submitForm11">提  交</el-button>
           </div>
         </el-form>
       </el-tab-pane>
       <el-tab-pane label="统计配置" name="statis.config">
         <el-form ref="form12" :model="form12" :rules="rules12" label-width="180px">
           <el-form-item   label="流量价格(每G/元)" prop="trafficPrice">
             <el-input-number v-model="form12.trafficPrice" />
           </el-form-item>
           <div   class="footer">
             <el-button type="primary" @click="submitForm12">提  交</el-button>
           </div>
         </el-form>
       </el-tab-pane>

    </el-tabs>
     <el-dialog :title="sign.title" :visible.sync="sign.open" width="500px" append-to-body>
      <el-form ref="signform" :model="signform"   label-width="80px">
        <el-form-item label="名称" prop="day">
          <el-input v-model="signform.day" placeholder="请输入名称" />
        </el-form-item>
        <el-form-item label="获得积分" prop="signNum">
          <el-input-number v-model="signform.signNum" placeholder="请输入获得积分" />
        </el-form-item>
        <el-form-item label="排序" prop="sort">
          <el-input-number v-model="signform.sort" placeholder="请输入排序" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitSignForm">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import Editor from '@/components/Editor/wang';
import {   getConfigByKey,updateConfigByKey, clearCache } from "@/api/system/config";
import Material from '@/components/Material'
export default {
  name: "Config",
  components: {
    Material,
    Editor
  },
   watch: {
    photoArr: function(val) {
      this.form1.certs = val.join(',')
    },
   images: function(val) {
     this.form7.images = val.join(',')
   }
  },
  data() {
    return {
      uploadUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
      videoAccept:"video/*",
      sign:{
        title:"修改签到",
        open:false,
      },
      signform: {

      },
      photoArr:[],
      images:[],
      activeName:"store.config",
      configId:null,
      configKey:null,
      // 表单参数
      form1: {
        hotSearch:"",

      },
      // 表单校验
      rules1: {

      },
      rules11: {

      },
      form2: {

      },
      // 表单校验
      rules2: {

      },
      form3: {

      },
      // 表单校验
      rules3: {

      },
      rules12: {
        trafficPrice: [{
          required: true, message: '流量价格不能为空', trigger: 'blur'
        }]
      },
      form4: {
        sign:[],

      },
      // 表单校验
      rules4: {

      },
      form5: {


      },
      form6: {


      },
      form7: {


      },
      rules7: {

      },
      form18:{
      },
      form10:[],
      form11:{},
      form12:{trafficPrice: 0},
      form19:{
      },
      // 表单校验
      rules5: {

      }
    };
  },
  created() {
    this.getConfigByKey(this.activeName);
  },
  methods: {
    handleSuccess(response, file) {
      // 上传成功后的回调函数
      this.myloading.close();
      this.form7.videoUrl = response.url;
      this.$refs.upload.clearFiles();
    },
    beforeUpload(file) {
      // 上传前的钩子函数，可以在这里对文件进行处理
      // 返回 false 则取消上传

      // 例如限制文件大小
      const isLt2M = file.size / 1024 / 1024 < 200;
      if (!isLt2M) {
        this.$message.error('上传视频文件大小不能超过 200MB!');
        return false;
      }
      this.myloading = this.$loading({
        lock: true,
        text: '上传中',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });

    },
      handleSignEdit(item){
        this.signform=item;
        this.sign.open=true;
      },
      submitSignForm(){
        this.sign.open=false;
      },
      updateText1(text){
        this.form5.userAgreement=text
      },
      updateText2(text){
        this.form5.privacyPolicy=text
      },
      handleClick(tab, event){
        console.log(tab.name)
        this.getConfigByKey(tab.name);
      },
      getConfigByKey(key){
         getConfigByKey(key).then(response => {
           console.log(response)
          if(key=="store.config"){
              this.configId=response.data.configId;
              this.configKey=response.data.configKey;
              this.form1 =JSON.parse(response.data.configValue);
              if(this.form1.certs!=null){
                  this.photoArr=this.form1.certs.split(",");
              }
          }
          else if(key=="store.concept"){
            this.configId=response.data.configId;
            this.configKey=response.data.configKey;
            this.form7 =JSON.parse(response.data.configValue);
            if(this.form7.images!=null){
              this.images=this.form7.images.split(",");
            }
          }
          else if(key=="store.integral"){
              this.configId=response.data.configId;
              this.configKey=response.data.configKey;
              console.log(response.data.configValue)
              this.form3 =JSON.parse(response.data.configValue);
              console.log(this.form3.sign)
          }
          else if(key=="store.sign"){
              this.configId=response.data.configId;
              this.configKey=response.data.configKey;
              this.form4.sign =JSON.parse(response.data.configValue);
              console.log(this.form4.sign)
           }
           else if(key=="store.agreement"){
              this.configId=response.data.configId;
              this.configKey=response.data.configKey;
              this.form5 =JSON.parse(response.data.configValue);
              this.$refs.myeditor1.setText(this.form5.userAgreement);
              this.$refs.myeditor2.setText(this.form5.privacyPolicy);
           }
           else if(key=="sys.oss.cloudStorage"){
              this.configId=response.data.configId;
              this.configKey=response.data.configKey;
              this.form2 =JSON.parse(response.data.configValue);
           }
            else if(key=="store.pay"){
              this.configId=response.data.configId;
              this.configKey=response.data.configKey;
              this.form6 =JSON.parse(response.data.configValue);
            }
           else if(key=="course.config"){
             this.configId=response.data.configId;
             this.configKey=response.data.configKey;
             this.form18 =JSON.parse(response.data.configValue);
           }
          else if(key=="redPacket.config"){
             this.configId=response.data.configId;
             this.configKey=response.data.configKey;
             this.form19 =JSON.parse(response.data.configValue);
           }
          else if(key=="store.appShow"){
             this.configId=response.data.configId;
             this.configKey=response.data.configKey;
             this.form10 =JSON.parse(response.data.configValue);
           }
          else if(key=="qw.config"){
             this.configId=response.data.configId;
             this.configKey=response.data.configKey;
             this.form11 =JSON.parse(response.data.configValue);
           }
          else if(key == "statis.config"){
             this.configId=response.data.configId;
             this.configKey=response.data.configKey;
             if(response.data.configValue != null) {
               this.form12 =JSON.parse(response.data.configValue);
             }

           }
        });
     },
    /** 提交按钮 */
    submitForm1: function() {

      this.$refs["form1"].validate(valid => {
        if (valid) {
          var param={configId:this.configId,configKey:this.configKey,configValue:JSON.stringify(this.form1)}
           updateConfigByKey(param).then(response => {
              if (response.code === 200) {
                this.msgSuccess("修改成功");
              }
            });
        }
      });
    },
    submitForm2: function() {
      this.$refs["form2"].validate(valid => {
        if (valid) {
         var param={configId:this.configId,configKey:this.configKey,configValue:JSON.stringify(this.form2)}
           updateConfigByKey(param).then(response => {
              if (response.code === 200) {
                this.msgSuccess("修改成功");
              }
            });
        }
      });
    },
    submitForm3: function() {
      this.$refs["form3"].validate(valid => {
        if (valid) {
         var param={configId:this.configId,configKey:this.configKey,configValue:JSON.stringify(this.form3)}
           updateConfigByKey(param).then(response => {
              if (response.code === 200) {
                this.msgSuccess("修改成功");
              }
            });
        }
      });
    },
    submitForm4: function() {
      this.$refs["form4"].validate(valid => {
        if (valid) {
         var param={configId:this.configId,configKey:this.configKey,configValue:JSON.stringify(this.form4.sign)}
           updateConfigByKey(param).then(response => {
              if (response.code === 200) {
                this.msgSuccess("修改成功");
              }
            });
        }
      });
    },
    submitForm5: function() {
      this.$refs["form5"].validate(valid => {
        if (valid) {
         var param={configId:this.configId,configKey:this.configKey,configValue:JSON.stringify(this.form5)}
           updateConfigByKey(param).then(response => {
              if (response.code === 200) {
                this.msgSuccess("修改成功");
              }
            });
        }
      });
    },
    submitform6: function() {
      this.$refs["form6"].validate(valid => {
        if (valid) {
          var param={configId:this.configId,configKey:this.configKey,configValue:JSON.stringify(this.form6)}
          updateConfigByKey(param).then(response => {
            if (response.code === 200) {
              this.msgSuccess("修改成功");
            }
          });
        }
      });
    },
    submitForm7(){
      var param={configId:this.configId,configKey:this.configKey,configValue:JSON.stringify(this.form7)}
      updateConfigByKey(param).then(response => {
        if (response.code === 200) {
          this.msgSuccess("修改成功");
        }
      });
    },
    submitForm18(){
      var param={configId:this.configId,configKey:this.configKey,configValue:JSON.stringify(this.form18)}
      updateConfigByKey(param).then(response => {
        if (response.code === 200) {
          this.msgSuccess("修改成功");
        }
      });
    },
    submitForm19(){
      var param={configId:this.configId,configKey:this.configKey,configValue:JSON.stringify(this.form19)}
      updateConfigByKey(param).then(response => {
        if (response.code === 200) {
          this.msgSuccess("修改成功");
        }
      });
    },
    submitForm10(){
      var param={configId:this.configId,configKey:this.configKey,configValue:JSON.stringify(this.form10)}
      updateConfigByKey(param).then(response => {
        if (response.code === 200) {
          this.msgSuccess("修改成功");
        }
      });
    },
    submitForm11(){
      var param={configId:this.configId,configKey:this.configKey,configValue:JSON.stringify(this.form11)}
      updateConfigByKey(param).then(response => {
        if (response.code === 200) {
          this.msgSuccess("修改成功");
        }
      });
    },
    submitForm12(){
      var param={configId:this.configId,configKey:this.configKey,configValue:JSON.stringify(this.form12)}
      updateConfigByKey(param).then(response => {
        if (response.code === 200) {
          this.msgSuccess("修改成功");
        }
      });
    },
    /** 清理缓存按钮操作 */
    handleClearCache() {
      clearCache().then(response => {
        if (response.code === 200) {
          this.msgSuccess("清理成功");
        }
      });
    },
    addDisabledTime(){
      if(this.form18.disabledTimeList == null || this.form18.disabledTimeList == undefined){
        this.form18.disabledTimeList = []
      }
      this.form18.disabledTimeList.push({startDisabledTime: "", endDisabledTime: ""});
      this.$forceUpdate();
    },
    removeDisabledTime(index){
      this.form18.disabledTimeList.splice(index, 1);
    },
  }
};
</script>
<style scoped>
.footer{
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}
</style>
