选择城市

cyl/master-0804
wangxia 8 months ago
parent e2000c389e
commit c8bad587f4

@ -1,87 +1,91 @@
<script lang="ts">
import RootStore from '@xkit-yx/im-store-v2'
import V2NIM, { V2NIMConst } from 'nim-web-sdk-ng/dist/v2/NIM_UNIAPP_SDK'
import { getMsgContentTipByType } from './pages/NEUIKit/utils/msg'
import { STORAGE_KEY } from './pages/NEUIKit/utils/constants'
import { isWxApp } from './pages/NEUIKit/utils'
import { V2NIMMessage, V2NIMMessagePushConfig } from 'nim-web-sdk-ng/dist/v2/NIM_UNIAPP_SDK/V2NIMMessageService'
import { unix } from 'dayjs'
import RootStore from "@xkit-yx/im-store-v2";
import V2NIM, { V2NIMConst } from "nim-web-sdk-ng/dist/v2/NIM_UNIAPP_SDK";
import { getMsgContentTipByType } from "./pages/NEUIKit/utils/msg";
import { STORAGE_KEY } from "./pages/NEUIKit/utils/constants";
import { isWxApp } from "./pages/NEUIKit/utils";
import { V2NIMMessage, V2NIMMessagePushConfig } from "nim-web-sdk-ng/dist/v2/NIM_UNIAPP_SDK/V2NIMMessageService";
import { unix } from "dayjs";
export default {
globalData: {
timer: null, //
themeColor: '#00b666',
themeBackgroundColor: '#00b66621',
themeColor: "#00b666",
themeBackgroundColor: "#00b66621",
},
onLaunch() {
let that = this;
uni.removeStorageSync("selectedCity");
},
onShow: function (options) {
let that = this
console.log('show 项目init', options, decodeURIComponent(options.query.scene))
let that = this;
console.log("show 项目init", options, decodeURIComponent(options.query.scene));
// id
uni.removeStorageSync('scene')
uni.removeStorageSync('user_scene')
uni.removeStorageSync('user_options', options)
uni.removeStorageSync("scene");
uni.removeStorageSync("user_scene");
uni.removeStorageSync("user_options", options);
if (options.query.id) {
uni.setStorageSync('apply-jobdetail-id', options.query.id)
uni.setStorageSync("apply-jobdetail-id", options.query.id);
} else {
uni.setStorageSync('apply-jobdetail-id', 0)
uni.setStorageSync("apply-jobdetail-id", 0);
}
if (options.query.scene) {
let str = decodeURIComponent(options.query.scene)
let str = decodeURIComponent(options.query.scene);
uni.setStorageSync(
'apply-invite-code',
"apply-invite-code",
JSON.stringify({
key: str.split('=')[0],
value: str.split('=')[1],
key: str.split("=")[0],
value: str.split("=")[1],
})
)
);
} else {
uni.setStorageSync('apply-invite-code', '')
uni.setStorageSync("apply-invite-code", "");
}
if (uni.getStorageSync('apply-token')) {
this.G.checkToken()
if (uni.getStorageSync("apply-token")) {
this.G.checkToken();
}
if (!that.globalData.timer) {
if (uni.getStorageSync('apply-token')) {
that.checkNum()
if (uni.getStorageSync("apply-token")) {
that.checkNum();
}
that.globalData.timer = setInterval(() => {
console.log('inner++++++++++++++++++++ +++++++++++++++++++++++++++')
if (uni.getStorageSync('apply-token')) {
that.checkNum()
console.log("inner++++++++++++++++++++ +++++++++++++++++++++++++++");
if (uni.getStorageSync("apply-token")) {
that.checkNum();
}
}, 1 * 30 * 1000)
}, 1 * 30 * 1000);
}
uni.$on('isGlogin', function (data) {
console.log('app.vue 接收', data)
if (uni.getStorageSync('apply-uid')) {
uni.$on("isGlogin", function (data) {
console.log("app.vue 接收", data);
if (uni.getStorageSync("apply-uid")) {
// that.initWyyx()
}
})
if (uni.getStorageSync('apply-token')) {
console.log('app.vue 是否调用')
});
if (uni.getStorageSync("apply-token")) {
console.log("app.vue 是否调用");
// that.initWyyx()
}
},
onHide: function () {},
methods: {
initWyyx() {
let that = this
let that = this;
that.F.wyyxPost(
that.api.wyyx_getConfig,
{
userId: uni.getStorageSync('apply-uid'),
userId: uni.getStorageSync("apply-uid"),
},
(res) => {
console.log('wyyx_getConfig', res)
console.log("wyyx_getConfig", res);
let resData = {
appkey: res.appKey,
accid: res.accid,
token: res.token,
}
};
const imOptions = {
appkey: resData.appkey, // appkey
account: resData.accid, // account
@ -89,40 +93,40 @@ export default {
// appkey: "7e19d679085266aa872a8de12f0c1ae5", // appkey
// account: "9", // account
// token: "2d4ca36cca6293cf3a81d6ca1b8026f7", // token
}
};
if (imOptions) {
this.initNim(imOptions)
this.initNim(imOptions);
} else {
// ,
}
}
)
);
},
async initNim(opts) {
let that = this
let that = this;
// nim sdk
const nim = (uni.$UIKitNIM = V2NIM.getInstance(
{
appkey: opts.appkey,
needReconnect: true,
// "reconnectionAttempts": 5,
debugLevel: 'debug',
apiVersion: 'v2',
debugLevel: "debug",
apiVersion: "v2",
enableV2CloudConversation: true,
},
{
V2NIMLoginServiceConfig: {
lbsUrls: isWxApp ? ['https://lbs.netease.im/lbs/wxwebconf.jsp'] : ['https://lbs.netease.im/lbs/webconf.jsp'],
linkUrl: isWxApp ? 'wlnimsc0.netease.im' : 'weblink.netease.im',
lbsUrls: isWxApp ? ["https://lbs.netease.im/lbs/wxwebconf.jsp"] : ["https://lbs.netease.im/lbs/webconf.jsp"],
linkUrl: isWxApp ? "wlnimsc0.netease.im" : "weblink.netease.im",
/**
* 使用固定设备 ID
*/
isFixedDeviceId: true,
},
}
))
));
that.globalData.nim = nim
that.globalData.nim = nim;
// store
const store = (uni.$UIKitStore = new RootStore(
@ -138,27 +142,27 @@ export default {
const pushContent = getMsgContentTipByType({
text: options.msg.text,
messageType: options.msg.messageType,
})
const yxAitMsg = options.serverExtension ? options.serverExtension.yxAitMsg : { forcePushIDsList: '[]', needForcePush: false }
});
const yxAitMsg = options.serverExtension ? options.serverExtension.yxAitMsg : { forcePushIDsList: "[]", needForcePush: false };
// at 线
const { forcePushIDsList, needForcePush } = yxAitMsg
? // @ts-ignore
store.msgStore._formatExtAitToPushInfo(yxAitMsg, options.msg.text)
: { forcePushIDsList: '[]', needForcePush: false }
: { forcePushIDsList: "[]", needForcePush: false };
console.log('forcePushIDsList: ', forcePushIDsList)
console.log("forcePushIDsList: ", forcePushIDsList);
const { conversationId } = options
const conversationType = nim.V2NIMConversationIdUtil.parseConversationType(conversationId)
const targetId = nim.V2NIMConversationIdUtil.parseConversationTargetId(conversationId)
const { conversationId } = options;
const conversationType = nim.V2NIMConversationIdUtil.parseConversationType(conversationId);
const targetId = nim.V2NIMConversationIdUtil.parseConversationTargetId(conversationId);
const pushPayload = JSON.stringify({
// oppo
oppoField: {
click_action_type: 4, // oppo
click_action_activity: '', // TODO
click_action_activity: "", // TODO
action_parameters: {
sessionId: targetId,
sessionType: conversationType,
@ -174,10 +178,10 @@ export default {
hwField: {
click_action: {
type: 1,
action: '', // TODO
action: "", // TODO
},
androidConfig: {
category: 'IM',
category: "IM",
data: JSON.stringify({
sessionId: targetId,
sessionType: conversationType,
@ -188,7 +192,7 @@ export default {
//
sessionId: targetId,
sessionType: conversationType,
})
});
const pushConfig: V2NIMMessagePushConfig = {
pushEnabled: true,
@ -196,99 +200,99 @@ export default {
forcePush: needForcePush,
forcePushContent: pushContent,
forcePushAccountIds: forcePushIDsList,
pushPayload: '{}',
pushPayload: "{}",
pushContent,
}
};
return { ...options, pushConfig }
return { ...options, pushConfig };
},
},
'UniApp'
))
"UniApp"
));
// #ifdef APP-PLUS
const nimPushPlugin = uni.requireNativePlugin('NIMUniPlugin-PluginModule')
const nimPushPlugin = uni.requireNativePlugin("NIMUniPlugin-PluginModule");
nim.V2NIMSettingService.setOfflinePushConfig(nimPushPlugin, {
miPush: {
appId: '2882303761520397320',
appKey: '5102039734320',
certificateName: 'xiaomiCertificateName',
appId: "2882303761520397320",
appKey: "5102039734320",
certificateName: "xiaomiCertificateName",
},
vivoPush: {
certificateName: 'vivoCertificateName',
certificateName: "vivoCertificateName",
},
oppoPush: {
appId: '32967155',
appKey: 'b98618cb272944dea324af6421d42a79',
secret: '0b7ce705a2304a17b78f20011c18890c',
certificateName: 'opopCertificateName',
appId: "32967155",
appKey: "b98618cb272944dea324af6421d42a79",
secret: "0b7ce705a2304a17b78f20011c18890c",
certificateName: "opopCertificateName",
},
honorPush: {
certificateName: 'rongyaoCertificateName',
certificateName: "rongyaoCertificateName",
},
apns: {
// certificateName: 'AuthKey_98P8URRXUD_test', //:
certificateName: 'AuthKey_98P8URRXUD', //
certificateName: "AuthKey_98P8URRXUD", //
},
})
console.log('是否执行 推送')
});
console.log("是否执行 推送");
// #endif
nim.V2NIMLoginService.login(opts.account, opts.token).then(() => {})
nim.V2NIMLoginService.login(opts.account, opts.token).then(() => {});
nim.V2NIMConversationService.on('onConversationChanged', function (conversationList: V2NIMConversation[]) {
console.log('初始化监听会话:', conversationList)
nim.V2NIMConversationService.on("onConversationChanged", function (conversationList: V2NIMConversation[]) {
console.log("初始化监听会话:", conversationList);
let _bool = conversationList.filter((item) => {
return Number(item.unreadCount) > 0
})
console.log('初始化监听会话bool:', _bool)
return Number(item.unreadCount) > 0;
});
console.log("初始化监听会话bool:", _bool);
if (_bool && _bool.length > 0) {
that.playAudio() //
that.playAudio(); //
}
})
});
},
playAudio() {
let that = this
const innerAudioContext = uni.createInnerAudioContext()
innerAudioContext.autoplay = true
innerAudioContext.src = 'https://matripe-cms.oss-cn-beijing.aliyuncs.com/ibocai/tip.mp3'
let that = this;
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.src = "https://matripe-cms.oss-cn-beijing.aliyuncs.com/ibocai/tip.mp3";
innerAudioContext.onPlay(() => {
console.log('开始播放')
})
uni.vibrateShort()
console.log("开始播放");
});
uni.vibrateShort();
innerAudioContext.onError((res) => {
console.log(res.errMsg)
console.log(res.errCode)
})
console.log(res.errMsg);
console.log(res.errCode);
});
},
checkNum() {
let that = this
if (uni.getStorageSync('apply-token')) {
let that = this;
if (uni.getStorageSync("apply-token")) {
that.G.Get(that.api.bind_getApplyNum, {}, (res) => {
console.log('获取待处理数量:', res)
console.log("获取待处理数量:", res);
if (res.approvePassHasNotRed > 0) {
uni.setTabBarBadge({
index: 2,
text: String(res.approvePassHasNotRed),
})
});
} else {
uni.removeTabBarBadge({
index: 2,
})
});
}
})
});
}
},
},
}
};
</script>
<style lang="scss">
@import './static/css/iconfont.css';
@import './uni_modules/vk-uview-ui/index.scss';
@import './static/css/base.scss';
@import './static/font/iconfont-weapp-icon.css';
@import "./static/css/iconfont.css";
@import "./uni_modules/vk-uview-ui/index.scss";
@import "./static/css/base.scss";
@import "./static/font/iconfont-weapp-icon.css";
// #ifdef MP-WEIXIN
page {

@ -17,6 +17,9 @@ let jobInfo = {
yi_job_class_new: "/labels/getListByTypeAndIndustry", // 新职位要求接口(新)
job_get_cus: "/yishoudan/job/customer/support/getJobCustomerSupportIM", // 获取客服ID
hasSee: "/yishoudan/job/view/record/addRecord",
getCityNameByLatLng: '/location/getCityNameByLatLng' ,// 根据经纬度获取城市
get_city_list: '/city/getAllCityLevel2', // 获取城市列表
}
export default jobInfo;

@ -457,6 +457,12 @@
"navigationBarTitleText": "搜索"
}
},
{
"path": "city",
"style": {
"navigationBarTitleText": "选择城市"
}
},
{
"path": "error",
"style": {

@ -10,11 +10,19 @@
<!-- `calc(${navInfo.windowHeight}px - ${navInfo.navigationBarHeight + navInfo.statusBarHeight}px)` -->
<scroll-view class="m-list" id="listBox" :scroll-into-view="scrollTo" :style="{ height: `calc(${navInfo.windowHeight}px)` }" :scroll-y="true" @scrolltolower="reachBottom">
<div class hover-class="none" hover-stop-propagation="false">
<div class="g_position_rela">
<div class="g_position_rela g_flex_row_between">
<div class="the_city g_flex_column_center" style hover-class="thover" @click="goCity">
<div class="g_flex_row_center">
<div class="g_fs_16 g_fw_600 g_ml_10" style="min-width: 36px; display: inline-block">{{ selectedCity }}</div>
<div class="g_flex_column_center">
<div class="iconfont icon-zhankai g_fs_12" style="display: inline-block"></div>
</div>
</div>
</div>
<!-- 搜索区 -->
<div class="m-search g_p_10 g_pt_8 g_position_rela bg_shawdoc" style id="searchInputBox">
<u-search height="80" v-model="keyword" class="g_flex_1" placeholder="搜索职位名称" bg-color="#fff" :show-action="false" placeholder-class="g_c_c" search-icon-color="#999999" :maxlength="20"></u-search>
<div class="g_w_all g_h_40 g_position_abso" style="left: 0; z-index: 9999; top: 0; height: 100%" @click.stop="goSearch"></div>
<div class="m-search g_p_10 g_pt_8 g_position_rela g_flex_1 bg_shawdoc" style id="searchInputBox">
<u-search height="80" v-model="keyword" @input="checkLength" @clear="searchJob" @search="searchJob" class="" placeholder="搜索职位名称" bg-color="#fff" :show-action="false" placeholder-class="g_c_c" search-icon-color="#999999" :maxlength="20"></u-search>
<!-- <div class="g_w_all g_h_40 g_position_abso" style="left: 0; z-index: 9999; top: 0; height: 100%" @click.stop="goSearch"></div> -->
</div>
</div>
<div>
@ -89,7 +97,6 @@
<div class="g_h_8"></div>
<g-list-job from="home" @uploadList="getList" bg="#ededed" class="g_h_all" :list="query.list" :active="tabInfo.active" @shareJob="shareJob" :loading="loading" :speed="speed" :query="query" :isShowLoginBtn="isLogin ? false : true" :emptyText="isLogin ? (tabInfo.active == 0 || tabInfo.active == 2 ? '嘿,这里还没有数据呢' : '您还未收藏职位,快去试试收藏职位吧') : '你好,此服务仅限人力资源行业受邀商家登录,请确认'" />
</div>
</div>
</scroll-view>
<div hover-class="none" style="position: fixed; right: 20px; bottom: 20px" hover-stop-propagation="false" @click="toRecord" v-if="isLogin">
@ -125,51 +132,113 @@
<script>
export default {
onReady() {
this.G.setNavStyle('home')
this.G.setNavStyle("home");
},
onShareAppMessage() {
return {
title: ' ',
imageUrl: 'https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/APP/shareCard0609.png',
}
title: " ",
imageUrl: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/APP/shareCard0609.png",
};
// return this.G.shareFun();
},
onLoad() {
let that = this
that.navInfo = that.G.getNavInfo()
that.tabInfo.active = 0
let that = this;
that.navInfo = that.G.getNavInfo();
that.tabInfo.active = 0;
that.isLogin = uni.getStorageSync("apply-token");
if (!that.isLogin) {
that.loading = false;
that.speed = 0;
setTimeout(() => {
that.computeCode = 1;
}, 100);
} else {
that.getList();
if (uni.getStorageSync("SHOW_INVITE_ALL")) {
if (uni.getStorageSync("SHOW_INVITE_ALL") == 1 && uni.getStorageSync("SHOW_INVITE") == 1) {
that.getInviteList();
}
}
console.log('uni.getStorageSync("apply-supplierAccount")', uni.getStorageSync("apply-supplierAccount"));
if (uni.getStorageSync("apply-supplierAccount") == 1) {
//
that.tabInfo.list = [
{
name: "关注",
num: 0,
tip: 0,
classify: 2,
},
{
name: "收藏",
num: 0,
tip: 1,
classify: 3,
},
{
name: "我的",
num: 0,
tip: 2,
classify: 99,
},
];
// that.tabInfo.active = 0;
that.isShowTab = true;
} else {
//
that.tabInfo.list = [
{
name: "关注",
num: 0,
tip: 0,
classify: 2,
},
{
name: "收藏",
num: 0,
tip: 1,
classify: 3,
},
];
// that.tabInfo.active = 0;
that.isShowTab = false;
}
}
// #ifdef MP-WEIXIN
// this.searchAnimate();
// #endif
},
data() {
return {
scrollTo: '',
scrollTo: "",
selectedCity: "全国",
getFilterData: {
sex: '-1',
ageRangeStr: '',
jobCategoryLabelIds: '',
jobSpecialLabelIds: '',
sex: "-1",
ageRangeStr: "",
jobCategoryLabelIds: "",
jobSpecialLabelIds: "",
jobSpecialLabelObjects: [],
jobCategoryLabelObjects: [],
},
background: {
backgroundColor: '#caf1e0',
backgroundColor: "#caf1e0",
},
customList: [
{
icon: 'icon-saoyisao-hui',
title: '扫一扫',
icon: "icon-saoyisao-hui",
title: "扫一扫",
tip: 0,
},
{
icon: 'icon-saoyisao-hui',
title: '发布职位',
icon: "icon-saoyisao-hui",
title: "发布职位",
tip: 0,
},
{
icon: 'icon-saoyisao-hui',
title: '发展代理',
icon: "icon-saoyisao-hui",
title: "发展代理",
tip: 0,
},
],
@ -200,23 +269,23 @@ export default {
isFinish: -1,
sortTag: 2,
},
keyword: '',
keyword: "",
tabInfo: {
list: [
{
name: '关注',
name: "关注",
num: 0,
tip: 0,
classify: 2,
},
{
name: '收藏',
name: "收藏",
num: 0,
tip: 1,
classify: 3,
},
{
name: '我的',
name: "我的",
num: 0,
tip: 2,
classify: 1,
@ -227,176 +296,128 @@ export default {
sortList: {
list: [
{
name: '按工价',
name: "按工价",
key: 1,
showName: '按工价',
showName: "按工价",
},
{
name: '按佣金',
name: "按佣金",
key: 3,
showName: '按佣金',
showName: "按佣金",
},
{
name: '按时间',
name: "按时间",
key: 0,
showName: '按时间',
showName: "按时间",
},
],
active: 2,
},
}
};
},
watch: {
'tabInfo.list': {
"tabInfo.list": {
handler(val) {
console.log('tabInfo.list', val)
console.log("tabInfo.list", val);
},
deep: true,
immediate: true,
},
showPop(val) {
if (val) {
uni.hideTabBar()
uni.hideTabBar();
} else {
uni.showTabBar()
uni.showTabBar();
}
},
},
computed: {},
onShow() {
let that = this
that.isLogin = uni.getStorageSync('apply-token')
if (!that.isLogin) {
that.loading = false
that.speed = 0
setTimeout(() => {
that.computeCode = 1
}, 100)
} else {
that.getList()
if (uni.getStorageSync('SHOW_INVITE_ALL')) {
if (uni.getStorageSync('SHOW_INVITE_ALL') == 1 && uni.getStorageSync('SHOW_INVITE') == 1) {
that.getInviteList()
}
let that = this;
if (that.isLogin) {
that.loadSelectedCityFromCache();
}
console.log('uni.getStorageSync("apply-supplierAccount")', uni.getStorageSync('apply-supplierAccount'))
if (uni.getStorageSync('apply-supplierAccount') == 1) {
//
that.tabInfo.list = [
{
name: '关注',
num: 0,
tip: 0,
classify: 2,
},
{
name: '收藏',
num: 0,
tip: 1,
classify: 3,
},
{
name: '我的',
num: 0,
tip: 2,
classify: 99,
},
]
// that.tabInfo.active = 0;
that.isShowTab = true
} else {
//
that.tabInfo.list = [
{
name: '关注',
num: 0,
tip: 0,
classify: 2,
},
{
name: '收藏',
num: 0,
tip: 1,
classify: 3,
},
]
// that.tabInfo.active = 0;
that.isShowTab = false
}
}
this.$forceUpdate()
},
onReachBottom() {
let that = this
console.log('onReachBottom', that.query.isFinish)
this.G.isLogin()
let that = this;
console.log("onReachBottom", that.query.isFinish);
this.G.isLogin();
if (this.G.isLogin()) {
console.log('that.query.size', that.query.size)
console.log("that.query.size", that.query.size);
if (that.query.isFinish == -1 || that.query.isFinish == that.query.size) {
that.query.page++
that.getList('concat')
that.query.page++;
that.getList("concat");
}
}
},
methods: {
loadSelectedCityFromCache() {
// 'selectedCity'
const cachedCity = wx.getStorageSync("selectedCity");
if (cachedCity) {
if (this.selectedCity != cachedCity) {
this.selectedCity = cachedCity;
this.getList();
}
}
},
handleOpenCamera() {
let that = this
that.G.handleScanCode()
let that = this;
that.G.handleScanCode();
},
goPage($path) {
uni.navigateTo({
url: $path,
})
});
},
reachBottom() {
let that = this
console.log('onReachBottom', that.query.isFinish)
this.G.isLogin()
let that = this;
console.log("onReachBottom", that.query.isFinish);
this.G.isLogin();
if (this.G.isLogin()) {
console.log('that.query.size', that.query.size)
console.log("that.query.size", that.query.size);
if (that.query.isFinish == -1 || that.query.isFinish == that.query.size) {
that.query.page++
that.getList('concat')
that.query.page++;
that.getList("concat");
}
}
},
getList($type = 'init') {
let that = this
this.loading = true
console.log('job_list __F________________________', 1)
let time = new Date().getTime()
getList($type = "init") {
let that = this;
this.loading = true;
console.log("job_list __F________________________", 1);
let time = new Date().getTime();
that.G.Post(
that.api.job_list,
{
...that.getFilterData,
pageNum: that.query.page,
pageSize: that.query.size,
agencyId: that.tabInfo.active == 2 ? uni.getStorageSync('apply-agencyId') : '',
agencyId: that.tabInfo.active == 2 ? uni.getStorageSync("apply-agencyId") : "",
classify: that.tabInfo.list[that.tabInfo.active].classify,
sortTag: that.query.sortTag,
keys: that.keyword,
cityName: that.selectedCity == "全国" ? "" : that.selectedCity,
},
(res) => {
that.computeCode = 1
console.log('job_list __________________________', (new Date().getTime() - time) / 1000)
that.computeCode = 1;
console.log("job_list __________________________", (new Date().getTime() - time) / 1000);
// res.recordCount = 0;
// res.recordList = [];
if (res.recordCount == 0) {
that.loading = false
that.loading = false;
} else {
that.loading = true
}
that.speed = res.recordCount
that.query.isFinish = res.recordList.length
res.recordList = that.G.toGetAddressv3(res.recordList)
res.recordList = that.G.toGetAge(res.recordList)
res.recordList = that.G.yijobCopy(res.recordList)
if ($type == 'init') {
that.query.list = []
that.loading = true;
}
that.speed = res.recordCount;
that.query.isFinish = res.recordList.length;
res.recordList = that.G.toGetAddressv3(res.recordList);
res.recordList = that.G.toGetAge(res.recordList);
res.recordList = that.G.yijobCopy(res.recordList);
if ($type == "init") {
that.query.list = [];
if (res.recordList.length > 0) {
that.query.list = res.recordList.map((item, index) => {
// console.log(item)
@ -406,7 +427,7 @@ export default {
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'),
time: that.G.setDeadLine(item.updateTime, "jiaofu"),
fuWuFei: that.G.setReturnFee(item.returnFee, item.returnFeeType),
gender: that.G.getGenderByMinAge(item),
leafCateId: item.id,
@ -417,8 +438,8 @@ export default {
active: that.tabInfo.active,
isToday: item.today == 0 ? false : true,
tip: that.tabInfo.list[that.tabInfo.active].tip,
}
})
};
});
}
} else {
that.query.list = that.query.list.concat(
@ -430,7 +451,7 @@ export default {
fuWuFei: that.G.setReturnFee(item.returnFee, item.returnFeeType),
gender: that.G.getGenderByMinAge(item),
logo: item.agencyLogo,
time: that.G.setDeadLine(item.updateTime, 'jiaofu'),
time: that.G.setDeadLine(item.updateTime, "jiaofu"),
leafCateId: item.id,
serverPrice: that.G.setReturnFee(item.agencyReturnFee, item.agencyReturnFeeType),
recruitmentSwitch: item.recruitment == 1 ? true : false,
@ -438,23 +459,23 @@ export default {
active: that.tabInfo.active,
isToday: item.today == 0 ? false : true,
tip: that.tabInfo.list[that.tabInfo.active].tip,
}
};
})
)
);
}
console.log('首页 列表:', that.query.list)
console.log("首页 列表:", that.query.list);
}
)
);
},
/**
* 获取邀请关注列表
*/
getInviteList() {
let that = this
let that = this;
uni.showLoading({
title: '加载中...',
title: "加载中...",
mask: true,
})
});
that.G.Get(
that.api.user_getInviteList,
{
@ -462,37 +483,37 @@ export default {
pageNum: that.attentionConfig.num,
},
(res) => {
console.log(res)
console.log(res);
if (that.attentionList.length > 0) {
res.forEach((item) => {
item.checked = false
})
that.attentionList.concat(res)
item.checked = false;
});
that.attentionList.concat(res);
} else {
that.attentionList = res
that.attentionList = res;
that.attentionList.forEach((item) => {
item.checked = false
})
item.checked = false;
});
}
if (that.attentionList.length > 0) {
that.showPop = true
uni.removeStorageSync('SHOW_INVITE')
uni.setStorageSync('watch_invite', 2)
that.showPop = true;
uni.removeStorageSync("SHOW_INVITE");
uni.setStorageSync("watch_invite", 2);
}
uni.hideLoading()
uni.hideLoading();
}
)
return
);
return;
},
/**
* 搜索框的滚动监听变化
*/
searchAnimate() {
let that = this
let that = this;
uni
.createSelectorQuery()
.select('#listBox')
.select("#listBox")
.fields(
{
scrollOffset: true,
@ -500,43 +521,43 @@ export default {
},
(res) => {
that.$mp.page.animate(
'#searchInputBox',
"#searchInputBox",
[
{
top: '10px',
width: '100%',
top: "10px",
width: "100%",
},
{
top: '-48px',
width: '70%',
top: "-48px",
width: "70%",
},
],
800,
{
scrollSource: '#listBox',
scrollSource: "#listBox",
timeRange: 1000,
startScrollOffset: 0,
endScrollOffset: 60,
}
)
);
that.$mp.page.animate(
'.the_city',
".the_city",
[
{
color: '#333',
color: "#333",
},
{
color: '#fff',
color: "#fff",
},
],
500,
{
scrollSource: '#listBox',
scrollSource: "#listBox",
timeRange: 1000,
startScrollOffset: 0,
endScrollOffset: 90,
}
)
);
// that.$mp.page.animate(
// ".daotian",
// [
@ -557,216 +578,234 @@ export default {
// );
}
)
.exec()
.exec();
},
/**
* 跳转快速报名
*/
toRecord() {
uni.navigateTo({
url: '/root/home/quickApplication?title=快速报名',
})
url: "/root/home/quickApplication?title=快速报名",
});
},
shareJob(e) {
console.log(e)
this.currentJob = e
console.log(e);
this.currentJob = e;
},
/**
* 跳转搜索页
*/
goSearch() {
this.G.isLogin()
this.G.isLogin();
if (this.G.isLogin()) {
uni.navigateTo({
url: '/root/other/search?from=home',
})
url: "/root/other/search?from=home",
});
}
},
handleUpdateTab(e) {
console.log('e', e)
this.G.isLogin()
console.log("e", e);
this.G.isLogin();
if (this.G.isLogin()) {
console.log('一级tab切换')
this.tabInfo.active = e
this.speed = -1
this.loading = true
this.query.page = 1
this.getList()
console.log("一级tab切换");
this.tabInfo.active = e;
this.speed = -1;
this.loading = true;
this.query.page = 1;
this.getList();
} else {
console.log('请先登录')
console.log("请先登录");
}
},
checkAllChange(e) {
console.log(e)
console.log(e);
this.attentionList.forEach((item) => {
item.checked = e.value
})
this.upInfo = this.getListNum()
item.checked = e.value;
});
this.upInfo = this.getListNum();
},
checkChange(e) {
console.log(e)
console.log(this.attentionList)
var check = true
console.log(e);
console.log(this.attentionList);
var check = true;
this.attentionList.forEach((item) => {
if (item.id == e.id) {
item.checked = !item.checked
item.checked = !item.checked;
}
if (item.checked === false) {
check = false
check = false;
}
})
this.checkAll = check
this.upInfo = this.getListNum()
});
this.checkAll = check;
this.upInfo = this.getListNum();
},
getListNum() {
let num = 0
let list = []
let num = 0;
let list = [];
this.attentionList.forEach((item) => {
if (item.checked) {
num++
list.push(item.id)
num++;
list.push(item.id);
}
})
});
return {
num,
list,
}
};
},
submitInfo() {
let that = this
let that = this;
if (this.upInfo.num <= 0) {
uni.showToast({
title: '请至少选择一个',
icon: 'none',
})
return false
title: "请至少选择一个",
icon: "none",
});
return false;
}
uni.showLoading({
title: '正在关注',
})
title: "正在关注",
});
that.G.Post(
that.api.user_updateInviteId,
{
agencyIds: that.upInfo.list.join(','),
agencyIds: that.upInfo.list.join(","),
},
(res) => {
console.log(res)
console.log(res);
uni.showToast({
title: '关注成功',
icon: '',
title: "关注成功",
icon: "",
duration: 1000,
complete: function () {
// uni.hideLoading();
that.showPop = false
that.showPop = false;
},
})
});
}
)
);
// setTimeout(() => {}, 2000);
},
onScrollToLower() {
console.log(123)
let that = this
console.log(123);
let that = this;
that.attentionConfig.num++
this.getInviteList()
that.attentionConfig.num++;
this.getInviteList();
},
/**
* 筛选相关========================================================
*/
deleteSex() {
console.log('deleteSex')
this.getFilterData.sex = -1
this.getList()
console.log("deleteSex");
this.getFilterData.sex = -1;
this.getList();
},
deleteAge() {
console.log('deleteAge')
this.getFilterData.ageRangeStr = ''
this.getList()
console.log("deleteAge");
this.getFilterData.ageRangeStr = "";
this.getList();
},
deleteJobCategoryLabel(id) {
console.log(id)
this.getFilterData.jobCategoryLabelObjects = this.getFilterData.jobCategoryLabelObjects.filter((obj) => obj.id != id)
console.log(id);
this.getFilterData.jobCategoryLabelObjects = this.getFilterData.jobCategoryLabelObjects.filter((obj) => obj.id != id);
const idsArray = this.getFilterData.jobCategoryLabelObjects.map((obj) => obj.id)
const idsArray = this.getFilterData.jobCategoryLabelObjects.map((obj) => obj.id);
//
this.getFilterData.jobCategoryLabelIds = idsArray.join(',')
console.log('deleteJobCategoryLabel', this.getFilterData)
this.getFilterData.jobCategoryLabelIds = idsArray.join(",");
console.log("deleteJobCategoryLabel", this.getFilterData);
this.getList()
this.getList();
},
deleteJobSpecialLabel(id) {
this.getFilterData.jobSpecialLabelObjects = JSON.parse(JSON.stringify(this.getFilterData.jobSpecialLabelObjects.filter((obj) => obj.id != id)))
const idsArray = this.getFilterData.jobSpecialLabelObjects.map((obj) => obj.id)
this.getFilterData.jobSpecialLabelObjects = JSON.parse(JSON.stringify(this.getFilterData.jobSpecialLabelObjects.filter((obj) => obj.id != id)));
const idsArray = this.getFilterData.jobSpecialLabelObjects.map((obj) => obj.id);
//
this.getFilterData.jobSpecialLabelIds = idsArray.join(',')
console.log('deleteJobSpecialLabel', this.getFilterData)
this.getList()
this.getFilterData.jobSpecialLabelIds = idsArray.join(",");
console.log("deleteJobSpecialLabel", this.getFilterData);
this.getList();
},
clearFilter1() {
var that = this
this.getFilterData.jobCategoryLabelIds = ''
this.getFilterData.jobSpecialLabelIds = ''
this.getFilterData.jobCategoryLabelObjects = []
this.getFilterData.jobSpecialLabelObjects = []
this.scrollTo = ''
this.getFilterData.sex = -1
this.getFilterData.ageRangeStr = ''
console.log('this.getFilterData', this.getFilterData)
this.$refs.filterChild.clearFilter()
this.getList()
var that = this;
this.getFilterData.jobCategoryLabelIds = "";
this.getFilterData.jobSpecialLabelIds = "";
this.getFilterData.jobCategoryLabelObjects = [];
this.getFilterData.jobSpecialLabelObjects = [];
this.scrollTo = "";
this.getFilterData.sex = -1;
this.getFilterData.ageRangeStr = "";
console.log("this.getFilterData", this.getFilterData);
this.$refs.filterChild.clearFilter();
this.getList();
setTimeout(() => {
that.scrollTo = 'listBox'
console.log('aaaaaaaaa')
}, 1)
that.scrollTo = "listBox";
console.log("aaaaaaaaa");
}, 1);
},
receiveFromChild(data) {
console.log(data)
this.whichOneShow = ''
this.query.page = 1
this.getFilterData = JSON.parse(JSON.stringify(data))
console.log('getFilterData in receiveFromChild', this.getFilterData)
this.getList()
console.log(data);
this.whichOneShow = "";
this.query.page = 1;
this.getFilterData = JSON.parse(JSON.stringify(data));
console.log("getFilterData in receiveFromChild", this.getFilterData);
this.getList();
// this.messageFromChild = data.message;
},
chooseNl(type) {
let that = this
that.scrollTo = ''
that.whichOneShow = that.whichOneShow == type ? '' : type
let that = this;
that.scrollTo = "";
that.whichOneShow = that.whichOneShow == type ? "" : type;
setTimeout(() => {
that.scrollTo = 'tttop'
}, 1)
that.scrollTo = "tttop";
}, 1);
},
/**
* 筛选相关================================================end
*/
sortJob(ind) {
let that = this
this.sortList.active = ind
this.query.sortTag = this.sortList.list[ind].key
this.whichOneShow = ''
let that = this;
this.sortList.active = ind;
this.query.sortTag = this.sortList.list[ind].key;
this.whichOneShow = "";
if (this.query.sortTag === 2) {
// 60 * 60 * 24
if (that.currentInfo.latitude && new Date().getTime() - that.currentInfo.timestamp < 1000 * 10) {
console.log('inTime')
this.getList()
console.log("inTime");
this.getList();
} else {
console.log('outTime')
console.log("outTime");
this.getLocation().then(() => {
this.getList()
})
this.getList();
});
}
} else {
this.getList()
this.getList();
}
},
checkLength(e) {
console.log("e", e);
console.log("keyword", this.keyword);
if (e.length == 0) {
this.keyword = "";
this.searchJob();
}
},
searchJob() {
this.query.list = [];
this.query.page = 1;
this.getList();
},
}
goCity() {
uni.navigateTo({
url: "/root/other/city",
});
},
},
};
</script>
<style lang="scss">

@ -0,0 +1,255 @@
<template>
<view class="g_pl_16 container" style="background-color: #f5f5f5">
<scroll-view class="cities-scroll" scroll-with-animation="true" style="box-sizing: border-box; height: calc(100vh - 87px)" :scroll-into-view="az" scroll-y ref="scrollViewRef">
<view class="">
<view class="headTxt">当前城市</view>
<view class="" hover-class="none" hover-stop-propagation="false">
<view @click="selectQuanGuo" class="itemCity" :class="{ active: selectedCity === '全国' }">全国</view>
<view class="g_flex_row_center itemCity" v-if="currentCity" @click="selectCity({ shortName: currentCity })" :class="{ active: selectedCity === currentCity }">
<i class="iconfont icon-dizhi1 g_mr_4"></i>
{{ currentCity }}
</view>
</view>
<view class="cities-list">
<block v-for="group in cities">
<view class="headTxt" :id="`letter-${group.name[0] == '热' ? 're' : group.name[0]}`">{{ group.name }}</view>
<block v-for="city in group.list">
<view @click="selectCity(city)" class="itemCity" :class="{ active: selectedCity === city.shortName }">{{ city.shortName }}</view>
</block>
</block>
</view>
</view>
<view class="" style="height: 120px"> </view>
</scroll-view>
<!-- 添加字母索引 -->
<view class="index-list" v-if="false">
<block v-for="(letter, index) in letters">
<!-- , activeIndex: currentIndex === index -->
<view :class="{ indexItem: true }" @click="scrollToLetter(letter)">
{{ letter }}
</view>
</block>
</view>
<g-panel-fixed>
<view class="g_flex_row_center">
<g-button btnText="重置" size="small" @clickBtn="back"></g-button>
<g-button btnText="确定" type="primary" class="g_ml_24" size="small" @clickBtn="setCity"></g-button>
</view>
</g-panel-fixed>
</view>
</template>
<script>
// import { cityList } from "../utils/city.js";
export default {
data() {
return {
cities: [],
cdnBaseImg: this.G.store().cdnBaseImg,
selectedCity: "全国",
currentIndex: 0,
letters: [],
az: "",
currentInfo: {}, //
currentCity: "",
};
},
onLoad() {
this.initializeCities();
this.getLocation().then((res) => {
console.log("res", res);
this.getCity();
});
// this.calculateLetters();
},
methods: {
setCity() {
uni.setStorageSync("selectedCity", this.selectedCity);
console.log(`城市 ${this.selectedCity} 已保存到缓存`);
uni.navigateBack({ delta: 1 });
},
getCity() {
let that = this;
this.G.Get(this.api.getCityNameByLatLng, { lng: this.currentInfo.longitude, lat: this.currentInfo.latitude }, (res) => {
if (res) {
that.currentCity = res.replace("市", "");
}
console.log("res");
});
},
getLocation() {
let that = this;
console.log("123123");
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,
timestamp: new Date().getTime(),
};
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();
},
});
});
},
back() {
this.selectedCity = "全国";
uni.setStorageSync("selectedCity", "全国");
// uni.navigateBack({ delta: 1 });
},
selectQuanGuo() {
this.selectedCity = "全国";
console.log("全国被选中");
},
selectCity(city) {
this.selectedCity = city.shortName;
console.log(`城市 ${city.shortName} 被选中`);
},
initializeCities() {
this.G.Get(this.api.get_city_list, {}, (res) => {
console.log(res);
this.letters.push("热");
res.forEach((item) => {
if (!this.letters.includes(item.name[0])) {
this.letters.push(item.name[0]);
}
});
this.cities = res;
const cachedSelectedCity = uni.getStorageSync("selectedCity");
if (cachedSelectedCity) {
this.selectedCity = cachedSelectedCity;
} else {
this.selectedCity = "全国";
}
});
// const hotCities = originalCities.find(group => group.name === '');
// if (hotCities) {
// hotCities.name = '';
// this.cities = originalCities.filter(group => group.name !== '');
// this.cities.unshift(hotCities);
// } else {
// this.cities = originalCities;
// }
},
// calculateLetters() {
// this.letters = [];
// this.cities.forEach((group) => {
// const firstLetter = group.name.charAt(0).toUpperCase();
// if (!this.letters.includes(firstLetter)) {
// this.letters.push(firstLetter);
// }
// });
// },
scrollToLetter(letter) {
var that = this;
if (letter == "热") {
letter = "re";
}
const id = `letter-${letter}`;
console.log(id);
this.az = id;
// console.log(that.$refs.scrollViewRef);
// this.$nextTick(() => {
// this.$refs.scrollViewRef.scrollIntoView(id, 300);
// });
},
},
};
</script>
<style lang="scss">
.container {
.itemCity {
width: calc(33.33% - 10px);
float: left;
margin-right: 10px;
background: #fff;
border-radius: 30px;
font-size: 16px;
font-weight: 400;
text-align: center;
padding: 8px 0;
color: #1d1d1d;
margin-bottom: 10px;
line-height: 20px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
&.active {
background: #00b666;
color: #ffffff;
}
}
.headTxt {
font-size: 18px;
font-weight: 400;
color: #999999;
line-height: 25px;
margin-top: 10px;
margin-left: 16px;
margin-bottom: 10px;
clear: both;
}
.cities-scroll {
// height: calc(100vh - 100px);
// overflow-y: auto;
}
.index-list {
position: fixed;
right: 10px;
top: 50%;
transform: translateY(-50%);
display: flex;
flex-direction: column;
align-items: center;
background-color: #f5f5f5;
.indexItem {
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
margin: 2px;
&.activeIndex {
background: #00b666;
color: #ffffff;
}
}
}
}
</style>
Loading…
Cancel
Save