Commit af905a0f by yanju

修复话题详情页

parent 131873ff
......@@ -75,6 +75,25 @@
import config from '../../../action/config'
export default {
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(){
return{
list: [
......@@ -119,10 +138,7 @@
}
},
created() {
let name = this.$route.params.name;
this.dataGetTopicInfo(name);
this.dataGetUsers(this.topicCardInfo.topicId);
this.$router.replace({
path: this.$route.path,
query: {
......@@ -157,18 +173,6 @@
},
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(){
this.postList = [];
this.pages = 1;
......@@ -304,7 +308,6 @@
changePage(currentPage){
console.log(currentPage)
//返回页数 请求新的数据
let type = this.$route.query.type;
if(type==='new'){
......@@ -361,7 +364,7 @@
div{
position:relative;
}
.topic-detail-container__search{
>.topic-detail-container__search{
width: 100%;
height:160*$length;
background-image: url("../../../assets/img/search_bg.png");
......
......@@ -25,12 +25,10 @@ export default function ({ store, redirect, app: { $axios } }) {
redirect('/users/login');
}
}
console.log(error)
});
$axios.interceptors.response.use((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