<template>
    <view>
        <block v-if="recordList.length > 0">
            <!-- <view class="weui-search-bar weui-search-bar_focusing bgf" id="searchBar" style="line-height: 1;padding-left:16px;padding-right:16px">
    <view class="weui-search-bar__form flex-1 fsa g_bg_f_5">
      <view class="weui-search-bar__box flex-1 fsa" style="border-radius: 17px;">
        <i class="iconfont icon-sousuo"></i>
        <input type="text" class="weui-search-bar__input flex-1 c3" style="max-width:150px" placeholder-style="color:#999;" value="{{inputVal}}" placeholder="搜索职位名称" bindinput="inputTyping" bindconfirm="searchKey" auto-focus confirm-type="search" />
        <view class="iconfont icon-qingchu biggerSize" wx:if="{{inputVal}}" catchtap="clearInput"></view>
        <view class="search" bindtap="searchKey">搜索</view>
      </view>
    </view>
  </view> -->
            <view class="bt1">
                <view
                    :class="(item.recruitment == 1 ? 'bgf' : 'bgf') + ' display-flex p16 pb0'"
                    :data-id="item.id"
                    :data-item="item"
                    :data-recruitment="item.recruitment"
                    @tap="goDetail"
                    hover-class="g_bg_f_5"
                    wx:item="item"
                    v-for="(item, index) in recordList"
                    :key="index"
                >
                    <view class="display-flex flex-1 pb16 bb1 pr">
                        <view class="flex-1">
                            <view class="f16 fwb">{{ item.storeJobName || '-' }}</view>
                            <view class="f14 c6 mt8">{{ item.citys && item.citys != '-' ? item.citys + ' | ' : '' }} {{ item.age || '-' }}</view>
                        </view>
                        <view class="tr">
                            <view class="f14 c9">{{ item.createTime || '-' }}</view>
                        </view>
                        <!-- <image style="width: 80px;height: 80px;position: absolute;left: 200px;top:-10px" src="//matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/tingzhao.svg" wx:if="{{item.recruitment != 1}}"></image> -->
                    </view>
                </view>
            </view>
        </block>
        <block v-else>
            <view class="tc">
                <view class="t-icon t-icon-zanwu" style="width: 80px; height: 80px; margin: 180px auto 10px"></view>
                <view class="cccc">暂无记录</view>
            </view>
        </block>
    </view>
</template>

<script>
// pages/mine/myJob/index.js
const app = getApp();
const commonUtil = require('../../../utils/commonUtil');
const dateUtil = require('../../../utils/dateUtil');
export default {
    data() {
        return {
            recordList: [],
            inputVal: '',
            jobListSearchForm: {
                pageNum: 1,
                pageSize: 50
            }
        };
    }
    /**
     * 生命周期函数--监听页面加载
     */,
    onLoad(options) {},
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {
        this.getList();
    },
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {},
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {},
    methods: {
        getList() {
            var that = this;
            uni.request({
                url: app.globalData.ip + '/yishoudan/common/order/list',
                method: 'Post',
                data: that.jobListSearchForm,
                header: app.globalData.headers,
                success: function (res) {
                    console.log(res);
                    res.data.data.forEach((item, index) => {
                        item['citys'] = commonUtil.setJobInfoPosition(item.storeDistrict);
                        // item['genderRestrict'] = commonUtil.getGenderByMinAge(item.customJob.customJob);
                        if (app.globalData.isNotEmptyCheck(item.minAge) && app.globalData.isNotEmptyCheck(item.maxAge)) {
                            item['age'] = item.minAge + '-' + item.maxAge + '岁';
                        } else if (app.globalData.isNotEmptyCheck(item.minAge)) {
                            item['age'] = item.minAge + '岁以上';
                        } else if (app.globalData.isNotEmptyCheck(item.maxAge)) {
                            item['age'] = item.maxAge + '岁以下';
                        }
                        item['createTime'] = dateUtil.formatDateYMDHM(item.createTime);
                    });
                    that.setData({
                        recordList: res.data.data
                    });
                }
            });
        },

        goDetail(e) {
            var that = this;
            console.log(e.currentTarget.dataset.id);
            console.log(e.currentTarget.dataset.item);

            // if(e.currentTarget.dataset.recruitment != 1){
            //   wx.showToast({
            //     icon: "none",
            //     title: '该职位已停招',
            //     duration: 2000,
            //   });
            //   return
            // }
            uni.navigateTo({
                url: '/pages/mine/jobDetail/index?storeJobId=' + e.currentTarget.dataset.id
            });
        }
    }
};
</script>
<style>
@import './index.css';
</style>
