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.
196 lines
5.6 KiB
Vue
196 lines
5.6 KiB
Vue
<template>
|
|
<div class="channel-page">
|
|
<div class="un-job g_h_all" v-if="notJob">
|
|
<img v-if="keys == '推荐'" class="" style="width: 100vw; height: 100vh" mode="aspectFill" :src="showImg" />
|
|
<div class="g_pt_12 g_text_c" v-if="keys == '联系'">
|
|
<div class="g_fs_20 g_fw_600 g_mb_24">添加微信联系我们</div>
|
|
<img class="" style="width: 70vw; height: 70vw" :src="showImg" :show-menu-by-longpress="true" />
|
|
</div>
|
|
</div>
|
|
<g-yi-list-job v-else from="home" class="g_h_all" :list="query.list" @clickCard="goDetail" :loading="loading" :speed="speed" :query="query" :isShowLoginBtn="false"
|
|
:class="pageTitle == '附近热招' ? 'g-components-panel-hr-avtive' : ''"
|
|
:isuse="pageTitle == '附近热招' ? 'fujin' : 'rijie'"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
var QQMapWX = require("../../utils/qqmap-wx-jssdk.min.js");
|
|
const app = getApp();
|
|
export default {
|
|
data() {
|
|
return {
|
|
loading: true,
|
|
query: {
|
|
page: 1,
|
|
size: 100,
|
|
list: [],
|
|
},
|
|
keys: "",
|
|
speed: -1,
|
|
isLogin: false,
|
|
notJob: false, // 是否是职位列表的判断
|
|
showImg: "",
|
|
currentInfo: {}, // 用户当前位置信息
|
|
currentStore: {},
|
|
pageTitle:''
|
|
};
|
|
},
|
|
created() {},
|
|
onLoad(options) {
|
|
let that = this;
|
|
console.log(options);
|
|
this.qqmapsdk = new QQMapWX({
|
|
key: "LHQBZ-MLTEG-BO4QK-QJ2TH-NLGZJ-7GFAS",
|
|
});
|
|
|
|
this.isLogin = uni.getStorageSync("apply-userinfo") ? true : false;
|
|
|
|
this.keys = options.keys;
|
|
uni.setNavigationBarTitle({
|
|
title: options.title,
|
|
});
|
|
that.pageTitle = options.title;
|
|
if (options.type == "job") {
|
|
console.log("job");
|
|
// 判断是附近还是日结
|
|
this.loading = true;
|
|
if(options.title == '附近热招'){
|
|
// 是附近,则先请求地址授权,再获取职位列表
|
|
that.getLocation().then((res) => {
|
|
that.keys = '';
|
|
that.getJob({
|
|
sortTag:2,
|
|
lng:that.currentInfo.longitude ? that.currentInfo.longitude : '',
|
|
lat:that.currentInfo.latitude ? that.currentInfo.latitude : ''
|
|
});
|
|
});
|
|
}else{
|
|
// 日结,直接请求职位列表
|
|
this.getJob();
|
|
}
|
|
} else if (options.type == "other") {
|
|
console.log("other");
|
|
this.notJob = true;
|
|
if (options.keys == "推荐") {
|
|
this.showImg = "https://matripe-cms.oss-cn-beijing.aliyuncs.com/pugongying/tuijian.jpg";
|
|
} else if (options.keys == "联系") {
|
|
this.showImg = "https://matripe-cms.oss-cn-beijing.aliyuncs.com/2023-06-14/411e860a-342b-4573-8acb-c4857cfdabde_柚子.jpg";
|
|
}
|
|
console.log("this.showImg", this.showImg);
|
|
}
|
|
},
|
|
methods: {
|
|
getLocation() {
|
|
let that = this;
|
|
return new Promise((resolve, reject) => {
|
|
uni.authorize({
|
|
// 检测是否授权位置信息
|
|
scope: "scope.userLocation",
|
|
success() {
|
|
console.log("用户成功授权位置信息");
|
|
uni.getLocation({
|
|
type: "wgs84",
|
|
success(res) {
|
|
that.currentInfo = {
|
|
latitude: res.latitude,
|
|
longitude: res.longitude,
|
|
};
|
|
console.log("获取当前经纬度:", that.currentInfo);
|
|
resolve();
|
|
},
|
|
fail(err) {
|
|
console.log(err);
|
|
},
|
|
complete() {
|
|
resolve();
|
|
},
|
|
});
|
|
},
|
|
fail(err) {
|
|
console.log(err);
|
|
console.log("用户拒绝授权位置信息,再次提示用户授权");
|
|
uni.showToast({
|
|
title: "请开启定位权限以显示距职位距离",
|
|
icon: "none",
|
|
});
|
|
resolve();
|
|
// that.showRefuseLocationPermission();
|
|
},
|
|
complete() {
|
|
console.log();
|
|
// resolve();
|
|
},
|
|
});
|
|
});
|
|
},
|
|
getJob($obj={}) {
|
|
let that = this;
|
|
that.G.Post(
|
|
that.api.yi_job_list,
|
|
Object.assign({
|
|
pageNum: that.query.page,
|
|
pageSize: that.query.size,
|
|
keys: that.keys,
|
|
},$obj),
|
|
(res) => {
|
|
console.log('列表',res);
|
|
that.query.isFinish = res.pageBean.recordList.length;
|
|
that.speed = res.pageBean.recordList.length;
|
|
if (res.pageBean.recordList && res.pageBean.recordList.length > 0) {
|
|
if(that.pageTitle == '附近热招'){
|
|
// 根据 distance 进行从小到大排序
|
|
res.pageBean.recordList.sort((a, b) => a.distance - b.distance);
|
|
}
|
|
|
|
|
|
res.pageBean.recordList = that.G.toGetAddress(res.pageBean.recordList);
|
|
res.pageBean.recordList = that.G.toGetAge(res.pageBean.recordList);
|
|
res.pageBean.recordList = that.G.yijobCopy(res.pageBean.recordList);
|
|
}
|
|
res.pageBean.recordList.forEach((item) => {
|
|
item.distance = item.distance;
|
|
item.liuNum = uni.getStorageSync("lin-liu") ? uni.getStorageSync("lin-liu") : Math.floor(Math.random() * 1000);
|
|
item.baoNum = uni.getStorageSync("lin-bao") ? uni.getStorageSync("lin-bao") / 10 : Math.ceil(item.liuNum / 10);
|
|
item.cus_price = item.salaryClassify != 7 ? that.G.getSalaryClassifyValueHtml(item.salaryClassify, item.salaryClassifyValue) : "月薪"
|
|
item.gender= that.G.getGenderByMinAge(item)
|
|
|
|
});
|
|
that.query.list = res.pageBean.recordList;
|
|
that.loading = false;
|
|
console.log("that.query.list", that.query.list);
|
|
console.log("that.query", that.query);
|
|
}
|
|
);
|
|
},
|
|
goDetail($item) {
|
|
console.log("前往详情页", $item);
|
|
uni.navigateTo({
|
|
url: "/root/detail/work?id=" + $item.id,
|
|
});
|
|
// if (this.isLogin) {
|
|
// uni.navigateTo({
|
|
// url: "/root/detail/work?id=" + $item.id,
|
|
// });
|
|
// } else {
|
|
// uni.navigateTo({
|
|
// url: "/pages/login/index",
|
|
// });
|
|
// }
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="less">
|
|
.channel-page {
|
|
min-height: 100vh;
|
|
background-color: #f5f5f5;
|
|
.g-components-panel-hr-avtive{
|
|
.g-components-panel-hr{
|
|
opacity: 0;
|
|
}
|
|
}
|
|
}
|
|
</style>
|