const $ = require("jquery");
const {getUrlArgObject,config,post} = require('./promise.js');
require('../css/generalTreat.less') 
$(function(){
  let disName = getUrlArgObject("name") ||''
  let showName = getUrlArgObject("disName") ||''
  let generalTreatInfo = ''
  function getInfomation() {
    var param = {
      "type": '1',
      "name": disName,
      "position": '',
      "contentTypes":[4]
    };
    post(config.information, param).then((res) => {
      const data = res.data.data
      // if (!data) {
      //   $("h1").html("暂时没有数据");
      //   $(".anchors").css("display", "none");
      //   return;
      // }
      var detailList = data.details
      generalTreatInfo = detailList['治疗方案'][0].content
      // console.log(generalTreatInfo)
      renderGeneralTreat(generalTreatInfo,'一般治疗')
    })
  }
  getInfomation();

  function renderGeneralTreat(list,name){
    if(list.length === 0){
      return
    }
    // let str = `<p>${name}</p>`
    let str = `<p class="contentTitle">${showName}</p>`
    str+= `<div class="preDom">${generalTreatInfo}</div>`
    $(".content").append(str)
  }
})