Commit 23123278 by yanju

Merge branch 'xue' into 'master'

话题详情完成

See merge request !32
parents 64881725 32eb0eef
......@@ -72,8 +72,9 @@
:width-v="464"
:height-v="72"
:border-v="[6]"
placeholder="输入新昵称"
:show-icon="false"
v-model="public"
>
</yun-input>
</yun-div>
......@@ -102,7 +103,9 @@
},
data(){
return{
public:'',
change:false,
rightNow:'',
slotDialog: {
open: true,
btns: [
......@@ -114,6 +117,14 @@
handler: this.dataPostRemarks,
},
],
gender:'',
mobile:'',
email:'',
signature:'',
nickName:null,
qqNumber:null,
wxNumber:null,
birthday:'',
},
}
......@@ -121,7 +132,63 @@
methods:{
dataChange(){
this.change=true;
this.rightNow=this.right;
console.log(this.rightNow);
},
dataPostRemarks() {
if (this.title==="昵称") {
this.$axios.$put(config.api.put.User.reviseInfo, {
nickName: this.public
}).then((response) => {
this.$message({
type:'success',
message:'修改成功'
})
})
}
if (this.title==="生日") {
this.$axios.$put(config.api.put.User.reviseInfo, {
birthday: this.public
}).then((response) => {
this.$message({
type:'success',
message:'修改成功'
})
})
}
if (this.title==="QQ号") {
this.$axios.$put(config.api.put.User.reviseInfo, {
qqNumber: this.public
}).then((response) => {
this.$message({
type:'success',
message:'修改成功'
})
})
}
if (this.title==="微信号") {
this.$axios.$put(config.api.put.User.reviseInfo, {
wxNumber: this.public
}).then((response) => {
this.$message({
type:'success',
message:'修改成功'
})
})
}
if (this.title==="手机号") {
this.$axios.$put(config.api.put.User.reviseInfo, {
wxNumber: this.public
}).then((response) => {
this.$message({
type:'success',
message:'修改成功'
})
})
}
}
}
......
<template>
<yun-div>
<topic-card :info="detail"></topic-card>
<Nav :show-right="false" :path="path" :nav-list="navList"></Nav>
<dynamic-card
v-for="(val,index) in postList"
:key="val.postId"
:info="val"
></dynamic-card>
<scroll-loading ref="pagination" :pages="pages" v-on:changePage="changePage"></scroll-loading>
</yun-div>
</template>
<script>
import topicCard from '../../../components/moblie/topicCard';
import Nav from '../../../components/moblie/nav';
import config from '../../../action/config';
import dynamicCard from '../../../components/moblie/dynamicCard';
import ScrollLoading from '../../../components/moblie/scrollLoading';
export default {
async asyncData({$axios,params}){
let detail = await $axios.$get(config.api.get.Topic.detail+params.id);
return {detail: detail.data}
},
data(){
return{
path: `/topic/detail/${this.$route.params.id}`,
navList: [
{
label: '最新',
id: 'new'
},
{
label: '推荐',
id: 'recommends'
},
{
label: '文字',
id: 'word'
},
{
label: '视频',
id: 'video'
},
{
label: '图片',
id: 'picture'
}
],
detail:{},
postList:[],
name:'',
pages:1,
}
},
components:{
topicCard,Nav,dynamicCard,ScrollLoading
},
created() {
this.id = this.$route.params.id;
if (this.$route.query.type) {
}else{
this.$router.replace({
path: `/topic/detail/${this.id}`,
query: {
type: 'new'
}
})
}
},
watch:{
$route(val){
if (val.query.type) {
}else{
this.$router.replace({
path: `/topic/detail/${this.id}`,
query: {
type: 'new'
}
})
}
this.restartPagination();
}
},
methods:{
restartPagination(){
if(process.browser){
this.postList = [];
this.pages = 1 ;
this.$refs.pagination.setCurrentPage(1)
}
},
handleResponse(currentPage,response){
if(currentPage===1){
this.postList=response.data.dataList;
this.pages = response.data.totalPage;
}else{
response.data.dataList.map((val,index)=>{
this.postList.push(val)
});
this.pages = response.data.totalPage;
}
},
dataGetDynamicList(currentPage){
let params={
page:currentPage,
size:12
};
if(this.$route.query.type&&this.$route.query.type==='new') {
this.$axios.$get(config.api.get.Topic.postList + this.detail.topicName + '/posts',
{params:params}).then((response) => {
console.log(response);
this.handleResponse(currentPage, response)
})
}
if(this.$route.query.type&&this.$route.query.type==='recommends' ){
this.$axios.$get(config.api.get.Topic.recommendsPost+ this.detail.topicName+'/post/recommends' ,{params:params}).then((response)=>{
this.handleResponse(currentPage,response)
})
}
if(this.$route.query.type&&this.$route.query.type==='word') {
params.type = 0;
this.$axios.$get(config.api.get.Topic.postList + this.detail.topicName + '/posts',
{params:params}).then((response) => {
this.handleResponse(currentPage, response)
})
}
if(this.$route.query.type&&this.$route.query.type==='video') {
params.type = 1;
this.$axios.$get(config.api.get.Topic.postList + this.detail.topicName + '/posts',
{params:params}).then((response) => {
this.handleResponse(currentPage, response)
})
}
if(this.$route.query.type&&this.$route.query.type==='picture') {
params.type = 2;
this.$axios.$get(config.api.get.Topic.postList + this.detail.topicName + '/posts',
{params:params}).then((response) => {
this.handleResponse(currentPage, response)
})
}
},
changePage(currentPage){
//返回页数 请求新的数据
this.dataGetDynamicList(currentPage)
},
}
}
</script>
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