山东大学软件学院暑期项目实训记录(九)

开始编写用户个人主页,实现基本功能

<template>
  <div>
    <div><headers_copy></headers_copy></div>
    <div class="head">
          <div  id="content" style="padding-top: 40px" >
           <span> <el-avatar :size="120"  src="image"  ><img :src="image"></el-avatar></span>
            <div id="username" style="padding-top: 10px">
              <span>{{username}} </span> </div>
            <div id="email" style="padding-top: 40px">
            <span>  <el-descriptions-item label="邮箱">{{mail}}</el-descriptions-item> </span>
            </div>
      </div>
    </div>
<div class="article">
  <el-divider content-position="left">
    <div style="width: 200px;padding-left: 30px;font-weight: bold;color: dodgerblue">全部文章</div>
  </el-divider>
</div>
<div class="resource">
  <div class="block">
        <el-timeline  >

          <el-timeline-item v-for="item in tabledata" :timestamp="item.editTime"  placement="top"  >
            <router-link :to="{name:'BlogDetail',query:{aid:item.aid}}" style="color: #333333;text-decoration: none" content="title" >
              <el-card >
                <h4>
                  {{item.title}}

                </h4>
                <p title="summary" content="summary">{{item.summary}}</p>

              </el-card>
            </router-link>
          </el-timeline-item>
        </el-timeline>
      </div>
    </div>

  </div>
</template>

<script>
import headers_copy from "../components/headers_copy";
const axios = require('axios');
export default {
  name: "user",
  components: {
    headers_copy
  },
  data() {
    return {
      uid: this.$route.query.uid,
      mail: '',
      image: '',
      username: '',
      tabledata:[],
    }
    },


    created()
    {
      const _this = this;
      console.log('页面创建')
      axios.get('http://47.107.40.143:8080/head',{params:{uid:_this.uid}}).then(function (resp){
        console.log(resp)
        _this.username=resp.data.data[0].username
        _this.mail=resp.data.data[0].email
        _this.image=resp.data.data[0].iconurl
        console.log('user查的数据为'+_this.username)
      })
      axios.get('http://47.107.40.143:8080/getSpecArticle',{params:{uid:_this.uid,state:1}}).then(function (resp){
        console.log('数组的长度为'+resp.data.data.length)
        for(let i = 0;i < resp.data.data.length;i++){
          _this.tabledata.push({
            aid: resp.data.data[i].aid,
            title: resp.data.data[i].title,
            summary:resp.data.data[i].summary,
            editTime:resp.data.data[i].editTime,

          })
          console.log(resp.data.data[i].aid)
        }
        console.log(resp)
      })

    },

    methods: {




    }



}
</script>

<style scoped>
.head{position:relative;height: 230px}
#content{position:absolute;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);}
#email{position:absolute;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);background-color:transparent;}
#username{position:absolute;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);font-size:20px}
</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值