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.
apply-assistant-v3/root/home/shareList.vue

199 lines
6.3 KiB
Vue

<template>
<view class="p-root-detail-apply g_w_all g_bg_f_5 g_kuaishou g_pt_10">
<g-list-job from="shareList" class="g_flex_1" :recordStatus="userRole.recordStatus" :list="query.list" @clickCard="goDetail" :loading="loading" :speed="speed" :query="query" :isShowLoginBtn="isLogin ? false : true" />
</view>
</template>
<script>
export default {
onReady() {
this.G.setNavStyle();
},
onShareAppMessage1() {
return this.G.shareFun();
},
data() {
return {
cdnBaseImg: this.G.store().cdnBaseImg,
agencyId: uni.getStorageSync("apply-agencyId"),
isAdmin: uni.getStorageSync("apply-userinfo").admin,
userRole: {},
shareUserInfo: {},
isCreator: false, //管理人员判断
speed: -1,
query: {
page: 1,
size: 20,
list: [],
isFinish: -1,
ujc: 0, // 0 全部 1收藏
},
isLogin: true,
loading: false,
QRCodeId: null,
};
},
onLoad(options) {
let that = this;
console.log("options", options);
if (options.scene) {
console.log("XXXXXXXXXXXX");
//扫小程序码携带参数
var sceneStr = decodeURIComponent(options.scene);
console.log(sceneStr);
var sceneJson = this.G.sceneToJson(sceneStr);
console.log("sceneJson===", sceneJson);
that.G.Get("/checkUserLogin", {}, (res) => {
console.log("checkUserLogin", res);
if (res) {
// 已登录状态
if (sceneJson.i) {
that.sceneStoreJobId = sceneJson.i;
let u = sceneJson.u.split("_");
that.shareUserInfo = {
agencyId: u[0],
agencyUserId: u[1],
};
that.getUserRole().then(() => {
that.getList();
});
} else {
that.QRCodeId = sceneJson.id;
that.getId().then(() => {
that.getUserRole().then(() => {
that.getList();
});
});
}
} else {
uni.reLaunch({
url: `/root/person/loginIndex?type=shareList&path=/root/home/shareList&scene=${JSON.stringify(sceneJson)}`,
});
}
});
// this.sceneStoreJobId = sceneJson.i;
// let u = sceneJson.u.split("_");
// this.sceneStoreJobId = sceneJson.u;
uni.setStorageSync("AGENCY_USER_ID", sceneJson.u);
// app.globalData.sceneStoreJobId = sceneJson.ids
}
// if (uni.getStorageSync("apply-userinfo")) {
// this.isLogin = true;
// } else {
// this.isLogin = false;
// }
},
onShow() {},
methods: {
getUserRole() {
let that = this;
return new Promise((resolve, reject) => {
this.G.Get(this.api.order_getAgencyByIdForApply, { agencyId: that.shareUserInfo.agencyId, inviteUserId: this.shareUserInfo.agencyUserId }, (res) => {
console.log("resresresresresres++++++++++++++", res);
that.userRole = res;
resolve();
});
});
},
getId() {
let that = this;
return new Promise((resolve, reject) => {
this.G.Get(this.api.common_getQRCode, { id: that.QRCodeId }, (res) => {
console.log("resresresresresres++++++++++++++", res);
let params = JSON.parse(res.params);
that.sceneStoreJobId = params.storeJobIds;
that.shareUserInfo = {
agencyId: params.agencyId,
agencyUserId: params.userId,
};
resolve();
});
});
},
getList($type = "init") {
let that = this;
that.G.Get(
that.api.get_sharejob_list,
{
storeJobIds: that.sceneStoreJobId,
},
(res) => {
console.log("一才职位列表:", res);
that.speed = res.list.length;
that.query.isFinish = res.list.length;
if (res.list && res.list.length > 0) {
res.list = that.G.toGetAddressv3(res.list);
res.list = that.G.toGetAge(res.list);
res.list = that.G.yijobCopy(res.list);
}
if ($type == "init") {
that.query.list = [];
that.query.list = res.list.map((item, index) => {
return {
...item,
title: item.jobName,
address: item.district + item.age,
price: item.salaryClassify != 7 ? that.G.getSalaryClassifyValue(item.salaryClassify, item.salaryClassifyValue) : that.G.getSalaryClassifyValue(item.salaryClassify, item.minMonthlyPay, item.maxMonthlyPay),
logo: item.agencyLogo,
time: that.G.setDeadLine(item.updateTime, "jiaofu"),
fuWuFei: that.G.setReturnFee(item.returnFee, item.returnFeeType),
gender: that.G.getGenderByMinAge(item),
leafCateId: item.id,
// serverPrice: that.tabInfo.list[that.tabInfo.active].tip == 2 ? that.G.setReturnFee(item.returnFee, item.returnFeeType) : that.G.setReturnFee(item.agencyReturnFee, item.agencyReturnFeeType),
serverPrice: that.G.setReturnFee(item.agencyReturnFee, item.agencyReturnFeeType),
recruitmentSwitch: item.recruitment == 1 ? true : false,
recruitmentImage: item.recruitment,
isToday: item.today == 0 ? false : true,
};
});
} else {
that.query.list = that.query.list.concat(
res.list.map((item, index) => {
return {
...item,
title: item.jobName,
address: item.district + item.age,
price: item.salaryClassify != 7 ? that.G.getSalaryClassifyValue(item.salaryClassify, item.salaryClassifyValue) : that.G.getSalaryClassifyValue(item.salaryClassify, item.minMonthlyPay, item.maxMonthlyPay),
logo: item.agencyLogo,
time: that.G.setDeadLine(item.updateTime, "jiaofu"),
fuWuFei: that.G.setReturnFee(item.returnFee, item.returnFeeType),
gender: that.G.getGenderByMinAge(item),
leafCateId: item.id,
// serverPrice: that.tabInfo.list[that.tabInfo.active].tip == 2 ? that.G.setReturnFee(item.returnFee, item.returnFeeType) : that.G.setReturnFee(item.agencyReturnFee, item.agencyReturnFeeType),
serverPrice: that.G.setReturnFee(item.agencyReturnFee, item.agencyReturnFeeType),
recruitmentSwitch: item.recruitment == 1 ? true : false,
recruitmentImage: item.recruitment,
isToday: item.today == 0 ? false : true,
};
})
);
}
}
);
},
goDetail($item) {
console.log("前往详情页", $item);
if (this.isLogin) {
uni.navigateTo({
// 职位id_职位创建方_分享人_分享人团队
url: `/root/detail/job?scene=id%3D${$item.id}_${$item.agencyId}_${this.shareUserInfo.agencyUserId}_${this.shareUserInfo.agencyId}`,
});
} else {
uni.navigateTo({
url: "/root/person/loginIndex",
});
}
},
},
};
</script>
<style lang="scss">
.p-root-detail-apply {
min-height: 100%;
}
</style>