Commit 4dd98be1 by yanju

Merge branch 'master' of coding.yundingshuyuan.com:pigbigbig/beyond-clouds-front

parents 294cd6c2 2ec6e92f
...@@ -66,14 +66,26 @@ ...@@ -66,14 +66,26 @@
import config from "../../../action/config"; import config from "../../../action/config";
export default { export default {
async asyncData({$axios, query}) { async asyncData({$axios, query}) {
const questionClass = await $axios.$get(config.api.get.QuestionCategory.list);
let classList = [];
questionClass.data.forEach(item => {
classList.push({
tag: item.category,
tagId: item.categoryId
})
});
console.log(classList)
if (query.hasOwnProperty('id')) { if (query.hasOwnProperty('id')) {
const response = await $axios.$get(config.api.get.Question.detail + query.id); const response = await $axios.$get(config.api.get.Question.detail + query.id);
console.log(response); console.log(response);
return { return {
response:response, response:response,
classList
} }
} }else{ return {classList}}
}, },
mounted(){ mounted(){
if (this.$route.query.id) { if (this.$route.query.id) {
this.content=this.response.data.content; this.content=this.response.data.content;
...@@ -136,20 +148,13 @@ ...@@ -136,20 +148,13 @@
questionDetail:'', questionDetail:'',
questionTitle:'', questionTitle:'',
lastSaveTime: new Date(), lastSaveTime: new Date(),
classList: [{tagId:1,tag:"web"}, {tagId:2,tag:"java"},{tagId:3,tag:"javascript"}], //classList: [{tagId:1,tag:"web"}, {tagId:2,tag:"java"},{tagId:3,tag:"javascript"}],
contentHtml:'', contentHtml:'',
} }
}, },
methods: { methods: {
handleClass(value) { handleClass(value) {
this.blogClass = value.tag; this.blogClass = value.tagId;
if (value.tag === "web") {
this.blogClass = 1;
} else if (value.tag === "java") {
this.blogClass = 2
} else if (value.tag === "javascript") {
this.blogClass = 3
}
}, },
// 获得得标签数组 // 获得得标签数组
handleTagList(tagList) { handleTagList(tagList) {
......
...@@ -10,33 +10,41 @@ ...@@ -10,33 +10,41 @@
<div class="blog-container__center"> <div class="blog-container__center">
<card-container <card-container
width="816px" width="816px"
height="1012px"
:title="labelTitle" :title="labelTitle"
> >
<empty-card v-if="blogList.length===0" height="556px"></empty-card>
<blog-card v-for="(val,index) in blogList" :key="val.blogId" :info="val"></blog-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="pages" v-on:listenPageChange="changePage"></pagination> <pagination style="margin: 0 auto;" :pages="pages" ref="pagination" v-on:listenPageChange="changePage"></pagination>
</div> </div>
</div> </div>
<div class="blog-container__right"> <div class="blog-container__right">
<div class="right__write-blog" @click="toRelease">写文章</div> <div class="right__write-blog" @click="toRelease">写文章</div>
<card-container <card-container
v-if="false"
title="热门博主" title="热门博主"
label="换一换" label="换一换"
more="更多" more="更多"
width="302px" width="302px"
height="446px" style="margin-top: 16px;max-height: 446px;"
style="margin-top: 16px" >
></card-container> <user-card></user-card>
</card-container>
<card-container <card-container
title="热门标签" title="热门标签"
width="302px" width="302px"
height="446px" style="margin-top: 16px;max-height: 446px;"
style="margin-top: 16px" >
></card-container> <div class="tags-wrap">
<div class="tag-box" v-for="(item, index) in hotTagsList" :key="item.tagId">
<span>{{item.tagName}}</span>
<span>{{item.referenceCount}}</span>
</div>
</div>
</card-container>
</div> </div>
</div> </div>
</div> </div>
...@@ -49,70 +57,101 @@ import CardContainer from "../../components/pc/cardContainer"; ...@@ -49,70 +57,101 @@ import CardContainer from "../../components/pc/cardContainer";
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"; import BlogCard from "../../components/pc/projectCard";
import EmptyCard from "../../components/pc/emptyCard";
import UserCard from "../../components/pc/userCard2";
export default { export default {
components: {Pagination, CardContainer, NavWrap,BlogCard}, components: {UserCard, EmptyCard, Pagination, CardContainer, NavWrap,BlogCard},
async asyncData({$axios}){
let typeList = await $axios.$get(config.api.get.BlogCategory.list);
return {typeList:typeList.data}
},
data(){ data(){
return{ return{
blogList:[], blogList:[],
currentPage:1, currentPage:1,
pages:1, pages:1,
hotBlogList: [],
hotTagsList: [],
labelTitle:'',
showPagination:true,
showPaginationTimer:null,
list: [ list: [
{
label: '全部类型',
address: '/blog',
id: '全部类型'
},
{
label: '程序人生',
address: '/blog',
id: '程序人生'
},
{ {
label: '移动开发', label: '全部项目',
address: '/blog', address: '/blog',
id: '移动开发' type: 'all'
}, },
{ ],
label: '前端',
address: '/blog',
id: '前端'
},
{
label: '其他',
address: '/blog',
id: '其他'
}
]
} }
}, },
created() { created() {
this.$router.replace({ this.$router.replace({
path: '/blog', path: '/blog',
query: { query: {
id: '全部类型' type: 'all'
} }
}); });
this.dataGetBlogCategory();
this.getLabelTitle();
this.dataGetHotTagsList();
}, },
computed: { watch: {
labelTitle: function () { $route: function () {
return this.$route.query.id this.restartPagination();
this.dataGetBlogList(1);
this.getLabelTitle();
} }
}, },
methods: { methods: {
dataGetBlogCategory(){
this.typeList.map((val,index)=>{
this.list.push({
label: val.category,
address: '/blog',
type: val.categoryId
})
})
dataGetBlogList(currentPage){ },
this.$axios.$get(config.api.get.Blog.list,{ getLabelTitle(){
params:{ let type = this.$route.query.type;
page:currentPage, this.list.map((val,index)=>{
size:7, if(val.type===type){
this.labelTitle = val.label
} }
}).then((response)=>{
this.blogList=response.data.dataList;
this.pages = response.data.totalPage;
}) })
}, },
restartPagination(){
if(process.browser){
this.$refs.pagination.setCurrentPage(1)
}
},
dataGetBlogList(currentPage){
let params={
page:currentPage,
size:7
};
if(this.$route.query.type && this.$route.query.type!=='all' ){
params.categoryId = this.$route.query.type
}
this.$axios.$get(config.api.get.Blog.list, {params:params})
.then((response)=>{
this.blogList=response.data.dataList;
this.pages = response.data.totalPage;
})
},
dataGetHotTagsList(){
let params={
page:1,
size:7
};
this.$axios.$get(config.api.get.Tag.hotTags,{params:params})
.then((response)=>{
this.hotTagsList = response.data.dataList;
})
},
toRelease(){ toRelease(){
this.$router.push('/blog/release') this.$router.push('/blog/release')
...@@ -153,6 +192,24 @@ export default { ...@@ -153,6 +192,24 @@ export default {
background-color: #00AAE6; background-color: #00AAE6;
} }
} }
.tags-wrap{
padding: 10*$length 10*$length 30*$length;
.tag-box{
display: inline-block;
margin-right: 10*$length;
margin-bottom: 10*$length;
padding: 2*$length 9*$length;
background-color: #F4F8FA;
@include border-radius(2*$length);
@extend %cursorPointer;
@extend %animate-transition;
@include fontStyle(12, 22, 500, #999, center);
&:hover {
color: #fff;
background-color: #00AAE6;
}
}
}
} }
} }
} }
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<select-card <select-card
ref="license" ref="license"
selectType="2" selectType="2"
:class-list="classList" :class-list="List1"
@handleClass="(val) => this.license = val.tag" @handleClass="(val) => this.license = val.tag"
placeholder="请选择授权协议"></select-card> placeholder="请选择授权协议"></select-card>
</div> </div>
...@@ -40,18 +40,18 @@ ...@@ -40,18 +40,18 @@
<select-card <select-card
ref="language" ref="language"
selectType="2" selectType="2"
:class-list="classList" :class-list="List2"
@handleClass="(val) => this.language = val.tag" @handleClass="(val) => this.language = val.tag"
placeholder="请选择开发语言"></select-card> placeholder="请选择开发语言"></select-card>
</div> </div>
<div class="select__wrap"> <div class="select__wrap">
<span>*</span> <span>*</span>
<select-card <select-card
ref="system" ref="projectClass"
selectType="2" selectType="2"
:class-list="classList" :class-list="classList"
@handleClass="(val) => this.system = val.tag" @handleClass="(val) => this.projectClass = val.tagId"
placeholder="请选择操作系统"></select-card> placeholder="请选择项目类型"></select-card>
</div> </div>
</div> </div>
<div class="header-content"> <div class="header-content">
...@@ -82,14 +82,14 @@ ...@@ -82,14 +82,14 @@
@focus="() => this.$refs.docLink.style.border = '1px solid transparent'" @focus="() => this.$refs.docLink.style.border = '1px solid transparent'"
@blur="checkAddress(docLink, 'docLink')" @blur="checkAddress(docLink, 'docLink')"
> >
<div class="select__wrap"> <div class="select__wrap" v-if="false">
<span>*</span> <span>*</span>
<select-card <select-card
ref="projectClass" ref="system"
selectType="2" selectType="2"
:class-list="classList" :class-list="classList"
@handleClass="(val) => this.projectClass = val.tag" @handleClass="(val) => this.system = val.tag"
placeholder="请选择项目类型"></select-card> placeholder="请选择操作系统"></select-card>
</div> </div>
</div> </div>
<div class="header-content"> <div class="header-content">
...@@ -157,12 +157,24 @@ import config from '../../../action/config'; ...@@ -157,12 +157,24 @@ import config from '../../../action/config';
export default { export default {
async asyncData({$axios, query}) { async asyncData({$axios, query}) {
const projectCategory = await $axios.$get(config.api.get.ProjectCategory.list);
let classList=[];
projectCategory.data.forEach(item=>{
classList.push({
tag:item.category,
tagId:item.categoryId
})
});
console.log(classList);
if (query.hasOwnProperty('id')) { if (query.hasOwnProperty('id')) {
const response = await $axios.$get(config.api.get.Project.detail + query.id); const response = await $axios.$get(config.api.get.Project.detail + query.id);
console.log(response); console.log(response);
return { return {
response:response, response:response,
classList
} }
}else{
return {classList}
} }
}, },
mounted() { mounted() {
...@@ -177,11 +189,12 @@ export default { ...@@ -177,11 +189,12 @@ export default {
this.$refs.license.$refs.select.value = this.response.data.license; this.$refs.license.$refs.select.value = this.response.data.license;
this.projectDescription = this.response.data.projectDescription; this.projectDescription = this.response.data.projectDescription;
this.name = this.response.data.projectName; this.name = this.response.data.projectName;
this.projectClass = this.response.data.projectType; this.projectClass = this.response.data.categoryId;
this.$refs.projectClass.$refs.select.value = this.response.data.projectType; this.$refs.projectClass.$refs.select.value = this.response.data.category;
this.system = this.response.data.runtimePlatform; //this.system = this.response.data.runtimePlatform;
this.$refs.system.$refs.select.value = this.response.data.runtimePlatform; //this.$refs.system.$refs.select.value = this.response.data.runtimePlatform;
this.addressLink = this.response.data.sourceLink this.addressLink = this.response.data.sourceLink
} }
}, },
components: {SelectCard, CardContainer}, components: {SelectCard, CardContainer},
...@@ -219,7 +232,8 @@ export default { ...@@ -219,7 +232,8 @@ export default {
zIndex: 100, zIndex: 100,
imgSrc: '', imgSrc: '',
lastSaveTime: new Date(), lastSaveTime: new Date(),
classList: [{tagId:1,tag:"web"}, {tagId:2,tag:"java"},{tagId:3,tag:"javascript"}], List1: [{tagId:1,tag:"MPL"},{tagId:2,tag:"BSD"},{tagId:3,tag:"Com"},{tagId:4,tag:"QPL"},{tagId:5,tag:"QNCL"},{tagId:6,tag:"Jab"},{tagId:7,tag:"IBM"}],
List2: [{tagId:1,tag:"C"}, {tagId:2,tag:"Java"},{tagId:3,tag:"Javascript"},{tagId:4,tag:"python"},{tagId:5,tag:"C++"}],
license: '', // 项目协议 license: '', // 项目协议
language: '', // 项目语言 language: '', // 项目语言
system: '', // 项目系统 system: '', // 项目系统
...@@ -316,7 +330,7 @@ export default { ...@@ -316,7 +330,7 @@ export default {
message: '请输入项目名称' message: '请输入项目名称'
}) })
} else if (this.license === '') { } else if (this.license === '') {
console.log(this.$refs.license); //console.log(this.$refs.license);
this.$refs.license.handleShow(); this.$refs.license.handleShow();
this.$refs.license.$refs.select.focus(); this.$refs.license.$refs.select.focus();
this.$message({ this.$message({
...@@ -330,13 +344,6 @@ export default { ...@@ -330,13 +344,6 @@ export default {
type: 'warning', type: 'warning',
message: '请选择开发语言' message: '请选择开发语言'
}) })
}else if (this.system === '') {
this.$refs.system.handleShow();
this.$refs.system.$refs.select.focus();
this.$message({
type: 'warning',
message: '请选择操作系统'
})
}else if (this.addressLink === '') { }else if (this.addressLink === '') {
this.$refs.addressLink.focus(); this.$refs.addressLink.focus();
this.$message({ this.$message({
...@@ -371,7 +378,7 @@ export default { ...@@ -371,7 +378,7 @@ export default {
return true return true
} }
} else { } else {
if (this.name !== '' && this.license !== '' && this.language !== '' && this.system !== '' if (this.name !== '' && this.license !== '' && this.language !== ''
&& this.addressLink !== '' && this.projectClass !== '' && this.projectDescription !== '' && this.addressLink !== '' && this.projectClass !== '' && this.projectDescription !== ''
&& this.value !== '' && this.imgSrc !== '' && this.value !== '' && this.imgSrc !== ''
) { ) {
...@@ -385,30 +392,6 @@ export default { ...@@ -385,30 +392,6 @@ export default {
} }
} }
}, },
// get修改信息
/* dataGetProject() {
this.$axios.$get(config.api.get.Project.detail+136,).then((response)=>{
//this.projectList=response.data.dataList;
//console.log(response);
this.imgSrc=response.data.cover,
this.language=response.data.devLang,
this.$refs.language.$refs.select.value=response.data.devLang,
this.docLink=response.data.docLink,
this.homeLink=response.data.homeLink,
this.content=response.data.devLang,//内容
this.license=response.data.license,
this.$refs.license.$refs.select.value=response.data.license,
this.projectDescription=response.data.projectDescription,
//this.projectDetail=response.data.content,
this.name=response.data.projectName;
// console.log(this.name)
this.projectClass=response.data.projectClass,
this.$refs.projectClass.$refs.select.value=response.data.projectClass,
this.system=response.data.runtimePlatform,
this.$refs.system.$refs.select.value=response.data.runtimePlatform,
this.addressLink=response.data.sourceLink
})
},*/
// 发布项目 // 发布项目
async postProject() { async postProject() {
let projectRes; let projectRes;
...@@ -417,7 +400,7 @@ export default { ...@@ -417,7 +400,7 @@ export default {
// 修改执行这个接口 // 修改执行这个接口
projectRes = await this.$axios.$put(config.api.put.Project.revise + this.$route.query.id, { projectRes = await this.$axios.$put(config.api.put.Project.revise + this.$route.query.id, {
author: this.author, author: this.author,
categoryId: 1, categoryId: this.projectClass,
cover: this.imgSrc, cover: this.imgSrc,
devLang: this.language, devLang: this.language,
docLink: this.docLink, docLink: this.docLink,
...@@ -428,8 +411,8 @@ export default { ...@@ -428,8 +411,8 @@ export default {
projectDescription: this.projectDescription, projectDescription: this.projectDescription,
contentHtml: this.projectDetail, contentHtml: this.projectDetail,
projectName: this.name, projectName: this.name,
projectType: this.projectClass, //projectType: this.projectClass,
runtimePlatform: this.system, //runtimePlatform: this.system,
sourceLink: this.addressLink sourceLink: this.addressLink
}) })
.then((response) => { .then((response) => {
...@@ -449,19 +432,18 @@ export default { ...@@ -449,19 +432,18 @@ export default {
} else { } else {
projectRes = await this.$axios.$post(config.api.post.Project.release, { projectRes = await this.$axios.$post(config.api.post.Project.release, {
author: this.author, author: this.author,
categoryId: 1, categoryId: this.projectClass,
cover: this.imgSrc, cover: this.imgSrc,
devLang: this.language, devLang: this.language,
docLink: this.docLink, docLink: this.docLink,
homeLink: this.homeLink, homeLink: this.homeLink,
content: this.content,//内容 content: this.content,//内容
//contentHtml: this.blogDetail,// 内容的html
license: this.license, license: this.license,
projectDescription: this.projectDescription, projectDescription: this.projectDescription,
contentHtml: this.projectDetail, contentHtml: this.projectDetail,
projectName: this.name, projectName: this.name,
projectType: this.projectClass, // projectType: this.projectClass,
runtimePlatform: this.system, //runtimePlatform: this.system,
sourceLink: this.addressLink sourceLink: this.addressLink
}) })
} }
......
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