选择城市

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

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

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

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

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