Commit af905a0f by yanju

修复话题详情页

parent 131873ff
...@@ -75,6 +75,25 @@ ...@@ -75,6 +75,25 @@
import config from '../../../action/config' import config from '../../../action/config'
export default { export default {
components: {TopicCard, Pagination, CardContainer, NavWrap,ReleaseCard,SocialCard,UserCard}, components: {TopicCard, Pagination, CardContainer, NavWrap,ReleaseCard,SocialCard,UserCard},
async asyncData({$axios,params}){
try {
let regExp = /^[\u4e00-\u9fa5]/
let typicName = regExp.test(params.name)?encodeURI(params.name):params.name;
let TopicDetail = await $axios.$get(config.api.get.Topic.detail+typicName,{
params:{
by:'name'
}
});
return {topicCardInfo:TopicDetail.data}
}catch (e) {
}
},
data(){ data(){
return{ return{
list: [ list: [
...@@ -119,10 +138,7 @@ ...@@ -119,10 +138,7 @@
} }
}, },
created() { created() {
let name = this.$route.params.name; this.dataGetUsers(this.topicCardInfo.topicId);
this.dataGetTopicInfo(name);
this.$router.replace({ this.$router.replace({
path: this.$route.path, path: this.$route.path,
query: { query: {
...@@ -157,18 +173,6 @@ ...@@ -157,18 +173,6 @@
}, },
methods:{ methods:{
dataGetTopicInfo(name){
this.$axios.$get(config.api.get.Topic.detail+name,{
params:{
by:'name'
}
}).then((response)=>{
this.topicCardInfo = response.data;
this.dataGetUsers(response.data.topicId);
})
},
restartPagination(){ restartPagination(){
this.postList = []; this.postList = [];
this.pages = 1; this.pages = 1;
...@@ -304,7 +308,6 @@ ...@@ -304,7 +308,6 @@
changePage(currentPage){ changePage(currentPage){
console.log(currentPage)
//返回页数 请求新的数据 //返回页数 请求新的数据
let type = this.$route.query.type; let type = this.$route.query.type;
if(type==='new'){ if(type==='new'){
...@@ -361,7 +364,7 @@ ...@@ -361,7 +364,7 @@
div{ div{
position:relative; position:relative;
} }
.topic-detail-container__search{ >.topic-detail-container__search{
width: 100%; width: 100%;
height:160*$length; height:160*$length;
background-image: url("../../../assets/img/search_bg.png"); background-image: url("../../../assets/img/search_bg.png");
......
...@@ -25,12 +25,10 @@ export default function ({ store, redirect, app: { $axios } }) { ...@@ -25,12 +25,10 @@ export default function ({ store, redirect, app: { $axios } }) {
redirect('/users/login'); redirect('/users/login');
} }
} }
console.log(error) console.log(error)
}); });
$axios.interceptors.response.use((response) => { $axios.interceptors.response.use((response) => {
return response return response
}) })
} }
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