Files
jobslink-user-clent/pages/projectInfo/sub/inviteList.vue

186 lines
6.1 KiB
Vue
Raw Normal View History

2024-05-07 16:59:22 +08:00
<template>
<view>
<view v-if="dataSource.length">
<u-collapse>
<u-collapse-item :title="`${item.realName} ${item.education}` " class="collapseItem" name="Docs guide"
v-for="(item, index) in dataSource" :key="item.id">
2024-05-07 19:57:08 +08:00
<text slot="value" class="u-page__item__title__slot-title">自定义内容</text>
2024-05-07 16:59:22 +08:00
<view class="u-collapse-content">
2024-05-07 19:57:08 +08:00
<view class="content_line">期望薪资{{ item.wage }}</view>
<view class="content_line">&emsp;&emsp;{{ item.skillName }}</view>
<view class="content_line">工作地区{{ item.workplace }}</view>
2024-05-07 16:59:22 +08:00
<view class="btnGr" v-if="item.isWorkInvite === 0" @click="updataRow(item)">&emsp;&emsp;
</view>
<view class="btnHuy" v-else @click="removeRow(item)">&emsp;&emsp;</view>
</view>
</u-collapse-item>
</u-collapse>
<!-- <block v-for="(item, index) in dataSource" :key="item.id">
<view class="search-item">
{{item.realName}}
<view style="flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">
{{ item.telphone }}
</view>
<view class="baddd"></view>
</view>
</block> -->
</view>
<empty v-else content="暂无问卷" mrTop="300"></empty>
</view>
</template>
<script>
import {
getInviteUserList,
userrecruitUserInvite,
cancelUserInvite
} from '@/api/userrecruit.js'
export default {
data() {
return {
dataSource: [],
loadOption: {},
}
},
onLoad(option) {
this.loadOption = option
this.getList("refresh");
},
onReachBottom() {
this.getList();
},
onPullDownRefresh() {
this.getList("refresh");
},
methods: {
async updataRow(item) {
let params = {
workId: this.loadOption.id,
type: this.loadOption.jobType,
fromUid: this.loadOption.createUserId,
toUid: item.userId,
}
uni.showLoading({
title: '邀请中'
})
let resData = await userrecruitUserInvite(params)
uni.hideLoading()
if (resData.data.code === 200) {
this.$api.msg('邀请成功')
// this.getList()
console.log(this.dataSource.map((vItem) => {
if (item.userId === vItem.userId) {
return {
...item,
isWorkInvite: 1
}
}
return item
}))
this.dataSource = this.dataSource.map((vItem) => {
if (item.userId === vItem.userId) {
return {
...item,
isWorkInvite: 1
}
}
return item
})
}
},
async removeRow(item) {
let params = {
workInviteId: item.id
}
uni.showLoading({
title: '取消中'
})
let resData = await cancelUserInvite(params)
uni.hideLoading()
if (resData.data.code === 200) {
this.$api.msg('取消成功')
// this.getList()
this.dataSource = this.dataSource.map((vItem) => {
if (item.userId === vItem.userId) {
return {
...item,
isWorkInvite: 0
}
}
return item
})
}
},
async getList(type = 'add') {
if (type === "refresh") {
this.pageNumber = 1;
}
const {
jobType,
id
} = this.loadOption
let params = {
type: jobType,
workId: id
}
let resData = await getInviteUserList(params)
uni.stopPullDownRefresh()
if (resData.data.code === 200) {
this.dataSource = resData.data.data
}
}
}
}
</script>
<style scoped>
2024-05-07 19:57:08 +08:00
.content_line {
margin-top: 10rpx;
}
2024-05-07 16:59:22 +08:00
.btnGr {
background-color: green;
color: #FFFFFF;
font-size: 24rpx;
padding: 5rpx 10rpx;
border-radius: 5rpx;
text-align: center;
2024-05-07 19:57:08 +08:00
margin-top: 10rpx;
2024-05-07 16:59:22 +08:00
}
.btnHuy {
2024-05-07 19:57:08 +08:00
margin-top: 10rpx;
2024-05-07 16:59:22 +08:00
background-color: #e8e8e8;
color: #FFFFFF;
font-size: 24rpx;
padding: 5rpx 10rpx;
border-radius: 5rpx;
text-align: center;
}
.baddd {
background: #f6f6f6;
height: 20rpx;
}
.search-item {
display: flex;
align-items: center;
font-size: 26rpx;
border-bottom: 1rpx solid #ddd;
height: 80rpx;
line-height: 80rpx;
padding: 10rpx 30rpx;
}
.search-item .type {
font-size: 20rpx;
color: #707070;
background-color: #dddddd;
border-radius: 15rpx;
height: 30rpx;
line-height: 30rpx;
padding: 0 20rpx;
}
</style>