登陆跳转

This commit is contained in:
pplokijuhyg 2019-12-26 10:00:24 +08:00
parent c901454332
commit faeb1f9ae1
7 changed files with 49 additions and 23 deletions

View File

@ -123,7 +123,7 @@ export default {
t.list = res.data.data;
window.console.log(t.list.length, "hfihaifohog");
if (t.list.length < 5) {
t.text = "暂无数据";
t.text = "暂无相关数据";
}
window.$(window).scroll(() => {
var windowH = window.$(window).height(); //
@ -139,7 +139,7 @@ export default {
});
} else {
window.console.log("errir");
t.text = "暂无数据";
t.text = "暂无相关数据";
}
});
},

View File

@ -3,7 +3,10 @@
<div class="header">
<img class="portrait" :src="'http://lawpro.earnest.pro' + userimg" alt />
<div class="introduce">
<p class="name">{{username}}</p>
<p class="name">
<span>{{username}}</span>
<img :src="home" alt="" style="width:0.5rem;position: absolute;right:0.5rem;top:0.3rem" @click="gohome">
</p>
<div class="follow">
<p>
<span>{{attention}}</span>
@ -71,7 +74,7 @@
:title="item.title"
types="1"
:sid="item.id"
:type="item.status"
:type="1"
></answer>
<answer
v-if="types==2"
@ -105,7 +108,6 @@
:types="item.type"
:sid="item.id"
:type="item.type"
></answer>
</div>
</div>
@ -190,11 +192,13 @@
import follow from "./components/PersonafFollow";
// import follows from "./components/PersonafFollows"
import answer from "./components/PersonalAnswer";
import home from "./assets/home.png"
// import { log } from 'util';
export default {
name: "Personal-homepage",
data() {
return {
home,
userimg: "",
username: "",
myfollow: "",
@ -220,7 +224,12 @@ export default {
path: "/articledetail?id=" + b
});
},
getlist() {
gohome(){
this.$router.push({
path:"/"
})
},
getlist(types) {
if (this.lock) {
return;
}
@ -233,19 +242,21 @@ export default {
page: this.page
})
.then(res => {
this.lock = false;
window.console.log(res);
if (res.data.code == 200) {
if (res.data.data.length == 0) {
if (types != this.types) {
// alert(1)
return;
}
this.dynamiclist = res.data.data;
this.lock = false;
window.console.log(this.lock);
}
});
},
getlists() {
getlists(types) {
if (this.lock) {
return;
}
@ -257,7 +268,9 @@ export default {
page: this.page
})
.then(res => {
window.console.log(res);
this.lock = false;
if (types != this.types) window.console.log(res);
if (res.data.code == 200) {
// if(res.data.data.length == 0){
@ -266,14 +279,14 @@ export default {
// alert(1)
this.dynamiclist = res.data.data;
this.lock = false;
window.console.log(this.lock);
}
});
}
},
mounted() {
document.title= "个人中心"
document.title = "个人中心";
if (localStorage.getItem("token") == "") {
this.$router.push({ path: "/login" });
}
@ -313,22 +326,27 @@ export default {
// alert(2);
window.console.log(1);
if (this.types == 5) {
t.getlists(0);
t.getlists(this.types);
} else {
t.getlist();
t.getlist(this.types);
}
}
});
},
watch: {
types() {
// window.console.log(a,b)
// if(this.lock == true){
// this.types = b
// return ;
// }
this.page = 0;
this.dynamiclist = [];
this.lock = false;
// this.lock = false;
if (this.types == 5) {
this.getlists(0);
this.getlists(this.types);
} else {
this.getlist();
this.getlist(this.types);
}
}
},

BIN
src/assets/home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
src/assets/login.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -21,7 +21,10 @@
></list>
</div>
<div style="width:100%;height:0.5rem;text-align:center;line-height:0.3rem">{{text}}</div>
<div style="width:100%;height:0.5rem;text-align:center;line-height:0.3rem">
<img :src="login" style="width:0.5rem" alt="" v-if="text == '加载中' ">
{{text}}
</div>
<!-- <list></list>
<list></list>-->
</div>
@ -42,6 +45,7 @@
<script>
import list from "./components/IndexList";
import heads from "./components/indexhead";
import login from "./assets/login.gif"
export default {
name: "index",
data() {
@ -49,7 +53,8 @@ export default {
list: [],
page: 1,
lock: false,
text: "加载中"
text: "加载中",
login
};
},
methods: {
@ -70,7 +75,7 @@ export default {
t.list = t.list.concat(res.data.data);
t.lock = false;
} else {
t.text = "暂无更多";
t.text = "暂无更多数据";
}
});
},

View File

@ -75,7 +75,7 @@ export default {
localStorage.setItem('token', res.data.data)
this.$router.push({
path: `/`,
path: `/PersonalHomepage`,
})
}else{
alert("登录失败,请重试")

View File

@ -87,6 +87,9 @@ router.beforeEach((to, from, next) => {
// location.href = "loaclhost:8080" + to.fullPath
next()
window.history.pushState({},0, "loaclhost:8080" + to.fullPath);
if(from.name !== null){
window.location.reload();
}
})
export default router;