diff --git a/src/components/Home/Header.vue b/src/components/Home/Header.vue index ba243c9..7b92d45 100644 --- a/src/components/Home/Header.vue +++ b/src/components/Home/Header.vue @@ -265,7 +265,7 @@ export default { }, getNameAndCheck() { if (this.form.url === null) { - return; + return false; } else { this.splitUrl(); this.isExist(); @@ -356,9 +356,15 @@ export default { } }).then((res)=>{ - that.avatar_url=res.data.owner.avatar_url; + that.avatar_url=res.data.owner.avatar_url; // that.saveGithubInfo(); - }); + }).catch(()=>{ + Vue.prototype.$notify.error({ + title: '错误', + message: '项目地址不合法或不存在!', + offset: 50 + }); + }) }, }, diff --git a/src/components/Home/Home.vue b/src/components/Home/Home.vue index d27cfcb..cf54b1c 100644 --- a/src/components/Home/Home.vue +++ b/src/components/Home/Home.vue @@ -140,6 +140,7 @@ import axios from 'axios' import ProjectList from "@/components/Project/ProjectList.vue"; import UserInfo from "@/components/User/UserInfo.vue"; import LoginDialog from "@/components/Home/LoginDialog.vue"; +import Vue from "vue"; export default { name: "HomeComponent", @@ -169,9 +170,7 @@ export default { created() { this.categoryList(); - setTimeout(()=>{ - this.getProjectTotal(); - },1000) + this.getProjectTotal(); this.getUserTotal(); }, computed: { @@ -212,7 +211,13 @@ export default { } }).then((res)=>{ that.projectLists=res.data; - }); + }).catch((error)=>{ + Vue.prototype.$notify.error({ + title: '错误', + message: error, + offset: 50 + }); + }) }, projectListsByCount(index,name){ var that=this; @@ -284,7 +289,13 @@ export default { }).then((res)=>{ // console.log(res); that.tags=res.data; - }); + }).catch((error)=>{ + Vue.prototype.$notify.error({ + title: '错误', + message: error, + offset: 50 + }); + }) }, getUserTotal(){ @@ -295,7 +306,13 @@ export default { url: '/api/userNum', }).then((res)=>{ that.userTotal=res.data; - }); + }).catch((error)=>{ + Vue.prototype.$notify.error({ + title: '错误', + message: error, + offset: 50 + }); + }) }, getProjectTotal(){ var that=this; @@ -306,9 +323,14 @@ export default { // URL 中的查询参数 }).then((res)=>{ that.projectTotal=res.data; - }); + }).catch((error)=>{ + Vue.prototype.$notify.error({ + title: '错误', + message: error, + offset: 50 + }); }, - + )} } } diff --git a/src/components/Home/LoginDialog.vue b/src/components/Home/LoginDialog.vue index c4f1fd9..3654911 100644 --- a/src/components/Home/LoginDialog.vue +++ b/src/components/Home/LoginDialog.vue @@ -275,7 +275,13 @@ export default { offset: 50 }); } - }); + }).catch((error)=>{ + Vue.prototype.$notify.error({ + title: '错误', + message: error, + offset: 50 + }); + }) } else { return false; } @@ -319,7 +325,13 @@ export default { }); } // console.log(res); - }); + }).catch((error)=>{ + Vue.prototype.$notify.error({ + title: '错误', + message: error, + offset: 50 + }); + }) } else { return false; } diff --git a/src/components/Home/PasswordStrength.vue b/src/components/Home/PasswordStrength.vue deleted file mode 100644 index 55180cf..0000000 --- a/src/components/Home/PasswordStrength.vue +++ /dev/null @@ -1,124 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/components/Home/SearchInput.vue b/src/components/Home/SearchInput.vue index aca98bc..8346692 100644 --- a/src/components/Home/SearchInput.vue +++ b/src/components/Home/SearchInput.vue @@ -129,7 +129,13 @@ export default { offset: 50 }); } - }); + }).catch((error)=>{ + Vue.prototype.$notify.error({ + title: '错误', + message: error, + offset: 50 + }); + }) }, // searchRequest() { // const params = { @@ -151,7 +157,13 @@ export default { }).then((res)=>{ that.historySearch=res.data; - }); + }).catch((error)=>{ + Vue.prototype.$notify.error({ + title: '错误', + message: error, + offset: 50 + }); + }) }, handleClose(tag){ var that=this; @@ -181,7 +193,13 @@ export default { offset: 50 }); } - }); + }).catch((error)=>{ + Vue.prototype.$notify.error({ + title: '错误', + message: error, + offset: 50 + }); + }) }, searchByInput(){ var that=this; @@ -217,7 +235,13 @@ export default { that.gethistorySearch(); }, 200); } - }); + }).catch((error)=>{ + Vue.prototype.$notify.error({ + title: '错误', + message: error, + offset: 50 + }); + }) }else{ Vue.prototype.$notify.error({ title: '错误', diff --git a/src/components/Home/SearchResultsList.vue b/src/components/Home/SearchResultsList.vue index 5a9e516..c0178d1 100644 --- a/src/components/Home/SearchResultsList.vue +++ b/src/components/Home/SearchResultsList.vue @@ -1,7 +1,7 @@