Commit 787a5dd8 by yanju

修改点击头像跳转 修改config.js

parent 16f4c3e6
......@@ -21,6 +21,11 @@ export default {
list:'/api/blogs', //获取博客列表
myList:'/api/my/blogs', //获取我的博客列表
otherList:'/api/user/',//获取别人的博客列表 + {userId}/blogs
hotList:'/api/blog/hots',//热门博客
recommendList:'/api/blog/',//推荐博客 +{blogId}/recommends
},
BlogCategory:{
list:'/api/blog/categories',//获取项目分类列表
},
BlogComment:{
list:'/api/blog/', //获取评论列表 +{blogId}/comments
......@@ -71,6 +76,12 @@ export default {
list:'/api/questions' ,//问答列表
otherParticipated:'/api/user/' ,//用户参与的问答列表 + {userId}/question/participated
otherCreated:'/api/user/' ,//用户创建的问答列表 +{userId}/questions
hotList:'/api/question/hots',//热门问题
recommendsList:'/api/question/',//相关问答 +{questionId}/recommends
},
QuestionCategory:{
list:'/api/question/categories',//获取项目分类列表
},
QuestionReply:{
......@@ -85,6 +96,11 @@ export default {
otherList:'/api/user/' ,//ta的项目列表 +{userId}/projects
list:'/api/projects',//项目列表
detail:'/api/project/' ,//项目详情 +{projectId}
hotList:'/api/project/hots',//热门项目
},
ProjectCategory:{
list:'/api/project/categories',//获取项目分类列表
},
ProjectComment:{
list:'/api/project/',//项目评论列表 +{projectId}/comments
......
......@@ -6,7 +6,7 @@
class="nav-card__label"
:style="{backgroundColor: isBlue ? '#00AAE6' : '#fff'}"
></div>
<nuxt-link tag="p" :to="{path:navAddress, query:{id:labelId}}" :style="{color: isBlue || fontColor ? '#00AAE6' : '#666'}">
<nuxt-link tag="p" :to="{path:navAddress, query:{type:labelId}}" :style="{color: isBlue || fontColor ? '#00AAE6' : '#666'}">
<slot></slot>
</nuxt-link>
<div class="nav-card__menu" v-if="isShow===true && childList !== undefined" >
......@@ -16,7 +16,7 @@
class="label-list"
v-for="(item, key) in childList"
:key="`${item}${key}`"
:to="{path: item.address, query: {id: labelId, childId: item.childId}}">
:to="{path: item.address, query: {type: labelId, childId: item.childId}}">
{{item.label}}
</nuxt-link>
</div>
......@@ -33,7 +33,7 @@
props: {
childList: Array,
navAddress: String,
labelId: String
labelId: [String,Number]
},
data(){
return{
......@@ -43,18 +43,18 @@
}
},
created() {
if (this.$route.query.id) {
this.isBlue = this.$route.query.id.indexOf(this.labelId) !== -1;
if (this.$route.query.type) {
this.isBlue = this.$route.query.type===this.labelId;
} else {
this.isBlue = this.$route.path.indexOf(this.navAddress) !== -1;
// this.isBlue = this.$route.path.indexOf(this.navAddress) !== -1;
}
},
watch:{
$route(to,from){
if (this.$route.query.id) {
this.isBlue = this.$route.query.id.indexOf(this.labelId) !== -1;
if (this.$route.query.type) {
this.isBlue = this.$route.query.type===this.labelId;
} else {
this.isBlue = this.$route.path.indexOf(this.navAddress) !== -1;
// this.isBlue = this.$route.path.indexOf(this.navAddress) !== -1;
}
}
},
......
......@@ -4,7 +4,7 @@
v-for="(item,index) in list"
:key="item.address+index"
:navAddress="item.address"
:labelId="item.id"
:labelId="item.type"
:childList="item.childList"
>{{item.label}}
</nav-card>
......
......@@ -66,7 +66,7 @@
@mouseover.native="changeStateShowBox(1)" @mouseleave.native="changeStateHideBox(1)"></yun-icon>
<yun-icon name="notification" color="#ccc" hoverColor="#F8A06F"
@mouseover.native="changeStateShowBox(3)" @mouseleave.native="changeStateHideBox(3)"></yun-icon>
<img class="user-photo" @mouseleave="changeStateHideBox(2)" :src="this.$store.state.userProfile.avatar" alt="" @mouseover="changeStateShowBox(2)" />
<img class="user-photo" @click="$router.push('/personal-center/home/project')" @mouseleave="changeStateHideBox(2)" :src="this.$store.state.userProfile.avatar" alt="" @mouseover="changeStateShowBox(2)" />
<ul class="abs-box abs-box1" v-if="showHideBox1" @mouseover="changeStateShowBox(1)" @mouseleave="changeStateHideBox(1)">
<li>
<nuxt-link tag="span" to="/project/release">发布项目</nuxt-link>
......@@ -214,7 +214,6 @@
this.routeToHome();
}
});
},
changeStateHideBox(...arg){
if(arg.indexOf(1)===0){
......@@ -236,7 +235,6 @@
},300)
}
},
changeStateShowBox(...arg){
clearTimeout(this.hideBox1Time);
clearTimeout(this.hideBox2Time);
......@@ -258,7 +256,6 @@
this.showHideBox3=true
}
},
routeToHome(){
this.$router.push('/');
},
......@@ -267,7 +264,7 @@
let path = this.$route.path;
let index = path.lastIndexOf('/');
let route = path.substring(0,index);
if(route==='/blog/detail'||route==='/blog/detail'||route==='/blog/detail'){
if(route==='/blog/detail'||route==='/project/detail'||route==='/answer/detail'){
if(process.browser){
document.removeEventListener('scroll',this.listenScroll2)
document.addEventListener('scroll',this.listenScroll1)
......@@ -291,6 +288,7 @@
this.showToTop = scrollTop >= 800;
},
listenScroll2(){
this.showDetailHead =false;
let scrollTop = document.documentElement.scrollTop ||document.body.scrollTop;
this.showToTop = scrollTop >= 800;
},
......
......@@ -99,6 +99,10 @@
methods:{
setCurrentPage(n){
this.currentPage = n;
},
getElementToPageTop(el) {
if(el.parentElement) {
return this.getElementToPageTop(el.parentElement) + el.offsetTop
......
......@@ -122,6 +122,7 @@
import {dateConvert} from "../../../action/utils/dataConvert";
import hljs from 'highlight.js'
import {globalBus} from "../../../components/common/globalBus";
export default {
async asyncData ({ $axios ,params}) {
......@@ -137,6 +138,7 @@
},
created(){
globalBus.$emit(config.event.listenDetailInfo,this.articleDetail.questionTitle,'answer')
},
mounted(){
......
......@@ -134,7 +134,6 @@
return{
commentContent:'',
commentList:[],
}
},
......@@ -142,10 +141,6 @@
globalBus.$emit(config.event.listenDetailInfo,this.articleDetail.blogTitle,'blog')
},
destroyed() {
globalBus.$emit(config.event.listenDetailInfo,this.articleDetail.blogTitle,'')
},
mounted(){
this.highlightCode();
......
......@@ -123,6 +123,7 @@
import {dateConvert} from "../../../action/utils/dataConvert";
import hljs from 'highlight.js'
import {globalBus} from "../../../components/common/globalBus";
export default {
async asyncData ({ $axios ,params}) {
......@@ -159,6 +160,7 @@
},
created(){
globalBus.$emit(config.event.listenDetailInfo,this.articleDetail.projectName,'project')
},
mounted(){
......
......@@ -7,39 +7,37 @@
:list="list"
></nav-wrap>
</div>
<div class="project-container__center">
<card-container
width="816px"
height="1012px"
:title="labelTitle"
>
<project-card v-for="(val,index) in projectList" :key="val.projectId" :info="val"></project-card>
<div class="project-container__center">
<card-container
width="816px"
:title="labelTitle"
>
<project-card v-if="showPagination" v-for="(val,index) in projectList" :key="val.projectId" :info="val"></project-card>
<empty-card v-if="projectList.length===0" height="556px"></empty-card>
</card-container>
<div class="pagination">
<pagination style="margin: 0 auto;" :pages="pages" v-on:listenPageChange="changePage"></pagination>
</card-container>
<div class="pagination">
<pagination style="margin: 0 auto;" :pages="pages" ref="pagination" v-on:listenPageChange="changePage"></pagination>
</div>
</div>
</div>
<div class="project-container__right">
<div class="right__write-project" @click="toRelease">发布项目</div>
<card-container
title="今日热门"
label="换一换"
more="加载更多"
width="302px"
height="446px"
style="margin-top: 16px"
></card-container>
<card-container
title="热门项目"
label="整点更新"
more="更多项目"
width="302px"
height="446px"
style="margin-top: 16px"
></card-container>
>
<div class="right__hot-item" v-for="(val,index) in hotProjectList" :key="val.projectId">
<yun-avatar size="48px" border-r="4px" :src="val.cover" :name="val.projectName"></yun-avatar>
<div class="right__hot-item__content">
<p>{{val.projectName}}</p>
<h6>{{val.projectDescription}}</h6>
</div>
</div>
</card-container>
</div>
</div>
</div>
......@@ -51,22 +49,10 @@ import CardContainer from "../../components/pc/cardContainer";
import ProjectCard from "../../components/pc/projectCard";
import Pagination from "../../components/pc/pagination";
import config from '../../action/config';
import EmptyCard from '../../components/pc/emptyCard';
export default {
/* async asyncData ({ $axios }) {
const projectList = await $axios.$get(config.api.get.Project.list,{
params:{
page:currentpage,
size:6,
}
});
return {projectList:projectList.data.dataList,pages:projectList.data.totalPage}
},*/
components: {Pagination, ProjectCard, CardContainer, NavWrap},
components: {Pagination, ProjectCard, CardContainer, NavWrap,EmptyCard},
data(){
return{
......@@ -74,100 +60,87 @@ export default {
{
label: '全部项目',
address: '/project',
id: '全部项目'
type: 'all'
},
{
label: 'web应用',
address: '/project',
id: 'web应用',
childList: [
{
address: '/project',
label: '桌面应用',
childId: '桌面应用'
},
{
address: '/project',
label: '手机APP',
childId: '手机APP'
},
{
address: '/project',
label: '实时聊天',
childId: '实时聊天'
},
{
address: '/project',
label: '快速开发',
childId: '快速开发'
}
]
},
{
label: '基础框架',
address: '/project',
id: '基础框架',
childList: [
{
label: 'Vue.js',
address: '/project',
childId: 'Vue.js'
}
]
},
{
label: '应用工具',
address: '/project',
id: '应用工具',
childList: [
{
label: '文件管理工具',
address: '/project',
childId: '文件管理工具'
},
{
label: '文本编辑',
address: '/project',
childId: '文本编辑'
}
]
}
],
projectList:[],
hotProjectList:[],
currentPage:1,
pages:1,
labelTitle:'',
showPagination:true,
showPaginationTimer:null
}
},
created() {
this.$router.replace({
path: '/project',
query: {
id: '全部项目'
type: 'all'
}
});
this.dataGetProjectCategory();
this.dataGetHotProjectList();
this.getLabelTitle();
},
computed: {
labelTitle: function () {
if (this.$route.query.childId) {
return this.$route.query.id + ' · ' + this.$route.query.childId
} else {
return this.$route.query.id
}
watch:{
$route(){
this.restartPagination();
this.dataGetProjectList(1);
this.getLabelTitle()
}
},
methods: {
methods: {
toRelease(){
this.$router.push('/project/release')
},
dataGetProjectList(currentPage){
this.$axios.$get(config.api.get.Project.list,{
params:{
page:currentPage,
size:7
restartPagination(){
if(process.browser){
this.$refs.pagination.setCurrentPage(1)
}
},
getLabelTitle(){
let type = this.$route.query.type;
this.list.map((val,index)=>{
if(val.type===type){
this.labelTitle = val.label
}
}).then((response)=>{
})
},
dataGetProjectCategory(){
this.$axios.$get(config.api.get.ProjectCategory.list).then((response)=>{
response.data.map((val,index)=>{
this.list.push({
label: val.category,
address: '/project',
type: val.categoryId
})
})
})
},
dataGetHotProjectList(){
let params={
page:1,
size:5
};
this.$axios.$get(config.api.get.Project.list,{params:params}).then((response)=>{
this.hotProjectList = response.data.dataList;
})
},
dataGetProjectList(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.Project.list,{params:params}).then((response)=>{
this.projectList = response.data.dataList;
this.pages = response.data.totalPage;
})
......@@ -213,6 +186,29 @@ export default {
background-color: #00AAE6;
}
}
.right__hot-item{
padding:8*$length 16*$length;
width:302*$length;
height:64*$length;
box-sizing: border-box;
@extend %flex-row-spb;
justify-content: flex-start;
.right__hot-item__content{
margin-left:10*$length;
width:210*$length;
p{
@include fontStyle(14,19,500,#2F2F2F,left);
@extend %nowrap;
}
h6{
margin-top:10*$length;
@include fontStyle(12,16,500,#999999,left);
@extend %nowrap;
}
}
}
}
}
}
......
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