今天完成了岗位收藏
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>岗位收藏</title>
<style>
.el-header {
background-color: #d2d5e0;
color: #333;
line-height: 60px;
height: 70px;
}
.el-aside {
color: #333;
height: calc(100vh - 70px);// 设置左侧 aside 高度
}
.el-main {
padding: 0;
height: calc(100vh - 70px);// 设置主体 main 高度
}
a{
text-decoration: none;/*取消下划线*/
color: black;
scroll-behavior: smooth;
}
</style>
</head>
<body>
<div id="peoInformation">
<el-container style="height: 700px; border: 1px solid #eee">
<el-header style=" font-size: 12px">
<span style="font-size: 30px ;color: black">智能简历检索系统</span>
<span style="margin-right: 15px;margin-left: 1000px;font-size: 15px">{{loginFormAndpost.username}},欢迎你</span>
<el-dropdown>
<i class="el-icon-setting" ></i>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item><a href="peoInformationView.html">查看个人信息</a></el-dropdown-item>
<el-dropdown-item><a href="peoInformationUpdate.html">修改个人信息</a></el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-header>
<el-container>
<el-aside width="200px" style="background-color: rgb(238, 241, 246)">
<el-menu :default-openeds="['1','2']" style="text-align: center">
<el-submenu index="1">
<template slot="title"><i class="el-icon-setting"></i></i>个人信息管理</template>
<el-menu-item index="1-1"><a href="peoInformationView.html">查看个人信息</a></el-menu-item>
<el-menu-item index="1-2" ><a href="peoInformationUpdate.html">修改个人信息</a></el-menu-item>
</el-submenu>
<el-submenu index="2">
<template slot="title"><i class="el-icon-menu"></i>岗位信息管理</template>
<el-menu-item index="2-1" ><a href="peoNotes.html">岗位推荐</a></el-menu-item>
<el-menu-item index="2-2" ><a href="peoNotesCollect.html">岗位收藏</a></el-menu-item>
<el-menu-item index="2-3" ><a href="PeoNotesCommit.html">岗位消息</a></el-menu-item>
</el-submenu>
</el-menu>
</el-aside>
<el-main>
<!-- 查询 -->
<!-- :model="formInline"-->
<el-form :inline="true" class="demo-form-inline">
<el-form-item >
<el-form-item label="岗位名称">
<el-input v-model="loginFormAndpost.post.name" placeholder="岗位名称"></el-input>
</el-form-item>
<el-form-item label="学历要求">
<el-input v-model="loginFormAndpost.post.degreeRequire" placeholder="学历要求"></el-input>
</el-form-item>
<el-form-item label="岗位薪资">
<el-input v-model="loginFormAndpost.post.money" placeholder="岗位薪资"></el-input>
</el-form-item>
<el-form-item label="技能要求">
<el-input v-model="loginFormAndpost.post.skillRequire" placeholder="技能要求"></el-input>
</el-form-item>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">查询</el-button>
</el-form-item>
</el-form>
<template>
<el-table
:data="postdata"
style="width: 100%">
<el-table-column
type="index"
width="50">
</el-table-column>
<el-table-column
prop="name"
label="岗位"
align="center">
<template slot-scope="scope">
<el-button @click="specific(scope.$index, scope.row)" type="text" >{{scope.row.name}}</el-button>
</template>
</el-table-column>
</el-table-column>
<el-table-column
prop="degreeRequire"
label="学历要求"
align="center">
</el-table-column>
<el-table-column
prop="money"
align="center"
label="工资">
</el-table-column>
<el-table-column
fixed="right"
align="center"
label="操作">
<template slot-scope="scope">
<el-row>
<el-button type="primary" plain @click="commit(scope.$index, scope.row)">投递
</el-button>
<el-button type="warning" @click="disCollect(scope.$index, scope.row)">取消收藏</el-button>
</el-row>
</template>
</el-table-column>
</el-table>
</template>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[5, 10, 15, 20]"
:page-size="5"
layout="total, sizes, prev, pager, next, jumper"
:total="totalCount">
</el-pagination>
</el-main>
</el-container>
</el-container>
<!--岗位详细信息-->
<el-dialog
title="岗位信息"
:visible.sync="postVisible"
width="70%">
<el-descriptions class="margin-top" :column="4" border style="margin-left: 8%;margin-right: 8%">
<el-descriptions-item style="width: 30%" >
<template slot="label" style="width: 5px">
<i class="el-icon-user"></i>
岗位名称
</template>
<template>
{{post.name}}
</template>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-location-outline"></i>
所属公司
</template>
<el-button @click="companyVisible=true" type="text" >{{company.name}}</el-button>
</el-descriptions-item>
<el-descriptions-item >
<template slot="label">
<i class="el-icon-tickets"></i>
薪资
</template>
{{post.money}}
</el-descriptions-item>
<el-descriptions-item >
<template slot="label">
<i class="el-icon-tickets"></i>
学历要求
</template>
{{post.degreeRequire}}
</el-descriptions-item>
<el-descriptions-item :span="4">
<template slot="label">
<i class="el-icon-tickets"></i>
岗位描述
</template>
{{post.description}}
</el-descriptions-item>
<el-descriptions-item :span="4">
<template slot="label">
<i class="el-icon-tickets"></i>
技能要求
</template>
{{post.skillRequire}}
</el-descriptions-item>
</el-descriptions>
</el-dialog>
<!--公司信息-->
<el-dialog
title="公司信息"
:visible.sync="companyVisible"
width="70%">
<el-descriptions class="margin-top" :column="2" border style="margin-left: 8%;margin-right: 8%">
<el-descriptions-item style="width: 30%" >
<template slot="label" style="width: 5px">
<i class="el-icon-user"></i>
公司名称
</template>
<template>
{{company.name}}
</template>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-location-outline"></i>
公司电话
</template>
{{company.phone}}
</el-descriptions-item>
<el-descriptions-item :span="2">
<template slot="label">
<i class="el-icon-tickets"></i>
公司简介
</template>
{{company.introduction}}
</el-descriptions-item>
</el-descriptions>
</el-dialog>
</div>
</body>
<script src="js/vue.js"></script>
<script src="js/axios-0.18.0.js"></script>
<!--<script src="element-ui/lib/index.js"></script>-->
<!--<link rel="stylesheet" href="element-ui/lib/theme-chalk/index.css">-->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<SCRIPT>
new Vue({
el:"#peoInformation",
data() {
return {
postVisible:false,
companyVisible:false,
disCollectvisible:false,
pageSize:5,
totalCount: 100,
currentPage:1,
postdata: [],
loginFormAndpost:{
post:{
name:'',
skillRequire:'',
money:'',
degreeRequire:''
},
username:''
},
post:{},
company:{}
}
},
mounted(){
this.mountedd();
},
methods:{
mountedd(){
var _this = this;
this.loginFormAndpost.username = localStorage.getItem("username"); //获取指定key本地存储的值
//var seekerId = localStorage.getItem("seekerId"); //获取指定key本地存储的值
axios({
method:"post",
url:"http://localhost:8080/notes/post/selectCollectPostBySeekerId?currentPage="+this.currentPage+"&pageSize="+this.pageSize,
data:_this.loginFormAndpost
}).then(function (resp){
_this.postdata = resp.data.rows;
_this.totalCount = resp.data.totalCount;
})
},
onSubmit(){
this.mountedd();
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`);
this.pageSize=val;
this.mountedd();
this.currentPage=1;
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
this.currentPage=val;
this.mountedd();
this.currentPage=1;
},
specific(index,cow){
console.log(index+" "+cow.id);
var _this=this;
axios({
method:"post",
url:"http://localhost:8080/notes/post/selectPostAndCompanyById",
data:cow.id
}).then(function (resp){
_this.post=resp.data.post;
_this.company=resp.data.company;
_this.postVisible=true;
})
},
disCollect(index,row){
var _this=this;
axios({
method:"get",
url:"http://localhost:8080/notes/post/postcollect?seekerName="+_this.loginFormAndpost.username+"&collect=0&postid="+row.id,//+"&companyId="+_this.company.id
}).then(function (resp){
console.log(resp.data)
_this.$message({
showClose: true,
message: '已成功取消此条收藏信息',
type: 'warning'
});
_this.disCollectvisible=false;
_this.mountedd();
})
},
commit(index,row){
var _this=this;
axios({
method:"get",
url:"http://localhost:8080/notes/post/postcommit?seekerName="+_this.loginFormAndpost.username+"&commit=1&postid="+row.id,//+"&companyId="+_this.company.id
}).then(function (resp){
console.log(resp.data)
if(resp.data==="error1")
{
_this.$message({
showClose: true,
message: '你已投递此岗位,无需重复操作',
type: 'warning'
});
}else{
_this.$message({
showClose: true,
message: '恭喜你,投递成功',
type: 'success'
});
}
})
},
}
})
</SCRIPT>
</html>
在实现岗位收藏时,遇到了数据库部分如何进行储存,在进行收藏,取消收藏室时,遇到了是修改数据还是删除数据。
最后进行了一些列的判断解决了问题。
预计明天进行岗位的投递。
浙公网安备 33010602011771号