<template>
<div class="feature-box">
  <div class="feature ">
      <ul >
          <li @click="dialogVisible = true">
              <span>
                <img :src="new1" alt="" style="width:40px;height:40px">
                <p>轮播图</p>  
              </span>
          </li>
          <li @click="two = true">
            <span>
                <img :src="new2" alt="" style="width:40px;height:40px">
                <p>医院介绍</p>  
              </span>  
          </li>
          <li @click="three = true">
            <span>
                <img :src="new3" alt="" style="width:40px;height:40px">
                <p>科室介绍</p>  
              </span>  
          </li>
          <li @click="four = true">
            <span>
                <img :src="new4" alt="" style="width:40px;height:40px">
                <p>医护团队</p>  
              </span>  
          </li>
          <li @click="five = true">
            <span>
                <img :src="new5" alt="" style="width:40px;height:40px">
                <p>医院环境</p>  
              </span>  
          </li>
          <li @click="six = true">
            <span>
                <img :src="new6" alt="" style="width:40px;height:40px">
                <p>医院动态</p>  
              </span>  
          </li>
          <li @click="seven = true">
            <span>
                <img :src="new7" alt="" style="width:40px;height:40px">
                <p>医院活动</p>  
              </span>  
          </li>
          <li @click="eight = true" >
            <span>
                <img :src="new8" alt="" style="width:40px;height:40px">
                <p>魔方导航</p>  
              </span>  
          </li>
      </ul>
  </div>    
  <div class="clear"></div>
  <!-- 新增轮播图 -->
  <el-dialog
    title="新增轮播图"
    :visible.sync="dialogVisible"
    width="58%"
    center>
    <el-form ref="rotationform" :model="rotationform" label-width="90px" :rules="rules" >
      <el-form-item label="模块标题:" required prop="title">
        <el-input v-model="rotationform.title" @input="changeInput($event)"></el-input>
      </el-form-item>
      <el-form-item label="排序值:" required prop="sort">
        <el-input v-model="rotationform.sort" @input="changeInput($event)" type="number"></el-input>
        <p class="tips">请输入1-99的整数，数值越小，模块排序越靠前</p>
      </el-form-item>
        <el-form-item label="添加图片:">
         <div class="flex-img">
              <div class="el-upload-list el-upload-list--picture-card">            
                  <div class="el-upload-list__item is-success" v-for="(item,index) in this.rotationdatatwo" :key="item.id"  v-show="isEmpty">             
                    <img class="flex-img__image" :src="item.images">              
                    <label class="el-upload-list__item-status-label">
                     <i class="el-icon-upload-success el-icon-check"></i>
                    </label>
                     <span class="el-upload-list__item-actions">
                    <span class="el-upload-list__item-delete">
                    <i class="el-icon-edit-outline" @click="editRotationImages(item.id);editRotionImages = true"></i>
                    <i class="el-icon-delete" @click="deleteRotations(item.id,index)"></i>
                    </span>
                    </span>
                   </div>         
                </div>     
                <div class="addrot" @click="addpicVisible = true" v-show="isNoEmpty">
                   <div class="addrotone">
                     <i class="el-icon-plus"></i>
                   </div>  
                   <div class="addrotwo">
                     <span>新增图片</span>
                   </div>
                </div>
             </div>
             <p class="tips">图片已上传{{totalImages}}张,最多上传9张</p>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" @click="AddRotationChart('rotationform');">确 定</el-button>
    </span>
  </el-dialog>

   <!-- 编辑图片 -->
   <el-dialog
     title="添加图片"
     :visible.sync="addpicVisible"
     width="40%"
     center>
  <el-form ref="picform" :model="picform" label-width="90px" :rules="rules">
    <el-form-item label="图片编辑:" required prop="imageUrl">
      <el-col :span="5">
         <el-upload
           :data="imageData"
           class="avatar-uploader"
           action="https://upload.qiniup.com"
          :show-file-list="false"
          :on-success="rotationSuccess"
          :before-upload="rotationUpload"
          :limit="9">
          <img v-if="picform.imageUrl" :src="picform.imageUrl" class="avatar">
          <i v-else class="el-icon-plus avatar-uploader-icon"></i>
        </el-upload> 
      </el-col>
      <el-col :span="19" v-show="isImages">   
          <div class="tpic"> 
            <img :src="picform.imageUrl" style="width:250px;height:150px">
          </div>
      </el-col>
    </el-form-item>
    <el-form-item label="排序值:" required prop="sort">
       <el-col :span="24">
         <el-input v-model="picform.sort" style="width:410px" type="number"></el-input>
       </el-col>   
    </el-form-item>
    <el-form-item label="图片链接:">
        <el-radio-group v-model="picform.imagelink">
          <el-radio :label="gender.id" :value="gender.id" v-for="(gender, index) in genderPicLink" :key="index" @change="select(gender.id)">{{gender.name}}</el-radio>
        </el-radio-group>
    </el-form-item>
    <el-form-item label="链接地址:"  v-show="selectone">
      <el-col :span="15">
      <el-input v-model="picform.linkaddress" style="width:300px" :disabled="true"></el-input>
      </el-col>
      <el-col :span="4">
       <el-button size="medium" @click="linkVisible = true">设置链接</el-button>
      </el-col>
    </el-form-item>
    
  </el-form>
  <span slot="footer" class="dialog-footer">
    <el-button @click="addpicVisible = false">取 消</el-button>
    <el-button type="primary" @click="AddImageslink('picform');addpicVisible = false">确 定</el-button>
  </span>
</el-dialog>

   <!-- <el-dialog
     title="添加图片"
     :visible.sync="addpicdialogVisible"
     width="30%"
     center>
    <el-form>
      <el-form-item label="添加图片:">
       <el-upload
           :data="imageData"
           class="avatar-uploader"
           action="https://upload.qiniup.com"
          :show-file-list="false"
          :on-success="rotationSuccess"
          :before-upload="rotationUpload">
          <img v-if="picform.imageUrl" :src="picform.imageUrl" class="avatar">
          <i v-else class="el-icon-plus avatar-uploader-icon"></i>
        </el-upload> 
      </el-form-item>
    </el-form>
  <span slot="footer" class="dialog-footer">
    <el-button @click="addpicdialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="addpicdialogVisible = false">确 定</el-button>
  </span>
</el-dialog> -->
  
  <!-- 设置图片链接地址 -->
  <el-dialog
    title="设置图片链接地址"
    :visible.sync="linkVisible"
    width="30%"
    center>
     <el-form label-width="90px" :model="linkformtwo" ref="linkformtwo">
     <el-form-item label="站外链接:">
       <el-input v-model="linkformtwo.address"></el-input>
     </el-form-item>
     </el-form>
    
    <span slot="footer" class="dialog-footer">
    <el-button @click="linkVisible = false">取 消</el-button>
    <el-button type="primary" @click="AddLinkAddress('linkformtwo');">确 定</el-button>
  </span>
  </el-dialog>

  <!-- 新增医院介绍 -->
  <el-dialog
    title="新增医院介绍"
    :visible.sync="two"
      width="58%"
     :modal='false'
     v-dialogDrag
     :close-on-click-modal="false"
     center>
    <el-form ref="hispitalform" :model="hispitalform" label-width="90px" :rules="rules">
      <el-form-item label="模块标题:" required prop="title">
        <el-input v-model="hispitalform.title"></el-input>
      </el-form-item>
      <el-form-item label="排序值:" required prop="sort">
        <el-input v-model="hispitalform.sort" type="number"></el-input>
        <p class="tips">请输入1-99的整数，数值越小，模块排序越靠前</p>
      </el-form-item>
      <el-form-item label="医院介绍:" required prop="introduction">
         <keep-alive>
            <neditor ref="neditor"
              id="editor"
              v-bind:r_content="hispitalform.introduction">
            </neditor>
        </keep-alive>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="two = false">取 消</el-button>
       <el-button type="primary" @click="saveHispital('hispitalform');">确 定</el-button> 
    </span>
  </el-dialog>

  <!-- 新增科室介绍 -->
  <el-dialog
    title="新增科室介绍"
    :visible.sync="three"
    width="58%"
    center>
    <el-form ref="administform" :model="administform" label-width="90px" :rules="rules">
      <el-form-item label="模块标题:" required prop="title">
        <el-input v-model="administform.title"></el-input>
      </el-form-item>
      <el-form-item label="排序值:" required prop="sort">
        <el-input v-model="administform.sort" type="number" ></el-input>
        <p class="tips">请输入1-99的整数，数值越小，模块排序越靠前</p>
      </el-form-item>
      <el-form-item label="科室介绍:" required prop="introduction">
         <keep-alive>
            <neditor ref="neditor"
              id="editorthree"
              v-bind:r_content="administform.introduction">
            </neditor>
        </keep-alive>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="three = false">取 消</el-button>
      <el-button type="primary" @click="addAdminist('administform');">确 定</el-button>
    </span>
  </el-dialog>

    <!-- 新增名医介绍 -->
  <el-dialog
    title="新增名医介绍"
    :visible.sync="four"
    width="58%"
    center>
    <el-form ref="doctorform" :model="doctorform" label-width="90px" :rules="rules" >
      <el-form-item label="模块标题:" required prop="title">
        <el-input v-model="doctorform.title"></el-input>
      </el-form-item>
      <el-form-item label="排序值:" required prop="sort">
        <el-input v-model="doctorform.sort" type="number"></el-input>
        <p class="tips">请输入1-99的整数，数值越小，模块排序越靠前</p>
      </el-form-item>
      <el-form-item label="新增名医:" v-model="doctorform.image">
         <div class="flex-img" v-show="headshow">
        <div class="el-upload-list el-upload-list--picture-card" >            
            <div class="el-upload-list__item is-success" v-for="(item,index) in this.docform" :key="item.id">             
                 <img class="flex-img__image" :src="item.dochead">              
                <label class="el-upload-list__item-status-label">
                    <i class="el-icon-upload-success el-icon-check"></i>
                </label>
                <span class="el-upload-list__item-actions">
                    <span class="el-upload-list__item-delete">
                        <i class="el-icon-edit-outline" @click="editDoctor(item.id);editcenterDialogVisible = true"></i>
                        <i class="el-icon-delete" @click="deleteDoctor(item.id,index)"></i>
                    </span>
                </span>
            </div>         
        </div>        
    </div>
      <div class="doc" @click="centerDialogVisible = true">
         <div class="docone">
         <li class="el-icon-plus"></li>  
         </div>
         <div class="doctwo">
            <span>新增名医</span>
         </div>
      </div>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="four = false">取 消</el-button>
      <el-button type="primary" @click="AddDoctor('doctorform');">确 定</el-button>
    </span>
  </el-dialog>

    <!-- 新增医生信息 -->
   <el-dialog
      title="新增医生信息"
      :visible.sync="centerDialogVisible"
      width="58%"
      center>
       <el-form label-width="90px" class="clearfix" :model="eidtDoctorform" ref="eidtDoctorform" :rules="rules">
          <el-row :span=20>
            <el-col :span="12">
             <el-form-item label="医生姓名:" required prop="name">
              <el-select  placeholder="请选择" v-model="eidtDoctorform.name"  @change="change(eidtDoctorform.name)">
                <el-option
                 v-for="item in docnames"
                 :key="item.id"
                 :label="item.name"
                 :value="item.id" >
                </el-option>
              </el-select>
             </el-form-item>     
             </el-col> 
             <el-col :span="12">
              <el-form-item label="医生职称:" required prop="user_title">
              <el-select v-model="eidtDoctorform.user_title" placeholder="请选择">
                <el-option
                 v-for="item in positions"
                 :key="item.index"
                 :label="item.name"
                 :value="item.index">
                </el-option>
              </el-select>
              </el-form-item>   
             </el-col>
          </el-row>
          <el-row :span=20>
               <el-form-item label="医生头像:" required prop="dochead">
                 <el-col :span="5">
                   <el-upload
                       :data="doctorData"
                       class="avatar-uploader"
                       action="https://upload.qiniup.com"
                       :show-file-list="false"
                       :on-success="handleAvatarSuccess"
                       :before-upload="beforeAvatarUpload">
                       <img v-if="eidtDoctorform.dochead" :src="eidtDoctorform.dochead" class="avatar">
                       <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                   </el-col>
                   <el-col :span="16">
                    <el-form-item label="排序值:" required prop="sort">
                      <el-input v-model="eidtDoctorform.sort" type="number"></el-input>
                    </el-form-item>
                  </el-col>
               </el-form-item>  
          </el-row>
          <el-row :span=20>
            <el-form-item label="医生简介:" required prop="content">      
                 <keep-alive>
                   <neditor ref="neditor"
                      id="editorsix"
                      v-bind:r_content="eidtDoctorform.content">
                  </neditor>
                </keep-alive>
            </el-form-item>
          </el-row>
        </el-form>
     <span slot="footer" class="dialog-footer">
      <el-button @click="centerDialogVisible = false">取 消</el-button>
      <el-button type="primary" @click="AddDoctorInfo('eidtDoctorform')">确 定</el-button>
      </span>
   </el-dialog>

    <el-dialog
      title="编辑医生介绍"
      :visible.sync="editcenterDialogVisible"
      width="50%"
      center>
       <el-form label-width="90px" class="clearfix" :model="editdocfrom" ref="editdocfrom" :rules="rules">
          <el-row :span=20>
            <el-col :span="10">
             <el-form-item label="医生姓名:" required prop="doc_name">
              <el-input v-model="editdocfrom.doc_name"></el-input>
             </el-form-item>     
             </el-col> 
             <el-col :span="12">
              <el-form-item label="医生职称:" required prop="doc_postion">
              <el-select v-model="editdocfrom.doc_postion" placeholder="请选择">
                <el-option
                 v-for="item in positions"
                 :key="item.index"
                 :label="item.name"
                 :value="item.index">
                </el-option>
              </el-select>
              </el-form-item>   
             </el-col>
          </el-row>
          <el-row :span=20>
               <el-form-item label="医生头像:" required prop="dochead">
                 <el-col :span="10">
                   <el-upload
                       :data="doctorDatatwo"
                       class="avatar-uploader"
                       action="https://upload.qiniup.com"
                       :show-file-list="false"
                       :on-success="handleAvatarSuccesstwo"
                       :before-upload="beforeAvatarUploadtwo">
                       <img v-if="editdocfrom.dochead" :src="editdocfrom.dochead" class="avatar">
                       <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                   </el-col>
                   <el-col :span="12">
                    <el-form-item label="排序值:" required prop="doc_sort">
                      <el-input v-model="editdocfrom.doc_sort" type="number"></el-input>
                    </el-form-item>
                  </el-col>
               </el-form-item>  
          </el-row>
          <el-row :span=20>
            <el-form-item label="医生简介:" required prop="docintroduction">      
                 <keep-alive>
                   <neditor ref="neditor"
                      id="editor"
                      v-bind:r_content="editdocfrom.docintroduction">
                  </neditor>
                </keep-alive>
            </el-form-item>
          </el-row>
        </el-form>
     <span slot="footer" class="dialog-footer">
      <el-button @click="editcenterDialogVisible = false">取 消</el-button>
      <el-button type="primary" @click="saveDocInfo('editdocfrom')">确 定</el-button>
      </span>
   </el-dialog>
  
  <!-- 新增科室环境 -->
   <el-dialog
    title="新增科室环境"
    :visible.sync="five"
    width="58%"
     center>
    <el-form ref="keform" :model="keform" label-width="110px" :rules="rules">
      <el-form-item label="模块标题: " required prop="title">
        <el-input v-model="keform.title"></el-input>
      </el-form-item>
      <el-form-item label="排序值: " required prop="sort">
        <el-input v-model="keform.sort" type="number"></el-input>
        <p class="tips">请输入1-99的整数，数值越小，模块排序越靠前</p>
      </el-form-item>
      <el-form-item label="新增科室环境:"  v-model="keform.keImages" >
           <div class="flex-img">
              <div class="el-upload-list el-upload-list--picture-card" v-show="isEmpty">            
                  <div class="el-upload-list__item is-success"  v-for="(it,index) in this.rotationdata" :key="it.id">             
                    <img class="flex-img__image" :src="it.enviroimages">              
                    <label class="el-upload-list__item-status-label">
                     <i class="el-icon-upload-success el-icon-check"></i>
                    </label>
                     <span class="el-upload-list__item-actions">
                    <span class="el-upload-list__item-delete">
                    <i class="el-icon-edit-outline" @click="EditEnvirImages(it.id);officetwoVisible = true"></i>
                    <i class="el-icon-delete" @click="deleteOfficeById(it.id,index)"></i><br>
                    </span>
                    </span>
                   </div>         
                </div>     
                <div class="upic" @click="officeVisible = true">
                  <div class="icon">
                     <i class="el-icon-plus"></i>
                  </div>
                  <div class="ufont">
                      <span>新增图片</span>
                  </div>
                </div>
         </div>
     </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="five = false">取 消</el-button>
      <el-button type="primary" @click="AddOfficeEnvironment('keform')">确 定</el-button>
    </span>
  </el-dialog>

  <el-dialog
    title="图片编辑"
   :visible.sync="officeVisible"
    width="35%"
    center>
     <el-form label-width="90px" :model="officeform" ref="officeform" :rules="rules">
       <el-form-item label="图片编辑:" required prop="enviroimages" >
            <el-upload
              :data="keData"
              class="avatar-uploader"
              action="https://upload.qiniup.com"
              :show-file-list="false"
              :on-success="officehandleAvatarSuccess"
              :before-upload="officebeforeAvatarUpload">
              <img v-if="officeform.enviroimages" :src="officeform.enviroimages" class="avatar">
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
            </el-upload>
       </el-form-item>
       <el-form-item label="排序:" required prop="sort">
         <el-input v-model="officeform.sort"></el-input>
        <p class="tips">请输入1-99的整数，数值越小，模块排序越靠前</p>
       </el-form-item>
     </el-form>
    <span slot="footer" class="dialog-footer">
    <el-button @click="officeVisible = false">取 消</el-button>
    <el-button type="primary" @click="AddImages('officeform');officeVisible = false">确 定</el-button>
  </span>
</el-dialog>

 <el-dialog
    title="图片编辑"
   :visible.sync="officetwoVisible"
    width="30%"
    center>
     <el-form label-width="90px" :model="officetwoform" ref="officetwoform" :rules="rules">
       <el-form-item label="图片编辑:" required prop="enviroimages" >
            <el-upload
              :data="keData"
              class="avatar-uploader"
              action="https://upload.qiniup.com"
              :show-file-list="false"
              :on-success="officetwohandleAvatarSuccess"
              :before-upload="officetwobeforeAvatarUpload">
              <img v-if="officetwoform.enviroimages" :src="officetwoform.enviroimages" class="avatar">
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
            </el-upload>
       </el-form-item>
       <el-form-item label="排序:" required prop="sort">
         <el-input v-model="officetwoform.sort"></el-input>
        <p class="tips">请输入1-99的整数，数值越小，模块排序越靠前</p>
       </el-form-item>
     </el-form>
    <span slot="footer" class="dialog-footer">
    <el-button @click="officetwoVisible = false">取 消</el-button>
    <el-button type="primary" @click="AddtwoImages('officetwoform');officetwoVisible = false">确 定</el-button>
  </span>
</el-dialog>




  <!-- 新增文章列表 -->
  <el-dialog
    title="新增文章列表"
    :visible.sync="six"
    width="58%"
    center>
    <el-form ref="articeform" :model="articeform" label-width="110px" :rules="rules">
      <el-form-item label="模块标题:" required  prop="title">
        <el-input v-model="articeform.title"></el-input>
      </el-form-item>
      <el-form-item label="排序值:" required prop="sort">
        <el-input v-model="articeform.sort" type="number"></el-input>
        <p class="tips">请输入1-99的整数，数值越小，模块排序越靠前</p>
      </el-form-item>
      <!-- <el-form-item label="文章分类: ">
        <el-select v-model="articeform.category"  style="width:49%;float:left;">
            <el-option
               v-for="item in articeType"
               :key="item.id"
               :label="item.name"
                :value="item.id">
           </el-option>
        </el-select>
        <el-select v-model="articeform.categoryone" style="width:49%;float:right;">
         <el-option
         v-for="item in articeTypelist"
         :key="item.id"
         :label="item.name"
         :value="item.id">         
         </el-option>
        </el-select>
      </el-form-item> -->
      <el-form-item label="首页展示条数: " required prop="number">
        <el-input v-model="articeform.number"></el-input>
        <p class="tips">请输入1-9的整数,最大数量为9</p>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="six = false">取 消</el-button>
      <el-button type="primary" @click="AddArticeList('articeform');six = false">确 定</el-button>
    </span>
  </el-dialog>
  <!-- 新增活动列表 -->
   <el-dialog
    title="新增活动列表"
    :visible.sync="seven"
    width="58%"
    center>
    <el-form ref="activeform" :model="activeform" label-width="120px" :rules="rules">
      <el-form-item label="模块标题: " required prop="title">
        <el-input v-model="activeform.title"></el-input>
      </el-form-item>
      <el-form-item label="排序值: " required prop="sort">
        <el-input v-model="activeform.sort" type="number"></el-input>
        <p class="tips">请输入1-99的整数，数值越小，模块排序越靠前</p>
      </el-form-item>
     
      <el-form-item label="首页展示条数: " required prop="number">
        <el-input v-model="activeform.number"></el-input>
        <p class="tips">请输入1-9的整数</p>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="seven = false">取 消</el-button>
      <el-button type="primary" @click="addActiveform('activeform');seven = false">确 定</el-button>
    </span>
  </el-dialog>
  <!-- 新增魔方导航 -->
    <el-dialog
    title="新增魔方导航"
    :visible.sync="eight"
    width="58%"
    center>
    <el-form ref="marginform" :model="marginform" label-width="90px" :rules="rules" >
      <el-form-item label="模块标题:" required prop="title">
        <el-input v-model="marginform.title"></el-input>
      </el-form-item>
      <el-form-item label="排序值:" required prop="sort">
        <el-input v-model="marginform.sort" type="number"></el-input>
        <p class="tips">请输入1-99的整数，数值越小，模块排序越靠前</p>
      </el-form-item>
       <el-form-item label="添加图片:" v-model="marginform.marginImages" required prop="marginImages">
         <div class="flex-img">
              <div class="el-upload-list el-upload-list--picture-card" v-for="item in margindata" :key="item.id" v-show="isEmpty">            
                  <div class="el-upload-list__item is-success">             
                    <img class="flex-img__image" :src="item.margimage">              
                    <label class="el-upload-list__item-status-label">
                     <i class="el-icon-upload-success el-icon-check"></i>
                    </label>
                     <span class="el-upload-list__item-actions">
                    <span class="el-upload-list__item-delete">
                    <i class="el-icon-edit-outline" @click="editImages(item.id);EditMacDialogVisible = true"></i>
                    <i class="el-icon-delete" @click="deleteMargin(item.id,index)"></i><br>
                    <i class="yangshi">{{item.margtitle}}</i>
                    </span>
                    </span>
                   </div>         
                </div>     
                <div class="upic" @click="MagicNavigation = true">
                  <div class="icon">
                     <i class="el-icon-plus"></i>
                  </div>
                  <div class="ufont">
                      <span>新增导航</span>
                  </div>
                </div>
         </div>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="eight = false">取 消</el-button>
      <el-button type="primary" @click="AddMarginChart('marginform');">确 定</el-button>
    </span>
  </el-dialog>

  <el-dialog
    title="编辑魔方导航"
    :visible.sync="EditMacDialogVisible"
    width="35%"
    center>
    <el-form label-width="90px" ref="editmacform" :model="editmacform" :rules="rules">
      <el-form-item label="导航标题:" required prop="margtitle">
          <el-input v-model="editmacform.margtitle"></el-input>
      </el-form-item>
      <el-form-item label="导航图标:" required prop="margimage">
        <el-upload
          :data="rotationData"
          class="avatar-uploader"
          action="https://upload.qiniup.com"
          :show-file-list="false"
          :on-success="machandleAvatarSuccess"
          :before-upload="macbeforeAvatarUpload">
          <img v-if="editmacform.margimage" :src="editmacform.margimage" class="avatar">
          <i v-else class="el-icon-plus avatar-uploader-icon"></i>     
       </el-upload>
      </el-form-item>
      <el-form-item label="跳转设置:" required="jumpset">
         <el-radio-group v-model="editmacform.jumpset">
            <el-radio :label="gender.id" :value="gender.id" v-for="(gender, index) in genderOptions" :key="index" @change="selectGender(gender.id)">{{gender.name}}</el-radio>
          </el-radio-group>
      </el-form-item>
      <el-form-item>
         <el-col :span="18">
           <el-input style="width:300px" v-model="editmacform.marginaddress" v-show="define" :disabled="true"></el-input>
        </el-col>
        <el-col :span="4">
         <el-button size="medium" @click="magicVisibleOne = true;GetMagicLinkAddressByID(editmacform.linkid)" v-show="define" >设置链接</el-button>
        </el-col>
       </el-form-item>
    </el-form>
   <span slot="footer" class="dialog-footer">
    <el-button @click="EditMacDialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="UpdateEditMacgin('editmacform');">确 定</el-button>
   </span>
  </el-dialog>

  <el-dialog
  title="设置链接地址"
  :visible.sync="magicVisibleOne"
  width="30%"
  center>
  <el-form label-width="90px">
     <el-form-item label="连接类型">
         <el-radio-group v-model="form.gender">
            <el-radio :label="item.id" :value="item.id" v-for="(item,index) in defineOptions" :key="index" @change="selectItem(item.id)">{{item.name}}</el-radio>
         </el-radio-group>
     </el-form-item>  
       <el-form-item label="链接类型:" v-show="definetwo">
       <el-select v-model="value" placeholder="请选择">
        <el-option
        v-for="item in modelTtile"
        :key="item.id"
        :label="item.title"
        :value="item.id">
       </el-option>
      </el-select>
     </el-form-item>
     <el-form-item label="电话号码:" v-show="definethree">
       <el-input></el-input>
     </el-form-item>
     <el-form-item label="站外链接:" v-show="definefour">
       <el-input></el-input>
     </el-form-item>
  </el-form>
  <span slot="footer" class="dialog-footer">
    <el-button @click="magicVisibleOne = false">取 消</el-button>
    <el-button type="primary" @click="magicVisibleOne = false">确 定</el-button>
  </span>
</el-dialog>
 
 <!-- 编辑魔法导航 -->
   <el-dialog
     title="编辑魔方导航"
     :visible.sync="MagicNavigation"
     width="35%"
     center>
     <el-form  label-width="90px"  ref="editmarginform" :model="editmarginform" :rules="rules">
       <el-form-item label="导航标题:" required prop="margtitle">
         <el-input style="width:400px" v-model="editmarginform.margtitle"></el-input>
       </el-form-item>
       <el-form-item label="导航图标:" required prop="margImage" >
       <el-upload
         class="avatar-uploader"
          :data="magicData"
          action="https://upload.qiniup.com"
           :on-success="MagicSuccess"
          :before-upload="MagicUpload"
         :show-file-list="false">
         <img v-if="editmarginform.margImage" :src="editmarginform.margImage" class="avatar">
         <i v-else class="el-icon-plus avatar-uploader-icon"></i>
       </el-upload>
       </el-form-item>
       <el-form-item label="跳转设置" required prop="jumpset">
         <el-radio-group v-model="editmarginform.jumpset">
            <el-radio :label="gender.id" :value="gender.id" v-for="(gender, index) in genderOptions" :key="index" @change="rotationGender(gender.id)">{{gender.name}}</el-radio>
          </el-radio-group>
       </el-form-item>
       <el-form-item>
         <el-col :span="15">
           <el-input style="width:300px" v-model="editmarginform.marginaddress" v-show="definefive" :disabled="true"></el-input>
        </el-col>
        <el-col :span="4">
         <el-button size="medium" @click="magicVisible=true" v-show="definefive">设置链接</el-button>
        </el-col>
       </el-form-item>
     </el-form>
    <span slot="footer" class="dialog-footer">
    <el-button @click="MagicNavigation = false">取 消</el-button>
    <el-button type="primary" @click="AddMagicNavi('editmarginform');">确 定</el-button>
  </span>
</el-dialog> 

<el-dialog
  title="设置链接地址"
  :visible.sync="magicVisible"
  width="30%"
  center>
  <el-form label-width="90px" ref="maclinkform" :model="maclinkform">
     <el-form-item label="连接类型">
         <el-radio-group v-model="maclinkform.linkType">
            <el-radio :label="item.id" :value="item.id" v-for="(item,index) in defineOptions" :key="index" @change="selectItemtwo(item.id)">{{item.name}}</el-radio>
         </el-radio-group>
     </el-form-item>  
       <el-form-item label="链接类型:" v-show="definetwo">
       <el-select v-model="maclinkform.instationlink" placeholder="请选择" clearable>
        <el-option
        v-for="item in modelTtile"
        :key="item.id"
        :label="item.title"
        :value="item.id">
       </el-option>
      </el-select>
     </el-form-item>
     <el-form-item label="电话号码:" v-show="definethree">
       <el-input v-model="maclinkform.phone"></el-input>
     </el-form-item>
     <el-form-item label="站外链接:" v-show="definefour">
       <el-input v-model="maclinkform.outstationlink"></el-input>
     </el-form-item>
  </el-form>
  <span slot="footer" class="dialog-footer">
    <el-button @click="magicVisible = false">取 消</el-button>
    <el-button type="primary" @click="AddMagiclinkData('maclinkform');">确 定</el-button>
  </span>
</el-dialog>

<!-- 编辑轮播图 -->
 <el-dialog
  title="编辑轮播图"
  :visible.sync="editRotionImages"
  width="35%"
  center>
  <el-form label-width="90px" ref="editrotationform" :model="editrotationform" :rules="rules">
      <el-form-item label="图片编辑:">
        <el-upload
          :data="rotationData"
          class="avatar-uploader"
          action="https://upload.qiniup.com"
          :show-file-list="false"
          :on-success="rotationAvatarSuccess"
          :before-upload="rotationAvatarUpload">
          <img v-if="editrotationform.images" :src="editrotationform.images" class="avatar">
          <i v-else class="el-icon-plus avatar-uploader-icon"></i>
        </el-upload>
      </el-form-item>
      <el-form-item label="排序值:" required prop="sort">
          <el-input v-model="editrotationform.sort" type="number"></el-input> 
      </el-form-item>
      <el-form-item label="图片链接:">
          <el-radio-group v-model="editrotationform.piclink">
           <el-radio :label="gender.id" :value="gender.id" v-for="(gender, index) in genderPicLink" :key="index" @change="select(gender.id)">{{gender.name}}</el-radio>
        </el-radio-group>
      </el-form-item>
       <el-form-item label="链接地址:" v-show="selectone">
        <el-col :span="15">
          <el-input v-model="editrotationform.linkaddress"  style="width:300px"></el-input>
        </el-col>
        <el-col :span="4">
          <el-button size="medium"  v-show="selectone" @click="rotationVisible = true;GetRotationVisibleByLinkId(editrotationform.linkid)">设置链接</el-button>
        </el-col>
    </el-form-item>
  </el-form>
  <span slot="footer" class="dialog-footer">
    <el-button @click="editRotionImages = false">取 消</el-button>
    <el-button type="primary" @click="updateRotionImages('editrotationform');editRotionImages = false">确 定</el-button>
  </span>
</el-dialog>


<!-- 设置轮播图链接地址 -->
<el-dialog
  title="设置链接地址"
  :visible.sync="rotationVisible"
  width="30%"
  center>
  <el-form label-width="90px"  ref="rotationvisibleform" :model="rotationvisibleform">
     <el-form-item label="站外链接:">
       <el-input v-model="rotationvisibleform.defineaddress"></el-input>
     </el-form-item>
  </el-form>
  <span slot="footer" class="dialog-footer">
    <el-button @click="rotationVisible = false">取 消</el-button>
    <el-button type="primary" @click="AddRotationVisibleForm('rotationvisibleform');">确 定</el-button>
  </span>
</el-dialog>
</div>
</template>

<script>
   import { AddRotationChart, saveHispital,addOffices,AddDoctor,AddDoctorInfo,AddImages,AddOfficeEnvironment,getQueryDocInfo,change,
   getQueryDoCHead,editDoctor,saveDocInfo,deleteDoctor,AddImageslink,getEditImages,AddMagicNavi,getMagicImages,AddMarginChart,
   deleteRotations,editRotationImages,updateRotionImages,addActiveform,deleteMargin,getEditImagesDetail,UpdateEditMacgin,getArticleType
   ,AddArticeList,getEnImages,EditEnvirImages,AddtwoImages,deleteOfficeById,GetArticleById,GetAllActivity,AddLinkAddress,AddMagiclinkData,
   getMacLinkAddress,getCountImages,getAllModelTitle, GetMagicLinkAddressByID,GetRotationVisibleByLinkId,AddRotationVisibleForm} from '@/api/site/site'  
   import { getToken } from '@/api/qiniu'
   import { getFileExtension} from '@/utils/tools'
   import { isIP, isIPv4 } from 'net';
   import { quillEditor } from 'vue-quill-editor'
   import Neditor from '@/components/Neditor'
   import 'quill/dist/quill.core.css'
   import 'quill/dist/quill.snow.css'
   import 'quill/dist/quill.bubble.css'
   import { constants } from 'crypto';
   import { fail } from 'assert';
   import { get } from 'http';
   import {checkNumber,checkSort} from "@/utils/tools";
export default {
  name: "newfeature",
  components:{
     Neditor,
  },
  data() {
     
     var checkNumberRule = (rule, value, callback) => {
            if (!checkNumber(value)) {
                 callback(new Error('请输入1-99的整数'));
              }else {
               callback(); 
             }
          };

     var checkSortRule = (rule,value,callback)=>{
       if(!checkSort(value)){
          callback(new Error('请输入1-9的整数'));
       }else{
         callback();
       }
     }     
    return {
      rotationvisibleform:{
         id:"",
         defineaddress:"",
      },
       genderPicLink:[
         {id:1,name:"无"},
         {id:2,name:"自定义"},
       ],
      genderOptions:[
        {id:1, name:'自定义'},
        {id:2, name:'不跳转'},
       ],
       genderOption:[
         {id:1,name:'自定义'},
         {id:2,name:'无'},
       ],
      defineOptions:[
        {id:1,name:'无'},
        {id:2,name:'站内链接'},
        {id:3,name:'电话'},
        {id:4,name:'站外链接'},
      ],  
      defineOptionsTwo:[
        {id:1,name:'无'},
        {id:2,name:'站内链接'},
        {id:3,name:'站外链接'}
      ],
      defineOptionsThree:[
         {id:1,name:'站外链接'}
      ],
      options: [
         {id:1,name:"文章"},
         {id:2,name:"活动"}, 
         {id:3,name:"肾科咨询"},
         {id:4,name:"肾科动态"},
         {id:5,name:"肾科科普"},
         {id:6,name:"生活"},
         {id:7,name:"肾友故事"}, 
        ], 
        
      modelTtile:[],   
        id:0,   
       articeType:[
         {id:1,name:"SCRM"},
         {id:2,name:"酷医云"},  
       ],
       linkform:{
          id:"",
          connectType:"",
          linkType:"",
          addtype:"",
          contenttype:"",
          linkaddress:"",
          defineAddress:"",
       },
       maclinkform:{
         linkType:'',
         instationlink:'',
         phone:'',
         outstationlink:'',
       },
       articeTypelist:[],
       acticeNamelist:[],
       headshow:false,
       define:false,
       definetwo:false,
       definethree:false,
       definefour:false,
       definefive:true,
       selectone:false,
       rotationVisible:false,
       officeVisible:false,
       officetwoVisible:false,
       addpicdialogVisible:false,
       isEmpty:false,
       isImages:false,
       isNoEmpty:true,
       docnames:[],
       addTypeShow:false,
       radio: '1',
       radiotwo:'2',
       positions:[
          { index: 1, name: '医士' },
          { index: 2, name: '医师' },
          { index: 3, name: '住院医师' },
          { index: 4, name: '主治医师' },
          { index: 5, name: '副主任医师' },
          { index: 6, name: '主任医师' },
          { index: 7, name: '护士' },
          { index: 8, name: '护师' },
          { index: 9, name: '主管护师' },
          { index: 10, name: '副主任护师' },
          { index: 11, name: '主任护师' },
          { index: 12, name: '运营专员' },
       ],
       form:{
         gender:"",
       },
       value: '',
      new1: require("../../../assets/preview/轮播图.png"),
      new2: require("../../../assets/preview/医院介绍.png"),
      new3: require("../../../assets/preview/科室介绍.png"),
      new4: require("../../../assets/preview/名医介绍.png"),
      new5: require("../../../assets/preview/科室环境.png"),
      new6: require("../../../assets/preview/文章列表.png"),
      new7: require("../../../assets/preview/活动列表.png"),
      new8: require("../../../assets/preview/魔方导航.png"),
      dialogVisible: false,
      dialogRotationVisible: false,
      editcenterDialogVisible: false,
      EditMacDialogVisible:false,
      addpicVisible:false,
      MagicNavigation:false,
      magicVisible:false,
      magicVisibleOne:false,
      editRotionImages:false,
      radio: '1',
      two: false,
      three: false,
      four: false,
      five: false,
      six: false,
      seven: false,
      eight: false,
      linkVisible:false,
      dialogImageUrl: '',
      disabled: false,
      qiniuDomain: 'https://images.shengws.com/',
      uploadData: { token: '', key: '' },
      doctorData: { token: '', key: '' },
      doctorDatatwo:  { token: '', key: '' },
      rotationData: { token:'',key: '' },
      magicData:{ token:'',key:''},
      keData: { token: '' ,key: ''},
      imageData: { token:'',key: ''},
      file: this.image ? this.image : '',
      hideShow:false,
      show:false,
      centerDialogVisible:false,
      rotationdata:[],
      rotationdatatwo:[],
      margindata:[],
      filelist:[],
      radio:3,
      form: {
        name: "",
        sort:"", 
        textarea:"",
        image:"",
      },
      docform:[],
      hispitalform:{
        title:"",
        sort:"",
        introduction:"",
      },
      administform:{
         title:"",
         sort:"",
         introduction:"", 
      },
      doctorform:{
        title:"",
        sort:"",
        image:"",
        docimages:[],
        ids:[],
      },
      editdocfrom:{
        doc_name:"",
        dochead:"",
        doc_postion:"",
        doc_sort:"",
        docintroduction:"",
      },
      eidtDoctorform:{
       id:"",
       name:"",
       dochead:"",
       user_title:"",
       sort:"",
       content:"",
      },
      rotationform:{
        title:"",
        sort:"",
        rotationImages:[],
        ids:[],
      },
       marginform:{
         title:"",
         sort:"",
         marginImages:[],
         margintTitle:[],
         ids:[],
      }, 
      editmarginform:{
        id:"",
        margtitle:"",
        margImage:"",
        marginaddress:"",
        jumpset:1,
        linkid:"",
      },
      keform:{
        title:"",
        sort:"",
        keImages:[],
        ids:[],
      },
      picform:{
        id:"",
        imageUrl:"",
        sort:"",
        imagelink:1,
        linkaddress:"",
      },

      editrotationform:{
          images:"",
          sort:"",
          piclink:"",
          linkaddress:"",
      },
      activeform:{
         title:"",
         sort:"",
         number:"",
      },

      articeform:{
        title:"",
        sort:"",
        category:"",
        categoryone:"",
        number:"",
      },
      editmacform:{
         margtitle:"",
         margimage:"",
         marginaddress:"",
         jumpset:"",
      },
      officeform:{
         enviroimages:"",
         sort:"",
      },
      officetwoform:{
        enviroimages:"",
        sort:"",
      },
      articeNamelist:[],
      patientRotation:[],
      totalImages:0,
      linkformtwo:{
        address:"",
      },
       rules: {
         title: [{required: true, message: "请填写模块标题",},],
         sort: [{required: true,message:"请填写排序值"},{validator:checkNumberRule}],
         introduction: [{required: true,message:"请填写医院介绍"}],
         image: [{required: true,message:"请填写新增名医"}],
         docname: [{required:true,message:"请填写医生姓名"}],
         doc_name:[{required:true,message:"请填写医生姓名"}],
         docHead: [{required: true,message:"请上传医生头像"}],
         dochead: [{required: true,message:"请上传医生头像"}],
         docpositional:[{required:true,message:"请填写医生职位"}],
         doc_postion:[{required:true,message:"请填写医生职位"}],
         docintroduction:[{required:true,message:"请填写医生简介"}],
         images:[{required:true,message:"请填写新增科室环境"}],
         rotationImages:[{required:true,message:"请填写添加图片"}],
         keimages:[{required:true,message:"请填写新增科室环境"}],
         user_title:[{required:true,message:"请填写医生职称"}],
         docimages:[{required:true,message:"请填写新增名医"}],
         imageUrl:[{required:true,message:"请填写图片编辑"}],
         margtitle:[{required:true,message:"请填写导航标题"}],
         address:[{required:true,message:"请填写链接地址"}],
         number:[{required:true,message:"请填写活动条数"},{validator:checkSortRule}],
         enviroimages:[{required:true,message:"请上传图片"}],
         marginImages:[{required:true,message:"请添加图片"}],
         jumpset:[{required:true,message:"请选择跳转设置"}],
         margImage:[{required:true,message:"请上传导航图标"}],
         name:[{required:true,message:"请选择医生姓名"}],
      },
    };
  },
  // 医院介绍模块
  methods:{  
     changeInput(e){
            this.$forceUpdate();
     },
    changeType(id){
  
      if(id == 1){
        this.addTypeShow = true;
      }
      if(id == 2){
        this.addTypeShow = false;
        GetAllActivity(this.articeNamelist).then(response=>{
           if(response.data.state == 1){
             var activtity = response.data.data.activtity;
             this.articeNamelist = response.data.data.activtity;
           }
        })
      }
    },
    GetArticleById(id){
      GetArticleById(id,this.linkform).then(response=>{
        if(response.data.state == 1){
          var articlelist = response.data.data.articlelist;
          this.articeNamelist = response.data.data.articlelist;        
        }
      })
    },
    AddLinkAddress(formName){
      this.$refs[formName].validate((valid)=>{
        if(valid){
           AddLinkAddress(this.linkformtwo.address).then(response=>{              
              if(response.data.state == 1){
                this.linkVisible = false;
                var linkaddress =  response.data.data.patientLinkaddress;
                this.picform.linkaddress = linkaddress.defineaddress;
                this.picform.id = linkaddress.id;
                this.linkformtwo.address = "";
                console.log("数据返回",linkaddress)
              }
           })
        }
      })
    },

    OpenCreate(){
       this.$refs.newfeature.Open();
    },
     //轮播图
     rotationEditImages(){
        this.dialogRotationVisible = true;
     },

      imageUploadSuccess(res,file) {
        console.log("上传的数据是什么",this.qiniuDomain+res.url)
        this.doctorform.docimages.push(this.qiniuDomain + res.url)
      },
      beforeUpload(file) {   
        var fileType = file.type
        const isJPG = fileType.indexOf("image") > -1;
        const isLt2M = file.size / 1024 / 1024 < 2;
        if (!isJPG) {
          this.$message.error("只能上传图片");
           return false;
          }
         if (!isLt2M) {
           this.$message.error("图片大小不能超过 2MB!");
           return false;
         }
           var date = new Date()
            var ext = getFileExtension(file.name)
            var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours()  + date.getMinutes()  + date.getSeconds()  +'_o_' + file.uid + '.' + ext;
            this.uploading = true;
            this.loadingText = '封面图片上传中'

            const _self = this
            return new Promise((resolve, reject) => {
                getToken().then(response => {
                  
                    const tokentree = response.data.data.uptoken
                    console.log("token是什么?",tokentree)
                    _self._data.doctorData.token = tokentree;
                    _self._data.doctorData.key = key;
                    resolve(true)
                }).catch(err => {
                    reject(false)
                    this.uploading = false;
                })
            })

        },

        rotationSuccess(res,file){
          this.picform.imageUrl = this.qiniuDomain + res.url;
          this.isImages = true;      
        },
  
        rotationUpload(file){
            var fileType = file.type
            const isJPG = fileType.indexOf("image") > -1;
            const isLt2M = file.size / 1024 / 1024 < 2;
            console.log("我爱你中国我爱你中奴工")
            console.log(fileType,isJPG,isLt2M)
            if (!isJPG) {
                this.$message.error("只能上传图片");
                return false;
            }
            if (!isLt2M) {
                this.$message.error("图片大小不能超过 2MB!");
                return false;
         }
           var date = new Date()
           console.log("date是",date)
            var ext = getFileExtension(file.name)
            console.log("ext",ext)
            var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours()  + date.getMinutes()  + date.getSeconds()  +'_o_' + file.uid + '.' + ext;   
            console.log("key",key)
            const _self = this
            return new Promise((resolve, reject) => {
                getToken().then(response => {
                    console.log("我爱你中国")
                    const tokentree = response.data.data.uptoken;
                    console.log("图片编辑token是什么?",tokentree)
                    _self._data.imageData.token = tokentree;
                    _self._data.imageData.key = key;
                    resolve(true)
                }).catch(err => {
                    reject(false)
                })
            })    
        },
        handleRemove() {
            this.file = '';
      },
     
      handleAvatarSuccess(res, file) {
         this.eidtDoctorform.dochead = this.qiniuDomain + res.url;  
      },

    
      beforeAvatarUpload(file) {
        console.log("尺寸",file.size)
        const isJPG = file.type === 'image/jpeg';
        const isLt2M = file.size / 1024 / 1024 < 2;
       
        if (!isJPG) {
          this.$message.error('上传头像图片只能是 JPG 格式!');
        }
        if (!isLt2M) {
          this.$message.error('上传头像图片大小不能超过 2MB!');
        }
      
         var date = new Date()
            var ext = getFileExtension(file.name)
            var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours()  + date.getMinutes()  + date.getSeconds()  +'_o_' + file.uid + '.' + ext;
            this.uploading = true;
            this.loadingText = '封面图片上传中'

            const _self = this
            return new Promise((resolve, reject) => {
                getToken().then(response => {
                    const token= response.data.data.uptoken
                    console.log("医生头像token是什么?",token)
                    _self._data.doctorData.token = token;
                    _self._data.doctorData.key = key;
                    resolve(true)
                }).catch(err => {
                    reject(false)
                    this.uploading = false;
                })
            })
          return isJPG && isLt2M;
      },

      handleAvatarSuccesstwo(res,file){
        this.editdocfrom.dochead = this.qiniuDomain + res.url;
      },

       beforeAvatarUploadtwo(file) {
        console.log("尺寸",file.size)
        const isJPG = file.type === 'image/jpeg';
        const isLt2M = file.size / 1024 / 1024 < 2;
       
        if (!isJPG) {
          this.$message.error('上传头像图片只能是 JPG 格式!');
        }
        if (!isLt2M) {
          this.$message.error('上传头像图片大小不能超过 2MB!');
        }
      
         var date = new Date()
            var ext = getFileExtension(file.name)
            var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours()  + date.getMinutes()  + date.getSeconds()  +'_o_' + file.uid + '.' + ext;
            this.uploading = true;
            this.loadingText = '封面图片上传中'

            const _self = this
            return new Promise((resolve, reject) => {
                getToken().then(response => {
                    const token= response.data.data.uptoken
                    console.log("医生头像token是什么?",token)
                    _self._data.doctorDatatwo.token = token;
                    _self._data.doctorDatatwo.key = key;
                    resolve(true)
                }).catch(err => {
                    reject(false)
                    this.uploading = false;
                })
            })
          return isJPG && isLt2M;
      },

      MagicSuccess(res,file){
         this.editmarginform.margImage =this.qiniuDomain + res.url;
      },

      MagicUpload(file){
            var fileType = file.type
            const isJPG = fileType.indexOf("image") > -1;
            const isLt2M = file.size / 1024 / 1024 < 2;
            if (!isJPG) {
                this.$message.error("只能上传图片");
                return false;
            }
            if (!isLt2M) {
                this.$message.error("图片大小不能超过 2MB!");
                return false;
         }
      
         var date = new Date()
            var ext = getFileExtension(file.name)
            var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours()  + date.getMinutes()  + date.getSeconds()  +'_o_' + file.uid + '.' + ext;       
            this.loadingText = '封面图片上传中'
            const _self = this
            return new Promise((resolve, reject) => {
                getToken().then(response => {
                    const token= response.data.data.uptoken
                    console.log("导航头像token是什么?",token)
                    _self._data.magicData.token = token;
                    _self._data.magicData.key = key;
                    resolve(true)
                }).catch(err => {
                    reject(false)                    
                })
            })
          return isJPG && isLt2M;
      },

      rotationAvatarSuccess(res,file){
         this.editrotationform.images = this.qiniuDomain + res.url;
      },
      rotationAvatarUpload(file){
            var fileType = file.type
            const isJPG = fileType.indexOf("image") > -1;
            const isLt2M = file.size / 1024 / 1024 < 2;
            if (!isJPG) {
                this.$message.error("只能上传图片");
                return false;
            }
            if (!isLt2M) {
                this.$message.error("图片大小不能超过 2MB!");
                return false;
         }
      
         var date = new Date()
            var ext = getFileExtension(file.name)
            var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours()  + date.getMinutes()  + date.getSeconds()  +'_o_' + file.uid + '.' + ext;       
            this.loadingText = '封面图片上传中'
            const _self = this
            return new Promise((resolve, reject) => {
                getToken().then(response => {
                    const token= response.data.data.uptoken
                    console.log("导航头像token是什么?",token)
                    _self._data.rotationData.token = token;
                    _self._data.rotationData.key = key;
                    resolve(true)
                }).catch(err => {
                    reject(false)                    
                })
            })
          return isJPG && isLt2M;
      },

      machandleAvatarSuccess(res){
         this.editmacform.margimage = this.qiniuDomain + res.url;
      },
      macbeforeAvatarUpload(file){
            var fileType = file.type
            const isJPG = fileType.indexOf("image") > -1;
            const isLt2M = file.size / 1024 / 1024 < 2;
            if (!isJPG) {
                this.$message.error("只能上传图片");
                return false;
            }
            if (!isLt2M) {
                this.$message.error("图片大小不能超过 2MB!");
                return false;
         }
      
         var date = new Date()
            var ext = getFileExtension(file.name)
            var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours()  + date.getMinutes()  + date.getSeconds()  +'_o_' + file.uid + '.' + ext;       
            this.loadingText = '封面图片上传中'
            const _self = this
            return new Promise((resolve, reject) => {
                getToken().then(response => {
                    const token= response.data.data.uptoken
                    console.log("导航头像token是什么?",token)
                    _self._data.rotationData.token = token;
                    _self._data.rotationData.key = key;
                    resolve(true)
                }).catch(err => {
                    reject(false)                    
                })
            })
          return isJPG && isLt2M;
      },

      //新增轮播图
      AddRotationChart(formName){
            var sorts =  this.rotationform.sort;
            var sort = parseInt(sorts);
            this.rotationform.sort = sort;
            for (let index = 0; index < this.rotationdatatwo.length; index++) {
                console.log("长度",this.rotationdatatwo.length)    
                this.rotationform.ids.push(this.rotationdatatwo[index].id) 
                this.rotationform.rotationImages.push(this.rotationdatatwo[index].images)                                        
          }             
          console.log("this.rotationform.rotationImages是什么",this.rotationform.rotationImages)
          this.$refs[formName].validate((valid)=>{
            if(valid){
              AddRotationChart(this.rotationform).then(response=>{
                  if(response.data.state==1){
                    var rotation =  response.data.data.rotation;
                    var patientRotation = response.data.data.patientRotation;
                    this.patientRotation = response.data.data.patientRotation;
                    console.log("查询出每条轮播数据",patientRotation)
                    this.$message.success("添加轮播图成功");
                    this.dialogVisible = false;
                    this.$emit('getHospitaldata');
                    this.rotationform.title = "";
                    this.rotationform.sort = "";
                    this.rotationform.rotationImages = [];  
                    this.rotationform.ids=[];
                    this.isEmpty = false;
                    this.totalImages = 0;
                  }
              })
            }
          })  
      },
      


    //医院介绍
     saveHispital(formName){
         this.hispitalform.introduction = this.$refs.neditor.content;
        console.log("文章内容",this.$refs.neditor.content)  
        this.$refs[formName].validate((valid)=>{
          if(valid){
             saveHispital(this.hispitalform).then(response=>{
                  if(response.data.state==1){
                    var hospital = response.data.data.hospital;
                    //console.log("返回数据",hospital)
                     this.$message.success("添加医院介绍成功");  
                     this.two = false;  
                     this.$emit('getHospitaldata')
                  }
             })
          }
        })
     },

     //科室介绍
     addAdminist(formName){
       this.administform.introduction = this.$refs.neditor.content;
        this.$refs[formName].validate((valid)=>{
          if(valid){
             addOffices(this.administform).then(response=>{
                 if(response.data.state==1){
                    var offices = response.data.data.offices;
                   // console.log("返回数据",offices);
                    this.$message.success("添加科室介绍成功");
                    this.three = false;
                     this.$emit('getHospitaldata')
                 }
             })
          }
        })
     },

     //名医介绍
     AddDoctor(formName){ 
          var images = [];  
          var ids = [];  
          for (let index = 0; index < this.docform.length; index++) {
            images.push(this.docform[index].dochead); 
            ids.push(this.docform[index].id);     
          }      
          this.doctorform.docimages = images,    
          this.doctorform.ids = ids;    
         this.$refs[formName].validate((valid)=>{
           if(valid){
              AddDoctor(this.doctorform).then(response=>{
                // console.log("啊啊啊",this.doctorform);
                if(response.data.state==1){
                  var doctor = response.data.data.doctor;
                  // console.log("返回数据",doctor)
                  this.headshow = false;
                  this.four = false;
                  this.docform = "";
                  this.doctorform = "";
                   this.$emit('getHospitaldata')
                }
              })
           }
         })
     },

      getQueryDocInfo(){
        getQueryDocInfo(this.doctorform).then(response=>{
              if(response.data.state==1){
                 this.docnames = response.data.data.doctor;
                 console.log("获取医生信息",response.data.data.doctor)
              }
        })
      },
      //获取医生头像
      getQueryDoCHead(){
        getQueryDoCHead().then(response=>{
          if(response.data.state==1){
            var docHead =  response.data.data.docHead;
            this.docform =  response.data.data.docHead;
            console.log("aaa",response.data.data.docHead)
            this.headshow = true;
            console.log("头像数据返回",docHead)
          }
        })
      },
      change(id){
        change(id).then(response=>{
            if(response.data.state == 1){
              var docinfo =  response.data.data.docinfo;
              this.eidtDoctorform = response.data.data.docinfo;
             console.log("编辑医生返回数据",docinfo);

            }
        })
      },
     editDoctor(id){ 
        editDoctor(id).then(response=>{
           if(response.data.state ==1){
             var docionfo = response.data.data.docinfo;
             this.editdocfrom = response.data.data.docinfo;             
             console.log("数据",docionfo);
           }
        });
     },

     deleteDoctor(id,index){
       this.$confirm('确认要删除吗?删除后信息将无法恢复','删除提示!',{
         dangerouslyUseHTMLString:true,
             confirmButtonText: '确定',
             cancelButtonText: '取消',
             type: 'warning'
       }).then(()=>{
           deleteDoctor(id,index).then(response=>{
              if(response.data.state == 1){
                this.docform.splice(index,1)
              }
           }).catch(e=>{});
       }).catch(e=>{});
     },
     //编辑医生介绍
     AddDoctorInfo(formName){
         this.$refs[formName].validate((valid)=>{
           if(valid){
             AddDoctorInfo(this.eidtDoctorform).then(response=>{
               if(response.data.state==1){
                 var doctor =  response.data.data.doctor;
                 this.centerDialogVisible = false;
                 this.eidtDoctorform.dochead = "";
                 this.eidtDoctorform.sort = "";
                 this.eidtDoctorform.content = "";
                 this.getQueryDoCHead();
               }
             })
           }
         })
     }, 
     saveDocInfo(formName){
        this.$refs[formName].validate((valid)=>{
          if(valid){
                 var sorts = this.editdocfrom.doc_sort
                 var sort = parseInt(sorts)
                this.editdocfrom.doc_sort = sort
                 this.editdocfrom.docintroduction = this.$refs.neditor.content;
     
               saveDocInfo(this.editdocfrom.id,this.editdocfrom).then(response=>{
                  if(response.data.state == 1){
                     var doctor =  response.data.data.editdoctor;
                     console.log("返回数据",doctor);
                     this.editcenterDialogVisible = false;
                     this.$message.success("保存成功")
                     this.getQueryDoCHead();
                  }
              })
           }
        })
     
     },
      
      // 科室环境
      deleteKe(){
      },
      handleClose(){

      },
      officehandleAvatarSuccess(res){

         this.officeform.enviroimages = this.qiniuDomain + res.url;
      },
      officebeforeAvatarUpload(file){
             var fileType = file.type
            const isJPG = fileType.indexOf("image") > -1;
            const isLt2M = file.size / 1024 / 1024 < 2;
            if (!isJPG) {
                this.$message.error("只能上传图片");
                return false;
            }
            if (!isLt2M) {
                this.$message.error("图片大小不能超过 2MB!");
                return false;
            }

           var date = new Date()
            var ext = getFileExtension(file.name)
            var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours()  + date.getMinutes()  + date.getSeconds()  +'_o_' + file.uid + '.' + ext;
            this.uploading = true;
            this.loadingText = '图片上传中'

            const _self = this
            return new Promise((resolve, reject) => {
                getToken().then(response => {
                    const tokentree = response.data.data.uptoken
                    console.log("科室环境token是什么?",tokentree)
                    _self._data.keData.token = tokentree;
                    _self._data.keData.key = key;
                    resolve(true)
                }).catch(err => {
                    reject(false)
                    this.uploading = false;
                })
            })
      },
      
         officetwohandleAvatarSuccess(res){

         this.officetwoform.enviroimages = this.qiniuDomain + res.url;
      },

      officetwobeforeAvatarUpload(file){
           var fileType = file.type
            const isJPG = fileType.indexOf("image") > -1;
            const isLt2M = file.size / 1024 / 1024 < 2;
            if (!isJPG) {
                this.$message.error("只能上传图片");
                return false;
            }
            if (!isLt2M) {
                this.$message.error("图片大小不能超过 2MB!");
                return false;
            }

           var date = new Date()
            var ext = getFileExtension(file.name)
            var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours()  + date.getMinutes()  + date.getSeconds()  +'_o_' + file.uid + '.' + ext;
            this.uploading = true;
            this.loadingText = '图片上传中'

            const _self = this
            return new Promise((resolve, reject) => {
                getToken().then(response => {
                    const tokentree = response.data.data.uptoken
                    console.log("科室环境token是什么?",tokentree)
                    _self._data.keData.token = tokentree;
                    _self._data.keData.key = key;
                    resolve(true)
                }).catch(err => {
                    reject(false)
                    this.uploading = false;
                })
            })
      },


        //科室介绍
      imageKeSuccess(res,file){
        console.log("图片路径",file.url)
         this.keform.keImages.push(this.qiniuDomain + res.url);
         console.log("图片数组",this.keform.keImages)
      },
      beforekeUpload(file){
            var fileType = file.type
            const isJPG = fileType.indexOf("image") > -1;
            const isLt2M = file.size / 1024 / 1024 < 2;
            if (!isJPG) {
                this.$message.error("只能上传图片");
                return false;
            }
            if (!isLt2M) {
                this.$message.error("图片大小不能超过 2MB!");
                return false;
            }

           var date = new Date()
            var ext = getFileExtension(file.name)
            var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours()  + date.getMinutes()  + date.getSeconds()  +'_o_' + file.uid + '.' + ext;
            this.uploading = true;
            this.loadingText = '图片上传中'

            const _self = this
            return new Promise((resolve, reject) => {
                getToken().then(response => {
                    const tokentree = response.data.data.uptoken
                    console.log("科室token是什么?",tokentree)
                    _self._data.keData.token = tokentree;
                    _self._data.keData.key = key;
                    resolve(true)
                }).catch(err => {
                    reject(false)
                    this.uploading = false;
                })
            })
      },
      handleRemove(file, fileList) {
        console.log(file, fileList);
      },
    
     AddImages(formName){
            var sorts = this.officeform.sort
            var sort = parseInt(sorts)
            this.officeform.sort = sort
        this.$refs[formName].validate((valid)=>{
          if(valid){
          AddImages(this.officeform).then(response=>{
             this.getEnImages();
             this.officeform.sort = "";
             this.officeform.enviroimages = "";
             this.isEmpty = true;
           })
          }
        })
     },

     getEnImages(){
       getEnImages().then(response=>{
           if(response.data.state == 1){
            var enviroimages = response.data.data.enviroimages;
             this.rotationdata = response.data.data.enviroimages;

           }
       })
     },

     EditEnvirImages(id){
         EditEnvirImages(id,this.officetwoform).then(response=>{
            if(response.data.state == 1){
              this.officetwoform =   response.data.data.enviroimages
            }
         })
     },

     AddtwoImages(){
            var sorts = this.officetwoform.sort;
            var sort = parseInt(sorts);
            this.officetwoform.sort = sort;
       AddtwoImages(this.officetwoform.id,this.officetwoform).then(response=>{
          if(response.data.state ==  1){
             var patientEnviroimages =   response.data.data.patientEnviroimages;             
             console.log("patientenviroimages",patientEnviroimages)
             this.getEnImages();
          }
       }) 
     },


      AddOfficeEnvironment(formName){
         var sorts = this.keform.sort;
         var sort =   parseInt(sorts);
         this.keform.sort = sort;
         for (let index = 0; index < this.rotationdata.length; index++) {
             this.keform.keImages.push(this.rotationdata[index].enviroimages);     
             this.keform.ids.push(this.rotationdata[index].id)  
         }
         this.$refs[formName].validate((valid)=>{
           if(valid){
             AddOfficeEnvironment(this.keform).then(response=>{
                  if(response.data.state == 1){
                    var offenvironment = response.data.data.offenvironment;
                    this.five = false;
                    this.keform.sort = "";
                    this.keform.title = "";
                    this.keform.keImages = [];
                    this.keform.ids=[];
                    this.isEmpty = false;
                    console.log("返回数据",offenvironment);
                     this.$emit('getHospitaldata')
                  }
             })
           }
         })
      },
     selectGender(id){
        if(id == 1){
          this.define = true;
        }
        if(id == 2){
           this.define = false;
        }
     },
     rotationGender(id){
        if(id == 1){
            this.definefive = true;
        }
        if(id == 2){
           this.definefive = false;
        }
     },
     selectItem(id){
       if(id == 1){
         this.definetwo = false;
         this.definethree = false;
         this.definefour = false;
       }

       if(id==2){
          this.definetwo = true;
          this.definethree = false;
          this.definefour = false;
       }

       if(id==3){
         this.definethree = true;
         this.definetwo = false;
         this.definefour = false;
       }

       if(id==4){
         this.definefour = true;
         this.definetwo = false;
         this.definethree = false;
       }
     },
    selectItemTwo(id){
      this.definethree = true;
    },

     select(id){
        if(id == 1){
          this.selectone = false;
        }

        if(id == 2){
          this.selectone = true;
        }
     },
      selectItemtwo(id){
       if(id == 1){
         this.definetwo = false;
         this.definethree = false;
         this.definefour = false;
         this.maclinkform.instationlink = 0;
         this.maclinkform.phone = "";
         this.maclinkform.outstationlink = "";       
       }
       if(id==2){
          this.definetwo = true;
          this.definethree = false;
          this.definefour = false;
          this.maclinkform.phone = "";
          this.maclinkform.outstationlink = "";
       }

       if(id==3){
         this.definethree = true;
         this.definetwo = false;
         this.definefour = false;
         this.maclinkform.instationlink = 0
         this.maclinkform.outstationlink = "";
       }

       if(id==4){
         this.definefour = true;
         this.definetwo = false;
         this.definethree = false;
         this.maclinkform.instationlink = 0;
         this.maclinkform.phone = "";
       }
     },
        
     AddImageslink(formName){      
          var sorts = this.picform.sort
          var sort = parseInt(sorts)
          this.picform.sort = sort
         var imagelink = this.picform.imagelink
         var links =  parseInt(imagelink)
         this.picform.imagelink = links;
         
        this.$refs[formName].validate((valid)=>{
          if(valid){
             AddImageslink(this.picform.id,this.picform).then(response=>{
                if(response.data.state ==1){
                  var editpiclink = response.data.data.editpiclink;
                  var total = response.data.data.total;
                  this.totalImages = total;
                  if(total>=9){
                     this.isNoEmpty = false;
                  }
                  console.log("数据返回",editpiclink)
                  this.picform.linkaddress = "",
                  this.getEditImages();
                  this.isEmpty = true;
                  this.isImages = false;
                  this.picform.sort = "";
                  this.picform.imageUrl = "";
                }
             })
          }
        })
     },
     getEditImages(){
       getEditImages().then(response=>{
         if(response.data.state == 1){
          var editpiclinks = response.data.data.editpiclinks;
          this.rotationdatatwo = response.data.data.editpiclinks;
          // console.log("想不通是什么",this.rotationdatatwo)
           if(this.rotationdatatwo.images == ""){
              this.isEmpty = false;             
           }
         }
       })
     },

     AddMagicNavi(formName){
         if(this.editmarginform.linkid == ""){
            this.editmarginform.linkid = 0;
         }
        this.$refs[formName].validate((valid)=>{
          if(valid){
            AddMagicNavi(this.editmarginform).then(response=>{
              if(response.data.state == 1){
                this.editmarginform.marginaddress = "";
                this.getMagicImages();
                var editmargin  = response.data.data.editmargin;
                this.isEmpty = true;
                this.editmarginform.margtitle = "";
                this.editmarginform.margImage = "";
                this.editmarginform.jumpset = "";
                this.MagicNavigation = false;
                
              }
            })
          }
        }) 
     },

     getMagicImages(){
       getMagicImages().then(response=>{
           if(response.data.state == 1){
             var editmargins = response.data.data.editmargins;
             this.margindata = response.data.data.editmargins;
             this.isEmpty = true;
             console.log("这个魔方导航是什么",editmargins);
           }
       })
     },
       AddMarginChart(formName){
         var sorts = this.marginform.sort
          var sort = parseInt(sorts)
          this.marginform.sort = sort
          for (let index = 0; index < this.margindata.length; index++) {
            this.marginform.marginImages.push(this.margindata[index].margimage);  
            this.marginform.ids.push(this.margindata[index].id) 
            this.marginform.margintTitle.push(this.margindata[index].margtitle);       
          }

      this.$refs[formName].validate((valid)=>{
        if(valid){
          AddMarginChart(this.marginform).then(response=>{
             if(response.data.state ==1){
              var macnavigation = response.data.data.macnavigation;
              this.eight = false;
              console.log("数据",macnavigation);
              this.$emit('getHospitaldata')
              this.marginform.title = "";
              this.marginform.sort = "";
              this.marginform.marginImages = [];
              this.marginform.margintTitle = [];
              this.marginform.ids = [];
              this.isEmpty = false;
             }
          })
        }
      })
    },

    deleteRotations(id,index){
       this.$confirm('确认要删除该组件吗?删除后该组件将无法恢复','删除提示!',{
          dangerouslyUseHTMLString:true,
             confirmButtonText: '确定',
             cancelButtonText: '取消',
             type: 'warning'
       }).then(()=>{
         deleteRotations(id).then(response=>{
             if(response.data.state == 1){
               var total = response.data.data.total;
               this.totalImages = total;
               this.rotationdatatwo.splice(index,1)
               this.isNoEmpty = true;
             }
         })
       })
    },

    editRotationImages(id){
      editRotationImages(id).then(response=>{
          if(response.data.state == 1){
           var editpiclink = response.data.data.editpiclink;
           this.editrotationform = response.data.data.editpiclink;
           console.log("这是什么",editpiclink)
          }
      })
    },
    updateRotionImages(formName){
         var sorts = this.editrotationform.sort;
          var sort = parseInt(sorts);
          this.editrotationform.sort = sort;
       this.$refs[formName].validate((valid)=>{
         if(valid){
          updateRotionImages(this.editrotationform.id,this.editrotationform).then(response=>{
                 if(response.data.state == 1){
                   var editpiclink =  response.data.data.editpiclink;
                   console.log("返回数据",editpiclink)
                   this.getEditImages();
                   
                 }
          })
         }
       })
    },
    addActiveform(formName){
      var sorts = this.activeform.sort;
      var sort =  parseInt(sorts);
      this.activeform.sort = sort;
    
      var numbers = this.activeform.number;
      var number = parseInt(numbers);
      this.activeform.number = number;
     
     this.$refs[formName].validate((valid)=>{
       if(valid){
          addActiveform(this.activeform).then(response=>{
             if(response.data.state == 1){
               var addactivity =  response.data.data.addactivity;
               console.log("返回数据",addactivity);
               this.$emit('getHospitaldata')
             }
          });
       }
     })
    },
    deleteMargin(id,index){
      deleteMargin(id).then(response=>{
          if(response.data.state == 1){
              this.margindata.splice(index,1);
          }
      })
    },

     editImages(id){
      getEditImagesDetail(id,this.editmacform).then(response=>{
          if(response.data.state == 1){
           
             var editmargin = response.data.data.editmargin;
             if(editmargin.jumpset == 1){
                 this.define = true;
             }
             if(editmargin.jumpset == 2){
                this.define = false;
             }
             this.editmacform = editmargin;
             console.log("返回导航数据",editmargin)
          }
      })
    },

    UpdateEditMacgin(formName){
      this.$refs[formName].validate((valid)=>{
        if(valid){
         UpdateEditMacgin(this.editmacform.id,this.editmacform).then(response=>{
          if(response.data.state ==1){
            var editmargin = response.data.data.editmargin;
            this.EditMacDialogVisible = false;
            this.getMagicImages();
           }
         })
        }
      })
    },

    getArticleType(){
      getArticleType(this.articeTypelist).then(response=>{
          if(response.data.state == 1){
            var  category = response.data.data.category;
             this.articeTypelist = response.data.data.category;
            console.log("文章分类是什么",this.articeTypelist)
          }
      })
    },
    AddArticeList(formName){
           var sorts = this.articeform.sort;
           var sort =  parseInt(sorts);
           this.articeform.sort = sort;
          var number = this.articeform.number;
          var numbers = parseInt(number);
         this.articeform.number = numbers;
        this.$refs[formName].validate((valid)=>{
          AddArticeList(this.articeform).then(response=>{
              if(response.data.state == 1){
                 var articlelist =  response.data.data.articlelist;
                   console.log("文章列表",articlelist);
                    this.$emit('getHospitaldata');
              }
          })
        })
    },

      deleteOfficeById(id,index){
        deleteOfficeById(id,index).then(response=>{
            if(response.data.state == 1){
               this.rotationdata.splice(index,1)
            }
        })
     },
     changeArticeType(id){
        if(id == 1 ){
          this.getArticleType();
        }
        if(id == 2){
          
         
        }
        if(id == 3){
         
          
        }
       if(id == 4){
         
          
        }
       if(id == 5){
          
        
        }
       if(id == 6){
         
          
        }
       if(id == 7){
         
         
        }
     },
     AddMagiclinkData(formName){ 
         var instationlink =  this.maclinkform.instationlink;
         var instationlinks = parseInt(instationlink);
         this.maclinkform.instationlink = instationlinks;
        this.$refs[formName].validate((valid)=>{
          if(valid){
            AddMagiclinkData(this.maclinkform).then(response=>{
                if(response.data.state == 1){
                  var magiclink =  response.data.data.magiclink;
                   console.log("链接返回数据",magiclink)
                  var model =  response.data.data.model;
                  console.log("model是什么",model)
               if(model.mode_type == 1){
                    this.editmacform.marginaddress = "javascript:;";
                } 
                if(model.mode_type == 2){
                      this.editmarginform.marginaddress = "http://microweb.kuyicloud.com/#/hospitalIntroduction?id="+model.id+"&orgid="+this.$store.getters.xt_user.org_id;
                     
                }
                if(model.mode_type == 3){
                       this.editmarginform.marginaddress = "http://microweb.kuyicloud.com/#/officeIntroduction?id="+model.id+"&orgid="+this.$store.getters.xt_user.org_id;
                }
                 if(model.mode_type == 4){
                       this.editmarginform.marginaddress = "http://microweb.kuyicloud.com/#/medicalTeam?id="+model.id+"&orgid="+this.$store.getters.xt_user.org_id;
                }
               if(model.mode_type == 5){
                    this.editmacform.marginaddress = "javascript:;";
                }
                if(model.mode_type == 6){
                    this.editmarginform.marginaddress = "http://microweb.kuyicloud.com/#/news?id="+model.id+"&orgid="+this.$store.getters.xt_user.org_id;
                }
                 if(model.mode_type == 7){
                    this.editmarginform.marginaddress = "http://microweb.kuyicloud.com/#/activity?id="+model.id+"&orgid="+this.$store.getters.xt_user.org_id;
                }
                if(model.mode_type == 8){
                  this.editmacform.marginaddress = "javascript:;";
                }

                  if(magiclink.linktype ==3 && magiclink.phone != ""){
                     this.editmacform.marginaddress =  magiclink.phone;
                  }

                  if(magiclink.linktype == 4 && magiclink.outstationlink != ""){
                     this.editmacform.marginaddress =  magiclink.outstationlink;
                  }
                 this.editmarginform.linkid =  magiclink.id
                  this.maclinkform.instationlink = "";
                  this.maclinkform.phone = "";
                  this.maclinkform.outstationlink = "";
                   this.magicVisible = false;
                 
                }
            })
          }
        })
     },
     getMacLinkAddress(){
       getMacLinkAddress().then(response=>{
          if(response.data.state ==1){
             var magiclink =  response.data.data.magiclink;
            //  this.editmarginform.marginaddress = magiclink.linkaddress;
             console.log("返回链接数据",magiclink)
          }
       })
     },
    //  getCountImages(){
    //    getCountImages().then(response=>{
    //       if(response.data.state == 1){
    //        var total =  response.data.data.total;
    //        this.totalImages = total;
    //        console.log("total是什么",total)
    //       }
    //    })
    //  },
     getAllModelTitle(){
       getAllModelTitle().then(response=>{
          if(response.data.state == 1){
             var patientModels = response.data.data.patientModels;
             this.modelTtile = patientModels;
             console.log("模块标题是什么",patientModels)
          }
       })
     },
     GetMagicLinkAddressByID(id){
        GetMagicLinkAddressByID(id).then(response=>{
             if(response.data.state == 1){
              var magiclink =  response.data.data.magiclink;
              console.log("magiclink",magiclink)
              this.modelTtile.id = magiclink.linkaddress;
             }
        })
     },

     GetRotationVisibleByLinkId(id){
      GetRotationVisibleByLinkId(id).then(response=>{
          if(response.data.state == 1){
             var conlinkaddress =  response.data.data.conlinkaddress;
             console.log("conlikaddress",conlinkaddress)
            this.rotationvisibleform =  conlinkaddress;
          }
      })
     },
     AddRotationVisibleForm(formName){
       this.$refs[formName].validate((valid)=>{
         if(valid){
          AddRotationVisibleForm(this.rotationvisibleform.id,this.rotationvisibleform).then(response=>{
               if(response.data.state == 1){
                 this.rotationVisible = false;
                 var linkaddress =  response.data.data.linkaddress;
                 console.log("linkaddress",linkaddress);
                 this.editrotationform.linkaddress = linkaddress.defineaddress;
               }
          })
         }
       })
     }
  },  
  
   created(){
     this.getQueryDocInfo();
     this.getQueryDoCHead();  
     this.getEditImages();
     this.getMagicImages();
     this.getArticleType();
     this.getEnImages();
     this.getMacLinkAddress();
    //  this.getCountImages();
     this.getAllModelTitle();
   },
 
 };
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
     .tpic{
       margin-left: 50px;
     }

     .eidtRotationimages{
       text-align: center;
       margin-bottom: 12px;
     }
         
     .clearfix {
        clear: both;
    }

    .el-upload--picture-card {
      width: 80px !important;
      height: 80px !important;
      line-height: 80px !important;
   }
   .tips {
    font-size: 12px;
    line-height: 18px;
  }
  .adddoc{
    font-size: 14px;
  }

    //上传样式
    .uploadfont{
      font-size: 14px;
      margin-left: 75px;
    }
    // 名医介绍样式
    .flex-img {
        display: flex;
    }

    .image-uploader {
        background-color: #fbfdff;
        border: 1px dashed #c0ccda;
        width: 148px;
        height: auto;
        cursor: pointer;
        line-height: 146px;
        text-align: center
    }

    .image-uploader {
        font-size: 28px;
        color: #8c939d;
    }

    //编辑名医样式
  .avatar-uploader{
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    width: 100px;
    height: 100px;
  }
  .avatar-uploader{
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 50px;
    height: 50px;
    line-height: 50px;
    margin-left: 25px;
    margin-top: 25px;
    text-align: center;
  }  

  .upic{
    width: 100px;
    height:100px;
    border: dashed 1px #409EFF;
    background-color: white;
    font-size: 30px;
  }
  .icon{
    width: 40px;
    height: 40px;
    // border: solid 1px red;
    margin-left: 30px;
    margin-top: 30px;
  }
  .ufont{
    width:80px;
    height: 28px;
    // border:solid 1px red;
    margin-left: 20px;
    margin-top: -20px;
    font-size: 14px;
  }

  .addrot{
    width:100px;
    height: 100px;
    border: dashed 1px #409EFF;
    margin-left: 10px;
    background-color: white;
  }
  .addrotone{
    font-size: 30px;
    width:50px;
    height: 50px;
    // border: solid 1px red;
    margin-left: 35px;
    margin-top: 35px;
  }
  .addrotwo{
    width:60px;
    height: 30px;
    // border: solid 1px #409EFF;
    margin-left: 25px;
    margin-top: -25px;
  }

  .doc{
    width: 100px;
    height:100px;
    border: dashed 1px #409EFF;
  }

  .docone{
    width: 50px;
    height: 50px;
    // border: solid 1px red;
    margin-top: 30px;
    margin-left: 30px;
    font-size: 30px;
  }
  .doctwo{
    width: 60px;
    height: 30px;
    margin-left: 20px;
    // border: solid 1px red;
    margin-top: -30px;
  }

  .el-upload-list--picture-card .el-upload-list__item {
    overflow: hidden; 
    background-color: #fff; 
    border: 1px solid #c0ccda;
    border-radius: 6px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    width: 100px;
    height: 100px;
    margin: 0 8px 8px 0;
    display: inline-block;
   }

   .flex-img__image{
     width: 100%;
     height: 100%;
   }
   .el-upload-list--picture-card .el-upload-list__item-thumbnail {
    width: 100%;
    height: 200px;
  }
  .avatar{
    width:100%;
    height: 100px;
  }

  .yangshi{
    font-size: 14px;
    margin-top: 25px;
  }
  .el-upload-list--picture-card .el-upload-list__item-actions .el-upload-list__item-delete {
    position: static;
    font-size: inherit;
    color: inherit;
    margin-top: 30px;
}
</style>

