From 572a87b8ec39530a5d18f5d2d3faad39e146d41c Mon Sep 17 00:00:00 2001 From: Qing Date: Mon, 3 Jul 2023 10:06:09 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Home/Home.vue | 4 ++- src/components/Home/SearchInput.vue | 46 ++++++++++++++++------------- src/components/Home/UserInfo.vue | 9 ++++-- src/components/UserInfoPage.vue | 2 +- 4 files changed, 36 insertions(+), 25 deletions(-) diff --git a/src/components/Home/Home.vue b/src/components/Home/Home.vue index 12ba79f..b9f74d7 100644 --- a/src/components/Home/Home.vue +++ b/src/components/Home/Home.vue @@ -367,11 +367,12 @@ export default { // 方法 submitForm(formName) { + var _this=this; this.$refs[formName].validate((valid) => { if (valid) { //存入cookie // this.setCookie(this.ruleForm.username, this.ruleForm.password, 7); //保存7天 - this.$cookie.set('username',this.ruleForm.username,7); + // } else { // this.clearCookie(); @@ -396,6 +397,7 @@ export default { // type: 'success' // }); if (res.data.code === 200) { + _this.$cookie.set('username',_this.ruleForm.username,7); Vue.prototype.$notify({ title: '成功', message: ('i', {style: 'color: teal'}, res.data.msg), diff --git a/src/components/Home/SearchInput.vue b/src/components/Home/SearchInput.vue index 9587cf9..573e9c0 100644 --- a/src/components/Home/SearchInput.vue +++ b/src/components/Home/SearchInput.vue @@ -9,13 +9,14 @@ style="padding-top: 0" v-model="visible" > -
-
+
+
搜索历史 - 清空 + 清空
- + - {{ tag }} - + > + {{ tag }} + +
+
+ 你还没有登录哦~ +
+
@@ -56,7 +62,7 @@ export default { isMouseOver: false, search: '', tipsWord: '', - historySearch: [], + historySearch: null, items: [ ] } @@ -114,34 +120,34 @@ export default { }); }, handleClose(tag){ - var that=this; axios({ method: 'post', // 请求的地址 url: 'http://localhost:8082/helloGithub_war_exploded/deletelabel', // URL 中的查询参数 params: { - tag:tag+';' + tag:tag } }).then((res)=>{ - if(res.date.code===200){ - that.$message({ - showClose: true, - message: res.date.msg, - type: 'success' + if(res.data.code===200){ + Vue.prototype.$notify({ + title: '成功', + message: ('i', {style: 'color: teal'}, res.data.msg), + type: 'success', + offset: 50 }); }else{ - that.$message({ - showClose: true, - message: res.date.msg, - type: 'error' + Vue.prototype.$notify.error({ + title: '错误', + message: res.data.msg, + offset: 50 }); } }); } }, mounted() { - this.tipsWord = "helloGithub"; + this.tipsWord = "搜索开源项目"; this.gethistorySearch(); } }; diff --git a/src/components/Home/UserInfo.vue b/src/components/Home/UserInfo.vue index e37090b..301e5d2 100644 --- a/src/components/Home/UserInfo.vue +++ b/src/components/Home/UserInfo.vue @@ -2,7 +2,7 @@
- + {{this.$cookie.get('username')}}
{{this.$cookie.get('username')}} Lv.1 @@ -14,14 +14,14 @@
贡献值 - 0/64 + 0/100
- 我的主页 + 我的主页 退出登录
@@ -39,6 +39,9 @@ export default { signOut(){ this.$cookie.delete('username'); window.location.reload(); + }, + toUserPage(){ + this.$router.push({path:'/UserInfoPage'}) } } } diff --git a/src/components/UserInfoPage.vue b/src/components/UserInfoPage.vue index 9a89d7f..7f01971 100644 --- a/src/components/UserInfoPage.vue +++ b/src/components/UserInfoPage.vue @@ -1,5 +1,5 @@