Commit 9cb531d5 by yanju

Merge branch 'xue' into 'master'

接口修改

See merge request pigbigbig/beyond-clouds-front!32
parents b588fe03 26df8161
......@@ -249,7 +249,8 @@
.project-card__right{
margin-left:12*$length;
img{
max-width:280*$length;
max-width:150*$length;
max-height:93*$length;
border-radius:4*$length;
height:auto;
@extend %animate-transition;
......
......@@ -14,11 +14,11 @@
:title="labelTitle"
>
<project-card v-for="(val,index) in blogList" :info="val"></project-card>
<blog-card v-for="(val,index) in blogList":key="val.blogId" :info="val"></blog-card>
</card-container>
<div class="pagination">
<pagination style="margin: 0 auto;" pages="13" v-on:listenPageChange="changePage"></pagination>
<pagination style="margin: 0 auto;" :pages="pages" v-on:listenPageChange="changePage"></pagination>
</div>
</div>
<div class="blog-container__right">
......@@ -45,26 +45,20 @@
<script>
import NavWrap from "../../components/pc/nav/navWrap";
import CardContainer from "../../components/pc/cardContainer";
import ProjectCard from "../../components/pc/projectCard";
import Pagination from "../../components/pc/pagination";
import config from '../../action/config';
import BlogCard from "../../components/pc/projectCard";
export default {
async asyncData ({ $axios }) {
const blogList = await $axios.$get(config.api.get.Blog.list,{
params:{
page:1,
size:6,
}
});
return {blogList:blogList.data.dataList}
},
components: {Pagination, ProjectCard, CardContainer, NavWrap},
components: {Pagination, CardContainer, NavWrap,BlogCard},
data(){
return{
blogList:[],
currentPage:1,
pages:1,
list: [
{
label: '全部类型',
address: '/blog',
......@@ -108,11 +102,24 @@ export default {
},
methods: {
dataGetBlogList(currentPage){
this.$axios.$get(config.api.get.Blog.list,{
params:{
page:currentPage,
size:7,
}
}).then((response)=>{
this.blogList=response.data.dataList;
this.pages = response.data.totalPage;
})
},
toRelease(){
this.$router.push('/blog/release')
},
changePage(currentPage){
//返回页数 请求新的数据
this.dataGetBlogList(currentPage)
}
}
}
......
......@@ -8,7 +8,7 @@
>
<div class="blog-release_List" v-for="val in blogList" :key="val.blogId" :info="val">
<div style="width: 60%"><p @click="toDetail">{{val.blogTitle}}</p></div>
<p @click="toDetail" style="color: #999999">{{val.category}}</p>
<div class="blog-release_List_r" @click="toDetail" >{{val.category}}</div>
</div>
</card-container>
<card-container
......@@ -104,7 +104,7 @@
<div class="blog-release__footer">
<p class="footer__left">上传封面
<img :src="imgSrc" alt="">
<input type="file" @change="e=>changeToUploadCover(e)" placeholder="上传项目封面图" >
<input type="file" @change="changeToUploadCover(e)" placeholder="上传项目封面图" accept="image/png,image/gif,image/jpeg" >
</p>
<div class="footer__right">
<p>已自动存为草稿</p>
......@@ -127,7 +127,7 @@
const blogList = await $axios.$get(config.api.get.Blog.myList,{
params:{
page:1,
size:8,
size:12,
}
});
......@@ -136,7 +136,6 @@
components: {SelectCard, CardContainer},
data() {
return {
markdownOption: {
bold: true, // 粗体
italic: true, // 斜体
......@@ -174,6 +173,8 @@
imgSrc: '',
lastSaveTime: new Date(),
blogClass: '',
originLink:'',
blogAbstract:'',
questionClass: '',
classList: ['web', 'java', 'javascript']
}
......@@ -223,10 +224,21 @@
viewPrivileges: this.way //1公开,0私有
}).then((response)=>{
//处理response
console.log(response)
if(response.code===0) {
this.$message({
type: 'success',
message: '提交成功!'
});
}else{
this.$message({
message:"提交失败 "+response.data.errMsg,
type:'error'
})
}
})
},
imgAdd(pos, file) {
//添加图片,pos为位置
// 第一步.将图片上传到服务器.
......@@ -243,6 +255,7 @@
* $vm 指为mavonEditor实例,可以通过如下两种方式获取
* 1. 通过引入对象获取: `import {mavonEditor} from ...` 等方式引入后,`$vm`为`mavonEditor`
* 2. 通过$refs获取: html声明ref : `<mavon-editor ref=md ></mavon-editor>,`$vm`为 `this.$refs.md`
*
*/
$vm.$img2Url(pos, url);
})
......@@ -251,6 +264,10 @@
console.log(pos);
console.log(url);
},
changeToUploadCover(e){
console.log(e);
this.imgSrc = 'http://i1.sinaimg.cn/ent/d/2008-06-04/U105P28T3D2048907F326DT20080604225106.jpg';
},
save() { //保存文章内容
},
......@@ -260,14 +277,13 @@
this.lastSaveTime = now;
}
},
changeToUploadCover(e){
console.log(e);
this.imgSrc = 'http://i1.sinaimg.cn/ent/d/2008-06-04/U105P28T3D2048907F326DT20080604225106.jpg';
},
readScreen(boolean, str){ // 预览
this.zIndex = 8000
}
}
},
}
</script>
......@@ -290,11 +306,15 @@
white-space: nowrap;
text-overflow: ellipsis;
}
.blog-release_List_r{
color: #999999
}
:hover{
color: #00AAE6;
cursor:pointer
}
}
}
.blog-release-container__r {
.blog-release {
......
......@@ -14,12 +14,12 @@
:title="labelTitle"
>
<project-card v-for="(val,index) in projectList" :info="val"></project-card>
<project-card v-for="(val,index) in projectList" :key="val.projectId" :info="val"></project-card>
</card-container>
<div class="pagination">
<pagination style="margin: 0 auto;" pages="13" v-on:listenPageChange="changePage"></pagination>
<pagination style="margin: 0 auto;" :pages="pages" v-on:listenPageChange="changePage"></pagination>
</div>
</div>
<div class="project-container__right">
......@@ -54,18 +54,18 @@ import config from '../../action/config';
export default {
async asyncData ({ $axios }) {
/* async asyncData ({ $axios }) {
const projectList = await $axios.$get(config.api.get.Project.list,{
params:{
page:1,
page:currentpage,
size:6,
}
});
return {projectList:projectList.data.dataList}
},
return {projectList:projectList.data.dataList,pages:projectList.data.totalPage}
},*/
components: {Pagination, ProjectCard, CardContainer, NavWrap},
data(){
......@@ -132,7 +132,10 @@ export default {
}
]
}
]
],
projectList:[],
currentPage:1,
pages:1,
}
},
created() {
......@@ -157,9 +160,24 @@ export default {
toRelease(){
this.$router.push('/project/release')
},
dataGetProjectList(currentPage){
this.$axios.$get(config.api.get.Project.list,{
params:{
page:currentPage,
size:7
}
}).then((response)=>{
this.projectList = response.data.dataList;
this.pages = response.data.totalPage;
})
},
changePage(currentPage){
//返回页数 请求新的数据
}
this.dataGetProjectList(currentPage);
},
}
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment