<template>
  <div class="service">
    <header-nav  :id="id"/>

    <div class="w sharonPic">
      <img src="../assets/image/shalong.jpg">
    </div>
    <!-- 沙龙内容部分 -->
    <div class="w sharoncont">

      <div class="wthree shaIcon">
        <div style="margin: 0 auto;">
            <div style="margin-top: 35px; margin-left: 36%;">
              <a href="service">服务项目</a>
            </div>
            <div style="margin-top: 5px; margin-left: 36%;">
              <a href="medicalAdmin" style="font-size: 12px;">医疗管理</a>
            </div>
            <div style="margin-top: 5px; margin-left: 36%;">
              <a href="consulting" style="font-size: 12px;">管理咨询</a>
            </div>
            <div style="margin-top: 5px; margin-left: 36%;">
              <a href="salonactivity" style="font-size: 12px;">沙龙活动</a>
            </div>
            <div style="margin-top: 5px; margin-left: 36%;">
              <a href="meeting" style="font-size: 12px;">研究会议</a>
            </div>

        </div>
      </div>
      <img src="../assets/image/sl.png" class="icon">

      <div class="wseven shamatter">
        <div class="shuIcon"></div>
        <span class="biaoti">服务项目</span>
        <div class="hengIcon"></div>
        <ul >
          <li v-for="(item, index) in serviceDemeanour" :key="id" @click="Jump(item.id)">
            <div class="newcont">
              <div style="overflow: hidden;">
                <span class="round left"></span>
                <h5 class="left" style="margin-left: 15px;">{{item.title}}</h5>
                <span class="onlyTime">{{item.publishTime}}</span>
              </div>

              <div class="onlyHeight">
                <p>{{item.newsAbstract}}</p>
              </div>
            </div>
          </li>
        </ul>
        <!-- 分页 -->
        <div class="block">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="current"
            :page-size="pagesize"
            background
            layout="prev, pager, next"
            :total="total">
          </el-pagination>
        </div>
      </div>
    </div>


    <footer-nav/>
  </div>
</template>

<script type="text/javascript">
import headerNav from '@/components/header';
import footerNav from '@/components/footer';
export default {
  data() {
    return {
      id: 10,
      current: 1,
      pagesize: 10,
      routingName: '',
      // 总共有多少条数据
      total: 0,
      serviceDemeanour: []
    };
  },
  components: {
    headerNav,
    footerNav
  },
  created() {
    this.loadData();
    this.getUrlsub();
  },
  methods: {
    async loadData() {
      const response = await this.$http.get(`biz/newsArticles/${10}?&current=${this.current}&size=${this.pagesize}`);
      if (response.data.code === 1) {
        this.serviceDemeanour = response.data.responseData.records;
        this.total = response.data.responseData.total;
        // console.log(response.data.responseData)
      }
    },
    //跳转
    Jump(id){
      window.open('/newsDetails/'+ id);
    },
    // 分页方法
    handleSizeChange(val) {
      this.pagesize = val;
      this.loadData();
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      this.current = val;
      this.loadData();
      console.log(`当前页: ${val}`);
    },
    getUrlsub() {
      var urlStr = location.pathname;
      var index = urlStr.lastIndexOf('\/');
      this.routingName = urlStr.substring(index + 1, urlStr.length);
      if(this.routingName == 'service') {
         sessionStorage.setItem('breadName', '服务项目');
         sessionStorage.setItem('breadRouting', 'service');
      }
    }
  }
};
</script>

<style type="text/css">
.service {

}
.service .sharonPic {
  overflow: hidden;
  margin-top: 20px;
  height: 300px;
}
.service .sharonPic img {
  height: 100%;
  width: 100%;
}
.service .sharoncont {

  position: relative;
}
.service .sharoncont .icon {
  position: absolute;
  left: -11px;
  top: 13px;

}
.service .shaIcon {
  position: relative;
  border: 1px solid #cccccc;
  height: 190px;
  margin-top: 20px;
}
.service .shaIcon a {
  cursor:pointer;
  color: #333333;
}
.service .shamatter {
  position: relative;
  border: 1px solid #cccccc;
  margin-top: 20px;
}
.service .shamatter .shuIcon {
  width: 4px;
  background-color: #14A24B;
  height: 15px;
  margin-top: 10px;
  margin-left: 8px;
}
.service .shamatter .hengIcon {
  width: 100%;
  background-color: #14A24B;
  height: 4px;
  margin-top: 10px;
}
.service .shamatter li {
  overflow: hidden;
  margin-top: 15px;
  cursor:pointer;
}
.service .shamatter li .pic {
  overflow: hidden;
  width: 100px;
  height: 80px;
  margin-left: 10px;
}
.service .shamatter li .pic img{
  width: 100%;
  height: 100%;
}
.service .shamatter li .newcont {
  overflow: hidden;
  padding-left: 10px;
}
.service .shamatter li .newcont h5{
  font-size: 14px;
  padding-top: 5px;
}
.service .shamatter .block {
  text-align: center;
  margin-top: 20px;
  margin-bottom: 20px;
}
</style>
