<template>
|
|
<view class="page">
|
|
|
|
<navbar title="我的收藏"
|
|
bgColor="#3796F8"
|
|
leftClick
|
|
color="#fff"
|
|
@leftClick="$utils.navigateBack"/>
|
|
|
|
<userListSwipe
|
|
:options="options"
|
|
v-if="role"
|
|
keyName="employResume"
|
|
@clickSwipeAction="clickSwipeAction"
|
|
:list="list"/>
|
|
|
|
<workListSwipe
|
|
:options="options"
|
|
v-else
|
|
keyName="employJob"
|
|
@clickSwipeAction="clickSwipeAction"
|
|
:list="list"/>
|
|
|
|
<uv-empty mode="list" v-if="list.length == 0"></uv-empty>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import workListSwipe from '@/components/list/workList/workListSwipe.vue'
|
|
import userListSwipe from '@/components/list/userList/userListSwipe.vue'
|
|
import mixinList from '@/mixins/list.js'
|
|
import { mapState } from 'vuex'
|
|
export default {
|
|
mixins : [mixinList],
|
|
components : {
|
|
workListSwipe,
|
|
userListSwipe,
|
|
},
|
|
data() {
|
|
return {
|
|
options: [
|
|
{
|
|
text: '删除',
|
|
style: {
|
|
backgroundColor: '#FA5A0A'
|
|
}
|
|
},
|
|
],
|
|
mixinsListApi : 'employeeQueryCollectionJobList',
|
|
list2 : [],
|
|
}
|
|
},
|
|
computed : {
|
|
...mapState([
|
|
'role',
|
|
]),
|
|
},
|
|
onLoad() {
|
|
this.mixinsListApi = (this.role ? 'boss' : 'employee') + 'QueryCollectionJobList'
|
|
},
|
|
methods: {
|
|
clickSwipeAction({e, item}){
|
|
uni.showModal({
|
|
title: '确认删除吗?',
|
|
success : res => {
|
|
if(res.confirm){
|
|
if(this.role){
|
|
this.addResumeCollection(item.employResume.id)
|
|
}else{
|
|
this.addJobCollection(item.employJob.id)
|
|
}
|
|
}
|
|
}
|
|
})
|
|
},
|
|
addJobCollection(jobId) {
|
|
let data = {
|
|
jobId
|
|
}
|
|
this.$api('addJobCollection', data, res => {
|
|
if (res.code == 200) {
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
}
|
|
this.getData();
|
|
})
|
|
},
|
|
addResumeCollection(resumeId){
|
|
let data = {
|
|
resumeId
|
|
}
|
|
this.$api('addResumeCollection', data, res => {
|
|
this.getData();
|
|
if(res.code == 200){
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// getDataThen(list, total, result){
|
|
// let l = []
|
|
// result.forEach(res => {
|
|
// if(this.role){
|
|
// res.employResume.collection = res.employCollectionResume
|
|
// l.push(res.employResume)
|
|
// }else{
|
|
// res.employJob.collection = res.employCollectionJob
|
|
// l.push(res.employJob)
|
|
// }
|
|
// })
|
|
// this.list2 = l
|
|
// },
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.page{
|
|
/deep/ .uv-swipe-action{
|
|
width: 100%;
|
|
}
|
|
}
|
|
</style>
|