You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

508 lines
16 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const quickLogin = () => "../quickLogin.js";
const _sfc_main = {
components: {
// unloginInfo,
quickLogin
},
data() {
return {
userinfo: {},
themeColor: getApp().globalData.themeColor,
isUseNewJob: getApp().globalData.isUseNewJob,
localBaseImg: this.G.store().localBaseImg,
appid: getApp().globalData.appid,
defaultLogo: "",
cdnBaseImg: this.G.store().cdnBaseImg,
jobArray: [],
isLogin: false,
popApply: {
isShow: false
},
jid: 0,
appInfo: {}
};
},
// 计算属性
computed: {
status() {
common_vendor.index.__f__("log", "at components/list/job.vue:201", "this.query", this.query);
if (this.query.isFinish >= 0 && this.query.isFinish < this.query.size) {
return "nomore";
} else {
return "loading";
}
}
},
props: {
list: {
type: Array,
default: () => {
return [];
}
},
loading: {
type: Boolean,
default: () => {
return true;
}
},
speed: {
type: Number,
default: () => {
return -1;
}
},
query: {
type: Object,
default: () => {
return {
page: 1,
size: 10,
list: [],
isFinish: -1
};
}
},
from: {
type: String,
default: () => {
return "default";
}
},
isSelf: {
type: Boolean,
default: () => {
return false;
}
},
isuse: {
type: String,
default: () => {
return "default";
}
},
emptyText: {
type: String,
default: () => {
return "嘿,这里还没有数据呢";
}
},
emptySubText: {
type: String,
default: () => {
return common_vendor.index.getStorageSync("apply-token") ? "关注发单号,查看发单号职位" : "";
}
},
pt: {
default: 0
},
reload: {
default: 0
},
isTrigger: {
// 下拉的判断
default: false
},
isHaveOrder: {
default: () => {
return false;
}
},
active: {
default: () => {
return 0;
}
},
recordStatus: {
default: () => {
return 1;
}
},
bg: {
default: () => {
return "#ededed";
}
},
isShowLoginBtn: {
default: () => {
return false;
}
}
},
watch: {
list: {
handler(val) {
this.jobArray = val;
common_vendor.index.__f__("log", "at components/list/job.vue:309", "this.jobArrayval", this.jobArray);
this.appInfo = common_vendor.index.getStorageSync("miniApp-info");
if (common_vendor.index.getStorageSync("apply-token")) {
this.userinfo = common_vendor.index.getStorageSync("apply-userinfo");
this.isLogin = true;
} else {
this.isLogin = false;
}
},
deep: true,
immediate: true
},
reload() {
if (common_vendor.index.getStorageSync("apply-token")) {
this.isLogin = true;
} else {
this.isLogin = false;
}
}
},
beforeCreate() {
setTimeout(() => {
}, 1e3);
},
created() {
let that = this;
that.defaultLogo = common_vendor.index.getStorageSync("miniApp-info").logo;
this.jobArray = this.list;
common_vendor.index.__f__("log", "at components/list/job.vue:337", "this.jobArray", this.jobArray);
},
methods: {
tobeAgencyToast() {
common_vendor.index.showModal({
title: "",
content: "抱歉,您需先成为伯才代理以获得使用权限。",
confirmColor: "#576b95",
confirmText: "入驻平台",
cancelText: "知道了",
success(res) {
if (res.confirm) {
common_vendor.wx$1.navigateTo({
url: "/root/other/tobeAgencyChoose"
});
}
}
});
},
toApplyInfo($item) {
let that = this;
let params = {
id: $item.agencyId,
type: 1,
shareForm: "apply",
isShowMore: true,
isShowJob: true
};
common_vendor.index.navigateTo({
url: "/root/detail/userShare?" + that.G.objToStr(params)
});
},
handleCard($item) {
common_vendor.index.__f__("log", "at components/list/job.vue:371", "$item", $item);
let that = this;
if (that.from == "record") {
common_vendor.index.$emit("changeJobInfo", { info: $item });
common_vendor.index.navigateBack({
delta: 1
});
return;
} else {
if (that.from == "shareList") {
this.$emit("clickCard", $item);
} else {
if (that.recordStatus == 1 || that.recordStatus == 2 || that.isSelf) {
common_vendor.index.navigateTo({
url: "/root/detail/job?id=" + $item.leafCateId + "&from=" + that.from
});
} else {
common_vendor.index.showToast({
title: "关注发单号后才可查看详情",
icon: "none"
});
}
}
}
},
goLogin() {
common_vendor.index.reLaunch({
url: "/root/person/loginIndex"
});
},
openApplyPop($item) {
let that = this;
this.getCode((res) => {
common_vendor.index.setStorageSync("apply-code", res);
that.jid = $item.id;
common_vendor.index.__f__("log", "at components/list/job.vue:406", "that.jid", that.jid);
that.popApply.isShow = true;
});
},
getCode(callback = () => {
}) {
common_vendor.index.login({
success(wxRes) {
callback(wxRes.code);
},
fail(res) {
common_vendor.index.__f__("log", "at components/list/job.vue:416", res);
}
});
},
handleClose() {
this.popApply.isShow = false;
},
checkJob(_item) {
this.$emit("checkJob", _item);
},
sendJob(_item) {
this.$emit("sendJob", _item);
},
submitApply(e) {
let that = this;
({
userName: e.name,
tel: e.tel,
jobId: that.jid
});
common_vendor.index.__f__("log", "at components/list/job.vue:437", 'uni.getStorageSync("AGENCY_ID")', common_vendor.index.getStorageSync("AGENCY_ID"));
common_vendor.index.__f__("log", "at components/list/job.vue:438", 'uni.getStorageSync("userinfo")', common_vendor.index.getStorageSync("apply-userinfo"));
return;
},
recruitmentChange($e, $item) {
common_vendor.index.__f__("log", "at components/list/job.vue:455", $e);
common_vendor.index.__f__("log", "at components/list/job.vue:456", $item);
this.G.Get(this.api.update_job_recruitment + "/" + $item.id, { recruitment: $e ? 1 : 2 }, (res) => {
common_vendor.index.__f__("log", "at components/list/job.vue:458", "res", res);
});
},
handleCollect($item) {
let that = this;
if (this.isLogin) {
$item.collected = !$item.collected;
that.G.Get(that.api.yi_job_collect + "/" + $item.id, {}, (res) => {
if ($item.collected) {
common_vendor.index.showToast({
icon: "none",
title: "收藏成功"
});
} else {
common_vendor.index.showToast({
icon: "none",
title: "取消收藏"
});
}
});
} else {
common_vendor.index.showModal({
title: "登录提示",
content: "收藏功能需要登录才能使用,是否登录",
success(res) {
if (res.confirm) {
common_vendor.index.navigateTo({
url: "/root/person/loginIndex"
});
}
}
});
}
},
successLogin(e) {
this.$emit("successLogin");
},
delJob() {
let that = this;
this.G.handleConfirm({
content: "是否删除该职位",
success(res) {
if (res.confirm) {
that.G.Post(that.api.job_delJob + "/" + that.jid, {}, (res2) => {
common_vendor.index.__f__("log", "at components/list/job.vue:507", res2);
that.$emit("updateList");
that.popApply.isShow = false;
});
}
}
});
},
updateJob() {
let that = this;
common_vendor.index.navigateTo({
url: `/root/merchantManagement/jobForm?id=${that.jid}`
});
this.popApply.isShow = false;
},
showConfig(_item) {
common_vendor.index.__f__("log", "at components/list/job.vue:523", _item);
this.jid = _item.id;
this.popApply.isShow = true;
},
timeShowXXX(updateTime) {
const now = Date.now();
const diff = now - updateTime;
const seconds = Math.floor(diff / 1e3);
const minutes = Math.floor(seconds / 60);
const hours = Math.floor(minutes / 60);
const days = Math.floor(hours / 24);
if (days < 2) {
if (hours > 0) {
return `${hours}小时前`;
} else if (minutes > 0) {
return `${minutes}分钟前`;
} else {
return `刚刚`;
}
} else {
return `${days}天前`;
}
}
}
};
if (!Array) {
const _component_g_loading = common_vendor.resolveComponent("g-loading");
const _component_g_empty = common_vendor.resolveComponent("g-empty");
const _component_g_button = common_vendor.resolveComponent("g-button");
const _easycom_u_switch2 = common_vendor.resolveComponent("u-switch");
const _component_quickLogin = common_vendor.resolveComponent("quickLogin");
const _easycom_u_loadmore2 = common_vendor.resolveComponent("u-loadmore");
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
(_component_g_loading + _component_g_empty + _component_g_button + _easycom_u_switch2 + _component_quickLogin + _easycom_u_loadmore2 + _easycom_u_popup2)();
}
const _easycom_u_switch = () => "../../uni_modules/vk-uview-ui/components/u-switch/u-switch.js";
const _easycom_u_loadmore = () => "../../uni_modules/vk-uview-ui/components/u-loadmore/u-loadmore.js";
const _easycom_u_popup = () => "../../uni_modules/vk-uview-ui/components/u-popup/u-popup.js";
if (!Math) {
(_easycom_u_switch + _easycom_u_loadmore + _easycom_u_popup)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $props.loading && $props.speed == -1
}, $props.loading && $props.speed == -1 ? {
b: common_vendor.p({
paddingBottom: "g_pb_120"
})
} : {}, {
c: !$props.loading && $props.speed == 0
}, !$props.loading && $props.speed == 0 ? common_vendor.e({
d: common_vendor.p({
text: $props.emptyText
}),
e: $props.isShowLoginBtn
}, $props.isShowLoginBtn ? {
f: common_vendor.o($options.goLogin),
g: common_vendor.p({
btnText: "登录查看",
type: "primary"
})
} : {}, {
h: $props.pt + "rpx"
}) : {}, {
i: $props.speed > 0
}, $props.speed > 0 ? common_vendor.e({
j: common_vendor.f($data.jobArray, (item, index, i0) => {
return common_vendor.e({
a: item.recruitment == 2 && $props.from != "mine"
}, item.recruitment == 2 && $props.from != "mine" ? {} : {}, {
b: item.picked == 1
}, item.picked == 1 ? {} : {}, {
c: common_vendor.t(item.jobName),
d: common_vendor.t($options.timeShowXXX(item.updateTime)),
e: common_vendor.t(item.district),
f: common_vendor.t(item.district ? "丨" : ""),
g: common_vendor.t((item.gender || "-") + "丨" + item.age),
h: common_vendor.t(item.distance && item.storeDistrict ? item.distance : "")
}, {}, {
j: common_vendor.f(item.jobSpecialLabelNameArray, (itm, inx, i1) => {
return {
a: common_vendor.t(itm),
b: inx
};
}),
k: item.jobSpecialLabelNameArray && item.jobSpecialLabelNameArray.length == 0
}, item.jobSpecialLabelNameArray && item.jobSpecialLabelNameArray.length == 0 ? {} : {}, {
l: item.cus_price != "月薪"
}, item.cus_price != "月薪" ? {
m: item.cus_price
} : {
n: common_vendor.t(item.monthlyPay)
}, {
o: common_vendor.t(($props.recordStatus == 3 || $props.recordStatus == 4 || $props.recordStatus == 5) && !$props.isSelf ? "关注查看" : item.fuWuFei),
p: common_vendor.o(($event) => $options.handleCard(item, index), index)
}, $props.from == "mine" ? {
q: common_vendor.o(($event) => $options.recruitmentChange($event, item), index),
r: "8bf3f084-3-" + i0,
s: common_vendor.o(($event) => item.recruitmentValue = $event, index),
t: common_vendor.p({
showText: true,
openText: "开",
closeText: "停",
size: "44",
activeColor: "#07C160",
modelValue: item.recruitmentValue
}),
v: common_vendor.o(($event) => $options.showConfig(item), index)
} : {}, $props.from != "shareList" ? common_vendor.e({
w: $props.from != "chat"
}, $props.from != "chat" ? common_vendor.e({
x: common_vendor.t(item.fullName || item.agencyName || "-"),
y: common_vendor.o(($event) => $options.toApplyInfo(item), index),
z: $data.userinfo.agencyId == item.agencyId
}, $data.userinfo.agencyId == item.agencyId ? {
A: common_vendor.t(item.upFullName || item.upAgencyName || item.upProviderName || "-")
} : {}) : {}, {
B: $props.from == "chat"
}, $props.from == "chat" ? {
C: common_vendor.o(($event) => $options.sendJob(item), index),
D: "8bf3f084-4-" + i0,
E: common_vendor.p({
btnText: "发送",
fontSize: "14",
type: "primary",
size: "mini"
})
} : {}) : {}, {
F: common_vendor.o(() => {
}, index)
}, $props.from == "share" ? {
G: item.checked,
H: item.checked,
I: common_vendor.o(($event) => $options.checkJob(item), index)
} : {}, {
J: index
});
}),
k: $props.from == "mine",
l: $props.from != "shareList",
m: $props.from == "share",
n: common_vendor.n($props.from == "share" ? "g_pl_32" : ""),
o: $props.isShowLoginBtn && $data.jobArray.length > 0
}, $props.isShowLoginBtn && $data.jobArray.length > 0 ? {
p: common_vendor.o($options.successLogin)
} : {}, {
q: $data.jobArray && $data.jobArray.length > 0 && !$props.isShowLoginBtn && $props.from != "collect"
}, $data.jobArray && $data.jobArray.length > 0 && !$props.isShowLoginBtn && $props.from != "collect" ? {
r: common_vendor.p({
status: $options.status,
loadText: {
loadmore: "加载中",
loading: "加载中",
nomore: $props.speed + "个职位"
}
})
} : {}) : {}, {
s: common_vendor.o((...args) => $options.updateJob && $options.updateJob(...args)),
t: common_vendor.o((...args) => $options.delJob && $options.delJob(...args)),
v: common_vendor.o((...args) => $options.handleClose && $options.handleClose(...args)),
w: common_vendor.o($options.handleClose),
x: common_vendor.o(($event) => $data.popApply.isShow = $event),
y: common_vendor.p({
mode: "bottom",
["z-index"]: "999999",
["border-radius"]: "12",
closeable: false,
["mask-close-able"]: true,
modelValue: $data.popApply.isShow
})
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/list/job.js.map