<template>
  <div class="info">
    <div class="content">
      <div class="info_box">
        <div class="info_mes" >
          <p >
            项目名称：{{title}}
          </p>
          <p>项目编号：{{code}}</p>
          <p >
            发布日期：{{date}}
          </p>
          
        </div>
        <h1>{{title}}</h1>
        <div class="content_list" v-html="contentList">
        </div>
        <div class="sty" v-for="item in fileList" :key="item.id">
          <span>附件下载:</span>
          <span>{{item.fileName}}</span>
          <a :href="item.accessoryUrl">
            <el-button size="mini">下载</el-button>
          </a>
        </div>
        <el-row>
          <el-button @click="prev"
                >返回</el-button
              >
          <el-button type="primary" @click="signUp" v-if="isshow">我要报名</el-button>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script>
import dataBreadcrumb from '@/components/dataBreadcrumb.vue'
import {getBidingdetails} from '@/common/list.js'
import Cookies from "js-cookie"
export default {
  components: {
    dataBreadcrumb
  },
  mounted(){
        let id = this.$route.query.id
        console.log(id)
        this.getBidingdetails(id)
        let noticeType = window.location.href.split("?id=")[1] 
        Cookies.set("bidId",noticeType)
        let issupplier =Cookies.get("isSupplier")
          if(issupplier==="1"){
            this.isshow = !this.isshow
          }
    },
  data() {
    return {
      proId:'',
      isshow:true,
      title:"",
      code:'',
      date:'',
      contentList:'',
      fileList:[]
    }
  },
  methods:{
    prev() {
      window.history.go(-1)
    },
    signUp(){
    let tokenStr = Cookies.get("token")
    if(!tokenStr){
      Cookies.set("sign",1)
      this.$router.push("/login/user")
    }else{
      let token = Cookies.get("token")
        /* this.$router.push(`/supply/web_sell/Online_registration/Sign_up?id=${this.proId}`) */
        window.open(`http://60.205.251.80:8082/#/supply/bid/signupOnline/SignUp?id=${this.proId}&token=${token}`)
      }
    
  },
    async getBidingdetails(id){
            const {data} = await getBidingdetails(id)
            console.log(data)
            this.date = data.createTime
            this.title = data.title
            this.code = data.projectId
            this.contentList = data.content
            this.fileList = data.accessoryVOList
            this.proId = data.projectId
            console.log(this.proId)
        }
  },
}
</script>

<style scoped>
	.info {
		box-sizing: border-box;
		padding: 30px;
		width: 9.3rem;
	}
  .content{
    width:9.3rem
  }

	.info>.info_prev {
		box-sizing: border-box;
		padding-left: 30px;
		padding-top: 30px;
		background: #fff;
	}

	.info_mes {
		margin-bottom: 40px;
		display: flex;
		justify-content: space-between;
	}

	.info_mes p {
		display: inline-block;
	}
	h1 {
		display: flex;
		justify-content: center;
    margin-left:-50px;
    
	}

	.content_list {
		margin-left: 50px;
		margin-right: 50px;
		margin-top: 50px;
	}
	
	.content_list h3 {
		margin-top: 30px;
		font-weight: bold;
		padding-bottom: 10px;
	}

	.content_list p {
		margin-top: 10px;
		margin-bottom: 10px;
	}

	.el-row {
		display: flex;
		justify-content: center;
    margin-left:-60px

	}
	.message>p{
		font-weight: bold;
	}
  .sty{
    margin-left:200px;
    margin-top:50px;
    margin-bottom: 50px;
  }
</style>
