首页更新

This commit is contained in:
2023-07-03 10:06:09 +08:00
parent a6260431a5
commit 572a87b8ec
4 changed files with 36 additions and 25 deletions

View File

@@ -367,11 +367,12 @@ export default {
// 方法 // 方法
submitForm(formName) { submitForm(formName) {
var _this=this;
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
//存入cookie //存入cookie
// this.setCookie(this.ruleForm.username, this.ruleForm.password, 7); //保存7天 // this.setCookie(this.ruleForm.username, this.ruleForm.password, 7); //保存7天
this.$cookie.set('username',this.ruleForm.username,7);
// } else { // } else {
// this.clearCookie(); // this.clearCookie();
@@ -396,6 +397,7 @@ export default {
// type: 'success' // type: 'success'
// }); // });
if (res.data.code === 200) { if (res.data.code === 200) {
_this.$cookie.set('username',_this.ruleForm.username,7);
Vue.prototype.$notify({ Vue.prototype.$notify({
title: '成功', title: '成功',
message: ('i', {style: 'color: teal'}, res.data.msg), message: ('i', {style: 'color: teal'}, res.data.msg),

View File

@@ -9,13 +9,14 @@
style="padding-top: 0" style="padding-top: 0"
v-model="visible" v-model="visible"
> >
<div class="search-content" v-show="this.$cookie.get('username')!=null"> <div class="search-content">
<div class="search-his" v-show="historySearch.length!=null"> <div class="search-his">
<div> <div>
<span class="title">搜索历史</span> <span class="title">搜索历史</span>
<span class="clear" @click="clearHistory"><i class="el-icon-circle-close"></i>清空</span> <span class="clear" @click="clearHistory" v-show="this.$cookie.get('username')!=null"><i class="el-icon-circle-close"></i>清空</span>
</div> </div>
<el-tag <div v-show="this.$cookie.get('username')!=null">
<el-tag
v-for="(tag,index) in historySearch" v-for="(tag,index) in historySearch"
:key="index" :key="index"
size="small" size="small"
@@ -23,9 +24,14 @@
@close="handleClose(tag)" @close="handleClose(tag)"
style="margin-right: 10px; margin-top: 10px; cursor: pointer" style="margin-right: 10px; margin-top: 10px; cursor: pointer"
@click="handleSearch(tag)" @click="handleSearch(tag)"
> >
{{ tag }} {{ tag }}
</el-tag> </el-tag>
</div>
<div v-show="this.$cookie.get('username')==null">
<span style="color: #9ca3af;font-size: 15px">你还没有登录哦~</span>
</div>
</div> </div>
</div> </div>
@@ -56,7 +62,7 @@ export default {
isMouseOver: false, isMouseOver: false,
search: '', search: '',
tipsWord: '', tipsWord: '',
historySearch: [], historySearch: null,
items: [ items: [
] ]
} }
@@ -114,34 +120,34 @@ export default {
}); });
}, },
handleClose(tag){ handleClose(tag){
var that=this;
axios({ axios({
method: 'post', method: 'post',
// 请求的地址 // 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/deletelabel', url: 'http://localhost:8082/helloGithub_war_exploded/deletelabel',
// URL 中的查询参数 // URL 中的查询参数
params: { params: {
tag:tag+';' tag:tag
} }
}).then((res)=>{ }).then((res)=>{
if(res.date.code===200){ if(res.data.code===200){
that.$message({ Vue.prototype.$notify({
showClose: true, title: '成功',
message: res.date.msg, message: ('i', {style: 'color: teal'}, res.data.msg),
type: 'success' type: 'success',
offset: 50
}); });
}else{ }else{
that.$message({ Vue.prototype.$notify.error({
showClose: true, title: '错误',
message: res.date.msg, message: res.data.msg,
type: 'error' offset: 50
}); });
} }
}); });
} }
}, },
mounted() { mounted() {
this.tipsWord = "helloGithub"; this.tipsWord = "搜索开源项目";
this.gethistorySearch(); this.gethistorySearch();
} }
}; };

View File

@@ -2,7 +2,7 @@
<div style="display: flex;flex-direction: column;flex-wrap: nowrap" v-show="this.$cookie.get('username')!=null"> <div style="display: flex;flex-direction: column;flex-wrap: nowrap" v-show="this.$cookie.get('username')!=null">
<div style="display: flex;flex-direction: row;align-items: center;width: 11vw;justify-content: space-between"> <div style="display: flex;flex-direction: row;align-items: center;width: 11vw;justify-content: space-between">
<div style="display: flex;flex-direction: row;align-items: center"> <div style="display: flex;flex-direction: row;align-items: center">
<el-avatar shape="square" style=" box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)" size="large" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"></el-avatar> <el-avatar shape="square" style=" background-color: #59A3A4;box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)" size="large">{{this.$cookie.get('username')}}</el-avatar>
<div style="margin-left: 5px;display: flex;flex-direction: column;justify-content: space-evenly"> <div style="margin-left: 5px;display: flex;flex-direction: column;justify-content: space-evenly">
<span style="font-weight: bold">{{this.$cookie.get('username')}}</span> <span style="font-weight: bold">{{this.$cookie.get('username')}}</span>
<span style="font-weight: 800;font-size: 13px;color: #3b82f6">Lv.1</span> <span style="font-weight: 800;font-size: 13px;color: #3b82f6">Lv.1</span>
@@ -14,14 +14,14 @@
</div> </div>
<div style="display: flex;flex-direction: row;margin-top: 10px;justify-content: space-between;align-items: center"> <div style="display: flex;flex-direction: row;margin-top: 10px;justify-content: space-between;align-items: center">
<span style="font-size: 10px;color: #9ca3af">贡献值</span> <span style="font-size: 10px;color: #9ca3af">贡献值</span>
<span style="font-weight: bold;color: #59A3A4;font-size: 20px">0/64</span> <span style="font-weight: bold;color: #59A3A4;font-size: 20px">0/100</span>
</div> </div>
<div style="margin-top: 10px"> <div style="margin-top: 10px">
<el-progress :text-inside="true" :stroke-width="15" :percentage="0"></el-progress> <el-progress :text-inside="true" :stroke-width="15" :percentage="0"></el-progress>
</div> </div>
<el-divider></el-divider> <el-divider></el-divider>
<div style="display: flex;align-items: center;justify-content: space-between;flex-direction: row;flex-wrap: nowrap;"> <div style="display: flex;align-items: center;justify-content: space-between;flex-direction: row;flex-wrap: nowrap;">
<el-link style="color: #9ca3af;font-size: 13px" icon="el-icon-s-custom" class="link">我的主页</el-link> <el-link style="color: #9ca3af;font-size: 13px" icon="el-icon-s-custom" class="link" @click="toUserPage">我的主页</el-link>
<el-link style="color: #9ca3af;font-size: 13px" icon="el-icon-switch-button" class="link" @click="signOut">退出登录</el-link> <el-link style="color: #9ca3af;font-size: 13px" icon="el-icon-switch-button" class="link" @click="signOut">退出登录</el-link>
</div> </div>
</div> </div>
@@ -39,6 +39,9 @@ export default {
signOut(){ signOut(){
this.$cookie.delete('username'); this.$cookie.delete('username');
window.location.reload(); window.location.reload();
},
toUserPage(){
this.$router.push({path:'/UserInfoPage'})
} }
} }
} }

View File

@@ -1,5 +1,5 @@
<template> <template>
<div> <div style="margin-top: 30px">
个人主页 个人主页
</div> </div>
</template> </template>