Commit 9cb531d5 by yanju

Merge branch 'xue' into 'master'

接口修改

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