添加标题

This commit is contained in:
pplokijuhyg 2019-12-19 09:12:50 +08:00
parent d41465615d
commit 62c0426cc5
8 changed files with 225 additions and 143 deletions

View File

@ -82,7 +82,7 @@
})(750, 1024); })(750, 1024);
</script> </script>
<script src="./jquery-3.4.1.min.js"></script> <script src="./jquery-3.4.1.min.js"></script>
<title>falv</title> <title>Lawpro社区</title>
</head> </head>
<body> <body>

View File

@ -197,6 +197,8 @@ window.$(window).scrollTop(window.$(window).scrollTop)
.then(res => { .then(res => {
// window.console.log(res) // window.console.log(res)
this.list = res.data.data; this.list = res.data.data;
document.title=this.list.data.title
}); });
this.axios this.axios
.post("http://lawpro.earnest.pro/api/login_main/answerList", { .post("http://lawpro.earnest.pro/api/login_main/answerList", {

View File

@ -84,6 +84,8 @@ export default {
indedfinduser indedfinduser
}, },
mounted() { mounted() {
document.title=this.$route.query.word + "-搜索"
this.getlist1(); this.getlist1();
}, },
watch: { watch: {

View File

@ -13,7 +13,7 @@
<span>{{myfollow}}</span> <span>{{myfollow}}</span>
我关注的 我关注的
</p> </p>
</div> --> </div>-->
</div> </div>
</div> </div>
<div class="classification"> <div class="classification">
@ -26,15 +26,88 @@
</div> </div>
<div class="list"> <div class="list">
<div v-for="(item,index) in dynamiclist" :key="index"> <div v-for="(item,index) in dynamiclist" :key="index">
<follow v-if="item.status == 3 " :operation="type[item.type] + '了该' + status[item.status]" :day="item.time + '前'" :title="item.title" :nickname="item.nickname" :userimg="'http://lawpro.earnest.pro' + item.img" :num="item.islike" :img="'http://lawpro.earnest.pro' + item.avatar" :text="item.text" :comment="item.comment" :sid="item.id" :type="item.status"></follow> <follow
<answer v-if="item.status == 1 || item.status == 2" :operation="type[item.type] + '了该' + status[item.status]" :day="item.time + '前'" :title="item.title" :types="item.status" :id="item.id" :sid="item.id" :type="item.status"></answer> v-if="item.status == 3 "
<follow v-if="types == 3" operation="我发布了该回答" :day="item.time" :title="item.title" :nickname="item.nickname" :userimg="'http://lawpro.earnest.pro' + userimg" :num="item.islike" :img="'http://lawpro.earnest.pro' + item.avatar" :text="item.text" :comment="item.comment" :sid="item.id" :type="item.status"></follow> :operation="type[item.type] + '了该' + status[item.status]"
<answer v-if="types==1" operation="我发布了该文章" :day="item.time" :title="item.title" types="1" :sid="item.id" :type="item.status"></answer> :day="item.time + '前'"
<answer v-if="types==2" operation="我发布了该问题" :day="item.time" :title="item.title" types="2" :sid="item.id" :type="item.status"></answer> :title="item.title"
<follow v-if="types == 5 && item.type==2" operation="我收藏了该回答" :day="item.time" :title="item.title" :nickname="item.nickname" :userimg="'http://lawpro.earnest.pro' + userimg" :num="item.islike" :img="'http://lawpro.earnest.pro' + item.avatar" :text="item.text" :comment="item.comment" :sid="item.id" :type="item.status"></follow> :nickname="item.nickname"
<answer v-if="types==5 && item.type ==1" operation="我收藏了该文章" :day="item.time" :title="item.title" types="1" :sid="item.id" :type="item.status"></answer> :userimg="'http://lawpro.earnest.pro' + item.avatar"
:num="item.islike"
:img="'http://lawpro.earnest.pro' + item.img"
:text="item.text"
:comment="item.comment"
:sid="item.id"
:type="item.status"
></follow>
<answer
v-if="item.status == 1 || item.status == 2"
:operation="type[item.type] + '了该' + status[item.status]"
:day="item.time + '前'"
:title="item.title"
:types="item.status"
:id="item.id"
:sid="item.id"
:type="item.status"
></answer>
<follow
v-if="types == 3"
operation="我发布了该回答"
:day="item.time"
:title="item.title"
:nickname="item.nickname"
:userimg="'http://lawpro.earnest.pro' + userimg"
:num="item.islike"
:img="'http://lawpro.earnest.pro' + item.avatar"
:text="item.text"
:comment="item.comment"
:sid="item.id"
:type="item.status"
></follow>
<answer
v-if="types==1"
operation="我发布了该文章"
:day="item.time"
:title="item.title"
types="1"
:sid="item.id"
:type="item.status"
></answer>
<answer
v-if="types==2"
operation="我发布了该问题"
:day="item.time"
:title="item.title"
types="2"
:sid="item.id"
:type="item.status"
></answer>
<follow
v-if="types == 5 && item.type==3"
:operation="'我收藏了该'+ status[item.type]"
:day="item.time"
:title="item.title"
:nickname="item.nickname"
:userimg="'http://lawpro.earnest.pro' + userimg"
:num="item.islike"
:img="'http://lawpro.earnest.pro' + item.avatar"
:text="item.text"
:comment="item.comment"
:sid="item.id"
:type="item.type"
:types="item.type"
></follow>
<answer
v-if="types==5 && item.type ==1|| item.type == 2"
:operation="'我收藏了该'+ status[item.type]"
:day="item.time"
:title="item.title"
:types="item.type"
:sid="item.id"
:type="item.type"
></answer>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@ -102,164 +175,166 @@
width: 100%; width: 100%;
font-size: 32px; font-size: 32px;
text-align: center; text-align: center;
} }
.select{ .select {
border-bottom: 4px solid #6B9147; border-bottom: 4px solid #6b9147;
} }
} }
.list{ .list {
width: 100%; width: 100%;
} }
} }
} }
</style> </style>
<script> <script>
import follow from "./components/PersonafFollow" import follow from "./components/PersonafFollow";
// import follows from "./components/PersonafFollows" // import follows from "./components/PersonafFollows"
import answer from "./components/PersonalAnswer" import answer from "./components/PersonalAnswer";
// import { log } from 'util'; // import { log } from 'util';
export default { export default {
name: "Personal-homepage", name: "Personal-homepage",
data() { data() {
return { return {
userimg:"", userimg: "",
username:"", username: "",
myfollow:"", myfollow: "",
attention:"", attention: "",
dynamiclist:[], dynamiclist: [],
status:['','文章','问题','回答'], status: ["", "文章", "问题", "回答"],
type:['','我点赞','我收藏','我关注','我评论','我回答'], type: ["", "我点赞", "我收藏", "我关注", "我评论", "我回答"],
types:4, types: 4,
page:1, page: 1,
lock:false lock: false
}; };
}, },
components:{ components: {
follow, follow,
answer answer
}, },
methods:{ methods: {
wzs(a,b){ wzs(a, b) {
// console.log(a,b,12) // console.log(a,b,12)
// this.$router.replace('/') // this.$router.replace('/')
this.$router.push({ this.$router.push({
path:'/articledetail?id=' + b path: "/articledetail?id=" + b
}) });
}, },
getlist(){ getlist() {
if(this.lock){ if (this.lock) {
return ; return;
} }
this.lock = true this.lock = true;
this.page += 1 this.page += 1;
this.axios.post("http://lawpro.earnest.pro/api/login_main/getUserListDetails",{ this.axios
token:localStorage.getItem("token"), .post("http://lawpro.earnest.pro/api/login_main/getUserListDetails", {
type:this.types, token: localStorage.getItem("token"),
page:this.page type: this.types,
}).then((res)=>{ page: this.page
window.console.log(res) })
if(res.data.code == 200){ .then(res => {
if(res.data.data.length == 0){ window.console.log(res);
// alert(1) if (res.data.code == 200) {
if (res.data.data.length == 0) {
// alert(1)
return ; return;
}
this.dynamiclist = res.data.data
this.lock = false
}
})
},
getlists(){
if(this.lock){
return ;
}
this.lock = true
this.page += 1
this.axios.post("http://lawpro.earnest.pro/api/login_main/getCollectList",{
token:localStorage.getItem("token"),
page:this.page
}).then((res)=>{
window.console.log(res)
if(res.data.code == 200){
// if(res.data.data.length == 0){
// return ;
// }
// alert(1)
this.dynamiclist = res.data.data
this.lock = false
}
})
}
},
mounted(){
if(localStorage.getItem('token') == ""){
this.$router.push({path:"/login"})
}
this.axios.post('http://lawpro.earnest.pro/api/login_main/getUserDetails',{
token:localStorage.getItem("token")
}).then((res)=>{
// window.console.log(res.data)
if(res.data.code == 200){
this.userimg = res.data.data.user.avatar,
this.username = res.data.data.user.nickname,
this.myfollow = res.data.data.myfollow,
this.attention = res.data.data.user.attention
}
})
this.axios.post("http://lawpro.earnest.pro/api/login_main/getUserListDetails",{
token:localStorage.getItem("token"),
type:4,
page:1
}).then((res)=>{
window.console.log(res)
if(res.data.code == 200){
this.dynamiclist = res.data.data
}
})
var t = this
window.$(window).scroll(() => {
var windowH = window.$(window).height(); //
var documentH = window.$(document).height(); //
var scrollH = window.$(window).scrollTop(); //
// scrollH = $(document).scrollTop();
if (windowH + scrollH >= documentH) {
// do something
// alert(2);
window.console.log(1)
if(this.types == 5){
t.getlists(0)
}else{
t.getlist()
}
} }
}); this.dynamiclist = res.data.data;
}, this.lock = false;
watch:{ }
types(){ });
this.page = 0 },
this.dynamiclist = [] getlists() {
this.lock = false; if (this.lock) {
if(this.types == 5){ return;
this.getlists(0) }
}else{ this.lock = true;
this.getlist() this.page += 1;
this.axios
.post("http://lawpro.earnest.pro/api/login_main/getCollectList", {
token: localStorage.getItem("token"),
page: this.page
})
.then(res => {
window.console.log(res);
if (res.data.code == 200) {
// if(res.data.data.length == 0){
// return ;
// }
// alert(1)
this.dynamiclist = res.data.data;
this.lock = false;
}
});
}
},
mounted() {
document.title= "个人中心"
if (localStorage.getItem("token") == "") {
this.$router.push({ path: "/login" });
}
this.axios
.post("http://lawpro.earnest.pro/api/login_main/getUserDetails", {
token: localStorage.getItem("token")
})
.then(res => {
// window.console.log(res.data)
if (res.data.code == 200) {
(this.userimg = res.data.data.user.avatar),
(this.username = res.data.data.user.nickname),
(this.myfollow = res.data.data.myfollow),
(this.attention = res.data.data.user.attention);
}
});
this.axios
.post("http://lawpro.earnest.pro/api/login_main/getUserListDetails", {
token: localStorage.getItem("token"),
type: 4,
page: 1
})
.then(res => {
window.console.log(res);
if (res.data.code == 200) {
this.dynamiclist = res.data.data;
}
});
var t = this;
window.$(window).scroll(() => {
var windowH = window.$(window).height(); //
var documentH = window.$(document).height(); //
var scrollH = window.$(window).scrollTop(); //
// scrollH = $(document).scrollTop();
if (windowH + scrollH >= documentH) {
// do something
// alert(2);
window.console.log(1);
if (this.types == 5) {
t.getlists(0);
} else {
t.getlist();
}
}
});
},
watch: {
types() {
this.page = 0;
this.dynamiclist = [];
this.lock = false;
if (this.types == 5) {
this.getlists(0);
} else {
this.getlist();
} }
} }
}, },
beforeRouteLeave(a,b,c){ beforeRouteLeave(a, b, c) {
window.$(window).scroll(() => { window.$(window).scroll(() => {});
c();
});
c()
} }
}; };
</script> </script>

View File

@ -209,6 +209,8 @@ window.$(window).scrollTop(window.$(window).scrollTop)
.then(res => { .then(res => {
window.console.log(res); window.console.log(res);
this.list = res.data.data; this.list = res.data.data;
document.title=this.list.data.title
}); });
} }
}; };

View File

@ -15,7 +15,7 @@
</div> </div>
<div class="agree">{{num}}人赞同了该回答</div> <div class="agree">{{num}}人赞同了该回答</div>
<div class="content"> <div class="content">
<img :src="img" alt srcset /> <img :src="img" v-if="!img" alt srcset />
<p> <p>
{{text}} {{text}}
</p> </p>

View File

@ -10,7 +10,7 @@
<list <list
:title="item.title" :title="item.title"
:id="item.id" :id="item.id"
:num="item.comment" :num="item.type == 1 ?item.comment:item.answer"
:img="item.img" :img="item.img"
:text="item.text" :text="item.text"
:type="item.type" :type="item.type"
@ -92,6 +92,7 @@ export default {
heads heads
}, },
mounted() { mounted() {
document.title="Lawpro社区"
var t = this; var t = this;
this.axios this.axios
.post("http://lawpro.earnest.pro/api/Login_main/articleList", { .post("http://lawpro.earnest.pro/api/Login_main/articleList", {

View File

@ -55,7 +55,7 @@ const router=new Router({
}, },
{ {
path: '/', path: '/',
component: index component: index,
}, },
{ {
path: '/IndexArticleDetaill', path: '/IndexArticleDetaill',