特易招,招聘小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

291 lines
5.3 KiB

11 months ago
11 months ago
10 months ago
11 months ago
10 months ago
8 months ago
10 months ago
11 months ago
11 months ago
8 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
10 months ago
11 months ago
10 months ago
8 months ago
8 months ago
8 months ago
11 months ago
10 months ago
10 months ago
11 months ago
11 months ago
11 months ago
8 months ago
11 months ago
8 months ago
11 months ago
8 months ago
11 months ago
8 months ago
11 months ago
11 months ago
  1. <template>
  2. <!-- 数据不存在时的友好提示 -->
  3. <view v-if="!item || !item.id" class="work-item deleted-item">
  4. <view class="deleted-content">
  5. <view class="deleted-icon"></view>
  6. <view class="deleted-text">
  7. <view class="deleted-title">职位已被删除</view>
  8. <view class="deleted-desc">该职位信息可能已被删除或不存在</view>
  9. </view>
  10. </view>
  11. </view>
  12. <!-- 正常数据显示 -->
  13. <view v-else class="work-item"
  14. :class="{ 'expired': isExpired }"
  15. @click="handledClick">
  16. <view class="top">
  17. <view class="title">
  18. {{ item.title }}
  19. </view>
  20. <view class="price"
  21. v-if="item.salaryLow >= 1000">
  22. <text>
  23. {{ (item.salaryLow / 1000).toFixed(0) }}
  24. </text>
  25. <text
  26. v-if="item.salaryUp">
  27. -{{ (item.salaryUp / 1000).toFixed(0) }}
  28. </text>
  29. K
  30. </view>
  31. <view class="price" v-else>
  32. <text>{{ item.salaryLow }}</text>
  33. <text
  34. v-if="item.salaryUp">-{{ item.salaryUp }}</text>
  35. </view>
  36. </view>
  37. <!-- 过期状态显示 -->
  38. <view class="expired-status" v-if="isExpired">
  39. <text class="expired-text">招聘已截止</text>
  40. </view>
  41. <view class="tag-list">
  42. <view
  43. v-for="(t, i) in lableText"
  44. :key="i">
  45. {{ t }}
  46. </view>
  47. </view>
  48. <view class="bottom">
  49. <view class="address">
  50. <!-- <text>2.5km | 楚河汉区</text> -->
  51. {{ item.workAddress }}
  52. </view>
  53. <view class="time">
  54. <!-- 09月23日 1620 -->
  55. {{ $dayjs(item.createTime).format('YYYY-MM-DD') }}
  56. </view>
  57. <view class="phone"
  58. :class="{ 'disabled': isExpired }"
  59. @click.stop="callPhone">
  60. <image src="/static/image/home/phone.png" mode=""></image>
  61. 联系老板
  62. </view>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. export default {
  68. props : {
  69. item : {
  70. default : {}
  71. }
  72. },
  73. computed : {
  74. lableText(){
  75. if (!this.item) return []
  76. let arr =
  77. this.item.tab ?
  78. this.item.tab.split('、')
  79. : []
  80. if(this.item.workAge){
  81. arr.unshift(this.item.workAge)
  82. }
  83. if(this.item.qulification){
  84. arr.unshift(this.item.qulification)
  85. }
  86. return arr
  87. },
  88. // 检查是否过期
  89. isExpired(){
  90. if(!this.item || !this.item.deadline) return false
  91. const now = this.$dayjs()
  92. const deadline = this.$dayjs(this.item.deadline)
  93. return now.isAfter(deadline)
  94. },
  95. // 检查数据是否有效
  96. isDataValid(){
  97. return this.item && this.item.id
  98. }
  99. },
  100. data() {
  101. return {
  102. }
  103. },
  104. methods: {
  105. callPhone(){
  106. // 检查数据是否有效
  107. if (!this.isDataValid) {
  108. uni.showToast({
  109. title: '职位信息不可用',
  110. icon: 'none'
  111. });
  112. return;
  113. }
  114. // 如果过期,禁止拨打电话
  115. if(this.isExpired) {
  116. uni.showToast({
  117. title: '招聘已截止',
  118. icon: 'none'
  119. })
  120. return
  121. }
  122. // 检查电话号码是否存在
  123. if (!this.item.phone) {
  124. uni.showToast({
  125. title: '联系方式不可用',
  126. icon: 'none'
  127. });
  128. return;
  129. }
  130. uni.makePhoneCall({
  131. phoneNumber: this.item.phone,
  132. success() {
  133. console.log('安卓拨打成功');
  134. },
  135. fail() {
  136. console.log('安卓拨打失败');
  137. }
  138. })
  139. },
  140. handledClick(){
  141. // 检查数据是否有效
  142. if (!this.isDataValid) {
  143. uni.showToast({
  144. title: '职位信息不可用',
  145. icon: 'none'
  146. });
  147. return;
  148. }
  149. // 如果过期,禁止点击
  150. if(this.isExpired) {
  151. uni.showToast({
  152. title: '招聘已截止,无法查看详情',
  153. icon: 'none'
  154. })
  155. return
  156. }
  157. this.$emit('click')
  158. },
  159. }
  160. }
  161. </script>
  162. <style scoped lang="scss">
  163. .work-item{
  164. background-color: #fff;
  165. padding: 20rpx;
  166. border-radius: 20rpx;
  167. position: relative;
  168. &.deleted-item {
  169. background-color: #f5f5f5;
  170. border: 2rpx dashed #ccc;
  171. padding: 40rpx 20rpx;
  172. .deleted-content {
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. flex-direction: column;
  177. text-align: center;
  178. .deleted-icon {
  179. font-size: 60rpx;
  180. margin-bottom: 20rpx;
  181. }
  182. .deleted-text {
  183. .deleted-title {
  184. font-size: 32rpx;
  185. color: #666;
  186. font-weight: bold;
  187. margin-bottom: 10rpx;
  188. }
  189. .deleted-desc {
  190. font-size: 24rpx;
  191. color: #999;
  192. }
  193. }
  194. }
  195. }
  196. // 过期状态样式
  197. &.expired {
  198. opacity: 0.6;
  199. background-color: #f5f5f5;
  200. .title {
  201. color: #999;
  202. }
  203. .price {
  204. color: #999 !important;
  205. }
  206. }
  207. .top{
  208. display: flex;
  209. justify-content: space-between;
  210. font-weight: 900;
  211. .title{
  212. }
  213. .price{
  214. color: $uni-color;
  215. }
  216. }
  217. // 过期状态标识
  218. .expired-status {
  219. position: absolute;
  220. top: 50%;
  221. left: 50%;
  222. transform: translate(-50%, -50%);
  223. z-index: 10;
  224. .expired-text {
  225. background-color: rgba(0, 0, 0, 0.8);
  226. color: #fff;
  227. padding: 16rpx 32rpx;
  228. border-radius: 20rpx;
  229. font-size: 28rpx;
  230. font-weight: 600;
  231. }
  232. }
  233. .bottom{
  234. display: flex;
  235. justify-content: space-between;
  236. align-items: center;
  237. font-size: 24rpx;
  238. gap: 16rpx;
  239. .time{
  240. color: #999999;
  241. flex-shrink: 0;
  242. }
  243. .phone{
  244. background-color: rgba($uni-color, 0.2);
  245. color: $uni-color;
  246. padding: 8rpx 16rpx;
  247. border-radius: 10rpx;
  248. flex-shrink: 0;
  249. image{
  250. width: 20rpx;
  251. height: 20rpx;
  252. }
  253. // 禁用状态样式
  254. &.disabled {
  255. background-color: #f0f0f0;
  256. color: #999;
  257. opacity: 0.6;
  258. }
  259. }
  260. }
  261. }
  262. </style>