AllWork.vue
4.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<template>
<view>
<view class="search-box">
<view class="search">
<view class="iconfont icon-fadajing"></view>
<input type="text" placeholder="热门搜索:成都、高薪" v-model="query.keyword" />
<view class="search-btn" @click="Searchtbrecruit()">搜索</view>
</view>
</view>
<view class="title-screen">
<view class="title-screen-box">发布时间<image src="../../static/down.png"></image>
</view>
</view>
<!-- 文章数据 -->
<mescroll-body ref="mescrollRef" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption"
:top="0">
<view class="record-list">
<view class="list" @click="JobsDetails(item.id)" v-for="item in tbrecruitList">
<view class="title-date">
<view class="title">
<text class="two-omit">{{item.companyName}}-{{item.jop}}</text>
</view>
<view class="date">
<text class="one-omit">{{item.introduce}}</text>
</view>
<view>
<view class="yellow-btn">{{getDifferTime(item.lastModifyTime)}}</view>
</view>
</view>
<view class="integral">
<text class="integral-btn">{{item.jopName}}</text>
<view class="integral-num">{{item.pay}}</view>
</view>
</view>
</view>
</mescroll-body>
<!-- tabbar -->
<TabBar :tabBarShow="1"></TabBar>
</view>
</template>
<script>
import BASE_URL from '@/common/config.js'
import TabBar from '../../components/TabBar/TabBar.vue';
import customHead from "@/components/xy-customhead/xy-customhead.vue";
// 引入mescroll-mixins.js
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
export default {
mixins: [MescrollMixin], // 使用mixin
components: {
TabBar,
customHead,
},
data() {
return {
BASE_URL,
headtitle: '铭钛招聘',
mescroll: null, // mescroll实例对象 (此行可删,mixins已默认)
// 下拉刷新的配置(可选, 绝大部分情况无需配置)
downOption: {},
// 上拉加载的配置(可选, 绝大部分情况无需配置)
upOption: {},
tbrecruitList: [],
query: {
currentPage: 1,
pageSize: 10,
keyword: "",
sidx:"lastModifyTime",
sort:"desc"
}
};
},
onReady() {
uni.hideTabBar();
},
onLoad(e) {
this.query.keyword = e.keyword;
this.Gettbrecruit();
},
methods: {
JobsDetails(id) {
uni.navigateTo({
url: '/pages/JobsDetails/JobsDetails?id=' + id
})
},
Searchtbrecruit() {
this.query.currentPage = 1;
this.query.pageSize = 10;
this.tbrecruitList = [];
this.Gettbrecruit();
},
Gettbrecruit() {
this.API.Gettbrecruit(this.query).then(res => {
this.tbrecruitList = res.data.list;
});
},
getDifferTime(startDate) {
startDate = this.formatDateTime(startDate);
let startTime = new Date(Date.parse(startDate.replace(/-/g, "/"))).getTime();
let endTime = new Date(Date.parse(this.getNowDate().replace(/-/g, "/"))).getTime();
let dates = Math.abs((startTime - endTime)) / (1000 * 60 * 60 * 24);
let DayNumber = Math.ceil(dates);
if (DayNumber <= 7) {
return DayNumber + "天内发布"
} else {
return DayNumber + "天前发布"
}
},
getNowDate() {
const timeOne = new Date()
const year = timeOne.getFullYear()
let month = timeOne.getMonth() + 1
let day = timeOne.getDate()
month = month < 10 ? '0' + month : month
day = day < 10 ? '0' + day : day
const NOW_MONTHS_AGO = `${year}-${month}-${day}`
return NOW_MONTHS_AGO
},
formatDateTime(value) { // 时间戳转换日期格式方法
if (value == null) {
return ''
} else {
const date = new Date(value)
const y = date.getFullYear() // 年
let MM = date.getMonth() + 1 // 月
MM = MM < 10 ? ('0' + MM) : MM
let d = date.getDate() // 日
d = d < 10 ? ('0' + d) : d
let h = date.getHours() // 时
h = h < 10 ? ('0' + h) : h
let m = date.getMinutes() // 分
m = m < 10 ? ('0' + m) : m
let s = date.getSeconds() // 秒
s = s < 10 ? ('0' + s) : s
return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s
}
},
/*下拉刷新的回调, 有三种处理方式:*/
downCallback() {
this.mescroll.endSuccess();
var that = this;
that.query.currentPage = 1;
that.query.pageSize = 10;
this.Gettbrecruit(that.query);
},
/*上拉加载的回调*/
upCallback(page) {
setTimeout(() => {
this.mescroll.endByPage(10, 20);
}, 2000)
},
/**
* 文章点击
*/
onArticle(id) {
uni.navigateTo({
url: '/pages/ArticleDetails/ArticleDetails?id=' + id,
})
}
}
}
</script>
<style scoped lang="scss">
@import 'AllWork.scss';
</style>