Commit 4dd98be1 by yanju

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

parents 294cd6c2 2ec6e92f
......@@ -66,14 +66,26 @@
import config from "../../../action/config";
export default {
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')) {
const response = await $axios.$get(config.api.get.Question.detail + query.id);
console.log(response);
return {
response:response,
classList
}
}
}else{ return {classList}}
},
mounted(){
if (this.$route.query.id) {
this.content=this.response.data.content;
......@@ -136,20 +148,13 @@
questionDetail:'',
questionTitle:'',
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:'',
}
},
methods: {
handleClass(value) {
this.blogClass = value.tag;
if (value.tag === "web") {
this.blogClass = 1;
} else if (value.tag === "java") {
this.blogClass = 2
} else if (value.tag === "javascript") {
this.blogClass = 3
}
this.blogClass = value.tagId;
},
// 获得得标签数组
handleTagList(tagList) {
......
......@@ -10,33 +10,41 @@
<div class="blog-container__center">
<card-container
width="816px"
height="1012px"
: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>
</card-container>
<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 class="blog-container__right">
<div class="right__write-blog" @click="toRelease">写文章</div>
<card-container
v-if="false"
title="热门博主"
label="换一换"
more="更多"
width="302px"
height="446px"
style="margin-top: 16px"
></card-container>
style="margin-top: 16px;max-height: 446px;"
>
<user-card></user-card>
</card-container>
<card-container
title="热门标签"
width="302px"
height="446px"
style="margin-top: 16px"
></card-container>
style="margin-top: 16px;max-height: 446px;"
>
<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>
......@@ -49,70 +57,101 @@ import CardContainer from "../../components/pc/cardContainer";
import Pagination from "../../components/pc/pagination";
import config from '../../action/config';
import BlogCard from "../../components/pc/projectCard";
import EmptyCard from "../../components/pc/emptyCard";
import UserCard from "../../components/pc/userCard2";
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(){
return{
blogList:[],
currentPage:1,
pages:1,
hotBlogList: [],
hotTagsList: [],
labelTitle:'',
showPagination:true,
showPaginationTimer:null,
list: [
{
label: '全部类型',
address: '/blog',
id: '全部类型'
},
{
label: '程序人生',
address: '/blog',
id: '程序人生'
},
{
label: '移动开发',
label: '全部项目',
address: '/blog',
id: '移动开发'
type: 'all'
},
{
label: '前端',
address: '/blog',
id: '前端'
},
{
label: '其他',
address: '/blog',
id: '其他'
}
]
],
}
},
created() {
this.$router.replace({
path: '/blog',
query: {
id: '全部类型'
type: 'all'
}
});
this.dataGetBlogCategory();
this.getLabelTitle();
this.dataGetHotTagsList();
},
computed: {
labelTitle: function () {
return this.$route.query.id
watch: {
$route: function () {
this.restartPagination();
this.dataGetBlogList(1);
this.getLabelTitle();
}
},
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,{
params:{
page:currentPage,
size:7,
},
getLabelTitle(){
let type = this.$route.query.type;
this.list.map((val,index)=>{
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(){
this.$router.push('/blog/release')
......@@ -153,6 +192,24 @@ export default {
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 @@
<select-card
ref="license"
selectType="2"
:class-list="classList"
:class-list="List1"
@handleClass="(val) => this.license = val.tag"
placeholder="请选择授权协议"></select-card>
</div>
......@@ -40,18 +40,18 @@
<select-card
ref="language"
selectType="2"
:class-list="classList"
:class-list="List2"
@handleClass="(val) => this.language = val.tag"
placeholder="请选择开发语言"></select-card>
</div>
<div class="select__wrap">
<span>*</span>
<select-card
ref="system"
ref="projectClass"
selectType="2"
:class-list="classList"
@handleClass="(val) => this.system = val.tag"
placeholder="请选择操作系统"></select-card>
@handleClass="(val) => this.projectClass = val.tagId"
placeholder="请选择项目类型"></select-card>
</div>
</div>
<div class="header-content">
......@@ -82,14 +82,14 @@
@focus="() => this.$refs.docLink.style.border = '1px solid transparent'"
@blur="checkAddress(docLink, 'docLink')"
>
<div class="select__wrap">
<div class="select__wrap" v-if="false">
<span>*</span>
<select-card
ref="projectClass"
ref="system"
selectType="2"
:class-list="classList"
@handleClass="(val) => this.projectClass = val.tag"
placeholder="请选择项目类型"></select-card>
@handleClass="(val) => this.system = val.tag"
placeholder="请选择操作系统"></select-card>
</div>
</div>
<div class="header-content">
......@@ -157,12 +157,24 @@ import config from '../../../action/config';
export default {
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')) {
const response = await $axios.$get(config.api.get.Project.detail + query.id);
console.log(response);
return {
response:response,
classList
}
}else{
return {classList}
}
},
mounted() {
......@@ -177,11 +189,12 @@ export default {
this.$refs.license.$refs.select.value = this.response.data.license;
this.projectDescription = this.response.data.projectDescription;
this.name = this.response.data.projectName;
this.projectClass = this.response.data.projectType;
this.$refs.projectClass.$refs.select.value = this.response.data.projectType;
this.system = this.response.data.runtimePlatform;
this.$refs.system.$refs.select.value = this.response.data.runtimePlatform;
this.projectClass = this.response.data.categoryId;
this.$refs.projectClass.$refs.select.value = this.response.data.category;
//this.system = this.response.data.runtimePlatform;
//this.$refs.system.$refs.select.value = this.response.data.runtimePlatform;
this.addressLink = this.response.data.sourceLink
}
},
components: {SelectCard, CardContainer},
......@@ -219,7 +232,8 @@ export default {
zIndex: 100,
imgSrc: '',
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: '', // 项目协议
language: '', // 项目语言
system: '', // 项目系统
......@@ -316,7 +330,7 @@ export default {
message: '请输入项目名称'
})
} else if (this.license === '') {
console.log(this.$refs.license);
//console.log(this.$refs.license);
this.$refs.license.handleShow();
this.$refs.license.$refs.select.focus();
this.$message({
......@@ -330,13 +344,6 @@ export default {
type: 'warning',
message: '请选择开发语言'
})
}else if (this.system === '') {
this.$refs.system.handleShow();
this.$refs.system.$refs.select.focus();
this.$message({
type: 'warning',
message: '请选择操作系统'
})
}else if (this.addressLink === '') {
this.$refs.addressLink.focus();
this.$message({
......@@ -371,7 +378,7 @@ export default {
return true
}
} else {
if (this.name !== '' && this.license !== '' && this.language !== '' && this.system !== ''
if (this.name !== '' && this.license !== '' && this.language !== ''
&& this.addressLink !== '' && this.projectClass !== '' && this.projectDescription !== ''
&& this.value !== '' && this.imgSrc !== ''
) {
......@@ -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() {
let projectRes;
......@@ -417,7 +400,7 @@ export default {
// 修改执行这个接口
projectRes = await this.$axios.$put(config.api.put.Project.revise + this.$route.query.id, {
author: this.author,
categoryId: 1,
categoryId: this.projectClass,
cover: this.imgSrc,
devLang: this.language,
docLink: this.docLink,
......@@ -428,8 +411,8 @@ export default {
projectDescription: this.projectDescription,
contentHtml: this.projectDetail,
projectName: this.name,
projectType: this.projectClass,
runtimePlatform: this.system,
//projectType: this.projectClass,
//runtimePlatform: this.system,
sourceLink: this.addressLink
})
.then((response) => {
......@@ -449,19 +432,18 @@ export default {
} else {
projectRes = await this.$axios.$post(config.api.post.Project.release, {
author: this.author,
categoryId: 1,
categoryId: this.projectClass,
cover: this.imgSrc,
devLang: this.language,
docLink: this.docLink,
homeLink: this.homeLink,
content: this.content,//内容
//contentHtml: this.blogDetail,// 内容的html
license: this.license,
projectDescription: this.projectDescription,
contentHtml: this.projectDetail,
projectName: this.name,
projectType: this.projectClass,
runtimePlatform: this.system,
// projectType: this.projectClass,
//runtimePlatform: this.system,
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